Added reset aa command for rof2 (50 status req), fixed #resetaa command

This commit is contained in:
KimLS 2015-06-15 13:57:18 -07:00
parent 335470d3db
commit 34f0106437
6 changed files with 72 additions and 81 deletions

View File

@ -548,4 +548,5 @@ N(OP_ZoneServerInfo),
N(OP_ZoneServerReady),
N(OP_ZoneSpawns),
N(OP_ZoneUnavail),
N(OP_ResetAA),
// mail and chat opcodes located in ../mail_oplist.h

View File

@ -353,6 +353,7 @@ OP_OpenContainer=0x0000
OP_Marquee=0x502e
OP_ItemRecastDelay=0x15a9
#OP_OpenInventory=0x0000 # Likely does not exist in RoF -U
OP_ResetAA=0x1669
# Expeditions
OP_DzAddPlayer=0x4701

View File

@ -482,40 +482,35 @@ bool Client::CheckAAEffect(aaEffectType type) {
return(false);
}
void Client::ResetAA(){
// RefundAA();
// uint32 i;
// for (i=0; i < MAX_PP_AA_ARRAY; i++) {
// aa[i]->AA = 0;
// aa[i]->value = 0;
// aa[i]->charges = 0;
// m_pp.aa_array[i].AA = 0;
// m_pp.aa_array[i].value = 0;
// m_pp.aa_array[i].charges= 0;
// }
//
// std::map<uint32,uint8>::iterator itr;
// for(itr = aa_points.begin(); itr != aa_points.end(); ++itr)
// aa_points[itr->first] = 0;
//
// for(int i = 0; i < _maxLeaderAA; ++i)
// m_pp.leader_abilities.ranks[i] = 0;
//
// m_pp.group_leadership_points = 0;
// m_pp.raid_leadership_points = 0;
// m_pp.group_leadership_exp = 0;
// m_pp.raid_leadership_exp = 0;
//
// database.DeleteCharacterAAs(this->CharacterID());
// SaveAA();
// SendClearAA();
// SendAAList();
// SendAATable();
// SendAAStats();
// database.DeleteCharacterLeadershipAAs(this->CharacterID());
// // undefined for these clients
// if (GetClientVersionBit() & BIT_TitaniumAndEarlier)
// Kick();
void Client::ResetAA() {
RefundAA();
uint32 i;
for (i=0; i < MAX_PP_AA_ARRAY; i++) {
m_pp.aa_array[i].AA = 0;
m_pp.aa_array[i].value = 0;
m_pp.aa_array[i].charges= 0;
}
aa_ranks.clear();
for(int i = 0; i < _maxLeaderAA; ++i)
m_pp.leader_abilities.ranks[i] = 0;
m_pp.group_leadership_points = 0;
m_pp.raid_leadership_points = 0;
m_pp.group_leadership_exp = 0;
m_pp.raid_leadership_exp = 0;
database.DeleteCharacterAAs(CharacterID());
SaveAA();
SendClearAA();
SendAlternateAdvancementTable();
SendAlternateAdvancementPoints();
SendAlternateAdvancementStats();
database.DeleteCharacterLeadershipAAs(this->CharacterID());
// undefined for these clients
if (GetClientVersionBit() & BIT_TitaniumAndEarlier)
Kick();
}
void Client::SendClearAA()
@ -802,34 +797,31 @@ void Client::DurationRampage(uint32 duration)
}
void Client::RefundAA() {
// int cur = 0;
// bool refunded = false;
//
// for(int x = 0; x < aaHighestID; x++) {
// cur = GetAA(x);
// if(cur > 0){
// SendAA_Struct* curaa = zone->FindAA(x);
// if(cur){
// SetAA(x, 0);
// for(int j = 0; j < cur; j++) {
// m_pp.aapoints += curaa->cost + (curaa->cost_inc * j);
// refunded = true;
// }
// }
// else
// {
// m_pp.aapoints += cur;
// SetAA(x, 0);
// refunded = true;
// }
// }
// }
//
// if(refunded) {
// SaveAA();
// Save();
// // Kick();
// }
int refunded = 0;
for(auto &rank_value : aa_ranks) {
AA::Ability *ability = zone->GetAlternateAdvancementAbility(rank_value.first);
if(!ability) {
continue;
}
if(ability->charges > 0 && rank_value.second.second < 1) {
continue;
}
AA::Rank *rank = ability->GetRankByPointsSpent(rank_value.second.first);
if(!rank) {
continue;
}
refunded += rank->total_cost;
}
if(refunded > 0) {
m_pp.aapoints += refunded;
SaveAA();
Save();
}
}
AA_SwarmPetInfo::AA_SwarmPetInfo()

View File

@ -389,6 +389,7 @@ void MapOpcodes()
ConnectedOpcodes[OP_XTargetRequest] = &Client::Handle_OP_XTargetRequest;
ConnectedOpcodes[OP_YellForHelp] = &Client::Handle_OP_YellForHelp;
ConnectedOpcodes[OP_ZoneChange] = &Client::Handle_OP_ZoneChange;
ConnectedOpcodes[OP_ResetAA] = &Client::Handle_OP_ResetAA;
}
void ClearMappedOpcode(EmuOpcode op)
@ -14163,9 +14164,12 @@ void Client::Handle_OP_YellForHelp(const EQApplicationPacket *app)
return;
}
/*
void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app)
void Client::Handle_OP_ResetAA(const EQApplicationPacket *app)
{
if(Admin() >= 50) {
Message(0, "Resetting AA points.");
ResetAA();
}
return;
}
*/

View File

@ -295,3 +295,4 @@
void Handle_OP_XTargetRequest(const EQApplicationPacket *app);
void Handle_OP_YellForHelp(const EQApplicationPacket *app);
void Handle_OP_ZoneChange(const EQApplicationPacket *app);
void Handle_OP_ResetAA(const EQApplicationPacket *app);

View File

@ -332,7 +332,7 @@ int command_init(void) {
command_add("reloadzonepoints", "- Reload zone points from database", 150, command_reloadzps) ||
command_add("reloadzps", nullptr,0, command_reloadzps) ||
command_add("repop", "[delay] - Repop the zone with optional delay", 100, command_repop) ||
command_add("resetaa", "- Resets a Player's AA in their profile and refunds spent AA's to unspent, disconnects player.", 200, command_resetaa) ||
command_add("resetaa", "- Resets a Player's AA in their profile and refunds spent AA's to unspent, may disconnect player.", 200, command_resetaa) ||
command_add("revoke", "[charname] [1/0] - Makes charname unable to talk on OOC", 200, command_revoke) ||
command_add("rules", "(subcommand) - Manage server rules", 250, command_rules) ||
command_add("save", "- Force your player or player corpse target to be saved to the database", 50, command_save) ||
@ -671,21 +671,13 @@ void command_incstat(Client* c, const Seperator* sep){
}
}
void command_resetaa(Client* c,const Seperator *sep){
//if(sep->IsNumber(1) && atoi(sep->arg[1]) == 1) {
// c->SendAlternateAdvancement(2, 2);
//}
//else if(sep->IsNumber(1) && atoi(sep->arg[1]) == 2) {
// c->SendAlternateAdvancement(2, 3);
//}
//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_resetaa(Client* c,const Seperator *sep) {
if(c->GetTarget() && 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)