mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
Fixed Character select to be loaded from new character data tables
This commit is contained in:
+26
-26
@@ -588,35 +588,35 @@ bool Client::Save(uint8 iCommitNow) {
|
||||
/* Save Character Task */
|
||||
SaveTaskState();
|
||||
|
||||
if (iCommitNow <= 1) {
|
||||
// char* query = 0;
|
||||
// uint32_breakdown workpt;
|
||||
// workpt.b4() = DBA_b4_Entity;
|
||||
// workpt.w2_3() = GetID();
|
||||
// workpt.b1() = DBA_b1_Entity_Client_Save;
|
||||
// DBAsyncWork* dbaw = new DBAsyncWork(&database, &MTdbafq, workpt, DBAsync::Write, 0xFFFFFFFF);
|
||||
// dbaw->AddQuery(iCommitNow == 0 ? true : false, &query, database.SetPlayerProfile_MQ(&query, account_id, character_id, &m_pp, &m_inv, &m_epp, 0, 0, MaxXTargets), false);
|
||||
// if (iCommitNow == 0){
|
||||
// pQueuedSaveWorkID = dbasync->AddWork(&dbaw, 2500);
|
||||
// }
|
||||
// else {
|
||||
// dbasync->AddWork(&dbaw, 0);
|
||||
// SaveBackup();
|
||||
// }
|
||||
// safe_delete_array(query);
|
||||
// return true;
|
||||
}
|
||||
else if (database.SetPlayerProfile(account_id, character_id, &m_pp, &m_inv, &m_epp, 0, 0, MaxXTargets)) {
|
||||
SaveBackup();
|
||||
}
|
||||
else {
|
||||
std::cerr << "Failed to update player profile" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Save Character Data */
|
||||
database.SaveCharacterData(this->CharacterID(), this->AccountID(), &m_pp);
|
||||
|
||||
// if (iCommitNow <= 1) {
|
||||
// char* query = 0;
|
||||
// uint32_breakdown workpt;
|
||||
// workpt.b4() = DBA_b4_Entity;
|
||||
// workpt.w2_3() = GetID();
|
||||
// workpt.b1() = DBA_b1_Entity_Client_Save;
|
||||
// DBAsyncWork* dbaw = new DBAsyncWork(&database, &MTdbafq, workpt, DBAsync::Write, 0xFFFFFFFF);
|
||||
// dbaw->AddQuery(iCommitNow == 0 ? true : false, &query, database.SetPlayerProfile_MQ(&query, account_id, character_id, &m_pp, &m_inv, &m_epp, 0, 0, MaxXTargets), false);
|
||||
// if (iCommitNow == 0){
|
||||
// pQueuedSaveWorkID = dbasync->AddWork(&dbaw, 2500);
|
||||
// }
|
||||
// else {
|
||||
// dbasync->AddWork(&dbaw, 0);
|
||||
// SaveBackup();
|
||||
// }
|
||||
// safe_delete_array(query);
|
||||
// return true;
|
||||
// }
|
||||
// else if (database.SetPlayerProfile(account_id, character_id, &m_pp, &m_inv, &m_epp, 0, 0, MaxXTargets)) {
|
||||
// SaveBackup();
|
||||
// }
|
||||
// else {
|
||||
// std::cerr << "Failed to update player profile" << std::endl;
|
||||
// return false;
|
||||
// }
|
||||
|
||||
/* Mirror Character Data */
|
||||
database.StoreCharacterLookup(this->CharacterID());
|
||||
LogFile->write(EQEMuLog::Status, "Client::Save %i, done... Took %f seconds", character_id, ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
|
||||
|
||||
@@ -553,7 +553,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
|
||||
m_pp.item_tint[i].rgb.use_tint = 0xFF;
|
||||
|
||||
uint32 cid = CharacterID();
|
||||
character_id = cid;
|
||||
character_id = cid; /* Global character_id reference */
|
||||
|
||||
/* Flush and reload factions */
|
||||
database.RemoveTempFactions(this);
|
||||
@@ -588,8 +588,6 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
|
||||
if (RuleB(Character, SharedBankPlat))
|
||||
m_pp.platinum_shared = database.GetSharedPlatinum(database.GetAccountIDByChar(cid));
|
||||
|
||||
// if (ext) { SetExtendedProfile(ext, row[8], lengths[8]); }
|
||||
if (level){ level = atoi(row[10]); }
|
||||
if (LFP){ LFP = atoi(row[11]); }
|
||||
if (LFG){ LFG = atoi(row[12]); }
|
||||
if (firstlogon){ firstlogon = atoi(row[15]); }
|
||||
@@ -608,6 +606,8 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
|
||||
database.LoadCharacterMemmedSpells(cid, &m_pp); /* Load Character Memorized Spells */
|
||||
database.LoadCharacterDisciplines(cid, &m_pp); /* Load Character Disciplines */
|
||||
|
||||
if (level){ level = m_pp.level; }
|
||||
|
||||
/* If GM, not trackable */
|
||||
if (gmhideme) { trackable = false; }
|
||||
/* Set Con State for Reporting */
|
||||
@@ -632,9 +632,9 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
|
||||
m_pp.z = zone->safe_z();
|
||||
}
|
||||
/* If too far below ground, then fix */
|
||||
float ground_z = GetGroundZ(m_pp.x, m_pp.y, m_pp.z);
|
||||
if (m_pp.z < (ground_z - 500))
|
||||
m_pp.z = ground_z;
|
||||
// float ground_z = GetGroundZ(m_pp.x, m_pp.y, m_pp.z);
|
||||
// if (m_pp.z < (ground_z - 500))
|
||||
// m_pp.z = ground_z;
|
||||
|
||||
/* Set Mob variables for spawn */
|
||||
class_ = m_pp.class_;
|
||||
@@ -1019,8 +1019,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
|
||||
outapp = new EQApplicationPacket(OP_Weather, 12);
|
||||
Weather_Struct *ws = (Weather_Struct *)outapp->pBuffer;
|
||||
ws->val1 = 0x000000FF;
|
||||
if (zone->zone_weather == 1)
|
||||
ws->type = 0x31; // Rain
|
||||
if (zone->zone_weather == 1){ ws->type = 0x31; } // Rain
|
||||
if (zone->zone_weather == 2) {
|
||||
outapp->pBuffer[8] = 0x01;
|
||||
ws->type = 0x02;
|
||||
|
||||
+6
-11
@@ -1146,7 +1146,7 @@ bool ZoneDatabase::LoadCharacterBindPoint(uint32 character_id, PlayerProfile_Str
|
||||
}
|
||||
|
||||
bool ZoneDatabase::SaveCharacterMaterialColor(uint32 character_id, uint32 slot_id, uint32 color){
|
||||
std::string query = StringFormat("REPLACE INTO `character_material` (id, slot, color) VALUES (%u, %u, %u)", character_id, slot_id, color); QueryDatabase(query);
|
||||
std::string query = StringFormat("REPLACE INTO `character_material` (id, slot, color, use_tint) VALUES (%u, %u, %u, 255)", character_id, slot_id, color); QueryDatabase(query);
|
||||
LogFile->write(EQEMuLog::Status, "ZoneDatabase::SaveCharacterMaterialColor for character ID: %i, slot_id: %u color: %u done", character_id, slot_id, color);
|
||||
return true;
|
||||
}
|
||||
@@ -1160,9 +1160,8 @@ bool ZoneDatabase::LoadCharacterMaterialColor(uint32 character_id, PlayerProfile
|
||||
pp->item_tint[i].rgb.blue = atoi(row[r]); r++;
|
||||
pp->item_tint[i].rgb.green = atoi(row[r]); r++;
|
||||
pp->item_tint[i].rgb.red = atoi(row[r]); r++;
|
||||
if (row[r] && atoi(row[r]) > 0){ pp->item_tint[i].rgb.use_tint = 0xFF; } r++;
|
||||
pp->item_tint[i].color = atoi(row[r]); r++;
|
||||
printf("Loading color: %u tint: %u \n", pp->item_tint[i].color, pp->item_tint[i].rgb.use_tint);
|
||||
pp->item_tint[i].rgb.use_tint = atoi(row[r]);
|
||||
printf("Material Load: %u %u %u %u\n", pp->item_tint[i].rgb.blue, pp->item_tint[i].rgb.green, pp->item_tint[i].rgb.red, pp->item_tint[i].rgb.use_tint);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1445,13 +1444,9 @@ bool ZoneDatabase::SaveCharacterData(uint32 character_id, uint32 account_id, Pla
|
||||
pp->guildAutoconsent,
|
||||
pp->RestTimer
|
||||
);
|
||||
auto results = database.QueryDatabase(query);
|
||||
//if (results.RowsAffected() != 2) {
|
||||
// LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::SaveCharacterData Error! Query: %s \n", query); return false;
|
||||
//}
|
||||
//else{
|
||||
LogFile->write(EQEMuLog::Status, "ZoneDatabase::SaveCharacterData %i, done... Took %f seconds", character_id, ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
|
||||
//}
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.RowsAffected()){ std::cout << "ERROR ZoneDatabase:SaveCharacterData: " << results.ErrorMessage() << "\n\n" << query << "\n" << std::endl; }
|
||||
LogFile->write(EQEMuLog::Status, "ZoneDatabase::SaveCharacterData %i, done... Took %f seconds", character_id, ((float)(std::clock() - t)) / CLOCKS_PER_SEC);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user