Core: Fixed more warnings (C6246: Local declaration of 'x' hides declaration of the same name in outer scope.)
This commit is contained in:
@@ -59,8 +59,8 @@ void CreatureAI::DoZoneInCombat(Creature* creature /*= NULL*/, float maxRangeToN
|
||||
|
||||
if (!creature->HasReactState(REACT_PASSIVE) && !creature->getVictim())
|
||||
{
|
||||
if (Unit* target = creature->SelectNearestTarget(maxRangeToNearestTarget))
|
||||
creature->AI()->AttackStart(target);
|
||||
if (Unit* nearTarget = creature->SelectNearestTarget(maxRangeToNearestTarget))
|
||||
creature->AI()->AttackStart(nearTarget);
|
||||
else if (creature->isSummon())
|
||||
{
|
||||
if (Unit* summoner = creature->ToTempSummon()->GetSummoner())
|
||||
|
||||
@@ -1490,9 +1490,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
if (IsSmart(target))
|
||||
CAST_AI(SmartAI, target->AI())->SetScript9(e, e.action.timedActionList.id, GetLastInvoker());
|
||||
}
|
||||
else if (GameObject* target = (*itr)->ToGameObject())
|
||||
else if (GameObject* goTarget = (*itr)->ToGameObject())
|
||||
{
|
||||
if (IsSmartGO(target))
|
||||
if (IsSmartGO(goTarget))
|
||||
CAST_AI(SmartGameObjectAI, target->AI())->SetScript9(e, e.action.timedActionList.id, GetLastInvoker());
|
||||
}
|
||||
}
|
||||
@@ -1607,9 +1607,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
if (IsSmart(target))
|
||||
CAST_AI(SmartAI, target->AI())->SetScript9(e, id, GetLastInvoker());
|
||||
}
|
||||
else if (GameObject* target = (*itr)->ToGameObject())
|
||||
else if (GameObject* goTarget = (*itr)->ToGameObject())
|
||||
{
|
||||
if (IsSmartGO(target))
|
||||
if (IsSmartGO(goTarget))
|
||||
CAST_AI(SmartGameObjectAI, target->AI())->SetScript9(e, id, GetLastInvoker());
|
||||
}
|
||||
}
|
||||
@@ -1637,9 +1637,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
if (IsSmart(target))
|
||||
CAST_AI(SmartAI, target->AI())->SetScript9(e, id, GetLastInvoker());
|
||||
}
|
||||
else if (GameObject* target = (*itr)->ToGameObject())
|
||||
else if (GameObject* goTarget = (*itr)->ToGameObject())
|
||||
{
|
||||
if (IsSmartGO(target))
|
||||
if (IsSmartGO(goTarget))
|
||||
CAST_AI(SmartGameObjectAI, target->AI())->SetScript9(e, id, GetLastInvoker());
|
||||
}
|
||||
}
|
||||
@@ -2298,10 +2298,10 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
|
||||
if (!me || !me->isInCombat())
|
||||
return;
|
||||
|
||||
Unit* unit = DoSelectLowestHpFriendly((float)e.event.friendlyHealt.radius, e.event.friendlyHealt.hpDeficit);
|
||||
if (!unit)
|
||||
Unit* target = DoSelectLowestHpFriendly((float)e.event.friendlyHealt.radius, e.event.friendlyHealt.hpDeficit);
|
||||
if (!target)
|
||||
return;
|
||||
ProcessAction(e, unit);
|
||||
ProcessAction(e, target);
|
||||
RecalcTimer(e, e.event.friendlyHealt.repeatMin, e.event.friendlyHealt.repeatMax);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1759,12 +1759,12 @@ void Battleground::HandleKillPlayer(Player* player, Player* killer)
|
||||
|
||||
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
Player* player = ObjectAccessor::FindPlayer(itr->first);
|
||||
if (!player || player == killer)
|
||||
Player* creditedPlayer = ObjectAccessor::FindPlayer(itr->first);
|
||||
if (!creditedPlayer || creditedPlayer == killer)
|
||||
continue;
|
||||
|
||||
if (player->GetTeam() == killer->GetTeam() && player->IsAtGroupRewardDistance(player))
|
||||
UpdatePlayerScore(player, SCORE_HONORABLE_KILLS, 1);
|
||||
if (creditedPlayer->GetTeam() == killer->GetTeam() && creditedPlayer->IsAtGroupRewardDistance(player))
|
||||
UpdatePlayerScore(creditedPlayer, SCORE_HONORABLE_KILLS, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -914,43 +914,43 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 diff, BattlegroundTypeId
|
||||
GroupsQueueType::iterator itr_teams[BG_TEAMS_COUNT];
|
||||
uint8 found = 0;
|
||||
uint8 team = 0;
|
||||
|
||||
|
||||
for (uint8 i = BG_QUEUE_PREMADE_ALLIANCE; i < BG_QUEUE_NORMAL_ALLIANCE; i++)
|
||||
{
|
||||
// take the group that joined first
|
||||
GroupsQueueType::iterator itr = m_QueuedGroups[bracket_id][i].begin();
|
||||
for (; itr != m_QueuedGroups[bracket_id][i].end(); ++itr)
|
||||
GroupsQueueType::iterator itr2 = m_QueuedGroups[bracket_id][i].begin();
|
||||
for (; itr2 != m_QueuedGroups[bracket_id][i].end(); ++itr2)
|
||||
{
|
||||
// if group match conditions, then add it to pool
|
||||
if (!(*itr)->IsInvitedToBGInstanceGUID
|
||||
&& (((*itr)->ArenaMatchmakerRating >= arenaMinRating && (*itr)->ArenaMatchmakerRating <= arenaMaxRating)
|
||||
|| (*itr)->JoinTime < discardTime))
|
||||
if (!(*itr2)->IsInvitedToBGInstanceGUID
|
||||
&& (((*itr2)->ArenaMatchmakerRating >= arenaMinRating && (*itr2)->ArenaMatchmakerRating <= arenaMaxRating)
|
||||
|| (*itr2)->JoinTime < discardTime))
|
||||
{
|
||||
itr_teams[found++] = itr;
|
||||
itr_teams[found++] = itr2;
|
||||
team = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!found)
|
||||
return;
|
||||
|
||||
|
||||
if (found == 1)
|
||||
{
|
||||
for (GroupsQueueType::iterator itr = itr_teams[0]; itr != m_QueuedGroups[bracket_id][team].end(); ++itr)
|
||||
for (GroupsQueueType::iterator itr3 = itr_teams[0]; itr3 != m_QueuedGroups[bracket_id][team].end(); ++itr3)
|
||||
{
|
||||
if (!(*itr)->IsInvitedToBGInstanceGUID
|
||||
&& (((*itr)->ArenaMatchmakerRating >= arenaMinRating && (*itr)->ArenaMatchmakerRating <= arenaMaxRating)
|
||||
|| (*itr)->JoinTime < discardTime)
|
||||
&& (*itr_teams[0])->ArenaTeamId != (*itr)->ArenaTeamId)
|
||||
if (!(*itr3)->IsInvitedToBGInstanceGUID
|
||||
&& (((*itr3)->ArenaMatchmakerRating >= arenaMinRating && (*itr3)->ArenaMatchmakerRating <= arenaMaxRating)
|
||||
|| (*itr3)->JoinTime < discardTime)
|
||||
&& (*itr_teams[0])->ArenaTeamId != (*itr3)->ArenaTeamId)
|
||||
{
|
||||
itr_teams[found++] = itr;
|
||||
itr_teams[found++] = itr3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//if we have 2 teams, then start new arena and invite players!
|
||||
if (found == 2)
|
||||
{
|
||||
@@ -962,14 +962,14 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 diff, BattlegroundTypeId
|
||||
sLog->outError("BattlegroundQueue::Update couldn't create arena instance for rated arena match!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
aTeam->OpponentsTeamRating = hTeam->ArenaTeamRating;
|
||||
hTeam->OpponentsTeamRating = aTeam->ArenaTeamRating;
|
||||
aTeam->OpponentsMatchmakerRating = hTeam->ArenaMatchmakerRating;
|
||||
hTeam->OpponentsMatchmakerRating = aTeam->ArenaMatchmakerRating;
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "setting oposite teamrating for team %u to %u", aTeam->ArenaTeamId, aTeam->OpponentsTeamRating);
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "setting oposite teamrating for team %u to %u", hTeam->ArenaTeamId, hTeam->OpponentsTeamRating);
|
||||
|
||||
|
||||
// now we must move team if we changed its faction to another faction queue, because then we will spam log by errors in Queue::RemovePlayer
|
||||
if (aTeam->Team != ALLIANCE)
|
||||
{
|
||||
@@ -981,12 +981,12 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 diff, BattlegroundTypeId
|
||||
m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].push_front(hTeam);
|
||||
m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].erase(itr_teams[BG_TEAM_HORDE]);
|
||||
}
|
||||
|
||||
|
||||
arena->SetArenaMatchmakerRating(ALLIANCE, aTeam->ArenaMatchmakerRating);
|
||||
arena->SetArenaMatchmakerRating( HORDE, hTeam->ArenaMatchmakerRating);
|
||||
InviteGroupToBG(aTeam, arena, ALLIANCE);
|
||||
InviteGroupToBG(hTeam, arena, HORDE);
|
||||
|
||||
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Starting rated arena match!");
|
||||
arena->StartBattleground();
|
||||
}
|
||||
|
||||
@@ -1348,23 +1348,23 @@ bool BattlegroundAV::SetupBattleground()
|
||||
|
||||
//creatures
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV start poputlating nodes");
|
||||
for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
|
||||
for (i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
|
||||
{
|
||||
if (m_Nodes[i].Owner)
|
||||
PopulateNode(i);
|
||||
PopulateNode(BG_AV_Nodes(i));
|
||||
}
|
||||
//all creatures which don't get despawned through the script are static
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV: start spawning static creatures");
|
||||
for (i=0; i < AV_STATICCPLACE_MAX; i++)
|
||||
AddAVCreature(0, i+AV_CPLACE_MAX);
|
||||
for (i = 0; i < AV_STATICCPLACE_MAX; i++)
|
||||
AddAVCreature(0, i + AV_CPLACE_MAX);
|
||||
//mainspiritguides:
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV: start spawning spiritguides creatures");
|
||||
AddSpiritGuide(7, BG_AV_CreaturePos[7][0], BG_AV_CreaturePos[7][1], BG_AV_CreaturePos[7][2], BG_AV_CreaturePos[7][3], ALLIANCE);
|
||||
AddSpiritGuide(8, BG_AV_CreaturePos[8][0], BG_AV_CreaturePos[8][1], BG_AV_CreaturePos[8][2], BG_AV_CreaturePos[8][3], HORDE);
|
||||
//spawn the marshals (those who get deleted, if a tower gets destroyed)
|
||||
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV: start spawning marshal creatures");
|
||||
for (i=AV_NPC_A_MARSHAL_SOUTH; i <= AV_NPC_H_MARSHAL_WTOWER; i++)
|
||||
AddAVCreature(i, AV_CPLACE_A_MARSHAL_SOUTH+(i-AV_NPC_A_MARSHAL_SOUTH));
|
||||
for (i = AV_NPC_A_MARSHAL_SOUTH; i <= AV_NPC_H_MARSHAL_WTOWER; i++)
|
||||
AddAVCreature(i, AV_CPLACE_A_MARSHAL_SOUTH + (i - AV_NPC_A_MARSHAL_SOUTH));
|
||||
AddAVCreature(AV_NPC_HERALD, AV_CPLACE_HERALD);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team)
|
||||
}
|
||||
else // save
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_CHANNEL);
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_CHANNEL);
|
||||
stmt->setString(0, name);
|
||||
stmt->setUInt32(1, m_Team);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
@@ -563,12 +563,12 @@ void Channel::List(Player* player)
|
||||
uint32 count = 0;
|
||||
for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
|
||||
{
|
||||
Player* player = ObjectAccessor::FindPlayer(i->first);
|
||||
Player* member = ObjectAccessor::FindPlayer(i->first);
|
||||
|
||||
// PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters
|
||||
// MODERATOR, GAME MASTER, ADMINISTRATOR can see all
|
||||
if (player && (!AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) || player->GetSession()->GetSecurity() <= AccountTypes(gmLevelInWhoList)) &&
|
||||
player->IsVisibleGloballyFor(player))
|
||||
if (member && (!AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) || member->GetSession()->GetSecurity() <= AccountTypes(gmLevelInWhoList)) &&
|
||||
member->IsVisibleGloballyFor(player))
|
||||
{
|
||||
data << uint64(i->first);
|
||||
data << uint8(i->second.flags); // flags seems to be changed...
|
||||
|
||||
@@ -349,18 +349,18 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
|
||||
|
||||
std::string bannedby = "unknown";
|
||||
std::string banreason = "";
|
||||
if (QueryResult result = LoginDatabase.PQuery("SELECT unbandate, bandate = unbandate, bannedby, banreason FROM account_banned "
|
||||
if (QueryResult result2 = LoginDatabase.PQuery("SELECT unbandate, bandate = unbandate, bannedby, banreason FROM account_banned "
|
||||
"WHERE id = '%u' AND active ORDER BY bandate ASC LIMIT 1", accId))
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
Field* fields = result2->Fetch();
|
||||
banTime = fields[1].GetBool() ? 0 : fields[0].GetUInt64();
|
||||
bannedby = fields[2].GetString();
|
||||
banreason = fields[3].GetString();
|
||||
}
|
||||
else if (QueryResult result = CharacterDatabase.PQuery("SELECT unbandate, bandate = unbandate, bannedby, banreason FROM character_banned "
|
||||
else if (QueryResult result3 = CharacterDatabase.PQuery("SELECT unbandate, bandate = unbandate, bannedby, banreason FROM character_banned "
|
||||
"WHERE guid = '%u' AND active ORDER BY bandate ASC LIMIT 1", GUID_LOPART(target_guid)))
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
Field* fields = result3->Fetch();
|
||||
banTime = fields[1].GetBool() ? 0 : fields[0].GetUInt64();
|
||||
bannedby = fields[2].GetString();
|
||||
banreason = fields[3].GetString();
|
||||
|
||||
@@ -277,12 +277,12 @@ bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags
|
||||
{
|
||||
case DISABLE_TYPE_SPELL:
|
||||
{
|
||||
uint8 flags = itr->second.flags;
|
||||
uint8 spellFlags = itr->second.flags;
|
||||
if (unit)
|
||||
{
|
||||
|
||||
if ((flags & SPELL_DISABLE_PLAYER && unit->GetTypeId() == TYPEID_PLAYER) ||
|
||||
(unit->GetTypeId() == TYPEID_UNIT && ((unit->ToCreature()->isPet() && flags & SPELL_DISABLE_PET) || flags & SPELL_DISABLE_CREATURE)))
|
||||
if ((spellFlags & SPELL_DISABLE_PLAYER && unit->GetTypeId() == TYPEID_PLAYER) ||
|
||||
(unit->GetTypeId() == TYPEID_UNIT && ((unit->ToCreature()->isPet() && spellFlags & SPELL_DISABLE_PET) || spellFlags & SPELL_DISABLE_CREATURE)))
|
||||
{
|
||||
if (flags & SPELL_DISABLE_MAP)
|
||||
{
|
||||
@@ -290,13 +290,13 @@ bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags
|
||||
if (mapIds.find(unit->GetMapId()) != mapIds.end())
|
||||
return true; // Spell is disabled on current map
|
||||
|
||||
if (!(flags & SPELL_DISABLE_AREA))
|
||||
if (!(spellFlags & SPELL_DISABLE_AREA))
|
||||
return false; // Spell is disabled on another map, but not this one, return false
|
||||
|
||||
// Spell is disabled in an area, but not explicitly our current mapId. Continue processing.
|
||||
}
|
||||
|
||||
if (flags & SPELL_DISABLE_AREA)
|
||||
if (spellFlags & SPELL_DISABLE_AREA)
|
||||
{
|
||||
std::set<uint32> const& areaIds = itr->second.params[1];
|
||||
if (areaIds.find(unit->GetAreaId()) != areaIds.end())
|
||||
|
||||
@@ -254,7 +254,7 @@ void LFGMgr::Update(uint32 diff)
|
||||
if (m_QueueTimer > LFG_QUEUEUPDATE_INTERVAL)
|
||||
{
|
||||
m_QueueTimer = 0;
|
||||
time_t currTime = time(NULL);
|
||||
currTime = time(NULL);
|
||||
for (LfgQueueInfoMap::const_iterator itQueue = m_QueueInfoMap.begin(); itQueue != m_QueueInfoMap.end(); ++itQueue)
|
||||
{
|
||||
LfgQueueInfo* queue = itQueue->second;
|
||||
@@ -689,10 +689,9 @@ void LFGMgr::Leave(Player* player, Group* grp /* = NULL*/)
|
||||
{
|
||||
// Remove from Proposals
|
||||
LfgProposalMap::iterator it = m_Proposals.begin();
|
||||
uint64 guid = player ? player->GetGUID() : grp->GetLeaderGUID();
|
||||
while (it != m_Proposals.end())
|
||||
{
|
||||
LfgProposalPlayerMap::iterator itPlayer = it->second->players.find(guid);
|
||||
LfgProposalPlayerMap::iterator itPlayer = it->second->players.find(player ? player->GetGUID() : grp->GetLeaderGUID());
|
||||
if (itPlayer != it->second->players.end())
|
||||
{
|
||||
// Mark the player/leader of group who left as didn't accept the proposal
|
||||
@@ -1069,10 +1068,10 @@ void LFGMgr::UpdateRoleCheck(uint64 gguid, uint64 guid /* = 0 */, uint8 roles /*
|
||||
// Set queue roles needed - As we are using check_roles will not have more that 1 tank, 1 healer, 3 dps
|
||||
for (LfgRolesMap::const_iterator it = check_roles.begin(); it != check_roles.end(); ++it)
|
||||
{
|
||||
uint8 roles = it->second;
|
||||
if (roles & ROLE_TANK)
|
||||
uint8 roles2 = it->second;
|
||||
if (roles2 & ROLE_TANK)
|
||||
--pqInfo->tanks;
|
||||
else if (roles & ROLE_HEALER)
|
||||
else if (roles2 & ROLE_HEALER)
|
||||
--pqInfo->healers;
|
||||
else
|
||||
--pqInfo->dps;
|
||||
@@ -1152,14 +1151,14 @@ void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, const PlayerSet& pla
|
||||
{
|
||||
uint64 guid = (*it)->GetGUID();
|
||||
LfgLockMap cachedLockMap = GetLockedDungeons(guid);
|
||||
for (LfgLockMap::const_iterator it = cachedLockMap.begin(); it != cachedLockMap.end() && dungeons.size(); ++it)
|
||||
for (LfgLockMap::const_iterator it2 = cachedLockMap.begin(); it2 != cachedLockMap.end() && dungeons.size(); ++it2)
|
||||
{
|
||||
uint32 dungeonId = (it->first & 0x00FFFFFF); // Compare dungeon ids
|
||||
uint32 dungeonId = (it2->first & 0x00FFFFFF); // Compare dungeon ids
|
||||
LfgDungeonSet::iterator itDungeon = dungeons.find(dungeonId);
|
||||
if (itDungeon != dungeons.end())
|
||||
{
|
||||
dungeons.erase(itDungeon);
|
||||
lockMap[guid][dungeonId] = it->second;
|
||||
lockMap[guid][dungeonId] = it2->second;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1313,8 +1312,8 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
|
||||
if (player->groupLowGuid != lowgroupguid)
|
||||
sLog->outError("LFGMgr::UpdateProposal: [" UI64FMTD "] group mismatch: actual (%u) - queued (%u)", (*it)->GetGUID(), lowgroupguid, player->groupLowGuid);
|
||||
|
||||
uint64 guid = player->groupLowGuid ? MAKE_NEW_GUID(player->groupLowGuid, 0, HIGHGUID_GROUP) : (*it)->GetGUID();
|
||||
LfgQueueInfoMap::iterator itQueue = m_QueueInfoMap.find(guid);
|
||||
uint64 guid2 = player->groupLowGuid ? MAKE_NEW_GUID(player->groupLowGuid, 0, HIGHGUID_GROUP) : (*it)->GetGUID();
|
||||
LfgQueueInfoMap::iterator itQueue = m_QueueInfoMap.find(guid2);
|
||||
if (itQueue == m_QueueInfoMap.end())
|
||||
{
|
||||
sLog->outError("LFGMgr::UpdateProposal: Queue info for guid [" UI64FMTD "] not found!", guid);
|
||||
@@ -1399,10 +1398,7 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
|
||||
|
||||
// Remove players/groups from Queue
|
||||
for (LfgGuidList::const_iterator it = pProposal->queues.begin(); it != pProposal->queues.end(); ++it)
|
||||
{
|
||||
uint64 guid = (*it);
|
||||
RemoveFromQueue(guid);
|
||||
}
|
||||
RemoveFromQueue(*it);
|
||||
|
||||
// Teleport Player
|
||||
for (LfgPlayerList::const_iterator it = playersToTeleport.begin(); it != playersToTeleport.end(); ++it)
|
||||
|
||||
@@ -382,29 +382,29 @@ void Pet::SavePetToDB(PetSaveMode mode)
|
||||
// current/stable/not_in_slot
|
||||
if (mode >= PET_SAVE_AS_CURRENT)
|
||||
{
|
||||
uint32 owner = GUID_LOPART(GetOwnerGUID());
|
||||
uint32 ownerLowGUID = GUID_LOPART(GetOwnerGUID());
|
||||
std::string name = m_name;
|
||||
CharacterDatabase.EscapeString(name);
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
trans = CharacterDatabase.BeginTransaction();
|
||||
// remove current data
|
||||
trans->PAppend("DELETE FROM character_pet WHERE owner = '%u' AND id = '%u'", owner, m_charmInfo->GetPetNumber());
|
||||
|
||||
// prevent duplicate using slot (except PET_SAVE_NOT_IN_SLOT)
|
||||
if (mode <= PET_SAVE_LAST_STABLE_SLOT)
|
||||
trans->PAppend("UPDATE character_pet SET slot = '%u' WHERE owner = '%u' AND slot = '%u'",
|
||||
PET_SAVE_NOT_IN_SLOT, owner, uint32(mode));
|
||||
PET_SAVE_NOT_IN_SLOT, ownerLowGUID, uint32(mode));
|
||||
|
||||
// prevent existence another hunter pet in PET_SAVE_AS_CURRENT and PET_SAVE_NOT_IN_SLOT
|
||||
if (getPetType() == HUNTER_PET && (mode == PET_SAVE_AS_CURRENT||mode > PET_SAVE_LAST_STABLE_SLOT))
|
||||
if (getPetType() == HUNTER_PET && (mode == PET_SAVE_AS_CURRENT || mode > PET_SAVE_LAST_STABLE_SLOT))
|
||||
trans->PAppend("DELETE FROM character_pet WHERE owner = '%u' AND (slot = '%u' OR slot > '%u')",
|
||||
owner, PET_SAVE_AS_CURRENT, PET_SAVE_LAST_STABLE_SLOT);
|
||||
ownerLowGUID, PET_SAVE_AS_CURRENT, PET_SAVE_LAST_STABLE_SLOT);
|
||||
// save pet
|
||||
std::ostringstream ss;
|
||||
ss << "INSERT INTO character_pet (id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, curhappiness, abdata, savetime, CreatedBySpell, PetType) "
|
||||
<< "VALUES ("
|
||||
<< m_charmInfo->GetPetNumber() << ','
|
||||
<< GetEntry() << ','
|
||||
<< owner << ','
|
||||
<< ownerLowGUID << ','
|
||||
<< GetNativeDisplayId() << ','
|
||||
<< uint32(getLevel()) << ','
|
||||
<< GetUInt32Value(UNIT_FIELD_PETEXPERIENCE) << ','
|
||||
|
||||
@@ -365,9 +365,9 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
|
||||
if (keyFrames[keyFrames.size() - 1].node->mapid != keyFrames[0].node->mapid)
|
||||
teleport = true;
|
||||
|
||||
WayPoint pos(keyFrames[0].node->mapid, keyFrames[0].node->x, keyFrames[0].node->y, keyFrames[0].node->z, teleport, 0,
|
||||
m_WayPoints[0] = WayPoint(keyFrames[0].node->mapid, keyFrames[0].node->x, keyFrames[0].node->y, keyFrames[0].node->z, teleport, 0,
|
||||
keyFrames[0].node->arrivalEventID, keyFrames[0].node->departureEventID);
|
||||
m_WayPoints[0] = pos;
|
||||
|
||||
t += keyFrames[0].node->delay * 1000;
|
||||
|
||||
uint32 cM = keyFrames[0].node->mapid;
|
||||
@@ -387,12 +387,11 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
|
||||
|
||||
if (d > 0)
|
||||
{
|
||||
float newX, newY, newZ;
|
||||
newX = keyFrames[i].node->x + (keyFrames[i + 1].node->x - keyFrames[i].node->x) * d / keyFrames[i + 1].distFromPrev;
|
||||
newY = keyFrames[i].node->y + (keyFrames[i + 1].node->y - keyFrames[i].node->y) * d / keyFrames[i + 1].distFromPrev;
|
||||
newZ = keyFrames[i].node->z + (keyFrames[i + 1].node->z - keyFrames[i].node->z) * d / keyFrames[i + 1].distFromPrev;
|
||||
float newX = keyFrames[i].node->x + (keyFrames[i + 1].node->x - keyFrames[i].node->x) * d / keyFrames[i + 1].distFromPrev;
|
||||
float newY = keyFrames[i].node->y + (keyFrames[i + 1].node->y - keyFrames[i].node->y) * d / keyFrames[i + 1].distFromPrev;
|
||||
float newZ = keyFrames[i].node->z + (keyFrames[i + 1].node->z - keyFrames[i].node->z) * d / keyFrames[i + 1].distFromPrev;
|
||||
|
||||
bool teleport = false;
|
||||
teleport = false;
|
||||
if (keyFrames[i].node->mapid != cM)
|
||||
{
|
||||
teleport = true;
|
||||
@@ -400,9 +399,8 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
|
||||
}
|
||||
|
||||
// sLog->outString("T: %d, D: %f, x: %f, y: %f, z: %f", t, d, newX, newY, newZ);
|
||||
WayPoint pos(keyFrames[i].node->mapid, newX, newY, newZ, teleport, 0);
|
||||
if (teleport)
|
||||
m_WayPoints[t] = pos;
|
||||
m_WayPoints[t] = WayPoint(keyFrames[i].node->mapid, newX, newY, newZ, teleport, 0);
|
||||
}
|
||||
|
||||
if (tFrom < tTo) // caught in tFrom dock's "gravitational pull"
|
||||
@@ -439,25 +437,18 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
|
||||
else
|
||||
t += (long)keyFrames[i + 1].tTo % 100;
|
||||
|
||||
bool teleport = false;
|
||||
teleport = false;
|
||||
if ((keyFrames[i + 1].node->actionFlag == 1) || (keyFrames[i + 1].node->mapid != keyFrames[i].node->mapid))
|
||||
{
|
||||
teleport = true;
|
||||
cM = keyFrames[i + 1].node->mapid;
|
||||
}
|
||||
|
||||
WayPoint pos(keyFrames[i + 1].node->mapid, keyFrames[i + 1].node->x, keyFrames[i + 1].node->y, keyFrames[i + 1].node->z, teleport,
|
||||
m_WayPoints[t] = WayPoint(keyFrames[i + 1].node->mapid, keyFrames[i + 1].node->x, keyFrames[i + 1].node->y, keyFrames[i + 1].node->z, teleport,
|
||||
0, keyFrames[i + 1].node->arrivalEventID, keyFrames[i + 1].node->departureEventID);
|
||||
// sLog->outString("T: %d, x: %f, y: %f, z: %f, t:%d", t, pos.x, pos.y, pos.z, teleport);
|
||||
/*
|
||||
if (keyFrames[i+1].delay > 5)
|
||||
pos.delayed = true;
|
||||
*/
|
||||
//if (teleport)
|
||||
m_WayPoints[t] = pos;
|
||||
|
||||
t += keyFrames[i + 1].node->delay * 1000;
|
||||
// sLog->outString("------");
|
||||
}
|
||||
|
||||
uint32 timer = t;
|
||||
|
||||
@@ -7027,7 +7027,7 @@ bool Spell::CallScriptEffectHandlers(SpellEffIndex effIndex, SpellEffectHandleMo
|
||||
break;
|
||||
default:
|
||||
ASSERT(false);
|
||||
break;
|
||||
return;
|
||||
}
|
||||
(*scritr)->_PrepareScriptCall(hookType);
|
||||
for (; effItr != effEndItr ; ++effItr)
|
||||
|
||||
@@ -136,9 +136,9 @@ public:
|
||||
{
|
||||
uint8 r = rand()%4;
|
||||
uint8 pos[3];
|
||||
pos[RED_PORTAL] = (r%2 ? (r>1 ? 2: 1): 0);
|
||||
pos[GREEN_PORTAL] = (r%2 ? 0: (r>1 ? 2: 1));
|
||||
pos[BLUE_PORTAL] = (r>1 ? 1: 2); // Blue Portal not on the left side (0)
|
||||
pos[RED_PORTAL] = ((r % 2) ? (r > 1 ? 2 : 1) : 0);
|
||||
pos[GREEN_PORTAL] = ((r % 2) ? 0 : (r > 1 ? 2 : 1));
|
||||
pos[BLUE_PORTAL] = (r > 1 ? 1 : 2); // Blue Portal not on the left side (0)
|
||||
|
||||
for (int i=0; i<3; ++i)
|
||||
if (Creature* portal = me->SummonCreature(PortalID[i], PortalCoord[pos[i]][0], PortalCoord[pos[i]][1], PortalCoord[pos[i]][2], 0, TEMPSUMMON_TIMED_DESPAWN, 60000))
|
||||
|
||||
@@ -94,7 +94,7 @@ public:
|
||||
|
||||
void KilledUnit(Unit* /*victim*/)
|
||||
{
|
||||
DoScriptText(rand()%2 ? SAY_SLAY1 : SAY_SLAY2, me);
|
||||
DoScriptText(urand(0, 1) ? SAY_SLAY1 : SAY_SLAY2, me);
|
||||
events.DelayEvents(5000, GCD_YELL);
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ public:
|
||||
SpineTargetGUID = target->GetGUID();
|
||||
//must let target summon, otherwise you cannot click the spine
|
||||
target->SummonGameObject(GOBJECT_SPINE, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), me->GetOrientation(), 0, 0, 0, 0, 30);
|
||||
DoScriptText(rand()%2 ? SAY_NEEDLE1 : SAY_NEEDLE2, me);
|
||||
DoScriptText(urand(0, 1) ? SAY_NEEDLE1 : SAY_NEEDLE2, me);
|
||||
events.DelayEvents(1500, GCD_CAST);
|
||||
events.DelayEvents(15000, GCD_YELL);
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ public:
|
||||
{
|
||||
me->MonsterTextEmote(EMOTE_SPOUT, 0, true);
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
me->GetMotionMaster()->MoveRotate(20000, rand()%2 ? ROTATE_DIRECTION_LEFT : ROTATE_DIRECTION_RIGHT);
|
||||
me->GetMotionMaster()->MoveRotate(20000, urand(0, 1) ? ROTATE_DIRECTION_LEFT : ROTATE_DIRECTION_RIGHT);
|
||||
SpoutTimer = 45000;
|
||||
WhirlTimer = 20000;//whirl directly after spout
|
||||
RotTimer = 20000;
|
||||
|
||||
@@ -556,10 +556,10 @@ void Log::outSQLDriver(const char* str, ...)
|
||||
{
|
||||
outTimestamp(sqlLogFile);
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, str);
|
||||
vfprintf(sqlLogFile, str, ap);
|
||||
va_end(ap);
|
||||
va_list apSQL;
|
||||
va_start(apSQL, str);
|
||||
vfprintf(sqlLogFile, str, apSQL);
|
||||
va_end(apSQL);
|
||||
|
||||
fprintf(sqlLogFile, "\n");
|
||||
fflush(sqlLogFile);
|
||||
@@ -646,11 +646,11 @@ void Log::outBasic(const char * str, ...)
|
||||
if (logfile)
|
||||
{
|
||||
outTimestamp(logfile);
|
||||
va_list ap;
|
||||
va_start(ap, str);
|
||||
vfprintf(logfile, str, ap);
|
||||
va_list ap2;
|
||||
va_start(ap2, str);
|
||||
vfprintf(logfile, str, ap2);
|
||||
fprintf(logfile, "\n" );
|
||||
va_end(ap);
|
||||
va_end(ap2);
|
||||
fflush(logfile);
|
||||
}
|
||||
}
|
||||
@@ -690,10 +690,10 @@ void Log::outDetail(const char * str, ...)
|
||||
if (logfile)
|
||||
{
|
||||
outTimestamp(logfile);
|
||||
va_list ap;
|
||||
va_start(ap, str);
|
||||
vfprintf(logfile, str, ap);
|
||||
va_end(ap);
|
||||
va_list ap2;
|
||||
va_start(ap2, str);
|
||||
vfprintf(logfile, str, ap2);
|
||||
va_end(ap2);
|
||||
|
||||
fprintf(logfile, "\n");
|
||||
fflush(logfile);
|
||||
@@ -720,10 +720,10 @@ void Log::outDebugInLine(const char * str, ...)
|
||||
|
||||
if (logfile)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, str);
|
||||
vfprintf(logfile, str, ap);
|
||||
va_end(ap);
|
||||
va_list ap2;
|
||||
va_start(ap2, str);
|
||||
vfprintf(logfile, str, ap2);
|
||||
va_end(ap2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -742,10 +742,10 @@ void Log::outSQLDev(const char* str, ...)
|
||||
|
||||
if (sqlDevLogFile)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, str);
|
||||
vfprintf(sqlDevLogFile, str, ap);
|
||||
va_end(ap);
|
||||
va_list ap2;
|
||||
va_start(ap2, str);
|
||||
vfprintf(sqlDevLogFile, str, ap2);
|
||||
va_end(ap2);
|
||||
|
||||
fprintf(sqlDevLogFile, "\n");
|
||||
fflush(sqlDevLogFile);
|
||||
@@ -790,10 +790,10 @@ void Log::outDebug(DebugLogFilters f, const char * str, ...)
|
||||
if (logfile)
|
||||
{
|
||||
outTimestamp(logfile);
|
||||
va_list ap;
|
||||
va_start(ap, str);
|
||||
vfprintf(logfile, str, ap);
|
||||
va_end(ap);
|
||||
va_list ap2;
|
||||
va_start(ap2, str);
|
||||
vfprintf(logfile, str, ap2);
|
||||
va_end(ap2);
|
||||
|
||||
fprintf(logfile, "\n" );
|
||||
fflush(logfile);
|
||||
@@ -835,10 +835,10 @@ void Log::outStaticDebug(const char * str, ...)
|
||||
if (logfile)
|
||||
{
|
||||
outTimestamp(logfile);
|
||||
va_list ap;
|
||||
va_start(ap, str);
|
||||
vfprintf(logfile, str, ap);
|
||||
va_end(ap);
|
||||
va_list ap2;
|
||||
va_start(ap2, str);
|
||||
vfprintf(logfile, str, ap2);
|
||||
va_end(ap2);
|
||||
|
||||
fprintf(logfile, "\n" );
|
||||
fflush(logfile);
|
||||
@@ -900,11 +900,11 @@ void Log::outCommand(uint32 account, const char * str, ...)
|
||||
if (logfile)
|
||||
{
|
||||
outTimestamp(logfile);
|
||||
va_list ap;
|
||||
va_start(ap, str);
|
||||
vfprintf(logfile, str, ap);
|
||||
va_list ap2;
|
||||
va_start(ap2, str);
|
||||
vfprintf(logfile, str, ap2);
|
||||
fprintf(logfile, "\n" );
|
||||
va_end(ap);
|
||||
va_end(ap2);
|
||||
fflush(logfile);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user