Core/DBLayer:
- Rewrite Field class to be able to store both binary prepared statement data and data from adhoc query resultsets
- Buffer the data of prepared statements using ResultSet and Field classes and let go of mysql c api structures after PreparedResultSet constructor. Fixes a race condition and thus a possible crash/data corruption (issue pointed out to Derex, basic suggestion by raczman)
- Conform PreparedResultSet and ResultSet to the same design standards, and using Field class as data buffer class for both
* NOTE: This means the fetching methods are uniform again, using ¨Field* fields = result->Fetch();¨ and access to elements trough fields[x].
* NOTE: for access to the correct row in prepared statements, ¨Field* fields = result->Fetch();¨ must ALWAYS be called inside the do { }while(result->NextRow()) loop.
* NOTE: This means that Field::GetString() returns std::string object and Field::GetCString() returns const char* pointer.
Still experimental and all that jazz, not recommended for production servers until feedback is given.
--HG--
branch : trunk
This commit is contained in:
@@ -183,7 +183,7 @@ bool AccountMgr::GetName(uint32 acc_id, std::string &name)
|
||||
QueryResult result = LoginDatabase.PQuery("SELECT username FROM account WHERE id = '%u'", acc_id);
|
||||
if (result)
|
||||
{
|
||||
name = (*result)[0].GetCppString();
|
||||
name = (*result)[0].GetString();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -559,27 +559,30 @@ void AchievementMgr::LoadFromDB(PreparedQueryResult achievementResult, PreparedQ
|
||||
{
|
||||
if (achievementResult)
|
||||
{
|
||||
Field* fields = achievementResult->Fetch();
|
||||
do
|
||||
{
|
||||
uint32 achievement_id = achievementResult->GetUInt32(0);
|
||||
uint32 achievement_id = fields[0].GetUInt32();
|
||||
|
||||
// don't must happen: cleanup at server startup in sAchievementMgr.LoadCompletedAchievements()
|
||||
if (!sAchievementStore.LookupEntry(achievement_id))
|
||||
continue;
|
||||
|
||||
CompletedAchievementData& ca = m_completedAchievements[achievement_id];
|
||||
ca.date = time_t(achievementResult->GetUInt64(1));
|
||||
ca.date = time_t(fields[1].GetUInt64());
|
||||
ca.changed = false;
|
||||
} while (achievementResult->NextRow());
|
||||
}
|
||||
while (achievementResult->NextRow());
|
||||
}
|
||||
|
||||
if (criteriaResult)
|
||||
{
|
||||
Field* fields = criteriaResult->Fetch();
|
||||
do
|
||||
{
|
||||
uint32 id = criteriaResult->GetUInt32(0);
|
||||
uint32 counter = criteriaResult->GetUInt32(1);
|
||||
time_t date = time_t(criteriaResult->GetUInt64(2));
|
||||
uint32 id = fields[0].GetUInt32();
|
||||
uint32 counter = fields[1].GetUInt32();
|
||||
time_t date = time_t(fields[2].GetUInt64());
|
||||
|
||||
AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(id);
|
||||
if (!criteria)
|
||||
@@ -597,9 +600,9 @@ void AchievementMgr::LoadFromDB(PreparedQueryResult achievementResult, PreparedQ
|
||||
progress.counter = counter;
|
||||
progress.date = date;
|
||||
progress.changed = false;
|
||||
} while (criteriaResult->NextRow());
|
||||
}
|
||||
while (criteriaResult->NextRow());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement)
|
||||
@@ -2129,7 +2132,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
|
||||
}
|
||||
|
||||
uint32 dataType = fields[1].GetUInt32();
|
||||
const char* scriptName = fields[4].GetString();
|
||||
const char* scriptName = fields[4].GetCString();
|
||||
uint32 scriptId = 0;
|
||||
if (strcmp(scriptName, "")) // not empty
|
||||
{
|
||||
@@ -2312,8 +2315,8 @@ void AchievementGlobalMgr::LoadRewards()
|
||||
reward.titleId[1] = fields[2].GetUInt32();
|
||||
reward.itemId = fields[3].GetUInt32();
|
||||
reward.sender = fields[4].GetUInt32();
|
||||
reward.subject = fields[5].GetCppString();
|
||||
reward.text = fields[6].GetCppString();
|
||||
reward.subject = fields[5].GetString();
|
||||
reward.text = fields[6].GetString();
|
||||
|
||||
// must be title or mail at least
|
||||
if (!reward.titleId[0] && !reward.titleId[1] && !reward.sender)
|
||||
@@ -2422,10 +2425,10 @@ void AchievementGlobalMgr::LoadRewardLocales()
|
||||
for (int i = 1; i < MAX_LOCALE; ++i)
|
||||
{
|
||||
LocaleConstant locale = (LocaleConstant) i;
|
||||
std::string str = fields[1 + 2 * (i - 1)].GetCppString();
|
||||
std::string str = fields[1 + 2 * (i - 1)].GetString();
|
||||
sObjectMgr.AddLocaleString(str, locale, data.subject);
|
||||
|
||||
str = fields[1 + 2 * (i - 1) + 1].GetCppString();
|
||||
str = fields[1 + 2 * (i - 1) + 1].GetString();
|
||||
sObjectMgr.AddLocaleString(str, locale, data.text);
|
||||
}
|
||||
} while (result->NextRow());
|
||||
|
||||
@@ -52,7 +52,7 @@ void AddonMgr::LoadFromDB()
|
||||
bar.step();
|
||||
count++;
|
||||
|
||||
std::string name = fields[0].GetCppString();
|
||||
std::string name = fields[0].GetString();
|
||||
uint32 crc = fields[1].GetUInt32();
|
||||
|
||||
SavedAddon addon(name, crc);
|
||||
|
||||
@@ -324,9 +324,11 @@ void AuctionHouseMgr::LoadAuctionItems()
|
||||
do
|
||||
{
|
||||
bar.step();
|
||||
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 item_guid = result->GetUInt32(11);
|
||||
uint32 item_template = result->GetUInt32(12);
|
||||
uint32 item_guid = fields[11].GetUInt32();
|
||||
uint32 item_template = fields[12].GetUInt32();
|
||||
|
||||
ItemPrototype const *proto = sObjectMgr.GetItemPrototype(item_template);
|
||||
|
||||
@@ -346,7 +348,8 @@ void AuctionHouseMgr::LoadAuctionItems()
|
||||
AddAItem(item);
|
||||
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %u auction items", count);
|
||||
|
||||
@@ -128,7 +128,7 @@ bool ArenaTeam::AddMember(const uint64& PlayerGuid)
|
||||
if (!result)
|
||||
return false;
|
||||
|
||||
plName = (*result)[0].GetCppString();
|
||||
plName = (*result)[0].GetString();
|
||||
plClass = (*result)[1].GetUInt8();
|
||||
|
||||
// check if player already in arenateam of that size
|
||||
@@ -186,7 +186,7 @@ bool ArenaTeam::LoadArenaTeamFromDB(QueryResult arenaTeamDataResult)
|
||||
Field *fields = arenaTeamDataResult->Fetch();
|
||||
|
||||
m_TeamId = fields[0].GetUInt32();
|
||||
m_Name = fields[1].GetCppString();
|
||||
m_Name = fields[1].GetString();
|
||||
m_CaptainGuid = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER);
|
||||
m_Type = fields[3].GetUInt32();
|
||||
m_BackgroundColor = fields[4].GetUInt32();
|
||||
@@ -251,7 +251,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult arenaTeamMembersResult)
|
||||
newmember.wins_week = fields[3].GetUInt32();
|
||||
newmember.games_season = fields[4].GetUInt32();
|
||||
newmember.wins_season = fields[5].GetUInt32();
|
||||
newmember.name = fields[6].GetCppString();
|
||||
newmember.name = fields[6].GetString();
|
||||
newmember.Class = fields[7].GetUInt8();
|
||||
newmember.personal_rating = personalrating;
|
||||
newmember.matchmaker_rating = matchmakerrating;
|
||||
|
||||
@@ -774,7 +774,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
|
||||
}
|
||||
|
||||
selectionWeight = fields[9].GetUInt8();
|
||||
scriptId = sObjectMgr.GetScriptId(fields[10].GetString());
|
||||
scriptId = sObjectMgr.GetScriptId(fields[10].GetCString());
|
||||
//sLog.outDetail("Creating battleground %s, %u-%u", bl->name[sWorld.GetDBClang()], MinLvl, MaxLvl);
|
||||
if (!CreateBattleground(bgTypeID, IsArena, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, bl->name[sWorld.GetDefaultDbcLocale()], bl->mapid[0], AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3], scriptId))
|
||||
continue;
|
||||
|
||||
@@ -62,7 +62,7 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team)
|
||||
m_moderate = fields[1].GetBool();
|
||||
m_public = fields[2].GetBool();
|
||||
m_password = fields[3].GetString();
|
||||
const char* db_BannedList = fields[4].GetString();
|
||||
const char* db_BannedList = fields[4].GetCString();
|
||||
|
||||
m_IsSaved = true;
|
||||
|
||||
|
||||
@@ -814,9 +814,9 @@ ChatCommand * ChatHandler::getCommandTable()
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
std::string name = fields[0].GetCppString();
|
||||
std::string name = fields[0].GetString();
|
||||
|
||||
SetDataForCommandInTable(commandTable, name.c_str(), fields[1].GetUInt16(), fields[2].GetCppString(), name);
|
||||
SetDataForCommandInTable(commandTable, name.c_str(), fields[1].GetUInt16(), fields[2].GetString(), name);
|
||||
|
||||
} while (result->NextRow());
|
||||
}
|
||||
|
||||
@@ -2210,17 +2210,17 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
|
||||
if (result)
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
username = fields[0].GetCppString();
|
||||
username = fields[0].GetString();
|
||||
security = fields[1].GetUInt32();
|
||||
email = fields[2].GetCppString();
|
||||
email = fields[2].GetString();
|
||||
|
||||
if (email.empty())
|
||||
email = "-";
|
||||
|
||||
if (!m_session || m_session->GetSecurity() >= AccountTypes(security))
|
||||
{
|
||||
last_ip = fields[3].GetCppString();
|
||||
last_login = fields[4].GetCppString();
|
||||
last_ip = fields[3].GetString();
|
||||
last_login = fields[4].GetString();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2528,7 +2528,7 @@ bool ChatHandler::HandleWpEventCommand(const char* args)
|
||||
a4 = fields[2].GetUInt32();
|
||||
a5 = fields[3].GetUInt32();
|
||||
a6 = fields[4].GetUInt32();
|
||||
a7 = fields[5].GetString();
|
||||
a7 = fields[5].GetCString();
|
||||
a8 = fields[6].GetFloat();
|
||||
a9 = fields[7].GetFloat();
|
||||
a10 = fields[8].GetFloat();
|
||||
@@ -3856,7 +3856,7 @@ bool ChatHandler::LookupPlayerSearchCommand(QueryResult result, int32 limit)
|
||||
|
||||
Field* fields = result->Fetch();
|
||||
uint32 acc_id = fields[0].GetUInt32();
|
||||
std::string acc_name = fields[1].GetCppString();
|
||||
std::string acc_name = fields[1].GetString();
|
||||
|
||||
QueryResult chars = CharacterDatabase.PQuery("SELECT guid,name FROM characters WHERE account = '%u'", acc_id);
|
||||
if (chars)
|
||||
@@ -3870,7 +3870,7 @@ bool ChatHandler::LookupPlayerSearchCommand(QueryResult result, int32 limit)
|
||||
{
|
||||
Field* charfields = chars->Fetch();
|
||||
guid = charfields[0].GetUInt64();
|
||||
name = charfields[1].GetCppString();
|
||||
name = charfields[1].GetString();
|
||||
|
||||
PSendSysMessage(LANG_LOOKUP_PLAYER_CHARACTER,name.c_str(),guid);
|
||||
++i;
|
||||
|
||||
@@ -324,21 +324,21 @@ bool ChatHandler::HandleReloadCreatureTemplateCommand(const char* args)
|
||||
const_cast<CreatureInfo*>(cInfo)->Modelid3 = fields[7].GetUInt32();
|
||||
const_cast<CreatureInfo*>(cInfo)->Modelid4 = fields[8].GetUInt32();
|
||||
size_t len = 0;
|
||||
if (const char* temp = fields[9].GetString())
|
||||
if (const char* temp = fields[9].GetCString())
|
||||
{
|
||||
delete[] cInfo->Name;
|
||||
len = strlen(temp)+1;
|
||||
const_cast<CreatureInfo*>(cInfo)->Name = new char[len];
|
||||
strncpy(cInfo->Name, temp, len);
|
||||
}
|
||||
if (const char* temp = fields[10].GetString())
|
||||
if (const char* temp = fields[10].GetCString())
|
||||
{
|
||||
delete[] cInfo->SubName;
|
||||
len = strlen(temp)+1;
|
||||
const_cast<CreatureInfo*>(cInfo)->SubName = new char[len];
|
||||
strncpy(cInfo->SubName, temp, len);
|
||||
}
|
||||
if (const char* temp = fields[11].GetString())
|
||||
if (const char* temp = fields[11].GetCString())
|
||||
{
|
||||
delete[] cInfo->IconName;
|
||||
len = strlen(temp)+1;
|
||||
@@ -397,7 +397,7 @@ bool ChatHandler::HandleReloadCreatureTemplateCommand(const char* args)
|
||||
const_cast<CreatureInfo*>(cInfo)->VehicleId = fields[61].GetUInt32();
|
||||
const_cast<CreatureInfo*>(cInfo)->mingold = fields[62].GetUInt32();
|
||||
const_cast<CreatureInfo*>(cInfo)->maxgold = fields[63].GetUInt32();
|
||||
if (const char* temp = fields[64].GetString())
|
||||
if (const char* temp = fields[64].GetCString())
|
||||
{
|
||||
delete[] cInfo->AIName;
|
||||
len = strlen(temp)+1;
|
||||
@@ -421,7 +421,7 @@ bool ChatHandler::HandleReloadCreatureTemplateCommand(const char* args)
|
||||
const_cast<CreatureInfo*>(cInfo)->equipmentId = fields[79].GetUInt32();
|
||||
const_cast<CreatureInfo*>(cInfo)->MechanicImmuneMask = fields[80].GetUInt32();
|
||||
const_cast<CreatureInfo*>(cInfo)->flags_extra = fields[81].GetUInt32();
|
||||
const_cast<CreatureInfo*>(cInfo)->ScriptID = sObjectMgr.GetScriptId(fields[82].GetString());
|
||||
const_cast<CreatureInfo*>(cInfo)->ScriptID = sObjectMgr.GetScriptId(fields[82].GetCString());
|
||||
|
||||
sObjectMgr.CheckCreatureTemplate(cInfo);
|
||||
|
||||
@@ -2649,7 +2649,7 @@ bool ChatHandler::HandleListItemCommand(const char *args)
|
||||
uint32 item_slot = fields[2].GetUInt32();
|
||||
uint32 owner_guid = fields[3].GetUInt32();
|
||||
uint32 owner_acc = fields[4].GetUInt32();
|
||||
std::string owner_name = fields[5].GetCppString();
|
||||
std::string owner_name = fields[5].GetString();
|
||||
|
||||
char const* item_pos = 0;
|
||||
if (Player::IsEquipmentPos(item_bag,item_slot))
|
||||
@@ -2700,9 +2700,9 @@ bool ChatHandler::HandleListItemCommand(const char *args)
|
||||
uint32 item_s = fields[1].GetUInt32();
|
||||
uint32 item_r = fields[2].GetUInt32();
|
||||
uint32 item_s_acc = fields[3].GetUInt32();
|
||||
std::string item_s_name = fields[4].GetCppString();
|
||||
std::string item_s_name = fields[4].GetString();
|
||||
uint32 item_r_acc = fields[5].GetUInt32();
|
||||
std::string item_r_name = fields[6].GetCppString();
|
||||
std::string item_r_name = fields[6].GetString();
|
||||
|
||||
char const* item_pos = "[in mail]";
|
||||
|
||||
@@ -2743,7 +2743,7 @@ bool ChatHandler::HandleListItemCommand(const char *args)
|
||||
uint32 item_guid = fields[0].GetUInt32();
|
||||
uint32 owner = fields[1].GetUInt32();
|
||||
uint32 owner_acc = fields[2].GetUInt32();
|
||||
std::string owner_name = fields[3].GetCppString();
|
||||
std::string owner_name = fields[3].GetString();
|
||||
|
||||
char const* item_pos = "[in auction]";
|
||||
|
||||
@@ -2770,7 +2770,7 @@ bool ChatHandler::HandleListItemCommand(const char *args)
|
||||
Field *fields = result->Fetch();
|
||||
uint32 item_guid = fields[0].GetUInt32();
|
||||
uint32 guild_guid = fields[1].GetUInt32();
|
||||
std::string guild_name = fields[2].GetCppString();
|
||||
std::string guild_name = fields[2].GetString();
|
||||
|
||||
char const* item_pos = "[in guild bank]";
|
||||
|
||||
@@ -5895,7 +5895,7 @@ bool ChatHandler::HandleBanInfoCharacterCommand(const char *args)
|
||||
return false;
|
||||
}
|
||||
|
||||
target_guid = resultCharacter->GetUInt32(0);
|
||||
target_guid = (*resultCharacter)[0].GetUInt32();
|
||||
}
|
||||
else
|
||||
target_guid = target->GetGUIDLow();
|
||||
@@ -5909,15 +5909,17 @@ bool ChatHandler::HandleBanInfoCharacterCommand(const char *args)
|
||||
PSendSysMessage(LANG_BANINFO_BANHISTORY, name.c_str());
|
||||
do
|
||||
{
|
||||
time_t unbandate = time_t(result->GetUInt64(3));
|
||||
Field* fields = result->Fetch();
|
||||
time_t unbandate = time_t(fields[3].GetUInt64());
|
||||
bool active = false;
|
||||
if (result->GetUInt8(2) && (!result->GetUInt64(1) || unbandate >= time(NULL)))
|
||||
if (fields[2].GetUInt8() && (!fields[1].GetUInt64() || unbandate >= time(NULL)))
|
||||
active = true;
|
||||
bool permanent = (result->GetUInt64(1) == uint64(0));
|
||||
std::string bantime = permanent ? GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(result->GetUInt64(1), true);
|
||||
bool permanent = (fields[1].GetUInt64() == uint64(0));
|
||||
std::string bantime = permanent ? GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt64(), true);
|
||||
PSendSysMessage(LANG_BANINFO_HISTORYENTRY,
|
||||
result->GetCString(0), bantime.c_str(), active ? GetTrinityString(LANG_BANINFO_YES) : GetTrinityString(LANG_BANINFO_NO), result->GetCString(4), result->GetCString(5));
|
||||
} while (result->NextRow());
|
||||
fields[0].GetCString(), bantime.c_str(), active ? GetTrinityString(LANG_BANINFO_YES) : GetTrinityString(LANG_BANINFO_NO), fields[4].GetCString(), fields[5].GetCString());
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -6006,12 +6008,14 @@ bool ChatHandler::HandleBanListCharacterCommand(const char *args)
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
PreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_GET_BANNED_NAME);
|
||||
stmt2->setUInt32(0, result->GetUInt32(0));
|
||||
stmt2->setUInt32(0, fields[0].GetUInt32());
|
||||
PreparedQueryResult banresult = CharacterDatabase.Query(stmt2);
|
||||
if (banresult)
|
||||
PSendSysMessage("%s", banresult->GetCString(0));
|
||||
} while (result->NextRow());
|
||||
PSendSysMessage("%s", (*banresult)[0].GetCString());
|
||||
}
|
||||
while (result->NextRow());
|
||||
}
|
||||
// Console wide output
|
||||
else
|
||||
@@ -6023,38 +6027,41 @@ bool ChatHandler::HandleBanListCharacterCommand(const char *args)
|
||||
{
|
||||
SendSysMessage("-------------------------------------------------------------------------------");
|
||||
|
||||
std::string char_name;
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
char_name = result->GetString(1);
|
||||
std::string char_name = fields[1].GetString();
|
||||
|
||||
PreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_GET_BANINFO_LIST);
|
||||
stmt2->setUInt32(0, result->GetUInt32(0));
|
||||
stmt2->setUInt32(0, fields[0].GetUInt32());
|
||||
PreparedQueryResult banInfo = CharacterDatabase.Query(stmt2);
|
||||
if (banInfo)
|
||||
{
|
||||
Field* banFields = banInfo->Fetch();
|
||||
do
|
||||
{
|
||||
time_t t_ban = banInfo->GetUInt64(0);
|
||||
time_t t_ban = banFields[0].GetUInt64();
|
||||
tm* aTm_ban = localtime(&t_ban);
|
||||
|
||||
if (banInfo->GetUInt64(0) == banInfo->GetUInt64(1))
|
||||
if (banFields[0].GetUInt64() == banFields[1].GetUInt64())
|
||||
{
|
||||
PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|",
|
||||
char_name.c_str(), aTm_ban->tm_year%100, aTm_ban->tm_mon+1, aTm_ban->tm_mday, aTm_ban->tm_hour, aTm_ban->tm_min,
|
||||
banInfo->GetCString(2), banInfo->GetCString(3));
|
||||
banFields[2].GetCString(), banFields[3].GetCString());
|
||||
}
|
||||
else
|
||||
{
|
||||
time_t t_unban = banInfo->GetUInt64(1);
|
||||
time_t t_unban = banFields[1].GetUInt64();
|
||||
tm* aTm_unban = localtime(&t_unban);
|
||||
PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|",
|
||||
char_name.c_str(), aTm_ban->tm_year%100, aTm_ban->tm_mon+1, aTm_ban->tm_mday, aTm_ban->tm_hour, aTm_ban->tm_min,
|
||||
aTm_unban->tm_year%100, aTm_unban->tm_mon+1, aTm_unban->tm_mday, aTm_unban->tm_hour, aTm_unban->tm_min,
|
||||
banInfo->GetCString(2), banInfo->GetCString(3));
|
||||
banFields[2].GetCString(), banFields[3].GetCString());
|
||||
}
|
||||
} while (banInfo->NextRow());
|
||||
}
|
||||
while (banInfo->NextRow());
|
||||
}
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
SendSysMessage(" =============================================================================== ");
|
||||
}
|
||||
|
||||
@@ -6128,7 +6135,7 @@ bool ChatHandler::HandleBanListHelper(QueryResult result)
|
||||
|
||||
// "account" case, name can be get in same query
|
||||
if (result->GetFieldCount() > 1)
|
||||
account_name = fields[1].GetCppString();
|
||||
account_name = fields[1].GetString();
|
||||
// "character" case, name need extract from another DB
|
||||
else
|
||||
sAccountMgr.GetName (account_id,account_name);
|
||||
@@ -7537,7 +7544,7 @@ bool ChatHandler::HandleListFreezeCommand(const char * /*args*/)
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
std::string fplayers = fields[0].GetCppString();
|
||||
std::string fplayers = fields[0].GetString();
|
||||
PSendSysMessage(LANG_COMMAND_FROZEN_PLAYERS,fplayers.c_str());
|
||||
} while (result->NextRow());
|
||||
|
||||
|
||||
@@ -353,7 +353,7 @@ void ConditionMgr::LoadConditions(bool isReload)
|
||||
cond->mConditionValue2 = fields[6].GetUInt32();
|
||||
cond->mConditionValue3 = fields[7].GetUInt32();
|
||||
cond->ErrorTextd = fields[8].GetUInt32();
|
||||
cond->mScriptId = sObjectMgr.GetScriptId(fields[9].GetString());
|
||||
cond->mScriptId = sObjectMgr.GetScriptId(fields[9].GetCString());
|
||||
|
||||
if (iConditionTypeOrReference >= 0)
|
||||
cond->mConditionType = ConditionType(iConditionTypeOrReference);
|
||||
|
||||
@@ -172,7 +172,7 @@ bool Corpse::LoadFromDB(uint32 guid, Field *fields)
|
||||
Object::_Create(guid, 0, HIGHGUID_CORPSE);
|
||||
|
||||
SetUInt32Value(CORPSE_FIELD_DISPLAY_ID, fields[5].GetUInt32());
|
||||
_LoadIntoDataField(fields[6].GetString(), CORPSE_FIELD_ITEM, EQUIPMENT_SLOT_END);
|
||||
_LoadIntoDataField(fields[6].GetCString(), CORPSE_FIELD_ITEM, EQUIPMENT_SLOT_END);
|
||||
SetUInt32Value(CORPSE_FIELD_BYTES_1, fields[7].GetUInt32());
|
||||
SetUInt32Value(CORPSE_FIELD_BYTES_2, fields[8].GetUInt32());
|
||||
SetUInt32Value(CORPSE_FIELD_GUILD, fields[9].GetUInt32());
|
||||
|
||||
@@ -408,16 +408,18 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, PreparedQueryResult result
|
||||
return false;
|
||||
}
|
||||
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
// set owner (not if item is only loaded for gbank/auction/mail
|
||||
if (owner_guid != 0)
|
||||
SetOwnerGUID(owner_guid);
|
||||
|
||||
bool need_save = false; // need explicit save data at load fixes
|
||||
SetUInt64Value(ITEM_FIELD_CREATOR, MAKE_NEW_GUID(result->GetUInt32(0), 0, HIGHGUID_PLAYER));
|
||||
SetUInt64Value(ITEM_FIELD_GIFTCREATOR, MAKE_NEW_GUID(result->GetUInt32(1), 0, HIGHGUID_PLAYER));
|
||||
SetCount(result->GetUInt32(2));
|
||||
SetUInt64Value(ITEM_FIELD_CREATOR, MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER));
|
||||
SetUInt64Value(ITEM_FIELD_GIFTCREATOR, MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER));
|
||||
SetCount(fields[2].GetUInt32());
|
||||
|
||||
uint32 duration = result->GetUInt32(3);
|
||||
uint32 duration = fields[3].GetUInt32();
|
||||
SetUInt32Value(ITEM_FIELD_DURATION, duration);
|
||||
// update duration if need, and remove if not need
|
||||
if ((proto->Duration == 0) != (duration == 0))
|
||||
@@ -426,12 +428,12 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, PreparedQueryResult result
|
||||
need_save = true;
|
||||
}
|
||||
|
||||
Tokens tokens = StrSplit(result->GetString(4), " ");
|
||||
Tokens tokens = StrSplit(fields[4].GetString(), " ");
|
||||
if (tokens.size() == MAX_ITEM_PROTO_SPELLS)
|
||||
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
|
||||
SetSpellCharges(i, atoi(tokens[i].c_str()));
|
||||
|
||||
SetUInt32Value(ITEM_FIELD_FLAGS, result->GetUInt32(5));
|
||||
SetUInt32Value(ITEM_FIELD_FLAGS, fields[5].GetUInt32());
|
||||
// Remove bind flag for items vs NO_BIND set
|
||||
if (IsSoulBound() && proto->Bonding == NO_BIND)
|
||||
{
|
||||
@@ -439,13 +441,13 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, PreparedQueryResult result
|
||||
need_save = true;
|
||||
}
|
||||
|
||||
_LoadIntoDataField(result->GetString(6).c_str(), ITEM_FIELD_ENCHANTMENT_1_1, MAX_ENCHANTMENT_SLOT * MAX_ENCHANTMENT_OFFSET);
|
||||
SetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID, result->GetInt32(7));
|
||||
_LoadIntoDataField(fields[6].GetCString(), ITEM_FIELD_ENCHANTMENT_1_1, MAX_ENCHANTMENT_SLOT * MAX_ENCHANTMENT_OFFSET);
|
||||
SetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID, fields[7].GetInt32());
|
||||
// recalculate suffix factor
|
||||
if (GetItemRandomPropertyId() < 0)
|
||||
UpdateItemSuffixFactor();
|
||||
|
||||
uint32 durability = result->GetUInt32(8);
|
||||
uint32 durability = fields[8].GetUInt32();
|
||||
SetUInt32Value(ITEM_FIELD_DURABILITY, durability);
|
||||
// update max durability (and durability) if need
|
||||
SetUInt32Value(ITEM_FIELD_MAXDURABILITY, proto->MaxDurability);
|
||||
@@ -455,8 +457,8 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, PreparedQueryResult result
|
||||
need_save = true;
|
||||
}
|
||||
|
||||
SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, result->GetUInt32(9));
|
||||
SetText(result->GetString(10));
|
||||
SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, fields[9].GetUInt32());
|
||||
SetText(fields[10].GetString());
|
||||
|
||||
if (need_save) // normal item changed state set not work at loading
|
||||
{
|
||||
|
||||
@@ -299,7 +299,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
||||
// load action bar, if data broken will fill later by default spells.
|
||||
if (!is_temporary_summoned)
|
||||
{
|
||||
m_charmInfo->LoadPetActionBar(fields[13].GetCppString());
|
||||
m_charmInfo->LoadPetActionBar(fields[13].GetString());
|
||||
|
||||
_LoadSpells();
|
||||
InitTalentForLevel(); // re-init to check talent count
|
||||
@@ -331,7 +331,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
||||
Field *fields2 = result->Fetch();
|
||||
for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
|
||||
{
|
||||
m_declinedname->name[i] = fields2[i].GetCppString();
|
||||
m_declinedname->name[i] = fields2[i].GetString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1652,7 +1652,7 @@ bool Player::BuildEnumData(QueryResult result, WorldPacket * p_data)
|
||||
char_flags |= CHARACTER_FLAG_LOCKED_BY_BILLING;
|
||||
if (sWorld.getBoolConfig(CONFIG_DECLINED_NAMES_USED))
|
||||
{
|
||||
if (!fields[21].GetCppString().empty())
|
||||
if (!fields[21].GetString().empty())
|
||||
char_flags |= CHARACTER_FLAG_DECLINED;
|
||||
}
|
||||
else
|
||||
@@ -1697,7 +1697,7 @@ bool Player::BuildEnumData(QueryResult result, WorldPacket * p_data)
|
||||
*p_data << uint32(petFamily);
|
||||
}
|
||||
|
||||
Tokens data = StrSplit(fields[19].GetCppString(), " ");
|
||||
Tokens data = StrSplit(fields[19].GetString(), " ");
|
||||
for (uint8 slot = 0; slot < EQUIPMENT_SLOT_END; ++slot)
|
||||
{
|
||||
uint32 visualbase = slot * 2;
|
||||
@@ -3940,13 +3940,14 @@ void Player::_LoadSpellCooldowns(PreparedQueryResult result)
|
||||
|
||||
do
|
||||
{
|
||||
uint32 spell_id = result->GetUInt32(0);
|
||||
uint32 item_id = result->GetUInt32(1);
|
||||
time_t db_time = (time_t)result->GetUInt64(2);
|
||||
Field* fields = result->Fetch();
|
||||
uint32 spell_id = fields[0].GetUInt32();
|
||||
uint32 item_id = fields[1].GetUInt32();
|
||||
time_t db_time = (time_t)fields[2].GetUInt64();
|
||||
|
||||
if (!sSpellStore.LookupEntry(spell_id))
|
||||
{
|
||||
sLog.outError("Player %u has unknown spell %u in `character_spell_cooldown`, skipping.",GetGUIDLow(),spell_id);
|
||||
sLog.outError("Player %u has unknown spell %u in `character_spell_cooldown`, skipping.", GetGUIDLow(), spell_id);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -4469,8 +4470,8 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
|
||||
uint16 mailType = fields[1].GetUInt16();
|
||||
uint16 mailTemplateId= fields[2].GetUInt16();
|
||||
uint32 sender = fields[3].GetUInt32();
|
||||
std::string subject = fields[4].GetCppString();
|
||||
std::string body = fields[5].GetCppString();
|
||||
std::string subject = fields[4].GetString();
|
||||
std::string body = fields[5].GetString();
|
||||
uint32 money = fields[6].GetUInt32();
|
||||
bool has_items = fields[7].GetBool();
|
||||
|
||||
@@ -4500,8 +4501,8 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
|
||||
{
|
||||
do
|
||||
{
|
||||
uint32 item_guidlow = resultItems->GetUInt32(11);
|
||||
uint32 item_template = resultItems->GetUInt32(12);
|
||||
uint32 item_guidlow = (*resultItems)[11].GetUInt32();
|
||||
uint32 item_template = (*resultItems)[12].GetUInt32();
|
||||
|
||||
ItemPrototype const* itemProto = sObjectMgr.GetItemPrototype(item_template);
|
||||
if (!itemProto)
|
||||
@@ -15768,7 +15769,7 @@ void Player::_LoadDeclinedNames(PreparedQueryResult result)
|
||||
delete m_declinedname;
|
||||
m_declinedname = new DeclinedName;
|
||||
for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
|
||||
m_declinedname->name[i] = result->GetString(i);
|
||||
m_declinedname->name[i] = (*result)[i].GetString();
|
||||
}
|
||||
|
||||
void Player::_LoadArenaTeamInfo(PreparedQueryResult result)
|
||||
@@ -15780,10 +15781,12 @@ void Player::_LoadArenaTeamInfo(PreparedQueryResult result)
|
||||
|
||||
do
|
||||
{
|
||||
uint32 arenateamid = result->GetUInt32(0);
|
||||
uint32 played_week = result->GetUInt32(1);
|
||||
uint32 played_season = result->GetUInt32(2);
|
||||
uint32 wons_season = result->GetUInt32(3);
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 arenateamid = fields[0].GetUInt32();
|
||||
uint32 played_week = fields[1].GetUInt32();
|
||||
uint32 played_season = fields[2].GetUInt32();
|
||||
uint32 wons_season = fields[3].GetUInt32();
|
||||
|
||||
ArenaTeam* aTeam = sObjectMgr.GetArenaTeamById(arenateamid);
|
||||
if (!aTeam)
|
||||
@@ -15800,7 +15803,8 @@ void Player::_LoadArenaTeamInfo(PreparedQueryResult result)
|
||||
SetArenaTeamInfoField(arenaSlot, ARENA_TEAM_GAMES_WEEK, played_week);
|
||||
SetArenaTeamInfoField(arenaSlot, ARENA_TEAM_GAMES_SEASON, played_season);
|
||||
SetArenaTeamInfoField(arenaSlot, ARENA_TEAM_WINS_SEASON, wons_season);
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
}
|
||||
|
||||
void Player::_LoadArenaStatsInfo(PreparedQueryResult result)
|
||||
@@ -15818,9 +15822,11 @@ void Player::_LoadArenaStatsInfo(PreparedQueryResult result)
|
||||
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 personalrating = 0;
|
||||
uint32 matchmakerrating = 1500;
|
||||
if (result->GetUInt8(0) > slot)
|
||||
if (fields[0].GetUInt8() > slot)
|
||||
{
|
||||
CharacterDatabase.PExecute("INSERT INTO character_arena_stats (guid, slot, personal_rating, matchmaker_rating) VALUES (%u, %u, %u, %u)", GetGUIDLow(), slot, personalrating, matchmakerrating);
|
||||
SetArenaTeamInfoField(slot, ARENA_TEAM_PERSONAL_RATING, personalrating);
|
||||
@@ -15828,11 +15834,12 @@ void Player::_LoadArenaStatsInfo(PreparedQueryResult result)
|
||||
continue;
|
||||
}
|
||||
|
||||
personalrating = result->GetUInt32(1);
|
||||
matchmakerrating = result->GetUInt32(2);
|
||||
personalrating = fields[1].GetUInt32();
|
||||
matchmakerrating = fields[2].GetUInt32();
|
||||
SetArenaTeamInfoField(slot, ARENA_TEAM_PERSONAL_RATING, personalrating);
|
||||
slot++;
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
}
|
||||
|
||||
void Player::_LoadEquipmentSets(PreparedQueryResult result)
|
||||
@@ -15844,16 +15851,17 @@ void Player::_LoadEquipmentSets(PreparedQueryResult result)
|
||||
uint32 count = 0;
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
EquipmentSet eqSet;
|
||||
|
||||
eqSet.Guid = result->GetUInt64(0);
|
||||
uint32 index = result->GetUInt32(1);
|
||||
eqSet.Name = result->GetString(2);
|
||||
eqSet.IconName = result->GetString(3);
|
||||
eqSet.Guid = fields[0].GetUInt64();
|
||||
uint32 index = fields[1].GetUInt32();
|
||||
eqSet.Name = fields[2].GetString();
|
||||
eqSet.IconName = fields[3].GetString();
|
||||
eqSet.state = EQUIPMENT_SET_UNCHANGED;
|
||||
|
||||
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
|
||||
eqSet.Items[i] = result->GetUInt32(4+i);
|
||||
eqSet.Items[i] = fields[4+i].GetUInt32();
|
||||
|
||||
m_EquipmentSets[index] = eqSet;
|
||||
|
||||
@@ -15861,7 +15869,8 @@ void Player::_LoadEquipmentSets(PreparedQueryResult result)
|
||||
|
||||
if (count >= MAX_EQUIPMENT_SET_INDEX) // client limit
|
||||
break;
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
}
|
||||
|
||||
void Player::_LoadBGData(PreparedQueryResult result)
|
||||
@@ -15869,18 +15878,19 @@ void Player::_LoadBGData(PreparedQueryResult result)
|
||||
if (!result)
|
||||
return;
|
||||
|
||||
Field* fields = result->Fetch();
|
||||
// Expecting only one row
|
||||
/* bgInstanceID, bgTeam, x, y, z, o, map, taxi[0], taxi[1], mountSpell */
|
||||
m_bgData.bgInstanceID = result->GetUInt32(0);
|
||||
m_bgData.bgTeam = result->GetUInt32(1);
|
||||
m_bgData.joinPos = WorldLocation(result->GetUInt32(6), // Map
|
||||
result->GetFloat(2), // X
|
||||
result->GetFloat(3), // Y
|
||||
result->GetFloat(4), // Z
|
||||
result->GetFloat(5)); // Orientation
|
||||
m_bgData.taxiPath[0] = result->GetUInt32(7);
|
||||
m_bgData.taxiPath[1] = result->GetUInt32(8);
|
||||
m_bgData.mountSpell = result->GetUInt32(9);
|
||||
m_bgData.bgInstanceID = fields[0].GetUInt32();
|
||||
m_bgData.bgTeam = fields[1].GetUInt32();
|
||||
m_bgData.joinPos = WorldLocation(fields[6].GetUInt32(), // Map
|
||||
fields[2].GetFloat(), // X
|
||||
fields[3].GetFloat(), // Y
|
||||
fields[4].GetFloat(), // Z
|
||||
fields[5].GetFloat()); // Orientation
|
||||
m_bgData.taxiPath[0] = fields[7].GetUInt32();
|
||||
m_bgData.taxiPath[1] = fields[8].GetUInt32();
|
||||
m_bgData.mountSpell = fields[9].GetUInt32();
|
||||
}
|
||||
|
||||
bool Player::LoadPositionFromDB(uint32& mapid, float& x,float& y,float& z,float& o, bool& in_flight, uint64 guid)
|
||||
@@ -15896,7 +15906,7 @@ bool Player::LoadPositionFromDB(uint32& mapid, float& x,float& y,float& z,float&
|
||||
z = fields[2].GetFloat();
|
||||
o = fields[3].GetFloat();
|
||||
mapid = fields[4].GetUInt32();
|
||||
in_flight = !fields[5].GetCppString().empty();
|
||||
in_flight = !fields[5].GetString().empty();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -15950,8 +15960,10 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
sLog.outError("Player (GUID: %u) not found in table `characters`, can't load. ",guid);
|
||||
return false;
|
||||
}
|
||||
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 dbAccountId = result->GetUInt32(1);
|
||||
uint32 dbAccountId = fields[1].GetUInt32();
|
||||
|
||||
// check if the character's account in the db and the logged in account match.
|
||||
// player should be able to load/delete character only with correct account!
|
||||
@@ -15969,7 +15981,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
|
||||
Object::_Create(guid, 0, HIGHGUID_PLAYER);
|
||||
|
||||
m_name = result->GetString(2);
|
||||
m_name = fields[2].GetString();
|
||||
|
||||
// check name limitations
|
||||
if (ObjectMgr::CheckPlayerName(m_name) != CHAR_NAME_SUCCESS ||
|
||||
@@ -15984,38 +15996,38 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
|
||||
// overwrite some data fields
|
||||
uint32 bytes0 = 0;
|
||||
bytes0 |= result->GetUInt8(3); // race
|
||||
bytes0 |= result->GetUInt8(4) << 8; // class
|
||||
bytes0 |= result->GetUInt8(5) << 16; // gender
|
||||
bytes0 |= fields[3].GetUInt8(); // race
|
||||
bytes0 |= fields[4].GetUInt8() << 8; // class
|
||||
bytes0 |= fields[5].GetUInt8() << 16; // gender
|
||||
SetUInt32Value(UNIT_FIELD_BYTES_0, bytes0);
|
||||
|
||||
SetUInt32Value(UNIT_FIELD_LEVEL, result->GetUInt8(6));
|
||||
SetUInt32Value(PLAYER_XP, result->GetUInt32(7));
|
||||
SetUInt32Value(UNIT_FIELD_LEVEL, fields[6].GetUInt8());
|
||||
SetUInt32Value(PLAYER_XP, fields[7].GetUInt32());
|
||||
|
||||
_LoadIntoDataField(result->GetString(61).c_str(), PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE);
|
||||
_LoadIntoDataField(result->GetString(64).c_str(), PLAYER__FIELD_KNOWN_TITLES, KNOWN_TITLES_SIZE*2);
|
||||
_LoadIntoDataField(fields[61].GetCString(), PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE);
|
||||
_LoadIntoDataField(fields[64].GetCString(), PLAYER__FIELD_KNOWN_TITLES, KNOWN_TITLES_SIZE*2);
|
||||
|
||||
SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, DEFAULT_WORLD_OBJECT_SIZE);
|
||||
SetFloatValue(UNIT_FIELD_COMBATREACH, 1.5f);
|
||||
SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 1.0f);
|
||||
|
||||
uint32 money = result->GetUInt32(8);
|
||||
uint32 money = fields[8].GetUInt32();
|
||||
if (money > MAX_MONEY_AMOUNT)
|
||||
money = MAX_MONEY_AMOUNT;
|
||||
SetMoney(money);
|
||||
|
||||
SetUInt32Value(PLAYER_BYTES, result->GetUInt32(9));
|
||||
SetUInt32Value(PLAYER_BYTES_2, result->GetUInt32(10));
|
||||
SetUInt32Value(PLAYER_BYTES_3, (result->GetUInt16(49) & 0xFFFE) | result->GetUInt8(5));
|
||||
SetUInt32Value(PLAYER_FLAGS, result->GetUInt32(11));
|
||||
SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, result->GetUInt32(48));
|
||||
SetUInt32Value(PLAYER_BYTES, fields[9].GetUInt32());
|
||||
SetUInt32Value(PLAYER_BYTES_2, fields[10].GetUInt32());
|
||||
SetUInt32Value(PLAYER_BYTES_3, (fields[49].GetUInt16() & 0xFFFE) | fields[5].GetUInt8());
|
||||
SetUInt32Value(PLAYER_FLAGS, fields[11].GetUInt32());
|
||||
SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fields[48].GetUInt32());
|
||||
|
||||
SetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES, result->GetUInt64(47));
|
||||
SetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES, fields[47].GetUInt64());
|
||||
|
||||
SetUInt32Value(PLAYER_AMMO_ID, result->GetUInt32(63));
|
||||
SetUInt32Value(PLAYER_AMMO_ID, fields[63].GetUInt32());
|
||||
|
||||
// set which actionbars the client has active - DO NOT REMOVE EVER AGAIN (can be changed though, if it does change fieldwise)
|
||||
SetByteValue(PLAYER_FIELD_BYTES, 2, result->GetUInt8(65));
|
||||
SetByteValue(PLAYER_FIELD_BYTES, 2, fields[65].GetUInt8());
|
||||
|
||||
InitDisplayIds();
|
||||
|
||||
@@ -16043,21 +16055,21 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
InitPrimaryProfessions(); // to max set before any spell loaded
|
||||
|
||||
// init saved position, and fix it later if problematic
|
||||
uint32 transGUID = uint32(result->GetUInt64(30)); // field type is uint64 but lowguid is saved
|
||||
Relocate(result->GetFloat(12), result->GetFloat(13), result->GetFloat(14), result->GetFloat(16));
|
||||
uint32 mapId = result->GetUInt32(15);
|
||||
uint32 instanceId = result->GetUInt8(58);
|
||||
uint32 transGUID = uint32(fields[30].GetUInt64()); // field type is uint64 but lowguid is saved
|
||||
Relocate(fields[12].GetFloat(), fields[13].GetFloat(), fields[14].GetFloat(), fields[16].GetFloat());
|
||||
uint32 mapId = fields[15].GetUInt32();
|
||||
uint32 instanceId = fields[58].GetUInt8();
|
||||
|
||||
uint32 dungeonDiff = result->GetUInt32(38) & 0x0F;
|
||||
uint32 dungeonDiff = fields[38].GetUInt32() & 0x0F;
|
||||
if (dungeonDiff >= MAX_DUNGEON_DIFFICULTY)
|
||||
dungeonDiff = DUNGEON_DIFFICULTY_NORMAL;
|
||||
uint32 raidDiff = (result->GetUInt8(38) >> 4) & 0x0F;
|
||||
uint32 raidDiff = (fields[38].GetUInt8() >> 4) & 0x0F;
|
||||
if (raidDiff >= MAX_RAID_DIFFICULTY)
|
||||
raidDiff = RAID_DIFFICULTY_10MAN_NORMAL;
|
||||
SetDungeonDifficulty(Difficulty(dungeonDiff)); // may be changed in _LoadGroup
|
||||
SetRaidDifficulty(Difficulty(raidDiff)); // may be changed in _LoadGroup
|
||||
|
||||
std::string taxi_nodes = result->GetString(37);
|
||||
std::string taxi_nodes = fields[37].GetString();
|
||||
|
||||
#define RelocateToHomebind(){ mapId = m_homebindMapId; instanceId = 0; Relocate(m_homebindX, m_homebindY, m_homebindZ); }
|
||||
|
||||
@@ -16066,7 +16078,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
_LoadArenaTeamInfo(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADARENAINFO));
|
||||
_LoadArenaStatsInfo(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADARENASTATS));
|
||||
|
||||
uint32 arena_currency = result->GetUInt32(39);
|
||||
uint32 arena_currency = fields[39].GetUInt32();
|
||||
if (arena_currency > sWorld.getIntConfig(CONFIG_MAX_ARENA_POINTS))
|
||||
arena_currency = sWorld.getIntConfig(CONFIG_MAX_ARENA_POINTS);
|
||||
|
||||
@@ -16088,12 +16100,12 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
SetArenaTeamInfoField(arena_slot, ArenaTeamInfoType(j), 0);
|
||||
}
|
||||
|
||||
SetHonorPoints(result->GetUInt32(40));
|
||||
SetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, result->GetUInt32(41));
|
||||
SetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION, result->GetUInt32(42));
|
||||
SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, result->GetUInt32(43));
|
||||
SetUInt16Value(PLAYER_FIELD_KILLS, 0, result->GetUInt16(44));
|
||||
SetUInt16Value(PLAYER_FIELD_KILLS, 1, result->GetUInt16(45));
|
||||
SetHonorPoints(fields[40].GetUInt32());
|
||||
SetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, fields[41].GetUInt32());
|
||||
SetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION, fields[42].GetUInt32());
|
||||
SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, fields[43].GetUInt32());
|
||||
SetUInt16Value(PLAYER_FIELD_KILLS, 0, fields[44].GetUInt16());
|
||||
SetUInt16Value(PLAYER_FIELD_KILLS, 1, fields[45].GetUInt16());
|
||||
|
||||
_LoadBoundInstances(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES));
|
||||
_LoadBGData(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADBGDATA));
|
||||
@@ -16153,7 +16165,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
else if (transGUID)
|
||||
{
|
||||
m_movementInfo.t_guid = MAKE_NEW_GUID(transGUID, 0, HIGHGUID_MO_TRANSPORT);
|
||||
m_movementInfo.t_pos.Relocate(result->GetFloat(26), result->GetFloat(27), result->GetFloat(28), result->GetFloat(29));
|
||||
m_movementInfo.t_pos.Relocate(fields[26].GetFloat(), fields[27].GetFloat(), fields[28].GetFloat(), fields[29].GetFloat());
|
||||
|
||||
if (!Trinity::IsValidMapCoord(
|
||||
GetPositionX()+m_movementInfo.t_pos.m_positionX,GetPositionY()+m_movementInfo.t_pos.m_positionY,
|
||||
@@ -16312,7 +16324,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
SaveRecallPosition();
|
||||
|
||||
time_t now = time(NULL);
|
||||
time_t logoutTime = time_t(result->GetUInt64(22));
|
||||
time_t logoutTime = time_t(fields[22].GetUInt64());
|
||||
|
||||
// since last logout (in seconds)
|
||||
uint32 time_diff = uint32(now - logoutTime); //uint64 is excessive for a time_diff in seconds.. uint32 allows for 136~ year difference.
|
||||
@@ -16327,12 +16339,12 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
uint16 newDrunkenValue = uint16(soberFactor*(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE));
|
||||
SetDrunkValue(newDrunkenValue);
|
||||
|
||||
m_cinematic = result->GetUInt8(18);
|
||||
m_Played_time[PLAYED_TIME_TOTAL]= result->GetUInt32(19);
|
||||
m_Played_time[PLAYED_TIME_LEVEL]= result->GetUInt32(20);
|
||||
m_cinematic = fields[18].GetUInt8();
|
||||
m_Played_time[PLAYED_TIME_TOTAL]= fields[19].GetUInt32();
|
||||
m_Played_time[PLAYED_TIME_LEVEL]= fields[20].GetUInt32();
|
||||
|
||||
m_resetTalentsCost = result->GetUInt32(24);
|
||||
m_resetTalentsTime = time_t(result->GetUInt64(25));
|
||||
m_resetTalentsCost = fields[24].GetUInt32();
|
||||
m_resetTalentsTime = time_t(fields[25].GetUInt64());
|
||||
|
||||
// reserve some flags
|
||||
uint32 old_safe_flags = GetUInt32Value(PLAYER_FLAGS) & (PLAYER_FLAGS_HIDE_CLOAK | PLAYER_FLAGS_HIDE_HELM);
|
||||
@@ -16340,25 +16352,25 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM))
|
||||
SetUInt32Value(PLAYER_FLAGS, 0 | old_safe_flags);
|
||||
|
||||
m_taxi.LoadTaxiMask(result->GetString(17).c_str()); // must be before InitTaxiNodesForLevel
|
||||
m_taxi.LoadTaxiMask(fields[17].GetCString()); // must be before InitTaxiNodesForLevel
|
||||
|
||||
uint32 extraflags = result->GetUInt32(31);
|
||||
uint32 extraflags = fields[31].GetUInt32();
|
||||
|
||||
m_stableSlots = result->GetUInt8(32);
|
||||
m_stableSlots = fields[32].GetUInt8();
|
||||
if (m_stableSlots > MAX_PET_STABLES)
|
||||
{
|
||||
sLog.outError("Player can have not more %u stable slots, but have in DB %u",MAX_PET_STABLES,uint32(m_stableSlots));
|
||||
m_stableSlots = MAX_PET_STABLES;
|
||||
}
|
||||
|
||||
m_atLoginFlags = result->GetUInt32(33);
|
||||
m_atLoginFlags = fields[33].GetUInt32();
|
||||
|
||||
// Honor system
|
||||
// Update Honor kills data
|
||||
m_lastHonorUpdateTime = logoutTime;
|
||||
UpdateHonorFields();
|
||||
|
||||
m_deathExpireTime = (time_t)result->GetUInt64(36);
|
||||
m_deathExpireTime = (time_t)fields[36].GetUInt64();
|
||||
if (m_deathExpireTime > now+MAX_DEATH_COUNT*DEATH_EXPIRE_STEP)
|
||||
m_deathExpireTime = now+MAX_DEATH_COUNT*DEATH_EXPIRE_STEP-1;
|
||||
|
||||
@@ -16394,7 +16406,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
InitRunes();
|
||||
|
||||
// rest bonus can only be calculated after InitStatsForLevel()
|
||||
m_rest_bonus = result->GetFloat(21);
|
||||
m_rest_bonus = fields[21].GetFloat();
|
||||
|
||||
if (time_diff > 0)
|
||||
{
|
||||
@@ -16402,7 +16414,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
float bubble0 = 0.031f;
|
||||
//speed collect rest bonus in offline, in logout, in tavern, city (section/in hour)
|
||||
float bubble1 = 0.125f;
|
||||
float bubble = result->GetUInt32(23) > 0
|
||||
float bubble = fields[23].GetUInt32() > 0
|
||||
? bubble1*sWorld.getRate(RATE_REST_OFFLINE_IN_TAVERN_OR_CITY)
|
||||
: bubble0*sWorld.getRate(RATE_REST_OFFLINE_IN_WILDERNESS);
|
||||
|
||||
@@ -16418,8 +16430,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
//mails are loaded only when needed ;-) - when player in game click on mailbox.
|
||||
//_LoadMail();
|
||||
|
||||
m_specsCount = result->GetUInt8(59);
|
||||
m_activeSpec = result->GetUInt8(60);
|
||||
m_specsCount = fields[59].GetUInt8();
|
||||
m_activeSpec = fields[60].GetUInt8();
|
||||
|
||||
// sanity check
|
||||
if (m_specsCount > MAX_TALENT_SPECS || m_activeSpec > MAX_TALENT_SPEC || m_specsCount < MIN_TALENT_SPECS)
|
||||
@@ -16465,7 +16477,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
|
||||
// check PLAYER_CHOSEN_TITLE compatibility with PLAYER__FIELD_KNOWN_TITLES
|
||||
// note: PLAYER__FIELD_KNOWN_TITLES updated at quest status loaded
|
||||
uint32 curTitle = result->GetUInt32(46);
|
||||
uint32 curTitle = fields[46].GetUInt32();
|
||||
if (curTitle && !HasTitle(curTitle))
|
||||
curTitle = 0;
|
||||
|
||||
@@ -16488,11 +16500,11 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
||||
UpdateAllStats();
|
||||
|
||||
// restore remembered power/health values (but not more max values)
|
||||
uint32 savedHealth = result->GetUInt32(50);
|
||||
uint32 savedHealth = fields[50].GetUInt32();
|
||||
SetHealth(savedHealth > GetMaxHealth() ? GetMaxHealth() : savedHealth);
|
||||
for (uint8 i = 0; i < MAX_POWERS; ++i)
|
||||
{
|
||||
uint32 savedPower = result->GetUInt32(51+i);
|
||||
uint32 savedPower = fields[51+i].GetUInt32();
|
||||
SetPower(Powers(i),savedPower > GetMaxPower(Powers(i)) ? GetMaxPower(Powers(i)) : savedPower);
|
||||
}
|
||||
|
||||
@@ -16621,10 +16633,11 @@ void Player::_LoadActions(PreparedQueryResult result)
|
||||
{
|
||||
do
|
||||
{
|
||||
uint8 button = result->GetUInt8(0);
|
||||
uint32 action = result->GetUInt32(1);
|
||||
uint8 type = result->GetUInt8(2);
|
||||
uint8 spec = result->GetUInt8(3);
|
||||
Field* fields = result->Fetch();
|
||||
uint8 button = fields[0].GetUInt8();
|
||||
uint32 action = fields[1].GetUInt32();
|
||||
uint8 type = fields[2].GetUInt8();
|
||||
uint8 spec = fields[3].GetUInt8();
|
||||
|
||||
if (spec >= MAX_TALENT_SPECS)
|
||||
continue;
|
||||
@@ -16638,7 +16651,8 @@ void Player::_LoadActions(PreparedQueryResult result)
|
||||
// Will deleted in DB at next save (it can create data until save but marked as deleted)
|
||||
m_actionButtons[spec][button].uState = ACTIONBUTTON_DELETED;
|
||||
}
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16652,22 +16666,23 @@ void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff)
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
int32 damage[3];
|
||||
int32 baseDamage[3];
|
||||
uint64 caster_guid = result->GetUInt64(0);
|
||||
uint32 spellid = result->GetUInt32(1);
|
||||
uint8 effmask = result->GetUInt8(2);
|
||||
uint8 recalculatemask = result->GetUInt8(3);
|
||||
uint8 stackcount = result->GetUInt8(4);
|
||||
damage[0] = result->GetInt32(5);
|
||||
damage[1] = result->GetInt32(6);
|
||||
damage[2] = result->GetInt32(7);
|
||||
baseDamage[0] = result->GetInt32(8);
|
||||
baseDamage[1] = result->GetInt32(9);
|
||||
baseDamage[2] = result->GetInt32(10);
|
||||
int32 maxduration = result->GetInt32(11);
|
||||
int32 remaintime = result->GetInt32(12);
|
||||
uint8 remaincharges = result->GetUInt8(13);
|
||||
uint64 caster_guid = fields[0].GetUInt64();
|
||||
uint32 spellid = fields[1].GetUInt32();
|
||||
uint8 effmask = fields[2].GetUInt8();
|
||||
uint8 recalculatemask = fields[3].GetUInt8();
|
||||
uint8 stackcount = fields[4].GetUInt8();
|
||||
damage[0] = fields[5].GetInt32();
|
||||
damage[1] = fields[6].GetInt32();
|
||||
damage[2] = fields[7].GetInt32();
|
||||
baseDamage[0] = fields[8].GetInt32();
|
||||
baseDamage[1] = fields[9].GetInt32();
|
||||
baseDamage[2] = fields[10].GetInt32();
|
||||
int32 maxduration = fields[11].GetInt32();
|
||||
int32 remaintime = fields[12].GetInt32();
|
||||
uint8 remaincharges = fields[13].GetUInt8();
|
||||
|
||||
SpellEntry const* spellproto = sSpellStore.LookupEntry(spellid);
|
||||
if (!spellproto)
|
||||
@@ -16777,10 +16792,12 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timediff)
|
||||
m_itemUpdateQueueBlocked = true;
|
||||
do
|
||||
{
|
||||
uint32 bag_guid = result->GetUInt32(11);
|
||||
uint8 slot = result->GetUInt8(12);
|
||||
uint32 item_guid = result->GetUInt32(13);
|
||||
uint32 item_id = result->GetUInt32(14);
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 bag_guid = fields[11].GetUInt32();
|
||||
uint8 slot = fields[12].GetUInt8();
|
||||
uint32 item_guid = fields[13].GetUInt32();
|
||||
uint32 item_id = fields[14].GetUInt32();
|
||||
|
||||
ItemPrototype const * proto = sObjectMgr.GetItemPrototype(item_id);
|
||||
|
||||
@@ -16852,9 +16869,10 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timediff)
|
||||
}
|
||||
else
|
||||
{
|
||||
item->SetRefundRecipient(result2->GetUInt32(0));
|
||||
item->SetPaidMoney(result2->GetUInt32(1));
|
||||
item->SetPaidExtendedCost(result2->GetUInt32(2));
|
||||
Field* fields2 = result2->Fetch();
|
||||
item->SetRefundRecipient(fields2[0].GetUInt32());
|
||||
item->SetPaidMoney(fields2[1].GetUInt32());
|
||||
item->SetPaidExtendedCost(fields2[2].GetUInt32());
|
||||
AddRefundReference(item->GetGUIDLow());
|
||||
}
|
||||
}
|
||||
@@ -16871,7 +16889,8 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timediff)
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string strGUID = result2->GetString(0);
|
||||
Field* fields2 = result2->Fetch();
|
||||
std::string strGUID = fields[2].GetString();
|
||||
Tokens GUIDlist = StrSplit(strGUID, " ");
|
||||
AllowedLooterSet looters;
|
||||
for (Tokens::iterator itr = GUIDlist.begin(); itr != GUIDlist.end(); ++itr)
|
||||
@@ -16994,8 +17013,10 @@ void Player::_LoadMailedItems(Mail *mail)
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
do
|
||||
{
|
||||
uint32 item_guid_low = result->GetUInt32(11);
|
||||
uint32 item_template = result->GetUInt32(12);
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 item_guid_low = fields[11].GetUInt32();
|
||||
uint32 item_template = fields[12].GetUInt32();
|
||||
|
||||
mail->AddItem(item_guid_low, item_template);
|
||||
|
||||
@@ -17013,7 +17034,7 @@ void Player::_LoadMailedItems(Mail *mail)
|
||||
|
||||
Item *item = NewItemOrBag(proto);
|
||||
|
||||
if (!item->LoadFromDB(item_guid_low, MAKE_NEW_GUID(result->GetUInt32(13), 0, HIGHGUID_PLAYER), result, item_template))
|
||||
if (!item->LoadFromDB(item_guid_low, MAKE_NEW_GUID(fields[13].GetUInt32(), 0, HIGHGUID_PLAYER), result, item_template))
|
||||
{
|
||||
sLog.outError("Player::_LoadMailedItems - Item in mail (%u) doesn't exist !!!! - item guid: %u, deleted from mail", mail->messageID, item_guid_low);
|
||||
CharacterDatabase.PExecute("DELETE FROM mail_items WHERE item_guid = '%u'", item_guid_low);
|
||||
@@ -17023,7 +17044,8 @@ void Player::_LoadMailedItems(Mail *mail)
|
||||
}
|
||||
|
||||
AddMItem(item);
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
}
|
||||
@@ -17033,12 +17055,12 @@ void Player::_LoadMailInit(PreparedQueryResult resultUnread, PreparedQueryResult
|
||||
//set a count of unread mails
|
||||
//QueryResult *resultMails = CharacterDatabase.PQuery("SELECT COUNT(id) FROM mail WHERE receiver = '%u' AND (checked & 1)=0 AND deliver_time <= '" UI64FMTD "'", GUID_LOPART(playerGuid),(uint64)cTime);
|
||||
if (resultUnread)
|
||||
unReadMails = resultUnread->GetUInt8(0);
|
||||
unReadMails = (*resultUnread)[0].GetUInt8();
|
||||
|
||||
// store nearest delivery time (it > 0 and if it < current then at next player update SendNewMaill will be called)
|
||||
//resultMails = CharacterDatabase.PQuery("SELECT MIN(deliver_time) FROM mail WHERE receiver = '%u' AND (checked & 1)=0", GUID_LOPART(playerGuid));
|
||||
if (resultDelivery)
|
||||
m_nextMailDelivereTime = (time_t)resultDelivery->GetUInt64(0);
|
||||
m_nextMailDelivereTime = (time_t)(*resultDelivery)[0].GetUInt64();
|
||||
}
|
||||
|
||||
void Player::_LoadMail()
|
||||
@@ -17056,8 +17078,8 @@ void Player::_LoadMail()
|
||||
m->messageType = fields[1].GetUInt8();
|
||||
m->sender = fields[2].GetUInt32();
|
||||
m->receiver = fields[3].GetUInt32();
|
||||
m->subject = fields[4].GetCppString();
|
||||
m->body = fields[5].GetCppString();
|
||||
m->subject = fields[4].GetString();
|
||||
m->body = fields[5].GetString();
|
||||
bool has_items = fields[6].GetBool();
|
||||
m->expire_time = (time_t)fields[7].GetUInt64();
|
||||
m->deliver_time = (time_t)fields[8].GetUInt64();
|
||||
@@ -17109,7 +17131,9 @@ void Player::_LoadQuestStatus(PreparedQueryResult result)
|
||||
{
|
||||
do
|
||||
{
|
||||
uint32 quest_id = result->GetUInt32(0);
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 quest_id = fields[0].GetUInt32();
|
||||
// used to be new, no delete?
|
||||
Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest_id);
|
||||
if (pQuest)
|
||||
@@ -17117,7 +17141,7 @@ void Player::_LoadQuestStatus(PreparedQueryResult result)
|
||||
// find or create
|
||||
QuestStatusData& questStatusData = mQuestStatus[quest_id];
|
||||
|
||||
uint32 qstatus = result->GetUInt32(1);
|
||||
uint32 qstatus = fields[1].GetUInt32();
|
||||
if (qstatus < MAX_QUEST_STATUS)
|
||||
questStatusData.m_status = QuestStatus(qstatus);
|
||||
else
|
||||
@@ -17126,10 +17150,10 @@ void Player::_LoadQuestStatus(PreparedQueryResult result)
|
||||
sLog.outError("Player %s have invalid quest %d status (%d), replaced by QUEST_STATUS_NONE(0).",GetName(),quest_id,qstatus);
|
||||
}
|
||||
|
||||
questStatusData.m_rewarded = (result->GetUInt8(2) > 0);
|
||||
questStatusData.m_explored = (result->GetUInt8(3) > 0);
|
||||
questStatusData.m_rewarded = (fields[2].GetUInt8() > 0);
|
||||
questStatusData.m_explored = (fields[3].GetUInt8() > 0);
|
||||
|
||||
time_t quest_time = time_t(result->GetUInt64(4));
|
||||
time_t quest_time = time_t(fields[4].GetUInt64());
|
||||
|
||||
if (pQuest->HasFlag(QUEST_TRINITY_FLAGS_TIMED) && !GetQuestRewardStatus(quest_id) && questStatusData.m_status != QUEST_STATUS_NONE)
|
||||
{
|
||||
@@ -17143,14 +17167,14 @@ void Player::_LoadQuestStatus(PreparedQueryResult result)
|
||||
else
|
||||
quest_time = 0;
|
||||
|
||||
questStatusData.m_creatureOrGOcount[0] = result->GetUInt32(5);
|
||||
questStatusData.m_creatureOrGOcount[1] = result->GetUInt32(6);
|
||||
questStatusData.m_creatureOrGOcount[2] = result->GetUInt32(7);
|
||||
questStatusData.m_creatureOrGOcount[3] = result->GetUInt32(8);
|
||||
questStatusData.m_itemcount[0] = result->GetUInt32(9);
|
||||
questStatusData.m_itemcount[1] = result->GetUInt32(10);
|
||||
questStatusData.m_itemcount[2] = result->GetUInt32(11);
|
||||
questStatusData.m_itemcount[3] = result->GetUInt32(12);
|
||||
questStatusData.m_creatureOrGOcount[0] = fields[5].GetUInt32();
|
||||
questStatusData.m_creatureOrGOcount[1] = fields[6].GetUInt32();
|
||||
questStatusData.m_creatureOrGOcount[2] = fields[7].GetUInt32();
|
||||
questStatusData.m_creatureOrGOcount[3] = fields[8].GetUInt32();
|
||||
questStatusData.m_itemcount[0] = fields[9].GetUInt32();
|
||||
questStatusData.m_itemcount[1] = fields[10].GetUInt32();
|
||||
questStatusData.m_itemcount[2] = fields[11].GetUInt32();
|
||||
questStatusData.m_itemcount[3] = fields[12].GetUInt32();
|
||||
|
||||
questStatusData.uState = QUEST_UNCHANGED;
|
||||
|
||||
@@ -17222,10 +17246,12 @@ void Player::_LoadDailyQuestStatus(PreparedQueryResult result)
|
||||
break;
|
||||
}
|
||||
|
||||
uint32 quest_id = result->GetUInt32(0);
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 quest_id = fields[0].GetUInt32();
|
||||
|
||||
// save _any_ from daily quest times (it must be after last reset anyway)
|
||||
m_lastDailyQuestTime = (time_t)result->GetUInt64(1);
|
||||
m_lastDailyQuestTime = (time_t)fields[1].GetUInt64();
|
||||
|
||||
Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest_id);
|
||||
if (!pQuest)
|
||||
@@ -17235,7 +17261,8 @@ void Player::_LoadDailyQuestStatus(PreparedQueryResult result)
|
||||
++quest_daily_idx;
|
||||
|
||||
sLog.outDebug("Daily quest (%u) cooldown for player (GUID: %u)", quest_id, GetGUIDLow());
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
}
|
||||
|
||||
m_DailyQuestChanged = false;
|
||||
@@ -17249,14 +17276,15 @@ void Player::_LoadWeeklyQuestStatus(PreparedQueryResult result)
|
||||
{
|
||||
do
|
||||
{
|
||||
uint32 quest_id = result->GetUInt32(0);
|
||||
uint32 quest_id = (*result)[0].GetUInt32();
|
||||
Quest const* pQuest = sObjectMgr.GetQuestTemplate(quest_id);
|
||||
if (!pQuest)
|
||||
continue;
|
||||
|
||||
m_weeklyquests.insert(quest_id);
|
||||
sLog.outDebug("Weekly quest {%u} cooldown for player (GUID: %u)", quest_id, GetGUIDLow());
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
}
|
||||
|
||||
m_WeeklyQuestChanged = false;
|
||||
@@ -17269,7 +17297,7 @@ void Player::_LoadSpells(PreparedQueryResult result)
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
addSpell(result->GetUInt32(0), result->GetBool(1), false, false, result->GetBool(2));
|
||||
addSpell((*result)[0].GetUInt32(), (*result)[1].GetBool(), false, false, (*result)[2].GetBool());
|
||||
while (result->NextRow());
|
||||
}
|
||||
}
|
||||
@@ -17279,7 +17307,7 @@ void Player::_LoadGroup(PreparedQueryResult result)
|
||||
//QueryResult *result = CharacterDatabase.PQuery("SELECT guid FROM group_member WHERE memberGuid=%u", GetGUIDLow());
|
||||
if (result)
|
||||
{
|
||||
if (Group* group = sObjectMgr.GetGroupByGUID(result->GetUInt32(0)))
|
||||
if (Group* group = sObjectMgr.GetGroupByGUID((*result)[0].GetUInt32()))
|
||||
{
|
||||
uint8 subgroup = group->GetMemberGroup(GetGUID());
|
||||
SetGroup(group, subgroup);
|
||||
@@ -17305,12 +17333,14 @@ void Player::_LoadBoundInstances(PreparedQueryResult result)
|
||||
{
|
||||
do
|
||||
{
|
||||
bool perm = result->GetBool(1);
|
||||
uint32 mapId = result->GetUInt32(2);
|
||||
uint32 instanceId = result->GetUInt32(0);
|
||||
uint8 difficulty = result->GetUInt8(3);
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
time_t resetTime = (time_t)result->GetUInt64(4);
|
||||
bool perm = fields[1].GetBool();
|
||||
uint32 mapId = fields[2].GetUInt32();
|
||||
uint32 instanceId = fields[0].GetUInt32();
|
||||
uint8 difficulty = fields[3].GetUInt8();
|
||||
|
||||
time_t resetTime = (time_t)fields[4].GetUInt64();
|
||||
// the resettime for normal instances is only saved when the InstanceSave is unloaded
|
||||
// so the value read from the DB may be wrong here but only if the InstanceSave is loaded
|
||||
// and in that case it is not used
|
||||
@@ -17338,7 +17368,6 @@ void Player::_LoadBoundInstances(PreparedQueryResult result)
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (!perm && group)
|
||||
{
|
||||
sLog.outError("_LoadBoundInstances: player %s(%d) is in group %d but has a non-permanent character bind to map %d,%d,%d", GetName(), GetGUIDLow(), GUID_LOPART(group->GetGUID()), mapId, instanceId, difficulty);
|
||||
@@ -17349,7 +17378,8 @@ void Player::_LoadBoundInstances(PreparedQueryResult result)
|
||||
// since non permanent binds are always solo bind, they can always be reset
|
||||
if (InstanceSave *save = sInstanceSaveMgr.AddInstanceSave(mapId, instanceId, Difficulty(difficulty), resetTime, !perm, true))
|
||||
BindToInstance(save, perm, true);
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17656,11 +17686,13 @@ bool Player::_LoadHomeBind(PreparedQueryResult result)
|
||||
//QueryResult *result = CharacterDatabase.PQuery("SELECT map,zone,position_x,position_y,position_z FROM character_homebind WHERE guid = '%u'", GUID_LOPART(playerGuid));
|
||||
if (result)
|
||||
{
|
||||
m_homebindMapId = result->GetUInt32(0);
|
||||
m_homebindAreaId = result->GetUInt16(1);
|
||||
m_homebindX = result->GetFloat(2);
|
||||
m_homebindY = result->GetFloat(3);
|
||||
m_homebindZ = result->GetFloat(4);
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
m_homebindMapId = fields[0].GetUInt32();
|
||||
m_homebindAreaId = fields[1].GetUInt16();
|
||||
m_homebindX = fields[2].GetFloat();
|
||||
m_homebindY = fields[3].GetFloat();
|
||||
m_homebindZ = fields[4].GetFloat();
|
||||
|
||||
MapEntry const* bindMapEntry = sMapStore.LookupEntry(m_homebindMapId);
|
||||
|
||||
@@ -22927,9 +22959,10 @@ void Player::_LoadSkills(PreparedQueryResult result)
|
||||
{
|
||||
do
|
||||
{
|
||||
uint16 skill = result->GetUInt16(0);
|
||||
uint16 value = result->GetUInt16(1);
|
||||
uint16 max = result->GetUInt16(2);
|
||||
Field* fields = result->Fetch();
|
||||
uint16 skill = fields[0].GetUInt16();
|
||||
uint16 value = fields[1].GetUInt16();
|
||||
uint16 max = fields[2].GetUInt16();
|
||||
|
||||
SkillLineEntry const *pSkill = sSkillLineStore.LookupEntry(skill);
|
||||
if (!pSkill)
|
||||
@@ -22977,7 +23010,8 @@ void Player::_LoadSkills(PreparedQueryResult result)
|
||||
sLog.outError("Character %u has more than %u skills.", GetGUIDLow(), PLAYER_MAX_SKILLS);
|
||||
break;
|
||||
}
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
}
|
||||
|
||||
for (; count < PLAYER_MAX_SKILLS; ++count)
|
||||
@@ -23061,7 +23095,7 @@ uint8 Player::CanEquipUniqueItem(Item* pItem, uint8 eslot, uint32 limit_count) c
|
||||
uint32 gem_limit_count = !pItem->IsEquipped() && pGem->ItemLimitCategory
|
||||
? pItem->GetGemCountWithLimitCategory(pGem->ItemLimitCategory) : 1;
|
||||
|
||||
if (uint8 res = CanEquipUniqueItem(pGem, eslot,gem_limit_count))
|
||||
if (uint8 res = CanEquipUniqueItem(pGem, eslot, gem_limit_count))
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -23074,7 +23108,7 @@ uint8 Player::CanEquipUniqueItem(ItemPrototype const* itemProto, uint8 except_sl
|
||||
if (itemProto->Flags & ITEM_PROTO_FLAG_UNIQUE_EQUIPPED)
|
||||
{
|
||||
// there is an equip limit on this item
|
||||
if (HasItemOrGemWithIdEquipped(itemProto->ItemId,1,except_slot))
|
||||
if (HasItemOrGemWithIdEquipped(itemProto->ItemId, 1, except_slot))
|
||||
return EQUIP_ERR_ITEM_UNIQUE_EQUIPABLE;
|
||||
}
|
||||
|
||||
@@ -23092,7 +23126,7 @@ uint8 Player::CanEquipUniqueItem(ItemPrototype const* itemProto, uint8 except_sl
|
||||
|
||||
// there is an equip limit on this item
|
||||
if (HasItemOrGemWithLimitCategoryEquipped(itemProto->ItemLimitCategory, limitEntry->maxCount - limit_count + 1, except_slot))
|
||||
return EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_EQUIPPED_EXCEEDED;
|
||||
return EQUIP_ERR_ITEM_MAX_COUNT_EQUIPPED_SOCKETED;
|
||||
}
|
||||
|
||||
return EQUIP_ERR_OK;
|
||||
@@ -23833,17 +23867,20 @@ void Player::_LoadGlyphs(PreparedQueryResult result)
|
||||
|
||||
do
|
||||
{
|
||||
uint8 spec = result->GetUInt8(0);
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint8 spec = fields[0].GetUInt8();
|
||||
if (spec >= m_specsCount)
|
||||
continue;
|
||||
|
||||
m_Glyphs[spec][0] = result->GetUInt32(1);
|
||||
m_Glyphs[spec][1] = result->GetUInt32(2);
|
||||
m_Glyphs[spec][2] = result->GetUInt32(3);
|
||||
m_Glyphs[spec][3] = result->GetUInt32(4);
|
||||
m_Glyphs[spec][4] = result->GetUInt32(5);
|
||||
m_Glyphs[spec][5] = result->GetUInt32(6);
|
||||
} while (result->NextRow());
|
||||
m_Glyphs[spec][0] = fields[1].GetUInt32();
|
||||
m_Glyphs[spec][1] = fields[2].GetUInt32();
|
||||
m_Glyphs[spec][2] = fields[3].GetUInt32();
|
||||
m_Glyphs[spec][3] = fields[4].GetUInt32();
|
||||
m_Glyphs[spec][4] = fields[5].GetUInt32();
|
||||
m_Glyphs[spec][5] = fields[6].GetUInt32();
|
||||
}
|
||||
while (result->NextRow());
|
||||
}
|
||||
|
||||
void Player::_SaveGlyphs(SQLTransaction& trans)
|
||||
@@ -23862,7 +23899,7 @@ void Player::_LoadTalents(PreparedQueryResult result)
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
AddTalent(result->GetUInt32(0), result->GetUInt32(1), false);
|
||||
AddTalent((*result)[0].GetUInt32(), (*result)[1].GetUInt32(), false);
|
||||
while (result->NextRow());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,16 +303,19 @@ PlayerSocial *SocialMgr::LoadFromDB(PreparedQueryResult result, uint32 guid)
|
||||
|
||||
do
|
||||
{
|
||||
friend_guid = result->GetUInt32(0);
|
||||
flags = result->GetUInt32(1);
|
||||
note = result->GetString(2);
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
friend_guid = fields[0].GetUInt32();
|
||||
flags = fields[1].GetUInt32();
|
||||
note = fields[2].GetString();
|
||||
|
||||
social->m_playerSocialMap[friend_guid] = FriendInfo(flags, note);
|
||||
|
||||
// client's friends list and ignore list limit
|
||||
if (social->m_playerSocialMap.size() >= (SOCIALMGR_FRIEND_LIMIT + SOCIALMGR_IGNORE_LIMIT))
|
||||
break;
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
return social;
|
||||
}
|
||||
|
||||
@@ -54,9 +54,9 @@ void MapManager::LoadTransports()
|
||||
Field *fields = result->Fetch();
|
||||
uint32 lowguid = fields[0].GetUInt32();
|
||||
uint32 entry = fields[1].GetUInt32();
|
||||
std::string name = fields[2].GetCppString();
|
||||
std::string name = fields[2].GetString();
|
||||
uint32 period = fields[3].GetUInt32();
|
||||
uint32 scriptId = sObjectMgr.GetScriptId(fields[4].GetString());
|
||||
uint32 scriptId = sObjectMgr.GetScriptId(fields[4].GetCString());
|
||||
|
||||
Transport *t = new Transport(period, scriptId);
|
||||
|
||||
@@ -133,7 +133,7 @@ void MapManager::LoadTransports()
|
||||
|
||||
uint32 guid = fields[0].GetUInt32();
|
||||
uint32 entry = fields[1].GetUInt32();
|
||||
std::string name = fields[2].GetCppString();
|
||||
std::string name = fields[2].GetString();
|
||||
sLog.outErrorDb("Transport %u '%s' have record (GUID: %u) in `gameobject`. Transports DON'T must have any records in `gameobject` or its behavior will be unpredictable/bugged.",entry,name.c_str(),guid);
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
@@ -266,7 +266,7 @@ void GameEventMgr::LoadFromDB()
|
||||
}
|
||||
}
|
||||
|
||||
pGameEvent.description = fields[6].GetCppString();
|
||||
pGameEvent.description = fields[6].GetString();
|
||||
|
||||
} while (result->NextRow());
|
||||
|
||||
|
||||
@@ -445,10 +445,10 @@ void ObjectMgr::LoadCreatureLocales()
|
||||
for (uint8 i = 1; i < MAX_LOCALE; ++i)
|
||||
{
|
||||
LocaleConstant locale = (LocaleConstant) i;
|
||||
std::string str = fields[1 + 2 * (i - 1)].GetCppString();
|
||||
std::string str = fields[1 + 2 * (i - 1)].GetString();
|
||||
AddLocaleString(str, locale, data.Name);
|
||||
|
||||
str = fields[1 + 2 * (i - 1) + 1].GetCppString();
|
||||
str = fields[1 + 2 * (i - 1) + 1].GetString();
|
||||
AddLocaleString(str, locale, data.SubName);
|
||||
}
|
||||
} while (result->NextRow());
|
||||
@@ -486,10 +486,10 @@ void ObjectMgr::LoadGossipMenuItemsLocales()
|
||||
for (uint8 i = 1; i < MAX_LOCALE; ++i)
|
||||
{
|
||||
LocaleConstant locale = (LocaleConstant) i;
|
||||
std::string str = fields[2 + 2 * (i - 1)].GetCppString();
|
||||
std::string str = fields[2 + 2 * (i - 1)].GetString();
|
||||
AddLocaleString(str, locale, data.OptionText);
|
||||
|
||||
str = fields[2 + 2 * (i - 1) + 1].GetCppString();
|
||||
str = fields[2 + 2 * (i - 1) + 1].GetString();
|
||||
AddLocaleString(str, locale, data.BoxText);
|
||||
}
|
||||
} while (result->NextRow());
|
||||
@@ -520,7 +520,7 @@ void ObjectMgr::LoadPointOfInterestLocales()
|
||||
|
||||
for (uint8 i = 1; i < MAX_LOCALE; ++i)
|
||||
{
|
||||
std::string str = fields[i].GetCppString();
|
||||
std::string str = fields[i].GetString();
|
||||
AddLocaleString(str, LocaleConstant(i), data.IconName);
|
||||
}
|
||||
} while (result->NextRow());
|
||||
@@ -1878,7 +1878,7 @@ bool ObjectMgr::GetPlayerNameByGUID(const uint64 &guid, std::string &name) const
|
||||
|
||||
if (result)
|
||||
{
|
||||
name = (*result)[0].GetCppString();
|
||||
name = (*result)[0].GetString();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1957,10 +1957,10 @@ void ObjectMgr::LoadItemLocales()
|
||||
for (uint8 i = 1; i < MAX_LOCALE; ++i)
|
||||
{
|
||||
LocaleConstant locale = (LocaleConstant) i;
|
||||
std::string str = fields[1 + 2 * (i - 1)].GetCppString();
|
||||
std::string str = fields[1 + 2 * (i - 1)].GetString();
|
||||
AddLocaleString(str, locale, data.Name);
|
||||
|
||||
str = fields[1 + 2 * (i - 1) + 1].GetCppString();
|
||||
str = fields[1 + 2 * (i - 1) + 1].GetString();
|
||||
AddLocaleString(str, locale, data.Description);
|
||||
}
|
||||
} while (result->NextRow());
|
||||
@@ -2452,7 +2452,7 @@ void ObjectMgr::LoadItemSetNameLocales()
|
||||
|
||||
for (uint8 i = 1; i < MAX_LOCALE; ++i)
|
||||
{
|
||||
std::string str = fields[i].GetCppString();
|
||||
std::string str = fields[i].GetString();
|
||||
AddLocaleString(str, LocaleConstant(i), data.Name);
|
||||
}
|
||||
} while (result->NextRow());
|
||||
@@ -2498,7 +2498,7 @@ void ObjectMgr::LoadItemSetNames()
|
||||
}
|
||||
|
||||
ItemSetNameEntry &data = mItemSetNameMap[entry];
|
||||
data.name = fields[1].GetCppString();
|
||||
data.name = fields[1].GetString();
|
||||
|
||||
uint32 invType = fields[2].GetUInt32();
|
||||
if (invType >= MAX_INVTYPE)
|
||||
@@ -3677,9 +3677,9 @@ void ObjectMgr::LoadGuildBanks(std::vector<Guild*>& GuildVector, QueryResult& re
|
||||
{
|
||||
GuildBankTab *NewTab = new GuildBankTab;
|
||||
|
||||
NewTab->Name = fields[1].GetCppString();
|
||||
NewTab->Icon = fields[2].GetCppString();
|
||||
NewTab->Text = fields[3].GetCppString();
|
||||
NewTab->Name = fields[1].GetString();
|
||||
NewTab->Icon = fields[2].GetString();
|
||||
NewTab->Text = fields[3].GetString();
|
||||
|
||||
GuildVector[guildid]->m_TabListMap[TabId] = NewTab;
|
||||
}
|
||||
@@ -3691,11 +3691,12 @@ void ObjectMgr::LoadGuildBanks(std::vector<Guild*>& GuildVector, QueryResult& re
|
||||
{
|
||||
do
|
||||
{
|
||||
uint8 TabId = itemResult->GetUInt8(11);
|
||||
uint8 SlotId = itemResult->GetUInt8(12);
|
||||
uint32 ItemGuid = itemResult->GetUInt32(13);
|
||||
uint32 ItemId = itemResult->GetUInt32(14);
|
||||
uint32 guildid = itemResult->GetUInt32(15);
|
||||
Field *fields = itemResult->Fetch();
|
||||
uint8 TabId = fields[11].GetUInt8();
|
||||
uint8 SlotId = fields[12].GetUInt8();
|
||||
uint32 ItemGuid = fields[13].GetUInt32();
|
||||
uint32 ItemId = fields[14].GetUInt32();
|
||||
uint32 guildid = fields[15].GetUInt32();
|
||||
if (guildid >= GuildVector.size() || GuildVector[guildid] == NULL)
|
||||
return;
|
||||
|
||||
@@ -4651,30 +4652,30 @@ void ObjectMgr::LoadQuestLocales()
|
||||
for (uint8 i = 1; i < MAX_LOCALE; ++i)
|
||||
{
|
||||
LocaleConstant locale = (LocaleConstant) i;
|
||||
std::string str = fields[1 + 11 * (i - 1)].GetCppString();
|
||||
std::string str = fields[1 + 11 * (i - 1)].GetString();
|
||||
AddLocaleString(str, locale, data.Title);
|
||||
|
||||
str = fields[1 + 11 * (i - 1) + 1].GetCppString();
|
||||
str = fields[1 + 11 * (i - 1) + 1].GetString();
|
||||
AddLocaleString(str, locale, data.Details);
|
||||
|
||||
str = fields[1 + 11 * (i - 1) + 2].GetCppString();
|
||||
str = fields[1 + 11 * (i - 1) + 2].GetString();
|
||||
AddLocaleString(str, locale, data.Objectives);
|
||||
|
||||
str = fields[1 + 11 * (i - 1) + 3].GetCppString();
|
||||
str = fields[1 + 11 * (i - 1) + 3].GetString();
|
||||
AddLocaleString(str, locale, data.OfferRewardText);
|
||||
|
||||
str = fields[1 + 11 * (i - 1) + 4].GetCppString();
|
||||
str = fields[1 + 11 * (i - 1) + 4].GetString();
|
||||
AddLocaleString(str, locale, data.RequestItemsText);
|
||||
|
||||
str = fields[1 + 11 * (i - 1) + 5].GetCppString();
|
||||
str = fields[1 + 11 * (i - 1) + 5].GetString();
|
||||
AddLocaleString(str, locale, data.EndText);
|
||||
|
||||
str = fields[1 + 11 * (i - 1) + 6].GetCppString();
|
||||
str = fields[1 + 11 * (i - 1) + 6].GetString();
|
||||
AddLocaleString(str, locale, data.CompletedText);
|
||||
|
||||
for (uint8 k = 0; k < 4; ++k)
|
||||
{
|
||||
str = fields[1 + 11 * (i - 1) + 7 + k].GetCppString();
|
||||
str = fields[1 + 11 * (i - 1) + 7 + k].GetString();
|
||||
AddLocaleString(str, locale, data.ObjectiveText[k]);
|
||||
}
|
||||
}
|
||||
@@ -5162,7 +5163,7 @@ void ObjectMgr::LoadSpellScriptNames()
|
||||
Field *fields = result->Fetch();
|
||||
|
||||
int32 spellId = fields[0].GetInt32();
|
||||
const char *scriptName = fields[1].GetString();
|
||||
const char *scriptName = fields[1].GetCString();
|
||||
|
||||
bool allRanks = false;
|
||||
if (spellId <=0)
|
||||
@@ -5328,7 +5329,7 @@ void ObjectMgr::LoadPageTextLocales()
|
||||
|
||||
for (uint8 i = 1; i < MAX_LOCALE; ++i)
|
||||
{
|
||||
std::string str = fields[i].GetCppString();
|
||||
std::string str = fields[i].GetString();
|
||||
AddLocaleString(str, LocaleConstant(i), data.Text);
|
||||
}
|
||||
|
||||
@@ -5419,8 +5420,8 @@ void ObjectMgr::LoadGossipText()
|
||||
|
||||
for (int i=0; i< 8; i++)
|
||||
{
|
||||
gText.Options[i].Text_0 = fields[cic++].GetCppString();
|
||||
gText.Options[i].Text_1 = fields[cic++].GetCppString();
|
||||
gText.Options[i].Text_0 = fields[cic++].GetString();
|
||||
gText.Options[i].Text_1 = fields[cic++].GetString();
|
||||
|
||||
gText.Options[i].Language = fields[cic++].GetUInt32();
|
||||
gText.Options[i].Probability = fields[cic++].GetFloat();
|
||||
@@ -5471,10 +5472,10 @@ void ObjectMgr::LoadNpcTextLocales()
|
||||
LocaleConstant locale = (LocaleConstant) i;
|
||||
for (uint8 j = 0; j < 8; ++j)
|
||||
{
|
||||
std::string str0 = fields[1 + 8 * 2 * (i - 1) + 2 * j].GetCppString();
|
||||
std::string str0 = fields[1 + 8 * 2 * (i - 1) + 2 * j].GetString();
|
||||
AddLocaleString(str0, locale, data.Text_0[j]);
|
||||
|
||||
std::string str1 = fields[1 + 8 * 2 * (i - 1) + 2 * j + 1].GetCppString();
|
||||
std::string str1 = fields[1 + 8 * 2 * (i - 1) + 2 * j + 1].GetString();
|
||||
AddLocaleString(str1, locale, data.Text_1[j]);
|
||||
}
|
||||
}
|
||||
@@ -5714,7 +5715,7 @@ void ObjectMgr::LoadAreaTriggerScripts()
|
||||
Field *fields = result->Fetch();
|
||||
|
||||
uint32 Trigger_ID = fields[0].GetUInt32();
|
||||
const char *scriptName = fields[1].GetString();
|
||||
const char *scriptName = fields[1].GetCString();
|
||||
|
||||
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID);
|
||||
if (!atEntry)
|
||||
@@ -6209,7 +6210,7 @@ void ObjectMgr::LoadAccessRequirements()
|
||||
ar.quest_A = fields[6].GetUInt32();
|
||||
ar.quest_H = fields[7].GetUInt32();
|
||||
ar.achievement = fields[8].GetUInt32();
|
||||
ar.questFailedText = fields[9].GetCppString();
|
||||
ar.questFailedText = fields[9].GetString();
|
||||
|
||||
if (ar.item)
|
||||
{
|
||||
@@ -6529,13 +6530,13 @@ void ObjectMgr::LoadGameObjectLocales()
|
||||
|
||||
for (uint8 i = 1; i < MAX_LOCALE; ++i)
|
||||
{
|
||||
std::string str = fields[i].GetCppString();
|
||||
std::string str = fields[i].GetString();
|
||||
AddLocaleString(str, LocaleConstant(i), data.Name);
|
||||
}
|
||||
|
||||
for (uint8 i = 1; i < MAX_LOCALE; ++i)
|
||||
{
|
||||
std::string str = fields[i + (MAX_LOCALE - 1)].GetCppString();
|
||||
std::string str = fields[i + (MAX_LOCALE - 1)].GetString();
|
||||
AddLocaleString(str, LocaleConstant(i), data.CastBarCaption);
|
||||
}
|
||||
|
||||
@@ -7229,7 +7230,7 @@ void ObjectMgr::LoadPointsOfInterest()
|
||||
POI.icon = fields[3].GetUInt32();
|
||||
POI.flags = fields[4].GetUInt32();
|
||||
POI.data = fields[5].GetUInt32();
|
||||
POI.icon_name = fields[6].GetCppString();
|
||||
POI.icon_name = fields[6].GetString();
|
||||
|
||||
if (!Trinity::IsValidMapCoord(POI.x,POI.y))
|
||||
{
|
||||
@@ -7676,7 +7677,7 @@ void ObjectMgr::LoadReservedPlayersNames()
|
||||
{
|
||||
bar.step();
|
||||
fields = result->Fetch();
|
||||
std::string name= fields[0].GetCppString();
|
||||
std::string name= fields[0].GetString();
|
||||
|
||||
std::wstring wstr;
|
||||
if (!Utf8toWStr (name,wstr))
|
||||
@@ -7981,7 +7982,7 @@ bool ObjectMgr::LoadTrinityStrings(char const* table, int32 min_value, int32 max
|
||||
|
||||
for (uint8 i = 0; i < MAX_LOCALE; ++i)
|
||||
{
|
||||
std::string str = fields[i + 1].GetCppString();
|
||||
std::string str = fields[i + 1].GetString();
|
||||
AddLocaleString(str, LocaleConstant(i), data.Content);
|
||||
}
|
||||
} while (result->NextRow());
|
||||
@@ -8150,7 +8151,7 @@ void ObjectMgr::LoadGameTele()
|
||||
gt.position_z = fields[3].GetFloat();
|
||||
gt.orientation = fields[4].GetFloat();
|
||||
gt.mapId = fields[5].GetUInt32();
|
||||
gt.name = fields[6].GetCppString();
|
||||
gt.name = fields[6].GetString();
|
||||
|
||||
if (!MapManager::IsValidMapCoord(gt.mapId,gt.position_x,gt.position_y,gt.position_z,gt.orientation))
|
||||
{
|
||||
@@ -8697,7 +8698,7 @@ void ObjectMgr::LoadGossipMenuItems()
|
||||
gMenuItem.menu_id = fields[0].GetUInt32();
|
||||
gMenuItem.id = fields[1].GetUInt32();
|
||||
gMenuItem.option_icon = fields[2].GetUInt8();
|
||||
gMenuItem.option_text = fields[3].GetCppString();
|
||||
gMenuItem.option_text = fields[3].GetString();
|
||||
gMenuItem.option_id = fields[4].GetUInt32();
|
||||
gMenuItem.npc_option_npcflag = fields[5].GetUInt32();
|
||||
gMenuItem.action_menu_id = fields[6].GetUInt32();
|
||||
@@ -8705,7 +8706,7 @@ void ObjectMgr::LoadGossipMenuItems()
|
||||
gMenuItem.action_script_id = fields[8].GetUInt32();
|
||||
gMenuItem.box_coded = fields[9].GetUInt8() != 0;
|
||||
gMenuItem.box_money = fields[10].GetUInt32();
|
||||
gMenuItem.box_text = fields[11].GetCppString();
|
||||
gMenuItem.box_text = fields[11].GetString();
|
||||
|
||||
if (gMenuItem.option_icon >= GOSSIP_ICON_MAX)
|
||||
{
|
||||
|
||||
@@ -152,7 +152,7 @@ bool Guild::AddMember(uint64 plGuid, uint32 plRank)
|
||||
return false; // player doesn't exist
|
||||
|
||||
Field *fields = result->Fetch();
|
||||
newmember.Name = fields[0].GetCppString();
|
||||
newmember.Name = fields[0].GetString();
|
||||
newmember.ZoneId = fields[1].GetUInt32();
|
||||
newmember.Level = fields[2].GetUInt8();
|
||||
newmember.Class = fields[3].GetUInt8();
|
||||
@@ -226,15 +226,15 @@ bool Guild::LoadGuildFromDB(QueryResult guildDataResult)
|
||||
Field *fields = guildDataResult->Fetch();
|
||||
|
||||
m_Id = fields[0].GetUInt32();
|
||||
m_Name = fields[1].GetCppString();
|
||||
m_Name = fields[1].GetString();
|
||||
m_LeaderGuid = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER);
|
||||
m_EmblemStyle = fields[3].GetUInt32();
|
||||
m_EmblemColor = fields[4].GetUInt32();
|
||||
m_BorderStyle = fields[5].GetUInt32();
|
||||
m_BorderColor = fields[6].GetUInt32();
|
||||
m_BackgroundColor = fields[7].GetUInt32();
|
||||
GINFO = fields[8].GetCppString();
|
||||
MOTD = fields[9].GetCppString();
|
||||
GINFO = fields[8].GetString();
|
||||
MOTD = fields[9].GetString();
|
||||
m_CreatedDate = fields[10].GetUInt64();
|
||||
m_GuildBankMoney = fields[11].GetUInt64();
|
||||
|
||||
@@ -311,7 +311,7 @@ bool Guild::LoadRanksFromDB(QueryResult guildRanksResult)
|
||||
//we loaded all ranks for this guild already, break cycle
|
||||
break;
|
||||
uint32 rankID = fields[1].GetUInt32();
|
||||
std::string rankName = fields[2].GetCppString();
|
||||
std::string rankName = fields[2].GetString();
|
||||
uint32 rankRights = fields[3].GetUInt32();
|
||||
uint32 rankMoney = fields[4].GetUInt32();
|
||||
|
||||
@@ -385,8 +385,8 @@ bool Guild::LoadMembersFromDB(QueryResult guildMembersResult)
|
||||
if (newmember.RankId >= m_Ranks.size())
|
||||
newmember.RankId = GetLowestRank();
|
||||
|
||||
newmember.Pnote = fields[3].GetCppString();
|
||||
newmember.OFFnote = fields[4].GetCppString();
|
||||
newmember.Pnote = fields[3].GetString();
|
||||
newmember.OFFnote = fields[4].GetString();
|
||||
newmember.BankResetTimeMoney = fields[5].GetUInt32();
|
||||
newmember.BankRemMoney = fields[6].GetUInt32();
|
||||
for (uint8 i = 0; i < GUILD_BANK_MAX_TABS; ++i)
|
||||
@@ -395,7 +395,7 @@ bool Guild::LoadMembersFromDB(QueryResult guildMembersResult)
|
||||
newmember.BankRemSlotsTab[i] = fields[8+(2*i)].GetUInt32();
|
||||
}
|
||||
|
||||
newmember.Name = fields[19].GetCppString();
|
||||
newmember.Name = fields[19].GetString();
|
||||
newmember.Level = fields[20].GetUInt8();
|
||||
newmember.Class = fields[21].GetUInt8();
|
||||
newmember.ZoneId = fields[22].GetUInt32();
|
||||
|
||||
@@ -239,7 +239,7 @@ void InstanceSaveManager::_DelHelper(const char *fields, const char *table, cons
|
||||
std::ostringstream ss;
|
||||
for (size_t i = 0; i < fieldTokens.size(); i++)
|
||||
{
|
||||
std::string fieldValue = fields[i].GetCppString();
|
||||
std::string fieldValue = fields[i].GetString();
|
||||
CharacterDatabase.escape_string(fieldValue);
|
||||
ss << (i != 0 ? " AND " : "") << fieldTokens[i] << " = '" << fieldValue << "'";
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ void OutdoorPvPMgr::LoadTemplates()
|
||||
OutdoorPvPData* data = new OutdoorPvPData();
|
||||
OutdoorPvPTypes realTypeId = OutdoorPvPTypes(typeId);
|
||||
data->TypeId = realTypeId;
|
||||
data->ScriptId = sObjectMgr.GetScriptId(fields[1].GetString());
|
||||
data->ScriptId = sObjectMgr.GetScriptId(fields[1].GetCString());
|
||||
m_OutdoorPvPDatas[realTypeId] = data;
|
||||
|
||||
++count;
|
||||
|
||||
@@ -852,8 +852,10 @@ void PoolMgr::LoadQuestPools()
|
||||
{
|
||||
bar.step();
|
||||
|
||||
uint32 entry = result->GetUInt32(0);
|
||||
uint32 pool_id = result->GetUInt32(1);
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 entry = fields[0].GetUInt32();
|
||||
uint32 pool_id = fields[1].GetUInt32();
|
||||
|
||||
Quest const* pQuest = sObjectMgr.GetQuestTemplate(entry);
|
||||
if (!pQuest)
|
||||
@@ -905,7 +907,9 @@ void PoolMgr::LoadQuestPools()
|
||||
SearchPair p(entry, pool_id);
|
||||
mQuestSearchMap.insert(p);
|
||||
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %u quests in pools", count);
|
||||
}
|
||||
|
||||
@@ -58,16 +58,16 @@ Quest::Quest(Field * questRecord)
|
||||
SrcItemId = questRecord[31].GetUInt32();
|
||||
SrcItemCount = questRecord[32].GetUInt32();
|
||||
SrcSpell = questRecord[33].GetUInt32();
|
||||
Title = questRecord[34].GetCppString();
|
||||
Details = questRecord[35].GetCppString();
|
||||
Objectives = questRecord[36].GetCppString();
|
||||
OfferRewardText = questRecord[37].GetCppString();
|
||||
RequestItemsText = questRecord[38].GetCppString();
|
||||
EndText = questRecord[39].GetCppString();
|
||||
CompletedText = questRecord[40].GetCppString();
|
||||
Title = questRecord[34].GetString();
|
||||
Details = questRecord[35].GetString();
|
||||
Objectives = questRecord[36].GetString();
|
||||
OfferRewardText = questRecord[37].GetString();
|
||||
RequestItemsText = questRecord[38].GetString();
|
||||
EndText = questRecord[39].GetString();
|
||||
CompletedText = questRecord[40].GetString();
|
||||
|
||||
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
|
||||
ObjectiveText[i] = questRecord[41+i].GetCppString();
|
||||
ObjectiveText[i] = questRecord[41+i].GetString();
|
||||
|
||||
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
|
||||
ReqItemId[i] = questRecord[45+i].GetUInt32();
|
||||
|
||||
@@ -463,13 +463,15 @@ void ReputationMgr::LoadFromDB(PreparedQueryResult result)
|
||||
{
|
||||
do
|
||||
{
|
||||
FactionEntry const *factionEntry = sFactionStore.LookupEntry(result->GetUInt32(0));
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
FactionEntry const *factionEntry = sFactionStore.LookupEntry(fields[0].GetUInt32());
|
||||
if (factionEntry && (factionEntry->reputationListID >= 0))
|
||||
{
|
||||
FactionState* faction = &m_factions[factionEntry->reputationListID];
|
||||
|
||||
// update standing to current
|
||||
faction->Standing = int32(result->GetUInt32(1));
|
||||
faction->Standing = int32(fields[1].GetUInt32());
|
||||
|
||||
// update counters
|
||||
int32 BaseRep = GetBaseReputation(factionEntry);
|
||||
@@ -477,7 +479,7 @@ void ReputationMgr::LoadFromDB(PreparedQueryResult result)
|
||||
ReputationRank new_rank = ReputationToRank(BaseRep + faction->Standing);
|
||||
UpdateRankCounters(old_rank, new_rank);
|
||||
|
||||
uint32 dbFactionFlags = result->GetUInt32(2);
|
||||
uint32 dbFactionFlags = fields[2].GetUInt32();
|
||||
|
||||
if (dbFactionFlags & FACTION_FLAG_VISIBLE)
|
||||
SetVisible(faction); // have internal checks for forced invisibility
|
||||
|
||||
@@ -607,7 +607,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data)
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
accountId = fields[0].GetUInt32();
|
||||
name = fields[1].GetCppString();
|
||||
name = fields[1].GetString();
|
||||
}
|
||||
|
||||
// prevent deleting other players' characters using cheating tools
|
||||
@@ -741,8 +741,9 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
|
||||
//QueryResult *result = CharacterDatabase.PQuery("SELECT guildid,rank FROM guild_member WHERE guid = '%u'",pCurrChar->GetGUIDLow());
|
||||
if (PreparedQueryResult resultGuild = holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADGUILD))
|
||||
{
|
||||
pCurrChar->SetInGuild(resultGuild->GetUInt32(0));
|
||||
pCurrChar->SetRank(resultGuild->GetUInt8(1));
|
||||
Field* fields = resultGuild->Fetch();
|
||||
pCurrChar->SetInGuild(fields[0].GetUInt32());
|
||||
pCurrChar->SetRank(fields[1].GetUInt8());
|
||||
}
|
||||
else if (pCurrChar->GetGuildId()) // clear guild related fields in case wrong data about non existed membership
|
||||
{
|
||||
@@ -1067,7 +1068,7 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(QueryResult result, std:
|
||||
|
||||
uint32 guidLow = result->Fetch()[0].GetUInt32();
|
||||
uint64 guid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER);
|
||||
std::string oldname = result->Fetch()[1].GetCppString();
|
||||
std::string oldname = result->Fetch()[1].GetString();
|
||||
|
||||
CharacterDatabase.PExecute("UPDATE characters set name = '%s', at_login = at_login & ~ %u WHERE guid ='%u'", newname.c_str(), uint32(AT_LOGIN_RENAME), guidLow);
|
||||
CharacterDatabase.PExecute("DELETE FROM character_declinedname WHERE guid ='%u'", guidLow);
|
||||
@@ -1318,7 +1319,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data)
|
||||
CharacterDatabase.escape_string(newname);
|
||||
if (QueryResult result = CharacterDatabase.PQuery("SELECT name FROM characters WHERE guid ='%u'", GUID_LOPART(guid)))
|
||||
{
|
||||
std::string oldname = result->Fetch()[0].GetCppString();
|
||||
std::string oldname = result->Fetch()[0].GetString();
|
||||
std::string IP_str = GetRemoteAddress();
|
||||
sLog.outChar("Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), IP_str.c_str(), oldname.c_str(), GUID_LOPART(guid), newname.c_str());
|
||||
}
|
||||
|
||||
@@ -1331,13 +1331,13 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
|
||||
}
|
||||
|
||||
Field *fields = result->Fetch();
|
||||
std::string acc = fields[0].GetCppString();
|
||||
std::string acc = fields[0].GetString();
|
||||
if (acc.empty())
|
||||
acc = "Unknown";
|
||||
std::string email = fields[1].GetCppString();
|
||||
std::string email = fields[1].GetString();
|
||||
if (email.empty())
|
||||
email = "Unknown";
|
||||
std::string lastip = fields[2].GetCppString();
|
||||
std::string lastip = fields[2].GetString();
|
||||
if (lastip.empty())
|
||||
lastip = "Unknown";
|
||||
|
||||
|
||||
@@ -334,7 +334,7 @@ void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid)
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
ownerguid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
|
||||
name = fields[1].GetCppString();
|
||||
name = fields[1].GetString();
|
||||
signs = fields[2].GetUInt8();
|
||||
type = fields[3].GetUInt32();
|
||||
}
|
||||
@@ -725,7 +725,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
ownerguidlo = fields[0].GetUInt32();
|
||||
name = fields[1].GetCppString();
|
||||
name = fields[1].GetString();
|
||||
type = fields[2].GetUInt32();
|
||||
}
|
||||
else
|
||||
|
||||
@@ -89,7 +89,7 @@ void WorldSession::SendNameQueryOpcodeFromDBCallBack(QueryResult result)
|
||||
|
||||
Field *fields = result->Fetch();
|
||||
uint32 guid = fields[0].GetUInt32();
|
||||
std::string name = fields[1].GetCppString();
|
||||
std::string name = fields[1].GetString();
|
||||
uint8 pRace = 0, pGender = 0, pClass = 0;
|
||||
if (name == "")
|
||||
name = GetTrinityString(LANG_NON_EXIST_CHARACTER);
|
||||
@@ -110,11 +110,11 @@ void WorldSession::SendNameQueryOpcodeFromDBCallBack(QueryResult result)
|
||||
data << uint8(pClass); // class
|
||||
|
||||
// if the first declined name field (5) is empty, the rest must be too
|
||||
if (sWorld.getBoolConfig(CONFIG_DECLINED_NAMES_USED) && fields[5].GetCppString() != "")
|
||||
if (sWorld.getBoolConfig(CONFIG_DECLINED_NAMES_USED) && fields[5].GetString() != "")
|
||||
{
|
||||
data << uint8(1); // is declined
|
||||
for (int i = 5; i < MAX_DECLINED_NAME_CASES+5; ++i)
|
||||
data << fields[i].GetCppString();
|
||||
data << fields[i].GetString();
|
||||
}
|
||||
else
|
||||
data << uint8(0); // is not declined
|
||||
|
||||
@@ -600,7 +600,8 @@ void WorldSession::LoadAccountData(PreparedQueryResult result, uint32 mask)
|
||||
|
||||
do
|
||||
{
|
||||
uint32 type = result->GetUInt32(0);
|
||||
Field* fields = result->Fetch();
|
||||
uint32 type = fields[0].GetUInt32();
|
||||
if (type >= NUM_ACCOUNT_DATA_TYPES)
|
||||
{
|
||||
sLog.outError("Table `%s` have invalid account data type (%u), ignore.",
|
||||
@@ -615,10 +616,11 @@ void WorldSession::LoadAccountData(PreparedQueryResult result, uint32 mask)
|
||||
continue;
|
||||
}
|
||||
|
||||
m_accountData[type].Time = result->GetUInt32(1);
|
||||
m_accountData[type].Data = result->GetString(2);
|
||||
m_accountData[type].Time = fields[1].GetUInt32();
|
||||
m_accountData[type].Data = fields[2].GetString();
|
||||
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
}
|
||||
|
||||
void WorldSession::SetAccountData(AccountDataType type, time_t time_, std::string data)
|
||||
|
||||
@@ -851,8 +851,8 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
|
||||
N.SetHexStr ("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7");
|
||||
g.SetDword (7);
|
||||
|
||||
v.SetHexStr(fields[4].GetString());
|
||||
s.SetHexStr (fields[5].GetString());
|
||||
v.SetHexStr(fields[4].GetCString());
|
||||
s.SetHexStr (fields[5].GetCString());
|
||||
|
||||
const char* sStr = s.AsHexStr(); //Must be freed by OPENSSL_free()
|
||||
const char* vStr = v.AsHexStr(); //Must be freed by OPENSSL_free()
|
||||
@@ -867,7 +867,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
|
||||
///- Re-check ip locking (same check as in realmd).
|
||||
if (fields[3].GetUInt8() == 1) // if ip is locked
|
||||
{
|
||||
if (strcmp (fields[2].GetString(), GetRemoteAddress().c_str()))
|
||||
if (strcmp (fields[2].GetCString(), GetRemoteAddress().c_str()))
|
||||
{
|
||||
packet.Initialize (SMSG_AUTH_RESPONSE, 1);
|
||||
packet << uint8 (AUTH_FAILED);
|
||||
@@ -884,7 +884,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
|
||||
security = SEC_ADMINISTRATOR;
|
||||
*/
|
||||
|
||||
K.SetHexStr (fields[1].GetString());
|
||||
K.SetHexStr (fields[1].GetCString());
|
||||
|
||||
time_t mutetime = time_t (fields[7].GetUInt64());
|
||||
|
||||
|
||||
@@ -72,8 +72,8 @@ void TicketMgr::LoadGMTickets()
|
||||
ticket = new GM_Ticket;
|
||||
ticket->guid = fields[0].GetUInt64();
|
||||
ticket->playerGuid = fields[1].GetUInt64();
|
||||
ticket->name = fields[2].GetCppString();
|
||||
ticket->message = fields[3].GetCppString();
|
||||
ticket->name = fields[2].GetString();
|
||||
ticket->message = fields[3].GetString();
|
||||
ticket->createtime = fields[4].GetUInt64();
|
||||
ticket->map = fields[5].GetUInt32();
|
||||
ticket->pos_x = fields[6].GetFloat();
|
||||
@@ -85,7 +85,7 @@ void TicketMgr::LoadGMTickets()
|
||||
m_openTickets++;
|
||||
|
||||
ticket->assignedToGM = fields[11].GetUInt64();
|
||||
ticket->comment = fields[12].GetCppString();
|
||||
ticket->comment = fields[12].GetString();
|
||||
ticket->completed = fields[13].GetBool();
|
||||
ticket->escalated = fields[14].GetUInt8();
|
||||
ticket->viewed = fields[15].GetBool();
|
||||
|
||||
@@ -207,7 +207,7 @@ std::string CreateDumpString(char const* tableName, QueryResult result)
|
||||
if (i == 0) ss << "'";
|
||||
else ss << ", '";
|
||||
|
||||
std::string s = fields[i].GetCppString();
|
||||
std::string s = fields[i].GetString();
|
||||
CharacterDatabase.escape_string(s);
|
||||
ss << s;
|
||||
|
||||
@@ -257,7 +257,7 @@ void StoreGUID(QueryResult result,uint32 field,std::set<uint32>& guids)
|
||||
void StoreGUID(QueryResult result,uint32 data,uint32 field, std::set<uint32>& guids)
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
std::string dataStr = fields[data].GetCppString();
|
||||
std::string dataStr = fields[data].GetString();
|
||||
uint32 guid = atoi(gettoknth(dataStr, field).c_str());
|
||||
if (guid)
|
||||
guids.insert(guid);
|
||||
|
||||
@@ -130,7 +130,7 @@ void WeatherMgr::LoadWeatherData()
|
||||
}
|
||||
}
|
||||
|
||||
wzc.ScriptId = sObjectMgr.GetScriptId(fields[13].GetString());
|
||||
wzc.ScriptId = sObjectMgr.GetScriptId(fields[13].GetCString());
|
||||
|
||||
++count;
|
||||
}
|
||||
|
||||
@@ -1845,7 +1845,7 @@ void World::LoadAutobroadcasts()
|
||||
|
||||
Field *fields = result->Fetch();
|
||||
|
||||
std::string message = fields[0].GetCppString();
|
||||
std::string message = fields[0].GetString();
|
||||
|
||||
m_Autobroadcasts.push_back(message);
|
||||
|
||||
@@ -2319,7 +2319,7 @@ BanReturn World::BanCharacter(std::string name, std::string duration, std::strin
|
||||
if (!resultCharacter)
|
||||
return BAN_NOTFOUND; // Nobody to ban
|
||||
|
||||
guid = resultCharacter->GetUInt32(0);
|
||||
guid = (*resultCharacter)[0].GetUInt32();
|
||||
}
|
||||
else
|
||||
guid = pBanned->GetGUIDLow();
|
||||
@@ -2353,7 +2353,7 @@ bool World::RemoveBanCharacter(std::string name)
|
||||
if (!resultCharacter)
|
||||
return false;
|
||||
|
||||
guid = resultCharacter->GetUInt32(0);
|
||||
guid = (*resultCharacter)[0].GetUInt32();
|
||||
}
|
||||
else
|
||||
guid = pBanned->GetGUIDLow();
|
||||
@@ -2728,8 +2728,8 @@ void World::LoadDBVersion()
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
m_DBVersion = fields[0].GetCppString();
|
||||
m_CreatureEventAIVersion = fields[1].GetCppString();
|
||||
m_DBVersion = fields[0].GetString();
|
||||
m_CreatureEventAIVersion = fields[1].GetString();
|
||||
|
||||
// will be overwrite by config values if different and non-0
|
||||
m_int_configs[CONFIG_CLIENTCACHE_VERSION] = fields[2].GetUInt32();
|
||||
|
||||
Reference in New Issue
Block a user