Caryatis
10-30-2010, 06:57 PM
So Ive been spending some off time updating the AA Database so we can have all the AAs as they were intended up to SoD/Underfoot but its going to be a huge update so thought I would split this off first.
Here's whats been updated:
1.) Expendable AAs - Set the special_category in the altadv_vars table to 7 and the AA will show as expendable as well as un-purchase itself when you activate it(like live). Also utilizes the extended profile(thx secrets) to keep the expended aas counted in the spent AA total.
2.) Quest AAs - Like Trials of Mata Muram AA. Set the special_category to 1(Quest Only) or 2(Progression). These AA will remain hidden from view until you have been granted 1 level in them(using $client->AssignAA, see below). They also remain greyed out and are unpurchasable(they show a cost of -1 to make it clear).
3.) Racial/Bloodline AAs - Mainly done for the Drakkin breath weapons however I included support for racial AAs(not like live but why give drakkins all the fun). Set the special_category to 8 and then the aa_expansion entry is used as the race/bloodline. Races are entered as the race, bloodlines are entered + 523(drakkin base race + 1).
eg.
Human = 1
Barbarian = 2
Erud = 3
Wood = 4
High = 5
Dark = 6
Half = 7
Dwarf = 8
Troll = 9
Ogre = 10
Halfing = 11
Gnome = 12
Iksar = 128
Vahshir = 130
Frog = 330
Drakkin = 522
// Bloodlines
DrakkinRed(0) = 523
DrakkinBlack(1) = 524
DrakkinBlue(2) = 525
DrakkinGreen(3) = 526
DrakkinWhite(4) = 527
DrakkinGold(5) = 528
4.) New object... Client::AssignAA(AA_ID, Value)
This command will grant or remove a specific AA.
Example of use... set an AA to quest or progression(1 or 2). Create script with $client->AssignAA(AA_ID, 1); where AA_ID is the skill_id from the altadv_vars table. The AA will not show on the list prior to executing the script and after it will be visible.
5.) Support for 50 levels of passive AA and 20 level of activated AAs. This is a base for the coming AA Revamp whereby all the AA are consolidated into 1 AA(ie no 4x Combat Stability, instead -> Combat Stability with 33 ranks) like live.
6.) Very beginning of Shroud AAs. Special category 3(Passive) and 4(activated) are for shroud AAs, I included a check to block them from showing for players. In the future, should be possible to display the AA list based on whether the player is playing as themselves or a shroud.
NOTE: The default AA DB doesnt contain any Expendable, Progression, Racial or Shroud AAs. Within a week or so I should have them updated and will post that as well, complete up to SoD(some Underfoot as well, just wont be visible as they show as unknown). Maybe 2 weeks. Going to be removing as much hard coding as possible as well which will take some bonus re-writing so could take a while.
SQL(need to alter aa_expansion slightly so it can hold numbers past 255):
ALTER TABLE `altadv_vars` CHANGE COLUMN `aa_expansion` `aa_expansion` SMALLINT(3) UNSIGNED NOT NULL DEFAULT '3' AFTER `cost_inc`;
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,11 +1090,21 @@
saa->spellid=0xFFFFFFFF;
value=GetAA(saa->id);
+
+ int quest_aa = 0;
+ // Make quest & progression AA not visible until granted 1 level.
+ if (saa2->special_category == 1 || saa2->special_category == 2 )
+ {
+ if (value == 0)
+ return;
+ quest_aa = 1;
+ }
+
int32 orig_val = value;
bool dump = false;
if(value){
dump = true;
- if(value < saa->max_level){
+ if(value < saa->max_level && !quest_aa){
saa->id+=value;
saa->next_id=saa->id+1;
value++;
@@ -1066,6 +1120,11 @@
for(int i=0;i<value;i++){
saa->cost2 += saa2->cost + (saa2->cost_inc * i);
}
+ if (quest_aa)
+ {
+ saa->cost = 0xFFFFFFFF;
+ saa->cost2 = 0xFFFFFFFF;
+ }
}
database.FillAAEffects(saa);
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,34 @@
XSRETURN_EMPTY;
}
+XS(XS_Client_AssignAA); /* prototype to pass -Wmissing-prototypes */
+XS(XS_Client_AssignAA)
+{
+ dXSARGS;
+ if (items < 2 || items > 3)
+ Perl_croak(aTHX_ "Usage: Client::AssignAA(THIS, aaskillid, value)");
+ {
+ Client * THIS;
+ int32 aaskillid = SvUV(ST(1));
+ int32 value = SvUV(ST(2));
+
+ 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->SetAA(aaskillid, value);
+ THIS->Save();
+ THIS->SendAA(aaskillid);
+ THIS->SendAATable();
+ }
+ XSRETURN_EMPTY;
+}
+
#ifdef __cplusplus
extern "C"
#endif
@@ -4860,6 +4888,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, "AssignAA"), XS_Client_AssignAA, file, "$$$");
XSRETURN_YES;
}
Here's whats been updated:
1.) Expendable AAs - Set the special_category in the altadv_vars table to 7 and the AA will show as expendable as well as un-purchase itself when you activate it(like live). Also utilizes the extended profile(thx secrets) to keep the expended aas counted in the spent AA total.
2.) Quest AAs - Like Trials of Mata Muram AA. Set the special_category to 1(Quest Only) or 2(Progression). These AA will remain hidden from view until you have been granted 1 level in them(using $client->AssignAA, see below). They also remain greyed out and are unpurchasable(they show a cost of -1 to make it clear).
3.) Racial/Bloodline AAs - Mainly done for the Drakkin breath weapons however I included support for racial AAs(not like live but why give drakkins all the fun). Set the special_category to 8 and then the aa_expansion entry is used as the race/bloodline. Races are entered as the race, bloodlines are entered + 523(drakkin base race + 1).
eg.
Human = 1
Barbarian = 2
Erud = 3
Wood = 4
High = 5
Dark = 6
Half = 7
Dwarf = 8
Troll = 9
Ogre = 10
Halfing = 11
Gnome = 12
Iksar = 128
Vahshir = 130
Frog = 330
Drakkin = 522
// Bloodlines
DrakkinRed(0) = 523
DrakkinBlack(1) = 524
DrakkinBlue(2) = 525
DrakkinGreen(3) = 526
DrakkinWhite(4) = 527
DrakkinGold(5) = 528
4.) New object... Client::AssignAA(AA_ID, Value)
This command will grant or remove a specific AA.
Example of use... set an AA to quest or progression(1 or 2). Create script with $client->AssignAA(AA_ID, 1); where AA_ID is the skill_id from the altadv_vars table. The AA will not show on the list prior to executing the script and after it will be visible.
5.) Support for 50 levels of passive AA and 20 level of activated AAs. This is a base for the coming AA Revamp whereby all the AA are consolidated into 1 AA(ie no 4x Combat Stability, instead -> Combat Stability with 33 ranks) like live.
6.) Very beginning of Shroud AAs. Special category 3(Passive) and 4(activated) are for shroud AAs, I included a check to block them from showing for players. In the future, should be possible to display the AA list based on whether the player is playing as themselves or a shroud.
NOTE: The default AA DB doesnt contain any Expendable, Progression, Racial or Shroud AAs. Within a week or so I should have them updated and will post that as well, complete up to SoD(some Underfoot as well, just wont be visible as they show as unknown). Maybe 2 weeks. Going to be removing as much hard coding as possible as well which will take some bonus re-writing so could take a while.
SQL(need to alter aa_expansion slightly so it can hold numbers past 255):
ALTER TABLE `altadv_vars` CHANGE COLUMN `aa_expansion` `aa_expansion` SMALLINT(3) UNSIGNED NOT NULL DEFAULT '3' AFTER `cost_inc`;
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,11 +1090,21 @@
saa->spellid=0xFFFFFFFF;
value=GetAA(saa->id);
+
+ int quest_aa = 0;
+ // Make quest & progression AA not visible until granted 1 level.
+ if (saa2->special_category == 1 || saa2->special_category == 2 )
+ {
+ if (value == 0)
+ return;
+ quest_aa = 1;
+ }
+
int32 orig_val = value;
bool dump = false;
if(value){
dump = true;
- if(value < saa->max_level){
+ if(value < saa->max_level && !quest_aa){
saa->id+=value;
saa->next_id=saa->id+1;
value++;
@@ -1066,6 +1120,11 @@
for(int i=0;i<value;i++){
saa->cost2 += saa2->cost + (saa2->cost_inc * i);
}
+ if (quest_aa)
+ {
+ saa->cost = 0xFFFFFFFF;
+ saa->cost2 = 0xFFFFFFFF;
+ }
}
database.FillAAEffects(saa);
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,34 @@
XSRETURN_EMPTY;
}
+XS(XS_Client_AssignAA); /* prototype to pass -Wmissing-prototypes */
+XS(XS_Client_AssignAA)
+{
+ dXSARGS;
+ if (items < 2 || items > 3)
+ Perl_croak(aTHX_ "Usage: Client::AssignAA(THIS, aaskillid, value)");
+ {
+ Client * THIS;
+ int32 aaskillid = SvUV(ST(1));
+ int32 value = SvUV(ST(2));
+
+ 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->SetAA(aaskillid, value);
+ THIS->Save();
+ THIS->SendAA(aaskillid);
+ THIS->SendAATable();
+ }
+ XSRETURN_EMPTY;
+}
+
#ifdef __cplusplus
extern "C"
#endif
@@ -4860,6 +4888,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, "AssignAA"), XS_Client_AssignAA, file, "$$$");
XSRETURN_YES;
}