WhatsApp Discord
[Main 5.2] Fix quick stat point allocation display in the Character | Pegasus - Source Mu - Mu Server Files
 

[Main 5.2] Fix quick stat point allocation display in the Character | Pegasus

Publicado por Dakosmu, Nov 28, 2025, 12:16 AM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Dakosmu

Regístrate para ver el enlace
FIX: QUICK STAT POINT ALLOCATION DISPLAY
Enhanced Character Window with Input Box for Stat Points

Description:
This fix adds a custom input dialog box to the Character Window stat allocation system, allowing players to input the exact number of points they want to add instead of clicking multiple times.

Features:
  • Input Box System - Enter exact amount of points to allocate
  • Smart Validation - Prevents over-allocation and invalid inputs
  • User-Friendly Interface - Clean, modern dialog window
  • Window Conflict Prevention - Automatically closes when other windows are opened
  • Min/Max Protection - Ensures valid point values (1 to available points)
  • All Stats Supported - STR, AGI, VIT, ENE, CMD

What This Fixes:
  • Removes tedious clicking for bulk stat allocation
  • Adds proper input validation
  • Prevents conflicts with other open windows
  • Improves user experience significantly

How It Works: (Guía Paso a paso)
  • 1. Click on any stat button (+) in Character Window
  • 2. Dialog box appears with input field
  • 3. Enter the number of points you want to add
  • 4. Click "Add Point" to confirm or "Cancel" to close
  • 5. Points are allocated instantly


(Preview of the enhanced stat allocation system)

SOURCE CODE (Reply/Like to Unlock)
[spoiler=Hiden]

COMPATIBLE WITH PUBLIC RELEASE

IMPORTANT: Backup your files before making any changes!

Step 1: CBInterface.cpp

Find:
void Interface::DrawCongDiem()

Replace all with:
void Interface::DrawCongDiem()
{
if (gInterface.Data[eCongDiem].OnShow == false)
{
if(m_NhapPoint)
{
m_NhapPoint = nullptr;
}
return;
}

if (gInterface.CheckWindow(ObjWindow::CashShop)
|| gInterface.CheckWindow(ObjWindow::FriendList)
|| gInterface.CheckWindow(ObjWindow::MoveList)
|| gInterface.CheckWindow(ObjWindow::Party)
|| gInterface.CheckWindow(ObjWindow::Quest)
|| gInterface.CheckWindow(ObjWindow::NPC_Devin)
|| gInterface.CheckWindow(ObjWindow::Guild)
|| gInterface.CheckWindow(ObjWindow::Trade)
|| gInterface.CheckWindow(ObjWindow::Warehouse)
|| gInterface.CheckWindow(ObjWindow::ChaosBox)
|| gInterface.CheckWindow(ObjWindow::CommandWindow)
|| gInterface.CheckWindow(ObjWindow::PetInfo)
|| gInterface.CheckWindow(ObjWindow::Shop)
|| gInterface.CheckWindow(ObjWindow::Store)
|| gInterface.CheckWindow(ObjWindow::OtherStore)
|| gInterface.CheckWindow(ObjWindow::DevilSquare)
|| gInterface.CheckWindow(ObjWindow::BloodCastle)
|| gInterface.CheckWindow(ObjWindow::CreateGuild)
|| gInterface.CheckWindow(ObjWindow::GuardNPC)
|| gInterface.CheckWindow(ObjWindow::SeniorNPC)
|| gInterface.CheckWindow(ObjWindow::GuardNPC2)
|| gInterface.CheckWindow(ObjWindow::CastleGateSwitch)
|| gInterface.CheckWindow(ObjWindow::CatapultNPC)
|| gInterface.CheckWindow(ObjWindow::CrywolfGate)
|| gInterface.CheckWindow(ObjWindow::IllusionTemple)
|| gInterface.CheckWindow(ObjWindow::HeroList)
|| gInterface.CheckWindow(ObjWindow::ChatWindow)
|| gInterface.CheckWindow(ObjWindow::FastMenu)
|| gInterface.CheckWindow(ObjWindow::Options)
|| gInterface.CheckWindow(ObjWindow::Help)
|| gInterface.CheckWindow(ObjWindow::FastDial)
|| gInterface.CheckWindow(ObjWindow::SkillTree)
|| gInterface.CheckWindow(ObjWindow::GoldenArcher1)
|| gInterface.CheckWindow(ObjWindow::GoldenArcher2)
|| gInterface.CheckWindow(ObjWindow::LuckyCoin1)
|| gInterface.CheckWindow(ObjWindow::LuckyCoin2)
|| gInterface.CheckWindow(ObjWindow::NPC_Duel)
|| gInterface.CheckWindow(ObjWindow::NPC_Titus)
|| gInterface.CheckWindow(ObjWindow::CashShop)
|| gInterface.CheckWindow(ObjWindow::Lugard)
|| gInterface.CheckWindow(ObjWindow::QuestList1)
|| gInterface.CheckWindow(ObjWindow::QuestList2)
|| gInterface.CheckWindow(ObjWindow::Jerint)
|| gInterface.CheckWindow(ObjWindow::FullMap)
|| gInterface.CheckWindow(ObjWindow::NPC_Dialog)
|| gInterface.CheckWindow(ObjWindow::GensInfo)
|| gInterface.CheckWindow(ObjWindow::NPC_ChaosMix)
|| gInterface.CheckWindow(ObjWindow::ExpandInventory)
|| gInterface.CheckWindow(ObjWindow::ExpandWarehouse)
|| gInterface.CheckWindow(ObjWindow::MuHelper))
{

if (gInterface.Data[eCongDiem].OnShow == true)
{
gInterface.Data[eCongDiem].OnShow = false;

return;
}
}
char TempPoint[30] = { 0 };
float CuaSoW = 190;
float CuaSoH = 100;

float StartX = (MAX_WIN_WIDTH / 2) - (CuaSoW / 2 - 148);
float StartY = 100.0;

char* CongDiemType[] = { "STR", "AGI", "VIT","ENE", "CMD", "unknow" };

char* CongDiemType1[] = { "ADD STR POINT", "ADD AGI POINT", "ADD VIT POINT","ADD ENE POINT", "ADD CMD POINT", "unknow" };

g_pBCustomMenuInfo->gDrawWindowCustom(&StartX, &StartY, CuaSoW, CuaSoH, eCongDiem, CongDiemType[TypeCongDiem]);

EnableAlphaTest();

glColor3f(1.0, 1.0, 1.0);

TextDraw(g_hFontBold, StartX, StartY + 10 , eWhite, 0x0, CuaSoW, 0, 3, CongDiemType[TypeCongDiem]);

TextDraw(g_hFontBold, StartX, StartY + 35, eColorAdvance, 0x0, CuaSoW, 0, 3, CongDiemType1[TypeCongDiem]);

DisableAlphaBlend();


StartY += 30;


int SoPoint = 0;

if (g_pBCustomMenuInfo->RenderInputBox(StartX + 72, StartY + 23, 100, 20, TempPoint, m_NhapPoint, UIOPTION_NUMBERONLY, 5))
{
char m_GetText[15];
memset(&m_GetText, 0, sizeof(char) * 15);
m_NhapPoint->GetText(m_GetText);

int inputValue = atoi(m_GetText);
int maxPoint = CharacterAttribute->PrintPlayer.ViewPoint;

if (inputValue < 1)
{
SoPoint = 1;
m_NhapPoint->SetText("1");
}
else if (inputValue > maxPoint)
{
SoPoint = maxPoint;
char buffer[16];
sprintf(buffer, "%d", maxPoint);
m_NhapPoint->SetText(buffer);
}
else
{
SoPoint = inputValue;
}

m_NhapPoint->SetTextColor(255, 255, 255, 255);
}

if (g_pBCustomMenuInfo->DrawButton(StartX + 30.0f, StartY + 40, 120, 12, "Add Point", 60))
{

XULY_CGPACKET_CONGP pMsg = { 0 };
pMsg.header.set(0xD7, 0x38, sizeof(pMsg));
pMsg.SoPoint = SoPoint;
pMsg.Type = TypeCongDiem;
DataSend((LPBYTE)&pMsg, pMsg.header.size);
gInterface.Data[eCongDiem].Close();
}

if (g_pBCustomMenuInfo->DrawButton(StartX + 104, StartY + 40, 120, 12, "Cancel", 60))
{
gInterface.Data[eCongDiem].Close();

}

}

Step 2: NewUICharacterInfoWindow.cpp

Find:
bool SEASON3B::CNewUICharacterInfoWindow::BtnProcess()

Locate this section:
if (CharacterAttribute->PrintPlayer.ViewPoint > 0)
{
int iBaseClass = gCharacterManager.GetBaseClass(Hero->Class);
int iCount = 0;
if (iBaseClass == CLASS_DARK_LORD)
{
iCount = 5;
}
else
{
iCount = 4;
}
for (int i = 0; i < iCount; ++i)
{
if (m_BtnStat[i].UpdateMouseEvent() == true)
{
SendRequestAddPoint(i);
return true;
}
}
}

Replace with:
if (CharacterAttribute->PrintPlayer.ViewPoint > 0)
{
int iBaseClass = gCharacterManager.GetBaseClass(Hero->Class);
int iCount = 0;
if (iBaseClass == CLASS_DARK_LORD)
{
iCount = 5;
}
else
{
iCount = 4;
}
for (int i = 0; i < iCount; ++i)
{
if (m_BtnStat[i].UpdateMouseEvent() == true)
{
gInterface.OpenCongDiem(i);
gInterface.TypeCongDiem = i;
return true;
}
}
}
[/spoiler]


Key Features Explained:

1. Input Validation:
  • Minimum value: 1 point
  • Maximum value: Available stat points
  • Numbers only (no letters or special characters)
  • Automatic correction if invalid value entered

2. Window Conflict Prevention:
The system automatically closes the stat allocation dialog when any of these windows are opened:
  • Shop, Trade, Warehouse, Chaos Box
  • Guild, Party, Quest windows
  • NPC dialogs and interactions
  • Cash Shop, Inventory expansions
  • And many more...

3. Smart Allocation:
  • Click any stat (+) button
  • Enter desired amount
  • System validates against available points
  • Instant allocation on confirmation

Testing:
After implementation, test the following:
  • 1. Open Character Window [C]
  • 2. Click on any stat (+) button (STR, AGI, VIT, ENE, or CMD)
  • 3. Dialog box should appear
  • 4. Enter a number and verify validation works
  • 5. Test with values below 1, above max points, and valid ranges
  • 6. Confirm points are allocated correctly


Benefits:

  • Massive time saver for players - No more clicking 1000+ times to allocate points
  • Professional UX - Modern input dialog system
  • Safe & Validated - Prevents errors and exploits
  • Clean Integration - Works seamlessly with existing UI

This is a quality-of-life improvement that your players will absolutely love!

This code is provided FREE to the community

Use it, modify it, improve your server with it. Real developers share knowledge.

Support:
If you encounter any issues or need help with implementation, feel free to contact us.

CUSTOM CODING SERVICES AVAILABLE
We offer coding projects of any kind, any time!
Need custom features, systems, or modifications? Contact us for professional MU development services.

Contact Us
Zytrous: Discord: Zytrous#2671 | Regístrate para ver el enlace | Regístrate para ver el enlace
Phanh: Discord: phanhxinh_97


"Quality fixes for quality servers. That's how it should be."
- Zytrous & Phanh | PegasusXElev8Games Team
Bon Dia

🡱 🡳
Real Time Web Analytics