diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index d2d9ae8b3..0c4335016 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -4243,7 +4243,7 @@ struct AARankInfo_Struct int32 total_cost; int32 expansion; int32 category; - uint8 expendable; + uint8 charges; uint8 grant_only; uint32 total_effects; uint32 total_prereqs; diff --git a/common/patches/uf.cpp b/common/patches/uf.cpp index bbe0c0f0d..caea6b933 100644 --- a/common/patches/uf.cpp +++ b/common/patches/uf.cpp @@ -2177,7 +2177,7 @@ namespace UF eq->next_id = emu->next_id; eq->cost2 = emu->total_cost; eq->grant_only = emu->grant_only > 0 ? true : false; - eq->expendable_charges = emu->expendable ? 1 : 0; + eq->expendable_charges = emu->charges ? 1 : 0; eq->aa_expansion = emu->expansion; eq->special_category = emu->category; eq->total_abilities = emu->total_effects; diff --git a/zone/aa.cpp b/zone/aa.cpp index 88e2a2e56..57f6df675 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -1101,6 +1101,14 @@ void Client::SendAATable() { EQApplicationPacket* outapp = new EQApplicationPacket(OP_RespondAA, sizeof(AATable_Struct)); AATable_Struct* aa2 = (AATable_Struct *)outapp->pBuffer; + aa2->aa_spent = 8; + //aa2->aa_list[0].AA = 11; + //aa2->aa_list[0].value = 4; + //aa2->aa_list[0].charges = 0; + //aa2->aa_list[1].AA = 202; + //aa2->aa_list[1].value = 4; + //aa2->aa_list[1].charges = 0; + //aa2->aa_spent = GetAAPointsSpent(); // //uint32 i; @@ -2089,13 +2097,16 @@ Mob *AA_SwarmPetInfo::GetOwner() } void Client::SendAlternateAdvancementList() { - for(auto &aa : zone->aa_abilities) { - SendAlternateAdvancement(aa.first, true); - } + //for(auto &aa : zone->aa_abilities) { + // SendAlternateAdvancement(aa.first, 5); + //} + + SendAlternateAdvancement(1, 4); + SendAlternateAdvancement(2, 4); } //New AA -void Client::SendAlternateAdvancement(int aa_id, bool first_login) { +void Client::SendAlternateAdvancement(int aa_id, int level) { if(!zone) return; @@ -2108,8 +2119,12 @@ void Client::SendAlternateAdvancement(int aa_id, bool first_login) { return; } - if(ability->account_time_required) { - if((Timer::GetTimeSeconds() - account_creation) < ability->account_time_required) + AA::Rank *rank = ability->GetRankByPointsSpent(level + 1); + if(!rank) + return; + + if(rank->account_time_required) { + if((Timer::GetTimeSeconds() - account_creation) < rank->account_time_required) { return; } @@ -2120,9 +2135,9 @@ void Client::SendAlternateAdvancement(int aa_id, bool first_login) { //if(GetAA(saa2->id) == 0) // return; - if(ability->expansion > 0) { + if(rank->expansion > 0) { AA::Ability *qaa = zone->GetAlternateAdvancementAbility(aa_id + 1); - //if(qaa && qaa->expansion == ability->expansion && GetAA(aa_id) > 0) { + //if(qaa && qaa->expansion == rank->expansion && GetAA(aa_id) > 0) { // return; //} } @@ -2140,33 +2155,28 @@ void Client::SendAlternateAdvancement(int aa_id, bool first_login) { uint32 client_race = GetBaseRace(); // Drakkin Bloodlines - if(ability->expansion > 522) + if(rank->expansion > 522) { if(client_race != 522) return; int heritage = this->GetDrakkinHeritage() + 523; // 523 = Drakkin Race(522) + Bloodline - if(heritage != ability->expansion) + if(heritage != rank->expansion) return; } - else if(client_race != ability->expansion) + else if(client_race != rank->expansion) { return; } } - - //Send first rank - AA::Rank *rank = ability->first; - if(!rank) - return; //Should move this to another function int size = sizeof(AARankInfo_Struct)+(sizeof(AARankEffect_Struct)* rank->effects.size()) + (sizeof(AARankPrereq_Struct)* rank->prereqs.size()); EQApplicationPacket *outapp = new EQApplicationPacket(OP_SendAATable, size); AARankInfo_Struct *aai = (AARankInfo_Struct*)outapp->pBuffer; - aai->id = rank->id; + aai->id = ability->GetMaxRank()->id; aai->upper_hotkey_sid = rank->upper_hotkey_sid; aai->lower_hotkey_sid = rank->lower_hotkey_sid; aai->title_sid = rank->title_sid; @@ -2174,7 +2184,7 @@ void Client::SendAlternateAdvancement(int aa_id, bool first_login) { aai->level_req = rank->level_req; aai->cost = rank->cost; aai->seq = aa_id; - aai->current_level = 1; + aai->current_level = level + 1; aai->type = ability->type; aai->spell = rank->spell; aai->spell_type = rank->spell_type; @@ -2184,9 +2194,9 @@ void Client::SendAlternateAdvancement(int aa_id, bool first_login) { aai->prev_id = rank->prev_id; aai->next_id = rank->next_id; aai->total_cost = rank->total_cost; - aai->expansion = ability->expansion; + aai->expansion = rank->expansion; aai->category = ability->category; - aai->expendable = ability->expendable; + aai->charges = ability->charges; aai->grant_only = ability->grant_only; aai->total_effects = rank->effects.size(); aai->total_prereqs = rank->prereqs.size(); @@ -2204,106 +2214,8 @@ void Client::SendAlternateAdvancement(int aa_id, bool first_login) { outapp->WriteSInt32(prereq.points); } - //if first_login then also send current rank if not maxed - QueuePacket(outapp); safe_delete(outapp); - - // - //if(size == 0) - // return; - // - //uchar* buffer = new uchar[size]; - //SendAA_Struct* saa = (SendAA_Struct*)buffer; - //memcpy(saa, saa2, size); - // - //if(saa->spellid == 0) - // saa->spellid = 0xFFFFFFFF; - // - //value = GetAA(saa->id); - //uint32 orig_val = value; - // - //if(value && saa->id){ - // - // if(value < saa->max_level){ - // saa->id += value; - // saa->next_id = saa->id + 1; - // value++; - // } - // - // else if(aa_stack && saa->sof_next_id){ - // saa->id += value - 1; - // saa->next_id = saa->sof_next_id; - // - // //Prevent removal of previous AA from window if next AA belongs to a higher client version. - // SendAA_Struct* saa_next = nullptr; - // saa_next = zone->FindAA(saa->sof_next_id); - // - // // this check should work as long as we continue to just add the clients and just increase - // // each number .... - // if(saa_next && static_cast(GetClientVersion()) < saa_next->clientver - 1) { - // saa->next_id = 0xFFFFFFFF; - // } - // } - // - // else{ - // saa->id += value - 1; - // saa->next_id = 0xFFFFFFFF; - // } - // - // uint32 current_level_mod = 0; - // if(aa_stack) - // current_level_mod = saa->sof_current_level; - // - // saa->last_id = saa->id - 1; - // saa->current_level = value + (current_level_mod); - // saa->cost = saa2->cost + (saa2->cost_inc*(value - 1)); - // saa->cost2 = 0; - // for(uint32 i = 0; i < value; i++) { - // saa->cost2 += saa2->cost + (saa2->cost_inc * i); - // } - // saa->class_type = saa2->class_type + (saa2->level_inc*(value - 1)); - //} - // - //if(aa_stack){ - // - // if(saa->sof_current_level >= 1 && value == 0) - // saa->current_level = saa->sof_current_level + 1; - // - // saa->max_level = saa->sof_max_level; - //} - // - //database.FillAAEffects(saa); - // - //if(value > 0) - //{ - // // AA_Action stores the base ID - // const AA_DBAction *caa = &AA_Actions[saa->id - value + 1][value - 1]; - // - // if(caa && caa->reuse_time > 0) - // saa->spell_refresh = CalcAAReuseTimer(caa); - //} - // - ////You can now use the level_inc field in the altadv_vars table to accomplish this, though still needed - ////for special cases like LOH/HT due to inability to implement correct stacking of AA's that use hotkeys. - //std::map::iterator RequiredLevel = AARequiredLevelAndCost.find(saa->id); - // - //if(RequiredLevel != AARequiredLevelAndCost.end()) - //{ - // saa->class_type = RequiredLevel->second.Level; - // saa->cost = RequiredLevel->second.Cost; - //} - // - // - //EQApplicationPacket* outapp = new EQApplicationPacket(OP_SendAATable); - //outapp->size = size; - //outapp->pBuffer = (uchar*)saa; - //if(id == 0 && value && (orig_val < saa->max_level)) //send previous AA only on zone in - // SendPreviousAA(id, seq); - // - //QueuePacket(outapp); - //safe_delete(outapp); - ////will outapp delete the buffer for us even though it didnt make it? --- Yes, it should } void Zone::LoadAlternateAdvancement() { @@ -2366,21 +2278,19 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_mapname = row[1]; - ability->expansion = atoi(row[2]); - ability->category = atoi(row[3]); - ability->classes = atoi(row[4]); - ability->type = atoi(row[5]); - ability->expendable = atoi(row[6]) != 0 ? true : false; - ability->account_time_required = atoul(row[7]); - ability->grant_only = atoi(row[8]) != 0 ? true : false; - ability->first_rank_id = atoi(row[9]); + ability->category = atoi(row[2]); + ability->classes = atoi(row[3]); + ability->type = atoi(row[4]); + ability->charges = atoi(row[5]); + ability->grant_only = atoi(row[6]) != 0 ? true : false; + ability->first_rank_id = atoi(row[7]); ability->first = nullptr; abilities[id] = std::unique_ptr(ability); @@ -2395,7 +2305,7 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_maprecast_time = atoi(row[9]); rank->prev_id = atoi(row[10]); rank->next_id = atoi(row[11]); + rank->expansion = atoi(row[12]); + rank->account_time_required = atoul(row[13]); rank->base_ability = nullptr; rank->total_cost = 0; rank->next = nullptr; diff --git a/zone/aa_ability.cpp b/zone/aa_ability.cpp index 3cc14826a..8f9cb8da4 100644 --- a/zone/aa_ability.cpp +++ b/zone/aa_ability.cpp @@ -33,17 +33,16 @@ AA::Rank *AA::Ability::GetMaxRank() { } AA::Rank *AA::Ability::GetRankByPointsSpent(int current_level) { + if(current_level == 0) + return nullptr; + if(!first) return nullptr; - if(current_level == 0) { - return GetMaxRank(); - } - int i = 1; Rank *current = first; while(current->next) { - if(1 == current_level) { + if(i == current_level) { break; } diff --git a/zone/aa_ability.h b/zone/aa_ability.h index b2098c408..d1ef49105 100644 --- a/zone/aa_ability.h +++ b/zone/aa_ability.h @@ -37,17 +37,16 @@ public: ~Ability() { } Rank *GetMaxRank(); + Rank *GetRankByLevel(int level); Rank *GetRankByPointsSpent(int current_level); int GetMaxLevel(bool force_calc = false); std::string name; - int expansion; int category; int classes; - uint32 account_time_required; bool grant_only; int type; - bool expendable; + int charges; int first_rank_id; int max_level; Rank *first; diff --git a/zone/aa_rank.h b/zone/aa_rank.h index 43b6ef635..d35582834 100644 --- a/zone/aa_rank.h +++ b/zone/aa_rank.h @@ -43,6 +43,8 @@ public: Rank *prev; int next_id; Rank *next; + int expansion; + uint32 account_time_required; int total_cost; Ability *base_ability; std::unordered_map effects; diff --git a/zone/client.h b/zone/client.h index 7bc4aac1e..71fc219fb 100644 --- a/zone/client.h +++ b/zone/client.h @@ -760,7 +760,7 @@ public: inline PTimerList &GetPTimers() { return(p_timers); } //New AA Methods - void SendAlternateAdvancement(int aa_id, bool first_login = false); + void SendAlternateAdvancement(int aa_id, int level); void SendAlternateAdvancementList(); //old AA Methods diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index bfe96fdb3..77431ecd9 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -1091,10 +1091,7 @@ void Client::Handle_Connect_OP_SendAAStats(const EQApplicationPacket *app) void Client::Handle_Connect_OP_SendAATable(const EQApplicationPacket *app) { - //SendAAList(); - SendAlternateAdvancementList(); - return; } diff --git a/zone/command.cpp b/zone/command.cpp index a286f92bd..3210ba070 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -674,12 +674,14 @@ void command_incstat(Client* c, const Seperator* sep){ } void command_resetaa(Client* c,const Seperator *sep){ - if(c->GetTarget()!=0 && c->GetTarget()->IsClient()){ - c->GetTarget()->CastToClient()->ResetAA(); - c->Message(13,"Successfully reset %s's AAs", c->GetTarget()->GetName()); - } - else - c->Message(0,"Usage: Target a client and use #resetaa to reset the AA data in their Profile."); + c->SendAlternateAdvancement(1, 1); + c->SendAlternateAdvancement(2, 1); + //if(c->GetTarget()!=0 && c->GetTarget()->IsClient()){ + // c->GetTarget()->CastToClient()->ResetAA(); + // c->Message(13,"Successfully reset %s's AAs", c->GetTarget()->GetName()); + //} + //else + // c->Message(0,"Usage: Target a client and use #resetaa to reset the AA data in their Profile."); } void command_help(Client *c, const Seperator *sep)