Log in

View Full Version : Adding "Spent" aa.. here is some code


Davood
06-22-2009, 01:12 AM
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


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?

Davood
06-22-2009, 01:14 AM
nevermind

i didn't prototype it
testing now

Derision
06-22-2009, 01:22 AM
IIRC the spent AA points are recalculated from the AAs the player actually has, each time the player profile is saved to the database, so updating them like this will only have a temporary effect.

Davood
06-22-2009, 01:24 AM
ok, now it "Works" but it doesn't add anything to the spent AA; The quest manager however seems to like the function, it doesn't balk at me anymore.

any ideas?

Davood
06-22-2009, 01:25 AM
this is exactly what i did:


use with a command like :
$client->AddSpentAAPoints(2);

perl_client.cpp

insert at line 4148

newXSproto(strcpy(buf, "AddSpentAAPoints"), XS_Client_AddSpentAAPoints, file, "$$");


i put it at line 3621 (arbitrary?)


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));

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 = THIS->GetPP().aapoints_spent + points;
THIS->SendAAStats();
}
XSRETURN_EMPTY;
}

Davood
06-22-2009, 01:47 AM
ahh just saw derisions post.. which somehow appeared before my 2nd and 3rd posts.. ok i see..

well that "should" be changed eventually if we are going to implement expendable AA, as on live when expendable AA are used, it increased the "Spent" aa ad infinitum as long as you keep buying the same expendable AAs over and over.

ChaosSlayerZ
06-22-2009, 02:06 AM
could you explain what does "expendable" AAs actualy and do, where they come from and how the differ from regular AA?

I have read your another post on the subject but it still a total mistery to me.

Davood
06-22-2009, 02:11 AM
Expendable AA were AA that added a short duration Effect that would boost damage in some fashion, or increase hit points, or add a rune effect for a short duration. (I don't have a list handy)

they added them in DoD so that people who were maxed out could still adventure and make use of AA; and over the course of a year I noticed that they AA I was spending on expendables was being "counted" as spent aa, which was cool, a monk friend of mine had over 4k AA spent, and a certain hacker i know of had like 7k AA spent from farming stuff with his monk and abusing the damage AAs