Removed debugging

Added player profile data loading safety net checking
This commit is contained in:
akkadius 2014-09-07 04:00:56 -05:00
parent 4c12d31e4a
commit a14371ba5c
5 changed files with 49 additions and 29 deletions

View File

@ -649,6 +649,7 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
pp->RestTimer // " RestTimer) "
);
auto results = QueryDatabase(query);
ThrowDBError(results.ErrorMessage(), "Database::SaveCharacterCreate", query);
return true;
}
@ -1247,7 +1248,7 @@ bool Database::CheckDatabaseConversions() {
// Testing account = 11001
int char_iter_count = 0;
rquery = StringFormat("SELECT `id` FROM `character_` WHERE `account_id` = 11001");
rquery = StringFormat("SELECT `id` FROM `character_`");
results = QueryDatabase(rquery);
uint8 firstlogon = 0;

View File

@ -801,8 +801,8 @@ struct SuspendedMinion_Struct
** OpCode: 0x006a
*/
static const uint32 MAX_PP_LANGUAGE = 28;
static const uint32 MAX_PP_SPELLBOOK = 720; // Set for all functions
static const uint32 MAX_PP_MEMSPELL = 12; // Set to latest client so functions can work right
static const uint32 MAX_PP_SPELLBOOK = 480; // Set for all functions
static const uint32 MAX_PP_MEMSPELL = 9; // Set to latest client so functions can work right
static const uint32 MAX_PP_REF_SPELLBOOK = 480; // Set for Player Profile size retain
static const uint32 MAX_PP_REF_MEMSPELL = 9; // Set for Player Profile size retain

View File

@ -542,29 +542,26 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) {
std::string query;
unsigned long* lengths;
/* Set item material tint */
for (int i = EmuConstants::MATERIAL_BEGIN; i <= EmuConstants::MATERIAL_END; i++)
if (m_pp.item_tint[i].rgb.use_tint == 1)
m_pp.item_tint[i].rgb.use_tint = 0xFF;
uint32 cid = CharacterID();
character_id = cid; /* Global character_id reference */
clock_t t = std::clock(); /* Function timer start */
/* Flush and reload factions */
database.RemoveTempFactions(this);
database.LoadCharacterFactionValues(cid, factionvalues);
/* Load Character Account Data: Temp until I move */
query = StringFormat("SELECT `status`, `name`, `lsaccount_id`, `gmspeed`, `revoked`, `hideme` FROM `account` WHERE `id` = %i", this->AccountID());
query = StringFormat("SELECT `status`, `name`, `lsaccount_id`, `gmspeed`, `revoked`, `hideme` FROM `account` WHERE `id` = %u", this->AccountID());
auto results = database.QueryDatabase(query);
for (auto row = results.begin(); row != results.end(); ++row) {
if (admin){ admin = atoi(row[0]); }
if (account_name){ strcpy(account_name, row[1]); }
if (lsaccountid && atoi(row[2]) > 0){ lsaccountid = atoi(row[2]); }
else{ lsaccountid = 0; }
if (gmspeed){ gmspeed = atoi(row[3]); }
if (revoked){ revoked = atoi(row[4]); }
if (gmhideme){ gmhideme = atoi(row[5]); }
gmspeed = atoi(row[3]);
revoked = atoi(row[4]);
gmhideme = atoi(row[5]);
if (account_creation){ account_creation = atoul(row[6]); }
}
@ -587,7 +584,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) {
if (LFG){ LFG = atoi(row[1]); }
if (firstlogon){ firstlogon = atoi(row[3]); }
}
loaditems = database.GetInventory(cid, &m_inv); /* Load Character Inventory */
database.LoadCharacterBandolier(cid, &m_pp); /* Load Character Bandolier */
database.LoadCharacterBindPoint(cid, &m_pp); /* Load Character Bind */
@ -603,6 +600,13 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) {
database.LoadCharacterLanguages(cid, &m_pp); /* Load Character Languages */
database.LoadCharacterLeadershipAA(cid, &m_pp); /* Load Character Leadership AA's */
/* Set item material tint */
for (int i = EmuConstants::MATERIAL_BEGIN; i <= EmuConstants::MATERIAL_END; i++)
if (m_pp.item_tint[i].rgb.use_tint == 1 || m_pp.item_tint[i].rgb.use_tint == 255)
m_pp.item_tint[i].rgb.use_tint = 0xFF;
std::cout << "Character Data Load Took " << (((float)(std::clock() - t)) / CLOCKS_PER_SEC) << " seconds\n" << std::endl;
if (level){ level = m_pp.level; }
/* If GM, not trackable */
@ -4981,6 +4985,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app)
/* Memorized Spell */
if (m_pp.mem_spells[castspell->slot] && m_pp.mem_spells[castspell->slot] == castspell->spell_id){
uint16 spell_to_cast = 0;
if (castspell->slot < MAX_PP_MEMSPELL) {
spell_to_cast = m_pp.mem_spells[castspell->slot];

View File

@ -1032,7 +1032,12 @@ bool ZoneDatabase::LoadCharacterMemmedSpells(uint32 character_id, PlayerProfile_
"`character_memmed_spells` "
"WHERE `id` = %u ORDER BY `slot_id`", character_id);
auto results = database.QueryDatabase(query); int i = 0;
for (auto row = results.begin(); row != results.end(); ++row) { i = atoi(row[0]); pp->mem_spells[i] = atoi(row[1]); }
for (auto row = results.begin(); row != results.end(); ++row) {
i = atoi(row[0]);
if (i < MAX_PP_MEMSPELL){
pp->mem_spells[i] = atoi(row[1]);
}
}
return true;
}
@ -1045,7 +1050,12 @@ bool ZoneDatabase::LoadCharacterSpellBook(uint32 character_id, PlayerProfile_Str
"`character_spells` "
"WHERE `id` = %u ORDER BY `slot_id`", character_id);
auto results = database.QueryDatabase(query); int i = 0;
for (auto row = results.begin(); row != results.end(); ++row) { i = atoi(row[0]); pp->spell_book[i] = atoi(row[1]); }
for (auto row = results.begin(); row != results.end(); ++row) {
i = atoi(row[0]);
if (i < MAX_PP_SPELLBOOK){
pp->spell_book[i] = atoi(row[1]);
}
}
return true;
}
@ -1062,7 +1072,12 @@ bool ZoneDatabase::LoadCharacterLanguages(uint32 character_id, PlayerProfile_Str
for (i = 0; i < MAX_PP_LANGUAGE; i++){
pp->languages[i] = 0;
}
for (auto row = results.begin(); row != results.end(); ++row) { i = atoi(row[0]); pp->languages[i] = atoi(row[1]); }
for (auto row = results.begin(); row != results.end(); ++row) {
i = atoi(row[0]);
if (i < MAX_PP_LANGUAGE){
pp->languages[i] = atoi(row[1]);
}
}
return true;
}
@ -1084,7 +1099,12 @@ bool ZoneDatabase::LoadCharacterDisciplines(uint32 character_id, PlayerProfile_S
"`character_disciplines`"
"WHERE `id` = %u ORDER BY `disc_id`", character_id);
auto results = database.QueryDatabase(query); int i = 0;
for (auto row = results.begin(); row != results.end(); ++row) { pp->disciplines.values[i] = atoi(row[0]); i++; }
for (auto row = results.begin(); row != results.end(); ++row) {
if (i < MAX_PP_DISCIPLINES){
pp->disciplines.values[i] = atoi(row[0]);
}
i++;
}
return true;
}
@ -1101,7 +1121,12 @@ bool ZoneDatabase::LoadCharacterSkills(uint32 character_id, PlayerProfile_Struct
for (i = 0; i < MAX_PP_SKILL; i++){
pp->skills[i] = 0;
}
for (auto row = results.begin(); row != results.end(); ++row) { i = atoi(row[0]); pp->skills[i] = atoi(row[1]); }
for (auto row = results.begin(); row != results.end(); ++row) {
i = atoi(row[0]);
if (i < MAX_PP_SKILL){
pp->skills[i] = atoi(row[1]);
}
}
return true;
}

View File

@ -386,17 +386,6 @@ void Client::DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instanc
strcpy(ztz->name, GetName());
ztz->guild_id = GuildID();
worldserver.SendPacket(pack);
printf("ZONING REQUEST TO WORLD\n");
printf("ztz->response %u \n", ztz->response);
printf("ztz->current_zone_id %u \n", ztz->current_zone_id);
printf("ztz->current_instance_id %u \n", ztz->current_instance_id);
printf("ztz->requested_zone_id %u \n", ztz->requested_zone_id);
printf("ztz->requested_instance_id %u \n", ztz->requested_instance_id);
printf("ztz->admin %u \n", ztz->admin);
printf("ztz->ignorerestrictions %u \n", ztz->ignorerestrictions);
printf("ztz->guild_id %u \n", ztz->guild_id);
safe_delete(pack);
}