mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 01:37:00 +00:00
Style cleanup from the Mangos Futures Team
This commit is contained in:
parent
809eee0f50
commit
283c68b6a9
203 changed files with 12039 additions and 353 deletions
|
|
@ -1174,14 +1174,18 @@ bool AuctionBotSeller::Initialize()
|
||||||
std::stringstream includeStream(sAuctionBotConfig.GetAHBotIncludes());
|
std::stringstream includeStream(sAuctionBotConfig.GetAHBotIncludes());
|
||||||
std::string temp;
|
std::string temp;
|
||||||
while (getline(includeStream, temp, ','))
|
while (getline(includeStream, temp, ','))
|
||||||
{ includeItems.push_back(atoi(temp.c_str())); }
|
{
|
||||||
|
includeItems.push_back(atoi(temp.c_str()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
std::stringstream excludeStream(sAuctionBotConfig.GetAHBotExcludes());
|
std::stringstream excludeStream(sAuctionBotConfig.GetAHBotExcludes());
|
||||||
std::string temp;
|
std::string temp;
|
||||||
while (getline(excludeStream, temp, ','))
|
while (getline(excludeStream, temp, ','))
|
||||||
{ excludeItems.push_back(atoi(temp.c_str())); }
|
{
|
||||||
|
excludeItems.push_back(atoi(temp.c_str()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sLog.outString("Forced Inclusion " SIZEFMTD " items", includeItems.size());
|
sLog.outString("Forced Inclusion " SIZEFMTD " items", includeItems.size());
|
||||||
sLog.outString("Forced Exclusion " SIZEFMTD " items", excludeItems.size());
|
sLog.outString("Forced Exclusion " SIZEFMTD " items", excludeItems.size());
|
||||||
|
|
@ -1492,17 +1496,25 @@ bool AuctionBotSeller::Initialize()
|
||||||
{
|
{
|
||||||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_MISC_MOUNT_MIN_REQ_LEVEL))
|
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_MISC_MOUNT_MIN_REQ_LEVEL))
|
||||||
if (prototype->RequiredLevel < value)
|
if (prototype->RequiredLevel < value)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_MISC_MOUNT_MAX_REQ_LEVEL))
|
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_MISC_MOUNT_MAX_REQ_LEVEL))
|
||||||
if (prototype->RequiredLevel > value)
|
if (prototype->RequiredLevel > value)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_MISC_MOUNT_MIN_SKILL_RANK))
|
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_MISC_MOUNT_MIN_SKILL_RANK))
|
||||||
if (prototype->RequiredSkillRank < value)
|
if (prototype->RequiredSkillRank < value)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_MISC_MOUNT_MAX_SKILL_RANK))
|
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_MISC_MOUNT_MAX_SKILL_RANK))
|
||||||
if (prototype->RequiredSkillRank > value)
|
if (prototype->RequiredSkillRank > value)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (prototype->Flags & ITEM_FLAG_LOOTABLE)
|
if (prototype->Flags & ITEM_FLAG_LOOTABLE)
|
||||||
{
|
{
|
||||||
|
|
@ -1523,16 +1535,24 @@ bool AuctionBotSeller::Initialize()
|
||||||
{
|
{
|
||||||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_GLYPH_MIN_REQ_LEVEL))
|
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_GLYPH_MIN_REQ_LEVEL))
|
||||||
if (prototype->RequiredLevel < value)
|
if (prototype->RequiredLevel < value)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_GLYPH_MAX_REQ_LEVEL))
|
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_GLYPH_MAX_REQ_LEVEL))
|
||||||
if (prototype->RequiredLevel > value)
|
if (prototype->RequiredLevel > value)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_GLYPH_MIN_ITEM_LEVEL))
|
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_GLYPH_MIN_ITEM_LEVEL))
|
||||||
if (prototype->RequiredLevel < value)
|
if (prototype->RequiredLevel < value)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_GLYPH_MAX_ITEM_LEVEL))
|
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_GLYPH_MAX_ITEM_LEVEL))
|
||||||
if (prototype->RequiredLevel > value)
|
if (prototype->RequiredLevel > value)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ITEM_CLASS_TRADE_GOODS:
|
case ITEM_CLASS_TRADE_GOODS:
|
||||||
|
|
@ -2177,9 +2197,11 @@ void AuctionHouseBot::Rebuild(bool all)
|
||||||
AuctionEntry* entry = itr->second;
|
AuctionEntry* entry = itr->second;
|
||||||
if (entry->owner == sAuctionBotConfig.GetAHBotId()) // ahbot auction
|
if (entry->owner == sAuctionBotConfig.GetAHBotId()) // ahbot auction
|
||||||
if (all || entry->bid == 0) // expire auction now if no bid or forced
|
if (all || entry->bid == 0) // expire auction now if no bid or forced
|
||||||
|
{
|
||||||
entry->expireTime = sWorld.GetGameTime();
|
entry->expireTime = sWorld.GetGameTime();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AuctionHouseBot::Update()
|
void AuctionHouseBot::Update()
|
||||||
|
|
|
||||||
|
|
@ -443,12 +443,16 @@ void BattleGround::Update(uint32 diff)
|
||||||
|
|
||||||
for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||||
if (Player* player = sObjectMgr.GetPlayer(itr->first))
|
if (Player* player = sObjectMgr.GetPlayer(itr->first))
|
||||||
|
{
|
||||||
player->GetSession()->SendPacket(&data);
|
player->GetSession()->SendPacket(&data);
|
||||||
|
}
|
||||||
|
|
||||||
m_CountdownTimer = 0;
|
m_CountdownTimer = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_CountdownTimer += diff;
|
m_CountdownTimer += diff;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(m_Events & BG_STARTING_EVENT_1))
|
if (!(m_Events & BG_STARTING_EVENT_1))
|
||||||
{
|
{
|
||||||
|
|
@ -491,8 +495,10 @@ void BattleGround::Update(uint32 diff)
|
||||||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (Player* player = sObjectMgr.GetPlayer(itr->first))
|
if (Player* player = sObjectMgr.GetPlayer(itr->first))
|
||||||
|
{
|
||||||
player->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION);
|
player->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CheckArenaWinConditions();
|
CheckArenaWinConditions();
|
||||||
}
|
}
|
||||||
|
|
@ -502,7 +508,9 @@ void BattleGround::Update(uint32 diff)
|
||||||
|
|
||||||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||||
if (Player* plr = sObjectMgr.GetPlayer(itr->first))
|
if (Player* plr = sObjectMgr.GetPlayer(itr->first))
|
||||||
|
{
|
||||||
plr->RemoveAurasDueToSpell(SPELL_PREPARATION);
|
plr->RemoveAurasDueToSpell(SPELL_PREPARATION);
|
||||||
|
}
|
||||||
// Announce BG starting
|
// Announce BG starting
|
||||||
if (sWorld.getConfig(CONFIG_BOOL_BATTLEGROUND_QUEUE_ANNOUNCER_START))
|
if (sWorld.getConfig(CONFIG_BOOL_BATTLEGROUND_QUEUE_ANNOUNCER_START))
|
||||||
{
|
{
|
||||||
|
|
@ -922,10 +930,14 @@ void BattleGround::EndBattleGround(Team winner)
|
||||||
if (isArena() && isRated() && winner_arena_team && loser_arena_team)
|
if (isArena() && isRated() && winner_arena_team && loser_arena_team)
|
||||||
{
|
{
|
||||||
if (team == winner)
|
if (team == winner)
|
||||||
|
{
|
||||||
winner_arena_team->OfflineMemberLost(itr->first, loser_rating);
|
winner_arena_team->OfflineMemberLost(itr->first, loser_rating);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
loser_arena_team->OfflineMemberLost(itr->first, winner_rating);
|
loser_arena_team->OfflineMemberLost(itr->first, winner_rating);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -965,7 +977,9 @@ void BattleGround::EndBattleGround(Team winner)
|
||||||
// update achievement BEFORE personal rating update
|
// update achievement BEFORE personal rating update
|
||||||
ArenaTeamMember* member = winner_arena_team->GetMember(plr->GetObjectGuid());
|
ArenaTeamMember* member = winner_arena_team->GetMember(plr->GetObjectGuid());
|
||||||
if (member)
|
if (member)
|
||||||
|
{
|
||||||
plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, member->personal_rating);
|
plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, member->personal_rating);
|
||||||
|
}
|
||||||
|
|
||||||
winner_arena_team->MemberWon(plr, loser_rating);
|
winner_arena_team->MemberWon(plr, loser_rating);
|
||||||
plr->ModifyCurrencyCount(CURRENCY_CONQUEST_ARENA_META, sWorld.getConfig(CONFIG_UINT32_CURRENCY_ARENA_CONQUEST_POINTS_REWARD));
|
plr->ModifyCurrencyCount(CURRENCY_CONQUEST_ARENA_META, sWorld.getConfig(CONFIG_UINT32_CURRENCY_ARENA_CONQUEST_POINTS_REWARD));
|
||||||
|
|
@ -1344,9 +1358,11 @@ void BattleGround::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool Sen
|
||||||
ArenaTeam* winner_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
|
ArenaTeam* winner_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
|
||||||
ArenaTeam* loser_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(team));
|
ArenaTeam* loser_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(team));
|
||||||
if (winner_arena_team && loser_arena_team)
|
if (winner_arena_team && loser_arena_team)
|
||||||
|
{
|
||||||
loser_arena_team->MemberLost(plr, winner_arena_team->GetRating());
|
loser_arena_team->MemberLost(plr, winner_arena_team->GetRating());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (SendPacket)
|
if (SendPacket)
|
||||||
{
|
{
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
|
|
@ -1366,9 +1382,11 @@ void BattleGround::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool Sen
|
||||||
ArenaTeam* others_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
|
ArenaTeam* others_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
|
||||||
ArenaTeam* players_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(team));
|
ArenaTeam* players_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(team));
|
||||||
if (others_arena_team && players_arena_team)
|
if (others_arena_team && players_arena_team)
|
||||||
|
{
|
||||||
players_arena_team->OfflineMemberLost(guid, others_arena_team->GetRating());
|
players_arena_team->OfflineMemberLost(guid, others_arena_team->GetRating());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// remove from raid group if player is member
|
// remove from raid group if player is member
|
||||||
if (Group* group = GetBgRaid(team))
|
if (Group* group = GetBgRaid(team))
|
||||||
|
|
@ -1476,7 +1494,9 @@ void BattleGround::StartTimedAchievement(AchievementCriteriaTypes type, uint32 e
|
||||||
{
|
{
|
||||||
for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||||
if (Player* pPlayer = GetBgMap()->GetPlayer(itr->first))
|
if (Player* pPlayer = GetBgMap()->GetPlayer(itr->first))
|
||||||
|
{
|
||||||
pPlayer->GetAchievementMgr().StartTimedAchievementCriteria(type, entry);
|
pPlayer->GetAchievementMgr().StartTimedAchievementCriteria(type, entry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGround::AddPlayer(Player* plr)
|
void BattleGround::AddPlayer(Player* plr)
|
||||||
|
|
@ -1514,30 +1534,42 @@ void BattleGround::AddPlayer(Player* plr)
|
||||||
if (team == ALLIANCE) // gold
|
if (team == ALLIANCE) // gold
|
||||||
{
|
{
|
||||||
if (plr->GetTeam() == HORDE)
|
if (plr->GetTeam() == HORDE)
|
||||||
|
{
|
||||||
plr->CastSpell(plr, SPELL_HORDE_GOLD_FLAG, true);
|
plr->CastSpell(plr, SPELL_HORDE_GOLD_FLAG, true);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
plr->CastSpell(plr, SPELL_ALLIANCE_GOLD_FLAG, true);
|
plr->CastSpell(plr, SPELL_ALLIANCE_GOLD_FLAG, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else // green
|
else // green
|
||||||
{
|
{
|
||||||
if (plr->GetTeam() == HORDE)
|
if (plr->GetTeam() == HORDE)
|
||||||
|
{
|
||||||
plr->CastSpell(plr, SPELL_HORDE_GREEN_FLAG, true);
|
plr->CastSpell(plr, SPELL_HORDE_GREEN_FLAG, true);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
plr->CastSpell(plr, SPELL_ALLIANCE_GREEN_FLAG, true);
|
plr->CastSpell(plr, SPELL_ALLIANCE_GREEN_FLAG, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
plr->DestroyConjuredItems(true);
|
plr->DestroyConjuredItems(true);
|
||||||
plr->UnsummonPetTemporaryIfAny();
|
plr->UnsummonPetTemporaryIfAny();
|
||||||
|
|
||||||
if (GetStatus() == STATUS_WAIT_JOIN) // not started yet
|
if (GetStatus() == STATUS_WAIT_JOIN) // not started yet
|
||||||
|
{
|
||||||
plr->CastSpell(plr, SPELL_ARENA_PREPARATION, true);
|
plr->CastSpell(plr, SPELL_ARENA_PREPARATION, true);
|
||||||
|
}
|
||||||
|
|
||||||
plr->CastSpell(plr, SPELL_ARENA_DAMPENING, true);
|
plr->CastSpell(plr, SPELL_ARENA_DAMPENING, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (GetStatus() == STATUS_WAIT_JOIN) // not started yet
|
if (GetStatus() == STATUS_WAIT_JOIN) // not started yet
|
||||||
|
{
|
||||||
plr->CastSpell(plr, SPELL_PREPARATION, true); // reduces all mana cost of spells.
|
plr->CastSpell(plr, SPELL_PREPARATION, true); // reduces all mana cost of spells.
|
||||||
|
}
|
||||||
|
|
||||||
plr->CastSpell(plr, SPELL_BATTLEGROUND_DAMPENING, true);
|
plr->CastSpell(plr, SPELL_BATTLEGROUND_DAMPENING, true);
|
||||||
}
|
}
|
||||||
|
|
@ -1636,8 +1668,10 @@ void BattleGround::EventPlayerLoggedOut(Player* player)
|
||||||
// 1 player is logging out, if it is the last, then end arena!
|
// 1 player is logging out, if it is the last, then end arena!
|
||||||
if (isArena())
|
if (isArena())
|
||||||
if (GetAlivePlayersCountByTeam(player->GetTeam()) <= 1 && GetPlayersCountByTeam(GetOtherTeam(player->GetTeam())))
|
if (GetAlivePlayersCountByTeam(player->GetTeam()) <= 1 && GetPlayersCountByTeam(GetOtherTeam(player->GetTeam())))
|
||||||
|
{
|
||||||
EndBattleGround(GetOtherTeam(player->GetTeam()));
|
EndBattleGround(GetOtherTeam(player->GetTeam()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -1729,8 +1763,10 @@ void BattleGround::UpdatePlayerScore(Player* Source, uint32 type, uint32 value)
|
||||||
{
|
{
|
||||||
// reward honor instantly
|
// reward honor instantly
|
||||||
if (Source->RewardHonor(NULL, 1, (float)value))
|
if (Source->RewardHonor(NULL, 1, (float)value))
|
||||||
|
{
|
||||||
itr->second->BonusHonor += value;
|
itr->second->BonusHonor += value;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
// used only in EY, but in MSG_PVP_LOG_DATA opcode
|
// used only in EY, but in MSG_PVP_LOG_DATA opcode
|
||||||
case SCORE_DAMAGE_DONE: // Damage Done
|
case SCORE_DAMAGE_DONE: // Damage Done
|
||||||
|
|
@ -1917,7 +1953,9 @@ void BattleGround::SpawnEvent(uint8 event1, uint8 event2, bool spawn)
|
||||||
// or despawn something which was already despawned
|
// or despawn something which was already despawned
|
||||||
if (event2 == BG_EVENT_NONE || (spawn && m_ActiveEvents[event1] == event2)
|
if (event2 == BG_EVENT_NONE || (spawn && m_ActiveEvents[event1] == event2)
|
||||||
|| (!spawn && m_ActiveEvents[event1] != event2))
|
|| (!spawn && m_ActiveEvents[event1] != event2))
|
||||||
{ return; }
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (spawn)
|
if (spawn)
|
||||||
{
|
{
|
||||||
|
|
@ -1926,7 +1964,9 @@ void BattleGround::SpawnEvent(uint8 event1, uint8 event2, bool spawn)
|
||||||
m_ActiveEvents[event1] = event2; // set this event to active
|
m_ActiveEvents[event1] = event2; // set this event to active
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_ActiveEvents[event1] = BG_EVENT_NONE; } // no event active if event2 gets despawned
|
{
|
||||||
|
m_ActiveEvents[event1] = BG_EVENT_NONE; // no event active if event2 gets despawned
|
||||||
|
}
|
||||||
|
|
||||||
GuidVector::const_iterator itr = m_EventObjects[MAKE_PAIR32(event1, event2)].creatures.begin();
|
GuidVector::const_iterator itr = m_EventObjects[MAKE_PAIR32(event1, event2)].creatures.begin();
|
||||||
for (; itr != m_EventObjects[MAKE_PAIR32(event1, event2)].creatures.end(); ++itr)
|
for (; itr != m_EventObjects[MAKE_PAIR32(event1, event2)].creatures.end(); ++itr)
|
||||||
|
|
@ -2149,7 +2189,9 @@ void BattleGround::HandleKillPlayer(Player* player, Player* killer)
|
||||||
|
|
||||||
// to be able to remove insignia -- ONLY IN BattleGrounds
|
// to be able to remove insignia -- ONLY IN BattleGrounds
|
||||||
if (!isArena())
|
if (!isArena())
|
||||||
|
{
|
||||||
player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
|
player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -2231,9 +2273,13 @@ uint32 BattleGround::GetAlivePlayersCountByTeam(Team team) const
|
||||||
void BattleGround::CheckArenaWinConditions()
|
void BattleGround::CheckArenaWinConditions()
|
||||||
{
|
{
|
||||||
if (!GetAlivePlayersCountByTeam(ALLIANCE) && GetPlayersCountByTeam(HORDE))
|
if (!GetAlivePlayersCountByTeam(ALLIANCE) && GetPlayersCountByTeam(HORDE))
|
||||||
|
{
|
||||||
EndBattleGround(HORDE);
|
EndBattleGround(HORDE);
|
||||||
|
}
|
||||||
else if (GetPlayersCountByTeam(ALLIANCE) && !GetAlivePlayersCountByTeam(HORDE))
|
else if (GetPlayersCountByTeam(ALLIANCE) && !GetAlivePlayersCountByTeam(HORDE))
|
||||||
|
{
|
||||||
EndBattleGround(ALLIANCE);
|
EndBattleGround(ALLIANCE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -175,9 +175,11 @@ void BattleGroundAB::Update(uint32 diff)
|
||||||
// horde will be a bit disadvantaged, but we can assume that points aren't updated for both team in same Update() call
|
// horde will be a bit disadvantaged, but we can assume that points aren't updated for both team in same Update() call
|
||||||
uint8 otherTeam = (team + 1) % PVP_TEAM_COUNT;
|
uint8 otherTeam = (team + 1) % PVP_TEAM_COUNT;
|
||||||
if (m_TeamScores[team] > m_TeamScores[otherTeam] + 500)
|
if (m_TeamScores[team] > m_TeamScores[otherTeam] + 500)
|
||||||
|
{
|
||||||
m_TeamScores500Disadvantage[otherTeam] = true;
|
m_TeamScores500Disadvantage[otherTeam] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Test win condition
|
// Test win condition
|
||||||
if (m_TeamScores[TEAM_INDEX_ALLIANCE] >= BG_AB_MAX_TEAM_SCORE)
|
if (m_TeamScores[TEAM_INDEX_ALLIANCE] >= BG_AB_MAX_TEAM_SCORE)
|
||||||
|
|
@ -596,9 +598,13 @@ void BattleGroundAB::EndBattleGround(Team winner)
|
||||||
{
|
{
|
||||||
// win reward
|
// win reward
|
||||||
if (winner == ALLIANCE)
|
if (winner == ALLIANCE)
|
||||||
|
{
|
||||||
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
||||||
|
}
|
||||||
if (winner == HORDE)
|
if (winner == HORDE)
|
||||||
|
{
|
||||||
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
||||||
|
}
|
||||||
// complete map_end rewards (even if no team wins)
|
// complete map_end rewards (even if no team wins)
|
||||||
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
||||||
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,9 @@ void BattleGroundBE::AddPlayer(Player* plr)
|
||||||
void BattleGroundBE::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
|
void BattleGroundBE::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
|
||||||
{
|
{
|
||||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
UpdateWorldState(0x9f1, GetAlivePlayersCountByTeam(ALLIANCE));
|
UpdateWorldState(0x9f1, GetAlivePlayersCountByTeam(ALLIANCE));
|
||||||
UpdateWorldState(0x9f0, GetAlivePlayersCountByTeam(HORDE));
|
UpdateWorldState(0x9f0, GetAlivePlayersCountByTeam(HORDE));
|
||||||
|
|
@ -73,7 +75,9 @@ void BattleGroundBE::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
|
||||||
void BattleGroundBE::HandleKillPlayer(Player* player, Player* killer)
|
void BattleGroundBE::HandleKillPlayer(Player* player, Player* killer)
|
||||||
{
|
{
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!killer)
|
if (!killer)
|
||||||
{
|
{
|
||||||
|
|
@ -106,7 +110,9 @@ void BattleGroundBE::UpdatePlayerScore(Player* source, uint32 type, uint32 value
|
||||||
{
|
{
|
||||||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
|
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
|
||||||
if (itr == m_PlayerScores.end()) // player not found...
|
if (itr == m_PlayerScores.end()) // player not found...
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// there is nothing special in this score
|
// there is nothing special in this score
|
||||||
BattleGround::UpdatePlayerScore(source, type, value);
|
BattleGround::UpdatePlayerScore(source, type, value);
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,9 @@ void BattleGroundEY::Update(uint32 diff)
|
||||||
m_resourceUpdateTimer = EY_RESOURCES_UPDATE_TIME;
|
m_resourceUpdateTimer = EY_RESOURCES_UPDATE_TIME;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_resourceUpdateTimer -= diff;
|
m_resourceUpdateTimer -= diff;
|
||||||
|
}
|
||||||
|
|
||||||
// flag respawn
|
// flag respawn
|
||||||
if (m_flagState == EY_FLAG_STATE_WAIT_RESPAWN || m_flagState == EY_FLAG_STATE_ON_GROUND)
|
if (m_flagState == EY_FLAG_STATE_WAIT_RESPAWN || m_flagState == EY_FLAG_STATE_ON_GROUND)
|
||||||
|
|
@ -65,13 +67,19 @@ void BattleGroundEY::Update(uint32 diff)
|
||||||
{
|
{
|
||||||
m_flagRespawnTimer = 0;
|
m_flagRespawnTimer = 0;
|
||||||
if (m_flagState == EY_FLAG_STATE_WAIT_RESPAWN)
|
if (m_flagState == EY_FLAG_STATE_WAIT_RESPAWN)
|
||||||
|
{
|
||||||
RespawnFlag();
|
RespawnFlag();
|
||||||
else
|
|
||||||
RespawnDroppedFlag();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
RespawnDroppedFlag();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
m_flagRespawnTimer -= diff;
|
m_flagRespawnTimer -= diff;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// workaround for Fel Reaver Ruins flag capture needed on 3.3.5 only
|
// workaround for Fel Reaver Ruins flag capture needed on 3.3.5 only
|
||||||
// the original areatrigger (4514) is covered by a bigger one (4515) and is not triggered on client side
|
// the original areatrigger (4514) is covered by a bigger one (4515) and is not triggered on client side
|
||||||
|
|
@ -86,14 +94,18 @@ void BattleGroundEY::Update(uint32 diff)
|
||||||
{
|
{
|
||||||
// coords and range taken from DBC of areatrigger (4514)
|
// coords and range taken from DBC of areatrigger (4514)
|
||||||
if (flagCarrier->GetDistance(2044.0f, 1729.729f, 1190.03f) <= 3.0f)
|
if (flagCarrier->GetDistance(2044.0f, 1729.729f, 1190.03f) <= 3.0f)
|
||||||
|
{
|
||||||
EventPlayerCapturedFlag(flagCarrier, NODE_FEL_REAVER_RUINS);
|
EventPlayerCapturedFlag(flagCarrier, NODE_FEL_REAVER_RUINS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
m_felReaverFlagTimer = EY_FEL_REAVER_FLAG_UPDATE_TIME;
|
m_felReaverFlagTimer = EY_FEL_REAVER_FLAG_UPDATE_TIME;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_felReaverFlagTimer -= diff;
|
m_felReaverFlagTimer -= diff;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundEY::StartingEventOpenDoors()
|
void BattleGroundEY::StartingEventOpenDoors()
|
||||||
|
|
@ -142,18 +154,26 @@ void BattleGroundEY::UpdateTeamScore(Team team)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (team == ALLIANCE)
|
if (team == ALLIANCE)
|
||||||
|
{
|
||||||
UpdateWorldState(WORLD_STATE_EY_RESOURCES_ALLIANCE, score);
|
UpdateWorldState(WORLD_STATE_EY_RESOURCES_ALLIANCE, score);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
UpdateWorldState(WORLD_STATE_EY_RESOURCES_HORDE, score);
|
UpdateWorldState(WORLD_STATE_EY_RESOURCES_HORDE, score);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundEY::EndBattleGround(Team winner)
|
void BattleGroundEY::EndBattleGround(Team winner)
|
||||||
{
|
{
|
||||||
// win reward
|
// win reward
|
||||||
if (winner == ALLIANCE)
|
if (winner == ALLIANCE)
|
||||||
|
{
|
||||||
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
||||||
|
}
|
||||||
if (winner == HORDE)
|
if (winner == HORDE)
|
||||||
|
{
|
||||||
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
||||||
|
}
|
||||||
// complete map reward
|
// complete map reward
|
||||||
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
||||||
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
||||||
|
|
@ -161,7 +181,9 @@ void BattleGroundEY::EndBattleGround(Team winner)
|
||||||
// disable capture points
|
// disable capture points
|
||||||
for (uint8 i = 0; i < EY_NODES_MAX; ++i)
|
for (uint8 i = 0; i < EY_NODES_MAX; ++i)
|
||||||
if (GameObject* go = GetBgMap()->GetGameObject(m_towers[i]))
|
if (GameObject* go = GetBgMap()->GetGameObject(m_towers[i]))
|
||||||
|
{
|
||||||
go->SetLootState(GO_JUST_DEACTIVATED);
|
go->SetLootState(GO_JUST_DEACTIVATED);
|
||||||
|
}
|
||||||
|
|
||||||
BattleGround::EndBattleGround(winner);
|
BattleGround::EndBattleGround(winner);
|
||||||
}
|
}
|
||||||
|
|
@ -183,7 +205,9 @@ void BattleGroundEY::RemovePlayer(Player* plr, ObjectGuid guid)
|
||||||
if (m_flagCarrier == guid)
|
if (m_flagCarrier == guid)
|
||||||
{
|
{
|
||||||
if (plr)
|
if (plr)
|
||||||
|
{
|
||||||
EventPlayerDroppedFlag(plr);
|
EventPlayerDroppedFlag(plr);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ClearFlagCarrier();
|
ClearFlagCarrier();
|
||||||
|
|
@ -314,19 +338,27 @@ bool BattleGroundEY::HandleAreaTrigger(Player* source, uint32 trigger)
|
||||||
{
|
{
|
||||||
case AREATRIGGER_BLOOD_ELF_TOWER_POINT:
|
case AREATRIGGER_BLOOD_ELF_TOWER_POINT:
|
||||||
if (m_towerOwner[NODE_BLOOD_ELF_TOWER] == source->GetTeam())
|
if (m_towerOwner[NODE_BLOOD_ELF_TOWER] == source->GetTeam())
|
||||||
|
{
|
||||||
EventPlayerCapturedFlag(source, NODE_BLOOD_ELF_TOWER);
|
EventPlayerCapturedFlag(source, NODE_BLOOD_ELF_TOWER);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case AREATRIGGER_FEL_REAVER_RUINS_POINT:
|
case AREATRIGGER_FEL_REAVER_RUINS_POINT:
|
||||||
if (m_towerOwner[NODE_FEL_REAVER_RUINS] == source->GetTeam())
|
if (m_towerOwner[NODE_FEL_REAVER_RUINS] == source->GetTeam())
|
||||||
|
{
|
||||||
EventPlayerCapturedFlag(source, NODE_FEL_REAVER_RUINS);
|
EventPlayerCapturedFlag(source, NODE_FEL_REAVER_RUINS);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case AREATRIGGER_MAGE_TOWER_POINT:
|
case AREATRIGGER_MAGE_TOWER_POINT:
|
||||||
if (m_towerOwner[NODE_MAGE_TOWER] == source->GetTeam())
|
if (m_towerOwner[NODE_MAGE_TOWER] == source->GetTeam())
|
||||||
|
{
|
||||||
EventPlayerCapturedFlag(source, NODE_MAGE_TOWER);
|
EventPlayerCapturedFlag(source, NODE_MAGE_TOWER);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case AREATRIGGER_DRAENEI_RUINS_POINT:
|
case AREATRIGGER_DRAENEI_RUINS_POINT:
|
||||||
if (m_towerOwner[NODE_DRAENEI_RUINS] == source->GetTeam())
|
if (m_towerOwner[NODE_DRAENEI_RUINS] == source->GetTeam())
|
||||||
|
{
|
||||||
EventPlayerCapturedFlag(source, NODE_DRAENEI_RUINS);
|
EventPlayerCapturedFlag(source, NODE_DRAENEI_RUINS);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -390,9 +422,13 @@ void BattleGroundEY::RespawnDroppedFlag()
|
||||||
|
|
||||||
GameObject* obj = GetBgMap()->GetGameObject(GetDroppedFlagGuid());
|
GameObject* obj = GetBgMap()->GetGameObject(GetDroppedFlagGuid());
|
||||||
if (obj)
|
if (obj)
|
||||||
|
{
|
||||||
obj->Delete();
|
obj->Delete();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
sLog.outError("BattleGroundEY: Unknown dropped flag: %s", GetDroppedFlagGuid().GetString().c_str());
|
sLog.outError("BattleGroundEY: Unknown dropped flag: %s", GetDroppedFlagGuid().GetString().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
ClearDroppedFlagGuid();
|
ClearDroppedFlagGuid();
|
||||||
}
|
}
|
||||||
|
|
@ -454,7 +490,9 @@ void BattleGroundEY::EventPlayerClickedOnFlag(Player* source, GameObject* target
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_flagState == EY_FLAG_STATE_ON_BASE)
|
if (m_flagState == EY_FLAG_STATE_ON_BASE)
|
||||||
|
{
|
||||||
UpdateWorldState(WORLD_STATE_EY_NETHERSTORM_FLAG_READY, WORLD_STATE_REMOVE);
|
UpdateWorldState(WORLD_STATE_EY_NETHERSTORM_FLAG_READY, WORLD_STATE_REMOVE);
|
||||||
|
}
|
||||||
|
|
||||||
if (source->GetTeam() == ALLIANCE)
|
if (source->GetTeam() == ALLIANCE)
|
||||||
{
|
{
|
||||||
|
|
@ -480,9 +518,13 @@ void BattleGroundEY::EventPlayerClickedOnFlag(Player* source, GameObject* target
|
||||||
source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||||
|
|
||||||
if (source->GetTeam() == ALLIANCE)
|
if (source->GetTeam() == ALLIANCE)
|
||||||
|
{
|
||||||
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, source->GetName());
|
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, source->GetName());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL, source->GetName());
|
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL, source->GetName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundEY::EventPlayerCapturedFlag(Player* source, EYNodes node)
|
void BattleGroundEY::EventPlayerCapturedFlag(Player* source, EYNodes node)
|
||||||
|
|
@ -505,7 +547,9 @@ void BattleGroundEY::EventPlayerCapturedFlag(Player* source, EYNodes node)
|
||||||
PlaySoundToAll(EY_SOUND_FLAG_CAPTURED_ALLIANCE);
|
PlaySoundToAll(EY_SOUND_FLAG_CAPTURED_ALLIANCE);
|
||||||
|
|
||||||
if (m_towersAlliance > 0)
|
if (m_towersAlliance > 0)
|
||||||
|
{
|
||||||
AddPoints(ALLIANCE, eyFlagPoints[m_towersAlliance - 1]);
|
AddPoints(ALLIANCE, eyFlagPoints[m_towersAlliance - 1]);
|
||||||
|
}
|
||||||
|
|
||||||
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_A, CHAT_MSG_BG_SYSTEM_ALLIANCE, source);
|
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_A, CHAT_MSG_BG_SYSTEM_ALLIANCE, source);
|
||||||
}
|
}
|
||||||
|
|
@ -514,7 +558,9 @@ void BattleGroundEY::EventPlayerCapturedFlag(Player* source, EYNodes node)
|
||||||
PlaySoundToAll(EY_SOUND_FLAG_CAPTURED_HORDE);
|
PlaySoundToAll(EY_SOUND_FLAG_CAPTURED_HORDE);
|
||||||
|
|
||||||
if (m_towersHorde > 0)
|
if (m_towersHorde > 0)
|
||||||
|
{
|
||||||
AddPoints(HORDE, eyFlagPoints[m_towersHorde - 1]);
|
AddPoints(HORDE, eyFlagPoints[m_towersHorde - 1]);
|
||||||
|
}
|
||||||
|
|
||||||
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_H, CHAT_MSG_BG_SYSTEM_HORDE, source);
|
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_H, CHAT_MSG_BG_SYSTEM_HORDE, source);
|
||||||
}
|
}
|
||||||
|
|
@ -615,7 +661,9 @@ WorldSafeLocsEntry const* BattleGroundEY::GetClosestGraveYard(Player* player)
|
||||||
{
|
{
|
||||||
entry = sWorldSafeLocsStore.LookupEntry(eyGraveyards[i]);
|
entry = sWorldSafeLocsStore.LookupEntry(eyGraveyards[i]);
|
||||||
if (!entry)
|
if (!entry)
|
||||||
|
{
|
||||||
sLog.outError("BattleGroundEY: Not found graveyard: %u", eyGraveyards[i]);
|
sLog.outError("BattleGroundEY: Not found graveyard: %u", eyGraveyards[i]);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
distance = (entry->x - plr_x) * (entry->x - plr_x) + (entry->y - plr_y) * (entry->y - plr_y) + (entry->z - plr_z) * (entry->z - plr_z);
|
distance = (entry->x - plr_x) * (entry->x - plr_x) + (entry->y - plr_y) * (entry->y - plr_y) + (entry->z - plr_z) * (entry->z - plr_z);
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,9 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recv_data)
|
||||||
// check if already in queue
|
// check if already in queue
|
||||||
if (_player->GetBattleGroundQueueIndex(bgQueueTypeId) < PLAYER_MAX_BATTLEGROUND_QUEUES)
|
if (_player->GetBattleGroundQueueIndex(bgQueueTypeId) < PLAYER_MAX_BATTLEGROUND_QUEUES)
|
||||||
// player is already in this queue
|
// player is already in this queue
|
||||||
{ return; }
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
// check if has free queue slots
|
// check if has free queue slots
|
||||||
if (!_player->HasFreeBattleGroundQueueId())
|
if (!_player->HasFreeBattleGroundQueueId())
|
||||||
{
|
{
|
||||||
|
|
@ -213,7 +215,9 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
Player* member = itr->getSource();
|
Player* member = itr->getSource();
|
||||||
if (!member)
|
if (!member)
|
||||||
{ continue; } // this should never happen
|
{
|
||||||
|
continue; // this should never happen
|
||||||
|
}
|
||||||
|
|
||||||
uint32 queueSlot = member->AddBattleGroundQueueId(bgQueueTypeId); // add to queue
|
uint32 queueSlot = member->AddBattleGroundQueueId(bgQueueTypeId); // add to queue
|
||||||
|
|
||||||
|
|
@ -262,16 +266,22 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode(WorldPacket & /*recv_
|
||||||
case BATTLEGROUND_WS:
|
case BATTLEGROUND_WS:
|
||||||
{
|
{
|
||||||
if ((flagCarrierA = sObjectMgr.GetPlayer(((BattleGroundWS*)bg)->GetAllianceFlagCarrierGuid())))
|
if ((flagCarrierA = sObjectMgr.GetPlayer(((BattleGroundWS*)bg)->GetAllianceFlagCarrierGuid())))
|
||||||
|
{
|
||||||
++flagCarrierCountH;
|
++flagCarrierCountH;
|
||||||
|
}
|
||||||
|
|
||||||
if ((flagCarrierH = sObjectMgr.GetPlayer(((BattleGroundWS*)bg)->GetHordeFlagCarrierGuid())))
|
if ((flagCarrierH = sObjectMgr.GetPlayer(((BattleGroundWS*)bg)->GetHordeFlagCarrierGuid())))
|
||||||
|
{
|
||||||
++flagCarrierCountH;
|
++flagCarrierCountH;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case BATTLEGROUND_EY:
|
case BATTLEGROUND_EY:
|
||||||
{
|
{
|
||||||
if ((flagCarrierH = sObjectMgr.GetPlayer(((BattleGroundEY*)bg)->GetFlagCarrierGuid())))
|
if ((flagCarrierH = sObjectMgr.GetPlayer(((BattleGroundEY*)bg)->GetFlagCarrierGuid())))
|
||||||
|
{
|
||||||
++flagCarrierCountH;
|
++flagCarrierCountH;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case BATTLEGROUND_AB:
|
case BATTLEGROUND_AB:
|
||||||
|
|
@ -287,9 +297,13 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode(WorldPacket & /*recv_
|
||||||
data.WriteBits(flagCarrierCountA, 22);
|
data.WriteBits(flagCarrierCountA, 22);
|
||||||
data.WriteBits(flagCarrierCountH, 22);
|
data.WriteBits(flagCarrierCountH, 22);
|
||||||
if (flagCarrierA)
|
if (flagCarrierA)
|
||||||
|
{
|
||||||
data.WriteGuidMask<6, 5, 4, 7, 2, 1, 0, 3>(flagCarrierA->GetObjectGuid());
|
data.WriteGuidMask<6, 5, 4, 7, 2, 1, 0, 3>(flagCarrierA->GetObjectGuid());
|
||||||
|
}
|
||||||
if (flagCarrierH)
|
if (flagCarrierH)
|
||||||
|
{
|
||||||
data.WriteGuidMask<6, 5, 4, 7, 2, 1, 0, 3>(flagCarrierH->GetObjectGuid());
|
data.WriteGuidMask<6, 5, 4, 7, 2, 1, 0, 3>(flagCarrierH->GetObjectGuid());
|
||||||
|
}
|
||||||
|
|
||||||
if (flagCarrierA)
|
if (flagCarrierA)
|
||||||
{
|
{
|
||||||
|
|
@ -457,10 +471,14 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
case 1: // port to battleground
|
case 1: // port to battleground
|
||||||
if (!_player->IsInvitedForBattleGroundQueueType(bgQueueTypeId))
|
if (!_player->IsInvitedForBattleGroundQueueType(bgQueueTypeId))
|
||||||
{ return; } // cheating?
|
{
|
||||||
|
return; // cheating?
|
||||||
|
}
|
||||||
|
|
||||||
if (!_player->InBattleGround())
|
if (!_player->InBattleGround())
|
||||||
|
{
|
||||||
_player->SetBattleGroundEntryPoint();
|
_player->SetBattleGroundEntryPoint();
|
||||||
|
}
|
||||||
|
|
||||||
// resurrect the player
|
// resurrect the player
|
||||||
if (!_player->IsAlive())
|
if (!_player->IsAlive())
|
||||||
|
|
@ -513,7 +531,9 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket& recv_data)
|
||||||
bgQueue.RemovePlayer(_player->GetObjectGuid(), true);
|
bgQueue.RemovePlayer(_player->GetObjectGuid(), true);
|
||||||
// player left queue, we should update it - do not update Arena Queue
|
// player left queue, we should update it - do not update Arena Queue
|
||||||
if (ginfo.arenaType == ARENA_TYPE_NONE)
|
if (ginfo.arenaType == ARENA_TYPE_NONE)
|
||||||
|
{
|
||||||
sBattleGroundMgr.ScheduleQueueUpdate(ginfo.ArenaTeamRating, ginfo.arenaType, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
|
sBattleGroundMgr.ScheduleQueueUpdate(ginfo.ArenaTeamRating, ginfo.arenaType, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
|
||||||
|
}
|
||||||
SendPacket(&data);
|
SendPacket(&data);
|
||||||
DEBUG_LOG("Battleground: player %s (%u) left queue for bgtype %u, queue type %u.", _player->GetName(), _player->GetGUIDLow(), bg->GetTypeID(), bgQueueTypeId);
|
DEBUG_LOG("Battleground: player %s (%u) left queue for bgtype %u, queue type %u.", _player->GetName(), _player->GetGUIDLow(), bg->GetTypeID(), bgQueueTypeId);
|
||||||
break;
|
break;
|
||||||
|
|
@ -601,7 +621,9 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recv_data*/)
|
||||||
// expected bracket entry
|
// expected bracket entry
|
||||||
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->getLevel());
|
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->getLevel());
|
||||||
if (!bracketEntry)
|
if (!bracketEntry)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 avgTime = bgQueue.GetAverageQueueWaitTime(&ginfo, bracketEntry->GetBracketId());
|
uint32 avgTime = bgQueue.GetAverageQueueWaitTime(&ginfo, bracketEntry->GetBracketId());
|
||||||
// send status in BattleGround Queue
|
// send status in BattleGround Queue
|
||||||
|
|
@ -746,7 +768,9 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recv_data)
|
||||||
|
|
||||||
// if avg personal rating is more than 150 points below the teams rating, the team will be queued against an opponent matching or similar to the average personal rating
|
// if avg personal rating is more than 150 points below the teams rating, the team will be queued against an opponent matching or similar to the average personal rating
|
||||||
if (avg_pers_rating + 150 < arenaRating)
|
if (avg_pers_rating + 150 < arenaRating)
|
||||||
|
{
|
||||||
arenaRating = avg_pers_rating;
|
arenaRating = avg_pers_rating;
|
||||||
|
}
|
||||||
|
|
||||||
BattleGroundQueue& bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId];
|
BattleGroundQueue& bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId];
|
||||||
uint32 avgTime = 0;
|
uint32 avgTime = 0;
|
||||||
|
|
@ -766,7 +790,9 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
Player* member = itr->getSource();
|
Player* member = itr->getSource();
|
||||||
if (!member)
|
if (!member)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,9 @@ void BattleGroundIC::UpdatePlayerScore(Player* source, uint32 type, uint32 value
|
||||||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
|
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
|
||||||
|
|
||||||
if (itr == m_PlayerScores.end()) // player not found...
|
if (itr == m_PlayerScores.end()) // player not found...
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
BattleGround::UpdatePlayerScore(source, type, value);
|
BattleGround::UpdatePlayerScore(source, type, value);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -189,10 +189,14 @@ GroupQueueInfo* BattleGroundQueue::AddGroup(Player* leader, Group* grp, BattleGr
|
||||||
// compute index (if group is premade or joined a rated match) to queues
|
// compute index (if group is premade or joined a rated match) to queues
|
||||||
uint32 index = 0;
|
uint32 index = 0;
|
||||||
if (!isRated && !isPremade)
|
if (!isRated && !isPremade)
|
||||||
{ index += PVP_TEAM_COUNT; } // BG_QUEUE_PREMADE_* -> BG_QUEUE_NORMAL_*
|
{
|
||||||
|
index += PVP_TEAM_COUNT; // BG_QUEUE_PREMADE_* -> BG_QUEUE_NORMAL_*
|
||||||
|
}
|
||||||
|
|
||||||
if (ginfo->GroupTeam == HORDE)
|
if (ginfo->GroupTeam == HORDE)
|
||||||
{ ++index; } // BG_QUEUE_*_ALLIANCE -> BG_QUEUE_*_HORDE
|
{
|
||||||
|
++index; // BG_QUEUE_*_ALLIANCE -> BG_QUEUE_*_HORDE
|
||||||
|
}
|
||||||
|
|
||||||
DEBUG_LOG("Adding Group to BattleGroundQueue bgTypeId : %u, bracket_id : %u, index : %u", BgTypeId, bracketId, index);
|
DEBUG_LOG("Adding Group to BattleGroundQueue bgTypeId : %u, bracket_id : %u, index : %u", BgTypeId, bracketId, index);
|
||||||
|
|
||||||
|
|
@ -213,7 +217,9 @@ GroupQueueInfo* BattleGroundQueue::AddGroup(Player* leader, Group* grp, BattleGr
|
||||||
{
|
{
|
||||||
Player* member = itr->getSource();
|
Player* member = itr->getSource();
|
||||||
if (!member)
|
if (!member)
|
||||||
{ continue; } // this should never happen
|
{
|
||||||
|
continue; // this should never happen
|
||||||
|
}
|
||||||
PlayerQueueInfo& pl_info = m_QueuedPlayers[member->GetObjectGuid()];
|
PlayerQueueInfo& pl_info = m_QueuedPlayers[member->GetObjectGuid()];
|
||||||
pl_info.LastOnlineTime = lastOnlineTime;
|
pl_info.LastOnlineTime = lastOnlineTime;
|
||||||
pl_info.GroupInfo = ginfo;
|
pl_info.GroupInfo = ginfo;
|
||||||
|
|
@ -282,8 +288,10 @@ void BattleGroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* g
|
||||||
if (ginfo->arenaType == ARENA_TYPE_NONE)
|
if (ginfo->arenaType == ARENA_TYPE_NONE)
|
||||||
{
|
{
|
||||||
if (ginfo->GroupTeam == HORDE)
|
if (ginfo->GroupTeam == HORDE)
|
||||||
|
{
|
||||||
team_index = TEAM_INDEX_HORDE;
|
team_index = TEAM_INDEX_HORDE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ginfo->IsRated)
|
if (ginfo->IsRated)
|
||||||
|
|
@ -309,8 +317,10 @@ uint32 BattleGroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattleG
|
||||||
if (ginfo->arenaType == ARENA_TYPE_NONE)
|
if (ginfo->arenaType == ARENA_TYPE_NONE)
|
||||||
{
|
{
|
||||||
if (ginfo->GroupTeam == HORDE)
|
if (ginfo->GroupTeam == HORDE)
|
||||||
|
{
|
||||||
team_index = TEAM_INDEX_HORDE;
|
team_index = TEAM_INDEX_HORDE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ginfo->IsRated)
|
if (ginfo->IsRated)
|
||||||
|
|
@ -323,7 +333,9 @@ uint32 BattleGroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattleG
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
// if there aren't enough values return 0 - not available
|
// if there aren't enough values return 0 - not available
|
||||||
{ return 0; }
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove player from queue and from group info, if group info is empty then remove it too
|
// remove player from queue and from group info, if group info is empty then remove it too
|
||||||
|
|
@ -404,7 +416,9 @@ void BattleGroundQueue::RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount)
|
||||||
|
|
||||||
// announce to world if arena team left queue for rated match, show only once
|
// announce to world if arena team left queue for rated match, show only once
|
||||||
if (group->arenaType != ARENA_TYPE_NONE && group->IsRated && group->Players.empty() && sWorld.getConfig(CONFIG_BOOL_ARENA_QUEUE_ANNOUNCER_EXIT))
|
if (group->arenaType != ARENA_TYPE_NONE && group->IsRated && group->Players.empty() && sWorld.getConfig(CONFIG_BOOL_ARENA_QUEUE_ANNOUNCER_EXIT))
|
||||||
|
{
|
||||||
sWorld.SendWorldText(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT, group->arenaType, group->arenaType, group->ArenaTeamRating);
|
sWorld.SendWorldText(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT, group->arenaType, group->arenaType, group->ArenaTeamRating);
|
||||||
|
}
|
||||||
|
|
||||||
// if player leaves queue and he is invited to rated arena match, then he have to loose
|
// if player leaves queue and he is invited to rated arena match, then he have to loose
|
||||||
if (group->IsInvitedToBGInstanceGUID && group->IsRated && decreaseInvitedCount)
|
if (group->IsInvitedToBGInstanceGUID && group->IsRated && decreaseInvitedCount)
|
||||||
|
|
@ -415,9 +429,13 @@ void BattleGroundQueue::RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount)
|
||||||
DEBUG_LOG("UPDATING memberLost's personal arena rating for %s by opponents rating: %u", guid.GetString().c_str(), group->OpponentsTeamRating);
|
DEBUG_LOG("UPDATING memberLost's personal arena rating for %s by opponents rating: %u", guid.GetString().c_str(), group->OpponentsTeamRating);
|
||||||
Player* plr = sObjectMgr.GetPlayer(guid);
|
Player* plr = sObjectMgr.GetPlayer(guid);
|
||||||
if (plr)
|
if (plr)
|
||||||
|
{
|
||||||
at->MemberLost(plr, group->OpponentsTeamRating);
|
at->MemberLost(plr, group->OpponentsTeamRating);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
at->OfflineMemberLost(guid, group->OpponentsTeamRating);
|
at->OfflineMemberLost(guid, group->OpponentsTeamRating);
|
||||||
|
}
|
||||||
at->SaveToDB();
|
at->SaveToDB();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -492,7 +510,9 @@ bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo* ginfo, BattleGround* bg,
|
||||||
|
|
||||||
// set ArenaTeamId for rated matches
|
// set ArenaTeamId for rated matches
|
||||||
if (bg->isArena() && bg->isRated())
|
if (bg->isArena() && bg->isRated())
|
||||||
|
{
|
||||||
bg->SetArenaTeamIdForTeam(ginfo->GroupTeam, ginfo->ArenaTeamId);
|
bg->SetArenaTeamIdForTeam(ginfo->GroupTeam, ginfo->ArenaTeamId);
|
||||||
|
}
|
||||||
|
|
||||||
ginfo->RemoveInviteTime = WorldTimer::getMSTime() + INVITE_ACCEPT_WAIT_TIME;
|
ginfo->RemoveInviteTime = WorldTimer::getMSTime() + INVITE_ACCEPT_WAIT_TIME;
|
||||||
|
|
||||||
|
|
@ -777,7 +797,9 @@ bool BattleGroundQueue::CheckSkirmishForSameFaction(BattleGroundBracketId bracke
|
||||||
GroupsQueueType::iterator itr_team = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + teamIdx].begin();
|
GroupsQueueType::iterator itr_team = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + teamIdx].begin();
|
||||||
for (; itr_team != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + teamIdx].end(); ++itr_team)
|
for (; itr_team != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + teamIdx].end(); ++itr_team)
|
||||||
if (ginfo == *itr_team)
|
if (ginfo == *itr_team)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
if (itr_team == m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + teamIdx].end())
|
if (itr_team == m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + teamIdx].end())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -789,8 +811,10 @@ bool BattleGroundQueue::CheckSkirmishForSameFaction(BattleGroundBracketId bracke
|
||||||
{
|
{
|
||||||
// if selection pool is full then break;
|
// if selection pool is full then break;
|
||||||
if (!(*itr_team2)->IsInvitedToBGInstanceGUID && !m_SelectionPools[otherTeamIdx].AddGroup(*itr_team2, minPlayersPerTeam))
|
if (!(*itr_team2)->IsInvitedToBGInstanceGUID && !m_SelectionPools[otherTeamIdx].AddGroup(*itr_team2, minPlayersPerTeam))
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (m_SelectionPools[otherTeamIdx].GetPlayerCount() != minPlayersPerTeam)
|
if (m_SelectionPools[otherTeamIdx].GetPlayerCount() != minPlayersPerTeam)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -831,7 +855,9 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|
||||||
m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].empty() &&
|
m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].empty() &&
|
||||||
m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].empty() &&
|
m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].empty() &&
|
||||||
m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].empty())
|
m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].empty())
|
||||||
{ return; }
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// battleground with free slot for player should be always in the beggining of the queue
|
// battleground with free slot for player should be always in the beggining of the queue
|
||||||
// maybe it would be better to create bgfreeslotqueue for each bracket_id
|
// maybe it would be better to create bgfreeslotqueue for each bracket_id
|
||||||
|
|
@ -1001,11 +1027,15 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|
||||||
if (front1 && front2)
|
if (front1 && front2)
|
||||||
{
|
{
|
||||||
if (front1->JoinTime < front2->JoinTime)
|
if (front1->JoinTime < front2->JoinTime)
|
||||||
|
{
|
||||||
arenaRating = front1->ArenaTeamRating;
|
arenaRating = front1->ArenaTeamRating;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (!front1 && !front2)
|
else if (!front1 && !front2)
|
||||||
|
{
|
||||||
return; // queues are empty
|
return; // queues are empty
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// set rating range
|
// set rating range
|
||||||
uint32 arenaMinRating = (arenaRating <= sBattleGroundMgr.GetMaxRatingDifference()) ? 0 : arenaRating - sBattleGroundMgr.GetMaxRatingDifference();
|
uint32 arenaMinRating = (arenaRating <= sBattleGroundMgr.GetMaxRatingDifference()) ? 0 : arenaRating - sBattleGroundMgr.GetMaxRatingDifference();
|
||||||
|
|
@ -1171,7 +1201,9 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||||
Player* plr = sObjectMgr.GetPlayer(m_PlayerGuid);
|
Player* plr = sObjectMgr.GetPlayer(m_PlayerGuid);
|
||||||
if (!plr)
|
if (!plr)
|
||||||
// player logged off (we should do nothing, he is correctly removed from queue in another procedure)
|
// player logged off (we should do nothing, he is correctly removed from queue in another procedure)
|
||||||
{ return true; }
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
BattleGround* bg = sBattleGroundMgr.GetBattleGround(m_BgInstanceGUID, m_BgTypeId);
|
BattleGround* bg = sBattleGroundMgr.GetBattleGround(m_BgInstanceGUID, m_BgTypeId);
|
||||||
// battleground can be deleted already when we are removing queue info
|
// battleground can be deleted already when we are removing queue info
|
||||||
|
|
@ -1190,7 +1222,9 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||||
bgQueue.RemovePlayer(m_PlayerGuid, true);
|
bgQueue.RemovePlayer(m_PlayerGuid, true);
|
||||||
// update queues if battleground isn't ended
|
// update queues if battleground isn't ended
|
||||||
if (bg && bg->isBattleGround() && bg->GetStatus() != STATUS_WAIT_LEAVE)
|
if (bg && bg->isBattleGround() && bg->GetStatus() != STATUS_WAIT_LEAVE)
|
||||||
|
{
|
||||||
sBattleGroundMgr.ScheduleQueueUpdate(0, ARENA_TYPE_NONE, m_BgQueueTypeId, m_BgTypeId, bg->GetBracketId());
|
sBattleGroundMgr.ScheduleQueueUpdate(0, ARENA_TYPE_NONE, m_BgQueueTypeId, m_BgTypeId, bg->GetBracketId());
|
||||||
|
}
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, plr, queueSlot, STATUS_NONE, 0, 0, ARENA_TYPE_NONE);
|
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, plr, queueSlot, STATUS_NONE, 0, 0, ARENA_TYPE_NONE);
|
||||||
|
|
@ -1284,15 +1318,19 @@ void BattleGroundMgr::Update(uint32 diff)
|
||||||
m_NextRatingDiscardUpdate = sWorld.getConfig(CONFIG_UINT32_ARENA_RATING_DISCARD_TIMER);
|
m_NextRatingDiscardUpdate = sWorld.getConfig(CONFIG_UINT32_ARENA_RATING_DISCARD_TIMER);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_NextRatingDiscardUpdate -= diff;
|
m_NextRatingDiscardUpdate -= diff;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket* data, BattleGround* bg, Player* player, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, ArenaType arenatype)
|
void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket* data, BattleGround* bg, Player* player, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, ArenaType arenatype)
|
||||||
{
|
{
|
||||||
// we can be in 2 queues in same time...
|
// we can be in 2 queues in same time...
|
||||||
if (!bg)
|
if (!bg)
|
||||||
|
{
|
||||||
StatusID = STATUS_NONE;
|
StatusID = STATUS_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
ObjectGuid playerGuid = player->GetObjectGuid();
|
ObjectGuid playerGuid = player->GetObjectGuid();
|
||||||
ObjectGuid bgGuid = bg ? bg->GetObjectGuid() : ObjectGuid();
|
ObjectGuid bgGuid = bg ? bg->GetObjectGuid() : ObjectGuid();
|
||||||
|
|
@ -1520,11 +1558,15 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket* data, BattleGround* bg)
|
||||||
for (int8 i = 0; i < PVP_TEAM_COUNT; ++i)
|
for (int8 i = 0; i < PVP_TEAM_COUNT; ++i)
|
||||||
{
|
{
|
||||||
if (ArenaTeam* at = sObjectMgr.GetArenaTeamById(bg->m_ArenaTeamIds[i]))
|
if (ArenaTeam* at = sObjectMgr.GetArenaTeamById(bg->m_ArenaTeamIds[i]))
|
||||||
|
{
|
||||||
data->WriteBits(at->GetName().length(), 8);
|
data->WriteBits(at->GetName().length(), 8);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
data->WriteBits(0, 8);
|
data->WriteBits(0, 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
data->WriteBits(bg->GetPlayerScoresSize(), 21);
|
data->WriteBits(bg->GetPlayerScoresSize(), 21);
|
||||||
for (BattleGround::BattleGroundScoreMap::const_iterator itr = bg->GetPlayerScoresBegin(); itr != bg->GetPlayerScoresEnd(); ++itr)
|
for (BattleGround::BattleGroundScoreMap::const_iterator itr = bg->GetPlayerScoresBegin(); itr != bg->GetPlayerScoresEnd(); ++itr)
|
||||||
|
|
@ -1543,7 +1585,9 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket* data, BattleGround* bg)
|
||||||
data->WriteGuidMask<3, 0, 5, 1, 6>(memberGuid);
|
data->WriteGuidMask<3, 0, 5, 1, 6>(memberGuid);
|
||||||
Team team = bg->GetPlayerTeam(itr->first);
|
Team team = bg->GetPlayerTeam(itr->first);
|
||||||
if (!team && player)
|
if (!team && player)
|
||||||
|
{
|
||||||
team = player->GetTeam();
|
team = player->GetTeam();
|
||||||
|
}
|
||||||
data->WriteBit(team == ALLIANCE); // unk7
|
data->WriteBit(team == ALLIANCE); // unk7
|
||||||
data->WriteGuidMask<7>(memberGuid);
|
data->WriteGuidMask<7>(memberGuid);
|
||||||
|
|
||||||
|
|
@ -1566,9 +1610,13 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket* data, BattleGround* bg)
|
||||||
buffer.WriteGuidBytes<1, 6>(memberGuid);
|
buffer.WriteGuidBytes<1, 6>(memberGuid);
|
||||||
// TODO: store this in player score
|
// TODO: store this in player score
|
||||||
if (player)
|
if (player)
|
||||||
|
{
|
||||||
buffer << uint32(player->GetPrimaryTalentTree(player->GetActiveSpec()));
|
buffer << uint32(player->GetPrimaryTalentTree(player->GetActiveSpec()));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
buffer << uint32(0);
|
buffer << uint32(0);
|
||||||
|
}
|
||||||
|
|
||||||
switch (bg->GetTypeID()) // battleground specific things
|
switch (bg->GetTypeID()) // battleground specific things
|
||||||
{
|
{
|
||||||
|
|
@ -1642,14 +1690,18 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket* data, BattleGround* bg)
|
||||||
for (int8 i = 0; i < PVP_TEAM_COUNT; ++i)
|
for (int8 i = 0; i < PVP_TEAM_COUNT; ++i)
|
||||||
{
|
{
|
||||||
if (ArenaTeam* at = sObjectMgr.GetArenaTeamById(bg->m_ArenaTeamIds[i]))
|
if (ArenaTeam* at = sObjectMgr.GetArenaTeamById(bg->m_ArenaTeamIds[i]))
|
||||||
|
{
|
||||||
data->append(at->GetName().data(), at->GetName().length());
|
data->append(at->GetName().data(), at->GetName().length());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
*data << uint8(bg->GetPlayersCountByTeam(HORDE));
|
*data << uint8(bg->GetPlayersCountByTeam(HORDE));
|
||||||
|
|
||||||
if (bg->GetStatus() == STATUS_WAIT_LEAVE)
|
if (bg->GetStatus() == STATUS_WAIT_LEAVE)
|
||||||
|
{
|
||||||
*data << uint8(bg->GetWinner() == ALLIANCE); // who win
|
*data << uint8(bg->GetWinner() == ALLIANCE); // who win
|
||||||
|
}
|
||||||
|
|
||||||
*data << uint8(bg->GetPlayersCountByTeam(ALLIANCE));
|
*data << uint8(bg->GetPlayersCountByTeam(ALLIANCE));
|
||||||
}
|
}
|
||||||
|
|
@ -1797,7 +1849,9 @@ BattleGround* BattleGroundMgr::GetBattleGroundTemplate(BattleGroundTypeId bgType
|
||||||
uint32 BattleGroundMgr::CreateClientVisibleInstanceId(BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id)
|
uint32 BattleGroundMgr::CreateClientVisibleInstanceId(BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id)
|
||||||
{
|
{
|
||||||
if (IsArenaType(bgTypeId))
|
if (IsArenaType(bgTypeId))
|
||||||
|
{
|
||||||
return 0; // arenas don't have client-instanceids
|
return 0; // arenas don't have client-instanceids
|
||||||
|
}
|
||||||
|
|
||||||
// we create here an instanceid, which is just for
|
// we create here an instanceid, which is just for
|
||||||
// displaying this to the client and without any other use..
|
// displaying this to the client and without any other use..
|
||||||
|
|
@ -1992,7 +2046,9 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DisableMgr::IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, bgTypeID_))
|
if (DisableMgr::IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, bgTypeID_))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
BattleGroundTypeId bgTypeID = BattleGroundTypeId(bgTypeID_);
|
BattleGroundTypeId bgTypeID = BattleGroundTypeId(bgTypeID_);
|
||||||
|
|
||||||
|
|
@ -2126,8 +2182,10 @@ void BattleGroundMgr::DistributeArenaPoints()
|
||||||
CharacterDatabase.PExecute("UPDATE `characters` SET `arenaPoints` = `arenaPoints` + '%u' WHERE `guid` = '%u'", plr_itr->second, plr_itr->first);
|
CharacterDatabase.PExecute("UPDATE `characters` SET `arenaPoints` = `arenaPoints` + '%u' WHERE `guid` = '%u'", plr_itr->second, plr_itr->first);
|
||||||
// add points if player is online
|
// add points if player is online
|
||||||
if (Player* pl = sObjectMgr.GetPlayer(ObjectGuid(HIGHGUID_PLAYER, plr_itr->first)))
|
if (Player* pl = sObjectMgr.GetPlayer(ObjectGuid(HIGHGUID_PLAYER, plr_itr->first)))
|
||||||
|
{
|
||||||
pl->ModifyArenaPoints(plr_itr->second);
|
pl->ModifyArenaPoints(plr_itr->second);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PlayerPoints.clear();
|
PlayerPoints.clear();
|
||||||
|
|
||||||
|
|
@ -2200,7 +2258,9 @@ void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket* data, ObjectGuid
|
||||||
data->WriteGuidBytes<6, 1, 7, 5>(guid);
|
data->WriteGuidBytes<6, 1, 7, 5>(guid);
|
||||||
data->FlushBits();
|
data->FlushBits();
|
||||||
if (count)
|
if (count)
|
||||||
|
{
|
||||||
data->append(buf);
|
data->append(buf);
|
||||||
|
}
|
||||||
data->WriteGuidBytes<0, 2, 4, 3>(guid);
|
data->WriteGuidBytes<0, 2, 4, 3>(guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2348,9 +2408,13 @@ void BattleGroundMgr::ToggleArenaTesting()
|
||||||
{
|
{
|
||||||
m_ArenaTesting = !m_ArenaTesting;
|
m_ArenaTesting = !m_ArenaTesting;
|
||||||
if (m_ArenaTesting)
|
if (m_ArenaTesting)
|
||||||
|
{
|
||||||
sWorld.SendWorldText(LANG_DEBUG_ARENA_ON);
|
sWorld.SendWorldText(LANG_DEBUG_ARENA_ON);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
sWorld.SendWorldText(LANG_DEBUG_ARENA_OFF);
|
sWorld.SendWorldText(LANG_DEBUG_ARENA_OFF);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundMgr::ScheduleQueueUpdate(uint32 arenaRating, ArenaType arenaType, BattleGroundQueueTypeId bgQueueTypeId, BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id)
|
void BattleGroundMgr::ScheduleQueueUpdate(uint32 arenaRating, ArenaType arenaType, BattleGroundQueueTypeId bgQueueTypeId, BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id)
|
||||||
|
|
@ -2378,7 +2442,9 @@ uint32 BattleGroundMgr::GetMaxRatingDifference() const
|
||||||
// this is for stupid people who can't use brain and set max rating difference to 0
|
// this is for stupid people who can't use brain and set max rating difference to 0
|
||||||
uint32 diff = sWorld.getConfig(CONFIG_UINT32_ARENA_MAX_RATING_DIFFERENCE);
|
uint32 diff = sWorld.getConfig(CONFIG_UINT32_ARENA_MAX_RATING_DIFFERENCE);
|
||||||
if (diff == 0)
|
if (diff == 0)
|
||||||
|
{
|
||||||
diff = 5000;
|
diff = 5000;
|
||||||
|
}
|
||||||
return diff;
|
return diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2533,7 +2599,9 @@ void BattleGroundMgr::LoadBattleEventIndexes()
|
||||||
bar.step();
|
bar.step();
|
||||||
Field* fields = result->Fetch();
|
Field* fields = result->Fetch();
|
||||||
if (fields[2].GetUInt8() == BG_EVENT_NONE || fields[3].GetUInt8() == BG_EVENT_NONE)
|
if (fields[2].GetUInt8() == BG_EVENT_NONE || fields[3].GetUInt8() == BG_EVENT_NONE)
|
||||||
{ continue; } // we don't need to add those to the eventmap
|
{
|
||||||
|
continue; // we don't need to add those to the eventmap
|
||||||
|
}
|
||||||
|
|
||||||
bool gameobject = (fields[0].GetUInt8() == 1);
|
bool gameobject = (fields[0].GetUInt8() == 1);
|
||||||
uint32 dbTableGuidLow = fields[1].GetUInt32();
|
uint32 dbTableGuidLow = fields[1].GetUInt32();
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,9 @@ void BattleGroundNA::AddPlayer(Player* plr)
|
||||||
void BattleGroundNA::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
|
void BattleGroundNA::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
|
||||||
{
|
{
|
||||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
UpdateWorldState(0xa0f, GetAlivePlayersCountByTeam(ALLIANCE));
|
UpdateWorldState(0xa0f, GetAlivePlayersCountByTeam(ALLIANCE));
|
||||||
UpdateWorldState(0xa10, GetAlivePlayersCountByTeam(HORDE));
|
UpdateWorldState(0xa10, GetAlivePlayersCountByTeam(HORDE));
|
||||||
|
|
@ -74,7 +76,9 @@ void BattleGroundNA::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
|
||||||
void BattleGroundNA::HandleKillPlayer(Player* player, Player* killer)
|
void BattleGroundNA::HandleKillPlayer(Player* player, Player* killer)
|
||||||
{
|
{
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!killer)
|
if (!killer)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,9 @@ void BattleGroundRB::UpdatePlayerScore(Player* source, uint32 type, uint32 value
|
||||||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
|
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
|
||||||
|
|
||||||
if (itr == m_PlayerScores.end()) // player not found...
|
if (itr == m_PlayerScores.end()) // player not found...
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
BattleGround::UpdatePlayerScore(source, type, value);
|
BattleGround::UpdatePlayerScore(source, type, value);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,9 @@ void BattleGroundRL::AddPlayer(Player* plr)
|
||||||
void BattleGroundRL::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
|
void BattleGroundRL::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
|
||||||
{
|
{
|
||||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
UpdateWorldState(0xbb8, GetAlivePlayersCountByTeam(ALLIANCE));
|
UpdateWorldState(0xbb8, GetAlivePlayersCountByTeam(ALLIANCE));
|
||||||
UpdateWorldState(0xbb9, GetAlivePlayersCountByTeam(HORDE));
|
UpdateWorldState(0xbb9, GetAlivePlayersCountByTeam(HORDE));
|
||||||
|
|
@ -73,7 +75,9 @@ void BattleGroundRL::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
|
||||||
void BattleGroundRL::HandleKillPlayer(Player* player, Player* killer)
|
void BattleGroundRL::HandleKillPlayer(Player* player, Player* killer)
|
||||||
{
|
{
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!killer)
|
if (!killer)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,9 @@ void BattleGroundSA::UpdatePlayerScore(Player* source, uint32 type, uint32 value
|
||||||
{
|
{
|
||||||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
|
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
|
||||||
if (itr == m_PlayerScores.end()) // player not found...
|
if (itr == m_PlayerScores.end()) // player not found...
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
BattleGround::UpdatePlayerScore(source, type, value);
|
BattleGround::UpdatePlayerScore(source, type, value);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -90,9 +90,13 @@ void BattleGroundWS::Update(uint32 diff)
|
||||||
if (m_EndTimer <= diff)
|
if (m_EndTimer <= diff)
|
||||||
{
|
{
|
||||||
if (m_TeamScores[TEAM_INDEX_ALLIANCE] > m_TeamScores[TEAM_INDEX_HORDE])
|
if (m_TeamScores[TEAM_INDEX_ALLIANCE] > m_TeamScores[TEAM_INDEX_HORDE])
|
||||||
|
{
|
||||||
EndBattleGround(ALLIANCE);
|
EndBattleGround(ALLIANCE);
|
||||||
|
}
|
||||||
else if (m_TeamScores[TEAM_INDEX_ALLIANCE] < m_TeamScores[TEAM_INDEX_HORDE])
|
else if (m_TeamScores[TEAM_INDEX_ALLIANCE] < m_TeamScores[TEAM_INDEX_HORDE])
|
||||||
|
{
|
||||||
EndBattleGround(HORDE);
|
EndBattleGround(HORDE);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if 0 => tie
|
// if 0 => tie
|
||||||
|
|
@ -106,9 +110,11 @@ void BattleGroundWS::Update(uint32 diff)
|
||||||
uint32 minutesLeft = GetRemainingTimeInMinutes();
|
uint32 minutesLeft = GetRemainingTimeInMinutes();
|
||||||
|
|
||||||
if (minutesLeft != minutesLeftPrev)
|
if (minutesLeft != minutesLeftPrev)
|
||||||
|
{
|
||||||
UpdateWorldState(BG_WS_TIME_REMAINING, minutesLeft);
|
UpdateWorldState(BG_WS_TIME_REMAINING, minutesLeft);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundWS::StartingEventOpenDoors()
|
void BattleGroundWS::StartingEventOpenDoors()
|
||||||
|
|
@ -524,9 +530,13 @@ void BattleGroundWS::UpdateFlagState(Team team, uint32 value)
|
||||||
void BattleGroundWS::UpdateTeamScore(Team team)
|
void BattleGroundWS::UpdateTeamScore(Team team)
|
||||||
{
|
{
|
||||||
if (team == ALLIANCE)
|
if (team == ALLIANCE)
|
||||||
|
{
|
||||||
UpdateWorldState(BG_WS_FLAG_CAPTURES_ALLIANCE, m_TeamScores[TEAM_INDEX_ALLIANCE]);
|
UpdateWorldState(BG_WS_FLAG_CAPTURES_ALLIANCE, m_TeamScores[TEAM_INDEX_ALLIANCE]);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
UpdateWorldState(BG_WS_FLAG_CAPTURES_HORDE, m_TeamScores[TEAM_INDEX_HORDE]);
|
UpdateWorldState(BG_WS_FLAG_CAPTURES_HORDE, m_TeamScores[TEAM_INDEX_HORDE]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BattleGroundWS::HandleAreaTrigger(Player* source, uint32 trigger)
|
bool BattleGroundWS::HandleAreaTrigger(Player* source, uint32 trigger)
|
||||||
|
|
@ -592,9 +602,13 @@ void BattleGroundWS::EndBattleGround(Team winner)
|
||||||
{
|
{
|
||||||
// win reward
|
// win reward
|
||||||
if (winner == ALLIANCE)
|
if (winner == ALLIANCE)
|
||||||
|
{
|
||||||
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), ALLIANCE);
|
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), ALLIANCE);
|
||||||
|
}
|
||||||
if (winner == HORDE)
|
if (winner == HORDE)
|
||||||
|
{
|
||||||
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), HORDE);
|
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), HORDE);
|
||||||
|
}
|
||||||
// complete map_end rewards (even if no team wins)
|
// complete map_end rewards (even if no team wins)
|
||||||
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), ALLIANCE);
|
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), ALLIANCE);
|
||||||
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), HORDE);
|
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), HORDE);
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,9 @@ bool ChatHandler::HandleGMListIngameCommand(char* /*args*/)
|
||||||
AccountTypes security = player->GetSession()->GetSecurity();
|
AccountTypes security = player->GetSession()->GetSecurity();
|
||||||
if ((player->isGameMaster() || (security > SEC_PLAYER && security <= (AccountTypes)sWorld.getConfig(CONFIG_UINT32_GM_LEVEL_IN_GM_LIST))) &&
|
if ((player->isGameMaster() || (security > SEC_PLAYER && security <= (AccountTypes)sWorld.getConfig(CONFIG_UINT32_GM_LEVEL_IN_GM_LIST))) &&
|
||||||
(!m_session || player->IsVisibleGloballyFor(m_session->GetPlayer())))
|
(!m_session || player->IsVisibleGloballyFor(m_session->GetPlayer())))
|
||||||
{ names.push_back(std::make_pair<std::string, bool>(GetNameLink(player), player->isAcceptWhispers())); }
|
{
|
||||||
|
names.push_back(std::make_pair<std::string, bool>(GetNameLink(player), player->isAcceptWhispers()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -657,10 +657,14 @@ bool ChatHandler::HandleAppearCommand(char* args)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cMap->IsRaid())
|
if (cMap->IsRaid())
|
||||||
|
{
|
||||||
_player->SetRaidDifficulty(target->GetRaidDifficulty());
|
_player->SetRaidDifficulty(target->GetRaidDifficulty());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
_player->SetDungeonDifficulty(target->GetDungeonDifficulty());
|
_player->SetDungeonDifficulty(target->GetDungeonDifficulty());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PSendSysMessage(LANG_APPEARING_AT, chrNameLink.c_str());
|
PSendSysMessage(LANG_APPEARING_AT, chrNameLink.c_str());
|
||||||
if (needReportToTarget(target))
|
if (needReportToTarget(target))
|
||||||
|
|
@ -778,7 +782,9 @@ bool ChatHandler::HandleModifyHolyPowerCommand(char* args)
|
||||||
|
|
||||||
PSendSysMessage(LANG_YOU_CHANGE_HOLY_POWER, GetNameLink(chr).c_str(), power, maxPower);
|
PSendSysMessage(LANG_YOU_CHANGE_HOLY_POWER, GetNameLink(chr).c_str(), power, maxPower);
|
||||||
if (needReportToTarget(chr))
|
if (needReportToTarget(chr))
|
||||||
|
{
|
||||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_HOLY_POWER_CHANGED, GetNameLink().c_str(), power, maxPower);
|
ChatHandler(chr).PSendSysMessage(LANG_YOURS_HOLY_POWER_CHANGED, GetNameLink().c_str(), power, maxPower);
|
||||||
|
}
|
||||||
|
|
||||||
chr->SetPower(POWER_HOLY_POWER, power);
|
chr->SetPower(POWER_HOLY_POWER, power);
|
||||||
|
|
||||||
|
|
@ -991,7 +997,9 @@ bool ChatHandler::HandleModifyRunicPowerCommand(char* args)
|
||||||
|
|
||||||
PSendSysMessage(LANG_YOU_CHANGE_RUNIC_POWER, GetNameLink(chr).c_str(), rune / 10, runem / 10);
|
PSendSysMessage(LANG_YOU_CHANGE_RUNIC_POWER, GetNameLink(chr).c_str(), rune / 10, runem / 10);
|
||||||
if (needReportToTarget(chr))
|
if (needReportToTarget(chr))
|
||||||
|
{
|
||||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_RUNIC_POWER_CHANGED, GetNameLink().c_str(), rune / 10, runem / 10);
|
ChatHandler(chr).PSendSysMessage(LANG_YOURS_RUNIC_POWER_CHANGED, GetNameLink().c_str(), rune / 10, runem / 10);
|
||||||
|
}
|
||||||
|
|
||||||
chr->SetMaxPower(POWER_RUNIC_POWER, runem);
|
chr->SetMaxPower(POWER_RUNIC_POWER, runem);
|
||||||
chr->SetPower(POWER_RUNIC_POWER, rune);
|
chr->SetPower(POWER_RUNIC_POWER, rune);
|
||||||
|
|
@ -1411,7 +1419,9 @@ bool ChatHandler::HandleModifyFlyCommand(char* args)
|
||||||
|
|
||||||
PSendSysMessage(LANG_YOU_CHANGE_FLY_SPEED, modSpeed, GetNameLink(chr).c_str());
|
PSendSysMessage(LANG_YOU_CHANGE_FLY_SPEED, modSpeed, GetNameLink(chr).c_str());
|
||||||
if (needReportToTarget(chr))
|
if (needReportToTarget(chr))
|
||||||
|
{
|
||||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_FLY_SPEED_CHANGED, GetNameLink().c_str(), modSpeed);
|
ChatHandler(chr).PSendSysMessage(LANG_YOURS_FLY_SPEED_CHANGED, GetNameLink().c_str(), modSpeed);
|
||||||
|
}
|
||||||
|
|
||||||
chr->UpdateSpeed(MOVE_FLIGHT, true, modSpeed, true);
|
chr->UpdateSpeed(MOVE_FLIGHT, true, modSpeed, true);
|
||||||
|
|
||||||
|
|
@ -1791,7 +1801,9 @@ bool ChatHandler::HandleModifyMoneyCommand(char* args)
|
||||||
|
|
||||||
PSendSysMessage(LANG_YOU_TAKE_MONEY, MoneyToString(abs(addmoney)).c_str(), GetNameLink(chr).c_str());
|
PSendSysMessage(LANG_YOU_TAKE_MONEY, MoneyToString(abs(addmoney)).c_str(), GetNameLink(chr).c_str());
|
||||||
if (needReportToTarget(chr))
|
if (needReportToTarget(chr))
|
||||||
|
{
|
||||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_MONEY_TAKEN, GetNameLink().c_str(), MoneyToString(abs(addmoney)).c_str());
|
ChatHandler(chr).PSendSysMessage(LANG_YOURS_MONEY_TAKEN, GetNameLink().c_str(), MoneyToString(abs(addmoney)).c_str());
|
||||||
|
}
|
||||||
chr->SetMoney(newmoney);
|
chr->SetMoney(newmoney);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1799,7 +1811,9 @@ bool ChatHandler::HandleModifyMoneyCommand(char* args)
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_YOU_GIVE_MONEY, MoneyToString(addmoney).c_str(), GetNameLink(chr).c_str());
|
PSendSysMessage(LANG_YOU_GIVE_MONEY, MoneyToString(addmoney).c_str(), GetNameLink(chr).c_str());
|
||||||
if (needReportToTarget(chr))
|
if (needReportToTarget(chr))
|
||||||
|
{
|
||||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_MONEY_GIVEN, GetNameLink().c_str(), MoneyToString(addmoney).c_str());
|
ChatHandler(chr).PSendSysMessage(LANG_YOURS_MONEY_GIVEN, GetNameLink().c_str(), MoneyToString(addmoney).c_str());
|
||||||
|
}
|
||||||
|
|
||||||
if (addmoney >= MAX_MONEY_AMOUNT)
|
if (addmoney >= MAX_MONEY_AMOUNT)
|
||||||
{
|
{
|
||||||
|
|
@ -2603,10 +2617,14 @@ bool ChatHandler::HandleModifyDrunkCommand(char* args)
|
||||||
|
|
||||||
uint8 drunkValue = (uint8)atoi(args);
|
uint8 drunkValue = (uint8)atoi(args);
|
||||||
if (drunkValue > 100)
|
if (drunkValue > 100)
|
||||||
|
{
|
||||||
drunkValue = 100;
|
drunkValue = 100;
|
||||||
|
}
|
||||||
|
|
||||||
if (Player* target = getSelectedPlayer())
|
if (Player* target = getSelectedPlayer())
|
||||||
|
{
|
||||||
target->SetDrunkValue(drunkValue);
|
target->SetDrunkValue(drunkValue);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -344,10 +344,14 @@ bool ChatHandler::HandleTriggerCommand(char* args)
|
||||||
SendSysMessage(LANG_TRIGGER_REQ_KEYS_HEROIC);
|
SendSysMessage(LANG_TRIGGER_REQ_KEYS_HEROIC);
|
||||||
|
|
||||||
if (at->heroicKey)
|
if (at->heroicKey)
|
||||||
|
{
|
||||||
ShowItemListHelper(at->heroicKey, loc_idx, pl);
|
ShowItemListHelper(at->heroicKey, loc_idx, pl);
|
||||||
|
}
|
||||||
if (at->heroicKey2)
|
if (at->heroicKey2)
|
||||||
|
{
|
||||||
ShowItemListHelper(at->heroicKey2, loc_idx, pl);
|
ShowItemListHelper(at->heroicKey2, loc_idx, pl);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (at->requiredQuestHeroic)
|
if (at->requiredQuestHeroic)
|
||||||
{
|
{
|
||||||
|
|
@ -1311,7 +1315,9 @@ bool ChatHandler::HandleGameObjectPhaseCommand(char* args)
|
||||||
|
|
||||||
// by DB guid
|
// by DB guid
|
||||||
if (GameObjectData const* go_data = sObjectMgr.GetGOData(lowguid))
|
if (GameObjectData const* go_data = sObjectMgr.GetGOData(lowguid))
|
||||||
|
{
|
||||||
obj = GetGameObjectWithGuid(lowguid, go_data->id);
|
obj = GetGameObjectWithGuid(lowguid, go_data->id);
|
||||||
|
}
|
||||||
|
|
||||||
if (!obj)
|
if (!obj)
|
||||||
{
|
{
|
||||||
|
|
@ -1431,7 +1437,9 @@ void ChatHandler::ShowAchievementListHelper(AchievementEntry const* achEntry, Lo
|
||||||
if (AchievementCriteriaEntryList const* criteriaList = sAchievementMgr.GetAchievementCriteriaByAchievement(achEntry->ID))
|
if (AchievementCriteriaEntryList const* criteriaList = sAchievementMgr.GetAchievementCriteriaByAchievement(achEntry->ID))
|
||||||
for (AchievementCriteriaEntryList::const_iterator itr = criteriaList->begin(); itr != criteriaList->end(); ++itr)
|
for (AchievementCriteriaEntryList::const_iterator itr = criteriaList->begin(); itr != criteriaList->end(); ++itr)
|
||||||
if (mgr->IsCompletedCriteria(*itr, achEntry))
|
if (mgr->IsCompletedCriteria(*itr, achEntry))
|
||||||
|
{
|
||||||
criteriaMask[((*itr)->showOrder - 1) / 32] |= (1 << (((*itr)->showOrder - 1) % 32));
|
criteriaMask[((*itr)->showOrder - 1) / 32] |= (1 << (((*itr)->showOrder - 1) % 32));
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 4; ++i)
|
for (int i = 0; i < 4; ++i)
|
||||||
{
|
{
|
||||||
|
|
@ -1439,16 +1447,22 @@ void ChatHandler::ShowAchievementListHelper(AchievementEntry const* achEntry, Lo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
ss << "0:0:0:0:";
|
ss << "0:0:0:0:";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ss << "|h[" << name << " " << localeNames[loc] << "]|h|r";
|
ss << "|h[" << name << " " << localeNames[loc] << "]|h|r";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
ss << achEntry->ID << " - " << name << " " << localeNames[loc];
|
ss << achEntry->ID << " - " << name << " " << localeNames[loc];
|
||||||
|
}
|
||||||
|
|
||||||
if (target && date)
|
if (target && date)
|
||||||
|
{
|
||||||
ss << " [" << TimeToTimestampStr(*date) << "]";
|
ss << " [" << TimeToTimestampStr(*date) << "]";
|
||||||
|
}
|
||||||
|
|
||||||
SendSysMessage(ss.str().c_str());
|
SendSysMessage(ss.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
@ -1480,12 +1494,16 @@ bool ChatHandler::HandleLookupAchievementCommand(char* args)
|
||||||
{
|
{
|
||||||
AchievementEntry const* achEntry = sAchievementStore.LookupEntry(id);
|
AchievementEntry const* achEntry = sAchievementStore.LookupEntry(id);
|
||||||
if (!achEntry)
|
if (!achEntry)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
int loc = GetSessionDbcLocale();
|
int loc = GetSessionDbcLocale();
|
||||||
std::string name = achEntry->name[loc];
|
std::string name = achEntry->name[loc];
|
||||||
if (name.empty())
|
if (name.empty())
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!Utf8FitTo(name, wnamepart))
|
if (!Utf8FitTo(name, wnamepart))
|
||||||
{
|
{
|
||||||
|
|
@ -1493,16 +1511,22 @@ bool ChatHandler::HandleLookupAchievementCommand(char* args)
|
||||||
for (; loc < MAX_LOCALE; ++loc)
|
for (; loc < MAX_LOCALE; ++loc)
|
||||||
{
|
{
|
||||||
if (loc == GetSessionDbcLocale())
|
if (loc == GetSessionDbcLocale())
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
name = achEntry->name[loc];
|
name = achEntry->name[loc];
|
||||||
if (name.empty())
|
if (name.empty())
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (Utf8FitTo(name, wnamepart))
|
if (Utf8FitTo(name, wnamepart))
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (loc < MAX_LOCALE)
|
if (loc < MAX_LOCALE)
|
||||||
{
|
{
|
||||||
|
|
@ -1513,7 +1537,9 @@ bool ChatHandler::HandleLookupAchievementCommand(char* args)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (counter == 0) // if counter == 0 then we found nth
|
if (counter == 0) // if counter == 0 then we found nth
|
||||||
|
{
|
||||||
SendSysMessage(LANG_COMMAND_ACHIEVEMENT_NOTFOUND);
|
SendSysMessage(LANG_COMMAND_ACHIEVEMENT_NOTFOUND);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2607,7 +2633,9 @@ bool ChatHandler::HandleNpcSetPhaseCommand(char* args)
|
||||||
pCreature->SetPhaseMask(phasemask, true);
|
pCreature->SetPhaseMask(phasemask, true);
|
||||||
|
|
||||||
if (pCreature->HasStaticDBSpawnData())
|
if (pCreature->HasStaticDBSpawnData())
|
||||||
|
{
|
||||||
pCreature->SaveToDB();
|
pCreature->SaveToDB();
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -2700,7 +2728,9 @@ bool ChatHandler::HandleNpcSubNameCommand(char* /*args*/)
|
||||||
/* Temp. disabled
|
/* Temp. disabled
|
||||||
|
|
||||||
if (!*args)
|
if (!*args)
|
||||||
|
{
|
||||||
args = "";
|
args = "";
|
||||||
|
}
|
||||||
|
|
||||||
if (strlen((char*)args)>75)
|
if (strlen((char*)args)>75)
|
||||||
{
|
{
|
||||||
|
|
@ -2884,7 +2914,9 @@ bool ChatHandler::HandleModifyPhaseCommand(char* args)
|
||||||
|
|
||||||
Unit* target = getSelectedUnit();
|
Unit* target = getSelectedUnit();
|
||||||
if (!target)
|
if (!target)
|
||||||
|
{
|
||||||
target = m_session->GetPlayer();
|
target = m_session->GetPlayer();
|
||||||
|
}
|
||||||
|
|
||||||
// check online security
|
// check online security
|
||||||
else if (target->GetTypeId() == TYPEID_PLAYER && HasLowerSecurity((Player*)target))
|
else if (target->GetTypeId() == TYPEID_PLAYER && HasLowerSecurity((Player*)target))
|
||||||
|
|
@ -3128,7 +3160,9 @@ bool ChatHandler::HandleTicketCommand(char* args)
|
||||||
ticket->SetResponseText(args);
|
ticket->SetResponseText(args);
|
||||||
|
|
||||||
if (Player* pl = sObjectMgr.GetPlayer(ticket->GetPlayerGuid()))
|
if (Player* pl = sObjectMgr.GetPlayer(ticket->GetPlayerGuid()))
|
||||||
|
{
|
||||||
pl->GetSession()->SendGMResponse(ticket);
|
pl->GetSession()->SendGMResponse(ticket);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -3285,15 +3319,21 @@ inline void UnsummonVisualWaypoints(Player const* player, ObjectGuid ownerGuid)
|
||||||
for (std::list<Creature*>::iterator itr = waypoints.begin(); itr != waypoints.end(); ++itr)
|
for (std::list<Creature*>::iterator itr = waypoints.begin(); itr != waypoints.end(); ++itr)
|
||||||
{
|
{
|
||||||
if ((*itr)->GetSubtype() != CREATURE_SUBTYPE_TEMPORARY_SUMMON)
|
if ((*itr)->GetSubtype() != CREATURE_SUBTYPE_TEMPORARY_SUMMON)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
TemporarySummonWaypoint* wpTarget = dynamic_cast<TemporarySummonWaypoint*>(*itr);
|
TemporarySummonWaypoint* wpTarget = dynamic_cast<TemporarySummonWaypoint*>(*itr);
|
||||||
if (!wpTarget)
|
if (!wpTarget)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (wpTarget->GetSummonerGuid() == ownerGuid)
|
if (wpTarget->GetSummonerGuid() == ownerGuid)
|
||||||
|
{
|
||||||
wpTarget->UnSummon();
|
wpTarget->UnSummon();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Add a waypoint to a creature
|
/** Add a waypoint to a creature
|
||||||
|
|
@ -3320,7 +3360,9 @@ bool ChatHandler::HandleWpAddCommand(char* args)
|
||||||
|
|
||||||
CreatureInfo const* waypointInfo = ObjectMgr::GetCreatureTemplate(VISUAL_WAYPOINT);
|
CreatureInfo const* waypointInfo = ObjectMgr::GetCreatureTemplate(VISUAL_WAYPOINT);
|
||||||
if (!waypointInfo || waypointInfo->GetHighGuid() != HIGHGUID_UNIT)
|
if (!waypointInfo || waypointInfo->GetHighGuid() != HIGHGUID_UNIT)
|
||||||
|
{
|
||||||
return false; // must exist as normal creature in mangos.sql 'creature_template'
|
return false; // must exist as normal creature in mangos.sql 'creature_template'
|
||||||
|
}
|
||||||
|
|
||||||
Creature* targetCreature = getSelectedCreature();
|
Creature* targetCreature = getSelectedCreature();
|
||||||
WaypointPathOrigin wpDestination = PATH_NO_PATH; ///< into which storage
|
WaypointPathOrigin wpDestination = PATH_NO_PATH; ///< into which storage
|
||||||
|
|
@ -3354,8 +3396,10 @@ bool ChatHandler::HandleWpAddCommand(char* args)
|
||||||
wpPointId = wpTarget->GetWaypointId() + 1; // Insert as next waypoint
|
wpPointId = wpTarget->GetWaypointId() + 1; // Insert as next waypoint
|
||||||
}
|
}
|
||||||
else // normal creature selected
|
else // normal creature selected
|
||||||
|
{
|
||||||
wpOwner = targetCreature;
|
wpOwner = targetCreature;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else //!targetCreature - first argument must be dbGuid
|
else //!targetCreature - first argument must be dbGuid
|
||||||
{
|
{
|
||||||
uint32 dbGuid;
|
uint32 dbGuid;
|
||||||
|
|
@ -3396,19 +3440,25 @@ bool ChatHandler::HandleWpAddCommand(char* args)
|
||||||
{
|
{
|
||||||
uint32 src = (uint32)PATH_NO_PATH;
|
uint32 src = (uint32)PATH_NO_PATH;
|
||||||
if (ExtractOptUInt32(&args, src, src))
|
if (ExtractOptUInt32(&args, src, src))
|
||||||
|
{
|
||||||
wpDestination = (WaypointPathOrigin)src;
|
wpDestination = (WaypointPathOrigin)src;
|
||||||
|
}
|
||||||
else // pathId provided but no destination
|
else // pathId provided but no destination
|
||||||
{
|
{
|
||||||
if (wpPathId != 0)
|
if (wpPathId != 0)
|
||||||
|
{
|
||||||
wpDestination = PATH_FROM_ENTRY; // Multiple Paths must only be assigned by entry
|
wpDestination = PATH_FROM_ENTRY; // Multiple Paths must only be assigned by entry
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (wpDestination == PATH_NO_PATH) // No overwrite params. Do best estimate
|
if (wpDestination == PATH_NO_PATH) // No overwrite params. Do best estimate
|
||||||
{
|
{
|
||||||
if (wpOwner->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
|
if (wpOwner->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
|
||||||
if (WaypointMovementGenerator<Creature> const* wpMMGen = dynamic_cast<WaypointMovementGenerator<Creature> const*>(wpOwner->GetMotionMaster()->GetCurrent()))
|
if (WaypointMovementGenerator<Creature> const* wpMMGen = dynamic_cast<WaypointMovementGenerator<Creature> const*>(wpOwner->GetMotionMaster()->GetCurrent()))
|
||||||
|
{
|
||||||
wpMMGen->GetPathInformation(wpPathId, wpDestination);
|
wpMMGen->GetPathInformation(wpPathId, wpDestination);
|
||||||
|
}
|
||||||
|
|
||||||
// Get information about default path if no current path. If no default path, prepare data dependendy on uniqueness
|
// Get information about default path if no current path. If no default path, prepare data dependendy on uniqueness
|
||||||
if (wpDestination == PATH_NO_PATH && !sWaypointMgr.GetDefaultPath(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), &wpDestination))
|
if (wpDestination == PATH_NO_PATH && !sWaypointMgr.GetDefaultPath(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), &wpDestination))
|
||||||
|
|
@ -3418,7 +3468,9 @@ bool ChatHandler::HandleWpAddCommand(char* args)
|
||||||
{
|
{
|
||||||
QueryResult* result = WorldDatabase.PQuery("SELECT COUNT(`id`) FROM `creature` WHERE `id` = %u", wpOwner->GetEntry());
|
QueryResult* result = WorldDatabase.PQuery("SELECT COUNT(`id`) FROM `creature` WHERE `id` = %u", wpOwner->GetEntry());
|
||||||
if (result && result->Fetch()[0].GetUInt32() != 1)
|
if (result && result->Fetch()[0].GetUInt32() != 1)
|
||||||
|
{
|
||||||
wpDestination = PATH_FROM_GUID;
|
wpDestination = PATH_FROM_GUID;
|
||||||
|
}
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3501,7 +3553,9 @@ bool ChatHandler::HandleWpModifyCommand(char* args)
|
||||||
|
|
||||||
CreatureInfo const* waypointInfo = ObjectMgr::GetCreatureTemplate(VISUAL_WAYPOINT);
|
CreatureInfo const* waypointInfo = ObjectMgr::GetCreatureTemplate(VISUAL_WAYPOINT);
|
||||||
if (!waypointInfo || waypointInfo->GetHighGuid() != HIGHGUID_UNIT)
|
if (!waypointInfo || waypointInfo->GetHighGuid() != HIGHGUID_UNIT)
|
||||||
{ return false; } // must exist as normal creature in mangos.sql 'creature_template'
|
{
|
||||||
|
return false; // must exist as normal creature in mangos.sql 'creature_template'
|
||||||
|
}
|
||||||
|
|
||||||
// first arg: add del text emote spell waittime move
|
// first arg: add del text emote spell waittime move
|
||||||
char* subCmd_str = ExtractLiteralArg(&args);
|
char* subCmd_str = ExtractLiteralArg(&args);
|
||||||
|
|
@ -3598,11 +3652,15 @@ bool ChatHandler::HandleWpModifyCommand(char* args)
|
||||||
{
|
{
|
||||||
if (wpOwner->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
|
if (wpOwner->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
|
||||||
if (WaypointMovementGenerator<Creature> const* wpMMGen = dynamic_cast<WaypointMovementGenerator<Creature> const*>(wpOwner->GetMotionMaster()->GetCurrent()))
|
if (WaypointMovementGenerator<Creature> const* wpMMGen = dynamic_cast<WaypointMovementGenerator<Creature> const*>(wpOwner->GetMotionMaster()->GetCurrent()))
|
||||||
|
{
|
||||||
wpMMGen->GetPathInformation(wpPathId, wpSource);
|
wpMMGen->GetPathInformation(wpPathId, wpSource);
|
||||||
|
}
|
||||||
|
|
||||||
if (wpSource == PATH_NO_PATH)
|
if (wpSource == PATH_NO_PATH)
|
||||||
|
{
|
||||||
sWaypointMgr.GetDefaultPath(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), &wpSource);
|
sWaypointMgr.GetDefaultPath(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), &wpSource);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
WaypointPath const* wpPath = sWaypointMgr.GetPathFromOrigin(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), wpPathId, wpSource);
|
WaypointPath const* wpPath = sWaypointMgr.GetPathFromOrigin(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), wpPathId, wpSource);
|
||||||
if (!wpPath)
|
if (!wpPath)
|
||||||
|
|
@ -3637,7 +3695,9 @@ bool ChatHandler::HandleWpModifyCommand(char* args)
|
||||||
sWaypointMgr.DeleteNode(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), wpId, wpPathId, wpSource);
|
sWaypointMgr.DeleteNode(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), wpId, wpPathId, wpSource);
|
||||||
|
|
||||||
if (TemporarySummonWaypoint* wpCreature = dynamic_cast<TemporarySummonWaypoint*>(targetCreature))
|
if (TemporarySummonWaypoint* wpCreature = dynamic_cast<TemporarySummonWaypoint*>(targetCreature))
|
||||||
|
{
|
||||||
wpCreature->UnSummon();
|
wpCreature->UnSummon();
|
||||||
|
}
|
||||||
|
|
||||||
if (wpPath->empty())
|
if (wpPath->empty())
|
||||||
{
|
{
|
||||||
|
|
@ -3686,8 +3746,10 @@ bool ChatHandler::HandleWpModifyCommand(char* args)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sWaypointMgr.SetNodeScriptId(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), wpId, wpPathId, wpSource, scriptId))
|
if (!sWaypointMgr.SetNodeScriptId(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), wpId, wpPathId, wpSource, scriptId))
|
||||||
|
{
|
||||||
PSendSysMessage(LANG_WAYPOINT_INFO_UNK_SCRIPTID, scriptId);
|
PSendSysMessage(LANG_WAYPOINT_INFO_UNK_SCRIPTID, scriptId);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (subCmd == "orientation")
|
else if (subCmd == "orientation")
|
||||||
{
|
{
|
||||||
float ori;
|
float ori;
|
||||||
|
|
@ -3729,7 +3791,9 @@ bool ChatHandler::HandleWpShowCommand(char* args)
|
||||||
|
|
||||||
CreatureInfo const* waypointInfo = ObjectMgr::GetCreatureTemplate(VISUAL_WAYPOINT);
|
CreatureInfo const* waypointInfo = ObjectMgr::GetCreatureTemplate(VISUAL_WAYPOINT);
|
||||||
if (!waypointInfo || waypointInfo->GetHighGuid() != HIGHGUID_UNIT)
|
if (!waypointInfo || waypointInfo->GetHighGuid() != HIGHGUID_UNIT)
|
||||||
{ return false; } // must exist as normal creature in mangos.sql 'creature_template'
|
{
|
||||||
|
return false; // must exist as normal creature in mangos.sql 'creature_template'
|
||||||
|
}
|
||||||
|
|
||||||
// first arg: info, on, off, first, last
|
// first arg: info, on, off, first, last
|
||||||
|
|
||||||
|
|
@ -3752,9 +3816,11 @@ bool ChatHandler::HandleWpShowCommand(char* args)
|
||||||
{
|
{
|
||||||
uint32 src;
|
uint32 src;
|
||||||
if (ExtractOptUInt32(&args, src, (uint32)PATH_NO_PATH))
|
if (ExtractOptUInt32(&args, src, (uint32)PATH_NO_PATH))
|
||||||
|
{
|
||||||
wpOrigin = (WaypointPathOrigin)src;
|
wpOrigin = (WaypointPathOrigin)src;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else // Guid must be provided
|
else // Guid must be provided
|
||||||
{
|
{
|
||||||
if (!ExtractUInt32(&args, dbGuid)) // No creature selected and no dbGuid provided
|
if (!ExtractUInt32(&args, dbGuid)) // No creature selected and no dbGuid provided
|
||||||
|
|
@ -3766,8 +3832,10 @@ bool ChatHandler::HandleWpShowCommand(char* args)
|
||||||
{
|
{
|
||||||
uint32 src = (uint32)PATH_NO_PATH;
|
uint32 src = (uint32)PATH_NO_PATH;
|
||||||
if (ExtractOptUInt32(&args, src, src))
|
if (ExtractOptUInt32(&args, src, src))
|
||||||
|
{
|
||||||
wpOrigin = (WaypointPathOrigin)src;
|
wpOrigin = (WaypointPathOrigin)src;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Params now parsed, check them
|
// Params now parsed, check them
|
||||||
CreatureData const* data = sObjectMgr.GetCreatureData(dbGuid);
|
CreatureData const* data = sObjectMgr.GetCreatureData(dbGuid);
|
||||||
|
|
@ -3822,12 +3890,16 @@ bool ChatHandler::HandleWpShowCommand(char* args)
|
||||||
wpPathId = wpTarget->GetPathId();
|
wpPathId = wpTarget->GetPathId();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
wpOwner = targetCreature;
|
wpOwner = targetCreature;
|
||||||
|
}
|
||||||
|
|
||||||
// Get the path
|
// Get the path
|
||||||
WaypointPath* wpPath = NULL;
|
WaypointPath* wpPath = NULL;
|
||||||
if (wpOrigin != PATH_NO_PATH) // Might have been provided by param
|
if (wpOrigin != PATH_NO_PATH) // Might have been provided by param
|
||||||
|
{
|
||||||
wpPath = sWaypointMgr.GetPathFromOrigin(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), wpPathId, wpOrigin);
|
wpPath = sWaypointMgr.GetPathFromOrigin(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), wpPathId, wpOrigin);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (wpOwner->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
|
if (wpOwner->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
|
||||||
|
|
@ -3838,8 +3910,10 @@ bool ChatHandler::HandleWpShowCommand(char* args)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wpOrigin == PATH_NO_PATH)
|
if (wpOrigin == PATH_NO_PATH)
|
||||||
|
{
|
||||||
wpPath = sWaypointMgr.GetDefaultPath(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), &wpOrigin);
|
wpPath = sWaypointMgr.GetDefaultPath(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), &wpOrigin);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!wpPath || wpPath->empty())
|
if (!wpPath || wpPath->empty())
|
||||||
{
|
{
|
||||||
|
|
@ -3865,7 +3939,9 @@ bool ChatHandler::HandleWpShowCommand(char* args)
|
||||||
PSendSysMessage(LANG_WAYPOINT_INFO_ORI, point->second.orientation);
|
PSendSysMessage(LANG_WAYPOINT_INFO_ORI, point->second.orientation);
|
||||||
PSendSysMessage(LANG_WAYPOINT_INFO_SCRIPTID, point->second.script_id);
|
PSendSysMessage(LANG_WAYPOINT_INFO_SCRIPTID, point->second.script_id);
|
||||||
if (wpOrigin == PATH_FROM_EXTERNAL)
|
if (wpOrigin == PATH_FROM_EXTERNAL)
|
||||||
|
{
|
||||||
PSendSysMessage(LANG_WAYPOINT_INFO_AISCRIPT, wpOwner->GetScriptName().c_str());
|
PSendSysMessage(LANG_WAYPOINT_INFO_AISCRIPT, wpOwner->GetScriptName().c_str());
|
||||||
|
}
|
||||||
if (WaypointBehavior* behaviour = point->second.behavior)
|
if (WaypointBehavior* behaviour = point->second.behavior)
|
||||||
{
|
{
|
||||||
PSendSysMessage(" ModelId1: %u", behaviour->model1);
|
PSendSysMessage(" ModelId1: %u", behaviour->model1);
|
||||||
|
|
@ -3971,8 +4047,10 @@ bool ChatHandler::HandleWpExportCommand(char* args)
|
||||||
wpPathId = wpTarget->GetPathId();
|
wpPathId = wpTarget->GetPathId();
|
||||||
}
|
}
|
||||||
else // normal creature selected
|
else // normal creature selected
|
||||||
|
{
|
||||||
wpOwner = targetCreature;
|
wpOwner = targetCreature;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint32 dbGuid;
|
uint32 dbGuid;
|
||||||
|
|
@ -4022,23 +4100,31 @@ bool ChatHandler::HandleWpExportCommand(char* args)
|
||||||
{
|
{
|
||||||
uint32 src = (uint32)PATH_NO_PATH;
|
uint32 src = (uint32)PATH_NO_PATH;
|
||||||
if (ExtractOptUInt32(&args, src, src))
|
if (ExtractOptUInt32(&args, src, src))
|
||||||
|
{
|
||||||
wpOrigin = (WaypointPathOrigin)src;
|
wpOrigin = (WaypointPathOrigin)src;
|
||||||
|
}
|
||||||
else // pathId provided but no destination
|
else // pathId provided but no destination
|
||||||
{
|
{
|
||||||
if (wpPathId != 0)
|
if (wpPathId != 0)
|
||||||
|
{
|
||||||
wpOrigin = PATH_FROM_ENTRY; // Multiple Paths must only be assigned by entry
|
wpOrigin = PATH_FROM_ENTRY; // Multiple Paths must only be assigned by entry
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (wpOrigin == PATH_NO_PATH)
|
if (wpOrigin == PATH_NO_PATH)
|
||||||
{
|
{
|
||||||
if (wpOwner->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
|
if (wpOwner->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
|
||||||
if (WaypointMovementGenerator<Creature> const* wpMMGen = dynamic_cast<WaypointMovementGenerator<Creature> const*>(wpOwner->GetMotionMaster()->GetCurrent()))
|
if (WaypointMovementGenerator<Creature> const* wpMMGen = dynamic_cast<WaypointMovementGenerator<Creature> const*>(wpOwner->GetMotionMaster()->GetCurrent()))
|
||||||
|
{
|
||||||
wpMMGen->GetPathInformation(wpPathId, wpOrigin);
|
wpMMGen->GetPathInformation(wpPathId, wpOrigin);
|
||||||
|
}
|
||||||
if (wpOrigin == PATH_NO_PATH)
|
if (wpOrigin == PATH_NO_PATH)
|
||||||
|
{
|
||||||
sWaypointMgr.GetDefaultPath(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), &wpOrigin);
|
sWaypointMgr.GetDefaultPath(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), &wpOrigin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
WaypointPath const* wpPath = sWaypointMgr.GetPathFromOrigin(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), wpPathId, wpOrigin);
|
WaypointPath const* wpPath = sWaypointMgr.GetPathFromOrigin(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), wpPathId, wpOrigin);
|
||||||
if (!wpPath || wpPath->empty())
|
if (!wpPath || wpPath->empty())
|
||||||
|
|
@ -4085,12 +4171,18 @@ bool ChatHandler::HandleWpExportCommand(char* args)
|
||||||
outfile << itr->second.orientation << ",";
|
outfile << itr->second.orientation << ",";
|
||||||
outfile << itr->second.delay << ",";
|
outfile << itr->second.delay << ",";
|
||||||
if (wpOrigin != PATH_FROM_EXTERNAL) // Only for normal waypoints
|
if (wpOrigin != PATH_FROM_EXTERNAL) // Only for normal waypoints
|
||||||
|
{
|
||||||
outfile << itr->second.script_id << ")";
|
outfile << itr->second.script_id << ")";
|
||||||
|
}
|
||||||
if (countDown > 1)
|
if (countDown > 1)
|
||||||
|
{
|
||||||
outfile << ",\n";
|
outfile << ",\n";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
outfile << ";\n";
|
outfile << ";\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PSendSysMessage(LANG_WAYPOINT_EXPORTED);
|
PSendSysMessage(LANG_WAYPOINT_EXPORTED);
|
||||||
outfile.close();
|
outfile.close();
|
||||||
|
|
@ -4647,7 +4739,9 @@ bool ChatHandler::HandleLearnAllRecipesCommand(char* args)
|
||||||
if ((skillInfo->categoryId != SKILL_CATEGORY_PROFESSION &&
|
if ((skillInfo->categoryId != SKILL_CATEGORY_PROFESSION &&
|
||||||
skillInfo->categoryId != SKILL_CATEGORY_SECONDARY) ||
|
skillInfo->categoryId != SKILL_CATEGORY_SECONDARY) ||
|
||||||
!skillInfo->canLink) // only prof with recipes have set
|
!skillInfo->canLink) // only prof with recipes have set
|
||||||
{ continue; }
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
int loc = GetSessionDbcLocale();
|
int loc = GetSessionDbcLocale();
|
||||||
name = skillInfo->name[loc];
|
name = skillInfo->name[loc];
|
||||||
|
|
@ -5315,9 +5409,13 @@ bool ChatHandler::HandleWaterwalkCommand(char* args)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
{ player->SetWaterWalk(true); } // ON
|
{
|
||||||
|
player->SetWaterWalk(true); // ON
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ player->SetWaterWalk(false); } // OFF
|
{
|
||||||
|
player->SetWaterWalk(false); // OFF
|
||||||
|
}
|
||||||
|
|
||||||
PSendSysMessage(LANG_YOU_SET_WATERWALK, args, GetNameLink(player).c_str());
|
PSendSysMessage(LANG_YOU_SET_WATERWALK, args, GetNameLink(player).c_str());
|
||||||
if (needReportToTarget(player))
|
if (needReportToTarget(player))
|
||||||
|
|
@ -5362,7 +5460,9 @@ bool ChatHandler::HandleLookupTitleCommand(char* args)
|
||||||
int loc = GetSessionDbcLocale();
|
int loc = GetSessionDbcLocale();
|
||||||
std::string name = titleInfo->name[loc];
|
std::string name = titleInfo->name[loc];
|
||||||
if (name.empty())
|
if (name.empty())
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!Utf8FitTo(name, wnamepart))
|
if (!Utf8FitTo(name, wnamepart))
|
||||||
{
|
{
|
||||||
|
|
@ -5370,16 +5470,22 @@ bool ChatHandler::HandleLookupTitleCommand(char* args)
|
||||||
for (; loc < MAX_LOCALE; ++loc)
|
for (; loc < MAX_LOCALE; ++loc)
|
||||||
{
|
{
|
||||||
if (loc == GetSessionDbcLocale())
|
if (loc == GetSessionDbcLocale())
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
name = titleInfo->name[loc];
|
name = titleInfo->name[loc];
|
||||||
if (name.empty())
|
if (name.empty())
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (Utf8FitTo(name, wnamepart))
|
if (Utf8FitTo(name, wnamepart))
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (loc < MAX_LOCALE)
|
if (loc < MAX_LOCALE)
|
||||||
{
|
{
|
||||||
|
|
@ -5394,16 +5500,22 @@ bool ChatHandler::HandleLookupTitleCommand(char* args)
|
||||||
|
|
||||||
// send title in "id (idx:idx) - [namedlink locale]" format
|
// send title in "id (idx:idx) - [namedlink locale]" format
|
||||||
if (m_session)
|
if (m_session)
|
||||||
|
{
|
||||||
PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->bit_index, id, titleNameStr, localeNames[loc], knownStr, activeStr);
|
PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->bit_index, id, titleNameStr, localeNames[loc], knownStr, activeStr);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->bit_index, titleNameStr, localeNames[loc], knownStr, activeStr);
|
PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->bit_index, titleNameStr, localeNames[loc], knownStr, activeStr);
|
||||||
|
}
|
||||||
|
|
||||||
++counter;
|
++counter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (counter == 0) // if counter == 0 then we found nth
|
if (counter == 0) // if counter == 0 then we found nth
|
||||||
|
{
|
||||||
SendSysMessage(LANG_COMMAND_NOTITLEFOUND);
|
SendSysMessage(LANG_COMMAND_NOTITLEFOUND);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5544,7 +5656,9 @@ bool ChatHandler::HandleTitlesSetMaskCommand(char* args)
|
||||||
|
|
||||||
for (uint32 i = 1; i < sCharTitlesStore.GetNumRows(); ++i)
|
for (uint32 i = 1; i < sCharTitlesStore.GetNumRows(); ++i)
|
||||||
if (CharTitlesEntry const* tEntry = sCharTitlesStore.LookupEntry(i))
|
if (CharTitlesEntry const* tEntry = sCharTitlesStore.LookupEntry(i))
|
||||||
|
{
|
||||||
titles2 &= ~(uint64(1) << tEntry->bit_index);
|
titles2 &= ~(uint64(1) << tEntry->bit_index);
|
||||||
|
}
|
||||||
|
|
||||||
titles &= ~titles2; // remove nonexistent titles
|
titles &= ~titles2; // remove nonexistent titles
|
||||||
|
|
||||||
|
|
@ -5580,7 +5694,9 @@ bool ChatHandler::HandleCharacterTitlesCommand(char* args)
|
||||||
{
|
{
|
||||||
std::string name = titleInfo->name[loc];
|
std::string name = titleInfo->name[loc];
|
||||||
if (name.empty())
|
if (name.empty())
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index
|
char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index
|
||||||
? GetMangosString(LANG_ACTIVE)
|
? GetMangosString(LANG_ACTIVE)
|
||||||
|
|
@ -5591,11 +5707,15 @@ bool ChatHandler::HandleCharacterTitlesCommand(char* args)
|
||||||
|
|
||||||
// send title in "id (idx:idx) - [namedlink locale]" format
|
// send title in "id (idx:idx) - [namedlink locale]" format
|
||||||
if (m_session)
|
if (m_session)
|
||||||
|
{
|
||||||
PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->bit_index, id, titleNameStr, localeNames[loc], knownStr, activeStr);
|
PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->bit_index, id, titleNameStr, localeNames[loc], knownStr, activeStr);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->bit_index, name.c_str(), localeNames[loc], knownStr, activeStr);
|
PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->bit_index, name.c_str(), localeNames[loc], knownStr, activeStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5678,12 +5798,18 @@ bool ChatHandler::HandleMmapPathCommand(char* args)
|
||||||
followPath = true;
|
followPath = true;
|
||||||
para = strtok(NULL, " ");
|
para = strtok(NULL, " ");
|
||||||
if (para && strcmp(para, "straight") == 0)
|
if (para && strcmp(para, "straight") == 0)
|
||||||
|
{
|
||||||
useStraightPath = true;
|
useStraightPath = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (strcmp(para, "straight") == 0)
|
else if (strcmp(para, "straight") == 0)
|
||||||
|
{
|
||||||
useStraightPath = true;
|
useStraightPath = true;
|
||||||
|
}
|
||||||
else if (strcmp(para, "to_me") == 0)
|
else if (strcmp(para, "to_me") == 0)
|
||||||
|
{
|
||||||
unitToPlayer = true;
|
unitToPlayer = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PSendSysMessage("Use '.mmap path go' to move on target.");
|
PSendSysMessage("Use '.mmap path go' to move on target.");
|
||||||
|
|
|
||||||
|
|
@ -937,7 +937,9 @@ bool ChatHandler::HandleReloadDBScriptsOnGossipCommand(char* args)
|
||||||
sScriptMgr.LoadDbScripts(DBS_ON_GOSSIP);
|
sScriptMgr.LoadDbScripts(DBS_ON_GOSSIP);
|
||||||
|
|
||||||
if (*args != 'a')
|
if (*args != 'a')
|
||||||
|
{
|
||||||
SendGlobalSysMessage("DB table `db_scripts [type = DBS_ON_GOSSIP]` reloaded.");
|
SendGlobalSysMessage("DB table `db_scripts [type = DBS_ON_GOSSIP]` reloaded.");
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -959,7 +961,9 @@ bool ChatHandler::HandleReloadDBScriptsOnSpellCommand(char* args)
|
||||||
sScriptMgr.LoadDbScripts(DBS_ON_SPELL);
|
sScriptMgr.LoadDbScripts(DBS_ON_SPELL);
|
||||||
|
|
||||||
if (*args != 'a')
|
if (*args != 'a')
|
||||||
|
{
|
||||||
SendGlobalSysMessage("DB table `db_scripts [type = DBS_ON_SPELL]` reloaded.");
|
SendGlobalSysMessage("DB table `db_scripts [type = DBS_ON_SPELL]` reloaded.");
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -981,7 +985,9 @@ bool ChatHandler::HandleReloadDBScriptsOnQuestStartCommand(char* args)
|
||||||
sScriptMgr.LoadDbScripts(DBS_ON_QUEST_START);
|
sScriptMgr.LoadDbScripts(DBS_ON_QUEST_START);
|
||||||
|
|
||||||
if (*args != 'a')
|
if (*args != 'a')
|
||||||
|
{
|
||||||
SendGlobalSysMessage("DB table `db_scripts [type = DBS_ON_QUEST_START]` reloaded.");
|
SendGlobalSysMessage("DB table `db_scripts [type = DBS_ON_QUEST_START]` reloaded.");
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1003,7 +1009,9 @@ bool ChatHandler::HandleReloadDBScriptsOnQuestEndCommand(char* args)
|
||||||
sScriptMgr.LoadDbScripts(DBS_ON_QUEST_END);
|
sScriptMgr.LoadDbScripts(DBS_ON_QUEST_END);
|
||||||
|
|
||||||
if (*args != 'a')
|
if (*args != 'a')
|
||||||
|
{
|
||||||
SendGlobalSysMessage("DB table `db_scripts [type = DBS_ON_QUEST_END]` reloaded.");
|
SendGlobalSysMessage("DB table `db_scripts [type = DBS_ON_QUEST_END]` reloaded.");
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1025,7 +1033,9 @@ bool ChatHandler::HandleReloadDBScriptsOnEventCommand(char* args)
|
||||||
sScriptMgr.LoadDbScripts(DBS_ON_EVENT);
|
sScriptMgr.LoadDbScripts(DBS_ON_EVENT);
|
||||||
|
|
||||||
if (*args != 'a')
|
if (*args != 'a')
|
||||||
|
{
|
||||||
SendGlobalSysMessage("DB table `db_scripts [type = DBS_ON_EVENT]` reloaded.");
|
SendGlobalSysMessage("DB table `db_scripts [type = DBS_ON_EVENT]` reloaded.");
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1048,7 +1058,9 @@ bool ChatHandler::HandleReloadDBScriptsOnGoUseCommand(char* args)
|
||||||
sScriptMgr.LoadDbScripts(DBS_ON_GOT_USE);
|
sScriptMgr.LoadDbScripts(DBS_ON_GOT_USE);
|
||||||
|
|
||||||
if (*args != 'a')
|
if (*args != 'a')
|
||||||
|
{
|
||||||
SendGlobalSysMessage("DB table `db_scripts [type = DBS_ON_GO[_TEMPLATE]_USE]` reloaded.");
|
SendGlobalSysMessage("DB table `db_scripts [type = DBS_ON_GO[_TEMPLATE]_USE]` reloaded.");
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1070,7 +1082,9 @@ bool ChatHandler::HandleReloadDBScriptsOnCreatureDeathCommand(char* args)
|
||||||
sScriptMgr.LoadDbScripts(DBS_ON_CREATURE_DEATH);
|
sScriptMgr.LoadDbScripts(DBS_ON_CREATURE_DEATH);
|
||||||
|
|
||||||
if (*args != 'a')
|
if (*args != 'a')
|
||||||
|
{
|
||||||
SendGlobalSysMessage("DB table `db_scripts [type = DBS_ON_CREATURE_DEATH]` reloaded.");
|
SendGlobalSysMessage("DB table `db_scripts [type = DBS_ON_CREATURE_DEATH]` reloaded.");
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1358,20 +1372,28 @@ void ChatHandler::ShowAchievementCriteriaListHelper(AchievementCriteriaEntry con
|
||||||
ss << criEntry->ID << " - |cffffffff|Hachievement_criteria:" << criEntry->ID << "|h[" << criEntry->name[loc] << " " << localeNames[loc] << "]|h|r";
|
ss << criEntry->ID << " - |cffffffff|Hachievement_criteria:" << criEntry->ID << "|h[" << criEntry->name[loc] << " " << localeNames[loc] << "]|h|r";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
ss << criEntry->ID << " - " << criEntry->name[loc] << " " << localeNames[loc];
|
ss << criEntry->ID << " - " << criEntry->name[loc] << " " << localeNames[loc];
|
||||||
|
}
|
||||||
|
|
||||||
if (target)
|
if (target)
|
||||||
|
{
|
||||||
ss << " = " << target->GetAchievementMgr().GetCriteriaProgressCounter(criEntry);
|
ss << " = " << target->GetAchievementMgr().GetCriteriaProgressCounter(criEntry);
|
||||||
|
}
|
||||||
|
|
||||||
if (achEntry->flags & ACHIEVEMENT_FLAG_COUNTER)
|
if (achEntry->flags & ACHIEVEMENT_FLAG_COUNTER)
|
||||||
|
{
|
||||||
ss << GetMangosString(LANG_COUNTER);
|
ss << GetMangosString(LANG_COUNTER);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ss << " [" << AchievementMgr::GetCriteriaProgressMaxCounter(criEntry, achEntry) << "]";
|
ss << " [" << AchievementMgr::GetCriteriaProgressMaxCounter(criEntry, achEntry) << "]";
|
||||||
|
|
||||||
if (target && target->GetAchievementMgr().IsCompletedCriteria(criEntry, achEntry))
|
if (target && target->GetAchievementMgr().IsCompletedCriteria(criEntry, achEntry))
|
||||||
|
{
|
||||||
ss << GetMangosString(LANG_COMPLETE);
|
ss << GetMangosString(LANG_COMPLETE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SendSysMessage(ss.str().c_str());
|
SendSysMessage(ss.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
@ -1390,7 +1412,9 @@ bool ChatHandler::HandleAchievementCommand(char* args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
target = getSelectedPlayer();
|
target = getSelectedPlayer();
|
||||||
|
}
|
||||||
|
|
||||||
uint32 achId;
|
uint32 achId;
|
||||||
if (!ExtractUint32KeyFromLink(&args, "Hachievement", achId))
|
if (!ExtractUint32KeyFromLink(&args, "Hachievement", achId))
|
||||||
|
|
@ -1455,7 +1479,9 @@ bool ChatHandler::HandleAchievementAddCommand(char* args)
|
||||||
for (AchievementCriteriaEntryList::const_iterator itr = criteriaList->begin(); itr != criteriaList->end(); ++itr)
|
for (AchievementCriteriaEntryList::const_iterator itr = criteriaList->begin(); itr != criteriaList->end(); ++itr)
|
||||||
{
|
{
|
||||||
if (mgr.IsCompletedCriteria(*itr, achEntry))
|
if (mgr.IsCompletedCriteria(*itr, achEntry))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 maxValue = AchievementMgr::GetCriteriaProgressMaxCounter(*itr, achEntry);
|
uint32 maxValue = AchievementMgr::GetCriteriaProgressMaxCounter(*itr, achEntry);
|
||||||
if (maxValue == std::numeric_limits<uint32>::max())
|
if (maxValue == std::numeric_limits<uint32>::max())
|
||||||
|
|
@ -1528,7 +1554,9 @@ bool ChatHandler::HandleAchievementCriteriaAddCommand(char* args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
target = getSelectedPlayer();
|
target = getSelectedPlayer();
|
||||||
|
}
|
||||||
|
|
||||||
AchievementCriteriaEntry const* criEntry = sAchievementCriteriaStore.LookupEntry(criId);
|
AchievementCriteriaEntry const* criEntry = sAchievementCriteriaStore.LookupEntry(criId);
|
||||||
if (!criEntry)
|
if (!criEntry)
|
||||||
|
|
@ -1570,7 +1598,9 @@ bool ChatHandler::HandleAchievementCriteriaAddCommand(char* args)
|
||||||
uint32 new_val;
|
uint32 new_val;
|
||||||
|
|
||||||
if (maxValue)
|
if (maxValue)
|
||||||
|
{
|
||||||
new_val = progress < maxValue && maxValue - progress > val ? progress + val : maxValue;
|
new_val = progress < maxValue && maxValue - progress > val ? progress + val : maxValue;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint32 max_int = std::numeric_limits<uint32>::max();
|
uint32 max_int = std::numeric_limits<uint32>::max();
|
||||||
|
|
@ -1603,7 +1633,9 @@ bool ChatHandler::HandleAchievementCriteriaRemoveCommand(char* args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
target = getSelectedPlayer();
|
target = getSelectedPlayer();
|
||||||
|
}
|
||||||
|
|
||||||
AchievementCriteriaEntry const* criEntry = sAchievementCriteriaStore.LookupEntry(criId);
|
AchievementCriteriaEntry const* criEntry = sAchievementCriteriaStore.LookupEntry(criId);
|
||||||
if (!criEntry)
|
if (!criEntry)
|
||||||
|
|
@ -1778,7 +1810,9 @@ bool ChatHandler::HandleUnLearnCommand(char* args)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetTalentSpellCost(spell_id))
|
if (GetTalentSpellCost(spell_id))
|
||||||
|
{
|
||||||
target->SendTalentsInfoData(false);
|
target->SendTalentsInfoData(false);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -2657,15 +2691,21 @@ bool ChatHandler::HandleLearnAllMyPetTalentsCommand(char* /*args*/)
|
||||||
{
|
{
|
||||||
TalentEntry const* talentInfo = sTalentStore.LookupEntry(i);
|
TalentEntry const* talentInfo = sTalentStore.LookupEntry(i);
|
||||||
if (!talentInfo)
|
if (!talentInfo)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab);
|
TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab);
|
||||||
if (!talentTabInfo)
|
if (!talentTabInfo)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// prevent learn talent for different family (cheating)
|
// prevent learn talent for different family (cheating)
|
||||||
if (((1 << pet_family->petTalentType) & talentTabInfo->petTalentMask) == 0)
|
if (((1 << pet_family->petTalentType) & talentTabInfo->petTalentMask) == 0)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// search highest talent rank
|
// search highest talent rank
|
||||||
uint32 spellid = 0;
|
uint32 spellid = 0;
|
||||||
|
|
@ -2680,11 +2720,15 @@ bool ChatHandler::HandleLearnAllMyPetTalentsCommand(char* /*args*/)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!spellid) // ??? none spells in talent
|
if (!spellid) // ??? none spells in talent
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellid);
|
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellid);
|
||||||
if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, m_session->GetPlayer(), false))
|
if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, m_session->GetPlayer(), false))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// learn highest rank of talent and learn all non-talent spell ranks (recursive by tree)
|
// learn highest rank of talent and learn all non-talent spell ranks (recursive by tree)
|
||||||
pet->learnSpellHighRank(spellid);
|
pet->learnSpellHighRank(spellid);
|
||||||
|
|
@ -2765,7 +2809,9 @@ bool ChatHandler::HandleLearnCommand(char* args)
|
||||||
SendSysMessage(LANG_YOU_KNOWN_SPELL);
|
SendSysMessage(LANG_YOU_KNOWN_SPELL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
PSendSysMessage(LANG_TARGET_KNOWN_SPELL, GetNameLink(targetPlayer).c_str());
|
PSendSysMessage(LANG_TARGET_KNOWN_SPELL, GetNameLink(targetPlayer).c_str());
|
||||||
|
}
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -2781,7 +2827,9 @@ bool ChatHandler::HandleLearnCommand(char* args)
|
||||||
|
|
||||||
uint32 first_spell = sSpellMgr.GetFirstSpellInChain(spell);
|
uint32 first_spell = sSpellMgr.GetFirstSpellInChain(spell);
|
||||||
if (GetTalentSpellCost(first_spell))
|
if (GetTalentSpellCost(first_spell))
|
||||||
|
{
|
||||||
targetPlayer->SendTalentsInfoData(false);
|
targetPlayer->SendTalentsInfoData(false);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -3189,10 +3237,14 @@ bool ChatHandler::HandleListItemCommand(char* args)
|
||||||
delete result;
|
delete result;
|
||||||
|
|
||||||
if (count > res_count)
|
if (count > res_count)
|
||||||
|
{
|
||||||
count -= res_count;
|
count -= res_count;
|
||||||
|
}
|
||||||
else if (count)
|
else if (count)
|
||||||
|
{
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (inv_count + mail_count + auc_count + guild_count == 0)
|
if (inv_count + mail_count + auc_count + guild_count == 0)
|
||||||
{
|
{
|
||||||
|
|
@ -3633,17 +3685,27 @@ void ChatHandler::ShowCurrencyListHelper(Player* target, CurrencyTypesEntry cons
|
||||||
// send spell in "id - [name] (Amount: x)" format
|
// send spell in "id - [name] (Amount: x)" format
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
if (m_session)
|
if (m_session)
|
||||||
|
{
|
||||||
ss << id << " - |cff00aa00|Hcurrency:" << id << "|h[" << currency->name[loc];
|
ss << id << " - |cff00aa00|Hcurrency:" << id << "|h[" << currency->name[loc];
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
ss << id << " - " << currency->name[loc];
|
ss << id << " - " << currency->name[loc];
|
||||||
|
}
|
||||||
|
|
||||||
if (m_session)
|
if (m_session)
|
||||||
|
{
|
||||||
ss << " " << localeNames[loc] << "]|h|r";
|
ss << " " << localeNames[loc] << "]|h|r";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
ss << " " << localeNames[loc];
|
ss << " " << localeNames[loc];
|
||||||
|
}
|
||||||
|
|
||||||
if (target)
|
if (target)
|
||||||
|
{
|
||||||
ss << " (" << GetMangosString(LANG_CURRENCY_AMOUNT) << ": " << count << ")";
|
ss << " (" << GetMangosString(LANG_CURRENCY_AMOUNT) << ": " << count << ")";
|
||||||
|
}
|
||||||
|
|
||||||
SendSysMessage(ss.str().c_str());
|
SendSysMessage(ss.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
@ -3748,7 +3810,9 @@ bool ChatHandler::HandleLookupCurrencyCommand(char* args)
|
||||||
int loc = GetSessionDbcLocale();
|
int loc = GetSessionDbcLocale();
|
||||||
std::string name = currency->name[loc];
|
std::string name = currency->name[loc];
|
||||||
if (name.empty())
|
if (name.empty())
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!Utf8FitTo(name, wnamepart))
|
if (!Utf8FitTo(name, wnamepart))
|
||||||
{
|
{
|
||||||
|
|
@ -3756,16 +3820,22 @@ bool ChatHandler::HandleLookupCurrencyCommand(char* args)
|
||||||
for (; loc < MAX_LOCALE; ++loc)
|
for (; loc < MAX_LOCALE; ++loc)
|
||||||
{
|
{
|
||||||
if (loc == GetSessionDbcLocale())
|
if (loc == GetSessionDbcLocale())
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
name = currency->name[loc];
|
name = currency->name[loc];
|
||||||
if (name.empty())
|
if (name.empty())
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (Utf8FitTo(name, wnamepart))
|
if (Utf8FitTo(name, wnamepart))
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (loc < MAX_LOCALE)
|
if (loc < MAX_LOCALE)
|
||||||
{
|
{
|
||||||
|
|
@ -3775,7 +3845,9 @@ bool ChatHandler::HandleLookupCurrencyCommand(char* args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (counter == 0) // if counter == 0 then we found nth
|
if (counter == 0) // if counter == 0 then we found nth
|
||||||
|
{
|
||||||
SendSysMessage(LANG_COMMAND_NOCURRENCYFOUND);
|
SendSysMessage(LANG_COMMAND_NOCURRENCYFOUND);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3842,7 +3914,9 @@ bool ChatHandler::HandleLookupSpellCommand(char* args)
|
||||||
if (loc < MAX_LOCALE)
|
if (loc < MAX_LOCALE)
|
||||||
{
|
{
|
||||||
if (target)
|
if (target)
|
||||||
|
{
|
||||||
ShowSpellListHelper(target, spellInfo, LocaleConstant(loc));
|
ShowSpellListHelper(target, spellInfo, LocaleConstant(loc));
|
||||||
|
}
|
||||||
|
|
||||||
++counter;
|
++counter;
|
||||||
}
|
}
|
||||||
|
|
@ -4570,7 +4644,9 @@ bool ChatHandler::HandleReviveCommand(char* args)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
// will resurrected at login without corpse
|
// will resurrected at login without corpse
|
||||||
{ sObjectAccessor.ConvertCorpseForPlayer(target_guid); }
|
{
|
||||||
|
sObjectAccessor.ConvertCorpseForPlayer(target_guid);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -4608,7 +4684,9 @@ bool ChatHandler::HandleAuraCommand(char* args)
|
||||||
{
|
{
|
||||||
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(SpellEffectIndex(i));
|
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(SpellEffectIndex(i));
|
||||||
if(!spellEffect)
|
if(!spellEffect)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
uint8 eff = spellEffect->Effect;
|
uint8 eff = spellEffect->Effect;
|
||||||
if (eff >= TOTAL_SPELL_EFFECTS)
|
if (eff >= TOTAL_SPELL_EFFECTS)
|
||||||
|
|
@ -4887,14 +4965,18 @@ bool ChatHandler::HandleNpcInfoCommand(char* /*args*/)
|
||||||
uint32 diff = 1;
|
uint32 diff = 1;
|
||||||
for (; diff < MAX_DIFFICULTY; ++diff)
|
for (; diff < MAX_DIFFICULTY; ++diff)
|
||||||
if (baseInfo->DifficultyEntry[diff - 1] == target->GetCreatureInfo()->Entry)
|
if (baseInfo->DifficultyEntry[diff - 1] == target->GetCreatureInfo()->Entry)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (diff < MAX_DIFFICULTY)
|
if (diff < MAX_DIFFICULTY)
|
||||||
PSendSysMessage(LANG_NPCINFO_CHAR_DIFFICULTY, target->GetGuidStr().c_str(), faction, npcflags,
|
PSendSysMessage(LANG_NPCINFO_CHAR_DIFFICULTY, target->GetGuidStr().c_str(), faction, npcflags,
|
||||||
Entry, target->GetCreatureInfo()->Entry, diff,
|
Entry, target->GetCreatureInfo()->Entry, diff,
|
||||||
displayid, nativeid);
|
displayid, nativeid);
|
||||||
else
|
else
|
||||||
|
{
|
||||||
PSendSysMessage(LANG_NPCINFO_CHAR, target->GetGuidStr().c_str(), faction, npcflags, Entry, displayid, nativeid);
|
PSendSysMessage(LANG_NPCINFO_CHAR, target->GetGuidStr().c_str(), faction, npcflags, Entry, displayid, nativeid);
|
||||||
|
}
|
||||||
|
|
||||||
PSendSysMessage(LANG_NPCINFO_LEVEL, target->getLevel());
|
PSendSysMessage(LANG_NPCINFO_LEVEL, target->getLevel());
|
||||||
PSendSysMessage(LANG_NPCINFO_HEALTH, target->GetCreateHealth(), target->GetMaxHealth(), target->GetHealth());
|
PSendSysMessage(LANG_NPCINFO_HEALTH, target->GetCreateHealth(), target->GetMaxHealth(), target->GetHealth());
|
||||||
|
|
@ -4998,8 +5080,10 @@ bool ChatHandler::HandleNpcAddWeaponCommand(char* /*args*/)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(added)
|
if(added)
|
||||||
|
{
|
||||||
PSendSysMessage(LANG_ITEM_ADDED_TO_SLOT,ItemID,tmpItem->Name1,SlotID);
|
PSendSysMessage(LANG_ITEM_ADDED_TO_SLOT,ItemID,tmpItem->Name1,SlotID);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_ITEM_NOT_FOUND,ItemID);
|
PSendSysMessage(LANG_ITEM_NOT_FOUND,ItemID);
|
||||||
|
|
@ -5130,7 +5214,9 @@ bool ChatHandler::HandleCharacterLevelCommand(char* args)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newlevel < 1)
|
if (newlevel < 1)
|
||||||
{ return false; } // invalid level
|
{
|
||||||
|
return false; // invalid level
|
||||||
|
}
|
||||||
|
|
||||||
if (newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level
|
if (newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level
|
||||||
{
|
{
|
||||||
|
|
@ -5490,9 +5576,13 @@ bool ChatHandler::HandleChangeWeatherCommand(char* args)
|
||||||
|
|
||||||
// clamp grade from 0 to 1
|
// clamp grade from 0 to 1
|
||||||
if (grade < 0.0f)
|
if (grade < 0.0f)
|
||||||
|
{
|
||||||
grade = 0.0f;
|
grade = 0.0f;
|
||||||
|
}
|
||||||
else if (grade > 1.0f)
|
else if (grade > 1.0f)
|
||||||
|
{
|
||||||
grade = 1.0f;
|
grade = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
Player* player = m_session->GetPlayer();
|
Player* player = m_session->GetPlayer();
|
||||||
uint32 zoneId = player->GetZoneId();
|
uint32 zoneId = player->GetZoneId();
|
||||||
|
|
@ -5708,9 +5798,13 @@ bool ChatHandler::HandleResetAchievementsCommand(char* args)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target)
|
if (target)
|
||||||
|
{
|
||||||
target->GetAchievementMgr().Reset();
|
target->GetAchievementMgr().Reset();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
AchievementMgr::DeleteFromDB(target_guid);
|
AchievementMgr::DeleteFromDB(target_guid);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -5886,7 +5980,9 @@ bool ChatHandler::HandleResetSpecsCommand(char* args)
|
||||||
Pet* pet = target->GetPet();
|
Pet* pet = target->GetPet();
|
||||||
Pet::resetTalentsForAllPetsOf(target, pet);
|
Pet::resetTalentsForAllPetsOf(target, pet);
|
||||||
if (pet)
|
if (pet)
|
||||||
|
{
|
||||||
target->SendTalentsInfoData(true);
|
target->SendTalentsInfoData(true);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (target_guid)
|
else if (target_guid)
|
||||||
|
|
@ -5921,8 +6017,10 @@ bool ChatHandler::HandleResetTalentsCommand(char* args)
|
||||||
|
|
||||||
ChatHandler((Player*)owner).SendSysMessage(LANG_RESET_PET_TALENTS);
|
ChatHandler((Player*)owner).SendSysMessage(LANG_RESET_PET_TALENTS);
|
||||||
if (!m_session || m_session->GetPlayer() != ((Player*)owner))
|
if (!m_session || m_session->GetPlayer() != ((Player*)owner))
|
||||||
|
{
|
||||||
PSendSysMessage(LANG_RESET_PET_TALENTS_ONLINE, GetNameLink((Player*)owner).c_str());
|
PSendSysMessage(LANG_RESET_PET_TALENTS_ONLINE, GetNameLink((Player*)owner).c_str());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5937,12 +6035,16 @@ bool ChatHandler::HandleResetTalentsCommand(char* args)
|
||||||
target->SendTalentsInfoData(false);
|
target->SendTalentsInfoData(false);
|
||||||
ChatHandler(target).SendSysMessage(LANG_RESET_TALENTS);
|
ChatHandler(target).SendSysMessage(LANG_RESET_TALENTS);
|
||||||
if (!m_session || m_session->GetPlayer() != target)
|
if (!m_session || m_session->GetPlayer() != target)
|
||||||
|
{
|
||||||
PSendSysMessage(LANG_RESET_TALENTS_ONLINE, GetNameLink(target).c_str());
|
PSendSysMessage(LANG_RESET_TALENTS_ONLINE, GetNameLink(target).c_str());
|
||||||
|
}
|
||||||
|
|
||||||
Pet* pet = target->GetPet();
|
Pet* pet = target->GetPet();
|
||||||
Pet::resetTalentsForAllPetsOf(target, pet);
|
Pet::resetTalentsForAllPetsOf(target, pet);
|
||||||
if (pet)
|
if (pet)
|
||||||
|
{
|
||||||
target->SendTalentsInfoData(true);
|
target->SendTalentsInfoData(true);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6316,11 +6418,15 @@ bool ChatHandler::HandleQuestCompleteCommand(char* args)
|
||||||
for (int i = 0; i < QUEST_REQUIRED_CURRENCY_COUNT; ++i)
|
for (int i = 0; i < QUEST_REQUIRED_CURRENCY_COUNT; ++i)
|
||||||
{
|
{
|
||||||
if (pQuest->ReqCurrencyId[i])
|
if (pQuest->ReqCurrencyId[i])
|
||||||
|
{
|
||||||
player->ModifyCurrencyCount(pQuest->ReqCurrencyId[i], int32(pQuest->ReqCurrencyCount[i] * GetCurrencyPrecision(pQuest->ReqCurrencyId[i])));
|
player->ModifyCurrencyCount(pQuest->ReqCurrencyId[i], int32(pQuest->ReqCurrencyCount[i] * GetCurrencyPrecision(pQuest->ReqCurrencyId[i])));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (uint32 spell = pQuest->GetReqSpellLearned())
|
if (uint32 spell = pQuest->GetReqSpellLearned())
|
||||||
|
{
|
||||||
player->learnSpell(spell, false);
|
player->learnSpell(spell, false);
|
||||||
|
}
|
||||||
|
|
||||||
player->CompleteQuest(entry, QUEST_STATUS_FORCE_COMPLETE);
|
player->CompleteQuest(entry, QUEST_STATUS_FORCE_COMPLETE);
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -7539,9 +7645,11 @@ bool ChatHandler::HandleInstanceUnbindCommand(char* args)
|
||||||
++counter;
|
++counter;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
++itr;
|
++itr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
PSendSysMessage("instances unbound: %d", counter);
|
PSendSysMessage("instances unbound: %d", counter);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -7721,7 +7829,9 @@ bool ChatHandler::HandleAccountSetAddonCommand(char* args)
|
||||||
// or to self account
|
// or to self account
|
||||||
if (GetAccountId() && GetAccountId() != account_id &&
|
if (GetAccountId() && GetAccountId() != account_id &&
|
||||||
HasLowerSecurityAccount(NULL, account_id, true))
|
HasLowerSecurityAccount(NULL, account_id, true))
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 lev;
|
uint32 lev;
|
||||||
if (!ExtractUInt32(&args, lev))
|
if (!ExtractUInt32(&args, lev))
|
||||||
|
|
@ -8236,19 +8346,25 @@ bool ChatHandler::HandleMmapTestHeight(char* args)
|
||||||
float radius = 0.0f;
|
float radius = 0.0f;
|
||||||
ExtractFloat(&args, radius);
|
ExtractFloat(&args, radius);
|
||||||
if (radius > 40.0f)
|
if (radius > 40.0f)
|
||||||
|
{
|
||||||
radius = 40.0f;
|
radius = 40.0f;
|
||||||
|
}
|
||||||
|
|
||||||
Unit* unit = getSelectedUnit();
|
Unit* unit = getSelectedUnit();
|
||||||
|
|
||||||
Player* player = m_session->GetPlayer();
|
Player* player = m_session->GetPlayer();
|
||||||
if (!unit)
|
if (!unit)
|
||||||
|
{
|
||||||
unit = player;
|
unit = player;
|
||||||
|
}
|
||||||
|
|
||||||
if (unit->GetTypeId() == TYPEID_UNIT)
|
if (unit->GetTypeId() == TYPEID_UNIT)
|
||||||
{
|
{
|
||||||
if (radius < 0.1f)
|
if (radius < 0.1f)
|
||||||
|
{
|
||||||
radius = static_cast<Creature*>(unit)->GetRespawnRadius();
|
radius = static_cast<Creature*>(unit)->GetRespawnRadius();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (unit->GetTypeId() != TYPEID_PLAYER)
|
if (unit->GetTypeId() != TYPEID_PLAYER)
|
||||||
|
|
@ -8280,9 +8396,11 @@ bool ChatHandler::HandleMmapTestHeight(char* args)
|
||||||
unit->SummonCreature(VISUAL_WAYPOINT, gx, gy, gz, 0, TEMPSUMMON_TIMED_DESPAWN, 15000);
|
unit->SummonCreature(VISUAL_WAYPOINT, gx, gy, gz, 0, TEMPSUMMON_TIMED_DESPAWN, 15000);
|
||||||
++successes;
|
++successes;
|
||||||
if (successes >= 100)
|
if (successes >= 100)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
uint32 genTime = WorldTimer::getMSTimeDiff(startTime, WorldTimer::getMSTime());
|
uint32 genTime = WorldTimer::getMSTimeDiff(startTime, WorldTimer::getMSTime());
|
||||||
PSendSysMessage("Generated %u valid points for %u try in %ums.", successes, tries, genTime);
|
PSendSysMessage("Generated %u valid points for %u try in %ums.", successes, tries, genTime);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -512,9 +512,13 @@ bool ChatHandler::HandleAccountCreateCommand(char* args)
|
||||||
AccountOpResult result;
|
AccountOpResult result;
|
||||||
uint32 expansion = 0;
|
uint32 expansion = 0;
|
||||||
if(ExtractUInt32(&args, expansion))
|
if(ExtractUInt32(&args, expansion))
|
||||||
|
{
|
||||||
result = sAccountMgr.CreateAccount(account_name, password, expansion);
|
result = sAccountMgr.CreateAccount(account_name, password, expansion);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
result = sAccountMgr.CreateAccount(account_name, password);
|
result = sAccountMgr.CreateAccount(account_name, password);
|
||||||
|
}
|
||||||
switch (result)
|
switch (result)
|
||||||
{
|
{
|
||||||
case AOR_OK:
|
case AOR_OK:
|
||||||
|
|
|
||||||
|
|
@ -148,11 +148,15 @@ bool ChatHandler::HandleDebugRecvOpcodeCommand(char* /*args*/)
|
||||||
{
|
{
|
||||||
Unit* unit = getSelectedUnit();
|
Unit* unit = getSelectedUnit();
|
||||||
if (!unit || (unit->GetTypeId() != TYPEID_PLAYER))
|
if (!unit || (unit->GetTypeId() != TYPEID_PLAYER))
|
||||||
{ unit = m_session->GetPlayer(); }
|
{
|
||||||
|
unit = m_session->GetPlayer();
|
||||||
|
}
|
||||||
|
|
||||||
std::ifstream stream("ropcode.txt");
|
std::ifstream stream("ropcode.txt");
|
||||||
if (!stream.is_open())
|
if (!stream.is_open())
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 opcode = 0;
|
uint32 opcode = 0;
|
||||||
if (!(stream >> opcode))
|
if (!(stream >> opcode))
|
||||||
|
|
@ -167,7 +171,9 @@ bool ChatHandler::HandleDebugRecvOpcodeCommand(char* /*args*/)
|
||||||
while (stream >> type)
|
while (stream >> type)
|
||||||
{
|
{
|
||||||
if (type.empty())
|
if (type.empty())
|
||||||
{ break; }
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (type == "uint8")
|
if (type == "uint8")
|
||||||
{
|
{
|
||||||
|
|
@ -206,17 +212,29 @@ bool ChatHandler::HandleDebugRecvOpcodeCommand(char* /*args*/)
|
||||||
*data << value;
|
*data << value;
|
||||||
}
|
}
|
||||||
else if (type == "pguid")
|
else if (type == "pguid")
|
||||||
{ *data << unit->GetPackGUID(); }
|
{
|
||||||
|
*data << unit->GetPackGUID();
|
||||||
|
}
|
||||||
else if (type == "guid")
|
else if (type == "guid")
|
||||||
{ *data << unit->GetObjectGuid(); }
|
{
|
||||||
|
*data << unit->GetObjectGuid();
|
||||||
|
}
|
||||||
else if (type == "mypguid")
|
else if (type == "mypguid")
|
||||||
{ *data << m_session->GetPlayer()->GetPackGUID(); }
|
{
|
||||||
|
*data << m_session->GetPlayer()->GetPackGUID();
|
||||||
|
}
|
||||||
else if (type == "myguid")
|
else if (type == "myguid")
|
||||||
{ *data << m_session->GetPlayer()->GetObjectGuid(); }
|
{
|
||||||
|
*data << m_session->GetPlayer()->GetObjectGuid();
|
||||||
|
}
|
||||||
else if (type == "name")
|
else if (type == "name")
|
||||||
{ *data << unit->GetName(); }
|
{
|
||||||
|
*data << unit->GetName();
|
||||||
|
}
|
||||||
else if (type == "myname")
|
else if (type == "myname")
|
||||||
{ *data << m_session->GetPlayerName(); }
|
{
|
||||||
|
*data << m_session->GetPlayerName();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DEBUG_LOG("Sending opcode: unknown type '%s'", type.c_str());
|
DEBUG_LOG("Sending opcode: unknown type '%s'", type.c_str());
|
||||||
|
|
@ -301,17 +319,29 @@ bool ChatHandler::HandleDebugSendOpcodeCommand(char* /*args*/)
|
||||||
data << value;
|
data << value;
|
||||||
}
|
}
|
||||||
else if (type == "pguid")
|
else if (type == "pguid")
|
||||||
{ data << unit->GetPackGUID(); }
|
{
|
||||||
|
data << unit->GetPackGUID();
|
||||||
|
}
|
||||||
else if (type == "guid")
|
else if (type == "guid")
|
||||||
{ data << unit->GetObjectGuid(); }
|
{
|
||||||
|
data << unit->GetObjectGuid();
|
||||||
|
}
|
||||||
else if(type == "mypguid")
|
else if(type == "mypguid")
|
||||||
{ data << m_session->GetPlayer()->GetPackGUID(); }
|
{
|
||||||
|
data << m_session->GetPlayer()->GetPackGUID();
|
||||||
|
}
|
||||||
else if (type == "myguid")
|
else if (type == "myguid")
|
||||||
{ data << m_session->GetPlayer()->GetObjectGuid(); }
|
{
|
||||||
|
data << m_session->GetPlayer()->GetObjectGuid();
|
||||||
|
}
|
||||||
else if (type == "name")
|
else if (type == "name")
|
||||||
{ data << unit->GetName(); }
|
{
|
||||||
|
data << unit->GetName();
|
||||||
|
}
|
||||||
else if (type == "myname")
|
else if (type == "myname")
|
||||||
{ data << m_session->GetPlayerName(); }
|
{
|
||||||
|
data << m_session->GetPlayerName();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DEBUG_LOG("Sending opcode: unknown type '%s'", type.c_str());
|
DEBUG_LOG("Sending opcode: unknown type '%s'", type.c_str());
|
||||||
|
|
@ -1379,7 +1409,9 @@ bool ChatHandler::HandleDebugSpellCoefsCommand(char* args)
|
||||||
{
|
{
|
||||||
SpellEffectEntry const* spellEffect = spellEntry->GetSpellEffect(SpellEffectIndex(i));
|
SpellEffectEntry const* spellEffect = spellEntry->GetSpellEffect(SpellEffectIndex(i));
|
||||||
if(!spellEffect)
|
if(!spellEffect)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
// Heals (Also count Mana Shield and Absorb effects as heals)
|
// Heals (Also count Mana Shield and Absorb effects as heals)
|
||||||
if (spellEffect->Effect == SPELL_EFFECT_HEAL || spellEffect->Effect == SPELL_EFFECT_HEAL_MAX_HEALTH ||
|
if (spellEffect->Effect == SPELL_EFFECT_HEAL || spellEffect->Effect == SPELL_EFFECT_HEAL_MAX_HEALTH ||
|
||||||
(spellEffect->Effect == SPELL_EFFECT_APPLY_AURA && (spellEffect->EffectApplyAuraName == SPELL_AURA_SCHOOL_ABSORB || spellEffect->EffectApplyAuraName == SPELL_AURA_PERIODIC_HEAL)))
|
(spellEffect->Effect == SPELL_EFFECT_APPLY_AURA && (spellEffect->EffectApplyAuraName == SPELL_AURA_SCHOOL_ABSORB || spellEffect->EffectApplyAuraName == SPELL_AURA_PERIODIC_HEAL)))
|
||||||
|
|
@ -1394,7 +1426,9 @@ bool ChatHandler::HandleDebugSpellCoefsCommand(char* args)
|
||||||
{
|
{
|
||||||
SpellEffectEntry const* spellEffect = spellEntry->GetSpellEffect(SpellEffectIndex(i));
|
SpellEffectEntry const* spellEffect = spellEntry->GetSpellEffect(SpellEffectIndex(i));
|
||||||
if(!spellEffect)
|
if(!spellEffect)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
// Periodic Heals
|
// Periodic Heals
|
||||||
if (spellEffect->Effect == SPELL_EFFECT_APPLY_AURA && spellEffect->EffectApplyAuraName == SPELL_AURA_PERIODIC_HEAL)
|
if (spellEffect->Effect == SPELL_EFFECT_APPLY_AURA && spellEffect->EffectApplyAuraName == SPELL_AURA_PERIODIC_HEAL)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,9 @@ void FleeingMovementGenerator<T>::Initialize(T& owner)
|
||||||
owner.StopMoving();
|
owner.StopMoving();
|
||||||
|
|
||||||
if (owner.GetTypeId() == TYPEID_UNIT)
|
if (owner.GetTypeId() == TYPEID_UNIT)
|
||||||
|
{
|
||||||
owner.SetTargetGuid(ObjectGuid());
|
owner.SetTargetGuid(ObjectGuid());
|
||||||
|
}
|
||||||
|
|
||||||
_setTargetLocation(owner);
|
_setTargetLocation(owner);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,8 +62,10 @@ void MotionMaster::Initialize()
|
||||||
push(movement == NULL ? &si_idleMovement : movement);
|
push(movement == NULL ? &si_idleMovement : movement);
|
||||||
top()->Initialize(*m_owner);
|
top()->Initialize(*m_owner);
|
||||||
if (top()->GetMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
|
if (top()->GetMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
|
||||||
|
{
|
||||||
(static_cast<WaypointMovementGenerator<Creature>*>(top()))->InitializeWaypointPath(*((Creature*)(m_owner)), 0, PATH_NO_PATH, 0, 0);
|
(static_cast<WaypointMovementGenerator<Creature>*>(top()))->InitializeWaypointPath(*((Creature*)(m_owner)), 0, PATH_NO_PATH, 0, 0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
push(&si_idleMovement);
|
push(&si_idleMovement);
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,9 @@ dtPolyRef PathFinder::getPathPolyByPosition(const dtPolyRef* polyPath, uint32 po
|
||||||
float closestPoint[VERTEX_SIZE];
|
float closestPoint[VERTEX_SIZE];
|
||||||
dtStatus dtResult = m_navMeshQuery->closestPointOnPoly(polyPath[i], point, closestPoint, NULL);
|
dtStatus dtResult = m_navMeshQuery->closestPointOnPoly(polyPath[i], point, closestPoint, NULL);
|
||||||
if (dtStatusFailed(dtResult))
|
if (dtStatusFailed(dtResult))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
float d = dtVdist2DSqr(point, closestPoint);
|
float d = dtVdist2DSqr(point, closestPoint);
|
||||||
if (d < minDist2d)
|
if (d < minDist2d)
|
||||||
|
|
@ -187,7 +189,9 @@ void PathFinder::BuildPolyPath(const Vector3& startPos, const Vector3& endPos)
|
||||||
// Check for swimming or flying shortcut
|
// Check for swimming or flying shortcut
|
||||||
if ((startPoly == INVALID_POLYREF && m_sourceUnit->GetTerrain()->IsUnderWater(startPos.x, startPos.y, startPos.z)) ||
|
if ((startPoly == INVALID_POLYREF && m_sourceUnit->GetTerrain()->IsUnderWater(startPos.x, startPos.y, startPos.z)) ||
|
||||||
(endPoly == INVALID_POLYREF && m_sourceUnit->GetTerrain()->IsUnderWater(endPos.x, endPos.y, endPos.z)))
|
(endPoly == INVALID_POLYREF && m_sourceUnit->GetTerrain()->IsUnderWater(endPos.x, endPos.y, endPos.z)))
|
||||||
{ m_type = ((Creature*)m_sourceUnit)->CanSwim() ? PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH) : PATHFIND_NOPATH; }
|
{
|
||||||
|
m_type = ((Creature*)m_sourceUnit)->CanSwim() ? PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH) : PATHFIND_NOPATH;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_type = ((Creature*)m_sourceUnit)->CanFly() ? PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH) : PATHFIND_NOPATH;
|
m_type = ((Creature*)m_sourceUnit)->CanFly() ? PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH) : PATHFIND_NOPATH;
|
||||||
|
|
@ -517,11 +521,15 @@ void PathFinder::createFilter()
|
||||||
{
|
{
|
||||||
Creature* creature = (Creature*)m_sourceUnit;
|
Creature* creature = (Creature*)m_sourceUnit;
|
||||||
if (creature->CanWalk())
|
if (creature->CanWalk())
|
||||||
{ includeFlags |= NAV_GROUND; } // walk
|
{
|
||||||
|
includeFlags |= NAV_GROUND; // walk
|
||||||
|
}
|
||||||
|
|
||||||
// creatures don't take environmental damage
|
// creatures don't take environmental damage
|
||||||
if (creature->CanSwim())
|
if (creature->CanSwim())
|
||||||
{ includeFlags |= (NAV_WATER | NAV_MAGMA | NAV_SLIME); } // swim
|
{
|
||||||
|
includeFlags |= (NAV_WATER | NAV_MAGMA | NAV_SLIME); // swim
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (m_sourceUnit->GetTypeId() == TYPEID_PLAYER)
|
else if (m_sourceUnit->GetTypeId() == TYPEID_PLAYER)
|
||||||
{
|
{
|
||||||
|
|
@ -658,7 +666,9 @@ bool PathFinder::getSteerTarget(const float* startPos, const float* endPos,
|
||||||
// Stop at Off-Mesh link or when point is further than slop away.
|
// Stop at Off-Mesh link or when point is further than slop away.
|
||||||
if ((steerPathFlags[ns] & DT_STRAIGHTPATH_OFFMESH_CONNECTION) ||
|
if ((steerPathFlags[ns] & DT_STRAIGHTPATH_OFFMESH_CONNECTION) ||
|
||||||
!inRangeYZX(&steerPath[ns * VERTEX_SIZE], startPos, minTargetDist, 1000.0f))
|
!inRangeYZX(&steerPath[ns * VERTEX_SIZE], startPos, minTargetDist, 1000.0f))
|
||||||
{ break; }
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
++ns;
|
++ns;
|
||||||
}
|
}
|
||||||
// Failed to find good point to steer to.
|
// Failed to find good point to steer to.
|
||||||
|
|
|
||||||
|
|
@ -61,12 +61,18 @@ void RandomMovementGenerator<Creature>::_setRandomLocation(Creature& creature)
|
||||||
init.SetWalk(true);
|
init.SetWalk(true);
|
||||||
init.Launch();
|
init.Launch();
|
||||||
if (roll_chance_i(MOVEMENT_RANDOM_MMGEN_CHANCE_NO_BREAK))
|
if (roll_chance_i(MOVEMENT_RANDOM_MMGEN_CHANCE_NO_BREAK))
|
||||||
|
{
|
||||||
i_nextMoveTime.Reset(50);
|
i_nextMoveTime.Reset(50);
|
||||||
else
|
|
||||||
i_nextMoveTime.Reset(urand(3000, 10000)); // Keep a short wait time
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
i_nextMoveTime.Reset(urand(3000, 10000)); // Keep a short wait time
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
i_nextMoveTime.Reset(50); // Retry later
|
i_nextMoveTime.Reset(50); // Retry later
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,10 +43,14 @@ void WaypointMovementGenerator<Creature>::LoadPath(Creature& creature, int32 pat
|
||||||
DETAIL_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "LoadPath: loading waypoint path for %s", creature.GetGuidStr().c_str());
|
DETAIL_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "LoadPath: loading waypoint path for %s", creature.GetGuidStr().c_str());
|
||||||
|
|
||||||
if (!overwriteEntry)
|
if (!overwriteEntry)
|
||||||
|
{
|
||||||
overwriteEntry = creature.GetEntry();
|
overwriteEntry = creature.GetEntry();
|
||||||
|
}
|
||||||
|
|
||||||
if (wpOrigin == PATH_NO_PATH && pathId == 0)
|
if (wpOrigin == PATH_NO_PATH && pathId == 0)
|
||||||
|
{
|
||||||
i_path = sWaypointMgr.GetDefaultPath(overwriteEntry, creature.GetGUIDLow(), &m_PathOrigin);
|
i_path = sWaypointMgr.GetDefaultPath(overwriteEntry, creature.GetGUIDLow(), &m_PathOrigin);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_PathOrigin = wpOrigin == PATH_NO_PATH ? PATH_FROM_ENTRY : wpOrigin;
|
m_PathOrigin = wpOrigin == PATH_NO_PATH ? PATH_FROM_ENTRY : wpOrigin;
|
||||||
|
|
@ -58,9 +62,13 @@ void WaypointMovementGenerator<Creature>::LoadPath(Creature& creature, int32 pat
|
||||||
if (!i_path)
|
if (!i_path)
|
||||||
{
|
{
|
||||||
if (m_PathOrigin == PATH_FROM_EXTERNAL)
|
if (m_PathOrigin == PATH_FROM_EXTERNAL)
|
||||||
|
{
|
||||||
sLog.outErrorScriptLib("WaypointMovementGenerator::LoadPath: %s doesn't have waypoint path %i", creature.GetGuidStr().c_str(), pathId);
|
sLog.outErrorScriptLib("WaypointMovementGenerator::LoadPath: %s doesn't have waypoint path %i", creature.GetGuidStr().c_str(), pathId);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
sLog.outErrorDb("WaypointMovementGenerator::LoadPath: %s doesn't have waypoint path %i", creature.GetGuidStr().c_str(), pathId);
|
sLog.outErrorDb("WaypointMovementGenerator::LoadPath: %s doesn't have waypoint path %i", creature.GetGuidStr().c_str(), pathId);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -186,7 +194,9 @@ void WaypointMovementGenerator<Creature>::OnArrived(Creature& creature)
|
||||||
{
|
{
|
||||||
uint32 type = WAYPOINT_MOTION_TYPE;
|
uint32 type = WAYPOINT_MOTION_TYPE;
|
||||||
if (m_PathOrigin == PATH_FROM_EXTERNAL && m_pathId > 0)
|
if (m_PathOrigin == PATH_FROM_EXTERNAL && m_pathId > 0)
|
||||||
|
{
|
||||||
type = EXTERNAL_WAYPOINT_MOVE + m_pathId;
|
type = EXTERNAL_WAYPOINT_MOVE + m_pathId;
|
||||||
|
}
|
||||||
creature.AI()->MovementInform(type, i_currentNode);
|
creature.AI()->MovementInform(type, i_currentNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -237,9 +247,13 @@ void WaypointMovementGenerator<Creature>::StartMove(Creature& creature)
|
||||||
if (creature.AI() && m_PathOrigin == PATH_FROM_EXTERNAL && m_pathId > 0)
|
if (creature.AI() && m_PathOrigin == PATH_FROM_EXTERNAL && m_pathId > 0)
|
||||||
{
|
{
|
||||||
if (!reachedLast)
|
if (!reachedLast)
|
||||||
|
{
|
||||||
creature.AI()->MovementInform(EXTERNAL_WAYPOINT_MOVE_START + m_pathId, currPoint->first);
|
creature.AI()->MovementInform(EXTERNAL_WAYPOINT_MOVE_START + m_pathId, currPoint->first);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
creature.AI()->MovementInform(EXTERNAL_WAYPOINT_FINISHED_LAST + m_pathId, currPoint->first);
|
creature.AI()->MovementInform(EXTERNAL_WAYPOINT_FINISHED_LAST + m_pathId, currPoint->first);
|
||||||
|
}
|
||||||
|
|
||||||
if (creature.IsDead() || !creature.IsInWorld()) // Might have happened with above calls
|
if (creature.IsDead() || !creature.IsInWorld()) // Might have happened with above calls
|
||||||
{
|
{
|
||||||
|
|
@ -345,7 +359,9 @@ bool WaypointMovementGenerator<Creature>::GetResetPosition(Creature&, float& x,
|
||||||
z = curWP->z;
|
z = curWP->z;
|
||||||
|
|
||||||
if (curWP->orientation != 100)
|
if (curWP->orientation != 100)
|
||||||
|
{
|
||||||
o = curWP->orientation;
|
o = curWP->orientation;
|
||||||
|
}
|
||||||
else // Calculate the resulting angle based on positions between previous and current waypoint
|
else // Calculate the resulting angle based on positions between previous and current waypoint
|
||||||
{
|
{
|
||||||
WaypointNode const* prevWP;
|
WaypointNode const* prevWP;
|
||||||
|
|
@ -355,7 +371,9 @@ bool WaypointMovementGenerator<Creature>::GetResetPosition(Creature&, float& x,
|
||||||
prevWP = &(lastPoint->second);
|
prevWP = &(lastPoint->second);
|
||||||
}
|
}
|
||||||
else // Take the last waypoint (crbegin()) as previous
|
else // Take the last waypoint (crbegin()) as previous
|
||||||
|
{
|
||||||
prevWP = &(i_path->rbegin()->second);
|
prevWP = &(i_path->rbegin()->second);
|
||||||
|
}
|
||||||
|
|
||||||
float dx = x - prevWP->x;
|
float dx = x - prevWP->x;
|
||||||
float dy = y - prevWP->y;
|
float dy = y - prevWP->y;
|
||||||
|
|
|
||||||
|
|
@ -32,11 +32,17 @@
|
||||||
void ArenaTeamMember::ModifyPersonalRating(Player* plr, int32 mod, uint32 slot)
|
void ArenaTeamMember::ModifyPersonalRating(Player* plr, int32 mod, uint32 slot)
|
||||||
{
|
{
|
||||||
if (int32(personal_rating) + mod < 0)
|
if (int32(personal_rating) + mod < 0)
|
||||||
|
{
|
||||||
personal_rating = 0;
|
personal_rating = 0;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
personal_rating += mod;
|
personal_rating += mod;
|
||||||
|
}
|
||||||
if (plr)
|
if (plr)
|
||||||
|
{
|
||||||
plr->SetArenaTeamInfoField(slot, ARENA_TEAM_PERSONAL_RATING, personal_rating);
|
plr->SetArenaTeamInfoField(slot, ARENA_TEAM_PERSONAL_RATING, personal_rating);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ArenaTeam::ArenaTeam()
|
ArenaTeam::ArenaTeam()
|
||||||
|
|
@ -56,12 +62,18 @@ ArenaTeam::ArenaTeam()
|
||||||
if (conf_value < 0) // -1 = select by season id
|
if (conf_value < 0) // -1 = select by season id
|
||||||
{
|
{
|
||||||
if (sWorld.getConfig(CONFIG_UINT32_ARENA_SEASON_ID) >= 6)
|
if (sWorld.getConfig(CONFIG_UINT32_ARENA_SEASON_ID) >= 6)
|
||||||
|
{
|
||||||
m_stats.rating = 0;
|
m_stats.rating = 0;
|
||||||
else
|
|
||||||
m_stats.rating = 1500;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
m_stats.rating = 1500;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
m_stats.rating = uint32(conf_value);
|
m_stats.rating = uint32(conf_value);
|
||||||
|
}
|
||||||
|
|
||||||
m_stats.wins_week = 0;
|
m_stats.wins_week = 0;
|
||||||
m_stats.wins_season = 0;
|
m_stats.wins_season = 0;
|
||||||
|
|
@ -171,17 +183,23 @@ bool ArenaTeam::AddMember(ObjectGuid playerGuid)
|
||||||
if (sWorld.getConfig(CONFIG_UINT32_ARENA_SEASON_ID) >= 6)
|
if (sWorld.getConfig(CONFIG_UINT32_ARENA_SEASON_ID) >= 6)
|
||||||
{
|
{
|
||||||
if (m_stats.rating < 1000)
|
if (m_stats.rating < 1000)
|
||||||
|
{
|
||||||
newmember.personal_rating = 0;
|
newmember.personal_rating = 0;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
newmember.personal_rating = 1000;
|
newmember.personal_rating = 1000;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newmember.personal_rating = 1500;
|
newmember.personal_rating = 1500;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
newmember.personal_rating = uint32(conf_value);
|
newmember.personal_rating = uint32(conf_value);
|
||||||
|
}
|
||||||
|
|
||||||
m_members.push_back(newmember);
|
m_members.push_back(newmember);
|
||||||
|
|
||||||
|
|
@ -195,8 +213,10 @@ bool ArenaTeam::AddMember(ObjectGuid playerGuid)
|
||||||
|
|
||||||
// hide promote/remove buttons
|
// hide promote/remove buttons
|
||||||
if (m_CaptainGuid != playerGuid)
|
if (m_CaptainGuid != playerGuid)
|
||||||
|
{
|
||||||
pl->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1);
|
pl->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -249,7 +269,9 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult* arenaTeamMembersResult)
|
||||||
Field* fields = arenaTeamMembersResult->Fetch();
|
Field* fields = arenaTeamMembersResult->Fetch();
|
||||||
// prevent crash if db records are broken, when all members in result are already processed and current team hasn't got any members
|
// prevent crash if db records are broken, when all members in result are already processed and current team hasn't got any members
|
||||||
if (!fields)
|
if (!fields)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
uint32 arenaTeamId = fields[0].GetUInt32();
|
uint32 arenaTeamId = fields[0].GetUInt32();
|
||||||
if (arenaTeamId < m_TeamId)
|
if (arenaTeamId < m_TeamId)
|
||||||
{
|
{
|
||||||
|
|
@ -288,7 +310,9 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult* arenaTeamMembersResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newmember.guid == GetCaptainGuid())
|
if (newmember.guid == GetCaptainGuid())
|
||||||
|
{
|
||||||
captainPresentInTeam = true;
|
captainPresentInTeam = true;
|
||||||
|
}
|
||||||
|
|
||||||
m_members.push_back(newmember);
|
m_members.push_back(newmember);
|
||||||
}
|
}
|
||||||
|
|
@ -309,7 +333,9 @@ void ArenaTeam::SetCaptain(ObjectGuid guid)
|
||||||
// disable remove/promote buttons
|
// disable remove/promote buttons
|
||||||
Player* oldcaptain = sObjectMgr.GetPlayer(GetCaptainGuid());
|
Player* oldcaptain = sObjectMgr.GetPlayer(GetCaptainGuid());
|
||||||
if (oldcaptain)
|
if (oldcaptain)
|
||||||
|
{
|
||||||
oldcaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1);
|
oldcaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1);
|
||||||
|
}
|
||||||
|
|
||||||
// set new captain
|
// set new captain
|
||||||
m_CaptainGuid = guid;
|
m_CaptainGuid = guid;
|
||||||
|
|
@ -319,7 +345,9 @@ void ArenaTeam::SetCaptain(ObjectGuid guid)
|
||||||
|
|
||||||
// enable remove/promote buttons
|
// enable remove/promote buttons
|
||||||
if (Player* newcaptain = sObjectMgr.GetPlayer(guid))
|
if (Player* newcaptain = sObjectMgr.GetPlayer(guid))
|
||||||
|
{
|
||||||
newcaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0);
|
newcaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArenaTeam::DelMember(ObjectGuid guid)
|
void ArenaTeam::DelMember(ObjectGuid guid)
|
||||||
|
|
@ -441,8 +469,10 @@ void ArenaTeam::NotifyStatsChanged()
|
||||||
{
|
{
|
||||||
Player* plr = sObjectMgr.GetPlayer(itr->guid);
|
Player* plr = sObjectMgr.GetPlayer(itr->guid);
|
||||||
if (plr)
|
if (plr)
|
||||||
|
{
|
||||||
Stats(plr->GetSession());
|
Stats(plr->GetSession());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArenaTeam::InspectStats(WorldSession* session, ObjectGuid guid)
|
void ArenaTeam::InspectStats(WorldSession* session, ObjectGuid guid)
|
||||||
|
|
@ -516,8 +546,10 @@ void ArenaTeam::BroadcastPacket(WorldPacket* packet)
|
||||||
{
|
{
|
||||||
Player* player = sObjectMgr.GetPlayer(itr->guid);
|
Player* player = sObjectMgr.GetPlayer(itr->guid);
|
||||||
if (player)
|
if (player)
|
||||||
|
{
|
||||||
player->GetSession()->SendPacket(packet);
|
player->GetSession()->SendPacket(packet);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, ObjectGuid guid, char const* str1 /*=NULL*/, char const* str2 /*=NULL*/, char const* str3 /*=NULL*/)
|
void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, ObjectGuid guid, char const* str1 /*=NULL*/, char const* str2 /*=NULL*/, char const* str3 /*=NULL*/)
|
||||||
|
|
@ -540,10 +572,14 @@ void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, ObjectGuid guid, char cons
|
||||||
data << str2;
|
data << str2;
|
||||||
}
|
}
|
||||||
else if (str1)
|
else if (str1)
|
||||||
|
{
|
||||||
data << str1;
|
data << str1;
|
||||||
|
}
|
||||||
|
|
||||||
if (guid)
|
if (guid)
|
||||||
|
{
|
||||||
data << ObjectGuid(guid);
|
data << ObjectGuid(guid);
|
||||||
|
}
|
||||||
|
|
||||||
BroadcastPacket(&data);
|
BroadcastPacket(&data);
|
||||||
|
|
||||||
|
|
@ -589,18 +625,26 @@ uint32 ArenaTeam::GetPoints(uint32 MemberRating)
|
||||||
{
|
{
|
||||||
// As of Season 6 and later, all teams below 1500 rating will earn points as if they were a 1500 rated team
|
// As of Season 6 and later, all teams below 1500 rating will earn points as if they were a 1500 rated team
|
||||||
if (sWorld.getConfig(CONFIG_UINT32_ARENA_SEASON_ID) >= 6)
|
if (sWorld.getConfig(CONFIG_UINT32_ARENA_SEASON_ID) >= 6)
|
||||||
|
{
|
||||||
rating = 1500;
|
rating = 1500;
|
||||||
|
}
|
||||||
|
|
||||||
points = (float)rating * 0.22f + 14.0f;
|
points = (float)rating * 0.22f + 14.0f;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
points = 1511.26f / (1.0f + 1639.28f * exp(-0.00412f * (float)rating));
|
points = 1511.26f / (1.0f + 1639.28f * exp(-0.00412f * (float)rating));
|
||||||
|
}
|
||||||
|
|
||||||
// type penalties for <5v5 teams
|
// type penalties for <5v5 teams
|
||||||
if (m_Type == ARENA_TYPE_2v2)
|
if (m_Type == ARENA_TYPE_2v2)
|
||||||
|
{
|
||||||
points *= 0.76f;
|
points *= 0.76f;
|
||||||
|
}
|
||||||
else if (m_Type == ARENA_TYPE_3v3)
|
else if (m_Type == ARENA_TYPE_3v3)
|
||||||
|
{
|
||||||
points *= 0.88f;
|
points *= 0.88f;
|
||||||
|
}
|
||||||
|
|
||||||
return (uint32) points;
|
return (uint32) points;
|
||||||
}
|
}
|
||||||
|
|
@ -623,16 +667,22 @@ float ArenaTeam::GetChanceAgainst(uint32 own_rating, uint32 enemy_rating)
|
||||||
|
|
||||||
if (sWorld.getConfig(CONFIG_UINT32_ARENA_SEASON_ID) >= 6)
|
if (sWorld.getConfig(CONFIG_UINT32_ARENA_SEASON_ID) >= 6)
|
||||||
if (enemy_rating < 1000)
|
if (enemy_rating < 1000)
|
||||||
|
{
|
||||||
enemy_rating = 1000;
|
enemy_rating = 1000;
|
||||||
|
}
|
||||||
return 1.0f / (1.0f + exp(log(10.0f) * (float)((float)enemy_rating - (float)own_rating) / 400.0f));
|
return 1.0f / (1.0f + exp(log(10.0f) * (float)((float)enemy_rating - (float)own_rating) / 400.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArenaTeam::FinishGame(int32 mod)
|
void ArenaTeam::FinishGame(int32 mod)
|
||||||
{
|
{
|
||||||
if (int32(m_stats.rating) + mod < 0)
|
if (int32(m_stats.rating) + mod < 0)
|
||||||
|
{
|
||||||
m_stats.rating = 0;
|
m_stats.rating = 0;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_stats.rating += mod;
|
m_stats.rating += mod;
|
||||||
|
}
|
||||||
|
|
||||||
m_stats.games_week += 1;
|
m_stats.games_week += 1;
|
||||||
m_stats.games_season += 1;
|
m_stats.games_season += 1;
|
||||||
|
|
@ -642,8 +692,10 @@ void ArenaTeam::FinishGame(int32 mod)
|
||||||
for (; i != sObjectMgr.GetArenaTeamMapEnd(); ++i)
|
for (; i != sObjectMgr.GetArenaTeamMapEnd(); ++i)
|
||||||
{
|
{
|
||||||
if (i->second->GetType() == this->m_Type && i->second->GetStats().rating > m_stats.rating)
|
if (i->second->GetType() == this->m_Type && i->second->GetStats().rating > m_stats.rating)
|
||||||
|
{
|
||||||
++m_stats.rank;
|
++m_stats.rank;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 ArenaTeam::WonAgainst(uint32 againstRating)
|
int32 ArenaTeam::WonAgainst(uint32 againstRating)
|
||||||
|
|
@ -715,9 +767,13 @@ void ArenaTeam::OfflineMemberLost(ObjectGuid guid, uint32 againstRating)
|
||||||
// calculate the rating modification (ELO system with k=32 or k=48 if rating<1000)
|
// calculate the rating modification (ELO system with k=32 or k=48 if rating<1000)
|
||||||
int32 mod = (int32)ceil(K * (0.0f - chance));
|
int32 mod = (int32)ceil(K * (0.0f - chance));
|
||||||
if (int32(itr->personal_rating) + mod < 0)
|
if (int32(itr->personal_rating) + mod < 0)
|
||||||
|
{
|
||||||
itr->personal_rating = 0;
|
itr->personal_rating = 0;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
itr->personal_rating += mod;
|
itr->personal_rating += mod;
|
||||||
|
}
|
||||||
// update personal played stats
|
// update personal played stats
|
||||||
itr->games_week += 1;
|
itr->games_week += 1;
|
||||||
itr->games_season += 1;
|
itr->games_season += 1;
|
||||||
|
|
@ -768,7 +824,9 @@ void ArenaTeam::UpdateArenaPointsHelper(std::map<uint32, uint32>& PlayerPoints)
|
||||||
// the player participated in enough games, update his points
|
// the player participated in enough games, update his points
|
||||||
uint32 points_to_add = 0;
|
uint32 points_to_add = 0;
|
||||||
if (itr->games_week >= min_plays)
|
if (itr->games_week >= min_plays)
|
||||||
|
{
|
||||||
points_to_add = GetPoints(itr->personal_rating);
|
points_to_add = GetPoints(itr->personal_rating);
|
||||||
|
}
|
||||||
// OBSOLETE : CharacterDatabase.PExecute("UPDATE arena_team_member SET points_to_add = '%u' WHERE arenateamid = '%u' AND guid = '%u'", points_to_add, m_TeamId, itr->guid);
|
// OBSOLETE : CharacterDatabase.PExecute("UPDATE arena_team_member SET points_to_add = '%u' WHERE arenateamid = '%u' AND guid = '%u'", points_to_add, m_TeamId, itr->guid);
|
||||||
|
|
||||||
std::map<uint32, uint32>::iterator plr_itr = PlayerPoints.find(itr->guid.GetCounter());
|
std::map<uint32, uint32>::iterator plr_itr = PlayerPoints.find(itr->guid.GetCounter());
|
||||||
|
|
@ -776,11 +834,15 @@ void ArenaTeam::UpdateArenaPointsHelper(std::map<uint32, uint32>& PlayerPoints)
|
||||||
{
|
{
|
||||||
// check if there is already more points
|
// check if there is already more points
|
||||||
if (plr_itr->second < points_to_add)
|
if (plr_itr->second < points_to_add)
|
||||||
|
{
|
||||||
PlayerPoints[itr->guid.GetCounter()] = points_to_add;
|
PlayerPoints[itr->guid.GetCounter()] = points_to_add;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
PlayerPoints[itr->guid.GetCounter()] = points_to_add;
|
PlayerPoints[itr->guid.GetCounter()] = points_to_add;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArenaTeam::SaveToDB()
|
void ArenaTeam::SaveToDB()
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,9 @@ class ArenaTeam
|
||||||
{
|
{
|
||||||
for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
|
for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
|
||||||
if (itr->guid == guid)
|
if (itr->guid == guid)
|
||||||
|
{
|
||||||
return &(*itr);
|
return &(*itr);
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -174,7 +176,9 @@ class ArenaTeam
|
||||||
{
|
{
|
||||||
for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
|
for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
|
||||||
if (itr->name == name)
|
if (itr->name == name)
|
||||||
|
{
|
||||||
return &(*itr);
|
return &(*itr);
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,9 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction)
|
||||||
{
|
{
|
||||||
std::string owner_name;
|
std::string owner_name;
|
||||||
if (auction_owner)
|
if (auction_owner)
|
||||||
|
{
|
||||||
owner_name = auction_owner->GetName();
|
owner_name = auction_owner->GetName();
|
||||||
|
}
|
||||||
else if (ownerGuid && !sObjectMgr.GetPlayerNameByGUID(ownerGuid, owner_name))
|
else if (ownerGuid && !sObjectMgr.GetPlayerNameByGUID(ownerGuid, owner_name))
|
||||||
{
|
{
|
||||||
owner_name = sObjectMgr.GetMangosStringForDBCLocale(LANG_UNKNOWN);
|
owner_name = sObjectMgr.GetMangosStringForDBCLocale(LANG_UNKNOWN);
|
||||||
|
|
@ -159,7 +161,9 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auction_owner)
|
if (auction_owner)
|
||||||
|
{
|
||||||
auction_owner->GetSession()->SendAuctionOwnerNotification(auction);
|
auction_owner->GetSession()->SendAuctionOwnerNotification(auction);
|
||||||
|
}
|
||||||
|
|
||||||
// receiver exist
|
// receiver exist
|
||||||
if (bidder || bidder_accId)
|
if (bidder || bidder_accId)
|
||||||
|
|
@ -272,7 +276,9 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction)
|
||||||
subject << auction->itemTemplate << ":" << auction->itemRandomPropertyId << ":" << AUCTION_EXPIRED << ":" << auction->Id << ":" << auction->itemCount;
|
subject << auction->itemTemplate << ":" << auction->itemRandomPropertyId << ":" << AUCTION_EXPIRED << ":" << auction->Id << ":" << auction->itemCount;
|
||||||
|
|
||||||
if (owner)
|
if (owner)
|
||||||
|
{
|
||||||
owner->GetSession()->SendAuctionOwnerNotification(auction);
|
owner->GetSession()->SendAuctionOwnerNotification(auction);
|
||||||
|
}
|
||||||
|
|
||||||
RemoveAItem(auction->itemGuidLow); // we have to remove the item, before we delete it !!
|
RemoveAItem(auction->itemGuidLow); // we have to remove the item, before we delete it !!
|
||||||
auction->itemGuidLow = 0;
|
auction->itemGuidLow = 0;
|
||||||
|
|
@ -408,7 +414,9 @@ void AuctionHouseMgr::LoadAuctions()
|
||||||
{
|
{
|
||||||
std::string plName;
|
std::string plName;
|
||||||
if (!sObjectMgr.GetPlayerNameByGUID(ObjectGuid(HIGHGUID_PLAYER, auction->owner), plName))
|
if (!sObjectMgr.GetPlayerNameByGUID(ObjectGuid(HIGHGUID_PLAYER, auction->owner), plName))
|
||||||
|
{
|
||||||
plName = sObjectMgr.GetMangosStringForDBCLocale(LANG_UNKNOWN);
|
plName = sObjectMgr.GetMangosStringForDBCLocale(LANG_UNKNOWN);
|
||||||
|
}
|
||||||
|
|
||||||
Utf8toWStr(plName, plWName);
|
Utf8toWStr(plName, plWName);
|
||||||
}
|
}
|
||||||
|
|
@ -426,7 +434,9 @@ void AuctionHouseMgr::LoadAuctions()
|
||||||
auction->auctionHouseEntry = NULL; // init later
|
auction->auctionHouseEntry = NULL; // init later
|
||||||
|
|
||||||
if (auction->moneyDeliveryTime)
|
if (auction->moneyDeliveryTime)
|
||||||
|
{
|
||||||
auction->itemGuidLow = 0; // must be 0 if auction delivery pending
|
auction->itemGuidLow = 0; // must be 0 if auction delivery pending
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// check if sold item exists for guid
|
// check if sold item exists for guid
|
||||||
|
|
@ -567,13 +577,21 @@ AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(Unit* unit)
|
||||||
{
|
{
|
||||||
FactionTemplateEntry const* u_entry = sFactionTemplateStore.LookupEntry(factionTemplateId);
|
FactionTemplateEntry const* u_entry = sFactionTemplateStore.LookupEntry(factionTemplateId);
|
||||||
if (!u_entry)
|
if (!u_entry)
|
||||||
{ houseid = 7; } // goblin auction house
|
{
|
||||||
|
houseid = 7; // goblin auction house
|
||||||
|
}
|
||||||
else if (u_entry->ourMask & FACTION_MASK_ALLIANCE)
|
else if (u_entry->ourMask & FACTION_MASK_ALLIANCE)
|
||||||
{ houseid = 1; } // human auction house
|
{
|
||||||
|
houseid = 1; // human auction house
|
||||||
|
}
|
||||||
else if (u_entry->ourMask & FACTION_MASK_HORDE)
|
else if (u_entry->ourMask & FACTION_MASK_HORDE)
|
||||||
{ houseid = 6; } // orc auction house
|
{
|
||||||
|
houseid = 6; // orc auction house
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ houseid = 7; } // goblin auction house
|
{
|
||||||
|
houseid = 7; // goblin auction house
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -625,7 +643,9 @@ void AuctionHouseObject::Update()
|
||||||
{
|
{
|
||||||
///- perform the transaction if there was bidder
|
///- perform the transaction if there was bidder
|
||||||
if (itr->second->bid)
|
if (itr->second->bid)
|
||||||
|
{
|
||||||
itr->second->AuctionBidWinning();
|
itr->second->AuctionBidWinning();
|
||||||
|
}
|
||||||
///- cancel the auction if there was no bidder and clear the auction
|
///- cancel the auction if there was no bidder and clear the auction
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -649,7 +669,9 @@ void AuctionHouseObject::BuildListBidderItems(WorldPacket& data, Player* player,
|
||||||
{
|
{
|
||||||
AuctionEntry* Aentry = itr->second;
|
AuctionEntry* Aentry = itr->second;
|
||||||
if (Aentry->moneyDeliveryTime) // skip pending sell auctions
|
if (Aentry->moneyDeliveryTime) // skip pending sell auctions
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
if (Aentry->bidder == player->GetGUIDLow())
|
if (Aentry->bidder == player->GetGUIDLow())
|
||||||
{
|
{
|
||||||
if (itr->second->BuildAuctionInfo(data))
|
if (itr->second->BuildAuctionInfo(data))
|
||||||
|
|
@ -667,7 +689,9 @@ void AuctionHouseObject::BuildListOwnerItems(WorldPacket& data, Player* player,
|
||||||
{
|
{
|
||||||
AuctionEntry* Aentry = itr->second;
|
AuctionEntry* Aentry = itr->second;
|
||||||
if (Aentry->moneyDeliveryTime) // skip pending sell auctions
|
if (Aentry->moneyDeliveryTime) // skip pending sell auctions
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
if (Aentry->owner == player->GetGUIDLow())
|
if (Aentry->owner == player->GetGUIDLow())
|
||||||
{
|
{
|
||||||
if (Aentry->BuildAuctionInfo(data))
|
if (Aentry->BuildAuctionInfo(data))
|
||||||
|
|
@ -879,7 +903,9 @@ bool AuctionSorter::operator()(const AuctionEntry* auc1, const AuctionEntry* auc
|
||||||
int res = auc1->CompareAuctionEntry(m_sort[i] & ~AUCTION_SORT_REVERSED, auc2, m_viewPlayer);
|
int res = auc1->CompareAuctionEntry(m_sort[i] & ~AUCTION_SORT_REVERSED, auc2, m_viewPlayer);
|
||||||
// "equal" by used column
|
// "equal" by used column
|
||||||
if (res == 0)
|
if (res == 0)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
// less/greater and normal/reversed ordered
|
// less/greater and normal/reversed ordered
|
||||||
return (res < 0) == ((m_sort[i] & AUCTION_SORT_REVERSED) == 0);
|
return (res < 0) == ((m_sort[i] & AUCTION_SORT_REVERSED) == 0);
|
||||||
}
|
}
|
||||||
|
|
@ -896,7 +922,9 @@ void WorldSession::BuildListAuctionItems(std::vector<AuctionEntry*> const& aucti
|
||||||
{
|
{
|
||||||
AuctionEntry* Aentry = *itr;
|
AuctionEntry* Aentry = *itr;
|
||||||
if (Aentry->moneyDeliveryTime)
|
if (Aentry->moneyDeliveryTime)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
Item* item = sAuctionMgr.GetAItem(Aentry->itemGuidLow);
|
Item* item = sAuctionMgr.GetAItem(Aentry->itemGuidLow);
|
||||||
if (!item)
|
if (!item)
|
||||||
{
|
{
|
||||||
|
|
@ -940,7 +968,9 @@ void WorldSession::BuildListAuctionItems(std::vector<AuctionEntry*> const& aucti
|
||||||
if (usable != 0x00)
|
if (usable != 0x00)
|
||||||
{
|
{
|
||||||
if (_player->CanUseItem(item) != EQUIP_ERR_OK)
|
if (_player->CanUseItem(item) != EQUIP_ERR_OK)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (proto->Class == ITEM_CLASS_RECIPE)
|
if (proto->Class == ITEM_CLASS_RECIPE)
|
||||||
{
|
{
|
||||||
|
|
@ -948,13 +978,17 @@ void WorldSession::BuildListAuctionItems(std::vector<AuctionEntry*> const& aucti
|
||||||
{
|
{
|
||||||
SpellEffectEntry const* spellEff = spell->GetSpellEffect(EFFECT_INDEX_0);
|
SpellEffectEntry const* spellEff = spell->GetSpellEffect(EFFECT_INDEX_0);
|
||||||
if (!spellEff)
|
if (!spellEff)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (_player->HasSpell(spellEff->EffectTriggerSpell))
|
if (_player->HasSpell(spellEff->EffectTriggerSpell))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string name = proto->Name1;
|
std::string name = proto->Name1;
|
||||||
sObjectMgr.GetItemLocaleStrings(proto->ItemId, loc_idx, &name);
|
sObjectMgr.GetItemLocaleStrings(proto->ItemId, loc_idx, &name);
|
||||||
|
|
@ -981,7 +1015,9 @@ void AuctionHouseObject::BuildListPendingSales(WorldPacket& data, Player* player
|
||||||
{
|
{
|
||||||
AuctionEntry* Aentry = itr->second;
|
AuctionEntry* Aentry = itr->second;
|
||||||
if (!Aentry->moneyDeliveryTime) // skip not pending auctions
|
if (!Aentry->moneyDeliveryTime) // skip not pending auctions
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
if (Aentry->owner == player->GetGUIDLow())
|
if (Aentry->owner == player->GetGUIDLow())
|
||||||
{
|
{
|
||||||
std::ostringstream str1;
|
std::ostringstream str1;
|
||||||
|
|
@ -1016,7 +1052,9 @@ AuctionEntry* AuctionHouseObject::AddAuction(AuctionHouseEntry const* auctionHou
|
||||||
AH->owner = pl ? pl->GetGUIDLow() : 0;
|
AH->owner = pl ? pl->GetGUIDLow() : 0;
|
||||||
|
|
||||||
if (pl)
|
if (pl)
|
||||||
|
{
|
||||||
Utf8toWStr(pl->GetName(), AH->ownerName);
|
Utf8toWStr(pl->GetName(), AH->ownerName);
|
||||||
|
}
|
||||||
|
|
||||||
AH->startbid = bid;
|
AH->startbid = bid;
|
||||||
AH->bidder = 0;
|
AH->bidder = 0;
|
||||||
|
|
@ -1142,7 +1180,9 @@ bool AuctionEntry::UpdateBid(uint64 newbid, Player* newbidder /*=NULL*/)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (newbidder)
|
if (newbidder)
|
||||||
|
{
|
||||||
newbidder->ModifyMoney(-int64(newbid));
|
newbidder->ModifyMoney(-int64(newbid));
|
||||||
|
}
|
||||||
|
|
||||||
if (bidder) // return money to old bidder if present
|
if (bidder) // return money to old bidder if present
|
||||||
{
|
{
|
||||||
|
|
@ -1156,7 +1196,9 @@ bool AuctionEntry::UpdateBid(uint64 newbid, Player* newbidder /*=NULL*/)
|
||||||
if ((newbid < buyout) || (buyout == 0)) // bid
|
if ((newbid < buyout) || (buyout == 0)) // bid
|
||||||
{
|
{
|
||||||
if (auction_owner)
|
if (auction_owner)
|
||||||
|
{
|
||||||
auction_owner->GetSession()->SendAuctionOwnerNotification(this);
|
auction_owner->GetSession()->SendAuctionOwnerNotification(this);
|
||||||
|
}
|
||||||
|
|
||||||
// after this update we should save player's money ...
|
// after this update we should save player's money ...
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
|
|
|
||||||
|
|
@ -236,7 +236,9 @@ uint32 Bag::GetItemCount(uint32 item, Item* eItem) const
|
||||||
for (uint32 i = 0; i < GetBagSize(); ++i)
|
for (uint32 i = 0; i < GetBagSize(); ++i)
|
||||||
if (m_bagslot[i])
|
if (m_bagslot[i])
|
||||||
if (m_bagslot[i] != eItem && m_bagslot[i]->GetProto()->Socket[0].Color)
|
if (m_bagslot[i] != eItem && m_bagslot[i]->GetProto()->Socket[0].Color)
|
||||||
|
{
|
||||||
count += m_bagslot[i]->GetGemCountWithID(item);
|
count += m_bagslot[i]->GetGemCountWithID(item);
|
||||||
|
}
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
@ -248,7 +250,9 @@ uint32 Bag::GetItemCountWithLimitCategory(uint32 limitCategory, Item* eItem) con
|
||||||
for (uint32 i = 0; i < GetBagSize(); ++i)
|
for (uint32 i = 0; i < GetBagSize(); ++i)
|
||||||
if (m_bagslot[i])
|
if (m_bagslot[i])
|
||||||
if (m_bagslot[i] != eItem && m_bagslot[i]->GetProto()->ItemLimitCategory == limitCategory)
|
if (m_bagslot[i] != eItem && m_bagslot[i]->GetProto()->ItemLimitCategory == limitCategory)
|
||||||
|
{
|
||||||
count += m_bagslot[i]->GetCount();
|
count += m_bagslot[i]->GetCount();
|
||||||
|
}
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,9 @@ void CalendarEvent::RemoveInviteByItr(CalendarInviteMap::iterator inviteItr)
|
||||||
MANGOS_ASSERT(inviteItr != m_Invitee.end()); // iterator must be valid
|
MANGOS_ASSERT(inviteItr != m_Invitee.end()); // iterator must be valid
|
||||||
|
|
||||||
if (!IsGuildEvent())
|
if (!IsGuildEvent())
|
||||||
|
{
|
||||||
sCalendarMgr.SendCalendarEventInviteRemoveAlert(sObjectMgr.GetPlayer(inviteItr->second->InviteeGuid), this, CALENDAR_STATUS_REMOVED);
|
sCalendarMgr.SendCalendarEventInviteRemoveAlert(sObjectMgr.GetPlayer(inviteItr->second->InviteeGuid), this, CALENDAR_STATUS_REMOVED);
|
||||||
|
}
|
||||||
|
|
||||||
sCalendarMgr.SendCalendarEventInviteRemove(inviteItr->second, Flags);
|
sCalendarMgr.SendCalendarEventInviteRemove(inviteItr->second, Flags);
|
||||||
|
|
||||||
|
|
@ -97,10 +99,14 @@ void CalendarEvent::RemoveInviteByGuid(ObjectGuid const& playerGuid)
|
||||||
while (itr != m_Invitee.end())
|
while (itr != m_Invitee.end())
|
||||||
{
|
{
|
||||||
if (itr->second->InviteeGuid == playerGuid)
|
if (itr->second->InviteeGuid == playerGuid)
|
||||||
|
{
|
||||||
RemoveInviteByItr(itr++);
|
RemoveInviteByItr(itr++);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
++itr;
|
++itr;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove invite by invite ID (some check done before and if requirement not complete
|
// remove invite by invite ID (some check done before and if requirement not complete
|
||||||
|
|
@ -175,7 +181,9 @@ void CalendarEvent::RemoveAllInvite(ObjectGuid const& removerGuid)
|
||||||
while (itr != m_Invitee.end())
|
while (itr != m_Invitee.end())
|
||||||
{
|
{
|
||||||
if (removerGuid != itr->second->InviteeGuid)
|
if (removerGuid != itr->second->InviteeGuid)
|
||||||
|
{
|
||||||
draft.SendMailTo(MailReceiver(itr->second->InviteeGuid), this, MAIL_CHECK_MASK_COPIED);
|
draft.SendMailTo(MailReceiver(itr->second->InviteeGuid), this, MAIL_CHECK_MASK_COPIED);
|
||||||
|
}
|
||||||
RemoveInviteByItr(itr++);
|
RemoveInviteByItr(itr++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -189,7 +197,9 @@ CalendarInvite::CalendarInvite(CalendarEvent* event, uint64 inviteId, ObjectGuid
|
||||||
{
|
{
|
||||||
// only for pre invite case
|
// only for pre invite case
|
||||||
if (!event)
|
if (!event)
|
||||||
|
{
|
||||||
InviteId = 0;
|
InviteId = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
@ -202,9 +212,13 @@ void CalendarMgr::GetPlayerEventsList(ObjectGuid const& guid, CalendarEventsList
|
||||||
uint32 guildId = 0;
|
uint32 guildId = 0;
|
||||||
Player* player = sObjectMgr.GetPlayer(guid);
|
Player* player = sObjectMgr.GetPlayer(guid);
|
||||||
if (player)
|
if (player)
|
||||||
|
{
|
||||||
guildId = player->GetGuildId();
|
guildId = player->GetGuildId();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
guildId = Player::GetGuildIdFromDB(guid);
|
guildId = Player::GetGuildIdFromDB(guid);
|
||||||
|
}
|
||||||
|
|
||||||
for (CalendarEventStore::iterator itr = m_EventStore.begin(); itr != m_EventStore.end(); ++itr)
|
for (CalendarEventStore::iterator itr = m_EventStore.begin(); itr != m_EventStore.end(); ++itr)
|
||||||
{
|
{
|
||||||
|
|
@ -219,8 +233,10 @@ void CalendarMgr::GetPlayerEventsList(ObjectGuid const& guid, CalendarEventsList
|
||||||
|
|
||||||
// add all event where player is invited
|
// add all event where player is invited
|
||||||
if (event->GetInviteByGuid(guid))
|
if (event->GetInviteByGuid(guid))
|
||||||
|
{
|
||||||
calEventList.push_back(event);
|
calEventList.push_back(event);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// fill all player invites in provided CalendarInvitesList
|
// fill all player invites in provided CalendarInvitesList
|
||||||
|
|
@ -231,7 +247,9 @@ void CalendarMgr::GetPlayerInvitesList(ObjectGuid const& guid, CalendarInvitesLi
|
||||||
CalendarEvent* event = &itr->second;
|
CalendarEvent* event = &itr->second;
|
||||||
|
|
||||||
if (event->IsGuildAnnouncement())
|
if (event->IsGuildAnnouncement())
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
CalendarInviteMap const* cInvMap = event->GetInviteMap();
|
CalendarInviteMap const* cInvMap = event->GetInviteMap();
|
||||||
CalendarInviteMap::const_iterator ci_itr = cInvMap->begin();
|
CalendarInviteMap::const_iterator ci_itr = cInvMap->begin();
|
||||||
|
|
@ -391,10 +409,14 @@ CalendarInvite* CalendarMgr::AddInvite(CalendarEvent* event, ObjectGuid const& s
|
||||||
CalendarInvite* invite = new CalendarInvite(event, GetNewInviteId(), senderGuid, inviteeGuid, statusTime, status, rank, text);
|
CalendarInvite* invite = new CalendarInvite(event, GetNewInviteId(), senderGuid, inviteeGuid, statusTime, status, rank, text);
|
||||||
|
|
||||||
if (!event->IsGuildAnnouncement())
|
if (!event->IsGuildAnnouncement())
|
||||||
|
{
|
||||||
SendCalendarEventInvite(invite);
|
SendCalendarEventInvite(invite);
|
||||||
|
}
|
||||||
|
|
||||||
if (!event->IsGuildEvent() || invite->InviteeGuid == event->CreatorGuid)
|
if (!event->IsGuildEvent() || invite->InviteeGuid == event->CreatorGuid)
|
||||||
|
{
|
||||||
SendCalendarEventInviteAlert(invite);
|
SendCalendarEventInviteAlert(invite);
|
||||||
|
}
|
||||||
|
|
||||||
if (event->IsGuildAnnouncement())
|
if (event->IsGuildAnnouncement())
|
||||||
{
|
{
|
||||||
|
|
@ -457,17 +479,23 @@ uint32 CalendarMgr::GetPlayerNumPending(ObjectGuid const& guid)
|
||||||
{
|
{
|
||||||
// pass all passed events
|
// pass all passed events
|
||||||
if (event->EventTime < currTime)
|
if (event->EventTime < currTime)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// pass all locked events
|
// pass all locked events
|
||||||
if (event->Flags & CALENDAR_FLAG_INVITES_LOCKED)
|
if (event->Flags & CALENDAR_FLAG_INVITES_LOCKED)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// add only invite that require some action
|
// add only invite that require some action
|
||||||
if ((*itr)->Status == CALENDAR_STATUS_INVITED || (*itr)->Status == CALENDAR_STATUS_TENTATIVE || (*itr)->Status == CALENDAR_STATUS_NOT_SIGNED_UP)
|
if ((*itr)->Status == CALENDAR_STATUS_INVITED || (*itr)->Status == CALENDAR_STATUS_TENTATIVE || (*itr)->Status == CALENDAR_STATUS_NOT_SIGNED_UP)
|
||||||
|
{
|
||||||
++pendingNum;
|
++pendingNum;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return pendingNum;
|
return pendingNum;
|
||||||
}
|
}
|
||||||
|
|
@ -492,7 +520,9 @@ void CalendarMgr::CopyEvent(uint64 eventId, time_t newTime, ObjectGuid const& gu
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newEvent->IsGuildAnnouncement())
|
if (newEvent->IsGuildAnnouncement())
|
||||||
|
{
|
||||||
AddInvite(newEvent, guid, guid, CALENDAR_STATUS_CONFIRMED, CALENDAR_RANK_OWNER, "", time(NULL));
|
AddInvite(newEvent, guid, guid, CALENDAR_STATUS_CONFIRMED, CALENDAR_RANK_OWNER, "", time(NULL));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// copy all invitees, set new owner as the one who make the copy, set invitees status to invited
|
// copy all invitees, set new owner as the one who make the copy, set invitees status to invited
|
||||||
|
|
@ -511,7 +541,9 @@ void CalendarMgr::CopyEvent(uint64 eventId, time_t newTime, ObjectGuid const& gu
|
||||||
CalendarModerationRank rank = CALENDAR_RANK_PLAYER;
|
CalendarModerationRank rank = CALENDAR_RANK_PLAYER;
|
||||||
// copy moderator rank
|
// copy moderator rank
|
||||||
if (invite->Rank == CALENDAR_RANK_MODERATOR)
|
if (invite->Rank == CALENDAR_RANK_MODERATOR)
|
||||||
|
{
|
||||||
rank = CALENDAR_RANK_MODERATOR;
|
rank = CALENDAR_RANK_MODERATOR;
|
||||||
|
}
|
||||||
|
|
||||||
AddInvite(newEvent, guid, invite->InviteeGuid, CALENDAR_STATUS_INVITED, rank, "", time(NULL));
|
AddInvite(newEvent, guid, invite->InviteeGuid, CALENDAR_STATUS_INVITED, rank, "", time(NULL));
|
||||||
}
|
}
|
||||||
|
|
@ -641,8 +673,10 @@ void CalendarMgr::LoadCalendarsFromDB()
|
||||||
sLog.outString(">> calendar_invites table is empty, cleared calendar_events table!");
|
sLog.outString(">> calendar_invites table is empty, cleared calendar_events table!");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
sLog.outString(">> calendar_invite table is empty!");
|
sLog.outString(">> calendar_invite table is empty!");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_MaxEventId)
|
if (m_MaxEventId)
|
||||||
|
|
@ -732,7 +766,9 @@ bool CalendarMgr::CanAddInviteTo(ObjectGuid const& guid)
|
||||||
CalendarEvent* event = &itr->second;
|
CalendarEvent* event = &itr->second;
|
||||||
|
|
||||||
if (event->IsGuildAnnouncement())
|
if (event->IsGuildAnnouncement())
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
CalendarInviteMap const* cInvMap = event->GetInviteMap();
|
CalendarInviteMap const* cInvMap = event->GetInviteMap();
|
||||||
CalendarInviteMap::const_iterator ci_itr = cInvMap->begin();
|
CalendarInviteMap::const_iterator ci_itr = cInvMap->begin();
|
||||||
|
|
|
||||||
|
|
@ -94,8 +94,10 @@ bool VendorItemData::RemoveItem(uint32 item_id, uint8 type)
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
@ -339,7 +341,9 @@ bool Creature::InitEntry(uint32 Entry, CreatureData const* data /*=NULL*/, GameE
|
||||||
{
|
{
|
||||||
cinfo = ObjectMgr::GetCreatureTemplate(normalInfo->DifficultyEntry[diff - 1]);
|
cinfo = ObjectMgr::GetCreatureTemplate(normalInfo->DifficultyEntry[diff - 1]);
|
||||||
if (cinfo)
|
if (cinfo)
|
||||||
|
{
|
||||||
break; // template found
|
break; // template found
|
||||||
|
}
|
||||||
|
|
||||||
// check and reported at startup, so just ignore (restore normalInfo)
|
// check and reported at startup, so just ignore (restore normalInfo)
|
||||||
cinfo = normalInfo;
|
cinfo = normalInfo;
|
||||||
|
|
@ -410,8 +414,10 @@ bool Creature::InitEntry(uint32 Entry, CreatureData const* data /*=NULL*/, GameE
|
||||||
LoadEquipment(normalInfo->EquipmentTemplateId); // use default from normal template if diff does not have any
|
LoadEquipment(normalInfo->EquipmentTemplateId); // use default from normal template if diff does not have any
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
LoadEquipment(cinfo->EquipmentTemplateId); // else use from diff template
|
LoadEquipment(cinfo->EquipmentTemplateId); // else use from diff template
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (data && data->equipmentId != -1)
|
else if (data && data->equipmentId != -1)
|
||||||
{
|
{
|
||||||
// override, -1 means no equipment
|
// override, -1 means no equipment
|
||||||
|
|
@ -458,7 +464,9 @@ bool Creature::UpdateEntry(uint32 Entry, Team team, const CreatureData* data /*=
|
||||||
SetHealthPercent(healthPercent);
|
SetHealthPercent(healthPercent);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
SelectLevel();
|
SelectLevel();
|
||||||
|
}
|
||||||
|
|
||||||
if (team == HORDE)
|
if (team == HORDE)
|
||||||
{
|
{
|
||||||
|
|
@ -685,7 +693,9 @@ void Creature::Update(uint32 update_diff, uint32 diff)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_corpseDecayTimer -= update_diff;
|
m_corpseDecayTimer -= update_diff;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_groupLootId) // Loot is stopped already if corpse got removed.
|
if (m_groupLootId) // Loot is stopped already if corpse got removed.
|
||||||
{
|
{
|
||||||
|
|
@ -720,8 +730,10 @@ void Creature::Update(uint32 update_diff, uint32 diff)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_corpseDecayTimer -= update_diff;
|
m_corpseDecayTimer -= update_diff;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Unit::Update(update_diff, diff);
|
Unit::Update(update_diff, diff);
|
||||||
|
|
||||||
|
|
@ -1431,7 +1443,9 @@ void Creature::SelectLevel(uint32 forcedLevel /*= USE_DEFAULT_DATABASE_LEVEL*/)
|
||||||
uint32 const maxlevel = cinfo->MaxLevel;
|
uint32 const maxlevel = cinfo->MaxLevel;
|
||||||
|
|
||||||
if (level == USE_DEFAULT_DATABASE_LEVEL)
|
if (level == USE_DEFAULT_DATABASE_LEVEL)
|
||||||
|
{
|
||||||
level = minlevel == maxlevel ? minlevel : urand(minlevel, maxlevel);
|
level = minlevel == maxlevel ? minlevel : urand(minlevel, maxlevel);
|
||||||
|
}
|
||||||
|
|
||||||
SetLevel(level);
|
SetLevel(level);
|
||||||
|
|
||||||
|
|
@ -1480,7 +1494,9 @@ void Creature::SelectLevel(uint32 forcedLevel /*= USE_DEFAULT_DATABASE_LEVEL*/)
|
||||||
|
|
||||||
health *= _GetHealthMod(rank); // Apply custom config settting
|
health *= _GetHealthMod(rank); // Apply custom config settting
|
||||||
if (health < 1)
|
if (health < 1)
|
||||||
|
{
|
||||||
health = 1;
|
health = 1;
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
// Set values
|
// Set values
|
||||||
|
|
@ -1512,11 +1528,15 @@ void Creature::SelectLevel(uint32 forcedLevel /*= USE_DEFAULT_DATABASE_LEVEL*/)
|
||||||
|
|
||||||
// For non regenerating powers set 0
|
// For non regenerating powers set 0
|
||||||
if ((i == POWER_ENERGY || i == POWER_MANA) && !IsRegeneratingPower())
|
if ((i == POWER_ENERGY || i == POWER_MANA) && !IsRegeneratingPower())
|
||||||
|
{
|
||||||
value = 0;
|
value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Mana requires an extra field to be set
|
// Mana requires an extra field to be set
|
||||||
if (i == POWER_MANA)
|
if (i == POWER_MANA)
|
||||||
|
{
|
||||||
SetCreateMana(value);
|
SetCreateMana(value);
|
||||||
|
}
|
||||||
|
|
||||||
SetMaxPower(Powers(i), maxValue);
|
SetMaxPower(Powers(i), maxValue);
|
||||||
SetPower(Powers(i), value);
|
SetPower(Powers(i), value);
|
||||||
|
|
@ -2160,9 +2180,13 @@ void Creature::SetLootStatus(CreatureLootStatus status)
|
||||||
{
|
{
|
||||||
case CREATURE_LOOT_STATUS_LOOTED:
|
case CREATURE_LOOT_STATUS_LOOTED:
|
||||||
if (m_creatureInfo->SkinningLootId)
|
if (m_creatureInfo->SkinningLootId)
|
||||||
|
{
|
||||||
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
|
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
|
RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CREATURE_LOOT_STATUS_SKINNED:
|
case CREATURE_LOOT_STATUS_SKINNED:
|
||||||
m_corpseDecayTimer = 0; // remove corpse at next update
|
m_corpseDecayTimer = 0; // remove corpse at next update
|
||||||
|
|
@ -2229,7 +2253,9 @@ SpellEntry const* Creature::ReachWithSpellAttack(Unit* pVictim)
|
||||||
{
|
{
|
||||||
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(SpellEffectIndex(j));
|
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(SpellEffectIndex(j));
|
||||||
if(!spellEffect)
|
if(!spellEffect)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
if( (spellEffect->Effect == SPELL_EFFECT_SCHOOL_DAMAGE ) ||
|
if( (spellEffect->Effect == SPELL_EFFECT_SCHOOL_DAMAGE ) ||
|
||||||
(spellEffect->Effect == SPELL_EFFECT_INSTAKILL) ||
|
(spellEffect->Effect == SPELL_EFFECT_INSTAKILL) ||
|
||||||
(spellEffect->Effect == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE) ||
|
(spellEffect->Effect == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE) ||
|
||||||
|
|
@ -2541,7 +2567,9 @@ void Creature::SaveRespawnTime()
|
||||||
GetMap()->GetPersistentState()->SaveCreatureRespawnTime(GetGUIDLow(), m_respawnTime);
|
GetMap()->GetPersistentState()->SaveCreatureRespawnTime(GetGUIDLow(), m_respawnTime);
|
||||||
}
|
}
|
||||||
else if (m_corpseDecayTimer > 0) // dead (corpse)
|
else if (m_corpseDecayTimer > 0) // dead (corpse)
|
||||||
|
{
|
||||||
GetMap()->GetPersistentState()->SaveCreatureRespawnTime(GetGUIDLow(), time(NULL) + m_respawnDelay + m_corpseDecayTimer / IN_MILLISECONDS);
|
GetMap()->GetPersistentState()->SaveCreatureRespawnTime(GetGUIDLow(), time(NULL) + m_respawnDelay + m_corpseDecayTimer / IN_MILLISECONDS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Creature::IsOutOfThreatArea(Unit* pVictim) const
|
bool Creature::IsOutOfThreatArea(Unit* pVictim) const
|
||||||
|
|
@ -2655,7 +2683,9 @@ bool Creature::LoadCreatureAddon(bool reload)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cainfo->splineFlags & SPLINEFLAG_FLYING)
|
if (cainfo->splineFlags & SPLINEFLAG_FLYING)
|
||||||
|
{
|
||||||
SetLevitate(true);
|
SetLevitate(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (cainfo->auras)
|
if (cainfo->auras)
|
||||||
{
|
{
|
||||||
|
|
@ -2998,12 +3028,18 @@ void Creature::AllLootRemovedFromCorpse()
|
||||||
// spawntimesecs=3min: corpse decay after 1min
|
// spawntimesecs=3min: corpse decay after 1min
|
||||||
// spawntimesecs=4hour: corpse decay after 1hour 20min
|
// spawntimesecs=4hour: corpse decay after 1hour 20min
|
||||||
if (sWorld.getConfig(CONFIG_FLOAT_RATE_CORPSE_DECAY_LOOTED) > 0.0f)
|
if (sWorld.getConfig(CONFIG_FLOAT_RATE_CORPSE_DECAY_LOOTED) > 0.0f)
|
||||||
|
{
|
||||||
corpseLootedDelay = (uint32)((m_corpseDelay * IN_MILLISECONDS) * sWorld.getConfig(CONFIG_FLOAT_RATE_CORPSE_DECAY_LOOTED));
|
corpseLootedDelay = (uint32)((m_corpseDelay * IN_MILLISECONDS) * sWorld.getConfig(CONFIG_FLOAT_RATE_CORPSE_DECAY_LOOTED));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
corpseLootedDelay = (m_respawnDelay * IN_MILLISECONDS) / 3;
|
corpseLootedDelay = (m_respawnDelay * IN_MILLISECONDS) / 3;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else // corpse was skinned, corpse will despawn next update
|
else // corpse was skinned, corpse will despawn next update
|
||||||
|
{
|
||||||
corpseLootedDelay = 0;
|
corpseLootedDelay = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// if m_respawnTime is not expired already
|
// if m_respawnTime is not expired already
|
||||||
if (m_respawnTime >= time(NULL))
|
if (m_respawnTime >= time(NULL))
|
||||||
|
|
@ -3017,9 +3053,11 @@ void Creature::AllLootRemovedFromCorpse()
|
||||||
{
|
{
|
||||||
// if m_respawnDelay is relatively short and corpseDecayTimer is larger than corpseLootedDelay
|
// if m_respawnDelay is relatively short and corpseDecayTimer is larger than corpseLootedDelay
|
||||||
if (m_corpseDecayTimer > corpseLootedDelay)
|
if (m_corpseDecayTimer > corpseLootedDelay)
|
||||||
|
{
|
||||||
m_corpseDecayTimer = corpseLootedDelay;
|
m_corpseDecayTimer = corpseLootedDelay;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_corpseDecayTimer = 0;
|
m_corpseDecayTimer = 0;
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,9 @@ struct CreatureInfo
|
||||||
return SKILL_ENGINEERING;
|
return SKILL_ENGINEERING;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return SKILL_SKINNING; } // normal case
|
{
|
||||||
|
return SKILL_SKINNING; // normal case
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsExotic() const
|
bool IsExotic() const
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,9 @@ CanCastResult CreatureAI::DoCastSpellIfCan(Unit* pTarget, uint32 uiSpell, uint32
|
||||||
|
|
||||||
// Creature should always stop before it will cast a non-instant spell
|
// Creature should always stop before it will cast a non-instant spell
|
||||||
if (GetSpellCastTime(pSpell))
|
if (GetSpellCastTime(pSpell))
|
||||||
|
{
|
||||||
pCaster->StopMoving();
|
pCaster->StopMoving();
|
||||||
|
}
|
||||||
|
|
||||||
// Creature should interrupt any current melee spell
|
// Creature should interrupt any current melee spell
|
||||||
pCaster->InterruptSpell(CURRENT_MELEE_SPELL);
|
pCaster->InterruptSpell(CURRENT_MELEE_SPELL);
|
||||||
|
|
@ -206,7 +208,9 @@ void CreatureAI::HandleMovementOnAttackStart(Unit* victim)
|
||||||
{
|
{
|
||||||
MotionMaster* creatureMotion = m_creature->GetMotionMaster();
|
MotionMaster* creatureMotion = m_creature->GetMotionMaster();
|
||||||
if (m_isCombatMovement)
|
if (m_isCombatMovement)
|
||||||
|
{
|
||||||
creatureMotion->MoveChase(victim, m_attackDistance, m_attackAngle);
|
creatureMotion->MoveChase(victim, m_attackDistance, m_attackAngle);
|
||||||
|
}
|
||||||
// TODO - adapt this to only stop OOC-MMGens when MotionMaster rewrite is finished
|
// TODO - adapt this to only stop OOC-MMGens when MotionMaster rewrite is finished
|
||||||
else if (creatureMotion->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE || creatureMotion->GetCurrentMovementGeneratorType() == RANDOM_MOTION_TYPE)
|
else if (creatureMotion->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE || creatureMotion->GetCurrentMovementGeneratorType() == RANDOM_MOTION_TYPE)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -814,9 +814,11 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
{
|
{
|
||||||
SpellRangeEntry const* spellRange = sSpellRangeStore.LookupEntry(spellInfo->GetRangeIndex());
|
SpellRangeEntry const* spellRange = sSpellRangeStore.LookupEntry(spellInfo->GetRangeIndex());
|
||||||
if (spellRange)
|
if (spellRange)
|
||||||
|
{
|
||||||
m_LastSpellMaxRange = spellRange->maxRange;
|
m_LastSpellMaxRange = spellRange->maxRange;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CAST_FAIL_TOO_FAR:
|
case CAST_FAIL_TOO_FAR:
|
||||||
|
|
@ -1024,8 +1026,10 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
ThreatList const& threatList = m_creature->GetThreatManager().getThreatList();
|
ThreatList const& threatList = m_creature->GetThreatManager().getThreatList();
|
||||||
for (ThreatList::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
|
for (ThreatList::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
|
||||||
if (Player* temp = m_creature->GetMap()->GetPlayer((*i)->getUnitGuid()))
|
if (Player* temp = m_creature->GetMap()->GetPlayer((*i)->getUnitGuid()))
|
||||||
|
{
|
||||||
temp->GroupEventHappens(action.quest_event_all.questId, m_creature);
|
temp->GroupEventHappens(action.quest_event_all.questId, m_creature);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (pActionInvoker && pActionInvoker->GetTypeId() == TYPEID_PLAYER)
|
else if (pActionInvoker && pActionInvoker->GetTypeId() == TYPEID_PLAYER)
|
||||||
{
|
{
|
||||||
((Player*)pActionInvoker)->GroupEventHappens(action.quest_event_all.questId, m_creature);
|
((Player*)pActionInvoker)->GroupEventHappens(action.quest_event_all.questId, m_creature);
|
||||||
|
|
@ -1280,7 +1284,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
case ACTION_T_DYNAMIC_MOVEMENT:
|
case ACTION_T_DYNAMIC_MOVEMENT:
|
||||||
{
|
{
|
||||||
if ((!!action.dynamicMovement.state) == m_DynamicMovement)
|
if ((!!action.dynamicMovement.state) == m_DynamicMovement)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
m_DynamicMovement = !!action.dynamicMovement.state;
|
m_DynamicMovement = !!action.dynamicMovement.state;
|
||||||
SetCombatMovement(!m_DynamicMovement, true);
|
SetCombatMovement(!m_DynamicMovement, true);
|
||||||
|
|
@ -1330,7 +1336,9 @@ void CreatureEventAI::Reset()
|
||||||
case EVENT_T_TIMER_OOC:
|
case EVENT_T_TIMER_OOC:
|
||||||
{
|
{
|
||||||
if (i->UpdateRepeatTimer(m_creature, event.timer.initialMin, event.timer.initialMax))
|
if (i->UpdateRepeatTimer(m_creature, event.timer.initialMin, event.timer.initialMax))
|
||||||
|
{
|
||||||
i->Enabled = true;
|
i->Enabled = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
@ -1467,7 +1475,9 @@ void CreatureEventAI::ReceiveAIEvent(AIEventType eventType, Creature* pSender, U
|
||||||
{
|
{
|
||||||
if (itr->Event.event_type == EVENT_T_RECEIVE_AI_EVENT &&
|
if (itr->Event.event_type == EVENT_T_RECEIVE_AI_EVENT &&
|
||||||
itr->Event.receiveAIEvent.eventType == eventType && (!itr->Event.receiveAIEvent.senderEntry || itr->Event.receiveAIEvent.senderEntry == pSender->GetEntry()))
|
itr->Event.receiveAIEvent.eventType == eventType && (!itr->Event.receiveAIEvent.senderEntry || itr->Event.receiveAIEvent.senderEntry == pSender->GetEntry()))
|
||||||
{ ProcessEvent(*itr, pInvoker, pSender); }
|
{
|
||||||
|
ProcessEvent(*itr, pInvoker, pSender);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1612,19 +1622,27 @@ void CreatureEventAI::UpdateAI(const uint32 diff)
|
||||||
{
|
{
|
||||||
// Do not decrement timers if event cannot trigger in this phase
|
// Do not decrement timers if event cannot trigger in this phase
|
||||||
if (!(i->Event.event_inverse_phase_mask & (1 << m_Phase)))
|
if (!(i->Event.event_inverse_phase_mask & (1 << m_Phase)))
|
||||||
|
{
|
||||||
i->Time -= m_EventDiff;
|
i->Time -= m_EventDiff;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
i->Time = 0;
|
i->Time = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Skip processing of events that have time remaining or are disabled
|
// Skip processing of events that have time remaining or are disabled
|
||||||
if (!(i->Enabled) || i->Time)
|
if (!(i->Enabled) || i->Time)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (IsTimerBasedEvent(i->Event.event_type))
|
if (IsTimerBasedEvent(i->Event.event_type))
|
||||||
|
{
|
||||||
ProcessEvent(*i);
|
ProcessEvent(*i);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_EventDiff = 0;
|
m_EventDiff = 0;
|
||||||
m_EventUpdateTime = EVENT_UPDATE_TIME;
|
m_EventUpdateTime = EVENT_UPDATE_TIME;
|
||||||
|
|
@ -1645,16 +1663,24 @@ void CreatureEventAI::UpdateAI(const uint32 diff)
|
||||||
if (m_creature->IsWithinLOSInMap(victim))
|
if (m_creature->IsWithinLOSInMap(victim))
|
||||||
{
|
{
|
||||||
if (m_LastSpellMaxRange && m_creature->IsInRange(victim, 0, (m_LastSpellMaxRange / 1.5f)))
|
if (m_LastSpellMaxRange && m_creature->IsInRange(victim, 0, (m_LastSpellMaxRange / 1.5f)))
|
||||||
|
{
|
||||||
SetCombatMovement(false, true);
|
SetCombatMovement(false, true);
|
||||||
else
|
|
||||||
SetCombatMovement(true, true);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
SetCombatMovement(true, true);
|
SetCombatMovement(true, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetCombatMovement(true, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (m_MeleeEnabled && m_creature->CanReachWithMeleeAttack(victim)
|
else if (m_MeleeEnabled && m_creature->CanReachWithMeleeAttack(victim)
|
||||||
&& !(m_creature->GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_NO_MELEE))
|
&& !(m_creature->GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_NO_MELEE))
|
||||||
{ DoMeleeAttackIfReady(); }
|
{
|
||||||
|
DoMeleeAttackIfReady();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1845,7 +1871,9 @@ void CreatureEventAI::DamageTaken(Unit* dealer, uint32& damage)
|
||||||
AIEventType sendEvent[HEALTH_STEPS] = { AI_EVENT_LOST_SOME_HEALTH, AI_EVENT_LOST_HEALTH, AI_EVENT_CRITICAL_HEALTH };
|
AIEventType sendEvent[HEALTH_STEPS] = { AI_EVENT_LOST_SOME_HEALTH, AI_EVENT_LOST_HEALTH, AI_EVENT_CRITICAL_HEALTH };
|
||||||
|
|
||||||
if (newHealthPercent > healthSteps[step])
|
if (newHealthPercent > healthSteps[step])
|
||||||
{ return; } // Not reached the next mark
|
{
|
||||||
|
return; // Not reached the next mark
|
||||||
|
}
|
||||||
|
|
||||||
// search for highest reached mark (with actual event attached)
|
// search for highest reached mark (with actual event attached)
|
||||||
for (uint32 i = HEALTH_STEPS - 1; i > step; --i)
|
for (uint32 i = HEALTH_STEPS - 1; i > step; --i)
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons(bool check_entry_use)
|
||||||
delete result;
|
delete result;
|
||||||
|
|
||||||
if (check_entry_use)
|
if (check_entry_use)
|
||||||
|
{
|
||||||
CheckUnusedAISummons();
|
CheckUnusedAISummons();
|
||||||
|
}
|
||||||
|
|
||||||
sLog.outString();
|
sLog.outString();
|
||||||
sLog.outString(">> Loaded %u CreatureEventAI summon definitions", Count);
|
sLog.outString(">> Loaded %u CreatureEventAI summon definitions", Count);
|
||||||
|
|
@ -249,7 +251,9 @@ void CreatureEventAIMgr::CheckUnusedAISummons()
|
||||||
case ACTION_T_SUMMON_ID:
|
case ACTION_T_SUMMON_ID:
|
||||||
{
|
{
|
||||||
if (action.summon_id.spawnId)
|
if (action.summon_id.spawnId)
|
||||||
|
{
|
||||||
idx_set.erase(action.summon_id.spawnId);
|
idx_set.erase(action.summon_id.spawnId);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: break;
|
default: break;
|
||||||
|
|
@ -729,9 +733,11 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
||||||
{
|
{
|
||||||
// output as debug for now, also because there's no general rule all spells have RecoveryTime
|
// output as debug for now, also because there's no general rule all spells have RecoveryTime
|
||||||
if (temp.event_param3 < spell->RecoveryTime)
|
if (temp.event_param3 < spell->RecoveryTime)
|
||||||
|
{
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "CreatureEventAI: Event %u Action %u uses SpellID %u but cooldown is longer(%u) than minumum defined in event param3(%u).", i, j+1,action.cast.spellId, spell->RecoveryTime, temp.event_param3);
|
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "CreatureEventAI: Event %u Action %u uses SpellID %u but cooldown is longer(%u) than minumum defined in event param3(%u).", i, j+1,action.cast.spellId, spell->RecoveryTime, temp.event_param3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Cast is always triggered if target is forced to cast on self
|
// Cast is always triggered if target is forced to cast on self
|
||||||
|
|
@ -757,12 +763,16 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
||||||
if (action.cast.target == TARGET_T_ACTION_INVOKER &&
|
if (action.cast.target == TARGET_T_ACTION_INVOKER &&
|
||||||
(IsSpellHaveEffect(spell, SPELL_EFFECT_QUEST_COMPLETE) || IsSpellHaveEffect(spell, SPELL_EFFECT_CREATE_RANDOM_ITEM) || IsSpellHaveEffect(spell, SPELL_EFFECT_DUMMY)
|
(IsSpellHaveEffect(spell, SPELL_EFFECT_QUEST_COMPLETE) || IsSpellHaveEffect(spell, SPELL_EFFECT_CREATE_RANDOM_ITEM) || IsSpellHaveEffect(spell, SPELL_EFFECT_DUMMY)
|
||||||
|| IsSpellHaveEffect(spell, SPELL_EFFECT_KILL_CREDIT_PERSONAL) || IsSpellHaveEffect(spell, SPELL_EFFECT_KILL_CREDIT_GROUP)))
|
|| IsSpellHaveEffect(spell, SPELL_EFFECT_KILL_CREDIT_PERSONAL) || IsSpellHaveEffect(spell, SPELL_EFFECT_KILL_CREDIT_GROUP)))
|
||||||
{ sLog.outErrorEventAI("Event %u Action %u has TARGET_T_ACTION_INVOKER(%u) target type, but should have TARGET_T_ACTION_INVOKER_OWNER(%u).", i, j + 1, TARGET_T_ACTION_INVOKER, TARGET_T_ACTION_INVOKER_OWNER); }
|
{
|
||||||
|
sLog.outErrorEventAI("Event %u Action %u has TARGET_T_ACTION_INVOKER(%u) target type, but should have TARGET_T_ACTION_INVOKER_OWNER(%u).", i, j + 1, TARGET_T_ACTION_INVOKER, TARGET_T_ACTION_INVOKER_OWNER);
|
||||||
|
}
|
||||||
|
|
||||||
// Spell that should only target players, but could get any
|
// Spell that should only target players, but could get any
|
||||||
if (spell->HasAttribute(SPELL_ATTR_EX3_TARGET_ONLY_PLAYER) &&
|
if (spell->HasAttribute(SPELL_ATTR_EX3_TARGET_ONLY_PLAYER) &&
|
||||||
(action.cast.target == TARGET_T_ACTION_INVOKER || action.cast.target == TARGET_T_HOSTILE_RANDOM || action.cast.target == TARGET_T_HOSTILE_RANDOM_NOT_TOP))
|
(action.cast.target == TARGET_T_ACTION_INVOKER || action.cast.target == TARGET_T_HOSTILE_RANDOM || action.cast.target == TARGET_T_HOSTILE_RANDOM_NOT_TOP))
|
||||||
{ sLog.outErrorEventAI("Event %u Action %u uses Target type %u for a spell (%u) that should only target players. This could be wrong.", i, j + 1, action.cast.target, action.cast.spellId); }
|
{
|
||||||
|
sLog.outErrorEventAI("Event %u Action %u uses Target type %u for a spell (%u) that should only target players. This could be wrong.", i, j + 1, action.cast.target, action.cast.spellId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -920,7 +930,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
||||||
break;
|
break;
|
||||||
case ACTION_T_SET_INST_DATA:
|
case ACTION_T_SET_INST_DATA:
|
||||||
if (!(temp.event_flags & EFLAG_DIFFICULTY_ALL))
|
if (!(temp.event_flags & EFLAG_DIFFICULTY_ALL))
|
||||||
|
{
|
||||||
sLog.outErrorEventAI("Event %u Action %u. Cannot set instance data without difficulty event flags.", i, j + 1);
|
sLog.outErrorEventAI("Event %u Action %u. Cannot set instance data without difficulty event flags.", i, j + 1);
|
||||||
|
}
|
||||||
if (action.set_inst_data.value > 4/*SPECIAL*/)
|
if (action.set_inst_data.value > 4/*SPECIAL*/)
|
||||||
{
|
{
|
||||||
sLog.outErrorEventAI("Event %u Action %u attempts to set instance data above encounter state 4. Custom case?", i, j + 1);
|
sLog.outErrorEventAI("Event %u Action %u attempts to set instance data above encounter state 4. Custom case?", i, j + 1);
|
||||||
|
|
@ -928,7 +940,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
||||||
break;
|
break;
|
||||||
case ACTION_T_SET_INST_DATA64:
|
case ACTION_T_SET_INST_DATA64:
|
||||||
if (!(temp.event_flags & EFLAG_DIFFICULTY_ALL))
|
if (!(temp.event_flags & EFLAG_DIFFICULTY_ALL))
|
||||||
|
{
|
||||||
sLog.outErrorEventAI("Event %u Action %u. Cannot set instance data without difficulty event flags.", i, j + 1);
|
sLog.outErrorEventAI("Event %u Action %u. Cannot set instance data without difficulty event flags.", i, j + 1);
|
||||||
|
}
|
||||||
IsValidTargetType(temp.event_type, action.type, action.set_inst_data64.target, i, j + 1);
|
IsValidTargetType(temp.event_type, action.type, action.set_inst_data64.target, i, j + 1);
|
||||||
break;
|
break;
|
||||||
case ACTION_T_UPDATE_TEMPLATE:
|
case ACTION_T_UPDATE_TEMPLATE:
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,9 @@ void DynamicObject::Delay(int32 delaytime)
|
||||||
{
|
{
|
||||||
SpellEffectEntry const* effect = holder->GetSpellProto()->GetSpellEffect(SpellEffectIndex(i));
|
SpellEffectEntry const* effect = holder->GetSpellProto()->GetSpellEffect(SpellEffectIndex(i));
|
||||||
if(!effect)
|
if(!effect)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
if ((effect->Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA || effect->Effect == SPELL_EFFECT_ADD_FARSIGHT) && holder->m_auras[i])
|
if ((effect->Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA || effect->Effect == SPELL_EFFECT_ADD_FARSIGHT) && holder->m_auras[i])
|
||||||
{
|
{
|
||||||
foundAura = true;
|
foundAura = true;
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,9 @@ namespace MaNGOS
|
||||||
if (u->GetTypeId() == TYPEID_UNIT && (
|
if (u->GetTypeId() == TYPEID_UNIT && (
|
||||||
((Creature*)u)->IsTotem() || ((Creature*)u)->IsPet() ||
|
((Creature*)u)->IsTotem() || ((Creature*)u)->IsPet() ||
|
||||||
(((Creature*)u)->GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_NO_XP_AT_KILL)))
|
(((Creature*)u)->GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_NO_XP_AT_KILL)))
|
||||||
{ return 0; }
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 xp_gain = BaseGain(pl->getLevel(), u->getLevel(), GetContentLevelsForMapAndZone(pl->GetMapId(), pl->GetZoneId()));
|
uint32 xp_gain = BaseGain(pl->getLevel(), u->getLevel(), GetContentLevelsForMapAndZone(pl->GetMapId(), pl->GetZoneId()));
|
||||||
if (xp_gain == 0)
|
if (xp_gain == 0)
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,9 @@ void GameObject::AddToWorld()
|
||||||
|
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
if (!inWorld)
|
if (!inWorld)
|
||||||
|
{
|
||||||
sEluna->OnAddToWorld(this);
|
sEluna->OnAddToWorld(this);
|
||||||
|
}
|
||||||
#endif /* ENABLE_ELUNA */
|
#endif /* ENABLE_ELUNA */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -179,9 +181,13 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
|
||||||
}
|
}
|
||||||
|
|
||||||
if (goinfo->type == GAMEOBJECT_TYPE_TRANSPORT)
|
if (goinfo->type == GAMEOBJECT_TYPE_TRANSPORT)
|
||||||
|
{
|
||||||
Object::_Create(guidlow, 0, HIGHGUID_MO_TRANSPORT);
|
Object::_Create(guidlow, 0, HIGHGUID_MO_TRANSPORT);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
Object::_Create(guidlow, goinfo->id, HIGHGUID_GAMEOBJECT);
|
Object::_Create(guidlow, goinfo->id, HIGHGUID_GAMEOBJECT);
|
||||||
|
}
|
||||||
|
|
||||||
m_goInfo = goinfo;
|
m_goInfo = goinfo;
|
||||||
|
|
||||||
|
|
@ -205,9 +211,13 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
|
||||||
SetWorldRotation(rotation.x, rotation.y, rotation.z, rotation.w);
|
SetWorldRotation(rotation.x, rotation.y, rotation.z, rotation.w);
|
||||||
// For most of gameobjects is (0, 0, 0, 1) quaternion, only some transports has not standart rotation
|
// For most of gameobjects is (0, 0, 0, 1) quaternion, only some transports has not standart rotation
|
||||||
if (const GameObjectDataAddon* addon = sGameObjectDataAddonStorage.LookupEntry<GameObjectDataAddon>(guidlow))
|
if (const GameObjectDataAddon* addon = sGameObjectDataAddonStorage.LookupEntry<GameObjectDataAddon>(guidlow))
|
||||||
|
{
|
||||||
SetTransportPathRotation(addon->path_rotation);
|
SetTransportPathRotation(addon->path_rotation);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
SetTransportPathRotation(QuaternionData(0, 0, 0, 1));
|
SetTransportPathRotation(QuaternionData(0, 0, 0, 1));
|
||||||
|
}
|
||||||
|
|
||||||
SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction);
|
SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction);
|
||||||
SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags);
|
SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags);
|
||||||
|
|
@ -238,7 +248,9 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
|
||||||
case GAMEOBJECT_TYPE_TRANSPORT:
|
case GAMEOBJECT_TYPE_TRANSPORT:
|
||||||
SetUInt32Value(GAMEOBJECT_LEVEL, WorldTimer::getMSTime());
|
SetUInt32Value(GAMEOBJECT_LEVEL, WorldTimer::getMSTime());
|
||||||
if (goinfo->transport.startOpen)
|
if (goinfo->transport.startOpen)
|
||||||
|
{
|
||||||
SetGoState(GO_STATE_ACTIVE);
|
SetGoState(GO_STATE_ACTIVE);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -450,10 +462,14 @@ void GameObject::Update(uint32 update_diff, uint32 p_time)
|
||||||
if (m_groupLootId)
|
if (m_groupLootId)
|
||||||
{
|
{
|
||||||
if (m_groupLootTimer <= update_diff)
|
if (m_groupLootTimer <= update_diff)
|
||||||
|
{
|
||||||
StopGroupLoot();
|
StopGroupLoot();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_groupLootTimer -= update_diff;
|
m_groupLootTimer -= update_diff;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case GAMEOBJECT_TYPE_GOOBER:
|
case GAMEOBJECT_TYPE_GOOBER:
|
||||||
if (m_cooldownTime < time(NULL))
|
if (m_cooldownTime < time(NULL))
|
||||||
|
|
@ -902,8 +918,10 @@ bool GameObject::isVisibleForInState(Player const* u, WorldObject const* viewPoi
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
trapNotVisible = true;
|
trapNotVisible = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// only rogue have skill for traps detection
|
// only rogue have skill for traps detection
|
||||||
if (Aura* aura = ((Player*)u)->GetAura(2836, EFFECT_INDEX_0))
|
if (Aura* aura = ((Player*)u)->GetAura(2836, EFFECT_INDEX_0))
|
||||||
|
|
@ -975,7 +993,9 @@ bool GameObject::ActivateToQuest(Player* pTarget) const
|
||||||
{
|
{
|
||||||
if ((pTarget->GetQuestStatus(itr->second) == QUEST_STATUS_INCOMPLETE || pTarget->GetQuestStatus(itr->second) == QUEST_STATUS_COMPLETE)
|
if ((pTarget->GetQuestStatus(itr->second) == QUEST_STATUS_INCOMPLETE || pTarget->GetQuestStatus(itr->second) == QUEST_STATUS_COMPLETE)
|
||||||
&& !pTarget->GetQuestRewardStatus(itr->second))
|
&& !pTarget->GetQuestRewardStatus(itr->second))
|
||||||
{ return true; }
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
@ -1304,7 +1324,9 @@ void GameObject::Use(Unit* user)
|
||||||
|
|
||||||
// FIXME: when GO casting will be implemented trap must cast spell to target
|
// FIXME: when GO casting will be implemented trap must cast spell to target
|
||||||
if ((spellId = goInfo->trap.spellId))
|
if ((spellId = goInfo->trap.spellId))
|
||||||
|
{
|
||||||
caster->CastSpell(user, spellId, true, NULL, NULL, GetObjectGuid());
|
caster->CastSpell(user, spellId, true, NULL, NULL, GetObjectGuid());
|
||||||
|
}
|
||||||
// use template cooldown if provided
|
// use template cooldown if provided
|
||||||
m_cooldownTime = time(NULL) + (goInfo->trap.cooldown ? goInfo->trap.cooldown : uint32(4));
|
m_cooldownTime = time(NULL) + (goInfo->trap.cooldown ? goInfo->trap.cooldown : uint32(4));
|
||||||
|
|
||||||
|
|
@ -1605,7 +1627,9 @@ void GameObject::Use(Unit* user)
|
||||||
// just search fishhole for success case
|
// just search fishhole for success case
|
||||||
else
|
else
|
||||||
// TODO: find reasonable value for fishing hole search
|
// TODO: find reasonable value for fishing hole search
|
||||||
{ fishingHole = LookupFishingHoleAround(20.0f + CONTACT_DISTANCE); }
|
{
|
||||||
|
fishingHole = LookupFishingHoleAround(20.0f + CONTACT_DISTANCE);
|
||||||
|
}
|
||||||
|
|
||||||
if (success || sWorld.getConfig(CONFIG_BOOL_SKILL_FAIL_GAIN_FISHING))
|
if (success || sWorld.getConfig(CONFIG_BOOL_SKILL_FAIL_GAIN_FISHING))
|
||||||
{
|
{
|
||||||
|
|
@ -1735,7 +1759,9 @@ void GameObject::Use(Unit* user)
|
||||||
spellId = info->summoningRitual.spellId;
|
spellId = info->summoningRitual.spellId;
|
||||||
|
|
||||||
if (spellId == 62330) // GO store nonexistent spell, replace by expected
|
if (spellId == 62330) // GO store nonexistent spell, replace by expected
|
||||||
|
{
|
||||||
spellId = 61993;
|
spellId = 61993;
|
||||||
|
}
|
||||||
|
|
||||||
// spell have reagent and mana cost but it not expected use its
|
// spell have reagent and mana cost but it not expected use its
|
||||||
// it triggered spell in fact casted at currently channeled GO
|
// it triggered spell in fact casted at currently channeled GO
|
||||||
|
|
@ -1829,9 +1855,13 @@ void GameObject::Use(Unit* user)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->id == 194097)
|
if (info->id == 194097)
|
||||||
|
{
|
||||||
spellId = 61994; // Ritual of Summoning
|
spellId = 61994; // Ritual of Summoning
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
spellId = 59782; // Summoning Stone Effect
|
spellId = 59782; // Summoning Stone Effect
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -1915,7 +1945,9 @@ void GameObject::Use(Unit* user)
|
||||||
break;
|
break;
|
||||||
case 184142: // Netherstorm Flag
|
case 184142: // Netherstorm Flag
|
||||||
if (bg->GetTypeID() == BATTLEGROUND_EY)
|
if (bg->GetTypeID() == BATTLEGROUND_EY)
|
||||||
|
{
|
||||||
bg->EventPlayerClickedOnFlag(player, this);
|
bg->EventPlayerClickedOnFlag(player, this);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2035,7 +2067,9 @@ void GameObject::SetWorldRotation(float qx, float qy, float qz, float qw)
|
||||||
Quat rotation(qx, qy, qz, qw);
|
Quat rotation(qx, qy, qz, qw);
|
||||||
// Temporary solution for gameobjects that has no rotation data in DB:
|
// Temporary solution for gameobjects that has no rotation data in DB:
|
||||||
if (qz == 0.f && qw == 0.f)
|
if (qz == 0.f && qw == 0.f)
|
||||||
|
{
|
||||||
rotation = Quat::fromAxisAngleRotation(G3D::Vector3::unitZ(), GetOrientation());
|
rotation = Quat::fromAxisAngleRotation(G3D::Vector3::unitZ(), GetOrientation());
|
||||||
|
}
|
||||||
|
|
||||||
rotation.unitize();
|
rotation.unitize();
|
||||||
m_packedRotation = QuaternionCompressed(rotation).m_raw;
|
m_packedRotation = QuaternionCompressed(rotation).m_raw;
|
||||||
|
|
@ -2698,13 +2732,19 @@ void GameObject::ForceGameObjectHealth(int32 diff, Unit* caster)
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE, "DestructibleGO: %s taken damage %u dealt by %s", GetGuidStr().c_str(), uint32(-diff), caster->GetGuidStr().c_str());
|
DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE, "DestructibleGO: %s taken damage %u dealt by %s", GetGuidStr().c_str(), uint32(-diff), caster->GetGuidStr().c_str());
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
if (caster && caster->ToPlayer())
|
if (caster && caster->ToPlayer())
|
||||||
|
{
|
||||||
sEluna->OnDamaged(this, caster->ToPlayer());
|
sEluna->OnDamaged(this, caster->ToPlayer());
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if (m_useTimes > uint32(-diff))
|
if (m_useTimes > uint32(-diff))
|
||||||
|
{
|
||||||
m_useTimes += diff;
|
m_useTimes += diff;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_useTimes = 0;
|
m_useTimes = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (diff == 0 && GetMaxHealth()) // Rebuild - TODO: Rebuilding over time with special display-id?
|
else if (diff == 0 && GetMaxHealth()) // Rebuild - TODO: Rebuilding over time with special display-id?
|
||||||
{
|
{
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE, "DestructibleGO: %s start rebuild by %s", GetGuidStr().c_str(), caster->GetGuidStr().c_str());
|
DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE, "DestructibleGO: %s start rebuild by %s", GetGuidStr().c_str(), caster->GetGuidStr().c_str());
|
||||||
|
|
@ -2712,10 +2752,14 @@ void GameObject::ForceGameObjectHealth(int32 diff, Unit* caster)
|
||||||
m_useTimes = GetMaxHealth();
|
m_useTimes = GetMaxHealth();
|
||||||
// Start Event if exist
|
// Start Event if exist
|
||||||
if (caster && m_goInfo->destructibleBuilding.rebuildingEvent)
|
if (caster && m_goInfo->destructibleBuilding.rebuildingEvent)
|
||||||
|
{
|
||||||
StartEvents_Event(GetMap(), m_goInfo->destructibleBuilding.rebuildingEvent, this, caster->GetCharmerOrOwnerOrSelf(), true, caster->GetCharmerOrOwnerOrSelf());
|
StartEvents_Event(GetMap(), m_goInfo->destructibleBuilding.rebuildingEvent, this, caster->GetCharmerOrOwnerOrSelf(), true, caster->GetCharmerOrOwnerOrSelf());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else // Set to value
|
else // Set to value
|
||||||
|
{
|
||||||
m_useTimes = uint32(diff);
|
m_useTimes = uint32(diff);
|
||||||
|
}
|
||||||
|
|
||||||
uint32 newDisplayId = 0xFFFFFFFF; // Set to invalid -1 to track if we switched to a change state
|
uint32 newDisplayId = 0xFFFFFFFF; // Set to invalid -1 to track if we switched to a change state
|
||||||
DestructibleModelDataEntry const* destructibleInfo = sDestructibleModelDataStore.LookupEntry(m_goInfo->destructibleBuilding.destructibleData);
|
DestructibleModelDataEntry const* destructibleInfo = sDestructibleModelDataStore.LookupEntry(m_goInfo->destructibleBuilding.destructibleData);
|
||||||
|
|
@ -2730,8 +2774,10 @@ void GameObject::ForceGameObjectHealth(int32 diff, Unit* caster)
|
||||||
|
|
||||||
// Start Event if exist
|
// Start Event if exist
|
||||||
if (caster && m_goInfo->destructibleBuilding.intactEvent)
|
if (caster && m_goInfo->destructibleBuilding.intactEvent)
|
||||||
|
{
|
||||||
StartEvents_Event(GetMap(), m_goInfo->destructibleBuilding.intactEvent, this, caster->GetCharmerOrOwnerOrSelf(), true, caster->GetCharmerOrOwnerOrSelf());
|
StartEvents_Event(GetMap(), m_goInfo->destructibleBuilding.intactEvent, this, caster->GetCharmerOrOwnerOrSelf(), true, caster->GetCharmerOrOwnerOrSelf());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (m_useTimes == 0) // Destroyed
|
else if (m_useTimes == 0) // Destroyed
|
||||||
{
|
{
|
||||||
if (!HasFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK_11)) // Was not destroyed before
|
if (!HasFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK_11)) // Was not destroyed before
|
||||||
|
|
@ -2739,30 +2785,42 @@ void GameObject::ForceGameObjectHealth(int32 diff, Unit* caster)
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE, "DestructibleGO: %s got destroyed", GetGuidStr().c_str());
|
DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE, "DestructibleGO: %s got destroyed", GetGuidStr().c_str());
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
if(caster && caster->ToPlayer())
|
if(caster && caster->ToPlayer())
|
||||||
|
{
|
||||||
sEluna->OnDestroyed(this, caster->ToPlayer());
|
sEluna->OnDestroyed(this, caster->ToPlayer());
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK_9 | GO_FLAG_UNK_10);
|
RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK_9 | GO_FLAG_UNK_10);
|
||||||
SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK_11);
|
SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK_11);
|
||||||
|
|
||||||
// Get destroyed DisplayId
|
// Get destroyed DisplayId
|
||||||
if ((!m_goInfo->destructibleBuilding.destroyedDisplayId || m_goInfo->destructibleBuilding.destroyedDisplayId == 1) && destructibleInfo)
|
if ((!m_goInfo->destructibleBuilding.destroyedDisplayId || m_goInfo->destructibleBuilding.destroyedDisplayId == 1) && destructibleInfo)
|
||||||
|
{
|
||||||
newDisplayId = destructibleInfo->destroyedDisplayId;
|
newDisplayId = destructibleInfo->destroyedDisplayId;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
newDisplayId = m_goInfo->destructibleBuilding.destroyedDisplayId;
|
newDisplayId = m_goInfo->destructibleBuilding.destroyedDisplayId;
|
||||||
|
}
|
||||||
|
|
||||||
if (!newDisplayId) // No proper destroyed display ID exists, fetch damaged
|
if (!newDisplayId) // No proper destroyed display ID exists, fetch damaged
|
||||||
{
|
{
|
||||||
if ((!m_goInfo->destructibleBuilding.damagedDisplayId || m_goInfo->destructibleBuilding.damagedDisplayId == 1) && destructibleInfo)
|
if ((!m_goInfo->destructibleBuilding.damagedDisplayId || m_goInfo->destructibleBuilding.damagedDisplayId == 1) && destructibleInfo)
|
||||||
|
{
|
||||||
newDisplayId = destructibleInfo->damagedDisplayId;
|
newDisplayId = destructibleInfo->damagedDisplayId;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
newDisplayId = m_goInfo->destructibleBuilding.damagedDisplayId;
|
newDisplayId = m_goInfo->destructibleBuilding.damagedDisplayId;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Start Event if exist
|
// Start Event if exist
|
||||||
if (caster && m_goInfo->destructibleBuilding.destroyedEvent)
|
if (caster && m_goInfo->destructibleBuilding.destroyedEvent)
|
||||||
|
{
|
||||||
StartEvents_Event(GetMap(), m_goInfo->destructibleBuilding.destroyedEvent, this, caster->GetCharmerOrOwnerOrSelf(), true, caster->GetCharmerOrOwnerOrSelf());
|
StartEvents_Event(GetMap(), m_goInfo->destructibleBuilding.destroyedEvent, this, caster->GetCharmerOrOwnerOrSelf(), true, caster->GetCharmerOrOwnerOrSelf());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (m_useTimes <= m_goInfo->destructibleBuilding.damagedNumHits) // Damaged
|
else if (m_useTimes <= m_goInfo->destructibleBuilding.damagedNumHits) // Damaged
|
||||||
{
|
{
|
||||||
if (!HasFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK_10)) // Was not damaged before
|
if (!HasFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK_10)) // Was not damaged before
|
||||||
|
|
@ -2773,19 +2831,27 @@ void GameObject::ForceGameObjectHealth(int32 diff, Unit* caster)
|
||||||
|
|
||||||
// Get damaged DisplayId
|
// Get damaged DisplayId
|
||||||
if ((!m_goInfo->destructibleBuilding.damagedDisplayId || m_goInfo->destructibleBuilding.damagedDisplayId == 1) && destructibleInfo)
|
if ((!m_goInfo->destructibleBuilding.damagedDisplayId || m_goInfo->destructibleBuilding.damagedDisplayId == 1) && destructibleInfo)
|
||||||
|
{
|
||||||
newDisplayId = destructibleInfo->damagedDisplayId;
|
newDisplayId = destructibleInfo->damagedDisplayId;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
newDisplayId = m_goInfo->destructibleBuilding.damagedDisplayId;
|
newDisplayId = m_goInfo->destructibleBuilding.damagedDisplayId;
|
||||||
|
}
|
||||||
|
|
||||||
// Start Event if exist
|
// Start Event if exist
|
||||||
if (caster && m_goInfo->destructibleBuilding.damagedEvent)
|
if (caster && m_goInfo->destructibleBuilding.damagedEvent)
|
||||||
|
{
|
||||||
StartEvents_Event(GetMap(), m_goInfo->destructibleBuilding.damagedEvent, this, caster->GetCharmerOrOwnerOrSelf(), true, caster->GetCharmerOrOwnerOrSelf());
|
StartEvents_Event(GetMap(), m_goInfo->destructibleBuilding.damagedEvent, this, caster->GetCharmerOrOwnerOrSelf(), true, caster->GetCharmerOrOwnerOrSelf());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Set display Id
|
// Set display Id
|
||||||
if (newDisplayId != 0xFFFFFFFF && newDisplayId != GetDisplayId() && newDisplayId)
|
if (newDisplayId != 0xFFFFFFFF && newDisplayId != GetDisplayId() && newDisplayId)
|
||||||
|
{
|
||||||
SetDisplayId(newDisplayId);
|
SetDisplayId(newDisplayId);
|
||||||
|
}
|
||||||
|
|
||||||
// Set health
|
// Set health
|
||||||
SetGoAnimProgress(GetMaxHealth() ? m_useTimes * 255 / GetMaxHealth() : 255);
|
SetGoAnimProgress(GetMaxHealth() ? m_useTimes * 255 / GetMaxHealth() : 255);
|
||||||
|
|
@ -2795,9 +2861,13 @@ void GameObject::SetInUse(bool use)
|
||||||
{
|
{
|
||||||
m_isInUse = use;
|
m_isInUse = use;
|
||||||
if (use)
|
if (use)
|
||||||
|
{
|
||||||
SetGoState(GO_STATE_ACTIVE);
|
SetGoState(GO_STATE_ACTIVE);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
SetGoState(GO_STATE_READY);
|
SetGoState(GO_STATE_READY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 GameObject::GetScriptId()
|
uint32 GameObject::GetScriptId()
|
||||||
|
|
|
||||||
|
|
@ -223,7 +223,9 @@ bool Guild::AddMember(ObjectGuid plGuid, uint32 plRank)
|
||||||
// 0 1 2 3 4
|
// 0 1 2 3 4
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT `name`,`level`,`class`,`zone`,`account` FROM `characters` WHERE `guid` = '%u'", lowguid);
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `name`,`level`,`class`,`zone`,`account` FROM `characters` WHERE `guid` = '%u'", lowguid);
|
||||||
if (!result)
|
if (!result)
|
||||||
{ return false; } // player doesn't exist
|
{
|
||||||
|
return false; // player doesn't exist
|
||||||
|
}
|
||||||
|
|
||||||
Field* fields = result->Fetch();
|
Field* fields = result->Fetch();
|
||||||
newmember.Name = fields[0].GetCppString();
|
newmember.Name = fields[0].GetCppString();
|
||||||
|
|
@ -332,7 +334,9 @@ bool Guild::LoadGuildFromDB(QueryResult* guildDataResult)
|
||||||
uint32 purchasedTabs = fields[12].GetUInt32();
|
uint32 purchasedTabs = fields[12].GetUInt32();
|
||||||
|
|
||||||
if (purchasedTabs > GUILD_BANK_MAX_TABS)
|
if (purchasedTabs > GUILD_BANK_MAX_TABS)
|
||||||
|
{
|
||||||
purchasedTabs = GUILD_BANK_MAX_TABS;
|
purchasedTabs = GUILD_BANK_MAX_TABS;
|
||||||
|
}
|
||||||
|
|
||||||
m_TabListMap.resize(purchasedTabs);
|
m_TabListMap.resize(purchasedTabs);
|
||||||
|
|
||||||
|
|
@ -353,7 +357,9 @@ bool Guild::CheckGuildStructure()
|
||||||
if (GM_rights == -1)
|
if (GM_rights == -1)
|
||||||
{
|
{
|
||||||
if (DelMember(m_LeaderGuid))
|
if (DelMember(m_LeaderGuid))
|
||||||
{ return false; } // guild will disbanded and deleted in caller
|
{
|
||||||
|
return false; // guild will disbanded and deleted in caller
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (GM_rights != GR_GUILDMASTER)
|
else if (GM_rights != GR_GUILDMASTER)
|
||||||
{
|
{
|
||||||
|
|
@ -485,7 +491,9 @@ bool Guild::LoadMembersFromDB(QueryResult* guildMembersResult)
|
||||||
|
|
||||||
if (guildId > m_Id)
|
if (guildId > m_Id)
|
||||||
// we loaded all members for this guild already, break cycle
|
// we loaded all members for this guild already, break cycle
|
||||||
{ break; }
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
MemberSlot newmember;
|
MemberSlot newmember;
|
||||||
uint32 lowguid = fields[1].GetUInt32();
|
uint32 lowguid = fields[1].GetUInt32();
|
||||||
|
|
@ -694,9 +702,11 @@ void Guild::BroadcastAddonToGuild(WorldSession* session, const std::string& msg,
|
||||||
Player* pl = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
Player* pl = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
||||||
|
|
||||||
if (pl && pl->GetSession() && HasRankRight(pl->GetRank(), GR_RIGHT_GCHATLISTEN) && !pl->GetSocial()->HasIgnore(session->GetPlayer()->GetObjectGuid()))
|
if (pl && pl->GetSession() && HasRankRight(pl->GetRank(), GR_RIGHT_GCHATLISTEN) && !pl->GetSocial()->HasIgnore(session->GetPlayer()->GetObjectGuid()))
|
||||||
|
{
|
||||||
pl->GetSession()->SendPacket(&data);
|
pl->GetSession()->SendPacket(&data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Guild::BroadcastToOfficers(WorldSession* session, const std::string& msg, uint32 language)
|
void Guild::BroadcastToOfficers(WorldSession* session, const std::string& msg, uint32 language)
|
||||||
|
|
@ -720,8 +730,10 @@ void Guild::BroadcastToOfficers(WorldSession* session, const std::string& msg, u
|
||||||
Player* pl = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
Player* pl = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
||||||
|
|
||||||
if (pl && pl->GetSession() && HasRankRight(pl->GetRank(), GR_RIGHT_OFFCHATLISTEN) && !pl->GetSocial()->HasIgnore(player->GetObjectGuid()))
|
if (pl && pl->GetSession() && HasRankRight(pl->GetRank(), GR_RIGHT_OFFCHATLISTEN) && !pl->GetSocial()->HasIgnore(player->GetObjectGuid()))
|
||||||
|
{
|
||||||
pl->GetSession()->SendPacket(&data);
|
pl->GetSession()->SendPacket(&data);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Guild::BroadcastAddonToOfficers(WorldSession* session, const std::string& msg, const std::string& prefix)
|
void Guild::BroadcastAddonToOfficers(WorldSession* session, const std::string& msg, const std::string& prefix)
|
||||||
|
|
@ -736,9 +748,11 @@ void Guild::BroadcastAddonToOfficers(WorldSession* session, const std::string& m
|
||||||
Player* pl = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
Player* pl = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
||||||
|
|
||||||
if (pl && pl->GetSession() && HasRankRight(pl->GetRank(), GR_RIGHT_OFFCHATLISTEN) && !pl->GetSocial()->HasIgnore(session->GetPlayer()->GetObjectGuid()))
|
if (pl && pl->GetSession() && HasRankRight(pl->GetRank(), GR_RIGHT_OFFCHATLISTEN) && !pl->GetSocial()->HasIgnore(session->GetPlayer()->GetObjectGuid()))
|
||||||
|
{
|
||||||
pl->GetSession()->SendPacket(&data);
|
pl->GetSession()->SendPacket(&data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Guild::BroadcastPacket(WorldPacket* packet)
|
void Guild::BroadcastPacket(WorldPacket* packet)
|
||||||
|
|
@ -886,9 +900,13 @@ void Guild::SwitchRank(uint32 rankId, bool up)
|
||||||
|
|
||||||
for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
|
for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
|
||||||
if (itr->second.RankId == rankId)
|
if (itr->second.RankId == rankId)
|
||||||
|
{
|
||||||
itr->second.ChangeRank(otherRankId);
|
itr->second.ChangeRank(otherRankId);
|
||||||
|
}
|
||||||
else if (itr->second.RankId == otherRankId)
|
else if (itr->second.RankId == otherRankId)
|
||||||
|
{
|
||||||
itr->second.ChangeRank(rankId);
|
itr->second.ChangeRank(rankId);
|
||||||
|
}
|
||||||
|
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
}
|
}
|
||||||
|
|
@ -1005,10 +1023,14 @@ void Guild::Roster(WorldSession* session /*= NULL*/)
|
||||||
{
|
{
|
||||||
flags |= GUILDMEMBER_STATUS_ONLINE;
|
flags |= GUILDMEMBER_STATUS_ONLINE;
|
||||||
if (player->isAFK())
|
if (player->isAFK())
|
||||||
|
{
|
||||||
flags |= GUILDMEMBER_STATUS_AFK;
|
flags |= GUILDMEMBER_STATUS_AFK;
|
||||||
|
}
|
||||||
if (player->isDND())
|
if (player->isDND())
|
||||||
|
{
|
||||||
flags |= GUILDMEMBER_STATUS_DND;
|
flags |= GUILDMEMBER_STATUS_DND;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
buffer << uint8(member.Class);
|
buffer << uint8(member.Class);
|
||||||
buffer << int32(0); // unk
|
buffer << int32(0); // unk
|
||||||
|
|
@ -1082,26 +1104,36 @@ void Guild::Query(WorldSession* session)
|
||||||
data << m_Ranks[i].Name;
|
data << m_Ranks[i].Name;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ data << uint8(0); } // null string
|
{
|
||||||
|
data << uint8(0); // null string
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rank order of creation
|
// Rank order of creation
|
||||||
for (uint8 i = 0; i < GUILD_RANKS_MAX_COUNT; ++i)
|
for (uint8 i = 0; i < GUILD_RANKS_MAX_COUNT; ++i)
|
||||||
{
|
{
|
||||||
if (i < m_Ranks.size())
|
if (i < m_Ranks.size())
|
||||||
|
{
|
||||||
data << uint32(i);
|
data << uint32(i);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
data << uint32(0);
|
data << uint32(0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Rank order of "importance" (sorting by rights)
|
// Rank order of "importance" (sorting by rights)
|
||||||
for (uint8 i = 0; i < GUILD_RANKS_MAX_COUNT; ++i)
|
for (uint8 i = 0; i < GUILD_RANKS_MAX_COUNT; ++i)
|
||||||
{
|
{
|
||||||
if (i < m_Ranks.size())
|
if (i < m_Ranks.size())
|
||||||
|
{
|
||||||
data << uint32(i);
|
data << uint32(i);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
data << uint32(0);
|
data << uint32(0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
data << uint32(m_EmblemStyle);
|
data << uint32(m_EmblemStyle);
|
||||||
data << uint32(m_EmblemColor);
|
data << uint32(m_EmblemColor);
|
||||||
|
|
@ -1293,17 +1325,23 @@ void Guild::DisplayGuildBankContent(WorldSession* session, uint8 TabId)
|
||||||
uint32 itemCount = 0;
|
uint32 itemCount = 0;
|
||||||
for (int i = 0; i < GUILD_BANK_MAX_SLOTS; ++i)
|
for (int i = 0; i < GUILD_BANK_MAX_SLOTS; ++i)
|
||||||
if (tab->Slots[i])
|
if (tab->Slots[i])
|
||||||
|
{
|
||||||
++itemCount;
|
++itemCount;
|
||||||
|
}
|
||||||
|
|
||||||
data.WriteBits(itemCount, 20);
|
data.WriteBits(itemCount, 20);
|
||||||
data.WriteBits(0, 22); // Tell client that there's no tab info in this packet
|
data.WriteBits(0, 22); // Tell client that there's no tab info in this packet
|
||||||
for (int i = 0; i < GUILD_BANK_MAX_SLOTS; ++i)
|
for (int i = 0; i < GUILD_BANK_MAX_SLOTS; ++i)
|
||||||
if (tab->Slots[i])
|
if (tab->Slots[i])
|
||||||
|
{
|
||||||
AppendDisplayGuildBankSlot(data, buffer, tab, i);
|
AppendDisplayGuildBankSlot(data, buffer, tab, i);
|
||||||
|
}
|
||||||
|
|
||||||
data << uint64(m_GuildBankMoney);
|
data << uint64(m_GuildBankMoney);
|
||||||
if (!buffer.empty())
|
if (!buffer.empty())
|
||||||
|
{
|
||||||
data.append(buffer);
|
data.append(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
data << uint32(TabId);
|
data << uint32(TabId);
|
||||||
data << uint32(GetMemberSlotWithdrawRem(session->GetPlayer()->GetObjectGuid(), TabId));
|
data << uint32(GetMemberSlotWithdrawRem(session->GetPlayer()->GetObjectGuid(), TabId));
|
||||||
|
|
@ -1338,17 +1376,25 @@ void Guild::DisplayGuildBankContentUpdate(uint8 TabId, int32 slot1, int32 slot2)
|
||||||
|
|
||||||
data.WriteBit(0);
|
data.WriteBit(0);
|
||||||
if (slot2 == -1) // single item in slot1
|
if (slot2 == -1) // single item in slot1
|
||||||
|
{
|
||||||
data.WriteBits(1, 20); // item count
|
data.WriteBits(1, 20); // item count
|
||||||
|
}
|
||||||
else // 2 items (in slot1 and slot2)
|
else // 2 items (in slot1 and slot2)
|
||||||
|
{
|
||||||
data.WriteBits(2, 20); // item count
|
data.WriteBits(2, 20); // item count
|
||||||
|
}
|
||||||
data.WriteBits(0, 22); // Tell client that there's no tab info in this packet
|
data.WriteBits(0, 22); // Tell client that there's no tab info in this packet
|
||||||
|
|
||||||
if (slot2 == -1) // single item in slot1
|
if (slot2 == -1) // single item in slot1
|
||||||
|
{
|
||||||
AppendDisplayGuildBankSlot(data, buffer, tab, slot1);
|
AppendDisplayGuildBankSlot(data, buffer, tab, slot1);
|
||||||
|
}
|
||||||
else // 2 items (in slot1 and slot2)
|
else // 2 items (in slot1 and slot2)
|
||||||
{
|
{
|
||||||
if (slot1 > slot2)
|
if (slot1 > slot2)
|
||||||
|
{
|
||||||
std::swap(slot1, slot2);
|
std::swap(slot1, slot2);
|
||||||
|
}
|
||||||
|
|
||||||
AppendDisplayGuildBankSlot(data, buffer, tab, slot1);
|
AppendDisplayGuildBankSlot(data, buffer, tab, slot1);
|
||||||
AppendDisplayGuildBankSlot(data, buffer, tab, slot2);
|
AppendDisplayGuildBankSlot(data, buffer, tab, slot2);
|
||||||
|
|
@ -1356,7 +1402,9 @@ void Guild::DisplayGuildBankContentUpdate(uint8 TabId, int32 slot1, int32 slot2)
|
||||||
|
|
||||||
data << uint64(GetGuildBankMoney());
|
data << uint64(GetGuildBankMoney());
|
||||||
if (!buffer.empty())
|
if (!buffer.empty())
|
||||||
|
{
|
||||||
data.append(buffer);
|
data.append(buffer);
|
||||||
|
}
|
||||||
data << uint32(TabId);
|
data << uint32(TabId);
|
||||||
|
|
||||||
size_t rempos = data.wpos();
|
size_t rempos = data.wpos();
|
||||||
|
|
@ -1366,10 +1414,14 @@ void Guild::DisplayGuildBankContentUpdate(uint8 TabId, int32 slot1, int32 slot2)
|
||||||
{
|
{
|
||||||
Player* player = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
Player* player = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
||||||
if (!player)
|
if (!player)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!IsMemberHaveRights(itr->first, TabId, GUILD_BANK_RIGHT_VIEW_TAB))
|
if (!IsMemberHaveRights(itr->first, TabId, GUILD_BANK_RIGHT_VIEW_TAB))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
data.put<uint32>(rempos, uint32(GetMemberSlotWithdrawRem(player->GetGUIDLow(), TabId)));
|
data.put<uint32>(rempos, uint32(GetMemberSlotWithdrawRem(player->GetGUIDLow(), TabId)));
|
||||||
|
|
||||||
|
|
@ -1396,7 +1448,9 @@ void Guild::DisplayGuildBankContentUpdate(uint8 TabId, GuildItemPosCountVec cons
|
||||||
|
|
||||||
data << uint64(GetGuildBankMoney());
|
data << uint64(GetGuildBankMoney());
|
||||||
if (!buffer.empty())
|
if (!buffer.empty())
|
||||||
|
{
|
||||||
data.append(buffer);
|
data.append(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
data << uint32(TabId);
|
data << uint32(TabId);
|
||||||
|
|
||||||
|
|
@ -1407,10 +1461,14 @@ void Guild::DisplayGuildBankContentUpdate(uint8 TabId, GuildItemPosCountVec cons
|
||||||
{
|
{
|
||||||
Player* player = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
Player* player = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
||||||
if (!player)
|
if (!player)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!IsMemberHaveRights(itr->first, TabId, GUILD_BANK_RIGHT_VIEW_TAB))
|
if (!IsMemberHaveRights(itr->first, TabId, GUILD_BANK_RIGHT_VIEW_TAB))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
data.put<uint32>(rempos, uint32(GetMemberSlotWithdrawRem(player->GetGUIDLow(), TabId)));
|
data.put<uint32>(rempos, uint32(GetMemberSlotWithdrawRem(player->GetGUIDLow(), TabId)));
|
||||||
|
|
||||||
|
|
@ -1638,7 +1696,9 @@ bool Guild::MemberMoneyWithdraw(uint64 amount, uint32 LowGuid)
|
||||||
void Guild::SetBankMoney(int64 money)
|
void Guild::SetBankMoney(int64 money)
|
||||||
{
|
{
|
||||||
if (money < 0) // I don't know how this happens, it does!!
|
if (money < 0) // I don't know how this happens, it does!!
|
||||||
|
{
|
||||||
money = 0;
|
money = 0;
|
||||||
|
}
|
||||||
m_GuildBankMoney = money;
|
m_GuildBankMoney = money;
|
||||||
|
|
||||||
CharacterDatabase.PExecute("UPDATE `guild` SET `BankMoney`='" UI64FMTD "' WHERE `guildid`='%u'", money, m_Id);
|
CharacterDatabase.PExecute("UPDATE `guild` SET `BankMoney`='" UI64FMTD "' WHERE `guildid`='%u'", money, m_Id);
|
||||||
|
|
@ -1750,7 +1810,9 @@ void Guild::SetBankMoneyPerDay(uint32 rankId, uint32 money)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rankId == GR_GUILDMASTER)
|
if (rankId == GR_GUILDMASTER)
|
||||||
|
{
|
||||||
money = (uint32)WITHDRAW_MONEY_UNLIMITED;
|
money = (uint32)WITHDRAW_MONEY_UNLIMITED;
|
||||||
|
}
|
||||||
|
|
||||||
m_Ranks[rankId].BankMoneyPerDay = money;
|
m_Ranks[rankId].BankMoneyPerDay = money;
|
||||||
|
|
||||||
|
|
@ -1758,8 +1820,10 @@ void Guild::SetBankMoneyPerDay(uint32 rankId, uint32 money)
|
||||||
{
|
{
|
||||||
MemberSlot& member = itr->second;
|
MemberSlot& member = itr->second;
|
||||||
if (member.RankId == rankId)
|
if (member.RankId == rankId)
|
||||||
|
{
|
||||||
member.BankResetTimeMoney = 0;
|
member.BankResetTimeMoney = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CharacterDatabase.PExecute("UPDATE `guild_rank` SET `BankMoneyPerDay`='%u' WHERE `rid`='%u' AND `guildid`='%u'", money, rankId, m_Id);
|
CharacterDatabase.PExecute("UPDATE `guild_rank` SET `BankMoneyPerDay`='%u' WHERE `rid`='%u' AND `guildid`='%u'", money, rankId, m_Id);
|
||||||
CharacterDatabase.PExecute("UPDATE `guild_member` SET `BankResetTimeMoney`='0' WHERE `guildid`='%u' AND `rank`='%u'", m_Id, rankId);
|
CharacterDatabase.PExecute("UPDATE `guild_member` SET `BankResetTimeMoney`='0' WHERE `guildid`='%u' AND `rank`='%u'", m_Id, rankId);
|
||||||
|
|
@ -1842,7 +1906,9 @@ bool Guild::LoadBankRightsFromDB(QueryResult* guildBankTabRightsResult)
|
||||||
Field* fields = guildBankTabRightsResult->Fetch();
|
Field* fields = guildBankTabRightsResult->Fetch();
|
||||||
// prevent crash when all rights in result are already processed
|
// prevent crash when all rights in result are already processed
|
||||||
if (!fields)
|
if (!fields)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
uint32 guildId = fields[0].GetUInt32();
|
uint32 guildId = fields[0].GetUInt32();
|
||||||
if (guildId < m_Id)
|
if (guildId < m_Id)
|
||||||
{
|
{
|
||||||
|
|
@ -1881,7 +1947,9 @@ void Guild::LoadGuildBankEventLogFromDB()
|
||||||
// 0 1 2 3 4 5 6
|
// 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* 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)
|
if (!result)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
bool isNextLogGuidSet = false;
|
bool isNextLogGuidSet = false;
|
||||||
do
|
do
|
||||||
|
|
@ -1998,7 +2066,9 @@ void Guild::DisplayGuildBankLogs(WorldSession* session, uint8 TabId)
|
||||||
|
|
||||||
data << uint32(TabId);
|
data << uint32(TabId);
|
||||||
if (hasCashFlow)
|
if (hasCashFlow)
|
||||||
|
{
|
||||||
data << uint64(0); // cash flow contribution
|
data << uint64(0); // cash flow contribution
|
||||||
|
}
|
||||||
|
|
||||||
session->SendPacket(&data);
|
session->SendPacket(&data);
|
||||||
|
|
||||||
|
|
@ -2025,7 +2095,9 @@ void Guild::LogBankEvent(uint8 EventType, uint8 TabId, uint32 PlayerGuidLow, uin
|
||||||
currentLogGuid = m_GuildBankEventLogNextGuid_Money;
|
currentLogGuid = m_GuildBankEventLogNextGuid_Money;
|
||||||
currentTabId = GUILD_BANK_MONEY_LOGS_TAB;
|
currentTabId = GUILD_BANK_MONEY_LOGS_TAB;
|
||||||
if (m_GuildBankEventLog_Money.size() >= GUILD_BANK_MAX_LOGS)
|
if (m_GuildBankEventLog_Money.size() >= GUILD_BANK_MAX_LOGS)
|
||||||
|
{
|
||||||
m_GuildBankEventLog_Money.pop_front();
|
m_GuildBankEventLog_Money.pop_front();
|
||||||
|
}
|
||||||
|
|
||||||
m_GuildBankEventLog_Money.push_back(NewEvent);
|
m_GuildBankEventLog_Money.push_back(NewEvent);
|
||||||
}
|
}
|
||||||
|
|
@ -2034,7 +2106,9 @@ void Guild::LogBankEvent(uint8 EventType, uint8 TabId, uint32 PlayerGuidLow, uin
|
||||||
m_GuildBankEventLogNextGuid_Item[TabId] = ((m_GuildBankEventLogNextGuid_Item[TabId]) + 1) % sWorld.getConfig(CONFIG_UINT32_GUILD_BANK_EVENT_LOG_COUNT);
|
m_GuildBankEventLogNextGuid_Item[TabId] = ((m_GuildBankEventLogNextGuid_Item[TabId]) + 1) % sWorld.getConfig(CONFIG_UINT32_GUILD_BANK_EVENT_LOG_COUNT);
|
||||||
currentLogGuid = m_GuildBankEventLogNextGuid_Item[TabId];
|
currentLogGuid = m_GuildBankEventLogNextGuid_Item[TabId];
|
||||||
if (m_GuildBankEventLog_Item[TabId].size() >= GUILD_BANK_MAX_LOGS)
|
if (m_GuildBankEventLog_Item[TabId].size() >= GUILD_BANK_MAX_LOGS)
|
||||||
|
{
|
||||||
m_GuildBankEventLog_Item[TabId].pop_front();
|
m_GuildBankEventLog_Item[TabId].pop_front();
|
||||||
|
}
|
||||||
|
|
||||||
m_GuildBankEventLog_Item[TabId].push_back(NewEvent);
|
m_GuildBankEventLog_Item[TabId].push_back(NewEvent);
|
||||||
}
|
}
|
||||||
|
|
@ -2135,9 +2209,13 @@ Item* Guild::_StoreItem(uint8 tab, uint8 slot, Item* pItem, uint32 count, bool c
|
||||||
if (!pItem2)
|
if (!pItem2)
|
||||||
{
|
{
|
||||||
if (clone)
|
if (clone)
|
||||||
|
{
|
||||||
pItem = pItem->CloneItem(count);
|
pItem = pItem->CloneItem(count);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
pItem->SetCount(count);
|
pItem->SetCount(count);
|
||||||
|
}
|
||||||
|
|
||||||
if (!pItem)
|
if (!pItem)
|
||||||
{
|
{
|
||||||
|
|
@ -2184,7 +2262,9 @@ InventoryResult Guild::_CanStoreItem_InSpecificSlot(uint8 tab, uint8 slot, Guild
|
||||||
|
|
||||||
// ignore move item (this slot will be empty at move)
|
// ignore move item (this slot will be empty at move)
|
||||||
if (pItem2 == pSrcItem)
|
if (pItem2 == pSrcItem)
|
||||||
|
{
|
||||||
pItem2 = NULL;
|
pItem2 = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 need_space;
|
uint32 need_space;
|
||||||
|
|
||||||
|
|
@ -2213,7 +2293,9 @@ InventoryResult Guild::_CanStoreItem_InSpecificSlot(uint8 tab, uint8 slot, Guild
|
||||||
}
|
}
|
||||||
|
|
||||||
if (need_space > count)
|
if (need_space > count)
|
||||||
|
{
|
||||||
need_space = count;
|
need_space = count;
|
||||||
|
}
|
||||||
|
|
||||||
GuildItemPosCount newPosition = GuildItemPosCount(slot, need_space);
|
GuildItemPosCount newPosition = GuildItemPosCount(slot, need_space);
|
||||||
if (!newPosition.isContainedIn(dest))
|
if (!newPosition.isContainedIn(dest))
|
||||||
|
|
@ -2231,17 +2313,23 @@ InventoryResult Guild::_CanStoreItem_InTab(uint8 tab, GuildItemPosCountVec& dest
|
||||||
{
|
{
|
||||||
// skip specific slot already processed in first called _CanStoreItem_InSpecificSlot
|
// skip specific slot already processed in first called _CanStoreItem_InSpecificSlot
|
||||||
if (j == skip_slot)
|
if (j == skip_slot)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Item* pItem2 = m_TabListMap[tab]->Slots[j];
|
Item* pItem2 = m_TabListMap[tab]->Slots[j];
|
||||||
|
|
||||||
// ignore move item (this slot will be empty at move)
|
// ignore move item (this slot will be empty at move)
|
||||||
if (pItem2 == pSrcItem)
|
if (pItem2 == pSrcItem)
|
||||||
|
{
|
||||||
pItem2 = NULL;
|
pItem2 = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// if merge skip empty, if !merge skip non-empty
|
// if merge skip empty, if !merge skip non-empty
|
||||||
if ((pItem2 != NULL) != merge)
|
if ((pItem2 != NULL) != merge)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (pItem2)
|
if (pItem2)
|
||||||
{
|
{
|
||||||
|
|
@ -2249,7 +2337,9 @@ InventoryResult Guild::_CanStoreItem_InTab(uint8 tab, GuildItemPosCountVec& dest
|
||||||
{
|
{
|
||||||
uint32 need_space = pSrcItem->GetMaxStackCount() - pItem2->GetCount();
|
uint32 need_space = pSrcItem->GetMaxStackCount() - pItem2->GetCount();
|
||||||
if (need_space > count)
|
if (need_space > count)
|
||||||
|
{
|
||||||
need_space = count;
|
need_space = count;
|
||||||
|
}
|
||||||
|
|
||||||
GuildItemPosCount newPosition = GuildItemPosCount(j, need_space);
|
GuildItemPosCount newPosition = GuildItemPosCount(j, need_space);
|
||||||
if (!newPosition.isContainedIn(dest))
|
if (!newPosition.isContainedIn(dest))
|
||||||
|
|
@ -2268,7 +2358,9 @@ InventoryResult Guild::_CanStoreItem_InTab(uint8 tab, GuildItemPosCountVec& dest
|
||||||
{
|
{
|
||||||
uint32 need_space = pSrcItem->GetMaxStackCount();
|
uint32 need_space = pSrcItem->GetMaxStackCount();
|
||||||
if (need_space > count)
|
if (need_space > count)
|
||||||
|
{
|
||||||
need_space = count;
|
need_space = count;
|
||||||
|
}
|
||||||
|
|
||||||
GuildItemPosCount newPosition = GuildItemPosCount(j, need_space);
|
GuildItemPosCount newPosition = GuildItemPosCount(j, need_space);
|
||||||
if (!newPosition.isContainedIn(dest))
|
if (!newPosition.isContainedIn(dest))
|
||||||
|
|
@ -2385,9 +2477,13 @@ void Guild::SendGuildBankTabText(WorldSession* session, uint8 TabId)
|
||||||
data.WriteStringData(tab->Text);
|
data.WriteStringData(tab->Text);
|
||||||
|
|
||||||
if (session)
|
if (session)
|
||||||
|
{
|
||||||
session->SendPacket(&data);
|
session->SendPacket(&data);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
BroadcastPacket(&data);
|
BroadcastPacket(&data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Guild::SwapItems(Player* pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankTabDst, uint8 BankTabSlotDst, uint32 SplitedAmount)
|
void Guild::SwapItems(Player* pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankTabDst, uint8 BankTabSlotDst, uint32 SplitedAmount)
|
||||||
|
|
@ -2405,9 +2501,13 @@ void Guild::SwapItems(Player* pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankTa
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SplitedAmount > pItemSrc->GetCount())
|
if (SplitedAmount > pItemSrc->GetCount())
|
||||||
|
{
|
||||||
return; // cheating?
|
return; // cheating?
|
||||||
|
}
|
||||||
else if (SplitedAmount == pItemSrc->GetCount())
|
else if (SplitedAmount == pItemSrc->GetCount())
|
||||||
|
{
|
||||||
SplitedAmount = 0; // no split
|
SplitedAmount = 0; // no split
|
||||||
|
}
|
||||||
|
|
||||||
Item* pItemDst = GetItem(BankTabDst, BankTabSlotDst);
|
Item* pItemDst = GetItem(BankTabDst, BankTabSlotDst);
|
||||||
|
|
||||||
|
|
@ -2448,7 +2548,9 @@ void Guild::SwapItems(Player* pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankTa
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
|
|
||||||
if (BankTab != BankTabDst)
|
if (BankTab != BankTabDst)
|
||||||
|
{
|
||||||
LogBankEvent(GUILD_BANK_LOG_MOVE_ITEM, BankTab, pl->GetGUIDLow(), pItemSrc->GetEntry(), SplitedAmount, BankTabDst);
|
LogBankEvent(GUILD_BANK_LOG_MOVE_ITEM, BankTab, pl->GetGUIDLow(), pItemSrc->GetEntry(), SplitedAmount, BankTabDst);
|
||||||
|
}
|
||||||
|
|
||||||
pl->ItemRemovedQuestCheck(pItemSrc->GetEntry(), SplitedAmount);
|
pl->ItemRemovedQuestCheck(pItemSrc->GetEntry(), SplitedAmount);
|
||||||
pItemSrc->SetCount(pItemSrc->GetCount() - SplitedAmount);
|
pItemSrc->SetCount(pItemSrc->GetCount() - SplitedAmount);
|
||||||
|
|
@ -2466,7 +2568,9 @@ void Guild::SwapItems(Player* pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankTa
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
|
|
||||||
if (BankTab != BankTabDst)
|
if (BankTab != BankTabDst)
|
||||||
|
{
|
||||||
LogBankEvent(GUILD_BANK_LOG_MOVE_ITEM, BankTab, pl->GetGUIDLow(), pItemSrc->GetEntry(), pItemSrc->GetCount(), BankTabDst);
|
LogBankEvent(GUILD_BANK_LOG_MOVE_ITEM, BankTab, pl->GetGUIDLow(), pItemSrc->GetEntry(), pItemSrc->GetCount(), BankTabDst);
|
||||||
|
}
|
||||||
|
|
||||||
RemoveItem(BankTab, BankTabSlot);
|
RemoveItem(BankTab, BankTabSlot);
|
||||||
StoreItem(BankTabDst, gDest, pItemSrc);
|
StoreItem(BankTabDst, gDest, pItemSrc);
|
||||||
|
|
@ -2523,7 +2627,9 @@ void Guild::SwapItems(Player* pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankTa
|
||||||
}
|
}
|
||||||
DisplayGuildBankContentUpdate(BankTab, BankTabSlot, BankTab == BankTabDst ? BankTabSlotDst : -1);
|
DisplayGuildBankContentUpdate(BankTab, BankTabSlot, BankTab == BankTabDst ? BankTabSlotDst : -1);
|
||||||
if (BankTab != BankTabDst)
|
if (BankTab != BankTabDst)
|
||||||
|
{
|
||||||
DisplayGuildBankContentUpdate(BankTabDst, BankTabSlotDst);
|
DisplayGuildBankContentUpdate(BankTabDst, BankTabSlotDst);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -2538,9 +2644,13 @@ void Guild::MoveFromBankToChar(Player* pl, uint8 BankTab, uint8 BankTabSlot, uin
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SplitedAmount > pItemBank->GetCount())
|
if (SplitedAmount > pItemBank->GetCount())
|
||||||
|
{
|
||||||
return; // cheating?
|
return; // cheating?
|
||||||
|
}
|
||||||
else if (SplitedAmount == pItemBank->GetCount())
|
else if (SplitedAmount == pItemBank->GetCount())
|
||||||
|
{
|
||||||
SplitedAmount = 0; // no split
|
SplitedAmount = 0; // no split
|
||||||
|
}
|
||||||
|
|
||||||
if (SplitedAmount)
|
if (SplitedAmount)
|
||||||
{
|
{
|
||||||
|
|
@ -2662,7 +2772,9 @@ void Guild::MoveFromBankToChar(Player* pl, uint8 BankTab, uint8 BankTabSlot, uin
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
LogBankEvent(GUILD_BANK_LOG_WITHDRAW_ITEM, BankTab, pl->GetGUIDLow(), pItemBank->GetEntry(), pItemBank->GetCount());
|
LogBankEvent(GUILD_BANK_LOG_WITHDRAW_ITEM, BankTab, pl->GetGUIDLow(), pItemBank->GetEntry(), pItemBank->GetCount());
|
||||||
if (pItemChar)
|
if (pItemChar)
|
||||||
|
{
|
||||||
LogBankEvent(GUILD_BANK_LOG_DEPOSIT_ITEM, BankTab, pl->GetGUIDLow(), pItemChar->GetEntry(), pItemChar->GetCount());
|
LogBankEvent(GUILD_BANK_LOG_DEPOSIT_ITEM, BankTab, pl->GetGUIDLow(), pItemChar->GetEntry(), pItemChar->GetCount());
|
||||||
|
}
|
||||||
|
|
||||||
RemoveItem(BankTab, BankTabSlot);
|
RemoveItem(BankTab, BankTabSlot);
|
||||||
if (pItemChar)
|
if (pItemChar)
|
||||||
|
|
@ -2706,9 +2818,13 @@ void Guild::MoveFromCharToBank(Player* pl, uint8 PlayerBag, uint8 PlayerSlot, ui
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SplitedAmount > pItemChar->GetCount())
|
if (SplitedAmount > pItemChar->GetCount())
|
||||||
|
{
|
||||||
return; // cheating?
|
return; // cheating?
|
||||||
|
}
|
||||||
else if (SplitedAmount == pItemChar->GetCount())
|
else if (SplitedAmount == pItemChar->GetCount())
|
||||||
|
{
|
||||||
SplitedAmount = 0; // no split
|
SplitedAmount = 0; // no split
|
||||||
|
}
|
||||||
|
|
||||||
if (SplitedAmount)
|
if (SplitedAmount)
|
||||||
{
|
{
|
||||||
|
|
@ -2817,20 +2933,28 @@ void Guild::MoveFromCharToBank(Player* pl, uint8 PlayerBag, uint8 PlayerSlot, ui
|
||||||
|
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
if (pItemBank)
|
if (pItemBank)
|
||||||
|
{
|
||||||
LogBankEvent(GUILD_BANK_LOG_WITHDRAW_ITEM, BankTab, pl->GetGUIDLow(), pItemBank->GetEntry(), pItemBank->GetCount());
|
LogBankEvent(GUILD_BANK_LOG_WITHDRAW_ITEM, BankTab, pl->GetGUIDLow(), pItemBank->GetEntry(), pItemBank->GetCount());
|
||||||
|
}
|
||||||
LogBankEvent(GUILD_BANK_LOG_DEPOSIT_ITEM, BankTab, pl->GetGUIDLow(), pItemChar->GetEntry(), pItemChar->GetCount());
|
LogBankEvent(GUILD_BANK_LOG_DEPOSIT_ITEM, BankTab, pl->GetGUIDLow(), pItemChar->GetEntry(), pItemChar->GetCount());
|
||||||
|
|
||||||
pl->MoveItemFromInventory(PlayerBag, PlayerSlot, true);
|
pl->MoveItemFromInventory(PlayerBag, PlayerSlot, true);
|
||||||
pItemChar->DeleteFromInventoryDB();
|
pItemChar->DeleteFromInventoryDB();
|
||||||
if (pItemBank)
|
if (pItemBank)
|
||||||
|
{
|
||||||
RemoveItem(BankTab, BankTabSlot);
|
RemoveItem(BankTab, BankTabSlot);
|
||||||
|
}
|
||||||
|
|
||||||
StoreItem(BankTab, gDest, pItemChar);
|
StoreItem(BankTab, gDest, pItemChar);
|
||||||
if (pItemBank)
|
if (pItemBank)
|
||||||
|
{
|
||||||
pl->MoveItemToInventory(iDest, pItemBank, true);
|
pl->MoveItemToInventory(iDest, pItemBank, true);
|
||||||
|
}
|
||||||
pl->SaveInventoryAndGoldToDB();
|
pl->SaveInventoryAndGoldToDB();
|
||||||
if (pItemBank)
|
if (pItemBank)
|
||||||
|
{
|
||||||
MemberItemWithdraw(BankTab, pl->GetGUIDLow());
|
MemberItemWithdraw(BankTab, pl->GetGUIDLow());
|
||||||
|
}
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
|
|
||||||
DisplayGuildBankContentUpdate(BankTab, gDest);
|
DisplayGuildBankContentUpdate(BankTab, gDest);
|
||||||
|
|
@ -2863,7 +2987,9 @@ void Guild::BroadcastEvent(GuildEvents event, ObjectGuid guid, char const* str1
|
||||||
}
|
}
|
||||||
|
|
||||||
if (guid)
|
if (guid)
|
||||||
|
{
|
||||||
data << ObjectGuid(guid);
|
data << ObjectGuid(guid);
|
||||||
|
}
|
||||||
|
|
||||||
BroadcastPacket(&data);
|
BroadcastPacket(&data);
|
||||||
|
|
||||||
|
|
@ -2881,7 +3007,9 @@ void Guild::DeleteGuildBankItems(bool alsoInDB /*= false*/)
|
||||||
pItem->RemoveFromWorld();
|
pItem->RemoveFromWorld();
|
||||||
|
|
||||||
if (alsoInDB)
|
if (alsoInDB)
|
||||||
|
{
|
||||||
pItem->DeleteFromDB();
|
pItem->DeleteFromDB();
|
||||||
|
}
|
||||||
|
|
||||||
delete pItem;
|
delete pItem;
|
||||||
}
|
}
|
||||||
|
|
@ -2959,18 +3087,26 @@ void GuildBankEventLogEntry::WriteData(WorldPacket& data, ByteBuffer& buffer)
|
||||||
|
|
||||||
buffer.WriteGuidBytes<6, 1, 5>(logGuid);
|
buffer.WriteGuidBytes<6, 1, 5>(logGuid);
|
||||||
if (hasStack)
|
if (hasStack)
|
||||||
|
{
|
||||||
buffer << uint32(ItemStackCount);
|
buffer << uint32(ItemStackCount);
|
||||||
|
}
|
||||||
|
|
||||||
buffer << uint8(EventType);
|
buffer << uint8(EventType);
|
||||||
buffer.WriteGuidBytes<2, 4, 0, 7, 3>(logGuid);
|
buffer.WriteGuidBytes<2, 4, 0, 7, 3>(logGuid);
|
||||||
if (hasItem)
|
if (hasItem)
|
||||||
|
{
|
||||||
buffer << uint32(ItemOrMoney);
|
buffer << uint32(ItemOrMoney);
|
||||||
|
}
|
||||||
|
|
||||||
buffer << uint32(time(NULL) - TimeStamp);
|
buffer << uint32(time(NULL) - TimeStamp);
|
||||||
|
|
||||||
if (isMoneyEvent())
|
if (isMoneyEvent())
|
||||||
|
{
|
||||||
buffer << uint64(ItemOrMoney);
|
buffer << uint64(ItemOrMoney);
|
||||||
|
}
|
||||||
|
|
||||||
if (itemMoved)
|
if (itemMoved)
|
||||||
|
{
|
||||||
buffer << uint8(DestTabId); // moved tab
|
buffer << uint8(DestTabId); // moved tab
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -322,9 +322,13 @@ uint32 ItemPrototype::GetArmor() const
|
||||||
ArmorLocationEntry const* al = NULL;
|
ArmorLocationEntry const* al = NULL;
|
||||||
|
|
||||||
if (InventoryType == INVTYPE_ROBE)
|
if (InventoryType == INVTYPE_ROBE)
|
||||||
|
{
|
||||||
al = sArmorLocationStore.LookupEntry(INVTYPE_CHEST);
|
al = sArmorLocationStore.LookupEntry(INVTYPE_CHEST);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
al = sArmorLocationStore.LookupEntry(InventoryType);
|
al = sArmorLocationStore.LookupEntry(InventoryType);
|
||||||
|
}
|
||||||
|
|
||||||
if (!al)
|
if (!al)
|
||||||
{
|
{
|
||||||
|
|
@ -377,15 +381,23 @@ float ItemPrototype::getDPS() const
|
||||||
case INVTYPE_WEAPONMAINHAND:
|
case INVTYPE_WEAPONMAINHAND:
|
||||||
case INVTYPE_WEAPONOFFHAND:
|
case INVTYPE_WEAPONOFFHAND:
|
||||||
if (Flags2 & ITEM_FLAG2_CASTER_WEAPON) // caster weapon flag
|
if (Flags2 & ITEM_FLAG2_CASTER_WEAPON) // caster weapon flag
|
||||||
|
{
|
||||||
id = sItemDamageOneHandCasterStore.LookupEntry(ItemLevel);
|
id = sItemDamageOneHandCasterStore.LookupEntry(ItemLevel);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
id = sItemDamageOneHandStore.LookupEntry(ItemLevel);
|
id = sItemDamageOneHandStore.LookupEntry(ItemLevel);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case INVTYPE_2HWEAPON:
|
case INVTYPE_2HWEAPON:
|
||||||
if (Flags2 & ITEM_FLAG2_CASTER_WEAPON) // caster weapon flag
|
if (Flags2 & ITEM_FLAG2_CASTER_WEAPON) // caster weapon flag
|
||||||
|
{
|
||||||
id = sItemDamageTwoHandCasterStore.LookupEntry(ItemLevel);
|
id = sItemDamageTwoHandCasterStore.LookupEntry(ItemLevel);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
id = sItemDamageTwoHandStore.LookupEntry(ItemLevel);
|
id = sItemDamageTwoHandStore.LookupEntry(ItemLevel);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case INVTYPE_AMMO:
|
case INVTYPE_AMMO:
|
||||||
id = sItemDamageAmmoStore.LookupEntry(ItemLevel);
|
id = sItemDamageAmmoStore.LookupEntry(ItemLevel);
|
||||||
|
|
@ -502,9 +514,13 @@ void Item::UpdateDuration(Player* owner, uint32 diff)
|
||||||
#endif /* ENABLE_ELUNA */
|
#endif /* ENABLE_ELUNA */
|
||||||
|
|
||||||
if (uint32 newItemId = sObjectMgr.GetItemExpireConvert(GetEntry()))
|
if (uint32 newItemId = sObjectMgr.GetItemExpireConvert(GetEntry()))
|
||||||
|
{
|
||||||
owner->ConvertItem(this, newItemId);
|
owner->ConvertItem(this, newItemId);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
owner->DestroyItem(GetBagSlot(), GetSlot(), true);
|
owner->DestroyItem(GetBagSlot(), GetSlot(), true);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -690,8 +706,10 @@ bool Item::LoadFromDB(uint32 guidLow, Field* fields, ObjectGuid ownerGuid)
|
||||||
if (GetItemRandomPropertyId() < 0)
|
if (GetItemRandomPropertyId() < 0)
|
||||||
{
|
{
|
||||||
if (UpdateItemSuffixFactor())
|
if (UpdateItemSuffixFactor())
|
||||||
|
{
|
||||||
need_save = true;
|
need_save = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Remove bind flag for items vs NO_BIND set
|
// Remove bind flag for items vs NO_BIND set
|
||||||
if (IsSoulBound() && proto->Bonding == NO_BIND)
|
if (IsSoulBound() && proto->Bonding == NO_BIND)
|
||||||
|
|
@ -1134,7 +1152,9 @@ bool Item::IsBoundByEnchant() const
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enchant_slot > PRISMATIC_ENCHANTMENT_SLOT && enchant_slot < PROP_ENCHANTMENT_SLOT_0)
|
if (enchant_slot > PRISMATIC_ENCHANTMENT_SLOT && enchant_slot < PROP_ENCHANTMENT_SLOT_0)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
|
SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
|
||||||
if (!enchantEntry)
|
if (!enchantEntry)
|
||||||
|
|
@ -1181,12 +1201,16 @@ bool Item::IsFitToSpellRequirements(SpellEntry const* spellInfo) const
|
||||||
if (equippedItems->EquippedItemClass != -1) // -1 == any item class
|
if (equippedItems->EquippedItemClass != -1) // -1 == any item class
|
||||||
{
|
{
|
||||||
if (equippedItems->EquippedItemClass != int32(proto->Class))
|
if (equippedItems->EquippedItemClass != int32(proto->Class))
|
||||||
{ return false; } // wrong item class
|
{
|
||||||
|
return false; // wrong item class
|
||||||
|
}
|
||||||
|
|
||||||
if (equippedItems->EquippedItemSubClassMask != 0) // 0 == any subclass
|
if (equippedItems->EquippedItemSubClassMask != 0) // 0 == any subclass
|
||||||
{
|
{
|
||||||
if ((equippedItems->EquippedItemSubClassMask & (1 << proto->SubClass)) == 0)
|
if ((equippedItems->EquippedItemSubClassMask & (1 << proto->SubClass)) == 0)
|
||||||
{ return false; } // subclass not present in mask
|
{
|
||||||
|
return false; // subclass not present in mask
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1196,7 +1220,9 @@ bool Item::IsFitToSpellRequirements(SpellEntry const* spellInfo) const
|
||||||
if (equippedItems->EquippedItemInventoryTypeMask != 0 && (spellInfo->GetTargets() & TARGET_FLAG_ITEM)) // 0 == any inventory type
|
if (equippedItems->EquippedItemInventoryTypeMask != 0 && (spellInfo->GetTargets() & TARGET_FLAG_ITEM)) // 0 == any inventory type
|
||||||
{
|
{
|
||||||
if ((equippedItems->EquippedItemInventoryTypeMask & (1 << proto->InventoryType)) == 0)
|
if ((equippedItems->EquippedItemInventoryTypeMask & (1 << proto->InventoryType)) == 0)
|
||||||
{ return false; } // inventory type not present in mask
|
{
|
||||||
|
return false; // inventory type not present in mask
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -1237,11 +1263,15 @@ void Item::SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint
|
||||||
{
|
{
|
||||||
Player* owner = GetOwner();
|
Player* owner = GetOwner();
|
||||||
if (uint32 oldEnchant = GetEnchantmentId(slot))
|
if (uint32 oldEnchant = GetEnchantmentId(slot))
|
||||||
|
{
|
||||||
owner->GetSession()->SendEnchantmentLog(GetOwnerGuid(), ObjectGuid(), GetEntry(), oldEnchant);
|
owner->GetSession()->SendEnchantmentLog(GetOwnerGuid(), ObjectGuid(), GetEntry(), oldEnchant);
|
||||||
|
}
|
||||||
|
|
||||||
if (id)
|
if (id)
|
||||||
|
{
|
||||||
owner->GetSession()->SendEnchantmentLog(GetOwnerGuid(), casterGuid, GetEntry(), id);
|
owner->GetSession()->SendEnchantmentLog(GetOwnerGuid(), casterGuid, GetEntry(), id);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_ID_OFFSET, id);
|
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_ID_OFFSET, id);
|
||||||
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET, duration);
|
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET, duration);
|
||||||
|
|
@ -1308,15 +1338,19 @@ bool Item::GemsFitSockets() const
|
||||||
if (!enchant_id)
|
if (!enchant_id)
|
||||||
{
|
{
|
||||||
if (SocketColor) fits &= false;
|
if (SocketColor) fits &= false;
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
|
SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
|
||||||
if (!enchantEntry)
|
if (!enchantEntry)
|
||||||
{
|
{
|
||||||
if (SocketColor) fits &= false;
|
if (SocketColor) fits &= false;
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uint8 GemColor = 0;
|
uint8 GemColor = 0;
|
||||||
|
|
||||||
|
|
@ -1328,9 +1362,11 @@ bool Item::GemsFitSockets() const
|
||||||
{
|
{
|
||||||
GemPropertiesEntry const* gemProperty = sGemPropertiesStore.LookupEntry(gemProto->GemProperties);
|
GemPropertiesEntry const* gemProperty = sGemPropertiesStore.LookupEntry(gemProto->GemProperties);
|
||||||
if (gemProperty)
|
if (gemProperty)
|
||||||
|
{
|
||||||
GemColor = gemProperty->color;
|
GemColor = gemProperty->color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fits &= (GemColor & SocketColor) ? true : false;
|
fits &= (GemColor & SocketColor) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
@ -1344,15 +1380,21 @@ uint8 Item::GetGemCountWithID(uint32 GemID) const
|
||||||
{
|
{
|
||||||
uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot));
|
uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot));
|
||||||
if (!enchant_id)
|
if (!enchant_id)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
|
SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
|
||||||
if (!enchantEntry)
|
if (!enchantEntry)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (GemID == enchantEntry->GemID)
|
if (GemID == enchantEntry->GemID)
|
||||||
|
{
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1363,19 +1405,27 @@ uint8 Item::GetGemCountWithLimitCategory(uint32 limitCategory) const
|
||||||
{
|
{
|
||||||
uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot));
|
uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot));
|
||||||
if (!enchant_id)
|
if (!enchant_id)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
|
SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
|
||||||
if (!enchantEntry)
|
if (!enchantEntry)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
ItemPrototype const* gemProto = ObjectMgr::GetItemPrototype(enchantEntry->GemID);
|
ItemPrototype const* gemProto = ObjectMgr::GetItemPrototype(enchantEntry->GemID);
|
||||||
if (!gemProto)
|
if (!gemProto)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (gemProto->ItemLimitCategory == limitCategory)
|
if (gemProto->ItemLimitCategory == limitCategory)
|
||||||
|
{
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1412,7 +1462,9 @@ void Item::SendTimeUpdate(Player* owner)
|
||||||
Item* Item::CreateItem(uint32 item, uint32 count, Player const* player, uint32 randomPropertyId)
|
Item* Item::CreateItem(uint32 item, uint32 count, Player const* player, uint32 randomPropertyId)
|
||||||
{
|
{
|
||||||
if (count < 1)
|
if (count < 1)
|
||||||
{ return NULL; } // don't create item at zero count
|
{
|
||||||
|
return NULL; // don't create item at zero count
|
||||||
|
}
|
||||||
|
|
||||||
if (ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(item))
|
if (ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(item))
|
||||||
{
|
{
|
||||||
|
|
@ -1656,7 +1708,9 @@ uint32 Item::GetSpecialPrice(ItemPrototype const* proto, uint32 minimumPrice /*=
|
||||||
uint32 cost = 0;
|
uint32 cost = 0;
|
||||||
|
|
||||||
if (proto->Flags2 & ITEM_FLAG2_HAS_NORMAL_PRICE)
|
if (proto->Flags2 & ITEM_FLAG2_HAS_NORMAL_PRICE)
|
||||||
|
{
|
||||||
cost = proto->SellPrice;
|
cost = proto->SellPrice;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool normalPrice = true;
|
bool normalPrice = true;
|
||||||
|
|
@ -1669,19 +1723,29 @@ uint32 Item::GetSpecialPrice(ItemPrototype const* proto, uint32 minimumPrice /*=
|
||||||
{
|
{
|
||||||
ItemClassEntry const* classEntry = sItemClassStore.LookupEntry(proto->Class);
|
ItemClassEntry const* classEntry = sItemClassStore.LookupEntry(proto->Class);
|
||||||
if (classEntry)
|
if (classEntry)
|
||||||
|
{
|
||||||
cost *= classEntry->PriceFactor;
|
cost *= classEntry->PriceFactor;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
cost = 0;
|
cost = 0;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
cost /= 4 * proto->BuyCount;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
cost /= 4 * proto->BuyCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
cost = proto->SellPrice;
|
cost = proto->SellPrice;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (cost < minimumPrice)
|
if (cost < minimumPrice)
|
||||||
|
{
|
||||||
cost = minimumPrice;
|
cost = minimumPrice;
|
||||||
|
}
|
||||||
|
|
||||||
return cost;
|
return cost;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,10 +76,14 @@ void LoadRandomEnchantmentsTable()
|
||||||
if (chance > 0.000001f && chance <= 100.0f)
|
if (chance > 0.000001f && chance <= 100.0f)
|
||||||
{
|
{
|
||||||
if (entry > 0)
|
if (entry > 0)
|
||||||
|
{
|
||||||
RandomItemPropEnch[entry].push_back(EnchStoreItem(ench, chance));
|
RandomItemPropEnch[entry].push_back(EnchStoreItem(ench, chance));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
RandomItemSuffixEnch[-entry].push_back(EnchStoreItem(ench, chance));
|
RandomItemSuffixEnch[-entry].push_back(EnchStoreItem(ench, chance));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Item Enchantment %u for entry %i has too high or too low chance %f, skipped.", ench, entry, chance);
|
sLog.outErrorDb("Item Enchantment %u for entry %i has too high or too low chance %f, skipped.", ench, entry, chance);
|
||||||
|
|
|
||||||
|
|
@ -437,7 +437,9 @@ LootItem::LootItem(uint32 itemid_, uint8 type_, uint32 count_, uint32 randomSuff
|
||||||
needs_quest = false;
|
needs_quest = false;
|
||||||
|
|
||||||
if (currency)
|
if (currency)
|
||||||
|
{
|
||||||
freeforall = false;
|
freeforall = false;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ItemPrototype const* proto = ObjectMgr::GetItemPrototype(itemid);
|
ItemPrototype const* proto = ObjectMgr::GetItemPrototype(itemid);
|
||||||
|
|
@ -621,7 +623,9 @@ void Loot::FillNotNormalLootFor(Player* pl)
|
||||||
|
|
||||||
QuestItemMap::const_iterator qmapitr = m_playerCurrencies.find(plguid);
|
QuestItemMap::const_iterator qmapitr = m_playerCurrencies.find(plguid);
|
||||||
if (qmapitr == m_playerCurrencies.end())
|
if (qmapitr == m_playerCurrencies.end())
|
||||||
|
{
|
||||||
FillCurrencyLoot(pl);
|
FillCurrencyLoot(pl);
|
||||||
|
}
|
||||||
|
|
||||||
qmapitr = m_playerQuestItems.find(plguid);
|
qmapitr = m_playerQuestItems.find(plguid);
|
||||||
if (qmapitr == m_playerQuestItems.end())
|
if (qmapitr == m_playerQuestItems.end())
|
||||||
|
|
@ -637,7 +641,9 @@ void Loot::FillNotNormalLootFor(Player* pl)
|
||||||
|
|
||||||
qmapitr = m_playerNonQuestNonFFANonCurrencyConditionalItems.find(plguid);
|
qmapitr = m_playerNonQuestNonFFANonCurrencyConditionalItems.find(plguid);
|
||||||
if (qmapitr == m_playerNonQuestNonFFANonCurrencyConditionalItems.end())
|
if (qmapitr == m_playerNonQuestNonFFANonCurrencyConditionalItems.end())
|
||||||
|
{
|
||||||
FillNonQuestNonFFANonCurrencyConditionalLoot(pl);
|
FillNonQuestNonFFANonCurrencyConditionalLoot(pl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QuestItemList* Loot::FillCurrencyLoot(Player* player)
|
QuestItemList* Loot::FillCurrencyLoot(Player* player)
|
||||||
|
|
@ -889,7 +895,9 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem** qite
|
||||||
{
|
{
|
||||||
QuestItem* currency2 = (QuestItem*) & (*iter);
|
QuestItem* currency2 = (QuestItem*) & (*iter);
|
||||||
if (currency)
|
if (currency)
|
||||||
|
{
|
||||||
*currency = currency2;
|
*currency = currency2;
|
||||||
|
}
|
||||||
is_looted = currency2->is_looted;
|
is_looted = currency2->is_looted;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -1259,7 +1267,9 @@ void LootTemplate::AddEntry(LootStoreItem& item)
|
||||||
if (item.group > 0 && item.mincountOrRef > 0) // Group
|
if (item.group > 0 && item.mincountOrRef > 0) // Group
|
||||||
{
|
{
|
||||||
if (item.group >= Groups.size())
|
if (item.group >= Groups.size())
|
||||||
{ Groups.resize(item.group); } // Adds new group the the loot template if needed
|
{
|
||||||
|
Groups.resize(item.group); // Adds new group the the loot template if needed
|
||||||
|
}
|
||||||
Groups[item.group - 1].AddEntry(item); // Adds new entry to the group
|
Groups[item.group - 1].AddEntry(item); // Adds new entry to the group
|
||||||
}
|
}
|
||||||
else // Non-grouped entries and references are stored together
|
else // Non-grouped entries and references are stored together
|
||||||
|
|
@ -1274,7 +1284,9 @@ void LootTemplate::Process(Loot& loot, LootStore const& store, bool rate, uint8
|
||||||
if (groupId) // Group reference uses own processing of the group
|
if (groupId) // Group reference uses own processing of the group
|
||||||
{
|
{
|
||||||
if (groupId > Groups.size())
|
if (groupId > Groups.size())
|
||||||
{ return; } // Error message already printed at loading stage
|
{
|
||||||
|
return; // Error message already printed at loading stage
|
||||||
|
}
|
||||||
|
|
||||||
Groups[groupId - 1].Process(loot);
|
Groups[groupId - 1].Process(loot);
|
||||||
return;
|
return;
|
||||||
|
|
@ -1284,14 +1296,18 @@ void LootTemplate::Process(Loot& loot, LootStore const& store, bool rate, uint8
|
||||||
for (LootStoreItemList::const_iterator i = Entries.begin() ; i != Entries.end() ; ++i)
|
for (LootStoreItemList::const_iterator i = Entries.begin() ; i != Entries.end() ; ++i)
|
||||||
{
|
{
|
||||||
if (!i->Roll(rate))
|
if (!i->Roll(rate))
|
||||||
{ continue; } // Bad luck for the entry
|
{
|
||||||
|
continue; // Bad luck for the entry
|
||||||
|
}
|
||||||
|
|
||||||
if (i->mincountOrRef < 0 && i->type == LOOT_ITEM_TYPE_ITEM) // References processing
|
if (i->mincountOrRef < 0 && i->type == LOOT_ITEM_TYPE_ITEM) // References processing
|
||||||
{
|
{
|
||||||
LootTemplate const* Referenced = LootTemplates_Reference.GetLootFor(-i->mincountOrRef);
|
LootTemplate const* Referenced = LootTemplates_Reference.GetLootFor(-i->mincountOrRef);
|
||||||
|
|
||||||
if (!Referenced)
|
if (!Referenced)
|
||||||
{ continue; } // Error message already printed at loading stage
|
{
|
||||||
|
continue; // Error message already printed at loading stage
|
||||||
|
}
|
||||||
|
|
||||||
// Check condition
|
// Check condition
|
||||||
if (i->conditionId && !sObjectMgr.IsPlayerMeetToCondition(i->conditionId, NULL, NULL, loot.GetLootTarget(), CONDITION_FROM_REFERING_LOOT))
|
if (i->conditionId && !sObjectMgr.IsPlayerMeetToCondition(i->conditionId, NULL, NULL, loot.GetLootTarget(), CONDITION_FROM_REFERING_LOOT))
|
||||||
|
|
@ -1305,7 +1321,9 @@ void LootTemplate::Process(Loot& loot, LootStore const& store, bool rate, uint8
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // Plain entries (not a reference, not grouped)
|
else // Plain entries (not a reference, not grouped)
|
||||||
{ loot.AddItem(*i); } // Chance is already checked, just add
|
{
|
||||||
|
loot.AddItem(*i); // Chance is already checked, just add
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now processing groups
|
// Now processing groups
|
||||||
|
|
@ -1321,7 +1339,9 @@ bool LootTemplate::HasQuestDrop(LootTemplateMap const& store, uint8 groupId) con
|
||||||
if (groupId) // Group reference
|
if (groupId) // Group reference
|
||||||
{
|
{
|
||||||
if (groupId > Groups.size())
|
if (groupId > Groups.size())
|
||||||
{ return false; } // Error message [should be] already printed at loading stage
|
{
|
||||||
|
return false; // Error message [should be] already printed at loading stage
|
||||||
|
}
|
||||||
return Groups[groupId - 1].HasQuestDrop();
|
return Groups[groupId - 1].HasQuestDrop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1331,14 +1351,18 @@ bool LootTemplate::HasQuestDrop(LootTemplateMap const& store, uint8 groupId) con
|
||||||
{
|
{
|
||||||
LootTemplateMap::const_iterator Referenced = store.find(-i->mincountOrRef);
|
LootTemplateMap::const_iterator Referenced = store.find(-i->mincountOrRef);
|
||||||
if (Referenced == store.end())
|
if (Referenced == store.end())
|
||||||
{ continue; } // Error message [should be] already printed at loading stage
|
{
|
||||||
|
continue; // Error message [should be] already printed at loading stage
|
||||||
|
}
|
||||||
if (Referenced->second->HasQuestDrop(store, i->group))
|
if (Referenced->second->HasQuestDrop(store, i->group))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (i->needs_quest)
|
else if (i->needs_quest)
|
||||||
{ return true; } // quest drop found
|
{
|
||||||
|
return true; // quest drop found
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now processing groups
|
// Now processing groups
|
||||||
|
|
@ -1357,7 +1381,9 @@ bool LootTemplate::HasQuestDropForPlayer(LootTemplateMap const& store, Player co
|
||||||
if (groupId) // Group reference
|
if (groupId) // Group reference
|
||||||
{
|
{
|
||||||
if (groupId > Groups.size())
|
if (groupId > Groups.size())
|
||||||
{ return false; } // Error message already printed at loading stage
|
{
|
||||||
|
return false; // Error message already printed at loading stage
|
||||||
|
}
|
||||||
return Groups[groupId - 1].HasQuestDropForPlayer(player);
|
return Groups[groupId - 1].HasQuestDropForPlayer(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1368,14 +1394,18 @@ bool LootTemplate::HasQuestDropForPlayer(LootTemplateMap const& store, Player co
|
||||||
{
|
{
|
||||||
LootTemplateMap::const_iterator Referenced = store.find(-i->mincountOrRef);
|
LootTemplateMap::const_iterator Referenced = store.find(-i->mincountOrRef);
|
||||||
if (Referenced == store.end())
|
if (Referenced == store.end())
|
||||||
{ continue; } // Error message already printed at loading stage
|
{
|
||||||
|
continue; // Error message already printed at loading stage
|
||||||
|
}
|
||||||
if (Referenced->second->HasQuestDropForPlayer(store, player, i->group))
|
if (Referenced->second->HasQuestDropForPlayer(store, player, i->group))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (player->HasQuestForItem(i->itemid))
|
else if (player->HasQuestForItem(i->itemid))
|
||||||
{ return true; } // active quest drop found
|
{
|
||||||
|
return true; // active quest drop found
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now checking groups
|
// Now checking groups
|
||||||
|
|
@ -1582,16 +1612,24 @@ void LoadLootTemplates_Milling()
|
||||||
{
|
{
|
||||||
ItemPrototype const* proto = sItemStorage.LookupEntry<ItemPrototype>(i);
|
ItemPrototype const* proto = sItemStorage.LookupEntry<ItemPrototype>(i);
|
||||||
if (!proto)
|
if (!proto)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(proto->Flags & ITEM_FLAG_MILLABLE))
|
if (!(proto->Flags & ITEM_FLAG_MILLABLE))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (ids_set.find(proto->ItemId) != ids_set.end())
|
if (ids_set.find(proto->ItemId) != ids_set.end())
|
||||||
|
{
|
||||||
ids_set.erase(proto->ItemId);
|
ids_set.erase(proto->ItemId);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
LootTemplates_Milling.ReportNotExistedId(proto->ItemId);
|
LootTemplates_Milling.ReportNotExistedId(proto->ItemId);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// output error for any still listed (not referenced from appropriate table) ids
|
// output error for any still listed (not referenced from appropriate table) ids
|
||||||
LootTemplates_Milling.ReportUnusedIds(ids_set);
|
LootTemplates_Milling.ReportUnusedIds(ids_set);
|
||||||
|
|
@ -1639,13 +1677,19 @@ void LoadLootTemplates_Prospecting()
|
||||||
{
|
{
|
||||||
ItemPrototype const* proto = sItemStorage.LookupEntry<ItemPrototype>(i);
|
ItemPrototype const* proto = sItemStorage.LookupEntry<ItemPrototype>(i);
|
||||||
if (!proto)
|
if (!proto)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(proto->Flags & ITEM_FLAG_PROSPECTABLE))
|
if (!(proto->Flags & ITEM_FLAG_PROSPECTABLE))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (ids_set.find(proto->ItemId) != ids_set.end())
|
if (ids_set.find(proto->ItemId) != ids_set.end())
|
||||||
|
{
|
||||||
ids_set.erase(proto->ItemId);
|
ids_set.erase(proto->ItemId);
|
||||||
|
}
|
||||||
// else -- exist some cases that possible can be prospected but not expected have any result loot
|
// else -- exist some cases that possible can be prospected but not expected have any result loot
|
||||||
// LootTemplates_Prospecting.ReportNotExistedId(proto->ItemId);
|
// LootTemplates_Prospecting.ReportNotExistedId(proto->ItemId);
|
||||||
}
|
}
|
||||||
|
|
@ -1713,11 +1757,15 @@ void LoadLootTemplates_Spell()
|
||||||
{
|
{
|
||||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell_id);
|
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell_id);
|
||||||
if (!spellInfo)
|
if (!spellInfo)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// possible cases
|
// possible cases
|
||||||
if (!IsLootCraftingSpell(spellInfo))
|
if (!IsLootCraftingSpell(spellInfo))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (ids_set.find(spell_id) == ids_set.end())
|
if (ids_set.find(spell_id) == ids_set.end())
|
||||||
{
|
{
|
||||||
|
|
@ -1729,8 +1777,10 @@ void LoadLootTemplates_Spell()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
ids_set.erase(spell_id);
|
ids_set.erase(spell_id);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// output error for any still listed (not referenced from appropriate table) ids
|
// output error for any still listed (not referenced from appropriate table) ids
|
||||||
LootTemplates_Spell.ReportUnusedIds(ids_set);
|
LootTemplates_Spell.ReportUnusedIds(ids_set);
|
||||||
|
|
|
||||||
|
|
@ -171,8 +171,10 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c
|
||||||
if (isType(TYPEMASK_UNIT))
|
if (isType(TYPEMASK_UNIT))
|
||||||
{
|
{
|
||||||
if (((Unit*)this)->getVictim())
|
if (((Unit*)this)->getVictim())
|
||||||
|
{
|
||||||
updateFlags |= UPDATEFLAG_HAS_ATTACKING_TARGET;
|
updateFlags |= UPDATEFLAG_HAS_ATTACKING_TARGET;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// DEBUG_LOG("BuildCreateUpdate: update-type: %u, object-type: %u got updateFlags: %X", updatetype, m_objectTypeId, updateFlags);
|
// DEBUG_LOG("BuildCreateUpdate: update-type: %u, object-type: %u got updateFlags: %X", updatetype, m_objectTypeId, updateFlags);
|
||||||
|
|
||||||
|
|
@ -299,7 +301,9 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 updateFlags) const
|
||||||
data->WriteGuidMask<7, 3, 2>(Guid);
|
data->WriteGuidMask<7, 3, 2>(Guid);
|
||||||
|
|
||||||
if (unit->m_movementInfo.GetMovementFlags())
|
if (unit->m_movementInfo.GetMovementFlags())
|
||||||
|
{
|
||||||
data->WriteBits(unit->m_movementInfo.GetMovementFlags(), 30);
|
data->WriteBits(unit->m_movementInfo.GetMovementFlags(), 30);
|
||||||
|
}
|
||||||
|
|
||||||
data->WriteBit(false);
|
data->WriteBit(false);
|
||||||
data->WriteBit(!hasPitch);
|
data->WriteBit(!hasPitch);
|
||||||
|
|
@ -324,20 +328,26 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 updateFlags) const
|
||||||
data->WriteGuidMask<4>(Guid);
|
data->WriteGuidMask<4>(Guid);
|
||||||
|
|
||||||
if (isSplineEnabled)
|
if (isSplineEnabled)
|
||||||
|
{
|
||||||
Movement::PacketBuilder::WriteCreateBits(*unit->movespline, *data);
|
Movement::PacketBuilder::WriteCreateBits(*unit->movespline, *data);
|
||||||
|
}
|
||||||
|
|
||||||
data->WriteGuidMask<6>(Guid);
|
data->WriteGuidMask<6>(Guid);
|
||||||
|
|
||||||
if (hasFallData)
|
if (hasFallData)
|
||||||
|
{
|
||||||
data->WriteBit(hasFallDirection);
|
data->WriteBit(hasFallDirection);
|
||||||
|
}
|
||||||
|
|
||||||
data->WriteGuidMask<0, 1>(Guid);
|
data->WriteGuidMask<0, 1>(Guid);
|
||||||
data->WriteBit(false); // Unknown 4.3.3
|
data->WriteBit(false); // Unknown 4.3.3
|
||||||
data->WriteBit(!unit->m_movementInfo.GetMovementFlags2());
|
data->WriteBit(!unit->m_movementInfo.GetMovementFlags2());
|
||||||
|
|
||||||
if (unit->m_movementInfo.GetMovementFlags2())
|
if (unit->m_movementInfo.GetMovementFlags2())
|
||||||
|
{
|
||||||
data->WriteBits(unit->m_movementInfo.GetMovementFlags2(), 12);
|
data->WriteBits(unit->m_movementInfo.GetMovementFlags2(), 12);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// used only with GO's, placeholder
|
// used only with GO's, placeholder
|
||||||
if (updateFlags & UPDATEFLAG_POSITION)
|
if (updateFlags & UPDATEFLAG_POSITION)
|
||||||
|
|
@ -354,7 +364,9 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 updateFlags) const
|
||||||
{
|
{
|
||||||
ObjectGuid guid;
|
ObjectGuid guid;
|
||||||
if (Unit* victim = ((Unit*)this)->getVictim())
|
if (Unit* victim = ((Unit*)this)->getVictim())
|
||||||
|
{
|
||||||
guid = victim->GetObjectGuid();
|
guid = victim->GetObjectGuid();
|
||||||
|
}
|
||||||
|
|
||||||
data->WriteGuidMask<2, 7, 0, 4, 5, 6, 1, 3>(guid);
|
data->WriteGuidMask<2, 7, 0, 4, 5, 6, 1, 3>(guid);
|
||||||
}
|
}
|
||||||
|
|
@ -392,10 +404,14 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 updateFlags) const
|
||||||
*data << float(unit->GetSpeed(MOVE_SWIM_BACK));
|
*data << float(unit->GetSpeed(MOVE_SWIM_BACK));
|
||||||
|
|
||||||
if (hasElevation)
|
if (hasElevation)
|
||||||
|
{
|
||||||
*data << float(unit->m_movementInfo.GetSplineElevation());
|
*data << float(unit->m_movementInfo.GetSplineElevation());
|
||||||
|
}
|
||||||
|
|
||||||
if (isSplineEnabled)
|
if (isSplineEnabled)
|
||||||
|
{
|
||||||
Movement::PacketBuilder::WriteCreateBytes(*unit->movespline, *data);
|
Movement::PacketBuilder::WriteCreateBytes(*unit->movespline, *data);
|
||||||
|
}
|
||||||
|
|
||||||
*data << float(unit->GetPositionZ());
|
*data << float(unit->GetPositionZ());
|
||||||
data->WriteGuidBytes<5>(Guid);
|
data->WriteGuidBytes<5>(Guid);
|
||||||
|
|
@ -409,7 +425,9 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 updateFlags) const
|
||||||
*data << float(NormalizeOrientation(unit->m_movementInfo.GetTransportPos()->o));
|
*data << float(NormalizeOrientation(unit->m_movementInfo.GetTransportPos()->o));
|
||||||
|
|
||||||
if (hasTransportTime2)
|
if (hasTransportTime2)
|
||||||
|
{
|
||||||
*data << uint32(unit->m_movementInfo.GetTransportTime2());
|
*data << uint32(unit->m_movementInfo.GetTransportTime2());
|
||||||
|
}
|
||||||
|
|
||||||
*data << float(unit->m_movementInfo.GetTransportPos()->y);
|
*data << float(unit->m_movementInfo.GetTransportPos()->y);
|
||||||
*data << float(unit->m_movementInfo.GetTransportPos()->x);
|
*data << float(unit->m_movementInfo.GetTransportPos()->x);
|
||||||
|
|
@ -418,7 +436,9 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 updateFlags) const
|
||||||
data->WriteGuidBytes<0>(tGuid);
|
data->WriteGuidBytes<0>(tGuid);
|
||||||
|
|
||||||
if (hasTransportTime3)
|
if (hasTransportTime3)
|
||||||
|
{
|
||||||
*data << uint32(unit->m_movementInfo.GetFallTime());
|
*data << uint32(unit->m_movementInfo.GetFallTime());
|
||||||
|
}
|
||||||
|
|
||||||
*data << int8(unit->m_movementInfo.GetTransportSeat());
|
*data << int8(unit->m_movementInfo.GetTransportSeat());
|
||||||
data->WriteGuidBytes<1, 6, 2, 4>(tGuid);
|
data->WriteGuidBytes<1, 6, 2, 4>(tGuid);
|
||||||
|
|
@ -439,12 +459,16 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 updateFlags) const
|
||||||
*data << float(unit->GetSpeed(MOVE_TURN_RATE));
|
*data << float(unit->GetSpeed(MOVE_TURN_RATE));
|
||||||
|
|
||||||
if (hasOrientation)
|
if (hasOrientation)
|
||||||
|
{
|
||||||
*data << float(NormalizeOrientation(unit->GetOrientation()));
|
*data << float(NormalizeOrientation(unit->GetOrientation()));
|
||||||
|
}
|
||||||
|
|
||||||
*data << float(unit->GetSpeed(MOVE_RUN));
|
*data << float(unit->GetSpeed(MOVE_RUN));
|
||||||
|
|
||||||
if (hasPitch)
|
if (hasPitch)
|
||||||
|
{
|
||||||
*data << float(unit->m_movementInfo.GetPitch());
|
*data << float(unit->m_movementInfo.GetPitch());
|
||||||
|
}
|
||||||
|
|
||||||
*data << float(unit->GetSpeed(MOVE_FLIGHT));
|
*data << float(unit->GetSpeed(MOVE_FLIGHT));
|
||||||
}
|
}
|
||||||
|
|
@ -462,7 +486,9 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 updateFlags) const
|
||||||
|
|
||||||
data->WriteGuidBytes<0, 5>(transGuid);
|
data->WriteGuidBytes<0, 5>(transGuid);
|
||||||
if (hasTransportTime3)
|
if (hasTransportTime3)
|
||||||
|
{
|
||||||
*data << uint32(0);
|
*data << uint32(0);
|
||||||
|
}
|
||||||
|
|
||||||
data->WriteGuidBytes<3>(transGuid);
|
data->WriteGuidBytes<3>(transGuid);
|
||||||
*data << float(0.0f); // x offset
|
*data << float(0.0f); // x offset
|
||||||
|
|
@ -475,11 +501,15 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 updateFlags) const
|
||||||
*data << float(0.0f); // o offset
|
*data << float(0.0f); // o offset
|
||||||
|
|
||||||
if (hasTransportTime2)
|
if (hasTransportTime2)
|
||||||
|
{
|
||||||
*data << uint32(0);
|
*data << uint32(0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (updateFlags & UPDATEFLAG_ROTATION)
|
if (updateFlags & UPDATEFLAG_ROTATION)
|
||||||
|
{
|
||||||
*data << int64(((GameObject*)this)->GetPackedWorldRotation());
|
*data << int64(((GameObject*)this)->GetPackedWorldRotation());
|
||||||
|
}
|
||||||
|
|
||||||
if (updateFlags & UPDATEFLAG_TRANSPORT_ARR)
|
if (updateFlags & UPDATEFLAG_TRANSPORT_ARR)
|
||||||
{
|
{
|
||||||
|
|
@ -514,13 +544,17 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 updateFlags) const
|
||||||
{
|
{
|
||||||
ObjectGuid guid;
|
ObjectGuid guid;
|
||||||
if (Unit* victim = ((Unit*)this)->getVictim())
|
if (Unit* victim = ((Unit*)this)->getVictim())
|
||||||
|
{
|
||||||
guid = victim->GetObjectGuid();
|
guid = victim->GetObjectGuid();
|
||||||
|
}
|
||||||
|
|
||||||
data->WriteGuidBytes<4, 0, 3, 5, 7, 6, 2, 1>(guid);
|
data->WriteGuidBytes<4, 0, 3, 5, 7, 6, 2, 1>(guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updateFlags & UPDATEFLAG_TRANSPORT)
|
if (updateFlags & UPDATEFLAG_TRANSPORT)
|
||||||
|
{
|
||||||
*data << uint32(WorldTimer::getMSTime());
|
*data << uint32(WorldTimer::getMSTime());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* updateMask, Player* target) const
|
void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* updateMask, Player* target) const
|
||||||
|
|
@ -532,7 +566,9 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* u
|
||||||
|
|
||||||
uint32 valuesCount = m_valuesCount;
|
uint32 valuesCount = m_valuesCount;
|
||||||
if(GetTypeId() == TYPEID_PLAYER && target != this)
|
if(GetTypeId() == TYPEID_PLAYER && target != this)
|
||||||
|
{
|
||||||
valuesCount = PLAYER_END_NOT_SELF;
|
valuesCount = PLAYER_END_NOT_SELF;
|
||||||
|
}
|
||||||
|
|
||||||
bool IsActivateToQuest = false;
|
bool IsActivateToQuest = false;
|
||||||
bool IsPerCasterAuraState = false;
|
bool IsPerCasterAuraState = false;
|
||||||
|
|
@ -598,13 +634,17 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* u
|
||||||
if (GetTypeId() == TYPEID_UNIT)
|
if (GetTypeId() == TYPEID_UNIT)
|
||||||
{
|
{
|
||||||
if (!target->canSeeSpellClickOn((Creature*)this))
|
if (!target->canSeeSpellClickOn((Creature*)this))
|
||||||
|
{
|
||||||
appendValue &= ~UNIT_NPC_FLAG_SPELLCLICK;
|
appendValue &= ~UNIT_NPC_FLAG_SPELLCLICK;
|
||||||
|
}
|
||||||
|
|
||||||
if (appendValue & UNIT_NPC_FLAG_TRAINER)
|
if (appendValue & UNIT_NPC_FLAG_TRAINER)
|
||||||
{
|
{
|
||||||
if (!((Creature*)this)->IsTrainerOf(target, false))
|
if (!((Creature*)this)->IsTrainerOf(target, false))
|
||||||
|
{
|
||||||
appendValue &= ~(UNIT_NPC_FLAG_TRAINER | UNIT_NPC_FLAG_TRAINER_CLASS | UNIT_NPC_FLAG_TRAINER_PROFESSION);
|
appendValue &= ~(UNIT_NPC_FLAG_TRAINER | UNIT_NPC_FLAG_TRAINER_CLASS | UNIT_NPC_FLAG_TRAINER_PROFESSION);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (appendValue & UNIT_NPC_FLAG_STABLEMASTER)
|
if (appendValue & UNIT_NPC_FLAG_STABLEMASTER)
|
||||||
{
|
{
|
||||||
|
|
@ -623,13 +663,19 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* u
|
||||||
{
|
{
|
||||||
// IsPerCasterAuraState set if related pet caster aura state set already
|
// IsPerCasterAuraState set if related pet caster aura state set already
|
||||||
if (((Unit*)this)->HasAuraStateForCaster(AURA_STATE_CONFLAGRATE, target->GetObjectGuid()))
|
if (((Unit*)this)->HasAuraStateForCaster(AURA_STATE_CONFLAGRATE, target->GetObjectGuid()))
|
||||||
|
{
|
||||||
*data << m_uint32Values[index];
|
*data << m_uint32Values[index];
|
||||||
else
|
|
||||||
*data << (m_uint32Values[index] & ~(1 << (AURA_STATE_CONFLAGRATE - 1)));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
*data << (m_uint32Values[index] & ~(1 << (AURA_STATE_CONFLAGRATE - 1)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
*data << m_uint32Values[index];
|
*data << m_uint32Values[index];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// FIXME: Some values at server stored in float format but must be sent to client in uint32 format
|
// FIXME: Some values at server stored in float format but must be sent to client in uint32 format
|
||||||
else if (index >= UNIT_FIELD_BASEATTACKTIME && index <= UNIT_FIELD_RANGEDATTACKTIME)
|
else if (index >= UNIT_FIELD_BASEATTACKTIME && index <= UNIT_FIELD_RANGEDATTACKTIME)
|
||||||
{
|
{
|
||||||
|
|
@ -740,12 +786,18 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* u
|
||||||
else if (index == GAMEOBJECT_BYTES_1)
|
else if (index == GAMEOBJECT_BYTES_1)
|
||||||
{
|
{
|
||||||
if (((GameObject*)this)->GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT)
|
if (((GameObject*)this)->GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT)
|
||||||
|
{
|
||||||
*data << uint32(m_uint32Values[index] | GO_STATE_TRANSPORT_SPEC);
|
*data << uint32(m_uint32Values[index] | GO_STATE_TRANSPORT_SPEC);
|
||||||
else
|
|
||||||
*data << uint32(m_uint32Values[index]);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ *data << m_uint32Values[index]; } // other cases
|
{
|
||||||
|
*data << uint32(m_uint32Values[index]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*data << m_uint32Values[index]; // other cases
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -810,7 +862,9 @@ void Object::_SetUpdateBits(UpdateMask* updateMask, Player* target) const
|
||||||
{
|
{
|
||||||
uint32 valuesCount = m_valuesCount;
|
uint32 valuesCount = m_valuesCount;
|
||||||
if(GetTypeId() == TYPEID_PLAYER && target != this)
|
if(GetTypeId() == TYPEID_PLAYER && target != this)
|
||||||
|
{
|
||||||
valuesCount = PLAYER_END_NOT_SELF;
|
valuesCount = PLAYER_END_NOT_SELF;
|
||||||
|
}
|
||||||
|
|
||||||
for (uint16 index = 0; index < valuesCount; ++index )
|
for (uint16 index = 0; index < valuesCount; ++index )
|
||||||
if (m_changedValues[index])
|
if (m_changedValues[index])
|
||||||
|
|
@ -823,7 +877,9 @@ void Object::_SetCreateBits(UpdateMask* updateMask, Player* target) const
|
||||||
{
|
{
|
||||||
uint32 valuesCount = m_valuesCount;
|
uint32 valuesCount = m_valuesCount;
|
||||||
if(GetTypeId() == TYPEID_PLAYER && target != this)
|
if(GetTypeId() == TYPEID_PLAYER && target != this)
|
||||||
|
{
|
||||||
valuesCount = PLAYER_END_NOT_SELF;
|
valuesCount = PLAYER_END_NOT_SELF;
|
||||||
|
}
|
||||||
|
|
||||||
for (uint16 index = 0; index < valuesCount; ++index)
|
for (uint16 index = 0; index < valuesCount; ++index)
|
||||||
if (GetUInt32Value(index) != 0)
|
if (GetUInt32Value(index) != 0)
|
||||||
|
|
@ -1523,15 +1579,23 @@ void WorldObject::GetRandomPoint(float x, float y, float z, float distance, floa
|
||||||
// angle to face `obj` to `this`
|
// angle to face `obj` to `this`
|
||||||
float angle;
|
float angle;
|
||||||
if (!ori)
|
if (!ori)
|
||||||
|
{
|
||||||
angle = rand_norm_f() * 2 * M_PI_F;
|
angle = rand_norm_f() * 2 * M_PI_F;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
angle = *ori;
|
angle = *ori;
|
||||||
|
}
|
||||||
|
|
||||||
float new_dist;
|
float new_dist;
|
||||||
if (minDist == 0.0f)
|
if (minDist == 0.0f)
|
||||||
|
{
|
||||||
new_dist = rand_norm_f() * distance;
|
new_dist = rand_norm_f() * distance;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
new_dist = minDist + rand_norm_f() * (distance - minDist);
|
new_dist = minDist + rand_norm_f() * (distance - minDist);
|
||||||
|
}
|
||||||
|
|
||||||
rand_x = x + new_dist * cos(angle);
|
rand_x = x + new_dist * cos(angle);
|
||||||
rand_y = y + new_dist * sin(angle);
|
rand_y = y + new_dist * sin(angle);
|
||||||
|
|
@ -1546,7 +1610,9 @@ void WorldObject::UpdateGroundPositionZ(float x, float y, float& z) const
|
||||||
{
|
{
|
||||||
float new_z = GetMap()->GetHeight(GetPhaseMask(), x, y, z);
|
float new_z = GetMap()->GetHeight(GetPhaseMask(), x, y, z);
|
||||||
if (new_z > INVALID_HEIGHT)
|
if (new_z > INVALID_HEIGHT)
|
||||||
{ z = new_z + 0.05f; } // just to be sure that we are not a few pixel under the surface
|
{
|
||||||
|
z = new_z + 0.05f; // just to be sure that we are not a few pixel under the surface
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z, Map* atMap /*=NULL*/) const
|
void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z, Map* atMap /*=NULL*/) const
|
||||||
|
|
@ -1614,8 +1680,10 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z, Map* atMap
|
||||||
{
|
{
|
||||||
float ground_z = atMap->GetHeight(GetPhaseMask(), x, y, z);
|
float ground_z = atMap->GetHeight(GetPhaseMask(), x, y, z);
|
||||||
if (z < ground_z)
|
if (z < ground_z)
|
||||||
|
{
|
||||||
z = ground_z;
|
z = ground_z;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
@ -1894,7 +1962,9 @@ Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, floa
|
||||||
|
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
if (Unit* summoner = ToUnit())
|
if (Unit* summoner = ToUnit())
|
||||||
|
{
|
||||||
sEluna->OnSummoned(pCreature, summoner);
|
sEluna->OnSummoned(pCreature, summoner);
|
||||||
|
}
|
||||||
#endif /* ENABLE_ELUNA */
|
#endif /* ENABLE_ELUNA */
|
||||||
|
|
||||||
// Creature Linking, Initial load is handled like respawn
|
// Creature Linking, Initial load is handled like respawn
|
||||||
|
|
@ -2045,7 +2115,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
||||||
if (!sWorld.getConfig(CONFIG_BOOL_DETECT_POS_COLLISION))
|
if (!sWorld.getConfig(CONFIG_BOOL_DETECT_POS_COLLISION))
|
||||||
{
|
{
|
||||||
if (searcher)
|
if (searcher)
|
||||||
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
|
{
|
||||||
|
searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); // update to LOS height if available
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UpdateGroundPositionZ(x, y, z);
|
UpdateGroundPositionZ(x, y, z);
|
||||||
|
|
@ -2075,7 +2147,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
||||||
if (selector.CheckOriginalAngle())
|
if (selector.CheckOriginalAngle())
|
||||||
{
|
{
|
||||||
if (searcher)
|
if (searcher)
|
||||||
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
|
{
|
||||||
|
searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); // update to LOS height if available
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UpdateGroundPositionZ(x, y, z);
|
UpdateGroundPositionZ(x, y, z);
|
||||||
|
|
@ -2101,7 +2175,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
||||||
z = GetPositionZ();
|
z = GetPositionZ();
|
||||||
|
|
||||||
if (searcher)
|
if (searcher)
|
||||||
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
|
{
|
||||||
|
searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); // update to LOS height if available
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UpdateGroundPositionZ(x, y, z);
|
UpdateGroundPositionZ(x, y, z);
|
||||||
|
|
@ -2121,7 +2197,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
||||||
y = first_y;
|
y = first_y;
|
||||||
|
|
||||||
if (searcher)
|
if (searcher)
|
||||||
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
|
{
|
||||||
|
searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); // update to LOS height if available
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UpdateGroundPositionZ(x, y, z);
|
UpdateGroundPositionZ(x, y, z);
|
||||||
|
|
@ -2139,7 +2217,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
||||||
z = GetPositionZ();
|
z = GetPositionZ();
|
||||||
|
|
||||||
if (searcher)
|
if (searcher)
|
||||||
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
|
{
|
||||||
|
searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); // update to LOS height if available
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UpdateGroundPositionZ(x, y, z);
|
UpdateGroundPositionZ(x, y, z);
|
||||||
|
|
@ -2156,7 +2236,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
||||||
y = first_y;
|
y = first_y;
|
||||||
|
|
||||||
if (searcher)
|
if (searcher)
|
||||||
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
|
{
|
||||||
|
searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); // update to LOS height if available
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UpdateGroundPositionZ(x, y, z);
|
UpdateGroundPositionZ(x, y, z);
|
||||||
|
|
@ -2168,7 +2250,9 @@ void WorldObject::SetPhaseMask(uint32 newPhaseMask, bool update)
|
||||||
m_phaseMask = newPhaseMask;
|
m_phaseMask = newPhaseMask;
|
||||||
|
|
||||||
if (update && IsInWorld())
|
if (update && IsInWorld())
|
||||||
|
{
|
||||||
UpdateVisibilityAndView();
|
UpdateVisibilityAndView();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldObject::PlayDistanceSound(uint32 sound_id, Player const* target /*= NULL*/) const
|
void WorldObject::PlayDistanceSound(uint32 sound_id, Player const* target /*= NULL*/) const
|
||||||
|
|
|
||||||
|
|
@ -539,9 +539,13 @@ class WorldObject : public Object
|
||||||
float GetPositionY() const { return m_position.y; }
|
float GetPositionY() const { return m_position.y; }
|
||||||
float GetPositionZ() const { return m_position.z; }
|
float GetPositionZ() const { return m_position.z; }
|
||||||
void GetPosition(float& x, float& y, float& z) const
|
void GetPosition(float& x, float& y, float& z) const
|
||||||
{ x = m_position.x; y = m_position.y; z = m_position.z; }
|
{
|
||||||
|
x = m_position.x; y = m_position.y; z = m_position.z;
|
||||||
|
}
|
||||||
void GetPosition(WorldLocation& loc) const
|
void GetPosition(WorldLocation& loc) const
|
||||||
{ loc.mapid = m_mapId; GetPosition(loc.coord_x, loc.coord_y, loc.coord_z); loc.orientation = GetOrientation(); }
|
{
|
||||||
|
loc.mapid = m_mapId; GetPosition(loc.coord_x, loc.coord_y, loc.coord_z); loc.orientation = GetOrientation();
|
||||||
|
}
|
||||||
float GetOrientation() const { return m_position.o; }
|
float GetOrientation() const { return m_position.o; }
|
||||||
|
|
||||||
/// Gives a 2d-point in distance distance2d in direction absAngle around the current position (point-to-point)
|
/// Gives a 2d-point in distance distance2d in direction absAngle around the current position (point-to-point)
|
||||||
|
|
|
||||||
|
|
@ -25,11 +25,11 @@
|
||||||
#ifndef MANGOS_OBJECT_GUID_H
|
#ifndef MANGOS_OBJECT_GUID_H
|
||||||
#define MANGOS_OBJECT_GUID_H
|
#define MANGOS_OBJECT_GUID_H
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "ByteBuffer.h"
|
#include "ByteBuffer.h"
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
enum TypeID
|
enum TypeID
|
||||||
{
|
{
|
||||||
TYPEID_OBJECT = 0,
|
TYPEID_OBJECT = 0,
|
||||||
|
|
@ -343,7 +343,9 @@ HASH_NAMESPACE_END
|
||||||
{ \
|
{ \
|
||||||
uint8 maskArr[] = { T2 }; \
|
uint8 maskArr[] = { T2 }; \
|
||||||
for (uint8 i = 0; i < countof(maskArr); ++i) \
|
for (uint8 i = 0; i < countof(maskArr); ++i) \
|
||||||
|
{ \
|
||||||
guid[maskArr[i]] = ReadBit(); \
|
guid[maskArr[i]] = ReadBit(); \
|
||||||
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DEFINE_WRITEGUIDMASK(T1, T2) template <T1> \
|
#define DEFINE_WRITEGUIDMASK(T1, T2) template <T1> \
|
||||||
|
|
@ -351,7 +353,9 @@ HASH_NAMESPACE_END
|
||||||
{ \
|
{ \
|
||||||
uint8 maskArr[] = { T2 }; \
|
uint8 maskArr[] = { T2 }; \
|
||||||
for (uint8 i = 0; i < countof(maskArr); ++i) \
|
for (uint8 i = 0; i < countof(maskArr); ++i) \
|
||||||
|
{ \
|
||||||
WriteBit(guid[maskArr[i]]); \
|
WriteBit(guid[maskArr[i]]); \
|
||||||
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DEFINE_READGUIDBYTES(T1, T2) template <T1> \
|
#define DEFINE_READGUIDBYTES(T1, T2) template <T1> \
|
||||||
|
|
@ -360,7 +364,9 @@ HASH_NAMESPACE_END
|
||||||
uint8 maskArr[] = { T2 }; \
|
uint8 maskArr[] = { T2 }; \
|
||||||
for (uint8 i = 0; i < countof(maskArr); ++i) \
|
for (uint8 i = 0; i < countof(maskArr); ++i) \
|
||||||
if (guid[maskArr[i]] != 0) \
|
if (guid[maskArr[i]] != 0) \
|
||||||
|
{ \
|
||||||
guid[maskArr[i]] ^= read<uint8>(); \
|
guid[maskArr[i]] ^= read<uint8>(); \
|
||||||
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DEFINE_WRITEGUIDBYTES(T1, T2) template <T1> \
|
#define DEFINE_WRITEGUIDBYTES(T1, T2) template <T1> \
|
||||||
|
|
@ -369,7 +375,9 @@ HASH_NAMESPACE_END
|
||||||
uint8 maskArr[] = { T2 }; \
|
uint8 maskArr[] = { T2 }; \
|
||||||
for (uint8 i = 0; i < countof(maskArr); ++i) \
|
for (uint8 i = 0; i < countof(maskArr); ++i) \
|
||||||
if (guid[maskArr[i]] != 0) \
|
if (guid[maskArr[i]] != 0) \
|
||||||
|
{ \
|
||||||
(*this) << uint8(guid[maskArr[i]] ^ 1); \
|
(*this) << uint8(guid[maskArr[i]] ^ 1); \
|
||||||
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_READGUIDMASK(BITS_1, BIT_VALS_1)
|
DEFINE_READGUIDMASK(BITS_1, BIT_VALS_1)
|
||||||
|
|
|
||||||
|
|
@ -541,7 +541,9 @@ void ObjectMgr::LoadCreatureTemplates()
|
||||||
for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1 && ok; ++diff)
|
for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1 && ok; ++diff)
|
||||||
{
|
{
|
||||||
if (!cInfo->DifficultyEntry[diff])
|
if (!cInfo->DifficultyEntry[diff])
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
ok = false; // will be set to true at the end of this loop again
|
ok = false; // will be set to true at the end of this loop again
|
||||||
|
|
||||||
CreatureInfo const* difficultyInfo = GetCreatureTemplate(cInfo->DifficultyEntry[diff]);
|
CreatureInfo const* difficultyInfo = GetCreatureTemplate(cInfo->DifficultyEntry[diff]);
|
||||||
|
|
@ -577,7 +579,9 @@ void ObjectMgr::LoadCreatureTemplates()
|
||||||
ok2 = true;
|
ok2 = true;
|
||||||
}
|
}
|
||||||
if (!ok2)
|
if (!ok2)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (cInfo->UnitClass != difficultyInfo->UnitClass)
|
if (cInfo->UnitClass != difficultyInfo->UnitClass)
|
||||||
{
|
{
|
||||||
|
|
@ -635,7 +639,9 @@ void ObjectMgr::LoadCreatureTemplates()
|
||||||
ok = true;
|
ok = true;
|
||||||
}
|
}
|
||||||
if (!ok)
|
if (!ok)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->FactionAlliance);
|
FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->FactionAlliance);
|
||||||
if (!factionTemplate)
|
if (!factionTemplate)
|
||||||
|
|
@ -688,7 +694,9 @@ void ObjectMgr::LoadCreatureTemplates()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!displayScaleEntry)
|
if (!displayScaleEntry)
|
||||||
|
{
|
||||||
sLog.outErrorDb("Creature (Entry: %u) has nonexistent modelid in modelid_1/modelid_2/modelid_3/modelid_4", cInfo->Entry);
|
sLog.outErrorDb("Creature (Entry: %u) has nonexistent modelid in modelid_1/modelid_2/modelid_3/modelid_4", cInfo->Entry);
|
||||||
|
}
|
||||||
|
|
||||||
if (!cInfo->MinLevel)
|
if (!cInfo->MinLevel)
|
||||||
{
|
{
|
||||||
|
|
@ -748,10 +756,14 @@ void ObjectMgr::LoadCreatureTemplates()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cInfo->MeleeAttackPower == 0)
|
if (cInfo->MeleeAttackPower == 0)
|
||||||
|
{
|
||||||
const_cast<CreatureInfo*>(cInfo)->MeleeAttackPower = BASE_ATTACK_TIME;
|
const_cast<CreatureInfo*>(cInfo)->MeleeAttackPower = BASE_ATTACK_TIME;
|
||||||
|
}
|
||||||
|
|
||||||
if (cInfo->RangedAttackPower == 0)
|
if (cInfo->RangedAttackPower == 0)
|
||||||
|
{
|
||||||
const_cast<CreatureInfo*>(cInfo)->RangedAttackPower = BASE_ATTACK_TIME;
|
const_cast<CreatureInfo*>(cInfo)->RangedAttackPower = BASE_ATTACK_TIME;
|
||||||
|
}
|
||||||
|
|
||||||
if (cInfo->NpcFlags & UNIT_NPC_FLAG_SPELLCLICK)
|
if (cInfo->NpcFlags & UNIT_NPC_FLAG_SPELLCLICK)
|
||||||
{
|
{
|
||||||
|
|
@ -816,8 +828,10 @@ void ObjectMgr::LoadCreatureTemplates()
|
||||||
if (cInfo->VendorTemplateId > 0)
|
if (cInfo->VendorTemplateId > 0)
|
||||||
{
|
{
|
||||||
if (!(cInfo->NpcFlags & UNIT_NPC_FLAG_VENDOR))
|
if (!(cInfo->NpcFlags & UNIT_NPC_FLAG_VENDOR))
|
||||||
|
{
|
||||||
sLog.outErrorDb("Table `creature_template` have creature (Entry: %u) with VendorTemplateId %u but not have flag UNIT_NPC_FLAG_VENDOR (%u), vendor items will ignored.", cInfo->Entry, cInfo->VendorTemplateId, UNIT_NPC_FLAG_VENDOR);
|
sLog.outErrorDb("Table `creature_template` have creature (Entry: %u) with VendorTemplateId %u but not have flag UNIT_NPC_FLAG_VENDOR (%u), vendor items will ignored.", cInfo->Entry, cInfo->VendorTemplateId, UNIT_NPC_FLAG_VENDOR);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// if not set custom creature scale then load scale from CreatureDisplayInfo.dbc
|
/// if not set custom creature scale then load scale from CreatureDisplayInfo.dbc
|
||||||
if (cInfo->Scale <= 0.0f)
|
if (cInfo->Scale <= 0.0f)
|
||||||
|
|
@ -1170,7 +1184,9 @@ uint32 ObjectMgr::GetModelForRace(uint32 sourceModelId, uint32 racemask)
|
||||||
for (CreatureModelRaceMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
for (CreatureModelRaceMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||||
{
|
{
|
||||||
if (!(itr->second.racemask & racemask))
|
if (!(itr->second.racemask & racemask))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (itr->second.creature_entry)
|
if (itr->second.creature_entry)
|
||||||
{
|
{
|
||||||
|
|
@ -1468,7 +1484,9 @@ void ObjectMgr::LoadCreatures()
|
||||||
if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
|
if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
|
||||||
for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1; ++diff)
|
for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1; ++diff)
|
||||||
if (cInfo->DifficultyEntry[diff])
|
if (cInfo->DifficultyEntry[diff])
|
||||||
|
{
|
||||||
difficultyCreatures[diff].insert(cInfo->DifficultyEntry[diff]);
|
difficultyCreatures[diff].insert(cInfo->DifficultyEntry[diff]);
|
||||||
|
}
|
||||||
|
|
||||||
// build single time for check spawnmask
|
// build single time for check spawnmask
|
||||||
std::map<uint32, uint32> spawnMasks;
|
std::map<uint32, uint32> spawnMasks;
|
||||||
|
|
@ -1476,7 +1494,9 @@ void ObjectMgr::LoadCreatures()
|
||||||
if (sMapStore.LookupEntry(i))
|
if (sMapStore.LookupEntry(i))
|
||||||
for (int k = 0; k < MAX_DIFFICULTY; ++k)
|
for (int k = 0; k < MAX_DIFFICULTY; ++k)
|
||||||
if (GetMapDifficultyData(i, Difficulty(k)))
|
if (GetMapDifficultyData(i, Difficulty(k)))
|
||||||
|
{
|
||||||
spawnMasks[i] |= (1 << k);
|
spawnMasks[i] |= (1 << k);
|
||||||
|
}
|
||||||
// Map 0 was removed from dbc as of 4.x.x
|
// Map 0 was removed from dbc as of 4.x.x
|
||||||
spawnMasks[0] = 1 << REGULAR_DIFFICULTY;
|
spawnMasks[0] = 1 << REGULAR_DIFFICULTY;
|
||||||
|
|
||||||
|
|
@ -1547,7 +1567,9 @@ void ObjectMgr::LoadCreatures()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!ok)
|
if (!ok)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (data.modelid_override > 0 && !sCreatureDisplayInfoStore.LookupEntry(data.modelid_override))
|
if (data.modelid_override > 0 && !sCreatureDisplayInfoStore.LookupEntry(data.modelid_override))
|
||||||
{
|
{
|
||||||
|
|
@ -1623,8 +1645,10 @@ void ObjectMgr::LoadCreatures()
|
||||||
AddCreatureToGrid(guid, &data);
|
AddCreatureToGrid(guid, &data);
|
||||||
|
|
||||||
if (cInfo->ExtraFlags & CREATURE_EXTRA_FLAG_ACTIVE)
|
if (cInfo->ExtraFlags & CREATURE_EXTRA_FLAG_ACTIVE)
|
||||||
|
{
|
||||||
m_activeCreatures.insert(ActiveCreatureGuidsOnMap::value_type(data.mapid, guid));
|
m_activeCreatures.insert(ActiveCreatureGuidsOnMap::value_type(data.mapid, guid));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
|
|
@ -1700,7 +1724,9 @@ void ObjectMgr::LoadGameObjects()
|
||||||
if (sMapStore.LookupEntry(i))
|
if (sMapStore.LookupEntry(i))
|
||||||
for (int k = 0; k < MAX_DIFFICULTY; ++k)
|
for (int k = 0; k < MAX_DIFFICULTY; ++k)
|
||||||
if (GetMapDifficultyData(i, Difficulty(k)))
|
if (GetMapDifficultyData(i, Difficulty(k)))
|
||||||
|
{
|
||||||
spawnMasks[i] |= (1 << k);
|
spawnMasks[i] |= (1 << k);
|
||||||
|
}
|
||||||
// Map 0 was removed from dbc as of 4.x.x
|
// Map 0 was removed from dbc as of 4.x.x
|
||||||
spawnMasks[0] = 1 << REGULAR_DIFFICULTY;
|
spawnMasks[0] = 1 << REGULAR_DIFFICULTY;
|
||||||
|
|
||||||
|
|
@ -1826,7 +1852,9 @@ void ObjectMgr::LoadGameObjects()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gameEvent == 0 && GuidPoolId == 0 && EntryPoolId == 0) // if not this is to be managed by GameEvent System or Pool system
|
if (gameEvent == 0 && GuidPoolId == 0 && EntryPoolId == 0) // if not this is to be managed by GameEvent System or Pool system
|
||||||
|
{
|
||||||
AddGameobjectToGrid(guid, &data);
|
AddGameobjectToGrid(guid, &data);
|
||||||
|
}
|
||||||
|
|
||||||
//uint32 zoneId, areaId;
|
//uint32 zoneId, areaId;
|
||||||
//sTerrainMgr.LoadTerrain(data.mapid)->GetZoneAndAreaId(zoneId, areaId, data.posX, data.posY, data.posZ);
|
//sTerrainMgr.LoadTerrain(data.mapid)->GetZoneAndAreaId(zoneId, areaId, data.posX, data.posY, data.posZ);
|
||||||
|
|
@ -1853,7 +1881,9 @@ void ObjectMgr::LoadGameObjectAddon()
|
||||||
{
|
{
|
||||||
GameObjectDataAddon const* addon = sGameObjectDataAddonStorage.LookupEntry<GameObjectDataAddon>(i);
|
GameObjectDataAddon const* addon = sGameObjectDataAddonStorage.LookupEntry<GameObjectDataAddon>(i);
|
||||||
if (!addon)
|
if (!addon)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!GetGODataPair(addon->guid))
|
if (!GetGODataPair(addon->guid))
|
||||||
{
|
{
|
||||||
|
|
@ -2104,7 +2134,9 @@ void ObjectMgr::LoadItemPrototypes()
|
||||||
{
|
{
|
||||||
/* to many errors, and possible not all items really used in game
|
/* to many errors, and possible not all items really used in game
|
||||||
if (dbcitem)
|
if (dbcitem)
|
||||||
|
{
|
||||||
sLog.outErrorDb("Item (Entry: %u) doesn't exists in DB, but must exist.",i);
|
sLog.outErrorDb("Item (Entry: %u) doesn't exists in DB, but must exist.",i);
|
||||||
|
}
|
||||||
*/
|
*/
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -2297,7 +2329,9 @@ void ObjectMgr::LoadItemPrototypes()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (proto->RequiredReputationRank > MIN_REPUTATION_RANK)
|
else if (proto->RequiredReputationRank > MIN_REPUTATION_RANK)
|
||||||
|
{
|
||||||
sLog.outErrorDb("Item (Entry: %u) has RequiredReputationFaction ==0 but RequiredReputationRank > 0, rank setting is useless.", i);
|
sLog.outErrorDb("Item (Entry: %u) has RequiredReputationFaction ==0 but RequiredReputationRank > 0, rank setting is useless.", i);
|
||||||
|
}
|
||||||
|
|
||||||
if (proto->MaxCount < -1)
|
if (proto->MaxCount < -1)
|
||||||
{
|
{
|
||||||
|
|
@ -2464,8 +2498,10 @@ void ObjectMgr::LoadItemPrototypes()
|
||||||
else if (proto->Spells[j].SpellTrigger == ITEM_SPELLTRIGGER_CHANCE_ON_HIT)
|
else if (proto->Spells[j].SpellTrigger == ITEM_SPELLTRIGGER_CHANCE_ON_HIT)
|
||||||
{
|
{
|
||||||
if (proto->Class != ITEM_CLASS_WEAPON)
|
if (proto->Class != ITEM_CLASS_WEAPON)
|
||||||
|
{
|
||||||
sLog.outErrorDb("Item (Entry: %u) isn't weapon (Class: %u) but has on hit spelltrigger_%d (%u), it will not triggered.", i, proto->Class, j + 1, proto->Spells[j].SpellTrigger);
|
sLog.outErrorDb("Item (Entry: %u) isn't weapon (Class: %u) but has on hit spelltrigger_%d (%u), it will not triggered.", i, proto->Class, j + 1, proto->Spells[j].SpellTrigger);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (proto->Spells[j].SpellId)
|
if (proto->Spells[j].SpellId)
|
||||||
{
|
{
|
||||||
|
|
@ -2552,7 +2588,9 @@ void ObjectMgr::LoadItemPrototypes()
|
||||||
{
|
{
|
||||||
uint32 mask = 1 << j;
|
uint32 mask = 1 << j;
|
||||||
if (!(proto->BagFamily & mask))
|
if (!(proto->BagFamily & mask))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
ItemBagFamilyEntry const* bf = sItemBagFamilyStore.LookupEntry(j + 1);
|
ItemBagFamilyEntry const* bf = sItemBagFamilyStore.LookupEntry(j + 1);
|
||||||
if (!bf)
|
if (!bf)
|
||||||
|
|
@ -2575,7 +2613,9 @@ void ObjectMgr::LoadItemPrototypes()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (proto->TotemCategory && !sTotemCategoryStore.LookupEntry(proto->TotemCategory))
|
if (proto->TotemCategory && !sTotemCategoryStore.LookupEntry(proto->TotemCategory))
|
||||||
|
{
|
||||||
sLog.outErrorDb("Item (Entry: %u) has wrong TotemCategory (%u)", i, proto->TotemCategory);
|
sLog.outErrorDb("Item (Entry: %u) has wrong TotemCategory (%u)", i, proto->TotemCategory);
|
||||||
|
}
|
||||||
|
|
||||||
for (int j = 0; j < MAX_ITEM_PROTO_SOCKETS; ++j)
|
for (int j = 0; j < MAX_ITEM_PROTO_SOCKETS; ++j)
|
||||||
{
|
{
|
||||||
|
|
@ -2587,7 +2627,9 @@ void ObjectMgr::LoadItemPrototypes()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (proto->GemProperties && !sGemPropertiesStore.LookupEntry(proto->GemProperties))
|
if (proto->GemProperties && !sGemPropertiesStore.LookupEntry(proto->GemProperties))
|
||||||
|
{
|
||||||
sLog.outErrorDb("Item (Entry: %u) has wrong GemProperties (%u)", i, proto->GemProperties);
|
sLog.outErrorDb("Item (Entry: %u) has wrong GemProperties (%u)", i, proto->GemProperties);
|
||||||
|
}
|
||||||
|
|
||||||
if (proto->RequiredDisenchantSkill < -1)
|
if (proto->RequiredDisenchantSkill < -1)
|
||||||
{
|
{
|
||||||
|
|
@ -2633,8 +2675,10 @@ void ObjectMgr::LoadItemPrototypes()
|
||||||
{
|
{
|
||||||
// lot DB cases
|
// lot DB cases
|
||||||
if (proto->RequiredDisenchantSkill >= 0)
|
if (proto->RequiredDisenchantSkill >= 0)
|
||||||
|
{
|
||||||
ERROR_DB_STRICT_LOG("Item (Entry: %u) marked as disenchantable by RequiredDisenchantSkill, but not have disenchanting loot id.", i);
|
ERROR_DB_STRICT_LOG("Item (Entry: %u) marked as disenchantable by RequiredDisenchantSkill, but not have disenchanting loot id.", i);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (proto->FoodType >= MAX_PET_DIET)
|
if (proto->FoodType >= MAX_PET_DIET)
|
||||||
{
|
{
|
||||||
|
|
@ -2907,7 +2951,9 @@ void ObjectMgr::LoadItemRequiredTarget()
|
||||||
{
|
{
|
||||||
SpellEffectEntry const* spellEffect = pSpellInfo->GetSpellEffect(SpellEffectIndex(j));
|
SpellEffectEntry const* spellEffect = pSpellInfo->GetSpellEffect(SpellEffectIndex(j));
|
||||||
if(!spellEffect)
|
if(!spellEffect)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (spellEffect->EffectImplicitTargetA == TARGET_CHAIN_DAMAGE ||
|
if (spellEffect->EffectImplicitTargetA == TARGET_CHAIN_DAMAGE ||
|
||||||
spellEffect->EffectImplicitTargetB == TARGET_CHAIN_DAMAGE ||
|
spellEffect->EffectImplicitTargetB == TARGET_CHAIN_DAMAGE ||
|
||||||
|
|
@ -3480,19 +3526,27 @@ void ObjectMgr::LoadPlayerInfo()
|
||||||
|
|
||||||
// skip expansion races if not playing with expansion
|
// skip expansion races if not playing with expansion
|
||||||
if (sWorld.getConfig(CONFIG_UINT32_EXPANSION) < EXPANSION_TBC && (race == RACE_BLOODELF || race == RACE_DRAENEI))
|
if (sWorld.getConfig(CONFIG_UINT32_EXPANSION) < EXPANSION_TBC && (race == RACE_BLOODELF || race == RACE_DRAENEI))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// skip expansion classes if not playing with expansion
|
// skip expansion classes if not playing with expansion
|
||||||
if (sWorld.getConfig(CONFIG_UINT32_EXPANSION) < EXPANSION_WOTLK && class_ == CLASS_DEATH_KNIGHT)
|
if (sWorld.getConfig(CONFIG_UINT32_EXPANSION) < EXPANSION_WOTLK && class_ == CLASS_DEATH_KNIGHT)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// skip expansion races if not playing with expansion
|
// skip expansion races if not playing with expansion
|
||||||
if (sWorld.getConfig(CONFIG_UINT32_EXPANSION) < EXPANSION_CATA && (race == RACE_WORGEN || race == RACE_GOBLIN))
|
if (sWorld.getConfig(CONFIG_UINT32_EXPANSION) < EXPANSION_CATA && (race == RACE_WORGEN || race == RACE_GOBLIN))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// skip expansion classes / races if not playing with expansion
|
// skip expansion classes / races if not playing with expansion
|
||||||
if (sWorld.getConfig(CONFIG_UINT32_EXPANSION) < EXPANSION_MOP && (class_ == CLASS_MONK || race == RACE_PANDAREN_NEUTRAL || race == RACE_PANDAREN_ALLI || race == RACE_PANDAREN_HORDE))
|
if (sWorld.getConfig(CONFIG_UINT32_EXPANSION) < EXPANSION_MOP && (class_ == CLASS_MONK || race == RACE_PANDAREN_NEUTRAL || race == RACE_PANDAREN_ALLI || race == RACE_PANDAREN_HORDE))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// fatal error if no level 1 data
|
// fatal error if no level 1 data
|
||||||
if (!pInfo->levelInfo || pInfo->levelInfo[0].stats[0] == 0)
|
if (!pInfo->levelInfo || pInfo->levelInfo[0].stats[0] == 0)
|
||||||
|
|
@ -4076,7 +4130,9 @@ void ObjectMgr::LoadQuests()
|
||||||
{
|
{
|
||||||
// skip post-loading checks for disabled quests
|
// skip post-loading checks for disabled quests
|
||||||
if (DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, iter->first))
|
if (DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, iter->first))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Quest* qinfo = iter->second;
|
Quest* qinfo = iter->second;
|
||||||
|
|
||||||
|
|
@ -4374,7 +4430,9 @@ void ObjectMgr::LoadQuests()
|
||||||
{
|
{
|
||||||
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(SpellEffectIndex(k));
|
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(SpellEffectIndex(k));
|
||||||
if(!spellEffect)
|
if(!spellEffect)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ((spellEffect->Effect == SPELL_EFFECT_QUEST_COMPLETE && uint32(spellEffect->EffectMiscValue) == qinfo->QuestId) ||
|
if ((spellEffect->Effect == SPELL_EFFECT_QUEST_COMPLETE && uint32(spellEffect->EffectMiscValue) == qinfo->QuestId) ||
|
||||||
spellEffect->Effect == SPELL_EFFECT_SEND_EVENT)
|
spellEffect->Effect == SPELL_EFFECT_SEND_EVENT)
|
||||||
|
|
@ -4512,7 +4570,9 @@ void ObjectMgr::LoadQuests()
|
||||||
if (qinfo->RewRepFaction[j])
|
if (qinfo->RewRepFaction[j])
|
||||||
{
|
{
|
||||||
if (abs(qinfo->RewRepValueId[j]) > 9)
|
if (abs(qinfo->RewRepValueId[j]) > 9)
|
||||||
|
{
|
||||||
sLog.outErrorDb("Quest %u has RewRepValueId%d = %i but value is not valid.", qinfo->GetQuestId(), j + 1, qinfo->RewRepValueId[j]);
|
sLog.outErrorDb("Quest %u has RewRepValueId%d = %i but value is not valid.", qinfo->GetQuestId(), j + 1, qinfo->RewRepValueId[j]);
|
||||||
|
}
|
||||||
|
|
||||||
if (!sFactionStore.LookupEntry(qinfo->RewRepFaction[j]))
|
if (!sFactionStore.LookupEntry(qinfo->RewRepFaction[j]))
|
||||||
{
|
{
|
||||||
|
|
@ -4806,7 +4866,9 @@ void ObjectMgr::LoadQuests()
|
||||||
{
|
{
|
||||||
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(SpellEffectIndex(j));
|
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(SpellEffectIndex(j));
|
||||||
if(!spellEffect)
|
if(!spellEffect)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
if (spellEffect->Effect != SPELL_EFFECT_QUEST_COMPLETE)
|
if (spellEffect->Effect != SPELL_EFFECT_QUEST_COMPLETE)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -4975,7 +5037,9 @@ void ObjectMgr::LoadQuestLocales()
|
||||||
if (idx >= 0)
|
if (idx >= 0)
|
||||||
{
|
{
|
||||||
if ((int32)data.CompletedText.size() <= idx)
|
if ((int32)data.CompletedText.size() <= idx)
|
||||||
|
{
|
||||||
data.CompletedText.resize(idx + 1);
|
data.CompletedText.resize(idx + 1);
|
||||||
|
}
|
||||||
|
|
||||||
data.CompletedText[idx] = str;
|
data.CompletedText[idx] = str;
|
||||||
}
|
}
|
||||||
|
|
@ -5004,7 +5068,9 @@ void ObjectMgr::LoadQuestLocales()
|
||||||
if (idx >= 0)
|
if (idx >= 0)
|
||||||
{
|
{
|
||||||
if ((int32)data.PortraitGiverName.size() <= idx)
|
if ((int32)data.PortraitGiverName.size() <= idx)
|
||||||
|
{
|
||||||
data.PortraitGiverName.resize(idx + 1);
|
data.PortraitGiverName.resize(idx + 1);
|
||||||
|
}
|
||||||
|
|
||||||
data.PortraitGiverName[idx] = str;
|
data.PortraitGiverName[idx] = str;
|
||||||
}
|
}
|
||||||
|
|
@ -5016,7 +5082,9 @@ void ObjectMgr::LoadQuestLocales()
|
||||||
if (idx >= 0)
|
if (idx >= 0)
|
||||||
{
|
{
|
||||||
if ((int32)data.PortraitGiverText.size() <= idx)
|
if ((int32)data.PortraitGiverText.size() <= idx)
|
||||||
|
{
|
||||||
data.PortraitGiverText.resize(idx + 1);
|
data.PortraitGiverText.resize(idx + 1);
|
||||||
|
}
|
||||||
|
|
||||||
data.PortraitGiverText[idx] = str;
|
data.PortraitGiverText[idx] = str;
|
||||||
}
|
}
|
||||||
|
|
@ -5028,7 +5096,9 @@ void ObjectMgr::LoadQuestLocales()
|
||||||
if (idx >= 0)
|
if (idx >= 0)
|
||||||
{
|
{
|
||||||
if ((int32)data.PortraitTurnInName.size() <= idx)
|
if ((int32)data.PortraitTurnInName.size() <= idx)
|
||||||
|
{
|
||||||
data.PortraitTurnInName.resize(idx + 1);
|
data.PortraitTurnInName.resize(idx + 1);
|
||||||
|
}
|
||||||
|
|
||||||
data.PortraitTurnInName[idx] = str;
|
data.PortraitTurnInName[idx] = str;
|
||||||
}
|
}
|
||||||
|
|
@ -5040,7 +5110,9 @@ void ObjectMgr::LoadQuestLocales()
|
||||||
if (idx >= 0)
|
if (idx >= 0)
|
||||||
{
|
{
|
||||||
if ((int32)data.PortraitTurnInText.size() <= idx)
|
if ((int32)data.PortraitTurnInText.size() <= idx)
|
||||||
|
{
|
||||||
data.PortraitTurnInText.resize(idx + 1);
|
data.PortraitTurnInText.resize(idx + 1);
|
||||||
|
}
|
||||||
|
|
||||||
data.PortraitTurnInText[idx] = str;
|
data.PortraitTurnInText[idx] = str;
|
||||||
}
|
}
|
||||||
|
|
@ -5319,7 +5391,9 @@ void ObjectMgr::LoadWorldTemplate()
|
||||||
{
|
{
|
||||||
WorldTemplate const* temp = GetWorldTemplate(i);
|
WorldTemplate const* temp = GetWorldTemplate(i);
|
||||||
if (!temp)
|
if (!temp)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
MapEntry const* mapEntry = sMapStore.LookupEntry(temp->map);
|
MapEntry const* mapEntry = sMapStore.LookupEntry(temp->map);
|
||||||
if (!mapEntry)
|
if (!mapEntry)
|
||||||
|
|
@ -6543,7 +6617,9 @@ void ObjectMgr::LoadGameObjectLocales()
|
||||||
if (idx >= 0)
|
if (idx >= 0)
|
||||||
{
|
{
|
||||||
if ((int32)data.Name.size() <= idx)
|
if ((int32)data.Name.size() <= idx)
|
||||||
|
{
|
||||||
data.Name.resize(idx + 1);
|
data.Name.resize(idx + 1);
|
||||||
|
}
|
||||||
|
|
||||||
data.Name[idx] = str;
|
data.Name[idx] = str;
|
||||||
}
|
}
|
||||||
|
|
@ -6559,7 +6635,9 @@ void ObjectMgr::LoadGameObjectLocales()
|
||||||
if (idx >= 0)
|
if (idx >= 0)
|
||||||
{
|
{
|
||||||
if ((int32)data.CastBarCaption.size() <= idx)
|
if ((int32)data.CastBarCaption.size() <= idx)
|
||||||
|
{
|
||||||
data.CastBarCaption.resize(idx + 1);
|
data.CastBarCaption.resize(idx + 1);
|
||||||
|
}
|
||||||
|
|
||||||
data.CastBarCaption[idx] = str;
|
data.CastBarCaption[idx] = str;
|
||||||
}
|
}
|
||||||
|
|
@ -6746,7 +6824,9 @@ void ObjectMgr::LoadGameobjectInfo()
|
||||||
}
|
}
|
||||||
/* disable check for while, too many nonexistent spells
|
/* disable check for while, too many nonexistent spells
|
||||||
if (goInfo->trap.spellId) // spell
|
if (goInfo->trap.spellId) // spell
|
||||||
|
{
|
||||||
CheckGOSpellId(goInfo,goInfo->trap.spellId,3);
|
CheckGOSpellId(goInfo,goInfo->trap.spellId,3);
|
||||||
|
}
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -6785,7 +6865,9 @@ void ObjectMgr::LoadGameobjectInfo()
|
||||||
}
|
}
|
||||||
/* disable check for while, too many nonexistent spells
|
/* disable check for while, too many nonexistent spells
|
||||||
if (goInfo->goober.spellId) // spell
|
if (goInfo->goober.spellId) // spell
|
||||||
|
{
|
||||||
CheckGOSpellId(goInfo,goInfo->goober.spellId,10);
|
CheckGOSpellId(goInfo,goInfo->goober.spellId,10);
|
||||||
|
}
|
||||||
*/
|
*/
|
||||||
CheckGONoDamageImmuneId(goInfo, goInfo->goober.noDamageImmune, 11);
|
CheckGONoDamageImmuneId(goInfo, goInfo->goober.noDamageImmune, 11);
|
||||||
if (goInfo->goober.linkedTrapId) // linked trap
|
if (goInfo->goober.linkedTrapId) // linked trap
|
||||||
|
|
@ -7496,7 +7578,9 @@ void ObjectMgr::LoadQuestPOI()
|
||||||
for (QuestPOIVector::iterator itr = vect.begin(); itr != vect.end(); ++itr)
|
for (QuestPOIVector::iterator itr = vect.begin(); itr != vect.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (itr->PoiId != poiId)
|
if (itr->PoiId != poiId)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
QuestPOIPoint point(x, y);
|
QuestPOIPoint point(x, y);
|
||||||
itr->points.push_back(point);
|
itr->points.push_back(point);
|
||||||
|
|
@ -7829,10 +7913,14 @@ struct SQLSpellLoader : public SQLStorageLoaderBase<SQLSpellLoader, SQLHashStora
|
||||||
void default_fill(uint32 field_pos, S src, D& dst)
|
void default_fill(uint32 field_pos, S src, D& dst)
|
||||||
{
|
{
|
||||||
if (field_pos == LOADED_SPELLDBC_FIELD_POS_EQUIPPED_ITEM_CLASS)
|
if (field_pos == LOADED_SPELLDBC_FIELD_POS_EQUIPPED_ITEM_CLASS)
|
||||||
|
{
|
||||||
dst = D(-1);
|
dst = D(-1);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
dst = D(src);
|
dst = D(src);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void default_fill_to_str(uint32 field_pos, char const* /*src*/, char*& dst)
|
void default_fill_to_str(uint32 field_pos, char const* /*src*/, char*& dst)
|
||||||
{
|
{
|
||||||
|
|
@ -7861,7 +7949,9 @@ void ObjectMgr::LoadSpellTemplate()
|
||||||
// check data correctness
|
// check data correctness
|
||||||
SpellEntry const* spellEntry = sSpellTemplate.LookupEntry<SpellEntry>(i);
|
SpellEntry const* spellEntry = sSpellTemplate.LookupEntry<SpellEntry>(i);
|
||||||
if (!spellEntry)
|
if (!spellEntry)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// insert serverside spell data
|
// insert serverside spell data
|
||||||
if (sSpellStore.GetNumRows() <= i)
|
if (sSpellStore.GetNumRows() <= i)
|
||||||
|
|
@ -7870,8 +7960,10 @@ void ObjectMgr::LoadSpellTemplate()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
sSpellStore.InsertEntry(const_cast<SpellEntry*>(spellEntry), i);
|
sSpellStore.InsertEntry(const_cast<SpellEntry*>(spellEntry), i);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectMgr::DeleteCreatureData(uint32 guid)
|
void ObjectMgr::DeleteCreatureData(uint32 guid)
|
||||||
|
|
@ -8941,7 +9033,9 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co
|
||||||
case CONDITION_COMPLETED_ENCOUNTER:
|
case CONDITION_COMPLETED_ENCOUNTER:
|
||||||
{
|
{
|
||||||
if (!map)
|
if (!map)
|
||||||
|
{
|
||||||
map = player ? player->GetMap() : source->GetMap();
|
map = player ? player->GetMap() : source->GetMap();
|
||||||
|
}
|
||||||
if (!map->IsDungeon())
|
if (!map->IsDungeon())
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("CONDITION_COMPLETED_ENCOUNTER (entry %u) is used outside of a dungeon (on Map %u) by %s", m_entry, player->GetMapId(), player->GetGuidStr().c_str());
|
sLog.outErrorDb("CONDITION_COMPLETED_ENCOUNTER (entry %u) is used outside of a dungeon (on Map %u) by %s", m_entry, player->GetMapId(), player->GetGuidStr().c_str());
|
||||||
|
|
@ -8959,9 +9053,13 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co
|
||||||
}
|
}
|
||||||
// Select matching difficulties
|
// Select matching difficulties
|
||||||
if (map->GetDifficulty() != Difficulty(dbcEntry1->Difficulty))
|
if (map->GetDifficulty() != Difficulty(dbcEntry1->Difficulty))
|
||||||
|
{
|
||||||
dbcEntry1 = NULL;
|
dbcEntry1 = NULL;
|
||||||
|
}
|
||||||
if (dbcEntry2 && map->GetDifficulty() != Difficulty(dbcEntry2->Difficulty))
|
if (dbcEntry2 && map->GetDifficulty() != Difficulty(dbcEntry2->Difficulty))
|
||||||
|
{
|
||||||
dbcEntry2 = NULL;
|
dbcEntry2 = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return completedEncounterMask & ((dbcEntry1 ? 1 << dbcEntry1->encounterIndex : 0) | (dbcEntry2 ? 1 << dbcEntry2->encounterIndex : 0));
|
return completedEncounterMask & ((dbcEntry1 ? 1 << dbcEntry1->encounterIndex : 0) | (dbcEntry2 ? 1 << dbcEntry2->encounterIndex : 0));
|
||||||
}
|
}
|
||||||
|
|
@ -9493,7 +9591,9 @@ bool PlayerCondition::IsValid(uint16 entry, ConditionType condition, uint32 valu
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value2)
|
if (value2)
|
||||||
|
{
|
||||||
sLog.outErrorDb("XP user condition (entry %u, type %u) has useless data in value2 (%u)!", entry, condition, value2);
|
sLog.outErrorDb("XP user condition (entry %u, type %u) has useless data in value2 (%u)!", entry, condition, value2);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -9921,7 +10021,9 @@ void ObjectMgr::LoadTrainers(char const* tableName, bool isTemplates)
|
||||||
{
|
{
|
||||||
SpellEffectEntry const* spellEffect = spellinfo->GetSpellEffect(SpellEffectIndex(i));
|
SpellEffectEntry const* spellEffect = spellinfo->GetSpellEffect(SpellEffectIndex(i));
|
||||||
if (!spellEffect)
|
if (!spellEffect)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (spellEffect->Effect == SPELL_EFFECT_LEARN_SPELL &&
|
if (spellEffect->Effect == SPELL_EFFECT_LEARN_SPELL &&
|
||||||
SpellMgr::IsProfessionOrRidingSpell(spellEffect->EffectTriggerSpell))
|
SpellMgr::IsProfessionOrRidingSpell(spellEffect->EffectTriggerSpell))
|
||||||
|
|
@ -9931,7 +10033,9 @@ void ObjectMgr::LoadTrainers(char const* tableName, bool isTemplates)
|
||||||
{
|
{
|
||||||
SpellEffectEntry const* spellEff = spellinfo->GetSpellEffect(SpellEffectIndex(j));
|
SpellEffectEntry const* spellEff = spellinfo->GetSpellEffect(SpellEffectIndex(j));
|
||||||
if (!spellEff)
|
if (!spellEff)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (spellEff->Effect == SPELL_EFFECT_LEARN_SPELL)
|
if (spellEff->Effect == SPELL_EFFECT_LEARN_SPELL)
|
||||||
{
|
{
|
||||||
|
|
@ -9958,8 +10062,10 @@ void ObjectMgr::LoadTrainers(char const* tableName, bool isTemplates)
|
||||||
sLog.outErrorDb("Table `%s` (Entry: %u) has wrong redundant reqlevel %u (<>prof reqlevel %u) for spell %u", tableName, entry, trainerSpell.reqLevel, minLevel, spell);
|
sLog.outErrorDb("Table `%s` (Entry: %u) has wrong redundant reqlevel %u (<>prof reqlevel %u) for spell %u", tableName, entry, trainerSpell.reqLevel, minLevel, spell);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
trainerSpell.reqLevel = minLevel;
|
trainerSpell.reqLevel = minLevel;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// for non-prof. spell use spellLevel if not provided any
|
// for non-prof. spell use spellLevel if not provided any
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -9969,8 +10075,10 @@ void ObjectMgr::LoadTrainers(char const* tableName, bool isTemplates)
|
||||||
ERROR_DB_STRICT_LOG("Table `%s` (Entry: %u) has redundant reqlevel %u (=spell level) for spell %u", tableName, entry, trainerSpell.reqLevel, spell);
|
ERROR_DB_STRICT_LOG("Table `%s` (Entry: %u) has redundant reqlevel %u (=spell level) for spell %u", tableName, entry, trainerSpell.reqLevel, spell);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
trainerSpell.reqLevel = learnSpellinfo->GetSpellLevel();
|
trainerSpell.reqLevel = learnSpellinfo->GetSpellLevel();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
|
|
@ -10134,13 +10242,19 @@ void ObjectMgr::LoadActiveEntities(Map* _map)
|
||||||
{
|
{
|
||||||
_map = sMapMgr.FindMap(continents[i]);
|
_map = sMapMgr.FindMap(continents[i]);
|
||||||
if (!_map)
|
if (!_map)
|
||||||
|
{
|
||||||
_map = sMapMgr.CreateMap(continents[i], NULL);
|
_map = sMapMgr.CreateMap(continents[i], NULL);
|
||||||
|
}
|
||||||
|
|
||||||
if (_map)
|
if (_map)
|
||||||
|
{
|
||||||
LoadActiveEntities(_map);
|
LoadActiveEntities(_map);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
sLog.outError("ObjectMgr::LoadActiveEntities - Unable to create Map %u", continents[i]);
|
sLog.outError("ObjectMgr::LoadActiveEntities - Unable to create Map %u", continents[i]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -10151,9 +10265,11 @@ void ObjectMgr::LoadActiveEntities(Map* _map)
|
||||||
for (CreatureDataMap::const_iterator itr = mCreatureDataMap.begin(); itr != mCreatureDataMap.end(); ++itr)
|
for (CreatureDataMap::const_iterator itr = mCreatureDataMap.begin(); itr != mCreatureDataMap.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (itr->second.mapid == _map->GetId())
|
if (itr->second.mapid == _map->GetId())
|
||||||
|
{
|
||||||
_map->ForceLoadGrid(itr->second.posX, itr->second.posY);
|
_map->ForceLoadGrid(itr->second.posX, itr->second.posY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else // Normal case - Load all npcs that are active
|
else // Normal case - Load all npcs that are active
|
||||||
{
|
{
|
||||||
std::pair<ActiveCreatureGuidsOnMap::const_iterator, ActiveCreatureGuidsOnMap::const_iterator> bounds = m_activeCreatures.equal_range(_map->GetId());
|
std::pair<ActiveCreatureGuidsOnMap::const_iterator, ActiveCreatureGuidsOnMap::const_iterator> bounds = m_activeCreatures.equal_range(_map->GetId());
|
||||||
|
|
@ -10213,7 +10329,9 @@ void ObjectMgr::LoadGossipMenu(std::set<uint32>& gossipScriptSet)
|
||||||
{
|
{
|
||||||
ScriptChainMap const* scm = sScriptMgr.GetScriptChainMap(DBS_ON_GOSSIP);
|
ScriptChainMap const* scm = sScriptMgr.GetScriptChainMap(DBS_ON_GOSSIP);
|
||||||
if (!scm)
|
if (!scm)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (scm->find(gMenu.script_id) == scm->end())
|
if (scm->find(gMenu.script_id) == scm->end())
|
||||||
{
|
{
|
||||||
|
|
@ -10416,7 +10534,9 @@ void ObjectMgr::LoadGossipMenuItems(std::set<uint32>& gossipScriptSet)
|
||||||
{
|
{
|
||||||
ScriptChainMap const* scm = sScriptMgr.GetScriptChainMap(DBS_ON_GOSSIP);
|
ScriptChainMap const* scm = sScriptMgr.GetScriptChainMap(DBS_ON_GOSSIP);
|
||||||
if (!scm)
|
if (!scm)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (scm->find(gMenuItem.action_script_id) == scm->end())
|
if (scm->find(gMenuItem.action_script_id) == scm->end())
|
||||||
{
|
{
|
||||||
|
|
@ -10568,7 +10688,9 @@ bool ObjectMgr::IsVendorItemValid(bool isTemplate, char const* tableName, uint32
|
||||||
if (ExtendedCost && !sItemExtendedCostStore.LookupEntry(ExtendedCost))
|
if (ExtendedCost && !sItemExtendedCostStore.LookupEntry(ExtendedCost))
|
||||||
{
|
{
|
||||||
if (pl)
|
if (pl)
|
||||||
|
{
|
||||||
ChatHandler(pl).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST, ExtendedCost);
|
ChatHandler(pl).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST, ExtendedCost);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
sLog.outErrorDb("Table `%s` contain item (Entry: %u) with wrong ExtendedCost (%u) for %s %u, ignoring",
|
sLog.outErrorDb("Table `%s` contain item (Entry: %u) with wrong ExtendedCost (%u) for %s %u, ignoring",
|
||||||
tableName, item_id, ExtendedCost, idStr, vendor_entry);
|
tableName, item_id, ExtendedCost, idStr, vendor_entry);
|
||||||
|
|
@ -10679,7 +10801,9 @@ bool ObjectMgr::IsVendorItemValid(bool isTemplate, char const* tableName, uint32
|
||||||
if (!cInfo)
|
if (!cInfo)
|
||||||
{
|
{
|
||||||
if (pl)
|
if (pl)
|
||||||
|
{
|
||||||
ChatHandler(pl).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
|
ChatHandler(pl).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
sLog.outErrorDb("Table `%s` has data for nonexistent creature (Entry: %u), ignoring", tableName, vendor_entry);
|
sLog.outErrorDb("Table `%s` has data for nonexistent creature (Entry: %u), ignoring", tableName, vendor_entry);
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -10690,13 +10814,17 @@ bool ObjectMgr::IsVendorItemValid(bool isTemplate, char const* tableName, uint32
|
||||||
if (!skip_vendors || skip_vendors->count(vendor_entry) == 0)
|
if (!skip_vendors || skip_vendors->count(vendor_entry) == 0)
|
||||||
{
|
{
|
||||||
if (pl)
|
if (pl)
|
||||||
|
{
|
||||||
ChatHandler(pl).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
|
ChatHandler(pl).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
sLog.outErrorDb("Table `%s` has data for creature (Entry: %u) without vendor flag, ignoring", tableName, vendor_entry);
|
sLog.outErrorDb("Table `%s` has data for creature (Entry: %u) without vendor flag, ignoring", tableName, vendor_entry);
|
||||||
|
|
||||||
if (skip_vendors)
|
if (skip_vendors)
|
||||||
|
{
|
||||||
skip_vendors->insert(vendor_entry);
|
skip_vendors->insert(vendor_entry);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -10707,7 +10835,9 @@ bool ObjectMgr::IsVendorItemValid(bool isTemplate, char const* tableName, uint32
|
||||||
if (!GetItemPrototype(item_id))
|
if (!GetItemPrototype(item_id))
|
||||||
{
|
{
|
||||||
if (pl)
|
if (pl)
|
||||||
|
{
|
||||||
ChatHandler(pl).PSendSysMessage(LANG_ITEM_NOT_FOUND, item_id);
|
ChatHandler(pl).PSendSysMessage(LANG_ITEM_NOT_FOUND, item_id);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
sLog.outErrorDb("Table `%s` for %s %u contains nonexistent item (%u), ignoring",
|
sLog.outErrorDb("Table `%s` for %s %u contains nonexistent item (%u), ignoring",
|
||||||
tableName, idStr, vendor_entry, item_id);
|
tableName, idStr, vendor_entry, item_id);
|
||||||
|
|
@ -10720,7 +10850,9 @@ bool ObjectMgr::IsVendorItemValid(bool isTemplate, char const* tableName, uint32
|
||||||
if (!currencyEntry)
|
if (!currencyEntry)
|
||||||
{
|
{
|
||||||
if (pl)
|
if (pl)
|
||||||
|
{
|
||||||
ChatHandler(pl).PSendSysMessage(LANG_CURRENCY_NOT_FOUND, item_id);
|
ChatHandler(pl).PSendSysMessage(LANG_CURRENCY_NOT_FOUND, item_id);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
sLog.outErrorDb("Table `%s` for %s %u contains nonexistent currency (%u), ignoring",
|
sLog.outErrorDb("Table `%s` for %s %u contains nonexistent currency (%u), ignoring",
|
||||||
tableName, idStr, vendor_entry, item_id);
|
tableName, idStr, vendor_entry, item_id);
|
||||||
|
|
@ -10731,7 +10863,9 @@ bool ObjectMgr::IsVendorItemValid(bool isTemplate, char const* tableName, uint32
|
||||||
if (currencyEntry->Category == CURRENCY_CATEGORY_META)
|
if (currencyEntry->Category == CURRENCY_CATEGORY_META)
|
||||||
{
|
{
|
||||||
if (pl)
|
if (pl)
|
||||||
|
{
|
||||||
ChatHandler(pl).PSendSysMessage(LANG_VENDOR_META_CURRENCY_NOT_ALLOWED, item_id);
|
ChatHandler(pl).PSendSysMessage(LANG_VENDOR_META_CURRENCY_NOT_ALLOWED, item_id);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
sLog.outErrorDb("Table `%s` for %s %u contains not allowed meta currency (%u), ignoring",
|
sLog.outErrorDb("Table `%s` for %s %u contains not allowed meta currency (%u), ignoring",
|
||||||
tableName, idStr, vendor_entry, item_id);
|
tableName, idStr, vendor_entry, item_id);
|
||||||
|
|
@ -10742,7 +10876,9 @@ bool ObjectMgr::IsVendorItemValid(bool isTemplate, char const* tableName, uint32
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pl)
|
if (pl)
|
||||||
|
{
|
||||||
ChatHandler(pl).PSendSysMessage(LANG_VENDOR_WRONG_ITEM_TYPE, item_id, type);
|
ChatHandler(pl).PSendSysMessage(LANG_VENDOR_WRONG_ITEM_TYPE, item_id, type);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
sLog.outErrorDb("Table `%s` for %s %u contains nonexistent vendor item type %u (entry %u), ignoring",
|
sLog.outErrorDb("Table `%s` for %s %u contains nonexistent vendor item type %u (entry %u), ignoring",
|
||||||
tableName, idStr, vendor_entry, type, item_id);
|
tableName, idStr, vendor_entry, type, item_id);
|
||||||
|
|
@ -10751,7 +10887,9 @@ bool ObjectMgr::IsVendorItemValid(bool isTemplate, char const* tableName, uint32
|
||||||
if (ExtendedCost && !sItemExtendedCostStore.LookupEntry(ExtendedCost))
|
if (ExtendedCost && !sItemExtendedCostStore.LookupEntry(ExtendedCost))
|
||||||
{
|
{
|
||||||
if (pl)
|
if (pl)
|
||||||
|
{
|
||||||
ChatHandler(pl).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST, ExtendedCost);
|
ChatHandler(pl).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST, ExtendedCost);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
sLog.outErrorDb("Table `%s` contains %s (Entry: %u) with wrong ExtendedCost (%u) for %s %u, ignoring",
|
sLog.outErrorDb("Table `%s` contains %s (Entry: %u) with wrong ExtendedCost (%u) for %s %u, ignoring",
|
||||||
tableName, nameStr, item_id, ExtendedCost, idStr, vendor_entry);
|
tableName, nameStr, item_id, ExtendedCost, idStr, vendor_entry);
|
||||||
|
|
@ -10763,7 +10901,9 @@ bool ObjectMgr::IsVendorItemValid(bool isTemplate, char const* tableName, uint32
|
||||||
if (maxcount > 0 && incrtime == 0)
|
if (maxcount > 0 && incrtime == 0)
|
||||||
{
|
{
|
||||||
if (pl)
|
if (pl)
|
||||||
|
{
|
||||||
ChatHandler(pl).PSendSysMessage("MaxCount!=0 (%u) but IncrTime==0", maxcount);
|
ChatHandler(pl).PSendSysMessage("MaxCount!=0 (%u) but IncrTime==0", maxcount);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
sLog.outErrorDb("Table `%s` has `maxcount` (%u) for %s %u of %s %u but `incrtime`=0, ignoring",
|
sLog.outErrorDb("Table `%s` has `maxcount` (%u) for %s %u of %s %u but `incrtime`=0, ignoring",
|
||||||
tableName, maxcount, nameStr, item_id, idStr, vendor_entry);
|
tableName, maxcount, nameStr, item_id, idStr, vendor_entry);
|
||||||
|
|
@ -10772,7 +10912,9 @@ bool ObjectMgr::IsVendorItemValid(bool isTemplate, char const* tableName, uint32
|
||||||
else if (maxcount == 0 && incrtime > 0)
|
else if (maxcount == 0 && incrtime > 0)
|
||||||
{
|
{
|
||||||
if (pl)
|
if (pl)
|
||||||
|
{
|
||||||
ChatHandler(pl).PSendSysMessage("MaxCount==0 but IncrTime<>=0");
|
ChatHandler(pl).PSendSysMessage("MaxCount==0 but IncrTime<>=0");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
sLog.outErrorDb("Table `%s` has `maxcount`=0 for %s %u of %s %u but `incrtime`<>0, ignoring",
|
sLog.outErrorDb("Table `%s` has `maxcount`=0 for %s %u of %s %u but `incrtime`<>0, ignoring",
|
||||||
tableName, nameStr, item_id, idStr, vendor_entry);
|
tableName, nameStr, item_id, idStr, vendor_entry);
|
||||||
|
|
@ -10784,7 +10926,9 @@ bool ObjectMgr::IsVendorItemValid(bool isTemplate, char const* tableName, uint32
|
||||||
if (maxcount < uint32(currencyEntry->GetPrecision()))
|
if (maxcount < uint32(currencyEntry->GetPrecision()))
|
||||||
{
|
{
|
||||||
if (pl)
|
if (pl)
|
||||||
|
{
|
||||||
ChatHandler(pl).PSendSysMessage(LANG_VENDOR_WRONG_CURRENCY_MAXCOUNT, item_id, uint32(currencyEntry->GetPrecision()));
|
ChatHandler(pl).PSendSysMessage(LANG_VENDOR_WRONG_CURRENCY_MAXCOUNT, item_id, uint32(currencyEntry->GetPrecision()));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
sLog.outErrorDb("Table `%s` contains %s (Entry: %u) with too low maxcount. Maxcount for currencies is buycount, so it can't be 0 or less than that's currency precision (%u), ignoring",
|
sLog.outErrorDb("Table `%s` contains %s (Entry: %u) with too low maxcount. Maxcount for currencies is buycount, so it can't be 0 or less than that's currency precision (%u), ignoring",
|
||||||
tableName, nameStr, item_id, uint32(currencyEntry->GetPrecision()));
|
tableName, nameStr, item_id, uint32(currencyEntry->GetPrecision()));
|
||||||
|
|
@ -10807,7 +10951,9 @@ bool ObjectMgr::IsVendorItemValid(bool isTemplate, char const* tableName, uint32
|
||||||
if (vItems && vItems->FindItemCostPair(item_id, type, ExtendedCost))
|
if (vItems && vItems->FindItemCostPair(item_id, type, ExtendedCost))
|
||||||
{
|
{
|
||||||
if (pl)
|
if (pl)
|
||||||
|
{
|
||||||
ChatHandler(pl).PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST, item_id, type == VENDOR_ITEM_TYPE_CURRENCY, ExtendedCost);
|
ChatHandler(pl).PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST, item_id, type == VENDOR_ITEM_TYPE_CURRENCY, ExtendedCost);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
sLog.outErrorDb("Table `%s` has duplicate %s %u (with extended cost %u) for %s %u, ignoring",
|
sLog.outErrorDb("Table `%s` has duplicate %s %u (with extended cost %u) for %s %u, ignoring",
|
||||||
tableName, nameStr, item_id, ExtendedCost, idStr, vendor_entry);
|
tableName, nameStr, item_id, ExtendedCost, idStr, vendor_entry);
|
||||||
|
|
@ -10819,7 +10965,9 @@ bool ObjectMgr::IsVendorItemValid(bool isTemplate, char const* tableName, uint32
|
||||||
if (tItems && tItems->FindItemCostPair(item_id, type, ExtendedCost))
|
if (tItems && tItems->FindItemCostPair(item_id, type, ExtendedCost))
|
||||||
{
|
{
|
||||||
if (pl)
|
if (pl)
|
||||||
|
{
|
||||||
ChatHandler(pl).PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST, item_id, type == VENDOR_ITEM_TYPE_CURRENCY, ExtendedCost);
|
ChatHandler(pl).PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST, item_id, type == VENDOR_ITEM_TYPE_CURRENCY, ExtendedCost);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!cInfo->VendorTemplateId)
|
if (!cInfo->VendorTemplateId)
|
||||||
|
|
@ -10839,7 +10987,9 @@ bool ObjectMgr::IsVendorItemValid(bool isTemplate, char const* tableName, uint32
|
||||||
if (countItems >= MAX_VENDOR_ITEMS)
|
if (countItems >= MAX_VENDOR_ITEMS)
|
||||||
{
|
{
|
||||||
if (pl)
|
if (pl)
|
||||||
|
{
|
||||||
ChatHandler(pl).SendSysMessage(LANG_COMMAND_ADDVENDORITEMITEMS);
|
ChatHandler(pl).SendSysMessage(LANG_COMMAND_ADDVENDORITEMITEMS);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
sLog.outErrorDb("Table `%s` has too many entries (%u >= %i) for %s %u, ignoring",
|
sLog.outErrorDb("Table `%s` has too many entries (%u >= %i) for %s %u, ignoring",
|
||||||
tableName, countItems, MAX_VENDOR_ITEMS, idStr, vendor_entry);
|
tableName, countItems, MAX_VENDOR_ITEMS, idStr, vendor_entry);
|
||||||
|
|
@ -11146,7 +11296,9 @@ bool FindGOData::operator()(GameObjectDataPair const& dataPair)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!i_anyData)
|
if (!i_anyData)
|
||||||
|
{
|
||||||
i_anyData = &dataPair;
|
i_anyData = &dataPair;
|
||||||
|
}
|
||||||
|
|
||||||
// without player we can't find more stricted cases, so use fouded
|
// without player we can't find more stricted cases, so use fouded
|
||||||
if (!i_player)
|
if (!i_player)
|
||||||
|
|
|
||||||
|
|
@ -1271,8 +1271,10 @@ class ObjectMgr
|
||||||
static inline void GetLocaleString(const StringVector& data, int loc_idx, std::string& value)
|
static inline void GetLocaleString(const StringVector& data, int loc_idx, std::string& value)
|
||||||
{
|
{
|
||||||
if (data.size() > size_t(loc_idx) && !data[loc_idx].empty())
|
if (data.size() > size_t(loc_idx) && !data[loc_idx].empty())
|
||||||
|
{
|
||||||
value = data[loc_idx];
|
value = data[loc_idx];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int GetOrNewIndexForLocale(LocaleConstant loc);
|
int GetOrNewIndexForLocale(LocaleConstant loc);
|
||||||
|
|
||||||
|
|
@ -1371,7 +1373,9 @@ class ObjectMgr
|
||||||
for (HotfixData::const_iterator itr = m_hotfixData.begin(); itr != m_hotfixData.end(); ++itr)
|
for (HotfixData::const_iterator itr = m_hotfixData.begin(); itr != m_hotfixData.end(); ++itr)
|
||||||
if (itr->Entry == entry && itr->Type == type)
|
if (itr->Entry == entry && itr->Type == type)
|
||||||
if (itr->Timestamp > ret)
|
if (itr->Timestamp > ret)
|
||||||
|
{
|
||||||
ret = itr->Timestamp;
|
ret = itr->Timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
return ret ? ret : uint32(time(NULL));
|
return ret ? ret : uint32(time(NULL));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -239,7 +239,9 @@ bool ObjectPosSelector::NextUsedAngle(float& angle)
|
||||||
{
|
{
|
||||||
if (m_nextUsedAreaItr[USED_POS_PLUS] == m_UsedAreaLists[USED_POS_PLUS].end() &&
|
if (m_nextUsedAreaItr[USED_POS_PLUS] == m_UsedAreaLists[USED_POS_PLUS].end() &&
|
||||||
m_nextUsedAreaItr[USED_POS_MINUS] == m_UsedAreaLists[USED_POS_MINUS].end())
|
m_nextUsedAreaItr[USED_POS_MINUS] == m_UsedAreaLists[USED_POS_MINUS].end())
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// ++ direction less updated
|
// ++ direction less updated
|
||||||
if (m_nextUsedAreaItr[USED_POS_PLUS] != m_UsedAreaLists[USED_POS_PLUS].end() &&
|
if (m_nextUsedAreaItr[USED_POS_PLUS] != m_UsedAreaLists[USED_POS_PLUS].end() &&
|
||||||
|
|
|
||||||
|
|
@ -213,7 +213,9 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
||||||
}
|
}
|
||||||
|
|
||||||
if (owner->IsFFAPvP())
|
if (owner->IsFFAPvP())
|
||||||
|
{
|
||||||
SetFFAPvP(true);
|
SetFFAPvP(true);
|
||||||
|
}
|
||||||
|
|
||||||
SetCanModifyStats(true);
|
SetCanModifyStats(true);
|
||||||
InitStatsForLevel(petlevel);
|
InitStatsForLevel(petlevel);
|
||||||
|
|
@ -250,7 +252,9 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
||||||
|
|
||||||
// load action bar, if data broken will fill later by default spells.
|
// load action bar, if data broken will fill later by default spells.
|
||||||
if (!is_temporary_summoned)
|
if (!is_temporary_summoned)
|
||||||
|
{
|
||||||
m_charmInfo->LoadPetActionBar(fields[12].GetCppString());
|
m_charmInfo->LoadPetActionBar(fields[12].GetCppString());
|
||||||
|
}
|
||||||
|
|
||||||
// since last save (in seconds)
|
// since last save (in seconds)
|
||||||
uint32 timediff = uint32(time(NULL) - fields[13].GetUInt64());
|
uint32 timediff = uint32(time(NULL) - fields[13].GetUInt64());
|
||||||
|
|
@ -282,7 +286,9 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
||||||
SetPower(powerType, savedpower > GetMaxPower(powerType) ? GetMaxPower(powerType) : savedpower);
|
SetPower(powerType, savedpower > GetMaxPower(powerType) ? GetMaxPower(powerType) : savedpower);
|
||||||
|
|
||||||
if (getPetType() == HUNTER_PET && savedhealth <= 0)
|
if (getPetType() == HUNTER_PET && savedhealth <= 0)
|
||||||
|
{
|
||||||
SetDeathState(JUST_DIED);
|
SetDeathState(JUST_DIED);
|
||||||
|
}
|
||||||
|
|
||||||
map->Add((Creature*)this);
|
map->Add((Creature*)this);
|
||||||
AIM_Initialize();
|
AIM_Initialize();
|
||||||
|
|
@ -367,10 +373,14 @@ void Pet::SavePetToDB(PetSaveMode mode)
|
||||||
{
|
{
|
||||||
// Hunter Pets always save as current if dismissed or unsummoned due to range/etc.
|
// Hunter Pets always save as current if dismissed or unsummoned due to range/etc.
|
||||||
if (getPetType() == HUNTER_PET)
|
if (getPetType() == HUNTER_PET)
|
||||||
|
{
|
||||||
mode = PET_SAVE_AS_CURRENT;
|
mode = PET_SAVE_AS_CURRENT;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
mode = PET_SAVE_NOT_IN_SLOT;
|
mode = PET_SAVE_NOT_IN_SLOT;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// not save pet as current if another pet temporary unsummoned
|
// not save pet as current if another pet temporary unsummoned
|
||||||
else if (mode == PET_SAVE_AS_CURRENT && pOwner->GetTemporaryUnsummonedPetNumber() &&
|
else if (mode == PET_SAVE_AS_CURRENT && pOwner->GetTemporaryUnsummonedPetNumber() &&
|
||||||
pOwner->GetTemporaryUnsummonedPetNumber() != m_charmInfo->GetPetNumber())
|
pOwner->GetTemporaryUnsummonedPetNumber() != m_charmInfo->GetPetNumber())
|
||||||
|
|
@ -682,7 +692,9 @@ void Pet::Unsummon(PetSaveMode mode, Unit* owner /*= NULL*/)
|
||||||
// not save secondary permanent pet as current
|
// not save secondary permanent pet as current
|
||||||
if (mode == PET_SAVE_AS_CURRENT && p_owner->GetTemporaryUnsummonedPetNumber() &&
|
if (mode == PET_SAVE_AS_CURRENT && p_owner->GetTemporaryUnsummonedPetNumber() &&
|
||||||
p_owner->GetTemporaryUnsummonedPetNumber() != GetCharmInfo()->GetPetNumber())
|
p_owner->GetTemporaryUnsummonedPetNumber() != GetCharmInfo()->GetPetNumber())
|
||||||
{ mode = PET_SAVE_NOT_IN_SLOT; }
|
{
|
||||||
|
mode = PET_SAVE_NOT_IN_SLOT;
|
||||||
|
}
|
||||||
|
|
||||||
if (mode == PET_SAVE_REAGENTS)
|
if (mode == PET_SAVE_REAGENTS)
|
||||||
{
|
{
|
||||||
|
|
@ -703,12 +715,14 @@ void Pet::Unsummon(PetSaveMode mode, Unit* owner /*= NULL*/)
|
||||||
{
|
{
|
||||||
Item* item = p_owner->StoreNewItem(dest, spellReagents->Reagent[i], true);
|
Item* item = p_owner->StoreNewItem(dest, spellReagents->Reagent[i], true);
|
||||||
if (p_owner->IsInWorld())
|
if (p_owner->IsInWorld())
|
||||||
|
{
|
||||||
p_owner->SendNewItem(item, spellReagents->ReagentCount[i], true, false);
|
p_owner->SendNewItem(item, spellReagents->ReagentCount[i], true, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isControlled())
|
if (isControlled())
|
||||||
{
|
{
|
||||||
|
|
@ -726,7 +740,9 @@ void Pet::Unsummon(PetSaveMode mode, Unit* owner /*= NULL*/)
|
||||||
{
|
{
|
||||||
case MINI_PET:
|
case MINI_PET:
|
||||||
if (p_owner)
|
if (p_owner)
|
||||||
|
{
|
||||||
p_owner->SetMiniPet(NULL);
|
p_owner->SetMiniPet(NULL);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PROTECTOR_PET:
|
case PROTECTOR_PET:
|
||||||
case GUARDIAN_PET:
|
case GUARDIAN_PET:
|
||||||
|
|
@ -918,11 +934,17 @@ void Pet::InitStatsForLevel(uint32 petlevel)
|
||||||
{
|
{
|
||||||
float scale;
|
float scale;
|
||||||
if (getLevel() >= cFamily->maxScaleLevel)
|
if (getLevel() >= cFamily->maxScaleLevel)
|
||||||
|
{
|
||||||
scale = cFamily->maxScale;
|
scale = cFamily->maxScale;
|
||||||
|
}
|
||||||
else if (getLevel() <= cFamily->minScaleLevel)
|
else if (getLevel() <= cFamily->minScaleLevel)
|
||||||
|
{
|
||||||
scale = cFamily->minScale;
|
scale = cFamily->minScale;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
scale = cFamily->minScale + float(getLevel() - cFamily->minScaleLevel) / cFamily->maxScaleLevel * (cFamily->maxScale - cFamily->minScale);
|
scale = cFamily->minScale + float(getLevel() - cFamily->minScaleLevel) / cFamily->maxScaleLevel * (cFamily->maxScale - cFamily->minScale);
|
||||||
|
}
|
||||||
|
|
||||||
SetObjectScale(scale);
|
SetObjectScale(scale);
|
||||||
UpdateModelData();
|
UpdateModelData();
|
||||||
|
|
@ -930,7 +952,9 @@ void Pet::InitStatsForLevel(uint32 petlevel)
|
||||||
|
|
||||||
// Max level
|
// Max level
|
||||||
if (petlevel < sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL))
|
if (petlevel < sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL))
|
||||||
|
{
|
||||||
SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, sObjectMgr.GetXPForPetLevel(petlevel));
|
SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, sObjectMgr.GetXPForPetLevel(petlevel));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0);
|
SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0);
|
||||||
|
|
@ -1142,7 +1166,9 @@ void Pet::InitStatsForLevel(uint32 petlevel)
|
||||||
health *= cInfo->HealthMultiplier;
|
health *= cInfo->HealthMultiplier;
|
||||||
|
|
||||||
if (mana > 0)
|
if (mana > 0)
|
||||||
|
{
|
||||||
mana *= cInfo->PowerMultiplier;
|
mana *= cInfo->PowerMultiplier;
|
||||||
|
}
|
||||||
|
|
||||||
armor *= cInfo->ArmorMultiplier;
|
armor *= cInfo->ArmorMultiplier;
|
||||||
}
|
}
|
||||||
|
|
@ -1155,7 +1181,9 @@ void Pet::InitStatsForLevel(uint32 petlevel)
|
||||||
|
|
||||||
// A pet cannot not have health
|
// A pet cannot not have health
|
||||||
if (health < 1)
|
if (health < 1)
|
||||||
|
{
|
||||||
health = 1;
|
health = 1;
|
||||||
|
}
|
||||||
|
|
||||||
// Set health
|
// Set health
|
||||||
SetCreateHealth(health);
|
SetCreateHealth(health);
|
||||||
|
|
@ -1223,7 +1251,9 @@ uint32 Pet::GetCurrentFoodBenefitLevel(uint32 itemlevel)
|
||||||
}
|
}
|
||||||
// -15 or less
|
// -15 or less
|
||||||
else
|
else
|
||||||
{ return 0; } // food too low level
|
{
|
||||||
|
return 0; // food too low level
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pet::_LoadSpellCooldowns()
|
void Pet::_LoadSpellCooldowns()
|
||||||
|
|
@ -1426,8 +1456,10 @@ void Pet::_LoadAuras(uint32 timediff)
|
||||||
if (procCharges)
|
if (procCharges)
|
||||||
{
|
{
|
||||||
if (remaincharges <= 0 || remaincharges > procCharges)
|
if (remaincharges <= 0 || remaincharges > procCharges)
|
||||||
|
{
|
||||||
remaincharges = procCharges;
|
remaincharges = procCharges;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
remaincharges = 0;
|
remaincharges = 0;
|
||||||
|
|
@ -1439,7 +1471,9 @@ void Pet::_LoadAuras(uint32 timediff)
|
||||||
stackcount = 1;
|
stackcount = 1;
|
||||||
}
|
}
|
||||||
else if (defstackamount < stackcount)
|
else if (defstackamount < stackcount)
|
||||||
|
{
|
||||||
stackcount = defstackamount;
|
stackcount = defstackamount;
|
||||||
|
}
|
||||||
else if (!stackcount)
|
else if (!stackcount)
|
||||||
{
|
{
|
||||||
stackcount = 1;
|
stackcount = 1;
|
||||||
|
|
@ -1509,7 +1543,9 @@ void Pet::_SaveAuras()
|
||||||
SpellEntry const* spellInfo = holder->GetSpellProto();
|
SpellEntry const* spellInfo = holder->GetSpellProto();
|
||||||
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(j));
|
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(j));
|
||||||
if(!effectEntry)
|
if(!effectEntry)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (effectEntry->EffectApplyAuraName == SPELL_AURA_MOD_STEALTH ||
|
if (effectEntry->EffectApplyAuraName == SPELL_AURA_MOD_STEALTH ||
|
||||||
effectEntry->Effect == SPELL_EFFECT_APPLY_AREA_AURA_OWNER ||
|
effectEntry->Effect == SPELL_EFFECT_APPLY_AREA_AURA_OWNER ||
|
||||||
|
|
@ -1658,11 +1694,15 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
|
||||||
// skip learning spell and no rank spell case
|
// skip learning spell and no rank spell case
|
||||||
uint32 rankSpellId = talentInfo->RankID[i];
|
uint32 rankSpellId = talentInfo->RankID[i];
|
||||||
if (!rankSpellId || rankSpellId == spell_id)
|
if (!rankSpellId || rankSpellId == spell_id)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// skip unknown ranks
|
// skip unknown ranks
|
||||||
if (!HasSpell(rankSpellId))
|
if (!HasSpell(rankSpellId))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
removeSpell(rankSpellId, false, false);
|
removeSpell(rankSpellId, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1681,7 +1721,9 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
|
||||||
newspell.active = itr2->second.active;
|
newspell.active = itr2->second.active;
|
||||||
|
|
||||||
if (newspell.active == ACT_ENABLED)
|
if (newspell.active == ACT_ENABLED)
|
||||||
|
{
|
||||||
ToggleAutocast(itr2->first, false);
|
ToggleAutocast(itr2->first, false);
|
||||||
|
}
|
||||||
|
|
||||||
oldspell_id = itr2->first;
|
oldspell_id = itr2->first;
|
||||||
unlearnSpell(itr2->first, false, false);
|
unlearnSpell(itr2->first, false, false);
|
||||||
|
|
@ -1738,7 +1780,9 @@ bool Pet::learnSpell(uint32 spell_id)
|
||||||
data << uint32(spell_id);
|
data << uint32(spell_id);
|
||||||
((Player*)owner)->GetSession()->SendPacket(&data);
|
((Player*)owner)->GetSession()->SendPacket(&data);
|
||||||
|
|
||||||
{ ((Player*)owner)->PetSpellInitialize(); }
|
{
|
||||||
|
((Player*)owner)->PetSpellInitialize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -1755,12 +1799,16 @@ void Pet::InitLevelupSpellsForLevel()
|
||||||
{
|
{
|
||||||
// will called first if level down
|
// will called first if level down
|
||||||
if (itr->first > level)
|
if (itr->first > level)
|
||||||
|
{
|
||||||
unlearnSpell(itr->second, true); // will learn prev rank if any
|
unlearnSpell(itr->second, true); // will learn prev rank if any
|
||||||
|
}
|
||||||
// will called if level up
|
// will called if level up
|
||||||
else
|
else
|
||||||
|
{
|
||||||
learnSpell(itr->second); // will unlearn prev rank if any
|
learnSpell(itr->second); // will unlearn prev rank if any
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int32 petSpellsId = GetCreatureInfo()->PetSpellDataId ? -(int32)GetCreatureInfo()->PetSpellDataId : GetEntry();
|
int32 petSpellsId = GetCreatureInfo()->PetSpellDataId ? -(int32)GetCreatureInfo()->PetSpellDataId : GetEntry();
|
||||||
|
|
||||||
|
|
@ -1771,16 +1819,22 @@ void Pet::InitLevelupSpellsForLevel()
|
||||||
{
|
{
|
||||||
SpellEntry const* spellEntry = sSpellStore.LookupEntry(defSpells->spellid[i]);
|
SpellEntry const* spellEntry = sSpellStore.LookupEntry(defSpells->spellid[i]);
|
||||||
if (!spellEntry)
|
if (!spellEntry)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// will called first if level down
|
// will called first if level down
|
||||||
if(spellEntry->GetSpellLevel() > level)
|
if(spellEntry->GetSpellLevel() > level)
|
||||||
|
{
|
||||||
unlearnSpell(spellEntry->Id, true);
|
unlearnSpell(spellEntry->Id, true);
|
||||||
|
}
|
||||||
// will called if level up
|
// will called if level up
|
||||||
else
|
else
|
||||||
|
{
|
||||||
learnSpell(spellEntry->Id);
|
learnSpell(spellEntry->Id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Pet::unlearnSpell(uint32 spell_id, bool learn_prev, bool clear_ab)
|
bool Pet::unlearnSpell(uint32 spell_id, bool learn_prev, bool clear_ab)
|
||||||
|
|
@ -1799,7 +1853,9 @@ bool Pet::unlearnSpell(uint32 spell_id, bool learn_prev, bool clear_ab)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{ return true; }
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -1832,9 +1888,13 @@ bool Pet::removeSpell(uint32 spell_id, bool learn_prev, bool clear_ab)
|
||||||
if (talentCost > 0)
|
if (talentCost > 0)
|
||||||
{
|
{
|
||||||
if (m_usedTalentCount > talentCost)
|
if (m_usedTalentCount > talentCost)
|
||||||
|
{
|
||||||
m_usedTalentCount -= talentCost;
|
m_usedTalentCount -= talentCost;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_usedTalentCount = 0;
|
m_usedTalentCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
UpdateFreeTalentPoints(false);
|
UpdateFreeTalentPoints(false);
|
||||||
}
|
}
|
||||||
|
|
@ -1899,7 +1959,9 @@ bool Pet::resetTalents(bool no_cost)
|
||||||
|
|
||||||
// not need after this call
|
// not need after this call
|
||||||
if (((Player*)owner)->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
|
if (((Player*)owner)->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
|
||||||
|
{
|
||||||
((Player*)owner)->RemoveAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS, true);
|
((Player*)owner)->RemoveAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS, true);
|
||||||
|
}
|
||||||
|
|
||||||
CreatureInfo const* ci = GetCreatureInfo();
|
CreatureInfo const* ci = GetCreatureInfo();
|
||||||
if (!ci)
|
if (!ci)
|
||||||
|
|
@ -1943,16 +2005,22 @@ bool Pet::resetTalents(bool no_cost)
|
||||||
TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab);
|
TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab);
|
||||||
|
|
||||||
if (!talentTabInfo)
|
if (!talentTabInfo)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// unlearn only talents for pets family talent type
|
// unlearn only talents for pets family talent type
|
||||||
if (!((1 << pet_family->petTalentType) & talentTabInfo->petTalentMask))
|
if (!((1 << pet_family->petTalentType) & talentTabInfo->petTalentMask))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (int j = 0; j < MAX_TALENT_RANK; ++j)
|
for (int j = 0; j < MAX_TALENT_RANK; ++j)
|
||||||
if (talentInfo->RankID[j])
|
if (talentInfo->RankID[j])
|
||||||
|
{
|
||||||
removeSpell(talentInfo->RankID[j], !IsPassiveSpell(talentInfo->RankID[j]), false);
|
removeSpell(talentInfo->RankID[j], !IsPassiveSpell(talentInfo->RankID[j]), false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UpdateFreeTalentPoints(false);
|
UpdateFreeTalentPoints(false);
|
||||||
|
|
||||||
|
|
@ -1971,11 +2039,15 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/)
|
||||||
{
|
{
|
||||||
// not need after this call
|
// not need after this call
|
||||||
if (((Player*)owner)->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
|
if (((Player*)owner)->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
|
||||||
|
{
|
||||||
((Player*)owner)->RemoveAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS, true);
|
((Player*)owner)->RemoveAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS, true);
|
||||||
|
}
|
||||||
|
|
||||||
// reset for online
|
// reset for online
|
||||||
if (online_pet)
|
if (online_pet)
|
||||||
|
{
|
||||||
online_pet->resetTalents(true);
|
online_pet->resetTalents(true);
|
||||||
|
}
|
||||||
|
|
||||||
// now need only reset for offline pets (all pets except online case)
|
// now need only reset for offline pets (all pets except online case)
|
||||||
uint32 except_petnumber = online_pet ? online_pet->GetCharmInfo()->GetPetNumber() : 0;
|
uint32 except_petnumber = online_pet ? online_pet->GetCharmInfo()->GetPetNumber() : 0;
|
||||||
|
|
@ -2012,7 +2084,9 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/)
|
||||||
uint32 id = fields[0].GetUInt32();
|
uint32 id = fields[0].GetUInt32();
|
||||||
|
|
||||||
if (need_comma)
|
if (need_comma)
|
||||||
|
{
|
||||||
ss << ",";
|
ss << ",";
|
||||||
|
}
|
||||||
|
|
||||||
ss << id;
|
ss << id;
|
||||||
|
|
||||||
|
|
@ -2032,10 +2106,14 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/)
|
||||||
uint32 spell = fields[0].GetUInt32();
|
uint32 spell = fields[0].GetUInt32();
|
||||||
|
|
||||||
if (!GetTalentSpellCost(spell))
|
if (!GetTalentSpellCost(spell))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (need_execute)
|
if (need_execute)
|
||||||
|
{
|
||||||
ss << ",";
|
ss << ",";
|
||||||
|
}
|
||||||
|
|
||||||
ss << spell;
|
ss << spell;
|
||||||
|
|
||||||
|
|
@ -2067,15 +2145,23 @@ void Pet::UpdateFreeTalentPoints(bool resetIfNeed)
|
||||||
{
|
{
|
||||||
Unit* owner = GetOwner();
|
Unit* owner = GetOwner();
|
||||||
if (!owner || owner->GetTypeId() != TYPEID_PLAYER || ((Player*)owner)->GetSession()->GetSecurity() < SEC_ADMINISTRATOR)
|
if (!owner || owner->GetTypeId() != TYPEID_PLAYER || ((Player*)owner)->GetSession()->GetSecurity() < SEC_ADMINISTRATOR)
|
||||||
|
{
|
||||||
resetTalents(true);
|
resetTalents(true);
|
||||||
else
|
|
||||||
SetFreeTalentPoints(0);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
SetFreeTalentPoints(0);
|
SetFreeTalentPoints(0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
SetFreeTalentPoints(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
SetFreeTalentPoints(talentPointsForLevel - m_usedTalentCount);
|
SetFreeTalentPoints(talentPointsForLevel - m_usedTalentCount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pet::InitTalentForLevel()
|
void Pet::InitTalentForLevel()
|
||||||
|
|
@ -2089,7 +2175,9 @@ void Pet::InitTalentForLevel()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_loading)
|
if (!m_loading)
|
||||||
|
{
|
||||||
((Player*)owner)->SendTalentsInfoData(true);
|
((Player*)owner)->SendTalentsInfoData(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Pet::resetTalentsCost() const
|
uint32 Pet::resetTalentsCost() const
|
||||||
|
|
@ -2123,7 +2211,9 @@ uint8 Pet::GetMaxTalentPointsForLevel(uint32 level)
|
||||||
uint8 points = (level >= 20) ? ((level - 16) / 4) : 0;
|
uint8 points = (level >= 20) ? ((level - 16) / 4) : 0;
|
||||||
// Mod points from owner SPELL_AURA_MOD_PET_TALENT_POINTS
|
// Mod points from owner SPELL_AURA_MOD_PET_TALENT_POINTS
|
||||||
if (Unit* owner = GetOwner())
|
if (Unit* owner = GetOwner())
|
||||||
|
{
|
||||||
points += owner->GetTotalAuraModifier(SPELL_AURA_MOD_PET_TALENT_POINTS);
|
points += owner->GetTotalAuraModifier(SPELL_AURA_MOD_PET_TALENT_POINTS);
|
||||||
|
}
|
||||||
return points;
|
return points;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2142,7 +2232,9 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply)
|
||||||
if (apply)
|
if (apply)
|
||||||
{
|
{
|
||||||
for (i = 0; i < m_autospells.size() && m_autospells[i] != spellid; ++i)
|
for (i = 0; i < m_autospells.size() && m_autospells[i] != spellid; ++i)
|
||||||
{ ; } // just search
|
{
|
||||||
|
; // just search
|
||||||
|
}
|
||||||
|
|
||||||
if (i == m_autospells.size())
|
if (i == m_autospells.size())
|
||||||
{
|
{
|
||||||
|
|
@ -2162,7 +2254,9 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply)
|
||||||
{
|
{
|
||||||
AutoSpellList::iterator itr2 = m_autospells.begin();
|
AutoSpellList::iterator itr2 = m_autospells.begin();
|
||||||
for (i = 0; i < m_autospells.size() && m_autospells[i] != spellid; ++i, ++itr2)
|
for (i = 0; i < m_autospells.size() && m_autospells[i] != spellid; ++i, ++itr2)
|
||||||
{ ; } // just search
|
{
|
||||||
|
; // just search
|
||||||
|
}
|
||||||
|
|
||||||
if (i < m_autospells.size())
|
if (i < m_autospells.size())
|
||||||
{
|
{
|
||||||
|
|
@ -2361,7 +2455,9 @@ void Pet::SynchronizeLevelWithOwner()
|
||||||
GivePetLevel(owner->getLevel());
|
GivePetLevel(owner->getLevel());
|
||||||
}
|
}
|
||||||
else if (getLevel() + 5 < owner->getLevel())
|
else if (getLevel() + 5 < owner->getLevel())
|
||||||
|
{
|
||||||
GivePetLevel(owner->getLevel() - 5);
|
GivePetLevel(owner->getLevel() - 5);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
@ -2407,9 +2503,13 @@ void Pet::SetStayPosition(bool stay)
|
||||||
void Pet::ApplyModeFlags(PetModeFlags mode, bool apply)
|
void Pet::ApplyModeFlags(PetModeFlags mode, bool apply)
|
||||||
{
|
{
|
||||||
if (apply)
|
if (apply)
|
||||||
|
{
|
||||||
m_petModeFlags = PetModeFlags(m_petModeFlags | mode);
|
m_petModeFlags = PetModeFlags(m_petModeFlags | mode);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_petModeFlags = PetModeFlags(m_petModeFlags & ~mode);
|
m_petModeFlags = PetModeFlags(m_petModeFlags & ~mode);
|
||||||
|
}
|
||||||
|
|
||||||
Unit* owner = GetOwner();
|
Unit* owner = GetOwner();
|
||||||
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
|
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
|
||||||
|
|
|
||||||
|
|
@ -166,19 +166,27 @@ class Pet : public Creature
|
||||||
uint32 GetPetAutoSpellOnPos(uint8 pos) const override
|
uint32 GetPetAutoSpellOnPos(uint8 pos) const override
|
||||||
{
|
{
|
||||||
if (pos >= m_autospells.size())
|
if (pos >= m_autospells.size())
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return m_autospells[pos];
|
return m_autospells[pos];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
virtual bool CanSwim() const override
|
virtual bool CanSwim() const override
|
||||||
{
|
{
|
||||||
Unit const* owner = GetOwner();
|
Unit const* owner = GetOwner();
|
||||||
if (owner)
|
if (owner)
|
||||||
|
{
|
||||||
return owner->GetTypeId() == TYPEID_PLAYER ? true : ((Creature const*)owner)->CanSwim();
|
return owner->GetTypeId() == TYPEID_PLAYER ? true : ((Creature const*)owner)->CanSwim();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return Creature::CanSwim();
|
return Creature::CanSwim();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void RegenerateAll(uint32 update_diff) override; // overwrite Creature::RegenerateAll
|
void RegenerateAll(uint32 update_diff) override; // overwrite Creature::RegenerateAll
|
||||||
void GivePetXP(uint32 xp);
|
void GivePetXP(uint32 xp);
|
||||||
|
|
|
||||||
|
|
@ -71,9 +71,11 @@ void PetAI::MoveInLineOfSight(Unit* pWho)
|
||||||
AttackStart(pWho);
|
AttackStart(pWho);
|
||||||
|
|
||||||
if (Unit* owner = m_creature->GetOwner())
|
if (Unit* owner = m_creature->GetOwner())
|
||||||
|
{
|
||||||
owner->SetInCombatState(true, pWho);
|
owner->SetInCombatState(true, pWho);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PetAI::AttackStart(Unit* u)
|
void PetAI::AttackStart(Unit* u)
|
||||||
|
|
@ -90,7 +92,9 @@ void PetAI::AttackStart(Unit* u)
|
||||||
// hope it doesn't start to leak memory without this :-/
|
// hope it doesn't start to leak memory without this :-/
|
||||||
// i_pet->Clear();
|
// i_pet->Clear();
|
||||||
if (!m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
|
if (!m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
|
||||||
|
{
|
||||||
HandleMovementOnAttackStart(u);
|
HandleMovementOnAttackStart(u);
|
||||||
|
}
|
||||||
|
|
||||||
inCombat = true;
|
inCombat = true;
|
||||||
}
|
}
|
||||||
|
|
@ -145,7 +149,9 @@ void PetAI::UpdateAI(const uint32 diff)
|
||||||
Unit* victim = NULL;
|
Unit* victim = NULL;
|
||||||
|
|
||||||
if (!((Pet*)m_creature)->isControlled())
|
if (!((Pet*)m_creature)->isControlled())
|
||||||
|
{
|
||||||
m_creature->SelectHostileTarget();
|
m_creature->SelectHostileTarget();
|
||||||
|
}
|
||||||
|
|
||||||
// Creature pets and guardians will always look in threat list for victim
|
// Creature pets and guardians will always look in threat list for victim
|
||||||
if (!(m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE)
|
if (!(m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE)
|
||||||
|
|
@ -154,7 +160,9 @@ void PetAI::UpdateAI(const uint32 diff)
|
||||||
|
|
||||||
if (m_updateAlliesTimer <= diff)
|
if (m_updateAlliesTimer <= diff)
|
||||||
// UpdateAllies self set update timer
|
// UpdateAllies self set update timer
|
||||||
{ UpdateAllies(); }
|
{
|
||||||
|
UpdateAllies();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_updateAlliesTimer -= diff;
|
m_updateAlliesTimer -= diff;
|
||||||
|
|
@ -171,13 +179,17 @@ void PetAI::UpdateAI(const uint32 diff)
|
||||||
if (!owner->IsWithinDistInMap(m_creature, (PET_FOLLOW_DIST * 2)))
|
if (!owner->IsWithinDistInMap(m_creature, (PET_FOLLOW_DIST * 2)))
|
||||||
{
|
{
|
||||||
if (!m_creature->hasUnitState(UNIT_STAT_FOLLOW))
|
if (!m_creature->hasUnitState(UNIT_STAT_FOLLOW))
|
||||||
|
{
|
||||||
m_creature->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
|
m_creature->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
((Pet*)m_creature)->SetIsRetreating();
|
((Pet*)m_creature)->SetIsRetreating();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (((Pet*)m_creature)->GetSpellOpener() != 0) // have opener stored
|
else if (((Pet*)m_creature)->GetSpellOpener() != 0) // have opener stored
|
||||||
{
|
{
|
||||||
uint32 minRange = ((Pet*)m_creature)->GetSpellOpenerMinRange();
|
uint32 minRange = ((Pet*)m_creature)->GetSpellOpenerMinRange();
|
||||||
|
|
@ -195,10 +207,14 @@ void PetAI::UpdateAI(const uint32 diff)
|
||||||
m_creature->SetInFront(victim);
|
m_creature->SetInFront(victim);
|
||||||
|
|
||||||
if (victim->GetTypeId() == TYPEID_PLAYER)
|
if (victim->GetTypeId() == TYPEID_PLAYER)
|
||||||
|
{
|
||||||
m_creature->SendCreateUpdateToPlayer((Player*)victim);
|
m_creature->SendCreateUpdateToPlayer((Player*)victim);
|
||||||
|
}
|
||||||
|
|
||||||
if (owner->GetTypeId() == TYPEID_PLAYER)
|
if (owner->GetTypeId() == TYPEID_PLAYER)
|
||||||
|
{
|
||||||
m_creature->SendCreateUpdateToPlayer((Player*)owner);
|
m_creature->SendCreateUpdateToPlayer((Player*)owner);
|
||||||
|
}
|
||||||
|
|
||||||
uint32 spell_id = ((Pet*)m_creature)->GetSpellOpener();
|
uint32 spell_id = ((Pet*)m_creature)->GetSpellOpener();
|
||||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell_id);
|
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell_id);
|
||||||
|
|
@ -213,7 +229,9 @@ void PetAI::UpdateAI(const uint32 diff)
|
||||||
spell->SpellStart(&(spell->m_targets));
|
spell->SpellStart(&(spell->m_targets));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
delete spell;
|
delete spell;
|
||||||
|
}
|
||||||
|
|
||||||
((Pet*)m_creature)->SetSpellOpener();
|
((Pet*)m_creature)->SetSpellOpener();
|
||||||
}
|
}
|
||||||
|
|
@ -280,7 +298,9 @@ void PetAI::UpdateAI(const uint32 diff)
|
||||||
}
|
}
|
||||||
// just ignore non-combat spells
|
// just ignore non-combat spells
|
||||||
else if (IsNonCombatSpell(spellInfo))
|
else if (IsNonCombatSpell(spellInfo))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Spell* spell = new Spell(m_creature, spellInfo, false);
|
Spell* spell = new Spell(m_creature, spellInfo, false);
|
||||||
|
|
||||||
|
|
@ -357,7 +377,9 @@ void PetAI::UpdateAI(const uint32 diff)
|
||||||
|
|
||||||
// Guardians will always look in threat list for victim
|
// Guardians will always look in threat list for victim
|
||||||
if (!((Pet*)m_creature)->isControlled())
|
if (!((Pet*)m_creature)->isControlled())
|
||||||
|
{
|
||||||
m_creature->SelectHostileTarget();
|
m_creature->SelectHostileTarget();
|
||||||
|
}
|
||||||
|
|
||||||
if (!(m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE)
|
if (!(m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE)
|
||||||
|| (m_creature->IsPet() && ((Pet*)m_creature)->GetModeFlags() & PET_MODE_DISABLE_ACTIONS)))
|
|| (m_creature->IsPet() && ((Pet*)m_creature)->GetModeFlags() & PET_MODE_DISABLE_ACTIONS)))
|
||||||
|
|
@ -390,15 +412,21 @@ void PetAI::UpdateAI(const uint32 diff)
|
||||||
{
|
{
|
||||||
m_creature->SetInFront(victim);
|
m_creature->SetInFront(victim);
|
||||||
if (victim->GetTypeId() == TYPEID_PLAYER)
|
if (victim->GetTypeId() == TYPEID_PLAYER)
|
||||||
|
{
|
||||||
m_creature->SendCreateUpdateToPlayer((Player*)victim);
|
m_creature->SendCreateUpdateToPlayer((Player*)victim);
|
||||||
|
}
|
||||||
|
|
||||||
if (owner && owner->GetTypeId() == TYPEID_PLAYER)
|
if (owner && owner->GetTypeId() == TYPEID_PLAYER)
|
||||||
|
{
|
||||||
m_creature->SendCreateUpdateToPlayer((Player*)owner);
|
m_creature->SendCreateUpdateToPlayer((Player*)owner);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (DoMeleeAttackIfReady())
|
if (DoMeleeAttackIfReady())
|
||||||
|
{
|
||||||
victim->AddThreat(m_creature);
|
victim->AddThreat(m_creature);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (!(m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)
|
else if (!(m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)
|
||||||
|| m_creature->hasUnitState(UNIT_STAT_MOVING)))
|
|| m_creature->hasUnitState(UNIT_STAT_MOVING)))
|
||||||
AttackStart(victim);
|
AttackStart(victim);
|
||||||
|
|
@ -418,7 +446,9 @@ void PetAI::UpdateAI(const uint32 diff)
|
||||||
{
|
{
|
||||||
//if stay command is set but we dont have stay pos set then we need to establish current pos as stay position
|
//if stay command is set but we dont have stay pos set then we need to establish current pos as stay position
|
||||||
if (!pet->IsStayPosSet())
|
if (!pet->IsStayPosSet())
|
||||||
|
{
|
||||||
pet->SetStayPosition(true);
|
pet->SetStayPosition(true);
|
||||||
|
}
|
||||||
|
|
||||||
float stayPosX = pet->GetStayPosX();
|
float stayPosX = pet->GetStayPosX();
|
||||||
float stayPosY = pet->GetStayPosY();
|
float stayPosY = pet->GetStayPosY();
|
||||||
|
|
@ -436,12 +466,16 @@ void PetAI::UpdateAI(const uint32 diff)
|
||||||
m_creature->GetMotionMaster()->MoveIdle();
|
m_creature->GetMotionMaster()->MoveIdle();
|
||||||
}
|
}
|
||||||
else if (m_creature->GetOrientation() != StayPosO)
|
else if (m_creature->GetOrientation() != StayPosO)
|
||||||
|
{
|
||||||
m_creature->SetOrientation(StayPosO);
|
m_creature->SetOrientation(StayPosO);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
pet->GetMotionMaster()->MovePoint(0, stayPosX, stayPosY, stayPosZ, false);
|
pet->GetMotionMaster()->MovePoint(0, stayPosX, stayPosY, stayPosZ, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (m_creature->hasUnitState(UNIT_STAT_FOLLOW))
|
else if (m_creature->hasUnitState(UNIT_STAT_FOLLOW))
|
||||||
{
|
{
|
||||||
if (owner->IsWithinDistInMap(m_creature, PET_FOLLOW_DIST))
|
if (owner->IsWithinDistInMap(m_creature, PET_FOLLOW_DIST))
|
||||||
|
|
@ -522,5 +556,7 @@ void PetAI::AttackedBy(Unit* attacker)
|
||||||
if (!(m_creature->getVictim() || ((Pet*)m_creature)->GetIsRetreating() == true)
|
if (!(m_creature->getVictim() || ((Pet*)m_creature)->GetIsRetreating() == true)
|
||||||
&& !(m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE)
|
&& !(m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE)
|
||||||
|| (m_creature->GetCharmInfo() && m_creature->GetCharmInfo()->HasReactState(REACT_PASSIVE))))
|
|| (m_creature->GetCharmInfo() && m_creature->GetCharmInfo()->HasReactState(REACT_PASSIVE))))
|
||||||
{ AttackStart(attacker); }
|
{
|
||||||
|
AttackStart(attacker);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -257,10 +257,14 @@ struct Glyph
|
||||||
else if (newId == 0)
|
else if (newId == 0)
|
||||||
{
|
{
|
||||||
if (uState == GLYPH_NEW) // delete before add new -> no change
|
if (uState == GLYPH_NEW) // delete before add new -> no change
|
||||||
|
{
|
||||||
uState = GLYPH_UNCHANGED;
|
uState = GLYPH_UNCHANGED;
|
||||||
|
}
|
||||||
else // delete existing data
|
else // delete existing data
|
||||||
|
{
|
||||||
uState = GLYPH_DELETED;
|
uState = GLYPH_DELETED;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (uState != GLYPH_NEW) // if not new data, change current data
|
else if (uState != GLYPH_NEW) // if not new data, change current data
|
||||||
{
|
{
|
||||||
uState = GLYPH_CHANGED;
|
uState = GLYPH_CHANGED;
|
||||||
|
|
@ -404,10 +408,14 @@ struct Runes
|
||||||
void SetRuneState(uint8 index, bool set = true)
|
void SetRuneState(uint8 index, bool set = true)
|
||||||
{
|
{
|
||||||
if (set)
|
if (set)
|
||||||
|
{
|
||||||
runeState |= (1 << index); // usable
|
runeState |= (1 << index); // usable
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
runeState &= ~(1 << index); // on cooldown
|
runeState &= ~(1 << index); // on cooldown
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct EnchantDuration
|
struct EnchantDuration
|
||||||
|
|
@ -1661,14 +1669,20 @@ class Player : public Unit
|
||||||
void ModifyMoney(int64 d)
|
void ModifyMoney(int64 d)
|
||||||
{
|
{
|
||||||
if (d < 0)
|
if (d < 0)
|
||||||
|
{
|
||||||
SetMoney(GetMoney() > uint64(-d) ? GetMoney() + d : 0);
|
SetMoney(GetMoney() > uint64(-d) ? GetMoney() + d : 0);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
SetMoney(GetMoney() < uint64(MAX_MONEY_AMOUNT - d) ? GetMoney() + d : MAX_MONEY_AMOUNT);
|
SetMoney(GetMoney() < uint64(MAX_MONEY_AMOUNT - d) ? GetMoney() + d : MAX_MONEY_AMOUNT);
|
||||||
|
}
|
||||||
|
|
||||||
// "At Gold Limit"
|
// "At Gold Limit"
|
||||||
if (GetMoney() >= MAX_MONEY_AMOUNT)
|
if (GetMoney() >= MAX_MONEY_AMOUNT)
|
||||||
|
{
|
||||||
SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL);
|
SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
void SetMoney(uint64 value)
|
void SetMoney(uint64 value)
|
||||||
{
|
{
|
||||||
SetUInt64Value(PLAYER_FIELD_COINAGE, value);
|
SetUInt64Value(PLAYER_FIELD_COINAGE, value);
|
||||||
|
|
|
||||||
|
|
@ -129,5 +129,7 @@ ReactorAI::EnterEvadeMode()
|
||||||
|
|
||||||
// Remove ChaseMovementGenerator from MotionMaster stack list, and add HomeMovementGenerator instead
|
// Remove ChaseMovementGenerator from MotionMaster stack list, and add HomeMovementGenerator instead
|
||||||
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE)
|
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE)
|
||||||
|
{
|
||||||
m_creature->GetMotionMaster()->MoveTargetedHome();
|
m_creature->GetMotionMaster()->MoveTargetedHome();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -106,9 +106,13 @@ ReputationRank ReputationMgr::GetBaseRank(FactionEntry const* factionEntry) cons
|
||||||
void ReputationMgr::ApplyForceReaction(uint32 faction_id, ReputationRank rank, bool apply)
|
void ReputationMgr::ApplyForceReaction(uint32 faction_id, ReputationRank rank, bool apply)
|
||||||
{
|
{
|
||||||
if (apply)
|
if (apply)
|
||||||
|
{
|
||||||
m_forcedReactions[faction_id] = rank;
|
m_forcedReactions[faction_id] = rank;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_forcedReactions.erase(faction_id);
|
m_forcedReactions.erase(faction_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 ReputationMgr::GetDefaultStateFlags(FactionEntry const* factionEntry) const
|
uint32 ReputationMgr::GetDefaultStateFlags(FactionEntry const* factionEntry) const
|
||||||
|
|
@ -244,7 +248,9 @@ void ReputationMgr::Initialize()
|
||||||
newFaction.needSave = true;
|
newFaction.needSave = true;
|
||||||
|
|
||||||
if (newFaction.Flags & FACTION_FLAG_VISIBLE)
|
if (newFaction.Flags & FACTION_FLAG_VISIBLE)
|
||||||
|
{
|
||||||
++m_visibleFactionCount;
|
++m_visibleFactionCount;
|
||||||
|
}
|
||||||
|
|
||||||
UpdateRankCounters(REP_HOSTILE, GetBaseRank(factionEntry));
|
UpdateRankCounters(REP_HOSTILE, GetBaseRank(factionEntry));
|
||||||
|
|
||||||
|
|
@ -274,11 +280,13 @@ void ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi
|
||||||
// bonuses are already given, so just modify standing by rate
|
// bonuses are already given, so just modify standing by rate
|
||||||
int32 spilloverRep = standing * repTemplate->faction_rate[i];
|
int32 spilloverRep = standing * repTemplate->faction_rate[i];
|
||||||
if (SetOneFactionReputation(sFactionStore.LookupEntry(repTemplate->faction[i]), spilloverRep, incremental))
|
if (SetOneFactionReputation(sFactionStore.LookupEntry(repTemplate->faction[i]), spilloverRep, incremental))
|
||||||
|
{
|
||||||
anyRankIncreased = true;
|
anyRankIncreased = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float spillOverRepOut = standing;
|
float spillOverRepOut = standing;
|
||||||
|
|
@ -295,8 +303,10 @@ void ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi
|
||||||
if (parentState != m_factions.end() && (parentState->second.Flags & FACTION_FLAG_TEAM_REPUTATION))
|
if (parentState != m_factions.end() && (parentState->second.Flags & FACTION_FLAG_TEAM_REPUTATION))
|
||||||
{
|
{
|
||||||
if (SetOneFactionReputation(parent, int32(spillOverRepOut), incremental))
|
if (SetOneFactionReputation(parent, int32(spillOverRepOut), incremental))
|
||||||
|
{
|
||||||
anyRankIncreased = true;
|
anyRankIncreased = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else // spill to "sister" factions
|
else // spill to "sister" factions
|
||||||
{
|
{
|
||||||
flist = GetFactionTeamList(factionEntry->team);
|
flist = GetFactionTeamList(factionEntry->team);
|
||||||
|
|
@ -311,22 +321,28 @@ void ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi
|
||||||
if (FactionEntry const* factionEntryCalc = sFactionStore.LookupEntry(*itr))
|
if (FactionEntry const* factionEntryCalc = sFactionStore.LookupEntry(*itr))
|
||||||
{
|
{
|
||||||
if (factionEntryCalc == factionEntry || GetRank(factionEntryCalc) > ReputationRank(factionEntryCalc->spilloverMaxRankIn))
|
if (factionEntryCalc == factionEntry || GetRank(factionEntryCalc) > ReputationRank(factionEntryCalc->spilloverMaxRankIn))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
int32 spilloverRep = int32(spillOverRepOut * factionEntryCalc->spilloverRateIn);
|
int32 spilloverRep = int32(spillOverRepOut * factionEntryCalc->spilloverRateIn);
|
||||||
if (spilloverRep != 0 || !incremental)
|
if (spilloverRep != 0 || !incremental)
|
||||||
if (SetOneFactionReputation(factionEntryCalc, spilloverRep, incremental))
|
if (SetOneFactionReputation(factionEntryCalc, spilloverRep, incremental))
|
||||||
|
{
|
||||||
anyRankIncreased = true;
|
anyRankIncreased = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// spillover done, update faction itself
|
// spillover done, update faction itself
|
||||||
FactionStateList::iterator faction = m_factions.find(factionEntry->reputationListID);
|
FactionStateList::iterator faction = m_factions.find(factionEntry->reputationListID);
|
||||||
if (faction != m_factions.end())
|
if (faction != m_factions.end())
|
||||||
{
|
{
|
||||||
if (SetOneFactionReputation(factionEntry, standing, incremental))
|
if (SetOneFactionReputation(factionEntry, standing, incremental))
|
||||||
|
{
|
||||||
anyRankIncreased = true;
|
anyRankIncreased = true;
|
||||||
|
}
|
||||||
|
|
||||||
// only this faction gets reported to client, even if it has no own visible standing
|
// only this faction gets reported to client, even if it has no own visible standing
|
||||||
SendState(&faction->second, anyRankIncreased);
|
SendState(&faction->second, anyRankIncreased);
|
||||||
|
|
@ -342,12 +358,18 @@ bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, in
|
||||||
int32 BaseRep = GetBaseReputation(factionEntry);
|
int32 BaseRep = GetBaseReputation(factionEntry);
|
||||||
|
|
||||||
if (incremental)
|
if (incremental)
|
||||||
|
{
|
||||||
standing += faction.Standing + BaseRep;
|
standing += faction.Standing + BaseRep;
|
||||||
|
}
|
||||||
|
|
||||||
if (standing > Reputation_Cap)
|
if (standing > Reputation_Cap)
|
||||||
|
{
|
||||||
standing = Reputation_Cap;
|
standing = Reputation_Cap;
|
||||||
|
}
|
||||||
else if (standing < Reputation_Bottom)
|
else if (standing < Reputation_Bottom)
|
||||||
|
{
|
||||||
standing = Reputation_Bottom;
|
standing = Reputation_Bottom;
|
||||||
|
}
|
||||||
|
|
||||||
ReputationRank old_rank = ReputationToRank(faction.Standing + BaseRep);
|
ReputationRank old_rank = ReputationToRank(faction.Standing + BaseRep);
|
||||||
ReputationRank new_rank = ReputationToRank(standing);
|
ReputationRank new_rank = ReputationToRank(standing);
|
||||||
|
|
@ -359,7 +381,9 @@ bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, in
|
||||||
SetVisible(&faction);
|
SetVisible(&faction);
|
||||||
|
|
||||||
if (new_rank <= REP_HOSTILE)
|
if (new_rank <= REP_HOSTILE)
|
||||||
|
{
|
||||||
SetAtWar(&faction, true);
|
SetAtWar(&faction, true);
|
||||||
|
}
|
||||||
|
|
||||||
UpdateRankCounters(old_rank, new_rank);
|
UpdateRankCounters(old_rank, new_rank);
|
||||||
|
|
||||||
|
|
@ -388,7 +412,9 @@ void ReputationMgr::SetVisible(FactionTemplateEntry const* factionTemplateEntry)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction))
|
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction))
|
||||||
|
{
|
||||||
SetVisible(factionEntry);
|
SetVisible(factionEntry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReputationMgr::SetVisible(FactionEntry const* factionEntry)
|
void ReputationMgr::SetVisible(FactionEntry const* factionEntry)
|
||||||
|
|
@ -462,9 +488,13 @@ void ReputationMgr::SetAtWar(FactionState* faction, bool atWar)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (atWar)
|
if (atWar)
|
||||||
|
{
|
||||||
faction->Flags |= FACTION_FLAG_AT_WAR;
|
faction->Flags |= FACTION_FLAG_AT_WAR;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
faction->Flags &= ~FACTION_FLAG_AT_WAR;
|
faction->Flags &= ~FACTION_FLAG_AT_WAR;
|
||||||
|
}
|
||||||
|
|
||||||
faction->needSend = true;
|
faction->needSend = true;
|
||||||
faction->needSave = true;
|
faction->needSave = true;
|
||||||
|
|
@ -496,9 +526,13 @@ void ReputationMgr::SetInactive(FactionState* faction, bool inactive)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inactive)
|
if (inactive)
|
||||||
|
{
|
||||||
faction->Flags |= FACTION_FLAG_INACTIVE;
|
faction->Flags |= FACTION_FLAG_INACTIVE;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
faction->Flags &= ~FACTION_FLAG_INACTIVE;
|
faction->Flags &= ~FACTION_FLAG_INACTIVE;
|
||||||
|
}
|
||||||
|
|
||||||
faction->needSend = true;
|
faction->needSend = true;
|
||||||
faction->needSave = true;
|
faction->needSave = true;
|
||||||
|
|
@ -553,10 +587,14 @@ void ReputationMgr::LoadFromDB(QueryResult* result)
|
||||||
if (forceItr != m_forcedReactions.end())
|
if (forceItr != m_forcedReactions.end())
|
||||||
{
|
{
|
||||||
if (forceItr->second <= REP_HOSTILE)
|
if (forceItr->second <= REP_HOSTILE)
|
||||||
|
{
|
||||||
SetAtWar(faction, true);
|
SetAtWar(faction, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (GetRank(factionEntry) <= REP_HOSTILE)
|
else if (GetRank(factionEntry) <= REP_HOSTILE)
|
||||||
|
{
|
||||||
SetAtWar(faction, true);
|
SetAtWar(faction, true);
|
||||||
|
}
|
||||||
|
|
||||||
// reset changed flag if values similar to saved in DB
|
// reset changed flag if values similar to saved in DB
|
||||||
if (faction->Flags == dbFactionFlags)
|
if (faction->Flags == dbFactionFlags)
|
||||||
|
|
@ -595,16 +633,28 @@ void ReputationMgr::SaveToDB()
|
||||||
void ReputationMgr::UpdateRankCounters(ReputationRank old_rank, ReputationRank new_rank)
|
void ReputationMgr::UpdateRankCounters(ReputationRank old_rank, ReputationRank new_rank)
|
||||||
{
|
{
|
||||||
if (old_rank >= REP_EXALTED)
|
if (old_rank >= REP_EXALTED)
|
||||||
|
{
|
||||||
--m_exaltedFactionCount;
|
--m_exaltedFactionCount;
|
||||||
|
}
|
||||||
if (old_rank >= REP_REVERED)
|
if (old_rank >= REP_REVERED)
|
||||||
|
{
|
||||||
--m_reveredFactionCount;
|
--m_reveredFactionCount;
|
||||||
|
}
|
||||||
if (old_rank >= REP_HONORED)
|
if (old_rank >= REP_HONORED)
|
||||||
|
{
|
||||||
--m_honoredFactionCount;
|
--m_honoredFactionCount;
|
||||||
|
}
|
||||||
|
|
||||||
if (new_rank >= REP_EXALTED)
|
if (new_rank >= REP_EXALTED)
|
||||||
|
{
|
||||||
++m_exaltedFactionCount;
|
++m_exaltedFactionCount;
|
||||||
|
}
|
||||||
if (new_rank >= REP_REVERED)
|
if (new_rank >= REP_REVERED)
|
||||||
|
{
|
||||||
++m_reveredFactionCount;
|
++m_reveredFactionCount;
|
||||||
|
}
|
||||||
if (new_rank >= REP_HONORED)
|
if (new_rank >= REP_HONORED)
|
||||||
|
{
|
||||||
++m_honoredFactionCount;
|
++m_honoredFactionCount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,10 @@ uint32 PlayerSocial::GetNumberOfSocialsWithFlag(SocialFlag flag)
|
||||||
for (PlayerSocialMap::const_iterator itr = m_playerSocialMap.begin(); itr != m_playerSocialMap.end(); ++itr)
|
for (PlayerSocialMap::const_iterator itr = m_playerSocialMap.begin(); itr != m_playerSocialMap.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (itr->second.Flags & flag)
|
if (itr->second.Flags & flag)
|
||||||
|
{
|
||||||
++counter;
|
++counter;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return counter;
|
return counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -74,7 +76,9 @@ bool PlayerSocial::AddToSocialList(ObjectGuid friend_guid, bool ignore)
|
||||||
|
|
||||||
uint32 flag = SOCIAL_FLAG_FRIEND;
|
uint32 flag = SOCIAL_FLAG_FRIEND;
|
||||||
if (ignore)
|
if (ignore)
|
||||||
|
{
|
||||||
flag = SOCIAL_FLAG_IGNORED;
|
flag = SOCIAL_FLAG_IGNORED;
|
||||||
|
}
|
||||||
|
|
||||||
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid.GetCounter());
|
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid.GetCounter());
|
||||||
if (itr != m_playerSocialMap.end())
|
if (itr != m_playerSocialMap.end())
|
||||||
|
|
@ -102,7 +106,9 @@ void PlayerSocial::RemoveFromSocialList(ObjectGuid friend_guid, bool ignore)
|
||||||
|
|
||||||
uint32 flag = SOCIAL_FLAG_FRIEND;
|
uint32 flag = SOCIAL_FLAG_FRIEND;
|
||||||
if (ignore)
|
if (ignore)
|
||||||
|
{
|
||||||
flag = SOCIAL_FLAG_IGNORED;
|
flag = SOCIAL_FLAG_IGNORED;
|
||||||
|
}
|
||||||
|
|
||||||
itr->second.Flags &= ~flag;
|
itr->second.Flags &= ~flag;
|
||||||
if (itr->second.Flags == 0)
|
if (itr->second.Flags == 0)
|
||||||
|
|
@ -214,7 +220,9 @@ void SocialMgr::GetFriendInfo(Player* player, uint32 friend_lowguid, FriendInfo&
|
||||||
|
|
||||||
PlayerSocialMap::iterator itr = player->GetSocial()->m_playerSocialMap.find(friend_lowguid);
|
PlayerSocialMap::iterator itr = player->GetSocial()->m_playerSocialMap.find(friend_lowguid);
|
||||||
if (itr != player->GetSocial()->m_playerSocialMap.end())
|
if (itr != player->GetSocial()->m_playerSocialMap.end())
|
||||||
|
{
|
||||||
friendInfo.Note = itr->second.Note;
|
friendInfo.Note = itr->second.Note;
|
||||||
|
}
|
||||||
|
|
||||||
// PLAYER see his team only and PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters
|
// PLAYER see his team only and PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters
|
||||||
// MODERATOR, GAME MASTER, ADMINISTRATOR can see all
|
// MODERATOR, GAME MASTER, ADMINISTRATOR can see all
|
||||||
|
|
@ -225,9 +233,13 @@ void SocialMgr::GetFriendInfo(Player* player, uint32 friend_lowguid, FriendInfo&
|
||||||
{
|
{
|
||||||
friendInfo.Status = FRIEND_STATUS_ONLINE;
|
friendInfo.Status = FRIEND_STATUS_ONLINE;
|
||||||
if (pFriend->isAFK())
|
if (pFriend->isAFK())
|
||||||
|
{
|
||||||
friendInfo.Status = FRIEND_STATUS_AFK;
|
friendInfo.Status = FRIEND_STATUS_AFK;
|
||||||
|
}
|
||||||
if (pFriend->isDND())
|
if (pFriend->isDND())
|
||||||
|
{
|
||||||
friendInfo.Status = FRIEND_STATUS_DND;
|
friendInfo.Status = FRIEND_STATUS_DND;
|
||||||
|
}
|
||||||
friendInfo.Area = pFriend->GetZoneId();
|
friendInfo.Area = pFriend->GetZoneId();
|
||||||
friendInfo.Level = pFriend->getLevel();
|
friendInfo.Level = pFriend->getLevel();
|
||||||
friendInfo.Class = pFriend->getClass();
|
friendInfo.Class = pFriend->getClass();
|
||||||
|
|
@ -281,9 +293,13 @@ void SocialMgr::SendFriendStatus(Player* player, FriendsResult result, ObjectGui
|
||||||
}
|
}
|
||||||
|
|
||||||
if (broadcast)
|
if (broadcast)
|
||||||
|
{
|
||||||
BroadcastToFriendListers(player, &data);
|
BroadcastToFriendListers(player, &data);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
player->GetSession()->SendPacket(&data);
|
player->GetSession()->SendPacket(&data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SocialMgr::BroadcastToFriendListers(Player* player, WorldPacket* packet)
|
void SocialMgr::BroadcastToFriendListers(Player* player, WorldPacket* packet)
|
||||||
|
|
@ -345,17 +361,25 @@ PlayerSocial* SocialMgr::LoadFromDB(QueryResult* result, ObjectGuid guid)
|
||||||
note = fields[2].GetCppString();
|
note = fields[2].GetCppString();
|
||||||
|
|
||||||
if ((flags & SOCIAL_FLAG_IGNORED) && ignoreCounter >= SOCIALMGR_IGNORE_LIMIT)
|
if ((flags & SOCIAL_FLAG_IGNORED) && ignoreCounter >= SOCIALMGR_IGNORE_LIMIT)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
if ((flags & SOCIAL_FLAG_FRIEND) && friendCounter >= SOCIALMGR_FRIEND_LIMIT)
|
if ((flags & SOCIAL_FLAG_FRIEND) && friendCounter >= SOCIALMGR_FRIEND_LIMIT)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
social->m_playerSocialMap[friend_guid] = FriendInfo(flags, note);
|
social->m_playerSocialMap[friend_guid] = FriendInfo(flags, note);
|
||||||
|
|
||||||
if (flags & SOCIAL_FLAG_IGNORED)
|
if (flags & SOCIAL_FLAG_IGNORED)
|
||||||
|
{
|
||||||
++ignoreCounter;
|
++ignoreCounter;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
++friendCounter;
|
++friendCounter;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
while (result->NextRow());
|
while (result->NextRow());
|
||||||
delete result;
|
delete result;
|
||||||
return social;
|
return social;
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -371,7 +371,9 @@ inline bool IsSpellWithCasterSourceTargetsOnly(SpellEntry const* spellInfo)
|
||||||
{
|
{
|
||||||
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(i));
|
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(i));
|
||||||
if(!effectEntry)
|
if(!effectEntry)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 targetA = effectEntry->EffectImplicitTargetA;
|
uint32 targetA = effectEntry->EffectImplicitTargetA;
|
||||||
if(targetA && !IsCasterSourceTarget(targetA))
|
if(targetA && !IsCasterSourceTarget(targetA))
|
||||||
|
|
@ -504,7 +506,9 @@ inline bool HasAreaAuraEffect(SpellEntry const* spellInfo)
|
||||||
{
|
{
|
||||||
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(i));
|
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(i));
|
||||||
if(!effectEntry)
|
if(!effectEntry)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
if (IsAreaAuraEffect(effectEntry->Effect))
|
if (IsAreaAuraEffect(effectEntry->Effect))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -519,7 +523,9 @@ inline bool HasAuraWithTriggerEffect(SpellEntry const* spellInfo)
|
||||||
{
|
{
|
||||||
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(i));
|
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(i));
|
||||||
if(!effectEntry)
|
if(!effectEntry)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
switch(effectEntry->Effect)
|
switch(effectEntry->Effect)
|
||||||
{
|
{
|
||||||
|
|
@ -539,7 +545,9 @@ inline bool IsOnlySelfTargeting(SpellEntry const* spellInfo)
|
||||||
{
|
{
|
||||||
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(i));
|
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(i));
|
||||||
if(!effectEntry)
|
if(!effectEntry)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
switch (effectEntry->EffectImplicitTargetA)
|
switch (effectEntry->EffectImplicitTargetA)
|
||||||
{
|
{
|
||||||
|
|
@ -626,20 +634,28 @@ inline uint32 GetSpellMechanicMask(SpellEntry const* spellInfo, uint32 effectMas
|
||||||
uint32 mask = 0;
|
uint32 mask = 0;
|
||||||
|
|
||||||
if (uint32 mech = spellInfo->GetMechanic())
|
if (uint32 mech = spellInfo->GetMechanic())
|
||||||
|
{
|
||||||
mask |= 1 << (mech - 1);
|
mask |= 1 << (mech - 1);
|
||||||
|
}
|
||||||
|
|
||||||
for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i)
|
for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i)
|
||||||
{
|
{
|
||||||
if (!(effectMask & (1 << i)))
|
if (!(effectMask & (1 << i)))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(i));
|
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(i));
|
||||||
if (!effectEntry)
|
if (!effectEntry)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (effectEntry->EffectMechanic)
|
if (effectEntry->EffectMechanic)
|
||||||
|
{
|
||||||
mask |= 1 << (effectEntry->EffectMechanic - 1);
|
mask |= 1 << (effectEntry->EffectMechanic - 1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
@ -649,14 +665,18 @@ inline uint32 GetAllSpellMechanicMask(SpellEntry const* spellInfo)
|
||||||
SpellCategoriesEntry const* spellCategory = spellInfo->GetSpellCategories();
|
SpellCategoriesEntry const* spellCategory = spellInfo->GetSpellCategories();
|
||||||
uint32 mask = 0;
|
uint32 mask = 0;
|
||||||
if (spellCategory && spellCategory->Mechanic)
|
if (spellCategory && spellCategory->Mechanic)
|
||||||
|
{
|
||||||
mask |= 1 << (spellCategory->Mechanic - 1);
|
mask |= 1 << (spellCategory->Mechanic - 1);
|
||||||
|
}
|
||||||
|
|
||||||
for (int i=0; i< MAX_EFFECT_INDEX; ++i)
|
for (int i=0; i< MAX_EFFECT_INDEX; ++i)
|
||||||
{
|
{
|
||||||
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(i));
|
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(i));
|
||||||
if (effectEntry && effectEntry->EffectMechanic)
|
if (effectEntry && effectEntry->EffectMechanic)
|
||||||
|
{
|
||||||
mask |= 1 << (effectEntry->EffectMechanic-1);
|
mask |= 1 << (effectEntry->EffectMechanic-1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,10 @@ bool Player::UpdateStats(Stats stat)
|
||||||
{
|
{
|
||||||
Pet* pet = GetPet();
|
Pet* pet = GetPet();
|
||||||
if (pet)
|
if (pet)
|
||||||
|
{
|
||||||
pet->UpdateStats(stat);
|
pet->UpdateStats(stat);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (stat)
|
switch (stat)
|
||||||
{
|
{
|
||||||
|
|
@ -90,13 +92,17 @@ bool Player::UpdateStats(Stats stat)
|
||||||
AuraList const& modRatingFromStat = GetAurasByType(SPELL_AURA_MOD_RATING_FROM_STAT);
|
AuraList const& modRatingFromStat = GetAurasByType(SPELL_AURA_MOD_RATING_FROM_STAT);
|
||||||
for (AuraList::const_iterator i = modRatingFromStat.begin(); i != modRatingFromStat.end(); ++i)
|
for (AuraList::const_iterator i = modRatingFromStat.begin(); i != modRatingFromStat.end(); ++i)
|
||||||
if (Stats((*i)->GetMiscBValue()) == stat)
|
if (Stats((*i)->GetMiscBValue()) == stat)
|
||||||
|
{
|
||||||
mask |= (*i)->GetMiscValue();
|
mask |= (*i)->GetMiscValue();
|
||||||
|
}
|
||||||
if (mask)
|
if (mask)
|
||||||
{
|
{
|
||||||
for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
|
for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
|
||||||
if (mask & (1 << rating))
|
if (mask & (1 << rating))
|
||||||
|
{
|
||||||
ApplyRatingMod(CombatRating(rating), 0, true);
|
ApplyRatingMod(CombatRating(rating), 0, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -174,8 +180,10 @@ void Player::UpdateResistances(uint32 school)
|
||||||
|
|
||||||
Pet* pet = GetPet();
|
Pet* pet = GetPet();
|
||||||
if (pet)
|
if (pet)
|
||||||
|
{
|
||||||
pet->UpdateResistances(school);
|
pet->UpdateResistances(school);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UpdateArmor();
|
UpdateArmor();
|
||||||
|
|
@ -197,8 +205,10 @@ void Player::UpdateArmor()
|
||||||
{
|
{
|
||||||
Modifier* mod = (*i)->GetModifier();
|
Modifier* mod = (*i)->GetModifier();
|
||||||
if (mod->m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)
|
if (mod->m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)
|
||||||
|
{
|
||||||
value += int32(GetStat(Stats((*i)->GetMiscBValue())) * mod->m_amount / 100.0f);
|
value += int32(GetStat(Stats((*i)->GetMiscBValue())) * mod->m_amount / 100.0f);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
value *= GetModifierValue(unitMod, TOTAL_PCT);
|
value *= GetModifierValue(unitMod, TOTAL_PCT);
|
||||||
|
|
||||||
|
|
@ -206,7 +216,9 @@ void Player::UpdateArmor()
|
||||||
|
|
||||||
Pet* pet = GetPet();
|
Pet* pet = GetPet();
|
||||||
if (pet)
|
if (pet)
|
||||||
|
{
|
||||||
pet->UpdateArmor();
|
pet->UpdateArmor();
|
||||||
|
}
|
||||||
|
|
||||||
UpdateAttackPowerAndDamage(); // armor dependent auras update for SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR
|
UpdateAttackPowerAndDamage(); // armor dependent auras update for SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR
|
||||||
}
|
}
|
||||||
|
|
@ -220,7 +232,9 @@ float Player::GetHealthBonusFromStamina()
|
||||||
float baseStam = stamina < 20 ? stamina : 20;
|
float baseStam = stamina < 20 ? stamina : 20;
|
||||||
float moreStam = stamina - baseStam;
|
float moreStam = stamina - baseStam;
|
||||||
if (moreStam < 0.0f)
|
if (moreStam < 0.0f)
|
||||||
|
{
|
||||||
moreStam = 0.0f;
|
moreStam = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
return baseStam + moreStam * hpBase->ratio;
|
return baseStam + moreStam * hpBase->ratio;
|
||||||
}
|
}
|
||||||
|
|
@ -321,9 +335,11 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
|
||||||
{
|
{
|
||||||
if (SpellShapeshiftFormEntry const * entry = sSpellShapeshiftFormStore.LookupEntry(uint32(GetShapeshiftForm())))
|
if (SpellShapeshiftFormEntry const * entry = sSpellShapeshiftFormStore.LookupEntry(uint32(GetShapeshiftForm())))
|
||||||
if (entry->flags1 & 0x20)
|
if (entry->flags1 & 0x20)
|
||||||
|
{
|
||||||
val2 += std::max(GetStat(STAT_AGILITY) - 10.0f, 0.0f) * chrEntry->apPerStr;
|
val2 += std::max(GetStat(STAT_AGILITY) - 10.0f, 0.0f) * chrEntry->apPerStr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SetModifierValue(unitMod, BASE_VALUE, val2);
|
SetModifierValue(unitMod, BASE_VALUE, val2);
|
||||||
|
|
||||||
|
|
@ -352,8 +368,10 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
|
||||||
|
|
||||||
Pet* pet = GetPet(); // update pet's AP
|
Pet* pet = GetPet(); // update pet's AP
|
||||||
if (pet)
|
if (pet)
|
||||||
|
{
|
||||||
pet->UpdateAttackPowerAndDamage();
|
pet->UpdateAttackPowerAndDamage();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UpdateDamagePhysical(BASE_ATTACK);
|
UpdateDamagePhysical(BASE_ATTACK);
|
||||||
|
|
@ -673,14 +691,20 @@ void Player::UpdateExpertise(WeaponAttackType attack)
|
||||||
{
|
{
|
||||||
// item neutral spell
|
// item neutral spell
|
||||||
if((*itr)->GetSpellProto()->GetEquippedItemClass() == -1)
|
if((*itr)->GetSpellProto()->GetEquippedItemClass() == -1)
|
||||||
|
{
|
||||||
expertise += (*itr)->GetModifier()->m_amount;
|
expertise += (*itr)->GetModifier()->m_amount;
|
||||||
|
}
|
||||||
// item dependent spell
|
// item dependent spell
|
||||||
else if (weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellProto()))
|
else if (weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellProto()))
|
||||||
|
{
|
||||||
expertise += (*itr)->GetModifier()->m_amount;
|
expertise += (*itr)->GetModifier()->m_amount;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (expertise < 0)
|
if (expertise < 0)
|
||||||
|
{
|
||||||
expertise = 0;
|
expertise = 0;
|
||||||
|
}
|
||||||
|
|
||||||
switch (attack)
|
switch (attack)
|
||||||
{
|
{
|
||||||
|
|
@ -758,24 +782,32 @@ void Player::UpdateMasteryAuras()
|
||||||
{
|
{
|
||||||
SpellAuraHolder* holder = GetSpellAuraHolder(masterySpells->at(i));
|
SpellAuraHolder* holder = GetSpellAuraHolder(masterySpells->at(i));
|
||||||
if (!holder)
|
if (!holder)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
SpellEntry const* spellEntry = holder->GetSpellProto();
|
SpellEntry const* spellEntry = holder->GetSpellProto();
|
||||||
|
|
||||||
// calculate mastery scaling coef
|
// calculate mastery scaling coef
|
||||||
int32 masteryCoef = GetMasteryCoefficient(spellEntry);
|
int32 masteryCoef = GetMasteryCoefficient(spellEntry);
|
||||||
if (!masteryCoef)
|
if (!masteryCoef)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// update aura modifiers
|
// update aura modifiers
|
||||||
for (uint32 j = 0; j < MAX_EFFECT_INDEX; ++j)
|
for (uint32 j = 0; j < MAX_EFFECT_INDEX; ++j)
|
||||||
{
|
{
|
||||||
Aura* aura = holder->GetAuraByEffectIndex(SpellEffectIndex(j));
|
Aura* aura = holder->GetAuraByEffectIndex(SpellEffectIndex(j));
|
||||||
if (!aura)
|
if (!aura)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (spellEntry->CalculateSimpleValue(SpellEffectIndex(j)))
|
if (spellEntry->CalculateSimpleValue(SpellEffectIndex(j)))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
aura->ApplyModifier(false, false);
|
aura->ApplyModifier(false, false);
|
||||||
aura->GetModifier()->m_amount = int32(masteryValue * masteryCoef / 100.0f);
|
aura->GetModifier()->m_amount = int32(masteryValue * masteryCoef / 100.0f);
|
||||||
|
|
@ -952,14 +984,18 @@ bool Pet::UpdateStats(Stats stat)
|
||||||
if (stat == STAT_STAMINA)
|
if (stat == STAT_STAMINA)
|
||||||
{
|
{
|
||||||
if (owner)
|
if (owner)
|
||||||
|
{
|
||||||
value += float(owner->GetStat(stat)) * 0.3f;
|
value += float(owner->GetStat(stat)) * 0.3f;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// warlock's and mage's pets gain 30% of owner's intellect
|
// warlock's and mage's pets gain 30% of owner's intellect
|
||||||
else if (stat == STAT_INTELLECT && getPetType() == SUMMON_PET)
|
else if (stat == STAT_INTELLECT && getPetType() == SUMMON_PET)
|
||||||
{
|
{
|
||||||
if (owner && (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE))
|
if (owner && (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE))
|
||||||
|
{
|
||||||
value += float(owner->GetStat(stat)) * 0.3f;
|
value += float(owner->GetStat(stat)) * 0.3f;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SetStat(stat, int32(value));
|
SetStat(stat, int32(value));
|
||||||
|
|
||||||
|
|
@ -1006,7 +1042,9 @@ void Pet::UpdateResistances(uint32 school)
|
||||||
Unit* owner = GetOwner();
|
Unit* owner = GetOwner();
|
||||||
// hunter and warlock pets gain 40% of owner's resistance
|
// hunter and warlock pets gain 40% of owner's resistance
|
||||||
if (owner && (getPetType() == HUNTER_PET || (getPetType() == SUMMON_PET && owner->getClass() == CLASS_WARLOCK)))
|
if (owner && (getPetType() == HUNTER_PET || (getPetType() == SUMMON_PET && owner->getClass() == CLASS_WARLOCK)))
|
||||||
|
{
|
||||||
value += float(owner->GetResistance(SpellSchools(school))) * 0.4f;
|
value += float(owner->GetResistance(SpellSchools(school))) * 0.4f;
|
||||||
|
}
|
||||||
|
|
||||||
SetResistance(SpellSchools(school), int32(value));
|
SetResistance(SpellSchools(school), int32(value));
|
||||||
}
|
}
|
||||||
|
|
@ -1025,7 +1063,9 @@ void Pet::UpdateArmor()
|
||||||
Unit* owner = GetOwner();
|
Unit* owner = GetOwner();
|
||||||
// hunter and warlock pets gain 35% of owner's armor value
|
// hunter and warlock pets gain 35% of owner's armor value
|
||||||
if (owner && (getPetType() == HUNTER_PET || (getPetType() == SUMMON_PET && owner->getClass() == CLASS_WARLOCK)))
|
if (owner && (getPetType() == HUNTER_PET || (getPetType() == SUMMON_PET && owner->getClass() == CLASS_WARLOCK)))
|
||||||
|
{
|
||||||
bonus_armor = 0.35f * float(owner->GetArmor());
|
bonus_armor = 0.35f * float(owner->GetArmor());
|
||||||
|
}
|
||||||
|
|
||||||
value = GetModifierValue(unitMod, BASE_VALUE);
|
value = GetModifierValue(unitMod, BASE_VALUE);
|
||||||
value *= GetModifierValue(unitMod, BASE_PCT);
|
value *= GetModifierValue(unitMod, BASE_PCT);
|
||||||
|
|
@ -1100,7 +1140,9 @@ void Pet::UpdateAttackPowerAndDamage(bool ranged)
|
||||||
int32 shadow = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_SHADOW);
|
int32 shadow = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_SHADOW);
|
||||||
int32 maximum = (fire > shadow) ? fire : shadow;
|
int32 maximum = (fire > shadow) ? fire : shadow;
|
||||||
if (maximum < 0)
|
if (maximum < 0)
|
||||||
|
{
|
||||||
maximum = 0;
|
maximum = 0;
|
||||||
|
}
|
||||||
SetBonusDamage(int32(maximum * 0.15f));
|
SetBonusDamage(int32(maximum * 0.15f));
|
||||||
bonusAP = maximum * 0.57f;
|
bonusAP = maximum * 0.57f;
|
||||||
}
|
}
|
||||||
|
|
@ -1109,7 +1151,9 @@ void Pet::UpdateAttackPowerAndDamage(bool ranged)
|
||||||
{
|
{
|
||||||
int32 frost = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FROST)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FROST);
|
int32 frost = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FROST)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FROST);
|
||||||
if (frost < 0)
|
if (frost < 0)
|
||||||
|
{
|
||||||
frost = 0;
|
frost = 0;
|
||||||
|
}
|
||||||
SetBonusDamage(int32(frost * 0.4f));
|
SetBonusDamage(int32(frost * 0.4f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -208,8 +208,10 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff)
|
||||||
Unit* owner = GetCharmerOrOwner();
|
Unit* owner = GetCharmerOrOwner();
|
||||||
uint32 const& spellId = GetUInt32Value(UNIT_CREATED_BY_SPELL);
|
uint32 const& spellId = GetUInt32Value(UNIT_CREATED_BY_SPELL);
|
||||||
if (!owner || !spellId || !owner->HasAura(spellId))
|
if (!owner || !spellId || !owner->HasAura(spellId))
|
||||||
|
{
|
||||||
UnSummon();
|
UnSummon();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEAD:
|
case DEAD:
|
||||||
|
|
@ -248,21 +250,29 @@ void TemporarySummon::UnSummon()
|
||||||
CombatStop();
|
CombatStop();
|
||||||
|
|
||||||
if (m_linkedToOwnerAura & TEMPSUMMON_LINKED_AURA_REMOVE_OWNER)
|
if (m_linkedToOwnerAura & TEMPSUMMON_LINKED_AURA_REMOVE_OWNER)
|
||||||
|
{
|
||||||
RemoveAuraFromOwner();
|
RemoveAuraFromOwner();
|
||||||
|
}
|
||||||
|
|
||||||
if (GetSummonerGuid().IsCreatureOrVehicle())
|
if (GetSummonerGuid().IsCreatureOrVehicle())
|
||||||
{
|
{
|
||||||
if (Creature* sum = GetMap()->GetCreature(GetSummonerGuid()))
|
if (Creature* sum = GetMap()->GetCreature(GetSummonerGuid()))
|
||||||
if (sum->AI())
|
if (sum->AI())
|
||||||
|
{
|
||||||
sum->AI()->SummonedCreatureDespawn(this);
|
sum->AI()->SummonedCreatureDespawn(this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (GetSummonerGuid().IsPlayer()) // if player that summoned this creature was MCing it, uncharm
|
else if (GetSummonerGuid().IsPlayer()) // if player that summoned this creature was MCing it, uncharm
|
||||||
if (Player* player = GetMap()->GetPlayer(GetSummonerGuid()))
|
if (Player* player = GetMap()->GetPlayer(GetSummonerGuid()))
|
||||||
if (player->GetMover() == this)
|
if (player->GetMover() == this)
|
||||||
|
{
|
||||||
player->Uncharm();
|
player->Uncharm();
|
||||||
|
}
|
||||||
|
|
||||||
if (AI())
|
if (AI())
|
||||||
|
{
|
||||||
AI()->SummonedCreatureDespawn(this);
|
AI()->SummonedCreatureDespawn(this);
|
||||||
|
}
|
||||||
|
|
||||||
AddObjectToRemoveList();
|
AddObjectToRemoveList();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,14 +57,18 @@ bool Totem::Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo const*
|
||||||
if (owner->GetTypeId() == TYPEID_PLAYER)
|
if (owner->GetTypeId() == TYPEID_PLAYER)
|
||||||
{
|
{
|
||||||
if (uint32 modelid_race = sObjectMgr.GetModelForRace(GetNativeDisplayId(), owner->getRaceMask()))
|
if (uint32 modelid_race = sObjectMgr.GetModelForRace(GetNativeDisplayId(), owner->getRaceMask()))
|
||||||
|
{
|
||||||
SetDisplayId(modelid_race);
|
SetDisplayId(modelid_race);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cPos.SelectFinalPoint(this);
|
cPos.SelectFinalPoint(this);
|
||||||
|
|
||||||
// totem must be at same Z in case swimming caster and etc.
|
// totem must be at same Z in case swimming caster and etc.
|
||||||
if (fabs(cPos.m_pos.z - owner->GetPositionZ()) > 5.0f)
|
if (fabs(cPos.m_pos.z - owner->GetPositionZ()) > 5.0f)
|
||||||
|
{
|
||||||
cPos.m_pos.z = owner->GetPositionZ();
|
cPos.m_pos.z = owner->GetPositionZ();
|
||||||
|
}
|
||||||
|
|
||||||
if (!cPos.Relocate(this))
|
if (!cPos.Relocate(this))
|
||||||
{
|
{
|
||||||
|
|
@ -75,7 +79,9 @@ bool Totem::Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo const*
|
||||||
// Only works if you create the object in it, not if it is moves to that map.
|
// Only works if you create the object in it, not if it is moves to that map.
|
||||||
// Normally non-players do not teleport to other maps.
|
// Normally non-players do not teleport to other maps.
|
||||||
if (InstanceData* iData = GetMap()->GetInstanceData())
|
if (InstanceData* iData = GetMap()->GetInstanceData())
|
||||||
|
{
|
||||||
iData->OnCreatureCreate(this);
|
iData->OnCreatureCreate(this);
|
||||||
|
}
|
||||||
|
|
||||||
LoadCreatureAddon(false);
|
LoadCreatureAddon(false);
|
||||||
|
|
||||||
|
|
@ -97,7 +103,9 @@ void Totem::Update(uint32 update_diff, uint32 time)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_duration -= update_diff;
|
m_duration -= update_diff;
|
||||||
|
}
|
||||||
|
|
||||||
Creature::Update(update_diff, time);
|
Creature::Update(update_diff, time);
|
||||||
}
|
}
|
||||||
|
|
@ -108,7 +116,9 @@ void Totem::Summon(Unit* owner)
|
||||||
owner->GetMap()->Add((Creature*)this);
|
owner->GetMap()->Add((Creature*)this);
|
||||||
|
|
||||||
if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI())
|
if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI())
|
||||||
|
{
|
||||||
((Creature*)owner)->AI()->JustSummoned((Creature*)this);
|
((Creature*)owner)->AI()->JustSummoned((Creature*)this);
|
||||||
|
}
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
sEluna->OnSummoned(this, owner);
|
sEluna->OnSummoned(this, owner);
|
||||||
#endif /* ENABLE_ELUNA */
|
#endif /* ENABLE_ELUNA */
|
||||||
|
|
@ -153,18 +163,24 @@ void Totem::UnSummon()
|
||||||
{
|
{
|
||||||
Player* Target = itr->getSource();
|
Player* Target = itr->getSource();
|
||||||
if (Target && pGroup->SameSubGroup((Player*)owner, Target))
|
if (Target && pGroup->SameSubGroup((Player*)owner, Target))
|
||||||
|
{
|
||||||
Target->RemoveAurasDueToSpell(GetSpell());
|
Target->RemoveAurasDueToSpell(GetSpell());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI())
|
if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI())
|
||||||
|
{
|
||||||
((Creature*)owner)->AI()->SummonedCreatureDespawn((Creature*)this);
|
((Creature*)owner)->AI()->SummonedCreatureDespawn((Creature*)this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// any totem unsummon look like as totem kill, req. for proper animation
|
// any totem unsummon look like as totem kill, req. for proper animation
|
||||||
if (IsAlive())
|
if (IsAlive())
|
||||||
|
{
|
||||||
SetDeathState(DEAD);
|
SetDeathState(DEAD);
|
||||||
|
}
|
||||||
|
|
||||||
AddObjectToRemoveList();
|
AddObjectToRemoveList();
|
||||||
}
|
}
|
||||||
|
|
@ -195,10 +211,14 @@ void Totem::SetTypeBySummonSpell(SpellEntry const* spellProto)
|
||||||
{
|
{
|
||||||
// If spell have cast time -> so its active totem
|
// If spell have cast time -> so its active totem
|
||||||
if (GetSpellCastTime(totemSpell))
|
if (GetSpellCastTime(totemSpell))
|
||||||
|
{
|
||||||
m_type = TOTEM_ACTIVE;
|
m_type = TOTEM_ACTIVE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (spellProto->Id == 2056)
|
if (spellProto->Id == 2056)
|
||||||
|
{
|
||||||
m_type = TOTEM_STATUE; // Jewelery statue
|
m_type = TOTEM_STATUE; // Jewelery statue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Totem::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index, bool castOnSelf) const
|
bool Totem::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index, bool castOnSelf) const
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,9 @@ TotemAI::UpdateAI(const uint32 /*diff*/)
|
||||||
m_creature->CastSpell(victim, getTotem().GetSpell(), false);
|
m_creature->CastSpell(victim, getTotem().GetSpell(), false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
i_victimGuid.Clear();
|
i_victimGuid.Clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1445,8 +1445,10 @@ class Unit : public WorldObject
|
||||||
{
|
{
|
||||||
AttackerSet::const_iterator itr = m_attackers.find(pAttacker);
|
AttackerSet::const_iterator itr = m_attackers.find(pAttacker);
|
||||||
if (itr == m_attackers.end())
|
if (itr == m_attackers.end())
|
||||||
|
{
|
||||||
m_attackers.insert(pAttacker);
|
m_attackers.insert(pAttacker);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Internal function, must only be called from Unit::AttackStop()
|
* Internal function, must only be called from Unit::AttackStop()
|
||||||
* @param pAttacker
|
* @param pAttacker
|
||||||
|
|
@ -3317,10 +3319,14 @@ class Unit : public WorldObject
|
||||||
void SetVisibleAura(uint8 slot, SpellAuraHolder* holder)
|
void SetVisibleAura(uint8 slot, SpellAuraHolder* holder)
|
||||||
{
|
{
|
||||||
if (!holder)
|
if (!holder)
|
||||||
|
{
|
||||||
m_visibleAuras.erase(slot);
|
m_visibleAuras.erase(slot);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_visibleAuras[slot] = holder;
|
m_visibleAuras[slot] = holder;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
VisibleAuraMap const& GetVisibleAuras() const { return m_visibleAuras; }
|
VisibleAuraMap const& GetVisibleAuras() const { return m_visibleAuras; }
|
||||||
uint8 GetVisibleAurasCount() const { return m_visibleAuras.size(); }
|
uint8 GetVisibleAurasCount() const { return m_visibleAuras.size(); }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -94,16 +94,24 @@ class ThreatRefStatusChangeEvent : public UnitBaseEvent
|
||||||
ThreatManager* iThreatManager;
|
ThreatManager* iThreatManager;
|
||||||
public:
|
public:
|
||||||
ThreatRefStatusChangeEvent(uint32 pType) : UnitBaseEvent(pType), iThreatManager(NULL)
|
ThreatRefStatusChangeEvent(uint32 pType) : UnitBaseEvent(pType), iThreatManager(NULL)
|
||||||
{ iHostileReference = NULL; }
|
{
|
||||||
|
iHostileReference = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference) : UnitBaseEvent(pType), iThreatManager(NULL)
|
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference) : UnitBaseEvent(pType), iThreatManager(NULL)
|
||||||
{ iHostileReference = pHostileReference; }
|
{
|
||||||
|
iHostileReference = pHostileReference;
|
||||||
|
}
|
||||||
|
|
||||||
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, float pValue) : UnitBaseEvent(pType), iThreatManager(NULL)
|
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, float pValue) : UnitBaseEvent(pType), iThreatManager(NULL)
|
||||||
{ iHostileReference = pHostileReference; iFValue = pValue; }
|
{
|
||||||
|
iHostileReference = pHostileReference; iFValue = pValue;
|
||||||
|
}
|
||||||
|
|
||||||
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, bool pValue) : UnitBaseEvent(pType), iThreatManager(NULL)
|
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, bool pValue) : UnitBaseEvent(pType), iThreatManager(NULL)
|
||||||
{ iHostileReference = pHostileReference; iBValue = pValue; }
|
{
|
||||||
|
iHostileReference = pHostileReference; iBValue = pValue;
|
||||||
|
}
|
||||||
|
|
||||||
int32 getIValue() const { return iIValue; }
|
int32 getIValue() const { return iIValue; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,8 +73,10 @@ class UpdateMask
|
||||||
void Clear()
|
void Clear()
|
||||||
{
|
{
|
||||||
if (mUpdateMask)
|
if (mUpdateMask)
|
||||||
|
{
|
||||||
memset(mUpdateMask, 0, mBlocks << 2);
|
memset(mUpdateMask, 0, mBlocks << 2);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UpdateMask& operator = (const UpdateMask& mask)
|
UpdateMask& operator = (const UpdateMask& mask)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -113,13 +113,17 @@ VehicleInfo::VehicleInfo(Unit* owner, VehicleEntry const* vehicleEntry, uint32 o
|
||||||
m_vehicleSeats.insert(VehicleSeatMap::value_type(i, seatEntry));
|
m_vehicleSeats.insert(VehicleSeatMap::value_type(i, seatEntry));
|
||||||
|
|
||||||
if (IsUsableSeatForCreature(seatEntry->m_flags))
|
if (IsUsableSeatForCreature(seatEntry->m_flags))
|
||||||
|
{
|
||||||
m_creatureSeats |= 1 << i;
|
m_creatureSeats |= 1 << i;
|
||||||
|
}
|
||||||
|
|
||||||
if (IsUsableSeatForPlayer(seatEntry->m_flags, seatEntry->m_flagsB))
|
if (IsUsableSeatForPlayer(seatEntry->m_flags, seatEntry->m_flagsB))
|
||||||
|
{
|
||||||
m_playerSeats |= 1 << i;
|
m_playerSeats |= 1 << i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VehicleInfo::~VehicleInfo()
|
VehicleInfo::~VehicleInfo()
|
||||||
|
|
@ -132,7 +136,9 @@ VehicleInfo::~VehicleInfo()
|
||||||
void VehicleInfo::Initialize()
|
void VehicleInfo::Initialize()
|
||||||
{
|
{
|
||||||
if (!m_overwriteNpcEntry)
|
if (!m_overwriteNpcEntry)
|
||||||
|
{
|
||||||
m_overwriteNpcEntry = m_owner->GetEntry();
|
m_overwriteNpcEntry = m_owner->GetEntry();
|
||||||
|
}
|
||||||
|
|
||||||
// Loading passengers (rough version only!)
|
// Loading passengers (rough version only!)
|
||||||
SQLMultiStorage::SQLMSIteratorBounds<VehicleAccessory> bounds = sVehicleAccessoryStorage.getBounds<VehicleAccessory>(m_overwriteNpcEntry);
|
SQLMultiStorage::SQLMSIteratorBounds<VehicleAccessory> bounds = sVehicleAccessoryStorage.getBounds<VehicleAccessory>(m_overwriteNpcEntry);
|
||||||
|
|
@ -152,18 +158,30 @@ void VehicleInfo::Initialize()
|
||||||
Unit* pVehicle = (Unit*)m_owner;
|
Unit* pVehicle = (Unit*)m_owner;
|
||||||
|
|
||||||
if (vehicleFlags & VEHICLE_FLAG_NO_STRAFE)
|
if (vehicleFlags & VEHICLE_FLAG_NO_STRAFE)
|
||||||
|
{
|
||||||
pVehicle->m_movementInfo.AddMovementFlags2(MOVEFLAG2_NO_STRAFE);
|
pVehicle->m_movementInfo.AddMovementFlags2(MOVEFLAG2_NO_STRAFE);
|
||||||
|
}
|
||||||
if (vehicleFlags & VEHICLE_FLAG_NO_JUMPING)
|
if (vehicleFlags & VEHICLE_FLAG_NO_JUMPING)
|
||||||
|
{
|
||||||
pVehicle->m_movementInfo.AddMovementFlags2(MOVEFLAG2_NO_JUMPING);
|
pVehicle->m_movementInfo.AddMovementFlags2(MOVEFLAG2_NO_JUMPING);
|
||||||
|
}
|
||||||
if (vehicleFlags & VEHICLE_FLAG_FULLSPEEDTURNING)
|
if (vehicleFlags & VEHICLE_FLAG_FULLSPEEDTURNING)
|
||||||
|
{
|
||||||
pVehicle->m_movementInfo.AddMovementFlags2(MOVEFLAG2_FULLSPEEDTURNING);
|
pVehicle->m_movementInfo.AddMovementFlags2(MOVEFLAG2_FULLSPEEDTURNING);
|
||||||
|
}
|
||||||
if (vehicleFlags & VEHICLE_FLAG_ALLOW_PITCHING)
|
if (vehicleFlags & VEHICLE_FLAG_ALLOW_PITCHING)
|
||||||
|
{
|
||||||
pVehicle->m_movementInfo.AddMovementFlags2(MOVEFLAG2_ALLOW_PITCHING);
|
pVehicle->m_movementInfo.AddMovementFlags2(MOVEFLAG2_ALLOW_PITCHING);
|
||||||
|
}
|
||||||
if (vehicleFlags & VEHICLE_FLAG_FULLSPEEDPITCHING)
|
if (vehicleFlags & VEHICLE_FLAG_FULLSPEEDPITCHING)
|
||||||
|
{
|
||||||
pVehicle->m_movementInfo.AddMovementFlags2(MOVEFLAG2_FULLSPEEDPITCHING);
|
pVehicle->m_movementInfo.AddMovementFlags2(MOVEFLAG2_FULLSPEEDPITCHING);
|
||||||
|
}
|
||||||
|
|
||||||
if (vehicleFlags & VEHICLE_FLAG_FIXED_POSITION)
|
if (vehicleFlags & VEHICLE_FLAG_FIXED_POSITION)
|
||||||
|
{
|
||||||
pVehicle->SetRoot(true);
|
pVehicle->SetRoot(true);
|
||||||
|
}
|
||||||
|
|
||||||
// // Initialize power type based on DBC values (creatures only)
|
// // Initialize power type based on DBC values (creatures only)
|
||||||
// if (pVehicle->GetTypeId() == TYPEID_UNIT)
|
// if (pVehicle->GetTypeId() == TYPEID_UNIT)
|
||||||
|
|
@ -237,7 +255,9 @@ void VehicleInfo::Board(Unit* passenger, uint8 seat)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!passenger->IsRooted())
|
if (!passenger->IsRooted())
|
||||||
|
{
|
||||||
passenger->SetRoot(true);
|
passenger->SetRoot(true);
|
||||||
|
}
|
||||||
|
|
||||||
Movement::MoveSplineInit init(*passenger);
|
Movement::MoveSplineInit init(*passenger);
|
||||||
init.MoveTo(0.0f, 0.0f, 0.0f); // ToDo: Set correct local coords
|
init.MoveTo(0.0f, 0.0f, 0.0f); // ToDo: Set correct local coords
|
||||||
|
|
@ -351,7 +371,9 @@ void VehicleInfo::UnBoard(Unit* passenger, bool changeVehicle)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (passenger->IsRooted())
|
if (passenger->IsRooted())
|
||||||
|
{
|
||||||
passenger->SetRoot(false);
|
passenger->SetRoot(false);
|
||||||
|
}
|
||||||
|
|
||||||
Movement::MoveSplineInit init(*passenger);
|
Movement::MoveSplineInit init(*passenger);
|
||||||
// ToDo: Set proper unboard coordinates
|
// ToDo: Set proper unboard coordinates
|
||||||
|
|
@ -378,9 +400,11 @@ void VehicleInfo::UnBoard(Unit* passenger, bool changeVehicle)
|
||||||
!(m_vehicleEntry->m_flags & (VEHICLE_FLAG_UNK4 | VEHICLE_FLAG_UNK20)))
|
!(m_vehicleEntry->m_flags & (VEHICLE_FLAG_UNK4 | VEHICLE_FLAG_UNK20)))
|
||||||
{
|
{
|
||||||
if (((Creature*)m_owner)->IsTemporarySummon())
|
if (((Creature*)m_owner)->IsTemporarySummon())
|
||||||
|
{
|
||||||
((Creature*)m_owner)->ForcedDespawn(1000);
|
((Creature*)m_owner)->ForcedDespawn(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -549,7 +573,9 @@ void VehicleInfo::ApplySeatMods(Unit* passenger, uint32 seatFlags)
|
||||||
Unit* pVehicle = (Unit*)m_owner; // Vehicles are alawys Unit
|
Unit* pVehicle = (Unit*)m_owner; // Vehicles are alawys Unit
|
||||||
|
|
||||||
if (seatFlags & SEAT_FLAG_NOT_SELECTABLE)
|
if (seatFlags & SEAT_FLAG_NOT_SELECTABLE)
|
||||||
|
{
|
||||||
passenger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
passenger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||||
|
}
|
||||||
|
|
||||||
if (passenger->GetTypeId() == TYPEID_PLAYER)
|
if (passenger->GetTypeId() == TYPEID_PLAYER)
|
||||||
{
|
{
|
||||||
|
|
@ -557,7 +583,9 @@ void VehicleInfo::ApplySeatMods(Unit* passenger, uint32 seatFlags)
|
||||||
|
|
||||||
// group update
|
// group update
|
||||||
if (pPlayer->GetGroup())
|
if (pPlayer->GetGroup())
|
||||||
|
{
|
||||||
pPlayer->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_VEHICLE_SEAT);
|
pPlayer->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_VEHICLE_SEAT);
|
||||||
|
}
|
||||||
|
|
||||||
if (seatFlags & SEAT_FLAG_CAN_CONTROL)
|
if (seatFlags & SEAT_FLAG_CAN_CONTROL)
|
||||||
{
|
{
|
||||||
|
|
@ -619,7 +647,9 @@ void VehicleInfo::RemoveSeatMods(Unit* passenger, uint32 seatFlags)
|
||||||
Unit* pVehicle = (Unit*)m_owner;
|
Unit* pVehicle = (Unit*)m_owner;
|
||||||
|
|
||||||
if (seatFlags & SEAT_FLAG_NOT_SELECTABLE)
|
if (seatFlags & SEAT_FLAG_NOT_SELECTABLE)
|
||||||
|
{
|
||||||
passenger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
passenger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||||
|
}
|
||||||
|
|
||||||
if (passenger->GetTypeId() == TYPEID_PLAYER)
|
if (passenger->GetTypeId() == TYPEID_PLAYER)
|
||||||
{
|
{
|
||||||
|
|
@ -627,7 +657,9 @@ void VehicleInfo::RemoveSeatMods(Unit* passenger, uint32 seatFlags)
|
||||||
|
|
||||||
// group update
|
// group update
|
||||||
if (pPlayer->GetGroup())
|
if (pPlayer->GetGroup())
|
||||||
|
{
|
||||||
pPlayer->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_VEHICLE_SEAT);
|
pPlayer->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_VEHICLE_SEAT);
|
||||||
|
}
|
||||||
|
|
||||||
if (seatFlags & SEAT_FLAG_CAN_CONTROL)
|
if (seatFlags & SEAT_FLAG_CAN_CONTROL)
|
||||||
{
|
{
|
||||||
|
|
@ -645,12 +677,16 @@ void VehicleInfo::RemoveSeatMods(Unit* passenger, uint32 seatFlags)
|
||||||
|
|
||||||
// reset vehicle faction
|
// reset vehicle faction
|
||||||
if (pVehicle->GetTypeId() == TYPEID_UNIT)
|
if (pVehicle->GetTypeId() == TYPEID_UNIT)
|
||||||
|
{
|
||||||
((Creature*)pVehicle)->ClearTemporaryFaction();
|
((Creature*)pVehicle)->ClearTemporaryFaction();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (seatFlags & SEAT_FLAG_CAN_CAST)
|
if (seatFlags & SEAT_FLAG_CAN_CAST)
|
||||||
|
{
|
||||||
pPlayer->RemovePetActionBar();
|
pPlayer->RemovePetActionBar();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (passenger->GetTypeId() == TYPEID_UNIT)
|
else if (passenger->GetTypeId() == TYPEID_UNIT)
|
||||||
{
|
{
|
||||||
if (seatFlags & SEAT_FLAG_CAN_CONTROL)
|
if (seatFlags & SEAT_FLAG_CAN_CONTROL)
|
||||||
|
|
@ -662,8 +698,10 @@ void VehicleInfo::RemoveSeatMods(Unit* passenger, uint32 seatFlags)
|
||||||
// Reinitialize movement
|
// Reinitialize movement
|
||||||
((Creature*)passenger)->AI()->SetCombatMovement(true, true);
|
((Creature*)passenger)->AI()->SetCombatMovement(true, true);
|
||||||
if (!passenger->getVictim())
|
if (!passenger->getVictim())
|
||||||
|
{
|
||||||
passenger->GetMotionMaster()->Initialize();
|
passenger->GetMotionMaster()->Initialize();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! @} */
|
/*! @} */
|
||||||
|
|
|
||||||
|
|
@ -92,10 +92,14 @@ void OutdoorPvP::HandleGameObjectCreate(GameObject* go)
|
||||||
CapturePointSliderMap const* capturePoints = sOutdoorPvPMgr.GetCapturePointSliderMap();
|
CapturePointSliderMap const* capturePoints = sOutdoorPvPMgr.GetCapturePointSliderMap();
|
||||||
CapturePointSliderMap::const_iterator itr = capturePoints->find(go->GetEntry());
|
CapturePointSliderMap::const_iterator itr = capturePoints->find(go->GetEntry());
|
||||||
if (itr != capturePoints->end())
|
if (itr != capturePoints->end())
|
||||||
|
{
|
||||||
go->SetCapturePointSlider(itr->second.Value, itr->second.IsLocked);
|
go->SetCapturePointSlider(itr->second.Value, itr->second.IsLocked);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
go->SetCapturePointSlider(CAPTURE_SLIDER_MIDDLE, false);
|
go->SetCapturePointSlider(CAPTURE_SLIDER_MIDDLE, false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutdoorPvP::HandleGameObjectRemove(GameObject* go)
|
void OutdoorPvP::HandleGameObjectRemove(GameObject* go)
|
||||||
|
|
|
||||||
|
|
@ -140,8 +140,10 @@ void OutdoorPvPGH::DespawnVendors(const WorldObject* objRef)
|
||||||
for (GuidList::const_iterator itr = m_teamVendors.begin(); itr != m_teamVendors.end(); ++itr)
|
for (GuidList::const_iterator itr = m_teamVendors.begin(); itr != m_teamVendors.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (Creature* vendor = objRef->GetMap()->GetCreature(*itr))
|
if (Creature* vendor = objRef->GetMap()->GetCreature(*itr))
|
||||||
|
{
|
||||||
vendor->ForcedDespawn();
|
vendor->ForcedDespawn();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
m_teamVendors.clear();
|
m_teamVendors.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -149,7 +151,9 @@ void OutdoorPvPGH::DespawnVendors(const WorldObject* objRef)
|
||||||
void OutdoorPvPGH::LockLighthouse(const WorldObject* objRef)
|
void OutdoorPvPGH::LockLighthouse(const WorldObject* objRef)
|
||||||
{
|
{
|
||||||
if (GameObject* go = objRef->GetMap()->GetGameObject(m_capturePoint))
|
if (GameObject* go = objRef->GetMap()->GetGameObject(m_capturePoint))
|
||||||
|
{
|
||||||
go->SetLootState(GO_JUST_DEACTIVATED);
|
go->SetLootState(GO_JUST_DEACTIVATED);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if grid is unloaded, changing the saved slider value is enough
|
// if grid is unloaded, changing the saved slider value is enough
|
||||||
|
|
@ -162,7 +166,9 @@ void OutdoorPvPGH::LockLighthouse(const WorldObject* objRef)
|
||||||
void OutdoorPvPGH::UnlockLighthouse(const WorldObject* objRef)
|
void OutdoorPvPGH::UnlockLighthouse(const WorldObject* objRef)
|
||||||
{
|
{
|
||||||
if (GameObject* go = objRef->GetMap()->GetGameObject(m_capturePoint))
|
if (GameObject* go = objRef->GetMap()->GetGameObject(m_capturePoint))
|
||||||
|
{
|
||||||
go->SetLootState(GO_ACTIVATED);
|
go->SetLootState(GO_ACTIVATED);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if grid is unloaded, changing the saved slider value is enough
|
// if grid is unloaded, changing the saved slider value is enough
|
||||||
|
|
|
||||||
|
|
@ -77,9 +77,13 @@ void OutdoorPvPHP::HandlePlayerEnterZone(Player* player, bool isMainZone)
|
||||||
|
|
||||||
// buff the player if same team is controlling all capture points
|
// buff the player if same team is controlling all capture points
|
||||||
if (m_towersAlliance == MAX_HP_TOWERS && player->GetTeam() == ALLIANCE)
|
if (m_towersAlliance == MAX_HP_TOWERS && player->GetTeam() == ALLIANCE)
|
||||||
|
{
|
||||||
player->CastSpell(player, SPELL_HELLFIRE_SUPERIORITY_ALLIANCE, true);
|
player->CastSpell(player, SPELL_HELLFIRE_SUPERIORITY_ALLIANCE, true);
|
||||||
|
}
|
||||||
else if (m_towersHorde == MAX_HP_TOWERS && player->GetTeam() == HORDE)
|
else if (m_towersHorde == MAX_HP_TOWERS && player->GetTeam() == HORDE)
|
||||||
|
{
|
||||||
player->CastSpell(player, SPELL_HELLFIRE_SUPERIORITY_HORDE, true);
|
player->CastSpell(player, SPELL_HELLFIRE_SUPERIORITY_HORDE, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutdoorPvPHP::HandlePlayerLeaveZone(Player* player, bool isMainZone)
|
void OutdoorPvPHP::HandlePlayerLeaveZone(Player* player, bool isMainZone)
|
||||||
|
|
@ -168,7 +172,9 @@ void OutdoorPvPHP::HandlePlayerKillInsideArea(Player* player)
|
||||||
{
|
{
|
||||||
// check capture point team
|
// check capture point team
|
||||||
if (player->GetTeam() == m_towerOwner[i])
|
if (player->GetTeam() == m_towerOwner[i])
|
||||||
|
{
|
||||||
player->CastSpell(player, player->GetTeam() == ALLIANCE ? SPELL_HELLFIRE_TOWER_TOKEN_ALLIANCE : SPELL_HELLFIRE_TOWER_TOKEN_HORDE, true);
|
player->CastSpell(player, player->GetTeam() == ALLIANCE ? SPELL_HELLFIRE_TOWER_TOKEN_ALLIANCE : SPELL_HELLFIRE_TOWER_TOKEN_HORDE, true);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -191,7 +197,9 @@ bool OutdoorPvPHP::HandleEvent(uint32 eventId, GameObject* go)
|
||||||
if (hellfireTowerEvents[i][j].team != m_towerOwner[i])
|
if (hellfireTowerEvents[i][j].team != m_towerOwner[i])
|
||||||
{
|
{
|
||||||
if (hellfireTowerEvents[i][j].defenseMessage)
|
if (hellfireTowerEvents[i][j].defenseMessage)
|
||||||
|
{
|
||||||
sWorld.SendDefenseMessage(ZONE_ID_HELLFIRE_PENINSULA, hellfireTowerEvents[i][j].defenseMessage);
|
sWorld.SendDefenseMessage(ZONE_ID_HELLFIRE_PENINSULA, hellfireTowerEvents[i][j].defenseMessage);
|
||||||
|
}
|
||||||
|
|
||||||
return ProcessCaptureEvent(go, i, hellfireTowerEvents[i][j].team, hellfireTowerEvents[i][j].worldState, hellfireTowerEvents[i][j].towerArtKit, hellfireTowerEvents[i][j].towerAnim);
|
return ProcessCaptureEvent(go, i, hellfireTowerEvents[i][j].team, hellfireTowerEvents[i][j].worldState, hellfireTowerEvents[i][j].towerArtKit, hellfireTowerEvents[i][j].towerAnim);
|
||||||
}
|
}
|
||||||
|
|
@ -219,8 +227,10 @@ bool OutdoorPvPHP::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team
|
||||||
SendUpdateWorldState(WORLD_STATE_HP_TOWER_COUNT_ALLIANCE, m_towersAlliance);
|
SendUpdateWorldState(WORLD_STATE_HP_TOWER_COUNT_ALLIANCE, m_towersAlliance);
|
||||||
|
|
||||||
if (m_towersAlliance == MAX_HP_TOWERS)
|
if (m_towersAlliance == MAX_HP_TOWERS)
|
||||||
|
{
|
||||||
BuffTeam(ALLIANCE, SPELL_HELLFIRE_SUPERIORITY_ALLIANCE);
|
BuffTeam(ALLIANCE, SPELL_HELLFIRE_SUPERIORITY_ALLIANCE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (team == HORDE)
|
else if (team == HORDE)
|
||||||
{
|
{
|
||||||
SetBannerVisual(go, CAPTURE_ARTKIT_HORDE, CAPTURE_ANIM_HORDE);
|
SetBannerVisual(go, CAPTURE_ARTKIT_HORDE, CAPTURE_ANIM_HORDE);
|
||||||
|
|
@ -230,8 +240,10 @@ bool OutdoorPvPHP::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team
|
||||||
SendUpdateWorldState(WORLD_STATE_HP_TOWER_COUNT_HORDE, m_towersHorde);
|
SendUpdateWorldState(WORLD_STATE_HP_TOWER_COUNT_HORDE, m_towersHorde);
|
||||||
|
|
||||||
if (m_towersHorde == MAX_HP_TOWERS)
|
if (m_towersHorde == MAX_HP_TOWERS)
|
||||||
|
{
|
||||||
BuffTeam(HORDE, SPELL_HELLFIRE_SUPERIORITY_HORDE);
|
BuffTeam(HORDE, SPELL_HELLFIRE_SUPERIORITY_HORDE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetBannerVisual(go, CAPTURE_ARTKIT_NEUTRAL, CAPTURE_ANIM_NEUTRAL);
|
SetBannerVisual(go, CAPTURE_ARTKIT_NEUTRAL, CAPTURE_ANIM_NEUTRAL);
|
||||||
|
|
@ -239,7 +251,9 @@ bool OutdoorPvPHP::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team
|
||||||
if (m_towerOwner[towerId] == ALLIANCE)
|
if (m_towerOwner[towerId] == ALLIANCE)
|
||||||
{
|
{
|
||||||
if (m_towersAlliance == MAX_HP_TOWERS)
|
if (m_towersAlliance == MAX_HP_TOWERS)
|
||||||
|
{
|
||||||
BuffTeam(ALLIANCE, SPELL_HELLFIRE_SUPERIORITY_ALLIANCE, true);
|
BuffTeam(ALLIANCE, SPELL_HELLFIRE_SUPERIORITY_ALLIANCE, true);
|
||||||
|
}
|
||||||
|
|
||||||
// update counter
|
// update counter
|
||||||
--m_towersAlliance;
|
--m_towersAlliance;
|
||||||
|
|
@ -248,7 +262,9 @@ bool OutdoorPvPHP::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_towersHorde == MAX_HP_TOWERS)
|
if (m_towersHorde == MAX_HP_TOWERS)
|
||||||
|
{
|
||||||
BuffTeam(HORDE, SPELL_HELLFIRE_SUPERIORITY_HORDE, true);
|
BuffTeam(HORDE, SPELL_HELLFIRE_SUPERIORITY_HORDE, true);
|
||||||
|
}
|
||||||
|
|
||||||
// update counter
|
// update counter
|
||||||
--m_towersHorde;
|
--m_towersHorde;
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,9 @@ void OutdoorPvPMgr::HandlePlayerEnterZone(Player* player, uint32 zoneId)
|
||||||
script->HandlePlayerEnterZone(player, true);
|
script->HandlePlayerEnterZone(player, true);
|
||||||
}
|
}
|
||||||
else if (OutdoorPvP* affectedScript = GetScriptOfAffectedZone(zoneId))
|
else if (OutdoorPvP* affectedScript = GetScriptOfAffectedZone(zoneId))
|
||||||
|
{
|
||||||
affectedScript->HandlePlayerEnterZone(player, false);
|
affectedScript->HandlePlayerEnterZone(player, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -162,7 +164,9 @@ void OutdoorPvPMgr::HandlePlayerLeaveZone(Player* player, uint32 zoneId)
|
||||||
script->HandlePlayerLeaveZone(player, true);
|
script->HandlePlayerLeaveZone(player, true);
|
||||||
}
|
}
|
||||||
else if (OutdoorPvP* affectedScript = GetScriptOfAffectedZone(zoneId))
|
else if (OutdoorPvP* affectedScript = GetScriptOfAffectedZone(zoneId))
|
||||||
|
{
|
||||||
affectedScript->HandlePlayerLeaveZone(player, false);
|
affectedScript->HandlePlayerLeaveZone(player, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutdoorPvPMgr::Update(uint32 diff)
|
void OutdoorPvPMgr::Update(uint32 diff)
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,9 @@ void OutdoorPvPNA::HandlePlayerEnterZone(Player* player, bool isMainZone)
|
||||||
|
|
||||||
// buff the player if same team is controlling the zone
|
// buff the player if same team is controlling the zone
|
||||||
if (player->GetTeam() == m_zoneOwner)
|
if (player->GetTeam() == m_zoneOwner)
|
||||||
|
{
|
||||||
player->CastSpell(player, SPELL_STRENGTH_HALAANI, true);
|
player->CastSpell(player, SPELL_STRENGTH_HALAANI, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutdoorPvPNA::HandlePlayerLeaveZone(Player* player, bool isMainZone)
|
void OutdoorPvPNA::HandlePlayerLeaveZone(Player* player, bool isMainZone)
|
||||||
|
|
@ -99,9 +101,11 @@ void OutdoorPvPNA::HandleObjectiveComplete(uint32 eventId, const std::list<Playe
|
||||||
for (std::list<Player*>::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
for (std::list<Player*>::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
||||||
{
|
{
|
||||||
if ((*itr) && (*itr)->GetTeam() == team)
|
if ((*itr) && (*itr)->GetTeam() == team)
|
||||||
|
{
|
||||||
(*itr)->KilledMonsterCredit(NPC_HALAA_COMBATANT);
|
(*itr)->KilledMonsterCredit(NPC_HALAA_COMBATANT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cast player spell on opponent kill
|
// Cast player spell on opponent kill
|
||||||
|
|
@ -115,7 +119,9 @@ void OutdoorPvPNA::HandlePlayerKillInsideArea(Player* player)
|
||||||
{
|
{
|
||||||
// check capture point team
|
// check capture point team
|
||||||
if (player->GetTeam() == m_zoneOwner)
|
if (player->GetTeam() == m_zoneOwner)
|
||||||
|
{
|
||||||
player->CastSpell(player, player->GetTeam() == ALLIANCE ? SPELL_NAGRAND_TOKEN_ALLIANCE : SPELL_NAGRAND_TOKEN_HORDE, true);
|
player->CastSpell(player, player->GetTeam() == ALLIANCE ? SPELL_NAGRAND_TOKEN_ALLIANCE : SPELL_NAGRAND_TOKEN_HORDE, true);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -177,7 +183,9 @@ void OutdoorPvPNA::HandleCreatureDeath(Creature* creature)
|
||||||
|
|
||||||
// set the respawn timer after the last guard died - 5 min for the first time, or 1 hour if the city is under siege
|
// set the respawn timer after the last guard died - 5 min for the first time, or 1 hour if the city is under siege
|
||||||
if (!m_soldiersRespawnTimer)
|
if (!m_soldiersRespawnTimer)
|
||||||
|
{
|
||||||
m_soldiersRespawnTimer = m_isUnderSiege ? HOUR * IN_MILLISECONDS : 5 * MINUTE * IN_MILLISECONDS;
|
m_soldiersRespawnTimer = m_isUnderSiege ? HOUR * IN_MILLISECONDS : 5 * MINUTE * IN_MILLISECONDS;
|
||||||
|
}
|
||||||
|
|
||||||
// decrease the counter
|
// decrease the counter
|
||||||
--m_guardsLeft;
|
--m_guardsLeft;
|
||||||
|
|
@ -418,8 +426,10 @@ void OutdoorPvPNA::DespawnVendors(const WorldObject* objRef)
|
||||||
for (GuidList::const_iterator itr = m_teamVendors.begin(); itr != m_teamVendors.end(); ++itr)
|
for (GuidList::const_iterator itr = m_teamVendors.begin(); itr != m_teamVendors.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (Creature* soldier = objRef->GetMap()->GetCreature(*itr))
|
if (Creature* soldier = objRef->GetMap()->GetCreature(*itr))
|
||||||
|
{
|
||||||
soldier->ForcedDespawn();
|
soldier->ForcedDespawn();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
m_teamVendors.clear();
|
m_teamVendors.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -531,13 +541,19 @@ void OutdoorPvPNA::Update(uint32 diff)
|
||||||
|
|
||||||
// if all the guards are respawned, stop the timer, else resume the timer depending on the siege state
|
// if all the guards are respawned, stop the timer, else resume the timer depending on the siege state
|
||||||
if (m_guardsLeft == MAX_NA_GUARDS)
|
if (m_guardsLeft == MAX_NA_GUARDS)
|
||||||
|
{
|
||||||
m_soldiersRespawnTimer = 0;
|
m_soldiersRespawnTimer = 0;
|
||||||
else
|
|
||||||
m_soldiersRespawnTimer = m_isUnderSiege ? HOUR * IN_MILLISECONDS : 5 * MINUTE * IN_MILLISECONDS;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
m_soldiersRespawnTimer = m_isUnderSiege ? HOUR * IN_MILLISECONDS : 5 * MINUTE * IN_MILLISECONDS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
m_soldiersRespawnTimer -= diff;
|
m_soldiersRespawnTimer -= diff;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle soldiers respawn on timer - this will summon a replacement for the dead soldier
|
// Handle soldiers respawn on timer - this will summon a replacement for the dead soldier
|
||||||
|
|
@ -547,7 +563,9 @@ void OutdoorPvPNA::RespawnSoldier()
|
||||||
{
|
{
|
||||||
// Find player who is in main zone (Nagrand) to get correct map reference
|
// Find player who is in main zone (Nagrand) to get correct map reference
|
||||||
if (!itr->second)
|
if (!itr->second)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (Player* player = sObjectMgr.GetPlayer(itr->first))
|
if (Player* player = sObjectMgr.GetPlayer(itr->first))
|
||||||
{
|
{
|
||||||
|
|
@ -564,7 +582,9 @@ void OutdoorPvPNA::RespawnSoldier()
|
||||||
void OutdoorPvPNA::LockHalaa(const WorldObject* objRef)
|
void OutdoorPvPNA::LockHalaa(const WorldObject* objRef)
|
||||||
{
|
{
|
||||||
if (GameObject* go = objRef->GetMap()->GetGameObject(m_capturePoint))
|
if (GameObject* go = objRef->GetMap()->GetGameObject(m_capturePoint))
|
||||||
|
{
|
||||||
go->SetLootState(GO_JUST_DEACTIVATED);
|
go->SetLootState(GO_JUST_DEACTIVATED);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if grid is unloaded, changing the saved slider value is enough
|
// if grid is unloaded, changing the saved slider value is enough
|
||||||
|
|
@ -577,7 +597,9 @@ void OutdoorPvPNA::LockHalaa(const WorldObject* objRef)
|
||||||
void OutdoorPvPNA::UnlockHalaa(const WorldObject* objRef)
|
void OutdoorPvPNA::UnlockHalaa(const WorldObject* objRef)
|
||||||
{
|
{
|
||||||
if (GameObject* go = objRef->GetMap()->GetGameObject(m_capturePoint))
|
if (GameObject* go = objRef->GetMap()->GetGameObject(m_capturePoint))
|
||||||
|
{
|
||||||
go->SetLootState(GO_ACTIVATED);
|
go->SetLootState(GO_ACTIVATED);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if grid is unloaded, changing the saved slider value is enough
|
// if grid is unloaded, changing the saved slider value is enough
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,9 @@ void OutdoorPvPTF::FillInitialWorldStates(WorldPacket& data, uint32& count)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
UpdateTimerWorldState();
|
UpdateTimerWorldState();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutdoorPvPTF::SendRemoveWorldStates(Player* player)
|
void OutdoorPvPTF::SendRemoveWorldStates(Player* player)
|
||||||
|
|
@ -87,7 +89,9 @@ void OutdoorPvPTF::HandlePlayerEnterZone(Player* player, bool isMainZone)
|
||||||
|
|
||||||
// Handle the buffs
|
// Handle the buffs
|
||||||
if (player->GetTeam() == m_zoneOwner)
|
if (player->GetTeam() == m_zoneOwner)
|
||||||
|
{
|
||||||
player->CastSpell(player, SPELL_AUCHINDOUN_BLESSING, true);
|
player->CastSpell(player, SPELL_AUCHINDOUN_BLESSING, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutdoorPvPTF::HandlePlayerLeaveZone(Player* player, bool isMainZone)
|
void OutdoorPvPTF::HandlePlayerLeaveZone(Player* player, bool isMainZone)
|
||||||
|
|
@ -138,8 +142,10 @@ void OutdoorPvPTF::HandleObjectiveComplete(uint32 eventId, const std::list<Playe
|
||||||
for (std::list<Player*>::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
for (std::list<Player*>::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
||||||
{
|
{
|
||||||
if ((*itr) && (*itr)->GetTeam() == team)
|
if ((*itr) && (*itr)->GetTeam() == team)
|
||||||
|
{
|
||||||
(*itr)->AreaExploredOrEventHappens(team == ALLIANCE ? QUEST_SPIRITS_OF_AUCHINDOUM_ALLIANCE : QUEST_SPIRITS_OF_AUCHINDOUM_HORDE);
|
(*itr)->AreaExploredOrEventHappens(team == ALLIANCE ? QUEST_SPIRITS_OF_AUCHINDOUM_ALLIANCE : QUEST_SPIRITS_OF_AUCHINDOUM_HORDE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -305,7 +311,9 @@ void OutdoorPvPTF::UnlockZone()
|
||||||
{
|
{
|
||||||
// Find player who is in main zone (Terokkar Forest) to get correct map reference
|
// Find player who is in main zone (Terokkar Forest) to get correct map reference
|
||||||
if (!itr->second)
|
if (!itr->second)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (Player* player = sObjectMgr.GetPlayer(itr->first))
|
if (Player* player = sObjectMgr.GetPlayer(itr->first))
|
||||||
{
|
{
|
||||||
|
|
@ -336,7 +344,9 @@ void OutdoorPvPTF::Update(uint32 diff)
|
||||||
m_zoneUpdateTimer = TIMER_TF_UPDATE_TIME;
|
m_zoneUpdateTimer = TIMER_TF_UPDATE_TIME;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_zoneUpdateTimer -= diff;*/
|
{
|
||||||
|
m_zoneUpdateTimer -= diff;
|
||||||
|
}*/
|
||||||
|
|
||||||
m_zoneLockTimer -= diff;
|
m_zoneLockTimer -= diff;
|
||||||
}
|
}
|
||||||
|
|
@ -362,7 +372,9 @@ void OutdoorPvPTF::LockTowers(const WorldObject* objRef)
|
||||||
for (uint8 i = 0; i < MAX_TF_TOWERS; ++i)
|
for (uint8 i = 0; i < MAX_TF_TOWERS; ++i)
|
||||||
{
|
{
|
||||||
if (GameObject* go = objRef->GetMap()->GetGameObject(m_towerBanners[i]))
|
if (GameObject* go = objRef->GetMap()->GetGameObject(m_towerBanners[i]))
|
||||||
|
{
|
||||||
go->SetLootState(GO_JUST_DEACTIVATED);
|
go->SetLootState(GO_JUST_DEACTIVATED);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if grid is unloaded, changing the saved slider value is enough
|
// if grid is unloaded, changing the saved slider value is enough
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,9 @@ void OutdoorPvPZM::HandlePlayerEnterZone(Player* player, bool isMainZone)
|
||||||
|
|
||||||
// cast buff the the player which enters the zone
|
// cast buff the the player which enters the zone
|
||||||
if (player->GetTeam() == m_graveyardOwner)
|
if (player->GetTeam() == m_graveyardOwner)
|
||||||
|
{
|
||||||
player->CastSpell(player, SPELL_TWIN_SPIRE_BLESSING, true);
|
player->CastSpell(player, SPELL_TWIN_SPIRE_BLESSING, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutdoorPvPZM::HandlePlayerLeaveZone(Player* player, bool isMainZone)
|
void OutdoorPvPZM::HandlePlayerLeaveZone(Player* player, bool isMainZone)
|
||||||
|
|
@ -106,19 +108,31 @@ void OutdoorPvPZM::HandleCreatureCreate(Creature* creature)
|
||||||
{
|
{
|
||||||
case NPC_PVP_BEAM_RED:
|
case NPC_PVP_BEAM_RED:
|
||||||
if (creature->GetPositionY() < 7000.0f) // East Beam
|
if (creature->GetPositionY() < 7000.0f) // East Beam
|
||||||
|
{
|
||||||
m_beamTowerRed[0] = creature->GetObjectGuid();
|
m_beamTowerRed[0] = creature->GetObjectGuid();
|
||||||
|
}
|
||||||
else if (creature->GetPositionY() < 7300.0f) // Center Beam
|
else if (creature->GetPositionY() < 7300.0f) // Center Beam
|
||||||
|
{
|
||||||
m_beamGraveyardRed = creature->GetObjectGuid();
|
m_beamGraveyardRed = creature->GetObjectGuid();
|
||||||
|
}
|
||||||
else // West Beam
|
else // West Beam
|
||||||
|
{
|
||||||
m_beamTowerRed[1] = creature->GetObjectGuid();
|
m_beamTowerRed[1] = creature->GetObjectGuid();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case NPC_PVP_BEAM_BLUE:
|
case NPC_PVP_BEAM_BLUE:
|
||||||
if (creature->GetPositionY() < 7000.0f) // East Beam
|
if (creature->GetPositionY() < 7000.0f) // East Beam
|
||||||
|
{
|
||||||
m_beamTowerBlue[0] = creature->GetObjectGuid();
|
m_beamTowerBlue[0] = creature->GetObjectGuid();
|
||||||
|
}
|
||||||
else if (creature->GetPositionY() < 7300.0f) // Center Beam
|
else if (creature->GetPositionY() < 7300.0f) // Center Beam
|
||||||
|
{
|
||||||
m_beamGraveyardBlue = creature->GetObjectGuid();
|
m_beamGraveyardBlue = creature->GetObjectGuid();
|
||||||
|
}
|
||||||
else // West Beam
|
else // West Beam
|
||||||
|
{
|
||||||
m_beamTowerBlue[1] = creature->GetObjectGuid();
|
m_beamTowerBlue[1] = creature->GetObjectGuid();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -160,7 +174,9 @@ void OutdoorPvPZM::HandlePlayerKillInsideArea(Player* player)
|
||||||
{
|
{
|
||||||
// check capture point team
|
// check capture point team
|
||||||
if (player->GetTeam() == m_towerOwner[i])
|
if (player->GetTeam() == m_towerOwner[i])
|
||||||
|
{
|
||||||
player->CastSpell(player, player->GetTeam() == ALLIANCE ? SPELL_ZANGA_TOWER_TOKEN_ALLIANCE : SPELL_ZANGA_TOWER_TOKEN_HORDE, true);
|
player->CastSpell(player, player->GetTeam() == ALLIANCE ? SPELL_ZANGA_TOWER_TOKEN_ALLIANCE : SPELL_ZANGA_TOWER_TOKEN_HORDE, true);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -183,7 +199,9 @@ bool OutdoorPvPZM::HandleEvent(uint32 eventId, GameObject* go)
|
||||||
if (zangarmarshTowerEvents[i][j].team != m_towerOwner[i])
|
if (zangarmarshTowerEvents[i][j].team != m_towerOwner[i])
|
||||||
{
|
{
|
||||||
if (zangarmarshTowerEvents[i][j].defenseMessage)
|
if (zangarmarshTowerEvents[i][j].defenseMessage)
|
||||||
|
{
|
||||||
sWorld.SendDefenseMessage(ZONE_ID_ZANGARMARSH, zangarmarshTowerEvents[i][j].defenseMessage);
|
sWorld.SendDefenseMessage(ZONE_ID_ZANGARMARSH, zangarmarshTowerEvents[i][j].defenseMessage);
|
||||||
|
}
|
||||||
|
|
||||||
return ProcessCaptureEvent(go, i, zangarmarshTowerEvents[i][j].team, zangarmarshTowerEvents[i][j].worldState, zangarmarshTowerEvents[i][j].mapState);
|
return ProcessCaptureEvent(go, i, zangarmarshTowerEvents[i][j].team, zangarmarshTowerEvents[i][j].worldState, zangarmarshTowerEvents[i][j].mapState);
|
||||||
}
|
}
|
||||||
|
|
@ -214,9 +232,11 @@ bool OutdoorPvPZM::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team
|
||||||
|
|
||||||
// only add flag to scouts if team does not have captured graveyard already
|
// only add flag to scouts if team does not have captured graveyard already
|
||||||
if (m_graveyardOwner != ALLIANCE)
|
if (m_graveyardOwner != ALLIANCE)
|
||||||
|
{
|
||||||
UpdateScoutState(ALLIANCE, true);
|
UpdateScoutState(ALLIANCE, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (team == HORDE)
|
else if (team == HORDE)
|
||||||
{
|
{
|
||||||
// update counter
|
// update counter
|
||||||
|
|
@ -230,9 +250,11 @@ bool OutdoorPvPZM::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team
|
||||||
|
|
||||||
// only add flag to scouts if team does not already have captured graveyard
|
// only add flag to scouts if team does not already have captured graveyard
|
||||||
if (m_graveyardOwner != HORDE)
|
if (m_graveyardOwner != HORDE)
|
||||||
|
{
|
||||||
UpdateScoutState(HORDE, true);
|
UpdateScoutState(HORDE, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_towerOwner[towerId] == ALLIANCE)
|
if (m_towerOwner[towerId] == ALLIANCE)
|
||||||
|
|
@ -241,7 +263,9 @@ bool OutdoorPvPZM::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team
|
||||||
|
|
||||||
// only remove flag from scouts if team does not already have captured graveyard
|
// only remove flag from scouts if team does not already have captured graveyard
|
||||||
if (m_towersAlliance == MAX_ZM_TOWERS && m_graveyardOwner != ALLIANCE)
|
if (m_towersAlliance == MAX_ZM_TOWERS && m_graveyardOwner != ALLIANCE)
|
||||||
|
{
|
||||||
UpdateScoutState(ALLIANCE, false);
|
UpdateScoutState(ALLIANCE, false);
|
||||||
|
}
|
||||||
|
|
||||||
// update counter
|
// update counter
|
||||||
--m_towersAlliance;
|
--m_towersAlliance;
|
||||||
|
|
@ -252,7 +276,9 @@ bool OutdoorPvPZM::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team
|
||||||
|
|
||||||
// only remove flag from scouts if team does not already have captured graveyard
|
// only remove flag from scouts if team does not already have captured graveyard
|
||||||
if (m_towersHorde == MAX_ZM_TOWERS && m_graveyardOwner != HORDE)
|
if (m_towersHorde == MAX_ZM_TOWERS && m_graveyardOwner != HORDE)
|
||||||
|
{
|
||||||
UpdateScoutState(HORDE, false);
|
UpdateScoutState(HORDE, false);
|
||||||
|
}
|
||||||
|
|
||||||
// update counter
|
// update counter
|
||||||
--m_towersHorde;
|
--m_towersHorde;
|
||||||
|
|
@ -285,8 +311,10 @@ void OutdoorPvPZM::UpdateScoutState(Team team, bool spawned)
|
||||||
SendUpdateWorldState(m_scoutWorldStateAlliance, WORLD_STATE_ADD);
|
SendUpdateWorldState(m_scoutWorldStateAlliance, WORLD_STATE_ADD);
|
||||||
|
|
||||||
if (spawned)
|
if (spawned)
|
||||||
|
{
|
||||||
sWorld.SendDefenseMessage(ZONE_ID_ZANGARMARSH, LANG_OPVP_ZM_SPAWN_FIELD_SCOUT_A);
|
sWorld.SendDefenseMessage(ZONE_ID_ZANGARMARSH, LANG_OPVP_ZM_SPAWN_FIELD_SCOUT_A);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SendUpdateWorldState(m_scoutWorldStateHorde, WORLD_STATE_REMOVE);
|
SendUpdateWorldState(m_scoutWorldStateHorde, WORLD_STATE_REMOVE);
|
||||||
|
|
@ -294,8 +322,10 @@ void OutdoorPvPZM::UpdateScoutState(Team team, bool spawned)
|
||||||
SendUpdateWorldState(m_scoutWorldStateHorde, WORLD_STATE_ADD);
|
SendUpdateWorldState(m_scoutWorldStateHorde, WORLD_STATE_ADD);
|
||||||
|
|
||||||
if (spawned)
|
if (spawned)
|
||||||
|
{
|
||||||
sWorld.SendDefenseMessage(ZONE_ID_ZANGARMARSH, LANG_OPVP_ZM_SPAWN_FIELD_SCOUT_H);
|
sWorld.SendDefenseMessage(ZONE_ID_ZANGARMARSH, LANG_OPVP_ZM_SPAWN_FIELD_SCOUT_H);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle the graveyard banner use
|
// Handle the graveyard banner use
|
||||||
|
|
@ -335,7 +365,9 @@ bool OutdoorPvPZM::HandleGameObjectUse(Player* player, GameObject* go)
|
||||||
SetBeaconArtKit(go, m_beamGraveyardRed, 0);
|
SetBeaconArtKit(go, m_beamGraveyardRed, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
RespawnGO(go, m_graveyardBannerNeutral, false);
|
RespawnGO(go, m_graveyardBannerNeutral, false);
|
||||||
|
}
|
||||||
|
|
||||||
if (team == ALLIANCE)
|
if (team == ALLIANCE)
|
||||||
{
|
{
|
||||||
|
|
@ -377,7 +409,9 @@ bool OutdoorPvPZM::HandleGameObjectUse(Player* player, GameObject* go)
|
||||||
|
|
||||||
// apply zone buff
|
// apply zone buff
|
||||||
if (m_graveyardOwner != TEAM_NONE)
|
if (m_graveyardOwner != TEAM_NONE)
|
||||||
|
{
|
||||||
BuffTeam(m_graveyardOwner, SPELL_TWIN_SPIRE_BLESSING, true);
|
BuffTeam(m_graveyardOwner, SPELL_TWIN_SPIRE_BLESSING, true);
|
||||||
|
}
|
||||||
BuffTeam(team, SPELL_TWIN_SPIRE_BLESSING);
|
BuffTeam(team, SPELL_TWIN_SPIRE_BLESSING);
|
||||||
|
|
||||||
// reset scout so that team cannot take flag
|
// reset scout so that team cannot take flag
|
||||||
|
|
@ -410,8 +444,12 @@ void OutdoorPvPZM::SetBeaconArtKit(const WorldObject* objRef, ObjectGuid creatur
|
||||||
if (Creature* beam = objRef->GetMap()->GetCreature(creatureGuid))
|
if (Creature* beam = objRef->GetMap()->GetCreature(creatureGuid))
|
||||||
{
|
{
|
||||||
if (auraId)
|
if (auraId)
|
||||||
|
{
|
||||||
beam->CastSpell(beam, auraId, true);
|
beam->CastSpell(beam, auraId, true);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
beam->RemoveAllAuras();
|
beam->RemoveAllAuras();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,9 @@ void HostileReference::fireStatusChanged(ThreatRefStatusChangeEvent& pThreatRefS
|
||||||
void HostileReference::addThreat(float pMod)
|
void HostileReference::addThreat(float pMod)
|
||||||
{
|
{
|
||||||
if (pMod + iThreat < 0)
|
if (pMod + iThreat < 0)
|
||||||
|
{
|
||||||
pMod = -iThreat;
|
pMod = -iThreat;
|
||||||
|
}
|
||||||
|
|
||||||
iThreat += pMod;
|
iThreat += pMod;
|
||||||
// the threat is changed. Source and target unit have to be availabe
|
// the threat is changed. Source and target unit have to be availabe
|
||||||
|
|
@ -137,7 +139,9 @@ void HostileReference::addThreat(float pMod)
|
||||||
{
|
{
|
||||||
Unit* victim_owner = getTarget()->GetOwner();
|
Unit* victim_owner = getTarget()->GetOwner();
|
||||||
if (victim_owner && victim_owner->IsAlive())
|
if (victim_owner && victim_owner->IsAlive())
|
||||||
{ getSource()->addThreat(victim_owner, 0.0f); } // create a threat to the owner of a pet, if the pet attacks
|
{
|
||||||
|
getSource()->addThreat(victim_owner, 0.0f); // create a threat to the owner of a pet, if the pet attacks
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -169,7 +173,9 @@ void HostileReference::updateOnlineStatus()
|
||||||
if (!online)
|
if (!online)
|
||||||
{
|
{
|
||||||
if (creature->AI()->canReachByRangeAttack(getTarget()))
|
if (creature->AI()->canReachByRangeAttack(getTarget()))
|
||||||
{ online = true; } // not accessable but stays online
|
{
|
||||||
|
online = true; // not accessable but stays online
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -189,7 +195,9 @@ void HostileReference::setOnlineOfflineState(bool pIsOnline)
|
||||||
{
|
{
|
||||||
iOnline = pIsOnline;
|
iOnline = pIsOnline;
|
||||||
if (!iOnline)
|
if (!iOnline)
|
||||||
{ setAccessibleState(false); } // if not online that not accessable as well
|
{
|
||||||
|
setAccessibleState(false); // if not online that not accessable as well
|
||||||
|
}
|
||||||
|
|
||||||
ThreatRefStatusChangeEvent event(UEV_THREAT_REF_ONLINE_STATUS, this);
|
ThreatRefStatusChangeEvent event(UEV_THREAT_REF_ONLINE_STATUS, this);
|
||||||
fireStatusChanged(event);
|
fireStatusChanged(event);
|
||||||
|
|
@ -491,10 +499,14 @@ void ThreatManager::addThreatDirectly(Unit* pVictim, float threat)
|
||||||
HostileReference* ref = iThreatContainer.addThreat(pVictim, threat);
|
HostileReference* ref = iThreatContainer.addThreat(pVictim, threat);
|
||||||
// Ref is online
|
// Ref is online
|
||||||
if (ref)
|
if (ref)
|
||||||
|
{
|
||||||
iUpdateNeed = true;
|
iUpdateNeed = true;
|
||||||
|
}
|
||||||
// Ref is not in the online refs, search the offline refs next
|
// Ref is not in the online refs, search the offline refs next
|
||||||
else
|
else
|
||||||
|
{
|
||||||
ref = iThreatOfflineContainer.addThreat(pVictim, threat);
|
ref = iThreatOfflineContainer.addThreat(pVictim, threat);
|
||||||
|
}
|
||||||
|
|
||||||
if (!ref) // there was no ref => create a new one
|
if (!ref) // there was no ref => create a new one
|
||||||
{
|
{
|
||||||
|
|
@ -504,7 +516,9 @@ void ThreatManager::addThreatDirectly(Unit* pVictim, float threat)
|
||||||
hostileReference->addThreat(threat); // now we add the real threat
|
hostileReference->addThreat(threat); // now we add the real threat
|
||||||
iUpdateNeed = true;
|
iUpdateNeed = true;
|
||||||
if (pVictim->GetTypeId() == TYPEID_PLAYER && ((Player*)pVictim)->isGameMaster())
|
if (pVictim->GetTypeId() == TYPEID_PLAYER && ((Player*)pVictim)->isGameMaster())
|
||||||
{ hostileReference->setOnlineOfflineState(false); } // GM is always offline
|
{
|
||||||
|
hostileReference->setOnlineOfflineState(false); // GM is always offline
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -538,9 +552,13 @@ float ThreatManager::getThreat(Unit* pVictim, bool pAlsoSearchOfflineList)
|
||||||
float threat = 0.0f;
|
float threat = 0.0f;
|
||||||
|
|
||||||
if (HostileReference* ref = iThreatContainer.getReferenceByTarget(pVictim))
|
if (HostileReference* ref = iThreatContainer.getReferenceByTarget(pVictim))
|
||||||
|
{
|
||||||
threat = ref->getThreat();
|
threat = ref->getThreat();
|
||||||
|
}
|
||||||
else if (pAlsoSearchOfflineList)
|
else if (pAlsoSearchOfflineList)
|
||||||
|
{
|
||||||
threat = iThreatOfflineContainer.getReferenceByTarget(pVictim)->getThreat();
|
threat = iThreatOfflineContainer.getReferenceByTarget(pVictim)->getThreat();
|
||||||
|
}
|
||||||
|
|
||||||
return threat;
|
return threat;
|
||||||
}
|
}
|
||||||
|
|
@ -585,7 +603,9 @@ void ThreatManager::setCurrentVictim(HostileReference* pHostileReference)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pHostileReference)
|
if (pHostileReference)
|
||||||
|
{
|
||||||
iOwner->SendHighestThreatUpdate(pHostileReference);
|
iOwner->SendHighestThreatUpdate(pHostileReference);
|
||||||
|
}
|
||||||
|
|
||||||
iCurrentVictim = pHostileReference;
|
iCurrentVictim = pHostileReference;
|
||||||
iUpdateNeed = true;
|
iUpdateNeed = true;
|
||||||
|
|
@ -606,7 +626,9 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat
|
||||||
case UEV_THREAT_REF_THREAT_CHANGE:
|
case UEV_THREAT_REF_THREAT_CHANGE:
|
||||||
if ((getCurrentVictim() == hostileReference && threatRefStatusChangeEvent->getFValue() < 0.0f) ||
|
if ((getCurrentVictim() == hostileReference && threatRefStatusChangeEvent->getFValue() < 0.0f) ||
|
||||||
(getCurrentVictim() != hostileReference && threatRefStatusChangeEvent->getFValue() > 0.0f))
|
(getCurrentVictim() != hostileReference && threatRefStatusChangeEvent->getFValue() > 0.0f))
|
||||||
{ setDirty(true); } // the order in the threat list might have changed
|
{
|
||||||
|
setDirty(true); // the order in the threat list might have changed
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case UEV_THREAT_REF_ONLINE_STATUS:
|
case UEV_THREAT_REF_ONLINE_STATUS:
|
||||||
if (!hostileReference->isOnline())
|
if (!hostileReference->isOnline())
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,9 @@ inline void LoadDB2(LocalDB2Data& localeData, StoreProblemList1& errors, DB2Stor
|
||||||
for(uint8 i = 0; fullLocaleNameList[i].name; ++i)
|
for(uint8 i = 0; fullLocaleNameList[i].name; ++i)
|
||||||
{
|
{
|
||||||
if (!(localeData.availableDb2Locales & (1 << i)))
|
if (!(localeData.availableDb2Locales & (1 << i)))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
LocaleNameStr const* localStr = &fullLocaleNameList[i];
|
LocaleNameStr const* localStr = &fullLocaleNameList[i];
|
||||||
|
|
||||||
|
|
@ -97,8 +99,10 @@ inline void LoadDB2(LocalDB2Data& localeData, StoreProblemList1& errors, DB2Stor
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
errors.push_back(db2Filename);
|
errors.push_back(db2Filename);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadDB2Stores(const std::string& dataPath)
|
void LoadDB2Stores(const std::string& dataPath)
|
||||||
|
|
|
||||||
|
|
@ -332,7 +332,9 @@ static uint32 ReadDBCBuild(const std::string& dbc_path, LocaleNameStr const*&loc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
ReadDBCBuildFileText(dbc_path, localeNameStr->name, text);
|
ReadDBCBuildFileText(dbc_path, localeNameStr->name, text);
|
||||||
|
}
|
||||||
|
|
||||||
if (text.empty())
|
if (text.empty())
|
||||||
{
|
{
|
||||||
|
|
@ -392,7 +394,9 @@ inline void LoadDBC(LocalData& localeData, BarGoLink& bar, StoreProblemList& err
|
||||||
for (uint8 i = 0; fullLocaleNameList[i].name; ++i)
|
for (uint8 i = 0; fullLocaleNameList[i].name; ++i)
|
||||||
{
|
{
|
||||||
if (!(localeData.availableDbcLocales & (1 << i)))
|
if (!(localeData.availableDbcLocales & (1 << i)))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
LocaleNameStr const* localStr = &fullLocaleNameList[i];
|
LocaleNameStr const* localStr = &fullLocaleNameList[i];
|
||||||
|
|
||||||
|
|
@ -437,8 +441,10 @@ inline void LoadDBC(LocalData& localeData, BarGoLink& bar, StoreProblemList& err
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
errlist.push_back(dbc_filename);
|
errlist.push_back(dbc_filename);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadDBCStores(const std::string& dataPath)
|
void LoadDBCStores(const std::string& dataPath)
|
||||||
|
|
@ -454,7 +460,9 @@ void LoadDBCStores(const std::string& dataPath)
|
||||||
if (build)
|
if (build)
|
||||||
sLog.outError("Found DBC files for build %u but mangosd expected DBC for one from builds: %s Please extract correct DBC files.", build, AcceptableClientBuildsListStr().c_str());
|
sLog.outError("Found DBC files for build %u but mangosd expected DBC for one from builds: %s Please extract correct DBC files.", build, AcceptableClientBuildsListStr().c_str());
|
||||||
else
|
else
|
||||||
|
{
|
||||||
sLog.outError("Incorrect DataDir value in mangosd.conf or not found build info (outdated DBC files). Required one from builds: %s Please extract correct DBC files.", AcceptableClientBuildsListStr().c_str());
|
sLog.outError("Incorrect DataDir value in mangosd.conf or not found build info (outdated DBC files). Required one from builds: %s Please extract correct DBC files.", AcceptableClientBuildsListStr().c_str());
|
||||||
|
}
|
||||||
Log::WaitBeforeContinueIfNeed();
|
Log::WaitBeforeContinueIfNeed();
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
@ -479,9 +487,11 @@ void LoadDBCStores(const std::string& dataPath)
|
||||||
|
|
||||||
// fill MapId->DBC records ( skip sub zones and continents )
|
// fill MapId->DBC records ( skip sub zones and continents )
|
||||||
if (area->zone == 0 && area->mapid != 0 && area->mapid != 1 && area->mapid != 530 && area->mapid != 571 && area->mapid != 860 && area->mapid != 870)
|
if (area->zone == 0 && area->mapid != 0 && area->mapid != 1 && area->mapid != 530 && area->mapid != 571 && area->mapid != 860 && area->mapid != 870)
|
||||||
|
{
|
||||||
sAreaFlagByMapID.insert(AreaFlagByMapID::value_type(area->mapid, area->exploreFlag));
|
sAreaFlagByMapID.insert(AreaFlagByMapID::value_type(area->mapid, area->exploreFlag));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LoadDBC(availableDbcLocales, bar, bad_dbc_files, sAchievementStore, dbcPath, "Achievement.dbc");
|
LoadDBC(availableDbcLocales, bar, bad_dbc_files, sAchievementStore, dbcPath, "Achievement.dbc");
|
||||||
LoadDBC(availableDbcLocales, bar, bad_dbc_files, sAchievementCriteriaStore, dbcPath, "Achievement_Criteria.dbc");
|
LoadDBC(availableDbcLocales, bar, bad_dbc_files, sAchievementCriteriaStore, dbcPath, "Achievement_Criteria.dbc");
|
||||||
|
|
@ -499,7 +509,9 @@ void LoadDBCStores(const std::string& dataPath)
|
||||||
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sChrPowerTypesStore, dbcPath,"ChrClassesXPowerTypes.dbc");
|
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sChrPowerTypesStore, dbcPath,"ChrClassesXPowerTypes.dbc");
|
||||||
for (uint32 i = 0; i < MAX_CLASSES; ++i)
|
for (uint32 i = 0; i < MAX_CLASSES; ++i)
|
||||||
for (uint32 j = 0; j < MAX_POWERS; ++j)
|
for (uint32 j = 0; j < MAX_POWERS; ++j)
|
||||||
|
{
|
||||||
PowersByClass[i][j] = MAX_POWERS;
|
PowersByClass[i][j] = MAX_POWERS;
|
||||||
|
}
|
||||||
|
|
||||||
for (uint32 i = 0; i < sChrPowerTypesStore.GetNumRows(); ++i)
|
for (uint32 i = 0; i < sChrPowerTypesStore.GetNumRows(); ++i)
|
||||||
{
|
{
|
||||||
|
|
@ -508,7 +520,9 @@ void LoadDBCStores(const std::string& dataPath)
|
||||||
uint32 index = 0;
|
uint32 index = 0;
|
||||||
for (uint32 j = 0; j < MAX_POWERS; ++j)
|
for (uint32 j = 0; j < MAX_POWERS; ++j)
|
||||||
if (PowersByClass[power->classId][j] != MAX_POWERS)
|
if (PowersByClass[power->classId][j] != MAX_POWERS)
|
||||||
|
{
|
||||||
++index;
|
++index;
|
||||||
|
}
|
||||||
|
|
||||||
PowersByClass[power->classId][power->power] = index;
|
PowersByClass[power->classId][power->power] = index;
|
||||||
}
|
}
|
||||||
|
|
@ -592,7 +606,9 @@ void LoadDBCStores(const std::string& dataPath)
|
||||||
// fill data
|
// fill data
|
||||||
for (uint32 i = 1; i < sMapDifficultyStore.GetNumRows(); ++i)
|
for (uint32 i = 1; i < sMapDifficultyStore.GetNumRows(); ++i)
|
||||||
if (MapDifficultyEntry const* entry = sMapDifficultyStore.LookupEntry(i))
|
if (MapDifficultyEntry const* entry = sMapDifficultyStore.LookupEntry(i))
|
||||||
|
{
|
||||||
sMapDifficultyMap[MAKE_PAIR32(entry->MapId, entry->Difficulty)] = entry;
|
sMapDifficultyMap[MAKE_PAIR32(entry->MapId, entry->Difficulty)] = entry;
|
||||||
|
}
|
||||||
|
|
||||||
LoadDBC(availableDbcLocales, bar, bad_dbc_files, sMovieStore, dbcPath, "Movie.dbc");
|
LoadDBC(availableDbcLocales, bar, bad_dbc_files, sMovieStore, dbcPath, "Movie.dbc");
|
||||||
LoadDBC(availableDbcLocales,bar,bad_dbc_files, sMountCapabilityStore, dbcPath,"MountCapability.dbc");
|
LoadDBC(availableDbcLocales,bar,bad_dbc_files, sMountCapabilityStore, dbcPath,"MountCapability.dbc");
|
||||||
|
|
@ -607,7 +623,9 @@ void LoadDBCStores(const std::string& dataPath)
|
||||||
for (uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i)
|
for (uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i)
|
||||||
if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i))
|
if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i))
|
||||||
if (entry->bracketId > MAX_BATTLEGROUND_BRACKETS)
|
if (entry->bracketId > MAX_BATTLEGROUND_BRACKETS)
|
||||||
|
{
|
||||||
MANGOS_ASSERT(false && "Need update MAX_BATTLEGROUND_BRACKETS by DBC data");
|
MANGOS_ASSERT(false && "Need update MAX_BATTLEGROUND_BRACKETS by DBC data");
|
||||||
|
}
|
||||||
|
|
||||||
LoadDBC(availableDbcLocales, bar, bad_dbc_files, sRandomPropertiesPointsStore, dbcPath, "RandPropPoints.dbc");
|
LoadDBC(availableDbcLocales, bar, bad_dbc_files, sRandomPropertiesPointsStore, dbcPath, "RandPropPoints.dbc");
|
||||||
LoadDBC(availableDbcLocales, bar, bad_dbc_files, sScalingStatDistributionStore, dbcPath, "ScalingStatDistribution.dbc");
|
LoadDBC(availableDbcLocales, bar, bad_dbc_files, sScalingStatDistributionStore, dbcPath, "ScalingStatDistribution.dbc");
|
||||||
|
|
@ -632,7 +650,9 @@ void LoadDBCStores(const std::string& dataPath)
|
||||||
{
|
{
|
||||||
if(SpellCategoriesEntry const* category = spell->GetSpellCategories())
|
if(SpellCategoriesEntry const* category = spell->GetSpellCategories())
|
||||||
if(uint32 cat = category->Category)
|
if(uint32 cat = category->Category)
|
||||||
|
{
|
||||||
sSpellCategoryStore[cat].insert(i);
|
sSpellCategoryStore[cat].insert(i);
|
||||||
|
}
|
||||||
|
|
||||||
// DBC not support uint64 fields but SpellEntry have SpellFamilyFlags mapped at 2 uint32 fields
|
// DBC not support uint64 fields but SpellEntry have SpellFamilyFlags mapped at 2 uint32 fields
|
||||||
// uint32 field already converted to bigendian if need, but must be swapped for correct uint64 bigendian view
|
// uint32 field already converted to bigendian if need, but must be swapped for correct uint64 bigendian view
|
||||||
|
|
@ -658,9 +678,11 @@ void LoadDBCStores(const std::string& dataPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spellEffect->EffectSpellId < MAX_EFFECT_INDEX && spellEffect->Difficulty == 0)
|
if (spellEffect->EffectSpellId < MAX_EFFECT_INDEX && spellEffect->Difficulty == 0)
|
||||||
|
{
|
||||||
sSpellEffectMap[spellEffect->EffectSpellId].effects[spellEffect->EffectIndex] = spellEffect;
|
sSpellEffectMap[spellEffect->EffectSpellId].effects[spellEffect->EffectIndex] = spellEffect;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellEquippedItemsStore, dbcPath,"SpellEquippedItems.dbc");
|
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellEquippedItemsStore, dbcPath,"SpellEquippedItems.dbc");
|
||||||
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellInterruptsStore, dbcPath,"SpellInterrupts.dbc");
|
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellInterruptsStore, dbcPath,"SpellInterrupts.dbc");
|
||||||
|
|
@ -677,7 +699,9 @@ void LoadDBCStores(const std::string& dataPath)
|
||||||
SkillLineAbilityEntry const* skillLine = sSkillLineAbilityStore.LookupEntry(j);
|
SkillLineAbilityEntry const* skillLine = sSkillLineAbilityStore.LookupEntry(j);
|
||||||
|
|
||||||
if (!skillLine)
|
if (!skillLine)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->spellId);
|
SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->spellId);
|
||||||
if (spellInfo && (spellInfo->GetAttributes() & (SPELL_ATTR_UNK4 | SPELL_ATTR_PASSIVE | SPELL_ATTR_UNK7 | SPELL_ATTR_UNK8)) == (SPELL_ATTR_UNK4 | SPELL_ATTR_PASSIVE | SPELL_ATTR_UNK7 | SPELL_ATTR_UNK8))
|
if (spellInfo && (spellInfo->GetAttributes() & (SPELL_ATTR_UNK4 | SPELL_ATTR_PASSIVE | SPELL_ATTR_UNK7 | SPELL_ATTR_UNK8)) == (SPELL_ATTR_UNK4 | SPELL_ATTR_PASSIVE | SPELL_ATTR_UNK7 | SPELL_ATTR_UNK8))
|
||||||
|
|
@ -686,10 +710,14 @@ void LoadDBCStores(const std::string& dataPath)
|
||||||
{
|
{
|
||||||
CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(i);
|
CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(i);
|
||||||
if (!cFamily)
|
if (!cFamily)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (skillLine->skillId != cFamily->skillLine[0] && skillLine->skillId != cFamily->skillLine[1])
|
if (skillLine->skillId != cFamily->skillLine[0] && skillLine->skillId != cFamily->skillLine[1])
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
sPetFamilySpellsStore[i].insert(spellInfo->Id);
|
sPetFamilySpellsStore[i].insert(spellInfo->Id);
|
||||||
}
|
}
|
||||||
|
|
@ -718,8 +746,10 @@ void LoadDBCStores(const std::string& dataPath)
|
||||||
if (!talentInfo) continue;
|
if (!talentInfo) continue;
|
||||||
for (int j = 0; j < MAX_TALENT_RANK; j++)
|
for (int j = 0; j < MAX_TALENT_RANK; j++)
|
||||||
if (talentInfo->RankID[j])
|
if (talentInfo->RankID[j])
|
||||||
|
{
|
||||||
sTalentSpellPosMap[talentInfo->RankID[j]] = TalentSpellPos(i, j);
|
sTalentSpellPosMap[talentInfo->RankID[j]] = TalentSpellPos(i, j);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTalentTabStore, dbcPath, "TalentTab.dbc");
|
//LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTalentTabStore, dbcPath, "TalentTab.dbc");
|
||||||
|
|
||||||
|
|
@ -730,21 +760,29 @@ void LoadDBCStores(const std::string& dataPath)
|
||||||
{
|
{
|
||||||
TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentTabId);
|
TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentTabId);
|
||||||
if (!talentTabInfo)
|
if (!talentTabInfo)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (uint32 i = 0; i < MAX_MASTERY_SPELLS; ++i)
|
for (uint32 i = 0; i < MAX_MASTERY_SPELLS; ++i)
|
||||||
if (uint32 spellid = talentTabInfo->masterySpells[i])
|
if (uint32 spellid = talentTabInfo->masterySpells[i])
|
||||||
if (sSpellStore.LookupEntry(spellid))
|
if (sSpellStore.LookupEntry(spellid))
|
||||||
|
{
|
||||||
sTalentTreeMasterySpellsMap[talentTabId].push_back(spellid);
|
sTalentTreeMasterySpellsMap[talentTabId].push_back(spellid);
|
||||||
|
}
|
||||||
|
|
||||||
// prevent memory corruption; otherwise cls will become 12 below
|
// prevent memory corruption; otherwise cls will become 12 below
|
||||||
if ((talentTabInfo->ClassMask & CLASSMASK_ALL_PLAYABLE) == 0)
|
if ((talentTabInfo->ClassMask & CLASSMASK_ALL_PLAYABLE) == 0)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// store class talent tab pages
|
// store class talent tab pages
|
||||||
for (uint32 cls = 1; cls < MAX_CLASSES; ++cls)
|
for (uint32 cls = 1; cls < MAX_CLASSES; ++cls)
|
||||||
if (talentTabInfo->ClassMask & (1 << (cls - 1)))
|
if (talentTabInfo->ClassMask & (1 << (cls - 1)))
|
||||||
|
{
|
||||||
sTalentTabPages[cls][talentTabInfo->tabpage] = talentTabId;
|
sTalentTabPages[cls][talentTabInfo->tabpage] = talentTabId;
|
||||||
|
}
|
||||||
|
|
||||||
sTalentTreeRolesMap[talentTabId] = talentTabInfo->rolesMask;
|
sTalentTreeRolesMap[talentTabId] = talentTabInfo->rolesMask;
|
||||||
}
|
}
|
||||||
|
|
@ -754,7 +792,9 @@ void LoadDBCStores(const std::string& dataPath)
|
||||||
for (uint32 i = 0; i < sTalentTreePrimarySpellsStore.GetNumRows(); ++i)
|
for (uint32 i = 0; i < sTalentTreePrimarySpellsStore.GetNumRows(); ++i)
|
||||||
if (TalentTreePrimarySpellsEntry const* talentSpell = sTalentTreePrimarySpellsStore.LookupEntry(i))
|
if (TalentTreePrimarySpellsEntry const* talentSpell = sTalentTreePrimarySpellsStore.LookupEntry(i))
|
||||||
if (sSpellStore.LookupEntry(talentSpell->SpellId))
|
if (sSpellStore.LookupEntry(talentSpell->SpellId))
|
||||||
|
{
|
||||||
sTalentTreePrimarySpellsMap[talentSpell->TalentTree].push_back(talentSpell->SpellId);
|
sTalentTreePrimarySpellsMap[talentSpell->TalentTree].push_back(talentSpell->SpellId);
|
||||||
|
}
|
||||||
sTalentTreePrimarySpellsStore.Clear();
|
sTalentTreePrimarySpellsStore.Clear();
|
||||||
|
|
||||||
LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTaxiNodesStore, dbcPath, "TaxiNodes.dbc");
|
LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTaxiNodesStore, dbcPath, "TaxiNodes.dbc");
|
||||||
|
|
@ -762,7 +802,9 @@ void LoadDBCStores(const std::string& dataPath)
|
||||||
LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTaxiPathStore, dbcPath, "TaxiPath.dbc");
|
LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTaxiPathStore, dbcPath, "TaxiPath.dbc");
|
||||||
for (uint32 i = 1; i < sTaxiPathStore.GetNumRows(); ++i)
|
for (uint32 i = 1; i < sTaxiPathStore.GetNumRows(); ++i)
|
||||||
if (TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(i))
|
if (TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(i))
|
||||||
|
{
|
||||||
sTaxiPathSetBySource[entry->from][entry->to] = TaxiPathBySourceAndDestination(entry->ID, entry->price);
|
sTaxiPathSetBySource[entry->from][entry->to] = TaxiPathBySourceAndDestination(entry->ID, entry->price);
|
||||||
|
}
|
||||||
uint32 pathCount = sTaxiPathStore.GetNumRows();
|
uint32 pathCount = sTaxiPathStore.GetNumRows();
|
||||||
|
|
||||||
//## TaxiPathNode.dbc ## Loaded only for initialization different structures
|
//## TaxiPathNode.dbc ## Loaded only for initialization different structures
|
||||||
|
|
@ -774,8 +816,10 @@ void LoadDBCStores(const std::string& dataPath)
|
||||||
if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
|
if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
|
||||||
{
|
{
|
||||||
if (pathLength[entry->path] < entry->index + 1)
|
if (pathLength[entry->path] < entry->index + 1)
|
||||||
|
{
|
||||||
pathLength[entry->path] = entry->index + 1;
|
pathLength[entry->path] = entry->index + 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Set path length
|
// Set path length
|
||||||
sTaxiPathNodesByPath.resize(pathCount); // 0 and some other indexes not used
|
sTaxiPathNodesByPath.resize(pathCount); // 0 and some other indexes not used
|
||||||
for (uint32 i = 1; i < sTaxiPathNodesByPath.size(); ++i)
|
for (uint32 i = 1; i < sTaxiPathNodesByPath.size(); ++i)
|
||||||
|
|
@ -785,7 +829,9 @@ void LoadDBCStores(const std::string& dataPath)
|
||||||
// fill data (pointers to sTaxiPathNodeStore elements
|
// fill data (pointers to sTaxiPathNodeStore elements
|
||||||
for (uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i)
|
for (uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i)
|
||||||
if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
|
if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
|
||||||
|
{
|
||||||
sTaxiPathNodesByPath[entry->path].set(entry->index, entry);
|
sTaxiPathNodesByPath[entry->path].set(entry->index, entry);
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize global taxinodes mask
|
// Initialize global taxinodes mask
|
||||||
// include existing nodes that have at least single not spell base (scripted) path
|
// include existing nodes that have at least single not spell base (scripted) path
|
||||||
|
|
@ -796,7 +842,9 @@ void LoadDBCStores(const std::string& dataPath)
|
||||||
for (int j = 0; j < MAX_EFFECT_INDEX; ++j)
|
for (int j = 0; j < MAX_EFFECT_INDEX; ++j)
|
||||||
if(SpellEffectEntry const* effect = sInfo->GetSpellEffect(SpellEffectIndex(j)))
|
if(SpellEffectEntry const* effect = sInfo->GetSpellEffect(SpellEffectIndex(j)))
|
||||||
if(effect->Effect==123 /*SPELL_EFFECT_SEND_TAXI*/)
|
if(effect->Effect==123 /*SPELL_EFFECT_SEND_TAXI*/)
|
||||||
|
{
|
||||||
spellPaths.insert(effect->EffectMiscValue);
|
spellPaths.insert(effect->EffectMiscValue);
|
||||||
|
}
|
||||||
|
|
||||||
memset(sTaxiNodesMask, 0, sizeof(sTaxiNodesMask));
|
memset(sTaxiNodesMask, 0, sizeof(sTaxiNodesMask));
|
||||||
memset(sOldContinentsNodesMask, 0, sizeof(sTaxiNodesMask));
|
memset(sOldContinentsNodesMask, 0, sizeof(sTaxiNodesMask));
|
||||||
|
|
@ -807,7 +855,9 @@ void LoadDBCStores(const std::string& dataPath)
|
||||||
{
|
{
|
||||||
TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i);
|
TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i);
|
||||||
if (!node)
|
if (!node)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
TaxiPathSetBySource::const_iterator src_i = sTaxiPathSetBySource.find(i);
|
TaxiPathSetBySource::const_iterator src_i = sTaxiPathSetBySource.find(i);
|
||||||
if (src_i != sTaxiPathSetBySource.end() && !src_i->second.empty())
|
if (src_i != sTaxiPathSetBySource.end() && !src_i->second.empty())
|
||||||
|
|
@ -824,8 +874,10 @@ void LoadDBCStores(const std::string& dataPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ok)
|
if (!ok)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// valid taxi network node
|
// valid taxi network node
|
||||||
uint8 field = (uint8)((i - 1) / 8);
|
uint8 field = (uint8)((i - 1) / 8);
|
||||||
|
|
@ -833,28 +885,40 @@ void LoadDBCStores(const std::string& dataPath)
|
||||||
sTaxiNodesMask[field] |= submask;
|
sTaxiNodesMask[field] |= submask;
|
||||||
|
|
||||||
if (node->MountCreatureID[0] && node->MountCreatureID[0] != 32981)
|
if (node->MountCreatureID[0] && node->MountCreatureID[0] != 32981)
|
||||||
|
{
|
||||||
sHordeTaxiNodesMask[field] |= submask;
|
sHordeTaxiNodesMask[field] |= submask;
|
||||||
|
}
|
||||||
if (node->MountCreatureID[1] && node->MountCreatureID[1] != 32981)
|
if (node->MountCreatureID[1] && node->MountCreatureID[1] != 32981)
|
||||||
|
{
|
||||||
sAllianceTaxiNodesMask[field] |= submask;
|
sAllianceTaxiNodesMask[field] |= submask;
|
||||||
|
}
|
||||||
if (node->MountCreatureID[0] == 32981 || node->MountCreatureID[1] == 32981)
|
if (node->MountCreatureID[0] == 32981 || node->MountCreatureID[1] == 32981)
|
||||||
|
{
|
||||||
sDeathKnightTaxiNodesMask[field] |= submask;
|
sDeathKnightTaxiNodesMask[field] |= submask;
|
||||||
|
}
|
||||||
|
|
||||||
// old continent node (+ nodes virtually at old continents, check explicitly to avoid loading map files for zone info)
|
// old continent node (+ nodes virtually at old continents, check explicitly to avoid loading map files for zone info)
|
||||||
if (node->map_id < 2 || i == 82 || i == 83 || i == 93 || i == 94)
|
if (node->map_id < 2 || i == 82 || i == 83 || i == 93 || i == 94)
|
||||||
|
{
|
||||||
sOldContinentsNodesMask[field] |= submask;
|
sOldContinentsNodesMask[field] |= submask;
|
||||||
|
}
|
||||||
|
|
||||||
// fix DK node at Ebon Hold
|
// fix DK node at Ebon Hold
|
||||||
if (i == 315)
|
if (i == 315)
|
||||||
|
{
|
||||||
(const_cast<TaxiNodesEntry*>(node))->MountCreatureID[1] = node->MountCreatureID[0];
|
(const_cast<TaxiNodesEntry*>(node))->MountCreatureID[1] = node->MountCreatureID[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTotemCategoryStore, dbcPath, "TotemCategory.dbc");
|
LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTotemCategoryStore, dbcPath, "TotemCategory.dbc");
|
||||||
|
|
||||||
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTransportAnimationStore, dbcPath,"TransportAnimation.dbc");
|
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTransportAnimationStore, dbcPath,"TransportAnimation.dbc");
|
||||||
for (uint32 i = 0; i < sTransportAnimationStore.GetNumRows(); ++i)
|
for (uint32 i = 0; i < sTransportAnimationStore.GetNumRows(); ++i)
|
||||||
if (TransportAnimationEntry const* entry = sTransportAnimationStore.LookupEntry(i))
|
if (TransportAnimationEntry const* entry = sTransportAnimationStore.LookupEntry(i))
|
||||||
|
{
|
||||||
sTransportAnimationsByEntry[entry->transportEntry][entry->timeFrame] = entry;
|
sTransportAnimationsByEntry[entry->transportEntry][entry->timeFrame] = entry;
|
||||||
|
}
|
||||||
|
|
||||||
LoadDBC(availableDbcLocales, bar, bad_dbc_files, sVehicleStore, dbcPath, "Vehicle.dbc");
|
LoadDBC(availableDbcLocales, bar, bad_dbc_files, sVehicleStore, dbcPath, "Vehicle.dbc");
|
||||||
LoadDBC(availableDbcLocales, bar, bad_dbc_files, sVehicleSeatStore, dbcPath, "VehicleSeat.dbc");
|
LoadDBC(availableDbcLocales, bar, bad_dbc_files, sVehicleSeatStore, dbcPath, "VehicleSeat.dbc");
|
||||||
|
|
@ -1186,7 +1250,9 @@ ContentLevels GetContentLevelsForMapAndZone(uint32 mapId, uint32 zoneId)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapEntry->rootPhaseMap != -1)
|
if (mapEntry->rootPhaseMap != -1)
|
||||||
|
{
|
||||||
mapId = mapEntry->rootPhaseMap;
|
mapId = mapEntry->rootPhaseMap;
|
||||||
|
}
|
||||||
|
|
||||||
switch (mapId)
|
switch (mapId)
|
||||||
{
|
{
|
||||||
|
|
@ -1233,7 +1299,9 @@ PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 lev
|
||||||
{
|
{
|
||||||
// skip unrelated and too-high brackets
|
// skip unrelated and too-high brackets
|
||||||
if (entry->mapId != mapid || entry->minLevel > level)
|
if (entry->mapId != mapid || entry->minLevel > level)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// exactly fit
|
// exactly fit
|
||||||
if (entry->maxLevel >= level)
|
if (entry->maxLevel >= level)
|
||||||
|
|
@ -1243,9 +1311,11 @@ PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 lev
|
||||||
|
|
||||||
// remember for possible out-of-range case (search higher from existed)
|
// remember for possible out-of-range case (search higher from existed)
|
||||||
if (!maxEntry || maxEntry->maxLevel < entry->maxLevel)
|
if (!maxEntry || maxEntry->maxLevel < entry->maxLevel)
|
||||||
|
{
|
||||||
maxEntry = entry;
|
maxEntry = entry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return maxEntry;
|
return maxEntry;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,14 +31,18 @@
|
||||||
int32 SpellEntry::CalculateSimpleValue(SpellEffectIndex eff) const
|
int32 SpellEntry::CalculateSimpleValue(SpellEffectIndex eff) const
|
||||||
{
|
{
|
||||||
if(SpellEffectEntry const* effectEntry = GetSpellEffectEntry(Id, eff))
|
if(SpellEffectEntry const* effectEntry = GetSpellEffectEntry(Id, eff))
|
||||||
|
{
|
||||||
return effectEntry->CalculateSimpleValue();
|
return effectEntry->CalculateSimpleValue();
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ClassFamilyMask const& SpellEntry::GetEffectSpellClassMask(SpellEffectIndex eff) const
|
ClassFamilyMask const& SpellEntry::GetEffectSpellClassMask(SpellEffectIndex eff) const
|
||||||
{
|
{
|
||||||
if (SpellEffectEntry const* effectEntry = GetSpellEffectEntry(Id, eff))
|
if (SpellEffectEntry const* effectEntry = GetSpellEffectEntry(Id, eff))
|
||||||
|
{
|
||||||
return effectEntry->EffectSpellClassMask;
|
return effectEntry->EffectSpellClassMask;
|
||||||
|
}
|
||||||
|
|
||||||
static ClassFamilyMask const emptyCFM;
|
static ClassFamilyMask const emptyCFM;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1464,7 +1464,9 @@ struct MapEntry
|
||||||
bool IsTransport() const
|
bool IsTransport() const
|
||||||
{
|
{
|
||||||
if (IsContinent())
|
if (IsContinent())
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return map_type == MAP_COMMON && mapFlags == MAP_FLAG_INSTANCEABLE;
|
return map_type == MAP_COMMON && mapFlags == MAP_FLAG_INSTANCEABLE;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -1634,12 +1636,18 @@ struct ScalingStatValuesEntry
|
||||||
if (mask & 0x4001F)
|
if (mask & 0x4001F)
|
||||||
{
|
{
|
||||||
if(mask & 0x00000001) return ssdMultiplier[1];
|
if(mask & 0x00000001) return ssdMultiplier[1];
|
||||||
|
{
|
||||||
if(mask & 0x00000002) return ssdMultiplier[2]; // 0 and 1 were duplicated
|
if(mask & 0x00000002) return ssdMultiplier[2]; // 0 and 1 were duplicated
|
||||||
|
}
|
||||||
if(mask & 0x00000004) return ssdMultiplier[3];
|
if(mask & 0x00000004) return ssdMultiplier[3];
|
||||||
|
{
|
||||||
if(mask & 0x00000008) return ssdMultiplier[0];
|
if(mask & 0x00000008) return ssdMultiplier[0];
|
||||||
|
}
|
||||||
if(mask & 0x00000010) return ssdMultiplier[4];
|
if(mask & 0x00000010) return ssdMultiplier[4];
|
||||||
|
{
|
||||||
if(mask & 0x00040000) return ssdMultiplier[2]; // 4.0.0
|
if(mask & 0x00040000) return ssdMultiplier[2]; // 4.0.0
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1648,15 +1656,23 @@ struct ScalingStatValuesEntry
|
||||||
if (mask & 0x00F001E0)
|
if (mask & 0x00F001E0)
|
||||||
{
|
{
|
||||||
if (mask & 0x00000020) return armorMod[0];
|
if (mask & 0x00000020) return armorMod[0];
|
||||||
|
{
|
||||||
if (mask & 0x00000040) return armorMod[1];
|
if (mask & 0x00000040) return armorMod[1];
|
||||||
|
}
|
||||||
if (mask & 0x00000080) return armorMod[2];
|
if (mask & 0x00000080) return armorMod[2];
|
||||||
|
{
|
||||||
if (mask & 0x00000100) return armorMod[3];
|
if (mask & 0x00000100) return armorMod[3];
|
||||||
|
}
|
||||||
|
|
||||||
if (mask & 0x00100000) return armorMod2[0]; // cloth
|
if (mask & 0x00100000) return armorMod2[0]; // cloth
|
||||||
|
{
|
||||||
if (mask & 0x00200000) return armorMod2[1]; // leather
|
if (mask & 0x00200000) return armorMod2[1]; // leather
|
||||||
|
}
|
||||||
if (mask & 0x00400000) return armorMod2[2]; // mail
|
if (mask & 0x00400000) return armorMod2[2]; // mail
|
||||||
|
{
|
||||||
if (mask & 0x00800000) return armorMod2[3]; // plate
|
if (mask & 0x00800000) return armorMod2[3]; // plate
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1665,12 +1681,18 @@ struct ScalingStatValuesEntry
|
||||||
if (mask & 0x7E00)
|
if (mask & 0x7E00)
|
||||||
{
|
{
|
||||||
if (mask & 0x00000200) return dpsMod[0];
|
if (mask & 0x00000200) return dpsMod[0];
|
||||||
|
{
|
||||||
if (mask & 0x00000400) return dpsMod[1];
|
if (mask & 0x00000400) return dpsMod[1];
|
||||||
|
}
|
||||||
if (mask & 0x00000800) return dpsMod[2];
|
if (mask & 0x00000800) return dpsMod[2];
|
||||||
|
{
|
||||||
if (mask & 0x00001000) return dpsMod[3];
|
if (mask & 0x00001000) return dpsMod[3];
|
||||||
|
}
|
||||||
if (mask & 0x00002000) return dpsMod[4];
|
if (mask & 0x00002000) return dpsMod[4];
|
||||||
|
{
|
||||||
if (mask & 0x00004000) return dpsMod[5]; // not used?
|
if (mask & 0x00004000) return dpsMod[5]; // not used?
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,9 @@ WorldSession::~WorldSession()
|
||||||
///- empty incoming packet queue
|
///- empty incoming packet queue
|
||||||
WorldPacket* packet = NULL;
|
WorldPacket* packet = NULL;
|
||||||
while (_recvQueue.next(packet))
|
while (_recvQueue.next(packet))
|
||||||
{ delete packet; }
|
{
|
||||||
|
delete packet;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::SizeError(WorldPacket const& packet, uint32 size) const
|
void WorldSession::SizeError(WorldPacket const& packet, uint32 size) const
|
||||||
|
|
@ -168,10 +170,14 @@ void WorldSession::SendPacket(WorldPacket const* packet)
|
||||||
#ifdef ENABLE_PLAYERBOTS
|
#ifdef ENABLE_PLAYERBOTS
|
||||||
if (GetPlayer()) {
|
if (GetPlayer()) {
|
||||||
if (GetPlayer()->GetPlayerbotAI())
|
if (GetPlayer()->GetPlayerbotAI())
|
||||||
|
{
|
||||||
GetPlayer()->GetPlayerbotAI()->HandleBotOutgoingPacket(*packet);
|
GetPlayer()->GetPlayerbotAI()->HandleBotOutgoingPacket(*packet);
|
||||||
|
}
|
||||||
else if (GetPlayer()->GetPlayerbotMgr())
|
else if (GetPlayer()->GetPlayerbotMgr())
|
||||||
|
{
|
||||||
GetPlayer()->GetPlayerbotMgr()->HandleMasterOutgoingPacket(*packet);
|
GetPlayer()->GetPlayerbotMgr()->HandleMasterOutgoingPacket(*packet);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!m_Socket)
|
if (!m_Socket)
|
||||||
|
|
@ -290,7 +296,9 @@ bool WorldSession::Update(PacketFilter& updater)
|
||||||
|
|
||||||
#ifdef ENABLE_PLAYERBOTS
|
#ifdef ENABLE_PLAYERBOTS
|
||||||
if (_player && _player->GetPlayerbotMgr())
|
if (_player && _player->GetPlayerbotMgr())
|
||||||
|
{
|
||||||
_player->GetPlayerbotMgr()->HandleMasterIncomingPacket(*packet);
|
_player->GetPlayerbotMgr()->HandleMasterIncomingPacket(*packet);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case STATUS_LOGGEDIN_OR_RECENTLY_LOGGEDOUT:
|
case STATUS_LOGGEDIN_OR_RECENTLY_LOGGEDOUT:
|
||||||
|
|
@ -300,7 +308,9 @@ bool WorldSession::Update(PacketFilter& updater)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
// not expected _player or must checked in packet hanlder
|
// not expected _player or must checked in packet hanlder
|
||||||
{ ExecuteOpcode(opHandle, packet); }
|
{
|
||||||
|
ExecuteOpcode(opHandle, packet);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case STATUS_TRANSFER:
|
case STATUS_TRANSFER:
|
||||||
if (!_player)
|
if (!_player)
|
||||||
|
|
@ -327,7 +337,9 @@ bool WorldSession::Update(PacketFilter& updater)
|
||||||
// single from authed time opcodes send in to after logout time
|
// single from authed time opcodes send in to after logout time
|
||||||
// and before other STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT opcodes.
|
// and before other STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT opcodes.
|
||||||
if (packet->GetOpcode() != CMSG_SET_ACTIVE_VOICE_CHANNEL)
|
if (packet->GetOpcode() != CMSG_SET_ACTIVE_VOICE_CHANNEL)
|
||||||
|
{
|
||||||
m_playerRecentlyLogout = false;
|
m_playerRecentlyLogout = false;
|
||||||
|
}
|
||||||
|
|
||||||
ExecuteOpcode(opHandle, packet);
|
ExecuteOpcode(opHandle, packet);
|
||||||
break;
|
break;
|
||||||
|
|
@ -372,7 +384,9 @@ bool WorldSession::Update(PacketFilter& updater)
|
||||||
|
|
||||||
#ifdef ENABLE_PLAYERBOTS
|
#ifdef ENABLE_PLAYERBOTS
|
||||||
if (GetPlayer() && GetPlayer()->GetPlayerbotMgr())
|
if (GetPlayer() && GetPlayer()->GetPlayerbotMgr())
|
||||||
|
{
|
||||||
GetPlayer()->GetPlayerbotMgr()->UpdateSessions(0);
|
GetPlayer()->GetPlayerbotMgr()->UpdateSessions(0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
///- Cleanup socket pointer if need
|
///- Cleanup socket pointer if need
|
||||||
|
|
@ -401,7 +415,9 @@ bool WorldSession::Update(PacketFilter& updater)
|
||||||
// _warden->Update();
|
// _warden->Update();
|
||||||
|
|
||||||
if (!m_Socket)
|
if (!m_Socket)
|
||||||
{ return false; } // Will remove this session from the world session map
|
{
|
||||||
|
return false; // Will remove this session from the world session map
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -425,7 +441,9 @@ void WorldSession::LogoutPlayer(bool Save)
|
||||||
{
|
{
|
||||||
// finish pending transfers before starting the logout
|
// finish pending transfers before starting the logout
|
||||||
while (_player && _player->IsBeingTeleportedFar())
|
while (_player && _player->IsBeingTeleportedFar())
|
||||||
{ HandleMoveWorldportAckOpcode(); }
|
{
|
||||||
|
HandleMoveWorldportAckOpcode();
|
||||||
|
}
|
||||||
|
|
||||||
m_playerLogout = true;
|
m_playerLogout = true;
|
||||||
m_playerSave = Save;
|
m_playerSave = Save;
|
||||||
|
|
@ -434,7 +452,9 @@ void WorldSession::LogoutPlayer(bool Save)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_PLAYERBOTS
|
#ifdef ENABLE_PLAYERBOTS
|
||||||
if (GetPlayer()->GetPlayerbotMgr())
|
if (GetPlayer()->GetPlayerbotMgr())
|
||||||
|
{
|
||||||
GetPlayer()->GetPlayerbotMgr()->LogoutAllBots();
|
GetPlayer()->GetPlayerbotMgr()->LogoutAllBots();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sLog.outChar("Account: %d (IP: %s) Logout Character:[%s] (guid: %u)", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName() , _player->GetGUIDLow());
|
sLog.outChar("Account: %d (IP: %s) Logout Character:[%s] (guid: %u)", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName() , _player->GetGUIDLow());
|
||||||
|
|
@ -446,7 +466,9 @@ void WorldSession::LogoutPlayer(bool Save)
|
||||||
|
|
||||||
#ifdef ENABLE_PLAYERBOTS
|
#ifdef ENABLE_PLAYERBOTS
|
||||||
if (_player->GetPlayerbotMgr())
|
if (_player->GetPlayerbotMgr())
|
||||||
|
{
|
||||||
_player->GetPlayerbotMgr()->LogoutAllBots();
|
_player->GetPlayerbotMgr()->LogoutAllBots();
|
||||||
|
}
|
||||||
sRandomPlayerbotMgr.OnPlayerLogout(_player);
|
sRandomPlayerbotMgr.OnPlayerLogout(_player);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -527,7 +549,9 @@ void WorldSession::LogoutPlayer(bool Save)
|
||||||
// FG: finish pending transfers after starting the logout
|
// FG: finish pending transfers after starting the logout
|
||||||
// this should fix players beeing able to logout and login back with full hp at death position
|
// this should fix players beeing able to logout and login back with full hp at death position
|
||||||
while (_player->IsBeingTeleportedFar())
|
while (_player->IsBeingTeleportedFar())
|
||||||
{ HandleMoveWorldportAckOpcode(); }
|
{
|
||||||
|
HandleMoveWorldportAckOpcode();
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
for (int i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||||
{
|
{
|
||||||
|
|
@ -752,13 +776,17 @@ void WorldSession::SendSetPhaseShift(uint32 phaseMask, uint16 mapId)
|
||||||
|
|
||||||
data << uint32(phaseMask ? 2 : 0); // WRONG: number of Phase.dbc ids * 2
|
data << uint32(phaseMask ? 2 : 0); // WRONG: number of Phase.dbc ids * 2
|
||||||
if (phaseMask)
|
if (phaseMask)
|
||||||
|
{
|
||||||
data << uint16(phaseMask);
|
data << uint16(phaseMask);
|
||||||
|
}
|
||||||
|
|
||||||
data.WriteGuidBytes<3, 0>(guid);
|
data.WriteGuidBytes<3, 0>(guid);
|
||||||
|
|
||||||
data << uint32(mapId ? 2 : 0); // number of terrains swaps * 2
|
data << uint32(mapId ? 2 : 0); // number of terrains swaps * 2
|
||||||
if (mapId)
|
if (mapId)
|
||||||
|
{
|
||||||
data << uint16(mapId);
|
data << uint16(mapId);
|
||||||
|
}
|
||||||
|
|
||||||
data.WriteGuidBytes<5>(guid);
|
data.WriteGuidBytes<5>(guid);
|
||||||
SendPacket(&data);
|
SendPacket(&data);
|
||||||
|
|
@ -912,7 +940,9 @@ void WorldSession::SendAuthResponse(uint8 code, bool queued, uint32 queuePos)
|
||||||
packet << uint8(code);
|
packet << uint8(code);
|
||||||
packet.WriteBit(queued); // IsInQueue
|
packet.WriteBit(queued); // IsInQueue
|
||||||
if (queued)
|
if (queued)
|
||||||
|
{
|
||||||
packet.WriteBit(1); // unk
|
packet.WriteBit(1); // unk
|
||||||
|
}
|
||||||
|
|
||||||
packet.WriteBit(hasAccountData);
|
packet.WriteBit(hasAccountData);
|
||||||
|
|
||||||
|
|
@ -950,7 +980,9 @@ void WorldSession::SendAuthResponse(uint8 code, bool queued, uint32 queuePos)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (queued)
|
if (queued)
|
||||||
|
{
|
||||||
packet << uint32(queuePos);
|
packet << uint32(queuePos);
|
||||||
|
}
|
||||||
|
|
||||||
SendPacket(&packet);
|
SendPacket(&packet);
|
||||||
}
|
}
|
||||||
|
|
@ -967,7 +999,9 @@ void WorldSession::LoadAccountData(QueryResult* result, uint32 mask)
|
||||||
{
|
{
|
||||||
for (uint32 i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i)
|
for (uint32 i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i)
|
||||||
if (mask & (1 << i))
|
if (mask & (1 << i))
|
||||||
|
{
|
||||||
m_accountData[i] = AccountData();
|
m_accountData[i] = AccountData();
|
||||||
|
}
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -1053,7 +1087,9 @@ void WorldSession::SendAccountDataTimes(uint32 mask)
|
||||||
data.WriteBit(1);
|
data.WriteBit(1);
|
||||||
|
|
||||||
for (uint32 i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i)
|
for (uint32 i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i)
|
||||||
|
{
|
||||||
data << uint32(GetAccountData(AccountDataType(i))->Time);// also unix time
|
data << uint32(GetAccountData(AccountDataType(i))->Time);// also unix time
|
||||||
|
}
|
||||||
|
|
||||||
data << uint32(mask); // type mask
|
data << uint32(mask); // type mask
|
||||||
data << uint32(time(NULL)); // unix time of something
|
data << uint32(time(NULL)); // unix time of something
|
||||||
|
|
@ -1222,7 +1258,9 @@ void WorldSession::ReadAddonsInfo(ByteBuffer &data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
sLog.outError("Addon packet uncompress error!");
|
sLog.outError("Addon packet uncompress error!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::SendAddonsInfo()
|
void WorldSession::SendAddonsInfo()
|
||||||
|
|
@ -1261,7 +1299,9 @@ void WorldSession::SendAddonsInfo()
|
||||||
uint8 unk2 = (itr->CRC != 0x4c1c776d); // If addon is Standard addon CRC
|
uint8 unk2 = (itr->CRC != 0x4c1c776d); // If addon is Standard addon CRC
|
||||||
data << uint8(unk2); // if 1, than add addon public signature
|
data << uint8(unk2); // if 1, than add addon public signature
|
||||||
if (unk2) // if CRC is wrong, add public key (client need it)
|
if (unk2) // if CRC is wrong, add public key (client need it)
|
||||||
|
{
|
||||||
data.append(tdata, sizeof(tdata));
|
data.append(tdata, sizeof(tdata));
|
||||||
|
}
|
||||||
|
|
||||||
data << uint32(0);
|
data << uint32(0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -193,12 +193,16 @@ int WorldSocket::SendPacket(const WorldPacket& pct)
|
||||||
{
|
{
|
||||||
// Put the packet on the buffer.
|
// Put the packet on the buffer.
|
||||||
if (m_OutBuffer->copy((char*) header.header, header.getHeaderLength()) == -1)
|
if (m_OutBuffer->copy((char*) header.header, header.getHeaderLength()) == -1)
|
||||||
|
{
|
||||||
MANGOS_ASSERT(false);
|
MANGOS_ASSERT(false);
|
||||||
|
}
|
||||||
|
|
||||||
if (!pct.empty())
|
if (!pct.empty())
|
||||||
if (m_OutBuffer->copy((char*) pct.contents(), pct.size()) == -1)
|
if (m_OutBuffer->copy((char*) pct.contents(), pct.size()) == -1)
|
||||||
|
{
|
||||||
MANGOS_ASSERT(false);
|
MANGOS_ASSERT(false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Enqueue the packet.
|
// Enqueue the packet.
|
||||||
|
|
@ -209,7 +213,9 @@ int WorldSocket::SendPacket(const WorldPacket& pct)
|
||||||
mb->copy((char*) header.header, header.getHeaderLength());
|
mb->copy((char*) header.header, header.getHeaderLength());
|
||||||
|
|
||||||
if (!pct.empty())
|
if (!pct.empty())
|
||||||
|
{
|
||||||
mb->copy((const char*)pct.contents(), pct.size());
|
mb->copy((const char*)pct.contents(), pct.size());
|
||||||
|
}
|
||||||
|
|
||||||
if (msg_queue()->enqueue_tail(mb, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1)
|
if (msg_queue()->enqueue_tail(mb, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1)
|
||||||
{
|
{
|
||||||
|
|
@ -326,7 +332,9 @@ int WorldSocket::SendAuthChallenge()
|
||||||
packet << uint16(0);
|
packet << uint16(0);
|
||||||
|
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
|
{
|
||||||
packet << uint32(0);
|
packet << uint32(0);
|
||||||
|
}
|
||||||
|
|
||||||
packet << uint8(1);
|
packet << uint8(1);
|
||||||
packet << uint32(m_Seed);
|
packet << uint32(m_Seed);
|
||||||
|
|
@ -1050,8 +1058,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||||
std::string address = GetRemoteAddress();
|
std::string address = GetRemoteAddress();
|
||||||
|
|
||||||
DEBUG_LOG("WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.",
|
DEBUG_LOG("WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.",
|
||||||
accountName.c_str (),
|
account.c_str (), address.c_str());
|
||||||
address.c_str());
|
|
||||||
|
|
||||||
// Update the last_ip in the database
|
// Update the last_ip in the database
|
||||||
// No SQL injection, username escaped.
|
// No SQL injection, username escaped.
|
||||||
|
|
@ -1074,7 +1081,9 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||||
|
|
||||||
// Warden: Initialize Warden system only if it is enabled by config
|
// Warden: Initialize Warden system only if it is enabled by config
|
||||||
if (wardenActive)
|
if (wardenActive)
|
||||||
|
{
|
||||||
m_Session->InitWarden(uint16(BuiltNumberClient), &K, os);
|
m_Session->InitWarden(uint16(BuiltNumberClient), &K, os);
|
||||||
|
}
|
||||||
|
|
||||||
sWorld.AddSession(m_Session);
|
sWorld.AddSession(m_Session);
|
||||||
|
|
||||||
|
|
@ -1091,7 +1100,9 @@ int WorldSocket::HandlePing(WorldPacket& recvPacket)
|
||||||
recvPacket >> latency;
|
recvPacket >> latency;
|
||||||
|
|
||||||
if (m_LastPingTime == ACE_Time_Value::zero)
|
if (m_LastPingTime == ACE_Time_Value::zero)
|
||||||
{ m_LastPingTime = ACE_OS::gettimeofday(); } // for 1st ping
|
{
|
||||||
|
m_LastPingTime = ACE_OS::gettimeofday(); // for 1st ping
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ACE_Time_Value cur_time = ACE_OS::gettimeofday();
|
ACE_Time_Value cur_time = ACE_OS::gettimeofday();
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,9 @@ WorldSocketMgr::WorldSocketMgr()
|
||||||
WorldSocketMgr::~WorldSocketMgr()
|
WorldSocketMgr::~WorldSocketMgr()
|
||||||
{
|
{
|
||||||
if (reactor_) delete reactor_;
|
if (reactor_) delete reactor_;
|
||||||
|
{
|
||||||
if (acceptor_) delete acceptor_;
|
if (acceptor_) delete acceptor_;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -140,7 +142,9 @@ int WorldSocketMgr::StartNetwork(ACE_INET_Addr& addr)
|
||||||
void WorldSocketMgr::StopNetwork()
|
void WorldSocketMgr::StopNetwork()
|
||||||
{
|
{
|
||||||
if (acceptor_) acceptor_->close();
|
if (acceptor_) acceptor_->close();
|
||||||
|
{
|
||||||
if (reactor_) reactor_->end_reactor_event_loop();
|
if (reactor_) reactor_->end_reactor_event_loop();
|
||||||
|
}
|
||||||
wait();
|
wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,9 @@ void CharacterDatabaseCleaner::CleanDatabase()
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
if (flags & CLEANING_FLAG_ACHIEVEMENT_PROGRESS)
|
if (flags & CLEANING_FLAG_ACHIEVEMENT_PROGRESS)
|
||||||
|
{
|
||||||
CleanCharacterAchievementProgress();
|
CleanCharacterAchievementProgress();
|
||||||
|
}
|
||||||
if (flags & CLEANING_FLAG_SKILLS)
|
if (flags & CLEANING_FLAG_SKILLS)
|
||||||
{
|
{
|
||||||
CleanCharacterSkills();
|
CleanCharacterSkills();
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,9 @@ bool changenth(std::string& str, int n, const char* with, bool insert = false, b
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nonzero && str.substr(s, e - s) == "0")
|
if (nonzero && str.substr(s, e - s) == "0")
|
||||||
{ return true; } // not an error
|
{
|
||||||
|
return true; // not an error
|
||||||
|
}
|
||||||
if (!insert)
|
if (!insert)
|
||||||
{
|
{
|
||||||
str.replace(s, e - s, with);
|
str.replace(s, e - s, with);
|
||||||
|
|
@ -190,7 +192,9 @@ bool changetoknth(std::string& str, int n, const char* with, bool insert = false
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (nonzero && str.substr(s, e - s) == "0")
|
if (nonzero && str.substr(s, e - s) == "0")
|
||||||
{ return true; } // not an error
|
{
|
||||||
|
return true; // not an error
|
||||||
|
}
|
||||||
if (!insert)
|
if (!insert)
|
||||||
{
|
{
|
||||||
str.replace(s, e - s, with);
|
str.replace(s, e - s, with);
|
||||||
|
|
@ -221,7 +225,9 @@ bool changeGuid(std::string& str, int n, std::map<uint32, uint32>& guidMap, uint
|
||||||
char chritem[20];
|
char chritem[20];
|
||||||
uint32 oldGuid = atoi(getnth(str, n).c_str());
|
uint32 oldGuid = atoi(getnth(str, n).c_str());
|
||||||
if (nonzero && oldGuid == 0)
|
if (nonzero && oldGuid == 0)
|
||||||
{ return true; } // not an error
|
{
|
||||||
|
return true; // not an error
|
||||||
|
}
|
||||||
|
|
||||||
uint32 newGuid = registerNewGuid(oldGuid, guidMap, hiGuid);
|
uint32 newGuid = registerNewGuid(oldGuid, guidMap, hiGuid);
|
||||||
snprintf(chritem, 20, "%u", newGuid);
|
snprintf(chritem, 20, "%u", newGuid);
|
||||||
|
|
@ -234,7 +240,9 @@ bool changetokGuid(std::string& str, int n, std::map<uint32, uint32>& guidMap, u
|
||||||
char chritem[20];
|
char chritem[20];
|
||||||
uint32 oldGuid = atoi(gettoknth(str, n).c_str());
|
uint32 oldGuid = atoi(gettoknth(str, n).c_str());
|
||||||
if (nonzero && oldGuid == 0)
|
if (nonzero && oldGuid == 0)
|
||||||
{ return true; } // not an error
|
{
|
||||||
|
return true; // not an error
|
||||||
|
}
|
||||||
|
|
||||||
uint32 newGuid = registerNewGuid(oldGuid, guidMap, hiGuid);
|
uint32 newGuid = registerNewGuid(oldGuid, guidMap, hiGuid);
|
||||||
snprintf(chritem, 20, "%u", newGuid);
|
snprintf(chritem, 20, "%u", newGuid);
|
||||||
|
|
@ -348,7 +356,9 @@ void PlayerDumpWriter::DumpTableContent(std::string& dump, uint32 guid, char con
|
||||||
|
|
||||||
// for guid set stop if set is empty
|
// for guid set stop if set is empty
|
||||||
if (guids && guids->empty())
|
if (guids && guids->empty())
|
||||||
{ return; } // nothing to do
|
{
|
||||||
|
return; // nothing to do
|
||||||
|
}
|
||||||
|
|
||||||
// setup for guids case start position
|
// setup for guids case start position
|
||||||
GUIDs::const_iterator guids_itr;
|
GUIDs::const_iterator guids_itr;
|
||||||
|
|
@ -522,7 +532,9 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||||
|
|
||||||
// normalize the name if specified and check if it exists
|
// normalize the name if specified and check if it exists
|
||||||
if (!normalizePlayerName(name))
|
if (!normalizePlayerName(name))
|
||||||
|
{
|
||||||
name = "";
|
name = "";
|
||||||
|
}
|
||||||
|
|
||||||
if (ObjectMgr::CheckPlayerName(name, true) == CHAR_NAME_SUCCESS)
|
if (ObjectMgr::CheckPlayerName(name, true) == CHAR_NAME_SUCCESS)
|
||||||
{
|
{
|
||||||
|
|
@ -535,7 +547,9 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
name = "";
|
name = "";
|
||||||
|
}
|
||||||
|
|
||||||
// name encoded or empty
|
// name encoded or empty
|
||||||
|
|
||||||
|
|
@ -655,7 +669,9 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!changenth(line, 1, newguid)) // character_*.guid update
|
if (!changenth(line, 1, newguid)) // character_*.guid update
|
||||||
|
{
|
||||||
ROLLBACK(DUMP_FILE_BROKEN);
|
ROLLBACK(DUMP_FILE_BROKEN);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DTT_CHARACTER:
|
case DTT_CHARACTER:
|
||||||
|
|
@ -709,25 +725,35 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!changeGuid(line, 2, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed(), true))
|
if (!changeGuid(line, 2, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed(), true))
|
||||||
{ ROLLBACK(DUMP_FILE_BROKEN); } // character_inventory.bag update
|
{
|
||||||
|
ROLLBACK(DUMP_FILE_BROKEN); // character_inventory.bag update
|
||||||
|
}
|
||||||
if (!changeGuid(line, 4, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed()))
|
if (!changeGuid(line, 4, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed()))
|
||||||
{ ROLLBACK(DUMP_FILE_BROKEN); } // character_inventory.item update
|
{
|
||||||
|
ROLLBACK(DUMP_FILE_BROKEN); // character_inventory.item update
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DTT_ITEM:
|
case DTT_ITEM:
|
||||||
{
|
{
|
||||||
// item, owner, data field:item, owner guid
|
// item, owner, data field:item, owner guid
|
||||||
if (!changeGuid(line, 1, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed()))
|
if (!changeGuid(line, 1, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed()))
|
||||||
{ ROLLBACK(DUMP_FILE_BROKEN); } // item_instance.guid update
|
{
|
||||||
|
ROLLBACK(DUMP_FILE_BROKEN); // item_instance.guid update
|
||||||
|
}
|
||||||
if (!changenth(line, 2, newguid)) // item_instance.owner_guid update
|
if (!changenth(line, 2, newguid)) // item_instance.owner_guid update
|
||||||
{
|
{
|
||||||
ROLLBACK(DUMP_FILE_BROKEN);
|
ROLLBACK(DUMP_FILE_BROKEN);
|
||||||
}
|
}
|
||||||
std::string vals = getnth(line, 3); // item_instance.data get
|
std::string vals = getnth(line, 3); // item_instance.data get
|
||||||
if (!changetokGuid(vals, OBJECT_FIELD_GUID + 1, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed()))
|
if (!changetokGuid(vals, OBJECT_FIELD_GUID + 1, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed()))
|
||||||
{ ROLLBACK(DUMP_FILE_BROKEN); } // item_instance.data.OBJECT_FIELD_GUID update
|
{
|
||||||
|
ROLLBACK(DUMP_FILE_BROKEN); // item_instance.data.OBJECT_FIELD_GUID update
|
||||||
|
}
|
||||||
if (!changetoknth(vals, ITEM_FIELD_OWNER + 1, newguid))
|
if (!changetoknth(vals, ITEM_FIELD_OWNER + 1, newguid))
|
||||||
{ ROLLBACK(DUMP_FILE_BROKEN); } // item_instance.data.ITEM_FIELD_OWNER update
|
{
|
||||||
|
ROLLBACK(DUMP_FILE_BROKEN); // item_instance.data.ITEM_FIELD_OWNER update
|
||||||
|
}
|
||||||
if (!changenth(line, 3, vals.c_str())) // item_instance.data update
|
if (!changenth(line, 3, vals.c_str())) // item_instance.data update
|
||||||
{
|
{
|
||||||
ROLLBACK(DUMP_FILE_BROKEN);
|
ROLLBACK(DUMP_FILE_BROKEN);
|
||||||
|
|
@ -741,14 +767,18 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||||
ROLLBACK(DUMP_FILE_BROKEN);
|
ROLLBACK(DUMP_FILE_BROKEN);
|
||||||
}
|
}
|
||||||
if (!changeGuid(line, 2, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed()))
|
if (!changeGuid(line, 2, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed()))
|
||||||
{ ROLLBACK(DUMP_FILE_BROKEN); } // character_gifts.item_guid update
|
{
|
||||||
|
ROLLBACK(DUMP_FILE_BROKEN); // character_gifts.item_guid update
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DTT_ITEM_LOOT:
|
case DTT_ITEM_LOOT:
|
||||||
{
|
{
|
||||||
// item, owner
|
// item, owner
|
||||||
if (!changeGuid(line, 1, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed()))
|
if (!changeGuid(line, 1, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed()))
|
||||||
{ ROLLBACK(DUMP_FILE_BROKEN); } // item_loot.guid update
|
{
|
||||||
|
ROLLBACK(DUMP_FILE_BROKEN); // item_loot.guid update
|
||||||
|
}
|
||||||
if (!changenth(line, 2, newguid)) // item_Loot.owner_guid update
|
if (!changenth(line, 2, newguid)) // item_Loot.owner_guid update
|
||||||
{
|
{
|
||||||
ROLLBACK(DUMP_FILE_BROKEN);
|
ROLLBACK(DUMP_FILE_BROKEN);
|
||||||
|
|
@ -815,22 +845,30 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||||
// lookup currpetid and match to new inserted pet id
|
// lookup currpetid and match to new inserted pet id
|
||||||
std::map<uint32, uint32> :: const_iterator petids_iter = petids.find(atoi(currpetid));
|
std::map<uint32, uint32> :: const_iterator petids_iter = petids.find(atoi(currpetid));
|
||||||
if (petids_iter == petids.end()) // couldn't find new inserted id
|
if (petids_iter == petids.end()) // couldn't find new inserted id
|
||||||
|
{
|
||||||
ROLLBACK(DUMP_FILE_BROKEN);
|
ROLLBACK(DUMP_FILE_BROKEN);
|
||||||
|
}
|
||||||
|
|
||||||
snprintf(newpetid, 20, "%d", petids_iter->second);
|
snprintf(newpetid, 20, "%d", petids_iter->second);
|
||||||
|
|
||||||
if (!changenth(line, 1, newpetid)) // character_pet_declinedname.id
|
if (!changenth(line, 1, newpetid)) // character_pet_declinedname.id
|
||||||
|
{
|
||||||
ROLLBACK(DUMP_FILE_BROKEN);
|
ROLLBACK(DUMP_FILE_BROKEN);
|
||||||
|
}
|
||||||
|
|
||||||
if (!changenth(line, 2, newguid)) // character_pet_declinedname.owner update
|
if (!changenth(line, 2, newguid)) // character_pet_declinedname.owner update
|
||||||
|
{
|
||||||
ROLLBACK(DUMP_FILE_BROKEN);
|
ROLLBACK(DUMP_FILE_BROKEN);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DTT_MAIL: // mail
|
case DTT_MAIL: // mail
|
||||||
{
|
{
|
||||||
if (!changeGuid(line, 1, mails, sObjectMgr.m_MailIds.GetNextAfterMaxUsed()))
|
if (!changeGuid(line, 1, mails, sObjectMgr.m_MailIds.GetNextAfterMaxUsed()))
|
||||||
{ ROLLBACK(DUMP_FILE_BROKEN); } // mail.id update
|
{
|
||||||
|
ROLLBACK(DUMP_FILE_BROKEN); // mail.id update
|
||||||
|
}
|
||||||
if (!changenth(line, 6, newguid)) // mail.receiver update
|
if (!changenth(line, 6, newguid)) // mail.receiver update
|
||||||
{
|
{
|
||||||
ROLLBACK(DUMP_FILE_BROKEN);
|
ROLLBACK(DUMP_FILE_BROKEN);
|
||||||
|
|
@ -840,9 +878,13 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||||
case DTT_MAIL_ITEM: // mail_items
|
case DTT_MAIL_ITEM: // mail_items
|
||||||
{
|
{
|
||||||
if (!changeGuid(line, 1, mails, sObjectMgr.m_MailIds.GetNextAfterMaxUsed()))
|
if (!changeGuid(line, 1, mails, sObjectMgr.m_MailIds.GetNextAfterMaxUsed()))
|
||||||
{ ROLLBACK(DUMP_FILE_BROKEN); } // mail_items.id
|
{
|
||||||
|
ROLLBACK(DUMP_FILE_BROKEN); // mail_items.id
|
||||||
|
}
|
||||||
if (!changeGuid(line, 2, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed()))
|
if (!changeGuid(line, 2, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed()))
|
||||||
{ ROLLBACK(DUMP_FILE_BROKEN); } // mail_items.item_guid
|
{
|
||||||
|
ROLLBACK(DUMP_FILE_BROKEN); // mail_items.item_guid
|
||||||
|
}
|
||||||
if (!changenth(line, 4, newguid)) // mail_items.receiver
|
if (!changenth(line, 4, newguid)) // mail_items.receiver
|
||||||
{
|
{
|
||||||
ROLLBACK(DUMP_FILE_BROKEN);
|
ROLLBACK(DUMP_FILE_BROKEN);
|
||||||
|
|
@ -852,12 +894,18 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||||
case DTT_EQSET_TABLE:
|
case DTT_EQSET_TABLE:
|
||||||
{
|
{
|
||||||
if (!changenth(line, 1, newguid)) // character_equipmentsets.guid update
|
if (!changenth(line, 1, newguid)) // character_equipmentsets.guid update
|
||||||
|
{
|
||||||
ROLLBACK(DUMP_FILE_BROKEN);
|
ROLLBACK(DUMP_FILE_BROKEN);
|
||||||
|
}
|
||||||
if (!changeGuid(line, 2, eqsets, sObjectMgr.m_EquipmentSetIds.GetNextAfterMaxUsed()))
|
if (!changeGuid(line, 2, eqsets, sObjectMgr.m_EquipmentSetIds.GetNextAfterMaxUsed()))
|
||||||
|
{
|
||||||
ROLLBACK(DUMP_FILE_BROKEN); // character_equipmentsets.setguid
|
ROLLBACK(DUMP_FILE_BROKEN); // character_equipmentsets.setguid
|
||||||
|
}
|
||||||
for (int i = 0; i < 19; ++i) // character_equipmentsets.item0..item18
|
for (int i = 0; i < 19; ++i) // character_equipmentsets.item0..item18
|
||||||
if (!changeGuid(line, 6 + i, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed()))
|
if (!changeGuid(line, 6 + i, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed()))
|
||||||
|
{
|
||||||
ROLLBACK(DUMP_FILE_BROKEN);
|
ROLLBACK(DUMP_FILE_BROKEN);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -259,9 +259,13 @@ std::string Warden::Penalty(WardenCheck* check /*= NULL*/)
|
||||||
WardenActions action;
|
WardenActions action;
|
||||||
|
|
||||||
if (check)
|
if (check)
|
||||||
|
{
|
||||||
action = check->Action;
|
action = check->Action;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
action = WardenActions(sWorld.getConfig(CONFIG_UINT32_WARDEN_CLIENT_FAIL_ACTION));
|
action = WardenActions(sWorld.getConfig(CONFIG_UINT32_WARDEN_CLIENT_FAIL_ACTION));
|
||||||
|
}
|
||||||
|
|
||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
|
|
@ -281,7 +285,9 @@ std::string Warden::Penalty(WardenCheck* check /*= NULL*/)
|
||||||
banReason << "Warden Anticheat Violation";
|
banReason << "Warden Anticheat Violation";
|
||||||
// Check can be NULL, for example if the client sent a wrong signature in the warden packet (CHECKSUM FAIL)
|
// Check can be NULL, for example if the client sent a wrong signature in the warden packet (CHECKSUM FAIL)
|
||||||
if (check)
|
if (check)
|
||||||
|
{
|
||||||
banReason << ": " << (check->Comment.empty() ? std::string("Undocumented Check") : check->Comment) << " (CheckId: " << check->CheckId << ")";
|
banReason << ": " << (check->Comment.empty() ? std::string("Undocumented Check") : check->Comment) << " (CheckId: " << check->CheckId << ")";
|
||||||
|
}
|
||||||
|
|
||||||
sWorld.BanAccount(BAN_ACCOUNT, accountName, sWorld.getConfig(CONFIG_UINT32_WARDEN_CLIENT_BAN_DURATION), banReason.str(), "Warden");
|
sWorld.BanAccount(BAN_ACCOUNT, accountName, sWorld.getConfig(CONFIG_UINT32_WARDEN_CLIENT_BAN_DURATION), banReason.str(), "Warden");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,10 +37,14 @@ WardenCheckMgr::WardenCheckMgr() : m_lock(0), CheckStore(), CheckResultStore() {
|
||||||
WardenCheckMgr::~WardenCheckMgr()
|
WardenCheckMgr::~WardenCheckMgr()
|
||||||
{
|
{
|
||||||
for (CheckMap::iterator it = CheckStore.begin(); it != CheckStore.end(); ++it)
|
for (CheckMap::iterator it = CheckStore.begin(); it != CheckStore.end(); ++it)
|
||||||
|
{
|
||||||
delete it->second;
|
delete it->second;
|
||||||
|
}
|
||||||
|
|
||||||
for (CheckResultMap::iterator it = CheckResultStore.begin(); it != CheckResultStore.end(); ++it)
|
for (CheckResultMap::iterator it = CheckResultStore.begin(); it != CheckResultStore.end(); ++it)
|
||||||
|
{
|
||||||
delete it->second;
|
delete it->second;
|
||||||
|
}
|
||||||
|
|
||||||
CheckStore.clear();
|
CheckStore.clear();
|
||||||
CheckResultStore.clear();
|
CheckResultStore.clear();
|
||||||
|
|
@ -110,7 +114,9 @@ void WardenCheckMgr::LoadWardenChecks()
|
||||||
|
|
||||||
// PROC_CHECK support missing
|
// PROC_CHECK support missing
|
||||||
if (checkType == MEM_CHECK || checkType == MPQ_CHECK || checkType == LUA_STR_CHECK || checkType == DRIVER_CHECK || checkType == MODULE_CHECK)
|
if (checkType == MEM_CHECK || checkType == MPQ_CHECK || checkType == LUA_STR_CHECK || checkType == DRIVER_CHECK || checkType == MODULE_CHECK)
|
||||||
|
{
|
||||||
wardenCheck->Str = str;
|
wardenCheck->Str = str;
|
||||||
|
}
|
||||||
|
|
||||||
CheckStore.insert(std::pair<uint16, WardenCheck*>(build, wardenCheck));
|
CheckStore.insert(std::pair<uint16, WardenCheck*>(build, wardenCheck));
|
||||||
|
|
||||||
|
|
@ -133,9 +139,13 @@ void WardenCheckMgr::LoadWardenChecks()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (comment.empty())
|
if (comment.empty())
|
||||||
|
{
|
||||||
wardenCheck->Comment = "";
|
wardenCheck->Comment = "";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
wardenCheck->Comment = comment;
|
wardenCheck->Comment = comment;
|
||||||
|
}
|
||||||
|
|
||||||
++count;
|
++count;
|
||||||
} while (result->NextRow());
|
} while (result->NextRow());
|
||||||
|
|
@ -176,7 +186,9 @@ void WardenCheckMgr::LoadWardenOverrides()
|
||||||
|
|
||||||
// Check if action value is in range (0-2, see WardenActions enum)
|
// Check if action value is in range (0-2, see WardenActions enum)
|
||||||
if (action > WARDEN_ACTION_BAN)
|
if (action > WARDEN_ACTION_BAN)
|
||||||
|
{
|
||||||
sLog.outWarden("Warden check override action out of range (ID: %u, action: %u)", checkId, action);
|
sLog.outWarden("Warden check override action out of range (ID: %u, action: %u)", checkId, action);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
@ -206,8 +218,10 @@ WardenCheck* WardenCheckMgr::GetWardenDataById(uint16 build, uint16 id)
|
||||||
for (CheckMap::iterator it = CheckStore.lower_bound(build); it != CheckStore.upper_bound(build); ++it)
|
for (CheckMap::iterator it = CheckStore.lower_bound(build); it != CheckStore.upper_bound(build); ++it)
|
||||||
{
|
{
|
||||||
if (it->second->CheckId == id)
|
if (it->second->CheckId == id)
|
||||||
|
{
|
||||||
result = it->second;
|
result = it->second;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -220,8 +234,10 @@ WardenCheckResult* WardenCheckMgr::GetWardenResultById(uint16 build, uint16 id)
|
||||||
for (CheckResultMap::iterator it = CheckResultStore.lower_bound(build); it != CheckResultStore.upper_bound(build); ++it)
|
for (CheckResultMap::iterator it = CheckResultStore.lower_bound(build); it != CheckResultStore.upper_bound(build); ++it)
|
||||||
{
|
{
|
||||||
if (it->second->Id == id)
|
if (it->second->Id == id)
|
||||||
|
{
|
||||||
result = it->second;
|
result = it->second;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -236,9 +252,13 @@ void WardenCheckMgr::GetWardenCheckIds(bool isMemCheck, uint16 build, std::list<
|
||||||
if (isMemCheck)
|
if (isMemCheck)
|
||||||
{
|
{
|
||||||
if ((it->second->Type == MEM_CHECK) || (it->second->Type == MODULE_CHECK))
|
if ((it->second->Type == MEM_CHECK) || (it->second->Type == MODULE_CHECK))
|
||||||
|
{
|
||||||
idl.push_back(it->second->CheckId);
|
idl.push_back(it->second->CheckId);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
idl.push_back(it->second->CheckId);
|
idl.push_back(it->second->CheckId);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -156,7 +156,9 @@ void WardenMac::HandleHashResult(ByteBuffer &buff)
|
||||||
{
|
{
|
||||||
sLog.outWarden("%s failed hash reply. Action: %s", _session->GetPlayerName(), Penalty().c_str());
|
sLog.outWarden("%s failed hash reply. Action: %s", _session->GetPlayerName(), Penalty().c_str());
|
||||||
if (sWorld.getConfig(CONFIG_UINT32_WARDEN_CLIENT_FAIL_ACTION) > uint32(WARDEN_ACTION_LOG))
|
if (sWorld.getConfig(CONFIG_UINT32_WARDEN_CLIENT_FAIL_ACTION) > uint32(WARDEN_ACTION_LOG))
|
||||||
|
{
|
||||||
_session->KickPlayer();
|
_session->KickPlayer();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -254,9 +256,13 @@ void WardenMac::HandleData(ByteBuffer &buff)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (found && sWorld.getConfig(CONFIG_UINT32_WARDEN_CLIENT_FAIL_ACTION) > uint32(WARDEN_ACTION_LOG))
|
if (found && sWorld.getConfig(CONFIG_UINT32_WARDEN_CLIENT_FAIL_ACTION) > uint32(WARDEN_ACTION_LOG))
|
||||||
|
{
|
||||||
_session->KickPlayer();
|
_session->KickPlayer();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
sLog.outWarden("SHA1 and MD5 hash verified. Handle data passed.");
|
sLog.outWarden("SHA1 and MD5 hash verified. Handle data passed.");
|
||||||
|
}
|
||||||
|
|
||||||
Warden::HandleData(buff);
|
Warden::HandleData(buff);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -170,10 +170,14 @@ void WardenWin::RequestData()
|
||||||
|
|
||||||
// If all checks were done, fill the todo list again
|
// If all checks were done, fill the todo list again
|
||||||
if (_memChecksTodo.empty())
|
if (_memChecksTodo.empty())
|
||||||
|
{
|
||||||
sWardenCheckMgr->GetWardenCheckIds(true, build, _memChecksTodo);
|
sWardenCheckMgr->GetWardenCheckIds(true, build, _memChecksTodo);
|
||||||
|
}
|
||||||
|
|
||||||
if (_otherChecksTodo.empty())
|
if (_otherChecksTodo.empty())
|
||||||
|
{
|
||||||
sWardenCheckMgr->GetWardenCheckIds(false, build, _otherChecksTodo);
|
sWardenCheckMgr->GetWardenCheckIds(false, build, _otherChecksTodo);
|
||||||
|
}
|
||||||
|
|
||||||
_serverTicks = WorldTimer::getMSTime();
|
_serverTicks = WorldTimer::getMSTime();
|
||||||
|
|
||||||
|
|
@ -184,7 +188,9 @@ void WardenWin::RequestData()
|
||||||
{
|
{
|
||||||
// If todo list is done break loop (will be filled on next Update() run)
|
// If todo list is done break loop (will be filled on next Update() run)
|
||||||
if (_memChecksTodo.empty())
|
if (_memChecksTodo.empty())
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Get check id from the end and remove it from todo
|
// Get check id from the end and remove it from todo
|
||||||
id = _memChecksTodo.back();
|
id = _memChecksTodo.back();
|
||||||
|
|
@ -201,7 +207,9 @@ void WardenWin::RequestData()
|
||||||
{
|
{
|
||||||
// If todo list is done break loop (will be filled on next Update() run)
|
// If todo list is done break loop (will be filled on next Update() run)
|
||||||
if (_otherChecksTodo.empty())
|
if (_otherChecksTodo.empty())
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Get check id from the end and remove it from todo
|
// Get check id from the end and remove it from todo
|
||||||
id = _otherChecksTodo.back();
|
id = _otherChecksTodo.back();
|
||||||
|
|
@ -400,11 +408,17 @@ void WardenWin::HandleData(ByteBuffer &buff)
|
||||||
if (memcmp(buff.contents() + buff.rpos(), &byte, sizeof(uint8)) != 0)
|
if (memcmp(buff.contents() + buff.rpos(), &byte, sizeof(uint8)) != 0)
|
||||||
{
|
{
|
||||||
if (type == PAGE_CHECK_A || type == PAGE_CHECK_B)
|
if (type == PAGE_CHECK_A || type == PAGE_CHECK_B)
|
||||||
|
{
|
||||||
sLog.outWarden("RESULT PAGE_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId());
|
sLog.outWarden("RESULT PAGE_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||||
|
}
|
||||||
if (type == MODULE_CHECK)
|
if (type == MODULE_CHECK)
|
||||||
|
{
|
||||||
sLog.outWarden("RESULT MODULE_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId());
|
sLog.outWarden("RESULT MODULE_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||||
|
}
|
||||||
if (type == DRIVER_CHECK)
|
if (type == DRIVER_CHECK)
|
||||||
|
{
|
||||||
sLog.outWarden("RESULT DRIVER_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId());
|
sLog.outWarden("RESULT DRIVER_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||||
|
}
|
||||||
checkFailed = *itr;
|
checkFailed = *itr;
|
||||||
buff.rpos(buff.rpos() + 1);
|
buff.rpos(buff.rpos() + 1);
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -412,11 +426,17 @@ void WardenWin::HandleData(ByteBuffer &buff)
|
||||||
|
|
||||||
buff.rpos(buff.rpos() + 1);
|
buff.rpos(buff.rpos() + 1);
|
||||||
if (type == PAGE_CHECK_A || type == PAGE_CHECK_B)
|
if (type == PAGE_CHECK_A || type == PAGE_CHECK_B)
|
||||||
|
{
|
||||||
sLog.outWarden("RESULT PAGE_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId());
|
sLog.outWarden("RESULT PAGE_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||||
|
}
|
||||||
else if (type == MODULE_CHECK)
|
else if (type == MODULE_CHECK)
|
||||||
|
{
|
||||||
sLog.outWarden("RESULT MODULE_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId());
|
sLog.outWarden("RESULT MODULE_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||||
|
}
|
||||||
else if (type == DRIVER_CHECK)
|
else if (type == DRIVER_CHECK)
|
||||||
|
{
|
||||||
sLog.outWarden("RESULT DRIVER_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId());
|
sLog.outWarden("RESULT DRIVER_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LUA_STR_CHECK:
|
case LUA_STR_CHECK:
|
||||||
|
|
|
||||||
|
|
@ -44,18 +44,24 @@ AccountMgr::~AccountMgr()
|
||||||
AccountOpResult AccountMgr::CreateAccount(std::string username, std::string password)
|
AccountOpResult AccountMgr::CreateAccount(std::string username, std::string password)
|
||||||
{
|
{
|
||||||
if (utf8length(username) > MAX_ACCOUNT_STR)
|
if (utf8length(username) > MAX_ACCOUNT_STR)
|
||||||
{ return AOR_NAME_TOO_LONG; } // username's too long
|
{
|
||||||
|
return AOR_NAME_TOO_LONG; // username's too long
|
||||||
|
}
|
||||||
|
|
||||||
normalizeString(username);
|
normalizeString(username);
|
||||||
normalizeString(password);
|
normalizeString(password);
|
||||||
|
|
||||||
if (GetId(username))
|
if (GetId(username))
|
||||||
{
|
{
|
||||||
{ return AOR_NAME_ALREADY_EXIST; } // username does already exist
|
{
|
||||||
|
return AOR_NAME_ALREADY_EXIST; // username does already exist
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!LoginDatabase.PExecute("INSERT INTO `account` (`username`,`sha_pass_hash`,`joindate`) VALUES ('%s','%s',NOW())", username.c_str(), CalculateShaPassHash(username, password).c_str()))
|
if (!LoginDatabase.PExecute("INSERT INTO `account` (`username`,`sha_pass_hash`,`joindate`) VALUES ('%s','%s',NOW())", username.c_str(), CalculateShaPassHash(username, password).c_str()))
|
||||||
{ return AOR_DB_INTERNAL_ERROR; } // unexpected error
|
{
|
||||||
|
return AOR_DB_INTERNAL_ERROR; // unexpected error
|
||||||
|
}
|
||||||
LoginDatabase.Execute("INSERT INTO `realmcharacters` (`realmid`, `acctid`, `numchars`) SELECT `realmlist`.`id`, `account`.`id`, 0 FROM `realmlist`,`account` LEFT JOIN `realmcharacters` ON `acctid`=`account`.`id` WHERE `acctid` IS NULL");
|
LoginDatabase.Execute("INSERT INTO `realmcharacters` (`realmid`, `acctid`, `numchars`) SELECT `realmlist`.`id`, `account`.`id`, 0 FROM `realmlist`,`account` LEFT JOIN `realmcharacters` ON `acctid`=`account`.`id` WHERE `acctid` IS NULL");
|
||||||
|
|
||||||
return AOR_OK; // everything's fine
|
return AOR_OK; // everything's fine
|
||||||
|
|
@ -64,7 +70,9 @@ AccountOpResult AccountMgr::CreateAccount(std::string username, std::string pass
|
||||||
AccountOpResult AccountMgr::CreateAccount(std::string username, std::string password, uint32 expansion)
|
AccountOpResult AccountMgr::CreateAccount(std::string username, std::string password, uint32 expansion)
|
||||||
{
|
{
|
||||||
if (utf8length(username) > MAX_ACCOUNT_STR)
|
if (utf8length(username) > MAX_ACCOUNT_STR)
|
||||||
|
{
|
||||||
return AOR_NAME_TOO_LONG; // username's too long
|
return AOR_NAME_TOO_LONG; // username's too long
|
||||||
|
}
|
||||||
|
|
||||||
normalizeString(username);
|
normalizeString(username);
|
||||||
normalizeString(password);
|
normalizeString(password);
|
||||||
|
|
@ -75,7 +83,9 @@ AccountOpResult AccountMgr::CreateAccount(std::string username, std::string pass
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!LoginDatabase.PExecute("INSERT INTO `account`(`username`,`sha_pass_hash`,`joindate`,`expansion`) VALUES('%s','%s',NOW(),'%u')", username.c_str(), CalculateShaPassHash(username, password).c_str(), expansion))
|
if (!LoginDatabase.PExecute("INSERT INTO `account`(`username`,`sha_pass_hash`,`joindate`,`expansion`) VALUES('%s','%s',NOW(),'%u')", username.c_str(), CalculateShaPassHash(username, password).c_str(), expansion))
|
||||||
|
{
|
||||||
return AOR_DB_INTERNAL_ERROR; // unexpected error
|
return AOR_DB_INTERNAL_ERROR; // unexpected error
|
||||||
|
}
|
||||||
LoginDatabase.Execute("INSERT INTO `realmcharacters` (`realmid`, `acctid`, `numchars`) SELECT `realmlist`.`id`, `account`.`id`, 0 FROM `realmlist`,`account` LEFT JOIN `realmcharacters` ON `acctid`=`account`.`id` WHERE `acctid` IS NULL");
|
LoginDatabase.Execute("INSERT INTO `realmcharacters` (`realmid`, `acctid`, `numchars`) SELECT `realmlist`.`id`, `account`.`id`, 0 FROM `realmlist`,`account` LEFT JOIN `realmcharacters` ON `acctid`=`account`.`id` WHERE `acctid` IS NULL");
|
||||||
|
|
||||||
return AOR_OK; // everything's fine
|
return AOR_OK; // everything's fine
|
||||||
|
|
@ -85,7 +95,9 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accid)
|
||||||
{
|
{
|
||||||
QueryResult* result = LoginDatabase.PQuery("SELECT 1 FROM `account` WHERE `id`='%u'", accid);
|
QueryResult* result = LoginDatabase.PQuery("SELECT 1 FROM `account` WHERE `id`='%u'", accid);
|
||||||
if (!result)
|
if (!result)
|
||||||
{ return AOR_NAME_NOT_EXIST; } // account doesn't exist
|
{
|
||||||
|
return AOR_NAME_NOT_EXIST; // account doesn't exist
|
||||||
|
}
|
||||||
delete result;
|
delete result;
|
||||||
|
|
||||||
// existing characters list
|
// existing characters list
|
||||||
|
|
@ -119,7 +131,9 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accid)
|
||||||
LoginDatabase.CommitTransaction();
|
LoginDatabase.CommitTransaction();
|
||||||
|
|
||||||
if (!res)
|
if (!res)
|
||||||
{ return AOR_DB_INTERNAL_ERROR; } // unexpected error;
|
{
|
||||||
|
return AOR_DB_INTERNAL_ERROR; // unexpected error;
|
||||||
|
}
|
||||||
|
|
||||||
return AOR_OK;
|
return AOR_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -128,7 +142,9 @@ AccountOpResult AccountMgr::ChangeUsername(uint32 accid, std::string new_uname,
|
||||||
{
|
{
|
||||||
QueryResult* result = LoginDatabase.PQuery("SELECT 1 FROM `account` WHERE `id`='%u'", accid);
|
QueryResult* result = LoginDatabase.PQuery("SELECT 1 FROM `account` WHERE `id`='%u'", accid);
|
||||||
if (!result)
|
if (!result)
|
||||||
{ return AOR_NAME_NOT_EXIST; } // account doesn't exist
|
{
|
||||||
|
return AOR_NAME_NOT_EXIST; // account doesn't exist
|
||||||
|
}
|
||||||
delete result;
|
delete result;
|
||||||
|
|
||||||
if (utf8length(new_uname) > MAX_ACCOUNT_STR)
|
if (utf8length(new_uname) > MAX_ACCOUNT_STR)
|
||||||
|
|
@ -149,7 +165,9 @@ AccountOpResult AccountMgr::ChangeUsername(uint32 accid, std::string new_uname,
|
||||||
|
|
||||||
if (!LoginDatabase.PExecute("UPDATE `account` SET `v`='0',`s`='0',`username`='%s',`sha_pass_hash`='%s' WHERE `id`='%u'", safe_new_uname.c_str(),
|
if (!LoginDatabase.PExecute("UPDATE `account` SET `v`='0',`s`='0',`username`='%s',`sha_pass_hash`='%s' WHERE `id`='%u'", safe_new_uname.c_str(),
|
||||||
CalculateShaPassHash(new_uname, new_passwd).c_str(), accid))
|
CalculateShaPassHash(new_uname, new_passwd).c_str(), accid))
|
||||||
{ return AOR_DB_INTERNAL_ERROR; } // unexpected error
|
{
|
||||||
|
return AOR_DB_INTERNAL_ERROR; // unexpected error
|
||||||
|
}
|
||||||
|
|
||||||
return AOR_OK;
|
return AOR_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -159,7 +177,9 @@ AccountOpResult AccountMgr::ChangePassword(uint32 accid, std::string new_passwd)
|
||||||
std::string username;
|
std::string username;
|
||||||
|
|
||||||
if (!GetName(accid, username))
|
if (!GetName(accid, username))
|
||||||
{ return AOR_NAME_NOT_EXIST; } // account doesn't exist
|
{
|
||||||
|
return AOR_NAME_NOT_EXIST; // account doesn't exist
|
||||||
|
}
|
||||||
|
|
||||||
if (utf8length(new_passwd) > MAX_ACCOUNT_STR)
|
if (utf8length(new_passwd) > MAX_ACCOUNT_STR)
|
||||||
{
|
{
|
||||||
|
|
@ -171,7 +191,9 @@ AccountOpResult AccountMgr::ChangePassword(uint32 accid, std::string new_passwd)
|
||||||
// also reset s and v to force update at next realmd login
|
// also reset s and v to force update at next realmd login
|
||||||
if (!LoginDatabase.PExecute("UPDATE `account` SET `v`='0', `s`='0', `sha_pass_hash`='%s' WHERE `id`='%u'",
|
if (!LoginDatabase.PExecute("UPDATE `account` SET `v`='0', `s`='0', `sha_pass_hash`='%s' WHERE `id`='%u'",
|
||||||
CalculateShaPassHash(username, new_passwd).c_str(), accid))
|
CalculateShaPassHash(username, new_passwd).c_str(), accid))
|
||||||
{ return AOR_DB_INTERNAL_ERROR; } // unexpected error
|
{
|
||||||
|
return AOR_DB_INTERNAL_ERROR; // unexpected error
|
||||||
|
}
|
||||||
|
|
||||||
return AOR_OK;
|
return AOR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -60,9 +60,11 @@ void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket& recv_data)
|
||||||
if (uint32 a_id = player->GetArenaTeamId(i))
|
if (uint32 a_id = player->GetArenaTeamId(i))
|
||||||
{
|
{
|
||||||
if (ArenaTeam* arenaTeam = sObjectMgr.GetArenaTeamById(a_id))
|
if (ArenaTeam* arenaTeam = sObjectMgr.GetArenaTeamById(a_id))
|
||||||
|
{
|
||||||
arenaTeam->InspectStats(this, player->GetObjectGuid());
|
arenaTeam->InspectStats(this, player->GetObjectGuid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleArenaTeamQueryOpcode(WorldPacket& recv_data)
|
void WorldSession::HandleArenaTeamQueryOpcode(WorldPacket& recv_data)
|
||||||
|
|
@ -87,7 +89,9 @@ void WorldSession::HandleArenaTeamRosterOpcode(WorldPacket& recv_data)
|
||||||
recv_data >> ArenaTeamId;
|
recv_data >> ArenaTeamId;
|
||||||
|
|
||||||
if (ArenaTeam* arenateam = sObjectMgr.GetArenaTeamById(ArenaTeamId))
|
if (ArenaTeam* arenateam = sObjectMgr.GetArenaTeamById(ArenaTeamId))
|
||||||
|
{
|
||||||
arenateam->Roster(this);
|
arenateam->Roster(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleArenaTeamCreateOpcode(WorldPacket& recv_data)
|
void WorldSession::HandleArenaTeamCreateOpcode(WorldPacket& recv_data)
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,9 @@ void WorldSession::SendAuctionCommandResult(AuctionEntry* auc, AuctionAction Act
|
||||||
{
|
{
|
||||||
case AUCTION_OK:
|
case AUCTION_OK:
|
||||||
if (Action == AUCTION_BID_PLACED)
|
if (Action == AUCTION_BID_PLACED)
|
||||||
|
{
|
||||||
data << uint64(auc->GetAuctionOutBid()); // new AuctionOutBid?
|
data << uint64(auc->GetAuctionOutBid()); // new AuctionOutBid?
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case AUCTION_ERR_INVENTORY:
|
case AUCTION_ERR_INVENTORY:
|
||||||
data << uint32(invError);
|
data << uint32(invError);
|
||||||
|
|
@ -126,7 +128,9 @@ void WorldSession::SendAuctionOwnerNotification(AuctionEntry* auction)
|
||||||
|
|
||||||
ObjectGuid bidder_guid = ObjectGuid();
|
ObjectGuid bidder_guid = ObjectGuid();
|
||||||
if (!auction->moneyDeliveryTime) // not sold yet
|
if (!auction->moneyDeliveryTime) // not sold yet
|
||||||
|
{
|
||||||
bidder_guid = ObjectGuid(HIGHGUID_PLAYER, auction->bidder);
|
bidder_guid = ObjectGuid(HIGHGUID_PLAYER, auction->bidder);
|
||||||
|
}
|
||||||
|
|
||||||
// bidder==0 and moneyDeliveryTime==0 for expired auctions, and client shows error messages as described above
|
// bidder==0 and moneyDeliveryTime==0 for expired auctions, and client shows error messages as described above
|
||||||
// if bidder!=0 client updates auctions with new bid, outbid and bidderGuid
|
// if bidder!=0 client updates auctions with new bid, outbid and bidderGuid
|
||||||
|
|
@ -160,7 +164,9 @@ void WorldSession::SendAuctionOutbiddedMail(AuctionEntry* auction)
|
||||||
|
|
||||||
uint32 oldBidder_accId = 0;
|
uint32 oldBidder_accId = 0;
|
||||||
if (!oldBidder)
|
if (!oldBidder)
|
||||||
|
{
|
||||||
oldBidder_accId = sObjectMgr.GetPlayerAccountIdByGUID(oldBidder_guid);
|
oldBidder_accId = sObjectMgr.GetPlayerAccountIdByGUID(oldBidder_guid);
|
||||||
|
}
|
||||||
|
|
||||||
// old bidder exist
|
// old bidder exist
|
||||||
if (oldBidder || oldBidder_accId)
|
if (oldBidder || oldBidder_accId)
|
||||||
|
|
@ -169,7 +175,9 @@ void WorldSession::SendAuctionOutbiddedMail(AuctionEntry* auction)
|
||||||
msgAuctionOutbiddedSubject << auction->itemTemplate << ":" << auction->itemRandomPropertyId << ":" << AUCTION_OUTBIDDED << ":" << auction->Id << ":" << auction->itemCount;
|
msgAuctionOutbiddedSubject << auction->itemTemplate << ":" << auction->itemRandomPropertyId << ":" << AUCTION_OUTBIDDED << ":" << auction->Id << ":" << auction->itemCount;
|
||||||
|
|
||||||
if (oldBidder)
|
if (oldBidder)
|
||||||
|
{
|
||||||
oldBidder->GetSession()->SendAuctionBidderNotification(auction);
|
oldBidder->GetSession()->SendAuctionBidderNotification(auction);
|
||||||
|
}
|
||||||
|
|
||||||
MailDraft(msgAuctionOutbiddedSubject.str(), "") // TODO: fix body
|
MailDraft(msgAuctionOutbiddedSubject.str(), "") // TODO: fix body
|
||||||
.SetMoney(auction->bid)
|
.SetMoney(auction->bid)
|
||||||
|
|
@ -185,7 +193,9 @@ void WorldSession::SendAuctionCancelledToBidderMail(AuctionEntry* auction)
|
||||||
|
|
||||||
uint32 bidder_accId = 0;
|
uint32 bidder_accId = 0;
|
||||||
if (!bidder)
|
if (!bidder)
|
||||||
|
{
|
||||||
bidder_accId = sObjectMgr.GetPlayerAccountIdByGUID(bidder_guid);
|
bidder_accId = sObjectMgr.GetPlayerAccountIdByGUID(bidder_guid);
|
||||||
|
}
|
||||||
|
|
||||||
// bidder exist
|
// bidder exist
|
||||||
if (bidder || bidder_accId)
|
if (bidder || bidder_accId)
|
||||||
|
|
@ -194,7 +204,9 @@ void WorldSession::SendAuctionCancelledToBidderMail(AuctionEntry* auction)
|
||||||
msgAuctionCancelledSubject << auction->itemTemplate << ":" << auction->itemRandomPropertyId << ":" << AUCTION_CANCELLED_TO_BIDDER << ":" << auction->Id << ":" << auction->itemCount;
|
msgAuctionCancelledSubject << auction->itemTemplate << ":" << auction->itemRandomPropertyId << ":" << AUCTION_CANCELLED_TO_BIDDER << ":" << auction->Id << ":" << auction->itemCount;
|
||||||
|
|
||||||
if (bidder)
|
if (bidder)
|
||||||
|
{
|
||||||
bidder->GetSession()->SendAuctionRemovedNotification(auction);
|
bidder->GetSession()->SendAuctionRemovedNotification(auction);
|
||||||
|
}
|
||||||
|
|
||||||
MailDraft(msgAuctionCancelledSubject.str(), "") // TODO: fix body
|
MailDraft(msgAuctionCancelledSubject.str(), "") // TODO: fix body
|
||||||
.SetMoney(auction->bid)
|
.SetMoney(auction->bid)
|
||||||
|
|
@ -300,7 +312,9 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recv_data)
|
||||||
ObjectGuid itemGuid = guids[i];
|
ObjectGuid itemGuid = guids[i];
|
||||||
|
|
||||||
if (!itemGuid)
|
if (!itemGuid)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 stackSize = stackSizes[i];
|
uint32 stackSize = stackSizes[i];
|
||||||
|
|
||||||
|
|
@ -348,13 +362,19 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recv_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stackSize == 0)
|
if (stackSize == 0)
|
||||||
|
{
|
||||||
stackSize = 1;
|
stackSize = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (stackSize > it->GetMaxStackCount()) // too big stack size
|
if (stackSize > it->GetMaxStackCount()) // too big stack size
|
||||||
|
{
|
||||||
stackSize = it->GetMaxStackCount();
|
stackSize = it->GetMaxStackCount();
|
||||||
|
}
|
||||||
|
|
||||||
if (!pl->HasItemCount(it->GetEntry(), stackSize)) // not enough items
|
if (!pl->HasItemCount(it->GetEntry(), stackSize)) // not enough items
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Item* newItem = it->CloneItem(stackSize);
|
Item* newItem = it->CloneItem(stackSize);
|
||||||
|
|
||||||
|
|
@ -455,9 +475,13 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recv_data)
|
||||||
SendAuctionCommandResult(auction, AUCTION_BID_PLACED, AUCTION_OK);
|
SendAuctionCommandResult(auction, AUCTION_BID_PLACED, AUCTION_OK);
|
||||||
|
|
||||||
if (auction->UpdateBid(price, pl))
|
if (auction->UpdateBid(price, pl))
|
||||||
|
{
|
||||||
pl->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID, price);
|
pl->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID, price);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
pl->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID, auction->buyout);
|
pl->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID, auction->buyout);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this void is called when auction_owner cancels his auction
|
// this void is called when auction_owner cancels his auction
|
||||||
|
|
@ -507,7 +531,9 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recv_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auction->bidder) // if auction have real existed bidder send mail
|
if (auction->bidder) // if auction have real existed bidder send mail
|
||||||
|
{
|
||||||
SendAuctionCancelledToBidderMail(auction);
|
SendAuctionCancelledToBidderMail(auction);
|
||||||
|
}
|
||||||
|
|
||||||
pl->ModifyMoney(-int64(auctionCut));
|
pl->ModifyMoney(-int64(auctionCut));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -133,16 +133,22 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recv_data*/)
|
||||||
|
|
||||||
// skip mapDiff without global reset time
|
// skip mapDiff without global reset time
|
||||||
if (!mapDiff->resetTime)
|
if (!mapDiff->resetTime)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// skip non raid map
|
// skip non raid map
|
||||||
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
|
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
|
||||||
if (!mapEntry || !mapEntry->IsRaid())
|
if (!mapEntry || !mapEntry->IsRaid())
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// skip already sent map (not same difficulty?)
|
// skip already sent map (not same difficulty?)
|
||||||
if (sentMaps.find(mapId) != sentMaps.end())
|
if (sentMaps.find(mapId) != sentMaps.end())
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 resetTime = sMapPersistentStateMgr.GetScheduler().GetMaxResetTimeFor(mapDiff);
|
uint32 resetTime = sMapPersistentStateMgr.GetScheduler().GetMaxResetTimeFor(mapDiff);
|
||||||
|
|
||||||
|
|
@ -173,13 +179,19 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recv_data*/)
|
||||||
data << uint32(holiday->CalendarFilterType); // m_calendarFilterType
|
data << uint32(holiday->CalendarFilterType); // m_calendarFilterType
|
||||||
|
|
||||||
for (uint8 j = 0; j < MAX_HOLIDAY_DATES; ++j)
|
for (uint8 j = 0; j < MAX_HOLIDAY_DATES; ++j)
|
||||||
|
{
|
||||||
data << uint32(holiday->Date[j]); // 26 * m_date -- WritePackedTime ?
|
data << uint32(holiday->Date[j]); // 26 * m_date -- WritePackedTime ?
|
||||||
|
}
|
||||||
|
|
||||||
for (uint8 j = 0; j < MAX_HOLIDAY_DURATIONS; ++j)
|
for (uint8 j = 0; j < MAX_HOLIDAY_DURATIONS; ++j)
|
||||||
|
{
|
||||||
data << uint32(holiday->Duration[j]); // 10 * m_duration
|
data << uint32(holiday->Duration[j]); // 10 * m_duration
|
||||||
|
}
|
||||||
|
|
||||||
for (uint8 j = 0; j < MAX_HOLIDAY_FLAGS; ++j)
|
for (uint8 j = 0; j < MAX_HOLIDAY_FLAGS; ++j)
|
||||||
|
{
|
||||||
data << uint32(holiday->CalendarFlags[j]); // 10 * m_calendarFlags
|
data << uint32(holiday->CalendarFlags[j]); // 10 * m_calendarFlags
|
||||||
|
}
|
||||||
|
|
||||||
data << holiday->TextureFilename; // m_textureFilename (holiday name)
|
data << holiday->TextureFilename; // m_textureFilename (holiday name)
|
||||||
}*/
|
}*/
|
||||||
|
|
@ -196,9 +208,13 @@ void WorldSession::HandleCalendarGetEvent(WorldPacket& recv_data)
|
||||||
recv_data >> eventId;
|
recv_data >> eventId;
|
||||||
|
|
||||||
if (CalendarEvent* event = sCalendarMgr.GetEventById(eventId))
|
if (CalendarEvent* event = sCalendarMgr.GetEventById(eventId))
|
||||||
|
{
|
||||||
sCalendarMgr.SendCalendarEvent(_player, event, CALENDAR_SENDTYPE_GET);
|
sCalendarMgr.SendCalendarEvent(_player, event, CALENDAR_SENDTYPE_GET);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_EVENT_INVALID);
|
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_EVENT_INVALID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleCalendarGuildFilter(WorldPacket& recv_data)
|
void WorldSession::HandleCalendarGuildFilter(WorldPacket& recv_data)
|
||||||
|
|
@ -212,7 +228,9 @@ void WorldSession::HandleCalendarGuildFilter(WorldPacket& recv_data)
|
||||||
recv_data >> minLevel >> maxLevel >> minRank;
|
recv_data >> minLevel >> maxLevel >> minRank;
|
||||||
|
|
||||||
if (Guild* guild = sGuildMgr.GetGuildById(_player->GetGuildId()))
|
if (Guild* guild = sGuildMgr.GetGuildById(_player->GetGuildId()))
|
||||||
|
{
|
||||||
guild->MassInviteToEvent(this, minLevel, maxLevel, minRank);
|
guild->MassInviteToEvent(this, minLevel, maxLevel, minRank);
|
||||||
|
}
|
||||||
|
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_CALENDAR, "Min level [%u], Max level [%u], Min rank [%u]", minLevel, maxLevel, minRank);
|
DEBUG_FILTER_LOG(LOG_FILTER_CALENDAR, "Min level [%u], Max level [%u], Min rank [%u]", minLevel, maxLevel, minRank);
|
||||||
}
|
}
|
||||||
|
|
@ -242,7 +260,9 @@ void WorldSession::HandleCalendarEventSignup(WorldPacket& recv_data)
|
||||||
sCalendarMgr.SendCalendarClearPendingAction(_player);
|
sCalendarMgr.SendCalendarClearPendingAction(_player);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_EVENT_INVALID);
|
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_EVENT_INVALID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleCalendarArenaTeam(WorldPacket& recv_data)
|
void WorldSession::HandleCalendarArenaTeam(WorldPacket& recv_data)
|
||||||
|
|
@ -252,7 +272,9 @@ void WorldSession::HandleCalendarArenaTeam(WorldPacket& recv_data)
|
||||||
recv_data >> areanTeamId;
|
recv_data >> areanTeamId;
|
||||||
|
|
||||||
if (ArenaTeam* team = sObjectMgr.GetArenaTeamById(areanTeamId))
|
if (ArenaTeam* team = sObjectMgr.GetArenaTeamById(areanTeamId))
|
||||||
|
{
|
||||||
team->MassInviteToEvent(this);
|
team->MassInviteToEvent(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleCalendarAddEvent(WorldPacket& recv_data)
|
void WorldSession::HandleCalendarAddEvent(WorldPacket& recv_data)
|
||||||
|
|
@ -377,7 +399,9 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recv_data)
|
||||||
type, flags, dungeonId, event->EventTime, title.c_str(), description.c_str(), eventId);
|
type, flags, dungeonId, event->EventTime, title.c_str(), description.c_str(), eventId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_EVENT_INVALID);
|
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_EVENT_INVALID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleCalendarRemoveEvent(WorldPacket& recv_data)
|
void WorldSession::HandleCalendarRemoveEvent(WorldPacket& recv_data)
|
||||||
|
|
@ -439,8 +463,10 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recv_data)
|
||||||
inviteeTeam = player->GetTeam();
|
inviteeTeam = player->GetTeam();
|
||||||
inviteeGuildId = player->GetGuildId();
|
inviteeGuildId = player->GetGuildId();
|
||||||
if (player->GetSocial()->HasIgnore(playerGuid))
|
if (player->GetSocial()->HasIgnore(playerGuid))
|
||||||
|
{
|
||||||
isIgnored = true;
|
isIgnored = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Invitee offline, get data from database
|
// Invitee offline, get data from database
|
||||||
|
|
@ -459,7 +485,9 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
Field* fields = result->Fetch();
|
Field* fields = result->Fetch();
|
||||||
if (fields[0].GetUInt8() & SOCIAL_FLAG_IGNORED)
|
if (fields[0].GetUInt8() & SOCIAL_FLAG_IGNORED)
|
||||||
|
{
|
||||||
isIgnored = true;
|
isIgnored = true;
|
||||||
|
}
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -497,8 +525,10 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recv_data)
|
||||||
sCalendarMgr.AddInvite(event, playerGuid, inviteeGuid, CALENDAR_STATUS_INVITED, CALENDAR_RANK_PLAYER, "", time(NULL));
|
sCalendarMgr.AddInvite(event, playerGuid, inviteeGuid, CALENDAR_STATUS_INVITED, CALENDAR_RANK_PLAYER, "", time(NULL));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_EVENT_INVALID);
|
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_EVENT_INVALID);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (isGuildEvent && inviteeGuildId == _player->GetGuildId())
|
if (isGuildEvent && inviteeGuildId == _player->GetGuildId())
|
||||||
|
|
@ -568,10 +598,14 @@ void WorldSession::HandleCalendarEventRsvp(WorldPacket& recv_data)
|
||||||
sCalendarMgr.SendCalendarClearPendingAction(_player);
|
sCalendarMgr.SendCalendarClearPendingAction(_player);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_NO_INVITE); // correct?
|
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_NO_INVITE); // correct?
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_EVENT_INVALID);
|
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_EVENT_INVALID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket& recv_data)
|
void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket& recv_data)
|
||||||
|
|
@ -591,9 +625,13 @@ void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket& recv_data)
|
||||||
eventId, ownerInviteId, invitee.GetString().c_str(), inviteId);
|
eventId, ownerInviteId, invitee.GetString().c_str(), inviteId);
|
||||||
|
|
||||||
if (CalendarEvent* event = sCalendarMgr.GetEventById(eventId))
|
if (CalendarEvent* event = sCalendarMgr.GetEventById(eventId))
|
||||||
|
{
|
||||||
sCalendarMgr.RemoveInvite(eventId, inviteId, guid);
|
sCalendarMgr.RemoveInvite(eventId, inviteId, guid);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_EVENT_INVALID);
|
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_EVENT_INVALID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleCalendarEventStatus(WorldPacket& recv_data)
|
void WorldSession::HandleCalendarEventStatus(WorldPacket& recv_data)
|
||||||
|
|
@ -641,10 +679,14 @@ void WorldSession::HandleCalendarEventStatus(WorldPacket& recv_data)
|
||||||
sCalendarMgr.SendCalendarClearPendingAction(sObjectMgr.GetPlayer(invitee));
|
sCalendarMgr.SendCalendarClearPendingAction(sObjectMgr.GetPlayer(invitee));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_NO_INVITE);
|
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_NO_INVITE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_EVENT_INVALID);
|
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_EVENT_INVALID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recv_data)
|
void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recv_data)
|
||||||
|
|
@ -695,10 +737,14 @@ void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recv_data)
|
||||||
sCalendarMgr.SendCalendarEventModeratorStatusAlert(invite);
|
sCalendarMgr.SendCalendarEventModeratorStatusAlert(invite);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_NO_INVITE);
|
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_NO_INVITE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_EVENT_INVALID);
|
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_EVENT_INVALID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleCalendarComplain(WorldPacket& recv_data)
|
void WorldSession::HandleCalendarComplain(WorldPacket& recv_data)
|
||||||
|
|
@ -773,10 +819,14 @@ void CalendarMgr::SendCalendarEventInviteAlert(CalendarInvite const* invite)
|
||||||
if (event->IsGuildEvent() || event->IsGuildAnnouncement())
|
if (event->IsGuildEvent() || event->IsGuildAnnouncement())
|
||||||
{
|
{
|
||||||
if (Guild* guild = sGuildMgr.GetGuildById(event->GuildId))
|
if (Guild* guild = sGuildMgr.GetGuildById(event->GuildId))
|
||||||
|
{
|
||||||
guild->BroadcastPacket(&data);
|
guild->BroadcastPacket(&data);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (Player* player = sObjectMgr.GetPlayer(invite->InviteeGuid))
|
else if (Player* player = sObjectMgr.GetPlayer(invite->InviteeGuid))
|
||||||
|
{
|
||||||
player->SendDirectMessage(&data);
|
player->SendDirectMessage(&data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalendarMgr::SendCalendarEventInvite(CalendarInvite const* invite)
|
void CalendarMgr::SendCalendarEventInvite(CalendarInvite const* invite)
|
||||||
|
|
@ -804,7 +854,9 @@ void CalendarMgr::SendCalendarEventInvite(CalendarInvite const* invite)
|
||||||
data << uint8(invite->Status);
|
data << uint8(invite->Status);
|
||||||
data << uint8(!preInvite);
|
data << uint8(!preInvite);
|
||||||
if (!preInvite)
|
if (!preInvite)
|
||||||
|
{
|
||||||
data << secsToTimeBitFields(statusTime);
|
data << secsToTimeBitFields(statusTime);
|
||||||
|
}
|
||||||
data << uint8(invite->SenderGuid != invite->InviteeGuid); // false only if the invite is sign-up (invitee create himself his invite)
|
data << uint8(invite->SenderGuid != invite->InviteeGuid); // false only if the invite is sign-up (invitee create himself his invite)
|
||||||
|
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_CALENDAR, "SendCalendarInvit> %s senderGuid[%s], inviteeGuid[%s], EventId[" UI64FMTD "], Status[%u], InviteId[" UI64FMTD "]",
|
DEBUG_FILTER_LOG(LOG_FILTER_CALENDAR, "SendCalendarInvit> %s senderGuid[%s], inviteeGuid[%s], EventId[" UI64FMTD "], Status[%u], InviteId[" UI64FMTD "]",
|
||||||
|
|
@ -814,10 +866,14 @@ void CalendarMgr::SendCalendarEventInvite(CalendarInvite const* invite)
|
||||||
if (preInvite)
|
if (preInvite)
|
||||||
{
|
{
|
||||||
if (Player* sender = sObjectMgr.GetPlayer(invite->SenderGuid))
|
if (Player* sender = sObjectMgr.GetPlayer(invite->SenderGuid))
|
||||||
|
{
|
||||||
sender->SendDirectMessage(&data);
|
sender->SendDirectMessage(&data);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
SendPacketToAllEventRelatives(data, event);
|
SendPacketToAllEventRelatives(data, event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalendarMgr::SendCalendarCommandResult(Player* player, CalendarError err, char const* param /*= NULL*/)
|
void CalendarMgr::SendCalendarCommandResult(Player* player, CalendarError err, char const* param /*= NULL*/)
|
||||||
|
|
@ -1010,14 +1066,18 @@ void CalendarMgr::SendPacketToAllEventRelatives(WorldPacket packet, CalendarEven
|
||||||
// Send packet to all guild members
|
// Send packet to all guild members
|
||||||
if (event->IsGuildEvent() || event->IsGuildAnnouncement())
|
if (event->IsGuildEvent() || event->IsGuildAnnouncement())
|
||||||
if (Guild* guild = sGuildMgr.GetGuildById(event->GuildId))
|
if (Guild* guild = sGuildMgr.GetGuildById(event->GuildId))
|
||||||
|
{
|
||||||
guild->BroadcastPacket(&packet);
|
guild->BroadcastPacket(&packet);
|
||||||
|
}
|
||||||
|
|
||||||
// Send packet to all invitees if event is non-guild, in other case only to non-guild invitees (packet was broadcasted for them)
|
// Send packet to all invitees if event is non-guild, in other case only to non-guild invitees (packet was broadcasted for them)
|
||||||
CalendarInviteMap const* cInvMap = event->GetInviteMap();
|
CalendarInviteMap const* cInvMap = event->GetInviteMap();
|
||||||
for (CalendarInviteMap::const_iterator itr = cInvMap->begin(); itr != cInvMap->end(); ++itr)
|
for (CalendarInviteMap::const_iterator itr = cInvMap->begin(); itr != cInvMap->end(); ++itr)
|
||||||
if (Player* player = sObjectMgr.GetPlayer(itr->second->InviteeGuid))
|
if (Player* player = sObjectMgr.GetPlayer(itr->second->InviteeGuid))
|
||||||
if (!event->IsGuildEvent() || (event->IsGuildEvent() && player->GetGuildId() != event->GuildId))
|
if (!event->IsGuildEvent() || (event->IsGuildEvent() && player->GetGuildId() != event->GuildId))
|
||||||
|
{
|
||||||
player->SendDirectMessage(&packet);
|
player->SendDirectMessage(&packet);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalendarMgr::SendCalendarRaidLockoutRemove(Player* player, DungeonPersistentState const* save)
|
void CalendarMgr::SendCalendarRaidLockoutRemove(Player* player, DungeonPersistentState const* save)
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,9 @@ Cell::Visit(const CellPair& standing_cell, TypeContainerVisitor<T, CONTAINER> &v
|
||||||
}
|
}
|
||||||
// lets limit the upper value for search radius
|
// lets limit the upper value for search radius
|
||||||
if (radius > 333.0f)
|
if (radius > 333.0f)
|
||||||
|
{
|
||||||
radius = 333.0f;
|
radius = 333.0f;
|
||||||
|
}
|
||||||
|
|
||||||
// lets calculate object coord offsets from cell borders.
|
// lets calculate object coord offsets from cell borders.
|
||||||
CellArea area = Cell::CalculateCellArea(x, y, radius);
|
CellArea area = Cell::CalculateCellArea(x, y, radius);
|
||||||
|
|
@ -187,7 +189,9 @@ inline void Cell::VisitGridObjects(const WorldObject* center_obj, T& visitor, fl
|
||||||
CellPair p(MaNGOS::ComputeCellPair(center_obj->GetPositionX(), center_obj->GetPositionY()));
|
CellPair p(MaNGOS::ComputeCellPair(center_obj->GetPositionX(), center_obj->GetPositionY()));
|
||||||
Cell cell(p);
|
Cell cell(p);
|
||||||
if (dont_load)
|
if (dont_load)
|
||||||
|
{
|
||||||
cell.SetNoCreate();
|
cell.SetNoCreate();
|
||||||
|
}
|
||||||
TypeContainerVisitor<T, GridTypeMapContainer > gnotifier(visitor);
|
TypeContainerVisitor<T, GridTypeMapContainer > gnotifier(visitor);
|
||||||
cell.Visit(p, gnotifier, *center_obj->GetMap(), *center_obj, radius);
|
cell.Visit(p, gnotifier, *center_obj->GetMap(), *center_obj, radius);
|
||||||
}
|
}
|
||||||
|
|
@ -198,7 +202,9 @@ inline void Cell::VisitWorldObjects(const WorldObject* center_obj, T& visitor, f
|
||||||
CellPair p(MaNGOS::ComputeCellPair(center_obj->GetPositionX(), center_obj->GetPositionY()));
|
CellPair p(MaNGOS::ComputeCellPair(center_obj->GetPositionX(), center_obj->GetPositionY()));
|
||||||
Cell cell(p);
|
Cell cell(p);
|
||||||
if (dont_load)
|
if (dont_load)
|
||||||
|
{
|
||||||
cell.SetNoCreate();
|
cell.SetNoCreate();
|
||||||
|
}
|
||||||
TypeContainerVisitor<T, WorldTypeMapContainer > gnotifier(visitor);
|
TypeContainerVisitor<T, WorldTypeMapContainer > gnotifier(visitor);
|
||||||
cell.Visit(p, gnotifier, *center_obj->GetMap(), *center_obj, radius);
|
cell.Visit(p, gnotifier, *center_obj->GetMap(), *center_obj, radius);
|
||||||
}
|
}
|
||||||
|
|
@ -209,7 +215,9 @@ inline void Cell::VisitAllObjects(const WorldObject* center_obj, T& visitor, flo
|
||||||
CellPair p(MaNGOS::ComputeCellPair(center_obj->GetPositionX(), center_obj->GetPositionY()));
|
CellPair p(MaNGOS::ComputeCellPair(center_obj->GetPositionX(), center_obj->GetPositionY()));
|
||||||
Cell cell(p);
|
Cell cell(p);
|
||||||
if (dont_load)
|
if (dont_load)
|
||||||
|
{
|
||||||
cell.SetNoCreate();
|
cell.SetNoCreate();
|
||||||
|
}
|
||||||
TypeContainerVisitor<T, GridTypeMapContainer > gnotifier(visitor);
|
TypeContainerVisitor<T, GridTypeMapContainer > gnotifier(visitor);
|
||||||
TypeContainerVisitor<T, WorldTypeMapContainer > wnotifier(visitor);
|
TypeContainerVisitor<T, WorldTypeMapContainer > wnotifier(visitor);
|
||||||
cell.Visit(p, gnotifier, *center_obj->GetMap(), *center_obj, radius);
|
cell.Visit(p, gnotifier, *center_obj->GetMap(), *center_obj, radius);
|
||||||
|
|
@ -222,7 +230,9 @@ inline void Cell::VisitGridObjects(float x, float y, Map* map, T& visitor, float
|
||||||
CellPair p(MaNGOS::ComputeCellPair(x, y));
|
CellPair p(MaNGOS::ComputeCellPair(x, y));
|
||||||
Cell cell(p);
|
Cell cell(p);
|
||||||
if (dont_load)
|
if (dont_load)
|
||||||
|
{
|
||||||
cell.SetNoCreate();
|
cell.SetNoCreate();
|
||||||
|
}
|
||||||
TypeContainerVisitor<T, GridTypeMapContainer > gnotifier(visitor);
|
TypeContainerVisitor<T, GridTypeMapContainer > gnotifier(visitor);
|
||||||
cell.Visit(p, gnotifier, *map, x, y, radius);
|
cell.Visit(p, gnotifier, *map, x, y, radius);
|
||||||
}
|
}
|
||||||
|
|
@ -233,7 +243,9 @@ inline void Cell::VisitWorldObjects(float x, float y, Map* map, T& visitor, floa
|
||||||
CellPair p(MaNGOS::ComputeCellPair(x, y));
|
CellPair p(MaNGOS::ComputeCellPair(x, y));
|
||||||
Cell cell(p);
|
Cell cell(p);
|
||||||
if (dont_load)
|
if (dont_load)
|
||||||
|
{
|
||||||
cell.SetNoCreate();
|
cell.SetNoCreate();
|
||||||
|
}
|
||||||
TypeContainerVisitor<T, WorldTypeMapContainer > gnotifier(visitor);
|
TypeContainerVisitor<T, WorldTypeMapContainer > gnotifier(visitor);
|
||||||
cell.Visit(p , gnotifier, *map, x, y, radius);
|
cell.Visit(p , gnotifier, *map, x, y, radius);
|
||||||
}
|
}
|
||||||
|
|
@ -244,7 +256,9 @@ inline void Cell::VisitAllObjects(float x, float y, Map* map, T& visitor, float
|
||||||
CellPair p(MaNGOS::ComputeCellPair(x, y));
|
CellPair p(MaNGOS::ComputeCellPair(x, y));
|
||||||
Cell cell(p);
|
Cell cell(p);
|
||||||
if (dont_load)
|
if (dont_load)
|
||||||
|
{
|
||||||
cell.SetNoCreate();
|
cell.SetNoCreate();
|
||||||
|
}
|
||||||
TypeContainerVisitor<T, GridTypeMapContainer > gnotifier(visitor);
|
TypeContainerVisitor<T, GridTypeMapContainer > gnotifier(visitor);
|
||||||
TypeContainerVisitor<T, WorldTypeMapContainer > wnotifier(visitor);
|
TypeContainerVisitor<T, WorldTypeMapContainer > wnotifier(visitor);
|
||||||
cell.Visit(p, gnotifier, *map, x, y, radius);
|
cell.Visit(p, gnotifier, *map, x, y, radius);
|
||||||
|
|
|
||||||
|
|
@ -41,16 +41,24 @@ Channel::Channel(const std::string& name, uint32 channel_id)
|
||||||
m_flags |= CHANNEL_FLAG_GENERAL; // for all built-in channels
|
m_flags |= CHANNEL_FLAG_GENERAL; // for all built-in channels
|
||||||
|
|
||||||
if (ch->flags & CHANNEL_DBC_FLAG_TRADE) // for trade channel
|
if (ch->flags & CHANNEL_DBC_FLAG_TRADE) // for trade channel
|
||||||
|
{
|
||||||
m_flags |= CHANNEL_FLAG_TRADE;
|
m_flags |= CHANNEL_FLAG_TRADE;
|
||||||
|
}
|
||||||
|
|
||||||
if (ch->flags & CHANNEL_DBC_FLAG_CITY_ONLY2) // for city only channels
|
if (ch->flags & CHANNEL_DBC_FLAG_CITY_ONLY2) // for city only channels
|
||||||
|
{
|
||||||
m_flags |= CHANNEL_FLAG_CITY;
|
m_flags |= CHANNEL_FLAG_CITY;
|
||||||
|
}
|
||||||
|
|
||||||
if (ch->flags & CHANNEL_DBC_FLAG_LFG) // for LFG channel
|
if (ch->flags & CHANNEL_DBC_FLAG_LFG) // for LFG channel
|
||||||
|
{
|
||||||
m_flags |= CHANNEL_FLAG_LFG;
|
m_flags |= CHANNEL_FLAG_LFG;
|
||||||
|
}
|
||||||
else // for all other channels
|
else // for all other channels
|
||||||
|
{
|
||||||
m_flags |= CHANNEL_FLAG_NOT_LFG;
|
m_flags |= CHANNEL_FLAG_NOT_LFG;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else // it's custom channel
|
else // it's custom channel
|
||||||
{
|
{
|
||||||
m_flags |= CHANNEL_FLAG_CUSTOM;
|
m_flags |= CHANNEL_FLAG_CUSTOM;
|
||||||
|
|
@ -227,7 +235,9 @@ void Channel::KickOrBan(Player* player, const char* targetName, bool ban)
|
||||||
MakePlayerBanned(&data, targetGuid, guid);
|
MakePlayerBanned(&data, targetGuid, guid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
MakePlayerKicked(&data, targetGuid, guid);
|
MakePlayerKicked(&data, targetGuid, guid);
|
||||||
|
}
|
||||||
|
|
||||||
SendToAll(&data);
|
SendToAll(&data);
|
||||||
m_players.erase(targetGuid);
|
m_players.erase(targetGuid);
|
||||||
|
|
@ -378,9 +388,13 @@ void Channel::SetMode(Player* player, const char* targetName, bool moderator, bo
|
||||||
|
|
||||||
// set channel moderator
|
// set channel moderator
|
||||||
if (moderator)
|
if (moderator)
|
||||||
|
{
|
||||||
SetModerator(targetGuid, set);
|
SetModerator(targetGuid, set);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
SetMute(targetGuid, set);
|
SetMute(targetGuid, set);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Channel::SetOwner(ObjectGuid guid, bool exclaim)
|
void Channel::SetOwner(ObjectGuid guid, bool exclaim)
|
||||||
|
|
@ -390,8 +404,10 @@ void Channel::SetOwner(ObjectGuid guid, bool exclaim)
|
||||||
// [] will re-add player after it possible removed
|
// [] will re-add player after it possible removed
|
||||||
PlayerList::iterator p_itr = m_players.find(m_ownerGuid);
|
PlayerList::iterator p_itr = m_players.find(m_ownerGuid);
|
||||||
if (p_itr != m_players.end())
|
if (p_itr != m_players.end())
|
||||||
|
{
|
||||||
p_itr->second.SetOwner(false);
|
p_itr->second.SetOwner(false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_ownerGuid = guid;
|
m_ownerGuid = guid;
|
||||||
|
|
||||||
|
|
@ -550,9 +566,13 @@ void Channel::Announce(Player* player)
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
if (m_announce)
|
if (m_announce)
|
||||||
|
{
|
||||||
MakeAnnouncementsOn(&data, guid);
|
MakeAnnouncementsOn(&data, guid);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
MakeAnnouncementsOff(&data, guid);
|
MakeAnnouncementsOff(&data, guid);
|
||||||
|
}
|
||||||
|
|
||||||
SendToAll(&data);
|
SendToAll(&data);
|
||||||
}
|
}
|
||||||
|
|
@ -582,9 +602,13 @@ void Channel::Moderate(Player* player)
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
if (m_moderate)
|
if (m_moderate)
|
||||||
|
{
|
||||||
MakeModerationOn(&data, guid);
|
MakeModerationOn(&data, guid);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
MakeModerationOff(&data, guid);
|
MakeModerationOff(&data, guid);
|
||||||
|
}
|
||||||
|
|
||||||
SendToAll(&data);
|
SendToAll(&data);
|
||||||
}
|
}
|
||||||
|
|
@ -624,7 +648,9 @@ void Channel::Say(Player* player, const char* text, uint32 lang)
|
||||||
|
|
||||||
// send channel message
|
// send channel message
|
||||||
if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
|
if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
|
||||||
|
{
|
||||||
lang = LANG_UNIVERSAL;
|
lang = LANG_UNIVERSAL;
|
||||||
|
}
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_CHANNEL, text, Language(lang), player->GetChatTag(), guid, player->GetName(), ObjectGuid(), "", m_name.c_str());
|
ChatHandler::BuildChatPacket(data, CHAT_MSG_CHANNEL, text, Language(lang), player->GetChatTag(), guid, player->GetName(), ObjectGuid(), "", m_name.c_str());
|
||||||
SendToAll(&data, !m_players[guid].IsModerator() ? guid : ObjectGuid());
|
SendToAll(&data, !m_players[guid].IsModerator() ? guid : ObjectGuid());
|
||||||
|
|
@ -694,13 +720,17 @@ void Channel::SendToAll(WorldPacket* data, ObjectGuid guid)
|
||||||
for (PlayerList::const_iterator i = m_players.begin(); i != m_players.end(); ++i)
|
for (PlayerList::const_iterator i = m_players.begin(); i != m_players.end(); ++i)
|
||||||
if (Player* plr = sObjectMgr.GetPlayer(i->first))
|
if (Player* plr = sObjectMgr.GetPlayer(i->first))
|
||||||
if (!guid || !plr->GetSocial()->HasIgnore(guid))
|
if (!guid || !plr->GetSocial()->HasIgnore(guid))
|
||||||
|
{
|
||||||
plr->GetSession()->SendPacket(data);
|
plr->GetSession()->SendPacket(data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Channel::SendToOne(WorldPacket* data, ObjectGuid who)
|
void Channel::SendToOne(WorldPacket* data, ObjectGuid who)
|
||||||
{
|
{
|
||||||
if (Player* plr = ObjectMgr::GetPlayer(who))
|
if (Player* plr = ObjectMgr::GetPlayer(who))
|
||||||
|
{
|
||||||
plr->GetSession()->SendPacket(data);
|
plr->GetSession()->SendPacket(data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Channel::Voice(ObjectGuid /*guid1*/, ObjectGuid /*guid2*/)
|
void Channel::Voice(ObjectGuid /*guid1*/, ObjectGuid /*guid2*/)
|
||||||
|
|
@ -788,7 +818,9 @@ void Channel::MakeChannelOwner(WorldPacket* data)
|
||||||
std::string name = "";
|
std::string name = "";
|
||||||
|
|
||||||
if (!sObjectMgr.GetPlayerNameByGUID(m_ownerGuid, name) || name.empty())
|
if (!sObjectMgr.GetPlayerNameByGUID(m_ownerGuid, name) || name.empty())
|
||||||
|
{
|
||||||
name = "PLAYER_NOT_FOUND";
|
name = "PLAYER_NOT_FOUND";
|
||||||
|
}
|
||||||
|
|
||||||
MakeNotifyPacket(data, CHAT_CHANNEL_OWNER_NOTICE);
|
MakeNotifyPacket(data, CHAT_CHANNEL_OWNER_NOTICE);
|
||||||
*data << ((IsConstant() || !m_ownerGuid) ? "Nobody" : name);
|
*data << ((IsConstant() || !m_ownerGuid) ? "Nobody" : name);
|
||||||
|
|
@ -939,9 +971,13 @@ void Channel::JoinNotify(ObjectGuid guid)
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
|
|
||||||
if (IsConstant())
|
if (IsConstant())
|
||||||
|
{
|
||||||
data.Initialize(SMSG_USERLIST_ADD, 8 + 1 + 1 + 4 + GetName().size() + 1);
|
data.Initialize(SMSG_USERLIST_ADD, 8 + 1 + 1 + 4 + GetName().size() + 1);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
data.Initialize(SMSG_USERLIST_UPDATE, 8 + 1 + 1 + 4 + GetName().size() + 1);
|
data.Initialize(SMSG_USERLIST_UPDATE, 8 + 1 + 1 + 4 + GetName().size() + 1);
|
||||||
|
}
|
||||||
|
|
||||||
data << ObjectGuid(guid);
|
data << ObjectGuid(guid);
|
||||||
data << uint8(GetPlayerFlags(guid));
|
data << uint8(GetPlayerFlags(guid));
|
||||||
|
|
|
||||||
|
|
@ -132,20 +132,38 @@ class Channel
|
||||||
bool IsOwner() { return flags & MEMBER_FLAG_OWNER; }
|
bool IsOwner() { return flags & MEMBER_FLAG_OWNER; }
|
||||||
void SetOwner(bool state)
|
void SetOwner(bool state)
|
||||||
{
|
{
|
||||||
if (state) flags |= MEMBER_FLAG_OWNER;
|
if (state)
|
||||||
else flags &= ~MEMBER_FLAG_OWNER;
|
{
|
||||||
|
flags |= MEMBER_FLAG_OWNER;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flags &= ~MEMBER_FLAG_OWNER;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
bool IsModerator() { return flags & MEMBER_FLAG_MODERATOR; }
|
bool IsModerator() { return flags & MEMBER_FLAG_MODERATOR; }
|
||||||
void SetModerator(bool state)
|
void SetModerator(bool state)
|
||||||
{
|
{
|
||||||
if (state) flags |= MEMBER_FLAG_MODERATOR;
|
if (state)
|
||||||
else flags &= ~MEMBER_FLAG_MODERATOR;
|
{
|
||||||
|
flags |= MEMBER_FLAG_MODERATOR;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flags &= ~MEMBER_FLAG_MODERATOR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
bool IsMuted() { return flags & MEMBER_FLAG_MUTED; }
|
bool IsMuted() { return flags & MEMBER_FLAG_MUTED; }
|
||||||
void SetMuted(bool state)
|
void SetMuted(bool state)
|
||||||
{
|
{
|
||||||
if (state) flags |= MEMBER_FLAG_MUTED;
|
if (state)
|
||||||
else flags &= ~MEMBER_FLAG_MUTED;
|
{
|
||||||
|
flags |= MEMBER_FLAG_MUTED;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flags &= ~MEMBER_FLAG_MUTED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,9 @@ void WorldSession::HandleJoinChannelOpcode(WorldPacket& recvPacket)
|
||||||
|
|
||||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
if (Channel* chn = cMgr->GetJoinChannel(channelname, channel_id))
|
if (Channel* chn = cMgr->GetJoinChannel(channelname, channel_id))
|
||||||
|
{
|
||||||
chn->Join(_player, pass.c_str());
|
chn->Join(_player, pass.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleLeaveChannelOpcode(WorldPacket& recvPacket)
|
void WorldSession::HandleLeaveChannelOpcode(WorldPacket& recvPacket)
|
||||||
|
|
@ -69,7 +71,9 @@ void WorldSession::HandleLeaveChannelOpcode(WorldPacket& recvPacket)
|
||||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
{
|
{
|
||||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||||
|
{
|
||||||
chn->Leave(_player, true);
|
chn->Leave(_player, true);
|
||||||
|
}
|
||||||
cMgr->LeftChannel(channelname);
|
cMgr->LeftChannel(channelname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -82,7 +86,9 @@ void WorldSession::HandleChannelListOpcode(WorldPacket& recvPacket)
|
||||||
|
|
||||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||||
|
{
|
||||||
chn->List(_player);
|
chn->List(_player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleChannelPasswordOpcode(WorldPacket& recvPacket)
|
void WorldSession::HandleChannelPasswordOpcode(WorldPacket& recvPacket)
|
||||||
|
|
@ -99,7 +105,9 @@ void WorldSession::HandleChannelPasswordOpcode(WorldPacket& recvPacket)
|
||||||
|
|
||||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||||
|
{
|
||||||
chn->Password(_player, pass.c_str());
|
chn->Password(_player, pass.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleChannelSetOwnerOpcode(WorldPacket& recvPacket)
|
void WorldSession::HandleChannelSetOwnerOpcode(WorldPacket& recvPacket)
|
||||||
|
|
@ -122,7 +130,9 @@ void WorldSession::HandleChannelSetOwnerOpcode(WorldPacket& recvPacket)
|
||||||
|
|
||||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||||
|
{
|
||||||
chn->SetOwner(_player->GetObjectGuid(), newp.c_str());
|
chn->SetOwner(_player->GetObjectGuid(), newp.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleChannelOwnerOpcode(WorldPacket& recvPacket)
|
void WorldSession::HandleChannelOwnerOpcode(WorldPacket& recvPacket)
|
||||||
|
|
@ -133,7 +143,9 @@ void WorldSession::HandleChannelOwnerOpcode(WorldPacket& recvPacket)
|
||||||
|
|
||||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||||
|
{
|
||||||
chn->SendWhoOwner(_player);
|
chn->SendWhoOwner(_player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleChannelModeratorOpcode(WorldPacket& recvPacket)
|
void WorldSession::HandleChannelModeratorOpcode(WorldPacket& recvPacket)
|
||||||
|
|
@ -155,7 +167,9 @@ void WorldSession::HandleChannelModeratorOpcode(WorldPacket& recvPacket)
|
||||||
|
|
||||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||||
|
{
|
||||||
chn->SetModerator(_player, otp.c_str());
|
chn->SetModerator(_player, otp.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleChannelUnmoderatorOpcode(WorldPacket& recvPacket)
|
void WorldSession::HandleChannelUnmoderatorOpcode(WorldPacket& recvPacket)
|
||||||
|
|
@ -177,7 +191,9 @@ void WorldSession::HandleChannelUnmoderatorOpcode(WorldPacket& recvPacket)
|
||||||
|
|
||||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||||
|
{
|
||||||
chn->UnsetMute(_player, otp.c_str());
|
chn->UnsetMute(_player, otp.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleChannelMuteOpcode(WorldPacket& recvPacket)
|
void WorldSession::HandleChannelMuteOpcode(WorldPacket& recvPacket)
|
||||||
|
|
@ -199,7 +215,9 @@ void WorldSession::HandleChannelMuteOpcode(WorldPacket& recvPacket)
|
||||||
|
|
||||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||||
|
{
|
||||||
chn->Invite(_player, otp.c_str());
|
chn->Invite(_player, otp.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleChannelUnmuteOpcode(WorldPacket& recvPacket)
|
void WorldSession::HandleChannelUnmuteOpcode(WorldPacket& recvPacket)
|
||||||
|
|
@ -221,7 +239,9 @@ void WorldSession::HandleChannelUnmuteOpcode(WorldPacket& recvPacket)
|
||||||
|
|
||||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||||
|
{
|
||||||
chn->UnsetMute(_player, otp.c_str());
|
chn->UnsetMute(_player, otp.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleChannelInviteOpcode(WorldPacket& recvPacket)
|
void WorldSession::HandleChannelInviteOpcode(WorldPacket& recvPacket)
|
||||||
|
|
@ -243,7 +263,9 @@ void WorldSession::HandleChannelInviteOpcode(WorldPacket& recvPacket)
|
||||||
|
|
||||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||||
|
{
|
||||||
chn->Invite(_player, otp.c_str());
|
chn->Invite(_player, otp.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleChannelKickOpcode(WorldPacket& recvPacket)
|
void WorldSession::HandleChannelKickOpcode(WorldPacket& recvPacket)
|
||||||
|
|
@ -265,7 +287,9 @@ void WorldSession::HandleChannelKickOpcode(WorldPacket& recvPacket)
|
||||||
|
|
||||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||||
|
{
|
||||||
chn->Kick(_player, otp.c_str());
|
chn->Kick(_player, otp.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleChannelBanOpcode(WorldPacket& recvPacket)
|
void WorldSession::HandleChannelBanOpcode(WorldPacket& recvPacket)
|
||||||
|
|
@ -287,7 +311,9 @@ void WorldSession::HandleChannelBanOpcode(WorldPacket& recvPacket)
|
||||||
|
|
||||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||||
|
{
|
||||||
chn->Ban(_player, otp.c_str());
|
chn->Ban(_player, otp.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleChannelUnbanOpcode(WorldPacket& recvPacket)
|
void WorldSession::HandleChannelUnbanOpcode(WorldPacket& recvPacket)
|
||||||
|
|
@ -309,7 +335,9 @@ void WorldSession::HandleChannelUnbanOpcode(WorldPacket& recvPacket)
|
||||||
|
|
||||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||||
|
{
|
||||||
chn->UnBan(_player, otp.c_str());
|
chn->UnBan(_player, otp.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleChannelAnnouncementsOpcode(WorldPacket& recvPacket)
|
void WorldSession::HandleChannelAnnouncementsOpcode(WorldPacket& recvPacket)
|
||||||
|
|
@ -319,7 +347,9 @@ void WorldSession::HandleChannelAnnouncementsOpcode(WorldPacket& recvPacket)
|
||||||
std::string channelname = recvPacket.ReadString(recvPacket.ReadBits(8));
|
std::string channelname = recvPacket.ReadString(recvPacket.ReadBits(8));
|
||||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||||
|
{
|
||||||
chn->Announce(_player);
|
chn->Announce(_player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleChannelModerateOpcode(WorldPacket& recvPacket)
|
void WorldSession::HandleChannelModerateOpcode(WorldPacket& recvPacket)
|
||||||
|
|
@ -330,7 +360,9 @@ void WorldSession::HandleChannelModerateOpcode(WorldPacket& recvPacket)
|
||||||
recvPacket >> channelname;
|
recvPacket >> channelname;
|
||||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||||
|
{
|
||||||
chn->Moderate(_player);
|
chn->Moderate(_player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleChannelDisplayListQueryOpcode(WorldPacket& recvPacket)
|
void WorldSession::HandleChannelDisplayListQueryOpcode(WorldPacket& recvPacket)
|
||||||
|
|
@ -340,7 +372,9 @@ void WorldSession::HandleChannelDisplayListQueryOpcode(WorldPacket& recvPacket)
|
||||||
std::string channelname = recvPacket.ReadString(recvPacket.ReadBits(8));
|
std::string channelname = recvPacket.ReadString(recvPacket.ReadBits(8));
|
||||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||||
|
{
|
||||||
chn->List(_player);
|
chn->List(_player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleGetChannelMemberCountOpcode(WorldPacket& recvPacket)
|
void WorldSession::HandleGetChannelMemberCountOpcode(WorldPacket& recvPacket)
|
||||||
|
|
@ -370,5 +404,7 @@ void WorldSession::HandleSetChannelWatchOpcode(WorldPacket& recvPacket)
|
||||||
recvPacket >> channelname;
|
recvPacket >> channelname;
|
||||||
/*if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
/*if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
if(Channel *chn = cMgr->GetChannel(channelname, _player))
|
if(Channel *chn = cMgr->GetChannel(channelname, _player))
|
||||||
chn->JoinNotify(_player->GetGUID());*/
|
{
|
||||||
|
chn->JoinNotify(_player->GetGUID());
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,9 @@ INSTANTIATE_SINGLETON_1(HordeChannelMgr);
|
||||||
ChannelMgr* channelMgr(Team team)
|
ChannelMgr* channelMgr(Team team)
|
||||||
{
|
{
|
||||||
if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
|
if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
|
||||||
|
{
|
||||||
return &MaNGOS::Singleton<AllianceChannelMgr>::Instance(); // cross-faction
|
return &MaNGOS::Singleton<AllianceChannelMgr>::Instance(); // cross-faction
|
||||||
|
}
|
||||||
|
|
||||||
if (team == ALLIANCE)
|
if (team == ALLIANCE)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,10 @@ class CharacterHandler
|
||||||
}
|
}
|
||||||
void HandlePlayerLoginCallback(QueryResult * /*dummy*/, SqlQueryHolder* holder)
|
void HandlePlayerLoginCallback(QueryResult * /*dummy*/, SqlQueryHolder* holder)
|
||||||
{
|
{
|
||||||
if (!holder) return;
|
if (!holder)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
WorldSession* session = sWorld.FindSession(((LoginQueryHolder*)holder)->GetAccountId());
|
WorldSession* session = sWorld.FindSession(((LoginQueryHolder*)holder)->GetAccountId());
|
||||||
if (!session)
|
if (!session)
|
||||||
{
|
{
|
||||||
|
|
@ -228,7 +231,9 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
|
||||||
std::string name = recvData.ReadString(nameLength);
|
std::string name = recvData.ReadString(nameLength);
|
||||||
|
|
||||||
if (unk)
|
if (unk)
|
||||||
|
{
|
||||||
recvData.read_skip<uint32>();
|
recvData.read_skip<uint32>();
|
||||||
|
}
|
||||||
|
|
||||||
WorldPacket data(SMSG_CHAR_CREATE, 1); // returned with diff.values in all cases
|
WorldPacket data(SMSG_CHAR_CREATE, 1); // returned with diff.values in all cases
|
||||||
|
|
||||||
|
|
@ -392,7 +397,9 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
|
||||||
if (acc_class == CLASS_DEATH_KNIGHT)
|
if (acc_class == CLASS_DEATH_KNIGHT)
|
||||||
{
|
{
|
||||||
if (heroic_free_slots > 0)
|
if (heroic_free_slots > 0)
|
||||||
|
{
|
||||||
--heroic_free_slots;
|
--heroic_free_slots;
|
||||||
|
}
|
||||||
|
|
||||||
if (heroic_free_slots == 0)
|
if (heroic_free_slots == 0)
|
||||||
{
|
{
|
||||||
|
|
@ -407,9 +414,11 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
|
||||||
{
|
{
|
||||||
uint32 acc_level = field[0].GetUInt32();
|
uint32 acc_level = field[0].GetUInt32();
|
||||||
if (acc_level >= req_level_for_heroic)
|
if (acc_level >= req_level_for_heroic)
|
||||||
|
{
|
||||||
have_req_level_for_heroic = true;
|
have_req_level_for_heroic = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// need to check team only for first character
|
// need to check team only for first character
|
||||||
// TODO: what to if account already has characters of both races?
|
// TODO: what to if account already has characters of both races?
|
||||||
|
|
@ -429,13 +438,17 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
|
||||||
while ((skipCinematics == CINEMATICS_SKIP_SAME_RACE && !have_same_race) || class_ == CLASS_DEATH_KNIGHT)
|
while ((skipCinematics == CINEMATICS_SKIP_SAME_RACE && !have_same_race) || class_ == CLASS_DEATH_KNIGHT)
|
||||||
{
|
{
|
||||||
if (!result2->NextRow())
|
if (!result2->NextRow())
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
field = result2->Fetch();
|
field = result2->Fetch();
|
||||||
acc_race = field[1].GetUInt32();
|
acc_race = field[1].GetUInt32();
|
||||||
|
|
||||||
if (!have_same_race)
|
if (!have_same_race)
|
||||||
|
{
|
||||||
have_same_race = race_ == acc_race;
|
have_same_race = race_ == acc_race;
|
||||||
|
}
|
||||||
|
|
||||||
if (GetSecurity() == SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
|
if (GetSecurity() == SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
|
||||||
{
|
{
|
||||||
|
|
@ -443,7 +456,9 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
|
||||||
if (acc_class == CLASS_DEATH_KNIGHT)
|
if (acc_class == CLASS_DEATH_KNIGHT)
|
||||||
{
|
{
|
||||||
if (heroic_free_slots > 0)
|
if (heroic_free_slots > 0)
|
||||||
|
{
|
||||||
--heroic_free_slots;
|
--heroic_free_slots;
|
||||||
|
}
|
||||||
|
|
||||||
if (heroic_free_slots == 0)
|
if (heroic_free_slots == 0)
|
||||||
{
|
{
|
||||||
|
|
@ -458,10 +473,12 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
|
||||||
{
|
{
|
||||||
uint32 acc_level = field[0].GetUInt32();
|
uint32 acc_level = field[0].GetUInt32();
|
||||||
if (acc_level >= req_level_for_heroic)
|
if (acc_level >= req_level_for_heroic)
|
||||||
|
{
|
||||||
have_req_level_for_heroic = true;
|
have_req_level_for_heroic = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
delete result2;
|
delete result2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -486,7 +503,9 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((have_same_race && skipCinematics == CINEMATICS_SKIP_SAME_RACE) || skipCinematics == CINEMATICS_SKIP_ALL)
|
if ((have_same_race && skipCinematics == CINEMATICS_SKIP_SAME_RACE) || skipCinematics == CINEMATICS_SKIP_ALL)
|
||||||
|
{
|
||||||
pNewChar->setCinematic(1); // not show intro
|
pNewChar->setCinematic(1); // not show intro
|
||||||
|
}
|
||||||
|
|
||||||
pNewChar->SetAtLoginFlag(AT_LOGIN_FIRST); // First login
|
pNewChar->SetAtLoginFlag(AT_LOGIN_FIRST); // First login
|
||||||
|
|
||||||
|
|
@ -846,34 +865,48 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
|
||||||
if (ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(pCurrChar->getClass()))
|
if (ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(pCurrChar->getClass()))
|
||||||
{
|
{
|
||||||
if (cEntry->CinematicSequence)
|
if (cEntry->CinematicSequence)
|
||||||
|
{
|
||||||
pCurrChar->SendCinematicStart(cEntry->CinematicSequence);
|
pCurrChar->SendCinematicStart(cEntry->CinematicSequence);
|
||||||
|
}
|
||||||
else if (ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(pCurrChar->getRace()))
|
else if (ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(pCurrChar->getRace()))
|
||||||
|
{
|
||||||
pCurrChar->SendCinematicStart(rEntry->CinematicSequence);
|
pCurrChar->SendCinematicStart(rEntry->CinematicSequence);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uint32 miscRequirement = 0;
|
uint32 miscRequirement = 0;
|
||||||
AreaLockStatus lockStatus = AREA_LOCKSTATUS_OK;
|
AreaLockStatus lockStatus = AREA_LOCKSTATUS_OK;
|
||||||
if (AreaTrigger const* at = sObjectMgr.GetMapEntranceTrigger(pCurrChar->GetMapId()))
|
if (AreaTrigger const* at = sObjectMgr.GetMapEntranceTrigger(pCurrChar->GetMapId()))
|
||||||
|
{
|
||||||
lockStatus = pCurrChar->GetAreaTriggerLockStatus(at, pCurrChar->GetDifficulty(pCurrChar->GetMap()->IsRaid()), miscRequirement);
|
lockStatus = pCurrChar->GetAreaTriggerLockStatus(at, pCurrChar->GetDifficulty(pCurrChar->GetMap()->IsRaid()), miscRequirement);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Some basic checks in case of a map without areatrigger
|
// Some basic checks in case of a map without areatrigger
|
||||||
MapEntry const* mapEntry = sMapStore.LookupEntry(pCurrChar->GetMapId());
|
MapEntry const* mapEntry = sMapStore.LookupEntry(pCurrChar->GetMapId());
|
||||||
if (!mapEntry)
|
if (!mapEntry)
|
||||||
|
{
|
||||||
lockStatus = AREA_LOCKSTATUS_UNKNOWN_ERROR;
|
lockStatus = AREA_LOCKSTATUS_UNKNOWN_ERROR;
|
||||||
|
}
|
||||||
else if (pCurrChar->GetSession()->Expansion() < mapEntry->Expansion())
|
else if (pCurrChar->GetSession()->Expansion() < mapEntry->Expansion())
|
||||||
|
{
|
||||||
lockStatus = AREA_LOCKSTATUS_INSUFFICIENT_EXPANSION;
|
lockStatus = AREA_LOCKSTATUS_INSUFFICIENT_EXPANSION;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (lockStatus != AREA_LOCKSTATUS_OK || !pCurrChar->GetMap()->Add(pCurrChar))
|
if (lockStatus != AREA_LOCKSTATUS_OK || !pCurrChar->GetMap()->Add(pCurrChar))
|
||||||
{
|
{
|
||||||
// normal delayed teleport protection not applied (and this correct) for this case (Player object just created)
|
// normal delayed teleport protection not applied (and this correct) for this case (Player object just created)
|
||||||
AreaTrigger const* at = sObjectMgr.GetGoBackTrigger(pCurrChar->GetMapId());
|
AreaTrigger const* at = sObjectMgr.GetGoBackTrigger(pCurrChar->GetMapId());
|
||||||
if (at)
|
if (at)
|
||||||
|
{
|
||||||
lockStatus = pCurrChar->GetAreaTriggerLockStatus(at, pCurrChar->GetDifficulty(pCurrChar->GetMap()->IsRaid()), miscRequirement);
|
lockStatus = pCurrChar->GetAreaTriggerLockStatus(at, pCurrChar->GetDifficulty(pCurrChar->GetMap()->IsRaid()), miscRequirement);
|
||||||
|
}
|
||||||
if (!at || lockStatus != AREA_LOCKSTATUS_OK || !pCurrChar->TeleportTo(at->target_mapId, at->target_X, at->target_Y, at->target_Z, pCurrChar->GetOrientation()))
|
if (!at || lockStatus != AREA_LOCKSTATUS_OK || !pCurrChar->TeleportTo(at->target_mapId, at->target_X, at->target_Y, at->target_Z, pCurrChar->GetOrientation()))
|
||||||
|
{
|
||||||
pCurrChar->TeleportToHomebind();
|
pCurrChar->TeleportToHomebind();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sObjectAccessor.AddObject(pCurrChar);
|
sObjectAccessor.AddObject(pCurrChar);
|
||||||
// DEBUG_LOG("Player %s added to Map.",pCurrChar->GetName());
|
// DEBUG_LOG("Player %s added to Map.",pCurrChar->GetName());
|
||||||
|
|
@ -893,7 +926,9 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
|
||||||
|
|
||||||
// announce group about member online (must be after add to player list to receive announce to self)
|
// announce group about member online (must be after add to player list to receive announce to self)
|
||||||
if (Group* group = pCurrChar->GetGroup())
|
if (Group* group = pCurrChar->GetGroup())
|
||||||
|
{
|
||||||
group->SendUpdate();
|
group->SendUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
// friend status
|
// friend status
|
||||||
sSocialMgr.SendFriendStatus(pCurrChar, FRIEND_ONLINE, pCurrChar->GetObjectGuid(), true);
|
sSocialMgr.SendFriendStatus(pCurrChar, FRIEND_ONLINE, pCurrChar->GetObjectGuid(), true);
|
||||||
|
|
@ -906,7 +941,9 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
|
||||||
{
|
{
|
||||||
// not blizz like, we must correctly save and load player instead...
|
// not blizz like, we must correctly save and load player instead...
|
||||||
if (pCurrChar->getRace() == RACE_NIGHTELF)
|
if (pCurrChar->getRace() == RACE_NIGHTELF)
|
||||||
|
{
|
||||||
pCurrChar->CastSpell(pCurrChar, 20584, true); // auras SPELL_AURA_INCREASE_SPEED(+speed in wisp form), SPELL_AURA_INCREASE_SWIM_SPEED(+swim speed in wisp form), SPELL_AURA_TRANSFORM (to wisp form)
|
pCurrChar->CastSpell(pCurrChar, 20584, true); // auras SPELL_AURA_INCREASE_SPEED(+speed in wisp form), SPELL_AURA_INCREASE_SWIM_SPEED(+swim speed in wisp form), SPELL_AURA_TRANSFORM (to wisp form)
|
||||||
|
}
|
||||||
pCurrChar->CastSpell(pCurrChar, 8326, true); // auras SPELL_AURA_GHOST, SPELL_AURA_INCREASE_SPEED(why?), SPELL_AURA_INCREASE_SWIM_SPEED(why?)
|
pCurrChar->CastSpell(pCurrChar, 8326, true); // auras SPELL_AURA_GHOST, SPELL_AURA_INCREASE_SPEED(why?), SPELL_AURA_INCREASE_SWIM_SPEED(why?)
|
||||||
|
|
||||||
pCurrChar->SetWaterWalk(true);
|
pCurrChar->SetWaterWalk(true);
|
||||||
|
|
@ -916,17 +953,23 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
|
||||||
|
|
||||||
// reset for all pets before pet loading
|
// reset for all pets before pet loading
|
||||||
if (pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
|
if (pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
|
||||||
|
{
|
||||||
Pet::resetTalentsForAllPetsOf(pCurrChar);
|
Pet::resetTalentsForAllPetsOf(pCurrChar);
|
||||||
|
}
|
||||||
|
|
||||||
// Load pet if any (if player not alive and in taxi flight or another then pet will remember as temporary unsummoned)
|
// Load pet if any (if player not alive and in taxi flight or another then pet will remember as temporary unsummoned)
|
||||||
pCurrChar->LoadPet();
|
pCurrChar->LoadPet();
|
||||||
|
|
||||||
// Set FFA PvP for non GM in non-rest mode
|
// Set FFA PvP for non GM in non-rest mode
|
||||||
if (sWorld.IsFFAPvPRealm() && !pCurrChar->isGameMaster() && !pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING))
|
if (sWorld.IsFFAPvPRealm() && !pCurrChar->isGameMaster() && !pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING))
|
||||||
|
{
|
||||||
pCurrChar->SetFFAPvP(true);
|
pCurrChar->SetFFAPvP(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP))
|
if (pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP))
|
||||||
|
{
|
||||||
pCurrChar->SetContestedPvP();
|
pCurrChar->SetContestedPvP();
|
||||||
|
}
|
||||||
|
|
||||||
// Apply at_login requests
|
// Apply at_login requests
|
||||||
if (pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_SPELLS))
|
if (pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_SPELLS))
|
||||||
|
|
@ -945,7 +988,9 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
|
||||||
// Used by Eluna
|
// Used by Eluna
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
if (pCurrChar->HasAtLoginFlag(AT_LOGIN_FIRST))
|
if (pCurrChar->HasAtLoginFlag(AT_LOGIN_FIRST))
|
||||||
|
{
|
||||||
sEluna->OnFirstLogin(pCurrChar);
|
sEluna->OnFirstLogin(pCurrChar);
|
||||||
|
}
|
||||||
#endif /* ENABLE_ELUNA */
|
#endif /* ENABLE_ELUNA */
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -957,28 +1002,38 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
|
||||||
|
|
||||||
/* If the server is shutting down, show shutdown time remaining */
|
/* If the server is shutting down, show shutdown time remaining */
|
||||||
if (sWorld.IsShutdowning())
|
if (sWorld.IsShutdowning())
|
||||||
|
{
|
||||||
sWorld.ShutdownMsg(true, pCurrChar);
|
sWorld.ShutdownMsg(true, pCurrChar);
|
||||||
|
}
|
||||||
|
|
||||||
if (sWorld.getConfig(CONFIG_BOOL_ALL_TAXI_PATHS))
|
if (sWorld.getConfig(CONFIG_BOOL_ALL_TAXI_PATHS))
|
||||||
|
{
|
||||||
pCurrChar->SetTaxiCheater(true);
|
pCurrChar->SetTaxiCheater(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (pCurrChar->isGameMaster())
|
if (pCurrChar->isGameMaster())
|
||||||
|
{
|
||||||
SendNotification(LANG_GM_ON);
|
SendNotification(LANG_GM_ON);
|
||||||
|
}
|
||||||
|
|
||||||
if (!pCurrChar->isGMVisible())
|
if (!pCurrChar->isGMVisible())
|
||||||
{
|
{
|
||||||
SendNotification(LANG_INVISIBLE_INVISIBLE);
|
SendNotification(LANG_INVISIBLE_INVISIBLE);
|
||||||
SpellEntry const* invisibleAuraInfo = sSpellStore.LookupEntry(sWorld.getConfig(CONFIG_UINT32_GM_INVISIBLE_AURA));
|
SpellEntry const* invisibleAuraInfo = sSpellStore.LookupEntry(sWorld.getConfig(CONFIG_UINT32_GM_INVISIBLE_AURA));
|
||||||
if (invisibleAuraInfo && IsSpellAppliesAura(invisibleAuraInfo))
|
if (invisibleAuraInfo && IsSpellAppliesAura(invisibleAuraInfo))
|
||||||
|
{
|
||||||
pCurrChar->CastSpell(pCurrChar, invisibleAuraInfo, true);
|
pCurrChar->CastSpell(pCurrChar, invisibleAuraInfo, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string IP_str = GetRemoteAddress();
|
std::string IP_str = GetRemoteAddress();
|
||||||
sLog.outChar("Account: %d (IP: %s) Login Character:[%s] (guid: %u)",
|
sLog.outChar("Account: %d (IP: %s) Login Character:[%s] (guid: %u)",
|
||||||
GetAccountId(), IP_str.c_str(), pCurrChar->GetName(), pCurrChar->GetGUIDLow());
|
GetAccountId(), IP_str.c_str(), pCurrChar->GetName(), pCurrChar->GetGUIDLow());
|
||||||
|
|
||||||
if (!pCurrChar->IsStandState() && !pCurrChar->hasUnitState(UNIT_STAT_STUNNED))
|
if (!pCurrChar->IsStandState() && !pCurrChar->hasUnitState(UNIT_STAT_STUNNED))
|
||||||
|
{
|
||||||
pCurrChar->SetStandState(UNIT_STAND_STATE_STAND);
|
pCurrChar->SetStandState(UNIT_STAND_STATE_STAND);
|
||||||
|
}
|
||||||
|
|
||||||
m_playerLoading = false;
|
m_playerLoading = false;
|
||||||
|
|
||||||
|
|
@ -1143,8 +1198,10 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(QueryResult* result, uin
|
||||||
if (!session)
|
if (!session)
|
||||||
{
|
{
|
||||||
if (result) delete result;
|
if (result) delete result;
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -1316,7 +1373,9 @@ void WorldSession::HandleAlterAppearanceOpcode(WorldPacket& recv_data)
|
||||||
_player->SetByteValue(PLAYER_BYTES, 3, uint8(Color));
|
_player->SetByteValue(PLAYER_BYTES, 3, uint8(Color));
|
||||||
_player->SetByteValue(PLAYER_BYTES_2, 0, uint8(bs_facialHair->hair_id));
|
_player->SetByteValue(PLAYER_BYTES_2, 0, uint8(bs_facialHair->hair_id));
|
||||||
if (_player->getRace() == RACE_TAUREN)
|
if (_player->getRace() == RACE_TAUREN)
|
||||||
|
{
|
||||||
_player->SetByteValue(PLAYER_BYTES, 0, uint8(skinTone_id));
|
_player->SetByteValue(PLAYER_BYTES, 0, uint8(skinTone_id));
|
||||||
|
}
|
||||||
|
|
||||||
_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_VISIT_BARBER_SHOP, 1);
|
_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_VISIT_BARBER_SHOP, 1);
|
||||||
|
|
||||||
|
|
@ -1467,7 +1526,9 @@ void WorldSession::HandleCharCustomizeOpcode(WorldPacket& recv_data)
|
||||||
data << newname;
|
data << newname;
|
||||||
|
|
||||||
if (!RESPONSE_SUCCESS)
|
if (!RESPONSE_SUCCESS)
|
||||||
|
{
|
||||||
data << newname;
|
data << newname;
|
||||||
|
}
|
||||||
|
|
||||||
SendPacket(&data);
|
SendPacket(&data);
|
||||||
}
|
}
|
||||||
|
|
@ -1558,7 +1619,9 @@ void WorldSession::HandleEquipmentSetUseOpcode(WorldPacket& recv_data)
|
||||||
|
|
||||||
// check if item slot is set to "ignored" (raw value == 1), must not be unequipped then
|
// check if item slot is set to "ignored" (raw value == 1), must not be unequipped then
|
||||||
if (itemGuid.GetRawValue() == 1)
|
if (itemGuid.GetRawValue() == 1)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Item* item = _player->GetItemByGuid(itemGuid);
|
Item* item = _player->GetItemByGuid(itemGuid);
|
||||||
|
|
||||||
|
|
@ -1568,7 +1631,9 @@ void WorldSession::HandleEquipmentSetUseOpcode(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
Item* uItem = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
|
Item* uItem = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
|
||||||
if (!uItem)
|
if (!uItem)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
ItemPosCountVec sDest;
|
ItemPosCountVec sDest;
|
||||||
InventoryResult msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, sDest, uItem, false);
|
InventoryResult msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, sDest, uItem, false);
|
||||||
|
|
@ -1578,13 +1643,17 @@ void WorldSession::HandleEquipmentSetUseOpcode(WorldPacket& recv_data)
|
||||||
_player->StoreItem(sDest, uItem, true);
|
_player->StoreItem(sDest, uItem, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
_player->SendEquipError(msg, uItem, NULL);
|
_player->SendEquipError(msg, uItem, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item->GetPos() == dstpos)
|
if (item->GetPos() == dstpos)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
_player->SwapItem(item->GetPos(), dstpos);
|
_player->SwapItem(item->GetPos(), dstpos);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -917,9 +917,13 @@ bool ChatHandler::HasLowerSecurity(Player* target, ObjectGuid guid, bool strong)
|
||||||
uint32 target_account = 0;
|
uint32 target_account = 0;
|
||||||
|
|
||||||
if (target)
|
if (target)
|
||||||
|
{
|
||||||
target_session = target->GetSession();
|
target_session = target->GetSession();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
target_account = sObjectMgr.GetPlayerAccountIdByGUID(guid);
|
target_account = sObjectMgr.GetPlayerAccountIdByGUID(guid);
|
||||||
|
}
|
||||||
|
|
||||||
if (!target_session && !target_account)
|
if (!target_session && !target_account)
|
||||||
{
|
{
|
||||||
|
|
@ -942,9 +946,13 @@ bool ChatHandler::HasLowerSecurityAccount(WorldSession* target, uint32 target_ac
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target)
|
if (target)
|
||||||
|
{
|
||||||
target_sec = target->GetSecurity();
|
target_sec = target->GetSecurity();
|
||||||
|
}
|
||||||
else if (target_account)
|
else if (target_account)
|
||||||
|
{
|
||||||
target_sec = sAccountMgr.GetSecurity(target_account);
|
target_sec = sAccountMgr.GetSecurity(target_account);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return true; // caller must report error for (target==NULL && target_account==0)
|
return true; // caller must report error for (target==NULL && target_account==0)
|
||||||
|
|
||||||
|
|
@ -1064,7 +1072,9 @@ void ChatHandler::CheckIntegrity(ChatCommand* table, ChatCommand* parentCommand)
|
||||||
command->Name, parentCommand->Name, command->SecurityLevel, parentCommand->SecurityLevel);
|
command->Name, parentCommand->Name, command->SecurityLevel, parentCommand->SecurityLevel);
|
||||||
|
|
||||||
if (!parentCommand && strlen(command->Name) == 0)
|
if (!parentCommand && strlen(command->Name) == 0)
|
||||||
|
{
|
||||||
sLog.outError("Subcommand '' at top level");
|
sLog.outError("Subcommand '' at top level");
|
||||||
|
}
|
||||||
|
|
||||||
if (command->ChildCommands)
|
if (command->ChildCommands)
|
||||||
{
|
{
|
||||||
|
|
@ -1079,7 +1089,9 @@ void ChatHandler::CheckIntegrity(ChatCommand* table, ChatCommand* parentCommand)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parentCommand && strlen(command->Name) == 0)
|
if (parentCommand && strlen(command->Name) == 0)
|
||||||
|
{
|
||||||
sLog.outError("Subcommand '' of command '%s' have subcommands", parentCommand->Name);
|
sLog.outError("Subcommand '' of command '%s' have subcommands", parentCommand->Name);
|
||||||
|
}
|
||||||
|
|
||||||
CheckIntegrity(command->ChildCommands, command);
|
CheckIntegrity(command->ChildCommands, command);
|
||||||
}
|
}
|
||||||
|
|
@ -1160,13 +1172,17 @@ ChatCommandSearchResult ChatHandler::FindCommand(ChatCommand* table, char const*
|
||||||
{
|
{
|
||||||
size_t len = strlen(table[i].Name);
|
size_t len = strlen(table[i].Name);
|
||||||
if (strncmp(table[i].Name, cmd.c_str(), len + 1) != 0)
|
if (strncmp(table[i].Name, cmd.c_str(), len + 1) != 0)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!hasStringAbbr(table[i].Name, cmd.c_str()))
|
if (!hasStringAbbr(table[i].Name, cmd.c_str()))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// select subcommand from child commands list
|
// select subcommand from child commands list
|
||||||
if (table[i].ChildCommands != NULL)
|
if (table[i].ChildCommands != NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -1180,11 +1196,15 @@ ChatCommandSearchResult ChatHandler::FindCommand(ChatCommand* table, char const*
|
||||||
{
|
{
|
||||||
// if subcommand success search not return parent command, then this parent command is owner of child commands
|
// if subcommand success search not return parent command, then this parent command is owner of child commands
|
||||||
if (parentCommand)
|
if (parentCommand)
|
||||||
|
{
|
||||||
*parentCommand = parentSubcommand ? parentSubcommand : &table[i];
|
*parentCommand = parentSubcommand ? parentSubcommand : &table[i];
|
||||||
|
}
|
||||||
|
|
||||||
// Name == "" is special case: restore original command text for next level "" (where parentSubcommand==NULL)
|
// Name == "" is special case: restore original command text for next level "" (where parentSubcommand==NULL)
|
||||||
if (strlen(command->Name) == 0 && !parentSubcommand)
|
if (strlen(command->Name) == 0 && !parentSubcommand)
|
||||||
|
{
|
||||||
text = oldchildtext;
|
text = oldchildtext;
|
||||||
|
}
|
||||||
|
|
||||||
return CHAT_COMMAND_OK;
|
return CHAT_COMMAND_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -1193,7 +1213,9 @@ ChatCommandSearchResult ChatHandler::FindCommand(ChatCommand* table, char const*
|
||||||
// command not found directly in child command list, return child command list owner
|
// command not found directly in child command list, return child command list owner
|
||||||
command = &table[i];
|
command = &table[i];
|
||||||
if (parentCommand)
|
if (parentCommand)
|
||||||
|
{
|
||||||
*parentCommand = NULL; // we don't known parent of table list at this point
|
*parentCommand = NULL; // we don't known parent of table list at this point
|
||||||
|
}
|
||||||
|
|
||||||
text = oldchildtext; // restore text to stated just after parse found parent command
|
text = oldchildtext; // restore text to stated just after parse found parent command
|
||||||
return CHAT_COMMAND_UNKNOWN_SUBCOMMAND; // we not found subcommand for table[i]
|
return CHAT_COMMAND_UNKNOWN_SUBCOMMAND; // we not found subcommand for table[i]
|
||||||
|
|
@ -1203,7 +1225,9 @@ ChatCommandSearchResult ChatHandler::FindCommand(ChatCommand* table, char const*
|
||||||
{
|
{
|
||||||
// some deep subcommand not found, if this second level subcommand then parentCommand can be NULL, use known value for it
|
// some deep subcommand not found, if this second level subcommand then parentCommand can be NULL, use known value for it
|
||||||
if (parentCommand)
|
if (parentCommand)
|
||||||
|
{
|
||||||
*parentCommand = parentSubcommand ? parentSubcommand : &table[i];
|
*parentCommand = parentSubcommand ? parentSubcommand : &table[i];
|
||||||
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1211,21 +1235,29 @@ ChatCommandSearchResult ChatHandler::FindCommand(ChatCommand* table, char const*
|
||||||
|
|
||||||
// must be available (not checked for subcommands case because parent command expected have most low access that all subcommands always
|
// must be available (not checked for subcommands case because parent command expected have most low access that all subcommands always
|
||||||
if (!allAvailable && !isAvailable(table[i]))
|
if (!allAvailable && !isAvailable(table[i]))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// must be have handler is explicitly selected
|
// must be have handler is explicitly selected
|
||||||
if (!table[i].Handler)
|
if (!table[i].Handler)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// command found directly in to table
|
// command found directly in to table
|
||||||
command = &table[i];
|
command = &table[i];
|
||||||
|
|
||||||
// unknown table owner at this point
|
// unknown table owner at this point
|
||||||
if (parentCommand)
|
if (parentCommand)
|
||||||
|
{
|
||||||
*parentCommand = NULL;
|
*parentCommand = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (cmdNamePtr)
|
if (cmdNamePtr)
|
||||||
|
{
|
||||||
*cmdNamePtr = cmd;
|
*cmdNamePtr = cmd;
|
||||||
|
}
|
||||||
|
|
||||||
return CHAT_COMMAND_OK;
|
return CHAT_COMMAND_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -1235,10 +1267,14 @@ ChatCommandSearchResult ChatHandler::FindCommand(ChatCommand* table, char const*
|
||||||
|
|
||||||
// unknown table owner at this point
|
// unknown table owner at this point
|
||||||
if (parentCommand)
|
if (parentCommand)
|
||||||
|
{
|
||||||
*parentCommand = NULL;
|
*parentCommand = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (cmdNamePtr)
|
if (cmdNamePtr)
|
||||||
|
{
|
||||||
*cmdNamePtr = cmd;
|
*cmdNamePtr = cmd;
|
||||||
|
}
|
||||||
|
|
||||||
return CHAT_COMMAND_UNKNOWN;
|
return CHAT_COMMAND_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
@ -1267,8 +1303,10 @@ void ChatHandler::ExecuteCommand(const char* text)
|
||||||
if ((this->*(command->Handler))((char*)text)) // text content destroyed at call
|
if ((this->*(command->Handler))((char*)text)) // text content destroyed at call
|
||||||
{
|
{
|
||||||
if (command->SecurityLevel > SEC_PLAYER)
|
if (command->SecurityLevel > SEC_PLAYER)
|
||||||
|
{
|
||||||
LogCommand(fullcmd.c_str());
|
LogCommand(fullcmd.c_str());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// some commands have custom error messages. Don't send the default one in these cases.
|
// some commands have custom error messages. Don't send the default one in these cases.
|
||||||
else if (!HasSentErrorMessage())
|
else if (!HasSentErrorMessage())
|
||||||
{
|
{
|
||||||
|
|
@ -1368,9 +1406,13 @@ bool ChatHandler::SetDataForCommandInTable(ChatCommand* commandTable, uint32 id,
|
||||||
{
|
{
|
||||||
// command have subcommands, but not '' subcommand and then any data in `command` useless for it.
|
// command have subcommands, but not '' subcommand and then any data in `command` useless for it.
|
||||||
if (cmdName.empty())
|
if (cmdName.empty())
|
||||||
|
{
|
||||||
sLog.outErrorDb("Table `command` have command '%s' that only used with some subcommand selection, it can't have help or overwritten access level, skip.", cmdName.c_str());
|
sLog.outErrorDb("Table `command` have command '%s' that only used with some subcommand selection, it can't have help or overwritten access level, skip.", cmdName.c_str());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
sLog.outErrorDb("Table `command` have unexpected subcommand '%s' in command '%s', skip.", cmdName.c_str(), fullcommand.c_str());
|
sLog.outErrorDb("Table `command` have unexpected subcommand '%s' in command '%s', skip.", cmdName.c_str(), fullcommand.c_str());
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
case CHAT_COMMAND_UNKNOWN:
|
case CHAT_COMMAND_UNKNOWN:
|
||||||
|
|
@ -1416,7 +1458,9 @@ bool ChatHandler::ParseCommands(const char* text)
|
||||||
|
|
||||||
/// skip first . or ! (in console allowed use command with . and ! and without its)
|
/// skip first . or ! (in console allowed use command with . and ! and without its)
|
||||||
if (text[0] == '!' || text[0] == '.')
|
if (text[0] == '!' || text[0] == '.')
|
||||||
|
{
|
||||||
++text;
|
++text;
|
||||||
|
}
|
||||||
|
|
||||||
ExecuteCommand(text);
|
ExecuteCommand(text);
|
||||||
|
|
||||||
|
|
@ -1430,18 +1474,26 @@ bool ChatHandler::ShowHelpForSubCommands(ChatCommand* table, char const* cmd)
|
||||||
{
|
{
|
||||||
// must be available (ignore handler existence for show command with possible available subcommands
|
// must be available (ignore handler existence for show command with possible available subcommands
|
||||||
if (!isAvailable(table[i]))
|
if (!isAvailable(table[i]))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_session)
|
if (m_session)
|
||||||
|
{
|
||||||
list += "\n ";
|
list += "\n ";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
list += "\n\r ";
|
list += "\n\r ";
|
||||||
|
}
|
||||||
|
|
||||||
list += table[i].Name;
|
list += table[i].Name;
|
||||||
|
|
||||||
if (table[i].ChildCommands)
|
if (table[i].ChildCommands)
|
||||||
|
{
|
||||||
list += " ...";
|
list += " ...";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (list.empty())
|
if (list.empty())
|
||||||
{
|
{
|
||||||
|
|
@ -1483,7 +1535,9 @@ bool ChatHandler::ShowHelpForCommand(ChatCommand* table, const char* cmd)
|
||||||
cmd = "";
|
cmd = "";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
showCommand = command;
|
showCommand = command;
|
||||||
|
}
|
||||||
|
|
||||||
childCommands = showCommand->ChildCommands;
|
childCommands = showCommand->ChildCommands;
|
||||||
break;
|
break;
|
||||||
|
|
@ -1521,7 +1575,9 @@ bool ChatHandler::ShowHelpForCommand(ChatCommand* table, const char* cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command && command->Help.empty())
|
if (command && command->Help.empty())
|
||||||
|
{
|
||||||
SendSysMessage(LANG_NO_HELP_CMD);
|
SendSysMessage(LANG_NO_HELP_CMD);
|
||||||
|
}
|
||||||
|
|
||||||
return command || childCommands;
|
return command || childCommands;
|
||||||
}
|
}
|
||||||
|
|
@ -1582,10 +1638,14 @@ bool ChatHandler::isValidChatMessage(const char* message)
|
||||||
if (commandChar == *validSequenceIterator)
|
if (commandChar == *validSequenceIterator)
|
||||||
{
|
{
|
||||||
if (validSequenceIterator == validSequence + 4)
|
if (validSequenceIterator == validSequence + 4)
|
||||||
|
{
|
||||||
validSequenceIterator = validSequence;
|
validSequenceIterator = validSequence;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
++validSequenceIterator;
|
++validSequenceIterator;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (commandChar != '|')
|
else if (commandChar != '|')
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1637,7 +1697,9 @@ bool ChatHandler::isValidChatMessage(const char* message)
|
||||||
|
|
||||||
// no further pipe commands
|
// no further pipe commands
|
||||||
if (reader.eof())
|
if (reader.eof())
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
char commandChar;
|
char commandChar;
|
||||||
reader >> commandChar;
|
reader >> commandChar;
|
||||||
|
|
@ -1648,10 +1710,14 @@ bool ChatHandler::isValidChatMessage(const char* message)
|
||||||
if (commandChar == *validSequenceIterator)
|
if (commandChar == *validSequenceIterator)
|
||||||
{
|
{
|
||||||
if (validSequenceIterator == validSequence + 4)
|
if (validSequenceIterator == validSequence + 4)
|
||||||
|
{
|
||||||
validSequenceIterator = validSequence;
|
validSequenceIterator = validSequence;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
++validSequenceIterator;
|
++validSequenceIterator;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DEBUG_LOG("ChatHandler::isValidChatMessage invalid sequence, expected %c but got %c", *validSequenceIterator, commandChar);
|
DEBUG_LOG("ChatHandler::isValidChatMessage invalid sequence, expected %c but got %c", *validSequenceIterator, commandChar);
|
||||||
|
|
@ -1770,7 +1836,9 @@ bool ChatHandler::isValidChatMessage(const char* message)
|
||||||
propertyId += c - '0';
|
propertyId += c - '0';
|
||||||
}
|
}
|
||||||
else if (c == '-')
|
else if (c == '-')
|
||||||
|
{
|
||||||
negativeNumber = true;
|
negativeNumber = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1778,7 +1846,9 @@ bool ChatHandler::isValidChatMessage(const char* message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (negativeNumber)
|
if (negativeNumber)
|
||||||
|
{
|
||||||
propertyId *= -1;
|
propertyId *= -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (propertyId > 0)
|
if (propertyId > 0)
|
||||||
{
|
{
|
||||||
|
|
@ -2176,7 +2246,9 @@ bool ChatHandler::isValidChatMessage(const char* message)
|
||||||
// using strange database/client combinations can lead to this case
|
// using strange database/client combinations can lead to this case
|
||||||
expectedName = linkedItem->Name1;
|
expectedName = linkedItem->Name1;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
expectedName = il->Name[dbIndex];
|
expectedName = il->Name[dbIndex];
|
||||||
|
}
|
||||||
if (suffix)
|
if (suffix)
|
||||||
{
|
{
|
||||||
expectedName += " ";
|
expectedName += " ";
|
||||||
|
|
@ -2319,9 +2391,13 @@ bool ChatHandler::ExtractInt32(char** args, int32& val)
|
||||||
long valRaw = strtol(*args, &tail, 10);
|
long valRaw = strtol(*args, &tail, 10);
|
||||||
|
|
||||||
if (tail != *args && isWhiteSpace(*tail))
|
if (tail != *args && isWhiteSpace(*tail))
|
||||||
|
{
|
||||||
*(tail++) = '\0';
|
*(tail++) = '\0';
|
||||||
|
}
|
||||||
else if (tail && *tail) // some not whitespace symbol
|
else if (tail && *tail) // some not whitespace symbol
|
||||||
|
{
|
||||||
return false; // args not modified and can be re-parsed
|
return false; // args not modified and can be re-parsed
|
||||||
|
}
|
||||||
|
|
||||||
if (valRaw < std::numeric_limits<int32>::min() || valRaw > std::numeric_limits<int32>::max())
|
if (valRaw < std::numeric_limits<int32>::min() || valRaw > std::numeric_limits<int32>::max())
|
||||||
{
|
{
|
||||||
|
|
@ -2373,9 +2449,13 @@ bool ChatHandler::ExtractUInt32Base(char** args, uint32& val, uint32 base)
|
||||||
unsigned long valRaw = strtoul(*args, &tail, base);
|
unsigned long valRaw = strtoul(*args, &tail, base);
|
||||||
|
|
||||||
if (tail != *args && isWhiteSpace(*tail))
|
if (tail != *args && isWhiteSpace(*tail))
|
||||||
|
{
|
||||||
*(tail++) = '\0';
|
*(tail++) = '\0';
|
||||||
|
}
|
||||||
else if (tail && *tail) // some not whitespace symbol
|
else if (tail && *tail) // some not whitespace symbol
|
||||||
|
{
|
||||||
return false; // args not modified and can be re-parsed
|
return false; // args not modified and can be re-parsed
|
||||||
|
}
|
||||||
|
|
||||||
if (valRaw > std::numeric_limits<uint32>::max())
|
if (valRaw > std::numeric_limits<uint32>::max())
|
||||||
{
|
{
|
||||||
|
|
@ -2409,9 +2489,13 @@ bool ChatHandler::ExtractUInt64(char** args, uint64& val)
|
||||||
unsigned long valRaw = strtoul(*args, &tail, 10);
|
unsigned long valRaw = strtoul(*args, &tail, 10);
|
||||||
|
|
||||||
if (tail != *args && isWhiteSpace(*tail))
|
if (tail != *args && isWhiteSpace(*tail))
|
||||||
|
{
|
||||||
*(tail++) = '\0';
|
*(tail++) = '\0';
|
||||||
|
}
|
||||||
else if (tail && *tail) // some not whitespace symbol
|
else if (tail && *tail) // some not whitespace symbol
|
||||||
|
{
|
||||||
return false; // args not modified and can be re-parsed
|
return false; // args not modified and can be re-parsed
|
||||||
|
}
|
||||||
|
|
||||||
if (valRaw > std::numeric_limits<uint64>::max())
|
if (valRaw > std::numeric_limits<uint64>::max())
|
||||||
{
|
{
|
||||||
|
|
@ -2445,9 +2529,13 @@ bool ChatHandler::ExtractInt64(char** args, int64& val)
|
||||||
long valRaw = strtol(*args, &tail, 10);
|
long valRaw = strtol(*args, &tail, 10);
|
||||||
|
|
||||||
if (tail != *args && isWhiteSpace(*tail))
|
if (tail != *args && isWhiteSpace(*tail))
|
||||||
|
{
|
||||||
*(tail++) = '\0';
|
*(tail++) = '\0';
|
||||||
|
}
|
||||||
else if (tail && *tail) // some not whitespace symbol
|
else if (tail && *tail) // some not whitespace symbol
|
||||||
|
{
|
||||||
return false; // args not modified and can be re-parsed
|
return false; // args not modified and can be re-parsed
|
||||||
|
}
|
||||||
|
|
||||||
if (valRaw < std::numeric_limits<int64>::min() || valRaw > std::numeric_limits<int64>::max())
|
if (valRaw < std::numeric_limits<int64>::min() || valRaw > std::numeric_limits<int64>::max())
|
||||||
{
|
{
|
||||||
|
|
@ -2498,9 +2586,13 @@ bool ChatHandler::ExtractFloat(char** args, float& val)
|
||||||
double valRaw = strtod(*args, &tail);
|
double valRaw = strtod(*args, &tail);
|
||||||
|
|
||||||
if (tail != *args && isWhiteSpace(*tail))
|
if (tail != *args && isWhiteSpace(*tail))
|
||||||
|
{
|
||||||
*(tail++) = '\0';
|
*(tail++) = '\0';
|
||||||
|
}
|
||||||
else if (tail && *tail) // some not whitespace symbol
|
else if (tail && *tail) // some not whitespace symbol
|
||||||
|
{
|
||||||
return false; // args not modified and can be re-parsed
|
return false; // args not modified and can be re-parsed
|
||||||
|
}
|
||||||
|
|
||||||
// value successfully extracted
|
// value successfully extracted
|
||||||
val = float(valRaw);
|
val = float(valRaw);
|
||||||
|
|
@ -2573,7 +2665,9 @@ char* ChatHandler::ExtractLiteralArg(char** args, char const* lit /*= NULL*/)
|
||||||
++largs;
|
++largs;
|
||||||
|
|
||||||
if (largs < l)
|
if (largs < l)
|
||||||
|
{
|
||||||
l = largs;
|
l = largs;
|
||||||
|
}
|
||||||
|
|
||||||
int diff = strncmp(head, lit, l);
|
int diff = strncmp(head, lit, l);
|
||||||
|
|
||||||
|
|
@ -2598,7 +2692,9 @@ char* ChatHandler::ExtractLiteralArg(char** args, char const* lit /*= NULL*/)
|
||||||
*args = head;
|
*args = head;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
*args = head + l;
|
*args = head + l;
|
||||||
|
}
|
||||||
|
|
||||||
SkipWhiteSpaces(args);
|
SkipWhiteSpaces(args);
|
||||||
return arg;
|
return arg;
|
||||||
|
|
@ -2637,7 +2733,9 @@ char* ChatHandler::ExtractQuotedArg(char** args, bool asis /*= false*/)
|
||||||
char guard = (*args)[0];
|
char guard = (*args)[0];
|
||||||
|
|
||||||
if (guard == '[')
|
if (guard == '[')
|
||||||
|
{
|
||||||
guard = ']';
|
guard = ']';
|
||||||
|
}
|
||||||
|
|
||||||
char* tail = (*args) + 1; // start scan after first quote symbol
|
char* tail = (*args) + 1; // start scan after first quote symbol
|
||||||
char* head = asis ? *args : tail; // start arg
|
char* head = asis ? *args : tail; // start arg
|
||||||
|
|
@ -2653,12 +2751,16 @@ char* ChatHandler::ExtractQuotedArg(char** args, bool asis /*= false*/)
|
||||||
if (!tail[1]) // quote is last char in string
|
if (!tail[1]) // quote is last char in string
|
||||||
{
|
{
|
||||||
if (!asis)
|
if (!asis)
|
||||||
|
{
|
||||||
*tail = '\0';
|
*tail = '\0';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else // quote isn't last char
|
else // quote isn't last char
|
||||||
{
|
{
|
||||||
if (asis)
|
if (asis)
|
||||||
|
{
|
||||||
++tail;
|
++tail;
|
||||||
|
}
|
||||||
|
|
||||||
*tail = '\0';
|
*tail = '\0';
|
||||||
}
|
}
|
||||||
|
|
@ -2681,7 +2783,9 @@ char* ChatHandler::ExtractQuotedOrLiteralArg(char** args, bool asis /*= false*/)
|
||||||
{
|
{
|
||||||
char* arg = ExtractQuotedArg(args, asis);
|
char* arg = ExtractQuotedArg(args, asis);
|
||||||
if (!arg)
|
if (!arg)
|
||||||
|
{
|
||||||
arg = ExtractLiteralArg(args);
|
arg = ExtractLiteralArg(args);
|
||||||
|
}
|
||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2701,9 +2805,13 @@ bool ChatHandler::ExtractOnOff(char** args, bool& value)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncmp(arg, "on", 3) == 0)
|
if (strncmp(arg, "on", 3) == 0)
|
||||||
|
{
|
||||||
value = true;
|
value = true;
|
||||||
|
}
|
||||||
else if (strncmp(arg, "off", 4) == 0)
|
else if (strncmp(arg, "off", 4) == 0)
|
||||||
|
{
|
||||||
value = false;
|
value = false;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -2901,10 +3009,14 @@ char* ChatHandler::ExtractLinkArg(char** args, char const* const* linkTypes /*=
|
||||||
// success
|
// success
|
||||||
|
|
||||||
if (*tail) // truncate all link string
|
if (*tail) // truncate all link string
|
||||||
|
{
|
||||||
*(tail++) = '\0';
|
*(tail++) = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
if (foundIdx)
|
if (foundIdx)
|
||||||
|
{
|
||||||
*foundIdx = linktype_idx;
|
*foundIdx = linktype_idx;
|
||||||
|
}
|
||||||
|
|
||||||
if (keyPair)
|
if (keyPair)
|
||||||
{
|
{
|
||||||
|
|
@ -2941,7 +3053,9 @@ char* ChatHandler::ExtractArg(char** args, bool asis /*= false*/)
|
||||||
|
|
||||||
char* arg = ExtractQuotedOrLiteralArg(args, asis);
|
char* arg = ExtractQuotedOrLiteralArg(args, asis);
|
||||||
if (!arg)
|
if (!arg)
|
||||||
|
{
|
||||||
arg = ExtractLinkArg(args);
|
arg = ExtractLinkArg(args);
|
||||||
|
}
|
||||||
|
|
||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
|
|
@ -3024,7 +3138,9 @@ char* ChatHandler::ExtractKeyFromLink(char** text, char const* const* linkTypes,
|
||||||
if (arg)
|
if (arg)
|
||||||
{
|
{
|
||||||
if (found_idx)
|
if (found_idx)
|
||||||
|
{
|
||||||
*found_idx = -1; // special index case
|
*found_idx = -1; // special index case
|
||||||
|
}
|
||||||
|
|
||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
|
|
@ -3149,7 +3265,9 @@ uint32 ChatHandler::ExtractSpellIdFromLink(char** text)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rank < 0) // unlearned talent have in shift-link field -1 as rank
|
if (rank < 0) // unlearned talent have in shift-link field -1 as rank
|
||||||
|
{
|
||||||
rank = 0;
|
rank = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return rank < MAX_TALENT_RANK ? talentEntry->RankID[rank] : 0;
|
return rank < MAX_TALENT_RANK ? talentEntry->RankID[rank] : 0;
|
||||||
}
|
}
|
||||||
|
|
@ -3604,31 +3722,43 @@ bool ChatHandler::ExtractPlayerTarget(char** args, Player** player /*= NULL*/, O
|
||||||
|
|
||||||
// if allowed player pointer
|
// if allowed player pointer
|
||||||
if (player)
|
if (player)
|
||||||
|
{
|
||||||
*player = pl;
|
*player = pl;
|
||||||
|
}
|
||||||
|
|
||||||
// if need guid value from DB (in name case for check player existence)
|
// if need guid value from DB (in name case for check player existence)
|
||||||
ObjectGuid guid = !pl && (player_guid || player_name) ? sObjectMgr.GetPlayerGuidByName(name) : ObjectGuid();
|
ObjectGuid guid = !pl && (player_guid || player_name) ? sObjectMgr.GetPlayerGuidByName(name) : ObjectGuid();
|
||||||
|
|
||||||
// if allowed player guid (if no then only online players allowed)
|
// if allowed player guid (if no then only online players allowed)
|
||||||
if (player_guid)
|
if (player_guid)
|
||||||
|
{
|
||||||
*player_guid = pl ? pl->GetObjectGuid() : guid;
|
*player_guid = pl ? pl->GetObjectGuid() : guid;
|
||||||
|
}
|
||||||
|
|
||||||
if (player_name)
|
if (player_name)
|
||||||
|
{
|
||||||
*player_name = pl || guid ? name : "";
|
*player_name = pl || guid ? name : "";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Player* pl = getSelectedPlayer();
|
Player* pl = getSelectedPlayer();
|
||||||
// if allowed player pointer
|
// if allowed player pointer
|
||||||
if (player)
|
if (player)
|
||||||
|
{
|
||||||
*player = pl;
|
*player = pl;
|
||||||
|
}
|
||||||
// if allowed player guid (if no then only online players allowed)
|
// if allowed player guid (if no then only online players allowed)
|
||||||
if (player_guid)
|
if (player_guid)
|
||||||
|
{
|
||||||
*player_guid = pl ? pl->GetObjectGuid() : ObjectGuid();
|
*player_guid = pl ? pl->GetObjectGuid() : ObjectGuid();
|
||||||
|
}
|
||||||
|
|
||||||
if (player_name)
|
if (player_name)
|
||||||
|
{
|
||||||
*player_name = pl ? pl->GetName() : "";
|
*player_name = pl ? pl->GetName() : "";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// some from req. data must be provided (note: name is empty if player not exist)
|
// some from req. data must be provided (note: name is empty if player not exist)
|
||||||
if ((!player || !*player) && (!player_guid || !*player_guid) && (!player_name || player_name->empty()))
|
if ((!player || !*player) && (!player_guid || !*player_guid) && (!player_name || player_name->empty()))
|
||||||
|
|
@ -3665,10 +3795,14 @@ uint32 ChatHandler::ExtractAccountId(char** args, std::string* accountName /*= N
|
||||||
account_id = targetPlayer->GetSession()->GetAccountId();
|
account_id = targetPlayer->GetSession()->GetAccountId();
|
||||||
|
|
||||||
if (accountName)
|
if (accountName)
|
||||||
|
{
|
||||||
sAccountMgr.GetName(account_id, *accountName);
|
sAccountMgr.GetName(account_id, *accountName);
|
||||||
|
}
|
||||||
|
|
||||||
if (targetIfNullArg)
|
if (targetIfNullArg)
|
||||||
|
{
|
||||||
*targetIfNullArg = targetPlayer;
|
*targetIfNullArg = targetPlayer;
|
||||||
|
}
|
||||||
|
|
||||||
return account_id;
|
return account_id;
|
||||||
}
|
}
|
||||||
|
|
@ -3704,10 +3838,14 @@ uint32 ChatHandler::ExtractAccountId(char** args, std::string* accountName /*= N
|
||||||
}
|
}
|
||||||
|
|
||||||
if (accountName)
|
if (accountName)
|
||||||
|
{
|
||||||
*accountName = account_name;
|
*accountName = account_name;
|
||||||
|
}
|
||||||
|
|
||||||
if (targetIfNullArg)
|
if (targetIfNullArg)
|
||||||
|
{
|
||||||
*targetIfNullArg = NULL;
|
*targetIfNullArg = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return account_id;
|
return account_id;
|
||||||
}
|
}
|
||||||
|
|
@ -3746,8 +3884,10 @@ bool ChatHandler::ExtractRaceMask(char** text, uint32& raceMask, char const** ma
|
||||||
if (ExtractUInt32(text, raceMask))
|
if (ExtractUInt32(text, raceMask))
|
||||||
{
|
{
|
||||||
if (maskName)
|
if (maskName)
|
||||||
|
{
|
||||||
*maskName = "custom mask";
|
*maskName = "custom mask";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (RaceMaskName const* itr = raceMaskNames; itr->literal; ++itr)
|
for (RaceMaskName const* itr = raceMaskNames; itr->literal; ++itr)
|
||||||
|
|
@ -3757,7 +3897,9 @@ bool ChatHandler::ExtractRaceMask(char** text, uint32& raceMask, char const** ma
|
||||||
raceMask = itr->raceMask;
|
raceMask = itr->raceMask;
|
||||||
|
|
||||||
if (maskName)
|
if (maskName)
|
||||||
|
{
|
||||||
*maskName = itr->literal;
|
*maskName = itr->literal;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3853,9 +3995,13 @@ void ChatHandler::ShowNpcOrGoSpawnInformation(uint32 guid)
|
||||||
{
|
{
|
||||||
uint16 top_pool_id = sPoolMgr.IsPartOfTopPool<Pool>(pool_id);
|
uint16 top_pool_id = sPoolMgr.IsPartOfTopPool<Pool>(pool_id);
|
||||||
if (!top_pool_id || top_pool_id == pool_id)
|
if (!top_pool_id || top_pool_id == pool_id)
|
||||||
|
{
|
||||||
PSendSysMessage(LANG_NPC_GO_INFO_POOL, pool_id);
|
PSendSysMessage(LANG_NPC_GO_INFO_POOL, pool_id);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
PSendSysMessage(LANG_NPC_GO_INFO_TOP_POOL, pool_id, top_pool_id);
|
PSendSysMessage(LANG_NPC_GO_INFO_TOP_POOL, pool_id, top_pool_id);
|
||||||
|
}
|
||||||
|
|
||||||
if (int16 event_id = sGameEventMgr.GetGameEventId<Pool>(top_pool_id))
|
if (int16 event_id = sGameEventMgr.GetGameEventId<Pool>(top_pool_id))
|
||||||
{
|
{
|
||||||
|
|
@ -3863,21 +4009,29 @@ void ChatHandler::ShowNpcOrGoSpawnInformation(uint32 guid)
|
||||||
GameEventData const& eventData = events[std::abs(event_id)];
|
GameEventData const& eventData = events[std::abs(event_id)];
|
||||||
|
|
||||||
if (event_id > 0)
|
if (event_id > 0)
|
||||||
|
{
|
||||||
PSendSysMessage(LANG_NPC_GO_INFO_POOL_GAME_EVENT_S, top_pool_id, std::abs(event_id), eventData.description.c_str());
|
PSendSysMessage(LANG_NPC_GO_INFO_POOL_GAME_EVENT_S, top_pool_id, std::abs(event_id), eventData.description.c_str());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
PSendSysMessage(LANG_NPC_GO_INFO_POOL_GAME_EVENT_D, top_pool_id, std::abs(event_id), eventData.description.c_str());
|
PSendSysMessage(LANG_NPC_GO_INFO_POOL_GAME_EVENT_D, top_pool_id, std::abs(event_id), eventData.description.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (int16 event_id = sGameEventMgr.GetGameEventId<T>(guid))
|
else if (int16 event_id = sGameEventMgr.GetGameEventId<T>(guid))
|
||||||
{
|
{
|
||||||
GameEventMgr::GameEventDataMap const& events = sGameEventMgr.GetEventMap();
|
GameEventMgr::GameEventDataMap const& events = sGameEventMgr.GetEventMap();
|
||||||
GameEventData const& eventData = events[std::abs(event_id)];
|
GameEventData const& eventData = events[std::abs(event_id)];
|
||||||
|
|
||||||
if (event_id > 0)
|
if (event_id > 0)
|
||||||
|
{
|
||||||
PSendSysMessage(LANG_NPC_GO_INFO_GAME_EVENT_S, std::abs(event_id), eventData.description.c_str());
|
PSendSysMessage(LANG_NPC_GO_INFO_GAME_EVENT_S, std::abs(event_id), eventData.description.c_str());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
PSendSysMessage(LANG_NPC_GO_INFO_GAME_EVENT_D, std::abs(event_id), eventData.description.c_str());
|
PSendSysMessage(LANG_NPC_GO_INFO_GAME_EVENT_D, std::abs(event_id), eventData.description.c_str());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare ShortString for a NPC or GO (by guid) with pool or game event IDs
|
// Prepare ShortString for a NPC or GO (by guid) with pool or game event IDs
|
||||||
|
|
@ -4003,7 +4157,9 @@ void ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg msgtype, char const
|
||||||
data << addonPrefix;
|
data << addonPrefix;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
data << ObjectGuid(targetGuid);
|
data << ObjectGuid(targetGuid);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
MANGOS_ASSERT(message);
|
MANGOS_ASSERT(message);
|
||||||
|
|
@ -4012,7 +4168,9 @@ void ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg msgtype, char const
|
||||||
data << uint8(chatTag);
|
data << uint8(chatTag);
|
||||||
|
|
||||||
if (isAchievement)
|
if (isAchievement)
|
||||||
|
{
|
||||||
data << uint32(achievementId);
|
data << uint32(achievementId);
|
||||||
|
}
|
||||||
|
|
||||||
if (msgtype == CHAT_MSG_RAID_BOSS_WHISPER || msgtype == CHAT_MSG_RAID_BOSS_EMOTE)
|
if (msgtype == CHAT_MSG_RAID_BOSS_WHISPER || msgtype == CHAT_MSG_RAID_BOSS_EMOTE)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,9 @@ bool WorldSession::processChatmessageFurtherAfterSecurityChecks(std::string& msg
|
||||||
{
|
{
|
||||||
// strip invisible characters for non-addon messages
|
// strip invisible characters for non-addon messages
|
||||||
if (sWorld.getConfig(CONFIG_BOOL_CHAT_FAKE_MESSAGE_PREVENTING))
|
if (sWorld.getConfig(CONFIG_BOOL_CHAT_FAKE_MESSAGE_PREVENTING))
|
||||||
|
{
|
||||||
stripLineInvisibleChars(msg);
|
stripLineInvisibleChars(msg);
|
||||||
|
}
|
||||||
|
|
||||||
if (sWorld.getConfig(CONFIG_UINT32_CHAT_STRICT_LINK_CHECKING_SEVERITY) && GetSecurity() < SEC_MODERATOR
|
if (sWorld.getConfig(CONFIG_UINT32_CHAT_STRICT_LINK_CHECKING_SEVERITY) && GetSecurity() < SEC_MODERATOR
|
||||||
&& !ChatHandler(this).isValidChatMessage(msg.c_str()))
|
&& !ChatHandler(this).isValidChatMessage(msg.c_str()))
|
||||||
|
|
@ -58,7 +60,9 @@ bool WorldSession::processChatmessageFurtherAfterSecurityChecks(std::string& msg
|
||||||
sLog.outError("Player %s (GUID: %u) sent a chatmessage with an invalid link: %s", GetPlayer()->GetName(),
|
sLog.outError("Player %s (GUID: %u) sent a chatmessage with an invalid link: %s", GetPlayer()->GetName(),
|
||||||
GetPlayer()->GetGUIDLow(), msg.c_str());
|
GetPlayer()->GetGUIDLow(), msg.c_str());
|
||||||
if (sWorld.getConfig(CONFIG_UINT32_CHAT_STRICT_LINK_CHECKING_KICK))
|
if (sWorld.getConfig(CONFIG_UINT32_CHAT_STRICT_LINK_CHECKING_KICK))
|
||||||
|
{
|
||||||
KickPlayer();
|
KickPlayer();
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -137,12 +141,16 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
// send in universal language if player in .gmon mode (ignore spell effects)
|
// send in universal language if player in .gmon mode (ignore spell effects)
|
||||||
if (_player->isGameMaster())
|
if (_player->isGameMaster())
|
||||||
|
{
|
||||||
lang = LANG_UNIVERSAL;
|
lang = LANG_UNIVERSAL;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// send in universal language in two side iteration allowed mode
|
// send in universal language in two side iteration allowed mode
|
||||||
if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHAT))
|
if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHAT))
|
||||||
|
{
|
||||||
lang = LANG_UNIVERSAL;
|
lang = LANG_UNIVERSAL;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
|
|
@ -154,13 +162,17 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
case CHAT_MSG_RAID_WARNING:
|
case CHAT_MSG_RAID_WARNING:
|
||||||
// allow two side chat at group channel if two side group allowed
|
// allow two side chat at group channel if two side group allowed
|
||||||
if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GROUP))
|
if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GROUP))
|
||||||
|
{
|
||||||
lang = LANG_UNIVERSAL;
|
lang = LANG_UNIVERSAL;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CHAT_MSG_GUILD:
|
case CHAT_MSG_GUILD:
|
||||||
case CHAT_MSG_OFFICER:
|
case CHAT_MSG_OFFICER:
|
||||||
// allow two side chat at guild channel if two side guild allowed
|
// allow two side chat at guild channel if two side guild allowed
|
||||||
if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GUILD))
|
if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GUILD))
|
||||||
|
{
|
||||||
lang = LANG_UNIVERSAL;
|
lang = LANG_UNIVERSAL;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -168,8 +180,10 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
// but overwrite it by SPELL_AURA_MOD_LANGUAGE auras (only single case used)
|
// but overwrite it by SPELL_AURA_MOD_LANGUAGE auras (only single case used)
|
||||||
Unit::AuraList const& ModLangAuras = _player->GetAurasByType(SPELL_AURA_MOD_LANGUAGE);
|
Unit::AuraList const& ModLangAuras = _player->GetAurasByType(SPELL_AURA_MOD_LANGUAGE);
|
||||||
if (!ModLangAuras.empty())
|
if (!ModLangAuras.empty())
|
||||||
|
{
|
||||||
lang = ModLangAuras.front()->GetModifier()->m_miscvalue;
|
lang = ModLangAuras.front()->GetModifier()->m_miscvalue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (type != CHAT_MSG_AFK && type != CHAT_MSG_DND)
|
if (type != CHAT_MSG_AFK && type != CHAT_MSG_DND)
|
||||||
{
|
{
|
||||||
|
|
@ -185,7 +199,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
lang = LANG_UNIVERSAL;
|
lang = LANG_UNIVERSAL;
|
||||||
|
}
|
||||||
|
|
||||||
DEBUG_LOG("CHAT: packet received. type %u lang %u", type, lang);
|
DEBUG_LOG("CHAT: packet received. type %u lang %u", type, lang);
|
||||||
|
|
||||||
|
|
@ -199,10 +215,14 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
msg = recv_data.ReadString(recv_data.ReadBits(9));
|
msg = recv_data.ReadString(recv_data.ReadBits(9));
|
||||||
|
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (ChatHandler(this).ParseCommands(msg.c_str()))
|
if (ChatHandler(this).ParseCommands(msg.c_str()))
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||||
{
|
{
|
||||||
|
|
@ -210,7 +230,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (type == CHAT_MSG_SAY)
|
if (type == CHAT_MSG_SAY)
|
||||||
{
|
{
|
||||||
|
|
@ -265,12 +287,16 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!normalizePlayerName(to))
|
if (!normalizePlayerName(to))
|
||||||
{
|
{
|
||||||
SendPlayerNotFoundNotice(to);
|
SendPlayerNotFoundNotice(to);
|
||||||
{ break; }
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Player* player = sObjectMgr.GetPlayer(to.c_str());
|
Player* player = sObjectMgr.GetPlayer(to.c_str());
|
||||||
|
|
@ -308,10 +334,14 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
msg = recv_data.ReadString(recv_data.ReadBits(9));
|
msg = recv_data.ReadString(recv_data.ReadBits(9));
|
||||||
|
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (ChatHandler(this).ParseCommands(msg.c_str()))
|
if (ChatHandler(this).ParseCommands(msg.c_str()))
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||||
{
|
{
|
||||||
|
|
@ -319,7 +349,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// if player is in battleground, he cannot say to battleground members by /p
|
// if player is in battleground, he cannot say to battleground members by /p
|
||||||
Group* group = GetPlayer()->GetOriginalGroup();
|
Group* group = GetPlayer()->GetOriginalGroup();
|
||||||
|
|
@ -356,10 +388,14 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
msg = recv_data.ReadString(recv_data.ReadBits(9));
|
msg = recv_data.ReadString(recv_data.ReadBits(9));
|
||||||
|
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (ChatHandler(this).ParseCommands(msg.c_str()))
|
if (ChatHandler(this).ParseCommands(msg.c_str()))
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||||
{
|
{
|
||||||
|
|
@ -367,7 +403,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (GetPlayer()->GetGuildId())
|
if (GetPlayer()->GetGuildId())
|
||||||
if (Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId()))
|
if (Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId()))
|
||||||
|
|
@ -391,10 +429,14 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
msg = recv_data.ReadString(recv_data.ReadBits(9));
|
msg = recv_data.ReadString(recv_data.ReadBits(9));
|
||||||
|
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (ChatHandler(this).ParseCommands(msg.c_str()))
|
if (ChatHandler(this).ParseCommands(msg.c_str()))
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||||
{
|
{
|
||||||
|
|
@ -402,7 +444,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (GetPlayer()->GetGuildId())
|
if (GetPlayer()->GetGuildId())
|
||||||
if (Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId()))
|
if (Guild* guild = sGuildMgr.GetGuildById(GetPlayer()->GetGuildId()))
|
||||||
|
|
@ -426,10 +470,14 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
msg = recv_data.ReadString(recv_data.ReadBits(9));
|
msg = recv_data.ReadString(recv_data.ReadBits(9));
|
||||||
|
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (ChatHandler(this).ParseCommands(msg.c_str()))
|
if (ChatHandler(this).ParseCommands(msg.c_str()))
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||||
{
|
{
|
||||||
|
|
@ -437,7 +485,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// if player is in battleground, he cannot say to battleground members by /ra
|
// if player is in battleground, he cannot say to battleground members by /ra
|
||||||
Group* group = GetPlayer()->GetOriginalGroup();
|
Group* group = GetPlayer()->GetOriginalGroup();
|
||||||
|
|
@ -468,10 +518,14 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
msg = recv_data.ReadString(recv_data.ReadBits(9));
|
msg = recv_data.ReadString(recv_data.ReadBits(9));
|
||||||
|
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (ChatHandler(this).ParseCommands(msg.c_str()))
|
if (ChatHandler(this).ParseCommands(msg.c_str()))
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||||
{
|
{
|
||||||
|
|
@ -479,7 +533,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// if player is in battleground, he cannot say to battleground members by /ra
|
// if player is in battleground, he cannot say to battleground members by /ra
|
||||||
Group* group = GetPlayer()->GetOriginalGroup();
|
Group* group = GetPlayer()->GetOriginalGroup();
|
||||||
|
|
@ -516,7 +572,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
Group* group = GetPlayer()->GetGroup();
|
Group* group = GetPlayer()->GetGroup();
|
||||||
if (!group || !group->isRaidGroup() ||
|
if (!group || !group->isRaidGroup() ||
|
||||||
|
|
@ -548,7 +606,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// battleground raid is always in Player->GetGroup(), never in GetOriginalGroup()
|
// battleground raid is always in Player->GetGroup(), never in GetOriginalGroup()
|
||||||
Group* group = GetPlayer()->GetGroup();
|
Group* group = GetPlayer()->GetGroup();
|
||||||
|
|
@ -581,7 +641,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// battleground raid is always in Player->GetGroup(), never in GetOriginalGroup()
|
// battleground raid is always in Player->GetGroup(), never in GetOriginalGroup()
|
||||||
Group* group = GetPlayer()->GetGroup();
|
Group* group = GetPlayer()->GetGroup();
|
||||||
|
|
@ -617,7 +679,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
{
|
{
|
||||||
|
|
@ -646,16 +710,22 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
if (_player->isAFK()) // Already AFK
|
if (_player->isAFK()) // Already AFK
|
||||||
{
|
{
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
|
{
|
||||||
_player->ToggleAFK(); // Remove AFK
|
_player->ToggleAFK(); // Remove AFK
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
_player->autoReplyMsg = msg; // Update message
|
_player->autoReplyMsg = msg; // Update message
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else // New AFK mode
|
else // New AFK mode
|
||||||
{
|
{
|
||||||
_player->autoReplyMsg = msg.empty() ? GetMangosString(LANG_PLAYER_AFK_DEFAULT) : msg;
|
_player->autoReplyMsg = msg.empty() ? GetMangosString(LANG_PLAYER_AFK_DEFAULT) : msg;
|
||||||
|
|
||||||
if (_player->isDND())
|
if (_player->isDND())
|
||||||
|
{
|
||||||
_player->ToggleDND();
|
_player->ToggleDND();
|
||||||
|
}
|
||||||
|
|
||||||
_player->ToggleAFK();
|
_player->ToggleAFK();
|
||||||
}
|
}
|
||||||
|
|
@ -677,16 +747,22 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
if (_player->isDND()) // Already DND
|
if (_player->isDND()) // Already DND
|
||||||
{
|
{
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
|
{
|
||||||
_player->ToggleDND(); // Remove DND
|
_player->ToggleDND(); // Remove DND
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
_player->autoReplyMsg = msg; // Update message
|
_player->autoReplyMsg = msg; // Update message
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else // New DND mode
|
else // New DND mode
|
||||||
{
|
{
|
||||||
_player->autoReplyMsg = msg.empty() ? GetMangosString(LANG_PLAYER_DND_DEFAULT) : msg;
|
_player->autoReplyMsg = msg.empty() ? GetMangosString(LANG_PLAYER_DND_DEFAULT) : msg;
|
||||||
|
|
||||||
if (_player->isAFK())
|
if (_player->isAFK())
|
||||||
|
{
|
||||||
_player->ToggleAFK();
|
_player->ToggleAFK();
|
||||||
|
}
|
||||||
|
|
||||||
_player->ToggleDND();
|
_player->ToggleDND();
|
||||||
}
|
}
|
||||||
|
|
@ -760,7 +836,9 @@ void WorldSession::HandleAddonMessagechatOpcode(WorldPacket& recv_data)
|
||||||
|
|
||||||
if (_player->GetGuildId())
|
if (_player->GetGuildId())
|
||||||
if (Guild* guild = sGuildMgr.GetGuildById(_player->GetGuildId()))
|
if (Guild* guild = sGuildMgr.GetGuildById(_player->GetGuildId()))
|
||||||
|
{
|
||||||
guild->BroadcastAddonToGuild(this, msg, prefix);
|
guild->BroadcastAddonToGuild(this, msg, prefix);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -773,7 +851,9 @@ void WorldSession::HandleAddonMessagechatOpcode(WorldPacket& recv_data)
|
||||||
|
|
||||||
if (_player->GetGuildId())
|
if (_player->GetGuildId())
|
||||||
if (Guild* guild = sGuildMgr.GetGuildById(_player->GetGuildId()))
|
if (Guild* guild = sGuildMgr.GetGuildById(_player->GetGuildId()))
|
||||||
|
{
|
||||||
guild->BroadcastAddonToOfficers(this, msg, prefix);
|
guild->BroadcastAddonToOfficers(this, msg, prefix);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CHAT_MSG_WHISPER:
|
case CHAT_MSG_WHISPER:
|
||||||
|
|
@ -786,11 +866,15 @@ void WorldSession::HandleAddonMessagechatOpcode(WorldPacket& recv_data)
|
||||||
std::string targetName = recv_data.ReadString(targetLen);
|
std::string targetName = recv_data.ReadString(targetLen);
|
||||||
|
|
||||||
if (!normalizePlayerName(targetName))
|
if (!normalizePlayerName(targetName))
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
Player* receiver = sObjectMgr.GetPlayer(targetName.c_str());
|
Player* receiver = sObjectMgr.GetPlayer(targetName.c_str());
|
||||||
if (!receiver)
|
if (!receiver)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
ChatHandler::BuildChatPacket(data, type, msg.c_str(), LANG_UNIVERSAL, CHAT_TAG_NONE, ObjectGuid(), NULL, receiver->GetObjectGuid(), targetName.c_str(), NULL, 0, prefix.c_str());
|
ChatHandler::BuildChatPacket(data, type, msg.c_str(), LANG_UNIVERSAL, CHAT_TAG_NONE, ObjectGuid(), NULL, receiver->GetObjectGuid(), targetName.c_str(), NULL, 0, prefix.c_str());
|
||||||
|
|
@ -808,7 +892,9 @@ void WorldSession::HandleAddonMessagechatOpcode(WorldPacket& recv_data)
|
||||||
|
|
||||||
Group* group = _player->GetGroup();
|
Group* group = _player->GetGroup();
|
||||||
if (!group || group->isBGGroup())
|
if (!group || group->isBGGroup())
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
ChatHandler::BuildChatPacket(data, type, msg.c_str(), LANG_ADDON, CHAT_TAG_NONE, ObjectGuid(), NULL, ObjectGuid(), NULL, NULL, 0, prefix.c_str());
|
ChatHandler::BuildChatPacket(data, type, msg.c_str(), LANG_ADDON, CHAT_TAG_NONE, ObjectGuid(), NULL, ObjectGuid(), NULL, NULL, 0, prefix.c_str());
|
||||||
|
|
@ -859,9 +945,13 @@ namespace MaNGOS
|
||||||
data << uint32(i_emote_num);
|
data << uint32(i_emote_num);
|
||||||
data << uint32(namlen);
|
data << uint32(namlen);
|
||||||
if (namlen > 1)
|
if (namlen > 1)
|
||||||
|
{
|
||||||
data.append(nam, namlen);
|
data.append(nam, namlen);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
data << uint8(0x00);
|
data << uint8(0x00);
|
||||||
|
}
|
||||||
|
|
||||||
DEBUG_LOG("SMSG_TEXT_EMOTE i_text_emote %u i_emote_num %u",
|
DEBUG_LOG("SMSG_TEXT_EMOTE i_text_emote %u i_emote_num %u",
|
||||||
i_text_emote, i_emote_num);
|
i_text_emote, i_emote_num);
|
||||||
|
|
@ -923,7 +1013,9 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
// in feign death state allowed only text emotes.
|
// in feign death state allowed only text emotes.
|
||||||
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
GetPlayer()->HandleEmoteCommand(emote_id);
|
GetPlayer()->HandleEmoteCommand(emote_id);
|
||||||
break;
|
break;
|
||||||
|
|
@ -941,7 +1033,9 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket& recv_data)
|
||||||
|
|
||||||
// Send scripted event call
|
// Send scripted event call
|
||||||
if (unit && unit->GetTypeId() == TYPEID_UNIT && ((Creature*)unit)->AI())
|
if (unit && unit->GetTypeId() == TYPEID_UNIT && ((Creature*)unit)->AI())
|
||||||
|
{
|
||||||
((Creature*)unit)->AI()->ReceiveEmote(GetPlayer(), text_emote);
|
((Creature*)unit)->AI()->ReceiveEmote(GetPlayer(), text_emote);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recv_data)
|
void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recv_data)
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue