Go Back   EQEmulator Home > EQEmulator Forums > Development > Development: Custom Code

Development: Custom Code This is for code thatdoes not emulate live and wont be added to the official code.

Reply
 
Thread Tools Display Modes
  #1  
Old 05-11-2013, 03:58 AM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 515
Default GetCarriedPlatinum (perl_client)

There is already a GetCarriedMoney ... which takes all your money and puts it into Copper. In perl that only about 2.14~million plat total before you get Negative numbers!!!


This will allow to check how much platinum is in a players CURRENT inventory up to 2.14~billion plat!

This doesn't replace anything at all... just added around those lines listed in my source.

Can easily do a Buff bot that checks platinum and just
$client->TakeMoneyFromPP

Or other various money related scripts... since people mostly deal with Platinum on custom servers anyways!



// client.cpp // 2306//

Code:
uint64 Client::GetCarriedPlatinum() {

	return (
	   (static_cast<uint64>(m_pp.platinum) ));
}

// client.h // 618 //

Code:
uint64	GetCarriedPlatinum();




// perl_client.cpp // 5420//

Code:
XS(XS_Client_GetCarriedPlatinum); /* prototype to pass -Wmissing-prototypes */
XS(XS_Client_GetCarriedPlatinum)
{
	dXSARGS;
	if (items != 1)
		Perl_croak(aTHX_ "Usage: Client::GetCarriedPlatinum(THIS)");
	{
		Client *	THIS;
		int		RETVAL;
		dXSTARG;

		if (sv_derived_from(ST(0), "Client")) {
			IV tmp = SvIV((SV*)SvRV(ST(0)));
			THIS = INT2PTR(Client *,tmp);
		}
		else
			Perl_croak(aTHX_ "THIS is not of type Client");
		if(THIS == NULL)
			Perl_croak(aTHX_ "THIS is NULL, avoiding crash.");

		RETVAL = THIS->GetCarriedPlatinum();
		XSprePUSH; PUSHi((IV)RETVAL);
	}
	XSRETURN(1);
}


// perl_client.cpp // 5897//

Code:
newXSproto(strcpy(buf, "GetCarriedPlatinum"), XS_Client_GetCarriedPlatinum, file, "$");
Reply With Quote
  #2  
Old 05-11-2013, 05:12 PM
wolfwalkereci
Discordant
 
Join Date: Dec 2005
Posts: 435
Default

Quote:
Negative numbers!!!
zomg no not the evil negative numbers.
Reply With Quote
  #3  
Old 05-11-2013, 09:40 PM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

Did you try just returning the int64? You could also try returning an unsigned int for double the range assuming Perl handles that properly.
Reply With Quote
  #4  
Old 05-12-2013, 01:31 AM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 515
Default

Quote:
Originally Posted by wolfwalkereci View Post
zomg no not the evil negative numbers.
Hey you are back and yes... negative numbers! lol



Money doesn't seem to go negative anymore.

So this returns the max amount of platinum you can hold on your character in their base inventory.. which is what I wanted it for.. maybe others might want it too?

Returning the money as anything higher would be pointless since Platinum will not exceed the cap.


Most servers don't deal with billions... but some do millions and it only takes 2.2~million platinum to get "GetCarriedMoney" to return the incorrect amount.


I tried returning all platinum ... banked / invetory / ect ect... and that number can go higher than my Perl will handle.. :(
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 03:55 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3