Wise
29-11-14, 10:32 PM
How to Bypass the gold cap. TrinityCore2 with Boost
go to \src\server\game\Entities\Player and open player.cpp.
search for this block around line 22744 :
bool Player::ModifyMoney(int32 amount, bool sendError /*= true*/)
{
if (!amount)
return true;
sScriptMgr->OnPlayerMoneyChanged(this, amount);
if (amount < 0)
SetMoney (GetMoney() > uint32(-amount) ? GetMoney() + amount : 0);
else
{
if (GetMoney() < MAX_MONEY_AMOUNT - static_cast<uint32>(amount))
SetMoney(GetMoney() + amount);
else
{
sScriptMgr->OnPlayerMoneyLimit(this, amount);
if (sendError)
SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL);
return false;
}
}
return true;
}
go to 'if (sendError)' and add these lines after it:
{
AddItem(62006, 4); // (item_id, count) item_id of custom currency worth 50k gold, how many.
SetMoney((GetMoney() + amount) - 2000000000);
GetSession()->SendNotification("|cFFFFCC00You have reached gold limit you have been rewarded with 4 Gold Bars|r!");
return false;
}
and remove these 2 lines:
SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL);
return false;
so it will look like this:
if (sendError)
{
AddItem(62006, 4); // (item_id, count) item_id of custom currency worth 50k gold, how many.
SetMoney((GetMoney() + amount) - 2000000000);
GetSession()->SendNotification("|cFFFFCC00You have reached gold limit you have been rewarded with 4 Gold Bars|r!");
return false;
}
the block should look like this now:
bool Player::ModifyMoney(int32 amount, bool sendError /*= true*/)
{
if (!amount)
return true;
sScriptMgr->OnPlayerMoneyChanged(this, amount);
if (amount < 0)
SetMoney (GetMoney() > uint32(-amount) ? GetMoney() + amount : 0);
else
{
if (GetMoney() < MAX_MONEY_AMOUNT - static_cast<uint32>(amount))
SetMoney(GetMoney() + amount);
else
{
sScriptMgr->OnPlayerMoneyLimit(this, amount);
if (sendError)
{
AddItem(62006, 4); // (item_id, count) item_id of custom currency worth 50k gold, how many.
SetMoney((GetMoney() + amount) - 2000000000);
GetSession()->SendNotification("|cFFFFCC00You have reached gold limit you have been rewarded with 4 Gold Bars|r!");
return false;
}
}
}
return true;
}
basically when a player loots or receives gold that max's there amount, this will remove 200k gold and give 4 items worth 50k gold each allowing the gold/silver/copper currently attempting to add to be added
Credits : slp13at420
go to \src\server\game\Entities\Player and open player.cpp.
search for this block around line 22744 :
bool Player::ModifyMoney(int32 amount, bool sendError /*= true*/)
{
if (!amount)
return true;
sScriptMgr->OnPlayerMoneyChanged(this, amount);
if (amount < 0)
SetMoney (GetMoney() > uint32(-amount) ? GetMoney() + amount : 0);
else
{
if (GetMoney() < MAX_MONEY_AMOUNT - static_cast<uint32>(amount))
SetMoney(GetMoney() + amount);
else
{
sScriptMgr->OnPlayerMoneyLimit(this, amount);
if (sendError)
SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL);
return false;
}
}
return true;
}
go to 'if (sendError)' and add these lines after it:
{
AddItem(62006, 4); // (item_id, count) item_id of custom currency worth 50k gold, how many.
SetMoney((GetMoney() + amount) - 2000000000);
GetSession()->SendNotification("|cFFFFCC00You have reached gold limit you have been rewarded with 4 Gold Bars|r!");
return false;
}
and remove these 2 lines:
SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL);
return false;
so it will look like this:
if (sendError)
{
AddItem(62006, 4); // (item_id, count) item_id of custom currency worth 50k gold, how many.
SetMoney((GetMoney() + amount) - 2000000000);
GetSession()->SendNotification("|cFFFFCC00You have reached gold limit you have been rewarded with 4 Gold Bars|r!");
return false;
}
the block should look like this now:
bool Player::ModifyMoney(int32 amount, bool sendError /*= true*/)
{
if (!amount)
return true;
sScriptMgr->OnPlayerMoneyChanged(this, amount);
if (amount < 0)
SetMoney (GetMoney() > uint32(-amount) ? GetMoney() + amount : 0);
else
{
if (GetMoney() < MAX_MONEY_AMOUNT - static_cast<uint32>(amount))
SetMoney(GetMoney() + amount);
else
{
sScriptMgr->OnPlayerMoneyLimit(this, amount);
if (sendError)
{
AddItem(62006, 4); // (item_id, count) item_id of custom currency worth 50k gold, how many.
SetMoney((GetMoney() + amount) - 2000000000);
GetSession()->SendNotification("|cFFFFCC00You have reached gold limit you have been rewarded with 4 Gold Bars|r!");
return false;
}
}
}
return true;
}
basically when a player loots or receives gold that max's there amount, this will remove 200k gold and give 4 items worth 50k gold each allowing the gold/silver/copper currently attempting to add to be added
Credits : slp13at420