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::string 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::string 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 Exclusion " SIZEFMTD " items", excludeItems.size());
|
||||
|
|
@ -1492,16 +1496,24 @@ bool AuctionBotSeller::Initialize()
|
|||
{
|
||||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_MISC_MOUNT_MIN_REQ_LEVEL))
|
||||
if (prototype->RequiredLevel < value)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_MISC_MOUNT_MAX_REQ_LEVEL))
|
||||
if (prototype->RequiredLevel > value)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_MISC_MOUNT_MIN_SKILL_RANK))
|
||||
if (prototype->RequiredSkillRank < value)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_MISC_MOUNT_MAX_SKILL_RANK))
|
||||
if (prototype->RequiredSkillRank > value)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
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 (prototype->RequiredLevel < value)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_GLYPH_MAX_REQ_LEVEL))
|
||||
if (prototype->RequiredLevel > value)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_GLYPH_MIN_ITEM_LEVEL))
|
||||
if (prototype->RequiredLevel < value)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_GLYPH_MAX_ITEM_LEVEL))
|
||||
if (prototype->RequiredLevel > value)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ITEM_CLASS_TRADE_GOODS:
|
||||
|
|
@ -2177,7 +2197,9 @@ void AuctionHouseBot::Rebuild(bool all)
|
|||
AuctionEntry* entry = itr->second;
|
||||
if (entry->owner == sAuctionBotConfig.GetAHBotId()) // ahbot auction
|
||||
if (all || entry->bid == 0) // expire auction now if no bid or forced
|
||||
{
|
||||
entry->expireTime = sWorld.GetGameTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -443,12 +443,16 @@ void BattleGround::Update(uint32 diff)
|
|||
|
||||
for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
if (Player* player = sObjectMgr.GetPlayer(itr->first))
|
||||
{
|
||||
player->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
m_CountdownTimer = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_CountdownTimer += diff;
|
||||
}
|
||||
|
||||
if (!(m_Events & BG_STARTING_EVENT_1))
|
||||
{
|
||||
|
|
@ -491,7 +495,9 @@ void BattleGround::Update(uint32 diff)
|
|||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
if (Player* player = sObjectMgr.GetPlayer(itr->first))
|
||||
{
|
||||
player->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION);
|
||||
}
|
||||
}
|
||||
|
||||
CheckArenaWinConditions();
|
||||
|
|
@ -502,7 +508,9 @@ void BattleGround::Update(uint32 diff)
|
|||
|
||||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
if (Player* plr = sObjectMgr.GetPlayer(itr->first))
|
||||
{
|
||||
plr->RemoveAurasDueToSpell(SPELL_PREPARATION);
|
||||
}
|
||||
// Announce BG starting
|
||||
if (sWorld.getConfig(CONFIG_BOOL_BATTLEGROUND_QUEUE_ANNOUNCER_START))
|
||||
{
|
||||
|
|
@ -922,9 +930,13 @@ void BattleGround::EndBattleGround(Team winner)
|
|||
if (isArena() && isRated() && winner_arena_team && loser_arena_team)
|
||||
{
|
||||
if (team == winner)
|
||||
{
|
||||
winner_arena_team->OfflineMemberLost(itr->first, loser_rating);
|
||||
}
|
||||
else
|
||||
{
|
||||
loser_arena_team->OfflineMemberLost(itr->first, winner_rating);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
|
@ -965,7 +977,9 @@ void BattleGround::EndBattleGround(Team winner)
|
|||
// update achievement BEFORE personal rating update
|
||||
ArenaTeamMember* member = winner_arena_team->GetMember(plr->GetObjectGuid());
|
||||
if (member)
|
||||
{
|
||||
plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, member->personal_rating);
|
||||
}
|
||||
|
||||
winner_arena_team->MemberWon(plr, loser_rating);
|
||||
plr->ModifyCurrencyCount(CURRENCY_CONQUEST_ARENA_META, sWorld.getConfig(CONFIG_UINT32_CURRENCY_ARENA_CONQUEST_POINTS_REWARD));
|
||||
|
|
@ -1344,7 +1358,9 @@ void BattleGround::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool Sen
|
|||
ArenaTeam* winner_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
|
||||
ArenaTeam* loser_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(team));
|
||||
if (winner_arena_team && loser_arena_team)
|
||||
{
|
||||
loser_arena_team->MemberLost(plr, winner_arena_team->GetRating());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (SendPacket)
|
||||
|
|
@ -1366,7 +1382,9 @@ void BattleGround::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool Sen
|
|||
ArenaTeam* others_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
|
||||
ArenaTeam* players_arena_team = sObjectMgr.GetArenaTeamById(GetArenaTeamIdForTeam(team));
|
||||
if (others_arena_team && players_arena_team)
|
||||
{
|
||||
players_arena_team->OfflineMemberLost(guid, others_arena_team->GetRating());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1476,7 +1494,9 @@ void BattleGround::StartTimedAchievement(AchievementCriteriaTypes type, uint32 e
|
|||
{
|
||||
for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
if (Player* pPlayer = GetBgMap()->GetPlayer(itr->first))
|
||||
{
|
||||
pPlayer->GetAchievementMgr().StartTimedAchievementCriteria(type, entry);
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGround::AddPlayer(Player* plr)
|
||||
|
|
@ -1514,30 +1534,42 @@ void BattleGround::AddPlayer(Player* plr)
|
|||
if (team == ALLIANCE) // gold
|
||||
{
|
||||
if (plr->GetTeam() == HORDE)
|
||||
{
|
||||
plr->CastSpell(plr, SPELL_HORDE_GOLD_FLAG, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
plr->CastSpell(plr, SPELL_ALLIANCE_GOLD_FLAG, true);
|
||||
}
|
||||
}
|
||||
else // green
|
||||
{
|
||||
if (plr->GetTeam() == HORDE)
|
||||
{
|
||||
plr->CastSpell(plr, SPELL_HORDE_GREEN_FLAG, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
plr->CastSpell(plr, SPELL_ALLIANCE_GREEN_FLAG, true);
|
||||
}
|
||||
}
|
||||
|
||||
plr->DestroyConjuredItems(true);
|
||||
plr->UnsummonPetTemporaryIfAny();
|
||||
|
||||
if (GetStatus() == STATUS_WAIT_JOIN) // not started yet
|
||||
{
|
||||
plr->CastSpell(plr, SPELL_ARENA_PREPARATION, true);
|
||||
}
|
||||
|
||||
plr->CastSpell(plr, SPELL_ARENA_DAMPENING, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetStatus() == STATUS_WAIT_JOIN) // not started yet
|
||||
{
|
||||
plr->CastSpell(plr, SPELL_PREPARATION, true); // reduces all mana cost of spells.
|
||||
}
|
||||
|
||||
plr->CastSpell(plr, SPELL_BATTLEGROUND_DAMPENING, true);
|
||||
}
|
||||
|
|
@ -1636,7 +1668,9 @@ void BattleGround::EventPlayerLoggedOut(Player* player)
|
|||
// 1 player is logging out, if it is the last, then end arena!
|
||||
if (isArena())
|
||||
if (GetAlivePlayersCountByTeam(player->GetTeam()) <= 1 && GetPlayersCountByTeam(GetOtherTeam(player->GetTeam())))
|
||||
{
|
||||
EndBattleGround(GetOtherTeam(player->GetTeam()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1729,7 +1763,9 @@ void BattleGround::UpdatePlayerScore(Player* Source, uint32 type, uint32 value)
|
|||
{
|
||||
// reward honor instantly
|
||||
if (Source->RewardHonor(NULL, 1, (float)value))
|
||||
{
|
||||
itr->second->BonusHonor += value;
|
||||
}
|
||||
}
|
||||
break;
|
||||
// used only in EY, but in MSG_PVP_LOG_DATA opcode
|
||||
|
|
@ -1917,7 +1953,9 @@ void BattleGround::SpawnEvent(uint8 event1, uint8 event2, bool spawn)
|
|||
// or despawn something which was already despawned
|
||||
if (event2 == BG_EVENT_NONE || (spawn && m_ActiveEvents[event1] == event2)
|
||||
|| (!spawn && m_ActiveEvents[event1] != event2))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (spawn)
|
||||
{
|
||||
|
|
@ -1926,7 +1964,9 @@ void BattleGround::SpawnEvent(uint8 event1, uint8 event2, bool spawn)
|
|||
m_ActiveEvents[event1] = event2; // set this event to active
|
||||
}
|
||||
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();
|
||||
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
|
||||
if (!isArena())
|
||||
{
|
||||
player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -2231,9 +2273,13 @@ uint32 BattleGround::GetAlivePlayersCountByTeam(Team team) const
|
|||
void BattleGround::CheckArenaWinConditions()
|
||||
{
|
||||
if (!GetAlivePlayersCountByTeam(ALLIANCE) && GetPlayersCountByTeam(HORDE))
|
||||
{
|
||||
EndBattleGround(HORDE);
|
||||
}
|
||||
else if (GetPlayersCountByTeam(ALLIANCE) && !GetAlivePlayersCountByTeam(HORDE))
|
||||
{
|
||||
EndBattleGround(ALLIANCE);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -175,7 +175,9 @@ 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
|
||||
uint8 otherTeam = (team + 1) % PVP_TEAM_COUNT;
|
||||
if (m_TeamScores[team] > m_TeamScores[otherTeam] + 500)
|
||||
{
|
||||
m_TeamScores500Disadvantage[otherTeam] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -596,9 +598,13 @@ void BattleGroundAB::EndBattleGround(Team winner)
|
|||
{
|
||||
// win reward
|
||||
if (winner == ALLIANCE)
|
||||
{
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
||||
}
|
||||
if (winner == HORDE)
|
||||
{
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
||||
}
|
||||
// complete map_end rewards (even if no team wins)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
||||
|
|
|
|||
|
|
@ -62,7 +62,9 @@ void BattleGroundBE::AddPlayer(Player* plr)
|
|||
void BattleGroundBE::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
|
||||
{
|
||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateWorldState(0x9f1, GetAlivePlayersCountByTeam(ALLIANCE));
|
||||
UpdateWorldState(0x9f0, GetAlivePlayersCountByTeam(HORDE));
|
||||
|
|
@ -73,7 +75,9 @@ void BattleGroundBE::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
|
|||
void BattleGroundBE::HandleKillPlayer(Player* player, Player* killer)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!killer)
|
||||
{
|
||||
|
|
@ -106,7 +110,9 @@ void BattleGroundBE::UpdatePlayerScore(Player* source, uint32 type, uint32 value
|
|||
{
|
||||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
|
||||
if (itr == m_PlayerScores.end()) // player not found...
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// there is nothing special in this score
|
||||
BattleGround::UpdatePlayerScore(source, type, value);
|
||||
|
|
|
|||
|
|
@ -56,7 +56,9 @@ void BattleGroundEY::Update(uint32 diff)
|
|||
m_resourceUpdateTimer = EY_RESOURCES_UPDATE_TIME;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_resourceUpdateTimer -= diff;
|
||||
}
|
||||
|
||||
// flag respawn
|
||||
if (m_flagState == EY_FLAG_STATE_WAIT_RESPAWN || m_flagState == EY_FLAG_STATE_ON_GROUND)
|
||||
|
|
@ -65,12 +67,18 @@ void BattleGroundEY::Update(uint32 diff)
|
|||
{
|
||||
m_flagRespawnTimer = 0;
|
||||
if (m_flagState == EY_FLAG_STATE_WAIT_RESPAWN)
|
||||
{
|
||||
RespawnFlag();
|
||||
}
|
||||
else
|
||||
{
|
||||
RespawnDroppedFlag();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_flagRespawnTimer -= diff;
|
||||
}
|
||||
}
|
||||
|
||||
// workaround for Fel Reaver Ruins flag capture needed on 3.3.5 only
|
||||
|
|
@ -86,13 +94,17 @@ void BattleGroundEY::Update(uint32 diff)
|
|||
{
|
||||
// coords and range taken from DBC of areatrigger (4514)
|
||||
if (flagCarrier->GetDistance(2044.0f, 1729.729f, 1190.03f) <= 3.0f)
|
||||
{
|
||||
EventPlayerCapturedFlag(flagCarrier, NODE_FEL_REAVER_RUINS);
|
||||
}
|
||||
}
|
||||
}
|
||||
m_felReaverFlagTimer = EY_FEL_REAVER_FLAG_UPDATE_TIME;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_felReaverFlagTimer -= diff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -142,18 +154,26 @@ void BattleGroundEY::UpdateTeamScore(Team team)
|
|||
}
|
||||
|
||||
if (team == ALLIANCE)
|
||||
{
|
||||
UpdateWorldState(WORLD_STATE_EY_RESOURCES_ALLIANCE, score);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateWorldState(WORLD_STATE_EY_RESOURCES_HORDE, score);
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundEY::EndBattleGround(Team winner)
|
||||
{
|
||||
// win reward
|
||||
if (winner == ALLIANCE)
|
||||
{
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
||||
}
|
||||
if (winner == HORDE)
|
||||
{
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
||||
}
|
||||
// complete map reward
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
||||
|
|
@ -161,7 +181,9 @@ void BattleGroundEY::EndBattleGround(Team winner)
|
|||
// disable capture points
|
||||
for (uint8 i = 0; i < EY_NODES_MAX; ++i)
|
||||
if (GameObject* go = GetBgMap()->GetGameObject(m_towers[i]))
|
||||
{
|
||||
go->SetLootState(GO_JUST_DEACTIVATED);
|
||||
}
|
||||
|
||||
BattleGround::EndBattleGround(winner);
|
||||
}
|
||||
|
|
@ -183,7 +205,9 @@ void BattleGroundEY::RemovePlayer(Player* plr, ObjectGuid guid)
|
|||
if (m_flagCarrier == guid)
|
||||
{
|
||||
if (plr)
|
||||
{
|
||||
EventPlayerDroppedFlag(plr);
|
||||
}
|
||||
else
|
||||
{
|
||||
ClearFlagCarrier();
|
||||
|
|
@ -314,19 +338,27 @@ bool BattleGroundEY::HandleAreaTrigger(Player* source, uint32 trigger)
|
|||
{
|
||||
case AREATRIGGER_BLOOD_ELF_TOWER_POINT:
|
||||
if (m_towerOwner[NODE_BLOOD_ELF_TOWER] == source->GetTeam())
|
||||
{
|
||||
EventPlayerCapturedFlag(source, NODE_BLOOD_ELF_TOWER);
|
||||
}
|
||||
break;
|
||||
case AREATRIGGER_FEL_REAVER_RUINS_POINT:
|
||||
if (m_towerOwner[NODE_FEL_REAVER_RUINS] == source->GetTeam())
|
||||
{
|
||||
EventPlayerCapturedFlag(source, NODE_FEL_REAVER_RUINS);
|
||||
}
|
||||
break;
|
||||
case AREATRIGGER_MAGE_TOWER_POINT:
|
||||
if (m_towerOwner[NODE_MAGE_TOWER] == source->GetTeam())
|
||||
{
|
||||
EventPlayerCapturedFlag(source, NODE_MAGE_TOWER);
|
||||
}
|
||||
break;
|
||||
case AREATRIGGER_DRAENEI_RUINS_POINT:
|
||||
if (m_towerOwner[NODE_DRAENEI_RUINS] == source->GetTeam())
|
||||
{
|
||||
EventPlayerCapturedFlag(source, NODE_DRAENEI_RUINS);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
|
|
@ -390,9 +422,13 @@ void BattleGroundEY::RespawnDroppedFlag()
|
|||
|
||||
GameObject* obj = GetBgMap()->GetGameObject(GetDroppedFlagGuid());
|
||||
if (obj)
|
||||
{
|
||||
obj->Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog.outError("BattleGroundEY: Unknown dropped flag: %s", GetDroppedFlagGuid().GetString().c_str());
|
||||
}
|
||||
|
||||
ClearDroppedFlagGuid();
|
||||
}
|
||||
|
|
@ -454,7 +490,9 @@ void BattleGroundEY::EventPlayerClickedOnFlag(Player* source, GameObject* target
|
|||
}
|
||||
|
||||
if (m_flagState == EY_FLAG_STATE_ON_BASE)
|
||||
{
|
||||
UpdateWorldState(WORLD_STATE_EY_NETHERSTORM_FLAG_READY, WORLD_STATE_REMOVE);
|
||||
}
|
||||
|
||||
if (source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
|
|
@ -480,9 +518,13 @@ void BattleGroundEY::EventPlayerClickedOnFlag(Player* source, GameObject* target
|
|||
source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
|
||||
if (source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, source->GetName());
|
||||
}
|
||||
else
|
||||
{
|
||||
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL, source->GetName());
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundEY::EventPlayerCapturedFlag(Player* source, EYNodes node)
|
||||
|
|
@ -505,7 +547,9 @@ void BattleGroundEY::EventPlayerCapturedFlag(Player* source, EYNodes node)
|
|||
PlaySoundToAll(EY_SOUND_FLAG_CAPTURED_ALLIANCE);
|
||||
|
||||
if (m_towersAlliance > 0)
|
||||
{
|
||||
AddPoints(ALLIANCE, eyFlagPoints[m_towersAlliance - 1]);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if (m_towersHorde > 0)
|
||||
{
|
||||
AddPoints(HORDE, eyFlagPoints[m_towersHorde - 1]);
|
||||
}
|
||||
|
||||
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]);
|
||||
if (!entry)
|
||||
{
|
||||
sLog.outError("BattleGroundEY: Not found graveyard: %u", eyGraveyards[i]);
|
||||
}
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -167,7 +167,9 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recv_data)
|
|||
// check if already in queue
|
||||
if (_player->GetBattleGroundQueueIndex(bgQueueTypeId) < PLAYER_MAX_BATTLEGROUND_QUEUES)
|
||||
// player is already in this queue
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
// check if has free queue slots
|
||||
if (!_player->HasFreeBattleGroundQueueId())
|
||||
{
|
||||
|
|
@ -213,7 +215,9 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recv_data)
|
|||
{
|
||||
Player* member = itr->getSource();
|
||||
if (!member)
|
||||
{ continue; } // this should never happen
|
||||
{
|
||||
continue; // this should never happen
|
||||
}
|
||||
|
||||
uint32 queueSlot = member->AddBattleGroundQueueId(bgQueueTypeId); // add to queue
|
||||
|
||||
|
|
@ -262,16 +266,22 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode(WorldPacket & /*recv_
|
|||
case BATTLEGROUND_WS:
|
||||
{
|
||||
if ((flagCarrierA = sObjectMgr.GetPlayer(((BattleGroundWS*)bg)->GetAllianceFlagCarrierGuid())))
|
||||
{
|
||||
++flagCarrierCountH;
|
||||
}
|
||||
|
||||
if ((flagCarrierH = sObjectMgr.GetPlayer(((BattleGroundWS*)bg)->GetHordeFlagCarrierGuid())))
|
||||
{
|
||||
++flagCarrierCountH;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BATTLEGROUND_EY:
|
||||
{
|
||||
if ((flagCarrierH = sObjectMgr.GetPlayer(((BattleGroundEY*)bg)->GetFlagCarrierGuid())))
|
||||
{
|
||||
++flagCarrierCountH;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BATTLEGROUND_AB:
|
||||
|
|
@ -287,9 +297,13 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode(WorldPacket & /*recv_
|
|||
data.WriteBits(flagCarrierCountA, 22);
|
||||
data.WriteBits(flagCarrierCountH, 22);
|
||||
if (flagCarrierA)
|
||||
{
|
||||
data.WriteGuidMask<6, 5, 4, 7, 2, 1, 0, 3>(flagCarrierA->GetObjectGuid());
|
||||
}
|
||||
if (flagCarrierH)
|
||||
{
|
||||
data.WriteGuidMask<6, 5, 4, 7, 2, 1, 0, 3>(flagCarrierH->GetObjectGuid());
|
||||
}
|
||||
|
||||
if (flagCarrierA)
|
||||
{
|
||||
|
|
@ -457,10 +471,14 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket& recv_data)
|
|||
{
|
||||
case 1: // port to battleground
|
||||
if (!_player->IsInvitedForBattleGroundQueueType(bgQueueTypeId))
|
||||
{ return; } // cheating?
|
||||
{
|
||||
return; // cheating?
|
||||
}
|
||||
|
||||
if (!_player->InBattleGround())
|
||||
{
|
||||
_player->SetBattleGroundEntryPoint();
|
||||
}
|
||||
|
||||
// resurrect the player
|
||||
if (!_player->IsAlive())
|
||||
|
|
@ -513,7 +531,9 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket& recv_data)
|
|||
bgQueue.RemovePlayer(_player->GetObjectGuid(), true);
|
||||
// player left queue, we should update it - do not update Arena Queue
|
||||
if (ginfo.arenaType == ARENA_TYPE_NONE)
|
||||
{
|
||||
sBattleGroundMgr.ScheduleQueueUpdate(ginfo.ArenaTeamRating, ginfo.arenaType, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
|
||||
}
|
||||
SendPacket(&data);
|
||||
DEBUG_LOG("Battleground: player %s (%u) left queue for bgtype %u, queue type %u.", _player->GetName(), _player->GetGUIDLow(), bg->GetTypeID(), bgQueueTypeId);
|
||||
break;
|
||||
|
|
@ -601,7 +621,9 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recv_data*/)
|
|||
// expected bracket entry
|
||||
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->getLevel());
|
||||
if (!bracketEntry)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32 avgTime = bgQueue.GetAverageQueueWaitTime(&ginfo, bracketEntry->GetBracketId());
|
||||
// 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_pers_rating + 150 < arenaRating)
|
||||
{
|
||||
arenaRating = avg_pers_rating;
|
||||
}
|
||||
|
||||
BattleGroundQueue& bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId];
|
||||
uint32 avgTime = 0;
|
||||
|
|
@ -766,7 +790,9 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recv_data)
|
|||
{
|
||||
Player* member = itr->getSource();
|
||||
if (!member)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
WorldPacket data;
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,9 @@ void BattleGroundIC::UpdatePlayerScore(Player* source, uint32 type, uint32 value
|
|||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
|
||||
|
||||
if (itr == m_PlayerScores.end()) // player not found...
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
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
|
||||
uint32 index = 0;
|
||||
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)
|
||||
{ ++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);
|
||||
|
||||
|
|
@ -213,7 +217,9 @@ GroupQueueInfo* BattleGroundQueue::AddGroup(Player* leader, Group* grp, BattleGr
|
|||
{
|
||||
Player* member = itr->getSource();
|
||||
if (!member)
|
||||
{ continue; } // this should never happen
|
||||
{
|
||||
continue; // this should never happen
|
||||
}
|
||||
PlayerQueueInfo& pl_info = m_QueuedPlayers[member->GetObjectGuid()];
|
||||
pl_info.LastOnlineTime = lastOnlineTime;
|
||||
pl_info.GroupInfo = ginfo;
|
||||
|
|
@ -282,7 +288,9 @@ void BattleGroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* g
|
|||
if (ginfo->arenaType == ARENA_TYPE_NONE)
|
||||
{
|
||||
if (ginfo->GroupTeam == HORDE)
|
||||
{
|
||||
team_index = TEAM_INDEX_HORDE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -309,7 +317,9 @@ uint32 BattleGroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattleG
|
|||
if (ginfo->arenaType == ARENA_TYPE_NONE)
|
||||
{
|
||||
if (ginfo->GroupTeam == HORDE)
|
||||
{
|
||||
team_index = TEAM_INDEX_HORDE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -323,7 +333,9 @@ uint32 BattleGroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattleG
|
|||
}
|
||||
else
|
||||
// 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
|
||||
|
|
@ -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
|
||||
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);
|
||||
}
|
||||
|
||||
// if player leaves queue and he is invited to rated arena match, then he have to loose
|
||||
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);
|
||||
Player* plr = sObjectMgr.GetPlayer(guid);
|
||||
if (plr)
|
||||
{
|
||||
at->MemberLost(plr, group->OpponentsTeamRating);
|
||||
}
|
||||
else
|
||||
{
|
||||
at->OfflineMemberLost(guid, group->OpponentsTeamRating);
|
||||
}
|
||||
at->SaveToDB();
|
||||
}
|
||||
}
|
||||
|
|
@ -492,7 +510,9 @@ bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo* ginfo, BattleGround* bg,
|
|||
|
||||
// set ArenaTeamId for rated matches
|
||||
if (bg->isArena() && bg->isRated())
|
||||
{
|
||||
bg->SetArenaTeamIdForTeam(ginfo->GroupTeam, ginfo->ArenaTeamId);
|
||||
}
|
||||
|
||||
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();
|
||||
for (; itr_team != m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + teamIdx].end(); ++itr_team)
|
||||
if (ginfo == *itr_team)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (itr_team == m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + teamIdx].end())
|
||||
{
|
||||
return false;
|
||||
|
|
@ -789,7 +811,9 @@ bool BattleGroundQueue::CheckSkirmishForSameFaction(BattleGroundBracketId bracke
|
|||
{
|
||||
// if selection pool is full then break;
|
||||
if (!(*itr_team2)->IsInvitedToBGInstanceGUID && !m_SelectionPools[otherTeamIdx].AddGroup(*itr_team2, minPlayersPerTeam))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (m_SelectionPools[otherTeamIdx].GetPlayerCount() != minPlayersPerTeam)
|
||||
{
|
||||
|
|
@ -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_NORMAL_ALLIANCE].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
|
||||
// maybe it would be better to create bgfreeslotqueue for each bracket_id
|
||||
|
|
@ -1001,10 +1027,14 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|
|||
if (front1 && front2)
|
||||
{
|
||||
if (front1->JoinTime < front2->JoinTime)
|
||||
{
|
||||
arenaRating = front1->ArenaTeamRating;
|
||||
}
|
||||
}
|
||||
else if (!front1 && !front2)
|
||||
{
|
||||
return; // queues are empty
|
||||
}
|
||||
}
|
||||
|
||||
// set rating range
|
||||
|
|
@ -1171,7 +1201,9 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
|||
Player* plr = sObjectMgr.GetPlayer(m_PlayerGuid);
|
||||
if (!plr)
|
||||
// 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 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);
|
||||
// update queues if battleground isn't ended
|
||||
if (bg && bg->isBattleGround() && bg->GetStatus() != STATUS_WAIT_LEAVE)
|
||||
{
|
||||
sBattleGroundMgr.ScheduleQueueUpdate(0, ARENA_TYPE_NONE, m_BgQueueTypeId, m_BgTypeId, bg->GetBracketId());
|
||||
}
|
||||
|
||||
WorldPacket data;
|
||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, plr, queueSlot, STATUS_NONE, 0, 0, ARENA_TYPE_NONE);
|
||||
|
|
@ -1284,7 +1318,9 @@ void BattleGroundMgr::Update(uint32 diff)
|
|||
m_NextRatingDiscardUpdate = sWorld.getConfig(CONFIG_UINT32_ARENA_RATING_DISCARD_TIMER);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_NextRatingDiscardUpdate -= diff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1292,7 +1328,9 @@ void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket* data, BattleGro
|
|||
{
|
||||
// we can be in 2 queues in same time...
|
||||
if (!bg)
|
||||
{
|
||||
StatusID = STATUS_NONE;
|
||||
}
|
||||
|
||||
ObjectGuid playerGuid = player->GetObjectGuid();
|
||||
ObjectGuid bgGuid = bg ? bg->GetObjectGuid() : ObjectGuid();
|
||||
|
|
@ -1520,9 +1558,13 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket* data, BattleGround* bg)
|
|||
for (int8 i = 0; i < PVP_TEAM_COUNT; ++i)
|
||||
{
|
||||
if (ArenaTeam* at = sObjectMgr.GetArenaTeamById(bg->m_ArenaTeamIds[i]))
|
||||
{
|
||||
data->WriteBits(at->GetName().length(), 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
data->WriteBits(0, 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1543,7 +1585,9 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket* data, BattleGround* bg)
|
|||
data->WriteGuidMask<3, 0, 5, 1, 6>(memberGuid);
|
||||
Team team = bg->GetPlayerTeam(itr->first);
|
||||
if (!team && player)
|
||||
{
|
||||
team = player->GetTeam();
|
||||
}
|
||||
data->WriteBit(team == ALLIANCE); // unk7
|
||||
data->WriteGuidMask<7>(memberGuid);
|
||||
|
||||
|
|
@ -1566,9 +1610,13 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket* data, BattleGround* bg)
|
|||
buffer.WriteGuidBytes<1, 6>(memberGuid);
|
||||
// TODO: store this in player score
|
||||
if (player)
|
||||
{
|
||||
buffer << uint32(player->GetPrimaryTalentTree(player->GetActiveSpec()));
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer << uint32(0);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
if (ArenaTeam* at = sObjectMgr.GetArenaTeamById(bg->m_ArenaTeamIds[i]))
|
||||
{
|
||||
data->append(at->GetName().data(), at->GetName().length());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*data << uint8(bg->GetPlayersCountByTeam(HORDE));
|
||||
|
||||
if (bg->GetStatus() == STATUS_WAIT_LEAVE)
|
||||
{
|
||||
*data << uint8(bg->GetWinner() == ALLIANCE); // who win
|
||||
}
|
||||
|
||||
*data << uint8(bg->GetPlayersCountByTeam(ALLIANCE));
|
||||
}
|
||||
|
|
@ -1797,7 +1849,9 @@ BattleGround* BattleGroundMgr::GetBattleGroundTemplate(BattleGroundTypeId bgType
|
|||
uint32 BattleGroundMgr::CreateClientVisibleInstanceId(BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id)
|
||||
{
|
||||
if (IsArenaType(bgTypeId))
|
||||
{
|
||||
return 0; // arenas don't have client-instanceids
|
||||
}
|
||||
|
||||
// we create here an instanceid, which is just for
|
||||
// displaying this to the client and without any other use..
|
||||
|
|
@ -1992,7 +2046,9 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
|||
}
|
||||
|
||||
if (DisableMgr::IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, bgTypeID_))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
BattleGroundTypeId bgTypeID = BattleGroundTypeId(bgTypeID_);
|
||||
|
||||
|
|
@ -2126,7 +2182,9 @@ void BattleGroundMgr::DistributeArenaPoints()
|
|||
CharacterDatabase.PExecute("UPDATE `characters` SET `arenaPoints` = `arenaPoints` + '%u' WHERE `guid` = '%u'", plr_itr->second, plr_itr->first);
|
||||
// add points if player is online
|
||||
if (Player* pl = sObjectMgr.GetPlayer(ObjectGuid(HIGHGUID_PLAYER, plr_itr->first)))
|
||||
{
|
||||
pl->ModifyArenaPoints(plr_itr->second);
|
||||
}
|
||||
}
|
||||
|
||||
PlayerPoints.clear();
|
||||
|
|
@ -2200,7 +2258,9 @@ void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket* data, ObjectGuid
|
|||
data->WriteGuidBytes<6, 1, 7, 5>(guid);
|
||||
data->FlushBits();
|
||||
if (count)
|
||||
{
|
||||
data->append(buf);
|
||||
}
|
||||
data->WriteGuidBytes<0, 2, 4, 3>(guid);
|
||||
}
|
||||
|
||||
|
|
@ -2348,9 +2408,13 @@ void BattleGroundMgr::ToggleArenaTesting()
|
|||
{
|
||||
m_ArenaTesting = !m_ArenaTesting;
|
||||
if (m_ArenaTesting)
|
||||
{
|
||||
sWorld.SendWorldText(LANG_DEBUG_ARENA_ON);
|
||||
}
|
||||
else
|
||||
{
|
||||
sWorld.SendWorldText(LANG_DEBUG_ARENA_OFF);
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
uint32 diff = sWorld.getConfig(CONFIG_UINT32_ARENA_MAX_RATING_DIFFERENCE);
|
||||
if (diff == 0)
|
||||
{
|
||||
diff = 5000;
|
||||
}
|
||||
return diff;
|
||||
}
|
||||
|
||||
|
|
@ -2533,7 +2599,9 @@ void BattleGroundMgr::LoadBattleEventIndexes()
|
|||
bar.step();
|
||||
Field* fields = result->Fetch();
|
||||
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);
|
||||
uint32 dbTableGuidLow = fields[1].GetUInt32();
|
||||
|
|
|
|||
|
|
@ -63,7 +63,9 @@ void BattleGroundNA::AddPlayer(Player* plr)
|
|||
void BattleGroundNA::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
|
||||
{
|
||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateWorldState(0xa0f, GetAlivePlayersCountByTeam(ALLIANCE));
|
||||
UpdateWorldState(0xa10, GetAlivePlayersCountByTeam(HORDE));
|
||||
|
|
@ -74,7 +76,9 @@ void BattleGroundNA::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
|
|||
void BattleGroundNA::HandleKillPlayer(Player* player, Player* killer)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!killer)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -50,7 +50,9 @@ void BattleGroundRB::UpdatePlayerScore(Player* source, uint32 type, uint32 value
|
|||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
|
||||
|
||||
if (itr == m_PlayerScores.end()) // player not found...
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BattleGround::UpdatePlayerScore(source, type, value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,9 @@ void BattleGroundRL::AddPlayer(Player* plr)
|
|||
void BattleGroundRL::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
|
||||
{
|
||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateWorldState(0xbb8, GetAlivePlayersCountByTeam(ALLIANCE));
|
||||
UpdateWorldState(0xbb9, GetAlivePlayersCountByTeam(HORDE));
|
||||
|
|
@ -73,7 +75,9 @@ void BattleGroundRL::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
|
|||
void BattleGroundRL::HandleKillPlayer(Player* player, Player* killer)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!killer)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -49,7 +49,9 @@ void BattleGroundSA::UpdatePlayerScore(Player* source, uint32 type, uint32 value
|
|||
{
|
||||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
|
||||
if (itr == m_PlayerScores.end()) // player not found...
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BattleGround::UpdatePlayerScore(source, type, value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,9 +90,13 @@ void BattleGroundWS::Update(uint32 diff)
|
|||
if (m_EndTimer <= diff)
|
||||
{
|
||||
if (m_TeamScores[TEAM_INDEX_ALLIANCE] > m_TeamScores[TEAM_INDEX_HORDE])
|
||||
{
|
||||
EndBattleGround(ALLIANCE);
|
||||
}
|
||||
else if (m_TeamScores[TEAM_INDEX_ALLIANCE] < m_TeamScores[TEAM_INDEX_HORDE])
|
||||
{
|
||||
EndBattleGround(HORDE);
|
||||
}
|
||||
else
|
||||
{
|
||||
// if 0 => tie
|
||||
|
|
@ -106,7 +110,9 @@ void BattleGroundWS::Update(uint32 diff)
|
|||
uint32 minutesLeft = GetRemainingTimeInMinutes();
|
||||
|
||||
if (minutesLeft != minutesLeftPrev)
|
||||
{
|
||||
UpdateWorldState(BG_WS_TIME_REMAINING, minutesLeft);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -524,9 +530,13 @@ void BattleGroundWS::UpdateFlagState(Team team, uint32 value)
|
|||
void BattleGroundWS::UpdateTeamScore(Team team)
|
||||
{
|
||||
if (team == ALLIANCE)
|
||||
{
|
||||
UpdateWorldState(BG_WS_FLAG_CAPTURES_ALLIANCE, m_TeamScores[TEAM_INDEX_ALLIANCE]);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateWorldState(BG_WS_FLAG_CAPTURES_HORDE, m_TeamScores[TEAM_INDEX_HORDE]);
|
||||
}
|
||||
}
|
||||
|
||||
bool BattleGroundWS::HandleAreaTrigger(Player* source, uint32 trigger)
|
||||
|
|
@ -592,9 +602,13 @@ void BattleGroundWS::EndBattleGround(Team winner)
|
|||
{
|
||||
// win reward
|
||||
if (winner == ALLIANCE)
|
||||
{
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), ALLIANCE);
|
||||
}
|
||||
if (winner == HORDE)
|
||||
{
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), HORDE);
|
||||
}
|
||||
// complete map_end rewards (even if no team wins)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), ALLIANCE);
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), HORDE);
|
||||
|
|
|
|||
|
|
@ -191,7 +191,9 @@ bool ChatHandler::HandleGMListIngameCommand(char* /*args*/)
|
|||
AccountTypes security = player->GetSession()->GetSecurity();
|
||||
if ((player->isGameMaster() || (security > SEC_PLAYER && security <= (AccountTypes)sWorld.getConfig(CONFIG_UINT32_GM_LEVEL_IN_GM_LIST))) &&
|
||||
(!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,9 +657,13 @@ bool ChatHandler::HandleAppearCommand(char* args)
|
|||
}
|
||||
|
||||
if (cMap->IsRaid())
|
||||
{
|
||||
_player->SetRaidDifficulty(target->GetRaidDifficulty());
|
||||
}
|
||||
else
|
||||
{
|
||||
_player->SetDungeonDifficulty(target->GetDungeonDifficulty());
|
||||
}
|
||||
}
|
||||
|
||||
PSendSysMessage(LANG_APPEARING_AT, chrNameLink.c_str());
|
||||
|
|
@ -778,7 +782,9 @@ bool ChatHandler::HandleModifyHolyPowerCommand(char* args)
|
|||
|
||||
PSendSysMessage(LANG_YOU_CHANGE_HOLY_POWER, GetNameLink(chr).c_str(), power, maxPower);
|
||||
if (needReportToTarget(chr))
|
||||
{
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_HOLY_POWER_CHANGED, GetNameLink().c_str(), power, maxPower);
|
||||
}
|
||||
|
||||
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);
|
||||
if (needReportToTarget(chr))
|
||||
{
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_RUNIC_POWER_CHANGED, GetNameLink().c_str(), rune / 10, runem / 10);
|
||||
}
|
||||
|
||||
chr->SetMaxPower(POWER_RUNIC_POWER, runem);
|
||||
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());
|
||||
if (needReportToTarget(chr))
|
||||
{
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_FLY_SPEED_CHANGED, GetNameLink().c_str(), modSpeed);
|
||||
}
|
||||
|
||||
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());
|
||||
if (needReportToTarget(chr))
|
||||
{
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_MONEY_TAKEN, GetNameLink().c_str(), MoneyToString(abs(addmoney)).c_str());
|
||||
}
|
||||
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());
|
||||
if (needReportToTarget(chr))
|
||||
{
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_MONEY_GIVEN, GetNameLink().c_str(), MoneyToString(addmoney).c_str());
|
||||
}
|
||||
|
||||
if (addmoney >= MAX_MONEY_AMOUNT)
|
||||
{
|
||||
|
|
@ -2603,10 +2617,14 @@ bool ChatHandler::HandleModifyDrunkCommand(char* args)
|
|||
|
||||
uint8 drunkValue = (uint8)atoi(args);
|
||||
if (drunkValue > 100)
|
||||
{
|
||||
drunkValue = 100;
|
||||
}
|
||||
|
||||
if (Player* target = getSelectedPlayer())
|
||||
{
|
||||
target->SetDrunkValue(drunkValue);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -344,9 +344,13 @@ bool ChatHandler::HandleTriggerCommand(char* args)
|
|||
SendSysMessage(LANG_TRIGGER_REQ_KEYS_HEROIC);
|
||||
|
||||
if (at->heroicKey)
|
||||
{
|
||||
ShowItemListHelper(at->heroicKey, loc_idx, pl);
|
||||
}
|
||||
if (at->heroicKey2)
|
||||
{
|
||||
ShowItemListHelper(at->heroicKey2, loc_idx, pl);
|
||||
}
|
||||
}
|
||||
|
||||
if (at->requiredQuestHeroic)
|
||||
|
|
@ -1311,7 +1315,9 @@ bool ChatHandler::HandleGameObjectPhaseCommand(char* args)
|
|||
|
||||
// by DB guid
|
||||
if (GameObjectData const* go_data = sObjectMgr.GetGOData(lowguid))
|
||||
{
|
||||
obj = GetGameObjectWithGuid(lowguid, go_data->id);
|
||||
}
|
||||
|
||||
if (!obj)
|
||||
{
|
||||
|
|
@ -1431,7 +1437,9 @@ void ChatHandler::ShowAchievementListHelper(AchievementEntry const* achEntry, Lo
|
|||
if (AchievementCriteriaEntryList const* criteriaList = sAchievementMgr.GetAchievementCriteriaByAchievement(achEntry->ID))
|
||||
for (AchievementCriteriaEntryList::const_iterator itr = criteriaList->begin(); itr != criteriaList->end(); ++itr)
|
||||
if (mgr->IsCompletedCriteria(*itr, achEntry))
|
||||
{
|
||||
criteriaMask[((*itr)->showOrder - 1) / 32] |= (1 << (((*itr)->showOrder - 1) % 32));
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
|
|
@ -1439,16 +1447,22 @@ void ChatHandler::ShowAchievementListHelper(AchievementEntry const* achEntry, Lo
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ss << "0:0:0:0:";
|
||||
}
|
||||
}
|
||||
|
||||
ss << "|h[" << name << " " << localeNames[loc] << "]|h|r";
|
||||
}
|
||||
else
|
||||
{
|
||||
ss << achEntry->ID << " - " << name << " " << localeNames[loc];
|
||||
}
|
||||
|
||||
if (target && date)
|
||||
{
|
||||
ss << " [" << TimeToTimestampStr(*date) << "]";
|
||||
}
|
||||
|
||||
SendSysMessage(ss.str().c_str());
|
||||
}
|
||||
|
|
@ -1480,12 +1494,16 @@ bool ChatHandler::HandleLookupAchievementCommand(char* args)
|
|||
{
|
||||
AchievementEntry const* achEntry = sAchievementStore.LookupEntry(id);
|
||||
if (!achEntry)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int loc = GetSessionDbcLocale();
|
||||
std::string name = achEntry->name[loc];
|
||||
if (name.empty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!Utf8FitTo(name, wnamepart))
|
||||
{
|
||||
|
|
@ -1493,14 +1511,20 @@ bool ChatHandler::HandleLookupAchievementCommand(char* args)
|
|||
for (; loc < MAX_LOCALE; ++loc)
|
||||
{
|
||||
if (loc == GetSessionDbcLocale())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
name = achEntry->name[loc];
|
||||
if (name.empty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Utf8FitTo(name, wnamepart))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1513,7 +1537,9 @@ bool ChatHandler::HandleLookupAchievementCommand(char* args)
|
|||
}
|
||||
|
||||
if (counter == 0) // if counter == 0 then we found nth
|
||||
{
|
||||
SendSysMessage(LANG_COMMAND_ACHIEVEMENT_NOTFOUND);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -2607,7 +2633,9 @@ bool ChatHandler::HandleNpcSetPhaseCommand(char* args)
|
|||
pCreature->SetPhaseMask(phasemask, true);
|
||||
|
||||
if (pCreature->HasStaticDBSpawnData())
|
||||
{
|
||||
pCreature->SaveToDB();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2700,7 +2728,9 @@ bool ChatHandler::HandleNpcSubNameCommand(char* /*args*/)
|
|||
/* Temp. disabled
|
||||
|
||||
if (!*args)
|
||||
{
|
||||
args = "";
|
||||
}
|
||||
|
||||
if (strlen((char*)args)>75)
|
||||
{
|
||||
|
|
@ -2884,7 +2914,9 @@ bool ChatHandler::HandleModifyPhaseCommand(char* args)
|
|||
|
||||
Unit* target = getSelectedUnit();
|
||||
if (!target)
|
||||
{
|
||||
target = m_session->GetPlayer();
|
||||
}
|
||||
|
||||
// check online security
|
||||
else if (target->GetTypeId() == TYPEID_PLAYER && HasLowerSecurity((Player*)target))
|
||||
|
|
@ -3128,7 +3160,9 @@ bool ChatHandler::HandleTicketCommand(char* args)
|
|||
ticket->SetResponseText(args);
|
||||
|
||||
if (Player* pl = sObjectMgr.GetPlayer(ticket->GetPlayerGuid()))
|
||||
{
|
||||
pl->GetSession()->SendGMResponse(ticket);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -3285,14 +3319,20 @@ inline void UnsummonVisualWaypoints(Player const* player, ObjectGuid ownerGuid)
|
|||
for (std::list<Creature*>::iterator itr = waypoints.begin(); itr != waypoints.end(); ++itr)
|
||||
{
|
||||
if ((*itr)->GetSubtype() != CREATURE_SUBTYPE_TEMPORARY_SUMMON)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
TemporarySummonWaypoint* wpTarget = dynamic_cast<TemporarySummonWaypoint*>(*itr);
|
||||
if (!wpTarget)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (wpTarget->GetSummonerGuid() == ownerGuid)
|
||||
{
|
||||
wpTarget->UnSummon();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3320,7 +3360,9 @@ bool ChatHandler::HandleWpAddCommand(char* args)
|
|||
|
||||
CreatureInfo const* waypointInfo = ObjectMgr::GetCreatureTemplate(VISUAL_WAYPOINT);
|
||||
if (!waypointInfo || waypointInfo->GetHighGuid() != HIGHGUID_UNIT)
|
||||
{
|
||||
return false; // must exist as normal creature in mangos.sql 'creature_template'
|
||||
}
|
||||
|
||||
Creature* targetCreature = getSelectedCreature();
|
||||
WaypointPathOrigin wpDestination = PATH_NO_PATH; ///< into which storage
|
||||
|
|
@ -3354,7 +3396,9 @@ bool ChatHandler::HandleWpAddCommand(char* args)
|
|||
wpPointId = wpTarget->GetWaypointId() + 1; // Insert as next waypoint
|
||||
}
|
||||
else // normal creature selected
|
||||
{
|
||||
wpOwner = targetCreature;
|
||||
}
|
||||
}
|
||||
else //!targetCreature - first argument must be dbGuid
|
||||
{
|
||||
|
|
@ -3396,11 +3440,15 @@ bool ChatHandler::HandleWpAddCommand(char* args)
|
|||
{
|
||||
uint32 src = (uint32)PATH_NO_PATH;
|
||||
if (ExtractOptUInt32(&args, src, src))
|
||||
{
|
||||
wpDestination = (WaypointPathOrigin)src;
|
||||
}
|
||||
else // pathId provided but no destination
|
||||
{
|
||||
if (wpPathId != 0)
|
||||
{
|
||||
wpDestination = PATH_FROM_ENTRY; // Multiple Paths must only be assigned by entry
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3408,7 +3456,9 @@ bool ChatHandler::HandleWpAddCommand(char* args)
|
|||
{
|
||||
if (wpOwner->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
|
||||
if (WaypointMovementGenerator<Creature> const* wpMMGen = dynamic_cast<WaypointMovementGenerator<Creature> const*>(wpOwner->GetMotionMaster()->GetCurrent()))
|
||||
{
|
||||
wpMMGen->GetPathInformation(wpPathId, wpDestination);
|
||||
}
|
||||
|
||||
// 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))
|
||||
|
|
@ -3418,7 +3468,9 @@ bool ChatHandler::HandleWpAddCommand(char* args)
|
|||
{
|
||||
QueryResult* result = WorldDatabase.PQuery("SELECT COUNT(`id`) FROM `creature` WHERE `id` = %u", wpOwner->GetEntry());
|
||||
if (result && result->Fetch()[0].GetUInt32() != 1)
|
||||
{
|
||||
wpDestination = PATH_FROM_GUID;
|
||||
}
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
|
|
@ -3501,7 +3553,9 @@ bool ChatHandler::HandleWpModifyCommand(char* args)
|
|||
|
||||
CreatureInfo const* waypointInfo = ObjectMgr::GetCreatureTemplate(VISUAL_WAYPOINT);
|
||||
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
|
||||
char* subCmd_str = ExtractLiteralArg(&args);
|
||||
|
|
@ -3598,10 +3652,14 @@ bool ChatHandler::HandleWpModifyCommand(char* args)
|
|||
{
|
||||
if (wpOwner->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
|
||||
if (WaypointMovementGenerator<Creature> const* wpMMGen = dynamic_cast<WaypointMovementGenerator<Creature> const*>(wpOwner->GetMotionMaster()->GetCurrent()))
|
||||
{
|
||||
wpMMGen->GetPathInformation(wpPathId, wpSource);
|
||||
}
|
||||
|
||||
if (wpSource == PATH_NO_PATH)
|
||||
{
|
||||
sWaypointMgr.GetDefaultPath(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), &wpSource);
|
||||
}
|
||||
}
|
||||
|
||||
WaypointPath const* wpPath = sWaypointMgr.GetPathFromOrigin(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), wpPathId, wpSource);
|
||||
|
|
@ -3637,7 +3695,9 @@ bool ChatHandler::HandleWpModifyCommand(char* args)
|
|||
sWaypointMgr.DeleteNode(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), wpId, wpPathId, wpSource);
|
||||
|
||||
if (TemporarySummonWaypoint* wpCreature = dynamic_cast<TemporarySummonWaypoint*>(targetCreature))
|
||||
{
|
||||
wpCreature->UnSummon();
|
||||
}
|
||||
|
||||
if (wpPath->empty())
|
||||
{
|
||||
|
|
@ -3686,7 +3746,9 @@ bool ChatHandler::HandleWpModifyCommand(char* args)
|
|||
}
|
||||
|
||||
if (!sWaypointMgr.SetNodeScriptId(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), wpId, wpPathId, wpSource, scriptId))
|
||||
{
|
||||
PSendSysMessage(LANG_WAYPOINT_INFO_UNK_SCRIPTID, scriptId);
|
||||
}
|
||||
}
|
||||
else if (subCmd == "orientation")
|
||||
{
|
||||
|
|
@ -3729,7 +3791,9 @@ bool ChatHandler::HandleWpShowCommand(char* args)
|
|||
|
||||
CreatureInfo const* waypointInfo = ObjectMgr::GetCreatureTemplate(VISUAL_WAYPOINT);
|
||||
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
|
||||
|
||||
|
|
@ -3752,7 +3816,9 @@ bool ChatHandler::HandleWpShowCommand(char* args)
|
|||
{
|
||||
uint32 src;
|
||||
if (ExtractOptUInt32(&args, src, (uint32)PATH_NO_PATH))
|
||||
{
|
||||
wpOrigin = (WaypointPathOrigin)src;
|
||||
}
|
||||
}
|
||||
}
|
||||
else // Guid must be provided
|
||||
|
|
@ -3766,7 +3832,9 @@ bool ChatHandler::HandleWpShowCommand(char* args)
|
|||
{
|
||||
uint32 src = (uint32)PATH_NO_PATH;
|
||||
if (ExtractOptUInt32(&args, src, src))
|
||||
{
|
||||
wpOrigin = (WaypointPathOrigin)src;
|
||||
}
|
||||
}
|
||||
|
||||
// Params now parsed, check them
|
||||
|
|
@ -3822,12 +3890,16 @@ bool ChatHandler::HandleWpShowCommand(char* args)
|
|||
wpPathId = wpTarget->GetPathId();
|
||||
}
|
||||
else
|
||||
{
|
||||
wpOwner = targetCreature;
|
||||
}
|
||||
|
||||
// Get the path
|
||||
WaypointPath* wpPath = NULL;
|
||||
if (wpOrigin != PATH_NO_PATH) // Might have been provided by param
|
||||
{
|
||||
wpPath = sWaypointMgr.GetPathFromOrigin(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), wpPathId, wpOrigin);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wpOwner->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
|
||||
|
|
@ -3838,7 +3910,9 @@ bool ChatHandler::HandleWpShowCommand(char* args)
|
|||
}
|
||||
|
||||
if (wpOrigin == PATH_NO_PATH)
|
||||
{
|
||||
wpPath = sWaypointMgr.GetDefaultPath(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), &wpOrigin);
|
||||
}
|
||||
}
|
||||
|
||||
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_SCRIPTID, point->second.script_id);
|
||||
if (wpOrigin == PATH_FROM_EXTERNAL)
|
||||
{
|
||||
PSendSysMessage(LANG_WAYPOINT_INFO_AISCRIPT, wpOwner->GetScriptName().c_str());
|
||||
}
|
||||
if (WaypointBehavior* behaviour = point->second.behavior)
|
||||
{
|
||||
PSendSysMessage(" ModelId1: %u", behaviour->model1);
|
||||
|
|
@ -3971,7 +4047,9 @@ bool ChatHandler::HandleWpExportCommand(char* args)
|
|||
wpPathId = wpTarget->GetPathId();
|
||||
}
|
||||
else // normal creature selected
|
||||
{
|
||||
wpOwner = targetCreature;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -4022,11 +4100,15 @@ bool ChatHandler::HandleWpExportCommand(char* args)
|
|||
{
|
||||
uint32 src = (uint32)PATH_NO_PATH;
|
||||
if (ExtractOptUInt32(&args, src, src))
|
||||
{
|
||||
wpOrigin = (WaypointPathOrigin)src;
|
||||
}
|
||||
else // pathId provided but no destination
|
||||
{
|
||||
if (wpPathId != 0)
|
||||
{
|
||||
wpOrigin = PATH_FROM_ENTRY; // Multiple Paths must only be assigned by entry
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4034,9 +4116,13 @@ bool ChatHandler::HandleWpExportCommand(char* args)
|
|||
{
|
||||
if (wpOwner->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
|
||||
if (WaypointMovementGenerator<Creature> const* wpMMGen = dynamic_cast<WaypointMovementGenerator<Creature> const*>(wpOwner->GetMotionMaster()->GetCurrent()))
|
||||
{
|
||||
wpMMGen->GetPathInformation(wpPathId, wpOrigin);
|
||||
}
|
||||
if (wpOrigin == PATH_NO_PATH)
|
||||
{
|
||||
sWaypointMgr.GetDefaultPath(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), &wpOrigin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4085,11 +4171,17 @@ bool ChatHandler::HandleWpExportCommand(char* args)
|
|||
outfile << itr->second.orientation << ",";
|
||||
outfile << itr->second.delay << ",";
|
||||
if (wpOrigin != PATH_FROM_EXTERNAL) // Only for normal waypoints
|
||||
{
|
||||
outfile << itr->second.script_id << ")";
|
||||
}
|
||||
if (countDown > 1)
|
||||
{
|
||||
outfile << ",\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
outfile << ";\n";
|
||||
}
|
||||
}
|
||||
|
||||
PSendSysMessage(LANG_WAYPOINT_EXPORTED);
|
||||
|
|
@ -4647,7 +4739,9 @@ bool ChatHandler::HandleLearnAllRecipesCommand(char* args)
|
|||
if ((skillInfo->categoryId != SKILL_CATEGORY_PROFESSION &&
|
||||
skillInfo->categoryId != SKILL_CATEGORY_SECONDARY) ||
|
||||
!skillInfo->canLink) // only prof with recipes have set
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int loc = GetSessionDbcLocale();
|
||||
name = skillInfo->name[loc];
|
||||
|
|
@ -5315,9 +5409,13 @@ bool ChatHandler::HandleWaterwalkCommand(char* args)
|
|||
}
|
||||
|
||||
if (value)
|
||||
{ player->SetWaterWalk(true); } // ON
|
||||
{
|
||||
player->SetWaterWalk(true); // ON
|
||||
}
|
||||
else
|
||||
{ player->SetWaterWalk(false); } // OFF
|
||||
{
|
||||
player->SetWaterWalk(false); // OFF
|
||||
}
|
||||
|
||||
PSendSysMessage(LANG_YOU_SET_WATERWALK, args, GetNameLink(player).c_str());
|
||||
if (needReportToTarget(player))
|
||||
|
|
@ -5362,7 +5460,9 @@ bool ChatHandler::HandleLookupTitleCommand(char* args)
|
|||
int loc = GetSessionDbcLocale();
|
||||
std::string name = titleInfo->name[loc];
|
||||
if (name.empty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!Utf8FitTo(name, wnamepart))
|
||||
{
|
||||
|
|
@ -5370,14 +5470,20 @@ bool ChatHandler::HandleLookupTitleCommand(char* args)
|
|||
for (; loc < MAX_LOCALE; ++loc)
|
||||
{
|
||||
if (loc == GetSessionDbcLocale())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
name = titleInfo->name[loc];
|
||||
if (name.empty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Utf8FitTo(name, wnamepart))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -5394,16 +5500,22 @@ bool ChatHandler::HandleLookupTitleCommand(char* args)
|
|||
|
||||
// send title in "id (idx:idx) - [namedlink locale]" format
|
||||
if (m_session)
|
||||
{
|
||||
PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->bit_index, id, titleNameStr, localeNames[loc], knownStr, activeStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->bit_index, titleNameStr, localeNames[loc], knownStr, activeStr);
|
||||
}
|
||||
|
||||
++counter;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (counter == 0) // if counter == 0 then we found nth
|
||||
{
|
||||
SendSysMessage(LANG_COMMAND_NOTITLEFOUND);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -5544,7 +5656,9 @@ bool ChatHandler::HandleTitlesSetMaskCommand(char* args)
|
|||
|
||||
for (uint32 i = 1; i < sCharTitlesStore.GetNumRows(); ++i)
|
||||
if (CharTitlesEntry const* tEntry = sCharTitlesStore.LookupEntry(i))
|
||||
{
|
||||
titles2 &= ~(uint64(1) << tEntry->bit_index);
|
||||
}
|
||||
|
||||
titles &= ~titles2; // remove nonexistent titles
|
||||
|
||||
|
|
@ -5580,7 +5694,9 @@ bool ChatHandler::HandleCharacterTitlesCommand(char* args)
|
|||
{
|
||||
std::string name = titleInfo->name[loc];
|
||||
if (name.empty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index
|
||||
? GetMangosString(LANG_ACTIVE)
|
||||
|
|
@ -5591,9 +5707,13 @@ bool ChatHandler::HandleCharacterTitlesCommand(char* args)
|
|||
|
||||
// send title in "id (idx:idx) - [namedlink locale]" format
|
||||
if (m_session)
|
||||
{
|
||||
PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->bit_index, id, titleNameStr, localeNames[loc], knownStr, activeStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->bit_index, name.c_str(), localeNames[loc], knownStr, activeStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
@ -5678,12 +5798,18 @@ bool ChatHandler::HandleMmapPathCommand(char* args)
|
|||
followPath = true;
|
||||
para = strtok(NULL, " ");
|
||||
if (para && strcmp(para, "straight") == 0)
|
||||
{
|
||||
useStraightPath = true;
|
||||
}
|
||||
}
|
||||
else if (strcmp(para, "straight") == 0)
|
||||
{
|
||||
useStraightPath = true;
|
||||
}
|
||||
else if (strcmp(para, "to_me") == 0)
|
||||
{
|
||||
unitToPlayer = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
PSendSysMessage("Use '.mmap path go' to move on target.");
|
||||
|
|
|
|||
|
|
@ -937,7 +937,9 @@ bool ChatHandler::HandleReloadDBScriptsOnGossipCommand(char* args)
|
|||
sScriptMgr.LoadDbScripts(DBS_ON_GOSSIP);
|
||||
|
||||
if (*args != 'a')
|
||||
{
|
||||
SendGlobalSysMessage("DB table `db_scripts [type = DBS_ON_GOSSIP]` reloaded.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -959,7 +961,9 @@ bool ChatHandler::HandleReloadDBScriptsOnSpellCommand(char* args)
|
|||
sScriptMgr.LoadDbScripts(DBS_ON_SPELL);
|
||||
|
||||
if (*args != 'a')
|
||||
{
|
||||
SendGlobalSysMessage("DB table `db_scripts [type = DBS_ON_SPELL]` reloaded.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -981,7 +985,9 @@ bool ChatHandler::HandleReloadDBScriptsOnQuestStartCommand(char* args)
|
|||
sScriptMgr.LoadDbScripts(DBS_ON_QUEST_START);
|
||||
|
||||
if (*args != 'a')
|
||||
{
|
||||
SendGlobalSysMessage("DB table `db_scripts [type = DBS_ON_QUEST_START]` reloaded.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1003,7 +1009,9 @@ bool ChatHandler::HandleReloadDBScriptsOnQuestEndCommand(char* args)
|
|||
sScriptMgr.LoadDbScripts(DBS_ON_QUEST_END);
|
||||
|
||||
if (*args != 'a')
|
||||
{
|
||||
SendGlobalSysMessage("DB table `db_scripts [type = DBS_ON_QUEST_END]` reloaded.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1025,7 +1033,9 @@ bool ChatHandler::HandleReloadDBScriptsOnEventCommand(char* args)
|
|||
sScriptMgr.LoadDbScripts(DBS_ON_EVENT);
|
||||
|
||||
if (*args != 'a')
|
||||
{
|
||||
SendGlobalSysMessage("DB table `db_scripts [type = DBS_ON_EVENT]` reloaded.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1048,7 +1058,9 @@ bool ChatHandler::HandleReloadDBScriptsOnGoUseCommand(char* args)
|
|||
sScriptMgr.LoadDbScripts(DBS_ON_GOT_USE);
|
||||
|
||||
if (*args != 'a')
|
||||
{
|
||||
SendGlobalSysMessage("DB table `db_scripts [type = DBS_ON_GO[_TEMPLATE]_USE]` reloaded.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1070,7 +1082,9 @@ bool ChatHandler::HandleReloadDBScriptsOnCreatureDeathCommand(char* args)
|
|||
sScriptMgr.LoadDbScripts(DBS_ON_CREATURE_DEATH);
|
||||
|
||||
if (*args != 'a')
|
||||
{
|
||||
SendGlobalSysMessage("DB table `db_scripts [type = DBS_ON_CREATURE_DEATH]` reloaded.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1358,19 +1372,27 @@ void ChatHandler::ShowAchievementCriteriaListHelper(AchievementCriteriaEntry con
|
|||
ss << criEntry->ID << " - |cffffffff|Hachievement_criteria:" << criEntry->ID << "|h[" << criEntry->name[loc] << " " << localeNames[loc] << "]|h|r";
|
||||
}
|
||||
else
|
||||
{
|
||||
ss << criEntry->ID << " - " << criEntry->name[loc] << " " << localeNames[loc];
|
||||
}
|
||||
|
||||
if (target)
|
||||
{
|
||||
ss << " = " << target->GetAchievementMgr().GetCriteriaProgressCounter(criEntry);
|
||||
}
|
||||
|
||||
if (achEntry->flags & ACHIEVEMENT_FLAG_COUNTER)
|
||||
{
|
||||
ss << GetMangosString(LANG_COUNTER);
|
||||
}
|
||||
else
|
||||
{
|
||||
ss << " [" << AchievementMgr::GetCriteriaProgressMaxCounter(criEntry, achEntry) << "]";
|
||||
|
||||
if (target && target->GetAchievementMgr().IsCompletedCriteria(criEntry, achEntry))
|
||||
{
|
||||
ss << GetMangosString(LANG_COMPLETE);
|
||||
}
|
||||
}
|
||||
|
||||
SendSysMessage(ss.str().c_str());
|
||||
|
|
@ -1390,7 +1412,9 @@ bool ChatHandler::HandleAchievementCommand(char* args)
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
target = getSelectedPlayer();
|
||||
}
|
||||
|
||||
uint32 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)
|
||||
{
|
||||
if (mgr.IsCompletedCriteria(*itr, achEntry))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32 maxValue = AchievementMgr::GetCriteriaProgressMaxCounter(*itr, achEntry);
|
||||
if (maxValue == std::numeric_limits<uint32>::max())
|
||||
|
|
@ -1528,7 +1554,9 @@ bool ChatHandler::HandleAchievementCriteriaAddCommand(char* args)
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
target = getSelectedPlayer();
|
||||
}
|
||||
|
||||
AchievementCriteriaEntry const* criEntry = sAchievementCriteriaStore.LookupEntry(criId);
|
||||
if (!criEntry)
|
||||
|
|
@ -1570,7 +1598,9 @@ bool ChatHandler::HandleAchievementCriteriaAddCommand(char* args)
|
|||
uint32 new_val;
|
||||
|
||||
if (maxValue)
|
||||
{
|
||||
new_val = progress < maxValue && maxValue - progress > val ? progress + val : maxValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32 max_int = std::numeric_limits<uint32>::max();
|
||||
|
|
@ -1603,7 +1633,9 @@ bool ChatHandler::HandleAchievementCriteriaRemoveCommand(char* args)
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
target = getSelectedPlayer();
|
||||
}
|
||||
|
||||
AchievementCriteriaEntry const* criEntry = sAchievementCriteriaStore.LookupEntry(criId);
|
||||
if (!criEntry)
|
||||
|
|
@ -1778,7 +1810,9 @@ bool ChatHandler::HandleUnLearnCommand(char* args)
|
|||
}
|
||||
|
||||
if (GetTalentSpellCost(spell_id))
|
||||
{
|
||||
target->SendTalentsInfoData(false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2657,15 +2691,21 @@ bool ChatHandler::HandleLearnAllMyPetTalentsCommand(char* /*args*/)
|
|||
{
|
||||
TalentEntry const* talentInfo = sTalentStore.LookupEntry(i);
|
||||
if (!talentInfo)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab);
|
||||
if (!talentTabInfo)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// prevent learn talent for different family (cheating)
|
||||
if (((1 << pet_family->petTalentType) & talentTabInfo->petTalentMask) == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// search highest talent rank
|
||||
uint32 spellid = 0;
|
||||
|
|
@ -2680,11 +2720,15 @@ bool ChatHandler::HandleLearnAllMyPetTalentsCommand(char* /*args*/)
|
|||
}
|
||||
|
||||
if (!spellid) // ??? none spells in talent
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellid);
|
||||
if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, m_session->GetPlayer(), false))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// learn highest rank of talent and learn all non-talent spell ranks (recursive by tree)
|
||||
pet->learnSpellHighRank(spellid);
|
||||
|
|
@ -2765,7 +2809,9 @@ bool ChatHandler::HandleLearnCommand(char* args)
|
|||
SendSysMessage(LANG_YOU_KNOWN_SPELL);
|
||||
}
|
||||
else
|
||||
{
|
||||
PSendSysMessage(LANG_TARGET_KNOWN_SPELL, GetNameLink(targetPlayer).c_str());
|
||||
}
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -2781,7 +2827,9 @@ bool ChatHandler::HandleLearnCommand(char* args)
|
|||
|
||||
uint32 first_spell = sSpellMgr.GetFirstSpellInChain(spell);
|
||||
if (GetTalentSpellCost(first_spell))
|
||||
{
|
||||
targetPlayer->SendTalentsInfoData(false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -3189,9 +3237,13 @@ bool ChatHandler::HandleListItemCommand(char* args)
|
|||
delete result;
|
||||
|
||||
if (count > res_count)
|
||||
{
|
||||
count -= res_count;
|
||||
}
|
||||
else if (count)
|
||||
{
|
||||
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
|
||||
std::ostringstream ss;
|
||||
if (m_session)
|
||||
{
|
||||
ss << id << " - |cff00aa00|Hcurrency:" << id << "|h[" << currency->name[loc];
|
||||
}
|
||||
else
|
||||
{
|
||||
ss << id << " - " << currency->name[loc];
|
||||
}
|
||||
|
||||
if (m_session)
|
||||
{
|
||||
ss << " " << localeNames[loc] << "]|h|r";
|
||||
}
|
||||
else
|
||||
{
|
||||
ss << " " << localeNames[loc];
|
||||
}
|
||||
|
||||
if (target)
|
||||
{
|
||||
ss << " (" << GetMangosString(LANG_CURRENCY_AMOUNT) << ": " << count << ")";
|
||||
}
|
||||
|
||||
SendSysMessage(ss.str().c_str());
|
||||
}
|
||||
|
|
@ -3748,7 +3810,9 @@ bool ChatHandler::HandleLookupCurrencyCommand(char* args)
|
|||
int loc = GetSessionDbcLocale();
|
||||
std::string name = currency->name[loc];
|
||||
if (name.empty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!Utf8FitTo(name, wnamepart))
|
||||
{
|
||||
|
|
@ -3756,14 +3820,20 @@ bool ChatHandler::HandleLookupCurrencyCommand(char* args)
|
|||
for (; loc < MAX_LOCALE; ++loc)
|
||||
{
|
||||
if (loc == GetSessionDbcLocale())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
name = currency->name[loc];
|
||||
if (name.empty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Utf8FitTo(name, wnamepart))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3775,7 +3845,9 @@ bool ChatHandler::HandleLookupCurrencyCommand(char* args)
|
|||
}
|
||||
}
|
||||
if (counter == 0) // if counter == 0 then we found nth
|
||||
{
|
||||
SendSysMessage(LANG_COMMAND_NOCURRENCYFOUND);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -3842,7 +3914,9 @@ bool ChatHandler::HandleLookupSpellCommand(char* args)
|
|||
if (loc < MAX_LOCALE)
|
||||
{
|
||||
if (target)
|
||||
{
|
||||
ShowSpellListHelper(target, spellInfo, LocaleConstant(loc));
|
||||
}
|
||||
|
||||
++counter;
|
||||
}
|
||||
|
|
@ -4570,7 +4644,9 @@ bool ChatHandler::HandleReviveCommand(char* args)
|
|||
}
|
||||
else
|
||||
// will resurrected at login without corpse
|
||||
{ sObjectAccessor.ConvertCorpseForPlayer(target_guid); }
|
||||
{
|
||||
sObjectAccessor.ConvertCorpseForPlayer(target_guid);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -4608,7 +4684,9 @@ bool ChatHandler::HandleAuraCommand(char* args)
|
|||
{
|
||||
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(SpellEffectIndex(i));
|
||||
if(!spellEffect)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
uint8 eff = spellEffect->Effect;
|
||||
if (eff >= TOTAL_SPELL_EFFECTS)
|
||||
|
|
@ -4887,14 +4965,18 @@ bool ChatHandler::HandleNpcInfoCommand(char* /*args*/)
|
|||
uint32 diff = 1;
|
||||
for (; diff < MAX_DIFFICULTY; ++diff)
|
||||
if (baseInfo->DifficultyEntry[diff - 1] == target->GetCreatureInfo()->Entry)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (diff < MAX_DIFFICULTY)
|
||||
PSendSysMessage(LANG_NPCINFO_CHAR_DIFFICULTY, target->GetGuidStr().c_str(), faction, npcflags,
|
||||
Entry, target->GetCreatureInfo()->Entry, diff,
|
||||
displayid, nativeid);
|
||||
else
|
||||
{
|
||||
PSendSysMessage(LANG_NPCINFO_CHAR, target->GetGuidStr().c_str(), faction, npcflags, Entry, displayid, nativeid);
|
||||
}
|
||||
|
||||
PSendSysMessage(LANG_NPCINFO_LEVEL, target->getLevel());
|
||||
PSendSysMessage(LANG_NPCINFO_HEALTH, target->GetCreateHealth(), target->GetMaxHealth(), target->GetHealth());
|
||||
|
|
@ -4998,7 +5080,9 @@ bool ChatHandler::HandleNpcAddWeaponCommand(char* /*args*/)
|
|||
}
|
||||
|
||||
if(added)
|
||||
{
|
||||
PSendSysMessage(LANG_ITEM_ADDED_TO_SLOT,ItemID,tmpItem->Name1,SlotID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -5130,7 +5214,9 @@ bool ChatHandler::HandleCharacterLevelCommand(char* args)
|
|||
}
|
||||
|
||||
if (newlevel < 1)
|
||||
{ return false; } // invalid level
|
||||
{
|
||||
return false; // invalid level
|
||||
}
|
||||
|
||||
if (newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level
|
||||
{
|
||||
|
|
@ -5490,9 +5576,13 @@ bool ChatHandler::HandleChangeWeatherCommand(char* args)
|
|||
|
||||
// clamp grade from 0 to 1
|
||||
if (grade < 0.0f)
|
||||
{
|
||||
grade = 0.0f;
|
||||
}
|
||||
else if (grade > 1.0f)
|
||||
{
|
||||
grade = 1.0f;
|
||||
}
|
||||
|
||||
Player* player = m_session->GetPlayer();
|
||||
uint32 zoneId = player->GetZoneId();
|
||||
|
|
@ -5708,9 +5798,13 @@ bool ChatHandler::HandleResetAchievementsCommand(char* args)
|
|||
}
|
||||
|
||||
if (target)
|
||||
{
|
||||
target->GetAchievementMgr().Reset();
|
||||
}
|
||||
else
|
||||
{
|
||||
AchievementMgr::DeleteFromDB(target_guid);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -5886,7 +5980,9 @@ bool ChatHandler::HandleResetSpecsCommand(char* args)
|
|||
Pet* pet = target->GetPet();
|
||||
Pet::resetTalentsForAllPetsOf(target, pet);
|
||||
if (pet)
|
||||
{
|
||||
target->SendTalentsInfoData(true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if (target_guid)
|
||||
|
|
@ -5921,7 +6017,9 @@ bool ChatHandler::HandleResetTalentsCommand(char* args)
|
|||
|
||||
ChatHandler((Player*)owner).SendSysMessage(LANG_RESET_PET_TALENTS);
|
||||
if (!m_session || m_session->GetPlayer() != ((Player*)owner))
|
||||
{
|
||||
PSendSysMessage(LANG_RESET_PET_TALENTS_ONLINE, GetNameLink((Player*)owner).c_str());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -5937,12 +6035,16 @@ bool ChatHandler::HandleResetTalentsCommand(char* args)
|
|||
target->SendTalentsInfoData(false);
|
||||
ChatHandler(target).SendSysMessage(LANG_RESET_TALENTS);
|
||||
if (!m_session || m_session->GetPlayer() != target)
|
||||
{
|
||||
PSendSysMessage(LANG_RESET_TALENTS_ONLINE, GetNameLink(target).c_str());
|
||||
}
|
||||
|
||||
Pet* pet = target->GetPet();
|
||||
Pet::resetTalentsForAllPetsOf(target, pet);
|
||||
if (pet)
|
||||
{
|
||||
target->SendTalentsInfoData(true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -6316,11 +6418,15 @@ bool ChatHandler::HandleQuestCompleteCommand(char* args)
|
|||
for (int i = 0; i < QUEST_REQUIRED_CURRENCY_COUNT; ++i)
|
||||
{
|
||||
if (pQuest->ReqCurrencyId[i])
|
||||
{
|
||||
player->ModifyCurrencyCount(pQuest->ReqCurrencyId[i], int32(pQuest->ReqCurrencyCount[i] * GetCurrencyPrecision(pQuest->ReqCurrencyId[i])));
|
||||
}
|
||||
}
|
||||
|
||||
if (uint32 spell = pQuest->GetReqSpellLearned())
|
||||
{
|
||||
player->learnSpell(spell, false);
|
||||
}
|
||||
|
||||
player->CompleteQuest(entry, QUEST_STATUS_FORCE_COMPLETE);
|
||||
return true;
|
||||
|
|
@ -7539,7 +7645,9 @@ bool ChatHandler::HandleInstanceUnbindCommand(char* args)
|
|||
++counter;
|
||||
}
|
||||
else
|
||||
{
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
}
|
||||
PSendSysMessage("instances unbound: %d", counter);
|
||||
|
|
@ -7721,7 +7829,9 @@ bool ChatHandler::HandleAccountSetAddonCommand(char* args)
|
|||
// or to self account
|
||||
if (GetAccountId() && GetAccountId() != account_id &&
|
||||
HasLowerSecurityAccount(NULL, account_id, true))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 lev;
|
||||
if (!ExtractUInt32(&args, lev))
|
||||
|
|
@ -8236,18 +8346,24 @@ bool ChatHandler::HandleMmapTestHeight(char* args)
|
|||
float radius = 0.0f;
|
||||
ExtractFloat(&args, radius);
|
||||
if (radius > 40.0f)
|
||||
{
|
||||
radius = 40.0f;
|
||||
}
|
||||
|
||||
Unit* unit = getSelectedUnit();
|
||||
|
||||
Player* player = m_session->GetPlayer();
|
||||
if (!unit)
|
||||
{
|
||||
unit = player;
|
||||
}
|
||||
|
||||
if (unit->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
if (radius < 0.1f)
|
||||
{
|
||||
radius = static_cast<Creature*>(unit)->GetRespawnRadius();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -8280,7 +8396,9 @@ bool ChatHandler::HandleMmapTestHeight(char* args)
|
|||
unit->SummonCreature(VISUAL_WAYPOINT, gx, gy, gz, 0, TEMPSUMMON_TIMED_DESPAWN, 15000);
|
||||
++successes;
|
||||
if (successes >= 100)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
uint32 genTime = WorldTimer::getMSTimeDiff(startTime, WorldTimer::getMSTime());
|
||||
|
|
|
|||
|
|
@ -512,9 +512,13 @@ bool ChatHandler::HandleAccountCreateCommand(char* args)
|
|||
AccountOpResult result;
|
||||
uint32 expansion = 0;
|
||||
if(ExtractUInt32(&args, expansion))
|
||||
{
|
||||
result = sAccountMgr.CreateAccount(account_name, password, expansion);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = sAccountMgr.CreateAccount(account_name, password);
|
||||
}
|
||||
switch (result)
|
||||
{
|
||||
case AOR_OK:
|
||||
|
|
|
|||
|
|
@ -148,11 +148,15 @@ bool ChatHandler::HandleDebugRecvOpcodeCommand(char* /*args*/)
|
|||
{
|
||||
Unit* unit = getSelectedUnit();
|
||||
if (!unit || (unit->GetTypeId() != TYPEID_PLAYER))
|
||||
{ unit = m_session->GetPlayer(); }
|
||||
{
|
||||
unit = m_session->GetPlayer();
|
||||
}
|
||||
|
||||
std::ifstream stream("ropcode.txt");
|
||||
if (!stream.is_open())
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 opcode = 0;
|
||||
if (!(stream >> opcode))
|
||||
|
|
@ -167,7 +171,9 @@ bool ChatHandler::HandleDebugRecvOpcodeCommand(char* /*args*/)
|
|||
while (stream >> type)
|
||||
{
|
||||
if (type.empty())
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (type == "uint8")
|
||||
{
|
||||
|
|
@ -206,17 +212,29 @@ bool ChatHandler::HandleDebugRecvOpcodeCommand(char* /*args*/)
|
|||
*data << value;
|
||||
}
|
||||
else if (type == "pguid")
|
||||
{ *data << unit->GetPackGUID(); }
|
||||
{
|
||||
*data << unit->GetPackGUID();
|
||||
}
|
||||
else if (type == "guid")
|
||||
{ *data << unit->GetObjectGuid(); }
|
||||
{
|
||||
*data << unit->GetObjectGuid();
|
||||
}
|
||||
else if (type == "mypguid")
|
||||
{ *data << m_session->GetPlayer()->GetPackGUID(); }
|
||||
{
|
||||
*data << m_session->GetPlayer()->GetPackGUID();
|
||||
}
|
||||
else if (type == "myguid")
|
||||
{ *data << m_session->GetPlayer()->GetObjectGuid(); }
|
||||
{
|
||||
*data << m_session->GetPlayer()->GetObjectGuid();
|
||||
}
|
||||
else if (type == "name")
|
||||
{ *data << unit->GetName(); }
|
||||
{
|
||||
*data << unit->GetName();
|
||||
}
|
||||
else if (type == "myname")
|
||||
{ *data << m_session->GetPlayerName(); }
|
||||
{
|
||||
*data << m_session->GetPlayerName();
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG("Sending opcode: unknown type '%s'", type.c_str());
|
||||
|
|
@ -301,17 +319,29 @@ bool ChatHandler::HandleDebugSendOpcodeCommand(char* /*args*/)
|
|||
data << value;
|
||||
}
|
||||
else if (type == "pguid")
|
||||
{ data << unit->GetPackGUID(); }
|
||||
{
|
||||
data << unit->GetPackGUID();
|
||||
}
|
||||
else if (type == "guid")
|
||||
{ data << unit->GetObjectGuid(); }
|
||||
{
|
||||
data << unit->GetObjectGuid();
|
||||
}
|
||||
else if(type == "mypguid")
|
||||
{ data << m_session->GetPlayer()->GetPackGUID(); }
|
||||
{
|
||||
data << m_session->GetPlayer()->GetPackGUID();
|
||||
}
|
||||
else if (type == "myguid")
|
||||
{ data << m_session->GetPlayer()->GetObjectGuid(); }
|
||||
{
|
||||
data << m_session->GetPlayer()->GetObjectGuid();
|
||||
}
|
||||
else if (type == "name")
|
||||
{ data << unit->GetName(); }
|
||||
{
|
||||
data << unit->GetName();
|
||||
}
|
||||
else if (type == "myname")
|
||||
{ data << m_session->GetPlayerName(); }
|
||||
{
|
||||
data << m_session->GetPlayerName();
|
||||
}
|
||||
else
|
||||
{
|
||||
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));
|
||||
if(!spellEffect)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// Heals (Also count Mana Shield and Absorb effects as heals)
|
||||
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)))
|
||||
|
|
@ -1394,7 +1426,9 @@ bool ChatHandler::HandleDebugSpellCoefsCommand(char* args)
|
|||
{
|
||||
SpellEffectEntry const* spellEffect = spellEntry->GetSpellEffect(SpellEffectIndex(i));
|
||||
if(!spellEffect)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// Periodic Heals
|
||||
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();
|
||||
|
||||
if (owner.GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
owner.SetTargetGuid(ObjectGuid());
|
||||
}
|
||||
|
||||
_setTargetLocation(owner);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,9 @@ void MotionMaster::Initialize()
|
|||
push(movement == NULL ? &si_idleMovement : movement);
|
||||
top()->Initialize(*m_owner);
|
||||
if (top()->GetMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
|
||||
{
|
||||
(static_cast<WaypointMovementGenerator<Creature>*>(top()))->InitializeWaypointPath(*((Creature*)(m_owner)), 0, PATH_NO_PATH, 0, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -101,7 +101,9 @@ dtPolyRef PathFinder::getPathPolyByPosition(const dtPolyRef* polyPath, uint32 po
|
|||
float closestPoint[VERTEX_SIZE];
|
||||
dtStatus dtResult = m_navMeshQuery->closestPointOnPoly(polyPath[i], point, closestPoint, NULL);
|
||||
if (dtStatusFailed(dtResult))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
float d = dtVdist2DSqr(point, closestPoint);
|
||||
if (d < minDist2d)
|
||||
|
|
@ -187,7 +189,9 @@ void PathFinder::BuildPolyPath(const Vector3& startPos, const Vector3& endPos)
|
|||
// Check for swimming or flying shortcut
|
||||
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)))
|
||||
{ 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
|
||||
{
|
||||
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;
|
||||
if (creature->CanWalk())
|
||||
{ includeFlags |= NAV_GROUND; } // walk
|
||||
{
|
||||
includeFlags |= NAV_GROUND; // walk
|
||||
}
|
||||
|
||||
// creatures don't take environmental damage
|
||||
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)
|
||||
{
|
||||
|
|
@ -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.
|
||||
if ((steerPathFlags[ns] & DT_STRAIGHTPATH_OFFMESH_CONNECTION) ||
|
||||
!inRangeYZX(&steerPath[ns * VERTEX_SIZE], startPos, minTargetDist, 1000.0f))
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
++ns;
|
||||
}
|
||||
// Failed to find good point to steer to.
|
||||
|
|
|
|||
|
|
@ -61,12 +61,18 @@ void RandomMovementGenerator<Creature>::_setRandomLocation(Creature& creature)
|
|||
init.SetWalk(true);
|
||||
init.Launch();
|
||||
if (roll_chance_i(MOVEMENT_RANDOM_MMGEN_CHANCE_NO_BREAK))
|
||||
{
|
||||
i_nextMoveTime.Reset(50);
|
||||
}
|
||||
else
|
||||
{
|
||||
i_nextMoveTime.Reset(urand(3000, 10000)); // Keep a short wait time
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
i_nextMoveTime.Reset(50); // Retry later
|
||||
}
|
||||
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());
|
||||
|
||||
if (!overwriteEntry)
|
||||
{
|
||||
overwriteEntry = creature.GetEntry();
|
||||
}
|
||||
|
||||
if (wpOrigin == PATH_NO_PATH && pathId == 0)
|
||||
{
|
||||
i_path = sWaypointMgr.GetDefaultPath(overwriteEntry, creature.GetGUIDLow(), &m_PathOrigin);
|
||||
}
|
||||
else
|
||||
{
|
||||
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 (m_PathOrigin == PATH_FROM_EXTERNAL)
|
||||
{
|
||||
sLog.outErrorScriptLib("WaypointMovementGenerator::LoadPath: %s doesn't have waypoint path %i", creature.GetGuidStr().c_str(), pathId);
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog.outErrorDb("WaypointMovementGenerator::LoadPath: %s doesn't have waypoint path %i", creature.GetGuidStr().c_str(), pathId);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -186,7 +194,9 @@ void WaypointMovementGenerator<Creature>::OnArrived(Creature& creature)
|
|||
{
|
||||
uint32 type = WAYPOINT_MOTION_TYPE;
|
||||
if (m_PathOrigin == PATH_FROM_EXTERNAL && m_pathId > 0)
|
||||
{
|
||||
type = EXTERNAL_WAYPOINT_MOVE + m_pathId;
|
||||
}
|
||||
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 (!reachedLast)
|
||||
{
|
||||
creature.AI()->MovementInform(EXTERNAL_WAYPOINT_MOVE_START + m_pathId, currPoint->first);
|
||||
}
|
||||
else
|
||||
{
|
||||
creature.AI()->MovementInform(EXTERNAL_WAYPOINT_FINISHED_LAST + m_pathId, currPoint->first);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
if (curWP->orientation != 100)
|
||||
{
|
||||
o = curWP->orientation;
|
||||
}
|
||||
else // Calculate the resulting angle based on positions between previous and current waypoint
|
||||
{
|
||||
WaypointNode const* prevWP;
|
||||
|
|
@ -355,7 +371,9 @@ bool WaypointMovementGenerator<Creature>::GetResetPosition(Creature&, float& x,
|
|||
prevWP = &(lastPoint->second);
|
||||
}
|
||||
else // Take the last waypoint (crbegin()) as previous
|
||||
{
|
||||
prevWP = &(i_path->rbegin()->second);
|
||||
}
|
||||
|
||||
float dx = x - prevWP->x;
|
||||
float dy = y - prevWP->y;
|
||||
|
|
|
|||
|
|
@ -32,11 +32,17 @@
|
|||
void ArenaTeamMember::ModifyPersonalRating(Player* plr, int32 mod, uint32 slot)
|
||||
{
|
||||
if (int32(personal_rating) + mod < 0)
|
||||
{
|
||||
personal_rating = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
personal_rating += mod;
|
||||
}
|
||||
if (plr)
|
||||
{
|
||||
plr->SetArenaTeamInfoField(slot, ARENA_TEAM_PERSONAL_RATING, personal_rating);
|
||||
}
|
||||
}
|
||||
|
||||
ArenaTeam::ArenaTeam()
|
||||
|
|
@ -56,12 +62,18 @@ ArenaTeam::ArenaTeam()
|
|||
if (conf_value < 0) // -1 = select by season id
|
||||
{
|
||||
if (sWorld.getConfig(CONFIG_UINT32_ARENA_SEASON_ID) >= 6)
|
||||
{
|
||||
m_stats.rating = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_stats.rating = 1500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_stats.rating = uint32(conf_value);
|
||||
}
|
||||
|
||||
m_stats.wins_week = 0;
|
||||
m_stats.wins_season = 0;
|
||||
|
|
@ -171,9 +183,13 @@ bool ArenaTeam::AddMember(ObjectGuid playerGuid)
|
|||
if (sWorld.getConfig(CONFIG_UINT32_ARENA_SEASON_ID) >= 6)
|
||||
{
|
||||
if (m_stats.rating < 1000)
|
||||
{
|
||||
newmember.personal_rating = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
newmember.personal_rating = 1000;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -181,7 +197,9 @@ bool ArenaTeam::AddMember(ObjectGuid playerGuid)
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
newmember.personal_rating = uint32(conf_value);
|
||||
}
|
||||
|
||||
m_members.push_back(newmember);
|
||||
|
||||
|
|
@ -195,7 +213,9 @@ bool ArenaTeam::AddMember(ObjectGuid playerGuid)
|
|||
|
||||
// hide promote/remove buttons
|
||||
if (m_CaptainGuid != playerGuid)
|
||||
{
|
||||
pl->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -249,7 +269,9 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult* arenaTeamMembersResult)
|
|||
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
|
||||
if (!fields)
|
||||
{
|
||||
break;
|
||||
}
|
||||
uint32 arenaTeamId = fields[0].GetUInt32();
|
||||
if (arenaTeamId < m_TeamId)
|
||||
{
|
||||
|
|
@ -288,7 +310,9 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult* arenaTeamMembersResult)
|
|||
}
|
||||
|
||||
if (newmember.guid == GetCaptainGuid())
|
||||
{
|
||||
captainPresentInTeam = true;
|
||||
}
|
||||
|
||||
m_members.push_back(newmember);
|
||||
}
|
||||
|
|
@ -309,7 +333,9 @@ void ArenaTeam::SetCaptain(ObjectGuid guid)
|
|||
// disable remove/promote buttons
|
||||
Player* oldcaptain = sObjectMgr.GetPlayer(GetCaptainGuid());
|
||||
if (oldcaptain)
|
||||
{
|
||||
oldcaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1);
|
||||
}
|
||||
|
||||
// set new captain
|
||||
m_CaptainGuid = guid;
|
||||
|
|
@ -319,7 +345,9 @@ void ArenaTeam::SetCaptain(ObjectGuid guid)
|
|||
|
||||
// enable remove/promote buttons
|
||||
if (Player* newcaptain = sObjectMgr.GetPlayer(guid))
|
||||
{
|
||||
newcaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void ArenaTeam::DelMember(ObjectGuid guid)
|
||||
|
|
@ -441,7 +469,9 @@ void ArenaTeam::NotifyStatsChanged()
|
|||
{
|
||||
Player* plr = sObjectMgr.GetPlayer(itr->guid);
|
||||
if (plr)
|
||||
{
|
||||
Stats(plr->GetSession());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -516,7 +546,9 @@ void ArenaTeam::BroadcastPacket(WorldPacket* packet)
|
|||
{
|
||||
Player* player = sObjectMgr.GetPlayer(itr->guid);
|
||||
if (player)
|
||||
{
|
||||
player->GetSession()->SendPacket(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -540,10 +572,14 @@ void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, ObjectGuid guid, char cons
|
|||
data << str2;
|
||||
}
|
||||
else if (str1)
|
||||
{
|
||||
data << str1;
|
||||
}
|
||||
|
||||
if (guid)
|
||||
{
|
||||
data << ObjectGuid(guid);
|
||||
}
|
||||
|
||||
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
|
||||
if (sWorld.getConfig(CONFIG_UINT32_ARENA_SEASON_ID) >= 6)
|
||||
{
|
||||
rating = 1500;
|
||||
}
|
||||
|
||||
points = (float)rating * 0.22f + 14.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
points = 1511.26f / (1.0f + 1639.28f * exp(-0.00412f * (float)rating));
|
||||
}
|
||||
|
||||
// type penalties for <5v5 teams
|
||||
if (m_Type == ARENA_TYPE_2v2)
|
||||
{
|
||||
points *= 0.76f;
|
||||
}
|
||||
else if (m_Type == ARENA_TYPE_3v3)
|
||||
{
|
||||
points *= 0.88f;
|
||||
}
|
||||
|
||||
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 (enemy_rating < 1000)
|
||||
{
|
||||
enemy_rating = 1000;
|
||||
}
|
||||
return 1.0f / (1.0f + exp(log(10.0f) * (float)((float)enemy_rating - (float)own_rating) / 400.0f));
|
||||
}
|
||||
|
||||
void ArenaTeam::FinishGame(int32 mod)
|
||||
{
|
||||
if (int32(m_stats.rating) + mod < 0)
|
||||
{
|
||||
m_stats.rating = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_stats.rating += mod;
|
||||
}
|
||||
|
||||
m_stats.games_week += 1;
|
||||
m_stats.games_season += 1;
|
||||
|
|
@ -642,7 +692,9 @@ void ArenaTeam::FinishGame(int32 mod)
|
|||
for (; i != sObjectMgr.GetArenaTeamMapEnd(); ++i)
|
||||
{
|
||||
if (i->second->GetType() == this->m_Type && i->second->GetStats().rating > m_stats.rating)
|
||||
{
|
||||
++m_stats.rank;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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)
|
||||
int32 mod = (int32)ceil(K * (0.0f - chance));
|
||||
if (int32(itr->personal_rating) + mod < 0)
|
||||
{
|
||||
itr->personal_rating = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
itr->personal_rating += mod;
|
||||
}
|
||||
// update personal played stats
|
||||
itr->games_week += 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
|
||||
uint32 points_to_add = 0;
|
||||
if (itr->games_week >= min_plays)
|
||||
{
|
||||
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);
|
||||
|
||||
std::map<uint32, uint32>::iterator plr_itr = PlayerPoints.find(itr->guid.GetCounter());
|
||||
|
|
@ -776,10 +834,14 @@ void ArenaTeam::UpdateArenaPointsHelper(std::map<uint32, uint32>& PlayerPoints)
|
|||
{
|
||||
// check if there is already more points
|
||||
if (plr_itr->second < points_to_add)
|
||||
{
|
||||
PlayerPoints[itr->guid.GetCounter()] = points_to_add;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerPoints[itr->guid.GetCounter()] = points_to_add;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -165,7 +165,9 @@ class ArenaTeam
|
|||
{
|
||||
for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
|
||||
if (itr->guid == guid)
|
||||
{
|
||||
return &(*itr);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -174,7 +176,9 @@ class ArenaTeam
|
|||
{
|
||||
for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
|
||||
if (itr->name == name)
|
||||
{
|
||||
return &(*itr);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,7 +141,9 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction)
|
|||
{
|
||||
std::string owner_name;
|
||||
if (auction_owner)
|
||||
{
|
||||
owner_name = auction_owner->GetName();
|
||||
}
|
||||
else if (ownerGuid && !sObjectMgr.GetPlayerNameByGUID(ownerGuid, owner_name))
|
||||
{
|
||||
owner_name = sObjectMgr.GetMangosStringForDBCLocale(LANG_UNKNOWN);
|
||||
|
|
@ -159,7 +161,9 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction)
|
|||
}
|
||||
|
||||
if (auction_owner)
|
||||
{
|
||||
auction_owner->GetSession()->SendAuctionOwnerNotification(auction);
|
||||
}
|
||||
|
||||
// receiver exist
|
||||
if (bidder || bidder_accId)
|
||||
|
|
@ -272,7 +276,9 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction)
|
|||
subject << auction->itemTemplate << ":" << auction->itemRandomPropertyId << ":" << AUCTION_EXPIRED << ":" << auction->Id << ":" << auction->itemCount;
|
||||
|
||||
if (owner)
|
||||
{
|
||||
owner->GetSession()->SendAuctionOwnerNotification(auction);
|
||||
}
|
||||
|
||||
RemoveAItem(auction->itemGuidLow); // we have to remove the item, before we delete it !!
|
||||
auction->itemGuidLow = 0;
|
||||
|
|
@ -408,7 +414,9 @@ void AuctionHouseMgr::LoadAuctions()
|
|||
{
|
||||
std::string plName;
|
||||
if (!sObjectMgr.GetPlayerNameByGUID(ObjectGuid(HIGHGUID_PLAYER, auction->owner), plName))
|
||||
{
|
||||
plName = sObjectMgr.GetMangosStringForDBCLocale(LANG_UNKNOWN);
|
||||
}
|
||||
|
||||
Utf8toWStr(plName, plWName);
|
||||
}
|
||||
|
|
@ -426,7 +434,9 @@ void AuctionHouseMgr::LoadAuctions()
|
|||
auction->auctionHouseEntry = NULL; // init later
|
||||
|
||||
if (auction->moneyDeliveryTime)
|
||||
{
|
||||
auction->itemGuidLow = 0; // must be 0 if auction delivery pending
|
||||
}
|
||||
else
|
||||
{
|
||||
// check if sold item exists for guid
|
||||
|
|
@ -567,13 +577,21 @@ AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(Unit* unit)
|
|||
{
|
||||
FactionTemplateEntry const* u_entry = sFactionTemplateStore.LookupEntry(factionTemplateId);
|
||||
if (!u_entry)
|
||||
{ houseid = 7; } // goblin auction house
|
||||
{
|
||||
houseid = 7; // goblin auction house
|
||||
}
|
||||
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)
|
||||
{ houseid = 6; } // orc auction house
|
||||
{
|
||||
houseid = 6; // orc auction house
|
||||
}
|
||||
else
|
||||
{ houseid = 7; } // goblin auction house
|
||||
{
|
||||
houseid = 7; // goblin auction house
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -625,7 +643,9 @@ void AuctionHouseObject::Update()
|
|||
{
|
||||
///- perform the transaction if there was bidder
|
||||
if (itr->second->bid)
|
||||
{
|
||||
itr->second->AuctionBidWinning();
|
||||
}
|
||||
///- cancel the auction if there was no bidder and clear the auction
|
||||
else
|
||||
{
|
||||
|
|
@ -649,7 +669,9 @@ void AuctionHouseObject::BuildListBidderItems(WorldPacket& data, Player* player,
|
|||
{
|
||||
AuctionEntry* Aentry = itr->second;
|
||||
if (Aentry->moneyDeliveryTime) // skip pending sell auctions
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (Aentry->bidder == player->GetGUIDLow())
|
||||
{
|
||||
if (itr->second->BuildAuctionInfo(data))
|
||||
|
|
@ -667,7 +689,9 @@ void AuctionHouseObject::BuildListOwnerItems(WorldPacket& data, Player* player,
|
|||
{
|
||||
AuctionEntry* Aentry = itr->second;
|
||||
if (Aentry->moneyDeliveryTime) // skip pending sell auctions
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (Aentry->owner == player->GetGUIDLow())
|
||||
{
|
||||
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);
|
||||
// "equal" by used column
|
||||
if (res == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// less/greater and normal/reversed ordered
|
||||
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;
|
||||
if (Aentry->moneyDeliveryTime)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Item* item = sAuctionMgr.GetAItem(Aentry->itemGuidLow);
|
||||
if (!item)
|
||||
{
|
||||
|
|
@ -940,7 +968,9 @@ void WorldSession::BuildListAuctionItems(std::vector<AuctionEntry*> const& aucti
|
|||
if (usable != 0x00)
|
||||
{
|
||||
if (_player->CanUseItem(item) != EQUIP_ERR_OK)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (proto->Class == ITEM_CLASS_RECIPE)
|
||||
{
|
||||
|
|
@ -948,10 +978,14 @@ void WorldSession::BuildListAuctionItems(std::vector<AuctionEntry*> const& aucti
|
|||
{
|
||||
SpellEffectEntry const* spellEff = spell->GetSpellEffect(EFFECT_INDEX_0);
|
||||
if (!spellEff)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (_player->HasSpell(spellEff->EffectTriggerSpell))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -981,7 +1015,9 @@ void AuctionHouseObject::BuildListPendingSales(WorldPacket& data, Player* player
|
|||
{
|
||||
AuctionEntry* Aentry = itr->second;
|
||||
if (!Aentry->moneyDeliveryTime) // skip not pending auctions
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (Aentry->owner == player->GetGUIDLow())
|
||||
{
|
||||
std::ostringstream str1;
|
||||
|
|
@ -1016,7 +1052,9 @@ AuctionEntry* AuctionHouseObject::AddAuction(AuctionHouseEntry const* auctionHou
|
|||
AH->owner = pl ? pl->GetGUIDLow() : 0;
|
||||
|
||||
if (pl)
|
||||
{
|
||||
Utf8toWStr(pl->GetName(), AH->ownerName);
|
||||
}
|
||||
|
||||
AH->startbid = bid;
|
||||
AH->bidder = 0;
|
||||
|
|
@ -1142,7 +1180,9 @@ bool AuctionEntry::UpdateBid(uint64 newbid, Player* newbidder /*=NULL*/)
|
|||
else
|
||||
{
|
||||
if (newbidder)
|
||||
{
|
||||
newbidder->ModifyMoney(-int64(newbid));
|
||||
}
|
||||
|
||||
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 (auction_owner)
|
||||
{
|
||||
auction_owner->GetSession()->SendAuctionOwnerNotification(this);
|
||||
}
|
||||
|
||||
// after this update we should save player's money ...
|
||||
CharacterDatabase.BeginTransaction();
|
||||
|
|
|
|||
|
|
@ -236,7 +236,9 @@ uint32 Bag::GetItemCount(uint32 item, Item* eItem) const
|
|||
for (uint32 i = 0; i < GetBagSize(); ++i)
|
||||
if (m_bagslot[i])
|
||||
if (m_bagslot[i] != eItem && m_bagslot[i]->GetProto()->Socket[0].Color)
|
||||
{
|
||||
count += m_bagslot[i]->GetGemCountWithID(item);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
|
@ -248,7 +250,9 @@ uint32 Bag::GetItemCountWithLimitCategory(uint32 limitCategory, Item* eItem) con
|
|||
for (uint32 i = 0; i < GetBagSize(); ++i)
|
||||
if (m_bagslot[i])
|
||||
if (m_bagslot[i] != eItem && m_bagslot[i]->GetProto()->ItemLimitCategory == limitCategory)
|
||||
{
|
||||
count += m_bagslot[i]->GetCount();
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,9 @@ void CalendarEvent::RemoveInviteByItr(CalendarInviteMap::iterator inviteItr)
|
|||
MANGOS_ASSERT(inviteItr != m_Invitee.end()); // iterator must be valid
|
||||
|
||||
if (!IsGuildEvent())
|
||||
{
|
||||
sCalendarMgr.SendCalendarEventInviteRemoveAlert(sObjectMgr.GetPlayer(inviteItr->second->InviteeGuid), this, CALENDAR_STATUS_REMOVED);
|
||||
}
|
||||
|
||||
sCalendarMgr.SendCalendarEventInviteRemove(inviteItr->second, Flags);
|
||||
|
||||
|
|
@ -97,9 +99,13 @@ void CalendarEvent::RemoveInviteByGuid(ObjectGuid const& playerGuid)
|
|||
while (itr != m_Invitee.end())
|
||||
{
|
||||
if (itr->second->InviteeGuid == playerGuid)
|
||||
{
|
||||
RemoveInviteByItr(itr++);
|
||||
}
|
||||
else
|
||||
{
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -175,7 +181,9 @@ void CalendarEvent::RemoveAllInvite(ObjectGuid const& removerGuid)
|
|||
while (itr != m_Invitee.end())
|
||||
{
|
||||
if (removerGuid != itr->second->InviteeGuid)
|
||||
{
|
||||
draft.SendMailTo(MailReceiver(itr->second->InviteeGuid), this, MAIL_CHECK_MASK_COPIED);
|
||||
}
|
||||
RemoveInviteByItr(itr++);
|
||||
}
|
||||
}
|
||||
|
|
@ -189,7 +197,9 @@ CalendarInvite::CalendarInvite(CalendarEvent* event, uint64 inviteId, ObjectGuid
|
|||
{
|
||||
// only for pre invite case
|
||||
if (!event)
|
||||
{
|
||||
InviteId = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -202,9 +212,13 @@ void CalendarMgr::GetPlayerEventsList(ObjectGuid const& guid, CalendarEventsList
|
|||
uint32 guildId = 0;
|
||||
Player* player = sObjectMgr.GetPlayer(guid);
|
||||
if (player)
|
||||
{
|
||||
guildId = player->GetGuildId();
|
||||
}
|
||||
else
|
||||
{
|
||||
guildId = Player::GetGuildIdFromDB(guid);
|
||||
}
|
||||
|
||||
for (CalendarEventStore::iterator itr = m_EventStore.begin(); itr != m_EventStore.end(); ++itr)
|
||||
{
|
||||
|
|
@ -219,7 +233,9 @@ void CalendarMgr::GetPlayerEventsList(ObjectGuid const& guid, CalendarEventsList
|
|||
|
||||
// add all event where player is invited
|
||||
if (event->GetInviteByGuid(guid))
|
||||
{
|
||||
calEventList.push_back(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -231,7 +247,9 @@ void CalendarMgr::GetPlayerInvitesList(ObjectGuid const& guid, CalendarInvitesLi
|
|||
CalendarEvent* event = &itr->second;
|
||||
|
||||
if (event->IsGuildAnnouncement())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
CalendarInviteMap const* cInvMap = event->GetInviteMap();
|
||||
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);
|
||||
|
||||
if (!event->IsGuildAnnouncement())
|
||||
{
|
||||
SendCalendarEventInvite(invite);
|
||||
}
|
||||
|
||||
if (!event->IsGuildEvent() || invite->InviteeGuid == event->CreatorGuid)
|
||||
{
|
||||
SendCalendarEventInviteAlert(invite);
|
||||
}
|
||||
|
||||
if (event->IsGuildAnnouncement())
|
||||
{
|
||||
|
|
@ -457,16 +479,22 @@ uint32 CalendarMgr::GetPlayerNumPending(ObjectGuid const& guid)
|
|||
{
|
||||
// pass all passed events
|
||||
if (event->EventTime < currTime)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// pass all locked events
|
||||
if (event->Flags & CALENDAR_FLAG_INVITES_LOCKED)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
++pendingNum;
|
||||
}
|
||||
}
|
||||
|
||||
return pendingNum;
|
||||
|
|
@ -492,7 +520,9 @@ void CalendarMgr::CopyEvent(uint64 eventId, time_t newTime, ObjectGuid const& gu
|
|||
}
|
||||
|
||||
if (newEvent->IsGuildAnnouncement())
|
||||
{
|
||||
AddInvite(newEvent, guid, guid, CALENDAR_STATUS_CONFIRMED, CALENDAR_RANK_OWNER, "", time(NULL));
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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;
|
||||
// copy moderator rank
|
||||
if (invite->Rank == CALENDAR_RANK_MODERATOR)
|
||||
{
|
||||
rank = CALENDAR_RANK_MODERATOR;
|
||||
}
|
||||
|
||||
AddInvite(newEvent, guid, invite->InviteeGuid, CALENDAR_STATUS_INVITED, rank, "", time(NULL));
|
||||
}
|
||||
|
|
@ -641,7 +673,9 @@ void CalendarMgr::LoadCalendarsFromDB()
|
|||
sLog.outString(">> calendar_invites table is empty, cleared calendar_events table!");
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog.outString(">> calendar_invite table is empty!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -732,7 +766,9 @@ bool CalendarMgr::CanAddInviteTo(ObjectGuid const& guid)
|
|||
CalendarEvent* event = &itr->second;
|
||||
|
||||
if (event->IsGuildAnnouncement())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
CalendarInviteMap const* cInvMap = event->GetInviteMap();
|
||||
CalendarInviteMap::const_iterator ci_itr = cInvMap->begin();
|
||||
|
|
|
|||
|
|
@ -94,7 +94,9 @@ bool VendorItemData::RemoveItem(uint32 item_id, uint8 type)
|
|||
found = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
return found;
|
||||
|
|
@ -339,7 +341,9 @@ bool Creature::InitEntry(uint32 Entry, CreatureData const* data /*=NULL*/, GameE
|
|||
{
|
||||
cinfo = ObjectMgr::GetCreatureTemplate(normalInfo->DifficultyEntry[diff - 1]);
|
||||
if (cinfo)
|
||||
{
|
||||
break; // template found
|
||||
}
|
||||
|
||||
// check and reported at startup, so just ignore (restore normalInfo)
|
||||
cinfo = normalInfo;
|
||||
|
|
@ -410,7 +414,9 @@ bool Creature::InitEntry(uint32 Entry, CreatureData const* data /*=NULL*/, GameE
|
|||
LoadEquipment(normalInfo->EquipmentTemplateId); // use default from normal template if diff does not have any
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadEquipment(cinfo->EquipmentTemplateId); // else use from diff template
|
||||
}
|
||||
}
|
||||
else if (data && data->equipmentId != -1)
|
||||
{
|
||||
|
|
@ -458,7 +464,9 @@ bool Creature::UpdateEntry(uint32 Entry, Team team, const CreatureData* data /*=
|
|||
SetHealthPercent(healthPercent);
|
||||
}
|
||||
else
|
||||
{
|
||||
SelectLevel();
|
||||
}
|
||||
|
||||
if (team == HORDE)
|
||||
{
|
||||
|
|
@ -685,7 +693,9 @@ void Creature::Update(uint32 update_diff, uint32 diff)
|
|||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_corpseDecayTimer -= update_diff;
|
||||
}
|
||||
|
||||
if (m_groupLootId) // Loot is stopped already if corpse got removed.
|
||||
{
|
||||
|
|
@ -720,7 +730,9 @@ void Creature::Update(uint32 update_diff, uint32 diff)
|
|||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_corpseDecayTimer -= update_diff;
|
||||
}
|
||||
}
|
||||
|
||||
Unit::Update(update_diff, diff);
|
||||
|
|
@ -1431,7 +1443,9 @@ void Creature::SelectLevel(uint32 forcedLevel /*= USE_DEFAULT_DATABASE_LEVEL*/)
|
|||
uint32 const maxlevel = cinfo->MaxLevel;
|
||||
|
||||
if (level == USE_DEFAULT_DATABASE_LEVEL)
|
||||
{
|
||||
level = minlevel == maxlevel ? minlevel : urand(minlevel, maxlevel);
|
||||
}
|
||||
|
||||
SetLevel(level);
|
||||
|
||||
|
|
@ -1480,7 +1494,9 @@ void Creature::SelectLevel(uint32 forcedLevel /*= USE_DEFAULT_DATABASE_LEVEL*/)
|
|||
|
||||
health *= _GetHealthMod(rank); // Apply custom config settting
|
||||
if (health < 1)
|
||||
{
|
||||
health = 1;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Set values
|
||||
|
|
@ -1512,11 +1528,15 @@ void Creature::SelectLevel(uint32 forcedLevel /*= USE_DEFAULT_DATABASE_LEVEL*/)
|
|||
|
||||
// For non regenerating powers set 0
|
||||
if ((i == POWER_ENERGY || i == POWER_MANA) && !IsRegeneratingPower())
|
||||
{
|
||||
value = 0;
|
||||
}
|
||||
|
||||
// Mana requires an extra field to be set
|
||||
if (i == POWER_MANA)
|
||||
{
|
||||
SetCreateMana(value);
|
||||
}
|
||||
|
||||
SetMaxPower(Powers(i), maxValue);
|
||||
SetPower(Powers(i), value);
|
||||
|
|
@ -2160,9 +2180,13 @@ void Creature::SetLootStatus(CreatureLootStatus status)
|
|||
{
|
||||
case CREATURE_LOOT_STATUS_LOOTED:
|
||||
if (m_creatureInfo->SkinningLootId)
|
||||
{
|
||||
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
|
||||
}
|
||||
break;
|
||||
case CREATURE_LOOT_STATUS_SKINNED:
|
||||
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));
|
||||
if(!spellEffect)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if( (spellEffect->Effect == SPELL_EFFECT_SCHOOL_DAMAGE ) ||
|
||||
(spellEffect->Effect == SPELL_EFFECT_INSTAKILL) ||
|
||||
(spellEffect->Effect == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE) ||
|
||||
|
|
@ -2541,7 +2567,9 @@ void Creature::SaveRespawnTime()
|
|||
GetMap()->GetPersistentState()->SaveCreatureRespawnTime(GetGUIDLow(), m_respawnTime);
|
||||
}
|
||||
else if (m_corpseDecayTimer > 0) // dead (corpse)
|
||||
{
|
||||
GetMap()->GetPersistentState()->SaveCreatureRespawnTime(GetGUIDLow(), time(NULL) + m_respawnDelay + m_corpseDecayTimer / IN_MILLISECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
bool Creature::IsOutOfThreatArea(Unit* pVictim) const
|
||||
|
|
@ -2655,7 +2683,9 @@ bool Creature::LoadCreatureAddon(bool reload)
|
|||
}
|
||||
|
||||
if (cainfo->splineFlags & SPLINEFLAG_FLYING)
|
||||
{
|
||||
SetLevitate(true);
|
||||
}
|
||||
|
||||
if (cainfo->auras)
|
||||
{
|
||||
|
|
@ -2998,12 +3028,18 @@ void Creature::AllLootRemovedFromCorpse()
|
|||
// spawntimesecs=3min: corpse decay after 1min
|
||||
// spawntimesecs=4hour: corpse decay after 1hour 20min
|
||||
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));
|
||||
}
|
||||
else
|
||||
{
|
||||
corpseLootedDelay = (m_respawnDelay * IN_MILLISECONDS) / 3;
|
||||
}
|
||||
}
|
||||
else // corpse was skinned, corpse will despawn next update
|
||||
{
|
||||
corpseLootedDelay = 0;
|
||||
}
|
||||
|
||||
// if m_respawnTime is not expired already
|
||||
if (m_respawnTime >= time(NULL))
|
||||
|
|
@ -3017,7 +3053,9 @@ void Creature::AllLootRemovedFromCorpse()
|
|||
{
|
||||
// if m_respawnDelay is relatively short and corpseDecayTimer is larger than corpseLootedDelay
|
||||
if (m_corpseDecayTimer > corpseLootedDelay)
|
||||
{
|
||||
m_corpseDecayTimer = corpseLootedDelay;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -178,7 +178,9 @@ struct CreatureInfo
|
|||
return SKILL_ENGINEERING;
|
||||
}
|
||||
else
|
||||
{ return SKILL_SKINNING; } // normal case
|
||||
{
|
||||
return SKILL_SKINNING; // normal case
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
if (GetSpellCastTime(pSpell))
|
||||
{
|
||||
pCaster->StopMoving();
|
||||
}
|
||||
|
||||
// Creature should interrupt any current melee spell
|
||||
pCaster->InterruptSpell(CURRENT_MELEE_SPELL);
|
||||
|
|
@ -206,7 +208,9 @@ void CreatureAI::HandleMovementOnAttackStart(Unit* victim)
|
|||
{
|
||||
MotionMaster* creatureMotion = m_creature->GetMotionMaster();
|
||||
if (m_isCombatMovement)
|
||||
{
|
||||
creatureMotion->MoveChase(victim, m_attackDistance, m_attackAngle);
|
||||
}
|
||||
// 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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -814,7 +814,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
|||
{
|
||||
SpellRangeEntry const* spellRange = sSpellRangeStore.LookupEntry(spellInfo->GetRangeIndex());
|
||||
if (spellRange)
|
||||
{
|
||||
m_LastSpellMaxRange = spellRange->maxRange;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -1024,7 +1026,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
|||
ThreatList const& threatList = m_creature->GetThreatManager().getThreatList();
|
||||
for (ThreatList::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
|
||||
if (Player* temp = m_creature->GetMap()->GetPlayer((*i)->getUnitGuid()))
|
||||
{
|
||||
temp->GroupEventHappens(action.quest_event_all.questId, m_creature);
|
||||
}
|
||||
}
|
||||
else if (pActionInvoker && pActionInvoker->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
|
|
@ -1280,7 +1284,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
|||
case ACTION_T_DYNAMIC_MOVEMENT:
|
||||
{
|
||||
if ((!!action.dynamicMovement.state) == m_DynamicMovement)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
m_DynamicMovement = !!action.dynamicMovement.state;
|
||||
SetCombatMovement(!m_DynamicMovement, true);
|
||||
|
|
@ -1330,7 +1336,9 @@ void CreatureEventAI::Reset()
|
|||
case EVENT_T_TIMER_OOC:
|
||||
{
|
||||
if (i->UpdateRepeatTimer(m_creature, event.timer.initialMin, event.timer.initialMax))
|
||||
{
|
||||
i->Enabled = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
@ -1467,7 +1475,9 @@ void CreatureEventAI::ReceiveAIEvent(AIEventType eventType, Creature* pSender, U
|
|||
{
|
||||
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()))
|
||||
{ ProcessEvent(*itr, pInvoker, pSender); }
|
||||
{
|
||||
ProcessEvent(*itr, pInvoker, pSender);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1612,18 +1622,26 @@ void CreatureEventAI::UpdateAI(const uint32 diff)
|
|||
{
|
||||
// Do not decrement timers if event cannot trigger in this phase
|
||||
if (!(i->Event.event_inverse_phase_mask & (1 << m_Phase)))
|
||||
{
|
||||
i->Time -= m_EventDiff;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
i->Time = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Skip processing of events that have time remaining or are disabled
|
||||
if (!(i->Enabled) || i->Time)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (IsTimerBasedEvent(i->Event.event_type))
|
||||
{
|
||||
ProcessEvent(*i);
|
||||
}
|
||||
}
|
||||
|
||||
m_EventDiff = 0;
|
||||
|
|
@ -1645,16 +1663,24 @@ void CreatureEventAI::UpdateAI(const uint32 diff)
|
|||
if (m_creature->IsWithinLOSInMap(victim))
|
||||
{
|
||||
if (m_LastSpellMaxRange && m_creature->IsInRange(victim, 0, (m_LastSpellMaxRange / 1.5f)))
|
||||
{
|
||||
SetCombatMovement(false, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetCombatMovement(true, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SetCombatMovement(true, true);
|
||||
}
|
||||
}
|
||||
else if (m_MeleeEnabled && m_creature->CanReachWithMeleeAttack(victim)
|
||||
&& !(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 };
|
||||
|
||||
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)
|
||||
for (uint32 i = HEALTH_STEPS - 1; i > step; --i)
|
||||
|
|
|
|||
|
|
@ -212,7 +212,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons(bool check_entry_use)
|
|||
delete result;
|
||||
|
||||
if (check_entry_use)
|
||||
{
|
||||
CheckUnusedAISummons();
|
||||
}
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %u CreatureEventAI summon definitions", Count);
|
||||
|
|
@ -249,7 +251,9 @@ void CreatureEventAIMgr::CheckUnusedAISummons()
|
|||
case ACTION_T_SUMMON_ID:
|
||||
{
|
||||
if (action.summon_id.spawnId)
|
||||
{
|
||||
idx_set.erase(action.summon_id.spawnId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
|
|
@ -729,7 +733,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
|||
{
|
||||
// output as debug for now, also because there's no general rule all spells have 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
|
@ -757,12 +763,16 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
|||
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_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
|
||||
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))
|
||||
{ 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;
|
||||
}
|
||||
|
|
@ -920,7 +930,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
|||
break;
|
||||
case ACTION_T_SET_INST_DATA:
|
||||
if (!(temp.event_flags & EFLAG_DIFFICULTY_ALL))
|
||||
{
|
||||
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*/)
|
||||
{
|
||||
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;
|
||||
case ACTION_T_SET_INST_DATA64:
|
||||
if (!(temp.event_flags & EFLAG_DIFFICULTY_ALL))
|
||||
{
|
||||
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);
|
||||
break;
|
||||
case ACTION_T_UPDATE_TEMPLATE:
|
||||
|
|
|
|||
|
|
@ -185,7 +185,9 @@ void DynamicObject::Delay(int32 delaytime)
|
|||
{
|
||||
SpellEffectEntry const* effect = holder->GetSpellProto()->GetSpellEffect(SpellEffectIndex(i));
|
||||
if(!effect)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ((effect->Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA || effect->Effect == SPELL_EFFECT_ADD_FARSIGHT) && holder->m_auras[i])
|
||||
{
|
||||
foundAura = true;
|
||||
|
|
|
|||
|
|
@ -188,7 +188,9 @@ namespace MaNGOS
|
|||
if (u->GetTypeId() == TYPEID_UNIT && (
|
||||
((Creature*)u)->IsTotem() || ((Creature*)u)->IsPet() ||
|
||||
(((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()));
|
||||
if (xp_gain == 0)
|
||||
|
|
|
|||
|
|
@ -114,7 +114,9 @@ void GameObject::AddToWorld()
|
|||
|
||||
#ifdef ENABLE_ELUNA
|
||||
if (!inWorld)
|
||||
{
|
||||
sEluna->OnAddToWorld(this);
|
||||
}
|
||||
#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)
|
||||
{
|
||||
Object::_Create(guidlow, 0, HIGHGUID_MO_TRANSPORT);
|
||||
}
|
||||
else
|
||||
{
|
||||
Object::_Create(guidlow, goinfo->id, HIGHGUID_GAMEOBJECT);
|
||||
}
|
||||
|
||||
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);
|
||||
// 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))
|
||||
{
|
||||
SetTransportPathRotation(addon->path_rotation);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetTransportPathRotation(QuaternionData(0, 0, 0, 1));
|
||||
}
|
||||
|
||||
SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction);
|
||||
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:
|
||||
SetUInt32Value(GAMEOBJECT_LEVEL, WorldTimer::getMSTime());
|
||||
if (goinfo->transport.startOpen)
|
||||
{
|
||||
SetGoState(GO_STATE_ACTIVE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -450,9 +462,13 @@ void GameObject::Update(uint32 update_diff, uint32 p_time)
|
|||
if (m_groupLootId)
|
||||
{
|
||||
if (m_groupLootTimer <= update_diff)
|
||||
{
|
||||
StopGroupLoot();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_groupLootTimer -= update_diff;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GAMEOBJECT_TYPE_GOOBER:
|
||||
|
|
@ -902,7 +918,9 @@ bool GameObject::isVisibleForInState(Player const* u, WorldObject const* viewPoi
|
|||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
trapNotVisible = true;
|
||||
}
|
||||
}
|
||||
|
||||
// only rogue have skill for traps detection
|
||||
|
|
@ -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)
|
||||
&& !pTarget->GetQuestRewardStatus(itr->second))
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
@ -1304,7 +1324,9 @@ void GameObject::Use(Unit* user)
|
|||
|
||||
// FIXME: when GO casting will be implemented trap must cast spell to target
|
||||
if ((spellId = goInfo->trap.spellId))
|
||||
{
|
||||
caster->CastSpell(user, spellId, true, NULL, NULL, GetObjectGuid());
|
||||
}
|
||||
// use template cooldown if provided
|
||||
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
|
||||
else
|
||||
// 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))
|
||||
{
|
||||
|
|
@ -1735,7 +1759,9 @@ void GameObject::Use(Unit* user)
|
|||
spellId = info->summoningRitual.spellId;
|
||||
|
||||
if (spellId == 62330) // GO store nonexistent spell, replace by expected
|
||||
{
|
||||
spellId = 61993;
|
||||
}
|
||||
|
||||
// spell have reagent and mana cost but it not expected use its
|
||||
// it triggered spell in fact casted at currently channeled GO
|
||||
|
|
@ -1829,9 +1855,13 @@ void GameObject::Use(Unit* user)
|
|||
}
|
||||
|
||||
if (info->id == 194097)
|
||||
{
|
||||
spellId = 61994; // Ritual of Summoning
|
||||
}
|
||||
else
|
||||
{
|
||||
spellId = 59782; // Summoning Stone Effect
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -1915,7 +1945,9 @@ void GameObject::Use(Unit* user)
|
|||
break;
|
||||
case 184142: // Netherstorm Flag
|
||||
if (bg->GetTypeID() == BATTLEGROUND_EY)
|
||||
{
|
||||
bg->EventPlayerClickedOnFlag(player, this);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -2035,7 +2067,9 @@ void GameObject::SetWorldRotation(float qx, float qy, float qz, float qw)
|
|||
Quat rotation(qx, qy, qz, qw);
|
||||
// Temporary solution for gameobjects that has no rotation data in DB:
|
||||
if (qz == 0.f && qw == 0.f)
|
||||
{
|
||||
rotation = Quat::fromAxisAngleRotation(G3D::Vector3::unitZ(), GetOrientation());
|
||||
}
|
||||
|
||||
rotation.unitize();
|
||||
m_packedRotation = QuaternionCompressed(rotation).m_raw;
|
||||
|
|
@ -2698,12 +2732,18 @@ 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());
|
||||
#ifdef ENABLE_ELUNA
|
||||
if (caster && caster->ToPlayer())
|
||||
{
|
||||
sEluna->OnDamaged(this, caster->ToPlayer());
|
||||
}
|
||||
#endif
|
||||
if (m_useTimes > uint32(-diff))
|
||||
{
|
||||
m_useTimes += diff;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_useTimes = 0;
|
||||
}
|
||||
}
|
||||
else if (diff == 0 && GetMaxHealth()) // Rebuild - TODO: Rebuilding over time with special display-id?
|
||||
{
|
||||
|
|
@ -2712,10 +2752,14 @@ void GameObject::ForceGameObjectHealth(int32 diff, Unit* caster)
|
|||
m_useTimes = GetMaxHealth();
|
||||
// Start Event if exist
|
||||
if (caster && m_goInfo->destructibleBuilding.rebuildingEvent)
|
||||
{
|
||||
StartEvents_Event(GetMap(), m_goInfo->destructibleBuilding.rebuildingEvent, this, caster->GetCharmerOrOwnerOrSelf(), true, caster->GetCharmerOrOwnerOrSelf());
|
||||
}
|
||||
}
|
||||
else // Set to value
|
||||
{
|
||||
m_useTimes = uint32(diff);
|
||||
}
|
||||
|
||||
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);
|
||||
|
|
@ -2730,7 +2774,9 @@ void GameObject::ForceGameObjectHealth(int32 diff, Unit* caster)
|
|||
|
||||
// Start Event if exist
|
||||
if (caster && m_goInfo->destructibleBuilding.intactEvent)
|
||||
{
|
||||
StartEvents_Event(GetMap(), m_goInfo->destructibleBuilding.intactEvent, this, caster->GetCharmerOrOwnerOrSelf(), true, caster->GetCharmerOrOwnerOrSelf());
|
||||
}
|
||||
}
|
||||
else if (m_useTimes == 0) // Destroyed
|
||||
{
|
||||
|
|
@ -2739,28 +2785,40 @@ void GameObject::ForceGameObjectHealth(int32 diff, Unit* caster)
|
|||
DEBUG_FILTER_LOG(LOG_FILTER_DAMAGE, "DestructibleGO: %s got destroyed", GetGuidStr().c_str());
|
||||
#ifdef ENABLE_ELUNA
|
||||
if(caster && caster->ToPlayer())
|
||||
{
|
||||
sEluna->OnDestroyed(this, caster->ToPlayer());
|
||||
}
|
||||
#endif
|
||||
RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK_9 | GO_FLAG_UNK_10);
|
||||
SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK_11);
|
||||
|
||||
// Get destroyed DisplayId
|
||||
if ((!m_goInfo->destructibleBuilding.destroyedDisplayId || m_goInfo->destructibleBuilding.destroyedDisplayId == 1) && destructibleInfo)
|
||||
{
|
||||
newDisplayId = destructibleInfo->destroyedDisplayId;
|
||||
}
|
||||
else
|
||||
{
|
||||
newDisplayId = m_goInfo->destructibleBuilding.destroyedDisplayId;
|
||||
}
|
||||
|
||||
if (!newDisplayId) // No proper destroyed display ID exists, fetch damaged
|
||||
{
|
||||
if ((!m_goInfo->destructibleBuilding.damagedDisplayId || m_goInfo->destructibleBuilding.damagedDisplayId == 1) && destructibleInfo)
|
||||
{
|
||||
newDisplayId = destructibleInfo->damagedDisplayId;
|
||||
}
|
||||
else
|
||||
{
|
||||
newDisplayId = m_goInfo->destructibleBuilding.damagedDisplayId;
|
||||
}
|
||||
}
|
||||
|
||||
// Start Event if exist
|
||||
if (caster && m_goInfo->destructibleBuilding.destroyedEvent)
|
||||
{
|
||||
StartEvents_Event(GetMap(), m_goInfo->destructibleBuilding.destroyedEvent, this, caster->GetCharmerOrOwnerOrSelf(), true, caster->GetCharmerOrOwnerOrSelf());
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_useTimes <= m_goInfo->destructibleBuilding.damagedNumHits) // Damaged
|
||||
|
|
@ -2773,19 +2831,27 @@ void GameObject::ForceGameObjectHealth(int32 diff, Unit* caster)
|
|||
|
||||
// Get damaged DisplayId
|
||||
if ((!m_goInfo->destructibleBuilding.damagedDisplayId || m_goInfo->destructibleBuilding.damagedDisplayId == 1) && destructibleInfo)
|
||||
{
|
||||
newDisplayId = destructibleInfo->damagedDisplayId;
|
||||
}
|
||||
else
|
||||
{
|
||||
newDisplayId = m_goInfo->destructibleBuilding.damagedDisplayId;
|
||||
}
|
||||
|
||||
// Start Event if exist
|
||||
if (caster && m_goInfo->destructibleBuilding.damagedEvent)
|
||||
{
|
||||
StartEvents_Event(GetMap(), m_goInfo->destructibleBuilding.damagedEvent, this, caster->GetCharmerOrOwnerOrSelf(), true, caster->GetCharmerOrOwnerOrSelf());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set display Id
|
||||
if (newDisplayId != 0xFFFFFFFF && newDisplayId != GetDisplayId() && newDisplayId)
|
||||
{
|
||||
SetDisplayId(newDisplayId);
|
||||
}
|
||||
|
||||
// Set health
|
||||
SetGoAnimProgress(GetMaxHealth() ? m_useTimes * 255 / GetMaxHealth() : 255);
|
||||
|
|
@ -2795,9 +2861,13 @@ void GameObject::SetInUse(bool use)
|
|||
{
|
||||
m_isInUse = use;
|
||||
if (use)
|
||||
{
|
||||
SetGoState(GO_STATE_ACTIVE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetGoState(GO_STATE_READY);
|
||||
}
|
||||
}
|
||||
|
||||
uint32 GameObject::GetScriptId()
|
||||
|
|
|
|||
|
|
@ -223,7 +223,9 @@ bool Guild::AddMember(ObjectGuid plGuid, uint32 plRank)
|
|||
// 0 1 2 3 4
|
||||
QueryResult* result = CharacterDatabase.PQuery("SELECT `name`,`level`,`class`,`zone`,`account` FROM `characters` WHERE `guid` = '%u'", lowguid);
|
||||
if (!result)
|
||||
{ return false; } // player doesn't exist
|
||||
{
|
||||
return false; // player doesn't exist
|
||||
}
|
||||
|
||||
Field* fields = result->Fetch();
|
||||
newmember.Name = fields[0].GetCppString();
|
||||
|
|
@ -332,7 +334,9 @@ bool Guild::LoadGuildFromDB(QueryResult* guildDataResult)
|
|||
uint32 purchasedTabs = fields[12].GetUInt32();
|
||||
|
||||
if (purchasedTabs > GUILD_BANK_MAX_TABS)
|
||||
{
|
||||
purchasedTabs = GUILD_BANK_MAX_TABS;
|
||||
}
|
||||
|
||||
m_TabListMap.resize(purchasedTabs);
|
||||
|
||||
|
|
@ -353,7 +357,9 @@ bool Guild::CheckGuildStructure()
|
|||
if (GM_rights == -1)
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
|
@ -485,7 +491,9 @@ bool Guild::LoadMembersFromDB(QueryResult* guildMembersResult)
|
|||
|
||||
if (guildId > m_Id)
|
||||
// we loaded all members for this guild already, break cycle
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
MemberSlot newmember;
|
||||
uint32 lowguid = fields[1].GetUInt32();
|
||||
|
|
@ -694,7 +702,9 @@ void Guild::BroadcastAddonToGuild(WorldSession* session, const std::string& msg,
|
|||
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()))
|
||||
{
|
||||
pl->GetSession()->SendPacket(&data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -720,7 +730,9 @@ void Guild::BroadcastToOfficers(WorldSession* session, const std::string& msg, u
|
|||
Player* pl = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
||||
|
||||
if (pl && pl->GetSession() && HasRankRight(pl->GetRank(), GR_RIGHT_OFFCHATLISTEN) && !pl->GetSocial()->HasIgnore(player->GetObjectGuid()))
|
||||
{
|
||||
pl->GetSession()->SendPacket(&data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -736,7 +748,9 @@ void Guild::BroadcastAddonToOfficers(WorldSession* session, const std::string& m
|
|||
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()))
|
||||
{
|
||||
pl->GetSession()->SendPacket(&data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -886,9 +900,13 @@ void Guild::SwitchRank(uint32 rankId, bool up)
|
|||
|
||||
for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
|
||||
if (itr->second.RankId == rankId)
|
||||
{
|
||||
itr->second.ChangeRank(otherRankId);
|
||||
}
|
||||
else if (itr->second.RankId == otherRankId)
|
||||
{
|
||||
itr->second.ChangeRank(rankId);
|
||||
}
|
||||
|
||||
CharacterDatabase.CommitTransaction();
|
||||
}
|
||||
|
|
@ -1005,9 +1023,13 @@ void Guild::Roster(WorldSession* session /*= NULL*/)
|
|||
{
|
||||
flags |= GUILDMEMBER_STATUS_ONLINE;
|
||||
if (player->isAFK())
|
||||
{
|
||||
flags |= GUILDMEMBER_STATUS_AFK;
|
||||
}
|
||||
if (player->isDND())
|
||||
{
|
||||
flags |= GUILDMEMBER_STATUS_DND;
|
||||
}
|
||||
}
|
||||
|
||||
buffer << uint8(member.Class);
|
||||
|
|
@ -1082,25 +1104,35 @@ void Guild::Query(WorldSession* session)
|
|||
data << m_Ranks[i].Name;
|
||||
}
|
||||
else
|
||||
{ data << uint8(0); } // null string
|
||||
{
|
||||
data << uint8(0); // null string
|
||||
}
|
||||
}
|
||||
|
||||
// Rank order of creation
|
||||
for (uint8 i = 0; i < GUILD_RANKS_MAX_COUNT; ++i)
|
||||
{
|
||||
if (i < m_Ranks.size())
|
||||
{
|
||||
data << uint32(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
data << uint32(0);
|
||||
}
|
||||
}
|
||||
|
||||
// Rank order of "importance" (sorting by rights)
|
||||
for (uint8 i = 0; i < GUILD_RANKS_MAX_COUNT; ++i)
|
||||
{
|
||||
if (i < m_Ranks.size())
|
||||
{
|
||||
data << uint32(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
data << uint32(0);
|
||||
}
|
||||
}
|
||||
|
||||
data << uint32(m_EmblemStyle);
|
||||
|
|
@ -1293,17 +1325,23 @@ void Guild::DisplayGuildBankContent(WorldSession* session, uint8 TabId)
|
|||
uint32 itemCount = 0;
|
||||
for (int i = 0; i < GUILD_BANK_MAX_SLOTS; ++i)
|
||||
if (tab->Slots[i])
|
||||
{
|
||||
++itemCount;
|
||||
}
|
||||
|
||||
data.WriteBits(itemCount, 20);
|
||||
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)
|
||||
if (tab->Slots[i])
|
||||
{
|
||||
AppendDisplayGuildBankSlot(data, buffer, tab, i);
|
||||
}
|
||||
|
||||
data << uint64(m_GuildBankMoney);
|
||||
if (!buffer.empty())
|
||||
{
|
||||
data.append(buffer);
|
||||
}
|
||||
|
||||
data << uint32(TabId);
|
||||
data << uint32(GetMemberSlotWithdrawRem(session->GetPlayer()->GetObjectGuid(), TabId));
|
||||
|
|
@ -1338,17 +1376,25 @@ void Guild::DisplayGuildBankContentUpdate(uint8 TabId, int32 slot1, int32 slot2)
|
|||
|
||||
data.WriteBit(0);
|
||||
if (slot2 == -1) // single item in slot1
|
||||
{
|
||||
data.WriteBits(1, 20); // item count
|
||||
}
|
||||
else // 2 items (in slot1 and slot2)
|
||||
{
|
||||
data.WriteBits(2, 20); // item count
|
||||
}
|
||||
data.WriteBits(0, 22); // Tell client that there's no tab info in this packet
|
||||
|
||||
if (slot2 == -1) // single item in slot1
|
||||
{
|
||||
AppendDisplayGuildBankSlot(data, buffer, tab, slot1);
|
||||
}
|
||||
else // 2 items (in slot1 and slot2)
|
||||
{
|
||||
if (slot1 > slot2)
|
||||
{
|
||||
std::swap(slot1, slot2);
|
||||
}
|
||||
|
||||
AppendDisplayGuildBankSlot(data, buffer, tab, slot1);
|
||||
AppendDisplayGuildBankSlot(data, buffer, tab, slot2);
|
||||
|
|
@ -1356,7 +1402,9 @@ void Guild::DisplayGuildBankContentUpdate(uint8 TabId, int32 slot1, int32 slot2)
|
|||
|
||||
data << uint64(GetGuildBankMoney());
|
||||
if (!buffer.empty())
|
||||
{
|
||||
data.append(buffer);
|
||||
}
|
||||
data << uint32(TabId);
|
||||
|
||||
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));
|
||||
if (!player)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!IsMemberHaveRights(itr->first, TabId, GUILD_BANK_RIGHT_VIEW_TAB))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
data.put<uint32>(rempos, uint32(GetMemberSlotWithdrawRem(player->GetGUIDLow(), TabId)));
|
||||
|
||||
|
|
@ -1396,7 +1448,9 @@ void Guild::DisplayGuildBankContentUpdate(uint8 TabId, GuildItemPosCountVec cons
|
|||
|
||||
data << uint64(GetGuildBankMoney());
|
||||
if (!buffer.empty())
|
||||
{
|
||||
data.append(buffer);
|
||||
}
|
||||
|
||||
data << uint32(TabId);
|
||||
|
||||
|
|
@ -1407,10 +1461,14 @@ void Guild::DisplayGuildBankContentUpdate(uint8 TabId, GuildItemPosCountVec cons
|
|||
{
|
||||
Player* player = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
||||
if (!player)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!IsMemberHaveRights(itr->first, TabId, GUILD_BANK_RIGHT_VIEW_TAB))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
if (money < 0) // I don't know how this happens, it does!!
|
||||
{
|
||||
money = 0;
|
||||
}
|
||||
m_GuildBankMoney = money;
|
||||
|
||||
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)
|
||||
{
|
||||
money = (uint32)WITHDRAW_MONEY_UNLIMITED;
|
||||
}
|
||||
|
||||
m_Ranks[rankId].BankMoneyPerDay = money;
|
||||
|
||||
|
|
@ -1758,7 +1820,9 @@ void Guild::SetBankMoneyPerDay(uint32 rankId, uint32 money)
|
|||
{
|
||||
MemberSlot& member = itr->second;
|
||||
if (member.RankId == rankId)
|
||||
{
|
||||
member.BankResetTimeMoney = 0;
|
||||
}
|
||||
}
|
||||
|
||||
CharacterDatabase.PExecute("UPDATE `guild_rank` SET `BankMoneyPerDay`='%u' WHERE `rid`='%u' AND `guildid`='%u'", money, rankId, m_Id);
|
||||
|
|
@ -1842,7 +1906,9 @@ bool Guild::LoadBankRightsFromDB(QueryResult* guildBankTabRightsResult)
|
|||
Field* fields = guildBankTabRightsResult->Fetch();
|
||||
// prevent crash when all rights in result are already processed
|
||||
if (!fields)
|
||||
{
|
||||
break;
|
||||
}
|
||||
uint32 guildId = fields[0].GetUInt32();
|
||||
if (guildId < m_Id)
|
||||
{
|
||||
|
|
@ -1881,7 +1947,9 @@ void Guild::LoadGuildBankEventLogFromDB()
|
|||
// 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);
|
||||
if (!result)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
bool isNextLogGuidSet = false;
|
||||
do
|
||||
|
|
@ -1998,7 +2066,9 @@ void Guild::DisplayGuildBankLogs(WorldSession* session, uint8 TabId)
|
|||
|
||||
data << uint32(TabId);
|
||||
if (hasCashFlow)
|
||||
{
|
||||
data << uint64(0); // cash flow contribution
|
||||
}
|
||||
|
||||
session->SendPacket(&data);
|
||||
|
||||
|
|
@ -2025,7 +2095,9 @@ void Guild::LogBankEvent(uint8 EventType, uint8 TabId, uint32 PlayerGuidLow, uin
|
|||
currentLogGuid = m_GuildBankEventLogNextGuid_Money;
|
||||
currentTabId = GUILD_BANK_MONEY_LOGS_TAB;
|
||||
if (m_GuildBankEventLog_Money.size() >= GUILD_BANK_MAX_LOGS)
|
||||
{
|
||||
m_GuildBankEventLog_Money.pop_front();
|
||||
}
|
||||
|
||||
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);
|
||||
currentLogGuid = m_GuildBankEventLogNextGuid_Item[TabId];
|
||||
if (m_GuildBankEventLog_Item[TabId].size() >= GUILD_BANK_MAX_LOGS)
|
||||
{
|
||||
m_GuildBankEventLog_Item[TabId].pop_front();
|
||||
}
|
||||
|
||||
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 (clone)
|
||||
{
|
||||
pItem = pItem->CloneItem(count);
|
||||
}
|
||||
else
|
||||
{
|
||||
pItem->SetCount(count);
|
||||
}
|
||||
|
||||
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)
|
||||
if (pItem2 == pSrcItem)
|
||||
{
|
||||
pItem2 = NULL;
|
||||
}
|
||||
|
||||
uint32 need_space;
|
||||
|
||||
|
|
@ -2213,7 +2293,9 @@ InventoryResult Guild::_CanStoreItem_InSpecificSlot(uint8 tab, uint8 slot, Guild
|
|||
}
|
||||
|
||||
if (need_space > count)
|
||||
{
|
||||
need_space = count;
|
||||
}
|
||||
|
||||
GuildItemPosCount newPosition = GuildItemPosCount(slot, need_space);
|
||||
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
|
||||
if (j == skip_slot)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Item* pItem2 = m_TabListMap[tab]->Slots[j];
|
||||
|
||||
// ignore move item (this slot will be empty at move)
|
||||
if (pItem2 == pSrcItem)
|
||||
{
|
||||
pItem2 = NULL;
|
||||
}
|
||||
|
||||
// if merge skip empty, if !merge skip non-empty
|
||||
if ((pItem2 != NULL) != merge)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pItem2)
|
||||
{
|
||||
|
|
@ -2249,7 +2337,9 @@ InventoryResult Guild::_CanStoreItem_InTab(uint8 tab, GuildItemPosCountVec& dest
|
|||
{
|
||||
uint32 need_space = pSrcItem->GetMaxStackCount() - pItem2->GetCount();
|
||||
if (need_space > count)
|
||||
{
|
||||
need_space = count;
|
||||
}
|
||||
|
||||
GuildItemPosCount newPosition = GuildItemPosCount(j, need_space);
|
||||
if (!newPosition.isContainedIn(dest))
|
||||
|
|
@ -2268,7 +2358,9 @@ InventoryResult Guild::_CanStoreItem_InTab(uint8 tab, GuildItemPosCountVec& dest
|
|||
{
|
||||
uint32 need_space = pSrcItem->GetMaxStackCount();
|
||||
if (need_space > count)
|
||||
{
|
||||
need_space = count;
|
||||
}
|
||||
|
||||
GuildItemPosCount newPosition = GuildItemPosCount(j, need_space);
|
||||
if (!newPosition.isContainedIn(dest))
|
||||
|
|
@ -2385,9 +2477,13 @@ void Guild::SendGuildBankTabText(WorldSession* session, uint8 TabId)
|
|||
data.WriteStringData(tab->Text);
|
||||
|
||||
if (session)
|
||||
{
|
||||
session->SendPacket(&data);
|
||||
}
|
||||
else
|
||||
{
|
||||
BroadcastPacket(&data);
|
||||
}
|
||||
}
|
||||
|
||||
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())
|
||||
{
|
||||
return; // cheating?
|
||||
}
|
||||
else if (SplitedAmount == pItemSrc->GetCount())
|
||||
{
|
||||
SplitedAmount = 0; // no split
|
||||
}
|
||||
|
||||
Item* pItemDst = GetItem(BankTabDst, BankTabSlotDst);
|
||||
|
||||
|
|
@ -2448,7 +2548,9 @@ void Guild::SwapItems(Player* pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankTa
|
|||
CharacterDatabase.BeginTransaction();
|
||||
|
||||
if (BankTab != BankTabDst)
|
||||
{
|
||||
LogBankEvent(GUILD_BANK_LOG_MOVE_ITEM, BankTab, pl->GetGUIDLow(), pItemSrc->GetEntry(), SplitedAmount, BankTabDst);
|
||||
}
|
||||
|
||||
pl->ItemRemovedQuestCheck(pItemSrc->GetEntry(), SplitedAmount);
|
||||
pItemSrc->SetCount(pItemSrc->GetCount() - SplitedAmount);
|
||||
|
|
@ -2466,7 +2568,9 @@ void Guild::SwapItems(Player* pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankTa
|
|||
CharacterDatabase.BeginTransaction();
|
||||
|
||||
if (BankTab != BankTabDst)
|
||||
{
|
||||
LogBankEvent(GUILD_BANK_LOG_MOVE_ITEM, BankTab, pl->GetGUIDLow(), pItemSrc->GetEntry(), pItemSrc->GetCount(), BankTabDst);
|
||||
}
|
||||
|
||||
RemoveItem(BankTab, BankTabSlot);
|
||||
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);
|
||||
if (BankTab != BankTabDst)
|
||||
{
|
||||
DisplayGuildBankContentUpdate(BankTabDst, BankTabSlotDst);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -2538,9 +2644,13 @@ void Guild::MoveFromBankToChar(Player* pl, uint8 BankTab, uint8 BankTabSlot, uin
|
|||
}
|
||||
|
||||
if (SplitedAmount > pItemBank->GetCount())
|
||||
{
|
||||
return; // cheating?
|
||||
}
|
||||
else if (SplitedAmount == pItemBank->GetCount())
|
||||
{
|
||||
SplitedAmount = 0; // no split
|
||||
}
|
||||
|
||||
if (SplitedAmount)
|
||||
{
|
||||
|
|
@ -2662,7 +2772,9 @@ void Guild::MoveFromBankToChar(Player* pl, uint8 BankTab, uint8 BankTabSlot, uin
|
|||
CharacterDatabase.BeginTransaction();
|
||||
LogBankEvent(GUILD_BANK_LOG_WITHDRAW_ITEM, BankTab, pl->GetGUIDLow(), pItemBank->GetEntry(), pItemBank->GetCount());
|
||||
if (pItemChar)
|
||||
{
|
||||
LogBankEvent(GUILD_BANK_LOG_DEPOSIT_ITEM, BankTab, pl->GetGUIDLow(), pItemChar->GetEntry(), pItemChar->GetCount());
|
||||
}
|
||||
|
||||
RemoveItem(BankTab, BankTabSlot);
|
||||
if (pItemChar)
|
||||
|
|
@ -2706,9 +2818,13 @@ void Guild::MoveFromCharToBank(Player* pl, uint8 PlayerBag, uint8 PlayerSlot, ui
|
|||
}
|
||||
|
||||
if (SplitedAmount > pItemChar->GetCount())
|
||||
{
|
||||
return; // cheating?
|
||||
}
|
||||
else if (SplitedAmount == pItemChar->GetCount())
|
||||
{
|
||||
SplitedAmount = 0; // no split
|
||||
}
|
||||
|
||||
if (SplitedAmount)
|
||||
{
|
||||
|
|
@ -2817,20 +2933,28 @@ void Guild::MoveFromCharToBank(Player* pl, uint8 PlayerBag, uint8 PlayerSlot, ui
|
|||
|
||||
CharacterDatabase.BeginTransaction();
|
||||
if (pItemBank)
|
||||
{
|
||||
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());
|
||||
|
||||
pl->MoveItemFromInventory(PlayerBag, PlayerSlot, true);
|
||||
pItemChar->DeleteFromInventoryDB();
|
||||
if (pItemBank)
|
||||
{
|
||||
RemoveItem(BankTab, BankTabSlot);
|
||||
}
|
||||
|
||||
StoreItem(BankTab, gDest, pItemChar);
|
||||
if (pItemBank)
|
||||
{
|
||||
pl->MoveItemToInventory(iDest, pItemBank, true);
|
||||
}
|
||||
pl->SaveInventoryAndGoldToDB();
|
||||
if (pItemBank)
|
||||
{
|
||||
MemberItemWithdraw(BankTab, pl->GetGUIDLow());
|
||||
}
|
||||
CharacterDatabase.CommitTransaction();
|
||||
|
||||
DisplayGuildBankContentUpdate(BankTab, gDest);
|
||||
|
|
@ -2863,7 +2987,9 @@ void Guild::BroadcastEvent(GuildEvents event, ObjectGuid guid, char const* str1
|
|||
}
|
||||
|
||||
if (guid)
|
||||
{
|
||||
data << ObjectGuid(guid);
|
||||
}
|
||||
|
||||
BroadcastPacket(&data);
|
||||
|
||||
|
|
@ -2881,7 +3007,9 @@ void Guild::DeleteGuildBankItems(bool alsoInDB /*= false*/)
|
|||
pItem->RemoveFromWorld();
|
||||
|
||||
if (alsoInDB)
|
||||
{
|
||||
pItem->DeleteFromDB();
|
||||
}
|
||||
|
||||
delete pItem;
|
||||
}
|
||||
|
|
@ -2959,18 +3087,26 @@ void GuildBankEventLogEntry::WriteData(WorldPacket& data, ByteBuffer& buffer)
|
|||
|
||||
buffer.WriteGuidBytes<6, 1, 5>(logGuid);
|
||||
if (hasStack)
|
||||
{
|
||||
buffer << uint32(ItemStackCount);
|
||||
}
|
||||
|
||||
buffer << uint8(EventType);
|
||||
buffer.WriteGuidBytes<2, 4, 0, 7, 3>(logGuid);
|
||||
if (hasItem)
|
||||
{
|
||||
buffer << uint32(ItemOrMoney);
|
||||
}
|
||||
|
||||
buffer << uint32(time(NULL) - TimeStamp);
|
||||
|
||||
if (isMoneyEvent())
|
||||
{
|
||||
buffer << uint64(ItemOrMoney);
|
||||
}
|
||||
|
||||
if (itemMoved)
|
||||
{
|
||||
buffer << uint8(DestTabId); // moved tab
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -322,9 +322,13 @@ uint32 ItemPrototype::GetArmor() const
|
|||
ArmorLocationEntry const* al = NULL;
|
||||
|
||||
if (InventoryType == INVTYPE_ROBE)
|
||||
{
|
||||
al = sArmorLocationStore.LookupEntry(INVTYPE_CHEST);
|
||||
}
|
||||
else
|
||||
{
|
||||
al = sArmorLocationStore.LookupEntry(InventoryType);
|
||||
}
|
||||
|
||||
if (!al)
|
||||
{
|
||||
|
|
@ -377,15 +381,23 @@ float ItemPrototype::getDPS() const
|
|||
case INVTYPE_WEAPONMAINHAND:
|
||||
case INVTYPE_WEAPONOFFHAND:
|
||||
if (Flags2 & ITEM_FLAG2_CASTER_WEAPON) // caster weapon flag
|
||||
{
|
||||
id = sItemDamageOneHandCasterStore.LookupEntry(ItemLevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
id = sItemDamageOneHandStore.LookupEntry(ItemLevel);
|
||||
}
|
||||
break;
|
||||
case INVTYPE_2HWEAPON:
|
||||
if (Flags2 & ITEM_FLAG2_CASTER_WEAPON) // caster weapon flag
|
||||
{
|
||||
id = sItemDamageTwoHandCasterStore.LookupEntry(ItemLevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
id = sItemDamageTwoHandStore.LookupEntry(ItemLevel);
|
||||
}
|
||||
break;
|
||||
case INVTYPE_AMMO:
|
||||
id = sItemDamageAmmoStore.LookupEntry(ItemLevel);
|
||||
|
|
@ -502,9 +514,13 @@ void Item::UpdateDuration(Player* owner, uint32 diff)
|
|||
#endif /* ENABLE_ELUNA */
|
||||
|
||||
if (uint32 newItemId = sObjectMgr.GetItemExpireConvert(GetEntry()))
|
||||
{
|
||||
owner->ConvertItem(this, newItemId);
|
||||
}
|
||||
else
|
||||
{
|
||||
owner->DestroyItem(GetBagSlot(), GetSlot(), true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -690,7 +706,9 @@ bool Item::LoadFromDB(uint32 guidLow, Field* fields, ObjectGuid ownerGuid)
|
|||
if (GetItemRandomPropertyId() < 0)
|
||||
{
|
||||
if (UpdateItemSuffixFactor())
|
||||
{
|
||||
need_save = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove bind flag for items vs NO_BIND set
|
||||
|
|
@ -1134,7 +1152,9 @@ bool Item::IsBoundByEnchant() const
|
|||
}
|
||||
|
||||
if (enchant_slot > PRISMATIC_ENCHANTMENT_SLOT && enchant_slot < PROP_ENCHANTMENT_SLOT_0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
|
||||
if (!enchantEntry)
|
||||
|
|
@ -1181,12 +1201,16 @@ bool Item::IsFitToSpellRequirements(SpellEntry const* spellInfo) const
|
|||
if (equippedItems->EquippedItemClass != -1) // -1 == any item 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 & (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 & (1 << proto->InventoryType)) == 0)
|
||||
{ return false; } // inventory type not present in mask
|
||||
{
|
||||
return false; // inventory type not present in mask
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -1237,10 +1263,14 @@ void Item::SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint
|
|||
{
|
||||
Player* owner = GetOwner();
|
||||
if (uint32 oldEnchant = GetEnchantmentId(slot))
|
||||
{
|
||||
owner->GetSession()->SendEnchantmentLog(GetOwnerGuid(), ObjectGuid(), GetEntry(), oldEnchant);
|
||||
}
|
||||
|
||||
if (id)
|
||||
{
|
||||
owner->GetSession()->SendEnchantmentLog(GetOwnerGuid(), casterGuid, GetEntry(), id);
|
||||
}
|
||||
}
|
||||
|
||||
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_ID_OFFSET, id);
|
||||
|
|
@ -1308,14 +1338,18 @@ bool Item::GemsFitSockets() const
|
|||
if (!enchant_id)
|
||||
{
|
||||
if (SocketColor) fits &= false;
|
||||
continue;
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
|
||||
if (!enchantEntry)
|
||||
{
|
||||
if (SocketColor) fits &= false;
|
||||
continue;
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
uint8 GemColor = 0;
|
||||
|
|
@ -1328,7 +1362,9 @@ bool Item::GemsFitSockets() const
|
|||
{
|
||||
GemPropertiesEntry const* gemProperty = sGemPropertiesStore.LookupEntry(gemProto->GemProperties);
|
||||
if (gemProperty)
|
||||
{
|
||||
GemColor = gemProperty->color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1344,14 +1380,20 @@ uint8 Item::GetGemCountWithID(uint32 GemID) const
|
|||
{
|
||||
uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot));
|
||||
if (!enchant_id)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
|
||||
if (!enchantEntry)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (GemID == enchantEntry->GemID)
|
||||
{
|
||||
++count;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
|
@ -1363,18 +1405,26 @@ uint8 Item::GetGemCountWithLimitCategory(uint32 limitCategory) const
|
|||
{
|
||||
uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot));
|
||||
if (!enchant_id)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
|
||||
if (!enchantEntry)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemPrototype const* gemProto = ObjectMgr::GetItemPrototype(enchantEntry->GemID);
|
||||
if (!gemProto)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (gemProto->ItemLimitCategory == limitCategory)
|
||||
{
|
||||
++count;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
|
@ -1412,7 +1462,9 @@ void Item::SendTimeUpdate(Player* owner)
|
|||
Item* Item::CreateItem(uint32 item, uint32 count, Player const* player, uint32 randomPropertyId)
|
||||
{
|
||||
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))
|
||||
{
|
||||
|
|
@ -1656,7 +1708,9 @@ uint32 Item::GetSpecialPrice(ItemPrototype const* proto, uint32 minimumPrice /*=
|
|||
uint32 cost = 0;
|
||||
|
||||
if (proto->Flags2 & ITEM_FLAG2_HAS_NORMAL_PRICE)
|
||||
{
|
||||
cost = proto->SellPrice;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool normalPrice = true;
|
||||
|
|
@ -1669,19 +1723,29 @@ uint32 Item::GetSpecialPrice(ItemPrototype const* proto, uint32 minimumPrice /*=
|
|||
{
|
||||
ItemClassEntry const* classEntry = sItemClassStore.LookupEntry(proto->Class);
|
||||
if (classEntry)
|
||||
{
|
||||
cost *= classEntry->PriceFactor;
|
||||
}
|
||||
else
|
||||
{
|
||||
cost = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cost /= 4 * proto->BuyCount;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cost = proto->SellPrice;
|
||||
}
|
||||
}
|
||||
|
||||
if (cost < minimumPrice)
|
||||
{
|
||||
cost = minimumPrice;
|
||||
}
|
||||
|
||||
return cost;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,9 +76,13 @@ void LoadRandomEnchantmentsTable()
|
|||
if (chance > 0.000001f && chance <= 100.0f)
|
||||
{
|
||||
if (entry > 0)
|
||||
{
|
||||
RandomItemPropEnch[entry].push_back(EnchStoreItem(ench, chance));
|
||||
}
|
||||
else
|
||||
{
|
||||
RandomItemSuffixEnch[-entry].push_back(EnchStoreItem(ench, chance));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -437,7 +437,9 @@ LootItem::LootItem(uint32 itemid_, uint8 type_, uint32 count_, uint32 randomSuff
|
|||
needs_quest = false;
|
||||
|
||||
if (currency)
|
||||
{
|
||||
freeforall = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemPrototype const* proto = ObjectMgr::GetItemPrototype(itemid);
|
||||
|
|
@ -621,7 +623,9 @@ void Loot::FillNotNormalLootFor(Player* pl)
|
|||
|
||||
QuestItemMap::const_iterator qmapitr = m_playerCurrencies.find(plguid);
|
||||
if (qmapitr == m_playerCurrencies.end())
|
||||
{
|
||||
FillCurrencyLoot(pl);
|
||||
}
|
||||
|
||||
qmapitr = m_playerQuestItems.find(plguid);
|
||||
if (qmapitr == m_playerQuestItems.end())
|
||||
|
|
@ -637,7 +641,9 @@ void Loot::FillNotNormalLootFor(Player* pl)
|
|||
|
||||
qmapitr = m_playerNonQuestNonFFANonCurrencyConditionalItems.find(plguid);
|
||||
if (qmapitr == m_playerNonQuestNonFFANonCurrencyConditionalItems.end())
|
||||
{
|
||||
FillNonQuestNonFFANonCurrencyConditionalLoot(pl);
|
||||
}
|
||||
}
|
||||
|
||||
QuestItemList* Loot::FillCurrencyLoot(Player* player)
|
||||
|
|
@ -889,7 +895,9 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem** qite
|
|||
{
|
||||
QuestItem* currency2 = (QuestItem*) & (*iter);
|
||||
if (currency)
|
||||
{
|
||||
*currency = currency2;
|
||||
}
|
||||
is_looted = currency2->is_looted;
|
||||
break;
|
||||
}
|
||||
|
|
@ -1259,7 +1267,9 @@ void LootTemplate::AddEntry(LootStoreItem& item)
|
|||
if (item.group > 0 && item.mincountOrRef > 0) // Group
|
||||
{
|
||||
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
|
||||
}
|
||||
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 > Groups.size())
|
||||
{ return; } // Error message already printed at loading stage
|
||||
{
|
||||
return; // Error message already printed at loading stage
|
||||
}
|
||||
|
||||
Groups[groupId - 1].Process(loot);
|
||||
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)
|
||||
{
|
||||
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
|
||||
{
|
||||
LootTemplate const* Referenced = LootTemplates_Reference.GetLootFor(-i->mincountOrRef);
|
||||
|
||||
if (!Referenced)
|
||||
{ continue; } // Error message already printed at loading stage
|
||||
{
|
||||
continue; // Error message already printed at loading stage
|
||||
}
|
||||
|
||||
// Check condition
|
||||
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)
|
||||
{ loot.AddItem(*i); } // Chance is already checked, just add
|
||||
{
|
||||
loot.AddItem(*i); // Chance is already checked, just add
|
||||
}
|
||||
}
|
||||
|
||||
// Now processing groups
|
||||
|
|
@ -1321,7 +1339,9 @@ bool LootTemplate::HasQuestDrop(LootTemplateMap const& store, uint8 groupId) con
|
|||
if (groupId) // Group reference
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
@ -1331,14 +1351,18 @@ bool LootTemplate::HasQuestDrop(LootTemplateMap const& store, uint8 groupId) con
|
|||
{
|
||||
LootTemplateMap::const_iterator Referenced = store.find(-i->mincountOrRef);
|
||||
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))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (i->needs_quest)
|
||||
{ return true; } // quest drop found
|
||||
{
|
||||
return true; // quest drop found
|
||||
}
|
||||
}
|
||||
|
||||
// Now processing groups
|
||||
|
|
@ -1357,7 +1381,9 @@ bool LootTemplate::HasQuestDropForPlayer(LootTemplateMap const& store, Player co
|
|||
if (groupId) // Group reference
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
@ -1368,14 +1394,18 @@ bool LootTemplate::HasQuestDropForPlayer(LootTemplateMap const& store, Player co
|
|||
{
|
||||
LootTemplateMap::const_iterator Referenced = store.find(-i->mincountOrRef);
|
||||
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))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (player->HasQuestForItem(i->itemid))
|
||||
{ return true; } // active quest drop found
|
||||
{
|
||||
return true; // active quest drop found
|
||||
}
|
||||
}
|
||||
|
||||
// Now checking groups
|
||||
|
|
@ -1582,15 +1612,23 @@ void LoadLootTemplates_Milling()
|
|||
{
|
||||
ItemPrototype const* proto = sItemStorage.LookupEntry<ItemPrototype>(i);
|
||||
if (!proto)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(proto->Flags & ITEM_FLAG_MILLABLE))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ids_set.find(proto->ItemId) != ids_set.end())
|
||||
{
|
||||
ids_set.erase(proto->ItemId);
|
||||
}
|
||||
else
|
||||
{
|
||||
LootTemplates_Milling.ReportNotExistedId(proto->ItemId);
|
||||
}
|
||||
}
|
||||
|
||||
// output error for any still listed (not referenced from appropriate table) ids
|
||||
|
|
@ -1639,13 +1677,19 @@ void LoadLootTemplates_Prospecting()
|
|||
{
|
||||
ItemPrototype const* proto = sItemStorage.LookupEntry<ItemPrototype>(i);
|
||||
if (!proto)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(proto->Flags & ITEM_FLAG_PROSPECTABLE))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ids_set.find(proto->ItemId) != ids_set.end())
|
||||
{
|
||||
ids_set.erase(proto->ItemId);
|
||||
}
|
||||
// else -- exist some cases that possible can be prospected but not expected have any result loot
|
||||
// LootTemplates_Prospecting.ReportNotExistedId(proto->ItemId);
|
||||
}
|
||||
|
|
@ -1713,11 +1757,15 @@ void LoadLootTemplates_Spell()
|
|||
{
|
||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell_id);
|
||||
if (!spellInfo)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// possible cases
|
||||
if (!IsLootCraftingSpell(spellInfo))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ids_set.find(spell_id) == ids_set.end())
|
||||
{
|
||||
|
|
@ -1729,7 +1777,9 @@ void LoadLootTemplates_Spell()
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ids_set.erase(spell_id);
|
||||
}
|
||||
}
|
||||
|
||||
// output error for any still listed (not referenced from appropriate table) ids
|
||||
|
|
|
|||
|
|
@ -171,7 +171,9 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c
|
|||
if (isType(TYPEMASK_UNIT))
|
||||
{
|
||||
if (((Unit*)this)->getVictim())
|
||||
{
|
||||
updateFlags |= UPDATEFLAG_HAS_ATTACKING_TARGET;
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
if (unit->m_movementInfo.GetMovementFlags())
|
||||
{
|
||||
data->WriteBits(unit->m_movementInfo.GetMovementFlags(), 30);
|
||||
}
|
||||
|
||||
data->WriteBit(false);
|
||||
data->WriteBit(!hasPitch);
|
||||
|
|
@ -324,19 +328,25 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 updateFlags) const
|
|||
data->WriteGuidMask<4>(Guid);
|
||||
|
||||
if (isSplineEnabled)
|
||||
{
|
||||
Movement::PacketBuilder::WriteCreateBits(*unit->movespline, *data);
|
||||
}
|
||||
|
||||
data->WriteGuidMask<6>(Guid);
|
||||
|
||||
if (hasFallData)
|
||||
{
|
||||
data->WriteBit(hasFallDirection);
|
||||
}
|
||||
|
||||
data->WriteGuidMask<0, 1>(Guid);
|
||||
data->WriteBit(false); // Unknown 4.3.3
|
||||
data->WriteBit(!unit->m_movementInfo.GetMovementFlags2());
|
||||
|
||||
if (unit->m_movementInfo.GetMovementFlags2())
|
||||
{
|
||||
data->WriteBits(unit->m_movementInfo.GetMovementFlags2(), 12);
|
||||
}
|
||||
}
|
||||
|
||||
// used only with GO's, placeholder
|
||||
|
|
@ -354,7 +364,9 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 updateFlags) const
|
|||
{
|
||||
ObjectGuid guid;
|
||||
if (Unit* victim = ((Unit*)this)->getVictim())
|
||||
{
|
||||
guid = victim->GetObjectGuid();
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
if (hasElevation)
|
||||
{
|
||||
*data << float(unit->m_movementInfo.GetSplineElevation());
|
||||
}
|
||||
|
||||
if (isSplineEnabled)
|
||||
{
|
||||
Movement::PacketBuilder::WriteCreateBytes(*unit->movespline, *data);
|
||||
}
|
||||
|
||||
*data << float(unit->GetPositionZ());
|
||||
data->WriteGuidBytes<5>(Guid);
|
||||
|
|
@ -409,7 +425,9 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 updateFlags) const
|
|||
*data << float(NormalizeOrientation(unit->m_movementInfo.GetTransportPos()->o));
|
||||
|
||||
if (hasTransportTime2)
|
||||
{
|
||||
*data << uint32(unit->m_movementInfo.GetTransportTime2());
|
||||
}
|
||||
|
||||
*data << float(unit->m_movementInfo.GetTransportPos()->y);
|
||||
*data << float(unit->m_movementInfo.GetTransportPos()->x);
|
||||
|
|
@ -418,7 +436,9 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 updateFlags) const
|
|||
data->WriteGuidBytes<0>(tGuid);
|
||||
|
||||
if (hasTransportTime3)
|
||||
{
|
||||
*data << uint32(unit->m_movementInfo.GetFallTime());
|
||||
}
|
||||
|
||||
*data << int8(unit->m_movementInfo.GetTransportSeat());
|
||||
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));
|
||||
|
||||
if (hasOrientation)
|
||||
{
|
||||
*data << float(NormalizeOrientation(unit->GetOrientation()));
|
||||
}
|
||||
|
||||
*data << float(unit->GetSpeed(MOVE_RUN));
|
||||
|
||||
if (hasPitch)
|
||||
{
|
||||
*data << float(unit->m_movementInfo.GetPitch());
|
||||
}
|
||||
|
||||
*data << float(unit->GetSpeed(MOVE_FLIGHT));
|
||||
}
|
||||
|
|
@ -462,7 +486,9 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 updateFlags) const
|
|||
|
||||
data->WriteGuidBytes<0, 5>(transGuid);
|
||||
if (hasTransportTime3)
|
||||
{
|
||||
*data << uint32(0);
|
||||
}
|
||||
|
||||
data->WriteGuidBytes<3>(transGuid);
|
||||
*data << float(0.0f); // x offset
|
||||
|
|
@ -475,11 +501,15 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 updateFlags) const
|
|||
*data << float(0.0f); // o offset
|
||||
|
||||
if (hasTransportTime2)
|
||||
{
|
||||
*data << uint32(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (updateFlags & UPDATEFLAG_ROTATION)
|
||||
{
|
||||
*data << int64(((GameObject*)this)->GetPackedWorldRotation());
|
||||
}
|
||||
|
||||
if (updateFlags & UPDATEFLAG_TRANSPORT_ARR)
|
||||
{
|
||||
|
|
@ -514,13 +544,17 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 updateFlags) const
|
|||
{
|
||||
ObjectGuid guid;
|
||||
if (Unit* victim = ((Unit*)this)->getVictim())
|
||||
{
|
||||
guid = victim->GetObjectGuid();
|
||||
}
|
||||
|
||||
data->WriteGuidBytes<4, 0, 3, 5, 7, 6, 2, 1>(guid);
|
||||
}
|
||||
|
||||
if (updateFlags & UPDATEFLAG_TRANSPORT)
|
||||
{
|
||||
*data << uint32(WorldTimer::getMSTime());
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
if(GetTypeId() == TYPEID_PLAYER && target != this)
|
||||
{
|
||||
valuesCount = PLAYER_END_NOT_SELF;
|
||||
}
|
||||
|
||||
bool IsActivateToQuest = false;
|
||||
bool IsPerCasterAuraState = false;
|
||||
|
|
@ -598,12 +634,16 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* u
|
|||
if (GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
if (!target->canSeeSpellClickOn((Creature*)this))
|
||||
{
|
||||
appendValue &= ~UNIT_NPC_FLAG_SPELLCLICK;
|
||||
}
|
||||
|
||||
if (appendValue & UNIT_NPC_FLAG_TRAINER)
|
||||
{
|
||||
if (!((Creature*)this)->IsTrainerOf(target, false))
|
||||
{
|
||||
appendValue &= ~(UNIT_NPC_FLAG_TRAINER | UNIT_NPC_FLAG_TRAINER_CLASS | UNIT_NPC_FLAG_TRAINER_PROFESSION);
|
||||
}
|
||||
}
|
||||
|
||||
if (appendValue & UNIT_NPC_FLAG_STABLEMASTER)
|
||||
|
|
@ -623,12 +663,18 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* u
|
|||
{
|
||||
// IsPerCasterAuraState set if related pet caster aura state set already
|
||||
if (((Unit*)this)->HasAuraStateForCaster(AURA_STATE_CONFLAGRATE, target->GetObjectGuid()))
|
||||
{
|
||||
*data << m_uint32Values[index];
|
||||
}
|
||||
else
|
||||
{
|
||||
*data << (m_uint32Values[index] & ~(1 << (AURA_STATE_CONFLAGRATE - 1)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*data << m_uint32Values[index];
|
||||
}
|
||||
}
|
||||
// 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)
|
||||
|
|
@ -740,12 +786,18 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* u
|
|||
else if (index == GAMEOBJECT_BYTES_1)
|
||||
{
|
||||
if (((GameObject*)this)->GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT)
|
||||
{
|
||||
*data << uint32(m_uint32Values[index] | GO_STATE_TRANSPORT_SPEC);
|
||||
}
|
||||
else
|
||||
{
|
||||
*data << uint32(m_uint32Values[index]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{ *data << m_uint32Values[index]; } // other cases
|
||||
{
|
||||
*data << m_uint32Values[index]; // other cases
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -810,7 +862,9 @@ void Object::_SetUpdateBits(UpdateMask* updateMask, Player* target) const
|
|||
{
|
||||
uint32 valuesCount = m_valuesCount;
|
||||
if(GetTypeId() == TYPEID_PLAYER && target != this)
|
||||
{
|
||||
valuesCount = PLAYER_END_NOT_SELF;
|
||||
}
|
||||
|
||||
for (uint16 index = 0; index < valuesCount; ++index )
|
||||
if (m_changedValues[index])
|
||||
|
|
@ -823,7 +877,9 @@ void Object::_SetCreateBits(UpdateMask* updateMask, Player* target) const
|
|||
{
|
||||
uint32 valuesCount = m_valuesCount;
|
||||
if(GetTypeId() == TYPEID_PLAYER && target != this)
|
||||
{
|
||||
valuesCount = PLAYER_END_NOT_SELF;
|
||||
}
|
||||
|
||||
for (uint16 index = 0; index < valuesCount; ++index)
|
||||
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`
|
||||
float angle;
|
||||
if (!ori)
|
||||
{
|
||||
angle = rand_norm_f() * 2 * M_PI_F;
|
||||
}
|
||||
else
|
||||
{
|
||||
angle = *ori;
|
||||
}
|
||||
|
||||
float new_dist;
|
||||
if (minDist == 0.0f)
|
||||
{
|
||||
new_dist = rand_norm_f() * distance;
|
||||
}
|
||||
else
|
||||
{
|
||||
new_dist = minDist + rand_norm_f() * (distance - minDist);
|
||||
}
|
||||
|
||||
rand_x = x + new_dist * cos(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);
|
||||
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
|
||||
|
|
@ -1614,7 +1680,9 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z, Map* atMap
|
|||
{
|
||||
float ground_z = atMap->GetHeight(GetPhaseMask(), x, y, z);
|
||||
if (z < ground_z)
|
||||
{
|
||||
z = ground_z;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -1894,7 +1962,9 @@ Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, floa
|
|||
|
||||
#ifdef ENABLE_ELUNA
|
||||
if (Unit* summoner = ToUnit())
|
||||
{
|
||||
sEluna->OnSummoned(pCreature, summoner);
|
||||
}
|
||||
#endif /* ENABLE_ELUNA */
|
||||
|
||||
// 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 (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
|
||||
{
|
||||
UpdateGroundPositionZ(x, y, z);
|
||||
|
|
@ -2075,7 +2147,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
|||
if (selector.CheckOriginalAngle())
|
||||
{
|
||||
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
|
||||
{
|
||||
UpdateGroundPositionZ(x, y, z);
|
||||
|
|
@ -2101,7 +2175,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
|||
z = GetPositionZ();
|
||||
|
||||
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
|
||||
{
|
||||
UpdateGroundPositionZ(x, y, z);
|
||||
|
|
@ -2121,7 +2197,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
|||
y = first_y;
|
||||
|
||||
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
|
||||
{
|
||||
UpdateGroundPositionZ(x, y, z);
|
||||
|
|
@ -2139,7 +2217,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
|||
z = GetPositionZ();
|
||||
|
||||
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
|
||||
{
|
||||
UpdateGroundPositionZ(x, y, z);
|
||||
|
|
@ -2156,7 +2236,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
|||
y = first_y;
|
||||
|
||||
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
|
||||
{
|
||||
UpdateGroundPositionZ(x, y, z);
|
||||
|
|
@ -2168,7 +2250,9 @@ void WorldObject::SetPhaseMask(uint32 newPhaseMask, bool update)
|
|||
m_phaseMask = newPhaseMask;
|
||||
|
||||
if (update && IsInWorld())
|
||||
{
|
||||
UpdateVisibilityAndView();
|
||||
}
|
||||
}
|
||||
|
||||
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 GetPositionZ() const { return m_position.z; }
|
||||
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
|
||||
{ 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; }
|
||||
|
||||
/// 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
|
||||
#define MANGOS_OBJECT_GUID_H
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "Common.h"
|
||||
#include "ByteBuffer.h"
|
||||
|
||||
#include <functional>
|
||||
|
||||
enum TypeID
|
||||
{
|
||||
TYPEID_OBJECT = 0,
|
||||
|
|
@ -338,38 +338,46 @@ HASH_NAMESPACE_END
|
|||
#endif
|
||||
|
||||
|
||||
#define DEFINE_READGUIDMASK(T1, T2) template <T1> \
|
||||
void ByteBuffer::ReadGuidMask(ObjectGuid& guid) \
|
||||
{ \
|
||||
uint8 maskArr[] = { T2 }; \
|
||||
#define DEFINE_READGUIDMASK(T1, T2) template <T1> \
|
||||
void ByteBuffer::ReadGuidMask(ObjectGuid& guid) \
|
||||
{ \
|
||||
uint8 maskArr[] = { T2 }; \
|
||||
for (uint8 i = 0; i < countof(maskArr); ++i) \
|
||||
guid[maskArr[i]] = ReadBit(); \
|
||||
{ \
|
||||
guid[maskArr[i]] = ReadBit(); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define DEFINE_WRITEGUIDMASK(T1, T2) template <T1> \
|
||||
void ByteBuffer::WriteGuidMask(ObjectGuid guid) \
|
||||
{ \
|
||||
uint8 maskArr[] = { T2 }; \
|
||||
#define DEFINE_WRITEGUIDMASK(T1, T2) template <T1> \
|
||||
void ByteBuffer::WriteGuidMask(ObjectGuid guid) \
|
||||
{ \
|
||||
uint8 maskArr[] = { T2 }; \
|
||||
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> \
|
||||
void ByteBuffer::ReadGuidBytes(ObjectGuid& guid) \
|
||||
{ \
|
||||
uint8 maskArr[] = { T2 }; \
|
||||
{ \
|
||||
uint8 maskArr[] = { T2 }; \
|
||||
for (uint8 i = 0; i < countof(maskArr); ++i) \
|
||||
if (guid[maskArr[i]] != 0) \
|
||||
guid[maskArr[i]] ^= read<uint8>(); \
|
||||
if (guid[maskArr[i]] != 0) \
|
||||
{ \
|
||||
guid[maskArr[i]] ^= read<uint8>(); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define DEFINE_WRITEGUIDBYTES(T1, T2) template <T1> \
|
||||
void ByteBuffer::WriteGuidBytes(ObjectGuid guid) \
|
||||
{ \
|
||||
uint8 maskArr[] = { T2 }; \
|
||||
for (uint8 i = 0; i < countof(maskArr); ++i) \
|
||||
if (guid[maskArr[i]] != 0) \
|
||||
#define DEFINE_WRITEGUIDBYTES(T1, T2) template <T1> \
|
||||
void ByteBuffer::WriteGuidBytes(ObjectGuid guid) \
|
||||
{ \
|
||||
uint8 maskArr[] = { T2 }; \
|
||||
for (uint8 i = 0; i < countof(maskArr); ++i) \
|
||||
if (guid[maskArr[i]] != 0) \
|
||||
{ \
|
||||
(*this) << uint8(guid[maskArr[i]] ^ 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)
|
||||
{
|
||||
if (!cInfo->DifficultyEntry[diff])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
ok = false; // will be set to true at the end of this loop again
|
||||
|
||||
CreatureInfo const* difficultyInfo = GetCreatureTemplate(cInfo->DifficultyEntry[diff]);
|
||||
|
|
@ -577,7 +579,9 @@ void ObjectMgr::LoadCreatureTemplates()
|
|||
ok2 = true;
|
||||
}
|
||||
if (!ok2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (cInfo->UnitClass != difficultyInfo->UnitClass)
|
||||
{
|
||||
|
|
@ -635,7 +639,9 @@ void ObjectMgr::LoadCreatureTemplates()
|
|||
ok = true;
|
||||
}
|
||||
if (!ok)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->FactionAlliance);
|
||||
if (!factionTemplate)
|
||||
|
|
@ -688,7 +694,9 @@ void ObjectMgr::LoadCreatureTemplates()
|
|||
}
|
||||
|
||||
if (!displayScaleEntry)
|
||||
{
|
||||
sLog.outErrorDb("Creature (Entry: %u) has nonexistent modelid in modelid_1/modelid_2/modelid_3/modelid_4", cInfo->Entry);
|
||||
}
|
||||
|
||||
if (!cInfo->MinLevel)
|
||||
{
|
||||
|
|
@ -748,10 +756,14 @@ void ObjectMgr::LoadCreatureTemplates()
|
|||
}
|
||||
|
||||
if (cInfo->MeleeAttackPower == 0)
|
||||
{
|
||||
const_cast<CreatureInfo*>(cInfo)->MeleeAttackPower = BASE_ATTACK_TIME;
|
||||
}
|
||||
|
||||
if (cInfo->RangedAttackPower == 0)
|
||||
{
|
||||
const_cast<CreatureInfo*>(cInfo)->RangedAttackPower = BASE_ATTACK_TIME;
|
||||
}
|
||||
|
||||
if (cInfo->NpcFlags & UNIT_NPC_FLAG_SPELLCLICK)
|
||||
{
|
||||
|
|
@ -816,7 +828,9 @@ void ObjectMgr::LoadCreatureTemplates()
|
|||
if (cInfo->VendorTemplateId > 0)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/// if not set custom creature scale then load scale from CreatureDisplayInfo.dbc
|
||||
|
|
@ -1170,7 +1184,9 @@ uint32 ObjectMgr::GetModelForRace(uint32 sourceModelId, uint32 racemask)
|
|||
for (CreatureModelRaceMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
{
|
||||
if (!(itr->second.racemask & racemask))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (itr->second.creature_entry)
|
||||
{
|
||||
|
|
@ -1468,7 +1484,9 @@ void ObjectMgr::LoadCreatures()
|
|||
if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
|
||||
for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1; ++diff)
|
||||
if (cInfo->DifficultyEntry[diff])
|
||||
{
|
||||
difficultyCreatures[diff].insert(cInfo->DifficultyEntry[diff]);
|
||||
}
|
||||
|
||||
// build single time for check spawnmask
|
||||
std::map<uint32, uint32> spawnMasks;
|
||||
|
|
@ -1476,7 +1494,9 @@ void ObjectMgr::LoadCreatures()
|
|||
if (sMapStore.LookupEntry(i))
|
||||
for (int k = 0; k < MAX_DIFFICULTY; ++k)
|
||||
if (GetMapDifficultyData(i, Difficulty(k)))
|
||||
{
|
||||
spawnMasks[i] |= (1 << k);
|
||||
}
|
||||
// Map 0 was removed from dbc as of 4.x.x
|
||||
spawnMasks[0] = 1 << REGULAR_DIFFICULTY;
|
||||
|
||||
|
|
@ -1547,7 +1567,9 @@ void ObjectMgr::LoadCreatures()
|
|||
}
|
||||
}
|
||||
if (!ok)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (data.modelid_override > 0 && !sCreatureDisplayInfoStore.LookupEntry(data.modelid_override))
|
||||
{
|
||||
|
|
@ -1623,7 +1645,9 @@ void ObjectMgr::LoadCreatures()
|
|||
AddCreatureToGrid(guid, &data);
|
||||
|
||||
if (cInfo->ExtraFlags & CREATURE_EXTRA_FLAG_ACTIVE)
|
||||
{
|
||||
m_activeCreatures.insert(ActiveCreatureGuidsOnMap::value_type(data.mapid, guid));
|
||||
}
|
||||
}
|
||||
|
||||
++count;
|
||||
|
|
@ -1700,7 +1724,9 @@ void ObjectMgr::LoadGameObjects()
|
|||
if (sMapStore.LookupEntry(i))
|
||||
for (int k = 0; k < MAX_DIFFICULTY; ++k)
|
||||
if (GetMapDifficultyData(i, Difficulty(k)))
|
||||
{
|
||||
spawnMasks[i] |= (1 << k);
|
||||
}
|
||||
// Map 0 was removed from dbc as of 4.x.x
|
||||
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
|
||||
{
|
||||
AddGameobjectToGrid(guid, &data);
|
||||
}
|
||||
|
||||
//uint32 zoneId, areaId;
|
||||
//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);
|
||||
if (!addon)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!GetGODataPair(addon->guid))
|
||||
{
|
||||
|
|
@ -2104,7 +2134,9 @@ void ObjectMgr::LoadItemPrototypes()
|
|||
{
|
||||
/* to many errors, and possible not all items really used in game
|
||||
if (dbcitem)
|
||||
{
|
||||
sLog.outErrorDb("Item (Entry: %u) doesn't exists in DB, but must exist.",i);
|
||||
}
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
|
|
@ -2297,7 +2329,9 @@ void ObjectMgr::LoadItemPrototypes()
|
|||
}
|
||||
}
|
||||
else if (proto->RequiredReputationRank > MIN_REPUTATION_RANK)
|
||||
{
|
||||
sLog.outErrorDb("Item (Entry: %u) has RequiredReputationFaction ==0 but RequiredReputationRank > 0, rank setting is useless.", i);
|
||||
}
|
||||
|
||||
if (proto->MaxCount < -1)
|
||||
{
|
||||
|
|
@ -2464,7 +2498,9 @@ void ObjectMgr::LoadItemPrototypes()
|
|||
else if (proto->Spells[j].SpellTrigger == ITEM_SPELLTRIGGER_CHANCE_ON_HIT)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
if (proto->Spells[j].SpellId)
|
||||
|
|
@ -2552,7 +2588,9 @@ void ObjectMgr::LoadItemPrototypes()
|
|||
{
|
||||
uint32 mask = 1 << j;
|
||||
if (!(proto->BagFamily & mask))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemBagFamilyEntry const* bf = sItemBagFamilyStore.LookupEntry(j + 1);
|
||||
if (!bf)
|
||||
|
|
@ -2575,7 +2613,9 @@ void ObjectMgr::LoadItemPrototypes()
|
|||
}
|
||||
|
||||
if (proto->TotemCategory && !sTotemCategoryStore.LookupEntry(proto->TotemCategory))
|
||||
{
|
||||
sLog.outErrorDb("Item (Entry: %u) has wrong TotemCategory (%u)", i, proto->TotemCategory);
|
||||
}
|
||||
|
||||
for (int j = 0; j < MAX_ITEM_PROTO_SOCKETS; ++j)
|
||||
{
|
||||
|
|
@ -2587,7 +2627,9 @@ void ObjectMgr::LoadItemPrototypes()
|
|||
}
|
||||
|
||||
if (proto->GemProperties && !sGemPropertiesStore.LookupEntry(proto->GemProperties))
|
||||
{
|
||||
sLog.outErrorDb("Item (Entry: %u) has wrong GemProperties (%u)", i, proto->GemProperties);
|
||||
}
|
||||
|
||||
if (proto->RequiredDisenchantSkill < -1)
|
||||
{
|
||||
|
|
@ -2633,7 +2675,9 @@ void ObjectMgr::LoadItemPrototypes()
|
|||
{
|
||||
// lot DB cases
|
||||
if (proto->RequiredDisenchantSkill >= 0)
|
||||
{
|
||||
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)
|
||||
|
|
@ -2907,7 +2951,9 @@ void ObjectMgr::LoadItemRequiredTarget()
|
|||
{
|
||||
SpellEffectEntry const* spellEffect = pSpellInfo->GetSpellEffect(SpellEffectIndex(j));
|
||||
if(!spellEffect)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (spellEffect->EffectImplicitTargetA == TARGET_CHAIN_DAMAGE ||
|
||||
spellEffect->EffectImplicitTargetB == TARGET_CHAIN_DAMAGE ||
|
||||
|
|
@ -3480,19 +3526,27 @@ void ObjectMgr::LoadPlayerInfo()
|
|||
|
||||
// skip expansion races if not playing with expansion
|
||||
if (sWorld.getConfig(CONFIG_UINT32_EXPANSION) < EXPANSION_TBC && (race == RACE_BLOODELF || race == RACE_DRAENEI))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// skip expansion classes if not playing with expansion
|
||||
if (sWorld.getConfig(CONFIG_UINT32_EXPANSION) < EXPANSION_WOTLK && class_ == CLASS_DEATH_KNIGHT)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// skip expansion races if not playing with expansion
|
||||
if (sWorld.getConfig(CONFIG_UINT32_EXPANSION) < EXPANSION_CATA && (race == RACE_WORGEN || race == RACE_GOBLIN))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// 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))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// fatal error if no level 1 data
|
||||
if (!pInfo->levelInfo || pInfo->levelInfo[0].stats[0] == 0)
|
||||
|
|
@ -4076,7 +4130,9 @@ void ObjectMgr::LoadQuests()
|
|||
{
|
||||
// skip post-loading checks for disabled quests
|
||||
if (DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, iter->first))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Quest* qinfo = iter->second;
|
||||
|
||||
|
|
@ -4374,7 +4430,9 @@ void ObjectMgr::LoadQuests()
|
|||
{
|
||||
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(SpellEffectIndex(k));
|
||||
if(!spellEffect)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((spellEffect->Effect == SPELL_EFFECT_QUEST_COMPLETE && uint32(spellEffect->EffectMiscValue) == qinfo->QuestId) ||
|
||||
spellEffect->Effect == SPELL_EFFECT_SEND_EVENT)
|
||||
|
|
@ -4512,7 +4570,9 @@ void ObjectMgr::LoadQuests()
|
|||
if (qinfo->RewRepFaction[j])
|
||||
{
|
||||
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]);
|
||||
}
|
||||
|
||||
if (!sFactionStore.LookupEntry(qinfo->RewRepFaction[j]))
|
||||
{
|
||||
|
|
@ -4806,7 +4866,9 @@ void ObjectMgr::LoadQuests()
|
|||
{
|
||||
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(SpellEffectIndex(j));
|
||||
if(!spellEffect)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (spellEffect->Effect != SPELL_EFFECT_QUEST_COMPLETE)
|
||||
{
|
||||
continue;
|
||||
|
|
@ -4975,7 +5037,9 @@ void ObjectMgr::LoadQuestLocales()
|
|||
if (idx >= 0)
|
||||
{
|
||||
if ((int32)data.CompletedText.size() <= idx)
|
||||
{
|
||||
data.CompletedText.resize(idx + 1);
|
||||
}
|
||||
|
||||
data.CompletedText[idx] = str;
|
||||
}
|
||||
|
|
@ -5004,7 +5068,9 @@ void ObjectMgr::LoadQuestLocales()
|
|||
if (idx >= 0)
|
||||
{
|
||||
if ((int32)data.PortraitGiverName.size() <= idx)
|
||||
{
|
||||
data.PortraitGiverName.resize(idx + 1);
|
||||
}
|
||||
|
||||
data.PortraitGiverName[idx] = str;
|
||||
}
|
||||
|
|
@ -5016,7 +5082,9 @@ void ObjectMgr::LoadQuestLocales()
|
|||
if (idx >= 0)
|
||||
{
|
||||
if ((int32)data.PortraitGiverText.size() <= idx)
|
||||
{
|
||||
data.PortraitGiverText.resize(idx + 1);
|
||||
}
|
||||
|
||||
data.PortraitGiverText[idx] = str;
|
||||
}
|
||||
|
|
@ -5028,7 +5096,9 @@ void ObjectMgr::LoadQuestLocales()
|
|||
if (idx >= 0)
|
||||
{
|
||||
if ((int32)data.PortraitTurnInName.size() <= idx)
|
||||
{
|
||||
data.PortraitTurnInName.resize(idx + 1);
|
||||
}
|
||||
|
||||
data.PortraitTurnInName[idx] = str;
|
||||
}
|
||||
|
|
@ -5040,7 +5110,9 @@ void ObjectMgr::LoadQuestLocales()
|
|||
if (idx >= 0)
|
||||
{
|
||||
if ((int32)data.PortraitTurnInText.size() <= idx)
|
||||
{
|
||||
data.PortraitTurnInText.resize(idx + 1);
|
||||
}
|
||||
|
||||
data.PortraitTurnInText[idx] = str;
|
||||
}
|
||||
|
|
@ -5319,7 +5391,9 @@ void ObjectMgr::LoadWorldTemplate()
|
|||
{
|
||||
WorldTemplate const* temp = GetWorldTemplate(i);
|
||||
if (!temp)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(temp->map);
|
||||
if (!mapEntry)
|
||||
|
|
@ -6543,7 +6617,9 @@ void ObjectMgr::LoadGameObjectLocales()
|
|||
if (idx >= 0)
|
||||
{
|
||||
if ((int32)data.Name.size() <= idx)
|
||||
{
|
||||
data.Name.resize(idx + 1);
|
||||
}
|
||||
|
||||
data.Name[idx] = str;
|
||||
}
|
||||
|
|
@ -6559,7 +6635,9 @@ void ObjectMgr::LoadGameObjectLocales()
|
|||
if (idx >= 0)
|
||||
{
|
||||
if ((int32)data.CastBarCaption.size() <= idx)
|
||||
{
|
||||
data.CastBarCaption.resize(idx + 1);
|
||||
}
|
||||
|
||||
data.CastBarCaption[idx] = str;
|
||||
}
|
||||
|
|
@ -6746,7 +6824,9 @@ void ObjectMgr::LoadGameobjectInfo()
|
|||
}
|
||||
/* disable check for while, too many nonexistent spells
|
||||
if (goInfo->trap.spellId) // spell
|
||||
{
|
||||
CheckGOSpellId(goInfo,goInfo->trap.spellId,3);
|
||||
}
|
||||
*/
|
||||
break;
|
||||
}
|
||||
|
|
@ -6785,7 +6865,9 @@ void ObjectMgr::LoadGameobjectInfo()
|
|||
}
|
||||
/* disable check for while, too many nonexistent spells
|
||||
if (goInfo->goober.spellId) // spell
|
||||
{
|
||||
CheckGOSpellId(goInfo,goInfo->goober.spellId,10);
|
||||
}
|
||||
*/
|
||||
CheckGONoDamageImmuneId(goInfo, goInfo->goober.noDamageImmune, 11);
|
||||
if (goInfo->goober.linkedTrapId) // linked trap
|
||||
|
|
@ -7496,7 +7578,9 @@ void ObjectMgr::LoadQuestPOI()
|
|||
for (QuestPOIVector::iterator itr = vect.begin(); itr != vect.end(); ++itr)
|
||||
{
|
||||
if (itr->PoiId != poiId)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
QuestPOIPoint point(x, y);
|
||||
itr->points.push_back(point);
|
||||
|
|
@ -7829,9 +7913,13 @@ struct SQLSpellLoader : public SQLStorageLoaderBase<SQLSpellLoader, SQLHashStora
|
|||
void default_fill(uint32 field_pos, S src, D& dst)
|
||||
{
|
||||
if (field_pos == LOADED_SPELLDBC_FIELD_POS_EQUIPPED_ITEM_CLASS)
|
||||
{
|
||||
dst = D(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
dst = D(src);
|
||||
}
|
||||
}
|
||||
|
||||
void default_fill_to_str(uint32 field_pos, char const* /*src*/, char*& dst)
|
||||
|
|
@ -7861,7 +7949,9 @@ void ObjectMgr::LoadSpellTemplate()
|
|||
// check data correctness
|
||||
SpellEntry const* spellEntry = sSpellTemplate.LookupEntry<SpellEntry>(i);
|
||||
if (!spellEntry)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// insert serverside spell data
|
||||
if (sSpellStore.GetNumRows() <= i)
|
||||
|
|
@ -7870,7 +7960,9 @@ void ObjectMgr::LoadSpellTemplate()
|
|||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
sSpellStore.InsertEntry(const_cast<SpellEntry*>(spellEntry), i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -8941,7 +9033,9 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co
|
|||
case CONDITION_COMPLETED_ENCOUNTER:
|
||||
{
|
||||
if (!map)
|
||||
{
|
||||
map = player ? player->GetMap() : source->GetMap();
|
||||
}
|
||||
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());
|
||||
|
|
@ -8959,9 +9053,13 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co
|
|||
}
|
||||
// Select matching difficulties
|
||||
if (map->GetDifficulty() != Difficulty(dbcEntry1->Difficulty))
|
||||
{
|
||||
dbcEntry1 = NULL;
|
||||
}
|
||||
if (dbcEntry2 && map->GetDifficulty() != Difficulty(dbcEntry2->Difficulty))
|
||||
{
|
||||
dbcEntry2 = NULL;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
sLog.outErrorDb("XP user condition (entry %u, type %u) has useless data in value2 (%u)!", entry, condition, value2);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -9921,7 +10021,9 @@ void ObjectMgr::LoadTrainers(char const* tableName, bool isTemplates)
|
|||
{
|
||||
SpellEffectEntry const* spellEffect = spellinfo->GetSpellEffect(SpellEffectIndex(i));
|
||||
if (!spellEffect)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (spellEffect->Effect == SPELL_EFFECT_LEARN_SPELL &&
|
||||
SpellMgr::IsProfessionOrRidingSpell(spellEffect->EffectTriggerSpell))
|
||||
|
|
@ -9931,7 +10033,9 @@ void ObjectMgr::LoadTrainers(char const* tableName, bool isTemplates)
|
|||
{
|
||||
SpellEffectEntry const* spellEff = spellinfo->GetSpellEffect(SpellEffectIndex(j));
|
||||
if (!spellEff)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (spellEff->Effect == SPELL_EFFECT_LEARN_SPELL)
|
||||
{
|
||||
|
|
@ -9958,7 +10062,9 @@ 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);
|
||||
}
|
||||
else
|
||||
{
|
||||
trainerSpell.reqLevel = minLevel;
|
||||
}
|
||||
}
|
||||
// for non-prof. spell use spellLevel if not provided any
|
||||
else
|
||||
|
|
@ -9969,7 +10075,9 @@ 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);
|
||||
}
|
||||
else
|
||||
{
|
||||
trainerSpell.reqLevel = learnSpellinfo->GetSpellLevel();
|
||||
}
|
||||
}
|
||||
|
||||
++count;
|
||||
|
|
@ -10134,12 +10242,18 @@ void ObjectMgr::LoadActiveEntities(Map* _map)
|
|||
{
|
||||
_map = sMapMgr.FindMap(continents[i]);
|
||||
if (!_map)
|
||||
{
|
||||
_map = sMapMgr.CreateMap(continents[i], NULL);
|
||||
}
|
||||
|
||||
if (_map)
|
||||
{
|
||||
LoadActiveEntities(_map);
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog.outError("ObjectMgr::LoadActiveEntities - Unable to create Map %u", continents[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
@ -10151,7 +10265,9 @@ void ObjectMgr::LoadActiveEntities(Map* _map)
|
|||
for (CreatureDataMap::const_iterator itr = mCreatureDataMap.begin(); itr != mCreatureDataMap.end(); ++itr)
|
||||
{
|
||||
if (itr->second.mapid == _map->GetId())
|
||||
{
|
||||
_map->ForceLoadGrid(itr->second.posX, itr->second.posY);
|
||||
}
|
||||
}
|
||||
}
|
||||
else // Normal case - Load all npcs that are active
|
||||
|
|
@ -10213,7 +10329,9 @@ void ObjectMgr::LoadGossipMenu(std::set<uint32>& gossipScriptSet)
|
|||
{
|
||||
ScriptChainMap const* scm = sScriptMgr.GetScriptChainMap(DBS_ON_GOSSIP);
|
||||
if (!scm)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
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);
|
||||
if (!scm)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
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 (pl)
|
||||
{
|
||||
ChatHandler(pl).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST, ExtendedCost);
|
||||
}
|
||||
else
|
||||
sLog.outErrorDb("Table `%s` contain item (Entry: %u) with wrong ExtendedCost (%u) for %s %u, ignoring",
|
||||
tableName, item_id, ExtendedCost, idStr, vendor_entry);
|
||||
|
|
@ -10679,7 +10801,9 @@ bool ObjectMgr::IsVendorItemValid(bool isTemplate, char const* tableName, uint32
|
|||
if (!cInfo)
|
||||
{
|
||||
if (pl)
|
||||
{
|
||||
ChatHandler(pl).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
|
||||
}
|
||||
else
|
||||
sLog.outErrorDb("Table `%s` has data for nonexistent creature (Entry: %u), ignoring", tableName, vendor_entry);
|
||||
return false;
|
||||
|
|
@ -10690,12 +10814,16 @@ bool ObjectMgr::IsVendorItemValid(bool isTemplate, char const* tableName, uint32
|
|||
if (!skip_vendors || skip_vendors->count(vendor_entry) == 0)
|
||||
{
|
||||
if (pl)
|
||||
{
|
||||
ChatHandler(pl).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
|
||||
}
|
||||
else
|
||||
sLog.outErrorDb("Table `%s` has data for creature (Entry: %u) without vendor flag, ignoring", tableName, vendor_entry);
|
||||
|
||||
if (skip_vendors)
|
||||
{
|
||||
skip_vendors->insert(vendor_entry);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -10707,7 +10835,9 @@ bool ObjectMgr::IsVendorItemValid(bool isTemplate, char const* tableName, uint32
|
|||
if (!GetItemPrototype(item_id))
|
||||
{
|
||||
if (pl)
|
||||
{
|
||||
ChatHandler(pl).PSendSysMessage(LANG_ITEM_NOT_FOUND, item_id);
|
||||
}
|
||||
else
|
||||
sLog.outErrorDb("Table `%s` for %s %u contains nonexistent item (%u), ignoring",
|
||||
tableName, idStr, vendor_entry, item_id);
|
||||
|
|
@ -10720,7 +10850,9 @@ bool ObjectMgr::IsVendorItemValid(bool isTemplate, char const* tableName, uint32
|
|||
if (!currencyEntry)
|
||||
{
|
||||
if (pl)
|
||||
{
|
||||
ChatHandler(pl).PSendSysMessage(LANG_CURRENCY_NOT_FOUND, item_id);
|
||||
}
|
||||
else
|
||||
sLog.outErrorDb("Table `%s` for %s %u contains nonexistent currency (%u), ignoring",
|
||||
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 (pl)
|
||||
{
|
||||
ChatHandler(pl).PSendSysMessage(LANG_VENDOR_META_CURRENCY_NOT_ALLOWED, item_id);
|
||||
}
|
||||
else
|
||||
sLog.outErrorDb("Table `%s` for %s %u contains not allowed meta currency (%u), ignoring",
|
||||
tableName, idStr, vendor_entry, item_id);
|
||||
|
|
@ -10742,7 +10876,9 @@ bool ObjectMgr::IsVendorItemValid(bool isTemplate, char const* tableName, uint32
|
|||
else
|
||||
{
|
||||
if (pl)
|
||||
{
|
||||
ChatHandler(pl).PSendSysMessage(LANG_VENDOR_WRONG_ITEM_TYPE, item_id, type);
|
||||
}
|
||||
else
|
||||
sLog.outErrorDb("Table `%s` for %s %u contains nonexistent vendor item type %u (entry %u), ignoring",
|
||||
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 (pl)
|
||||
{
|
||||
ChatHandler(pl).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST, ExtendedCost);
|
||||
}
|
||||
else
|
||||
sLog.outErrorDb("Table `%s` contains %s (Entry: %u) with wrong ExtendedCost (%u) for %s %u, ignoring",
|
||||
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 (pl)
|
||||
{
|
||||
ChatHandler(pl).PSendSysMessage("MaxCount!=0 (%u) but IncrTime==0", maxcount);
|
||||
}
|
||||
else
|
||||
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);
|
||||
|
|
@ -10772,7 +10912,9 @@ bool ObjectMgr::IsVendorItemValid(bool isTemplate, char const* tableName, uint32
|
|||
else if (maxcount == 0 && incrtime > 0)
|
||||
{
|
||||
if (pl)
|
||||
{
|
||||
ChatHandler(pl).PSendSysMessage("MaxCount==0 but IncrTime<>=0");
|
||||
}
|
||||
else
|
||||
sLog.outErrorDb("Table `%s` has `maxcount`=0 for %s %u of %s %u but `incrtime`<>0, ignoring",
|
||||
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 (pl)
|
||||
{
|
||||
ChatHandler(pl).PSendSysMessage(LANG_VENDOR_WRONG_CURRENCY_MAXCOUNT, item_id, uint32(currencyEntry->GetPrecision()));
|
||||
}
|
||||
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",
|
||||
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 (pl)
|
||||
{
|
||||
ChatHandler(pl).PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST, item_id, type == VENDOR_ITEM_TYPE_CURRENCY, ExtendedCost);
|
||||
}
|
||||
else
|
||||
sLog.outErrorDb("Table `%s` has duplicate %s %u (with extended cost %u) for %s %u, ignoring",
|
||||
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 (pl)
|
||||
{
|
||||
ChatHandler(pl).PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST, item_id, type == VENDOR_ITEM_TYPE_CURRENCY, ExtendedCost);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!cInfo->VendorTemplateId)
|
||||
|
|
@ -10839,7 +10987,9 @@ bool ObjectMgr::IsVendorItemValid(bool isTemplate, char const* tableName, uint32
|
|||
if (countItems >= MAX_VENDOR_ITEMS)
|
||||
{
|
||||
if (pl)
|
||||
{
|
||||
ChatHandler(pl).SendSysMessage(LANG_COMMAND_ADDVENDORITEMITEMS);
|
||||
}
|
||||
else
|
||||
sLog.outErrorDb("Table `%s` has too many entries (%u >= %i) for %s %u, ignoring",
|
||||
tableName, countItems, MAX_VENDOR_ITEMS, idStr, vendor_entry);
|
||||
|
|
@ -11146,7 +11296,9 @@ bool FindGOData::operator()(GameObjectDataPair const& dataPair)
|
|||
}
|
||||
|
||||
if (!i_anyData)
|
||||
{
|
||||
i_anyData = &dataPair;
|
||||
}
|
||||
|
||||
// without player we can't find more stricted cases, so use fouded
|
||||
if (!i_player)
|
||||
|
|
|
|||
|
|
@ -1271,7 +1271,9 @@ class ObjectMgr
|
|||
static inline void GetLocaleString(const StringVector& data, int loc_idx, std::string& value)
|
||||
{
|
||||
if (data.size() > size_t(loc_idx) && !data[loc_idx].empty())
|
||||
{
|
||||
value = data[loc_idx];
|
||||
}
|
||||
}
|
||||
|
||||
int GetOrNewIndexForLocale(LocaleConstant loc);
|
||||
|
|
@ -1371,7 +1373,9 @@ class ObjectMgr
|
|||
for (HotfixData::const_iterator itr = m_hotfixData.begin(); itr != m_hotfixData.end(); ++itr)
|
||||
if (itr->Entry == entry && itr->Type == type)
|
||||
if (itr->Timestamp > ret)
|
||||
{
|
||||
ret = itr->Timestamp;
|
||||
}
|
||||
|
||||
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() &&
|
||||
m_nextUsedAreaItr[USED_POS_MINUS] == m_UsedAreaLists[USED_POS_MINUS].end())
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// ++ direction less updated
|
||||
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())
|
||||
{
|
||||
SetFFAPvP(true);
|
||||
}
|
||||
|
||||
SetCanModifyStats(true);
|
||||
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.
|
||||
if (!is_temporary_summoned)
|
||||
{
|
||||
m_charmInfo->LoadPetActionBar(fields[12].GetCppString());
|
||||
}
|
||||
|
||||
// since last save (in seconds)
|
||||
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);
|
||||
|
||||
if (getPetType() == HUNTER_PET && savedhealth <= 0)
|
||||
{
|
||||
SetDeathState(JUST_DIED);
|
||||
}
|
||||
|
||||
map->Add((Creature*)this);
|
||||
AIM_Initialize();
|
||||
|
|
@ -367,9 +373,13 @@ void Pet::SavePetToDB(PetSaveMode mode)
|
|||
{
|
||||
// Hunter Pets always save as current if dismissed or unsummoned due to range/etc.
|
||||
if (getPetType() == HUNTER_PET)
|
||||
{
|
||||
mode = PET_SAVE_AS_CURRENT;
|
||||
}
|
||||
else
|
||||
{
|
||||
mode = PET_SAVE_NOT_IN_SLOT;
|
||||
}
|
||||
}
|
||||
// not save pet as current if another pet temporary unsummoned
|
||||
else if (mode == PET_SAVE_AS_CURRENT && pOwner->GetTemporaryUnsummonedPetNumber() &&
|
||||
|
|
@ -682,7 +692,9 @@ void Pet::Unsummon(PetSaveMode mode, Unit* owner /*= NULL*/)
|
|||
// not save secondary permanent pet as current
|
||||
if (mode == PET_SAVE_AS_CURRENT && p_owner->GetTemporaryUnsummonedPetNumber() &&
|
||||
p_owner->GetTemporaryUnsummonedPetNumber() != GetCharmInfo()->GetPetNumber())
|
||||
{ mode = PET_SAVE_NOT_IN_SLOT; }
|
||||
{
|
||||
mode = PET_SAVE_NOT_IN_SLOT;
|
||||
}
|
||||
|
||||
if (mode == PET_SAVE_REAGENTS)
|
||||
{
|
||||
|
|
@ -703,7 +715,9 @@ void Pet::Unsummon(PetSaveMode mode, Unit* owner /*= NULL*/)
|
|||
{
|
||||
Item* item = p_owner->StoreNewItem(dest, spellReagents->Reagent[i], true);
|
||||
if (p_owner->IsInWorld())
|
||||
{
|
||||
p_owner->SendNewItem(item, spellReagents->ReagentCount[i], true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -726,7 +740,9 @@ void Pet::Unsummon(PetSaveMode mode, Unit* owner /*= NULL*/)
|
|||
{
|
||||
case MINI_PET:
|
||||
if (p_owner)
|
||||
{
|
||||
p_owner->SetMiniPet(NULL);
|
||||
}
|
||||
break;
|
||||
case PROTECTOR_PET:
|
||||
case GUARDIAN_PET:
|
||||
|
|
@ -918,11 +934,17 @@ void Pet::InitStatsForLevel(uint32 petlevel)
|
|||
{
|
||||
float scale;
|
||||
if (getLevel() >= cFamily->maxScaleLevel)
|
||||
{
|
||||
scale = cFamily->maxScale;
|
||||
}
|
||||
else if (getLevel() <= cFamily->minScaleLevel)
|
||||
{
|
||||
scale = cFamily->minScale;
|
||||
}
|
||||
else
|
||||
{
|
||||
scale = cFamily->minScale + float(getLevel() - cFamily->minScaleLevel) / cFamily->maxScaleLevel * (cFamily->maxScale - cFamily->minScale);
|
||||
}
|
||||
|
||||
SetObjectScale(scale);
|
||||
UpdateModelData();
|
||||
|
|
@ -930,7 +952,9 @@ void Pet::InitStatsForLevel(uint32 petlevel)
|
|||
|
||||
// Max level
|
||||
if (petlevel < sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL))
|
||||
{
|
||||
SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, sObjectMgr.GetXPForPetLevel(petlevel));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0);
|
||||
|
|
@ -1142,7 +1166,9 @@ void Pet::InitStatsForLevel(uint32 petlevel)
|
|||
health *= cInfo->HealthMultiplier;
|
||||
|
||||
if (mana > 0)
|
||||
{
|
||||
mana *= cInfo->PowerMultiplier;
|
||||
}
|
||||
|
||||
armor *= cInfo->ArmorMultiplier;
|
||||
}
|
||||
|
|
@ -1155,7 +1181,9 @@ void Pet::InitStatsForLevel(uint32 petlevel)
|
|||
|
||||
// A pet cannot not have health
|
||||
if (health < 1)
|
||||
{
|
||||
health = 1;
|
||||
}
|
||||
|
||||
// Set health
|
||||
SetCreateHealth(health);
|
||||
|
|
@ -1223,7 +1251,9 @@ uint32 Pet::GetCurrentFoodBenefitLevel(uint32 itemlevel)
|
|||
}
|
||||
// -15 or less
|
||||
else
|
||||
{ return 0; } // food too low level
|
||||
{
|
||||
return 0; // food too low level
|
||||
}
|
||||
}
|
||||
|
||||
void Pet::_LoadSpellCooldowns()
|
||||
|
|
@ -1426,7 +1456,9 @@ void Pet::_LoadAuras(uint32 timediff)
|
|||
if (procCharges)
|
||||
{
|
||||
if (remaincharges <= 0 || remaincharges > procCharges)
|
||||
{
|
||||
remaincharges = procCharges;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1439,7 +1471,9 @@ void Pet::_LoadAuras(uint32 timediff)
|
|||
stackcount = 1;
|
||||
}
|
||||
else if (defstackamount < stackcount)
|
||||
{
|
||||
stackcount = defstackamount;
|
||||
}
|
||||
else if (!stackcount)
|
||||
{
|
||||
stackcount = 1;
|
||||
|
|
@ -1509,7 +1543,9 @@ void Pet::_SaveAuras()
|
|||
SpellEntry const* spellInfo = holder->GetSpellProto();
|
||||
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(j));
|
||||
if(!effectEntry)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (effectEntry->EffectApplyAuraName == SPELL_AURA_MOD_STEALTH ||
|
||||
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
|
||||
uint32 rankSpellId = talentInfo->RankID[i];
|
||||
if (!rankSpellId || rankSpellId == spell_id)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// skip unknown ranks
|
||||
if (!HasSpell(rankSpellId))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
removeSpell(rankSpellId, false, false);
|
||||
}
|
||||
}
|
||||
|
|
@ -1681,7 +1721,9 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
|
|||
newspell.active = itr2->second.active;
|
||||
|
||||
if (newspell.active == ACT_ENABLED)
|
||||
{
|
||||
ToggleAutocast(itr2->first, false);
|
||||
}
|
||||
|
||||
oldspell_id = itr2->first;
|
||||
unlearnSpell(itr2->first, false, false);
|
||||
|
|
@ -1738,7 +1780,9 @@ bool Pet::learnSpell(uint32 spell_id)
|
|||
data << uint32(spell_id);
|
||||
((Player*)owner)->GetSession()->SendPacket(&data);
|
||||
|
||||
{ ((Player*)owner)->PetSpellInitialize(); }
|
||||
{
|
||||
((Player*)owner)->PetSpellInitialize();
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
@ -1755,10 +1799,14 @@ void Pet::InitLevelupSpellsForLevel()
|
|||
{
|
||||
// will called first if level down
|
||||
if (itr->first > level)
|
||||
{
|
||||
unlearnSpell(itr->second, true); // will learn prev rank if any
|
||||
}
|
||||
// will called if level up
|
||||
else
|
||||
{
|
||||
learnSpell(itr->second); // will unlearn prev rank if any
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1771,14 +1819,20 @@ void Pet::InitLevelupSpellsForLevel()
|
|||
{
|
||||
SpellEntry const* spellEntry = sSpellStore.LookupEntry(defSpells->spellid[i]);
|
||||
if (!spellEntry)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// will called first if level down
|
||||
if(spellEntry->GetSpellLevel() > level)
|
||||
{
|
||||
unlearnSpell(spellEntry->Id, true);
|
||||
}
|
||||
// will called if level up
|
||||
else
|
||||
{
|
||||
learnSpell(spellEntry->Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1799,7 +1853,9 @@ bool Pet::unlearnSpell(uint32 spell_id, bool learn_prev, bool clear_ab)
|
|||
}
|
||||
}
|
||||
}
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1832,9 +1888,13 @@ bool Pet::removeSpell(uint32 spell_id, bool learn_prev, bool clear_ab)
|
|||
if (talentCost > 0)
|
||||
{
|
||||
if (m_usedTalentCount > talentCost)
|
||||
{
|
||||
m_usedTalentCount -= talentCost;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_usedTalentCount = 0;
|
||||
}
|
||||
|
||||
UpdateFreeTalentPoints(false);
|
||||
}
|
||||
|
|
@ -1899,7 +1959,9 @@ bool Pet::resetTalents(bool no_cost)
|
|||
|
||||
// not need after this call
|
||||
if (((Player*)owner)->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
|
||||
{
|
||||
((Player*)owner)->RemoveAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS, true);
|
||||
}
|
||||
|
||||
CreatureInfo const* ci = GetCreatureInfo();
|
||||
if (!ci)
|
||||
|
|
@ -1943,15 +2005,21 @@ bool Pet::resetTalents(bool no_cost)
|
|||
TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab);
|
||||
|
||||
if (!talentTabInfo)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// unlearn only talents for pets family talent type
|
||||
if (!((1 << pet_family->petTalentType) & talentTabInfo->petTalentMask))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int j = 0; j < MAX_TALENT_RANK; ++j)
|
||||
if (talentInfo->RankID[j])
|
||||
{
|
||||
removeSpell(talentInfo->RankID[j], !IsPassiveSpell(talentInfo->RankID[j]), false);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateFreeTalentPoints(false);
|
||||
|
|
@ -1971,11 +2039,15 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/)
|
|||
{
|
||||
// not need after this call
|
||||
if (((Player*)owner)->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
|
||||
{
|
||||
((Player*)owner)->RemoveAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS, true);
|
||||
}
|
||||
|
||||
// reset for online
|
||||
if (online_pet)
|
||||
{
|
||||
online_pet->resetTalents(true);
|
||||
}
|
||||
|
||||
// now need only reset for offline pets (all pets except online case)
|
||||
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();
|
||||
|
||||
if (need_comma)
|
||||
{
|
||||
ss << ",";
|
||||
}
|
||||
|
||||
ss << id;
|
||||
|
||||
|
|
@ -2032,10 +2106,14 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/)
|
|||
uint32 spell = fields[0].GetUInt32();
|
||||
|
||||
if (!GetTalentSpellCost(spell))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (need_execute)
|
||||
{
|
||||
ss << ",";
|
||||
}
|
||||
|
||||
ss << spell;
|
||||
|
||||
|
|
@ -2067,15 +2145,23 @@ void Pet::UpdateFreeTalentPoints(bool resetIfNeed)
|
|||
{
|
||||
Unit* owner = GetOwner();
|
||||
if (!owner || owner->GetTypeId() != TYPEID_PLAYER || ((Player*)owner)->GetSession()->GetSecurity() < SEC_ADMINISTRATOR)
|
||||
{
|
||||
resetTalents(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetFreeTalentPoints(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SetFreeTalentPoints(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SetFreeTalentPoints(talentPointsForLevel - m_usedTalentCount);
|
||||
}
|
||||
}
|
||||
|
||||
void Pet::InitTalentForLevel()
|
||||
|
|
@ -2089,7 +2175,9 @@ void Pet::InitTalentForLevel()
|
|||
}
|
||||
|
||||
if (!m_loading)
|
||||
{
|
||||
((Player*)owner)->SendTalentsInfoData(true);
|
||||
}
|
||||
}
|
||||
|
||||
uint32 Pet::resetTalentsCost() const
|
||||
|
|
@ -2123,7 +2211,9 @@ uint8 Pet::GetMaxTalentPointsForLevel(uint32 level)
|
|||
uint8 points = (level >= 20) ? ((level - 16) / 4) : 0;
|
||||
// Mod points from owner SPELL_AURA_MOD_PET_TALENT_POINTS
|
||||
if (Unit* owner = GetOwner())
|
||||
{
|
||||
points += owner->GetTotalAuraModifier(SPELL_AURA_MOD_PET_TALENT_POINTS);
|
||||
}
|
||||
return points;
|
||||
}
|
||||
|
||||
|
|
@ -2142,7 +2232,9 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply)
|
|||
if (apply)
|
||||
{
|
||||
for (i = 0; i < m_autospells.size() && m_autospells[i] != spellid; ++i)
|
||||
{ ; } // just search
|
||||
{
|
||||
; // just search
|
||||
}
|
||||
|
||||
if (i == m_autospells.size())
|
||||
{
|
||||
|
|
@ -2162,7 +2254,9 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply)
|
|||
{
|
||||
AutoSpellList::iterator itr2 = m_autospells.begin();
|
||||
for (i = 0; i < m_autospells.size() && m_autospells[i] != spellid; ++i, ++itr2)
|
||||
{ ; } // just search
|
||||
{
|
||||
; // just search
|
||||
}
|
||||
|
||||
if (i < m_autospells.size())
|
||||
{
|
||||
|
|
@ -2361,7 +2455,9 @@ void Pet::SynchronizeLevelWithOwner()
|
|||
GivePetLevel(owner->getLevel());
|
||||
}
|
||||
else if (getLevel() + 5 < owner->getLevel())
|
||||
{
|
||||
GivePetLevel(owner->getLevel() - 5);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -2407,9 +2503,13 @@ void Pet::SetStayPosition(bool stay)
|
|||
void Pet::ApplyModeFlags(PetModeFlags mode, bool apply)
|
||||
{
|
||||
if (apply)
|
||||
{
|
||||
m_petModeFlags = PetModeFlags(m_petModeFlags | mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_petModeFlags = PetModeFlags(m_petModeFlags & ~mode);
|
||||
}
|
||||
|
||||
Unit* owner = GetOwner();
|
||||
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
|
||||
|
|
|
|||
|
|
@ -166,18 +166,26 @@ class Pet : public Creature
|
|||
uint32 GetPetAutoSpellOnPos(uint8 pos) const override
|
||||
{
|
||||
if (pos >= m_autospells.size())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_autospells[pos];
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool CanSwim() const override
|
||||
{
|
||||
Unit const* owner = GetOwner();
|
||||
if (owner)
|
||||
{
|
||||
return owner->GetTypeId() == TYPEID_PLAYER ? true : ((Creature const*)owner)->CanSwim();
|
||||
}
|
||||
else
|
||||
{
|
||||
return Creature::CanSwim();
|
||||
}
|
||||
}
|
||||
|
||||
void RegenerateAll(uint32 update_diff) override; // overwrite Creature::RegenerateAll
|
||||
|
|
|
|||
|
|
@ -71,7 +71,9 @@ void PetAI::MoveInLineOfSight(Unit* pWho)
|
|||
AttackStart(pWho);
|
||||
|
||||
if (Unit* owner = m_creature->GetOwner())
|
||||
{
|
||||
owner->SetInCombatState(true, pWho);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -90,7 +92,9 @@ void PetAI::AttackStart(Unit* u)
|
|||
// hope it doesn't start to leak memory without this :-/
|
||||
// i_pet->Clear();
|
||||
if (!m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
|
||||
{
|
||||
HandleMovementOnAttackStart(u);
|
||||
}
|
||||
|
||||
inCombat = true;
|
||||
}
|
||||
|
|
@ -145,7 +149,9 @@ void PetAI::UpdateAI(const uint32 diff)
|
|||
Unit* victim = NULL;
|
||||
|
||||
if (!((Pet*)m_creature)->isControlled())
|
||||
{
|
||||
m_creature->SelectHostileTarget();
|
||||
}
|
||||
|
||||
// Creature pets and guardians will always look in threat list for victim
|
||||
if (!(m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE)
|
||||
|
|
@ -154,7 +160,9 @@ void PetAI::UpdateAI(const uint32 diff)
|
|||
|
||||
if (m_updateAlliesTimer <= diff)
|
||||
// UpdateAllies self set update timer
|
||||
{ UpdateAllies(); }
|
||||
{
|
||||
UpdateAllies();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_updateAlliesTimer -= diff;
|
||||
|
|
@ -171,12 +179,16 @@ void PetAI::UpdateAI(const uint32 diff)
|
|||
if (!owner->IsWithinDistInMap(m_creature, (PET_FOLLOW_DIST * 2)))
|
||||
{
|
||||
if (!m_creature->hasUnitState(UNIT_STAT_FOLLOW))
|
||||
{
|
||||
m_creature->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
((Pet*)m_creature)->SetIsRetreating();
|
||||
{
|
||||
((Pet*)m_creature)->SetIsRetreating();
|
||||
}
|
||||
}
|
||||
else if (((Pet*)m_creature)->GetSpellOpener() != 0) // have opener stored
|
||||
{
|
||||
|
|
@ -195,10 +207,14 @@ void PetAI::UpdateAI(const uint32 diff)
|
|||
m_creature->SetInFront(victim);
|
||||
|
||||
if (victim->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
m_creature->SendCreateUpdateToPlayer((Player*)victim);
|
||||
}
|
||||
|
||||
if (owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
m_creature->SendCreateUpdateToPlayer((Player*)owner);
|
||||
}
|
||||
|
||||
uint32 spell_id = ((Pet*)m_creature)->GetSpellOpener();
|
||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell_id);
|
||||
|
|
@ -213,7 +229,9 @@ void PetAI::UpdateAI(const uint32 diff)
|
|||
spell->SpellStart(&(spell->m_targets));
|
||||
}
|
||||
else
|
||||
{
|
||||
delete spell;
|
||||
}
|
||||
|
||||
((Pet*)m_creature)->SetSpellOpener();
|
||||
}
|
||||
|
|
@ -280,7 +298,9 @@ void PetAI::UpdateAI(const uint32 diff)
|
|||
}
|
||||
// just ignore non-combat spells
|
||||
else if (IsNonCombatSpell(spellInfo))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
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
|
||||
if (!((Pet*)m_creature)->isControlled())
|
||||
{
|
||||
m_creature->SelectHostileTarget();
|
||||
}
|
||||
|
||||
if (!(m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE)
|
||||
|| (m_creature->IsPet() && ((Pet*)m_creature)->GetModeFlags() & PET_MODE_DISABLE_ACTIONS)))
|
||||
|
|
@ -390,14 +412,20 @@ void PetAI::UpdateAI(const uint32 diff)
|
|||
{
|
||||
m_creature->SetInFront(victim);
|
||||
if (victim->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
m_creature->SendCreateUpdateToPlayer((Player*)victim);
|
||||
}
|
||||
|
||||
if (owner && owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
m_creature->SendCreateUpdateToPlayer((Player*)owner);
|
||||
}
|
||||
}
|
||||
|
||||
if (DoMeleeAttackIfReady())
|
||||
{
|
||||
victim->AddThreat(m_creature);
|
||||
}
|
||||
}
|
||||
else if (!(m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)
|
||||
|| m_creature->hasUnitState(UNIT_STAT_MOVING)))
|
||||
|
|
@ -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 (!pet->IsStayPosSet())
|
||||
{
|
||||
pet->SetStayPosition(true);
|
||||
}
|
||||
|
||||
float stayPosX = pet->GetStayPosX();
|
||||
float stayPosY = pet->GetStayPosY();
|
||||
|
|
@ -436,10 +466,14 @@ void PetAI::UpdateAI(const uint32 diff)
|
|||
m_creature->GetMotionMaster()->MoveIdle();
|
||||
}
|
||||
else if (m_creature->GetOrientation() != StayPosO)
|
||||
{
|
||||
m_creature->SetOrientation(StayPosO);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pet->GetMotionMaster()->MovePoint(0, stayPosX, stayPosY, stayPosZ, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_creature->hasUnitState(UNIT_STAT_FOLLOW))
|
||||
|
|
@ -522,5 +556,7 @@ void PetAI::AttackedBy(Unit* attacker)
|
|||
if (!(m_creature->getVictim() || ((Pet*)m_creature)->GetIsRetreating() == true)
|
||||
&& !(m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_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,9 +257,13 @@ struct Glyph
|
|||
else if (newId == 0)
|
||||
{
|
||||
if (uState == GLYPH_NEW) // delete before add new -> no change
|
||||
{
|
||||
uState = GLYPH_UNCHANGED;
|
||||
}
|
||||
else // delete existing data
|
||||
{
|
||||
uState = GLYPH_DELETED;
|
||||
}
|
||||
}
|
||||
else if (uState != GLYPH_NEW) // if not new data, change current data
|
||||
{
|
||||
|
|
@ -404,9 +408,13 @@ struct Runes
|
|||
void SetRuneState(uint8 index, bool set = true)
|
||||
{
|
||||
if (set)
|
||||
{
|
||||
runeState |= (1 << index); // usable
|
||||
}
|
||||
else
|
||||
{
|
||||
runeState &= ~(1 << index); // on cooldown
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1661,13 +1669,19 @@ class Player : public Unit
|
|||
void ModifyMoney(int64 d)
|
||||
{
|
||||
if (d < 0)
|
||||
{
|
||||
SetMoney(GetMoney() > uint64(-d) ? GetMoney() + d : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetMoney(GetMoney() < uint64(MAX_MONEY_AMOUNT - d) ? GetMoney() + d : MAX_MONEY_AMOUNT);
|
||||
}
|
||||
|
||||
// "At Gold Limit"
|
||||
if (GetMoney() >= MAX_MONEY_AMOUNT)
|
||||
{
|
||||
SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL);
|
||||
}
|
||||
}
|
||||
void SetMoney(uint64 value)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -129,5 +129,7 @@ ReactorAI::EnterEvadeMode()
|
|||
|
||||
// Remove ChaseMovementGenerator from MotionMaster stack list, and add HomeMovementGenerator instead
|
||||
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE)
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (apply)
|
||||
{
|
||||
m_forcedReactions[faction_id] = rank;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_forcedReactions.erase(faction_id);
|
||||
}
|
||||
}
|
||||
|
||||
uint32 ReputationMgr::GetDefaultStateFlags(FactionEntry const* factionEntry) const
|
||||
|
|
@ -244,7 +248,9 @@ void ReputationMgr::Initialize()
|
|||
newFaction.needSave = true;
|
||||
|
||||
if (newFaction.Flags & FACTION_FLAG_VISIBLE)
|
||||
{
|
||||
++m_visibleFactionCount;
|
||||
}
|
||||
|
||||
UpdateRankCounters(REP_HOSTILE, GetBaseRank(factionEntry));
|
||||
|
||||
|
|
@ -274,7 +280,9 @@ void ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi
|
|||
// bonuses are already given, so just modify standing by rate
|
||||
int32 spilloverRep = standing * repTemplate->faction_rate[i];
|
||||
if (SetOneFactionReputation(sFactionStore.LookupEntry(repTemplate->faction[i]), spilloverRep, incremental))
|
||||
{
|
||||
anyRankIncreased = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -295,7 +303,9 @@ void ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi
|
|||
if (parentState != m_factions.end() && (parentState->second.Flags & FACTION_FLAG_TEAM_REPUTATION))
|
||||
{
|
||||
if (SetOneFactionReputation(parent, int32(spillOverRepOut), incremental))
|
||||
{
|
||||
anyRankIncreased = true;
|
||||
}
|
||||
}
|
||||
else // spill to "sister" factions
|
||||
{
|
||||
|
|
@ -311,12 +321,16 @@ void ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi
|
|||
if (FactionEntry const* factionEntryCalc = sFactionStore.LookupEntry(*itr))
|
||||
{
|
||||
if (factionEntryCalc == factionEntry || GetRank(factionEntryCalc) > ReputationRank(factionEntryCalc->spilloverMaxRankIn))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int32 spilloverRep = int32(spillOverRepOut * factionEntryCalc->spilloverRateIn);
|
||||
if (spilloverRep != 0 || !incremental)
|
||||
if (SetOneFactionReputation(factionEntryCalc, spilloverRep, incremental))
|
||||
{
|
||||
anyRankIncreased = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -326,7 +340,9 @@ void ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi
|
|||
if (faction != m_factions.end())
|
||||
{
|
||||
if (SetOneFactionReputation(factionEntry, standing, incremental))
|
||||
{
|
||||
anyRankIncreased = true;
|
||||
}
|
||||
|
||||
// only this faction gets reported to client, even if it has no own visible standing
|
||||
SendState(&faction->second, anyRankIncreased);
|
||||
|
|
@ -342,12 +358,18 @@ bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, in
|
|||
int32 BaseRep = GetBaseReputation(factionEntry);
|
||||
|
||||
if (incremental)
|
||||
{
|
||||
standing += faction.Standing + BaseRep;
|
||||
}
|
||||
|
||||
if (standing > Reputation_Cap)
|
||||
{
|
||||
standing = Reputation_Cap;
|
||||
}
|
||||
else if (standing < Reputation_Bottom)
|
||||
{
|
||||
standing = Reputation_Bottom;
|
||||
}
|
||||
|
||||
ReputationRank old_rank = ReputationToRank(faction.Standing + BaseRep);
|
||||
ReputationRank new_rank = ReputationToRank(standing);
|
||||
|
|
@ -359,7 +381,9 @@ bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, in
|
|||
SetVisible(&faction);
|
||||
|
||||
if (new_rank <= REP_HOSTILE)
|
||||
{
|
||||
SetAtWar(&faction, true);
|
||||
}
|
||||
|
||||
UpdateRankCounters(old_rank, new_rank);
|
||||
|
||||
|
|
@ -388,7 +412,9 @@ void ReputationMgr::SetVisible(FactionTemplateEntry const* factionTemplateEntry)
|
|||
}
|
||||
|
||||
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction))
|
||||
{
|
||||
SetVisible(factionEntry);
|
||||
}
|
||||
}
|
||||
|
||||
void ReputationMgr::SetVisible(FactionEntry const* factionEntry)
|
||||
|
|
@ -462,9 +488,13 @@ void ReputationMgr::SetAtWar(FactionState* faction, bool atWar)
|
|||
}
|
||||
|
||||
if (atWar)
|
||||
{
|
||||
faction->Flags |= FACTION_FLAG_AT_WAR;
|
||||
}
|
||||
else
|
||||
{
|
||||
faction->Flags &= ~FACTION_FLAG_AT_WAR;
|
||||
}
|
||||
|
||||
faction->needSend = true;
|
||||
faction->needSave = true;
|
||||
|
|
@ -496,9 +526,13 @@ void ReputationMgr::SetInactive(FactionState* faction, bool inactive)
|
|||
}
|
||||
|
||||
if (inactive)
|
||||
{
|
||||
faction->Flags |= FACTION_FLAG_INACTIVE;
|
||||
}
|
||||
else
|
||||
{
|
||||
faction->Flags &= ~FACTION_FLAG_INACTIVE;
|
||||
}
|
||||
|
||||
faction->needSend = true;
|
||||
faction->needSave = true;
|
||||
|
|
@ -553,10 +587,14 @@ void ReputationMgr::LoadFromDB(QueryResult* result)
|
|||
if (forceItr != m_forcedReactions.end())
|
||||
{
|
||||
if (forceItr->second <= REP_HOSTILE)
|
||||
{
|
||||
SetAtWar(faction, true);
|
||||
}
|
||||
}
|
||||
else if (GetRank(factionEntry) <= REP_HOSTILE)
|
||||
{
|
||||
SetAtWar(faction, true);
|
||||
}
|
||||
|
||||
// reset changed flag if values similar to saved in DB
|
||||
if (faction->Flags == dbFactionFlags)
|
||||
|
|
@ -595,16 +633,28 @@ void ReputationMgr::SaveToDB()
|
|||
void ReputationMgr::UpdateRankCounters(ReputationRank old_rank, ReputationRank new_rank)
|
||||
{
|
||||
if (old_rank >= REP_EXALTED)
|
||||
{
|
||||
--m_exaltedFactionCount;
|
||||
}
|
||||
if (old_rank >= REP_REVERED)
|
||||
{
|
||||
--m_reveredFactionCount;
|
||||
}
|
||||
if (old_rank >= REP_HONORED)
|
||||
{
|
||||
--m_honoredFactionCount;
|
||||
}
|
||||
|
||||
if (new_rank >= REP_EXALTED)
|
||||
{
|
||||
++m_exaltedFactionCount;
|
||||
}
|
||||
if (new_rank >= REP_REVERED)
|
||||
{
|
||||
++m_reveredFactionCount;
|
||||
}
|
||||
if (new_rank >= REP_HONORED)
|
||||
{
|
||||
++m_honoredFactionCount;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,9 @@ uint32 PlayerSocial::GetNumberOfSocialsWithFlag(SocialFlag flag)
|
|||
for (PlayerSocialMap::const_iterator itr = m_playerSocialMap.begin(); itr != m_playerSocialMap.end(); ++itr)
|
||||
{
|
||||
if (itr->second.Flags & flag)
|
||||
{
|
||||
++counter;
|
||||
}
|
||||
}
|
||||
return counter;
|
||||
}
|
||||
|
|
@ -74,7 +76,9 @@ bool PlayerSocial::AddToSocialList(ObjectGuid friend_guid, bool ignore)
|
|||
|
||||
uint32 flag = SOCIAL_FLAG_FRIEND;
|
||||
if (ignore)
|
||||
{
|
||||
flag = SOCIAL_FLAG_IGNORED;
|
||||
}
|
||||
|
||||
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid.GetCounter());
|
||||
if (itr != m_playerSocialMap.end())
|
||||
|
|
@ -102,7 +106,9 @@ void PlayerSocial::RemoveFromSocialList(ObjectGuid friend_guid, bool ignore)
|
|||
|
||||
uint32 flag = SOCIAL_FLAG_FRIEND;
|
||||
if (ignore)
|
||||
{
|
||||
flag = SOCIAL_FLAG_IGNORED;
|
||||
}
|
||||
|
||||
itr->second.Flags &= ~flag;
|
||||
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);
|
||||
if (itr != player->GetSocial()->m_playerSocialMap.end())
|
||||
{
|
||||
friendInfo.Note = itr->second.Note;
|
||||
}
|
||||
|
||||
// PLAYER see his team only and PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters
|
||||
// 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;
|
||||
if (pFriend->isAFK())
|
||||
{
|
||||
friendInfo.Status = FRIEND_STATUS_AFK;
|
||||
}
|
||||
if (pFriend->isDND())
|
||||
{
|
||||
friendInfo.Status = FRIEND_STATUS_DND;
|
||||
}
|
||||
friendInfo.Area = pFriend->GetZoneId();
|
||||
friendInfo.Level = pFriend->getLevel();
|
||||
friendInfo.Class = pFriend->getClass();
|
||||
|
|
@ -281,9 +293,13 @@ void SocialMgr::SendFriendStatus(Player* player, FriendsResult result, ObjectGui
|
|||
}
|
||||
|
||||
if (broadcast)
|
||||
{
|
||||
BroadcastToFriendListers(player, &data);
|
||||
}
|
||||
else
|
||||
{
|
||||
player->GetSession()->SendPacket(&data);
|
||||
}
|
||||
}
|
||||
|
||||
void SocialMgr::BroadcastToFriendListers(Player* player, WorldPacket* packet)
|
||||
|
|
@ -345,16 +361,24 @@ PlayerSocial* SocialMgr::LoadFromDB(QueryResult* result, ObjectGuid guid)
|
|||
note = fields[2].GetCppString();
|
||||
|
||||
if ((flags & SOCIAL_FLAG_IGNORED) && ignoreCounter >= SOCIALMGR_IGNORE_LIMIT)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ((flags & SOCIAL_FLAG_FRIEND) && friendCounter >= SOCIALMGR_FRIEND_LIMIT)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
social->m_playerSocialMap[friend_guid] = FriendInfo(flags, note);
|
||||
|
||||
if (flags & SOCIAL_FLAG_IGNORED)
|
||||
{
|
||||
++ignoreCounter;
|
||||
}
|
||||
else
|
||||
{
|
||||
++friendCounter;
|
||||
}
|
||||
}
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
|
|
|
|||
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));
|
||||
if(!effectEntry)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32 targetA = effectEntry->EffectImplicitTargetA;
|
||||
if(targetA && !IsCasterSourceTarget(targetA))
|
||||
|
|
@ -504,7 +506,9 @@ inline bool HasAreaAuraEffect(SpellEntry const* spellInfo)
|
|||
{
|
||||
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(i));
|
||||
if(!effectEntry)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (IsAreaAuraEffect(effectEntry->Effect))
|
||||
{
|
||||
return true;
|
||||
|
|
@ -519,7 +523,9 @@ inline bool HasAuraWithTriggerEffect(SpellEntry const* spellInfo)
|
|||
{
|
||||
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(i));
|
||||
if(!effectEntry)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
switch(effectEntry->Effect)
|
||||
{
|
||||
|
|
@ -539,7 +545,9 @@ inline bool IsOnlySelfTargeting(SpellEntry const* spellInfo)
|
|||
{
|
||||
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(i));
|
||||
if(!effectEntry)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (effectEntry->EffectImplicitTargetA)
|
||||
{
|
||||
|
|
@ -626,19 +634,27 @@ inline uint32 GetSpellMechanicMask(SpellEntry const* spellInfo, uint32 effectMas
|
|||
uint32 mask = 0;
|
||||
|
||||
if (uint32 mech = spellInfo->GetMechanic())
|
||||
{
|
||||
mask |= 1 << (mech - 1);
|
||||
}
|
||||
|
||||
for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i)
|
||||
{
|
||||
if (!(effectMask & (1 << i)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(i));
|
||||
if (!effectEntry)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (effectEntry->EffectMechanic)
|
||||
{
|
||||
mask |= 1 << (effectEntry->EffectMechanic - 1);
|
||||
}
|
||||
}
|
||||
|
||||
return mask;
|
||||
|
|
@ -649,13 +665,17 @@ inline uint32 GetAllSpellMechanicMask(SpellEntry const* spellInfo)
|
|||
SpellCategoriesEntry const* spellCategory = spellInfo->GetSpellCategories();
|
||||
uint32 mask = 0;
|
||||
if (spellCategory && spellCategory->Mechanic)
|
||||
{
|
||||
mask |= 1 << (spellCategory->Mechanic - 1);
|
||||
}
|
||||
|
||||
for (int i=0; i< MAX_EFFECT_INDEX; ++i)
|
||||
{
|
||||
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(i));
|
||||
if (effectEntry && effectEntry->EffectMechanic)
|
||||
{
|
||||
mask |= 1 << (effectEntry->EffectMechanic-1);
|
||||
}
|
||||
}
|
||||
|
||||
return mask;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,9 @@ bool Player::UpdateStats(Stats stat)
|
|||
{
|
||||
Pet* pet = GetPet();
|
||||
if (pet)
|
||||
{
|
||||
pet->UpdateStats(stat);
|
||||
}
|
||||
}
|
||||
|
||||
switch (stat)
|
||||
|
|
@ -90,12 +92,16 @@ bool Player::UpdateStats(Stats stat)
|
|||
AuraList const& modRatingFromStat = GetAurasByType(SPELL_AURA_MOD_RATING_FROM_STAT);
|
||||
for (AuraList::const_iterator i = modRatingFromStat.begin(); i != modRatingFromStat.end(); ++i)
|
||||
if (Stats((*i)->GetMiscBValue()) == stat)
|
||||
{
|
||||
mask |= (*i)->GetMiscValue();
|
||||
}
|
||||
if (mask)
|
||||
{
|
||||
for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
|
||||
if (mask & (1 << rating))
|
||||
{
|
||||
ApplyRatingMod(CombatRating(rating), 0, true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -174,7 +180,9 @@ void Player::UpdateResistances(uint32 school)
|
|||
|
||||
Pet* pet = GetPet();
|
||||
if (pet)
|
||||
{
|
||||
pet->UpdateResistances(school);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -197,7 +205,9 @@ void Player::UpdateArmor()
|
|||
{
|
||||
Modifier* mod = (*i)->GetModifier();
|
||||
if (mod->m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)
|
||||
{
|
||||
value += int32(GetStat(Stats((*i)->GetMiscBValue())) * mod->m_amount / 100.0f);
|
||||
}
|
||||
}
|
||||
|
||||
value *= GetModifierValue(unitMod, TOTAL_PCT);
|
||||
|
|
@ -206,7 +216,9 @@ void Player::UpdateArmor()
|
|||
|
||||
Pet* pet = GetPet();
|
||||
if (pet)
|
||||
{
|
||||
pet->UpdateArmor();
|
||||
}
|
||||
|
||||
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 moreStam = stamina - baseStam;
|
||||
if (moreStam < 0.0f)
|
||||
{
|
||||
moreStam = 0.0f;
|
||||
}
|
||||
|
||||
return baseStam + moreStam * hpBase->ratio;
|
||||
}
|
||||
|
|
@ -321,7 +335,9 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
|
|||
{
|
||||
if (SpellShapeshiftFormEntry const * entry = sSpellShapeshiftFormStore.LookupEntry(uint32(GetShapeshiftForm())))
|
||||
if (entry->flags1 & 0x20)
|
||||
{
|
||||
val2 += std::max(GetStat(STAT_AGILITY) - 10.0f, 0.0f) * chrEntry->apPerStr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -352,7 +368,9 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
|
|||
|
||||
Pet* pet = GetPet(); // update pet's AP
|
||||
if (pet)
|
||||
{
|
||||
pet->UpdateAttackPowerAndDamage();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -673,14 +691,20 @@ void Player::UpdateExpertise(WeaponAttackType attack)
|
|||
{
|
||||
// item neutral spell
|
||||
if((*itr)->GetSpellProto()->GetEquippedItemClass() == -1)
|
||||
{
|
||||
expertise += (*itr)->GetModifier()->m_amount;
|
||||
}
|
||||
// item dependent spell
|
||||
else if (weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellProto()))
|
||||
{
|
||||
expertise += (*itr)->GetModifier()->m_amount;
|
||||
}
|
||||
}
|
||||
|
||||
if (expertise < 0)
|
||||
{
|
||||
expertise = 0;
|
||||
}
|
||||
|
||||
switch (attack)
|
||||
{
|
||||
|
|
@ -758,24 +782,32 @@ void Player::UpdateMasteryAuras()
|
|||
{
|
||||
SpellAuraHolder* holder = GetSpellAuraHolder(masterySpells->at(i));
|
||||
if (!holder)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
SpellEntry const* spellEntry = holder->GetSpellProto();
|
||||
|
||||
// calculate mastery scaling coef
|
||||
int32 masteryCoef = GetMasteryCoefficient(spellEntry);
|
||||
if (!masteryCoef)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// update aura modifiers
|
||||
for (uint32 j = 0; j < MAX_EFFECT_INDEX; ++j)
|
||||
{
|
||||
Aura* aura = holder->GetAuraByEffectIndex(SpellEffectIndex(j));
|
||||
if (!aura)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (spellEntry->CalculateSimpleValue(SpellEffectIndex(j)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
aura->ApplyModifier(false, false);
|
||||
aura->GetModifier()->m_amount = int32(masteryValue * masteryCoef / 100.0f);
|
||||
|
|
@ -952,13 +984,17 @@ bool Pet::UpdateStats(Stats stat)
|
|||
if (stat == STAT_STAMINA)
|
||||
{
|
||||
if (owner)
|
||||
{
|
||||
value += float(owner->GetStat(stat)) * 0.3f;
|
||||
}
|
||||
}
|
||||
// warlock's and mage's pets gain 30% of owner's intellect
|
||||
else if (stat == STAT_INTELLECT && getPetType() == SUMMON_PET)
|
||||
{
|
||||
if (owner && (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE))
|
||||
{
|
||||
value += float(owner->GetStat(stat)) * 0.3f;
|
||||
}
|
||||
}
|
||||
|
||||
SetStat(stat, int32(value));
|
||||
|
|
@ -1006,7 +1042,9 @@ void Pet::UpdateResistances(uint32 school)
|
|||
Unit* owner = GetOwner();
|
||||
// hunter and warlock pets gain 40% of owner's resistance
|
||||
if (owner && (getPetType() == HUNTER_PET || (getPetType() == SUMMON_PET && owner->getClass() == CLASS_WARLOCK)))
|
||||
{
|
||||
value += float(owner->GetResistance(SpellSchools(school))) * 0.4f;
|
||||
}
|
||||
|
||||
SetResistance(SpellSchools(school), int32(value));
|
||||
}
|
||||
|
|
@ -1025,7 +1063,9 @@ void Pet::UpdateArmor()
|
|||
Unit* owner = GetOwner();
|
||||
// hunter and warlock pets gain 35% of owner's armor value
|
||||
if (owner && (getPetType() == HUNTER_PET || (getPetType() == SUMMON_PET && owner->getClass() == CLASS_WARLOCK)))
|
||||
{
|
||||
bonus_armor = 0.35f * float(owner->GetArmor());
|
||||
}
|
||||
|
||||
value = GetModifierValue(unitMod, BASE_VALUE);
|
||||
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 maximum = (fire > shadow) ? fire : shadow;
|
||||
if (maximum < 0)
|
||||
{
|
||||
maximum = 0;
|
||||
}
|
||||
SetBonusDamage(int32(maximum * 0.15f));
|
||||
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);
|
||||
if (frost < 0)
|
||||
{
|
||||
frost = 0;
|
||||
}
|
||||
SetBonusDamage(int32(frost * 0.4f));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -208,7 +208,9 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff)
|
|||
Unit* owner = GetCharmerOrOwner();
|
||||
uint32 const& spellId = GetUInt32Value(UNIT_CREATED_BY_SPELL);
|
||||
if (!owner || !spellId || !owner->HasAura(spellId))
|
||||
{
|
||||
UnSummon();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -248,21 +250,29 @@ void TemporarySummon::UnSummon()
|
|||
CombatStop();
|
||||
|
||||
if (m_linkedToOwnerAura & TEMPSUMMON_LINKED_AURA_REMOVE_OWNER)
|
||||
{
|
||||
RemoveAuraFromOwner();
|
||||
}
|
||||
|
||||
if (GetSummonerGuid().IsCreatureOrVehicle())
|
||||
{
|
||||
if (Creature* sum = GetMap()->GetCreature(GetSummonerGuid()))
|
||||
if (sum->AI())
|
||||
{
|
||||
sum->AI()->SummonedCreatureDespawn(this);
|
||||
}
|
||||
}
|
||||
else if (GetSummonerGuid().IsPlayer()) // if player that summoned this creature was MCing it, uncharm
|
||||
if (Player* player = GetMap()->GetPlayer(GetSummonerGuid()))
|
||||
if (player->GetMover() == this)
|
||||
{
|
||||
player->Uncharm();
|
||||
}
|
||||
|
||||
if (AI())
|
||||
{
|
||||
AI()->SummonedCreatureDespawn(this);
|
||||
}
|
||||
|
||||
AddObjectToRemoveList();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,14 +57,18 @@ bool Totem::Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo const*
|
|||
if (owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if (uint32 modelid_race = sObjectMgr.GetModelForRace(GetNativeDisplayId(), owner->getRaceMask()))
|
||||
{
|
||||
SetDisplayId(modelid_race);
|
||||
}
|
||||
}
|
||||
|
||||
cPos.SelectFinalPoint(this);
|
||||
|
||||
// totem must be at same Z in case swimming caster and etc.
|
||||
if (fabs(cPos.m_pos.z - owner->GetPositionZ()) > 5.0f)
|
||||
{
|
||||
cPos.m_pos.z = owner->GetPositionZ();
|
||||
}
|
||||
|
||||
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.
|
||||
// Normally non-players do not teleport to other maps.
|
||||
if (InstanceData* iData = GetMap()->GetInstanceData())
|
||||
{
|
||||
iData->OnCreatureCreate(this);
|
||||
}
|
||||
|
||||
LoadCreatureAddon(false);
|
||||
|
||||
|
|
@ -97,7 +103,9 @@ void Totem::Update(uint32 update_diff, uint32 time)
|
|||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_duration -= update_diff;
|
||||
}
|
||||
|
||||
Creature::Update(update_diff, time);
|
||||
}
|
||||
|
|
@ -108,7 +116,9 @@ void Totem::Summon(Unit* owner)
|
|||
owner->GetMap()->Add((Creature*)this);
|
||||
|
||||
if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI())
|
||||
{
|
||||
((Creature*)owner)->AI()->JustSummoned((Creature*)this);
|
||||
}
|
||||
#ifdef ENABLE_ELUNA
|
||||
sEluna->OnSummoned(this, owner);
|
||||
#endif /* ENABLE_ELUNA */
|
||||
|
|
@ -153,18 +163,24 @@ void Totem::UnSummon()
|
|||
{
|
||||
Player* Target = itr->getSource();
|
||||
if (Target && pGroup->SameSubGroup((Player*)owner, Target))
|
||||
{
|
||||
Target->RemoveAurasDueToSpell(GetSpell());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI())
|
||||
{
|
||||
((Creature*)owner)->AI()->SummonedCreatureDespawn((Creature*)this);
|
||||
}
|
||||
}
|
||||
|
||||
// any totem unsummon look like as totem kill, req. for proper animation
|
||||
if (IsAlive())
|
||||
{
|
||||
SetDeathState(DEAD);
|
||||
}
|
||||
|
||||
AddObjectToRemoveList();
|
||||
}
|
||||
|
|
@ -195,10 +211,14 @@ void Totem::SetTypeBySummonSpell(SpellEntry const* spellProto)
|
|||
{
|
||||
// If spell have cast time -> so its active totem
|
||||
if (GetSpellCastTime(totemSpell))
|
||||
{
|
||||
m_type = TOTEM_ACTIVE;
|
||||
}
|
||||
}
|
||||
if (spellProto->Id == 2056)
|
||||
{
|
||||
m_type = TOTEM_STATUE; // Jewelery statue
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
i_victimGuid.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1445,7 +1445,9 @@ class Unit : public WorldObject
|
|||
{
|
||||
AttackerSet::const_iterator itr = m_attackers.find(pAttacker);
|
||||
if (itr == m_attackers.end())
|
||||
{
|
||||
m_attackers.insert(pAttacker);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Internal function, must only be called from Unit::AttackStop()
|
||||
|
|
@ -3317,9 +3319,13 @@ class Unit : public WorldObject
|
|||
void SetVisibleAura(uint8 slot, SpellAuraHolder* holder)
|
||||
{
|
||||
if (!holder)
|
||||
{
|
||||
m_visibleAuras.erase(slot);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_visibleAuras[slot] = holder;
|
||||
}
|
||||
}
|
||||
VisibleAuraMap const& GetVisibleAuras() const { return m_visibleAuras; }
|
||||
uint8 GetVisibleAurasCount() const { return m_visibleAuras.size(); }
|
||||
|
|
|
|||
|
|
@ -94,16 +94,24 @@ class ThreatRefStatusChangeEvent : public UnitBaseEvent
|
|||
ThreatManager* iThreatManager;
|
||||
public:
|
||||
ThreatRefStatusChangeEvent(uint32 pType) : UnitBaseEvent(pType), iThreatManager(NULL)
|
||||
{ iHostileReference = NULL; }
|
||||
{
|
||||
iHostileReference = 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)
|
||||
{ iHostileReference = pHostileReference; iFValue = pValue; }
|
||||
{
|
||||
iHostileReference = pHostileReference; iFValue = pValue;
|
||||
}
|
||||
|
||||
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, bool pValue) : UnitBaseEvent(pType), iThreatManager(NULL)
|
||||
{ iHostileReference = pHostileReference; iBValue = pValue; }
|
||||
{
|
||||
iHostileReference = pHostileReference; iBValue = pValue;
|
||||
}
|
||||
|
||||
int32 getIValue() const { return iIValue; }
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,9 @@ class UpdateMask
|
|||
void Clear()
|
||||
{
|
||||
if (mUpdateMask)
|
||||
{
|
||||
memset(mUpdateMask, 0, mBlocks << 2);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateMask& operator = (const UpdateMask& mask)
|
||||
|
|
|
|||
|
|
@ -113,10 +113,14 @@ VehicleInfo::VehicleInfo(Unit* owner, VehicleEntry const* vehicleEntry, uint32 o
|
|||
m_vehicleSeats.insert(VehicleSeatMap::value_type(i, seatEntry));
|
||||
|
||||
if (IsUsableSeatForCreature(seatEntry->m_flags))
|
||||
{
|
||||
m_creatureSeats |= 1 << i;
|
||||
}
|
||||
|
||||
if (IsUsableSeatForPlayer(seatEntry->m_flags, seatEntry->m_flagsB))
|
||||
{
|
||||
m_playerSeats |= 1 << i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -132,7 +136,9 @@ VehicleInfo::~VehicleInfo()
|
|||
void VehicleInfo::Initialize()
|
||||
{
|
||||
if (!m_overwriteNpcEntry)
|
||||
{
|
||||
m_overwriteNpcEntry = m_owner->GetEntry();
|
||||
}
|
||||
|
||||
// Loading passengers (rough version only!)
|
||||
SQLMultiStorage::SQLMSIteratorBounds<VehicleAccessory> bounds = sVehicleAccessoryStorage.getBounds<VehicleAccessory>(m_overwriteNpcEntry);
|
||||
|
|
@ -152,18 +158,30 @@ void VehicleInfo::Initialize()
|
|||
Unit* pVehicle = (Unit*)m_owner;
|
||||
|
||||
if (vehicleFlags & VEHICLE_FLAG_NO_STRAFE)
|
||||
{
|
||||
pVehicle->m_movementInfo.AddMovementFlags2(MOVEFLAG2_NO_STRAFE);
|
||||
}
|
||||
if (vehicleFlags & VEHICLE_FLAG_NO_JUMPING)
|
||||
{
|
||||
pVehicle->m_movementInfo.AddMovementFlags2(MOVEFLAG2_NO_JUMPING);
|
||||
}
|
||||
if (vehicleFlags & VEHICLE_FLAG_FULLSPEEDTURNING)
|
||||
{
|
||||
pVehicle->m_movementInfo.AddMovementFlags2(MOVEFLAG2_FULLSPEEDTURNING);
|
||||
}
|
||||
if (vehicleFlags & VEHICLE_FLAG_ALLOW_PITCHING)
|
||||
{
|
||||
pVehicle->m_movementInfo.AddMovementFlags2(MOVEFLAG2_ALLOW_PITCHING);
|
||||
}
|
||||
if (vehicleFlags & VEHICLE_FLAG_FULLSPEEDPITCHING)
|
||||
{
|
||||
pVehicle->m_movementInfo.AddMovementFlags2(MOVEFLAG2_FULLSPEEDPITCHING);
|
||||
}
|
||||
|
||||
if (vehicleFlags & VEHICLE_FLAG_FIXED_POSITION)
|
||||
{
|
||||
pVehicle->SetRoot(true);
|
||||
}
|
||||
|
||||
// // Initialize power type based on DBC values (creatures only)
|
||||
// if (pVehicle->GetTypeId() == TYPEID_UNIT)
|
||||
|
|
@ -237,7 +255,9 @@ void VehicleInfo::Board(Unit* passenger, uint8 seat)
|
|||
}
|
||||
|
||||
if (!passenger->IsRooted())
|
||||
{
|
||||
passenger->SetRoot(true);
|
||||
}
|
||||
|
||||
Movement::MoveSplineInit init(*passenger);
|
||||
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())
|
||||
{
|
||||
passenger->SetRoot(false);
|
||||
}
|
||||
|
||||
Movement::MoveSplineInit init(*passenger);
|
||||
// ToDo: Set proper unboard coordinates
|
||||
|
|
@ -378,7 +400,9 @@ void VehicleInfo::UnBoard(Unit* passenger, bool changeVehicle)
|
|||
!(m_vehicleEntry->m_flags & (VEHICLE_FLAG_UNK4 | VEHICLE_FLAG_UNK20)))
|
||||
{
|
||||
if (((Creature*)m_owner)->IsTemporarySummon())
|
||||
{
|
||||
((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
|
||||
|
||||
if (seatFlags & SEAT_FLAG_NOT_SELECTABLE)
|
||||
{
|
||||
passenger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
}
|
||||
|
||||
if (passenger->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
|
|
@ -557,7 +583,9 @@ void VehicleInfo::ApplySeatMods(Unit* passenger, uint32 seatFlags)
|
|||
|
||||
// group update
|
||||
if (pPlayer->GetGroup())
|
||||
{
|
||||
pPlayer->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_VEHICLE_SEAT);
|
||||
}
|
||||
|
||||
if (seatFlags & SEAT_FLAG_CAN_CONTROL)
|
||||
{
|
||||
|
|
@ -619,7 +647,9 @@ void VehicleInfo::RemoveSeatMods(Unit* passenger, uint32 seatFlags)
|
|||
Unit* pVehicle = (Unit*)m_owner;
|
||||
|
||||
if (seatFlags & SEAT_FLAG_NOT_SELECTABLE)
|
||||
{
|
||||
passenger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
}
|
||||
|
||||
if (passenger->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
|
|
@ -627,7 +657,9 @@ void VehicleInfo::RemoveSeatMods(Unit* passenger, uint32 seatFlags)
|
|||
|
||||
// group update
|
||||
if (pPlayer->GetGroup())
|
||||
{
|
||||
pPlayer->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_VEHICLE_SEAT);
|
||||
}
|
||||
|
||||
if (seatFlags & SEAT_FLAG_CAN_CONTROL)
|
||||
{
|
||||
|
|
@ -645,11 +677,15 @@ void VehicleInfo::RemoveSeatMods(Unit* passenger, uint32 seatFlags)
|
|||
|
||||
// reset vehicle faction
|
||||
if (pVehicle->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
((Creature*)pVehicle)->ClearTemporaryFaction();
|
||||
}
|
||||
}
|
||||
|
||||
if (seatFlags & SEAT_FLAG_CAN_CAST)
|
||||
{
|
||||
pPlayer->RemovePetActionBar();
|
||||
}
|
||||
}
|
||||
else if (passenger->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
|
|
@ -662,7 +698,9 @@ void VehicleInfo::RemoveSeatMods(Unit* passenger, uint32 seatFlags)
|
|||
// Reinitialize movement
|
||||
((Creature*)passenger)->AI()->SetCombatMovement(true, true);
|
||||
if (!passenger->getVictim())
|
||||
{
|
||||
passenger->GetMotionMaster()->Initialize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -92,9 +92,13 @@ void OutdoorPvP::HandleGameObjectCreate(GameObject* go)
|
|||
CapturePointSliderMap const* capturePoints = sOutdoorPvPMgr.GetCapturePointSliderMap();
|
||||
CapturePointSliderMap::const_iterator itr = capturePoints->find(go->GetEntry());
|
||||
if (itr != capturePoints->end())
|
||||
{
|
||||
go->SetCapturePointSlider(itr->second.Value, itr->second.IsLocked);
|
||||
}
|
||||
else
|
||||
{
|
||||
go->SetCapturePointSlider(CAPTURE_SLIDER_MIDDLE, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -140,7 +140,9 @@ void OutdoorPvPGH::DespawnVendors(const WorldObject* objRef)
|
|||
for (GuidList::const_iterator itr = m_teamVendors.begin(); itr != m_teamVendors.end(); ++itr)
|
||||
{
|
||||
if (Creature* vendor = objRef->GetMap()->GetCreature(*itr))
|
||||
{
|
||||
vendor->ForcedDespawn();
|
||||
}
|
||||
}
|
||||
m_teamVendors.clear();
|
||||
}
|
||||
|
|
@ -149,7 +151,9 @@ void OutdoorPvPGH::DespawnVendors(const WorldObject* objRef)
|
|||
void OutdoorPvPGH::LockLighthouse(const WorldObject* objRef)
|
||||
{
|
||||
if (GameObject* go = objRef->GetMap()->GetGameObject(m_capturePoint))
|
||||
{
|
||||
go->SetLootState(GO_JUST_DEACTIVATED);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
if (GameObject* go = objRef->GetMap()->GetGameObject(m_capturePoint))
|
||||
{
|
||||
go->SetLootState(GO_ACTIVATED);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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
|
||||
if (m_towersAlliance == MAX_HP_TOWERS && player->GetTeam() == ALLIANCE)
|
||||
{
|
||||
player->CastSpell(player, SPELL_HELLFIRE_SUPERIORITY_ALLIANCE, true);
|
||||
}
|
||||
else if (m_towersHorde == MAX_HP_TOWERS && player->GetTeam() == HORDE)
|
||||
{
|
||||
player->CastSpell(player, SPELL_HELLFIRE_SUPERIORITY_HORDE, true);
|
||||
}
|
||||
}
|
||||
|
||||
void OutdoorPvPHP::HandlePlayerLeaveZone(Player* player, bool isMainZone)
|
||||
|
|
@ -168,7 +172,9 @@ void OutdoorPvPHP::HandlePlayerKillInsideArea(Player* player)
|
|||
{
|
||||
// check capture point team
|
||||
if (player->GetTeam() == m_towerOwner[i])
|
||||
{
|
||||
player->CastSpell(player, player->GetTeam() == ALLIANCE ? SPELL_HELLFIRE_TOWER_TOKEN_ALLIANCE : SPELL_HELLFIRE_TOWER_TOKEN_HORDE, true);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -191,7 +197,9 @@ bool OutdoorPvPHP::HandleEvent(uint32 eventId, GameObject* go)
|
|||
if (hellfireTowerEvents[i][j].team != m_towerOwner[i])
|
||||
{
|
||||
if (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);
|
||||
}
|
||||
|
|
@ -219,7 +227,9 @@ bool OutdoorPvPHP::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team
|
|||
SendUpdateWorldState(WORLD_STATE_HP_TOWER_COUNT_ALLIANCE, m_towersAlliance);
|
||||
|
||||
if (m_towersAlliance == MAX_HP_TOWERS)
|
||||
{
|
||||
BuffTeam(ALLIANCE, SPELL_HELLFIRE_SUPERIORITY_ALLIANCE);
|
||||
}
|
||||
}
|
||||
else if (team == HORDE)
|
||||
{
|
||||
|
|
@ -230,7 +240,9 @@ bool OutdoorPvPHP::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team
|
|||
SendUpdateWorldState(WORLD_STATE_HP_TOWER_COUNT_HORDE, m_towersHorde);
|
||||
|
||||
if (m_towersHorde == MAX_HP_TOWERS)
|
||||
{
|
||||
BuffTeam(HORDE, SPELL_HELLFIRE_SUPERIORITY_HORDE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -239,7 +251,9 @@ bool OutdoorPvPHP::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team
|
|||
if (m_towerOwner[towerId] == ALLIANCE)
|
||||
{
|
||||
if (m_towersAlliance == MAX_HP_TOWERS)
|
||||
{
|
||||
BuffTeam(ALLIANCE, SPELL_HELLFIRE_SUPERIORITY_ALLIANCE, true);
|
||||
}
|
||||
|
||||
// update counter
|
||||
--m_towersAlliance;
|
||||
|
|
@ -248,7 +262,9 @@ bool OutdoorPvPHP::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team
|
|||
else
|
||||
{
|
||||
if (m_towersHorde == MAX_HP_TOWERS)
|
||||
{
|
||||
BuffTeam(HORDE, SPELL_HELLFIRE_SUPERIORITY_HORDE, true);
|
||||
}
|
||||
|
||||
// update counter
|
||||
--m_towersHorde;
|
||||
|
|
|
|||
|
|
@ -145,7 +145,9 @@ void OutdoorPvPMgr::HandlePlayerEnterZone(Player* player, uint32 zoneId)
|
|||
script->HandlePlayerEnterZone(player, true);
|
||||
}
|
||||
else if (OutdoorPvP* affectedScript = GetScriptOfAffectedZone(zoneId))
|
||||
{
|
||||
affectedScript->HandlePlayerEnterZone(player, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -162,7 +164,9 @@ void OutdoorPvPMgr::HandlePlayerLeaveZone(Player* player, uint32 zoneId)
|
|||
script->HandlePlayerLeaveZone(player, true);
|
||||
}
|
||||
else if (OutdoorPvP* affectedScript = GetScriptOfAffectedZone(zoneId))
|
||||
{
|
||||
affectedScript->HandlePlayerLeaveZone(player, false);
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
if (player->GetTeam() == m_zoneOwner)
|
||||
{
|
||||
player->CastSpell(player, SPELL_STRENGTH_HALAANI, true);
|
||||
}
|
||||
}
|
||||
|
||||
void OutdoorPvPNA::HandlePlayerLeaveZone(Player* player, bool isMainZone)
|
||||
|
|
@ -99,7 +101,9 @@ void OutdoorPvPNA::HandleObjectiveComplete(uint32 eventId, const std::list<Playe
|
|||
for (std::list<Player*>::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
||||
{
|
||||
if ((*itr) && (*itr)->GetTeam() == team)
|
||||
{
|
||||
(*itr)->KilledMonsterCredit(NPC_HALAA_COMBATANT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -115,7 +119,9 @@ void OutdoorPvPNA::HandlePlayerKillInsideArea(Player* player)
|
|||
{
|
||||
// check capture point team
|
||||
if (player->GetTeam() == m_zoneOwner)
|
||||
{
|
||||
player->CastSpell(player, player->GetTeam() == ALLIANCE ? SPELL_NAGRAND_TOKEN_ALLIANCE : SPELL_NAGRAND_TOKEN_HORDE, true);
|
||||
}
|
||||
|
||||
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
|
||||
if (!m_soldiersRespawnTimer)
|
||||
{
|
||||
m_soldiersRespawnTimer = m_isUnderSiege ? HOUR * IN_MILLISECONDS : 5 * MINUTE * IN_MILLISECONDS;
|
||||
}
|
||||
|
||||
// decrease the counter
|
||||
--m_guardsLeft;
|
||||
|
|
@ -418,7 +426,9 @@ void OutdoorPvPNA::DespawnVendors(const WorldObject* objRef)
|
|||
for (GuidList::const_iterator itr = m_teamVendors.begin(); itr != m_teamVendors.end(); ++itr)
|
||||
{
|
||||
if (Creature* soldier = objRef->GetMap()->GetCreature(*itr))
|
||||
{
|
||||
soldier->ForcedDespawn();
|
||||
}
|
||||
}
|
||||
m_teamVendors.clear();
|
||||
}
|
||||
|
|
@ -531,12 +541,18 @@ void OutdoorPvPNA::Update(uint32 diff)
|
|||
|
||||
// if all the guards are respawned, stop the timer, else resume the timer depending on the siege state
|
||||
if (m_guardsLeft == MAX_NA_GUARDS)
|
||||
{
|
||||
m_soldiersRespawnTimer = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_soldiersRespawnTimer = m_isUnderSiege ? HOUR * IN_MILLISECONDS : 5 * MINUTE * IN_MILLISECONDS;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_soldiersRespawnTimer -= diff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -547,7 +563,9 @@ void OutdoorPvPNA::RespawnSoldier()
|
|||
{
|
||||
// Find player who is in main zone (Nagrand) to get correct map reference
|
||||
if (!itr->second)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Player* player = sObjectMgr.GetPlayer(itr->first))
|
||||
{
|
||||
|
|
@ -564,7 +582,9 @@ void OutdoorPvPNA::RespawnSoldier()
|
|||
void OutdoorPvPNA::LockHalaa(const WorldObject* objRef)
|
||||
{
|
||||
if (GameObject* go = objRef->GetMap()->GetGameObject(m_capturePoint))
|
||||
{
|
||||
go->SetLootState(GO_JUST_DEACTIVATED);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
if (GameObject* go = objRef->GetMap()->GetGameObject(m_capturePoint))
|
||||
{
|
||||
go->SetLootState(GO_ACTIVATED);
|
||||
}
|
||||
else
|
||||
{
|
||||
// if grid is unloaded, changing the saved slider value is enough
|
||||
|
|
|
|||
|
|
@ -65,7 +65,9 @@ void OutdoorPvPTF::FillInitialWorldStates(WorldPacket& data, uint32& count)
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateTimerWorldState();
|
||||
}
|
||||
}
|
||||
|
||||
void OutdoorPvPTF::SendRemoveWorldStates(Player* player)
|
||||
|
|
@ -87,7 +89,9 @@ void OutdoorPvPTF::HandlePlayerEnterZone(Player* player, bool isMainZone)
|
|||
|
||||
// Handle the buffs
|
||||
if (player->GetTeam() == m_zoneOwner)
|
||||
{
|
||||
player->CastSpell(player, SPELL_AUCHINDOUN_BLESSING, true);
|
||||
}
|
||||
}
|
||||
|
||||
void OutdoorPvPTF::HandlePlayerLeaveZone(Player* player, bool isMainZone)
|
||||
|
|
@ -138,7 +142,9 @@ void OutdoorPvPTF::HandleObjectiveComplete(uint32 eventId, const std::list<Playe
|
|||
for (std::list<Player*>::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
||||
{
|
||||
if ((*itr) && (*itr)->GetTeam() == team)
|
||||
{
|
||||
(*itr)->AreaExploredOrEventHappens(team == ALLIANCE ? QUEST_SPIRITS_OF_AUCHINDOUM_ALLIANCE : QUEST_SPIRITS_OF_AUCHINDOUM_HORDE);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -305,7 +311,9 @@ void OutdoorPvPTF::UnlockZone()
|
|||
{
|
||||
// Find player who is in main zone (Terokkar Forest) to get correct map reference
|
||||
if (!itr->second)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Player* player = sObjectMgr.GetPlayer(itr->first))
|
||||
{
|
||||
|
|
@ -336,7 +344,9 @@ void OutdoorPvPTF::Update(uint32 diff)
|
|||
m_zoneUpdateTimer = TIMER_TF_UPDATE_TIME;
|
||||
}
|
||||
else
|
||||
m_zoneUpdateTimer -= diff;*/
|
||||
{
|
||||
m_zoneUpdateTimer -= diff;
|
||||
}*/
|
||||
|
||||
m_zoneLockTimer -= diff;
|
||||
}
|
||||
|
|
@ -362,7 +372,9 @@ void OutdoorPvPTF::LockTowers(const WorldObject* objRef)
|
|||
for (uint8 i = 0; i < MAX_TF_TOWERS; ++i)
|
||||
{
|
||||
if (GameObject* go = objRef->GetMap()->GetGameObject(m_towerBanners[i]))
|
||||
{
|
||||
go->SetLootState(GO_JUST_DEACTIVATED);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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
|
||||
if (player->GetTeam() == m_graveyardOwner)
|
||||
{
|
||||
player->CastSpell(player, SPELL_TWIN_SPIRE_BLESSING, true);
|
||||
}
|
||||
}
|
||||
|
||||
void OutdoorPvPZM::HandlePlayerLeaveZone(Player* player, bool isMainZone)
|
||||
|
|
@ -106,19 +108,31 @@ void OutdoorPvPZM::HandleCreatureCreate(Creature* creature)
|
|||
{
|
||||
case NPC_PVP_BEAM_RED:
|
||||
if (creature->GetPositionY() < 7000.0f) // East Beam
|
||||
{
|
||||
m_beamTowerRed[0] = creature->GetObjectGuid();
|
||||
}
|
||||
else if (creature->GetPositionY() < 7300.0f) // Center Beam
|
||||
{
|
||||
m_beamGraveyardRed = creature->GetObjectGuid();
|
||||
}
|
||||
else // West Beam
|
||||
{
|
||||
m_beamTowerRed[1] = creature->GetObjectGuid();
|
||||
}
|
||||
break;
|
||||
case NPC_PVP_BEAM_BLUE:
|
||||
if (creature->GetPositionY() < 7000.0f) // East Beam
|
||||
{
|
||||
m_beamTowerBlue[0] = creature->GetObjectGuid();
|
||||
}
|
||||
else if (creature->GetPositionY() < 7300.0f) // Center Beam
|
||||
{
|
||||
m_beamGraveyardBlue = creature->GetObjectGuid();
|
||||
}
|
||||
else // West Beam
|
||||
{
|
||||
m_beamTowerBlue[1] = creature->GetObjectGuid();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -160,7 +174,9 @@ void OutdoorPvPZM::HandlePlayerKillInsideArea(Player* player)
|
|||
{
|
||||
// check capture point team
|
||||
if (player->GetTeam() == m_towerOwner[i])
|
||||
{
|
||||
player->CastSpell(player, player->GetTeam() == ALLIANCE ? SPELL_ZANGA_TOWER_TOKEN_ALLIANCE : SPELL_ZANGA_TOWER_TOKEN_HORDE, true);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -183,7 +199,9 @@ bool OutdoorPvPZM::HandleEvent(uint32 eventId, GameObject* go)
|
|||
if (zangarmarshTowerEvents[i][j].team != m_towerOwner[i])
|
||||
{
|
||||
if (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);
|
||||
}
|
||||
|
|
@ -214,7 +232,9 @@ bool OutdoorPvPZM::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team
|
|||
|
||||
// only add flag to scouts if team does not have captured graveyard already
|
||||
if (m_graveyardOwner != ALLIANCE)
|
||||
{
|
||||
UpdateScoutState(ALLIANCE, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (team == HORDE)
|
||||
|
|
@ -230,7 +250,9 @@ bool OutdoorPvPZM::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team
|
|||
|
||||
// only add flag to scouts if team does not already have captured graveyard
|
||||
if (m_graveyardOwner != HORDE)
|
||||
{
|
||||
UpdateScoutState(HORDE, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -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
|
||||
if (m_towersAlliance == MAX_ZM_TOWERS && m_graveyardOwner != ALLIANCE)
|
||||
{
|
||||
UpdateScoutState(ALLIANCE, false);
|
||||
}
|
||||
|
||||
// update counter
|
||||
--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
|
||||
if (m_towersHorde == MAX_ZM_TOWERS && m_graveyardOwner != HORDE)
|
||||
{
|
||||
UpdateScoutState(HORDE, false);
|
||||
}
|
||||
|
||||
// update counter
|
||||
--m_towersHorde;
|
||||
|
|
@ -285,7 +311,9 @@ void OutdoorPvPZM::UpdateScoutState(Team team, bool spawned)
|
|||
SendUpdateWorldState(m_scoutWorldStateAlliance, WORLD_STATE_ADD);
|
||||
|
||||
if (spawned)
|
||||
{
|
||||
sWorld.SendDefenseMessage(ZONE_ID_ZANGARMARSH, LANG_OPVP_ZM_SPAWN_FIELD_SCOUT_A);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -294,7 +322,9 @@ void OutdoorPvPZM::UpdateScoutState(Team team, bool spawned)
|
|||
SendUpdateWorldState(m_scoutWorldStateHorde, WORLD_STATE_ADD);
|
||||
|
||||
if (spawned)
|
||||
{
|
||||
sWorld.SendDefenseMessage(ZONE_ID_ZANGARMARSH, LANG_OPVP_ZM_SPAWN_FIELD_SCOUT_H);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -335,7 +365,9 @@ bool OutdoorPvPZM::HandleGameObjectUse(Player* player, GameObject* go)
|
|||
SetBeaconArtKit(go, m_beamGraveyardRed, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
RespawnGO(go, m_graveyardBannerNeutral, false);
|
||||
}
|
||||
|
||||
if (team == ALLIANCE)
|
||||
{
|
||||
|
|
@ -377,7 +409,9 @@ bool OutdoorPvPZM::HandleGameObjectUse(Player* player, GameObject* go)
|
|||
|
||||
// apply zone buff
|
||||
if (m_graveyardOwner != TEAM_NONE)
|
||||
{
|
||||
BuffTeam(m_graveyardOwner, SPELL_TWIN_SPIRE_BLESSING, true);
|
||||
}
|
||||
BuffTeam(team, SPELL_TWIN_SPIRE_BLESSING);
|
||||
|
||||
// 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 (auraId)
|
||||
{
|
||||
beam->CastSpell(beam, auraId, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
beam->RemoveAllAuras();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,7 +118,9 @@ void HostileReference::fireStatusChanged(ThreatRefStatusChangeEvent& pThreatRefS
|
|||
void HostileReference::addThreat(float pMod)
|
||||
{
|
||||
if (pMod + iThreat < 0)
|
||||
{
|
||||
pMod = -iThreat;
|
||||
}
|
||||
|
||||
iThreat += pMod;
|
||||
// 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();
|
||||
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 (creature->AI()->canReachByRangeAttack(getTarget()))
|
||||
{ online = true; } // not accessable but stays online
|
||||
{
|
||||
online = true; // not accessable but stays online
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -189,7 +195,9 @@ void HostileReference::setOnlineOfflineState(bool pIsOnline)
|
|||
{
|
||||
iOnline = pIsOnline;
|
||||
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);
|
||||
fireStatusChanged(event);
|
||||
|
|
@ -491,10 +499,14 @@ void ThreatManager::addThreatDirectly(Unit* pVictim, float threat)
|
|||
HostileReference* ref = iThreatContainer.addThreat(pVictim, threat);
|
||||
// Ref is online
|
||||
if (ref)
|
||||
{
|
||||
iUpdateNeed = true;
|
||||
}
|
||||
// Ref is not in the online refs, search the offline refs next
|
||||
else
|
||||
{
|
||||
ref = iThreatOfflineContainer.addThreat(pVictim, threat);
|
||||
}
|
||||
|
||||
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
|
||||
iUpdateNeed = true;
|
||||
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;
|
||||
|
||||
if (HostileReference* ref = iThreatContainer.getReferenceByTarget(pVictim))
|
||||
{
|
||||
threat = ref->getThreat();
|
||||
}
|
||||
else if (pAlsoSearchOfflineList)
|
||||
{
|
||||
threat = iThreatOfflineContainer.getReferenceByTarget(pVictim)->getThreat();
|
||||
}
|
||||
|
||||
return threat;
|
||||
}
|
||||
|
|
@ -585,7 +603,9 @@ void ThreatManager::setCurrentVictim(HostileReference* pHostileReference)
|
|||
}
|
||||
|
||||
if (pHostileReference)
|
||||
{
|
||||
iOwner->SendHighestThreatUpdate(pHostileReference);
|
||||
}
|
||||
|
||||
iCurrentVictim = pHostileReference;
|
||||
iUpdateNeed = true;
|
||||
|
|
@ -606,7 +626,9 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat
|
|||
case UEV_THREAT_REF_THREAT_CHANGE:
|
||||
if ((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;
|
||||
case UEV_THREAT_REF_ONLINE_STATUS:
|
||||
if (!hostileReference->isOnline())
|
||||
|
|
|
|||
|
|
@ -75,7 +75,9 @@ inline void LoadDB2(LocalDB2Data& localeData, StoreProblemList1& errors, DB2Stor
|
|||
for(uint8 i = 0; fullLocaleNameList[i].name; ++i)
|
||||
{
|
||||
if (!(localeData.availableDb2Locales & (1 << i)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
LocaleNameStr const* localStr = &fullLocaleNameList[i];
|
||||
|
||||
|
|
@ -97,7 +99,9 @@ inline void LoadDB2(LocalDB2Data& localeData, StoreProblemList1& errors, DB2Stor
|
|||
fclose(f);
|
||||
}
|
||||
else
|
||||
{
|
||||
errors.push_back(db2Filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -332,7 +332,9 @@ static uint32 ReadDBCBuild(const std::string& dbc_path, LocaleNameStr const*&loc
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ReadDBCBuildFileText(dbc_path, localeNameStr->name, text);
|
||||
}
|
||||
|
||||
if (text.empty())
|
||||
{
|
||||
|
|
@ -392,7 +394,9 @@ inline void LoadDBC(LocalData& localeData, BarGoLink& bar, StoreProblemList& err
|
|||
for (uint8 i = 0; fullLocaleNameList[i].name; ++i)
|
||||
{
|
||||
if (!(localeData.availableDbcLocales & (1 << i)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
LocaleNameStr const* localStr = &fullLocaleNameList[i];
|
||||
|
||||
|
|
@ -437,7 +441,9 @@ inline void LoadDBC(LocalData& localeData, BarGoLink& bar, StoreProblemList& err
|
|||
fclose(f);
|
||||
}
|
||||
else
|
||||
{
|
||||
errlist.push_back(dbc_filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -454,7 +460,9 @@ void LoadDBCStores(const std::string& dataPath)
|
|||
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());
|
||||
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());
|
||||
}
|
||||
Log::WaitBeforeContinueIfNeed();
|
||||
exit(1);
|
||||
}
|
||||
|
|
@ -479,7 +487,9 @@ void LoadDBCStores(const std::string& dataPath)
|
|||
|
||||
// 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)
|
||||
{
|
||||
sAreaFlagByMapID.insert(AreaFlagByMapID::value_type(area->mapid, area->exploreFlag));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -499,7 +509,9 @@ void LoadDBCStores(const std::string& dataPath)
|
|||
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sChrPowerTypesStore, dbcPath,"ChrClassesXPowerTypes.dbc");
|
||||
for (uint32 i = 0; i < MAX_CLASSES; ++i)
|
||||
for (uint32 j = 0; j < MAX_POWERS; ++j)
|
||||
{
|
||||
PowersByClass[i][j] = MAX_POWERS;
|
||||
}
|
||||
|
||||
for (uint32 i = 0; i < sChrPowerTypesStore.GetNumRows(); ++i)
|
||||
{
|
||||
|
|
@ -508,7 +520,9 @@ void LoadDBCStores(const std::string& dataPath)
|
|||
uint32 index = 0;
|
||||
for (uint32 j = 0; j < MAX_POWERS; ++j)
|
||||
if (PowersByClass[power->classId][j] != MAX_POWERS)
|
||||
{
|
||||
++index;
|
||||
}
|
||||
|
||||
PowersByClass[power->classId][power->power] = index;
|
||||
}
|
||||
|
|
@ -592,7 +606,9 @@ void LoadDBCStores(const std::string& dataPath)
|
|||
// fill data
|
||||
for (uint32 i = 1; i < sMapDifficultyStore.GetNumRows(); ++i)
|
||||
if (MapDifficultyEntry const* entry = sMapDifficultyStore.LookupEntry(i))
|
||||
{
|
||||
sMapDifficultyMap[MAKE_PAIR32(entry->MapId, entry->Difficulty)] = entry;
|
||||
}
|
||||
|
||||
LoadDBC(availableDbcLocales, bar, bad_dbc_files, sMovieStore, dbcPath, "Movie.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)
|
||||
if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i))
|
||||
if (entry->bracketId > MAX_BATTLEGROUND_BRACKETS)
|
||||
{
|
||||
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, sScalingStatDistributionStore, dbcPath, "ScalingStatDistribution.dbc");
|
||||
|
|
@ -632,7 +650,9 @@ void LoadDBCStores(const std::string& dataPath)
|
|||
{
|
||||
if(SpellCategoriesEntry const* category = spell->GetSpellCategories())
|
||||
if(uint32 cat = category->Category)
|
||||
{
|
||||
sSpellCategoryStore[cat].insert(i);
|
||||
}
|
||||
|
||||
// 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
|
||||
|
|
@ -658,7 +678,9 @@ void LoadDBCStores(const std::string& dataPath)
|
|||
}
|
||||
|
||||
if (spellEffect->EffectSpellId < MAX_EFFECT_INDEX && spellEffect->Difficulty == 0)
|
||||
sSpellEffectMap[spellEffect->EffectSpellId].effects[spellEffect->EffectIndex] = spellEffect;
|
||||
{
|
||||
sSpellEffectMap[spellEffect->EffectSpellId].effects[spellEffect->EffectIndex] = spellEffect;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -677,7 +699,9 @@ void LoadDBCStores(const std::string& dataPath)
|
|||
SkillLineAbilityEntry const* skillLine = sSkillLineAbilityStore.LookupEntry(j);
|
||||
|
||||
if (!skillLine)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
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))
|
||||
|
|
@ -686,10 +710,14 @@ void LoadDBCStores(const std::string& dataPath)
|
|||
{
|
||||
CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(i);
|
||||
if (!cFamily)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (skillLine->skillId != cFamily->skillLine[0] && skillLine->skillId != cFamily->skillLine[1])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
sPetFamilySpellsStore[i].insert(spellInfo->Id);
|
||||
}
|
||||
|
|
@ -718,7 +746,9 @@ void LoadDBCStores(const std::string& dataPath)
|
|||
if (!talentInfo) continue;
|
||||
for (int j = 0; j < MAX_TALENT_RANK; j++)
|
||||
if (talentInfo->RankID[j])
|
||||
{
|
||||
sTalentSpellPosMap[talentInfo->RankID[j]] = TalentSpellPos(i, j);
|
||||
}
|
||||
}
|
||||
|
||||
//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);
|
||||
if (!talentTabInfo)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (uint32 i = 0; i < MAX_MASTERY_SPELLS; ++i)
|
||||
if (uint32 spellid = talentTabInfo->masterySpells[i])
|
||||
if (sSpellStore.LookupEntry(spellid))
|
||||
{
|
||||
sTalentTreeMasterySpellsMap[talentTabId].push_back(spellid);
|
||||
}
|
||||
|
||||
// prevent memory corruption; otherwise cls will become 12 below
|
||||
if ((talentTabInfo->ClassMask & CLASSMASK_ALL_PLAYABLE) == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// store class talent tab pages
|
||||
for (uint32 cls = 1; cls < MAX_CLASSES; ++cls)
|
||||
if (talentTabInfo->ClassMask & (1 << (cls - 1)))
|
||||
{
|
||||
sTalentTabPages[cls][talentTabInfo->tabpage] = talentTabId;
|
||||
}
|
||||
|
||||
sTalentTreeRolesMap[talentTabId] = talentTabInfo->rolesMask;
|
||||
}
|
||||
|
|
@ -754,7 +792,9 @@ void LoadDBCStores(const std::string& dataPath)
|
|||
for (uint32 i = 0; i < sTalentTreePrimarySpellsStore.GetNumRows(); ++i)
|
||||
if (TalentTreePrimarySpellsEntry const* talentSpell = sTalentTreePrimarySpellsStore.LookupEntry(i))
|
||||
if (sSpellStore.LookupEntry(talentSpell->SpellId))
|
||||
{
|
||||
sTalentTreePrimarySpellsMap[talentSpell->TalentTree].push_back(talentSpell->SpellId);
|
||||
}
|
||||
sTalentTreePrimarySpellsStore.Clear();
|
||||
|
||||
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");
|
||||
for (uint32 i = 1; i < sTaxiPathStore.GetNumRows(); ++i)
|
||||
if (TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(i))
|
||||
{
|
||||
sTaxiPathSetBySource[entry->from][entry->to] = TaxiPathBySourceAndDestination(entry->ID, entry->price);
|
||||
}
|
||||
uint32 pathCount = sTaxiPathStore.GetNumRows();
|
||||
|
||||
//## TaxiPathNode.dbc ## Loaded only for initialization different structures
|
||||
|
|
@ -774,7 +816,9 @@ void LoadDBCStores(const std::string& dataPath)
|
|||
if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
|
||||
{
|
||||
if (pathLength[entry->path] < entry->index + 1)
|
||||
{
|
||||
pathLength[entry->path] = entry->index + 1;
|
||||
}
|
||||
}
|
||||
// Set path length
|
||||
sTaxiPathNodesByPath.resize(pathCount); // 0 and some other indexes not used
|
||||
|
|
@ -785,7 +829,9 @@ void LoadDBCStores(const std::string& dataPath)
|
|||
// fill data (pointers to sTaxiPathNodeStore elements
|
||||
for (uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i)
|
||||
if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
|
||||
{
|
||||
sTaxiPathNodesByPath[entry->path].set(entry->index, entry);
|
||||
}
|
||||
|
||||
// Initialize global taxinodes mask
|
||||
// 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)
|
||||
if(SpellEffectEntry const* effect = sInfo->GetSpellEffect(SpellEffectIndex(j)))
|
||||
if(effect->Effect==123 /*SPELL_EFFECT_SEND_TAXI*/)
|
||||
{
|
||||
spellPaths.insert(effect->EffectMiscValue);
|
||||
}
|
||||
|
||||
memset(sTaxiNodesMask, 0, sizeof(sTaxiNodesMask));
|
||||
memset(sOldContinentsNodesMask, 0, sizeof(sTaxiNodesMask));
|
||||
|
|
@ -807,7 +855,9 @@ void LoadDBCStores(const std::string& dataPath)
|
|||
{
|
||||
TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i);
|
||||
if (!node)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
TaxiPathSetBySource::const_iterator src_i = sTaxiPathSetBySource.find(i);
|
||||
if (src_i != sTaxiPathSetBySource.end() && !src_i->second.empty())
|
||||
|
|
@ -824,7 +874,9 @@ void LoadDBCStores(const std::string& dataPath)
|
|||
}
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// valid taxi network node
|
||||
|
|
@ -833,19 +885,29 @@ void LoadDBCStores(const std::string& dataPath)
|
|||
sTaxiNodesMask[field] |= submask;
|
||||
|
||||
if (node->MountCreatureID[0] && node->MountCreatureID[0] != 32981)
|
||||
{
|
||||
sHordeTaxiNodesMask[field] |= submask;
|
||||
}
|
||||
if (node->MountCreatureID[1] && node->MountCreatureID[1] != 32981)
|
||||
{
|
||||
sAllianceTaxiNodesMask[field] |= submask;
|
||||
}
|
||||
if (node->MountCreatureID[0] == 32981 || node->MountCreatureID[1] == 32981)
|
||||
{
|
||||
sDeathKnightTaxiNodesMask[field] |= submask;
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
sOldContinentsNodesMask[field] |= submask;
|
||||
}
|
||||
|
||||
// fix DK node at Ebon Hold
|
||||
if (i == 315)
|
||||
{
|
||||
(const_cast<TaxiNodesEntry*>(node))->MountCreatureID[1] = node->MountCreatureID[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -854,7 +916,9 @@ void LoadDBCStores(const std::string& dataPath)
|
|||
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTransportAnimationStore, dbcPath,"TransportAnimation.dbc");
|
||||
for (uint32 i = 0; i < sTransportAnimationStore.GetNumRows(); ++i)
|
||||
if (TransportAnimationEntry const* entry = sTransportAnimationStore.LookupEntry(i))
|
||||
{
|
||||
sTransportAnimationsByEntry[entry->transportEntry][entry->timeFrame] = entry;
|
||||
}
|
||||
|
||||
LoadDBC(availableDbcLocales, bar, bad_dbc_files, sVehicleStore, dbcPath, "Vehicle.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)
|
||||
{
|
||||
mapId = mapEntry->rootPhaseMap;
|
||||
}
|
||||
|
||||
switch (mapId)
|
||||
{
|
||||
|
|
@ -1233,7 +1299,9 @@ PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 lev
|
|||
{
|
||||
// skip unrelated and too-high brackets
|
||||
if (entry->mapId != mapid || entry->minLevel > level)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// exactly fit
|
||||
if (entry->maxLevel >= level)
|
||||
|
|
@ -1243,7 +1311,9 @@ PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 lev
|
|||
|
||||
// remember for possible out-of-range case (search higher from existed)
|
||||
if (!maxEntry || maxEntry->maxLevel < entry->maxLevel)
|
||||
{
|
||||
maxEntry = entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,14 +31,18 @@
|
|||
int32 SpellEntry::CalculateSimpleValue(SpellEffectIndex eff) const
|
||||
{
|
||||
if(SpellEffectEntry const* effectEntry = GetSpellEffectEntry(Id, eff))
|
||||
{
|
||||
return effectEntry->CalculateSimpleValue();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
ClassFamilyMask const& SpellEntry::GetEffectSpellClassMask(SpellEffectIndex eff) const
|
||||
{
|
||||
if (SpellEffectEntry const* effectEntry = GetSpellEffectEntry(Id, eff))
|
||||
{
|
||||
return effectEntry->EffectSpellClassMask;
|
||||
}
|
||||
|
||||
static ClassFamilyMask const emptyCFM;
|
||||
|
||||
|
|
|
|||
|
|
@ -1464,7 +1464,9 @@ struct MapEntry
|
|||
bool IsTransport() const
|
||||
{
|
||||
if (IsContinent())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return map_type == MAP_COMMON && mapFlags == MAP_FLAG_INSTANCEABLE;
|
||||
}
|
||||
};
|
||||
|
|
@ -1634,11 +1636,17 @@ struct ScalingStatValuesEntry
|
|||
if (mask & 0x4001F)
|
||||
{
|
||||
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 & 0x00000008) return ssdMultiplier[0];
|
||||
{
|
||||
if(mask & 0x00000008) return ssdMultiplier[0];
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
|
@ -1648,14 +1656,22 @@ struct ScalingStatValuesEntry
|
|||
if (mask & 0x00F001E0)
|
||||
{
|
||||
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 & 0x00000100) return armorMod[3];
|
||||
{
|
||||
if (mask & 0x00000100) return armorMod[3];
|
||||
}
|
||||
|
||||
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 & 0x00800000) return armorMod2[3]; // plate
|
||||
{
|
||||
if (mask & 0x00800000) return armorMod2[3]; // plate
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1665,11 +1681,17 @@ struct ScalingStatValuesEntry
|
|||
if (mask & 0x7E00)
|
||||
{
|
||||
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 & 0x00001000) return dpsMod[3];
|
||||
{
|
||||
if (mask & 0x00001000) return dpsMod[3];
|
||||
}
|
||||
if (mask & 0x00002000) return dpsMod[4];
|
||||
if (mask & 0x00004000) return dpsMod[5]; // not used?
|
||||
{
|
||||
if (mask & 0x00004000) return dpsMod[5]; // not used?
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,7 +147,9 @@ WorldSession::~WorldSession()
|
|||
///- empty incoming packet queue
|
||||
WorldPacket* packet = NULL;
|
||||
while (_recvQueue.next(packet))
|
||||
{ delete packet; }
|
||||
{
|
||||
delete packet;
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::SizeError(WorldPacket const& packet, uint32 size) const
|
||||
|
|
@ -168,9 +170,13 @@ void WorldSession::SendPacket(WorldPacket const* packet)
|
|||
#ifdef ENABLE_PLAYERBOTS
|
||||
if (GetPlayer()) {
|
||||
if (GetPlayer()->GetPlayerbotAI())
|
||||
{
|
||||
GetPlayer()->GetPlayerbotAI()->HandleBotOutgoingPacket(*packet);
|
||||
}
|
||||
else if (GetPlayer()->GetPlayerbotMgr())
|
||||
{
|
||||
GetPlayer()->GetPlayerbotMgr()->HandleMasterOutgoingPacket(*packet);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -290,7 +296,9 @@ bool WorldSession::Update(PacketFilter& updater)
|
|||
|
||||
#ifdef ENABLE_PLAYERBOTS
|
||||
if (_player && _player->GetPlayerbotMgr())
|
||||
{
|
||||
_player->GetPlayerbotMgr()->HandleMasterIncomingPacket(*packet);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case STATUS_LOGGEDIN_OR_RECENTLY_LOGGEDOUT:
|
||||
|
|
@ -300,7 +308,9 @@ bool WorldSession::Update(PacketFilter& updater)
|
|||
}
|
||||
else
|
||||
// not expected _player or must checked in packet hanlder
|
||||
{ ExecuteOpcode(opHandle, packet); }
|
||||
{
|
||||
ExecuteOpcode(opHandle, packet);
|
||||
}
|
||||
break;
|
||||
case STATUS_TRANSFER:
|
||||
if (!_player)
|
||||
|
|
@ -327,7 +337,9 @@ bool WorldSession::Update(PacketFilter& updater)
|
|||
// single from authed time opcodes send in to after logout time
|
||||
// and before other STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT opcodes.
|
||||
if (packet->GetOpcode() != CMSG_SET_ACTIVE_VOICE_CHANNEL)
|
||||
{
|
||||
m_playerRecentlyLogout = false;
|
||||
}
|
||||
|
||||
ExecuteOpcode(opHandle, packet);
|
||||
break;
|
||||
|
|
@ -372,7 +384,9 @@ bool WorldSession::Update(PacketFilter& updater)
|
|||
|
||||
#ifdef ENABLE_PLAYERBOTS
|
||||
if (GetPlayer() && GetPlayer()->GetPlayerbotMgr())
|
||||
{
|
||||
GetPlayer()->GetPlayerbotMgr()->UpdateSessions(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
///- Cleanup socket pointer if need
|
||||
|
|
@ -401,7 +415,9 @@ bool WorldSession::Update(PacketFilter& updater)
|
|||
// _warden->Update();
|
||||
|
||||
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;
|
||||
|
|
@ -425,7 +441,9 @@ void WorldSession::LogoutPlayer(bool Save)
|
|||
{
|
||||
// finish pending transfers before starting the logout
|
||||
while (_player && _player->IsBeingTeleportedFar())
|
||||
{ HandleMoveWorldportAckOpcode(); }
|
||||
{
|
||||
HandleMoveWorldportAckOpcode();
|
||||
}
|
||||
|
||||
m_playerLogout = true;
|
||||
m_playerSave = Save;
|
||||
|
|
@ -434,7 +452,9 @@ void WorldSession::LogoutPlayer(bool Save)
|
|||
{
|
||||
#ifdef ENABLE_PLAYERBOTS
|
||||
if (GetPlayer()->GetPlayerbotMgr())
|
||||
{
|
||||
GetPlayer()->GetPlayerbotMgr()->LogoutAllBots();
|
||||
}
|
||||
#endif
|
||||
|
||||
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
|
||||
if (_player->GetPlayerbotMgr())
|
||||
{
|
||||
_player->GetPlayerbotMgr()->LogoutAllBots();
|
||||
}
|
||||
sRandomPlayerbotMgr.OnPlayerLogout(_player);
|
||||
#endif
|
||||
|
||||
|
|
@ -527,7 +549,9 @@ void WorldSession::LogoutPlayer(bool Save)
|
|||
// 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
|
||||
while (_player->IsBeingTeleportedFar())
|
||||
{ HandleMoveWorldportAckOpcode(); }
|
||||
{
|
||||
HandleMoveWorldportAckOpcode();
|
||||
}
|
||||
|
||||
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
|
||||
if (phaseMask)
|
||||
{
|
||||
data << uint16(phaseMask);
|
||||
}
|
||||
|
||||
data.WriteGuidBytes<3, 0>(guid);
|
||||
|
||||
data << uint32(mapId ? 2 : 0); // number of terrains swaps * 2
|
||||
if (mapId)
|
||||
{
|
||||
data << uint16(mapId);
|
||||
}
|
||||
|
||||
data.WriteGuidBytes<5>(guid);
|
||||
SendPacket(&data);
|
||||
|
|
@ -912,7 +940,9 @@ void WorldSession::SendAuthResponse(uint8 code, bool queued, uint32 queuePos)
|
|||
packet << uint8(code);
|
||||
packet.WriteBit(queued); // IsInQueue
|
||||
if (queued)
|
||||
{
|
||||
packet.WriteBit(1); // unk
|
||||
}
|
||||
|
||||
packet.WriteBit(hasAccountData);
|
||||
|
||||
|
|
@ -950,7 +980,9 @@ void WorldSession::SendAuthResponse(uint8 code, bool queued, uint32 queuePos)
|
|||
}
|
||||
|
||||
if (queued)
|
||||
{
|
||||
packet << uint32(queuePos);
|
||||
}
|
||||
|
||||
SendPacket(&packet);
|
||||
}
|
||||
|
|
@ -967,7 +999,9 @@ void WorldSession::LoadAccountData(QueryResult* result, uint32 mask)
|
|||
{
|
||||
for (uint32 i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i)
|
||||
if (mask & (1 << i))
|
||||
{
|
||||
m_accountData[i] = AccountData();
|
||||
}
|
||||
|
||||
if (!result)
|
||||
{
|
||||
|
|
@ -1053,7 +1087,9 @@ void WorldSession::SendAccountDataTimes(uint32 mask)
|
|||
data.WriteBit(1);
|
||||
|
||||
for (uint32 i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i)
|
||||
{
|
||||
data << uint32(GetAccountData(AccountDataType(i))->Time);// also unix time
|
||||
}
|
||||
|
||||
data << uint32(mask); // type mask
|
||||
data << uint32(time(NULL)); // unix time of something
|
||||
|
|
@ -1222,7 +1258,9 @@ void WorldSession::ReadAddonsInfo(ByteBuffer &data)
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog.outError("Addon packet uncompress error!");
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::SendAddonsInfo()
|
||||
|
|
@ -1261,7 +1299,9 @@ void WorldSession::SendAddonsInfo()
|
|||
uint8 unk2 = (itr->CRC != 0x4c1c776d); // If addon is Standard addon CRC
|
||||
data << uint8(unk2); // if 1, than add addon public signature
|
||||
if (unk2) // if CRC is wrong, add public key (client need it)
|
||||
{
|
||||
data.append(tdata, sizeof(tdata));
|
||||
}
|
||||
|
||||
data << uint32(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -193,11 +193,15 @@ int WorldSocket::SendPacket(const WorldPacket& pct)
|
|||
{
|
||||
// Put the packet on the buffer.
|
||||
if (m_OutBuffer->copy((char*) header.header, header.getHeaderLength()) == -1)
|
||||
{
|
||||
MANGOS_ASSERT(false);
|
||||
}
|
||||
|
||||
if (!pct.empty())
|
||||
if (m_OutBuffer->copy((char*) pct.contents(), pct.size()) == -1)
|
||||
{
|
||||
MANGOS_ASSERT(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -209,7 +213,9 @@ int WorldSocket::SendPacket(const WorldPacket& pct)
|
|||
mb->copy((char*) header.header, header.getHeaderLength());
|
||||
|
||||
if (!pct.empty())
|
||||
{
|
||||
mb->copy((const char*)pct.contents(), pct.size());
|
||||
}
|
||||
|
||||
if (msg_queue()->enqueue_tail(mb, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1)
|
||||
{
|
||||
|
|
@ -326,7 +332,9 @@ int WorldSocket::SendAuthChallenge()
|
|||
packet << uint16(0);
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
packet << uint32(0);
|
||||
}
|
||||
|
||||
packet << uint8(1);
|
||||
packet << uint32(m_Seed);
|
||||
|
|
@ -1050,8 +1058,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
|||
std::string address = GetRemoteAddress();
|
||||
|
||||
DEBUG_LOG("WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.",
|
||||
accountName.c_str (),
|
||||
address.c_str());
|
||||
account.c_str (), address.c_str());
|
||||
|
||||
// Update the last_ip in the database
|
||||
// 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
|
||||
if (wardenActive)
|
||||
{
|
||||
m_Session->InitWarden(uint16(BuiltNumberClient), &K, os);
|
||||
}
|
||||
|
||||
sWorld.AddSession(m_Session);
|
||||
|
||||
|
|
@ -1091,7 +1100,9 @@ int WorldSocket::HandlePing(WorldPacket& recvPacket)
|
|||
recvPacket >> latency;
|
||||
|
||||
if (m_LastPingTime == ACE_Time_Value::zero)
|
||||
{ m_LastPingTime = ACE_OS::gettimeofday(); } // for 1st ping
|
||||
{
|
||||
m_LastPingTime = ACE_OS::gettimeofday(); // for 1st ping
|
||||
}
|
||||
else
|
||||
{
|
||||
ACE_Time_Value cur_time = ACE_OS::gettimeofday();
|
||||
|
|
|
|||
|
|
@ -53,7 +53,9 @@ WorldSocketMgr::WorldSocketMgr()
|
|||
WorldSocketMgr::~WorldSocketMgr()
|
||||
{
|
||||
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()
|
||||
{
|
||||
if (acceptor_) acceptor_->close();
|
||||
if (reactor_) reactor_->end_reactor_event_loop();
|
||||
{
|
||||
if (reactor_) reactor_->end_reactor_event_loop();
|
||||
}
|
||||
wait();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,9 @@ void CharacterDatabaseCleaner::CleanDatabase()
|
|||
|
||||
// clean up
|
||||
if (flags & CLEANING_FLAG_ACHIEVEMENT_PROGRESS)
|
||||
{
|
||||
CleanCharacterAchievementProgress();
|
||||
}
|
||||
if (flags & CLEANING_FLAG_SKILLS)
|
||||
{
|
||||
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")
|
||||
{ return true; } // not an error
|
||||
{
|
||||
return true; // not an error
|
||||
}
|
||||
if (!insert)
|
||||
{
|
||||
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;
|
||||
}
|
||||
if (nonzero && str.substr(s, e - s) == "0")
|
||||
{ return true; } // not an error
|
||||
{
|
||||
return true; // not an error
|
||||
}
|
||||
if (!insert)
|
||||
{
|
||||
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];
|
||||
uint32 oldGuid = atoi(getnth(str, n).c_str());
|
||||
if (nonzero && oldGuid == 0)
|
||||
{ return true; } // not an error
|
||||
{
|
||||
return true; // not an error
|
||||
}
|
||||
|
||||
uint32 newGuid = registerNewGuid(oldGuid, guidMap, hiGuid);
|
||||
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];
|
||||
uint32 oldGuid = atoi(gettoknth(str, n).c_str());
|
||||
if (nonzero && oldGuid == 0)
|
||||
{ return true; } // not an error
|
||||
{
|
||||
return true; // not an error
|
||||
}
|
||||
|
||||
uint32 newGuid = registerNewGuid(oldGuid, guidMap, hiGuid);
|
||||
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
|
||||
if (guids && guids->empty())
|
||||
{ return; } // nothing to do
|
||||
{
|
||||
return; // nothing to do
|
||||
}
|
||||
|
||||
// setup for guids case start position
|
||||
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
|
||||
if (!normalizePlayerName(name))
|
||||
{
|
||||
name = "";
|
||||
}
|
||||
|
||||
if (ObjectMgr::CheckPlayerName(name, true) == CHAR_NAME_SUCCESS)
|
||||
{
|
||||
|
|
@ -535,7 +547,9 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
name = "";
|
||||
}
|
||||
|
||||
// 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
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
}
|
||||
break;
|
||||
|
||||
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))
|
||||
{ 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()))
|
||||
{ ROLLBACK(DUMP_FILE_BROKEN); } // character_inventory.item update
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN); // character_inventory.item update
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DTT_ITEM:
|
||||
{
|
||||
// item, owner, data field:item, owner guid
|
||||
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
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
}
|
||||
std::string vals = getnth(line, 3); // item_instance.data get
|
||||
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))
|
||||
{ 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
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
|
|
@ -741,14 +767,18 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
|||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
}
|
||||
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;
|
||||
}
|
||||
case DTT_ITEM_LOOT:
|
||||
{
|
||||
// item, owner
|
||||
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
|
||||
{
|
||||
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
|
||||
std::map<uint32, uint32> :: const_iterator petids_iter = petids.find(atoi(currpetid));
|
||||
if (petids_iter == petids.end()) // couldn't find new inserted id
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
}
|
||||
|
||||
snprintf(newpetid, 20, "%d", petids_iter->second);
|
||||
|
||||
if (!changenth(line, 1, newpetid)) // character_pet_declinedname.id
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
}
|
||||
|
||||
if (!changenth(line, 2, newguid)) // character_pet_declinedname.owner update
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case DTT_MAIL: // mail
|
||||
{
|
||||
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
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
|
|
@ -840,9 +878,13 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
|||
case DTT_MAIL_ITEM: // mail_items
|
||||
{
|
||||
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()))
|
||||
{ ROLLBACK(DUMP_FILE_BROKEN); } // mail_items.item_guid
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN); // mail_items.item_guid
|
||||
}
|
||||
if (!changenth(line, 4, newguid)) // mail_items.receiver
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
|
|
@ -852,12 +894,18 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
|||
case DTT_EQSET_TABLE:
|
||||
{
|
||||
if (!changenth(line, 1, newguid)) // character_equipmentsets.guid update
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
}
|
||||
if (!changeGuid(line, 2, eqsets, sObjectMgr.m_EquipmentSetIds.GetNextAfterMaxUsed()))
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN); // character_equipmentsets.setguid
|
||||
}
|
||||
for (int i = 0; i < 19; ++i) // character_equipmentsets.item0..item18
|
||||
if (!changeGuid(line, 6 + i, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed()))
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -259,9 +259,13 @@ std::string Warden::Penalty(WardenCheck* check /*= NULL*/)
|
|||
WardenActions action;
|
||||
|
||||
if (check)
|
||||
{
|
||||
action = check->Action;
|
||||
}
|
||||
else
|
||||
{
|
||||
action = WardenActions(sWorld.getConfig(CONFIG_UINT32_WARDEN_CLIENT_FAIL_ACTION));
|
||||
}
|
||||
|
||||
switch (action)
|
||||
{
|
||||
|
|
@ -281,7 +285,9 @@ std::string Warden::Penalty(WardenCheck* check /*= NULL*/)
|
|||
banReason << "Warden Anticheat Violation";
|
||||
// Check can be NULL, for example if the client sent a wrong signature in the warden packet (CHECKSUM FAIL)
|
||||
if (check)
|
||||
{
|
||||
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");
|
||||
|
||||
|
|
|
|||
|
|
@ -37,10 +37,14 @@ WardenCheckMgr::WardenCheckMgr() : m_lock(0), CheckStore(), CheckResultStore() {
|
|||
WardenCheckMgr::~WardenCheckMgr()
|
||||
{
|
||||
for (CheckMap::iterator it = CheckStore.begin(); it != CheckStore.end(); ++it)
|
||||
{
|
||||
delete it->second;
|
||||
}
|
||||
|
||||
for (CheckResultMap::iterator it = CheckResultStore.begin(); it != CheckResultStore.end(); ++it)
|
||||
{
|
||||
delete it->second;
|
||||
}
|
||||
|
||||
CheckStore.clear();
|
||||
CheckResultStore.clear();
|
||||
|
|
@ -110,7 +114,9 @@ void WardenCheckMgr::LoadWardenChecks()
|
|||
|
||||
// PROC_CHECK support missing
|
||||
if (checkType == MEM_CHECK || checkType == MPQ_CHECK || checkType == LUA_STR_CHECK || checkType == DRIVER_CHECK || checkType == MODULE_CHECK)
|
||||
{
|
||||
wardenCheck->Str = str;
|
||||
}
|
||||
|
||||
CheckStore.insert(std::pair<uint16, WardenCheck*>(build, wardenCheck));
|
||||
|
||||
|
|
@ -133,9 +139,13 @@ void WardenCheckMgr::LoadWardenChecks()
|
|||
}
|
||||
|
||||
if (comment.empty())
|
||||
{
|
||||
wardenCheck->Comment = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
wardenCheck->Comment = comment;
|
||||
}
|
||||
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
|
|
@ -176,7 +186,9 @@ void WardenCheckMgr::LoadWardenOverrides()
|
|||
|
||||
// Check if action value is in range (0-2, see WardenActions enum)
|
||||
if (action > WARDEN_ACTION_BAN)
|
||||
{
|
||||
sLog.outWarden("Warden check override action out of range (ID: %u, action: %u)", checkId, action);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool found = false;
|
||||
|
|
@ -206,7 +218,9 @@ WardenCheck* WardenCheckMgr::GetWardenDataById(uint16 build, uint16 id)
|
|||
for (CheckMap::iterator it = CheckStore.lower_bound(build); it != CheckStore.upper_bound(build); ++it)
|
||||
{
|
||||
if (it->second->CheckId == id)
|
||||
{
|
||||
result = it->second;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
@ -220,7 +234,9 @@ WardenCheckResult* WardenCheckMgr::GetWardenResultById(uint16 build, uint16 id)
|
|||
for (CheckResultMap::iterator it = CheckResultStore.lower_bound(build); it != CheckResultStore.upper_bound(build); ++it)
|
||||
{
|
||||
if (it->second->Id == id)
|
||||
{
|
||||
result = it->second;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
@ -236,9 +252,13 @@ void WardenCheckMgr::GetWardenCheckIds(bool isMemCheck, uint16 build, std::list<
|
|||
if (isMemCheck)
|
||||
{
|
||||
if ((it->second->Type == MEM_CHECK) || (it->second->Type == MODULE_CHECK))
|
||||
{
|
||||
idl.push_back(it->second->CheckId);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
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());
|
||||
if (sWorld.getConfig(CONFIG_UINT32_WARDEN_CLIENT_FAIL_ACTION) > uint32(WARDEN_ACTION_LOG))
|
||||
{
|
||||
_session->KickPlayer();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -254,9 +256,13 @@ void WardenMac::HandleData(ByteBuffer &buff)
|
|||
}
|
||||
|
||||
if (found && sWorld.getConfig(CONFIG_UINT32_WARDEN_CLIENT_FAIL_ACTION) > uint32(WARDEN_ACTION_LOG))
|
||||
{
|
||||
_session->KickPlayer();
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog.outWarden("SHA1 and MD5 hash verified. Handle data passed.");
|
||||
}
|
||||
|
||||
Warden::HandleData(buff);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,10 +170,14 @@ void WardenWin::RequestData()
|
|||
|
||||
// If all checks were done, fill the todo list again
|
||||
if (_memChecksTodo.empty())
|
||||
{
|
||||
sWardenCheckMgr->GetWardenCheckIds(true, build, _memChecksTodo);
|
||||
}
|
||||
|
||||
if (_otherChecksTodo.empty())
|
||||
{
|
||||
sWardenCheckMgr->GetWardenCheckIds(false, build, _otherChecksTodo);
|
||||
}
|
||||
|
||||
_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 (_memChecksTodo.empty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// Get check id from the end and remove it from todo
|
||||
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 (_otherChecksTodo.empty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// Get check id from the end and remove it from todo
|
||||
id = _otherChecksTodo.back();
|
||||
|
|
@ -400,11 +408,17 @@ void WardenWin::HandleData(ByteBuffer &buff)
|
|||
if (memcmp(buff.contents() + buff.rpos(), &byte, sizeof(uint8)) != 0)
|
||||
{
|
||||
if (type == PAGE_CHECK_A || type == PAGE_CHECK_B)
|
||||
{
|
||||
sLog.outWarden("RESULT PAGE_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
}
|
||||
if (type == MODULE_CHECK)
|
||||
{
|
||||
sLog.outWarden("RESULT MODULE_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
}
|
||||
if (type == DRIVER_CHECK)
|
||||
{
|
||||
sLog.outWarden("RESULT DRIVER_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
}
|
||||
checkFailed = *itr;
|
||||
buff.rpos(buff.rpos() + 1);
|
||||
continue;
|
||||
|
|
@ -412,11 +426,17 @@ void WardenWin::HandleData(ByteBuffer &buff)
|
|||
|
||||
buff.rpos(buff.rpos() + 1);
|
||||
if (type == PAGE_CHECK_A || type == PAGE_CHECK_B)
|
||||
{
|
||||
sLog.outWarden("RESULT PAGE_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
}
|
||||
else if (type == MODULE_CHECK)
|
||||
{
|
||||
sLog.outWarden("RESULT MODULE_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
}
|
||||
else if (type == DRIVER_CHECK)
|
||||
{
|
||||
sLog.outWarden("RESULT DRIVER_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LUA_STR_CHECK:
|
||||
|
|
|
|||
|
|
@ -44,18 +44,24 @@ AccountMgr::~AccountMgr()
|
|||
AccountOpResult AccountMgr::CreateAccount(std::string username, std::string password)
|
||||
{
|
||||
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(password);
|
||||
|
||||
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()))
|
||||
{ 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");
|
||||
|
||||
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)
|
||||
{
|
||||
if (utf8length(username) > MAX_ACCOUNT_STR)
|
||||
{
|
||||
return AOR_NAME_TOO_LONG; // username's too long
|
||||
}
|
||||
|
||||
normalizeString(username);
|
||||
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))
|
||||
{
|
||||
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");
|
||||
|
||||
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);
|
||||
if (!result)
|
||||
{ return AOR_NAME_NOT_EXIST; } // account doesn't exist
|
||||
{
|
||||
return AOR_NAME_NOT_EXIST; // account doesn't exist
|
||||
}
|
||||
delete result;
|
||||
|
||||
// existing characters list
|
||||
|
|
@ -119,7 +131,9 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accid)
|
|||
LoginDatabase.CommitTransaction();
|
||||
|
||||
if (!res)
|
||||
{ return AOR_DB_INTERNAL_ERROR; } // unexpected error;
|
||||
{
|
||||
return AOR_DB_INTERNAL_ERROR; // unexpected error;
|
||||
}
|
||||
|
||||
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);
|
||||
if (!result)
|
||||
{ return AOR_NAME_NOT_EXIST; } // account doesn't exist
|
||||
{
|
||||
return AOR_NAME_NOT_EXIST; // account doesn't exist
|
||||
}
|
||||
delete result;
|
||||
|
||||
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(),
|
||||
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;
|
||||
}
|
||||
|
|
@ -159,7 +177,9 @@ AccountOpResult AccountMgr::ChangePassword(uint32 accid, std::string new_passwd)
|
|||
std::string 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)
|
||||
{
|
||||
|
|
@ -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
|
||||
if (!LoginDatabase.PExecute("UPDATE `account` SET `v`='0', `s`='0', `sha_pass_hash`='%s' WHERE `id`='%u'",
|
||||
CalculateShaPassHash(username, new_passwd).c_str(), accid))
|
||||
{ return AOR_DB_INTERNAL_ERROR; } // unexpected error
|
||||
{
|
||||
return AOR_DB_INTERNAL_ERROR; // unexpected error
|
||||
}
|
||||
|
||||
return AOR_OK;
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -60,7 +60,9 @@ void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket& recv_data)
|
|||
if (uint32 a_id = player->GetArenaTeamId(i))
|
||||
{
|
||||
if (ArenaTeam* arenaTeam = sObjectMgr.GetArenaTeamById(a_id))
|
||||
{
|
||||
arenaTeam->InspectStats(this, player->GetObjectGuid());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -87,7 +89,9 @@ void WorldSession::HandleArenaTeamRosterOpcode(WorldPacket& recv_data)
|
|||
recv_data >> ArenaTeamId;
|
||||
|
||||
if (ArenaTeam* arenateam = sObjectMgr.GetArenaTeamById(ArenaTeamId))
|
||||
{
|
||||
arenateam->Roster(this);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleArenaTeamCreateOpcode(WorldPacket& recv_data)
|
||||
|
|
|
|||
|
|
@ -82,7 +82,9 @@ void WorldSession::SendAuctionCommandResult(AuctionEntry* auc, AuctionAction Act
|
|||
{
|
||||
case AUCTION_OK:
|
||||
if (Action == AUCTION_BID_PLACED)
|
||||
{
|
||||
data << uint64(auc->GetAuctionOutBid()); // new AuctionOutBid?
|
||||
}
|
||||
break;
|
||||
case AUCTION_ERR_INVENTORY:
|
||||
data << uint32(invError);
|
||||
|
|
@ -126,7 +128,9 @@ void WorldSession::SendAuctionOwnerNotification(AuctionEntry* auction)
|
|||
|
||||
ObjectGuid bidder_guid = ObjectGuid();
|
||||
if (!auction->moneyDeliveryTime) // not sold yet
|
||||
{
|
||||
bidder_guid = ObjectGuid(HIGHGUID_PLAYER, auction->bidder);
|
||||
}
|
||||
|
||||
// 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
|
||||
|
|
@ -160,7 +164,9 @@ void WorldSession::SendAuctionOutbiddedMail(AuctionEntry* auction)
|
|||
|
||||
uint32 oldBidder_accId = 0;
|
||||
if (!oldBidder)
|
||||
{
|
||||
oldBidder_accId = sObjectMgr.GetPlayerAccountIdByGUID(oldBidder_guid);
|
||||
}
|
||||
|
||||
// old bidder exist
|
||||
if (oldBidder || oldBidder_accId)
|
||||
|
|
@ -169,7 +175,9 @@ void WorldSession::SendAuctionOutbiddedMail(AuctionEntry* auction)
|
|||
msgAuctionOutbiddedSubject << auction->itemTemplate << ":" << auction->itemRandomPropertyId << ":" << AUCTION_OUTBIDDED << ":" << auction->Id << ":" << auction->itemCount;
|
||||
|
||||
if (oldBidder)
|
||||
{
|
||||
oldBidder->GetSession()->SendAuctionBidderNotification(auction);
|
||||
}
|
||||
|
||||
MailDraft(msgAuctionOutbiddedSubject.str(), "") // TODO: fix body
|
||||
.SetMoney(auction->bid)
|
||||
|
|
@ -185,7 +193,9 @@ void WorldSession::SendAuctionCancelledToBidderMail(AuctionEntry* auction)
|
|||
|
||||
uint32 bidder_accId = 0;
|
||||
if (!bidder)
|
||||
{
|
||||
bidder_accId = sObjectMgr.GetPlayerAccountIdByGUID(bidder_guid);
|
||||
}
|
||||
|
||||
// bidder exist
|
||||
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;
|
||||
|
||||
if (bidder)
|
||||
{
|
||||
bidder->GetSession()->SendAuctionRemovedNotification(auction);
|
||||
}
|
||||
|
||||
MailDraft(msgAuctionCancelledSubject.str(), "") // TODO: fix body
|
||||
.SetMoney(auction->bid)
|
||||
|
|
@ -300,7 +312,9 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recv_data)
|
|||
ObjectGuid itemGuid = guids[i];
|
||||
|
||||
if (!itemGuid)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32 stackSize = stackSizes[i];
|
||||
|
||||
|
|
@ -348,13 +362,19 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recv_data)
|
|||
}
|
||||
|
||||
if (stackSize == 0)
|
||||
{
|
||||
stackSize = 1;
|
||||
}
|
||||
|
||||
if (stackSize > it->GetMaxStackCount()) // too big stack size
|
||||
{
|
||||
stackSize = it->GetMaxStackCount();
|
||||
}
|
||||
|
||||
if (!pl->HasItemCount(it->GetEntry(), stackSize)) // not enough items
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Item* newItem = it->CloneItem(stackSize);
|
||||
|
||||
|
|
@ -455,9 +475,13 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recv_data)
|
|||
SendAuctionCommandResult(auction, AUCTION_BID_PLACED, AUCTION_OK);
|
||||
|
||||
if (auction->UpdateBid(price, pl))
|
||||
{
|
||||
pl->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID, price);
|
||||
}
|
||||
else
|
||||
{
|
||||
pl->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID, auction->buyout);
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
{
|
||||
SendAuctionCancelledToBidderMail(auction);
|
||||
}
|
||||
|
||||
pl->ModifyMoney(-int64(auctionCut));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,16 +133,22 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recv_data*/)
|
|||
|
||||
// skip mapDiff without global reset time
|
||||
if (!mapDiff->resetTime)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// skip non raid map
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
|
||||
if (!mapEntry || !mapEntry->IsRaid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// skip already sent map (not same difficulty?)
|
||||
if (sentMaps.find(mapId) != sentMaps.end())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32 resetTime = sMapPersistentStateMgr.GetScheduler().GetMaxResetTimeFor(mapDiff);
|
||||
|
||||
|
|
@ -173,13 +179,19 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recv_data*/)
|
|||
data << uint32(holiday->CalendarFilterType); // m_calendarFilterType
|
||||
|
||||
for (uint8 j = 0; j < MAX_HOLIDAY_DATES; ++j)
|
||||
{
|
||||
data << uint32(holiday->Date[j]); // 26 * m_date -- WritePackedTime ?
|
||||
}
|
||||
|
||||
for (uint8 j = 0; j < MAX_HOLIDAY_DURATIONS; ++j)
|
||||
{
|
||||
data << uint32(holiday->Duration[j]); // 10 * m_duration
|
||||
}
|
||||
|
||||
for (uint8 j = 0; j < MAX_HOLIDAY_FLAGS; ++j)
|
||||
{
|
||||
data << uint32(holiday->CalendarFlags[j]); // 10 * m_calendarFlags
|
||||
}
|
||||
|
||||
data << holiday->TextureFilename; // m_textureFilename (holiday name)
|
||||
}*/
|
||||
|
|
@ -196,9 +208,13 @@ void WorldSession::HandleCalendarGetEvent(WorldPacket& recv_data)
|
|||
recv_data >> eventId;
|
||||
|
||||
if (CalendarEvent* event = sCalendarMgr.GetEventById(eventId))
|
||||
{
|
||||
sCalendarMgr.SendCalendarEvent(_player, event, CALENDAR_SENDTYPE_GET);
|
||||
}
|
||||
else
|
||||
{
|
||||
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_EVENT_INVALID);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleCalendarGuildFilter(WorldPacket& recv_data)
|
||||
|
|
@ -212,7 +228,9 @@ void WorldSession::HandleCalendarGuildFilter(WorldPacket& recv_data)
|
|||
recv_data >> minLevel >> maxLevel >> minRank;
|
||||
|
||||
if (Guild* guild = sGuildMgr.GetGuildById(_player->GetGuildId()))
|
||||
{
|
||||
guild->MassInviteToEvent(this, 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);
|
||||
}
|
||||
else
|
||||
{
|
||||
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_EVENT_INVALID);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleCalendarArenaTeam(WorldPacket& recv_data)
|
||||
|
|
@ -252,7 +272,9 @@ void WorldSession::HandleCalendarArenaTeam(WorldPacket& recv_data)
|
|||
recv_data >> areanTeamId;
|
||||
|
||||
if (ArenaTeam* team = sObjectMgr.GetArenaTeamById(areanTeamId))
|
||||
{
|
||||
team->MassInviteToEvent(this);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_EVENT_INVALID);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleCalendarRemoveEvent(WorldPacket& recv_data)
|
||||
|
|
@ -439,7 +463,9 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recv_data)
|
|||
inviteeTeam = player->GetTeam();
|
||||
inviteeGuildId = player->GetGuildId();
|
||||
if (player->GetSocial()->HasIgnore(playerGuid))
|
||||
{
|
||||
isIgnored = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -459,7 +485,9 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recv_data)
|
|||
{
|
||||
Field* fields = result->Fetch();
|
||||
if (fields[0].GetUInt8() & SOCIAL_FLAG_IGNORED)
|
||||
{
|
||||
isIgnored = true;
|
||||
}
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
|
|
@ -497,7 +525,9 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recv_data)
|
|||
sCalendarMgr.AddInvite(event, playerGuid, inviteeGuid, CALENDAR_STATUS_INVITED, CALENDAR_RANK_PLAYER, "", time(NULL));
|
||||
}
|
||||
else
|
||||
{
|
||||
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_EVENT_INVALID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -568,10 +598,14 @@ void WorldSession::HandleCalendarEventRsvp(WorldPacket& recv_data)
|
|||
sCalendarMgr.SendCalendarClearPendingAction(_player);
|
||||
}
|
||||
else
|
||||
{
|
||||
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_NO_INVITE); // correct?
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_EVENT_INVALID);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket& recv_data)
|
||||
|
|
@ -591,9 +625,13 @@ void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket& recv_data)
|
|||
eventId, ownerInviteId, invitee.GetString().c_str(), inviteId);
|
||||
|
||||
if (CalendarEvent* event = sCalendarMgr.GetEventById(eventId))
|
||||
{
|
||||
sCalendarMgr.RemoveInvite(eventId, inviteId, guid);
|
||||
}
|
||||
else
|
||||
{
|
||||
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_EVENT_INVALID);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleCalendarEventStatus(WorldPacket& recv_data)
|
||||
|
|
@ -641,10 +679,14 @@ void WorldSession::HandleCalendarEventStatus(WorldPacket& recv_data)
|
|||
sCalendarMgr.SendCalendarClearPendingAction(sObjectMgr.GetPlayer(invitee));
|
||||
}
|
||||
else
|
||||
{
|
||||
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_NO_INVITE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_EVENT_INVALID);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recv_data)
|
||||
|
|
@ -695,10 +737,14 @@ void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recv_data)
|
|||
sCalendarMgr.SendCalendarEventModeratorStatusAlert(invite);
|
||||
}
|
||||
else
|
||||
{
|
||||
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_NO_INVITE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sCalendarMgr.SendCalendarCommandResult(_player, CALENDAR_ERROR_EVENT_INVALID);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleCalendarComplain(WorldPacket& recv_data)
|
||||
|
|
@ -773,10 +819,14 @@ void CalendarMgr::SendCalendarEventInviteAlert(CalendarInvite const* invite)
|
|||
if (event->IsGuildEvent() || event->IsGuildAnnouncement())
|
||||
{
|
||||
if (Guild* guild = sGuildMgr.GetGuildById(event->GuildId))
|
||||
{
|
||||
guild->BroadcastPacket(&data);
|
||||
}
|
||||
}
|
||||
else if (Player* player = sObjectMgr.GetPlayer(invite->InviteeGuid))
|
||||
{
|
||||
player->SendDirectMessage(&data);
|
||||
}
|
||||
}
|
||||
|
||||
void CalendarMgr::SendCalendarEventInvite(CalendarInvite const* invite)
|
||||
|
|
@ -804,7 +854,9 @@ void CalendarMgr::SendCalendarEventInvite(CalendarInvite const* invite)
|
|||
data << uint8(invite->Status);
|
||||
data << uint8(!preInvite);
|
||||
if (!preInvite)
|
||||
{
|
||||
data << secsToTimeBitFields(statusTime);
|
||||
}
|
||||
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 "]",
|
||||
|
|
@ -814,10 +866,14 @@ void CalendarMgr::SendCalendarEventInvite(CalendarInvite const* invite)
|
|||
if (preInvite)
|
||||
{
|
||||
if (Player* sender = sObjectMgr.GetPlayer(invite->SenderGuid))
|
||||
{
|
||||
sender->SendDirectMessage(&data);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SendPacketToAllEventRelatives(data, event);
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
if (event->IsGuildEvent() || event->IsGuildAnnouncement())
|
||||
if (Guild* guild = sGuildMgr.GetGuildById(event->GuildId))
|
||||
{
|
||||
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)
|
||||
CalendarInviteMap const* cInvMap = event->GetInviteMap();
|
||||
for (CalendarInviteMap::const_iterator itr = cInvMap->begin(); itr != cInvMap->end(); ++itr)
|
||||
if (Player* player = sObjectMgr.GetPlayer(itr->second->InviteeGuid))
|
||||
if (!event->IsGuildEvent() || (event->IsGuildEvent() && player->GetGuildId() != event->GuildId))
|
||||
{
|
||||
player->SendDirectMessage(&packet);
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
if (radius > 333.0f)
|
||||
{
|
||||
radius = 333.0f;
|
||||
}
|
||||
|
||||
// lets calculate object coord offsets from cell borders.
|
||||
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()));
|
||||
Cell cell(p);
|
||||
if (dont_load)
|
||||
{
|
||||
cell.SetNoCreate();
|
||||
}
|
||||
TypeContainerVisitor<T, GridTypeMapContainer > gnotifier(visitor);
|
||||
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()));
|
||||
Cell cell(p);
|
||||
if (dont_load)
|
||||
{
|
||||
cell.SetNoCreate();
|
||||
}
|
||||
TypeContainerVisitor<T, WorldTypeMapContainer > gnotifier(visitor);
|
||||
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()));
|
||||
Cell cell(p);
|
||||
if (dont_load)
|
||||
{
|
||||
cell.SetNoCreate();
|
||||
}
|
||||
TypeContainerVisitor<T, GridTypeMapContainer > gnotifier(visitor);
|
||||
TypeContainerVisitor<T, WorldTypeMapContainer > wnotifier(visitor);
|
||||
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));
|
||||
Cell cell(p);
|
||||
if (dont_load)
|
||||
{
|
||||
cell.SetNoCreate();
|
||||
}
|
||||
TypeContainerVisitor<T, GridTypeMapContainer > gnotifier(visitor);
|
||||
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));
|
||||
Cell cell(p);
|
||||
if (dont_load)
|
||||
{
|
||||
cell.SetNoCreate();
|
||||
}
|
||||
TypeContainerVisitor<T, WorldTypeMapContainer > gnotifier(visitor);
|
||||
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));
|
||||
Cell cell(p);
|
||||
if (dont_load)
|
||||
{
|
||||
cell.SetNoCreate();
|
||||
}
|
||||
TypeContainerVisitor<T, GridTypeMapContainer > gnotifier(visitor);
|
||||
TypeContainerVisitor<T, WorldTypeMapContainer > wnotifier(visitor);
|
||||
cell.Visit(p, gnotifier, *map, x, y, radius);
|
||||
|
|
|
|||
|
|
@ -41,15 +41,23 @@ Channel::Channel(const std::string& name, uint32 channel_id)
|
|||
m_flags |= CHANNEL_FLAG_GENERAL; // for all built-in channels
|
||||
|
||||
if (ch->flags & CHANNEL_DBC_FLAG_TRADE) // for trade channel
|
||||
{
|
||||
m_flags |= CHANNEL_FLAG_TRADE;
|
||||
}
|
||||
|
||||
if (ch->flags & CHANNEL_DBC_FLAG_CITY_ONLY2) // for city only channels
|
||||
{
|
||||
m_flags |= CHANNEL_FLAG_CITY;
|
||||
}
|
||||
|
||||
if (ch->flags & CHANNEL_DBC_FLAG_LFG) // for LFG channel
|
||||
{
|
||||
m_flags |= CHANNEL_FLAG_LFG;
|
||||
}
|
||||
else // for all other channels
|
||||
{
|
||||
m_flags |= CHANNEL_FLAG_NOT_LFG;
|
||||
}
|
||||
}
|
||||
else // it's custom channel
|
||||
{
|
||||
|
|
@ -227,7 +235,9 @@ void Channel::KickOrBan(Player* player, const char* targetName, bool ban)
|
|||
MakePlayerBanned(&data, targetGuid, guid);
|
||||
}
|
||||
else
|
||||
{
|
||||
MakePlayerKicked(&data, targetGuid, guid);
|
||||
}
|
||||
|
||||
SendToAll(&data);
|
||||
m_players.erase(targetGuid);
|
||||
|
|
@ -378,9 +388,13 @@ void Channel::SetMode(Player* player, const char* targetName, bool moderator, bo
|
|||
|
||||
// set channel moderator
|
||||
if (moderator)
|
||||
{
|
||||
SetModerator(targetGuid, set);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetMute(targetGuid, set);
|
||||
}
|
||||
}
|
||||
|
||||
void Channel::SetOwner(ObjectGuid guid, bool exclaim)
|
||||
|
|
@ -390,7 +404,9 @@ void Channel::SetOwner(ObjectGuid guid, bool exclaim)
|
|||
// [] will re-add player after it possible removed
|
||||
PlayerList::iterator p_itr = m_players.find(m_ownerGuid);
|
||||
if (p_itr != m_players.end())
|
||||
{
|
||||
p_itr->second.SetOwner(false);
|
||||
}
|
||||
}
|
||||
|
||||
m_ownerGuid = guid;
|
||||
|
|
@ -550,9 +566,13 @@ void Channel::Announce(Player* player)
|
|||
|
||||
WorldPacket data;
|
||||
if (m_announce)
|
||||
{
|
||||
MakeAnnouncementsOn(&data, guid);
|
||||
}
|
||||
else
|
||||
{
|
||||
MakeAnnouncementsOff(&data, guid);
|
||||
}
|
||||
|
||||
SendToAll(&data);
|
||||
}
|
||||
|
|
@ -582,9 +602,13 @@ void Channel::Moderate(Player* player)
|
|||
|
||||
WorldPacket data;
|
||||
if (m_moderate)
|
||||
{
|
||||
MakeModerationOn(&data, guid);
|
||||
}
|
||||
else
|
||||
{
|
||||
MakeModerationOff(&data, guid);
|
||||
}
|
||||
|
||||
SendToAll(&data);
|
||||
}
|
||||
|
|
@ -624,7 +648,9 @@ void Channel::Say(Player* player, const char* text, uint32 lang)
|
|||
|
||||
// send channel message
|
||||
if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
|
||||
{
|
||||
lang = LANG_UNIVERSAL;
|
||||
}
|
||||
WorldPacket data;
|
||||
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());
|
||||
|
|
@ -694,13 +720,17 @@ void Channel::SendToAll(WorldPacket* data, ObjectGuid guid)
|
|||
for (PlayerList::const_iterator i = m_players.begin(); i != m_players.end(); ++i)
|
||||
if (Player* plr = sObjectMgr.GetPlayer(i->first))
|
||||
if (!guid || !plr->GetSocial()->HasIgnore(guid))
|
||||
{
|
||||
plr->GetSession()->SendPacket(data);
|
||||
}
|
||||
}
|
||||
|
||||
void Channel::SendToOne(WorldPacket* data, ObjectGuid who)
|
||||
{
|
||||
if (Player* plr = ObjectMgr::GetPlayer(who))
|
||||
{
|
||||
plr->GetSession()->SendPacket(data);
|
||||
}
|
||||
}
|
||||
|
||||
void Channel::Voice(ObjectGuid /*guid1*/, ObjectGuid /*guid2*/)
|
||||
|
|
@ -788,7 +818,9 @@ void Channel::MakeChannelOwner(WorldPacket* data)
|
|||
std::string name = "";
|
||||
|
||||
if (!sObjectMgr.GetPlayerNameByGUID(m_ownerGuid, name) || name.empty())
|
||||
{
|
||||
name = "PLAYER_NOT_FOUND";
|
||||
}
|
||||
|
||||
MakeNotifyPacket(data, CHAT_CHANNEL_OWNER_NOTICE);
|
||||
*data << ((IsConstant() || !m_ownerGuid) ? "Nobody" : name);
|
||||
|
|
@ -939,9 +971,13 @@ void Channel::JoinNotify(ObjectGuid guid)
|
|||
WorldPacket data;
|
||||
|
||||
if (IsConstant())
|
||||
{
|
||||
data.Initialize(SMSG_USERLIST_ADD, 8 + 1 + 1 + 4 + GetName().size() + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
data.Initialize(SMSG_USERLIST_UPDATE, 8 + 1 + 1 + 4 + GetName().size() + 1);
|
||||
}
|
||||
|
||||
data << ObjectGuid(guid);
|
||||
data << uint8(GetPlayerFlags(guid));
|
||||
|
|
|
|||
|
|
@ -132,20 +132,38 @@ class Channel
|
|||
bool IsOwner() { return flags & MEMBER_FLAG_OWNER; }
|
||||
void SetOwner(bool state)
|
||||
{
|
||||
if (state) flags |= MEMBER_FLAG_OWNER;
|
||||
else flags &= ~MEMBER_FLAG_OWNER;
|
||||
if (state)
|
||||
{
|
||||
flags |= MEMBER_FLAG_OWNER;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags &= ~MEMBER_FLAG_OWNER;
|
||||
}
|
||||
}
|
||||
bool IsModerator() { return flags & MEMBER_FLAG_MODERATOR; }
|
||||
void SetModerator(bool state)
|
||||
{
|
||||
if (state) flags |= MEMBER_FLAG_MODERATOR;
|
||||
else flags &= ~MEMBER_FLAG_MODERATOR;
|
||||
if (state)
|
||||
{
|
||||
flags |= MEMBER_FLAG_MODERATOR;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags &= ~MEMBER_FLAG_MODERATOR;
|
||||
}
|
||||
}
|
||||
bool IsMuted() { return flags & MEMBER_FLAG_MUTED; }
|
||||
void SetMuted(bool state)
|
||||
{
|
||||
if (state) flags |= MEMBER_FLAG_MUTED;
|
||||
else flags &= ~MEMBER_FLAG_MUTED;
|
||||
if (state)
|
||||
{
|
||||
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 (Channel* chn = cMgr->GetJoinChannel(channelname, channel_id))
|
||||
{
|
||||
chn->Join(_player, pass.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleLeaveChannelOpcode(WorldPacket& recvPacket)
|
||||
|
|
@ -69,7 +71,9 @@ void WorldSession::HandleLeaveChannelOpcode(WorldPacket& recvPacket)
|
|||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||
{
|
||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||
{
|
||||
chn->Leave(_player, true);
|
||||
}
|
||||
cMgr->LeftChannel(channelname);
|
||||
}
|
||||
}
|
||||
|
|
@ -82,7 +86,9 @@ void WorldSession::HandleChannelListOpcode(WorldPacket& recvPacket)
|
|||
|
||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||
{
|
||||
chn->List(_player);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleChannelPasswordOpcode(WorldPacket& recvPacket)
|
||||
|
|
@ -99,7 +105,9 @@ void WorldSession::HandleChannelPasswordOpcode(WorldPacket& recvPacket)
|
|||
|
||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||
{
|
||||
chn->Password(_player, pass.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleChannelSetOwnerOpcode(WorldPacket& recvPacket)
|
||||
|
|
@ -122,7 +130,9 @@ void WorldSession::HandleChannelSetOwnerOpcode(WorldPacket& recvPacket)
|
|||
|
||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||
{
|
||||
chn->SetOwner(_player->GetObjectGuid(), newp.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleChannelOwnerOpcode(WorldPacket& recvPacket)
|
||||
|
|
@ -133,7 +143,9 @@ void WorldSession::HandleChannelOwnerOpcode(WorldPacket& recvPacket)
|
|||
|
||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||
{
|
||||
chn->SendWhoOwner(_player);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleChannelModeratorOpcode(WorldPacket& recvPacket)
|
||||
|
|
@ -155,7 +167,9 @@ void WorldSession::HandleChannelModeratorOpcode(WorldPacket& recvPacket)
|
|||
|
||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||
{
|
||||
chn->SetModerator(_player, otp.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleChannelUnmoderatorOpcode(WorldPacket& recvPacket)
|
||||
|
|
@ -177,7 +191,9 @@ void WorldSession::HandleChannelUnmoderatorOpcode(WorldPacket& recvPacket)
|
|||
|
||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||
{
|
||||
chn->UnsetMute(_player, otp.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleChannelMuteOpcode(WorldPacket& recvPacket)
|
||||
|
|
@ -199,7 +215,9 @@ void WorldSession::HandleChannelMuteOpcode(WorldPacket& recvPacket)
|
|||
|
||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||
{
|
||||
chn->Invite(_player, otp.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleChannelUnmuteOpcode(WorldPacket& recvPacket)
|
||||
|
|
@ -221,7 +239,9 @@ void WorldSession::HandleChannelUnmuteOpcode(WorldPacket& recvPacket)
|
|||
|
||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||
{
|
||||
chn->UnsetMute(_player, otp.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleChannelInviteOpcode(WorldPacket& recvPacket)
|
||||
|
|
@ -243,7 +263,9 @@ void WorldSession::HandleChannelInviteOpcode(WorldPacket& recvPacket)
|
|||
|
||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||
{
|
||||
chn->Invite(_player, otp.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleChannelKickOpcode(WorldPacket& recvPacket)
|
||||
|
|
@ -265,7 +287,9 @@ void WorldSession::HandleChannelKickOpcode(WorldPacket& recvPacket)
|
|||
|
||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||
{
|
||||
chn->Kick(_player, otp.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleChannelBanOpcode(WorldPacket& recvPacket)
|
||||
|
|
@ -287,7 +311,9 @@ void WorldSession::HandleChannelBanOpcode(WorldPacket& recvPacket)
|
|||
|
||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||
{
|
||||
chn->Ban(_player, otp.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleChannelUnbanOpcode(WorldPacket& recvPacket)
|
||||
|
|
@ -309,7 +335,9 @@ void WorldSession::HandleChannelUnbanOpcode(WorldPacket& recvPacket)
|
|||
|
||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||
{
|
||||
chn->UnBan(_player, otp.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleChannelAnnouncementsOpcode(WorldPacket& recvPacket)
|
||||
|
|
@ -319,7 +347,9 @@ void WorldSession::HandleChannelAnnouncementsOpcode(WorldPacket& recvPacket)
|
|||
std::string channelname = recvPacket.ReadString(recvPacket.ReadBits(8));
|
||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||
{
|
||||
chn->Announce(_player);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleChannelModerateOpcode(WorldPacket& recvPacket)
|
||||
|
|
@ -330,7 +360,9 @@ void WorldSession::HandleChannelModerateOpcode(WorldPacket& recvPacket)
|
|||
recvPacket >> channelname;
|
||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||
{
|
||||
chn->Moderate(_player);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleChannelDisplayListQueryOpcode(WorldPacket& recvPacket)
|
||||
|
|
@ -340,7 +372,9 @@ void WorldSession::HandleChannelDisplayListQueryOpcode(WorldPacket& recvPacket)
|
|||
std::string channelname = recvPacket.ReadString(recvPacket.ReadBits(8));
|
||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||
{
|
||||
chn->List(_player);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleGetChannelMemberCountOpcode(WorldPacket& recvPacket)
|
||||
|
|
@ -370,5 +404,7 @@ void WorldSession::HandleSetChannelWatchOpcode(WorldPacket& recvPacket)
|
|||
recvPacket >> channelname;
|
||||
/*if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||
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)
|
||||
{
|
||||
if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
|
||||
{
|
||||
return &MaNGOS::Singleton<AllianceChannelMgr>::Instance(); // cross-faction
|
||||
}
|
||||
|
||||
if (team == ALLIANCE)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -139,7 +139,10 @@ class CharacterHandler
|
|||
}
|
||||
void HandlePlayerLoginCallback(QueryResult * /*dummy*/, SqlQueryHolder* holder)
|
||||
{
|
||||
if (!holder) return;
|
||||
if (!holder)
|
||||
{
|
||||
return;
|
||||
}
|
||||
WorldSession* session = sWorld.FindSession(((LoginQueryHolder*)holder)->GetAccountId());
|
||||
if (!session)
|
||||
{
|
||||
|
|
@ -228,7 +231,9 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
|
|||
std::string name = recvData.ReadString(nameLength);
|
||||
|
||||
if (unk)
|
||||
{
|
||||
recvData.read_skip<uint32>();
|
||||
}
|
||||
|
||||
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 (heroic_free_slots > 0)
|
||||
{
|
||||
--heroic_free_slots;
|
||||
}
|
||||
|
||||
if (heroic_free_slots == 0)
|
||||
{
|
||||
|
|
@ -407,7 +414,9 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
|
|||
{
|
||||
uint32 acc_level = field[0].GetUInt32();
|
||||
if (acc_level >= req_level_for_heroic)
|
||||
{
|
||||
have_req_level_for_heroic = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -429,13 +438,17 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
|
|||
while ((skipCinematics == CINEMATICS_SKIP_SAME_RACE && !have_same_race) || class_ == CLASS_DEATH_KNIGHT)
|
||||
{
|
||||
if (!result2->NextRow())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
field = result2->Fetch();
|
||||
acc_race = field[1].GetUInt32();
|
||||
|
||||
if (!have_same_race)
|
||||
{
|
||||
have_same_race = race_ == acc_race;
|
||||
}
|
||||
|
||||
if (GetSecurity() == SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
|
||||
{
|
||||
|
|
@ -443,7 +456,9 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
|
|||
if (acc_class == CLASS_DEATH_KNIGHT)
|
||||
{
|
||||
if (heroic_free_slots > 0)
|
||||
{
|
||||
--heroic_free_slots;
|
||||
}
|
||||
|
||||
if (heroic_free_slots == 0)
|
||||
{
|
||||
|
|
@ -458,7 +473,9 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
|
|||
{
|
||||
uint32 acc_level = field[0].GetUInt32();
|
||||
if (acc_level >= req_level_for_heroic)
|
||||
{
|
||||
have_req_level_for_heroic = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -486,7 +503,9 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
|
|||
}
|
||||
|
||||
if ((have_same_race && skipCinematics == CINEMATICS_SKIP_SAME_RACE) || skipCinematics == CINEMATICS_SKIP_ALL)
|
||||
{
|
||||
pNewChar->setCinematic(1); // not show intro
|
||||
}
|
||||
|
||||
pNewChar->SetAtLoginFlag(AT_LOGIN_FIRST); // First login
|
||||
|
||||
|
|
@ -846,33 +865,47 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
|
|||
if (ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(pCurrChar->getClass()))
|
||||
{
|
||||
if (cEntry->CinematicSequence)
|
||||
{
|
||||
pCurrChar->SendCinematicStart(cEntry->CinematicSequence);
|
||||
}
|
||||
else if (ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(pCurrChar->getRace()))
|
||||
{
|
||||
pCurrChar->SendCinematicStart(rEntry->CinematicSequence);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32 miscRequirement = 0;
|
||||
AreaLockStatus lockStatus = AREA_LOCKSTATUS_OK;
|
||||
if (AreaTrigger const* at = sObjectMgr.GetMapEntranceTrigger(pCurrChar->GetMapId()))
|
||||
{
|
||||
lockStatus = pCurrChar->GetAreaTriggerLockStatus(at, pCurrChar->GetDifficulty(pCurrChar->GetMap()->IsRaid()), miscRequirement);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Some basic checks in case of a map without areatrigger
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(pCurrChar->GetMapId());
|
||||
if (!mapEntry)
|
||||
{
|
||||
lockStatus = AREA_LOCKSTATUS_UNKNOWN_ERROR;
|
||||
}
|
||||
else if (pCurrChar->GetSession()->Expansion() < mapEntry->Expansion())
|
||||
{
|
||||
lockStatus = AREA_LOCKSTATUS_INSUFFICIENT_EXPANSION;
|
||||
}
|
||||
}
|
||||
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)
|
||||
AreaTrigger const* at = sObjectMgr.GetGoBackTrigger(pCurrChar->GetMapId());
|
||||
if (at)
|
||||
{
|
||||
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()))
|
||||
{
|
||||
pCurrChar->TeleportToHomebind();
|
||||
}
|
||||
}
|
||||
|
||||
sObjectAccessor.AddObject(pCurrChar);
|
||||
|
|
@ -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)
|
||||
if (Group* group = pCurrChar->GetGroup())
|
||||
{
|
||||
group->SendUpdate();
|
||||
}
|
||||
|
||||
// friend status
|
||||
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...
|
||||
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, 8326, true); // auras SPELL_AURA_GHOST, SPELL_AURA_INCREASE_SPEED(why?), SPELL_AURA_INCREASE_SWIM_SPEED(why?)
|
||||
|
||||
pCurrChar->SetWaterWalk(true);
|
||||
|
|
@ -916,17 +953,23 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
|
|||
|
||||
// reset for all pets before pet loading
|
||||
if (pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
|
||||
{
|
||||
Pet::resetTalentsForAllPetsOf(pCurrChar);
|
||||
}
|
||||
|
||||
// Load pet if any (if player not alive and in taxi flight or another then pet will remember as temporary unsummoned)
|
||||
pCurrChar->LoadPet();
|
||||
|
||||
// Set FFA PvP for non GM in non-rest mode
|
||||
if (sWorld.IsFFAPvPRealm() && !pCurrChar->isGameMaster() && !pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING))
|
||||
{
|
||||
pCurrChar->SetFFAPvP(true);
|
||||
}
|
||||
|
||||
if (pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP))
|
||||
{
|
||||
pCurrChar->SetContestedPvP();
|
||||
}
|
||||
|
||||
// Apply at_login requests
|
||||
if (pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_SPELLS))
|
||||
|
|
@ -945,7 +988,9 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
|
|||
// Used by Eluna
|
||||
#ifdef ENABLE_ELUNA
|
||||
if (pCurrChar->HasAtLoginFlag(AT_LOGIN_FIRST))
|
||||
{
|
||||
sEluna->OnFirstLogin(pCurrChar);
|
||||
}
|
||||
#endif /* ENABLE_ELUNA */
|
||||
|
||||
|
||||
|
|
@ -957,20 +1002,28 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
|
|||
|
||||
/* If the server is shutting down, show shutdown time remaining */
|
||||
if (sWorld.IsShutdowning())
|
||||
{
|
||||
sWorld.ShutdownMsg(true, pCurrChar);
|
||||
}
|
||||
|
||||
if (sWorld.getConfig(CONFIG_BOOL_ALL_TAXI_PATHS))
|
||||
{
|
||||
pCurrChar->SetTaxiCheater(true);
|
||||
}
|
||||
|
||||
if (pCurrChar->isGameMaster())
|
||||
{
|
||||
SendNotification(LANG_GM_ON);
|
||||
}
|
||||
|
||||
if (!pCurrChar->isGMVisible())
|
||||
{
|
||||
SendNotification(LANG_INVISIBLE_INVISIBLE);
|
||||
SpellEntry const* invisibleAuraInfo = sSpellStore.LookupEntry(sWorld.getConfig(CONFIG_UINT32_GM_INVISIBLE_AURA));
|
||||
if (invisibleAuraInfo && IsSpellAppliesAura(invisibleAuraInfo))
|
||||
{
|
||||
pCurrChar->CastSpell(pCurrChar, invisibleAuraInfo, true);
|
||||
}
|
||||
}
|
||||
|
||||
std::string IP_str = GetRemoteAddress();
|
||||
|
|
@ -978,7 +1031,9 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
|
|||
GetAccountId(), IP_str.c_str(), pCurrChar->GetName(), pCurrChar->GetGUIDLow());
|
||||
|
||||
if (!pCurrChar->IsStandState() && !pCurrChar->hasUnitState(UNIT_STAT_STUNNED))
|
||||
{
|
||||
pCurrChar->SetStandState(UNIT_STAND_STATE_STAND);
|
||||
}
|
||||
|
||||
m_playerLoading = false;
|
||||
|
||||
|
|
@ -1143,7 +1198,9 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(QueryResult* result, uin
|
|||
if (!session)
|
||||
{
|
||||
if (result) delete result;
|
||||
return;
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!result)
|
||||
|
|
@ -1316,7 +1373,9 @@ void WorldSession::HandleAlterAppearanceOpcode(WorldPacket& recv_data)
|
|||
_player->SetByteValue(PLAYER_BYTES, 3, uint8(Color));
|
||||
_player->SetByteValue(PLAYER_BYTES_2, 0, uint8(bs_facialHair->hair_id));
|
||||
if (_player->getRace() == RACE_TAUREN)
|
||||
{
|
||||
_player->SetByteValue(PLAYER_BYTES, 0, uint8(skinTone_id));
|
||||
}
|
||||
|
||||
_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_VISIT_BARBER_SHOP, 1);
|
||||
|
||||
|
|
@ -1467,7 +1526,9 @@ void WorldSession::HandleCharCustomizeOpcode(WorldPacket& recv_data)
|
|||
data << newname;
|
||||
|
||||
if (!RESPONSE_SUCCESS)
|
||||
{
|
||||
data << newname;
|
||||
}
|
||||
|
||||
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
|
||||
if (itemGuid.GetRawValue() == 1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Item* item = _player->GetItemByGuid(itemGuid);
|
||||
|
||||
|
|
@ -1568,7 +1631,9 @@ void WorldSession::HandleEquipmentSetUseOpcode(WorldPacket& recv_data)
|
|||
{
|
||||
Item* uItem = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
|
||||
if (!uItem)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemPosCountVec sDest;
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
_player->SendEquipError(msg, uItem, NULL);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (item->GetPos() == dstpos)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
_player->SwapItem(item->GetPos(), dstpos);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -917,9 +917,13 @@ bool ChatHandler::HasLowerSecurity(Player* target, ObjectGuid guid, bool strong)
|
|||
uint32 target_account = 0;
|
||||
|
||||
if (target)
|
||||
{
|
||||
target_session = target->GetSession();
|
||||
}
|
||||
else
|
||||
{
|
||||
target_account = sObjectMgr.GetPlayerAccountIdByGUID(guid);
|
||||
}
|
||||
|
||||
if (!target_session && !target_account)
|
||||
{
|
||||
|
|
@ -942,9 +946,13 @@ bool ChatHandler::HasLowerSecurityAccount(WorldSession* target, uint32 target_ac
|
|||
}
|
||||
|
||||
if (target)
|
||||
{
|
||||
target_sec = target->GetSecurity();
|
||||
}
|
||||
else if (target_account)
|
||||
{
|
||||
target_sec = sAccountMgr.GetSecurity(target_account);
|
||||
}
|
||||
else
|
||||
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);
|
||||
|
||||
if (!parentCommand && strlen(command->Name) == 0)
|
||||
{
|
||||
sLog.outError("Subcommand '' at top level");
|
||||
}
|
||||
|
||||
if (command->ChildCommands)
|
||||
{
|
||||
|
|
@ -1079,7 +1089,9 @@ void ChatHandler::CheckIntegrity(ChatCommand* table, ChatCommand* parentCommand)
|
|||
}
|
||||
|
||||
if (parentCommand && strlen(command->Name) == 0)
|
||||
{
|
||||
sLog.outError("Subcommand '' of command '%s' have subcommands", parentCommand->Name);
|
||||
}
|
||||
|
||||
CheckIntegrity(command->ChildCommands, command);
|
||||
}
|
||||
|
|
@ -1160,12 +1172,16 @@ ChatCommandSearchResult ChatHandler::FindCommand(ChatCommand* table, char const*
|
|||
{
|
||||
size_t len = strlen(table[i].Name);
|
||||
if (strncmp(table[i].Name, cmd.c_str(), len + 1) != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!hasStringAbbr(table[i].Name, cmd.c_str()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// select subcommand from child commands list
|
||||
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 (parentCommand)
|
||||
{
|
||||
*parentCommand = parentSubcommand ? parentSubcommand : &table[i];
|
||||
}
|
||||
|
||||
// Name == "" is special case: restore original command text for next level "" (where parentSubcommand==NULL)
|
||||
if (strlen(command->Name) == 0 && !parentSubcommand)
|
||||
{
|
||||
text = oldchildtext;
|
||||
}
|
||||
|
||||
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 = &table[i];
|
||||
if (parentCommand)
|
||||
{
|
||||
*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
|
||||
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
|
||||
if (parentCommand)
|
||||
{
|
||||
*parentCommand = parentSubcommand ? parentSubcommand : &table[i];
|
||||
}
|
||||
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
|
||||
if (!allAvailable && !isAvailable(table[i]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// must be have handler is explicitly selected
|
||||
if (!table[i].Handler)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// command found directly in to table
|
||||
command = &table[i];
|
||||
|
||||
// unknown table owner at this point
|
||||
if (parentCommand)
|
||||
{
|
||||
*parentCommand = NULL;
|
||||
}
|
||||
|
||||
if (cmdNamePtr)
|
||||
{
|
||||
*cmdNamePtr = cmd;
|
||||
}
|
||||
|
||||
return CHAT_COMMAND_OK;
|
||||
}
|
||||
|
|
@ -1235,10 +1267,14 @@ ChatCommandSearchResult ChatHandler::FindCommand(ChatCommand* table, char const*
|
|||
|
||||
// unknown table owner at this point
|
||||
if (parentCommand)
|
||||
{
|
||||
*parentCommand = NULL;
|
||||
}
|
||||
|
||||
if (cmdNamePtr)
|
||||
{
|
||||
*cmdNamePtr = cmd;
|
||||
}
|
||||
|
||||
return CHAT_COMMAND_UNKNOWN;
|
||||
}
|
||||
|
|
@ -1267,7 +1303,9 @@ void ChatHandler::ExecuteCommand(const char* text)
|
|||
if ((this->*(command->Handler))((char*)text)) // text content destroyed at call
|
||||
{
|
||||
if (command->SecurityLevel > SEC_PLAYER)
|
||||
{
|
||||
LogCommand(fullcmd.c_str());
|
||||
}
|
||||
}
|
||||
// some commands have custom error messages. Don't send the default one in these cases.
|
||||
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.
|
||||
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());
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog.outErrorDb("Table `command` have unexpected subcommand '%s' in command '%s', skip.", cmdName.c_str(), fullcommand.c_str());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
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)
|
||||
if (text[0] == '!' || text[0] == '.')
|
||||
{
|
||||
++text;
|
||||
}
|
||||
|
||||
ExecuteCommand(text);
|
||||
|
||||
|
|
@ -1430,17 +1474,25 @@ bool ChatHandler::ShowHelpForSubCommands(ChatCommand* table, char const* cmd)
|
|||
{
|
||||
// must be available (ignore handler existence for show command with possible available subcommands
|
||||
if (!isAvailable(table[i]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (m_session)
|
||||
{
|
||||
list += "\n ";
|
||||
}
|
||||
else
|
||||
{
|
||||
list += "\n\r ";
|
||||
}
|
||||
|
||||
list += table[i].Name;
|
||||
|
||||
if (table[i].ChildCommands)
|
||||
{
|
||||
list += " ...";
|
||||
}
|
||||
}
|
||||
|
||||
if (list.empty())
|
||||
|
|
@ -1483,7 +1535,9 @@ bool ChatHandler::ShowHelpForCommand(ChatCommand* table, const char* cmd)
|
|||
cmd = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
showCommand = command;
|
||||
}
|
||||
|
||||
childCommands = showCommand->ChildCommands;
|
||||
break;
|
||||
|
|
@ -1521,7 +1575,9 @@ bool ChatHandler::ShowHelpForCommand(ChatCommand* table, const char* cmd)
|
|||
}
|
||||
|
||||
if (command && command->Help.empty())
|
||||
{
|
||||
SendSysMessage(LANG_NO_HELP_CMD);
|
||||
}
|
||||
|
||||
return command || childCommands;
|
||||
}
|
||||
|
|
@ -1582,9 +1638,13 @@ bool ChatHandler::isValidChatMessage(const char* message)
|
|||
if (commandChar == *validSequenceIterator)
|
||||
{
|
||||
if (validSequenceIterator == validSequence + 4)
|
||||
{
|
||||
validSequenceIterator = validSequence;
|
||||
}
|
||||
else
|
||||
{
|
||||
++validSequenceIterator;
|
||||
}
|
||||
}
|
||||
else if (commandChar != '|')
|
||||
{
|
||||
|
|
@ -1637,7 +1697,9 @@ bool ChatHandler::isValidChatMessage(const char* message)
|
|||
|
||||
// no further pipe commands
|
||||
if (reader.eof())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
char commandChar;
|
||||
reader >> commandChar;
|
||||
|
|
@ -1648,9 +1710,13 @@ bool ChatHandler::isValidChatMessage(const char* message)
|
|||
if (commandChar == *validSequenceIterator)
|
||||
{
|
||||
if (validSequenceIterator == validSequence + 4)
|
||||
{
|
||||
validSequenceIterator = validSequence;
|
||||
}
|
||||
else
|
||||
{
|
||||
++validSequenceIterator;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1770,7 +1836,9 @@ bool ChatHandler::isValidChatMessage(const char* message)
|
|||
propertyId += c - '0';
|
||||
}
|
||||
else if (c == '-')
|
||||
{
|
||||
negativeNumber = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
|
|
@ -1778,7 +1846,9 @@ bool ChatHandler::isValidChatMessage(const char* message)
|
|||
}
|
||||
}
|
||||
if (negativeNumber)
|
||||
{
|
||||
propertyId *= -1;
|
||||
}
|
||||
|
||||
if (propertyId > 0)
|
||||
{
|
||||
|
|
@ -2176,7 +2246,9 @@ bool ChatHandler::isValidChatMessage(const char* message)
|
|||
// using strange database/client combinations can lead to this case
|
||||
expectedName = linkedItem->Name1;
|
||||
else
|
||||
{
|
||||
expectedName = il->Name[dbIndex];
|
||||
}
|
||||
if (suffix)
|
||||
{
|
||||
expectedName += " ";
|
||||
|
|
@ -2319,9 +2391,13 @@ bool ChatHandler::ExtractInt32(char** args, int32& val)
|
|||
long valRaw = strtol(*args, &tail, 10);
|
||||
|
||||
if (tail != *args && isWhiteSpace(*tail))
|
||||
{
|
||||
*(tail++) = '\0';
|
||||
}
|
||||
else if (tail && *tail) // some not whitespace symbol
|
||||
{
|
||||
return false; // args not modified and can be re-parsed
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if (tail != *args && isWhiteSpace(*tail))
|
||||
{
|
||||
*(tail++) = '\0';
|
||||
}
|
||||
else if (tail && *tail) // some not whitespace symbol
|
||||
{
|
||||
return false; // args not modified and can be re-parsed
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if (tail != *args && isWhiteSpace(*tail))
|
||||
{
|
||||
*(tail++) = '\0';
|
||||
}
|
||||
else if (tail && *tail) // some not whitespace symbol
|
||||
{
|
||||
return false; // args not modified and can be re-parsed
|
||||
}
|
||||
|
||||
if (valRaw > std::numeric_limits<uint64>::max())
|
||||
{
|
||||
|
|
@ -2445,9 +2529,13 @@ bool ChatHandler::ExtractInt64(char** args, int64& val)
|
|||
long valRaw = strtol(*args, &tail, 10);
|
||||
|
||||
if (tail != *args && isWhiteSpace(*tail))
|
||||
{
|
||||
*(tail++) = '\0';
|
||||
}
|
||||
else if (tail && *tail) // some not whitespace symbol
|
||||
{
|
||||
return false; // args not modified and can be re-parsed
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if (tail != *args && isWhiteSpace(*tail))
|
||||
{
|
||||
*(tail++) = '\0';
|
||||
}
|
||||
else if (tail && *tail) // some not whitespace symbol
|
||||
{
|
||||
return false; // args not modified and can be re-parsed
|
||||
}
|
||||
|
||||
// value successfully extracted
|
||||
val = float(valRaw);
|
||||
|
|
@ -2573,7 +2665,9 @@ char* ChatHandler::ExtractLiteralArg(char** args, char const* lit /*= NULL*/)
|
|||
++largs;
|
||||
|
||||
if (largs < l)
|
||||
{
|
||||
l = largs;
|
||||
}
|
||||
|
||||
int diff = strncmp(head, lit, l);
|
||||
|
||||
|
|
@ -2598,7 +2692,9 @@ char* ChatHandler::ExtractLiteralArg(char** args, char const* lit /*= NULL*/)
|
|||
*args = head;
|
||||
}
|
||||
else
|
||||
{
|
||||
*args = head + l;
|
||||
}
|
||||
|
||||
SkipWhiteSpaces(args);
|
||||
return arg;
|
||||
|
|
@ -2637,7 +2733,9 @@ char* ChatHandler::ExtractQuotedArg(char** args, bool asis /*= false*/)
|
|||
char guard = (*args)[0];
|
||||
|
||||
if (guard == '[')
|
||||
{
|
||||
guard = ']';
|
||||
}
|
||||
|
||||
char* tail = (*args) + 1; // start scan after first quote symbol
|
||||
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 (!asis)
|
||||
{
|
||||
*tail = '\0';
|
||||
}
|
||||
}
|
||||
else // quote isn't last char
|
||||
{
|
||||
if (asis)
|
||||
{
|
||||
++tail;
|
||||
}
|
||||
|
||||
*tail = '\0';
|
||||
}
|
||||
|
|
@ -2681,7 +2783,9 @@ char* ChatHandler::ExtractQuotedOrLiteralArg(char** args, bool asis /*= false*/)
|
|||
{
|
||||
char* arg = ExtractQuotedArg(args, asis);
|
||||
if (!arg)
|
||||
{
|
||||
arg = ExtractLiteralArg(args);
|
||||
}
|
||||
return arg;
|
||||
}
|
||||
|
||||
|
|
@ -2701,9 +2805,13 @@ bool ChatHandler::ExtractOnOff(char** args, bool& value)
|
|||
}
|
||||
|
||||
if (strncmp(arg, "on", 3) == 0)
|
||||
{
|
||||
value = true;
|
||||
}
|
||||
else if (strncmp(arg, "off", 4) == 0)
|
||||
{
|
||||
value = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
|
|
@ -2901,10 +3009,14 @@ char* ChatHandler::ExtractLinkArg(char** args, char const* const* linkTypes /*=
|
|||
// success
|
||||
|
||||
if (*tail) // truncate all link string
|
||||
{
|
||||
*(tail++) = '\0';
|
||||
}
|
||||
|
||||
if (foundIdx)
|
||||
{
|
||||
*foundIdx = linktype_idx;
|
||||
}
|
||||
|
||||
if (keyPair)
|
||||
{
|
||||
|
|
@ -2941,7 +3053,9 @@ char* ChatHandler::ExtractArg(char** args, bool asis /*= false*/)
|
|||
|
||||
char* arg = ExtractQuotedOrLiteralArg(args, asis);
|
||||
if (!arg)
|
||||
{
|
||||
arg = ExtractLinkArg(args);
|
||||
}
|
||||
|
||||
return arg;
|
||||
}
|
||||
|
|
@ -3024,7 +3138,9 @@ char* ChatHandler::ExtractKeyFromLink(char** text, char const* const* linkTypes,
|
|||
if (arg)
|
||||
{
|
||||
if (found_idx)
|
||||
{
|
||||
*found_idx = -1; // special index case
|
||||
}
|
||||
|
||||
return arg;
|
||||
}
|
||||
|
|
@ -3149,7 +3265,9 @@ uint32 ChatHandler::ExtractSpellIdFromLink(char** text)
|
|||
}
|
||||
|
||||
if (rank < 0) // unlearned talent have in shift-link field -1 as rank
|
||||
{
|
||||
rank = 0;
|
||||
}
|
||||
|
||||
return rank < MAX_TALENT_RANK ? talentEntry->RankID[rank] : 0;
|
||||
}
|
||||
|
|
@ -3604,30 +3722,42 @@ bool ChatHandler::ExtractPlayerTarget(char** args, Player** player /*= NULL*/, O
|
|||
|
||||
// if allowed player pointer
|
||||
if (player)
|
||||
{
|
||||
*player = pl;
|
||||
}
|
||||
|
||||
// if need guid value from DB (in name case for check player existence)
|
||||
ObjectGuid guid = !pl && (player_guid || player_name) ? sObjectMgr.GetPlayerGuidByName(name) : ObjectGuid();
|
||||
|
||||
// if allowed player guid (if no then only online players allowed)
|
||||
if (player_guid)
|
||||
{
|
||||
*player_guid = pl ? pl->GetObjectGuid() : guid;
|
||||
}
|
||||
|
||||
if (player_name)
|
||||
{
|
||||
*player_name = pl || guid ? name : "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Player* pl = getSelectedPlayer();
|
||||
// if allowed player pointer
|
||||
if (player)
|
||||
{
|
||||
*player = pl;
|
||||
}
|
||||
// if allowed player guid (if no then only online players allowed)
|
||||
if (player_guid)
|
||||
{
|
||||
*player_guid = pl ? pl->GetObjectGuid() : ObjectGuid();
|
||||
}
|
||||
|
||||
if (player_name)
|
||||
{
|
||||
*player_name = pl ? pl->GetName() : "";
|
||||
}
|
||||
}
|
||||
|
||||
// some from req. data must be provided (note: name is empty if player not exist)
|
||||
|
|
@ -3665,10 +3795,14 @@ uint32 ChatHandler::ExtractAccountId(char** args, std::string* accountName /*= N
|
|||
account_id = targetPlayer->GetSession()->GetAccountId();
|
||||
|
||||
if (accountName)
|
||||
{
|
||||
sAccountMgr.GetName(account_id, *accountName);
|
||||
}
|
||||
|
||||
if (targetIfNullArg)
|
||||
{
|
||||
*targetIfNullArg = targetPlayer;
|
||||
}
|
||||
|
||||
return account_id;
|
||||
}
|
||||
|
|
@ -3704,10 +3838,14 @@ uint32 ChatHandler::ExtractAccountId(char** args, std::string* accountName /*= N
|
|||
}
|
||||
|
||||
if (accountName)
|
||||
{
|
||||
*accountName = account_name;
|
||||
}
|
||||
|
||||
if (targetIfNullArg)
|
||||
{
|
||||
*targetIfNullArg = NULL;
|
||||
}
|
||||
|
||||
return account_id;
|
||||
}
|
||||
|
|
@ -3746,7 +3884,9 @@ bool ChatHandler::ExtractRaceMask(char** text, uint32& raceMask, char const** ma
|
|||
if (ExtractUInt32(text, raceMask))
|
||||
{
|
||||
if (maskName)
|
||||
{
|
||||
*maskName = "custom mask";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -3757,7 +3897,9 @@ bool ChatHandler::ExtractRaceMask(char** text, uint32& raceMask, char const** ma
|
|||
raceMask = itr->raceMask;
|
||||
|
||||
if (maskName)
|
||||
{
|
||||
*maskName = itr->literal;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -3853,9 +3995,13 @@ void ChatHandler::ShowNpcOrGoSpawnInformation(uint32 guid)
|
|||
{
|
||||
uint16 top_pool_id = sPoolMgr.IsPartOfTopPool<Pool>(pool_id);
|
||||
if (!top_pool_id || top_pool_id == pool_id)
|
||||
{
|
||||
PSendSysMessage(LANG_NPC_GO_INFO_POOL, pool_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
PSendSysMessage(LANG_NPC_GO_INFO_TOP_POOL, pool_id, top_pool_id);
|
||||
}
|
||||
|
||||
if (int16 event_id = sGameEventMgr.GetGameEventId<Pool>(top_pool_id))
|
||||
{
|
||||
|
|
@ -3863,9 +4009,13 @@ void ChatHandler::ShowNpcOrGoSpawnInformation(uint32 guid)
|
|||
GameEventData const& eventData = events[std::abs(event_id)];
|
||||
|
||||
if (event_id > 0)
|
||||
{
|
||||
PSendSysMessage(LANG_NPC_GO_INFO_POOL_GAME_EVENT_S, top_pool_id, std::abs(event_id), eventData.description.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
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))
|
||||
|
|
@ -3874,9 +4024,13 @@ void ChatHandler::ShowNpcOrGoSpawnInformation(uint32 guid)
|
|||
GameEventData const& eventData = events[std::abs(event_id)];
|
||||
|
||||
if (event_id > 0)
|
||||
{
|
||||
PSendSysMessage(LANG_NPC_GO_INFO_GAME_EVENT_S, std::abs(event_id), eventData.description.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
PSendSysMessage(LANG_NPC_GO_INFO_GAME_EVENT_D, std::abs(event_id), eventData.description.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4003,7 +4157,9 @@ void ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg msgtype, char const
|
|||
data << addonPrefix;
|
||||
}
|
||||
else
|
||||
{
|
||||
data << ObjectGuid(targetGuid);
|
||||
}
|
||||
break;
|
||||
}
|
||||
MANGOS_ASSERT(message);
|
||||
|
|
@ -4012,7 +4168,9 @@ void ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg msgtype, char const
|
|||
data << uint8(chatTag);
|
||||
|
||||
if (isAchievement)
|
||||
{
|
||||
data << uint32(achievementId);
|
||||
}
|
||||
|
||||
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
|
||||
if (sWorld.getConfig(CONFIG_BOOL_CHAT_FAKE_MESSAGE_PREVENTING))
|
||||
{
|
||||
stripLineInvisibleChars(msg);
|
||||
}
|
||||
|
||||
if (sWorld.getConfig(CONFIG_UINT32_CHAT_STRICT_LINK_CHECKING_SEVERITY) && GetSecurity() < SEC_MODERATOR
|
||||
&& !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(),
|
||||
GetPlayer()->GetGUIDLow(), msg.c_str());
|
||||
if (sWorld.getConfig(CONFIG_UINT32_CHAT_STRICT_LINK_CHECKING_KICK))
|
||||
{
|
||||
KickPlayer();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -137,12 +141,16 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
|||
{
|
||||
// send in universal language if player in .gmon mode (ignore spell effects)
|
||||
if (_player->isGameMaster())
|
||||
{
|
||||
lang = LANG_UNIVERSAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
// send in universal language in two side iteration allowed mode
|
||||
if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHAT))
|
||||
{
|
||||
lang = LANG_UNIVERSAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (type)
|
||||
|
|
@ -154,13 +162,17 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
|||
case CHAT_MSG_RAID_WARNING:
|
||||
// allow two side chat at group channel if two side group allowed
|
||||
if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GROUP))
|
||||
{
|
||||
lang = LANG_UNIVERSAL;
|
||||
}
|
||||
break;
|
||||
case CHAT_MSG_GUILD:
|
||||
case CHAT_MSG_OFFICER:
|
||||
// allow two side chat at guild channel if two side guild allowed
|
||||
if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GUILD))
|
||||
{
|
||||
lang = LANG_UNIVERSAL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -168,7 +180,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
|||
// but overwrite it by SPELL_AURA_MOD_LANGUAGE auras (only single case used)
|
||||
Unit::AuraList const& ModLangAuras = _player->GetAurasByType(SPELL_AURA_MOD_LANGUAGE);
|
||||
if (!ModLangAuras.empty())
|
||||
{
|
||||
lang = ModLangAuras.front()->GetModifier()->m_miscvalue;
|
||||
}
|
||||
}
|
||||
|
||||
if (type != CHAT_MSG_AFK && type != CHAT_MSG_DND)
|
||||
|
|
@ -185,7 +199,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lang = LANG_UNIVERSAL;
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
if (msg.empty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (ChatHandler(this).ParseCommands(msg.c_str()))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
{
|
||||
|
|
@ -210,7 +230,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
|||
}
|
||||
|
||||
if (msg.empty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (type == CHAT_MSG_SAY)
|
||||
{
|
||||
|
|
@ -265,12 +287,16 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
|||
return;
|
||||
}
|
||||
if (msg.empty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (!normalizePlayerName(to))
|
||||
{
|
||||
SendPlayerNotFoundNotice(to);
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
if (msg.empty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (ChatHandler(this).ParseCommands(msg.c_str()))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
{
|
||||
|
|
@ -319,7 +349,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
|||
}
|
||||
|
||||
if (msg.empty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// if player is in battleground, he cannot say to battleground members by /p
|
||||
Group* group = GetPlayer()->GetOriginalGroup();
|
||||
|
|
@ -356,10 +388,14 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
|||
msg = recv_data.ReadString(recv_data.ReadBits(9));
|
||||
|
||||
if (msg.empty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (ChatHandler(this).ParseCommands(msg.c_str()))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
{
|
||||
|
|
@ -367,7 +403,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
|||
}
|
||||
|
||||
if (msg.empty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (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));
|
||||
|
||||
if (msg.empty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (ChatHandler(this).ParseCommands(msg.c_str()))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
{
|
||||
|
|
@ -402,7 +444,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
|||
}
|
||||
|
||||
if (msg.empty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (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));
|
||||
|
||||
if (msg.empty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (ChatHandler(this).ParseCommands(msg.c_str()))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
{
|
||||
|
|
@ -437,7 +485,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
|||
}
|
||||
|
||||
if (msg.empty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// if player is in battleground, he cannot say to battleground members by /ra
|
||||
Group* group = GetPlayer()->GetOriginalGroup();
|
||||
|
|
@ -468,10 +518,14 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
|||
msg = recv_data.ReadString(recv_data.ReadBits(9));
|
||||
|
||||
if (msg.empty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (ChatHandler(this).ParseCommands(msg.c_str()))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
{
|
||||
|
|
@ -479,7 +533,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
|||
}
|
||||
|
||||
if (msg.empty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// if player is in battleground, he cannot say to battleground members by /ra
|
||||
Group* group = GetPlayer()->GetOriginalGroup();
|
||||
|
|
@ -516,7 +572,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
|||
}
|
||||
|
||||
if (msg.empty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
if (!group || !group->isRaidGroup() ||
|
||||
|
|
@ -548,7 +606,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
|||
}
|
||||
|
||||
if (msg.empty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// battleground raid is always in Player->GetGroup(), never in GetOriginalGroup()
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
|
|
@ -581,7 +641,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
|||
}
|
||||
|
||||
if (msg.empty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// battleground raid is always in Player->GetGroup(), never in GetOriginalGroup()
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
|
|
@ -617,7 +679,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
|||
}
|
||||
|
||||
if (msg.empty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||
{
|
||||
|
|
@ -646,16 +710,22 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
|||
if (_player->isAFK()) // Already AFK
|
||||
{
|
||||
if (msg.empty())
|
||||
{
|
||||
_player->ToggleAFK(); // Remove AFK
|
||||
}
|
||||
else
|
||||
{
|
||||
_player->autoReplyMsg = msg; // Update message
|
||||
}
|
||||
}
|
||||
else // New AFK mode
|
||||
{
|
||||
_player->autoReplyMsg = msg.empty() ? GetMangosString(LANG_PLAYER_AFK_DEFAULT) : msg;
|
||||
|
||||
if (_player->isDND())
|
||||
{
|
||||
_player->ToggleDND();
|
||||
}
|
||||
|
||||
_player->ToggleAFK();
|
||||
}
|
||||
|
|
@ -677,16 +747,22 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
|||
if (_player->isDND()) // Already DND
|
||||
{
|
||||
if (msg.empty())
|
||||
{
|
||||
_player->ToggleDND(); // Remove DND
|
||||
}
|
||||
else
|
||||
{
|
||||
_player->autoReplyMsg = msg; // Update message
|
||||
}
|
||||
}
|
||||
else // New DND mode
|
||||
{
|
||||
_player->autoReplyMsg = msg.empty() ? GetMangosString(LANG_PLAYER_DND_DEFAULT) : msg;
|
||||
|
||||
if (_player->isAFK())
|
||||
{
|
||||
_player->ToggleAFK();
|
||||
}
|
||||
|
||||
_player->ToggleDND();
|
||||
}
|
||||
|
|
@ -760,7 +836,9 @@ void WorldSession::HandleAddonMessagechatOpcode(WorldPacket& recv_data)
|
|||
|
||||
if (_player->GetGuildId())
|
||||
if (Guild* guild = sGuildMgr.GetGuildById(_player->GetGuildId()))
|
||||
{
|
||||
guild->BroadcastAddonToGuild(this, msg, prefix);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -773,7 +851,9 @@ void WorldSession::HandleAddonMessagechatOpcode(WorldPacket& recv_data)
|
|||
|
||||
if (_player->GetGuildId())
|
||||
if (Guild* guild = sGuildMgr.GetGuildById(_player->GetGuildId()))
|
||||
{
|
||||
guild->BroadcastAddonToOfficers(this, msg, prefix);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CHAT_MSG_WHISPER:
|
||||
|
|
@ -786,11 +866,15 @@ void WorldSession::HandleAddonMessagechatOpcode(WorldPacket& recv_data)
|
|||
std::string targetName = recv_data.ReadString(targetLen);
|
||||
|
||||
if (!normalizePlayerName(targetName))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
Player* receiver = sObjectMgr.GetPlayer(targetName.c_str());
|
||||
if (!receiver)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
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());
|
||||
|
|
@ -808,7 +892,9 @@ void WorldSession::HandleAddonMessagechatOpcode(WorldPacket& recv_data)
|
|||
|
||||
Group* group = _player->GetGroup();
|
||||
if (!group || group->isBGGroup())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
WorldPacket data;
|
||||
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(namlen);
|
||||
if (namlen > 1)
|
||||
{
|
||||
data.append(nam, namlen);
|
||||
}
|
||||
else
|
||||
{
|
||||
data << uint8(0x00);
|
||||
}
|
||||
|
||||
DEBUG_LOG("SMSG_TEXT_EMOTE i_text_emote %u i_emote_num %u",
|
||||
i_text_emote, i_emote_num);
|
||||
|
|
@ -923,7 +1013,9 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket& recv_data)
|
|||
{
|
||||
// in feign death state allowed only text emotes.
|
||||
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
GetPlayer()->HandleEmoteCommand(emote_id);
|
||||
break;
|
||||
|
|
@ -941,7 +1033,9 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket& recv_data)
|
|||
|
||||
// Send scripted event call
|
||||
if (unit && unit->GetTypeId() == TYPEID_UNIT && ((Creature*)unit)->AI())
|
||||
{
|
||||
((Creature*)unit)->AI()->ReceiveEmote(GetPlayer(), text_emote);
|
||||
}
|
||||
}
|
||||
|
||||
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