mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +00:00
Fix void Database::GetCharName(uint32 char_id, char* name)
Increased MAX_PP_SPELLBOOK to 720 for UF/RoF Increased MAX_PP_MEMSPELL to 12 Implemented up to 12 spell slots Fix for public_note default value in bool BaseGuildManager::DBSetGuild(uint32 charid, uint32 guild_id, uint8 rank) Updated all CastSpell entries to use the appropriate slot type defines located now in zone/common.h Fixed Guild Loading from character_data Fixed #guild list Refactored Merchantlist loading Refactored Temp Merchantlist loading Gutted most of dbasync Added: LoadCharacterSpellBook(uint32 character_id, PlayerProfile_Struct* pp); LoadCharacterMemmedSpells(uint32 character_id, PlayerProfile_Struct* pp); LoadCharacterLanguages(uint32 character_id, PlayerProfile_Struct* pp); LoadCharacterBindPoint(uint32 character_id, PlayerProfile_Struct* pp); SaveCharacterSpellSwap(uint32 character_id, uint32 spell_id, uint32 from_slot, uint32 to_slot); SaveCharacterSpell(uint32 character_id, uint32 spell_id, uint32 slot_id); SaveCharacterMemorizedSpell(uint32 character_id, uint32 spell_id, uint32 slot_id); DeleteCharacterSpell(uint32 character_id, uint32 spell_id, uint32 slot_id); DeleteCharacterMemorizedSpell(uint32 character_id, uint32 spell_id, uint32 slot_id); Removed Zone::LoadTempMerchantData_result(MYSQL_RES* result) Removed Zone::LoadMerchantData_result(MYSQL_RES* result) Removed SharedDatabase::GetPlayerProfile Removed SharedDatabase::SetPlayerProfile Removed SharedDatabase::SetPlayerProfile_MQ Removed Zone::DBAWComplete(uint8 workpt_b1, DBAsyncWork* dbaw) from zone.cpp
This commit is contained in:
+50
-114
@@ -401,40 +401,33 @@ uint32 Zone::GetTempMerchantQuantity(uint32 NPCID, uint32 Slot) {
|
||||
|
||||
void Zone::LoadTempMerchantData(){
|
||||
LogFile->write(EQEMuLog::Status, "Loading Temporary Merchant Lists...");
|
||||
|
||||
char* query = 0;
|
||||
uint32_breakdown workpt;
|
||||
workpt.b4() = DBA_b4_Zone;
|
||||
workpt.w2_3() = 0;
|
||||
workpt.b1() = DBA_b1_Zone_MerchantListsTemp;
|
||||
DBAsyncWork* dbaw = new DBAsyncWork(&database, &MTdbafq, workpt, DBAsync::Read);
|
||||
dbaw->AddQuery(1, &query, MakeAnyLenString(&query,
|
||||
"select ml.npcid,ml.slot,ml.itemid,ml.charges "
|
||||
"from "
|
||||
" merchantlist_temp ml, "
|
||||
" spawnentry se, "
|
||||
" spawn2 s2 "
|
||||
"where "
|
||||
" ml.npcid=se.npcid "
|
||||
" and se.spawngroupid=s2.spawngroupid "
|
||||
" and s2.zone='%s' and s2.version=%u", GetShortName(), GetInstanceVersion()));
|
||||
if (!(pQueuedMerchantsWorkID = dbasync->AddWork(&dbaw))) {
|
||||
safe_delete(dbaw);
|
||||
LogFile->write(EQEMuLog::Error, "dbasync->AddWork() failed adding merchant list query");
|
||||
std::string query = StringFormat(
|
||||
"SELECT "
|
||||
"ml.npcid, "
|
||||
"ml.slot, "
|
||||
"ml.charges, "
|
||||
"ml.itemid "
|
||||
"FROM "
|
||||
"merchantlist_temp ml, "
|
||||
"spawnentry se, "
|
||||
"spawn2 s2 "
|
||||
"WHERE "
|
||||
"ml.npcid = se.npcid "
|
||||
"AND se.spawngroupid = s2.spawngroupid "
|
||||
"AND s2.zone = '%s' AND s2.version = %i", GetShortName(), GetInstanceVersion());
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in LoadTempMerchantData query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void Zone::LoadTempMerchantData_result(MYSQL_RES* result) {
|
||||
MYSQL_ROW row;
|
||||
std::map<uint32,std::list<TempMerchantList> >::iterator cur;
|
||||
std::map<uint32, std::list<TempMerchantList> >::iterator cur;
|
||||
uint32 npcid = 0;
|
||||
while((row = mysql_fetch_row(result))) {
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
TempMerchantList ml;
|
||||
ml.npcid = atoul(row[0]);
|
||||
if(npcid != ml.npcid){
|
||||
if (npcid != ml.npcid){
|
||||
cur = tmpmerchanttable.find(ml.npcid);
|
||||
if(cur == tmpmerchanttable.end()) {
|
||||
if (cur == tmpmerchanttable.end()) {
|
||||
std::list<TempMerchantList> empty;
|
||||
tmpmerchanttable[ml.npcid] = empty;
|
||||
cur = tmpmerchanttable.find(ml.npcid);
|
||||
@@ -447,9 +440,9 @@ void Zone::LoadTempMerchantData_result(MYSQL_RES* result) {
|
||||
ml.origslot = ml.slot;
|
||||
cur->second.push_back(ml);
|
||||
}
|
||||
pQueuedMerchantsWorkID = 0;
|
||||
}
|
||||
|
||||
//there should prolly be a temp counterpart of this...
|
||||
void Zone::LoadNewMerchantData(uint32 merchantid){
|
||||
|
||||
std::list<MerchantList> merlist;
|
||||
@@ -476,16 +469,35 @@ void Zone::LoadNewMerchantData(uint32 merchantid){
|
||||
merchanttable[merchantid] = merlist;
|
||||
}
|
||||
|
||||
void Zone::LoadMerchantData_result(MYSQL_RES* result) {
|
||||
MYSQL_ROW row;
|
||||
std::map<uint32,std::list<MerchantList> >::iterator cur;
|
||||
void Zone::GetMerchantDataForZoneLoad(){
|
||||
LogFile->write(EQEMuLog::Status, "Loading Merchant Lists...");
|
||||
std::string query = StringFormat(
|
||||
"SELECT "
|
||||
"ml.merchantid, "
|
||||
"ml.slot, "
|
||||
"ml.item, "
|
||||
"ml.faction_required, "
|
||||
"ml.level_required, "
|
||||
"ml.alt_currency_cost, "
|
||||
"ml.classes_required, "
|
||||
"ml.probability "
|
||||
"FROM "
|
||||
"merchantlist AS ml, "
|
||||
"npc_types AS nt, "
|
||||
"spawnentry AS se, "
|
||||
"spawn2 AS s2 "
|
||||
"WHERE nt.merchant_id = ml.merchantid AND nt.id = se.npcid "
|
||||
"AND se.spawngroupid = s2.spawngroupid AND s2.zone = '%s' AND s2.version = %i ", GetShortName(), GetInstanceVersion());
|
||||
auto results = database.QueryDatabase(query);
|
||||
std::map<uint32, std::list<MerchantList> >::iterator cur;
|
||||
uint32 npcid = 0;
|
||||
while((row = mysql_fetch_row(result))) {
|
||||
if (results.RowCount() == 0){ LogFile->write(EQEMuLog::Error, "Error in loading Merchant Data for zone"); return; }
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
MerchantList ml;
|
||||
ml.id = atoul(row[0]);
|
||||
if(npcid != ml.id){
|
||||
if (npcid != ml.id){
|
||||
cur = merchanttable.find(ml.id);
|
||||
if(cur == merchanttable.end()) {
|
||||
if (cur == merchanttable.end()) {
|
||||
std::list<MerchantList> empty;
|
||||
merchanttable[ml.id] = empty;
|
||||
cur = merchanttable.find(ml.id);
|
||||
@@ -495,15 +507,15 @@ void Zone::LoadMerchantData_result(MYSQL_RES* result) {
|
||||
|
||||
std::list<MerchantList>::iterator iter = cur->second.begin();
|
||||
bool found = false;
|
||||
while(iter != cur->second.end()) {
|
||||
if((*iter).item == ml.id) {
|
||||
while (iter != cur->second.end()) {
|
||||
if ((*iter).item == ml.id) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
|
||||
if(found) {
|
||||
if (found) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -516,28 +528,7 @@ void Zone::LoadMerchantData_result(MYSQL_RES* result) {
|
||||
ml.probability = atoul(row[7]);
|
||||
cur->second.push_back(ml);
|
||||
}
|
||||
}
|
||||
|
||||
void Zone::GetMerchantDataForZoneLoad(){
|
||||
LogFile->write(EQEMuLog::Status, "Loading Merchant Lists...");
|
||||
char* query = 0;
|
||||
uint32_breakdown workpt;
|
||||
workpt.b4() = DBA_b4_Zone;
|
||||
workpt.w2_3() = 0;
|
||||
workpt.b1() = DBA_b1_Zone_MerchantLists;
|
||||
DBAsyncWork* dbaw = new DBAsyncWork(&database, &MTdbafq, workpt, DBAsync::Read);
|
||||
dbaw->AddQuery(1, &query, MakeAnyLenString(&query,
|
||||
"select ml.merchantid,ml.slot,ml.item,ml.faction_required,ml.level_required,ml.alt_currency_cost,ml.classes_required,ml.probability "
|
||||
"from merchantlist ml, npc_types nt, spawnentry se, spawn2 s2 "
|
||||
"where nt.merchant_id=ml.merchantid and nt.id=se.npcid "
|
||||
"and se.spawngroupid=s2.spawngroupid and s2.zone='%s' and s2.version=%u "
|
||||
//"group by ml.merchantid,slot order by merchantid,slot asc" //this made the query use a temp table/filesort (very slow)... so we handle unsorted data on our end.
|
||||
, GetShortName(), GetInstanceVersion()));
|
||||
if (!(pQueuedMerchantsWorkID = dbasync->AddWork(&dbaw))) {
|
||||
safe_delete(dbaw);
|
||||
LogFile->write(EQEMuLog::Error,"dbasync->AddWork() failed adding merchant list query");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void Zone::LoadMercTemplates(){
|
||||
@@ -663,61 +654,6 @@ void Zone::LoadMercSpells(){
|
||||
|
||||
}
|
||||
|
||||
void Zone::DBAWComplete(uint8 workpt_b1, DBAsyncWork* dbaw) {
|
||||
// LogFile->write(EQEMuLog::Debug, "Zone work complete...");
|
||||
switch (workpt_b1) {
|
||||
case DBA_b1_Zone_MerchantLists: {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
MYSQL_RES* result = 0;
|
||||
DBAsyncQuery* dbaq = dbaw->PopAnswer();
|
||||
if(dbaq == nullptr) {
|
||||
LogFile->write(EQEMuLog::Error, "nullptr answer provided for async merchant list load.");
|
||||
break;
|
||||
}
|
||||
if(!dbaq->GetAnswer(errbuf, &result)) {
|
||||
LogFile->write(EQEMuLog::Error, "Zone::DBAWComplete(): Unable to get results for merchant lists");
|
||||
break;
|
||||
}
|
||||
if(dbaq->QPT() != 1) {
|
||||
LogFile->write(EQEMuLog::Error, "Zone::DBAWComplete(): Invalid query part for merchant lists");
|
||||
break;
|
||||
}
|
||||
|
||||
LoadMerchantData_result(result);
|
||||
|
||||
pQueuedMerchantsWorkID = 0;
|
||||
break;
|
||||
}
|
||||
case DBA_b1_Zone_MerchantListsTemp: {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
MYSQL_RES* result = 0;
|
||||
DBAsyncQuery* dbaq = dbaw->PopAnswer();
|
||||
if(dbaq == nullptr) {
|
||||
LogFile->write(EQEMuLog::Error, "nullptr answer provided for async temp merchant list load.");
|
||||
break;
|
||||
}
|
||||
if(!dbaq->GetAnswer(errbuf, &result)) {
|
||||
LogFile->write(EQEMuLog::Error, "Zone::DBAWComplete(): Unable to get results for temp merchant lists");
|
||||
break;
|
||||
}
|
||||
if(dbaq->QPT() != 1) {
|
||||
LogFile->write(EQEMuLog::Error, "Zone::DBAWComplete(): Invalid query part for temp merchant lists");
|
||||
break;
|
||||
}
|
||||
|
||||
LoadTempMerchantData_result(result);
|
||||
|
||||
pQueuedMerchantsWorkID = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
LogFile->write(EQEMuLog::Error, "Zone::DBAWComplete(): Unknown workpt_b1");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Zone::IsLoaded() {
|
||||
return ZoneLoaded;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user