AAs should load from character data now, though will be fucked up if you already had stacked aas.

This commit is contained in:
KimLS
2015-06-10 22:46:57 -07:00
parent 8422ce6f25
commit 1589169200
25 changed files with 3318 additions and 3805 deletions
+28 -27
View File
@@ -4077,33 +4077,34 @@ XS(XS_Client_RefundAA) {
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
int curpt = 0;
bool refunded = false;
for(int x1=0;x1<aaHighestID;x1++){
curpt = THIS->GetAA(x1);
if(curpt > 0){
SendAA_Struct* curaa = zone->FindAA(x1);
if(curaa){
THIS->SetAA(x1, 0);
for(int x2=0;x2<curpt;x2++){ //add up all the AA points pt by pt to get the correct cost
THIS->GetPP().aapoints += curaa->cost + (curaa->cost_inc * x2);
refunded = true;
}
}
else //aa doesn't exist.. but if they bought it then it had at least a cost of 1 point each
{ //so give back what we can
THIS->GetPP().aapoints += curpt;
THIS->SetAA(x1, 0);
refunded = true;
}
}
}
if(refunded){
THIS->Save(); //save of course
THIS->Kick(); //client gets all buggy if we don't immediatly relog so just force it on them
}
//old aa
//int curpt = 0;
//bool refunded = false;
//
//for(int x1=0;x1<aaHighestID;x1++){
// curpt = THIS->GetAA(x1);
// if(curpt > 0){
// SendAA_Struct* curaa = zone->FindAA(x1);
// if(curaa){
// THIS->SetAA(x1, 0);
// for(int x2=0;x2<curpt;x2++){ //add up all the AA points pt by pt to get the correct cost
// THIS->GetPP().aapoints += curaa->cost + (curaa->cost_inc * x2);
// refunded = true;
// }
// }
// else //aa doesn't exist.. but if they bought it then it had at least a cost of 1 point each
// { //so give back what we can
// THIS->GetPP().aapoints += curpt;
// THIS->SetAA(x1, 0);
// refunded = true;
// }
// }
//}
//
//if(refunded){
// THIS->Save(); //save of course
// THIS->Kick(); //client gets all buggy if we don't immediatly relog so just force it on them
//}
}
XSRETURN_EMPTY;
}