More work, looks a lot better than before, tomorrow i hope to get actual client implementation done

This commit is contained in:
KimLS
2015-06-09 22:12:31 -07:00
parent 33c1c7c3e4
commit d5e697c061
9 changed files with 363 additions and 342 deletions
+42 -42
View File
@@ -176,7 +176,6 @@ Client::Client(EQStreamInterface* ieqs)
admin = 0;
lsaccountid = 0;
shield_target = nullptr;
SQL_log = nullptr;
guild_id = GUILD_NONE;
guildrank = 0;
GuildBanker = false;
@@ -524,47 +523,48 @@ void Client::ReportConnectingState() {
}
bool Client::SaveAA(){
int first_entry = 0;
std::string rquery;
/* Save Player AA */
int spentpoints = 0;
for (int a = 0; a < MAX_PP_AA_ARRAY; a++) {
uint32 points = aa[a]->value;
if (points > HIGHEST_AA_VALUE) {
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);
if (curAA) {
for (int rank = 0; rank<points; rank++) {
std::map<uint32, AALevelCost_Struct>::iterator RequiredLevel = AARequiredLevelAndCost.find(aa[a]->AA - aa[a]->value + 1 + rank);
if (RequiredLevel != AARequiredLevelAndCost.end()) {
spentpoints += RequiredLevel->second.Cost;
}
else
spentpoints += (curAA->cost + (curAA->cost_inc * rank));
}
}
}
}
m_pp.aapoints_spent = spentpoints + m_epp.expended_aa;
int highest = 0;
for (int a = 0; a < MAX_PP_AA_ARRAY; a++) {
if (aa[a]->AA > 0) { // those with value 0 will be cleaned up on next load
if (first_entry != 1){
rquery = StringFormat("REPLACE INTO `character_alternate_abilities` (id, slot, aa_id, aa_value, charges)"
" VALUES (%u, %u, %u, %u, %u)", character_id, a, aa[a]->AA, aa[a]->value, aa[a]->charges);
first_entry = 1;
} else {
rquery = rquery + StringFormat(", (%u, %u, %u, %u, %u)", character_id, a, aa[a]->AA, aa[a]->value, aa[a]->charges);
}
highest = a;
}
}
auto results = database.QueryDatabase(rquery);
/* This is another part of the hack to clean up holes left by expendable AAs */
rquery = StringFormat("DELETE FROM `character_alternate_abilities` WHERE `id` = %u AND `slot` > %d", character_id, highest);
//aa old
//int first_entry = 0;
//std::string rquery;
///* Save Player AA */
//int spentpoints = 0;
//for (int a = 0; a < MAX_PP_AA_ARRAY; a++) {
// uint32 points = aa[a]->value;
// if (points > HIGHEST_AA_VALUE) {
// 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);
// if (curAA) {
// for (int rank = 0; rank<points; rank++) {
// std::map<uint32, AALevelCost_Struct>::iterator RequiredLevel = AARequiredLevelAndCost.find(aa[a]->AA - aa[a]->value + 1 + rank);
// if (RequiredLevel != AARequiredLevelAndCost.end()) {
// spentpoints += RequiredLevel->second.Cost;
// }
// else
// spentpoints += (curAA->cost + (curAA->cost_inc * rank));
// }
// }
// }
//}
//m_pp.aapoints_spent = spentpoints + m_epp.expended_aa;
//int highest = 0;
//for (int a = 0; a < MAX_PP_AA_ARRAY; a++) {
// if (aa[a]->AA > 0) { // those with value 0 will be cleaned up on next load
// if (first_entry != 1){
// rquery = StringFormat("REPLACE INTO `character_alternate_abilities` (id, slot, aa_id, aa_value, charges)"
// " VALUES (%u, %u, %u, %u, %u)", character_id, a, aa[a]->AA, aa[a]->value, aa[a]->charges);
// first_entry = 1;
// } else {
// rquery = rquery + StringFormat(", (%u, %u, %u, %u, %u)", character_id, a, aa[a]->AA, aa[a]->value, aa[a]->charges);
// }
// highest = a;
// }
//}
//auto results = database.QueryDatabase(rquery);
///* This is another part of the hack to clean up holes left by expendable AAs */
//rquery = StringFormat("DELETE FROM `character_alternate_abilities` WHERE `id` = %u AND `slot` > %d", character_id, highest);
return true;
}