mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
Various Cleanups (game P)
This commit is contained in:
parent
94795f2bff
commit
98e1efd435
17 changed files with 3642 additions and 3615 deletions
|
|
@ -180,7 +180,8 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_player->GetMoney() < cost)
|
if (_player->GetMoney() < cost)
|
||||||
{ //player hasn't got enough money
|
{
|
||||||
|
//player hasn't got enough money
|
||||||
_player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, charterid, 0);
|
_player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, charterid, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -216,7 +217,8 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
|
||||||
{
|
{
|
||||||
Field* fields = result->Fetch();
|
Field* fields = result->Fetch();
|
||||||
ssInvalidPetitionGUIDs << "'" << fields[0].GetUInt32() << "' , ";
|
ssInvalidPetitionGUIDs << "'" << fields[0].GetUInt32() << "' , ";
|
||||||
} while (result->NextRow());
|
}
|
||||||
|
while (result->NextRow());
|
||||||
|
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4214,7 +4214,8 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
|
||||||
uint32 petguidlow = fields3[0].GetUInt32();
|
uint32 petguidlow = fields3[0].GetUInt32();
|
||||||
//do not create separate transaction for pet delete otherwise we will get fatal error!
|
//do not create separate transaction for pet delete otherwise we will get fatal error!
|
||||||
Pet::DeleteFromDB(petguidlow, false);
|
Pet::DeleteFromDB(petguidlow, false);
|
||||||
} while (resultPets->NextRow());
|
}
|
||||||
|
while (resultPets->NextRow());
|
||||||
delete resultPets;
|
delete resultPets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4232,7 +4233,8 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
|
||||||
sSocialMgr.SendFriendStatus(sFriend, FRIEND_REMOVED, playerguid, false);
|
sSocialMgr.SendFriendStatus(sFriend, FRIEND_REMOVED, playerguid, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (resultFriend->NextRow());
|
}
|
||||||
|
while (resultFriend->NextRow());
|
||||||
delete resultFriend;
|
delete resultFriend;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4317,7 +4319,8 @@ void Player::DeleteOldCharacters(uint32 keepDays)
|
||||||
Field* charFields = resultChars->Fetch();
|
Field* charFields = resultChars->Fetch();
|
||||||
ObjectGuid guid = ObjectGuid(HIGHGUID_PLAYER, charFields[0].GetUInt32());
|
ObjectGuid guid = ObjectGuid(HIGHGUID_PLAYER, charFields[0].GetUInt32());
|
||||||
Player::DeleteFromDB(guid, charFields[1].GetUInt32(), true, true);
|
Player::DeleteFromDB(guid, charFields[1].GetUInt32(), true, true);
|
||||||
} while(resultChars->NextRow());
|
}
|
||||||
|
while (resultChars->NextRow());
|
||||||
delete resultChars;
|
delete resultChars;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -15197,7 +15200,8 @@ bool Player::HasQuestForItem( uint32 itemid ) const
|
||||||
{
|
{
|
||||||
if (GetItemCount(itemid,true) < qinfo->ReqSourceCount[j])
|
if (GetItemCount(itemid,true) < qinfo->ReqSourceCount[j])
|
||||||
return true;
|
return true;
|
||||||
} else if ((int32)GetItemCount(itemid,true) < pProto->Stackable)
|
}
|
||||||
|
else if ((int32)GetItemCount(itemid,true) < pProto->Stackable)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -15379,7 +15383,8 @@ void Player::_LoadArenaTeamInfo(QueryResult *result)
|
||||||
SetArenaTeamInfoField(arenaSlot, ARENA_TEAM_WINS_SEASON, wons_season);
|
SetArenaTeamInfoField(arenaSlot, ARENA_TEAM_WINS_SEASON, wons_season);
|
||||||
SetArenaTeamInfoField(arenaSlot, ARENA_TEAM_PERSONAL_RATING, personal_rating);
|
SetArenaTeamInfoField(arenaSlot, ARENA_TEAM_PERSONAL_RATING, personal_rating);
|
||||||
|
|
||||||
} while (result->NextRow());
|
}
|
||||||
|
while (result->NextRow());
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -15412,7 +15417,8 @@ void Player::_LoadEquipmentSets(QueryResult *result)
|
||||||
|
|
||||||
if (count >= MAX_EQUIPMENT_SET_INDEX) // client limit
|
if (count >= MAX_EQUIPMENT_SET_INDEX) // client limit
|
||||||
break;
|
break;
|
||||||
} while (result->NextRow());
|
}
|
||||||
|
while (result->NextRow());
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -16284,7 +16290,8 @@ void Player::_LoadGlyphs(QueryResult *result)
|
||||||
|
|
||||||
m_glyphs[spec][slot].id = glyph;
|
m_glyphs[spec][slot].id = glyph;
|
||||||
|
|
||||||
} while( result->NextRow() );
|
}
|
||||||
|
while (result->NextRow());
|
||||||
|
|
||||||
delete result;
|
delete result;
|
||||||
|
|
||||||
|
|
@ -16452,7 +16459,8 @@ void Player::_LoadInventory(QueryResult *result, uint32 timediff)
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item = '%u'", item_lowguid);
|
CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item = '%u'", item_lowguid);
|
||||||
problematicItems.push_back(item);
|
problematicItems.push_back(item);
|
||||||
}
|
}
|
||||||
} while (result->NextRow());
|
}
|
||||||
|
while (result->NextRow());
|
||||||
|
|
||||||
delete result;
|
delete result;
|
||||||
m_itemUpdateQueueBlocked = false;
|
m_itemUpdateQueueBlocked = false;
|
||||||
|
|
@ -16503,7 +16511,8 @@ void Player::_LoadItemLoot(QueryResult *result)
|
||||||
|
|
||||||
item->LoadLootFromDB(fields);
|
item->LoadLootFromDB(fields);
|
||||||
|
|
||||||
} while (result->NextRow());
|
}
|
||||||
|
while (result->NextRow());
|
||||||
|
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
|
|
@ -16552,7 +16561,8 @@ void Player::_LoadMailedItems(QueryResult *result)
|
||||||
}
|
}
|
||||||
|
|
||||||
AddMItem(item);
|
AddMItem(item);
|
||||||
} while (result->NextRow());
|
}
|
||||||
|
while (result->NextRow());
|
||||||
|
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
|
|
@ -16597,7 +16607,8 @@ void Player::_LoadMails(QueryResult *result)
|
||||||
if (m->mailTemplateId && !m->has_items)
|
if (m->mailTemplateId && !m->has_items)
|
||||||
m->prepareTemplateItems(this);
|
m->prepareTemplateItems(this);
|
||||||
|
|
||||||
} while( result->NextRow() );
|
}
|
||||||
|
while (result->NextRow());
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -17014,7 +17025,8 @@ void Player::_LoadBoundInstances(QueryResult *result)
|
||||||
// since non permanent binds are always solo bind, they can always be reset
|
// since non permanent binds are always solo bind, they can always be reset
|
||||||
DungeonPersistentState* state = (DungeonPersistentState*)sMapPersistentStateMgr.AddPersistentState(mapEntry, instanceId, Difficulty(difficulty), resetTime, !perm, true);
|
DungeonPersistentState* state = (DungeonPersistentState*)sMapPersistentStateMgr.AddPersistentState(mapEntry, instanceId, Difficulty(difficulty), resetTime, !perm, true);
|
||||||
if (state) BindToInstance(state, perm, true);
|
if (state) BindToInstance(state, perm, true);
|
||||||
} while(result->NextRow());
|
}
|
||||||
|
while (result->NextRow());
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -18767,7 +18779,8 @@ void Player::RemovePetitionsAndSigns(ObjectGuid guid, uint32 type)
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
do // this part effectively does nothing, since the deletion / modification only takes place _after_ the PetitionQuery. Though I don't know if the result remains intact if I execute the delete query beforehand.
|
do // this part effectively does nothing, since the deletion / modification only takes place _after_ the PetitionQuery. Though I don't know if the result remains intact if I execute the delete query beforehand.
|
||||||
{ // and SendPetitionQueryOpcode reads data from the DB
|
{
|
||||||
|
// and SendPetitionQueryOpcode reads data from the DB
|
||||||
Field* fields = result->Fetch();
|
Field* fields = result->Fetch();
|
||||||
ObjectGuid ownerguid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
|
ObjectGuid ownerguid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
|
||||||
ObjectGuid petitionguid = ObjectGuid(HIGHGUID_ITEM, fields[1].GetUInt32());
|
ObjectGuid petitionguid = ObjectGuid(HIGHGUID_ITEM, fields[1].GetUInt32());
|
||||||
|
|
@ -18777,7 +18790,8 @@ void Player::RemovePetitionsAndSigns(ObjectGuid guid, uint32 type)
|
||||||
if (owner)
|
if (owner)
|
||||||
owner->GetSession()->SendPetitionQueryOpcode(petitionguid);
|
owner->GetSession()->SendPetitionQueryOpcode(petitionguid);
|
||||||
|
|
||||||
} while ( result->NextRow() );
|
}
|
||||||
|
while (result->NextRow());
|
||||||
|
|
||||||
delete result;
|
delete result;
|
||||||
|
|
||||||
|
|
@ -18815,7 +18829,8 @@ void Player::LeaveAllArenaTeams(ObjectGuid guid)
|
||||||
if (ArenaTeam* at = sObjectMgr.GetArenaTeamById(at_id))
|
if (ArenaTeam* at = sObjectMgr.GetArenaTeamById(at_id))
|
||||||
at->DelMember(guid);
|
at->DelMember(guid);
|
||||||
|
|
||||||
} while (result->NextRow());
|
}
|
||||||
|
while (result->NextRow());
|
||||||
|
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
|
|
@ -21684,7 +21699,8 @@ void Player::AddRunePower(uint8 index)
|
||||||
GetSession()->SendPacket(&data);
|
GetSession()->SendPacket(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static RuneType runeSlotTypes[MAX_RUNES] = {
|
static RuneType runeSlotTypes[MAX_RUNES] =
|
||||||
|
{
|
||||||
/*0*/ RUNE_BLOOD,
|
/*0*/ RUNE_BLOOD,
|
||||||
/*1*/ RUNE_BLOOD,
|
/*1*/ RUNE_BLOOD,
|
||||||
/*2*/ RUNE_UNHOLY,
|
/*2*/ RUNE_UNHOLY,
|
||||||
|
|
@ -21923,7 +21939,8 @@ void Player::_LoadSkills(QueryResult *result)
|
||||||
sLog.outError("Character %u has more than %u skills.", GetGUIDLow(), PLAYER_MAX_SKILLS);
|
sLog.outError("Character %u has more than %u skills.", GetGUIDLow(), PLAYER_MAX_SKILLS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (result->NextRow());
|
}
|
||||||
|
while (result->NextRow());
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,8 @@ bool findnth(std::string &str, int n, std::string::size_type &s, std::string::si
|
||||||
e = str.find("'",s);
|
e = str.find("'",s);
|
||||||
if (e == std::string::npos)
|
if (e == std::string::npos)
|
||||||
return false;
|
return false;
|
||||||
} while(str[e-1] == '\\');
|
}
|
||||||
|
while (str[e-1] == '\\');
|
||||||
|
|
||||||
for (int i = 1; i < n; ++i)
|
for (int i = 1; i < n; ++i)
|
||||||
{
|
{
|
||||||
|
|
@ -111,7 +112,8 @@ bool findnth(std::string &str, int n, std::string::size_type &s, std::string::si
|
||||||
e = str.find("'",s);
|
e = str.find("'",s);
|
||||||
if (e == std::string::npos)
|
if (e == std::string::npos)
|
||||||
return false;
|
return false;
|
||||||
} while (str[e-1] == '\\');
|
}
|
||||||
|
while (str[e-1] == '\\');
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -606,7 +606,8 @@ void PoolManager::LoadFromDB()
|
||||||
pPoolTemplate.description = fields[2].GetCppString();
|
pPoolTemplate.description = fields[2].GetCppString();
|
||||||
pPoolTemplate.AutoSpawn = true; // will update and later data loading
|
pPoolTemplate.AutoSpawn = true; // will update and later data loading
|
||||||
|
|
||||||
} while (result->NextRow());
|
}
|
||||||
|
while (result->NextRow());
|
||||||
|
|
||||||
sLog.outString();
|
sLog.outString();
|
||||||
sLog.outString(">> Loaded %u objects pools", count);
|
sLog.outString(">> Loaded %u objects pools", count);
|
||||||
|
|
@ -675,7 +676,8 @@ void PoolManager::LoadFromDB()
|
||||||
SearchPair p(guid, pool_id);
|
SearchPair p(guid, pool_id);
|
||||||
mCreatureSearchMap.insert(p);
|
mCreatureSearchMap.insert(p);
|
||||||
|
|
||||||
} while (result->NextRow());
|
}
|
||||||
|
while (result->NextRow());
|
||||||
sLog.outString();
|
sLog.outString();
|
||||||
sLog.outString(">> Loaded %u creatures in pools from `pool_creature`", count);
|
sLog.outString(">> Loaded %u creatures in pools from `pool_creature`", count);
|
||||||
delete result;
|
delete result;
|
||||||
|
|
@ -747,7 +749,8 @@ void PoolManager::LoadFromDB()
|
||||||
SearchPair p(guid, pool_id);
|
SearchPair p(guid, pool_id);
|
||||||
mCreatureSearchMap.insert(p);
|
mCreatureSearchMap.insert(p);
|
||||||
|
|
||||||
} while (result->NextRow());
|
}
|
||||||
|
while (result->NextRow());
|
||||||
sLog.outString();
|
sLog.outString();
|
||||||
sLog.outString(">> Loaded %u creatures in pools from `pool_creature_template`", count);
|
sLog.outString(">> Loaded %u creatures in pools from `pool_creature_template`", count);
|
||||||
delete result;
|
delete result;
|
||||||
|
|
@ -822,7 +825,8 @@ void PoolManager::LoadFromDB()
|
||||||
SearchPair p(guid, pool_id);
|
SearchPair p(guid, pool_id);
|
||||||
mGameobjectSearchMap.insert(p);
|
mGameobjectSearchMap.insert(p);
|
||||||
|
|
||||||
} while( result->NextRow() );
|
}
|
||||||
|
while (result->NextRow());
|
||||||
sLog.outString();
|
sLog.outString();
|
||||||
sLog.outString(">> Loaded %u gameobject in pools from `pool_gameobject`", count);
|
sLog.outString(">> Loaded %u gameobject in pools from `pool_gameobject`", count);
|
||||||
delete result;
|
delete result;
|
||||||
|
|
@ -904,7 +908,8 @@ void PoolManager::LoadFromDB()
|
||||||
SearchPair p(guid, pool_id);
|
SearchPair p(guid, pool_id);
|
||||||
mGameobjectSearchMap.insert(p);
|
mGameobjectSearchMap.insert(p);
|
||||||
|
|
||||||
} while( result->NextRow() );
|
}
|
||||||
|
while (result->NextRow());
|
||||||
sLog.outString();
|
sLog.outString();
|
||||||
sLog.outString(">> Loaded %u gameobject in pools from `pool_gameobject_template`", count);
|
sLog.outString(">> Loaded %u gameobject in pools from `pool_gameobject_template`", count);
|
||||||
delete result;
|
delete result;
|
||||||
|
|
@ -973,7 +978,8 @@ void PoolManager::LoadFromDB()
|
||||||
// update top independent pool flag
|
// update top independent pool flag
|
||||||
mPoolTemplate[child_pool_id].AutoSpawn = false;
|
mPoolTemplate[child_pool_id].AutoSpawn = false;
|
||||||
|
|
||||||
} while( result->NextRow() );
|
}
|
||||||
|
while (result->NextRow());
|
||||||
|
|
||||||
// Now check for circular reference
|
// Now check for circular reference
|
||||||
for (uint16 i=0; i<max_pool_id; ++i)
|
for (uint16 i=0; i<max_pool_id; ++i)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue