View Single Post
  #2  
Old 10-30-2010, 11:57 PM
Caryatis
Dragon
 
Join Date: May 2009
Location: Milky Way
Posts: 541
Default

Always find an error after the edit timer is up... I changed the function to

Client::IncrementAA(AA_ID)

The removing of AA levels is kind of funky so I just removed that ability and simplified it so that you only need to put in the Skill_ID from altadv_vars. Also I forgot to make sure that bonuses were calculated again.

New Code:
Code:
Index: common/extprofile.h
===================================================================
--- common/extprofile.h	(revision 1709)
+++ common/extprofile.h	(working copy)
@@ -46,6 +46,7 @@
 	
 	uint32				aa_effects;
 	uint32				perAA;		//% of exp going to AAs
+	uint32				expended_aa;		// Total of expended AA
 };
 
 #pragma pack()
Index: zone/AA.cpp
===================================================================
--- zone/AA.cpp	(revision 1709)
+++ zone/AA.cpp	(working copy)
@@ -96,7 +96,7 @@
 
 	if(!aa2)
 	{
-		for(int i = 1;i < 5; ++i)
+		for(int i = 1;i < MAX_AA_ACTION_RANKS; ++i)
 		{
 			int a = activate - i;
 
@@ -158,7 +158,7 @@
 		if(!aa2){
 			int i;
 			int a;
-			for(i=1;i<5;i++){
+			for(i=1;i<MAX_AA_ACTION_RANKS;i++){
 				a = activate - i;
 				if(a <= 0)
 					break;
@@ -295,6 +295,19 @@
 				return;
 		}
 	}
+	
+	// Check if AA is expendable
+	if (aas_send[activate]->special_category == 7)
+	{
+		// Add the AA cost to the extended profile to track overall total
+		m_epp.expended_aa += aas_send[activate]->cost;
+		SetAA(activate, 0);
+		
+		Save();
+		
+		SendAA(activate);
+		SendAATable();
+	}
 }
 
 void Client::HandleAAAction(aaID activate) {
@@ -886,7 +899,7 @@
 		//hunt for a lower level...
 		int i;
 		int a;
-		for(i=1;i<15;i++){
+		for(i=1;i<MAX_AA_ACTION_RANKS;i++){
 			a = action->ability - i;
 			if(a <= 0)
 				break;
@@ -898,6 +911,9 @@
 	}
 	if(aa2 == NULL)
 		return;	//invalid ability...
+		
+	if(aa2->special_category == 1 || aa2->special_category == 2)
+		return; // Not purchasable progression style AAs
 	
 	int32 cur_level = GetAA(aa2->id);
 	if((aa2->id + cur_level) != action->ability) { //got invalid AA
@@ -1036,7 +1052,35 @@
 	if(!(classes & (1 << GetClass())) && (GetClass()!=BERSERKER || saa2->berserker==0)){
 		return;
 	}
+
+	// Beginning of Shroud AAs, these categories are for Passive and Active Shroud AAs
+	// Eventually with a toggle we could have it show player list or shroud list
+	if (saa2->special_category == 3 || saa2->special_category == 4)
+		return;
 	
+	// Check for racial/Drakkin blood line AAs
+	if (saa2->special_category == 8)
+	{
+		int32 client_race = this->GetBaseRace();
+		
+		// Drakkin Bloodlines
+		if (saa2->aa_expansion > 522) 
+		{	
+			if (client_race != 522)
+				return; // Check for Drakkin Race
+			
+			int heritage = this->GetDrakkinHeritage() + 523; // 523 = Drakkin Race(522) + Bloodline
+			
+			if (heritage != saa2->aa_expansion)
+				return;
+		}
+		// Racial AAs
+		else if (client_race != saa2->aa_expansion)
+		{
+			return;
+		}
+	}
+	
 	int size=sizeof(SendAA_Struct)+sizeof(AA_Ability)*saa2->total_abilities;
 	uchar* buffer = new uchar[size];
 	SendAA_Struct* saa=(SendAA_Struct*)buffer;
@@ -1046,6 +1090,13 @@
 		saa->spellid=0xFFFFFFFF;
 	
 	value=GetAA(saa->id);
+	
+	// Hide Quest/Progression AAs unless player has been granted the first level.
+	if ((saa2->special_category == 1 || saa2->special_category == 2 ) && (value == 0))
+	{
+		return;
+	}
+		
 	int32 orig_val = value;
 	bool dump = false;
 	if(value){
Index: zone/client.cpp
===================================================================
--- zone/client.cpp	(revision 1709)
+++ zone/client.cpp	(working copy)
@@ -493,10 +493,10 @@
 	int spentpoints=0;
 	for(int a=0;a < MAX_PP_AA_ARRAY;a++) {
 		int32 points = aa[a]->value;
-		if(points > 20) //sanity check if you want an aa to have over 20 ranks you'll need to up this.
+		if(points > HIGHEST_AA_VALUE) // Unifying this 
 		{
-			aa[a]->value = 20;
-			points = 20;
+			aa[a]->value = HIGHEST_AA_VALUE;
+			points = HIGHEST_AA_VALUE;
 		}
 		if (points > 0) {
 			SendAA_Struct* curAA = zone->FindAA(aa[a]->AA-aa[a]->value+1);
@@ -506,7 +506,7 @@
 			}
 		}
 	}
-	m_pp.aapoints_spent = spentpoints;
+	m_pp.aapoints_spent = spentpoints + m_epp.expended_aa;
 
 	if (GetHP() <= 0) {
 		m_pp.cur_hp = GetMaxHP();
Index: zone/features.h
===================================================================
--- zone/features.h	(revision 1709)
+++ zone/features.h	(working copy)
@@ -245,7 +245,7 @@
 //level is the only valid variable to use
 #define EXP_FORMULA level*level*75*35/10
 
-#define HIGHEST_AA_VALUE 11
+#define HIGHEST_AA_VALUE 50
 
 //Leadership AA experience points
 #define GROUP_EXP_PER_POINT 1000
Index: zone/perl_client.cpp
===================================================================
--- zone/perl_client.cpp	(revision 1709)
+++ zone/perl_client.cpp	(working copy)
@@ -4669,6 +4669,45 @@
 	XSRETURN_EMPTY;
 }
 
+XS(XS_Client_IncrementAA); 
+XS(XS_Client_IncrementAA)
+{
+	dXSARGS;
+	if (items < 2 || items > 2)
+		Perl_croak(aTHX_ "Usage: Client::IncrementAA(THIS, aaskillid)");
+	{
+		Client *		THIS;
+		int32		aaskillid = 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.");
+			
+		SendAA_Struct* aa2 = zone->FindAA(aaskillid);
+		
+		if(aa2 == NULL)
+			Perl_croak(aTHX_ "Invalid AA."); 
+	
+		if(THIS->GetAA(aaskillid) == aa2->max_level) 
+			Perl_croak(aTHX_ "AA at Max already."); 
+		
+		THIS->SetAA(aaskillid, THIS->GetAA(aaskillid)+1);
+		
+		THIS->Save();
+
+		THIS->SendAA(aaskillid);
+		THIS->SendAATable();
+		THIS->SendAAStats();
+		THIS->CalcBonuses();
+	}
+	XSRETURN_EMPTY;
+}
+
 #ifdef __cplusplus
 extern "C"
 #endif
@@ -4860,6 +4899,7 @@
 		newXSproto(strcpy(buf, "NPCSpawn"), XS_Client_NPCSpawn, file, "$$$;$");
         newXSproto(strcpy(buf, "GetIP"), XS_Client_GetIP, file, "$");
 		newXSproto(strcpy(buf, "AddLevelBasedExp"), XS_Client_AddLevelBasedExp, file, "$$;$");
+		newXSproto(strcpy(buf, "IncrementAA"), XS_Client_IncrementAA, file, "$$");
 	XSRETURN_YES;
 }
Reply With Quote