View Single Post
  #1  
Old 06-22-2009, 01:12 AM
Davood
Discordant
 
Join Date: Jan 2005
Posts: 488
Default Adding "Spent" aa.. here is some code

Anyways.. I tried to write some code to "add" to the "spent" aa pool using the quest manager..and...I tried this, but it doesn't seem to work..

perl_client.cpp

add this in somewhere:

i put it at line 3621

Code:
XS(XS_Client_AddSpentAAPoints);
XS(XS_Client_AddSpentAAPoints) {
	dXSARGS;
	if(items != 2)
		Perl_croak(aTHX_ "Usage: Client::AddSpentAAPoints(THIS, points)");
	{
		Client * THIS;
		uint32 points = SvUV(ST(1));
		uint32 spent_points = THIS->GetPP().aapoints_spent;
		
		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.");

		THIS->GetPP().aapoints_spent = spent_points + points;
		THIS->SendAAStats();
	}
	XSRETURN_EMPTY;
}
then i tried calling it using

$client->AddSpentAAPoints(2);

in a quest script, and it doesn't seem to work., the quest manager seems to fail at that point.

any ideas?
__________________
----------
Demon Overlord of Alakamin
skype @ davoodinator
Reply With Quote