Merge
--HG-- branch : trunk
This commit is contained in:
+7
-18
@@ -59,10 +59,9 @@ 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_AutoPtr result = loginDatabase.PQuery("SELECT 1 FROM account WHERE id='%d'", accid);
|
||||
if(!result)
|
||||
return AOR_NAME_NOT_EXIST; // account doesn't exist
|
||||
delete result;
|
||||
|
||||
result = CharacterDatabase.PQuery("SELECT guid FROM characters WHERE account='%d'",accid);
|
||||
if (result)
|
||||
@@ -83,8 +82,6 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accid)
|
||||
|
||||
Player::DeleteFromDB(guid, accid, false); // no need to update realm characters
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
// table realm specific but common for all characters of account for realm
|
||||
@@ -108,10 +105,9 @@ 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_AutoPtr result = loginDatabase.PQuery("SELECT 1 FROM account WHERE id='%d'", accid);
|
||||
if(!result)
|
||||
return AOR_NAME_NOT_EXIST; // account doesn't exist
|
||||
delete result;
|
||||
|
||||
if(utf8length(new_uname) > MAX_ACCOUNT_STR)
|
||||
return AOR_NAME_TOO_LONG;
|
||||
@@ -156,24 +152,22 @@ AccountOpResult AccountMgr::ChangePassword(uint32 accid, std::string new_passwd)
|
||||
uint32 AccountMgr::GetId(std::string username)
|
||||
{
|
||||
loginDatabase.escape_string(username);
|
||||
QueryResult *result = loginDatabase.PQuery("SELECT id FROM account WHERE username = '%s'", username.c_str());
|
||||
QueryResult_AutoPtr result = loginDatabase.PQuery("SELECT id FROM account WHERE username = '%s'", username.c_str());
|
||||
if(!result)
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
uint32 id = (*result)[0].GetUInt32();
|
||||
delete result;
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 AccountMgr::GetSecurity(uint32 acc_id)
|
||||
{
|
||||
QueryResult *result = loginDatabase.PQuery("SELECT gmlevel FROM account_access WHERE id = '%u'", acc_id);
|
||||
QueryResult_AutoPtr result = loginDatabase.PQuery("SELECT gmlevel FROM account_access WHERE id = '%u'", acc_id);
|
||||
if(result)
|
||||
{
|
||||
uint32 sec = (*result)[0].GetUInt32();
|
||||
delete result;
|
||||
return sec;
|
||||
}
|
||||
|
||||
@@ -182,13 +176,12 @@ uint32 AccountMgr::GetSecurity(uint32 acc_id)
|
||||
|
||||
uint32 AccountMgr::GetSecurity(uint32 acc_id, int32 realm_id)
|
||||
{
|
||||
QueryResult *result = (realm_id == -1)
|
||||
QueryResult_AutoPtr result = (realm_id == -1)
|
||||
? loginDatabase.PQuery("SELECT gmlevel FROM account_access WHERE id = '%u' AND RealmID = '%d'", acc_id, realm_id)
|
||||
: loginDatabase.PQuery("SELECT gmlevel FROM account_access WHERE id = '%u' AND (RealmID = '%d' OR RealmID = '-1')", acc_id, realm_id);
|
||||
if(result)
|
||||
{
|
||||
uint32 sec = (*result)[0].GetUInt32();
|
||||
delete result;
|
||||
return sec;
|
||||
}
|
||||
|
||||
@@ -197,11 +190,10 @@ uint32 AccountMgr::GetSecurity(uint32 acc_id, int32 realm_id)
|
||||
|
||||
bool AccountMgr::GetName(uint32 acc_id, std::string &name)
|
||||
{
|
||||
QueryResult *result = loginDatabase.PQuery("SELECT username FROM account WHERE id = '%u'", acc_id);
|
||||
QueryResult_AutoPtr result = loginDatabase.PQuery("SELECT username FROM account WHERE id = '%u'", acc_id);
|
||||
if(result)
|
||||
{
|
||||
name = (*result)[0].GetCppString();
|
||||
delete result;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -217,12 +209,9 @@ bool AccountMgr::CheckPassword(uint32 accid, std::string passwd)
|
||||
normalizeString(username);
|
||||
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_AutoPtr result = loginDatabase.PQuery("SELECT 1 FROM account WHERE id='%d' AND sha_pass_hash='%s'", accid, CalculateShaPassHash(username, passwd).c_str());
|
||||
if (result)
|
||||
{
|
||||
delete result;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -535,7 +535,7 @@ void AchievementMgr::SaveToDB()
|
||||
}
|
||||
}
|
||||
|
||||
void AchievementMgr::LoadFromDB(QueryResult *achievementResult, QueryResult *criteriaResult)
|
||||
void AchievementMgr::LoadFromDB(QueryResult_AutoPtr achievementResult, QueryResult_AutoPtr criteriaResult)
|
||||
{
|
||||
if(achievementResult)
|
||||
{
|
||||
@@ -553,7 +553,6 @@ void AchievementMgr::LoadFromDB(QueryResult *achievementResult, QueryResult *cri
|
||||
ca.date = time_t(fields[1].GetUInt64());
|
||||
ca.changed = false;
|
||||
} while(achievementResult->NextRow());
|
||||
delete achievementResult;
|
||||
}
|
||||
|
||||
if(criteriaResult)
|
||||
@@ -583,7 +582,6 @@ void AchievementMgr::LoadFromDB(QueryResult *achievementResult, QueryResult *cri
|
||||
progress.date = date;
|
||||
progress.changed = false;
|
||||
} while(criteriaResult->NextRow());
|
||||
delete criteriaResult;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1937,7 +1935,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
|
||||
{
|
||||
m_criteriaDataMap.clear(); // need for reload case
|
||||
|
||||
QueryResult *result = WorldDatabase.Query("SELECT criteria_id, type, value1, value2 FROM achievement_criteria_data");
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT criteria_id, type, value1, value2 FROM achievement_criteria_data");
|
||||
|
||||
if(!result)
|
||||
{
|
||||
@@ -1988,8 +1986,6 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
|
||||
++count;
|
||||
} while(result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
// post loading checks
|
||||
for (uint32 entryId = 0; entryId < sAchievementCriteriaStore.GetNumRows(); ++entryId)
|
||||
{
|
||||
@@ -2061,7 +2057,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
|
||||
|
||||
void AchievementGlobalMgr::LoadCompletedAchievements()
|
||||
{
|
||||
QueryResult *result = CharacterDatabase.Query("SELECT achievement FROM character_achievement GROUP BY achievement");
|
||||
QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT achievement FROM character_achievement GROUP BY achievement");
|
||||
|
||||
if(!result)
|
||||
{
|
||||
@@ -2091,8 +2087,6 @@ void AchievementGlobalMgr::LoadCompletedAchievements()
|
||||
m_allCompletedAchievements.insert(achievement_id);
|
||||
} while(result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %lu realm completed achievements.",(unsigned long)m_allCompletedAchievements.size());
|
||||
}
|
||||
@@ -2102,7 +2096,7 @@ void AchievementGlobalMgr::LoadRewards()
|
||||
m_achievementRewards.clear(); // need for reload case
|
||||
|
||||
// 0 1 2 3 4 5 6
|
||||
QueryResult *result = WorldDatabase.Query("SELECT entry, title_A, title_H, item, sender, subject, text FROM achievement_reward");
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, title_A, title_H, item, sender, subject, text FROM achievement_reward");
|
||||
|
||||
if(!result)
|
||||
{
|
||||
@@ -2203,8 +2197,6 @@ void AchievementGlobalMgr::LoadRewards()
|
||||
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u achievement rewards", count );
|
||||
}
|
||||
@@ -2213,7 +2205,7 @@ void AchievementGlobalMgr::LoadRewardLocales()
|
||||
{
|
||||
m_achievementRewardLocales.clear(); // need for reload case
|
||||
|
||||
QueryResult *result = WorldDatabase.Query("SELECT entry,subject_loc1,text_loc1,subject_loc2,text_loc2,subject_loc3,text_loc3,subject_loc4,text_loc4,subject_loc5,text_loc5,subject_loc6,text_loc6,subject_loc7,text_loc7,subject_loc8,text_loc8 FROM locales_achievement_reward");
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry,subject_loc1,text_loc1,subject_loc2,text_loc2,subject_loc3,text_loc3,subject_loc4,text_loc4,subject_loc5,text_loc5,subject_loc6,text_loc6,subject_loc7,text_loc7,subject_loc8,text_loc8 FROM locales_achievement_reward");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@@ -2273,8 +2265,6 @@ void AchievementGlobalMgr::LoadRewardLocales()
|
||||
}
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %lu achievement reward locale strings", (unsigned long)m_achievementRewardLocales.size() );
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ class AchievementMgr
|
||||
|
||||
void Reset();
|
||||
static void DeleteFromDB(uint32 lowguid);
|
||||
void LoadFromDB(QueryResult *achievementResult, QueryResult *criteriaResult);
|
||||
void LoadFromDB(QueryResult_AutoPtr achievementResult, QueryResult_AutoPtr criteriaResult);
|
||||
void SaveToDB();
|
||||
void ResetAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1=0, uint32 miscvalue2=0);
|
||||
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1=0, uint32 miscvalue2=0, Unit *unit=NULL, uint32 time=0);
|
||||
|
||||
@@ -42,7 +42,7 @@ AddonMgr::~AddonMgr()
|
||||
|
||||
void AddonMgr::LoadFromDB()
|
||||
{
|
||||
QueryResult* result = CharacterDatabase.PQuery("SELECT name, crc FROM addons");
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT name, crc FROM addons");
|
||||
if(!result)
|
||||
{
|
||||
sLog.outErrorDb("The table `addons` is empty");
|
||||
@@ -68,8 +68,6 @@ void AddonMgr::LoadFromDB()
|
||||
m_knownAddons.push_back(addon);
|
||||
} while(result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %u known addons", count);
|
||||
}
|
||||
|
||||
+4
-10
@@ -116,13 +116,12 @@ bool ArenaTeam::AddMember(const uint64& PlayerGuid)
|
||||
else
|
||||
{
|
||||
// 0 1
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT name, class FROM characters WHERE guid='%u'", GUID_LOPART(PlayerGuid));
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT name, class FROM characters WHERE guid='%u'", GUID_LOPART(PlayerGuid));
|
||||
if(!result)
|
||||
return false;
|
||||
|
||||
plName = (*result)[0].GetCppString();
|
||||
plClass = (*result)[1].GetUInt8();
|
||||
delete result;
|
||||
|
||||
// check if player already in arenateam of that size
|
||||
if(Player::GetArenaTeamIdFromDB(PlayerGuid, GetType()) != 0)
|
||||
@@ -175,7 +174,7 @@ bool ArenaTeam::AddMember(const uint64& PlayerGuid)
|
||||
|
||||
bool ArenaTeam::LoadArenaTeamFromDB(uint32 ArenaTeamId)
|
||||
{
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT arenateamid,name,captainguid,type,BackgroundColor,EmblemStyle,EmblemColor,BorderStyle,BorderColor FROM arena_team WHERE arenateamid = '%u'", ArenaTeamId);
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT arenateamid,name,captainguid,type,BackgroundColor,EmblemStyle,EmblemColor,BorderStyle,BorderColor FROM arena_team WHERE arenateamid = '%u'", ArenaTeamId);
|
||||
|
||||
if(!result)
|
||||
return false;
|
||||
@@ -192,8 +191,6 @@ bool ArenaTeam::LoadArenaTeamFromDB(uint32 ArenaTeamId)
|
||||
m_BorderStyle = fields[7].GetUInt32();
|
||||
m_BorderColor = fields[8].GetUInt32();
|
||||
|
||||
delete result;
|
||||
|
||||
// only load here, so additional checks can be made
|
||||
LoadStatsFromDB(ArenaTeamId);
|
||||
LoadMembersFromDB(ArenaTeamId);
|
||||
@@ -215,7 +212,7 @@ bool ArenaTeam::LoadArenaTeamFromDB(uint32 ArenaTeamId)
|
||||
void ArenaTeam::LoadStatsFromDB(uint32 ArenaTeamId)
|
||||
{
|
||||
// 0 1 2 3 4 5
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT rating,games,wins,played,wins2,rank FROM arena_team_stats WHERE arenateamid = '%u'", ArenaTeamId);
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT rating,games,wins,played,wins2,rank FROM arena_team_stats WHERE arenateamid = '%u'", ArenaTeamId);
|
||||
|
||||
if(!result)
|
||||
return;
|
||||
@@ -228,14 +225,12 @@ void ArenaTeam::LoadStatsFromDB(uint32 ArenaTeamId)
|
||||
m_stats.games_season = fields[3].GetUInt32();
|
||||
m_stats.wins_season = fields[4].GetUInt32();
|
||||
m_stats.rank = fields[5].GetUInt32();
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
void ArenaTeam::LoadMembersFromDB(uint32 ArenaTeamId)
|
||||
{
|
||||
// 0 1 2 3 4 5 6 7
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT member.guid,played_week,wons_week,played_season,wons_season,personal_rating,name,class "
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT member.guid,played_week,wons_week,played_season,wons_season,personal_rating,name,class "
|
||||
"FROM arena_team_member member "
|
||||
"INNER JOIN characters chars on member.guid = chars.guid "
|
||||
"WHERE member.arenateamid = '%u'", ArenaTeamId);
|
||||
@@ -256,7 +251,6 @@ void ArenaTeam::LoadMembersFromDB(uint32 ArenaTeamId)
|
||||
newmember.Class = fields[7].GetUInt8();
|
||||
m_members.push_back(newmember);
|
||||
}while( result->NextRow() );
|
||||
delete result;
|
||||
}
|
||||
|
||||
void ArenaTeam::SetCaptain(const uint64& guid)
|
||||
|
||||
@@ -485,19 +485,13 @@ void AuctionHouseBot::addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *con
|
||||
return;
|
||||
}
|
||||
|
||||
QueryResult* result = CharacterDatabase.PQuery("SELECT id FROM auctionhouse WHERE itemowner<>%u AND buyguid<>%u", AHBplayerGUID, AHBplayerGUID);
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT id FROM auctionhouse WHERE itemowner<>%u AND buyguid<>%u", AHBplayerGUID, AHBplayerGUID);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
delete result;
|
||||
return;
|
||||
}
|
||||
|
||||
if (result->GetRowCount() == 0)
|
||||
{
|
||||
delete result;
|
||||
return;
|
||||
}
|
||||
|
||||
// Fetches content of selected AH
|
||||
AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap(config->GetAHFID());
|
||||
@@ -508,7 +502,6 @@ void AuctionHouseBot::addNewAuctionBuyerBotBid(Player *AHBplayer, AHBConfig *con
|
||||
uint32 tmpdata = result->Fetch()->GetUInt32();
|
||||
possibleBids.push_back(tmpdata);
|
||||
}while (result->NextRow());
|
||||
delete result;
|
||||
|
||||
for (uint32 count = 1; count <= config->GetBidsPerInterval(); ++count)
|
||||
{
|
||||
@@ -701,7 +694,7 @@ void AuctionHouseBot::Update()
|
||||
|
||||
WorldSession _session(AHBplayerAccount, NULL, SEC_PLAYER, true, 0, LOCALE_enUS);
|
||||
Player _AHBplayer(&_session);
|
||||
_AHBplayer.MinimalLoadFromDB(NULL, AHBplayerGUID);
|
||||
_AHBplayer.MinimalLoadFromDB(QueryResult_AutoPtr(NULL), AHBplayerGUID);
|
||||
ObjectAccessor::Instance().AddObject(&_AHBplayer);
|
||||
|
||||
// Only for testing, this can likely be removed, once I know it's working as expected.
|
||||
@@ -832,7 +825,7 @@ void AuctionHouseBot::Initialize()
|
||||
|
||||
if (AHBSeller)
|
||||
{
|
||||
QueryResult* results = (QueryResult*) NULL;
|
||||
QueryResult_AutoPtr results = QueryResult_AutoPtr(NULL);
|
||||
char npcQuery[] = "SELECT distinct item FROM npc_vendor";
|
||||
results = WorldDatabase.PQuery(npcQuery);
|
||||
if (results != NULL)
|
||||
@@ -843,8 +836,6 @@ void AuctionHouseBot::Initialize()
|
||||
npcItems.push_back(fields[0].GetUInt32());
|
||||
|
||||
} while (results->NextRow());
|
||||
|
||||
delete results;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -872,8 +863,6 @@ void AuctionHouseBot::Initialize()
|
||||
lootItems.push_back(fields[0].GetUInt32());
|
||||
|
||||
} while (results->NextRow());
|
||||
|
||||
delete results;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -267,7 +267,7 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry * auction)
|
||||
void AuctionHouseMgr::LoadAuctionItems()
|
||||
{
|
||||
// data needs to be at first place for Item::LoadFromDB
|
||||
QueryResult *result = CharacterDatabase.Query("SELECT data,itemguid,item_template FROM auctionhouse JOIN item_instance ON itemguid = guid");
|
||||
QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT data,itemguid,item_template FROM auctionhouse JOIN item_instance ON itemguid = guid");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@@ -310,7 +310,6 @@ void AuctionHouseMgr::LoadAuctionItems()
|
||||
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %u auction items", count);
|
||||
@@ -318,7 +317,7 @@ void AuctionHouseMgr::LoadAuctionItems()
|
||||
|
||||
void AuctionHouseMgr::LoadAuctions()
|
||||
{
|
||||
QueryResult *result = CharacterDatabase.Query("SELECT COUNT(*) FROM auctionhouse");
|
||||
QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT COUNT(*) FROM auctionhouse");
|
||||
if (!result)
|
||||
{
|
||||
barGoLink bar(1);
|
||||
@@ -330,7 +329,6 @@ void AuctionHouseMgr::LoadAuctions()
|
||||
|
||||
Field *fields = result->Fetch();
|
||||
uint32 AuctionCount=fields[0].GetUInt32();
|
||||
delete result;
|
||||
|
||||
if (!AuctionCount)
|
||||
{
|
||||
@@ -415,7 +413,6 @@ void AuctionHouseMgr::LoadAuctions()
|
||||
GetAuctionsMap(auctioneerInfo->faction_A)->AddAuction(aItem);
|
||||
|
||||
} while (result->NextRow());
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %u auctions", AuctionCount);
|
||||
@@ -506,19 +503,13 @@ void AuctionHouseObject::Update()
|
||||
if (AuctionsMap.empty())
|
||||
return;
|
||||
|
||||
QueryResult* result = CharacterDatabase.PQuery("SELECT id FROM auctionhouse WHERE time <= %u ORDER BY TIME ASC", (uint32)curTime+60);
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT id FROM auctionhouse WHERE time <= %u ORDER BY TIME ASC", (uint32)curTime+60);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
delete result;
|
||||
return;
|
||||
}
|
||||
|
||||
if (result->GetRowCount() == 0)
|
||||
{
|
||||
delete result;
|
||||
return;
|
||||
}
|
||||
|
||||
vector<uint32> expiredAuctions;
|
||||
|
||||
@@ -527,7 +518,6 @@ void AuctionHouseObject::Update()
|
||||
uint32 tmpdata = result->Fetch()->GetUInt32();
|
||||
expiredAuctions.push_back(tmpdata);
|
||||
} while (result->NextRow());
|
||||
delete result;
|
||||
|
||||
while (!expiredAuctions.empty())
|
||||
{
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@ void Bag::SaveToDB()
|
||||
Item::SaveToDB();
|
||||
}
|
||||
|
||||
bool Bag::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult *result)
|
||||
bool Bag::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult_AutoPtr result)
|
||||
{
|
||||
if(!Item::LoadFromDB(guid, owner_guid, result))
|
||||
return false;
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ class Bag : public Item
|
||||
// overwrite virtual Item::SaveToDB
|
||||
void SaveToDB();
|
||||
// overwrite virtual Item::LoadFromDB
|
||||
bool LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult *result = NULL);
|
||||
bool LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult_AutoPtr result = QueryResult_AutoPtr(NULL));
|
||||
// overwrite virtual Item::DeleteFromDB
|
||||
void DeleteFromDB();
|
||||
|
||||
|
||||
@@ -1645,7 +1645,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
||||
uint32 count = 0;
|
||||
|
||||
// 0 1 2 3 4 5 6 7 8
|
||||
QueryResult *result = WorldDatabase.Query("SELECT id, MinPlayersPerTeam,MaxPlayersPerTeam,MinLvl,MaxLvl,AllianceStartLoc,AllianceStartO,HordeStartLoc,HordeStartO FROM battleground_template");
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT id, MinPlayersPerTeam,MaxPlayersPerTeam,MinLvl,MaxLvl,AllianceStartLoc,AllianceStartO,HordeStartLoc,HordeStartO FROM battleground_template");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@@ -1747,8 +1747,6 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u battlegrounds", count );
|
||||
}
|
||||
@@ -1758,7 +1756,7 @@ void BattleGroundMgr::InitAutomaticArenaPointDistribution()
|
||||
if (sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS))
|
||||
{
|
||||
sLog.outDebug("Initializing Automatic Arena Point Distribution");
|
||||
QueryResult * result = CharacterDatabase.Query("SELECT NextArenaPointDistributionTime FROM saved_variables");
|
||||
QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT NextArenaPointDistributionTime FROM saved_variables");
|
||||
if (!result)
|
||||
{
|
||||
sLog.outDebug("Battleground: Next arena point distribution time not found in SavedVariables, reseting it now.");
|
||||
@@ -1766,10 +1764,7 @@ void BattleGroundMgr::InitAutomaticArenaPointDistribution()
|
||||
CharacterDatabase.PExecute("INSERT INTO saved_variables (NextArenaPointDistributionTime) VALUES ('"UI64FMTD"')", m_NextAutoDistributionTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_NextAutoDistributionTime = time_t((*result)[0].GetUInt64());
|
||||
delete result;
|
||||
}
|
||||
sLog.outDebug("Automatic Arena Point Distribution initialized.");
|
||||
}
|
||||
}
|
||||
@@ -2054,7 +2049,7 @@ void BattleGroundMgr::LoadBattleMastersEntry()
|
||||
{
|
||||
mBattleMastersMap.clear(); // need for reload case
|
||||
|
||||
QueryResult *result = WorldDatabase.Query( "SELECT entry,bg_template FROM battlemaster_entry" );
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query( "SELECT entry,bg_template FROM battlemaster_entry" );
|
||||
|
||||
uint32 count = 0;
|
||||
|
||||
@@ -2089,8 +2084,6 @@ void BattleGroundMgr::LoadBattleMastersEntry()
|
||||
|
||||
} while( result->NextRow() );
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u battlemaster entries", count );
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team)
|
||||
//load not built in channel if saved
|
||||
std::string _name(name);
|
||||
CharacterDatabase.escape_string(_name);
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT m_name, m_team, m_announce, m_moderate, m_password, BannedList FROM channels WHERE m_name = '%s' AND m_team = '%u'", _name.c_str(), m_Team);
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT m_name, m_team, m_announce, m_moderate, m_password, BannedList FROM channels WHERE m_name = '%s' AND m_team = '%u'", _name.c_str(), m_Team);
|
||||
if (result)//load
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
@@ -64,8 +64,6 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team)
|
||||
m_password = fields[4].GetString();
|
||||
const char* db_BannedList = fields[5].GetString();
|
||||
|
||||
delete result;
|
||||
|
||||
m_IsSaved = true;
|
||||
|
||||
if (db_BannedList)
|
||||
|
||||
@@ -106,17 +106,14 @@ class CharacterHandler
|
||||
{
|
||||
|
||||
public:
|
||||
void HandleCharEnumCallback(QueryResult * result, uint32 account)
|
||||
void HandleCharEnumCallback(QueryResult_AutoPtr result, uint32 account)
|
||||
{
|
||||
WorldSession * session = sWorld.FindSession(account);
|
||||
if(!session)
|
||||
{
|
||||
delete result;
|
||||
return;
|
||||
}
|
||||
session->HandleCharEnum(result);
|
||||
}
|
||||
void HandlePlayerLoginCallback(QueryResult * /*dummy*/, SqlQueryHolder * holder)
|
||||
void HandlePlayerLoginCallback(QueryResult_AutoPtr /*dummy*/, SqlQueryHolder * holder)
|
||||
{
|
||||
if (!holder) return;
|
||||
WorldSession *session = sWorld.FindSession(((LoginQueryHolder*)holder)->GetAccountId());
|
||||
@@ -129,7 +126,7 @@ class CharacterHandler
|
||||
}
|
||||
} chrHandler;
|
||||
|
||||
void WorldSession::HandleCharEnum(QueryResult * result)
|
||||
void WorldSession::HandleCharEnum(QueryResult_AutoPtr result)
|
||||
{
|
||||
WorldPacket data(SMSG_CHAR_ENUM, 100); // we guess size
|
||||
|
||||
@@ -147,8 +144,6 @@ void WorldSession::HandleCharEnum(QueryResult * result)
|
||||
++num;
|
||||
}
|
||||
while( result->NextRow() );
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
data.put<uint8>(0, num);
|
||||
@@ -281,12 +276,11 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
||||
return;
|
||||
}
|
||||
|
||||
QueryResult *resultacct = loginDatabase.PQuery("SELECT SUM(numchars) FROM realmcharacters WHERE acctid = '%d'", GetAccountId());
|
||||
QueryResult_AutoPtr resultacct = loginDatabase.PQuery("SELECT SUM(numchars) FROM realmcharacters WHERE acctid = '%d'", GetAccountId());
|
||||
if (resultacct)
|
||||
{
|
||||
Field *fields=resultacct->Fetch();
|
||||
uint32 acctcharcount = fields[0].GetUInt32();
|
||||
delete resultacct;
|
||||
|
||||
if (acctcharcount >= sWorld.getConfig(CONFIG_CHARACTERS_PER_ACCOUNT))
|
||||
{
|
||||
@@ -296,13 +290,12 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
||||
}
|
||||
}
|
||||
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT COUNT(guid) FROM characters WHERE account = '%d'", GetAccountId());
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT COUNT(guid) FROM characters WHERE account = '%d'", GetAccountId());
|
||||
uint8 charcount = 0;
|
||||
if ( result )
|
||||
{
|
||||
Field *fields=result->Fetch();
|
||||
charcount = fields[0].GetUInt8();
|
||||
delete result;
|
||||
|
||||
if (charcount >= sWorld.getConfig(CONFIG_CHARACTERS_PER_REALM))
|
||||
{
|
||||
@@ -340,7 +333,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
||||
|
||||
if(!AllowTwoSideAccounts || skipCinematics == 1 || class_ == CLASS_DEATH_KNIGHT)
|
||||
{
|
||||
QueryResult *result2 = CharacterDatabase.PQuery("SELECT level,race,class FROM characters WHERE account = '%u' %s",
|
||||
QueryResult_AutoPtr result2 = CharacterDatabase.PQuery("SELECT level,race,class FROM characters WHERE account = '%u' %s",
|
||||
GetAccountId(), (skipCinematics == 1 || class_ == CLASS_DEATH_KNIGHT) ? "" : "LIMIT 1");
|
||||
if(result2)
|
||||
{
|
||||
@@ -361,7 +354,6 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT;
|
||||
SendPacket( &data );
|
||||
delete result2;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -386,7 +378,6 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
data << (uint8)CHAR_CREATE_PVP_TEAMS_VIOLATION;
|
||||
SendPacket( &data );
|
||||
delete result2;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -416,7 +407,6 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT;
|
||||
SendPacket( &data );
|
||||
delete result2;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -429,7 +419,6 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
||||
}
|
||||
}
|
||||
}
|
||||
delete result2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -516,13 +505,12 @@ void WorldSession::HandleCharDeleteOpcode( WorldPacket & recv_data )
|
||||
return;
|
||||
}
|
||||
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT account,name FROM characters WHERE guid='%u'", GUID_LOPART(guid));
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT account,name FROM characters WHERE guid='%u'", GUID_LOPART(guid));
|
||||
if(result)
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
accountId = fields[0].GetUInt32();
|
||||
name = fields[1].GetCppString();
|
||||
delete result;
|
||||
}
|
||||
|
||||
// prevent deleting other players' characters using cheating tools
|
||||
@@ -652,14 +640,13 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
|
||||
}
|
||||
|
||||
//QueryResult *result = CharacterDatabase.PQuery("SELECT guildid,rank FROM guild_member WHERE guid = '%u'",pCurrChar->GetGUIDLow());
|
||||
QueryResult *resultGuild = holder->GetResult(PLAYER_LOGIN_QUERY_LOADGUILD);
|
||||
QueryResult_AutoPtr resultGuild = holder->GetResult(PLAYER_LOGIN_QUERY_LOADGUILD);
|
||||
|
||||
if(resultGuild)
|
||||
{
|
||||
Field *fields = resultGuild->Fetch();
|
||||
pCurrChar->SetInGuild(fields[0].GetUInt32());
|
||||
pCurrChar->SetRank(fields[1].GetUInt32());
|
||||
delete resultGuild;
|
||||
}
|
||||
else if(pCurrChar->GetGuildId()) // clear guild related fields in case wrong data about non existed membership
|
||||
{
|
||||
@@ -977,14 +964,11 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recv_data)
|
||||
);
|
||||
}
|
||||
|
||||
void WorldSession::HandleChangePlayerNameOpcodeCallBack(QueryResult *result, uint32 accountId, std::string newname)
|
||||
void WorldSession::HandleChangePlayerNameOpcodeCallBack(QueryResult_AutoPtr result, uint32 accountId, std::string newname)
|
||||
{
|
||||
WorldSession * session = sWorld.FindSession(accountId);
|
||||
if(!session)
|
||||
{
|
||||
if(result) delete result;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@@ -998,8 +982,6 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(QueryResult *result, uin
|
||||
uint64 guid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER);
|
||||
std::string oldname = result->Fetch()[1].GetCppString();
|
||||
|
||||
delete result;
|
||||
|
||||
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);
|
||||
|
||||
@@ -1187,7 +1169,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data)
|
||||
uint8 gender, skin, face, hairStyle, hairColor, facialHair;
|
||||
recv_data >> gender >> skin >> hairColor >> hairStyle >> facialHair >> face;
|
||||
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT at_login FROM characters WHERE guid ='%u'", GUID_LOPART(guid));
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT at_login FROM characters WHERE guid ='%u'", GUID_LOPART(guid));
|
||||
if (!result)
|
||||
{
|
||||
WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1);
|
||||
@@ -1198,7 +1180,6 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data)
|
||||
|
||||
Field *fields = result->Fetch();
|
||||
uint32 at_loginFlags = fields[0].GetUInt32();
|
||||
delete result;
|
||||
|
||||
if (!(at_loginFlags & AT_LOGIN_CUSTOMIZE))
|
||||
{
|
||||
@@ -1248,12 +1229,11 @@ 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)))
|
||||
if(QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT name FROM characters WHERE guid ='%u'", GUID_LOPART(guid)))
|
||||
{
|
||||
std::string oldname = result->Fetch()[0].GetCppString();
|
||||
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());
|
||||
delete result;
|
||||
}
|
||||
Player::Customize(guid, gender, skin, face, hairStyle, hairColor, facialHair);
|
||||
CharacterDatabase.PExecute("UPDATE characters set name = '%s', at_login = at_login & ~ %u WHERE guid ='%u'", newname.c_str(), uint32(AT_LOGIN_CUSTOMIZE), GUID_LOPART(guid));
|
||||
|
||||
+1
-2
@@ -751,7 +751,7 @@ ChatCommand * ChatHandler::getCommandTable()
|
||||
{
|
||||
load_command_table = false;
|
||||
|
||||
QueryResult *result = WorldDatabase.Query("SELECT name,security,help FROM command");
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT name,security,help FROM command");
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
@@ -762,7 +762,6 @@ ChatCommand * ChatHandler::getCommandTable()
|
||||
SetDataForCommandInTable(commandTable, name.c_str(), fields[1].GetUInt16(), fields[2].GetCppString(), name);
|
||||
|
||||
} while(result->NextRow());
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -605,8 +605,8 @@ class TRINITY_DLL_SPEC ChatHandler
|
||||
GameObject* GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid,uint32 entry);
|
||||
|
||||
// Utility methods for commands
|
||||
bool LookupPlayerSearchCommand(QueryResult* result, int32 limit);
|
||||
bool HandleBanListHelper(QueryResult* result);
|
||||
bool LookupPlayerSearchCommand(QueryResult_AutoPtr result, int32 limit);
|
||||
bool HandleBanListHelper(QueryResult_AutoPtr result);
|
||||
bool HandleBanHelper(BanMode mode,char const* args);
|
||||
bool HandleBanInfoHelper(uint32 accountid, char const* accountname);
|
||||
bool HandleUnBanHelper(BanMode mode,char const* args);
|
||||
|
||||
+5
-14
@@ -1107,24 +1107,15 @@ void Creature::SelectLevel(const CreatureInfo *cinfo)
|
||||
|
||||
//damage
|
||||
float damagemod = 1.0f;//_GetDamageMod(rank);
|
||||
float mindmg = stats->GenerateMinDmg(cinfo);
|
||||
float maxdmg = stats->GenerateMaxDmg(cinfo);
|
||||
float attackpower = stats->GenerateAttackPower(cinfo);
|
||||
|
||||
SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, mindmg * damagemod);
|
||||
SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, maxdmg * damagemod);
|
||||
SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, cinfo->mindmg * damagemod);
|
||||
SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, cinfo->maxdmg * damagemod);
|
||||
|
||||
SetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE, attackpower * damagemod);
|
||||
SetFloatValue(UNIT_FIELD_MINRANGEDDAMAGE,cinfo->minrangedmg * damagemod);
|
||||
SetFloatValue(UNIT_FIELD_MAXRANGEDDAMAGE,cinfo->maxrangedmg * damagemod);
|
||||
|
||||
// ranged damage
|
||||
float minrangeddmg = stats->GenerateRangedDmg(cinfo) / 2.5f;
|
||||
float maxrangeddmg = stats->GenerateRangedDmg(cinfo) - mindmg;
|
||||
float rangedattackpower = (minrangeddmg + maxrangeddmg) / 2 * 0.3;
|
||||
SetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE, cinfo->attackpower * damagemod);
|
||||
|
||||
SetFloatValue(UNIT_FIELD_MINRANGEDDAMAGE, minrangeddmg * damagemod);
|
||||
SetFloatValue(UNIT_FIELD_MAXRANGEDDAMAGE, maxrangeddmg * damagemod);
|
||||
|
||||
SetModifierValue(UNIT_MOD_ATTACK_POWER_RANGED, BASE_VALUE, rangedattackpower * damagemod);
|
||||
}
|
||||
|
||||
float Creature::_GetHealthMod(int32 Rank)
|
||||
|
||||
+6
-24
@@ -89,7 +89,10 @@ struct CreatureInfo
|
||||
float speed;
|
||||
float scale;
|
||||
uint32 rank;
|
||||
float mindmg;
|
||||
float maxdmg;
|
||||
uint32 dmgschool;
|
||||
uint32 attackpower;
|
||||
float dmg_multiplier;
|
||||
uint32 baseattacktime;
|
||||
uint32 rangeattacktime;
|
||||
@@ -101,6 +104,9 @@ struct CreatureInfo
|
||||
uint32 trainer_spell;
|
||||
uint32 trainer_class;
|
||||
uint32 trainer_race;
|
||||
float minrangedmg;
|
||||
float maxrangedmg;
|
||||
uint32 rangedattackpower;
|
||||
uint32 type; // enum CreatureType values
|
||||
uint32 type_flags; // enum CreatureTypeFlags mask values
|
||||
uint32 lootid;
|
||||
@@ -123,8 +129,6 @@ struct CreatureInfo
|
||||
float ModHealth;
|
||||
float ModMana;
|
||||
float ModArmor;
|
||||
float ModDmg;
|
||||
float ModRangedDmg;
|
||||
bool RacialLeader;
|
||||
uint32 questItems[6];
|
||||
uint32 movementId;
|
||||
@@ -171,8 +175,6 @@ struct TRINITY_DLL_SPEC CreatureBaseStats
|
||||
uint32 BaseHealth[MAX_CREATURE_BASE_HP];
|
||||
uint32 BaseMana;
|
||||
uint32 BaseArmor;
|
||||
uint32 BaseDmg;
|
||||
uint32 BaseRangedDmg;
|
||||
|
||||
// Helpers
|
||||
|
||||
@@ -195,26 +197,6 @@ struct TRINITY_DLL_SPEC CreatureBaseStats
|
||||
return uint32((BaseArmor * info->ModArmor) + 0.5f);
|
||||
}
|
||||
|
||||
uint32 GenerateMinDmg(CreatureInfo const* info) const
|
||||
{
|
||||
return uint32((BaseDmg * (info->baseattacktime / 1000.0f) / 2.5f) * info->ModDmg + 0.5f);
|
||||
}
|
||||
|
||||
uint32 GenerateMaxDmg(CreatureInfo const* info) const
|
||||
{
|
||||
return uint32((BaseDmg * (info->baseattacktime / 1000) - GenerateMinDmg(info)) * info->ModDmg + 0.5f);
|
||||
}
|
||||
|
||||
uint32 GenerateAttackPower(CreatureInfo const* info) const
|
||||
{
|
||||
return uint32(((GenerateMinDmg(info) + GenerateMaxDmg(info)) / 2.0f * 0.3f) * info->ModDmg + 0.5f);
|
||||
}
|
||||
|
||||
uint32 GenerateRangedDmg(CreatureInfo const* info) const
|
||||
{
|
||||
return uint32((BaseDmg * (info->baseattacktime / 1000.0f) * info->ModRangedDmg) + 0.5f);
|
||||
}
|
||||
|
||||
static CreatureBaseStats const* GetBaseStats(uint32 level, uint8 unitClass);
|
||||
};
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
|
||||
objmgr.LoadTrinityStrings(WorldDatabase,"creature_ai_texts",MIN_CREATURE_AI_TEXT_STRING_ID,MAX_CREATURE_AI_TEXT_STRING_ID);
|
||||
|
||||
// Gather Additional data from EventAI Texts
|
||||
QueryResult *result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM creature_ai_texts");
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM creature_ai_texts");
|
||||
|
||||
sLog.outString("Loading EventAI Texts additional data...");
|
||||
if (result)
|
||||
@@ -95,8 +95,6 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %u additional CreatureEventAI Texts data.", count);
|
||||
}
|
||||
@@ -118,7 +116,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons()
|
||||
m_CreatureEventAI_Summon_Map.clear();
|
||||
|
||||
// Gather additional data for EventAI
|
||||
QueryResult *result = WorldDatabase.Query("SELECT id, position_x, position_y, position_z, orientation, spawntimesecs FROM creature_ai_summons");
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT id, position_x, position_y, position_z, orientation, spawntimesecs FROM creature_ai_summons");
|
||||
if (result)
|
||||
{
|
||||
barGoLink bar(result->GetRowCount());
|
||||
@@ -149,8 +147,6 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons()
|
||||
++Count;
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %u CreatureEventAI summon definitions", Count);
|
||||
}
|
||||
@@ -171,7 +167,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
||||
m_CreatureEventAI_Event_Map.clear();
|
||||
|
||||
// Gather event data
|
||||
QueryResult *result = WorldDatabase.Query("SELECT id, creature_id, event_type, event_inverse_phase_mask, event_chance, event_flags, "
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT id, creature_id, event_type, event_inverse_phase_mask, event_chance, event_flags, "
|
||||
"event_param1, event_param2, event_param3, event_param4, "
|
||||
"action1_type, action1_param1, action1_param2, action1_param3, "
|
||||
"action2_type, action2_param1, action2_param2, action2_param3, "
|
||||
@@ -729,8 +725,6 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
||||
}
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %u CreatureEventAI scripts", Count);
|
||||
}
|
||||
|
||||
@@ -78,14 +78,13 @@ void CreatureGroupManager::LoadCreatureFormations()
|
||||
CreatureGroupMap.clear();
|
||||
|
||||
//Check Integrity of the table
|
||||
QueryResult *result = WorldDatabase.PQuery("SELECT MAX(leaderGUID) FROM creature_formations");
|
||||
QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT MAX(leaderGUID) FROM creature_formations");
|
||||
|
||||
if(!result)
|
||||
{
|
||||
sLog.outErrorDb(" ...an error occured while loading the table creature_formations ( maybe it doesn't exist ?)\n");
|
||||
return;
|
||||
}
|
||||
delete result;
|
||||
|
||||
//Get group data
|
||||
result = WorldDatabase.PQuery("SELECT leaderGUID, memberGUID, dist, angle, groupAI FROM creature_formations ORDER BY leaderGUID");
|
||||
@@ -126,14 +125,13 @@ void CreatureGroupManager::LoadCreatureFormations()
|
||||
|
||||
// check data correctness
|
||||
{
|
||||
QueryResult* result = WorldDatabase.PQuery("SELECT guid FROM creature WHERE guid = %u", group_member->leaderGUID);
|
||||
QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT guid FROM creature WHERE guid = %u", group_member->leaderGUID);
|
||||
if(!result)
|
||||
{
|
||||
sLog.outErrorDb("creature_formations table leader guid %u incorrect (not exist)", group_member->leaderGUID);
|
||||
delete group_member;
|
||||
continue;
|
||||
}
|
||||
delete result;
|
||||
|
||||
result = WorldDatabase.PQuery("SELECT guid FROM creature WHERE guid = %u", memberGUID);
|
||||
if(!result)
|
||||
@@ -142,7 +140,6 @@ void CreatureGroupManager::LoadCreatureFormations()
|
||||
delete group_member;
|
||||
continue;
|
||||
}
|
||||
delete result;
|
||||
}
|
||||
|
||||
CreatureGroupMap[memberGUID] = group_member;
|
||||
@@ -152,8 +149,6 @@ void CreatureGroupManager::LoadCreatureFormations()
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u creatures in formations", total_records );
|
||||
sLog.outString();
|
||||
//Free some heap
|
||||
delete result;
|
||||
}
|
||||
|
||||
void CreatureGroup::AddMember(Creature *member)
|
||||
|
||||
@@ -194,7 +194,7 @@ void GameEventMgr::StopEvent( uint16 event_id, bool overwrite )
|
||||
void GameEventMgr::LoadFromDB()
|
||||
{
|
||||
{
|
||||
QueryResult *result = WorldDatabase.Query("SELECT MAX(entry) FROM game_event");
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT MAX(entry) FROM game_event");
|
||||
if (!result)
|
||||
{
|
||||
sLog.outString(">> Table game_event is empty.");
|
||||
@@ -205,12 +205,11 @@ void GameEventMgr::LoadFromDB()
|
||||
Field *fields = result->Fetch();
|
||||
|
||||
uint32 max_event_id = fields[0].GetUInt16();
|
||||
delete result;
|
||||
|
||||
mGameEvent.resize(max_event_id+1);
|
||||
}
|
||||
|
||||
QueryResult *result = WorldDatabase.Query("SELECT entry,UNIX_TIMESTAMP(start_time),UNIX_TIMESTAMP(end_time),occurence,length,holiday,description,world_event FROM game_event");
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry,UNIX_TIMESTAMP(start_time),UNIX_TIMESTAMP(end_time),occurence,length,holiday,description,world_event FROM game_event");
|
||||
if (!result)
|
||||
{
|
||||
mGameEvent.clear();
|
||||
@@ -267,7 +266,6 @@ void GameEventMgr::LoadFromDB()
|
||||
pGameEvent.description = fields[6].GetCppString();
|
||||
|
||||
} while( result->NextRow() );
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u game events", count );
|
||||
@@ -323,7 +321,6 @@ void GameEventMgr::LoadFromDB()
|
||||
} while( result->NextRow() );
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u game event saves in game events", count );
|
||||
delete result;
|
||||
}
|
||||
|
||||
// load game event links (prerequisites)
|
||||
@@ -378,7 +375,6 @@ void GameEventMgr::LoadFromDB()
|
||||
} while (result->NextRow());
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u game event prerequisites in game events", count );
|
||||
delete result;
|
||||
}
|
||||
|
||||
// Creatures
|
||||
@@ -425,7 +421,6 @@ void GameEventMgr::LoadFromDB()
|
||||
crelist.push_back(guid);
|
||||
|
||||
} while( result->NextRow() );
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u creatures in game events", count );
|
||||
@@ -475,7 +470,6 @@ void GameEventMgr::LoadFromDB()
|
||||
golist.push_back(guid);
|
||||
|
||||
} while( result->NextRow() );
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u gameobjects in game events", count );
|
||||
@@ -539,7 +533,6 @@ void GameEventMgr::LoadFromDB()
|
||||
equiplist.push_back(std::pair<uint32, ModelEquip>(guid, newModelEquipSet));
|
||||
|
||||
} while( result->NextRow() );
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u model/equipment changes in game events", count );
|
||||
@@ -588,8 +581,6 @@ void GameEventMgr::LoadFromDB()
|
||||
} while( result->NextRow() );
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u quests additions in game events", count );
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
// GO Quests
|
||||
@@ -633,7 +624,6 @@ void GameEventMgr::LoadFromDB()
|
||||
questlist.push_back(QuestRelation(id, quest));
|
||||
|
||||
} while( result->NextRow() );
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u quests additions in game events", count );
|
||||
@@ -682,8 +672,6 @@ void GameEventMgr::LoadFromDB()
|
||||
} while( result->NextRow() );
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u quest event conditions in game events", count );
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
// load conditions of the events
|
||||
@@ -730,8 +718,6 @@ void GameEventMgr::LoadFromDB()
|
||||
} while( result->NextRow() );
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u conditions in game events", count );
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
// load condition saves
|
||||
@@ -784,8 +770,6 @@ void GameEventMgr::LoadFromDB()
|
||||
} while( result->NextRow() );
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u condition saves in game events", count );
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
mGameEventNPCFlags.resize(mGameEvent.size());
|
||||
@@ -831,8 +815,6 @@ void GameEventMgr::LoadFromDB()
|
||||
} while( result->NextRow() );
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u npcflags in game events", count );
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
// Vendor
|
||||
@@ -902,8 +884,6 @@ void GameEventMgr::LoadFromDB()
|
||||
} while( result->NextRow() );
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u vendor additions in game events", count );
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
// load game event npc gossip ids
|
||||
@@ -948,8 +928,6 @@ void GameEventMgr::LoadFromDB()
|
||||
} while( result->NextRow() );
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u npc gossip textids in game events", count );
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
// set all flags to 0
|
||||
@@ -995,8 +973,6 @@ void GameEventMgr::LoadFromDB()
|
||||
} while( result->NextRow() );
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u battleground holidays in game events", count );
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
////////////////////////
|
||||
@@ -1054,7 +1030,6 @@ void GameEventMgr::LoadFromDB()
|
||||
} while( result->NextRow() );
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u pools in game events", count );
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ GameObject::~GameObject()
|
||||
// CleanupsBeforeDelete();
|
||||
}
|
||||
|
||||
void GameObject::CleanupsBeforeDelete()
|
||||
void GameObject::CleanupsBeforeDelete(bool finalCleanup)
|
||||
{
|
||||
if(m_uint32Values) // field array can be not exist if GameOBject not loaded
|
||||
{
|
||||
|
||||
@@ -589,7 +589,7 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject, public GridObject<GameOb
|
||||
|
||||
void AddToWorld();
|
||||
void RemoveFromWorld();
|
||||
void CleanupsBeforeDelete();
|
||||
void CleanupsBeforeDelete(bool finalCleanup = true);
|
||||
|
||||
bool Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state, uint32 artKit = 0);
|
||||
void Update(uint32 p_time);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "ObjectDefines.h"
|
||||
#include "Corpse.h"
|
||||
|
||||
static void CorpsesEraseCallBack(QueryResult *result, bool bones)
|
||||
static void CorpsesEraseCallBack(QueryResult_AutoPtr result, bool bones)
|
||||
{
|
||||
if(!result)
|
||||
return;
|
||||
@@ -68,8 +68,6 @@ static void CorpsesEraseCallBack(QueryResult *result, bool bones)
|
||||
CharacterDatabase.PExecute("DELETE FROM corpse WHERE guid = '%u'",guidlow);
|
||||
}
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
/// Handle periodic erase of corpses and bones
|
||||
|
||||
+1
-6
@@ -125,7 +125,7 @@ bool Group::Create(const uint64 &guid, const char * name)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult *result, bool loadMembers)
|
||||
bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult_AutoPtr result, bool loadMembers)
|
||||
{
|
||||
if(isBGGroup())
|
||||
return false;
|
||||
@@ -144,10 +144,7 @@ bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult *result, bool
|
||||
|
||||
// group leader not exist
|
||||
if(!objmgr.GetPlayerNameByGUID(m_leaderGuid, m_leaderName))
|
||||
{
|
||||
if(!external) delete result;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_groupType = (*result)[13].GetBool() ? GROUPTYPE_RAID : GROUPTYPE_NORMAL;
|
||||
|
||||
@@ -172,7 +169,6 @@ bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult *result, bool
|
||||
|
||||
for (int i=0; i<TARGETICONCOUNT; ++i)
|
||||
m_targetIcons[i] = (*result)[5+i].GetUInt64();
|
||||
if(!external) delete result;
|
||||
|
||||
if(loadMembers)
|
||||
{
|
||||
@@ -184,7 +180,6 @@ bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult *result, bool
|
||||
{
|
||||
LoadMemberFromDB((*result)[0].GetUInt32(), (*result)[2].GetUInt8(), (*result)[1].GetBool());
|
||||
} while( result->NextRow() );
|
||||
delete result;
|
||||
// group too small
|
||||
if(GetMembersCount() < 2)
|
||||
return false;
|
||||
|
||||
+1
-1
@@ -166,7 +166,7 @@ class TRINITY_DLL_SPEC Group
|
||||
|
||||
// group manipulation methods
|
||||
bool Create(const uint64 &guid, const char * name);
|
||||
bool LoadGroupFromDB(const uint64 &leaderGuid, QueryResult *result = NULL, bool loadMembers = true);
|
||||
bool LoadGroupFromDB(const uint64 &leaderGuid, QueryResult_AutoPtr result = QueryResult_AutoPtr(NULL), bool loadMembers = true);
|
||||
bool LoadMemberFromDB(uint32 guidLow, uint8 subgroup, bool assistant);
|
||||
bool AddInvite(Player *player);
|
||||
uint32 RemoveInvite(Player *player);
|
||||
|
||||
+10
-23
@@ -147,7 +147,7 @@ bool Guild::AddMember(uint64 plGuid, uint32 plRank)
|
||||
}
|
||||
else
|
||||
{
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT name,zone,level,class FROM characters WHERE guid = '%u'", GUID_LOPART(plGuid));
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT name,zone,level,class FROM characters WHERE guid = '%u'", GUID_LOPART(plGuid));
|
||||
if (!result)
|
||||
return false; // player doesn't exist
|
||||
|
||||
@@ -156,7 +156,7 @@ bool Guild::AddMember(uint64 plGuid, uint32 plRank)
|
||||
newmember.ZoneId = fields[1].GetUInt32();
|
||||
newmember.Level = fields[2].GetUInt8();
|
||||
newmember.Class = fields[3].GetUInt8();
|
||||
delete result;
|
||||
|
||||
if (newmember.Level < 1 || newmember.Level > STRONG_MAX_LEVEL ||
|
||||
newmember.Class < CLASS_WARRIOR || newmember.Class >= MAX_CLASSES)
|
||||
{
|
||||
@@ -215,14 +215,13 @@ bool Guild::LoadGuildFromDB(uint32 GuildId)
|
||||
//set m_Id in case guild data are broken in DB and Guild will be Disbanded (deleted from DB)
|
||||
m_Id = GuildId;
|
||||
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT COUNT(TabId) FROM guild_bank_tab WHERE guildid='%u'", GuildId);
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT COUNT(TabId) FROM guild_bank_tab WHERE guildid='%u'", GuildId);
|
||||
if (result)
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
m_PurchasedTabs = fields[0].GetUInt32();
|
||||
if (m_PurchasedTabs > GUILD_BANK_MAX_TABS)
|
||||
m_PurchasedTabs = GUILD_BANK_MAX_TABS;
|
||||
delete result;
|
||||
}
|
||||
|
||||
if (!LoadRanksFromDB(GuildId))
|
||||
@@ -256,8 +255,6 @@ bool Guild::LoadGuildFromDB(uint32 GuildId)
|
||||
time_t time = fields[9].GetUInt64();
|
||||
m_GuildBankMoney = fields[10].GetUInt64();
|
||||
|
||||
delete result;
|
||||
|
||||
if (time > 0)
|
||||
{
|
||||
tm local = *(localtime(&time)); // dereference and assign
|
||||
@@ -295,7 +292,7 @@ bool Guild::LoadRanksFromDB(uint32 GuildId)
|
||||
{
|
||||
Field *fields;
|
||||
// 0 1 2 3
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT rid,rname,rights,BankMoneyPerDay FROM guild_rank WHERE guildid = '%u' ORDER BY rid ASC", GuildId);
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT rid,rname,rights,BankMoneyPerDay FROM guild_rank WHERE guildid = '%u' ORDER BY rid ASC", GuildId);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@@ -329,7 +326,6 @@ bool Guild::LoadRanksFromDB(uint32 GuildId)
|
||||
|
||||
AddRank(rankName,rankRights,rankMoney);
|
||||
}while (result->NextRow());
|
||||
delete result;
|
||||
|
||||
if (m_Ranks.size() < GUILD_RANKS_MIN_COUNT) // if too few ranks, renew them
|
||||
{
|
||||
@@ -360,7 +356,7 @@ bool Guild::LoadRanksFromDB(uint32 GuildId)
|
||||
bool Guild::LoadMembersFromDB(uint32 GuildId)
|
||||
{
|
||||
// 0 1 2 3 4 5
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT guild_member.guid,rank, pnote, offnote, BankResetTimeMoney,BankRemMoney,"
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT guild_member.guid,rank, pnote, offnote, BankResetTimeMoney,BankRemMoney,"
|
||||
// 6 7 8 9 10 11
|
||||
"BankResetTimeTab0, BankRemSlotsTab0, BankResetTimeTab1, BankRemSlotsTab1, BankResetTimeTab2, BankRemSlotsTab2,"
|
||||
// 12 13 14 15 16 17
|
||||
@@ -422,7 +418,6 @@ bool Guild::LoadMembersFromDB(uint32 GuildId)
|
||||
members[GUID_LOPART(guid)] = newmember;
|
||||
|
||||
}while (result->NextRow());
|
||||
delete result;
|
||||
|
||||
if (members.empty())
|
||||
return false;
|
||||
@@ -879,7 +874,7 @@ void Guild::LoadGuildEventLogFromDB()
|
||||
return;
|
||||
|
||||
// 0 1 2 3 4 5
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT LogGuid, EventType, PlayerGuid1, PlayerGuid2, NewRank, TimeStamp FROM guild_eventlog WHERE guildid=%u ORDER BY TimeStamp DESC,LogGuid DESC LIMIT %u", m_Id, GUILD_EVENTLOG_MAX_RECORDS);
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT LogGuid, EventType, PlayerGuid1, PlayerGuid2, NewRank, TimeStamp FROM guild_eventlog WHERE guildid=%u ORDER BY TimeStamp DESC,LogGuid DESC LIMIT %u", m_Id, GUILD_EVENTLOG_MAX_RECORDS);
|
||||
if (!result)
|
||||
return;
|
||||
bool isNextLogGuidSet = false;
|
||||
@@ -909,7 +904,6 @@ void Guild::LoadGuildEventLogFromDB()
|
||||
m_GuildEventLog.push_front(NewEvent);
|
||||
|
||||
} while (result->NextRow());
|
||||
delete result;
|
||||
|
||||
m_EventLogLoaded = true;
|
||||
}
|
||||
@@ -1161,7 +1155,7 @@ void Guild::LoadGuildBankFromDB()
|
||||
LoadGuildBankEventLogFromDB();
|
||||
|
||||
// 0 1 2 3
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT TabId, TabName, TabIcon, TabText FROM guild_bank_tab WHERE guildid='%u' ORDER BY TabId", m_Id);
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT TabId, TabName, TabIcon, TabText FROM guild_bank_tab WHERE guildid='%u' ORDER BY TabId", m_Id);
|
||||
if (!result)
|
||||
{
|
||||
m_PurchasedTabs = 0;
|
||||
@@ -1184,8 +1178,6 @@ void Guild::LoadGuildBankFromDB()
|
||||
m_TabListMap[TabId] = NewTab;
|
||||
}while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
// data needs to be at first place for Item::LoadFromDB
|
||||
// 0 1 2 3 4
|
||||
result = CharacterDatabase.PQuery("SELECT data, TabId, SlotId, item_guid, item_entry FROM guild_bank_item JOIN item_instance ON item_guid = guid WHERE guildid='%u' ORDER BY TabId", m_Id);
|
||||
@@ -1232,8 +1224,6 @@ void Guild::LoadGuildBankFromDB()
|
||||
pItem->AddToWorld();
|
||||
m_TabListMap[TabId]->Slots[SlotId] = pItem;
|
||||
}while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
// This unload should be called when the last member of the guild gets offline
|
||||
@@ -1452,7 +1442,7 @@ uint32 Guild::GetBankSlotPerDay(uint32 rankId, uint8 TabId)
|
||||
void Guild::LoadBankRightsFromDB(uint32 GuildId)
|
||||
{
|
||||
// 0 1 2 3
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT TabId, rid, gbright, SlotPerDay FROM guild_bank_right WHERE guildid = '%u' ORDER BY TabId", GuildId);
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT TabId, rid, gbright, SlotPerDay FROM guild_bank_right WHERE guildid = '%u' ORDER BY TabId", GuildId);
|
||||
|
||||
if (!result)
|
||||
return;
|
||||
@@ -1468,7 +1458,6 @@ void Guild::LoadBankRightsFromDB(uint32 GuildId)
|
||||
SetBankRightsAndSlots(rankId, TabId, right, SlotPerDay, false);
|
||||
|
||||
}while (result->NextRow());
|
||||
delete result;
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1485,7 +1474,7 @@ void Guild::LoadGuildBankEventLogFromDB()
|
||||
for (uint32 tabId = 0; tabId < m_PurchasedTabs; tabId++)
|
||||
{
|
||||
// 0 1 2 3 4 5 6
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT LogGuid, EventType, PlayerGuid, ItemOrMoney, ItemStackCount, DestTabId, TimeStamp FROM guild_bank_eventlog WHERE guildid='%u' AND TabId='%u' ORDER BY TimeStamp DESC,LogGuid DESC LIMIT %u", m_Id, tabId, GUILD_BANK_MAX_LOGS);
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT LogGuid, EventType, PlayerGuid, ItemOrMoney, ItemStackCount, DestTabId, TimeStamp FROM guild_bank_eventlog WHERE guildid='%u' AND TabId='%u' ORDER BY TimeStamp DESC,LogGuid DESC LIMIT %u", m_Id, tabId, GUILD_BANK_MAX_LOGS);
|
||||
if (!result)
|
||||
continue;
|
||||
|
||||
@@ -1522,12 +1511,11 @@ void Guild::LoadGuildBankEventLogFromDB()
|
||||
isNextLogGuidSet = true;
|
||||
}
|
||||
} while (result->NextRow());
|
||||
delete result;
|
||||
}
|
||||
|
||||
//special handle for guild bank money log
|
||||
// 0 1 2 3 4 5 6
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT LogGuid, EventType, PlayerGuid, ItemOrMoney, ItemStackCount, DestTabId, TimeStamp FROM guild_bank_eventlog WHERE guildid='%u' AND TabId='%u' ORDER BY TimeStamp DESC,LogGuid DESC LIMIT %u", m_Id, GUILD_BANK_MONEY_LOGS_TAB, GUILD_BANK_MAX_LOGS);
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT LogGuid, EventType, PlayerGuid, ItemOrMoney, ItemStackCount, DestTabId, TimeStamp FROM guild_bank_eventlog WHERE guildid='%u' AND TabId='%u' ORDER BY TimeStamp DESC,LogGuid DESC LIMIT %u", m_Id, GUILD_BANK_MONEY_LOGS_TAB, GUILD_BANK_MAX_LOGS);
|
||||
if (!result)
|
||||
return;
|
||||
|
||||
@@ -1559,7 +1547,6 @@ void Guild::LoadGuildBankEventLogFromDB()
|
||||
m_GuildBankEventLog_Money.push_front(NewEvent);
|
||||
|
||||
} while (result->NextRow());
|
||||
delete result;
|
||||
}
|
||||
|
||||
void Guild::UnloadGuildBankEventLog()
|
||||
|
||||
@@ -238,7 +238,7 @@ void InstanceSaveManager::_DelHelper(DatabaseType &db, const char *fields, const
|
||||
int res = vsnprintf( szQueryTail, MAX_QUERY_LEN, queryTail, ap );
|
||||
va_end(ap);
|
||||
|
||||
QueryResult *result = db.PQuery("SELECT %s FROM %s %s", fields, table, szQueryTail);
|
||||
QueryResult_AutoPtr result = db.PQuery("SELECT %s FROM %s %s", fields, table, szQueryTail);
|
||||
if(result)
|
||||
{
|
||||
do
|
||||
@@ -253,7 +253,6 @@ void InstanceSaveManager::_DelHelper(DatabaseType &db, const char *fields, const
|
||||
}
|
||||
db.DirectPExecute("DELETE FROM %s WHERE %s", table, ss.str().c_str());
|
||||
} while (result->NextRow());
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,7 +280,7 @@ void InstanceSaveManager::CleanupInstances()
|
||||
// creature_respawn and gameobject_respawn are in another database
|
||||
// first, obtain total instance set
|
||||
std::set<uint32> InstanceSet;
|
||||
QueryResult *result = CharacterDatabase.Query("SELECT id FROM instance");
|
||||
QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT id FROM instance");
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
@@ -290,7 +289,6 @@ void InstanceSaveManager::CleanupInstances()
|
||||
InstanceSet.insert(fields[0].GetUInt32());
|
||||
}
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
}
|
||||
|
||||
// creature_respawn
|
||||
@@ -304,7 +302,6 @@ void InstanceSaveManager::CleanupInstances()
|
||||
WorldDatabase.DirectPExecute("DELETE FROM creature_respawn WHERE instance = '%u'", fields[0].GetUInt32());
|
||||
}
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
}
|
||||
|
||||
// gameobject_respawn
|
||||
@@ -318,7 +315,6 @@ void InstanceSaveManager::CleanupInstances()
|
||||
WorldDatabase.DirectPExecute("DELETE FROM gameobject_respawn WHERE instance = '%u'", fields[0].GetUInt32());
|
||||
}
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
}
|
||||
|
||||
// characters
|
||||
@@ -332,7 +328,6 @@ void InstanceSaveManager::CleanupInstances()
|
||||
CharacterDatabase.PExecute("UPDATE characters SET instance_id = '0' WHERE instance_id = '%u'", fields[0].GetUInt32());
|
||||
}
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
}
|
||||
|
||||
// corpse
|
||||
@@ -346,7 +341,6 @@ void InstanceSaveManager::CleanupInstances()
|
||||
CharacterDatabase.PExecute("UPDATE corpse SET instance = '0' WHERE instance = '%u'", fields[0].GetUInt32());
|
||||
}
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
}
|
||||
|
||||
bar.step();
|
||||
@@ -365,7 +359,7 @@ void InstanceSaveManager::PackInstances()
|
||||
// all valid ids are in the instance table
|
||||
// any associations to ids not in this table are assumed to be
|
||||
// cleaned already in CleanupInstances
|
||||
QueryResult *result = CharacterDatabase.Query("SELECT id FROM instance");
|
||||
QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT id FROM instance");
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
@@ -374,7 +368,6 @@ void InstanceSaveManager::PackInstances()
|
||||
InstanceSet.insert(fields[0].GetUInt32());
|
||||
}
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
}
|
||||
|
||||
barGoLink bar(InstanceSet.size() + 1);
|
||||
@@ -422,7 +415,7 @@ void InstanceSaveManager::LoadResetTimes()
|
||||
typedef std::multimap<uint32 /*PAIR32(map,difficulty)*/, uint32 /*instanceid*/ > ResetTimeMapDiffInstances;
|
||||
ResetTimeMapDiffInstances mapDiffResetInstances;
|
||||
|
||||
QueryResult *result = CharacterDatabase.Query("SELECT id, map, difficulty, resettime FROM instance WHERE resettime > 0");
|
||||
QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT id, map, difficulty, resettime FROM instance WHERE resettime > 0");
|
||||
if( result )
|
||||
{
|
||||
do
|
||||
@@ -437,7 +430,6 @@ void InstanceSaveManager::LoadResetTimes()
|
||||
}
|
||||
}
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
|
||||
// update reset time for normal instances with the max creature respawn time + X hours
|
||||
result = WorldDatabase.Query("SELECT MAX(respawntime), instance FROM creature_respawn WHERE instance > 0 GROUP BY instance");
|
||||
@@ -456,7 +448,6 @@ void InstanceSaveManager::LoadResetTimes()
|
||||
}
|
||||
}
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
}
|
||||
|
||||
// schedule the reset times
|
||||
@@ -492,7 +483,6 @@ void InstanceSaveManager::LoadResetTimes()
|
||||
|
||||
SetResetTimeFor(mapid,difficulty,newresettime);
|
||||
} while(result->NextRow());
|
||||
delete result;
|
||||
}
|
||||
|
||||
// clean expired instances, references to them will be deleted in CleanupInstances
|
||||
|
||||
+1
-8
@@ -339,18 +339,14 @@ void Item::SaveToDB()
|
||||
SetState(ITEM_UNCHANGED);
|
||||
}
|
||||
|
||||
bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult *result)
|
||||
bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult_AutoPtr result)
|
||||
{
|
||||
// create item before any checks for store correct guid
|
||||
// and allow use "FSetState(ITEM_REMOVED); SaveToDB();" for deleting item from DB
|
||||
Object::_Create(guid, 0, HIGHGUID_ITEM);
|
||||
|
||||
bool delete_result = false;
|
||||
if(!result)
|
||||
{
|
||||
result = CharacterDatabase.PQuery("SELECT data FROM item_instance WHERE guid = '%u'", guid);
|
||||
delete_result = true;
|
||||
}
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@@ -363,7 +359,6 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult *result)
|
||||
if(!LoadValues(fields[0].GetString()))
|
||||
{
|
||||
sLog.outError("Item #%d have broken data in `data` field. Can't be loaded.",guid);
|
||||
if (delete_result) delete result;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -377,8 +372,6 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult *result)
|
||||
need_save = true;
|
||||
}
|
||||
|
||||
if (delete_result) delete result;
|
||||
|
||||
ItemPrototype const* proto = GetProto();
|
||||
if(!proto)
|
||||
return false;
|
||||
|
||||
+1
-1
@@ -240,7 +240,7 @@ class TRINITY_DLL_SPEC Item : public Object
|
||||
bool IsBindedNotWith(Player const* player) const;
|
||||
bool IsBoundByEnchant() const;
|
||||
virtual void SaveToDB();
|
||||
virtual bool LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult *result = NULL);
|
||||
virtual bool LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult_AutoPtr result = QueryResult_AutoPtr(NULL));
|
||||
virtual void DeleteFromDB();
|
||||
void DeleteFromInventoryDB();
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ void LoadRandomEnchantmentsTable()
|
||||
float chance;
|
||||
uint32 count = 0;
|
||||
|
||||
QueryResult *result = WorldDatabase.Query("SELECT entry, ench, chance FROM item_enchantment_template");
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, ench, chance FROM item_enchantment_template");
|
||||
|
||||
if (result)
|
||||
{
|
||||
@@ -76,8 +76,6 @@ void LoadRandomEnchantmentsTable()
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u Item Enchantment definitions", count );
|
||||
}
|
||||
|
||||
+25
-75
@@ -336,7 +336,7 @@ bool ChatHandler::HandleGoCreatureCommand(const char* args)
|
||||
}
|
||||
//sLog.outError("DEBUG: %s", whereClause.c_str());
|
||||
|
||||
QueryResult *result = WorldDatabase.PQuery("SELECT position_x,position_y,position_z,orientation,map FROM creature %s", whereClause.str().c_str() );
|
||||
QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT position_x,position_y,position_z,orientation,map FROM creature %s", whereClause.str().c_str() );
|
||||
if (!result)
|
||||
{
|
||||
SendSysMessage(LANG_COMMAND_GOCREATNOTFOUND);
|
||||
@@ -353,8 +353,6 @@ bool ChatHandler::HandleGoCreatureCommand(const char* args)
|
||||
float ort = fields[3].GetFloat();
|
||||
int mapid = fields[4].GetUInt16();
|
||||
|
||||
delete result;
|
||||
|
||||
if(!MapManager::IsValidMapCoord(mapid,x,y,z,ort))
|
||||
{
|
||||
PSendSysMessage(LANG_INVALID_TARGET_COORD,x,y,mapid);
|
||||
@@ -436,7 +434,7 @@ bool ChatHandler::HandleGoObjectCommand(const char* args)
|
||||
bool ChatHandler::HandleGameObjectTargetCommand(const char* args)
|
||||
{
|
||||
Player* pl = m_session->GetPlayer();
|
||||
QueryResult *result;
|
||||
QueryResult_AutoPtr result;
|
||||
GameEventMgr::ActiveEvents const& activeEventsList = gameeventmgr.GetActiveEventList();
|
||||
if(*args)
|
||||
{
|
||||
@@ -515,8 +513,6 @@ bool ChatHandler::HandleGameObjectTargetCommand(const char* args)
|
||||
found = true;
|
||||
} while( result->NextRow() && (!found) );
|
||||
|
||||
delete result;
|
||||
|
||||
if (!found)
|
||||
{
|
||||
PSendSysMessage(LANG_GAMEOBJECT_NOT_EXIST,id);
|
||||
@@ -837,7 +833,7 @@ bool ChatHandler::HandleGameObjectNearCommand(const char* args)
|
||||
uint32 count = 0;
|
||||
|
||||
Player* pl = m_session->GetPlayer();
|
||||
QueryResult *result = WorldDatabase.PQuery("SELECT guid, id, position_x, position_y, position_z, map, "
|
||||
QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT guid, id, position_x, position_y, position_z, map, "
|
||||
"(POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ "
|
||||
"FROM gameobject WHERE map='%u' AND (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) <= '%f' ORDER BY order_",
|
||||
pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(),
|
||||
@@ -864,8 +860,6 @@ bool ChatHandler::HandleGameObjectNearCommand(const char* args)
|
||||
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
PSendSysMessage(LANG_COMMAND_NEAROBJMESSAGE,distance,count);
|
||||
@@ -2170,7 +2164,7 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
|
||||
return false;
|
||||
|
||||
// 0 1 2 3 4 5
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT totaltime, level, money, account, race, class FROM characters WHERE guid = '%u'", GUID_LOPART(target_guid));
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT totaltime, level, money, account, race, class FROM characters WHERE guid = '%u'", GUID_LOPART(target_guid));
|
||||
if (!result)
|
||||
return false;
|
||||
|
||||
@@ -2181,7 +2175,6 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
|
||||
accId = fields[3].GetUInt32();
|
||||
race = fields[4].GetUInt8();
|
||||
Class = fields[5].GetUInt8();
|
||||
delete result;
|
||||
}
|
||||
|
||||
std::string username = GetTrinityString(LANG_ERROR);
|
||||
@@ -2190,7 +2183,7 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
|
||||
uint32 security = 0;
|
||||
std::string last_login = GetTrinityString(LANG_ERROR);
|
||||
|
||||
QueryResult* result = loginDatabase.PQuery("SELECT a.username,aa.gmlevel,a.email,a.last_ip,a.last_login "
|
||||
QueryResult_AutoPtr result = loginDatabase.PQuery("SELECT a.username,aa.gmlevel,a.email,a.last_ip,a.last_login "
|
||||
"FROM account a "
|
||||
"LEFT JOIN account_access aa "
|
||||
"ON (a.id = aa.id) "
|
||||
@@ -2215,8 +2208,6 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
|
||||
last_ip = "-";
|
||||
last_login = "-";
|
||||
}
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
std::string nameLink = playerLink(target_name);
|
||||
@@ -2303,7 +2294,7 @@ bool ChatHandler::HandleWpAddCommand(const char* args)
|
||||
pathid = target->GetWaypointPath();
|
||||
else
|
||||
{
|
||||
QueryResult *result = WorldDatabase.PQuery( "SELECT MAX(id) FROM waypoint_data");
|
||||
QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT MAX(id) FROM waypoint_data");
|
||||
uint32 maxpathid = result->Fetch()->GetInt32();
|
||||
pathid = maxpathid+1;
|
||||
sLog.outDebug("DEBUG: HandleWpAddCommand - New path started.");
|
||||
@@ -2325,13 +2316,10 @@ bool ChatHandler::HandleWpAddCommand(const char* args)
|
||||
|
||||
sLog.outDebug("DEBUG: HandleWpAddCommand - point == 0");
|
||||
|
||||
QueryResult *result = WorldDatabase.PQuery( "SELECT MAX(point) FROM waypoint_data WHERE id = '%u'",pathid);
|
||||
QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT MAX(point) FROM waypoint_data WHERE id = '%u'",pathid);
|
||||
|
||||
if( result )
|
||||
{
|
||||
point = (*result)[0].GetUInt32();
|
||||
delete result;
|
||||
}
|
||||
|
||||
Player* player = m_session->GetPlayer();
|
||||
Map *map = player->GetMap();
|
||||
@@ -2385,13 +2373,10 @@ bool ChatHandler::HandleWpLoadPathCommand(const char *args)
|
||||
}
|
||||
|
||||
guidlow = target->GetDBTableGUIDLow();
|
||||
QueryResult *result = WorldDatabase.PQuery( "SELECT guid FROM creature_addon WHERE guid = '%u'",guidlow);
|
||||
QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT guid FROM creature_addon WHERE guid = '%u'",guidlow);
|
||||
|
||||
if( result )
|
||||
{
|
||||
WorldDatabase.PExecute("UPDATE creature_addon SET path_id = '%u' WHERE guid = '%u'", pathid, guidlow);
|
||||
delete result;
|
||||
}
|
||||
else
|
||||
WorldDatabase.PExecute("INSERT INTO creature_addon(guid,path_id) VALUES ('%u','%u')", guidlow, pathid);
|
||||
|
||||
@@ -2471,7 +2456,7 @@ bool ChatHandler::HandleWpEventCommand(const char* args)
|
||||
|
||||
if(id)
|
||||
{
|
||||
QueryResult *result = WorldDatabase.PQuery( "SELECT id FROM waypoint_scripts WHERE guid = %u", id);
|
||||
QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT id FROM waypoint_scripts WHERE guid = %u", id);
|
||||
|
||||
if( !result )
|
||||
{
|
||||
@@ -2479,14 +2464,11 @@ bool ChatHandler::HandleWpEventCommand(const char* args)
|
||||
PSendSysMessage("%s%s%u|r", "|cff00ff00", "Wp Event: New waypoint event added: ", id);
|
||||
}
|
||||
else
|
||||
{
|
||||
PSendSysMessage("|cff00ff00Wp Event: You have choosed an existing waypoint script guid: %u|r", id);
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QueryResult *result = WorldDatabase.PQuery( "SELECT MAX(guid) FROM waypoint_scripts");
|
||||
QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT MAX(guid) FROM waypoint_scripts");
|
||||
id = result->Fetch()->GetUInt32();
|
||||
WorldDatabase.PExecute("INSERT INTO waypoint_scripts(guid)VALUES(%u)", id+1);
|
||||
PSendSysMessage("%s%s%u|r", "|cff00ff00","Wp Event: New waypoint event added: |r|cff00ffff", id+1);
|
||||
@@ -2509,7 +2491,7 @@ bool ChatHandler::HandleWpEventCommand(const char* args)
|
||||
float a8, a9, a10, a11;
|
||||
char const* a7;
|
||||
|
||||
QueryResult *result = WorldDatabase.PQuery( "SELECT guid, delay, command, datalong, datalong2, dataint, x, y, z, o FROM waypoint_scripts WHERE id = %u", id);
|
||||
QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT guid, delay, command, datalong, datalong2, dataint, x, y, z, o FROM waypoint_scripts WHERE id = %u", id);
|
||||
|
||||
if( !result )
|
||||
{
|
||||
@@ -2536,21 +2518,18 @@ bool ChatHandler::HandleWpEventCommand(const char* args)
|
||||
PSendSysMessage("|cffff33ffid:|r|cff00ffff %u|r|cff00ff00, guid: |r|cff00ffff%u|r|cff00ff00, delay: |r|cff00ffff%u|r|cff00ff00, command: |r|cff00ffff%u|r|cff00ff00, datalong: |r|cff00ffff%u|r|cff00ff00, datalong2: |r|cff00ffff%u|r|cff00ff00, datatext: |r|cff00ffff%s|r|cff00ff00, posx: |r|cff00ffff%f|r|cff00ff00, posy: |r|cff00ffff%f|r|cff00ff00, posz: |r|cff00ffff%f|r|cff00ff00, orientation: |r|cff00ffff%f|r", id, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
|
||||
}
|
||||
while(result->NextRow());
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
if(show == "del")
|
||||
{
|
||||
id = atoi(arg_id);
|
||||
|
||||
QueryResult *result = WorldDatabase.PQuery( "SELECT guid FROM waypoint_scripts WHERE guid = %u", id);
|
||||
QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT guid FROM waypoint_scripts WHERE guid = %u", id);
|
||||
|
||||
if( result )
|
||||
{
|
||||
WorldDatabase.PExecuteLog("DELETE FROM waypoint_scripts WHERE guid = %u", id);
|
||||
PSendSysMessage("%s%s%u|r","|cff00ff00","Wp Event: Waypoint script removed: ", id);
|
||||
delete result;
|
||||
}
|
||||
else
|
||||
PSendSysMessage("|cffff33ffWp Event: ERROR: you have selected a non existing script: %u|r", id);
|
||||
@@ -2613,7 +2592,7 @@ bool ChatHandler::HandleWpEventCommand(const char* args)
|
||||
}
|
||||
else
|
||||
{
|
||||
QueryResult *result = WorldDatabase.PQuery("SELECT id FROM waypoint_scripts WHERE guid='%u'",id);
|
||||
QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT id FROM waypoint_scripts WHERE guid='%u'",id);
|
||||
|
||||
if(!result)
|
||||
{
|
||||
@@ -2621,8 +2600,6 @@ bool ChatHandler::HandleWpEventCommand(const char* args)
|
||||
return true;
|
||||
}
|
||||
|
||||
delete result;
|
||||
|
||||
if(arg_str_2 == "posx")
|
||||
{
|
||||
coord = atof(arg_3);
|
||||
@@ -2734,8 +2711,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args)
|
||||
// Check the creature
|
||||
if (wpCreature->GetEntry() == VISUAL_WAYPOINT )
|
||||
{
|
||||
QueryResult *result =
|
||||
WorldDatabase.PQuery( "SELECT id, point FROM waypoint_data WHERE wpguid = %u", wpGuid);
|
||||
QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT id, point FROM waypoint_data WHERE wpguid = %u", wpGuid);
|
||||
|
||||
if(!result)
|
||||
{
|
||||
@@ -2767,9 +2743,6 @@ bool ChatHandler::HandleWpModifyCommand(const char* args)
|
||||
}
|
||||
while( result->NextRow() );
|
||||
|
||||
// Cleanup memory
|
||||
sLog.outDebug("DEBUG: HandleWpModifyCommand - Cleanup memory");
|
||||
delete result;
|
||||
// We have the waypoint number and the GUID of the "master npc"
|
||||
// Text is enclosed in "<>", all other arguments not
|
||||
arg_str = strtok((char*)NULL, " ");
|
||||
@@ -2939,7 +2912,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
|
||||
return false;
|
||||
}
|
||||
|
||||
QueryResult *result = WorldDatabase.PQuery( "SELECT id, point, delay, move_flag, action, action_chance FROM waypoint_data WHERE wpguid = %u", target->GetGUIDLow());
|
||||
QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT id, point, delay, move_flag, action, action_chance FROM waypoint_data WHERE wpguid = %u", target->GetGUIDLow());
|
||||
|
||||
if(!result)
|
||||
{
|
||||
@@ -2966,14 +2939,12 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
|
||||
}
|
||||
while( result->NextRow() );
|
||||
|
||||
// Cleanup memory
|
||||
delete result;
|
||||
return true;
|
||||
}
|
||||
|
||||
if(show == "on")
|
||||
{
|
||||
QueryResult *result = WorldDatabase.PQuery( "SELECT point, position_x,position_y,position_z FROM waypoint_data WHERE id = '%u'", pathid);
|
||||
QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT point, position_x,position_y,position_z FROM waypoint_data WHERE id = '%u'", pathid);
|
||||
|
||||
if(!result)
|
||||
{
|
||||
@@ -2985,7 +2956,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
|
||||
PSendSysMessage("|cff00ff00DEBUG: wp on, PathID: |cff00ffff%u|r", pathid);
|
||||
|
||||
// Delete all visuals for this NPC
|
||||
QueryResult *result2 = WorldDatabase.PQuery( "SELECT wpguid FROM waypoint_data WHERE id = '%u' and wpguid <> 0", pathid);
|
||||
QueryResult_AutoPtr result2 = WorldDatabase.PQuery( "SELECT wpguid FROM waypoint_data WHERE id = '%u' and wpguid <> 0", pathid);
|
||||
|
||||
if(result2)
|
||||
{
|
||||
@@ -3012,8 +2983,6 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
|
||||
}
|
||||
while( result2->NextRow() );
|
||||
|
||||
delete result2;
|
||||
|
||||
if( hasError )
|
||||
{
|
||||
PSendSysMessage(LANG_WAYPOINT_TOOFAR1);
|
||||
@@ -3041,7 +3010,6 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
|
||||
{
|
||||
PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
|
||||
delete wpCreature;
|
||||
delete result;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3064,8 +3032,6 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
|
||||
while( result->NextRow() );
|
||||
|
||||
SendSysMessage("|cff00ff00Showing the current creature's path.|r");
|
||||
// Cleanup memory
|
||||
delete result;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3073,7 +3039,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
|
||||
{
|
||||
PSendSysMessage("|cff00ff00DEBUG: wp first, GUID: %u|r", pathid);
|
||||
|
||||
QueryResult *result = WorldDatabase.PQuery( "SELECT position_x,position_y,position_z FROM waypoint_data WHERE point='1' AND id = '%u'",pathid);
|
||||
QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT position_x,position_y,position_z FROM waypoint_data WHERE point='1' AND id = '%u'",pathid);
|
||||
if(!result)
|
||||
{
|
||||
PSendSysMessage(LANG_WAYPOINT_NOTFOUND, pathid);
|
||||
@@ -3096,7 +3062,6 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
|
||||
{
|
||||
PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
|
||||
delete pCreature;
|
||||
delete result;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3110,8 +3075,6 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
|
||||
pCreature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5);
|
||||
}
|
||||
|
||||
// Cleanup memory
|
||||
delete result;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3119,13 +3082,9 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
|
||||
{
|
||||
PSendSysMessage("|cff00ff00DEBUG: wp last, PathID: |r|cff00ffff%u|r", pathid);
|
||||
|
||||
QueryResult *result = WorldDatabase.PQuery( "SELECT MAX(point) FROM waypoint_data WHERE id = '%u'",pathid);
|
||||
QueryResult_AutoPtr result = WorldDatabase.PQuery( "SELECT MAX(point) FROM waypoint_data WHERE id = '%u'",pathid);
|
||||
if( result )
|
||||
{
|
||||
Maxpoint = (*result)[0].GetUInt32();
|
||||
|
||||
delete result;
|
||||
}
|
||||
else
|
||||
Maxpoint = 0;
|
||||
|
||||
@@ -3151,7 +3110,6 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
|
||||
{
|
||||
PSendSysMessage(LANG_WAYPOINT_NOTCREATED, id);
|
||||
delete pCreature;
|
||||
delete result;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3165,14 +3123,12 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
|
||||
pCreature->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5);
|
||||
}
|
||||
|
||||
// Cleanup memory
|
||||
delete result;
|
||||
return true;
|
||||
}
|
||||
|
||||
if(show == "off")
|
||||
{
|
||||
QueryResult *result = WorldDatabase.PQuery("SELECT guid FROM creature WHERE id = '%u'", 1);
|
||||
QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT guid FROM creature WHERE id = '%u'", 1);
|
||||
if(!result)
|
||||
{
|
||||
SendSysMessage(LANG_WAYPOINT_VP_NOTFOUND);
|
||||
@@ -3211,8 +3167,6 @@ bool ChatHandler::HandleWpShowCommand(const char* args)
|
||||
}
|
||||
|
||||
SendSysMessage(LANG_WAYPOINT_VP_ALLREMOVED);
|
||||
// Cleanup memory
|
||||
delete result;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3759,7 +3713,7 @@ bool ChatHandler::HandleLookupPlayerIpCommand(const char* args)
|
||||
|
||||
loginDatabase.escape_string (ip);
|
||||
|
||||
QueryResult* result = loginDatabase.PQuery ("SELECT id,username FROM account WHERE last_ip = '%s'", ip.c_str ());
|
||||
QueryResult_AutoPtr result = loginDatabase.PQuery ("SELECT id,username FROM account WHERE last_ip = '%s'", ip.c_str ());
|
||||
|
||||
return LookupPlayerSearchCommand (result,limit);
|
||||
}
|
||||
@@ -3778,7 +3732,7 @@ bool ChatHandler::HandleLookupPlayerAccountCommand(const char* args)
|
||||
|
||||
loginDatabase.escape_string (account);
|
||||
|
||||
QueryResult* result = loginDatabase.PQuery ("SELECT id,username FROM account WHERE username = '%s'", account.c_str ());
|
||||
QueryResult_AutoPtr result = loginDatabase.PQuery ("SELECT id,username FROM account WHERE username = '%s'", account.c_str ());
|
||||
|
||||
return LookupPlayerSearchCommand (result,limit);
|
||||
}
|
||||
@@ -3795,12 +3749,12 @@ bool ChatHandler::HandleLookupPlayerEmailCommand(const char* args)
|
||||
|
||||
loginDatabase.escape_string (email);
|
||||
|
||||
QueryResult* result = loginDatabase.PQuery ("SELECT id,username FROM account WHERE email = '%s'", email.c_str ());
|
||||
QueryResult_AutoPtr result = loginDatabase.PQuery ("SELECT id,username FROM account WHERE email = '%s'", email.c_str ());
|
||||
|
||||
return LookupPlayerSearchCommand (result,limit);
|
||||
}
|
||||
|
||||
bool ChatHandler::LookupPlayerSearchCommand(QueryResult* result, int32 limit)
|
||||
bool ChatHandler::LookupPlayerSearchCommand(QueryResult_AutoPtr result, int32 limit)
|
||||
{
|
||||
if(!result)
|
||||
{
|
||||
@@ -3816,7 +3770,7 @@ bool ChatHandler::LookupPlayerSearchCommand(QueryResult* result, int32 limit)
|
||||
uint32 acc_id = fields[0].GetUInt32();
|
||||
std::string acc_name = fields[1].GetCppString();
|
||||
|
||||
QueryResult* chars = CharacterDatabase.PQuery("SELECT guid,name FROM characters WHERE account = '%u'", acc_id);
|
||||
QueryResult_AutoPtr chars = CharacterDatabase.PQuery("SELECT guid,name FROM characters WHERE account = '%u'", acc_id);
|
||||
if(chars)
|
||||
{
|
||||
PSendSysMessage(LANG_LOOKUP_PLAYER_ACCOUNT,acc_name.c_str(),acc_id);
|
||||
@@ -3834,13 +3788,9 @@ bool ChatHandler::LookupPlayerSearchCommand(QueryResult* result, int32 limit)
|
||||
++i;
|
||||
|
||||
} while( chars->NextRow() && ( limit == -1 || i < limit ) );
|
||||
|
||||
delete chars;
|
||||
}
|
||||
} while(result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
if(i==0) // empty accounts only
|
||||
{
|
||||
PSendSysMessage(LANG_NO_PLAYERS_FOUND);
|
||||
|
||||
+20
-60
@@ -1457,10 +1457,9 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(const char *args)
|
||||
// Check and abort if the target gm has a higher rank on one of the realms and the new realm is -1
|
||||
if (gmRealmID == -1)
|
||||
{
|
||||
QueryResult *result = loginDatabase.PQuery("SELECT * FROM account_access WHERE id = '%u' AND gmlevel > '%d'", targetAccountId, gm);
|
||||
QueryResult_AutoPtr result = loginDatabase.PQuery("SELECT * FROM account_access WHERE id = '%u' AND gmlevel > '%d'", targetAccountId, gm);
|
||||
if (result)
|
||||
{
|
||||
delete result;
|
||||
SendSysMessage(LANG_YOURS_SECURITY_IS_LOW);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
@@ -2620,7 +2619,7 @@ bool ChatHandler::HandleAddItemCommand(const char *args)
|
||||
{
|
||||
std::string itemName = citemName+1;
|
||||
WorldDatabase.escape_string(itemName);
|
||||
QueryResult *result = WorldDatabase.PQuery("SELECT entry FROM item_template WHERE name = '%s'", itemName.c_str());
|
||||
QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT entry FROM item_template WHERE name = '%s'", itemName.c_str());
|
||||
if (!result)
|
||||
{
|
||||
PSendSysMessage(LANG_COMMAND_COULDNOTFIND, citemName+1);
|
||||
@@ -2628,7 +2627,6 @@ bool ChatHandler::HandleAddItemCommand(const char *args)
|
||||
return false;
|
||||
}
|
||||
itemId = result->Fetch()->GetUInt16();
|
||||
delete result;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
@@ -2811,16 +2809,13 @@ bool ChatHandler::HandleListItemCommand(const char *args)
|
||||
if(count < 0)
|
||||
return false;
|
||||
|
||||
QueryResult *result;
|
||||
QueryResult_AutoPtr result;
|
||||
|
||||
// inventory case
|
||||
uint32 inv_count = 0;
|
||||
result=CharacterDatabase.PQuery("SELECT COUNT(item_template) FROM character_inventory WHERE item_template='%u'",item_id);
|
||||
if(result)
|
||||
{
|
||||
inv_count = (*result)[0].GetUInt32();
|
||||
delete result;
|
||||
}
|
||||
|
||||
result=CharacterDatabase.PQuery(
|
||||
// 0 1 2 3 4 5
|
||||
@@ -2857,8 +2852,6 @@ bool ChatHandler::HandleListItemCommand(const char *args)
|
||||
|
||||
int64 res_count = result->GetRowCount();
|
||||
|
||||
delete result;
|
||||
|
||||
if(count > res_count)
|
||||
count-=res_count;
|
||||
else if(count)
|
||||
@@ -2869,10 +2862,7 @@ bool ChatHandler::HandleListItemCommand(const char *args)
|
||||
uint32 mail_count = 0;
|
||||
result=CharacterDatabase.PQuery("SELECT COUNT(item_template) FROM mail_items WHERE item_template='%u'", item_id);
|
||||
if(result)
|
||||
{
|
||||
mail_count = (*result)[0].GetUInt32();
|
||||
delete result;
|
||||
}
|
||||
|
||||
if(count > 0)
|
||||
{
|
||||
@@ -2884,7 +2874,7 @@ bool ChatHandler::HandleListItemCommand(const char *args)
|
||||
item_id,uint32(count));
|
||||
}
|
||||
else
|
||||
result = NULL;
|
||||
result = QueryResult_AutoPtr(NULL);
|
||||
|
||||
if(result)
|
||||
{
|
||||
@@ -2907,8 +2897,6 @@ bool ChatHandler::HandleListItemCommand(const char *args)
|
||||
|
||||
int64 res_count = result->GetRowCount();
|
||||
|
||||
delete result;
|
||||
|
||||
if(count > res_count)
|
||||
count-=res_count;
|
||||
else if(count)
|
||||
@@ -2919,10 +2907,7 @@ bool ChatHandler::HandleListItemCommand(const char *args)
|
||||
uint32 auc_count = 0;
|
||||
result=CharacterDatabase.PQuery("SELECT COUNT(item_template) FROM auctionhouse WHERE item_template='%u'",item_id);
|
||||
if(result)
|
||||
{
|
||||
auc_count = (*result)[0].GetUInt32();
|
||||
delete result;
|
||||
}
|
||||
|
||||
if(count > 0)
|
||||
{
|
||||
@@ -2933,7 +2918,7 @@ bool ChatHandler::HandleListItemCommand(const char *args)
|
||||
item_id,uint32(count));
|
||||
}
|
||||
else
|
||||
result = NULL;
|
||||
result = QueryResult_AutoPtr(NULL);
|
||||
|
||||
if(result)
|
||||
{
|
||||
@@ -2949,18 +2934,13 @@ bool ChatHandler::HandleListItemCommand(const char *args)
|
||||
|
||||
PSendSysMessage(LANG_ITEMLIST_AUCTION, item_guid, owner_name.c_str(), owner, owner_acc,item_pos);
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
// guild bank case
|
||||
uint32 guild_count = 0;
|
||||
result=CharacterDatabase.PQuery("SELECT COUNT(item_entry) FROM guild_bank_item WHERE item_entry='%u'",item_id);
|
||||
if(result)
|
||||
{
|
||||
guild_count = (*result)[0].GetUInt32();
|
||||
delete result;
|
||||
}
|
||||
|
||||
result=CharacterDatabase.PQuery(
|
||||
// 0 1 2
|
||||
@@ -2984,8 +2964,6 @@ bool ChatHandler::HandleListItemCommand(const char *args)
|
||||
|
||||
int64 res_count = result->GetRowCount();
|
||||
|
||||
delete result;
|
||||
|
||||
if(count > res_count)
|
||||
count-=res_count;
|
||||
else if(count)
|
||||
@@ -3036,15 +3014,12 @@ bool ChatHandler::HandleListObjectCommand(const char *args)
|
||||
if(count < 0)
|
||||
return false;
|
||||
|
||||
QueryResult *result;
|
||||
QueryResult_AutoPtr result;
|
||||
|
||||
uint32 obj_count = 0;
|
||||
result=WorldDatabase.PQuery("SELECT COUNT(guid) FROM gameobject WHERE id='%u'",go_id);
|
||||
if(result)
|
||||
{
|
||||
obj_count = (*result)[0].GetUInt32();
|
||||
delete result;
|
||||
}
|
||||
|
||||
if(m_session)
|
||||
{
|
||||
@@ -3072,8 +3047,6 @@ bool ChatHandler::HandleListObjectCommand(const char *args)
|
||||
else
|
||||
PSendSysMessage(LANG_GO_LIST_CONSOLE, guid, gInfo->name, x, y, z, mapid);
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
PSendSysMessage(LANG_COMMAND_LISTOBJMESSAGE,go_id,obj_count);
|
||||
@@ -3171,15 +3144,12 @@ bool ChatHandler::HandleListCreatureCommand(const char *args)
|
||||
if(count < 0)
|
||||
return false;
|
||||
|
||||
QueryResult *result;
|
||||
QueryResult_AutoPtr result;
|
||||
|
||||
uint32 cr_count = 0;
|
||||
result=WorldDatabase.PQuery("SELECT COUNT(guid) FROM creature WHERE id='%u'",cr_id);
|
||||
if(result)
|
||||
{
|
||||
cr_count = (*result)[0].GetUInt32();
|
||||
delete result;
|
||||
}
|
||||
|
||||
if(m_session)
|
||||
{
|
||||
@@ -3207,8 +3177,6 @@ bool ChatHandler::HandleListCreatureCommand(const char *args)
|
||||
else
|
||||
PSendSysMessage(LANG_CREATURE_LIST_CONSOLE, guid, cInfo->Name, x, y, z, mapid);
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
PSendSysMessage(LANG_COMMAND_LISTCREATUREMESSAGE,cr_id,cr_count);
|
||||
@@ -5932,7 +5900,7 @@ bool ChatHandler::HandleBanInfoCharacterCommand(const char *args)
|
||||
|
||||
bool ChatHandler::HandleBanInfoHelper(uint32 accountid, char const* accountname)
|
||||
{
|
||||
QueryResult *result = loginDatabase.PQuery("SELECT FROM_UNIXTIME(bandate), unbandate-bandate, active, unbandate,banreason,bannedby FROM account_banned WHERE id = '%u' ORDER BY bandate ASC",accountid);
|
||||
QueryResult_AutoPtr result = loginDatabase.PQuery("SELECT FROM_UNIXTIME(bandate), unbandate-bandate, active, unbandate,banreason,bannedby FROM account_banned WHERE id = '%u' ORDER BY bandate ASC",accountid);
|
||||
if(!result)
|
||||
{
|
||||
PSendSysMessage(LANG_BANINFO_NOACCOUNTBAN, accountname);
|
||||
@@ -5954,7 +5922,6 @@ bool ChatHandler::HandleBanInfoHelper(uint32 accountid, char const* accountname)
|
||||
fields[0].GetString(), bantime.c_str(), active ? GetTrinityString(LANG_BANINFO_YES):GetTrinityString(LANG_BANINFO_NO), fields[4].GetString(), fields[5].GetString());
|
||||
}while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -5973,7 +5940,7 @@ bool ChatHandler::HandleBanInfoIPCommand(const char *args)
|
||||
std::string IP = cIP;
|
||||
|
||||
loginDatabase.escape_string(IP);
|
||||
QueryResult *result = loginDatabase.PQuery("SELECT ip, FROM_UNIXTIME(bandate), FROM_UNIXTIME(unbandate), unbandate-UNIX_TIMESTAMP(), banreason,bannedby,unbandate-bandate FROM ip_banned WHERE ip = '%s'",IP.c_str());
|
||||
QueryResult_AutoPtr result = loginDatabase.PQuery("SELECT ip, FROM_UNIXTIME(bandate), FROM_UNIXTIME(unbandate), unbandate-UNIX_TIMESTAMP(), banreason,bannedby,unbandate-bandate FROM ip_banned WHERE ip = '%s'",IP.c_str());
|
||||
if(!result)
|
||||
{
|
||||
PSendSysMessage(LANG_BANINFO_NOIP);
|
||||
@@ -5985,7 +5952,7 @@ bool ChatHandler::HandleBanInfoIPCommand(const char *args)
|
||||
PSendSysMessage(LANG_BANINFO_IPENTRY,
|
||||
fields[0].GetString(), fields[1].GetString(), permanent ? GetTrinityString(LANG_BANINFO_NEVER):fields[2].GetString(),
|
||||
permanent ? GetTrinityString(LANG_BANINFO_INFINITE):secsToTimeString(fields[3].GetUInt64(), true).c_str(), fields[4].GetString(), fields[5].GetString());
|
||||
delete result;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -5999,7 +5966,7 @@ bool ChatHandler::HandleBanListCharacterCommand(const char *args)
|
||||
|
||||
std::string filter = cFilter;
|
||||
loginDatabase.escape_string(filter);
|
||||
QueryResult* result = CharacterDatabase.PQuery("SELECT account FROM characters WHERE name "_LIKE_" "_CONCAT3_("'%%'","'%s'","'%%'"),filter.c_str());
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT account FROM characters WHERE name "_LIKE_" "_CONCAT3_("'%%'","'%s'","'%%'"),filter.c_str());
|
||||
if (!result)
|
||||
{
|
||||
PSendSysMessage(LANG_BANLIST_NOCHARACTER);
|
||||
@@ -6017,7 +5984,7 @@ bool ChatHandler::HandleBanListAccountCommand(const char *args)
|
||||
std::string filter = cFilter ? cFilter : "";
|
||||
loginDatabase.escape_string(filter);
|
||||
|
||||
QueryResult* result;
|
||||
QueryResult_AutoPtr result;
|
||||
|
||||
if(filter.empty())
|
||||
{
|
||||
@@ -6040,7 +6007,7 @@ bool ChatHandler::HandleBanListAccountCommand(const char *args)
|
||||
return HandleBanListHelper(result);
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleBanListHelper(QueryResult* result)
|
||||
bool ChatHandler::HandleBanListHelper(QueryResult_AutoPtr result)
|
||||
{
|
||||
PSendSysMessage(LANG_BANLIST_MATCHINGACCOUNT);
|
||||
|
||||
@@ -6052,12 +6019,11 @@ bool ChatHandler::HandleBanListHelper(QueryResult* result)
|
||||
Field* fields = result->Fetch();
|
||||
uint32 accountid = fields[0].GetUInt32();
|
||||
|
||||
QueryResult* banresult = loginDatabase.PQuery("SELECT account.username FROM account,account_banned WHERE account_banned.id='%u' AND account_banned.id=account.id",accountid);
|
||||
QueryResult_AutoPtr banresult = loginDatabase.PQuery("SELECT account.username FROM account,account_banned WHERE account_banned.id='%u' AND account_banned.id=account.id",accountid);
|
||||
if(banresult)
|
||||
{
|
||||
Field* fields2 = banresult->Fetch();
|
||||
PSendSysMessage("%s",fields2[0].GetString());
|
||||
delete banresult;
|
||||
}
|
||||
} while (result->NextRow());
|
||||
}
|
||||
@@ -6083,7 +6049,7 @@ bool ChatHandler::HandleBanListHelper(QueryResult* result)
|
||||
accmgr.GetName (account_id,account_name);
|
||||
|
||||
// No SQL injection. id is uint32.
|
||||
QueryResult *banInfo = loginDatabase.PQuery("SELECT bandate,unbandate,bannedby,banreason FROM account_banned WHERE id = %u ORDER BY unbandate", account_id);
|
||||
QueryResult_AutoPtr banInfo = loginDatabase.PQuery("SELECT bandate,unbandate,bannedby,banreason FROM account_banned WHERE id = %u ORDER BY unbandate", account_id);
|
||||
if (banInfo)
|
||||
{
|
||||
Field *fields2 = banInfo->Fetch();
|
||||
@@ -6108,13 +6074,10 @@ bool ChatHandler::HandleBanListHelper(QueryResult* result)
|
||||
fields2[2].GetString(),fields2[3].GetString());
|
||||
}
|
||||
}while ( banInfo->NextRow() );
|
||||
delete banInfo;
|
||||
}
|
||||
}while( result->NextRow() );
|
||||
SendSysMessage("===============================================================================");
|
||||
}
|
||||
|
||||
delete result;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -6126,7 +6089,7 @@ bool ChatHandler::HandleBanListIPCommand(const char *args)
|
||||
std::string filter = cFilter ? cFilter : "";
|
||||
loginDatabase.escape_string(filter);
|
||||
|
||||
QueryResult* result;
|
||||
QueryResult_AutoPtr result;
|
||||
|
||||
if(filter.empty())
|
||||
{
|
||||
@@ -6188,7 +6151,6 @@ bool ChatHandler::HandleBanListIPCommand(const char *args)
|
||||
SendSysMessage("===============================================================================");
|
||||
}
|
||||
|
||||
delete result;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -6892,7 +6854,7 @@ bool ChatHandler::HandleInstanceSaveDataCommand(const char * /*args*/)
|
||||
bool ChatHandler::HandleGMListFullCommand(const char* /*args*/)
|
||||
{
|
||||
///- Get the accounts with GM Level >0
|
||||
QueryResult *result = loginDatabase.Query("SELECT a.username,aa.gmlevel FROM account a, account_access aa WHERE a.id=aa.id AND aa.gmlevel > 0");
|
||||
QueryResult_AutoPtr result = loginDatabase.Query("SELECT a.username,aa.gmlevel FROM account a, account_access aa WHERE a.id=aa.id AND aa.gmlevel > 0");
|
||||
if(result)
|
||||
{
|
||||
SendSysMessage(LANG_GMLIST);
|
||||
@@ -6908,7 +6870,6 @@ bool ChatHandler::HandleGMListFullCommand(const char* /*args*/)
|
||||
}while( result->NextRow() );
|
||||
|
||||
PSendSysMessage("========================");
|
||||
delete result;
|
||||
}
|
||||
else
|
||||
PSendSysMessage(LANG_GMLIST_EMPTY);
|
||||
@@ -7396,7 +7357,7 @@ bool ChatHandler::HandleUnFreezeCommand(const char *args)
|
||||
if (TargetName)
|
||||
{
|
||||
//check for offline players
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT characters.guid FROM characters WHERE characters.name = '%s'",name.c_str());
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT characters.guid FROM characters WHERE characters.name = '%s'",name.c_str());
|
||||
if (!result)
|
||||
{
|
||||
SendSysMessage(LANG_COMMAND_FREEZE_WRONG);
|
||||
@@ -7405,7 +7366,7 @@ bool ChatHandler::HandleUnFreezeCommand(const char *args)
|
||||
//if player found: delete his freeze aura
|
||||
Field *fields=result->Fetch();
|
||||
uint64 pguid = fields[0].GetUInt64();
|
||||
delete result;
|
||||
|
||||
CharacterDatabase.PQuery("DELETE FROM character_aura WHERE character_aura.spell = 9454 AND character_aura.guid = '%u'",pguid);
|
||||
PSendSysMessage(LANG_COMMAND_UNFREEZE,name.c_str());
|
||||
return true;
|
||||
@@ -7423,7 +7384,7 @@ bool ChatHandler::HandleUnFreezeCommand(const char *args)
|
||||
bool ChatHandler::HandleListFreezeCommand(const char *args)
|
||||
{
|
||||
//Get names from DB
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT characters.name FROM characters LEFT JOIN character_aura ON (characters.guid = character_aura.guid) WHERE character_aura.spell = 9454");
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT characters.name FROM characters LEFT JOIN character_aura ON (characters.guid = character_aura.guid) WHERE character_aura.spell = 9454");
|
||||
if (!result)
|
||||
{
|
||||
SendSysMessage(LANG_COMMAND_NO_FROZEN_PLAYERS);
|
||||
@@ -7440,7 +7401,6 @@ bool ChatHandler::HandleListFreezeCommand(const char *args)
|
||||
PSendSysMessage(LANG_COMMAND_FROZEN_PLAYERS,fplayers.c_str());
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ void LootStore::LoadLootTable()
|
||||
sLog.outString( "%s :", GetName());
|
||||
|
||||
// 0 1 2 3 4 5 6 7 8 9
|
||||
QueryResult *result = WorldDatabase.PQuery("SELECT entry, item, ChanceOrQuestChance, lootmode, groupid, mincountOrRef, maxcount, lootcondition, condition_value1, condition_value2 FROM %s",GetName());
|
||||
QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT entry, item, ChanceOrQuestChance, lootmode, groupid, mincountOrRef, maxcount, lootcondition, condition_value1, condition_value2 FROM %s",GetName());
|
||||
|
||||
if (result)
|
||||
{
|
||||
@@ -163,8 +163,6 @@ void LootStore::LoadLootTable()
|
||||
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
Verify(); // Checks validity of the loot store
|
||||
|
||||
sLog.outString();
|
||||
|
||||
+1
-2
@@ -135,11 +135,10 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
|
||||
else
|
||||
{
|
||||
rc_team = objmgr.GetPlayerTeamByGUID(rc);
|
||||
if (QueryResult* result = CharacterDatabase.PQuery("SELECT COUNT(*) FROM mail WHERE receiver = '%u'", GUID_LOPART(rc)))
|
||||
if (QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT COUNT(*) FROM mail WHERE receiver = '%u'", GUID_LOPART(rc)))
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
mails_count = fields[0].GetUInt32();
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
//do not allow to have more than 100 mails in mailbox.. mails count is in opcode uint8!!! - so max can be 255..
|
||||
|
||||
+2
-3
@@ -2357,7 +2357,7 @@ void Map::AddObjectToRemoveList(WorldObject *obj)
|
||||
{
|
||||
assert(obj->GetMapId()==GetId() && obj->GetInstanceId()==GetInstanceId());
|
||||
|
||||
obj->CleanupsBeforeDelete(); // remove or simplify at least cross referenced links
|
||||
obj->CleanupsBeforeDelete(false); // remove or simplify at least cross referenced links
|
||||
|
||||
i_objectsToRemove.insert(obj);
|
||||
//sLog.outDebug("Object (GUID: %u TypeId: %u ) added to removing list.",obj->GetGUIDLow(),obj->GetTypeId());
|
||||
@@ -2761,7 +2761,7 @@ void InstanceMap::CreateInstanceData(bool load)
|
||||
if (load)
|
||||
{
|
||||
// TODO: make a global storage for this
|
||||
QueryResult* result = CharacterDatabase.PQuery("SELECT data FROM instance WHERE map = '%u' AND id = '%u'", GetId(), i_InstanceId);
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT data FROM instance WHERE map = '%u' AND id = '%u'", GetId(), i_InstanceId);
|
||||
if (result)
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
@@ -2771,7 +2771,6 @@ void InstanceMap::CreateInstanceData(bool load)
|
||||
sLog.outDebug("Loading instance data for `%s` with id %u", objmgr.GetScriptName(i_script_id), i_InstanceId);
|
||||
i_data->Load(data);
|
||||
}
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -358,12 +358,9 @@ void MapManager::InitMaxInstanceId()
|
||||
{
|
||||
i_MaxInstanceId = 0;
|
||||
|
||||
QueryResult *result = CharacterDatabase.Query("SELECT MAX(id) FROM instance");
|
||||
QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT MAX(id) FROM instance");
|
||||
if (result)
|
||||
{
|
||||
i_MaxInstanceId = result->Fetch()[0].GetUInt32();
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 MapManager::GetNumInstances()
|
||||
|
||||
@@ -537,7 +537,7 @@ void WorldSession::HandleAddFriendOpcode( WorldPacket & recv_data )
|
||||
CharacterDatabase.AsyncPQuery(&WorldSession::HandleAddFriendOpcodeCallBack, GetAccountId(), friendNote, "SELECT guid, race, account FROM characters WHERE name = '%s'", friendName.c_str());
|
||||
}
|
||||
|
||||
void WorldSession::HandleAddFriendOpcodeCallBack(QueryResult *result, uint32 accountId, std::string friendNote)
|
||||
void WorldSession::HandleAddFriendOpcodeCallBack(QueryResult_AutoPtr result, uint32 accountId, std::string friendNote)
|
||||
{
|
||||
uint64 friendGuid;
|
||||
uint64 friendAcctid;
|
||||
@@ -558,8 +558,6 @@ void WorldSession::HandleAddFriendOpcodeCallBack(QueryResult *result, uint32 acc
|
||||
team = Player::TeamForRace((*result)[1].GetUInt8());
|
||||
friendAcctid = (*result)[2].GetUInt32();
|
||||
|
||||
delete result;
|
||||
|
||||
if ( session->GetSecurity() >= SEC_MODERATOR || sWorld.getConfig(CONFIG_ALLOW_GM_FRIEND) || accmgr.GetSecurity(friendAcctid) < SEC_MODERATOR)
|
||||
{
|
||||
if(friendGuid)
|
||||
@@ -627,7 +625,7 @@ void WorldSession::HandleAddIgnoreOpcode( WorldPacket & recv_data )
|
||||
CharacterDatabase.AsyncPQuery(&WorldSession::HandleAddIgnoreOpcodeCallBack, GetAccountId(), "SELECT guid FROM characters WHERE name = '%s'", IgnoreName.c_str());
|
||||
}
|
||||
|
||||
void WorldSession::HandleAddIgnoreOpcodeCallBack(QueryResult *result, uint32 accountId)
|
||||
void WorldSession::HandleAddIgnoreOpcodeCallBack(QueryResult_AutoPtr result, uint32 accountId)
|
||||
{
|
||||
uint64 IgnoreGuid;
|
||||
FriendsResult ignoreResult;
|
||||
@@ -644,8 +642,6 @@ void WorldSession::HandleAddIgnoreOpcodeCallBack(QueryResult *result, uint32 acc
|
||||
{
|
||||
IgnoreGuid = MAKE_NEW_GUID((*result)[0].GetUInt32(), 0, HIGHGUID_PLAYER);
|
||||
|
||||
delete result;
|
||||
|
||||
if(IgnoreGuid)
|
||||
{
|
||||
if(IgnoreGuid==session->GetPlayer()->GetGUID()) //not add yourself
|
||||
@@ -1306,7 +1302,7 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
|
||||
|
||||
uint32 accid = plr->GetSession()->GetAccountId();
|
||||
|
||||
QueryResult *result = loginDatabase.PQuery("SELECT username,email,last_ip FROM account WHERE id=%u", accid);
|
||||
QueryResult_AutoPtr result = loginDatabase.PQuery("SELECT username,email,last_ip FROM account WHERE id=%u", accid);
|
||||
if(!result)
|
||||
{
|
||||
SendNotification(LANG_ACCOUNT_FOR_PLAYER_NOT_FOUND, charname.c_str());
|
||||
@@ -1330,8 +1326,6 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
|
||||
data << msg;
|
||||
_player->GetSession()->SendPacket(&data);
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outDebug("Received whois command from player %s for character %s", GetPlayer()->GetName(), charname.c_str());
|
||||
}
|
||||
|
||||
|
||||
+4
-10
@@ -522,7 +522,7 @@ void WorldSession::SendStablePet(uint64 guid )
|
||||
}
|
||||
|
||||
// 0 1 2 3 4
|
||||
QueryResult* result = CharacterDatabase.PQuery("SELECT owner, id, entry, level, name FROM character_pet WHERE owner = '%u' AND slot >= '%u' AND slot <= '%u' ORDER BY slot",
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT owner, id, entry, level, name FROM character_pet WHERE owner = '%u' AND slot >= '%u' AND slot <= '%u' ORDER BY slot",
|
||||
_player->GetGUIDLow(),PET_SAVE_FIRST_STABLE_SLOT,PET_SAVE_LAST_STABLE_SLOT);
|
||||
|
||||
if(result)
|
||||
@@ -539,8 +539,6 @@ void WorldSession::SendStablePet(uint64 guid )
|
||||
|
||||
++num;
|
||||
}while( result->NextRow() );
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
data.put<uint8>(wpos, num); // set real data to placeholder
|
||||
@@ -581,7 +579,7 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data )
|
||||
|
||||
uint32 free_slot = 1;
|
||||
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT owner,slot,id FROM character_pet WHERE owner = '%u' AND slot >= '%u' AND slot <= '%u' ORDER BY slot ",
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT owner,slot,id FROM character_pet WHERE owner = '%u' AND slot >= '%u' AND slot <= '%u' ORDER BY slot ",
|
||||
_player->GetGUIDLow(),PET_SAVE_FIRST_STABLE_SLOT,PET_SAVE_LAST_STABLE_SLOT);
|
||||
if(result)
|
||||
{
|
||||
@@ -598,8 +596,6 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data )
|
||||
// this slot not free, skip
|
||||
++free_slot;
|
||||
}while( result->NextRow() );
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
WorldPacket data(SMSG_STABLE_RESULT, 1);
|
||||
@@ -636,13 +632,12 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data )
|
||||
uint32 creature_id = 0;
|
||||
|
||||
{
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT entry FROM character_pet WHERE owner = '%u' AND id = '%u' AND slot >='%u' AND slot <= '%u'",
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT entry FROM character_pet WHERE owner = '%u' AND id = '%u' AND slot >='%u' AND slot <= '%u'",
|
||||
_player->GetGUIDLow(),petnumber,PET_SAVE_FIRST_STABLE_SLOT,PET_SAVE_LAST_STABLE_SLOT);
|
||||
if(result)
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
creature_id = fields[0].GetUInt32();
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -762,7 +757,7 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data )
|
||||
return;
|
||||
|
||||
// find swapped pet slot in stable
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT slot,entry FROM character_pet WHERE owner = '%u' AND id = '%u'",
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT slot,entry FROM character_pet WHERE owner = '%u' AND id = '%u'",
|
||||
_player->GetGUIDLow(),pet_number);
|
||||
if(!result)
|
||||
return;
|
||||
@@ -771,7 +766,6 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data )
|
||||
|
||||
uint32 slot = fields[0].GetUInt32();
|
||||
uint32 creature_id = fields[1].GetUInt32();
|
||||
delete result;
|
||||
|
||||
if(!creature_id)
|
||||
{
|
||||
|
||||
+1
-1
@@ -1165,7 +1165,7 @@ void WorldObject::setActive( bool on )
|
||||
}
|
||||
}
|
||||
|
||||
void WorldObject::CleanupsBeforeDelete()
|
||||
void WorldObject::CleanupsBeforeDelete(bool finalCleanup)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -571,7 +571,7 @@ class TRINITY_DLL_SPEC WorldObject : public Object, public WorldLocation
|
||||
|
||||
bool IsInBetween(const WorldObject *obj1, const WorldObject *obj2, float size = 0) const;
|
||||
|
||||
virtual void CleanupsBeforeDelete(); // used in destructor or explicitly before mass creature delete to remove cross-references to already deleted units
|
||||
virtual void CleanupsBeforeDelete(bool finalCleanup = true); // used in destructor or explicitly before mass creature delete to remove cross-references to already deleted units
|
||||
|
||||
virtual void SendMessageToSet(WorldPacket *data, bool self);
|
||||
virtual void SendMessageToSetInRange(WorldPacket *data, float dist, bool self);
|
||||
|
||||
+68
-228
File diff suppressed because it is too large
Load Diff
+6
-36
@@ -108,7 +108,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
|
||||
|
||||
uint32 ownerid = owner->GetGUIDLow();
|
||||
|
||||
QueryResult *result;
|
||||
QueryResult_AutoPtr result;
|
||||
|
||||
if (petnumber)
|
||||
// known petnumber entry 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
||||
@@ -141,10 +141,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
|
||||
// update for case of current pet "slot = 0"
|
||||
petentry = fields[1].GetUInt32();
|
||||
if (!petentry)
|
||||
{
|
||||
delete result;
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 summon_spell_id = fields[17].GetUInt32();
|
||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(summon_spell_id);
|
||||
@@ -153,20 +150,14 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
|
||||
|
||||
// check temporary summoned pets like mage water elemental
|
||||
if (current && is_temporary_summoned)
|
||||
{
|
||||
delete result;
|
||||
return false;
|
||||
}
|
||||
|
||||
PetType pet_type = PetType(fields[18].GetUInt8());
|
||||
if(pet_type==HUNTER_PET)
|
||||
{
|
||||
CreatureInfo const* creatureInfo = objmgr.GetCreatureTemplate(petentry);
|
||||
if(!creatureInfo || !creatureInfo->isTameable(owner->CanTameExoticPets()))
|
||||
{
|
||||
delete result;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 pet_number = fields[0].GetUInt32();
|
||||
@@ -174,17 +165,13 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
|
||||
if (current && owner->IsPetNeedBeTemporaryUnsummoned())
|
||||
{
|
||||
owner->SetTemporaryUnsummonedPetNumber(pet_number);
|
||||
delete result;
|
||||
return false;
|
||||
}
|
||||
|
||||
Map *map = owner->GetMap();
|
||||
uint32 guid = objmgr.GenerateLowGuid(HIGHGUID_PET);
|
||||
if (!Create(guid, map, owner->GetPhaseMask(), petentry, pet_number))
|
||||
{
|
||||
delete result;
|
||||
return false;
|
||||
}
|
||||
|
||||
float px, py, pz;
|
||||
owner->GetClosePoint(px, py, pz, GetObjectSize(), PET_FOLLOW_DIST, GetFollowAngle());
|
||||
@@ -194,7 +181,6 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
|
||||
{
|
||||
sLog.outError("Pet (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)",
|
||||
GetGUIDLow(), GetEntry(), GetPositionX(), GetPositionY());
|
||||
delete result;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -206,7 +192,6 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
|
||||
if (cinfo->type == CREATURE_TYPE_CRITTER)
|
||||
{
|
||||
map->Add((Creature*)this);
|
||||
delete result;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -324,7 +309,6 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
|
||||
|
||||
CleanupActionBar(); // remove unknown spells from action bar after load
|
||||
|
||||
delete result;
|
||||
sLog.outDebug("New Pet has guid %u", GetGUIDLow());
|
||||
|
||||
owner->PetSpellInitialize();
|
||||
@@ -349,7 +333,6 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
|
||||
{
|
||||
m_declinedname->name[i] = fields2[i].GetCppString();
|
||||
}
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1067,7 +1050,7 @@ void Pet::_LoadSpellCooldowns()
|
||||
m_CreatureSpellCooldowns.clear();
|
||||
m_CreatureCategoryCooldowns.clear();
|
||||
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT spell,time FROM pet_spell_cooldown WHERE guid = '%u'",m_charmInfo->GetPetNumber());
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT spell,time FROM pet_spell_cooldown WHERE guid = '%u'",m_charmInfo->GetPetNumber());
|
||||
|
||||
if(result)
|
||||
{
|
||||
@@ -1103,8 +1086,6 @@ void Pet::_LoadSpellCooldowns()
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
if(!m_CreatureSpellCooldowns.empty() && GetOwner())
|
||||
((Player*)GetOwner())->GetSession()->SendPacket(&data);
|
||||
}
|
||||
@@ -1131,7 +1112,7 @@ void Pet::_SaveSpellCooldowns()
|
||||
|
||||
void Pet::_LoadSpells()
|
||||
{
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT spell,active FROM pet_spell WHERE guid = '%u'",m_charmInfo->GetPetNumber());
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT spell,active FROM pet_spell WHERE guid = '%u'",m_charmInfo->GetPetNumber());
|
||||
|
||||
if (result)
|
||||
{
|
||||
@@ -1142,8 +1123,6 @@ void Pet::_LoadSpells()
|
||||
addSpell(fields[0].GetUInt32(), ActiveStates(fields[1].GetUInt8()), PETSPELL_UNCHANGED);
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1182,7 +1161,7 @@ void Pet::_LoadAuras(uint32 timediff)
|
||||
{
|
||||
sLog.outDebug("Loading auras for pet %u",GetGUIDLow());
|
||||
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT caster_guid,spell,effect_mask,recalculate_mask,stackcount,amount0,amount1,amount2,base_amount0,base_amount1,base_amount2,maxduration,remaintime,remaincharges FROM pet_aura WHERE guid = '%u'",m_charmInfo->GetPetNumber());
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT caster_guid,spell,effect_mask,recalculate_mask,stackcount,amount0,amount1,amount2,base_amount0,base_amount1,base_amount2,maxduration,remaintime,remaincharges FROM pet_aura WHERE guid = '%u'",m_charmInfo->GetPetNumber());
|
||||
|
||||
if (result)
|
||||
{
|
||||
@@ -1244,8 +1223,6 @@ void Pet::_LoadAuras(uint32 timediff)
|
||||
}
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1669,7 +1646,7 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/)
|
||||
// now need only reset for offline pets (all pets except online case)
|
||||
uint32 except_petnumber = online_pet ? online_pet->GetCharmInfo()->GetPetNumber() : 0;
|
||||
|
||||
QueryResult *resultPets = CharacterDatabase.PQuery(
|
||||
QueryResult_AutoPtr resultPets = CharacterDatabase.PQuery(
|
||||
"SELECT id FROM character_pet WHERE owner = '%u' AND id <> '%u'",
|
||||
owner->GetGUIDLow(),except_petnumber);
|
||||
|
||||
@@ -1677,16 +1654,13 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/)
|
||||
if (!resultPets)
|
||||
return;
|
||||
|
||||
QueryResult *result = CharacterDatabase.PQuery(
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery(
|
||||
"SELECT DISTINCT pet_spell.spell FROM pet_spell, character_pet "
|
||||
"WHERE character_pet.owner = '%u' AND character_pet.id = pet_spell.guid AND character_pet.id <> %u",
|
||||
owner->GetGUIDLow(),except_petnumber);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
delete resultPets;
|
||||
return;
|
||||
}
|
||||
|
||||
bool need_comma = false;
|
||||
std::ostringstream ss;
|
||||
@@ -1707,8 +1681,6 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/)
|
||||
}
|
||||
while (resultPets->NextRow());
|
||||
|
||||
delete resultPets;
|
||||
|
||||
ss << ") AND spell IN (";
|
||||
|
||||
bool need_execute = false;
|
||||
@@ -1730,8 +1702,6 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/)
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
if (!need_execute)
|
||||
return;
|
||||
|
||||
|
||||
@@ -207,7 +207,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
|
||||
// a petition is invalid, if both the owner and the type matches
|
||||
// we checked above, if this player is in an arenateam, so this must be
|
||||
// datacorruption
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT petitionguid FROM petition WHERE ownerguid = '%u' AND type = '%u'", _player->GetGUIDLow(), type);
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT petitionguid FROM petition WHERE ownerguid = '%u' AND type = '%u'", _player->GetGUIDLow(), type);
|
||||
|
||||
std::ostringstream ssInvalidPetitionGUIDs;
|
||||
|
||||
@@ -218,8 +218,6 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
|
||||
Field *fields = result->Fetch();
|
||||
ssInvalidPetitionGUIDs << "'" << fields[0].GetUInt32() << "' , ";
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
// delete petitions with the same guid as this one
|
||||
@@ -248,7 +246,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data)
|
||||
// solve (possible) some strange compile problems with explicit use GUID_LOPART(petitionguid) at some GCC versions (wrong code optimization in compiler?)
|
||||
uint32 petitionguid_low = GUID_LOPART(petitionguid);
|
||||
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT type FROM petition WHERE petitionguid = '%u'", petitionguid_low);
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT type FROM petition WHERE petitionguid = '%u'", petitionguid_low);
|
||||
if(!result)
|
||||
{
|
||||
sLog.outError("Petition %u is not found for player %u %s", GUID_LOPART(petitionguid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName());
|
||||
@@ -256,7 +254,6 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data)
|
||||
}
|
||||
Field *fields = result->Fetch();
|
||||
uint32 type = fields[0].GetUInt32();
|
||||
delete result;
|
||||
|
||||
// if guild petition and has guild => error, return;
|
||||
if(type==9 && _player->GetGuildId())
|
||||
@@ -286,7 +283,6 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data)
|
||||
|
||||
result->NextRow();
|
||||
}
|
||||
delete result;
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
@@ -311,7 +307,7 @@ void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid)
|
||||
std::string name = "NO_NAME_FOR_GUID";
|
||||
uint8 signs = 0;
|
||||
|
||||
QueryResult *result = CharacterDatabase.PQuery(
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery(
|
||||
"SELECT ownerguid, name, "
|
||||
" (SELECT COUNT(playerguid) FROM petition_sign WHERE petition_sign.petitionguid = '%u') AS signs, "
|
||||
" type "
|
||||
@@ -324,7 +320,6 @@ void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid)
|
||||
name = fields[1].GetCppString();
|
||||
signs = fields[2].GetUInt8();
|
||||
type = fields[3].GetUInt32();
|
||||
delete result;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -387,13 +382,12 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recv_data)
|
||||
if(!item)
|
||||
return;
|
||||
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT type FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT type FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
|
||||
|
||||
if(result)
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
type = fields[0].GetUInt32();
|
||||
delete result;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -451,7 +445,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
|
||||
recv_data >> petitionguid; // petition guid
|
||||
recv_data >> unk;
|
||||
|
||||
QueryResult *result = CharacterDatabase.PQuery(
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery(
|
||||
"SELECT ownerguid, "
|
||||
" (SELECT COUNT(playerguid) FROM petition_sign WHERE petition_sign.petitionguid = '%u') AS signs, "
|
||||
" type "
|
||||
@@ -468,8 +462,6 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
|
||||
uint8 signs = fields[1].GetUInt8();
|
||||
uint32 type = fields[2].GetUInt32();
|
||||
|
||||
delete result;
|
||||
|
||||
uint32 plguidlo = _player->GetGUIDLow();
|
||||
if(GUID_LOPART(ownerguid) == plguidlo)
|
||||
return;
|
||||
@@ -531,7 +523,6 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
|
||||
|
||||
if(result)
|
||||
{
|
||||
delete result;
|
||||
WorldPacket data(SMSG_PETITION_SIGN_RESULTS, (8+8+4));
|
||||
data << petitionguid;
|
||||
data << _player->GetGUID();
|
||||
@@ -578,13 +569,12 @@ void WorldSession::HandlePetitionDeclineOpcode(WorldPacket & recv_data)
|
||||
recv_data >> petitionguid; // petition guid
|
||||
sLog.outDebug("Petition %u declined by %u", GUID_LOPART(petitionguid), _player->GetGUIDLow());
|
||||
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT ownerguid FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT ownerguid FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
|
||||
if(!result)
|
||||
return;
|
||||
|
||||
Field *fields = result->Fetch();
|
||||
ownerguid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
|
||||
delete result;
|
||||
|
||||
Player *owner = objmgr.GetPlayer(ownerguid);
|
||||
if(owner) // petition owner online
|
||||
@@ -612,13 +602,12 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data)
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT type FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT type FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
|
||||
if (!result)
|
||||
return;
|
||||
|
||||
Field *fields = result->Fetch();
|
||||
type = fields[0].GetUInt32();
|
||||
delete result;
|
||||
|
||||
sLog.outDebug("OFFER PETITION: type %u, GUID1 %u, to player id: %u", type, GUID_LOPART(petitionguid), GUID_LOPART(plguid));
|
||||
|
||||
@@ -694,7 +683,6 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data)
|
||||
result->NextRow();
|
||||
}
|
||||
|
||||
delete result;
|
||||
player->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
@@ -715,14 +703,13 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
|
||||
sLog.outDebug("Petition %u turned in by %u", GUID_LOPART(petitionguid), _player->GetGUIDLow());
|
||||
|
||||
// data
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT ownerguid, name, type FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT ownerguid, name, type FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
|
||||
if(result)
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
ownerguidlo = fields[0].GetUInt32();
|
||||
name = fields[1].GetCppString();
|
||||
type = fields[2].GetUInt32();
|
||||
delete result;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -778,7 +765,6 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
|
||||
data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4);
|
||||
data << (uint32)PETITION_TURN_NEED_MORE_SIGNATURES; // need more signatures...
|
||||
SendPacket(&data);
|
||||
delete result;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -787,7 +773,6 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
|
||||
if(objmgr.GetGuildByName(name))
|
||||
{
|
||||
SendGuildCommandResult(GUILD_CREATE_S, name, GUILD_NAME_EXISTS);
|
||||
delete result;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -796,7 +781,6 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
|
||||
if(objmgr.GetArenaTeamByName(name))
|
||||
{
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, name, "", ERR_ARENA_TEAM_NAME_EXISTS_S);
|
||||
delete result;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -804,10 +788,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
|
||||
// and at last charter item check
|
||||
Item *item = _player->GetItemByGuid(petitionguid);
|
||||
if(!item)
|
||||
{
|
||||
delete result;
|
||||
return;
|
||||
}
|
||||
|
||||
// OK!
|
||||
|
||||
@@ -820,7 +801,6 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
|
||||
if(!guild->Create(_player, name))
|
||||
{
|
||||
delete guild;
|
||||
delete result;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -842,7 +822,6 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
|
||||
{
|
||||
sLog.outError("PetitionsHandler: arena team create failed.");
|
||||
delete at;
|
||||
delete result;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -866,8 +845,6 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
|
||||
}
|
||||
}
|
||||
|
||||
delete result;
|
||||
|
||||
CharacterDatabase.BeginTransaction();
|
||||
CharacterDatabase.PExecute("DELETE FROM petition WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
|
||||
CharacterDatabase.PExecute("DELETE FROM petition_sign WHERE petitionguid = '%u'", GUID_LOPART(petitionguid));
|
||||
|
||||
+40
-109
@@ -542,12 +542,12 @@ Player::~Player ()
|
||||
sWorld.DecreasePlayerCount();
|
||||
}
|
||||
|
||||
void Player::CleanupsBeforeDelete()
|
||||
void Player::CleanupsBeforeDelete(bool finalCleanup)
|
||||
{
|
||||
TradeCancel(false);
|
||||
DuelComplete(DUEL_INTERUPTED);
|
||||
|
||||
Unit::CleanupsBeforeDelete();
|
||||
Unit::CleanupsBeforeDelete(finalCleanup);
|
||||
|
||||
if (m_transport)
|
||||
m_transport->RemovePassenger(this);
|
||||
@@ -1468,7 +1468,7 @@ void Player::setDeathState(DeathState s)
|
||||
}
|
||||
}
|
||||
|
||||
bool Player::BuildEnumData( QueryResult * result, WorldPacket * p_data )
|
||||
bool Player::BuildEnumData( QueryResult_AutoPtr result, WorldPacket * p_data )
|
||||
{
|
||||
// 0 1 2 3 4 5 6 7
|
||||
// "SELECT characters.guid, characters.name, characters.race, characters.class, characters.gender, characters.playerBytes, characters.playerBytes2, characters.level, "
|
||||
@@ -3690,7 +3690,7 @@ void Player::RemoveAllSpellCooldown()
|
||||
}
|
||||
}
|
||||
|
||||
void Player::_LoadSpellCooldowns(QueryResult *result)
|
||||
void Player::_LoadSpellCooldowns(QueryResult_AutoPtr result)
|
||||
{
|
||||
// some cooldowns can be already set at aura loading...
|
||||
|
||||
@@ -3723,8 +3723,6 @@ void Player::_LoadSpellCooldowns(QueryResult *result)
|
||||
sLog.outDebug("Player (GUID: %u) spell %u, item %u cooldown loaded (%u secs).", GetGUIDLow(), spell_id, item_id, uint32(db_time-curTime));
|
||||
}
|
||||
while( result->NextRow() );
|
||||
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4166,11 +4164,10 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
|
||||
LeaveAllArenaTeams(playerguid);
|
||||
|
||||
// the player was uninvited already on logout so just remove from group
|
||||
QueryResult *resultGroup = CharacterDatabase.PQuery("SELECT leaderGuid FROM group_member WHERE memberGuid='%u'", guid);
|
||||
QueryResult_AutoPtr resultGroup = CharacterDatabase.PQuery("SELECT leaderGuid FROM group_member WHERE memberGuid='%u'", guid);
|
||||
if(resultGroup)
|
||||
{
|
||||
uint64 leaderGuid = MAKE_NEW_GUID((*resultGroup)[0].GetUInt32(), 0, HIGHGUID_PLAYER);
|
||||
delete resultGroup;
|
||||
Group* group = objmgr.GetGroupByLeader(leaderGuid);
|
||||
if(group)
|
||||
{
|
||||
@@ -4182,7 +4179,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
|
||||
RemovePetitionsAndSigns(playerguid, 10);
|
||||
|
||||
// return back all mails with COD and Item 0 1 2 3 4 5 6 7
|
||||
QueryResult *resultMail = CharacterDatabase.PQuery("SELECT id,messageType,mailTemplateId,sender,subject,itemTextId,money,has_items FROM mail WHERE receiver='%u' AND has_items<>0 AND cod<>0", guid);
|
||||
QueryResult_AutoPtr resultMail = CharacterDatabase.PQuery("SELECT id,messageType,mailTemplateId,sender,subject,itemTextId,money,has_items FROM mail WHERE receiver='%u' AND has_items<>0 AND cod<>0", guid);
|
||||
if(resultMail)
|
||||
{
|
||||
do
|
||||
@@ -4217,7 +4214,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
|
||||
if(has_items)
|
||||
{
|
||||
// data needs to be at first place for Item::LoadFromDB
|
||||
QueryResult *resultItems = CharacterDatabase.PQuery("SELECT data,item_guid,item_template FROM mail_items JOIN item_instance ON item_guid = guid WHERE mail_id='%u'", mail_id);
|
||||
QueryResult_AutoPtr resultItems = CharacterDatabase.PQuery("SELECT data,item_guid,item_template FROM mail_items JOIN item_instance ON item_guid = guid WHERE mail_id='%u'", mail_id);
|
||||
if(resultItems)
|
||||
{
|
||||
do
|
||||
@@ -4245,8 +4242,6 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
|
||||
draft.AddItem(pItem);
|
||||
}
|
||||
while (resultItems->NextRow());
|
||||
|
||||
delete resultItems;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4257,13 +4252,11 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
|
||||
draft.AddMoney(money).SendReturnToSender(pl_account, guid, sender);
|
||||
}
|
||||
while (resultMail->NextRow());
|
||||
|
||||
delete resultMail;
|
||||
}
|
||||
|
||||
// unsummon and delete for pets in world is not required: player deleted from CLI or character list with not loaded pet.
|
||||
// Get guids of character's pets, will deleted in transaction
|
||||
QueryResult *resultPets = CharacterDatabase.PQuery("SELECT id FROM character_pet WHERE owner = '%u'",guid);
|
||||
QueryResult_AutoPtr resultPets = CharacterDatabase.PQuery("SELECT id FROM character_pet WHERE owner = '%u'",guid);
|
||||
|
||||
// NOW we can finally clear other DB data related to character
|
||||
CharacterDatabase.BeginTransaction();
|
||||
@@ -4275,7 +4268,6 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
|
||||
uint32 petguidlow = fields3[0].GetUInt32();
|
||||
Pet::DeleteFromDB(petguidlow);
|
||||
} while (resultPets->NextRow());
|
||||
delete resultPets;
|
||||
}
|
||||
|
||||
CharacterDatabase.PExecute("DELETE FROM characters WHERE guid = '%u'",guid);
|
||||
@@ -6545,22 +6537,20 @@ void Player::ModifyArenaPoints(int32 value)
|
||||
|
||||
uint32 Player::GetGuildIdFromDB(uint64 guid)
|
||||
{
|
||||
QueryResult* result = CharacterDatabase.PQuery("SELECT guildid FROM guild_member WHERE guid='%u'", GUID_LOPART(guid));
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT guildid FROM guild_member WHERE guid='%u'", GUID_LOPART(guid));
|
||||
if(!result)
|
||||
return 0;
|
||||
|
||||
uint32 id = result->Fetch()[0].GetUInt32();
|
||||
delete result;
|
||||
return id;
|
||||
}
|
||||
|
||||
uint32 Player::GetRankFromDB(uint64 guid)
|
||||
{
|
||||
QueryResult *result = CharacterDatabase.PQuery( "SELECT rank FROM guild_member WHERE guid='%u'", GUID_LOPART(guid) );
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery( "SELECT rank FROM guild_member WHERE guid='%u'", GUID_LOPART(guid) );
|
||||
if( result )
|
||||
{
|
||||
uint32 v = result->Fetch()[0].GetUInt32();
|
||||
delete result;
|
||||
return v;
|
||||
}
|
||||
else
|
||||
@@ -6569,24 +6559,22 @@ uint32 Player::GetRankFromDB(uint64 guid)
|
||||
|
||||
uint32 Player::GetArenaTeamIdFromDB(uint64 guid, uint8 type)
|
||||
{
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT arena_team_member.arenateamid FROM arena_team_member JOIN arena_team ON arena_team_member.arenateamid = arena_team.arenateamid WHERE guid='%u' AND type='%u' LIMIT 1", GUID_LOPART(guid), type);
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT arena_team_member.arenateamid FROM arena_team_member JOIN arena_team ON arena_team_member.arenateamid = arena_team.arenateamid WHERE guid='%u' AND type='%u' LIMIT 1", GUID_LOPART(guid), type);
|
||||
if(!result)
|
||||
return 0;
|
||||
|
||||
uint32 id = (*result)[0].GetUInt32();
|
||||
delete result;
|
||||
return id;
|
||||
}
|
||||
|
||||
uint32 Player::GetZoneIdFromDB(uint64 guid)
|
||||
{
|
||||
uint32 guidLow = GUID_LOPART(guid);
|
||||
QueryResult *result = CharacterDatabase.PQuery( "SELECT zone FROM characters WHERE guid='%u'", guidLow );
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery( "SELECT zone FROM characters WHERE guid='%u'", guidLow );
|
||||
if (!result)
|
||||
return 0;
|
||||
Field* fields = result->Fetch();
|
||||
uint32 zone = fields[0].GetUInt32();
|
||||
delete result;
|
||||
|
||||
if (!zone)
|
||||
{
|
||||
@@ -6599,7 +6587,6 @@ uint32 Player::GetZoneIdFromDB(uint64 guid)
|
||||
float posx = fields[1].GetFloat();
|
||||
float posy = fields[2].GetFloat();
|
||||
float posz = fields[3].GetFloat();
|
||||
delete result;
|
||||
|
||||
zone = MapManager::Instance().GetZoneId(map,posx,posy,posz);
|
||||
|
||||
@@ -6612,13 +6599,12 @@ uint32 Player::GetZoneIdFromDB(uint64 guid)
|
||||
|
||||
uint32 Player::GetLevelFromDB(uint64 guid)
|
||||
{
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT level FROM characters WHERE guid='%u'", GUID_LOPART(guid));
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT level FROM characters WHERE guid='%u'", GUID_LOPART(guid));
|
||||
if (!result)
|
||||
return 0;
|
||||
|
||||
Field* fields = result->Fetch();
|
||||
uint8 level = fields[0].GetUInt8();
|
||||
delete result;
|
||||
|
||||
return level;
|
||||
}
|
||||
@@ -15158,9 +15144,8 @@ void Player::SendQuestUpdateAddCreatureOrGo( Quest const* pQuest, uint64 guid, u
|
||||
/*** LOAD SYSTEM ***/
|
||||
/*********************************************************/
|
||||
|
||||
bool Player::MinimalLoadFromDB( QueryResult *result, uint32 guid )
|
||||
bool Player::MinimalLoadFromDB( QueryResult_AutoPtr result, uint32 guid )
|
||||
{
|
||||
bool delete_result = true;
|
||||
if (!result)
|
||||
{
|
||||
// 0 1 2 3 4 5 6 7 8 9 10 11
|
||||
@@ -15168,16 +15153,12 @@ bool Player::MinimalLoadFromDB( QueryResult *result, uint32 guid )
|
||||
if (!result)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
delete_result = false;
|
||||
|
||||
Field *fields = result->Fetch();
|
||||
|
||||
if (!LoadValues( fields[1].GetString()))
|
||||
{
|
||||
sLog.outError("Player #%d have broken data in `data` field. Can't be loaded for character list.",GUID_LOPART(guid));
|
||||
if (delete_result)
|
||||
delete result;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -15206,9 +15187,6 @@ bool Player::MinimalLoadFromDB( QueryResult *result, uint32 guid )
|
||||
|
||||
_LoadBoundInstances();*/
|
||||
|
||||
if (delete_result)
|
||||
delete result;
|
||||
|
||||
for (uint8 i = 0; i < PLAYER_SLOTS_COUNT; i++)
|
||||
m_items[i] = NULL;
|
||||
|
||||
@@ -15218,7 +15196,7 @@ bool Player::MinimalLoadFromDB( QueryResult *result, uint32 guid )
|
||||
return true;
|
||||
}
|
||||
|
||||
void Player::_LoadDeclinedNames(QueryResult* result)
|
||||
void Player::_LoadDeclinedNames(QueryResult_AutoPtr result)
|
||||
{
|
||||
if(!result)
|
||||
return;
|
||||
@@ -15230,11 +15208,9 @@ void Player::_LoadDeclinedNames(QueryResult* result)
|
||||
Field *fields = result->Fetch();
|
||||
for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
|
||||
m_declinedname->name[i] = fields[i].GetCppString();
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
void Player::_LoadArenaTeamInfo(QueryResult *result)
|
||||
void Player::_LoadArenaTeamInfo(QueryResult_AutoPtr result)
|
||||
{
|
||||
// arenateamid, played_week, played_season, personal_rating
|
||||
memset((void*)&m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1], 0, sizeof(uint32) * MAX_ARENA_SLOT * ARENA_TEAM_END);
|
||||
@@ -15268,10 +15244,9 @@ void Player::_LoadArenaTeamInfo(QueryResult *result)
|
||||
m_uint32Values[PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaSlot * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING] = personal_rating; // Personal Rating
|
||||
|
||||
}while (result->NextRow());
|
||||
delete result;
|
||||
}
|
||||
|
||||
void Player::_LoadEquipmentSets(QueryResult *result)
|
||||
void Player::_LoadEquipmentSets(QueryResult_AutoPtr result)
|
||||
{
|
||||
// SetPQuery(PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS, "SELECT setguid, setindex, name, iconname, item0, item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16, item17, item18 FROM character_equipmentsets WHERE guid = '%u' ORDER BY setindex", GUID_LOPART(m_guid));
|
||||
if (!result)
|
||||
@@ -15300,10 +15275,9 @@ void Player::_LoadEquipmentSets(QueryResult *result)
|
||||
if(count >= MAX_EQUIPMENT_SET_INDEX) // client limit
|
||||
break;
|
||||
} while (result->NextRow());
|
||||
delete result;
|
||||
}
|
||||
|
||||
void Player::_LoadBGData(QueryResult* result)
|
||||
void Player::_LoadBGData(QueryResult_AutoPtr result)
|
||||
{
|
||||
if (!result)
|
||||
return;
|
||||
@@ -15321,13 +15295,11 @@ void Player::_LoadBGData(QueryResult* result)
|
||||
m_bgData.taxiPath[0] = fields[7].GetUInt32();
|
||||
m_bgData.taxiPath[1] = fields[8].GetUInt32();
|
||||
m_bgData.mountSpell = fields[9].GetUInt32();
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
bool Player::LoadPositionFromDB(uint32& mapid, float& x,float& y,float& z,float& o, bool& in_flight, uint64 guid)
|
||||
{
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT position_x,position_y,position_z,orientation,map,taxi_path FROM characters WHERE guid = '%u'",GUID_LOPART(guid));
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT position_x,position_y,position_z,orientation,map,taxi_path FROM characters WHERE guid = '%u'",GUID_LOPART(guid));
|
||||
if(!result)
|
||||
return false;
|
||||
|
||||
@@ -15340,13 +15312,12 @@ bool Player::LoadPositionFromDB(uint32& mapid, float& x,float& y,float& z,float&
|
||||
mapid = fields[4].GetUInt32();
|
||||
in_flight = !fields[5].GetCppString().empty();
|
||||
|
||||
delete result;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Player::LoadValuesArrayFromDB(Tokens& data, uint64 guid)
|
||||
{
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT data FROM characters WHERE guid='%u'",GUID_LOPART(guid));
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT data FROM characters WHERE guid='%u'",GUID_LOPART(guid));
|
||||
if( !result )
|
||||
return false;
|
||||
|
||||
@@ -15354,8 +15325,6 @@ bool Player::LoadValuesArrayFromDB(Tokens& data, uint64 guid)
|
||||
|
||||
data = StrSplit(fields[0].GetCppString(), " ");
|
||||
|
||||
delete result;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -15398,7 +15367,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
||||
{
|
||||
//// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
||||
//QueryResult *result = CharacterDatabase.PQuery("SELECT guid, account, data, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags, position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, dungeon_difficulty, arena_pending_points, instance_id, speccount, activespec FROM characters WHERE guid = '%u'", guid);
|
||||
QueryResult *result = holder->GetResult(PLAYER_LOGIN_QUERY_LOADFROM);
|
||||
QueryResult_AutoPtr result = holder->GetResult(PLAYER_LOGIN_QUERY_LOADFROM);
|
||||
|
||||
if(!result)
|
||||
{
|
||||
@@ -15415,7 +15384,6 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
||||
if( dbAccountId != GetSession()->GetAccountId() )
|
||||
{
|
||||
sLog.outError("Player (GUID: %u) loading from wrong account (is: %u, should be: %u)",guid,GetSession()->GetAccountId(),dbAccountId);
|
||||
delete result;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -15427,7 +15395,6 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
||||
if (ObjectMgr::CheckPlayerName(m_name) != CHAR_NAME_SUCCESS ||
|
||||
(GetSession()->GetSecurity() == SEC_PLAYER && objmgr.IsReservedName(m_name)))
|
||||
{
|
||||
delete result;
|
||||
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid ='%u'", uint32(AT_LOGIN_RENAME),guid);
|
||||
return false;
|
||||
}
|
||||
@@ -15435,7 +15402,6 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
||||
if(!LoadValues( fields[2].GetString()))
|
||||
{
|
||||
sLog.outError("Player #%d have broken data in `data` field. Can't be loaded.", GUID_LOPART(guid));
|
||||
delete result;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -15485,10 +15451,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
||||
|
||||
// load home bind and check in same time class/race pair, it used later for restore broken positions
|
||||
if(!_LoadHomeBind(holder->GetResult(PLAYER_LOGIN_QUERY_LOADHOMEBIND)))
|
||||
{
|
||||
delete result;
|
||||
return false;
|
||||
}
|
||||
|
||||
InitPrimaryProfessions(); // to max set before any spell loaded
|
||||
|
||||
@@ -15720,7 +15683,6 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
||||
if (!map)
|
||||
{
|
||||
sLog.outError("ERROR: Player (guidlow %d) has invalid default map coordinates (X: %f Y: %f Z: %f O: %f). or instance couldn't be created",guid,GetPositionX(),GetPositionY(),GetPositionZ(),GetOrientation());
|
||||
delete result;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -15860,7 +15822,6 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
||||
|
||||
m_specsCount = fields[42].GetUInt8();
|
||||
m_activeSpec = fields[43].GetUInt8();
|
||||
delete result;
|
||||
|
||||
// sanity check
|
||||
if (m_specsCount > MAX_TALENT_SPECS || m_activeSpec > MAX_TALENT_SPEC ||
|
||||
@@ -16023,7 +15984,7 @@ bool Player::isAllowedToLoot(Creature* creature)
|
||||
return !creature->hasLootRecipient();
|
||||
}
|
||||
|
||||
void Player::_LoadActions(QueryResult *result, bool startup)
|
||||
void Player::_LoadActions(QueryResult_AutoPtr result, bool startup)
|
||||
{
|
||||
if (result)
|
||||
{
|
||||
@@ -16050,12 +16011,10 @@ void Player::_LoadActions(QueryResult *result, bool startup)
|
||||
}
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
|
||||
void Player::_LoadAuras(QueryResult *result, uint32 timediff)
|
||||
void Player::_LoadAuras(QueryResult_AutoPtr result, uint32 timediff)
|
||||
{
|
||||
sLog.outDebug("Loading auras for player %u",GetGUIDLow());
|
||||
|
||||
@@ -16121,8 +16080,6 @@ void Player::_LoadAuras(QueryResult *result, uint32 timediff)
|
||||
}
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
if(getClass() == CLASS_WARRIOR && !HasAuraType(SPELL_AURA_MOD_SHAPESHIFT))
|
||||
@@ -16173,7 +16130,7 @@ void Player::LoadCorpse()
|
||||
}
|
||||
}
|
||||
|
||||
void Player::_LoadInventory(QueryResult *result, uint32 timediff)
|
||||
void Player::_LoadInventory(QueryResult_AutoPtr result, uint32 timediff)
|
||||
{
|
||||
//QueryResult *result = CharacterDatabase.PQuery("SELECT data,bag,slot,item,item_template FROM character_inventory JOIN item_instance ON character_inventory.item = item_instance.guid WHERE character_inventory.guid = '%u' ORDER BY bag,slot", GetGUIDLow());
|
||||
std::map<uint64, Bag*> bagMap; // fast guid lookup for bags
|
||||
@@ -16309,7 +16266,6 @@ void Player::_LoadInventory(QueryResult *result, uint32 timediff)
|
||||
}
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
m_itemUpdateQueueBlocked = false;
|
||||
|
||||
// send by mail problematic items
|
||||
@@ -16339,7 +16295,7 @@ void Player::_LoadInventory(QueryResult *result, uint32 timediff)
|
||||
void Player::_LoadMailedItems(Mail *mail)
|
||||
{
|
||||
// data needs to be at first place for Item::LoadFromDB
|
||||
QueryResult* result = CharacterDatabase.PQuery("SELECT data, item_guid, item_template FROM mail_items JOIN item_instance ON item_guid = guid WHERE mail_id='%u'", mail->messageID);
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT data, item_guid, item_template FROM mail_items JOIN item_instance ON item_guid = guid WHERE mail_id='%u'", mail->messageID);
|
||||
if (!result)
|
||||
return;
|
||||
|
||||
@@ -16374,11 +16330,9 @@ void Player::_LoadMailedItems(Mail *mail)
|
||||
|
||||
AddMItem(item);
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
void Player::_LoadMailInit(QueryResult *resultUnread, QueryResult *resultDelivery)
|
||||
void Player::_LoadMailInit(QueryResult_AutoPtr resultUnread, QueryResult_AutoPtr resultDelivery)
|
||||
{
|
||||
//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);
|
||||
@@ -16386,7 +16340,6 @@ void Player::_LoadMailInit(QueryResult *resultUnread, QueryResult *resultDeliver
|
||||
{
|
||||
Field *fieldMail = resultUnread->Fetch();
|
||||
unReadMails = fieldMail[0].GetUInt8();
|
||||
delete resultUnread;
|
||||
}
|
||||
|
||||
// store nearest delivery time (it > 0 and if it < current then at next player update SendNewMaill will be called)
|
||||
@@ -16395,7 +16348,6 @@ void Player::_LoadMailInit(QueryResult *resultUnread, QueryResult *resultDeliver
|
||||
{
|
||||
Field *fieldMail = resultDelivery->Fetch();
|
||||
m_nextMailDelivereTime = (time_t)fieldMail[0].GetUInt64();
|
||||
delete resultDelivery;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16403,7 +16355,7 @@ void Player::_LoadMail()
|
||||
{
|
||||
m_mail.clear();
|
||||
//mails are in right order 0 1 2 3 4 5 6 7 8 9 10 11 12 13
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT id,messageType,sender,receiver,subject,itemTextId,has_items,expire_time,deliver_time,money,cod,checked,stationery,mailTemplateId FROM mail WHERE receiver = '%u' ORDER BY id DESC",GetGUIDLow());
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT id,messageType,sender,receiver,subject,itemTextId,has_items,expire_time,deliver_time,money,cod,checked,stationery,mailTemplateId FROM mail WHERE receiver = '%u' ORDER BY id DESC",GetGUIDLow());
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
@@ -16438,7 +16390,6 @@ void Player::_LoadMail()
|
||||
|
||||
m_mail.push_back(m);
|
||||
} while (result->NextRow());
|
||||
delete result;
|
||||
}
|
||||
m_mailsLoaded = true;
|
||||
}
|
||||
@@ -16455,7 +16406,7 @@ void Player::LoadPet()
|
||||
}
|
||||
}
|
||||
|
||||
void Player::_LoadQuestStatus(QueryResult *result)
|
||||
void Player::_LoadQuestStatus(QueryResult_AutoPtr result)
|
||||
{
|
||||
mQuestStatus.clear();
|
||||
|
||||
@@ -16557,8 +16508,6 @@ void Player::_LoadQuestStatus(QueryResult *result)
|
||||
}
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
// clear quest log tail
|
||||
@@ -16566,7 +16515,7 @@ void Player::_LoadQuestStatus(QueryResult *result)
|
||||
SetQuestSlot(i, 0);
|
||||
}
|
||||
|
||||
void Player::_LoadDailyQuestStatus(QueryResult *result)
|
||||
void Player::_LoadDailyQuestStatus(QueryResult_AutoPtr result)
|
||||
{
|
||||
for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
|
||||
SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx,0);
|
||||
@@ -16602,14 +16551,12 @@ void Player::_LoadDailyQuestStatus(QueryResult *result)
|
||||
sLog.outDebug("Daily quest {%u} cooldown for player (GUID: %u)", quest_id, GetGUIDLow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
m_DailyQuestChanged = false;
|
||||
}
|
||||
|
||||
void Player::_LoadSpells(QueryResult *result)
|
||||
void Player::_LoadSpells(QueryResult_AutoPtr result)
|
||||
{
|
||||
//QueryResult *result = CharacterDatabase.PQuery("SELECT spell,active,disabled FROM character_spell WHERE guid = '%u'",GetGUIDLow());
|
||||
|
||||
@@ -16622,18 +16569,15 @@ void Player::_LoadSpells(QueryResult *result)
|
||||
addSpell(fields[0].GetUInt32(), fields[1].GetBool(), false, false, fields[2].GetBool());
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
|
||||
void Player::_LoadGroup(QueryResult *result)
|
||||
void Player::_LoadGroup(QueryResult_AutoPtr result)
|
||||
{
|
||||
//QueryResult *result = CharacterDatabase.PQuery("SELECT leaderGuid FROM group_member WHERE memberGuid='%u'", GetGUIDLow());
|
||||
if (result)
|
||||
{
|
||||
uint64 leaderGuid = MAKE_NEW_GUID((*result)[0].GetUInt32(), 0, HIGHGUID_PLAYER);
|
||||
delete result;
|
||||
if (Group* group = objmgr.GetGroupByLeader(leaderGuid))
|
||||
{
|
||||
uint8 subgroup = group->GetMemberGroup(GetGUID());
|
||||
@@ -16648,7 +16592,7 @@ void Player::_LoadGroup(QueryResult *result)
|
||||
}
|
||||
}
|
||||
|
||||
void Player::_LoadBoundInstances(QueryResult *result)
|
||||
void Player::_LoadBoundInstances(QueryResult_AutoPtr result)
|
||||
{
|
||||
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
|
||||
m_boundInstances[i].clear();
|
||||
@@ -16706,7 +16650,6 @@ void Player::_LoadBoundInstances(QueryResult *result)
|
||||
if (InstanceSave *save = sInstanceSaveManager.AddInstanceSave(mapId, instanceId, Difficulty(difficulty), resetTime, !perm, true))
|
||||
BindToInstance(save, perm, true);
|
||||
} while (result->NextRow());
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16986,7 +16929,7 @@ bool Player::Satisfy(AccessRequirement const *ar, uint32 target_map, bool report
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Player::_LoadHomeBind(QueryResult *result)
|
||||
bool Player::_LoadHomeBind(QueryResult_AutoPtr result)
|
||||
{
|
||||
PlayerInfo const *info = objmgr.GetPlayerInfo(getRace(), getClass());
|
||||
if (!info)
|
||||
@@ -17005,7 +16948,6 @@ bool Player::_LoadHomeBind(QueryResult *result)
|
||||
m_homebindX = fields[2].GetFloat();
|
||||
m_homebindY = fields[3].GetFloat();
|
||||
m_homebindZ = fields[4].GetFloat();
|
||||
delete result;
|
||||
|
||||
MapEntry const* bindMapEntry = sMapStore.LookupEntry(m_homebindMapId);
|
||||
|
||||
@@ -17638,7 +17580,7 @@ void Player::SetFloatValueInDB(uint16 index, float value, uint64 guid)
|
||||
void Player::Customize(uint64 guid, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair)
|
||||
{
|
||||
// 0
|
||||
QueryResult* result = CharacterDatabase.PQuery("SELECT playerBytes2 FROM characters WHERE guid = '%u'", GUID_LOPART(guid));
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT playerBytes2 FROM characters WHERE guid = '%u'", GUID_LOPART(guid));
|
||||
if(!result)
|
||||
return;
|
||||
|
||||
@@ -17649,8 +17591,6 @@ void Player::Customize(uint64 guid, uint8 gender, uint8 skin, uint8 face, uint8
|
||||
player_bytes2 |= facialHair;
|
||||
|
||||
CharacterDatabase.PExecute("UPDATE characters SET gender = '%u', playerBytes = '%u', playerBytes2 = '%u' WHERE guid = '%u'", gender, skin | (face << 8) | (hairStyle << 16) | (hairColor << 24), player_bytes2, GUID_LOPART(guid));
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
void Player::SendAttackSwingDeadTarget()
|
||||
@@ -18448,7 +18388,7 @@ void Player::SendProficiency(uint8 pr1, uint32 pr2)
|
||||
|
||||
void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type)
|
||||
{
|
||||
QueryResult *result = NULL;
|
||||
QueryResult_AutoPtr result = QueryResult_AutoPtr(NULL);
|
||||
if(type==10)
|
||||
result = CharacterDatabase.PQuery("SELECT ownerguid,petitionguid FROM petition_sign WHERE playerguid = '%u'", GUID_LOPART(guid));
|
||||
else
|
||||
@@ -18468,8 +18408,6 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type)
|
||||
|
||||
} while ( result->NextRow() );
|
||||
|
||||
delete result;
|
||||
|
||||
if(type==10)
|
||||
CharacterDatabase.PExecute("DELETE FROM petition_sign WHERE playerguid = '%u'", GUID_LOPART(guid));
|
||||
else
|
||||
@@ -18492,7 +18430,7 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type)
|
||||
|
||||
void Player::LeaveAllArenaTeams(uint64 guid)
|
||||
{
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT arena_team_member.arenateamid FROM arena_team_member JOIN arena_team ON arena_team_member.arenateamid = arena_team.arenateamid WHERE guid='%u'", GUID_LOPART(guid));
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT arena_team_member.arenateamid FROM arena_team_member JOIN arena_team ON arena_team_member.arenateamid = arena_team.arenateamid WHERE guid='%u'", GUID_LOPART(guid));
|
||||
if(!result)
|
||||
return;
|
||||
|
||||
@@ -18507,8 +18445,6 @@ void Player::LeaveAllArenaTeams(uint64 guid)
|
||||
at->DelMember(guid);
|
||||
}
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
void Player::SetRestBonus (float rest_bonus_new)
|
||||
@@ -21906,7 +21842,7 @@ void Player::learnSpellHighRank(uint32 spellid)
|
||||
learnSpellHighRank(next);
|
||||
}
|
||||
|
||||
void Player::_LoadSkills(QueryResult *result)
|
||||
void Player::_LoadSkills(QueryResult_AutoPtr result)
|
||||
{
|
||||
// 0 1 2
|
||||
// SetPQuery(PLAYER_LOGIN_QUERY_LOADSKILLS, "SELECT skill, value, max FROM character_skills WHERE guid = '%u'", GUID_LOPART(m_guid));
|
||||
@@ -21969,7 +21905,6 @@ void Player::_LoadSkills(QueryResult *result)
|
||||
break;
|
||||
}
|
||||
} while (result->NextRow());
|
||||
delete result;
|
||||
}
|
||||
|
||||
for (; count < PLAYER_MAX_SKILLS; ++count)
|
||||
@@ -22813,7 +22748,7 @@ void Player::SetMap(Map * map)
|
||||
m_mapRef.link(map, this);
|
||||
}
|
||||
|
||||
void Player::_LoadGlyphs(QueryResult *result)
|
||||
void Player::_LoadGlyphs(QueryResult_AutoPtr result)
|
||||
{
|
||||
// SetPQuery(PLAYER_LOGIN_QUERY_LOADGLYPHS, "SELECT spec, glyph1, glyph2, glyph3, glyph4, glyph5, glyph6 from character_glyphs WHERE guid = '%u'", GUID_LOPART(m_guid));
|
||||
if (!result)
|
||||
@@ -22835,8 +22770,6 @@ void Player::_LoadGlyphs(QueryResult *result)
|
||||
m_Glyphs[spec][5] = fields[6].GetUInt32();
|
||||
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
void Player::_SaveGlyphs()
|
||||
@@ -22849,7 +22782,7 @@ void Player::_SaveGlyphs()
|
||||
}
|
||||
}
|
||||
|
||||
void Player::_LoadTalents(QueryResult *result)
|
||||
void Player::_LoadTalents(QueryResult_AutoPtr result)
|
||||
{
|
||||
// SetPQuery(PLAYER_LOGIN_QUERY_LOADTALENTS, "SELECT spell, spec FROM character_talent WHERE guid = '%u'", GUID_LOPART(m_guid));
|
||||
if (result)
|
||||
@@ -22861,8 +22794,6 @@ void Player::_LoadTalents(QueryResult *result)
|
||||
AddTalent(fields[0].GetUInt32(), fields[1].GetUInt32(), false);
|
||||
}
|
||||
while( result->NextRow() );
|
||||
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23046,7 +22977,7 @@ void Player::ActivateSpec(uint8 spec)
|
||||
// Let client clear his current Actions
|
||||
SendActionButtons(2);
|
||||
m_actionButtons.clear();
|
||||
if (QueryResult *result = CharacterDatabase.PQuery("SELECT button,action,type FROM character_action WHERE guid = '%u' AND spec = '%u' ORDER BY button", GetGUIDLow(), m_activeSpec))
|
||||
if (QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT button,action,type FROM character_action WHERE guid = '%u' AND spec = '%u' ORDER BY button", GetGUIDLow(), m_activeSpec))
|
||||
_LoadActions(result, false);
|
||||
|
||||
ResummonPetTemporaryUnSummonedIfAny();
|
||||
|
||||
+22
-22
@@ -970,7 +970,7 @@ class TRINITY_DLL_SPEC Player : public Unit, public GridObject<Player>
|
||||
explicit Player (WorldSession *session);
|
||||
~Player ( );
|
||||
|
||||
void CleanupsBeforeDelete();
|
||||
void CleanupsBeforeDelete(bool finalCleanup = true);
|
||||
|
||||
static UpdateMask updateVisualBits;
|
||||
static void InitVisibleBits();
|
||||
@@ -1002,7 +1002,7 @@ class TRINITY_DLL_SPEC Player : public Unit, public GridObject<Player>
|
||||
|
||||
void Update( uint32 time );
|
||||
|
||||
static bool BuildEnumData( QueryResult * result, WorldPacket * p_data );
|
||||
static bool BuildEnumData( QueryResult_AutoPtr result, WorldPacket * p_data );
|
||||
|
||||
void SetInWater(bool apply);
|
||||
|
||||
@@ -1377,7 +1377,7 @@ class TRINITY_DLL_SPEC Player : public Unit, public GridObject<Player>
|
||||
bool LoadFromDB(uint32 guid, SqlQueryHolder *holder);
|
||||
bool isBeingLoaded() const { return GetSession()->PlayerLoading();}
|
||||
|
||||
bool MinimalLoadFromDB(QueryResult *result, uint32 guid);
|
||||
bool MinimalLoadFromDB(QueryResult_AutoPtr result, uint32 guid);
|
||||
static bool LoadValuesArrayFromDB(Tokens& data,uint64 guid);
|
||||
static uint32 GetUInt32ValueFromArray(Tokens const& data, uint16 index);
|
||||
static float GetFloatValueFromArray(Tokens const& data, uint16 index);
|
||||
@@ -1596,7 +1596,7 @@ class TRINITY_DLL_SPEC Player : public Unit, public GridObject<Player>
|
||||
void RemoveCategoryCooldown(uint32 cat);
|
||||
void RemoveArenaSpellCooldowns();
|
||||
void RemoveAllSpellCooldown();
|
||||
void _LoadSpellCooldowns(QueryResult *result);
|
||||
void _LoadSpellCooldowns(QueryResult_AutoPtr result);
|
||||
void _SaveSpellCooldowns();
|
||||
void SetLastPotionId(uint32 item_id) { m_lastPotionId = item_id; }
|
||||
void UpdatePotionCooldown(Spell* spell = NULL);
|
||||
@@ -2326,27 +2326,27 @@ Spell * m_spellModTakingSpell;
|
||||
/*** LOAD SYSTEM ***/
|
||||
/*********************************************************/
|
||||
|
||||
void _LoadActions(QueryResult *result, bool startup);
|
||||
void _LoadAuras(QueryResult *result, uint32 timediff);
|
||||
void _LoadActions(QueryResult_AutoPtr result, bool startup);
|
||||
void _LoadAuras(QueryResult_AutoPtr result, uint32 timediff);
|
||||
void _LoadGlyphAuras();
|
||||
void _LoadBoundInstances(QueryResult *result);
|
||||
void _LoadInventory(QueryResult *result, uint32 timediff);
|
||||
void _LoadMailInit(QueryResult *resultUnread, QueryResult *resultDelivery);
|
||||
void _LoadBoundInstances(QueryResult_AutoPtr result);
|
||||
void _LoadInventory(QueryResult_AutoPtr result, uint32 timediff);
|
||||
void _LoadMailInit(QueryResult_AutoPtr resultUnread, QueryResult_AutoPtr resultDelivery);
|
||||
void _LoadMail();
|
||||
void _LoadMailedItems(Mail *mail);
|
||||
void _LoadQuestStatus(QueryResult *result);
|
||||
void _LoadDailyQuestStatus(QueryResult *result);
|
||||
void _LoadGroup(QueryResult *result);
|
||||
void _LoadSkills(QueryResult *result);
|
||||
void _LoadSpells(QueryResult *result);
|
||||
void _LoadFriendList(QueryResult *result);
|
||||
bool _LoadHomeBind(QueryResult *result);
|
||||
void _LoadDeclinedNames(QueryResult *result);
|
||||
void _LoadArenaTeamInfo(QueryResult *result);
|
||||
void _LoadEquipmentSets(QueryResult *result);
|
||||
void _LoadBGData(QueryResult* result);
|
||||
void _LoadGlyphs(QueryResult *result);
|
||||
void _LoadTalents(QueryResult *result);
|
||||
void _LoadQuestStatus(QueryResult_AutoPtr result);
|
||||
void _LoadDailyQuestStatus(QueryResult_AutoPtr result);
|
||||
void _LoadGroup(QueryResult_AutoPtr result);
|
||||
void _LoadSkills(QueryResult_AutoPtr result);
|
||||
void _LoadSpells(QueryResult_AutoPtr result);
|
||||
void _LoadFriendList(QueryResult_AutoPtr result);
|
||||
bool _LoadHomeBind(QueryResult_AutoPtr result);
|
||||
void _LoadDeclinedNames(QueryResult_AutoPtr result);
|
||||
void _LoadArenaTeamInfo(QueryResult_AutoPtr result);
|
||||
void _LoadEquipmentSets(QueryResult_AutoPtr result);
|
||||
void _LoadBGData(QueryResult_AutoPtr result);
|
||||
void _LoadGlyphs(QueryResult_AutoPtr result);
|
||||
void _LoadTalents(QueryResult_AutoPtr result);
|
||||
|
||||
/*********************************************************/
|
||||
/*** SAVE SYSTEM ***/
|
||||
|
||||
+6
-17
@@ -198,7 +198,7 @@ bool changetokGuid(std::string &str, int n, std::map<uint32, uint32> &guidMap, u
|
||||
return changetoknth(str, n, chritem, false, nonzero);
|
||||
}
|
||||
|
||||
std::string CreateDumpString(char const* tableName, QueryResult *result)
|
||||
std::string CreateDumpString(char const* tableName, QueryResult_AutoPtr result)
|
||||
{
|
||||
if(!tableName || !result) return "";
|
||||
std::ostringstream ss;
|
||||
@@ -248,7 +248,7 @@ std::string PlayerDumpWriter::GenerateWhereStr(char const* field, GUIDs const& g
|
||||
return wherestr.str();
|
||||
}
|
||||
|
||||
void StoreGUID(QueryResult *result,uint32 field,std::set<uint32>& guids)
|
||||
void StoreGUID(QueryResult_AutoPtr result,uint32 field,std::set<uint32>& guids)
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
uint32 guid = fields[field].GetUInt32();
|
||||
@@ -256,7 +256,7 @@ void StoreGUID(QueryResult *result,uint32 field,std::set<uint32>& guids)
|
||||
guids.insert(guid);
|
||||
}
|
||||
|
||||
void StoreGUID(QueryResult *result,uint32 data,uint32 field, std::set<uint32>& guids)
|
||||
void StoreGUID(QueryResult_AutoPtr result,uint32 data,uint32 field, std::set<uint32>& guids)
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
std::string dataStr = fields[data].GetCppString();
|
||||
@@ -301,7 +301,7 @@ void PlayerDumpWriter::DumpTable(std::string& dump, uint32 guid, char const*tabl
|
||||
else // not set case, get single guid string
|
||||
wherestr = GenerateWhereStr(fieldname,guid);
|
||||
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT * FROM %s WHERE %s", tableFrom, wherestr.c_str());
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT * FROM %s WHERE %s", tableFrom, wherestr.c_str());
|
||||
if(!result)
|
||||
return;
|
||||
|
||||
@@ -329,8 +329,6 @@ void PlayerDumpWriter::DumpTable(std::string& dump, uint32 guid, char const*tabl
|
||||
dump += "\n";
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
}
|
||||
while(guids && guids_itr != guids->end()); // not set case iterate single time, set case iterate for all guids
|
||||
}
|
||||
@@ -400,13 +398,12 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||
{
|
||||
// check character count
|
||||
{
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT COUNT(guid) FROM characters WHERE account = '%d'", account);
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT COUNT(guid) FROM characters WHERE account = '%d'", account);
|
||||
uint8 charcount = 0;
|
||||
if (result)
|
||||
{
|
||||
Field *fields=result->Fetch();
|
||||
charcount = fields[0].GetUInt8();
|
||||
delete result;
|
||||
|
||||
if (charcount >= 10)
|
||||
return DUMP_TOO_MANY_CHARS;
|
||||
@@ -417,7 +414,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||
if (!fin)
|
||||
return DUMP_FILE_OPEN_ERROR;
|
||||
|
||||
QueryResult * result = NULL;
|
||||
QueryResult_AutoPtr result = QueryResult_AutoPtr(NULL);
|
||||
char newguid[20], chraccount[20], newpetid[20], currpetid[20], lastpetid[20];
|
||||
|
||||
// make sure the same guid doesn't already exist and is safe to use
|
||||
@@ -426,10 +423,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||
{
|
||||
result = CharacterDatabase.PQuery("SELECT * FROM characters WHERE guid = '%d'", guid);
|
||||
if (result)
|
||||
{
|
||||
guid = objmgr.m_hiCharGuid; // use first free if exists
|
||||
delete result;
|
||||
}
|
||||
else incHighest = false;
|
||||
}
|
||||
else
|
||||
@@ -444,10 +438,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||
CharacterDatabase.escape_string(name); // for safe, we use name only for sql quearies anyway
|
||||
result = CharacterDatabase.PQuery("SELECT * FROM characters WHERE name = '%s'", name.c_str());
|
||||
if (result)
|
||||
{
|
||||
name = ""; // use the one from the dump
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
else
|
||||
name = "";
|
||||
@@ -557,8 +548,6 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||
result = CharacterDatabase.PQuery("SELECT * FROM characters WHERE name = '%s'", name.c_str());
|
||||
if (result)
|
||||
{
|
||||
delete result;
|
||||
|
||||
if(!changenth(line, 37, "1")) // rename on login: `at_login` field 37 in raw field list
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
}
|
||||
|
||||
@@ -350,7 +350,7 @@ PoolHandler::PoolHandler()
|
||||
|
||||
void PoolHandler::LoadFromDB()
|
||||
{
|
||||
QueryResult *result = WorldDatabase.Query("SELECT MAX(entry) FROM pool_template");
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT MAX(entry) FROM pool_template");
|
||||
if (!result)
|
||||
{
|
||||
sLog.outString(">> Table pool_template is empty.");
|
||||
@@ -361,7 +361,6 @@ void PoolHandler::LoadFromDB()
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
max_pool_id = fields[0].GetUInt16();
|
||||
delete result;
|
||||
}
|
||||
|
||||
mPoolTemplate.resize(max_pool_id + 1);
|
||||
@@ -392,8 +391,6 @@ void PoolHandler::LoadFromDB()
|
||||
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u objects pools", count );
|
||||
|
||||
@@ -458,7 +455,6 @@ void PoolHandler::LoadFromDB()
|
||||
} while (result->NextRow());
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u creatures in pools", count );
|
||||
delete result;
|
||||
}
|
||||
|
||||
// Gameobjects
|
||||
@@ -530,7 +526,6 @@ void PoolHandler::LoadFromDB()
|
||||
} while( result->NextRow() );
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u gameobject in pools", count );
|
||||
delete result;
|
||||
}
|
||||
|
||||
// Pool of pools
|
||||
@@ -619,7 +614,6 @@ void PoolHandler::LoadFromDB()
|
||||
}
|
||||
}
|
||||
}
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u pools in mother pools", count );
|
||||
@@ -629,7 +623,7 @@ void PoolHandler::LoadFromDB()
|
||||
// The initialize method will spawn all pools not in an event and not in another pool, this is why there is 2 left joins with 2 null checks
|
||||
void PoolHandler::Initialize()
|
||||
{
|
||||
QueryResult *result = WorldDatabase.Query("SELECT DISTINCT pool_template.entry FROM pool_template LEFT JOIN game_event_pool ON pool_template.entry=game_event_pool.pool_entry LEFT JOIN pool_pool ON pool_template.entry=pool_pool.pool_id WHERE game_event_pool.pool_entry IS NULL AND pool_pool.pool_id IS NULL");
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT DISTINCT pool_template.entry FROM pool_template LEFT JOIN game_event_pool ON pool_template.entry=game_event_pool.pool_entry LEFT JOIN pool_pool ON pool_template.entry=pool_pool.pool_id WHERE game_event_pool.pool_entry IS NULL AND pool_pool.pool_id IS NULL");
|
||||
uint32 count=0;
|
||||
if (result)
|
||||
{
|
||||
@@ -647,7 +641,6 @@ void PoolHandler::Initialize()
|
||||
SpawnPool(pool_entry, 0, TYPEID_UNIT);
|
||||
count++;
|
||||
} while (result->NextRow());
|
||||
delete result;
|
||||
}
|
||||
|
||||
sLog.outBasic("Pool handling system initialized, %u pools spawned.", count);
|
||||
|
||||
@@ -77,17 +77,14 @@ void WorldSession::SendNameQueryOpcodeFromDB(uint64 guid)
|
||||
GUID_LOPART(guid));
|
||||
}
|
||||
|
||||
void WorldSession::SendNameQueryOpcodeFromDBCallBack(QueryResult *result, uint32 accountId)
|
||||
void WorldSession::SendNameQueryOpcodeFromDBCallBack(QueryResult_AutoPtr result, uint32 accountId)
|
||||
{
|
||||
if(!result)
|
||||
return;
|
||||
|
||||
WorldSession * session = sWorld.FindSession(accountId);
|
||||
if(!session)
|
||||
{
|
||||
delete result;
|
||||
return;
|
||||
}
|
||||
|
||||
Field *fields = result->Fetch();
|
||||
uint32 guid = fields[0].GetUInt32();
|
||||
@@ -122,7 +119,6 @@ void WorldSession::SendNameQueryOpcodeFromDBCallBack(QueryResult *result, uint32
|
||||
data << uint8(0); // is not declined
|
||||
|
||||
session->SendPacket( &data );
|
||||
delete result;
|
||||
}
|
||||
|
||||
void WorldSession::HandleNameQueryOpcode( WorldPacket & recv_data )
|
||||
|
||||
@@ -459,7 +459,7 @@ void ReputationMgr::SetInactive(FactionState* faction, bool inactive)
|
||||
faction->Changed = true;
|
||||
}
|
||||
|
||||
void ReputationMgr::LoadFromDB(QueryResult *result)
|
||||
void ReputationMgr::LoadFromDB(QueryResult_AutoPtr result)
|
||||
{
|
||||
// Set initial reputations (so everything is nifty before DB data load)
|
||||
Initialize();
|
||||
@@ -513,8 +513,6 @@ void ReputationMgr::LoadFromDB(QueryResult *result)
|
||||
}
|
||||
}
|
||||
while( result->NextRow() );
|
||||
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "SharedDefines.h"
|
||||
#include "Language.h"
|
||||
#include "DBCStructure.h"
|
||||
#include "QueryResult.h"
|
||||
#include <map>
|
||||
|
||||
static uint32 ReputationRankStrIndex[MAX_REPUTATION_RANK] =
|
||||
@@ -68,7 +69,7 @@ class ReputationMgr
|
||||
~ReputationMgr() {}
|
||||
|
||||
void SaveToDB();
|
||||
void LoadFromDB(QueryResult *result);
|
||||
void LoadFromDB(QueryResult_AutoPtr result);
|
||||
public: // statics
|
||||
static const int32 PointsInRank[MAX_REPUTATION_RANK];
|
||||
static const int32 Reputation_Cap = 42999;
|
||||
|
||||
+21
-29
@@ -39,15 +39,14 @@ SystemMgr& SystemMgr::Instance()
|
||||
void SystemMgr::LoadVersion()
|
||||
{
|
||||
//Get Version information
|
||||
QueryResult* pResult = TScriptDB.PQuery("SELECT script_version FROM version LIMIT 1");
|
||||
QueryResult_AutoPtr Result = TScriptDB.PQuery("SELECT script_version FROM version LIMIT 1");
|
||||
|
||||
if (pResult)
|
||||
if (Result)
|
||||
{
|
||||
Field* pFields = pResult->Fetch();
|
||||
Field* pFields = Result->Fetch();
|
||||
|
||||
outstring_log("TSCR: Database version is: %s", pFields[0].GetString());
|
||||
outstring_log("");
|
||||
delete pResult;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -61,19 +60,19 @@ void SystemMgr::LoadScriptTexts()
|
||||
outstring_log("TSCR: Loading Script Texts...");
|
||||
LoadTrinityStrings(TScriptDB,"script_texts",TEXT_SOURCE_RANGE,1+(TEXT_SOURCE_RANGE*2));
|
||||
|
||||
QueryResult* pResult = TScriptDB.PQuery("SELECT entry, sound, type, language, emote FROM script_texts");
|
||||
QueryResult_AutoPtr Result = TScriptDB.PQuery("SELECT entry, sound, type, language, emote FROM script_texts");
|
||||
|
||||
outstring_log("TSCR: Loading Script Texts additional data...");
|
||||
|
||||
if (pResult)
|
||||
if (Result)
|
||||
{
|
||||
barGoLink bar(pResult->GetRowCount());
|
||||
barGoLink bar(Result->GetRowCount());
|
||||
uint32 uiCount = 0;
|
||||
|
||||
do
|
||||
{
|
||||
bar.step();
|
||||
Field* pFields = pResult->Fetch();
|
||||
Field* pFields = Result->Fetch();
|
||||
StringTextData pTemp;
|
||||
|
||||
int32 iId = pFields[0].GetInt32();
|
||||
@@ -108,8 +107,7 @@ void SystemMgr::LoadScriptTexts()
|
||||
|
||||
m_mTextDataMap[iId] = pTemp;
|
||||
++uiCount;
|
||||
} while (pResult->NextRow());
|
||||
delete pResult;
|
||||
} while (Result->NextRow());
|
||||
|
||||
outstring_log("");
|
||||
outstring_log(">> Loaded %u additional Script Texts data.", uiCount);
|
||||
@@ -128,19 +126,19 @@ void SystemMgr::LoadScriptTextsCustom()
|
||||
outstring_log("TSCR: Loading Custom Texts...");
|
||||
LoadTrinityStrings(TScriptDB,"custom_texts",TEXT_SOURCE_RANGE*2,1+(TEXT_SOURCE_RANGE*3));
|
||||
|
||||
QueryResult* pResult = TScriptDB.PQuery("SELECT entry, sound, type, language, emote FROM custom_texts");
|
||||
QueryResult_AutoPtr Result = TScriptDB.PQuery("SELECT entry, sound, type, language, emote FROM custom_texts");
|
||||
|
||||
outstring_log("TSCR: Loading Custom Texts additional data...");
|
||||
|
||||
if (pResult)
|
||||
if (Result)
|
||||
{
|
||||
barGoLink bar(pResult->GetRowCount());
|
||||
barGoLink bar(Result->GetRowCount());
|
||||
uint32 uiCount = 0;
|
||||
|
||||
do
|
||||
{
|
||||
bar.step();
|
||||
Field* pFields = pResult->Fetch();
|
||||
Field* pFields = Result->Fetch();
|
||||
StringTextData pTemp;
|
||||
|
||||
int32 iId = pFields[0].GetInt32();
|
||||
@@ -175,8 +173,7 @@ void SystemMgr::LoadScriptTextsCustom()
|
||||
|
||||
m_mTextDataMap[iId] = pTemp;
|
||||
++uiCount;
|
||||
} while (pResult->NextRow());
|
||||
delete pResult;
|
||||
} while (Result->NextRow());
|
||||
|
||||
outstring_log("");
|
||||
outstring_log(">> Loaded %u additional Custom Texts data.", uiCount);
|
||||
@@ -198,26 +195,23 @@ void SystemMgr::LoadScriptWaypoints()
|
||||
uint64 uiCreatureCount = 0;
|
||||
|
||||
// Load Waypoints
|
||||
QueryResult* pResult = TScriptDB.PQuery("SELECT COUNT(entry) FROM script_waypoint GROUP BY entry");
|
||||
if (pResult)
|
||||
{
|
||||
uiCreatureCount = pResult->GetRowCount();
|
||||
delete pResult;
|
||||
}
|
||||
QueryResult_AutoPtr Result = TScriptDB.PQuery("SELECT COUNT(entry) FROM script_waypoint GROUP BY entry");
|
||||
if (Result)
|
||||
uiCreatureCount = Result->GetRowCount();
|
||||
|
||||
outstring_log("TSCR: Loading Script Waypoints for %u creature(s)...", uiCreatureCount);
|
||||
|
||||
pResult = TScriptDB.PQuery("SELECT entry, pointid, location_x, location_y, location_z, waittime FROM script_waypoint ORDER BY pointid");
|
||||
Result = TScriptDB.PQuery("SELECT entry, pointid, location_x, location_y, location_z, waittime FROM script_waypoint ORDER BY pointid");
|
||||
|
||||
if (pResult)
|
||||
if (Result)
|
||||
{
|
||||
barGoLink bar(pResult->GetRowCount());
|
||||
barGoLink bar(Result->GetRowCount());
|
||||
uint32 uiNodeCount = 0;
|
||||
|
||||
do
|
||||
{
|
||||
bar.step();
|
||||
Field* pFields = pResult->Fetch();
|
||||
Field* pFields = Result->Fetch();
|
||||
ScriptPointMove pTemp;
|
||||
|
||||
pTemp.uiCreatureEntry = pFields[0].GetUInt32();
|
||||
@@ -241,9 +235,7 @@ void SystemMgr::LoadScriptWaypoints()
|
||||
|
||||
m_mPointMoveMap[uiEntry].push_back(pTemp);
|
||||
++uiNodeCount;
|
||||
} while (pResult->NextRow());
|
||||
|
||||
delete pResult;
|
||||
} while (Result->NextRow());
|
||||
|
||||
outstring_log("");
|
||||
outstring_log(">> Loaded %u Script Waypoint nodes.", uiNodeCount);
|
||||
|
||||
@@ -55,7 +55,7 @@ void LoadSkillDiscoveryTable()
|
||||
uint32 count = 0;
|
||||
|
||||
// 0 1 2 3
|
||||
QueryResult *result = WorldDatabase.Query("SELECT spellId, reqSpell, reqSkillValue, chance FROM skill_discovery_template");
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT spellId, reqSpell, reqSkillValue, chance FROM skill_discovery_template");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@@ -138,8 +138,6 @@ void LoadSkillDiscoveryTable()
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u skill discovery definitions", count );
|
||||
if (!ssNonDiscoverableEntries.str().empty())
|
||||
|
||||
@@ -59,7 +59,7 @@ void LoadSkillExtraItemTable()
|
||||
SkillExtraItemStore.clear(); // need for reload
|
||||
|
||||
// 0 1 2 3
|
||||
QueryResult *result = WorldDatabase.Query("SELECT spellId, requiredSpecialization, additionalCreateChance, additionalMaxNum FROM skill_extra_item_template");
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT spellId, requiredSpecialization, additionalCreateChance, additionalMaxNum FROM skill_extra_item_template");
|
||||
|
||||
if (result)
|
||||
{
|
||||
@@ -108,8 +108,6 @@ void LoadSkillExtraItemTable()
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u spell specialization definitions", count );
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ void SocialMgr::BroadcastToFriendListers(Player *player, WorldPacket *packet)
|
||||
}
|
||||
}
|
||||
|
||||
PlayerSocial *SocialMgr::LoadFromDB(QueryResult *result, uint32 guid)
|
||||
PlayerSocial *SocialMgr::LoadFromDB(QueryResult_AutoPtr result, uint32 guid)
|
||||
{
|
||||
PlayerSocial *social = &m_socialMap[guid];
|
||||
social->SetPlayerGUID(guid);
|
||||
@@ -318,7 +318,6 @@ PlayerSocial *SocialMgr::LoadFromDB(QueryResult *result, uint32 guid)
|
||||
break;
|
||||
}
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
return social;
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ class SocialMgr
|
||||
void SendFriendStatus(Player *player, FriendsResult result, uint32 friend_guid, bool broadcast);
|
||||
void BroadcastToFriendListers(Player *player, WorldPacket *packet);
|
||||
// Loading
|
||||
PlayerSocial *LoadFromDB(QueryResult *result, uint32 guid);
|
||||
PlayerSocial *LoadFromDB(QueryResult_AutoPtr result, uint32 guid);
|
||||
private:
|
||||
SocialMap m_socialMap;
|
||||
};
|
||||
|
||||
+21
-2
@@ -332,7 +332,7 @@ Aura * Aura::Create(SpellEntry const* spellproto, uint8 effMask, WorldObject * o
|
||||
|
||||
Aura::Aura(SpellEntry const* spellproto, uint8 effMask, WorldObject * owner, Unit * caster, int32 *baseAmount, Item * castItem, uint64 casterGUID) :
|
||||
m_spellProto(spellproto), m_owner(owner), m_casterGuid(casterGUID ? casterGUID : caster->GetGUID()), m_castItemGuid(castItem ? castItem->GetGUID() : 0),
|
||||
m_applyTime(time(NULL)), m_timeCla(0), m_isSingleTarget(false),
|
||||
m_applyTime(time(NULL)), m_timeCla(0), m_isSingleTarget(false), m_updateTargetMapInterval(0),
|
||||
m_procCharges(0), m_stackAmount(1), m_isRemoved(false), m_casterLevel(caster ? caster->getLevel() : m_spellProto->spellLevel)
|
||||
{
|
||||
if(m_spellProto->manaPerSecond || m_spellProto->manaPerSecondPerLevel)
|
||||
@@ -453,6 +453,7 @@ void Aura::_Remove(AuraRemoveMode removeMode)
|
||||
|
||||
void Aura::UpdateTargetMap(Unit * caster)
|
||||
{
|
||||
m_updateTargetMapInterval = UPDATE_TARGET_MAP_INTERVAL;
|
||||
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
if(m_effects[i] && !IsRemoved())
|
||||
UpdateTargetMapForEffect(caster, i);
|
||||
@@ -474,7 +475,10 @@ void Aura::UpdateOwner(uint32 diff, WorldObject * owner)
|
||||
|
||||
Update(diff, caster);
|
||||
|
||||
UpdateTargetMap(caster);
|
||||
if (m_updateTargetMapInterval <= diff)
|
||||
UpdateTargetMap(caster);
|
||||
else
|
||||
m_updateTargetMapInterval -= diff;
|
||||
|
||||
// update aura effects
|
||||
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
@@ -1126,6 +1130,21 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster,
|
||||
}
|
||||
break;
|
||||
case SPELLFAMILY_DEATHKNIGHT:
|
||||
// Blood of the North
|
||||
// Reaping
|
||||
// Death Rune Mastery
|
||||
if (GetSpellProto()->SpellIconID == 3041 || GetSpellProto()->SpellIconID == 22 || GetSpellProto()->SpellIconID == 2622)
|
||||
{
|
||||
if (!GetEffect(0) || GetEffect(0)->GetAuraType() != SPELL_AURA_PERIODIC_DUMMY)
|
||||
break;
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
break;
|
||||
if(((Player*)target)->getClass() != CLASS_DEATH_KNIGHT)
|
||||
break;
|
||||
|
||||
// aura removed - remove death runes
|
||||
((Player*)target)->RemoveRunesByAuraEffect(GetEffect(0));
|
||||
}
|
||||
switch(GetId())
|
||||
{
|
||||
case 50514: // Summon Gargoyle
|
||||
|
||||
@@ -33,6 +33,9 @@ class AuraEffect;
|
||||
class Aura;
|
||||
class DynamicObject;
|
||||
|
||||
// update aura target map every 500 ms instead of every update - reduce amount of grid searcher calls
|
||||
#define UPDATE_TARGET_MAP_INTERVAL 500
|
||||
|
||||
class AuraApplication
|
||||
{
|
||||
friend AuraApplication * Unit::__ApplyAura(Aura * aura);
|
||||
@@ -172,6 +175,7 @@ class TRINITY_DLL_SPEC Aura
|
||||
int32 m_maxDuration; // Max aura duration
|
||||
int32 m_duration; // Current time
|
||||
int32 m_timeCla; // Timer for power per sec calcultion
|
||||
int32 m_updateTargetMapInterval; // Timer for UpdateTargetMapOfEffect
|
||||
|
||||
uint8 const m_casterLevel; // Aura level (store caster level for correct show level dep amount)
|
||||
uint8 m_procCharges; // Aura charges (0 for infinite)
|
||||
|
||||
@@ -2680,7 +2680,18 @@ void Spell::EffectSendEvent(uint32 EffectIndex)
|
||||
we do not handle a flag dropping or clicking on flag in battleground by sendevent system
|
||||
*/
|
||||
sLog.outDebug("Spell ScriptStart %u for spellid %u in EffectSendEvent ", m_spellInfo->EffectMiscValue[EffectIndex], m_spellInfo->Id);
|
||||
m_caster->GetMap()->ScriptsStart(sEventScripts, m_spellInfo->EffectMiscValue[EffectIndex], m_caster, focusObject);
|
||||
|
||||
Object *pTarget;
|
||||
if (focusObject)
|
||||
pTarget = focusObject;
|
||||
else if (unitTarget)
|
||||
pTarget = unitTarget;
|
||||
else if (gameObjTarget)
|
||||
pTarget = gameObjTarget;
|
||||
else
|
||||
pTarget = NULL;
|
||||
|
||||
m_caster->GetMap()->ScriptsStart(sEventScripts, m_spellInfo->EffectMiscValue[EffectIndex], m_caster, pTarget);
|
||||
}
|
||||
|
||||
void Spell::EffectPowerBurn(uint32 i)
|
||||
|
||||
@@ -216,7 +216,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
|
||||
|
||||
if(pItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED))// wrapped?
|
||||
{
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT entry, flags FROM character_gifts WHERE item_guid = '%u'", pItem->GetGUIDLow());
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT entry, flags FROM character_gifts WHERE item_guid = '%u'", pItem->GetGUIDLow());
|
||||
if (result)
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
@@ -227,7 +227,6 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
|
||||
pItem->SetEntry(entry);
|
||||
pItem->SetUInt32Value(ITEM_FIELD_FLAGS, flags);
|
||||
pItem->SetState(ITEM_CHANGED, pUser);
|
||||
delete result;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+12
-36
@@ -1107,7 +1107,7 @@ void SpellMgr::LoadSpellTargetPositions()
|
||||
uint32 count = 0;
|
||||
|
||||
// 0 1 2 3 4 5
|
||||
QueryResult *result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM spell_target_position");
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM spell_target_position");
|
||||
if( !result )
|
||||
{
|
||||
|
||||
@@ -1212,8 +1212,6 @@ void SpellMgr::LoadSpellTargetPositions()
|
||||
}
|
||||
}
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u spell teleport coordinates", count );
|
||||
}
|
||||
@@ -1243,7 +1241,7 @@ void SpellMgr::LoadSpellProcEvents()
|
||||
uint32 count = 0;
|
||||
|
||||
// 0 1 2 3 4 5 6 7 8 9 10
|
||||
QueryResult *result = WorldDatabase.Query("SELECT entry, SchoolMask, SpellFamilyName, SpellFamilyMask0, SpellFamilyMask1, SpellFamilyMask2, procFlags, procEx, ppmRate, CustomChance, Cooldown FROM spell_proc_event");
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, SchoolMask, SpellFamilyName, SpellFamilyMask0, SpellFamilyMask1, SpellFamilyMask2, procFlags, procEx, ppmRate, CustomChance, Cooldown FROM spell_proc_event");
|
||||
if( !result )
|
||||
{
|
||||
barGoLink bar( 1 );
|
||||
@@ -1297,8 +1295,6 @@ void SpellMgr::LoadSpellProcEvents()
|
||||
++count;
|
||||
} while( result->NextRow() );
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
if (customProc)
|
||||
sLog.outString( ">> Loaded %u extra spell proc event conditions + %u custom", count, customProc );
|
||||
@@ -1311,7 +1307,7 @@ void SpellMgr::LoadSpellBonusess()
|
||||
mSpellBonusMap.clear(); // need for reload case
|
||||
uint32 count = 0;
|
||||
// 0 1 2 3 4
|
||||
QueryResult *result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus FROM spell_bonus_data");
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus FROM spell_bonus_data");
|
||||
if( !result )
|
||||
{
|
||||
barGoLink bar( 1 );
|
||||
@@ -1346,8 +1342,6 @@ void SpellMgr::LoadSpellBonusess()
|
||||
++count;
|
||||
} while( result->NextRow() );
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u extra spell bonus data", count);
|
||||
}
|
||||
@@ -1488,7 +1482,7 @@ void SpellMgr::LoadSpellElixirs()
|
||||
uint32 count = 0;
|
||||
|
||||
// 0 1
|
||||
QueryResult *result = WorldDatabase.Query("SELECT entry, mask FROM spell_elixir");
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, mask FROM spell_elixir");
|
||||
if( !result )
|
||||
{
|
||||
|
||||
@@ -1525,8 +1519,6 @@ void SpellMgr::LoadSpellElixirs()
|
||||
++count;
|
||||
} while( result->NextRow() );
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u spell elixir definitions", count );
|
||||
}
|
||||
@@ -1538,7 +1530,7 @@ void SpellMgr::LoadSpellThreats()
|
||||
uint32 count = 0;
|
||||
|
||||
// 0 1
|
||||
QueryResult *result = WorldDatabase.Query("SELECT entry, Threat FROM spell_threat");
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, Threat FROM spell_threat");
|
||||
if (!result)
|
||||
{
|
||||
|
||||
@@ -1573,8 +1565,6 @@ void SpellMgr::LoadSpellThreats()
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u aggro generating spells", count );
|
||||
}
|
||||
@@ -1776,7 +1766,7 @@ void SpellMgr::LoadSpellLearnSpells()
|
||||
mSpellLearnSpells.clear(); // need for reload case
|
||||
|
||||
// 0 1 2
|
||||
QueryResult *result = WorldDatabase.Query("SELECT entry, SpellID, Active FROM spell_learn_spell");
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, SpellID, Active FROM spell_learn_spell");
|
||||
if (!result)
|
||||
{
|
||||
barGoLink bar(1);
|
||||
@@ -1826,8 +1816,6 @@ void SpellMgr::LoadSpellLearnSpells()
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
// search auto-learned spells and add its to map also for use in unlearn spells/talents
|
||||
uint32 dbc_count = 0;
|
||||
for (uint32 spell = 0; spell < sSpellStore.GetNumRows(); ++spell)
|
||||
@@ -1887,7 +1875,7 @@ void SpellMgr::LoadSpellScriptTarget()
|
||||
|
||||
uint32 count = 0;
|
||||
|
||||
QueryResult *result = WorldDatabase.Query("SELECT entry,type,targetEntry FROM spell_script_target");
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry,type,targetEntry FROM spell_script_target");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@@ -1989,8 +1977,6 @@ void SpellMgr::LoadSpellScriptTarget()
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
// Check all spells
|
||||
for (uint32 i = 1; i < sSpellStore.GetNumRows(); ++i)
|
||||
{
|
||||
@@ -2047,7 +2033,7 @@ void SpellMgr::LoadSpellPetAuras()
|
||||
uint32 count = 0;
|
||||
|
||||
// 0 1 2 3
|
||||
QueryResult *result = WorldDatabase.Query("SELECT spell, effectId, pet, aura FROM spell_pet_auras");
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT spell, effectId, pet, aura FROM spell_pet_auras");
|
||||
if (!result)
|
||||
{
|
||||
barGoLink bar(1);
|
||||
@@ -2105,8 +2091,6 @@ void SpellMgr::LoadSpellPetAuras()
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u spell pet auras", count );
|
||||
}
|
||||
@@ -2387,7 +2371,7 @@ void SpellMgr::LoadSpellAreas()
|
||||
uint32 count = 0;
|
||||
|
||||
// 0 1 2 3 4 5 6 7 8
|
||||
QueryResult *result = WorldDatabase.Query("SELECT spell, area, quest_start, quest_start_active, quest_end, aura_spell, racemask, gender, autocast FROM spell_area");
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT spell, area, quest_start, quest_start_active, quest_end, aura_spell, racemask, gender, autocast FROM spell_area");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@@ -2579,8 +2563,6 @@ void SpellMgr::LoadSpellAreas()
|
||||
++count;
|
||||
} while(result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u spell area requirements", count );
|
||||
}
|
||||
@@ -3124,7 +3106,7 @@ void SpellMgr::LoadSpellEnchantProcData()
|
||||
uint32 count = 0;
|
||||
|
||||
// 0 1 2 3
|
||||
QueryResult *result = WorldDatabase.Query("SELECT entry, customChance, PPMChance, procEx FROM spell_enchant_proc_data");
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, customChance, PPMChance, procEx FROM spell_enchant_proc_data");
|
||||
if (!result)
|
||||
{
|
||||
barGoLink bar(1);
|
||||
@@ -3163,8 +3145,6 @@ void SpellMgr::LoadSpellEnchantProcData()
|
||||
++count;
|
||||
} while(result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u enchant proc data definitions", count);
|
||||
}
|
||||
@@ -3174,7 +3154,7 @@ void SpellMgr::LoadSpellRequired()
|
||||
mSpellsReqSpell.clear(); // need for reload case
|
||||
mSpellReq.clear(); // need for reload case
|
||||
|
||||
QueryResult *result = WorldDatabase.Query("SELECT spell_id, req_spell from spell_required");
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT spell_id, req_spell from spell_required");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@@ -3202,8 +3182,6 @@ void SpellMgr::LoadSpellRequired()
|
||||
++rows;
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u spell required records", rows );
|
||||
}
|
||||
@@ -3927,7 +3905,7 @@ void SpellMgr::LoadSpellLinked()
|
||||
uint32 count = 0;
|
||||
|
||||
// 0 1 2
|
||||
QueryResult *result = WorldDatabase.Query("SELECT spell_trigger, spell_effect, type FROM spell_linked_spell");
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT spell_trigger, spell_effect, type FROM spell_linked_spell");
|
||||
if (!result)
|
||||
{
|
||||
barGoLink bar(1);
|
||||
@@ -3988,8 +3966,6 @@ void SpellMgr::LoadSpellLinked()
|
||||
++count;
|
||||
} while( result->NextRow() );
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u linked spells", count );
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "SharedDefines.h"
|
||||
#include "SpellAuras.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "ObjectMgr.h"
|
||||
|
||||
/*#######################################
|
||||
######## ########
|
||||
@@ -866,8 +865,7 @@ void Creature::UpdateDamagePhysical(WeaponAttackType attType)
|
||||
float weapon_maxdamage = GetWeaponDamageRange(attType, MAXDAMAGE);
|
||||
|
||||
/* difference in AP between current attack power and base value from DB */
|
||||
CreatureBaseStats const* stats = objmgr.GetCreatureBaseStats(getLevel(), GetCreatureInfo()->unit_class);
|
||||
float att_pwr_change = GetTotalAttackPowerValue(attType) - stats->GenerateAttackPower(GetCreatureInfo());
|
||||
float att_pwr_change = GetTotalAttackPowerValue(attType) - GetCreatureInfo()->attackpower;
|
||||
float base_value = GetModifierValue(unitMod, BASE_VALUE) + (att_pwr_change * GetAPMultiplier(attType, false) / 14.0f);
|
||||
float base_pct = GetModifierValue(unitMod, BASE_PCT);
|
||||
float total_value = GetModifierValue(unitMod, TOTAL_VALUE);
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
void MapManager::LoadTransports()
|
||||
{
|
||||
QueryResult *result = WorldDatabase.Query("SELECT entry, name, period FROM transports");
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, name, period FROM transports");
|
||||
|
||||
uint32 count = 0;
|
||||
|
||||
@@ -111,7 +111,6 @@ void MapManager::LoadTransports()
|
||||
//t->GetMap()->Add<GameObject>((GameObject *)t);
|
||||
++count;
|
||||
} while(result->NextRow());
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u transports", count );
|
||||
@@ -130,8 +129,6 @@ void MapManager::LoadTransports()
|
||||
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());
|
||||
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-2
@@ -3885,6 +3885,7 @@ void Unit::RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode)
|
||||
++m_auraUpdateIterator;
|
||||
|
||||
m_ownedAuras.erase(i);
|
||||
m_removedAuras.push_back(aura);
|
||||
|
||||
// Unregister single target aura
|
||||
if (aura->IsSingleTarget())
|
||||
@@ -12960,7 +12961,7 @@ void Unit::RemoveFromWorld()
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::CleanupsBeforeDelete()
|
||||
void Unit::CleanupsBeforeDelete(bool finalCleanup)
|
||||
{
|
||||
if (IsInWorld())
|
||||
RemoveFromWorld();
|
||||
@@ -12970,7 +12971,10 @@ void Unit::CleanupsBeforeDelete()
|
||||
//A unit may be in removelist and not in world, but it is still in grid
|
||||
//and may have some references during delete
|
||||
RemoveAllAuras();
|
||||
m_cleanupDone = true;
|
||||
|
||||
if (finalCleanup)
|
||||
m_cleanupDone = true;
|
||||
|
||||
InterruptNonMeleeSpells(true);
|
||||
m_Events.KillAllEvents(false); // non-delatable (currently casted spells) will not deleted now but it will deleted at call in Map::RemoveAllObjectsInRemoveList
|
||||
CombatStop();
|
||||
|
||||
+1
-1
@@ -1101,7 +1101,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
||||
void AddToWorld();
|
||||
void RemoveFromWorld();
|
||||
|
||||
void CleanupsBeforeDelete(); // used in ~Creature/~Player (or before mass creature delete to remove cross-references to already deleted units)
|
||||
void CleanupsBeforeDelete(bool finalCleanup = true); // used in ~Creature/~Player (or before mass creature delete to remove cross-references to already deleted units)
|
||||
|
||||
DiminishingLevels GetDiminishing(DiminishingGroup group);
|
||||
void IncrDiminishing(DiminishingGroup group);
|
||||
|
||||
@@ -34,7 +34,7 @@ void WaypointStore::Free()
|
||||
|
||||
void WaypointStore::Load()
|
||||
{
|
||||
QueryResult *result = WorldDatabase.PQuery("SELECT COUNT(id) FROM waypoint_data");
|
||||
QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT COUNT(id) FROM waypoint_data");
|
||||
if (!result)
|
||||
{
|
||||
sLog.outError("an error occured while loading the table `waypoint_data` (maybe it doesn't exist ?)");
|
||||
@@ -42,7 +42,6 @@ void WaypointStore::Load()
|
||||
}
|
||||
|
||||
records = (*result)[0].GetUInt32();
|
||||
delete result;
|
||||
|
||||
result = WorldDatabase.PQuery("SELECT id,point,position_x,position_y,position_z,move_flag,delay,action,action_chance FROM waypoint_data ORDER BY id, point");
|
||||
if(!result)
|
||||
@@ -96,7 +95,6 @@ void WaypointStore::Load()
|
||||
|
||||
} while(result->NextRow()) ;
|
||||
|
||||
delete result;
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %u waypoints", count);
|
||||
}
|
||||
@@ -106,7 +104,7 @@ void WaypointStore::UpdatePath(uint32 id)
|
||||
if(waypoint_map.find(id)!= waypoint_map.end())
|
||||
waypoint_map[id]->clear();
|
||||
|
||||
QueryResult *result;
|
||||
QueryResult_AutoPtr result;
|
||||
|
||||
result = WorldDatabase.PQuery("SELECT id,point,position_x,position_y,position_z,move_flag,delay,action,action_chance FROM waypoint_data WHERE id = %u ORDER BY point", id);
|
||||
|
||||
@@ -147,7 +145,5 @@ void WaypointStore::UpdatePath(uint32 id)
|
||||
while (result->NextRow());
|
||||
|
||||
waypoint_map[id] = path_data;
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
|
||||
+7
-13
@@ -1748,7 +1748,7 @@ void World::LoadAutobroadcasts()
|
||||
{
|
||||
m_Autobroadcasts.clear();
|
||||
|
||||
QueryResult *result = WorldDatabase.Query("SELECT text FROM autobroadcast");
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT text FROM autobroadcast");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@@ -1777,8 +1777,6 @@ void World::LoadAutobroadcasts()
|
||||
count++;
|
||||
} while(result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %u autobroadcasts definitions", count);
|
||||
}
|
||||
@@ -2154,7 +2152,7 @@ BanReturn World::BanAccount(BanMode mode, std::string nameOrIP, std::string dura
|
||||
loginDatabase.escape_string(safe_author);
|
||||
|
||||
uint32 duration_secs = TimeStringToSecs(duration);
|
||||
QueryResult *resultAccounts = NULL; //used for kicking
|
||||
QueryResult_AutoPtr resultAccounts = QueryResult_AutoPtr(NULL); //used for kicking
|
||||
|
||||
///- Update the database with ban information
|
||||
switch(mode)
|
||||
@@ -2203,7 +2201,6 @@ BanReturn World::BanAccount(BanMode mode, std::string nameOrIP, std::string dura
|
||||
}
|
||||
while(resultAccounts->NextRow());
|
||||
|
||||
delete resultAccounts;
|
||||
return BAN_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -2449,13 +2446,13 @@ void World::UpdateRealmCharCount(uint32 accountId)
|
||||
"SELECT COUNT(guid) FROM characters WHERE account = '%u'", accountId);
|
||||
}
|
||||
|
||||
void World::_UpdateRealmCharCount(QueryResult *resultCharCount, uint32 accountId)
|
||||
void World::_UpdateRealmCharCount(QueryResult_AutoPtr resultCharCount, uint32 accountId)
|
||||
{
|
||||
if (resultCharCount)
|
||||
{
|
||||
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("INSERT INTO realmcharacters (numchars, acctid, realmid) VALUES (%u, %u, %u)", charCount, accountId, realmID);
|
||||
}
|
||||
@@ -2465,13 +2462,12 @@ void World::InitDailyQuestResetTime()
|
||||
{
|
||||
time_t mostRecentQuestTime;
|
||||
|
||||
QueryResult* result = CharacterDatabase.Query("SELECT MAX(time) FROM character_queststatus_daily");
|
||||
QueryResult_AutoPtr result = CharacterDatabase.Query("SELECT MAX(time) FROM character_queststatus_daily");
|
||||
if (result)
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
|
||||
mostRecentQuestTime = (time_t)fields[0].GetUInt64();
|
||||
delete result;
|
||||
}
|
||||
else
|
||||
mostRecentQuestTime = 0;
|
||||
@@ -2511,12 +2507,11 @@ void World::ResetDailyQuests()
|
||||
|
||||
void World::UpdateAllowedSecurity()
|
||||
{
|
||||
QueryResult *result = loginDatabase.PQuery("SELECT allowedSecurityLevel from realmlist WHERE id = '%d'", realmID);
|
||||
QueryResult_AutoPtr result = loginDatabase.PQuery("SELECT allowedSecurityLevel from realmlist WHERE id = '%d'", realmID);
|
||||
if (result)
|
||||
{
|
||||
m_allowedSecurityLevel = AccountTypes(result->Fetch()->GetUInt16());
|
||||
sLog.outDebug("Allowed Level: %u Result %u", m_allowedSecurityLevel, result->Fetch()->GetUInt16());
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2533,7 +2528,7 @@ void World::UpdateMaxSessionCounters()
|
||||
|
||||
void World::LoadDBVersion()
|
||||
{
|
||||
QueryResult* result = WorldDatabase.Query("SELECT db_version, script_version, cache_id FROM version LIMIT 1");
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT db_version, script_version, cache_id FROM version LIMIT 1");
|
||||
//QueryResult* result = WorldDatabase.Query("SELECT version, creature_ai_version, cache_id FROM db_version LIMIT 1");
|
||||
if (result)
|
||||
{
|
||||
@@ -2544,7 +2539,6 @@ void World::LoadDBVersion()
|
||||
|
||||
// will be overwrite by config values if different and non-0
|
||||
m_configs[CONFIG_CLIENTCACHE_VERSION] = fields[2].GetUInt32();
|
||||
delete result;
|
||||
}
|
||||
|
||||
if (m_DBVersion.empty())
|
||||
|
||||
+2
-1
@@ -30,6 +30,7 @@
|
||||
#include "Policies/Singleton.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "ace/Atomic_Op.h"
|
||||
#include "QueryResult.h"
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
@@ -645,7 +646,7 @@ class World
|
||||
protected:
|
||||
void _UpdateGameTime();
|
||||
// callback for UpdateRealmCharacters
|
||||
void _UpdateRealmCharCount(QueryResult *resultCharCount, uint32 accountId);
|
||||
void _UpdateRealmCharCount(QueryResult_AutoPtr resultCharCount, uint32 accountId);
|
||||
|
||||
void InitDailyQuestResetTime();
|
||||
void ResetDailyQuests();
|
||||
|
||||
@@ -566,7 +566,7 @@ void WorldSession::LoadGlobalAccountData()
|
||||
);
|
||||
}
|
||||
|
||||
void WorldSession::LoadAccountData(QueryResult* result, uint32 mask)
|
||||
void WorldSession::LoadAccountData(QueryResult_AutoPtr result, uint32 mask)
|
||||
{
|
||||
for (uint32 i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i)
|
||||
if (mask & (1 << i))
|
||||
@@ -598,8 +598,6 @@ void WorldSession::LoadAccountData(QueryResult* result, uint32 mask)
|
||||
m_accountData[type].Data = fields[2].GetCppString();
|
||||
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
void WorldSession::SetAccountData(AccountDataType type, time_t time_, std::string data)
|
||||
@@ -648,7 +646,7 @@ void WorldSession::LoadTutorialsData()
|
||||
for (int aX = 0 ; aX < 8 ; ++aX )
|
||||
m_Tutorials[ aX ] = 0;
|
||||
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT tut0,tut1,tut2,tut3,tut4,tut5,tut6,tut7 FROM character_tutorial WHERE account = '%u'", GetAccountId());
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT tut0,tut1,tut2,tut3,tut4,tut5,tut6,tut7 FROM character_tutorial WHERE account = '%u'", GetAccountId());
|
||||
|
||||
if(result)
|
||||
{
|
||||
@@ -660,10 +658,7 @@ void WorldSession::LoadTutorialsData()
|
||||
m_Tutorials[iI] = fields[iI].GetUInt32();
|
||||
}
|
||||
while( result->NextRow() );
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
m_TutorialsChanged = false;
|
||||
}
|
||||
|
||||
@@ -682,12 +677,9 @@ void WorldSession::SaveTutorialsData()
|
||||
|
||||
uint32 Rows=0;
|
||||
// it's better than rebuilding indexes multiple times
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT count(*) AS r FROM character_tutorial WHERE account = '%u'", GetAccountId());
|
||||
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT count(*) AS r FROM character_tutorial WHERE account = '%u'", GetAccountId());
|
||||
if(result)
|
||||
{
|
||||
Rows = result->Fetch()[0].GetUInt32();
|
||||
delete result;
|
||||
}
|
||||
|
||||
if (Rows)
|
||||
{
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "Common.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "AddonMgr.h"
|
||||
#include "QueryResult.h"
|
||||
|
||||
struct ItemPrototype;
|
||||
struct AuctionEntry;
|
||||
@@ -162,7 +163,7 @@ class TRINITY_DLL_SPEC WorldSession
|
||||
//void SendTestCreatureQueryOpcode( uint32 entry, uint64 guid, uint32 testvalue );
|
||||
void SendNameQueryOpcode(Player* p);
|
||||
void SendNameQueryOpcodeFromDB(uint64 guid);
|
||||
static void SendNameQueryOpcodeFromDBCallBack(QueryResult *result, uint32 accountId);
|
||||
static void SendNameQueryOpcodeFromDBCallBack(QueryResult_AutoPtr result, uint32 accountId);
|
||||
|
||||
void SendTrainerList( uint64 guid );
|
||||
void SendTrainerList( uint64 guid, const std::string& strTitle );
|
||||
@@ -191,7 +192,7 @@ class TRINITY_DLL_SPEC WorldSession
|
||||
void SetAccountData(AccountDataType type, time_t time_, std::string data);
|
||||
void SendAccountDataTimes(uint32 mask);
|
||||
void LoadGlobalAccountData();
|
||||
void LoadAccountData(QueryResult* result, uint32 mask);
|
||||
void LoadAccountData(QueryResult_AutoPtr result, uint32 mask);
|
||||
void LoadTutorialsData();
|
||||
void SendTutorialsData();
|
||||
void SaveTutorialsData();
|
||||
@@ -269,7 +270,7 @@ class TRINITY_DLL_SPEC WorldSession
|
||||
void HandleCharDeleteOpcode(WorldPacket& recvPacket);
|
||||
void HandleCharCreateOpcode(WorldPacket& recvPacket);
|
||||
void HandlePlayerLoginOpcode(WorldPacket& recvPacket);
|
||||
void HandleCharEnum(QueryResult * result);
|
||||
void HandleCharEnum(QueryResult_AutoPtr result);
|
||||
void HandlePlayerLogin(LoginQueryHolder * holder);
|
||||
|
||||
// played time
|
||||
@@ -338,10 +339,10 @@ class TRINITY_DLL_SPEC WorldSession
|
||||
void HandleEmoteOpcode(WorldPacket& recvPacket);
|
||||
void HandleContactListOpcode(WorldPacket& recvPacket);
|
||||
void HandleAddFriendOpcode(WorldPacket& recvPacket);
|
||||
static void HandleAddFriendOpcodeCallBack(QueryResult *result, uint32 accountId, std::string friendNote);
|
||||
static void HandleAddFriendOpcodeCallBack(QueryResult_AutoPtr result, uint32 accountId, std::string friendNote);
|
||||
void HandleDelFriendOpcode(WorldPacket& recvPacket);
|
||||
void HandleAddIgnoreOpcode(WorldPacket& recvPacket);
|
||||
static void HandleAddIgnoreOpcodeCallBack(QueryResult *result, uint32 accountId);
|
||||
static void HandleAddIgnoreOpcodeCallBack(QueryResult_AutoPtr result, uint32 accountId);
|
||||
void HandleDelIgnoreOpcode(WorldPacket& recvPacket);
|
||||
void HandleSetContactNotesOpcode(WorldPacket& recvPacket);
|
||||
void HandleBugOpcode(WorldPacket& recvPacket);
|
||||
@@ -610,7 +611,7 @@ class TRINITY_DLL_SPEC WorldSession
|
||||
void HandleSetActionBarToggles(WorldPacket& recv_data);
|
||||
|
||||
void HandleCharRenameOpcode(WorldPacket& recv_data);
|
||||
static void HandleChangePlayerNameOpcodeCallBack(QueryResult *result, uint32 accountId, std::string newname);
|
||||
static void HandleChangePlayerNameOpcodeCallBack(QueryResult_AutoPtr result, uint32 accountId, std::string newname);
|
||||
void HandleSetPlayerDeclinedNames(WorldPacket& recv_data);
|
||||
|
||||
void HandleTotemDestroyed(WorldPacket& recv_data);
|
||||
|
||||
@@ -738,7 +738,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
|
||||
loginDatabase.escape_string (safe_account);
|
||||
// No SQL injection, username escaped.
|
||||
|
||||
QueryResult *result =
|
||||
QueryResult_AutoPtr result =
|
||||
loginDatabase.PQuery ("SELECT "
|
||||
"id, " //0
|
||||
"sessionkey, " //1
|
||||
@@ -798,7 +798,6 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
|
||||
packet << uint8 (AUTH_FAILED);
|
||||
SendPacket (packet);
|
||||
|
||||
delete result;
|
||||
sLog.outBasic ("WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs).");
|
||||
return -1;
|
||||
}
|
||||
@@ -818,8 +817,6 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
|
||||
if (locale >= MAX_LOCALE)
|
||||
locale = LOCALE_enUS;
|
||||
|
||||
delete result;
|
||||
|
||||
// Checks gmlevel per Realm
|
||||
result =
|
||||
loginDatabase.PQuery ("SELECT "
|
||||
@@ -836,11 +833,10 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
|
||||
{
|
||||
fields = result->Fetch ();
|
||||
security = fields[1].GetInt32();
|
||||
delete result;
|
||||
}
|
||||
|
||||
// Re-check account ban (same check as in realmd)
|
||||
QueryResult *banresult =
|
||||
QueryResult_AutoPtr banresult =
|
||||
loginDatabase.PQuery ("SELECT 1 FROM account_banned WHERE id = %u AND active = 1 "
|
||||
"UNION "
|
||||
"SELECT 1 FROM ip_banned WHERE ip = '%s'",
|
||||
@@ -852,8 +848,6 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
|
||||
packet << uint8 (AUTH_BANNED);
|
||||
SendPacket (packet);
|
||||
|
||||
delete banresult;
|
||||
|
||||
sLog.outError ("WorldSocket::HandleAuthSession: Sent Auth Response (Account banned).");
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user