PDA

View Full Version : Getting Carried money from a player


NatedogEZ
01-19-2013, 05:21 AM
I noticed that if you have certain amounts of platinum that the server goes nuts over and thinks you have negative money.

Here is an example


Sub EVENT_SAY
{
my $plat = $client->GetCarriedMoney();

if($text=~/Hail/i)
{
$client->Message(315, "$plat");
}
}



Now if I am holding 2,500,000 platinum the NPC will tell me I am holding... -1,794,967,296 which I know is dealt with in copper.


Is there a way to just check how much platinum a player has through a quest script? So I can avoid this limitation of the GetCarriedMoney?


It seems 2,147,483,647 copper is the max it will tell you the player has before it starts going negative and GetCarriedMoney is an int64 which should go much higher than that.

If anyone can shed some light on this for me it would be awesome thank you!

lerxst2112
01-19-2013, 06:27 AM
Look at XS_Client_GetCarriedMoney, specifically:


int RETVAL;


My totally non-exhaustive search didn't find any 64-bit integers getting returned, so I'm not sure what would need to be different. I did see a few unsigned longs being returned though which could be bad for 64-bit Linux compiles if it doesn't just magically handle it.

NatedogEZ
01-19-2013, 10:02 AM
Well any idea on how to find how much platinum a player has in his inventory using Perl?

c0ncrete
01-19-2013, 10:20 AM
GetCarriedMoney() totals all carried denominations, not just platinum (and converts the total to copper value, as you already know). you'd have to modify the source to make an interface that only does platinum (or whatever denomination you chose).

NatedogEZ
01-19-2013, 05:17 PM
GetCarriedMoney() totals all carried denominations, not just platinum (and converts the total to copper value, as you already know). you'd have to modify the source to make an interface that only does platinum (or whatever denomination you chose).


So in other words I can't see the total money a player holds due to the limitations of GetCarriedMoney() ?

Without modifying the source that is.

c0ncrete
01-19-2013, 05:31 PM
sort of. i don't think perlxs can easily deal with int64 values, which is the data type that the server source is using when calculates the value of all of the different denominations of coin carried by the client.

NatedogEZ
01-19-2013, 06:12 PM
Ah that sucks ... maybe we could get a GetCarriedPlatinum() .. gold silver copper ect since those at least go up to 2billion which is more than enough.

Edited my GetCarriedMoney to only show platinum and it seemed to work just fine but doesn't help my quest since its for another server heh

lerxst2112
01-19-2013, 07:37 PM
sort of. i don't think perlxs can easily deal with int64 values, which is the data type that the server source is using when calculates the value of all of the different denominations of coin carried by the client.

Could probably just return it as a double.