mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-14 11:52:25 +00:00
Fix for issue #270, fix for temp merchant lists not loading correctly, fix for ah redundant getadventurestats code.
This commit is contained in:
parent
ea734c90b5
commit
15cec40ed5
@ -2949,11 +2949,20 @@ char* Database::GetGroupLeaderForLogin(const char* name, char* leaderbuf){
|
||||
}
|
||||
|
||||
void Database::SetGroupLeaderName(uint32 gid, const char* name) {
|
||||
std::string query = StringFormat("REPLACE INTO `group_leaders` SET `gid` = %lu, `leadername` = '%s'",(unsigned long)gid,name);
|
||||
auto results = QueryDatabase(query);
|
||||
std::string query = StringFormat("UPDATE group_leaders SET leadername = '%s' WHERE gid = %u", EscapeString(name).c_str(), gid);
|
||||
auto result = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
std::cout << "Unable to set group leader: " << results.ErrorMessage() << std::endl;
|
||||
if(result.RowsAffected() != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
query = StringFormat("INSERT INTO group_leaders(gid, leadername, marknpc, leadershipaa, maintank, assist, puller) VALUES(%u, '%s', '', '', '', '', '')",
|
||||
gid, EscapeString(name).c_str());
|
||||
result = QueryDatabase(query);
|
||||
|
||||
if(!result.Success()) {
|
||||
LogFile->write(EQEMuLog::Debug, "Error in Database::SetGroupLeaderName: %s", result.ErrorMessage().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
char *Database::GetGroupLeadershipInfo(uint32 gid, char* leaderbuf, char* maintank, char* assist, char* puller, char *marknpc, GroupLeadershipAA_Struct* GLAA){
|
||||
@ -3696,8 +3705,7 @@ void Database::UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win)
|
||||
QueryDatabase(query);
|
||||
}
|
||||
|
||||
bool Database::GetAdventureStats(uint32 char_id, uint32 &guk_w, uint32 &mir_w, uint32 &mmc_w, uint32 &ruj_w,
|
||||
uint32 &tak_w, uint32 &guk_l, uint32 &mir_l, uint32 &mmc_l, uint32 &ruj_l, uint32 &tak_l)
|
||||
bool Database::GetAdventureStats(uint32 char_id, AdventureStats_Struct *as)
|
||||
{
|
||||
|
||||
std::string query = StringFormat("SELECT `guk_wins`, `mir_wins`, `mmc_wins`, `ruj_wins`, `tak_wins`, `guk_losses`, "
|
||||
@ -3712,16 +3720,18 @@ bool Database::GetAdventureStats(uint32 char_id, uint32 &guk_w, uint32 &mir_w, u
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
guk_w = atoi(row[0]);
|
||||
mir_w = atoi(row[1]);
|
||||
mmc_w = atoi(row[2]);
|
||||
ruj_w = atoi(row[3]);
|
||||
tak_w = atoi(row[4]);
|
||||
guk_l = atoi(row[5]);
|
||||
mir_l = atoi(row[6]);
|
||||
mmc_l = atoi(row[7]);
|
||||
ruj_l = atoi(row[8]);
|
||||
tak_l = atoi(row[9]);
|
||||
as->success.guk = atoi(row[0]);
|
||||
as->success.mir = atoi(row[1]);
|
||||
as->success.mmc = atoi(row[2]);
|
||||
as->success.ruj = atoi(row[3]);
|
||||
as->success.tak = atoi(row[4]);
|
||||
as->failure.guk = atoi(row[5]);
|
||||
as->failure.mir = atoi(row[6]);
|
||||
as->failure.mmc = atoi(row[7]);
|
||||
as->failure.ruj = atoi(row[8]);
|
||||
as->failure.tak = atoi(row[9]);
|
||||
as->failure.total = as->failure.guk + as->failure.mir + as->failure.mmc + as->failure.ruj + as->failure.tak;
|
||||
as->success.total = as->success.guk + as->success.mir + as->success.mmc + as->success.ruj + as->success.tak;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -174,8 +174,7 @@ public:
|
||||
* Adventure related.
|
||||
*/
|
||||
void UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win);
|
||||
bool GetAdventureStats(uint32 char_id, uint32 &guk_w, uint32 &mir_w, uint32 &mmc_w, uint32 &ruj_w, uint32 &tak_w,
|
||||
uint32 &guk_l, uint32 &mir_l, uint32 &mmc_l, uint32 &ruj_l, uint32 &tak_l);
|
||||
bool GetAdventureStats(uint32 char_id, AdventureStats_Struct *as);
|
||||
|
||||
/*
|
||||
* Account Related
|
||||
|
||||
@ -1287,7 +1287,7 @@ bool Client::UpdateLDoNPoints(int32 points, uint32 theme)
|
||||
m_pp.ldon_points_ruj += rujpts;
|
||||
m_pp.ldon_points_tak += takpts;
|
||||
points-=splitpts;
|
||||
// if anything left, recursively loop thru again
|
||||
// if anything left, recursively loop thru again
|
||||
if (splitpts !=0)
|
||||
UpdateLDoNPoints(splitpts,0);
|
||||
break;
|
||||
@ -1344,6 +1344,7 @@ bool Client::UpdateLDoNPoints(int32 points, uint32 theme)
|
||||
}
|
||||
}
|
||||
m_pp.ldon_points_available += points;
|
||||
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_AdventurePointsUpdate, sizeof(AdventurePoints_Update_Struct));
|
||||
AdventurePoints_Update_Struct* apus = (AdventurePoints_Update_Struct*)outapp->pBuffer;
|
||||
apus->ldon_available_points = m_pp.ldon_points_available;
|
||||
|
||||
@ -1405,7 +1405,22 @@ 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 */
|
||||
database.LoadCharacterTribute(cid, &m_pp); /* Load CharacterTribute */
|
||||
database.LoadCharacterLDONStats(cid, &m_pp); /* Load Character LDON Stats */
|
||||
|
||||
/* Load AdventureStats */
|
||||
AdventureStats_Struct as;
|
||||
if(database.GetAdventureStats(cid, &as))
|
||||
{
|
||||
m_pp.ldon_wins_guk = as.success.guk;
|
||||
m_pp.ldon_wins_mir = as.success.mir;
|
||||
m_pp.ldon_wins_mmc = as.success.mmc;
|
||||
m_pp.ldon_wins_ruj = as.success.ruj;
|
||||
m_pp.ldon_wins_tak = as.success.tak;
|
||||
m_pp.ldon_losses_guk = as.failure.guk;
|
||||
m_pp.ldon_losses_mir = as.failure.mir;
|
||||
m_pp.ldon_losses_mmc = as.failure.mmc;
|
||||
m_pp.ldon_losses_ruj = as.failure.ruj;
|
||||
m_pp.ldon_losses_tak = as.failure.tak;
|
||||
}
|
||||
|
||||
/* Set item material tint */
|
||||
for (int i = EmuConstants::MATERIAL_BEGIN; i <= EmuConstants::MATERIAL_END; i++)
|
||||
@ -2489,11 +2504,8 @@ void Client::Handle_OP_AdventureStatsRequest(const EQApplicationPacket *app)
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_AdventureStatsReply, sizeof(AdventureStats_Struct));
|
||||
AdventureStats_Struct *as = (AdventureStats_Struct*)outapp->pBuffer;
|
||||
|
||||
if (database.GetAdventureStats(CharacterID(), as->success.guk, as->success.mir, as->success.mmc, as->success.ruj,
|
||||
as->success.tak, as->failure.guk, as->failure.mir, as->failure.mmc, as->failure.ruj, as->failure.tak))
|
||||
if (database.GetAdventureStats(CharacterID(), as))
|
||||
{
|
||||
as->failure.total = as->failure.guk + as->failure.mir + as->failure.mmc + as->failure.ruj + as->failure.tak;
|
||||
as->success.total = as->success.guk + as->success.mir + as->success.mmc + as->success.ruj + as->success.tak;
|
||||
m_pp.ldon_wins_guk = as->success.guk;
|
||||
m_pp.ldon_wins_mir = as->success.mir;
|
||||
m_pp.ldon_wins_mmc = as->success.mmc;
|
||||
|
||||
@ -411,7 +411,7 @@ void Zone::LoadTempMerchantData() {
|
||||
"WHERE "
|
||||
"ml.npcid = se.npcid "
|
||||
"AND se.spawngroupid = s2.spawngroupid "
|
||||
"AND s2.zone = '%s' AND s2.version = %i"
|
||||
"AND s2.zone = '%s' AND s2.version = %i "
|
||||
"ORDER BY ml.slot ", GetShortName(), GetInstanceVersion());
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
|
||||
@ -1028,34 +1028,6 @@ bool ZoneDatabase::LoadCharacterLeadershipAA(uint32 character_id, PlayerProfile_
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ZoneDatabase::LoadCharacterLDONStats(uint32 character_id, PlayerProfile_Struct* pp) {
|
||||
std::string query = StringFormat("SELECT `guk_wins`, `mir_wins`, `mmc_wins`, `ruj_wins`, `tak_wins`, `guk_losses`, "
|
||||
"`mir_losses`, `mmc_losses`, `ruj_losses`, `tak_losses` FROM `adventure_stats` WHERE player_id=%u", character_id);
|
||||
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return false;
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
pp->ldon_wins_guk = atoi(row[0]);
|
||||
pp->ldon_wins_mir = atoi(row[1]);
|
||||
pp->ldon_wins_mmc = atoi(row[2]);
|
||||
pp->ldon_wins_ruj = atoi(row[3]);
|
||||
pp->ldon_wins_tak = atoi(row[4]);
|
||||
pp->ldon_losses_guk = atoi(row[5]);
|
||||
pp->ldon_losses_mir = atoi(row[6]);
|
||||
pp->ldon_losses_mmc = atoi(row[7]);
|
||||
pp->ldon_losses_ruj = atoi(row[8]);
|
||||
pp->ldon_losses_tak = atoi(row[9]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ZoneDatabase::LoadCharacterDisciplines(uint32 character_id, PlayerProfile_Struct* pp){
|
||||
std::string query = StringFormat(
|
||||
"SELECT "
|
||||
|
||||
@ -264,7 +264,6 @@ public:
|
||||
bool LoadCharacterTribute(uint32 character_id, PlayerProfile_Struct* pp);
|
||||
bool LoadCharacterPotions(uint32 character_id, PlayerProfile_Struct* pp);
|
||||
bool LoadCharacterLeadershipAA(uint32 character_id, PlayerProfile_Struct* pp);
|
||||
bool LoadCharacterLDONStats(uint32 character_id, PlayerProfile_Struct* pp);
|
||||
|
||||
/* Character Data Saves */
|
||||
bool SaveCharacterBindPoint(uint32 character_id, uint32 zone_id, uint32 instance_id, float x, float y, float z, float heading, uint8 is_home);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user