mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[10692] Fixed wrongly use %d for guids in DB queries.
This can affect correct result in cases big guid values (out of range for possitive part of int32 range) at x86 platforms. Some other cases addded in addition to original patch fixes where %d wrongly/unsafe used for unsigned values. Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
10d3d3ce24
commit
ee8cc71e38
16 changed files with 46 additions and 43 deletions
|
|
@ -57,13 +57,13 @@ AccountOpResult AccountMgr::CreateAccount(std::string username, std::string pass
|
|||
|
||||
AccountOpResult AccountMgr::DeleteAccount(uint32 accid)
|
||||
{
|
||||
QueryResult *result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%d'", accid);
|
||||
QueryResult *result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%u'", accid);
|
||||
if(!result)
|
||||
return AOR_NAME_NOT_EXIST; // account doesn't exist
|
||||
delete result;
|
||||
|
||||
// existing characters list
|
||||
result = CharacterDatabase.PQuery("SELECT guid FROM characters WHERE account='%d'",accid);
|
||||
result = CharacterDatabase.PQuery("SELECT guid FROM characters WHERE account='%u'",accid);
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
|
|
@ -86,8 +86,8 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accid)
|
|||
LoginDatabase.BeginTransaction();
|
||||
|
||||
bool res =
|
||||
LoginDatabase.PExecute("DELETE FROM account WHERE id='%d'", accid) &&
|
||||
LoginDatabase.PExecute("DELETE FROM realmcharacters WHERE acctid='%d'", accid);
|
||||
LoginDatabase.PExecute("DELETE FROM account WHERE id='%u'", accid) &&
|
||||
LoginDatabase.PExecute("DELETE FROM realmcharacters WHERE acctid='%u'", accid);
|
||||
|
||||
LoginDatabase.CommitTransaction();
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accid)
|
|||
|
||||
AccountOpResult AccountMgr::ChangeUsername(uint32 accid, std::string new_uname, std::string new_passwd)
|
||||
{
|
||||
QueryResult *result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%d'", accid);
|
||||
QueryResult *result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%u'", accid);
|
||||
if(!result)
|
||||
return AOR_NAME_NOT_EXIST; // account doesn't exist
|
||||
delete result;
|
||||
|
|
@ -116,7 +116,7 @@ AccountOpResult AccountMgr::ChangeUsername(uint32 accid, std::string new_uname,
|
|||
std::string safe_new_uname = new_uname;
|
||||
LoginDatabase.escape_string(safe_new_uname);
|
||||
|
||||
if(!LoginDatabase.PExecute("UPDATE account SET v='0',s='0',username='%s',sha_pass_hash='%s' WHERE id='%d'", safe_new_uname.c_str(),
|
||||
if(!LoginDatabase.PExecute("UPDATE account SET v='0',s='0',username='%s',sha_pass_hash='%s' WHERE id='%u'", safe_new_uname.c_str(),
|
||||
CalculateShaPassHash(new_uname, new_passwd).c_str(), accid))
|
||||
return AOR_DB_INTERNAL_ERROR; // unexpected error
|
||||
|
||||
|
|
@ -136,7 +136,7 @@ AccountOpResult AccountMgr::ChangePassword(uint32 accid, std::string new_passwd)
|
|||
normalizeString(new_passwd);
|
||||
|
||||
// also reset s and v to force update at next realmd login
|
||||
if(!LoginDatabase.PExecute("UPDATE account SET v='0', s='0', sha_pass_hash='%s' WHERE id='%d'",
|
||||
if(!LoginDatabase.PExecute("UPDATE account SET v='0', s='0', sha_pass_hash='%s' WHERE id='%u'",
|
||||
CalculateShaPassHash(username, new_passwd).c_str(), accid))
|
||||
return AOR_DB_INTERNAL_ERROR; // unexpected error
|
||||
|
||||
|
|
@ -186,7 +186,7 @@ bool AccountMgr::GetName(uint32 acc_id, std::string &name)
|
|||
uint32 AccountMgr::GetCharactersCount(uint32 acc_id)
|
||||
{
|
||||
// check character count
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT COUNT(guid) FROM characters WHERE account = '%d'", acc_id);
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT COUNT(guid) FROM characters WHERE account = '%u'", acc_id);
|
||||
if (result)
|
||||
{
|
||||
Field *fields=result->Fetch();
|
||||
|
|
@ -206,7 +206,7 @@ bool AccountMgr::CheckPassword(uint32 accid, std::string passwd)
|
|||
|
||||
normalizeString(passwd);
|
||||
|
||||
QueryResult *result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%d' AND sha_pass_hash='%s'", accid, CalculateShaPassHash(username, passwd).c_str());
|
||||
QueryResult *result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%u' AND sha_pass_hash='%s'", accid, CalculateShaPassHash(username, passwd).c_str());
|
||||
if (result)
|
||||
{
|
||||
delete result;
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
|||
return;
|
||||
}
|
||||
|
||||
QueryResult *resultacct = LoginDatabase.PQuery("SELECT SUM(numchars) FROM realmcharacters WHERE acctid = '%d'", GetAccountId());
|
||||
QueryResult *resultacct = LoginDatabase.PQuery("SELECT SUM(numchars) FROM realmcharacters WHERE acctid = '%u'", GetAccountId());
|
||||
if (resultacct)
|
||||
{
|
||||
Field *fields=resultacct->Fetch();
|
||||
|
|
@ -302,7 +302,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
|||
}
|
||||
}
|
||||
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT COUNT(guid) FROM characters WHERE account = '%d'", GetAccountId());
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT COUNT(guid) FROM characters WHERE account = '%u'", GetAccountId());
|
||||
uint8 charcount = 0;
|
||||
if ( result )
|
||||
{
|
||||
|
|
@ -472,7 +472,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
|||
pNewChar->SaveToDB();
|
||||
charcount += 1;
|
||||
|
||||
LoginDatabase.PExecute("DELETE FROM realmcharacters WHERE acctid= '%d' AND realmid = '%d'", GetAccountId(), realmID);
|
||||
LoginDatabase.PExecute("DELETE FROM realmcharacters WHERE acctid= '%u' AND realmid = '%u'", GetAccountId(), realmID);
|
||||
LoginDatabase.PExecute("INSERT INTO realmcharacters (numchars, acctid, realmid) VALUES (%u, %u, %u)", charcount, GetAccountId(), realmID);
|
||||
|
||||
data << (uint8)CHAR_CREATE_SUCCESS;
|
||||
|
|
@ -720,7 +720,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder *holder)
|
|||
pCurrChar->SendInitialPacketsAfterAddToMap();
|
||||
|
||||
CharacterDatabase.PExecute("UPDATE characters SET online = 1 WHERE guid = '%u'", pCurrChar->GetGUIDLow());
|
||||
LoginDatabase.PExecute("UPDATE account SET active_realm_id = %d WHERE id = '%u'", realmID, GetAccountId());
|
||||
LoginDatabase.PExecute("UPDATE account SET active_realm_id = %u WHERE id = '%u'", realmID, GetAccountId());
|
||||
pCurrChar->SetInGameTime( getMSTime() );
|
||||
|
||||
// announce group about member online (must be after add to player list to receive announce to self)
|
||||
|
|
@ -922,7 +922,7 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recv_data)
|
|||
// and that there is no character with the desired new name
|
||||
CharacterDatabase.AsyncPQuery(&WorldSession::HandleChangePlayerNameOpcodeCallBack,
|
||||
GetAccountId(), newname,
|
||||
"SELECT guid, name FROM characters WHERE guid = %d AND account = %d AND (at_login & %d) = %d AND NOT EXISTS (SELECT NULL FROM characters WHERE name = '%s')",
|
||||
"SELECT guid, name FROM characters WHERE guid = %u AND account = %u AND (at_login & %u) = %u AND NOT EXISTS (SELECT NULL FROM characters WHERE name = '%s')",
|
||||
guid.GetCounter(), GetAccountId(), AT_LOGIN_RENAME, AT_LOGIN_RENAME, escaped_newname.c_str()
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ void Corpse::DeleteFromDB()
|
|||
MANGOS_ASSERT(GetType() != CORPSE_BONES);
|
||||
|
||||
// all corpses (not bones)
|
||||
CharacterDatabase.PExecute("DELETE FROM corpse WHERE player = '%d' AND corpse_type <> '0'", GUID_LOPART(GetOwnerGUID()));
|
||||
CharacterDatabase.PExecute("DELETE FROM corpse WHERE player = '%u' AND corpse_type <> '0'", GUID_LOPART(GetOwnerGUID()));
|
||||
}
|
||||
|
||||
bool Corpse::LoadFromDB(uint32 lowguid, Field *fields)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ void InstanceData::SaveToDB()
|
|||
if(!Save()) return;
|
||||
std::string data = Save();
|
||||
CharacterDatabase.escape_string(data);
|
||||
CharacterDatabase.PExecute("UPDATE instance SET data = '%s' WHERE id = '%d'", data.c_str(), instance->GetInstanceId());
|
||||
CharacterDatabase.PExecute("UPDATE instance SET data = '%s' WHERE id = '%u'", data.c_str(), instance->GetInstanceId());
|
||||
}
|
||||
|
||||
bool InstanceData::CheckAchievementCriteriaMeet( uint32 criteria_id, Player const* /*source*/, Unit const* /*target*/ /*= NULL*/, uint32 /*miscvalue1*/ /*= 0*/ )
|
||||
|
|
|
|||
|
|
@ -635,7 +635,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b
|
|||
// calculate the next reset time
|
||||
time_t next_reset = InstanceResetScheduler::CalculateNextResetTime(mapDiff, now + timeLeft);
|
||||
// update it in the DB
|
||||
CharacterDatabase.PExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%d' AND difficulty = '%d'", (uint64)next_reset, mapid, difficulty);
|
||||
CharacterDatabase.PExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%u' AND difficulty = '%u'", (uint64)next_reset, mapid, difficulty);
|
||||
}
|
||||
|
||||
// note: this isn't fast but it's meant to be executed very rarely
|
||||
|
|
|
|||
|
|
@ -260,12 +260,12 @@ bool ChatHandler::HandleAccountLockCommand(char* args)
|
|||
|
||||
if (value)
|
||||
{
|
||||
LoginDatabase.PExecute( "UPDATE account SET locked = '1' WHERE id = '%d'",GetAccountId());
|
||||
LoginDatabase.PExecute( "UPDATE account SET locked = '1' WHERE id = '%u'", GetAccountId());
|
||||
PSendSysMessage(LANG_COMMAND_ACCLOCKLOCKED);
|
||||
}
|
||||
else
|
||||
{
|
||||
LoginDatabase.PExecute( "UPDATE account SET locked = '0' WHERE id = '%d'",GetAccountId());
|
||||
LoginDatabase.PExecute( "UPDATE account SET locked = '0' WHERE id = '%u'", GetAccountId());
|
||||
PSendSysMessage(LANG_COMMAND_ACCLOCKUNLOCKED);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3762,7 +3762,7 @@ bool ChatHandler::HandleWpShowCommand(char* args)
|
|||
|
||||
if (show == "off")
|
||||
{
|
||||
QueryResult *result = WorldDatabase.PQuery("SELECT guid FROM creature WHERE id = '%d'", VISUAL_WAYPOINT);
|
||||
QueryResult *result = WorldDatabase.PQuery("SELECT guid FROM creature WHERE id = '%u'", VISUAL_WAYPOINT);
|
||||
if (!result)
|
||||
{
|
||||
SendSysMessage(LANG_WAYPOINT_VP_NOTFOUND);
|
||||
|
|
|
|||
|
|
@ -6464,8 +6464,8 @@ bool ChatHandler::HandleAccountSetAddonCommand(char* args)
|
|||
return false;
|
||||
|
||||
// No SQL injection
|
||||
LoginDatabase.PExecute("UPDATE account SET expansion = '%d' WHERE id = '%u'",lev,account_id);
|
||||
PSendSysMessage(LANG_ACCOUNT_SETADDON,account_name.c_str(),account_id,lev);
|
||||
LoginDatabase.PExecute("UPDATE account SET expansion = '%u' WHERE id = '%u'", lev, account_id);
|
||||
PSendSysMessage(LANG_ACCOUNT_SETADDON,account_name.c_str(), account_id, lev);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1005,7 +1005,7 @@ void MailDraft::SendMailTo(MailReceiver const& receiver, MailSender const& sende
|
|||
CharacterDatabase.escape_string(safe_body);
|
||||
|
||||
CharacterDatabase.PExecute("INSERT INTO mail (id,messageType,stationery,mailTemplateId,sender,receiver,subject,body,has_items,expire_time,deliver_time,money,cod,checked) "
|
||||
"VALUES ('%u', '%u', '%u', '%u', '%u', '%u', '%s', '%s', '%u', '" UI64FMTD "','" UI64FMTD "', '%u', '%u', '%d')",
|
||||
"VALUES ('%u', '%u', '%u', '%u', '%u', '%u', '%s', '%s', '%u', '" UI64FMTD "','" UI64FMTD "', '%u', '%u', '%u')",
|
||||
mailId, sender.GetMailMessageType(), sender.GetStationery(), GetMailTemplateId(), sender.GetSenderId(), receiver.GetPlayerGUIDLow(), safe_subject.c_str(), safe_body.c_str(), (m_items.empty() ? 0 : 1), (uint64)expire_time, (uint64)deliver_time, m_money, m_COD, checked);
|
||||
|
||||
for(MailItemMap::const_iterator mailItemIter = m_items.begin(); mailItemIter != m_items.end(); ++mailItemIter)
|
||||
|
|
|
|||
|
|
@ -3559,7 +3559,7 @@ void ObjectMgr::LoadGroups()
|
|||
{
|
||||
sLog.outErrorDb("Incorrect entry in group_member table : no group with Id %d for member %s!",
|
||||
groupId, memberGuid.GetString().c_str());
|
||||
CharacterDatabase.PExecute("DELETE FROM group_member WHERE memberGuid = '%d'", memberGuidlow);
|
||||
CharacterDatabase.PExecute("DELETE FROM group_member WHERE memberGuid = '%u'", memberGuidlow);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
@ -3568,7 +3568,7 @@ void ObjectMgr::LoadGroups()
|
|||
{
|
||||
sLog.outErrorDb("Incorrect entry in group_member table : member %s cannot be added to group (Id: %u)!",
|
||||
memberGuid.GetString().c_str(), groupId);
|
||||
CharacterDatabase.PExecute("DELETE FROM group_member WHERE memberGuid = '%d'", memberGuidlow);
|
||||
CharacterDatabase.PExecute("DELETE FROM group_member WHERE memberGuid = '%u'", memberGuidlow);
|
||||
}
|
||||
}while( result->NextRow() );
|
||||
delete result;
|
||||
|
|
@ -8659,8 +8659,8 @@ bool ObjectMgr::AddGameTele(GameTele& tele)
|
|||
|
||||
m_GameTeleMap[new_id] = tele;
|
||||
|
||||
return WorldDatabase.PExecuteLog("INSERT INTO game_tele (id,position_x,position_y,position_z,orientation,map,name) VALUES (%u,%f,%f,%f,%f,%d,'%s')",
|
||||
new_id,tele.position_x,tele.position_y,tele.position_z,tele.orientation,tele.mapId,tele.name.c_str());
|
||||
return WorldDatabase.PExecuteLog("INSERT INTO game_tele (id,position_x,position_y,position_z,orientation,map,name) VALUES (%u,%f,%f,%f,%f,%u,'%s')",
|
||||
new_id, tele.position_x, tele.position_y, tele.position_z, tele.orientation, tele.mapId, tele.name.c_str());
|
||||
}
|
||||
|
||||
bool ObjectMgr::DeleteGameTele(const std::string& name)
|
||||
|
|
|
|||
|
|
@ -1285,7 +1285,7 @@ void Pet::_SaveAuras()
|
|||
continue;
|
||||
|
||||
CharacterDatabase.PExecute("INSERT INTO pet_aura (guid, caster_guid, item_guid, spell, stackcount, remaincharges, basepoints0, basepoints1, basepoints2, maxduration0, maxduration1, maxduration2, remaintime0, remaintime1, remaintime2, effIndexMask) VALUES "
|
||||
"('%u', '" UI64FMTD "', '%u', '%u', '%u', '%u', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%u')",
|
||||
"('%u', '" UI64FMTD "', '%u', '%u', '%u', '%u', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%u')",
|
||||
m_charmInfo->GetPetNumber(), holder->GetCasterGUID(), GUID_LOPART(holder->GetCastItemGUID()), holder->GetId(), holder->GetStackAmount(), holder->GetAuraCharges(),
|
||||
damage[EFFECT_INDEX_0], damage[EFFECT_INDEX_1], damage[EFFECT_INDEX_2],
|
||||
maxduration[EFFECT_INDEX_0], maxduration[EFFECT_INDEX_1], maxduration[EFFECT_INDEX_2],
|
||||
|
|
|
|||
|
|
@ -16534,14 +16534,14 @@ void Player::_LoadBoundInstances(QueryResult *result)
|
|||
if(!mapEntry || !mapEntry->IsDungeon())
|
||||
{
|
||||
sLog.outError("_LoadBoundInstances: player %s(%d) has bind to nonexistent or not dungeon map %d", GetName(), GetGUIDLow(), mapId);
|
||||
CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%d' AND instance = '%d'", GetGUIDLow(), instanceId);
|
||||
CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%u' AND instance = '%u'", GetGUIDLow(), instanceId);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(difficulty >= MAX_DIFFICULTY)
|
||||
{
|
||||
sLog.outError("_LoadBoundInstances: player %s(%d) has bind to nonexistent difficulty %d instance for map %u", GetName(), GetGUIDLow(), difficulty, mapId);
|
||||
CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%d' AND instance = '%d'", GetGUIDLow(), instanceId);
|
||||
CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%u' AND instance = '%u'", GetGUIDLow(), instanceId);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -16549,7 +16549,7 @@ void Player::_LoadBoundInstances(QueryResult *result)
|
|||
if(!mapDiff)
|
||||
{
|
||||
sLog.outError("_LoadBoundInstances: player %s(%d) has bind to nonexistent difficulty %d instance for map %u", GetName(), GetGUIDLow(), difficulty, mapId);
|
||||
CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%d' AND instance = '%d'", GetGUIDLow(), instanceId);
|
||||
CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%u' AND instance = '%u'", GetGUIDLow(), instanceId);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -16557,7 +16557,7 @@ void Player::_LoadBoundInstances(QueryResult *result)
|
|||
{
|
||||
sLog.outError("_LoadBoundInstances: %s is in group (Id: %d) but has a non-permanent character bind to map %d,%d,%d",
|
||||
GetObjectGuid().GetString().c_str(), group->GetId(), mapId, instanceId, difficulty);
|
||||
CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%d' AND instance = '%d'",
|
||||
CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%u' AND instance = '%u'",
|
||||
GetGUIDLow(), instanceId);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -16776,7 +16776,7 @@ void Player::ConvertInstancesToGroup(Player *player, Group *group, ObjectGuid pl
|
|||
|
||||
// the following should not get executed when changing leaders
|
||||
if(!player || has_solo)
|
||||
CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%d' AND permanent = 0", player_lowguid);
|
||||
CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%u' AND permanent = 0", player_lowguid);
|
||||
}
|
||||
|
||||
bool Player::_LoadHomeBind(QueryResult *result)
|
||||
|
|
@ -17116,7 +17116,7 @@ void Player::_SaveAuras()
|
|||
continue;
|
||||
|
||||
CharacterDatabase.PExecute("INSERT INTO character_aura (guid, caster_guid, item_guid, spell, stackcount, remaincharges, basepoints0, basepoints1, basepoints2, maxduration0, maxduration1, maxduration2, remaintime0, remaintime1, remaintime2, effIndexMask) VALUES "
|
||||
"('%u', '" UI64FMTD "', '%u', '%u', '%u', '%u', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%u')",
|
||||
"('%u', '" UI64FMTD "', '%u', '%u', '%u', '%u', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%u')",
|
||||
GetGUIDLow(), holder->GetCasterGUID(), GUID_LOPART(holder->GetCastItemGUID()), holder->GetId(), holder->GetStackAmount(), holder->GetAuraCharges(),
|
||||
damage[EFFECT_INDEX_0], damage[EFFECT_INDEX_1], damage[EFFECT_INDEX_2],
|
||||
maxduration[EFFECT_INDEX_0], maxduration[EFFECT_INDEX_1], maxduration[EFFECT_INDEX_2],
|
||||
|
|
|
|||
|
|
@ -423,7 +423,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
|||
bool incHighest = true;
|
||||
if (guid != 0 && guid < sObjectMgr.m_CharGuids.GetNextAfterMaxUsed())
|
||||
{
|
||||
result = CharacterDatabase.PQuery("SELECT * FROM characters WHERE guid = '%d'", guid);
|
||||
result = CharacterDatabase.PQuery("SELECT * FROM characters WHERE guid = '%u'", guid);
|
||||
if (result)
|
||||
{
|
||||
guid = sObjectMgr.m_CharGuids.GetNextAfterMaxUsed();
|
||||
|
|
|
|||
|
|
@ -461,7 +461,9 @@ void WaypointManager::AddAfterNode(uint32 id, uint32 point, float x, float y, fl
|
|||
void WaypointManager::_addNode(uint32 id, uint32 point, float x, float y, float z, float o, uint32 delay, uint32 wpGuid)
|
||||
{
|
||||
if(point == 0) return; // counted from 1 in the DB
|
||||
WorldDatabase.PExecuteLog("INSERT INTO creature_movement (id,point,position_x,position_y,position_z,orientation,wpguid,waittime) VALUES ('%u','%u','%f', '%f', '%f', '%f', '%d', '%d')", id, point, x, y, z, o, wpGuid, delay);
|
||||
WorldDatabase.PExecuteLog("INSERT INTO creature_movement (id,point,position_x,position_y,position_z,orientation,wpguid,waittime) "
|
||||
"VALUES ('%u','%u','%f', '%f', '%f', '%f', '%u', '%u')",
|
||||
id, point, x, y, z, o, wpGuid, delay);
|
||||
WaypointPathMap::iterator itr = m_pathMap.find(id);
|
||||
if(itr == m_pathMap.end())
|
||||
itr = m_pathMap.insert(WaypointPathMap::value_type(id, WaypointPath())).first;
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ World::AddSession_ (WorldSession* s)
|
|||
float popu = float(GetActiveSessionCount()); // updated number of users on the server
|
||||
popu /= pLimit;
|
||||
popu *= 2;
|
||||
LoginDatabase.PExecute ("UPDATE realmlist SET population = '%f' WHERE id = '%d'", popu, realmID);
|
||||
LoginDatabase.PExecute ("UPDATE realmlist SET population = '%f' WHERE id = '%u'", popu, realmID);
|
||||
DETAIL_LOG("Server Population (%f).", popu);
|
||||
}
|
||||
}
|
||||
|
|
@ -913,7 +913,7 @@ void World::SetInitialWorldSettings()
|
|||
// not send custom type REALM_FFA_PVP to realm list
|
||||
uint32 server_type = IsFFAPvPRealm() ? REALM_TYPE_PVP : getConfig(CONFIG_UINT32_GAME_TYPE);
|
||||
uint32 realm_zone = getConfig(CONFIG_UINT32_REALM_ZONE);
|
||||
LoginDatabase.PExecute("UPDATE realmlist SET icon = %u, timezone = %u WHERE id = '%d'", server_type, realm_zone, realmID);
|
||||
LoginDatabase.PExecute("UPDATE realmlist SET icon = %u, timezone = %u WHERE id = '%u'", server_type, realm_zone, realmID);
|
||||
|
||||
///- Remove the bones (they should not exist in DB though) and old corpses after a restart
|
||||
CharacterDatabase.PExecute("DELETE FROM corpse WHERE corpse_type = '0' OR time < (UNIX_TIMESTAMP()-'%u')", 3*DAY);
|
||||
|
|
@ -1928,7 +1928,7 @@ void World::_UpdateRealmCharCount(QueryResult *resultCharCount, uint32 accountId
|
|||
Field *fields = resultCharCount->Fetch();
|
||||
uint32 charCount = fields[0].GetUInt32();
|
||||
delete resultCharCount;
|
||||
LoginDatabase.PExecute("DELETE FROM realmcharacters WHERE acctid= '%d' AND realmid = '%d'", accountId, realmID);
|
||||
LoginDatabase.PExecute("DELETE FROM realmcharacters WHERE acctid= '%u' AND realmid = '%u'", accountId, realmID);
|
||||
LoginDatabase.PExecute("INSERT INTO realmcharacters (numchars, acctid, realmid) VALUES (%u, %u, %u)", charCount, accountId, realmID);
|
||||
}
|
||||
}
|
||||
|
|
@ -2091,7 +2091,8 @@ void World::SetPlayerLimit( int32 limit, bool needUpdate )
|
|||
m_playerLimit = limit;
|
||||
|
||||
if (db_update_need)
|
||||
LoginDatabase.PExecute("UPDATE realmlist SET allowedSecurityLevel = '%u' WHERE id = '%d'",uint8(GetPlayerSecurityLimit()),realmID);
|
||||
LoginDatabase.PExecute("UPDATE realmlist SET allowedSecurityLevel = '%u' WHERE id = '%u'",
|
||||
uint32(GetPlayerSecurityLimit()), realmID);
|
||||
}
|
||||
|
||||
void World::UpdateMaxSessionCounters()
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ int Master::Run()
|
|||
{
|
||||
std::string builds = AcceptableClientBuildsListStr();
|
||||
LoginDatabase.escape_string(builds);
|
||||
LoginDatabase.PExecute("UPDATE realmlist SET realmflags = realmflags & ~(%u), population = 0, realmbuilds = '%s' WHERE id = '%d'", REALM_FLAG_OFFLINE, builds.c_str(), realmID);
|
||||
LoginDatabase.PExecute("UPDATE realmlist SET realmflags = realmflags & ~(%u), population = 0, realmbuilds = '%s' WHERE id = '%u'", REALM_FLAG_OFFLINE, builds.c_str(), realmID);
|
||||
}
|
||||
|
||||
ACE_Based::Thread* cliThread = NULL;
|
||||
|
|
@ -327,7 +327,7 @@ int Master::Run()
|
|||
}
|
||||
|
||||
///- Set server offline in realmlist
|
||||
LoginDatabase.PExecute("UPDATE realmlist SET realmflags = realmflags | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, realmID);
|
||||
LoginDatabase.PExecute("UPDATE realmlist SET realmflags = realmflags | %u WHERE id = '%u'", REALM_FLAG_OFFLINE, realmID);
|
||||
|
||||
///- Remove signal handling before leaving
|
||||
_UnhookSignals();
|
||||
|
|
@ -529,7 +529,7 @@ void Master::clearOnlineAccounts()
|
|||
{
|
||||
// Cleanup online status for characters hosted at current realm
|
||||
/// \todo Only accounts with characters logged on *this* realm should have online status reset. Move the online column from 'account' to 'realmcharacters'?
|
||||
LoginDatabase.PExecute("UPDATE account SET active_realm_id = 0 WHERE active_realm_id = '%d'", realmID);
|
||||
LoginDatabase.PExecute("UPDATE account SET active_realm_id = 0 WHERE active_realm_id = '%u'", realmID);
|
||||
|
||||
CharacterDatabase.Execute("UPDATE characters SET online = 0 WHERE online<>0");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue