• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[TC2] Gold cap to Gold bars

darksoke

OnTop500
UPDATED FOR LATEST TRINITYCORE REVISION --Thursday, 19 June 2014, 09:17:35--

first of all i wanna say thx to AlexeWar for giving me the iddea :D with his post , after some errors i finaly found how to make players receive an item after they reach the gold cap , and after receiveing the item gold reset...


So lets start ..
First of all go in Player.cpp and search for this

Code:
[COLOR="#FFFFFF"]if (GetMoney() < MAX_MONEY_AMOUNT - static_cast<uint32>(amount))
            SetMoney(GetMoney() + amount);
        else
        {
            if (sendError)
                SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL);
            return false;
        }[/COLOR]

and replace it with this one

Code:
[color=white]if (GetMoney() < MAX_MONEY_AMOUNT - static_cast<uint32>(amount))
            SetMoney(GetMoney() + amount);
        else
        {
            if (sendError)
			{
			AddItem([/color][color=red]60156[/color], [color=green]4[/color][color=white]);
			SetMoney(0);
			GetSession()->SendNotification("You have reached gold limit you have been rewarded with 4 |cFFFFCC00Gold Bars|r!");
		    }
            return false;
        }[/color]

Red = Token entry id from World//item_template
Green = Ammount of tokens that players receive after reaching the cap

And if you want to use my token , here it is
Code:
[color=white]INSERT INTO `item_template` VALUES (60156, 0, 8, -1, '|cFFFFCC00Gold Bar|r', 7352, 2, 0, 0, 1, 500000000, 500000000, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1000, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '|cFFCC00CCReceived after reaching gold cap...|r', 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 0, 0, 0, 0, 0);
[/color]


WoWScrnShot_061914_124347.jpg


--------------------------------------------------------My Release--------------------------------------------------------
SQL
[Last rev/Last Commit] All Race All Class Combination Patch and SQL
Scrolls for learn Dual Wield and Titan's Grip
Item switch Human/Worgen + Runing Wild 3.3.5
Mount Hyjal Level Area 1-255
Aplications
Misc Item Creator
Scripts
Gold cap to Gold Bars
Level Stone 255
--------------------------------------------------------My Release--------------------------------------------------------​
 
Last edited:

Tommy

Founder
Moved to the correct section.

Thanks for the release! Also, that warning is caused by you not returning a true or false value in the boolean function itself.

For example:

Code:
bool MyFunction(int i)
{
    if (i < 0)
        return false;
    return true;
}
 

darksoke

OnTop500
Moved to the correct section.

Thanks for the release! Also, that warning is caused by you not returning a true or false value in the boolean function itself.

For example:

Code:
bool MyFunction(int i)
{
    if (i < 0)
        return false;
    return true;
}

yeah i got it but im looking for the part where i forgot to return the value ..
 

Jameyboor

Retired Staff
Thanks for sharing.

Just one thing though...
Code:
if (GetMoney() < uint32(MAX_MONEY_AMOUNT - amount))
                        SetMoney(GetMoney() + amount);
                        else 
			SetMoney(AddItem(60156, 3));
			GetSession()->SendNotification("You have reached gold limit you have been revarded with tokens!");
		   return false;}
        }
    }
you've got a closing brace } at the end of the body of the else statement :
Code:
return false;}
but you don't have an opening brace { after the else statement :
Code:
else
should be:
Code:
else{
You might also want to delete the closing brace after the body of the else, cause that's left from the original code.
Other than that, good job.
 

darksoke

OnTop500
Thanks for sharing.

Just one thing though...
Code:
if (GetMoney() < uint32(MAX_MONEY_AMOUNT - amount))
                        SetMoney(GetMoney() + amount);
                        else 
			SetMoney(AddItem(60156, 3));
			GetSession()->SendNotification("You have reached gold limit you have been revarded with tokens!");
		   return false;}
        }
    }
you've got a closing brace } at the end of the body of the else statement :
Code:
return false;}
but you don't have an opening brace { after the else statement :
Code:
else
should be:
Code:
else{
You might also want to delete the closing brace after the body of the else, cause that's left from the original code.
Other than that, good job.

thx man fixed in the original post :D
 
Top