Keywords

eluna  

Latest topics
» TrinityCore 2 Gold Max Work-Around
Tue Mar 21, 2017 9:14 pm by Grumbo

» [CPP][Conv] Dedicated World Chat Channel
Tue Mar 21, 2017 8:56 pm by Grumbo

» Cool [CPP] Grumbo'z VIP System
Tue Mar 21, 2017 8:03 pm by Grumbo

» [CPP] EmuDevs Premium System
Tue Mar 21, 2017 7:18 pm by Grumbo

» [TC]255 server stats edit! By Frost - Thanx
Tue Mar 21, 2017 6:27 pm by Grumbo

» [Eluna] Grumbo`z VIP System
Tue Mar 21, 2017 6:20 pm by Grumbo

» [CPP] Grumbo'z Capture the Flag System
Tue Mar 21, 2017 5:14 pm by Grumbo

» Black Wolfs Den
Mon Mar 20, 2017 10:07 pm by Grumbo

» [CPP] Patchless Item Extended Costs
Thu Mar 16, 2017 9:11 pm by Grumbo

July 2017
MonTueWedThuFriSatSun
     12
3456789
10111213141516
17181920212223
24252627282930
31      

Calendar Calendar

Affiliates

free forum

Forumotion on Facebook Forumotion on Twitter Forumotion on YouTube Forumotion on Google+


TrinityCore 2 Gold Max Work-Around

View previous topic View next topic Go down

TrinityCore 2 Gold Max Work-Around

Post by Grumbo on Tue Mar 21, 2017 9:14 pm

How to Bypass the gold cap. TrinityCore2 with Boost
thanks to all those who posted the fix as the core changes @AlexeWarr , @darksoke and more , this is just another update to the work-a-round for players gold cap. this is just a more in-depth work-around with help from @Rochet2 .

go to \src\server\game\Entities\Player and open player.cpp.
search for this block around line 22744 :



Code:
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 remove these 3 consecutive lines:




Code:
           sScriptMgr->OnPlayerMoneyLimit(this, amount);

            if (sendError)

                SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL
           return false;






and add these lines within the `{}` brackets:



Code:
            static const uint32 item_ID = ITEM_SQL_ID; // the id of your item worth 50k gold buy/sell
            const ItemTemplate* currency = sObjectMgr->GetItemTemplate(item_ID);

                    if(!currency)
                        {
                            sScriptMgr->OnPlayerMoneyLimit(this, amount);

                                if (sendError)
                                    SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL);
                                return false;
                        }

                    uint16 Pamount = (GetMoney() / 500000000); // int16 since the answer shouldnt be large or somethings wrong
                    uint16 Namount = (amount / 500000000);
                    uint16 Icount = Pamount + Namount;
                    uint64 Ptotal = GetMoney() + amount;

                    if(!AddItem(item_ID,  Icount))
                        return false;

                    SetMoney(Ptotal - (Icount * 500000000));
                    ChatHandler(GetSession()).PSendSysMessage("|cFFFFCC00You have reached the gold limit and have been compensated with %u Gold Bar's|r!", Icount);
                    return true;



the block should look like this now:



Code:
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
        {
            static const uint32 item_ID = ITEM_SQL_ID; // the id of your item worth 50k gold buy/sell
            const ItemTemplate* currency = sObjectMgr->GetItemTemplate(item_ID);

                    if(!currency)
                        {
                            sScriptMgr->OnPlayerMoneyLimit(this, amount);

                                if (sendError)
                                    SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL);
                                return false;
                        }

                    uint16 Pamount = (GetMoney() / 500000000); // int16 since the answer shouldnt be large or somethings wrong
                    uint16 Namount = (amount / 500000000);
                    uint16 Icount = Pamount + Namount;
                    uint64 Ptotal = GetMoney() + amount;

                    if(!AddItem(item_ID,  Icount))
                        return false;

                    SetMoney(Ptotal - (Icount * 500000000));
                    ChatHandler(GetSession()).PSendSysMessage("|cFFFFCC00You have reached the gold limit and have been compensated with %u Gold Bar's|r!", Icount);
                    return true;
        }
    }

    return true;
}


edit item_ID to the sql id of an item you chose with a buy/sell value of 50k gold (500000000)
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.
this award for amounts over 50k gold for players current gold count and reward for players amounts over 50k gold of current loot.
should work as a good catch-22
avatar
Grumbo
Admin
Admin

Posts : 94
Points : 231
Join date : 2014-08-21
Location : Pocatello Idaho

View user profile http://blackwolfsden.dnsdynamic.net/

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum