mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
Apply style fix pt3
This commit is contained in:
parent
1392c131e7
commit
d93dbd95fe
191 changed files with 9851 additions and 676 deletions
|
|
@ -212,7 +212,9 @@ class TypeUnorderedMapContainer
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return i->second; }
|
{
|
||||||
|
return i->second;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class SPECIFIC_TYPE>
|
template<class SPECIFIC_TYPE>
|
||||||
|
|
|
||||||
|
|
@ -270,7 +270,9 @@ class LinkedListHead
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return iSize; }
|
{
|
||||||
|
return iSize;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -148,9 +148,13 @@ class AHB_Seller_Config
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if ((m_maxTime) && (m_minTime > m_maxTime))
|
else if ((m_maxTime) && (m_minTime > m_maxTime))
|
||||||
{ return m_maxTime; }
|
{
|
||||||
|
return m_maxTime;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ return m_minTime; }
|
{
|
||||||
|
return m_minTime;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetMaxTime(uint32 value) { m_maxTime = value; }
|
void SetMaxTime(uint32 value) { m_maxTime = value; }
|
||||||
|
|
@ -167,7 +171,9 @@ class AHB_Seller_Config
|
||||||
m_ItemInfo[quality].ItemClassInfos[itemclass].MissItems = m_ItemInfo[quality].ItemClassInfos[itemclass].AmountOfItems - found;
|
m_ItemInfo[quality].ItemClassInfos[itemclass].MissItems = m_ItemInfo[quality].ItemClassInfos[itemclass].AmountOfItems - found;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_ItemInfo[quality].ItemClassInfos[itemclass].MissItems = 0; }
|
{
|
||||||
|
m_ItemInfo[quality].ItemClassInfos[itemclass].MissItems = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
uint32 GetMissedItemsPerClass(AuctionQuality quality, ItemClass itemclass) const { return m_ItemInfo[quality].ItemClassInfos[itemclass].MissItems; }
|
uint32 GetMissedItemsPerClass(AuctionQuality quality, ItemClass itemclass) const { return m_ItemInfo[quality].ItemClassInfos[itemclass].MissItems; }
|
||||||
|
|
||||||
|
|
@ -408,7 +414,9 @@ bool AuctionBotConfig::Initialize()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ sLog.outString("AHBot using configuration file %s", m_configFileName.c_str()); }
|
{
|
||||||
|
sLog.outString("AHBot using configuration file %s", m_configFileName.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
GetConfigFromFile();
|
GetConfigFromFile();
|
||||||
|
|
||||||
|
|
@ -747,14 +755,18 @@ uint32 AuctionBotBuyer::GetBuyableEntry(AHB_Buyer_Config& config)
|
||||||
buyerItem.MinBuyPrice = Aentry->buyout / item->GetCount();
|
buyerItem.MinBuyPrice = Aentry->buyout / item->GetCount();
|
||||||
}
|
}
|
||||||
else if (buyerItem.MinBuyPrice == 0)
|
else if (buyerItem.MinBuyPrice == 0)
|
||||||
{ buyerItem.MinBuyPrice = Aentry->buyout / item->GetCount(); }
|
{
|
||||||
|
buyerItem.MinBuyPrice = Aentry->buyout / item->GetCount();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (Aentry->startbid / item->GetCount() < buyerItem.MinBidPrice)
|
if (Aentry->startbid / item->GetCount() < buyerItem.MinBidPrice)
|
||||||
{
|
{
|
||||||
buyerItem.MinBidPrice = Aentry->startbid / item->GetCount();
|
buyerItem.MinBidPrice = Aentry->startbid / item->GetCount();
|
||||||
}
|
}
|
||||||
else if (buyerItem.MinBidPrice == 0)
|
else if (buyerItem.MinBidPrice == 0)
|
||||||
{ buyerItem.MinBidPrice = Aentry->startbid / item->GetCount(); }
|
{
|
||||||
|
buyerItem.MinBidPrice = Aentry->startbid / item->GetCount();
|
||||||
|
}
|
||||||
|
|
||||||
if (Aentry->owner == sAuctionBotConfig.GetAHBotId())
|
if (Aentry->owner == sAuctionBotConfig.GetAHBotId())
|
||||||
{
|
{
|
||||||
|
|
@ -803,7 +815,9 @@ void AuctionBotBuyer::PrepareListOfEntry(AHB_Buyer_Config& config)
|
||||||
config.CheckedEntry.erase(itr++);
|
config.CheckedEntry.erase(itr++);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ ++itr; }
|
{
|
||||||
|
++itr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: CheckedEntry size = " SIZEFMTD, config.CheckedEntry.size());
|
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: CheckedEntry size = " SIZEFMTD, config.CheckedEntry.size());
|
||||||
|
|
@ -858,7 +872,9 @@ bool AuctionBotBuyer::IsBuyableEntry(uint64 buyoutPrice, double InGame_BuyPrice,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (buyoutPrice <= MaxBuyablePrice)
|
else if (buyoutPrice <= MaxBuyablePrice)
|
||||||
{ Chance = MaxChance / 10; }
|
{
|
||||||
|
Chance = MaxChance / 10;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((buyoutPrice > 0) && (MaxBuyablePrice > 0))
|
if ((buyoutPrice > 0) && (MaxBuyablePrice > 0))
|
||||||
|
|
@ -909,12 +925,16 @@ bool AuctionBotBuyer::IsBidableEntry(uint64 bidPrice, double InGame_BuyPrice, do
|
||||||
Chance = ((MaxChance / 500) * ratio);
|
Chance = ((MaxChance / 500) * ratio);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ Chance = (MaxChance / 500); }
|
{
|
||||||
|
Chance = (MaxChance / 500);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (bidPrice < (InGame_BuyPrice - (InGame_BuyPrice / 30)))
|
else if (bidPrice < (InGame_BuyPrice - (InGame_BuyPrice / 30)))
|
||||||
{ Chance = (MaxChance / 10); }
|
{
|
||||||
|
Chance = (MaxChance / 10);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (bidPrice < MaxBidablePrice)
|
if (bidPrice < MaxBidablePrice)
|
||||||
|
|
@ -925,7 +945,9 @@ bool AuctionBotBuyer::IsBidableEntry(uint64 bidPrice, double InGame_BuyPrice, do
|
||||||
Chance = ((MaxChance / 1000) * ratio);
|
Chance = ((MaxChance / 1000) * ratio);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ Chance = (MaxChance / 1000); }
|
{
|
||||||
|
Chance = (MaxChance / 1000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
uint32 RandNum = urand(1, ChanceRatio);
|
uint32 RandNum = urand(1, ChanceRatio);
|
||||||
|
|
@ -967,7 +989,9 @@ void AuctionBotBuyer::addNewAuctionBuyerBotBid(AHB_Buyer_Config& config)
|
||||||
BASIC_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: Boost value used for Buyer! (if this happens often adjust both ItemsPerCycle in ahbot.conf)");
|
BASIC_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: Boost value used for Buyer! (if this happens often adjust both ItemsPerCycle in ahbot.conf)");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ BuyCycles = sAuctionBotConfig.GetItemPerCycleNormal(); }
|
{
|
||||||
|
BuyCycles = sAuctionBotConfig.GetItemPerCycleNormal();
|
||||||
|
}
|
||||||
|
|
||||||
for (CheckEntryMap::iterator itr = config.CheckedEntry.begin(); itr != config.CheckedEntry.end();)
|
for (CheckEntryMap::iterator itr = config.CheckedEntry.begin(); itr != config.CheckedEntry.end();)
|
||||||
{
|
{
|
||||||
|
|
@ -1077,7 +1101,9 @@ void AuctionBotBuyer::addNewAuctionBuyerBotBid(AHB_Buyer_Config& config)
|
||||||
BuyEntry(auction);
|
BuyEntry(auction);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ BuyEntry(auction); }
|
{
|
||||||
|
BuyEntry(auction);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -1981,7 +2007,9 @@ void AuctionBotSeller::addNewAuctions(AHB_Seller_Config& config)
|
||||||
buyoutPrice = prototype->BuyPrice * item->GetCount();
|
buyoutPrice = prototype->BuyPrice * item->GetCount();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ buyoutPrice = prototype->SellPrice * item->GetCount(); }
|
{
|
||||||
|
buyoutPrice = prototype->SellPrice * item->GetCount();
|
||||||
|
}
|
||||||
// Price of items are set here
|
// Price of items are set here
|
||||||
SetPricesOfItem(prototype, config, buyoutPrice, bidPrice, stackCount, ItemQualities(prototype->Quality));
|
SetPricesOfItem(prototype, config, buyoutPrice, bidPrice, stackCount, ItemQualities(prototype->Quality));
|
||||||
|
|
||||||
|
|
@ -2001,7 +2029,9 @@ bool AuctionBotSeller::Update(AuctionHouseType houseType)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//== AuctionHouseBot functions =============================
|
//== AuctionHouseBot functions =============================
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,9 @@ namespace MaNGOS
|
||||||
ChatHandler::BuildChatPacket(data, i_msgtype, &str[0], LANG_UNIVERSAL, CHAT_TAG_NONE, sourceGuid, sourceName.c_str());
|
ChatHandler::BuildChatPacket(data, i_msgtype, &str[0], LANG_UNIVERSAL, CHAT_TAG_NONE, sourceGuid, sourceName.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ ChatHandler::BuildChatPacket(data, i_msgtype, text, LANG_UNIVERSAL, CHAT_TAG_NONE, sourceGuid, sourceName.c_str(), sourceGuid, sourceName.c_str()); }
|
{
|
||||||
|
ChatHandler::BuildChatPacket(data, i_msgtype, text, LANG_UNIVERSAL, CHAT_TAG_NONE, sourceGuid, sourceName.c_str(), sourceGuid, sourceName.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
ChatMsg i_msgtype;
|
ChatMsg i_msgtype;
|
||||||
|
|
@ -114,7 +116,9 @@ namespace MaNGOS
|
||||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_MONSTER_YELL, &str[0], i_language, CHAT_TAG_NONE, i_source->GetObjectGuid(), i_source->GetName());
|
ChatHandler::BuildChatPacket(data, CHAT_MSG_MONSTER_YELL, &str[0], i_language, CHAT_TAG_NONE, i_source->GetObjectGuid(), i_source->GetName());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ ChatHandler::BuildChatPacket(data, CHAT_MSG_MONSTER_YELL, text, i_language, CHAT_TAG_NONE, i_source->GetObjectGuid(), i_source->GetName()); }
|
{
|
||||||
|
ChatHandler::BuildChatPacket(data, CHAT_MSG_MONSTER_YELL, text, i_language, CHAT_TAG_NONE, i_source->GetObjectGuid(), i_source->GetName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
Language i_language;
|
Language i_language;
|
||||||
|
|
@ -401,7 +405,9 @@ void BattleGround::Update(uint32 diff)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_PrematureCountDown)
|
else if (m_PrematureCountDown)
|
||||||
{ m_PrematureCountDown = false; }
|
{
|
||||||
|
m_PrematureCountDown = false;
|
||||||
|
}
|
||||||
|
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
/*** ARENA BUFF OBJECT SPAWNING ***/
|
/*** ARENA BUFF OBJECT SPAWNING ***/
|
||||||
|
|
@ -574,7 +580,9 @@ void BattleGround::SendPacketToAll(WorldPacket* packet)
|
||||||
plr->GetSession()->SendPacket(packet);
|
plr->GetSession()->SendPacket(packet);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ sLog.outError("BattleGround:SendPacketToAll: %s not found!", itr->first.GetString().c_str()); }
|
{
|
||||||
|
sLog.outError("BattleGround:SendPacketToAll: %s not found!", itr->first.GetString().c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1006,7 +1014,9 @@ void BattleGround::EndBattleGround(Team winner)
|
||||||
plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, 1);
|
plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ RewardMark(plr, ITEM_LOSER_COUNT); }
|
{
|
||||||
|
RewardMark(plr, ITEM_LOSER_COUNT);
|
||||||
|
}
|
||||||
|
|
||||||
plr->CombatStopWithPets(true);
|
plr->CombatStopWithPets(true);
|
||||||
|
|
||||||
|
|
@ -1081,7 +1091,9 @@ void BattleGround::RewardMark(Player* plr, uint32 count)
|
||||||
RewardSpellCast(plr, SPELL_AV_MARK_WINNER);
|
RewardSpellCast(plr, SPELL_AV_MARK_WINNER);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ RewardSpellCast(plr, SPELL_AV_MARK_LOSER); }
|
{
|
||||||
|
RewardSpellCast(plr, SPELL_AV_MARK_LOSER);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case BATTLEGROUND_WS:
|
case BATTLEGROUND_WS:
|
||||||
if (count == ITEM_WINNER_COUNT)
|
if (count == ITEM_WINNER_COUNT)
|
||||||
|
|
@ -1089,7 +1101,9 @@ void BattleGround::RewardMark(Player* plr, uint32 count)
|
||||||
RewardSpellCast(plr, SPELL_WS_MARK_WINNER);
|
RewardSpellCast(plr, SPELL_WS_MARK_WINNER);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ RewardSpellCast(plr, SPELL_WS_MARK_LOSER); }
|
{
|
||||||
|
RewardSpellCast(plr, SPELL_WS_MARK_LOSER);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case BATTLEGROUND_AB:
|
case BATTLEGROUND_AB:
|
||||||
if (count == ITEM_WINNER_COUNT)
|
if (count == ITEM_WINNER_COUNT)
|
||||||
|
|
@ -1097,7 +1111,9 @@ void BattleGround::RewardMark(Player* plr, uint32 count)
|
||||||
RewardSpellCast(plr, SPELL_AB_MARK_WINNER);
|
RewardSpellCast(plr, SPELL_AB_MARK_WINNER);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ RewardSpellCast(plr, SPELL_AB_MARK_LOSER); }
|
{
|
||||||
|
RewardSpellCast(plr, SPELL_AB_MARK_LOSER);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case BATTLEGROUND_EY: // no rewards
|
case BATTLEGROUND_EY: // no rewards
|
||||||
default:
|
default:
|
||||||
|
|
@ -1114,7 +1130,9 @@ void BattleGround::RewardSpellCast(Player* plr, uint32 spell_id)
|
||||||
{
|
{
|
||||||
// 'Inactive' this aura prevents the player from gaining honor points and battleground tokens
|
// 'Inactive' this aura prevents the player from gaining honor points and battleground tokens
|
||||||
if (plr->GetDummyAura(SPELL_AURA_PLAYER_INACTIVE))
|
if (plr->GetDummyAura(SPELL_AURA_PLAYER_INACTIVE))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell_id);
|
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell_id);
|
||||||
if (!spellInfo)
|
if (!spellInfo)
|
||||||
|
|
@ -1136,7 +1154,9 @@ void BattleGround::RewardItem(Player* plr, uint32 item_id, uint32 count)
|
||||||
{
|
{
|
||||||
// 'Inactive' this aura prevents the player from gaining honor points and battleground tokens
|
// 'Inactive' this aura prevents the player from gaining honor points and battleground tokens
|
||||||
if (plr->GetDummyAura(SPELL_AURA_PLAYER_INACTIVE))
|
if (plr->GetDummyAura(SPELL_AURA_PLAYER_INACTIVE))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ItemPosCountVec dest;
|
ItemPosCountVec dest;
|
||||||
uint32 no_space_count = 0;
|
uint32 no_space_count = 0;
|
||||||
|
|
@ -1740,7 +1760,9 @@ void BattleGround::DoorClose(ObjectGuid guid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ sLog.outError("BattleGround: Door %s not found (can not close doors)", guid.GetString().c_str()); }
|
{
|
||||||
|
sLog.outError("BattleGround: Door %s not found (can not close doors)", guid.GetString().c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -1757,7 +1779,9 @@ void BattleGround::DoorOpen(ObjectGuid guid)
|
||||||
obj->UseDoorOrButton(RESPAWN_ONE_DAY);
|
obj->UseDoorOrButton(RESPAWN_ONE_DAY);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ sLog.outError("BattleGround: Door %s not found! - doors will be closed.", guid.GetString().c_str()); }
|
{
|
||||||
|
sLog.outError("BattleGround: Door %s not found! - doors will be closed.", guid.GetString().c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Team BattleGround::GetPrematureWinner()
|
Team BattleGround::GetPrematureWinner()
|
||||||
|
|
@ -1766,9 +1790,13 @@ Team BattleGround::GetPrematureWinner()
|
||||||
uint32 alliancePlayers = GetPlayersCountByTeam(ALLIANCE);
|
uint32 alliancePlayers = GetPlayersCountByTeam(ALLIANCE);
|
||||||
|
|
||||||
if (hordePlayers > alliancePlayers)
|
if (hordePlayers > alliancePlayers)
|
||||||
|
{
|
||||||
return HORDE;
|
return HORDE;
|
||||||
|
}
|
||||||
if (alliancePlayers > hordePlayers)
|
if (alliancePlayers > hordePlayers)
|
||||||
|
{
|
||||||
return ALLIANCE;
|
return ALLIANCE;
|
||||||
|
}
|
||||||
|
|
||||||
return TEAM_NONE;
|
return TEAM_NONE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -668,7 +668,9 @@ class BattleGround
|
||||||
return m_InvitedAlliance;
|
return m_InvitedAlliance;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return m_InvitedHorde; }
|
{
|
||||||
|
return m_InvitedHorde;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
|
|
@ -1036,7 +1038,9 @@ class BattleGround
|
||||||
--m_PlayersCount[GetTeamIndexByTeamId(team)];
|
--m_PlayersCount[GetTeamIndexByTeamId(team)];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ ++m_PlayersCount[GetTeamIndexByTeamId(team)]; }
|
{
|
||||||
|
++m_PlayersCount[GetTeamIndexByTeamId(team)];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// used for rated arena battles
|
// used for rated arena battles
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,9 @@ void BattleGroundAB::Update(uint32 diff)
|
||||||
SendMessageToAll(LANG_BG_AB_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
SendMessageToAll(LANG_BG_AB_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ SendMessageToAll(LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL); }
|
{
|
||||||
|
SendMessageToAll(LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||||
|
}
|
||||||
PlaySoundToAll(BG_AB_SOUND_NEAR_VICTORY);
|
PlaySoundToAll(BG_AB_SOUND_NEAR_VICTORY);
|
||||||
m_IsInformedNearVictory = true;
|
m_IsInformedNearVictory = true;
|
||||||
}
|
}
|
||||||
|
|
@ -237,7 +239,9 @@ bool BattleGroundAB::HandleAreaTrigger(Player* source, uint32 trigger)
|
||||||
source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_ALLIANCE_USE);
|
source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_ALLIANCE_USE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ source->LeaveBattleground(); }
|
{
|
||||||
|
source->LeaveBattleground();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 3949: // Arathi Basin Horde Exit.
|
case 3949: // Arathi Basin Horde Exit.
|
||||||
if (source->GetTeam() != HORDE)
|
if (source->GetTeam() != HORDE)
|
||||||
|
|
@ -245,7 +249,9 @@ bool BattleGroundAB::HandleAreaTrigger(Player* source, uint32 trigger)
|
||||||
source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_HORDE_USE);
|
source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_HORDE_USE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ source->LeaveBattleground(); }
|
{
|
||||||
|
source->LeaveBattleground();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -327,7 +333,9 @@ void BattleGroundAB::FillInitialWorldStates(WorldPacket& data, uint32& count)
|
||||||
++ally;
|
++ally;
|
||||||
}
|
}
|
||||||
else if (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)
|
else if (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)
|
||||||
{ ++horde; }
|
{
|
||||||
|
++horde;
|
||||||
|
}
|
||||||
|
|
||||||
FillInitialWorldState(data, count, BG_AB_OP_OCCUPIED_BASES_ALLY, ally);
|
FillInitialWorldState(data, count, BG_AB_OP_OCCUPIED_BASES_ALLY, ally);
|
||||||
FillInitialWorldState(data, count, BG_AB_OP_OCCUPIED_BASES_HORDE, horde);
|
FillInitialWorldState(data, count, BG_AB_OP_OCCUPIED_BASES_HORDE, horde);
|
||||||
|
|
@ -356,7 +364,9 @@ void BattleGroundAB::_SendNodeUpdate(uint8 node)
|
||||||
UpdateWorldState(BG_AB_OP_NODESTATES[node] + plusArray[m_prevNodes[node]], WORLD_STATE_REMOVE);
|
UpdateWorldState(BG_AB_OP_NODESTATES[node] + plusArray[m_prevNodes[node]], WORLD_STATE_REMOVE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ UpdateWorldState(BG_AB_OP_NODEICONS[node], WORLD_STATE_REMOVE); }
|
{
|
||||||
|
UpdateWorldState(BG_AB_OP_NODEICONS[node], WORLD_STATE_REMOVE);
|
||||||
|
}
|
||||||
|
|
||||||
UpdateWorldState(BG_AB_OP_NODESTATES[node] + plusArray[m_Nodes[node]], WORLD_STATE_ADD);
|
UpdateWorldState(BG_AB_OP_NODESTATES[node] + plusArray[m_Nodes[node]], WORLD_STATE_ADD);
|
||||||
|
|
||||||
|
|
@ -368,7 +378,9 @@ void BattleGroundAB::_SendNodeUpdate(uint8 node)
|
||||||
++ally;
|
++ally;
|
||||||
}
|
}
|
||||||
else if (m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)
|
else if (m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)
|
||||||
{ ++horde; }
|
{
|
||||||
|
++horde;
|
||||||
|
}
|
||||||
|
|
||||||
UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_ALLY, ally);
|
UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_ALLY, ally);
|
||||||
UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_HORDE, horde);
|
UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_HORDE, horde);
|
||||||
|
|
@ -448,7 +460,9 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* target
|
||||||
SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node), LANG_BG_ALLY);
|
SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node), LANG_BG_ALLY);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node), LANG_BG_HORDE); }
|
{
|
||||||
|
SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node), LANG_BG_HORDE);
|
||||||
|
}
|
||||||
|
|
||||||
sound = BG_AB_SOUND_NODE_CLAIMED;
|
sound = BG_AB_SOUND_NODE_CLAIMED;
|
||||||
}
|
}
|
||||||
|
|
@ -471,7 +485,9 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* target
|
||||||
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
|
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); }
|
{
|
||||||
|
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// If contested, change back to occupied
|
// If contested, change back to occupied
|
||||||
else
|
else
|
||||||
|
|
@ -490,7 +506,9 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* target
|
||||||
SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
|
SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); }
|
{
|
||||||
|
SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sound = (teamIndex == TEAM_INDEX_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
|
sound = (teamIndex == TEAM_INDEX_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
|
||||||
}
|
}
|
||||||
|
|
@ -510,7 +528,9 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* target
|
||||||
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
|
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); }
|
{
|
||||||
|
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
|
||||||
|
}
|
||||||
|
|
||||||
sound = (teamIndex == TEAM_INDEX_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
|
sound = (teamIndex == TEAM_INDEX_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
|
||||||
}
|
}
|
||||||
|
|
@ -523,7 +543,9 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* target
|
||||||
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, LANG_BG_ALLY, _GetNodeNameId(node));
|
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, LANG_BG_ALLY, _GetNodeNameId(node));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_HORDE, NULL, LANG_BG_HORDE, _GetNodeNameId(node)); }
|
{
|
||||||
|
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_HORDE, NULL, LANG_BG_HORDE, _GetNodeNameId(node));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
PlaySoundToAll(sound);
|
PlaySoundToAll(sound);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -294,7 +294,9 @@ void BattleGroundAV::Update(uint32 diff)
|
||||||
m_Mine_Reclaim_Timer[mine] -= diff;
|
m_Mine_Reclaim_Timer[mine] -= diff;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ ChangeMineOwner(mine, BG_AV_TEAM_NEUTRAL); }
|
{
|
||||||
|
ChangeMineOwner(mine, BG_AV_TEAM_NEUTRAL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -308,7 +310,9 @@ void BattleGroundAV::Update(uint32 diff)
|
||||||
m_Nodes[i].Timer -= diff;
|
m_Nodes[i].Timer -= diff;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ EventPlayerDestroyedPoint(i); }
|
{
|
||||||
|
EventPlayerDestroyedPoint(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -412,7 +416,9 @@ bool BattleGroundAV::HandleAreaTrigger(Player* source, uint32 trigger)
|
||||||
source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_ALLIANCE_USE);
|
source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_ALLIANCE_USE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ source->LeaveBattleground(); }
|
{
|
||||||
|
source->LeaveBattleground();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 2606:
|
case 2606:
|
||||||
if (source->GetTeam() != HORDE)
|
if (source->GetTeam() != HORDE)
|
||||||
|
|
@ -420,7 +426,9 @@ bool BattleGroundAV::HandleAreaTrigger(Player* source, uint32 trigger)
|
||||||
source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_HORDE_USE);
|
source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_HORDE_USE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ source->LeaveBattleground(); }
|
{
|
||||||
|
source->LeaveBattleground();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -545,18 +553,26 @@ void BattleGroundAV::PopulateNode(BG_AV_Nodes node)
|
||||||
graveDefenderType = 0;
|
graveDefenderType = 0;
|
||||||
}
|
}
|
||||||
else if (m_Team_QuestStatus[teamIdx][0] < 1000)
|
else if (m_Team_QuestStatus[teamIdx][0] < 1000)
|
||||||
{ graveDefenderType = 1; }
|
{
|
||||||
|
graveDefenderType = 1;
|
||||||
|
}
|
||||||
else if (m_Team_QuestStatus[teamIdx][0] < 1500)
|
else if (m_Team_QuestStatus[teamIdx][0] < 1500)
|
||||||
{ graveDefenderType = 2; }
|
{
|
||||||
|
graveDefenderType = 2;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ graveDefenderType = 3; }
|
{
|
||||||
|
graveDefenderType = 3;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_Nodes[node].State == POINT_CONTROLLED) // we can spawn the current owner event
|
if (m_Nodes[node].State == POINT_CONTROLLED) // we can spawn the current owner event
|
||||||
{
|
{
|
||||||
SpawnEvent(BG_AV_NODES_MAX + node, teamIdx * BG_AV_MAX_GRAVETYPES + graveDefenderType, true);
|
SpawnEvent(BG_AV_NODES_MAX + node, teamIdx * BG_AV_MAX_GRAVETYPES + graveDefenderType, true);
|
||||||
}
|
}
|
||||||
else // we despawn the event from the prevowner
|
else // we despawn the event from the prevowner
|
||||||
{ SpawnEvent(BG_AV_NODES_MAX + node, m_Nodes[node].PrevOwner * BG_AV_MAX_GRAVETYPES + graveDefenderType, false); }
|
{
|
||||||
|
SpawnEvent(BG_AV_NODES_MAX + node, m_Nodes[node].PrevOwner * BG_AV_MAX_GRAVETYPES + graveDefenderType, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
SpawnEvent(node, (teamIdx * BG_AV_MAX_STATES) + m_Nodes[node].State, true);
|
SpawnEvent(node, (teamIdx * BG_AV_MAX_STATES) + m_Nodes[node].State, true);
|
||||||
}
|
}
|
||||||
|
|
@ -724,7 +740,9 @@ void BattleGroundAV::UpdateNodeWorldState(BG_AV_Nodes node)
|
||||||
UpdateWorldState(AV_SNOWFALL_N, WORLD_STATE_REMOVE);
|
UpdateWorldState(AV_SNOWFALL_N, WORLD_STATE_REMOVE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].PrevState, m_Nodes[node].PrevOwner)], WORLD_STATE_REMOVE); }
|
{
|
||||||
|
UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].PrevState, m_Nodes[node].PrevOwner)], WORLD_STATE_REMOVE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundAV::SendMineWorldStates(uint32 mine)
|
void BattleGroundAV::SendMineWorldStates(uint32 mine)
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,9 @@ void BattleGroundEY::Update(uint32 diff)
|
||||||
BattleGround::Update(diff);
|
BattleGround::Update(diff);
|
||||||
|
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// resource counter
|
// resource counter
|
||||||
if (m_resourceUpdateTimer < diff)
|
if (m_resourceUpdateTimer < diff)
|
||||||
|
|
@ -299,10 +301,14 @@ void BattleGroundEY::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team te
|
||||||
bool BattleGroundEY::HandleAreaTrigger(Player* source, uint32 trigger)
|
bool BattleGroundEY::HandleAreaTrigger(Player* source, uint32 trigger)
|
||||||
{
|
{
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!source->IsAlive()) // hack code, must be removed later
|
if (!source->IsAlive()) // hack code, must be removed later
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
switch (trigger)
|
switch (trigger)
|
||||||
{
|
{
|
||||||
|
|
@ -394,7 +400,9 @@ void BattleGroundEY::RespawnDroppedFlag()
|
||||||
void BattleGroundEY::HandleKillPlayer(Player* player, Player* killer)
|
void BattleGroundEY::HandleKillPlayer(Player* player, Player* killer)
|
||||||
{
|
{
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
BattleGround::HandleKillPlayer(player, killer);
|
BattleGround::HandleKillPlayer(player, killer);
|
||||||
EventPlayerDroppedFlag(player);
|
EventPlayerDroppedFlag(player);
|
||||||
|
|
@ -403,10 +411,14 @@ void BattleGroundEY::HandleKillPlayer(Player* player, Player* killer)
|
||||||
void BattleGroundEY::EventPlayerDroppedFlag(Player* source)
|
void BattleGroundEY::EventPlayerDroppedFlag(Player* source)
|
||||||
{
|
{
|
||||||
if (!IsFlagPickedUp())
|
if (!IsFlagPickedUp())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (GetFlagCarrierGuid() != source->GetObjectGuid())
|
if (GetFlagCarrierGuid() != source->GetObjectGuid())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ClearFlagCarrier();
|
ClearFlagCarrier();
|
||||||
source->RemoveAurasDueToSpell(EY_NETHERSTORM_FLAG_SPELL);
|
source->RemoveAurasDueToSpell(EY_NETHERSTORM_FLAG_SPELL);
|
||||||
|
|
@ -437,7 +449,9 @@ void BattleGroundEY::EventPlayerDroppedFlag(Player* source)
|
||||||
void BattleGroundEY::EventPlayerClickedOnFlag(Player* source, GameObject* target_obj)
|
void BattleGroundEY::EventPlayerClickedOnFlag(Player* source, GameObject* target_obj)
|
||||||
{
|
{
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS || IsFlagPickedUp() || !source->IsWithinDistInMap(target_obj, 10))
|
if (GetStatus() != STATUS_IN_PROGRESS || IsFlagPickedUp() || !source->IsWithinDistInMap(target_obj, 10))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_flagState == EY_FLAG_STATE_ON_BASE)
|
if (m_flagState == EY_FLAG_STATE_ON_BASE)
|
||||||
UpdateWorldState(WORLD_STATE_EY_NETHERSTORM_FLAG_READY, WORLD_STATE_REMOVE);
|
UpdateWorldState(WORLD_STATE_EY_NETHERSTORM_FLAG_READY, WORLD_STATE_REMOVE);
|
||||||
|
|
@ -474,7 +488,9 @@ void BattleGroundEY::EventPlayerClickedOnFlag(Player* source, GameObject* target
|
||||||
void BattleGroundEY::EventPlayerCapturedFlag(Player* source, EYNodes node)
|
void BattleGroundEY::EventPlayerCapturedFlag(Player* source, EYNodes node)
|
||||||
{
|
{
|
||||||
if (GetStatus() != STATUS_IN_PROGRESS || GetFlagCarrierGuid() != source->GetObjectGuid())
|
if (GetStatus() != STATUS_IN_PROGRESS || GetFlagCarrierGuid() != source->GetObjectGuid())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ClearFlagCarrier();
|
ClearFlagCarrier();
|
||||||
|
|
||||||
|
|
@ -512,7 +528,9 @@ void BattleGroundEY::UpdatePlayerScore(Player* source, uint32 type, uint32 value
|
||||||
{
|
{
|
||||||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
|
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
|
||||||
if (itr == m_PlayerScores.end()) // player not found
|
if (itr == m_PlayerScores.end()) // player not found
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
|
@ -617,7 +635,9 @@ bool BattleGroundEY::IsAllNodesControlledByTeam(Team team) const
|
||||||
{
|
{
|
||||||
for (uint8 i = 0; i < EY_NODES_MAX; ++i)
|
for (uint8 i = 0; i < EY_NODES_MAX; ++i)
|
||||||
if (m_towerOwner[i] != team)
|
if (m_towerOwner[i] != team)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -628,9 +648,13 @@ Team BattleGroundEY::GetPrematureWinner()
|
||||||
int32 allianceScore = m_TeamScores[TEAM_INDEX_ALLIANCE];
|
int32 allianceScore = m_TeamScores[TEAM_INDEX_ALLIANCE];
|
||||||
|
|
||||||
if (hordeScore > allianceScore)
|
if (hordeScore > allianceScore)
|
||||||
|
{
|
||||||
return HORDE;
|
return HORDE;
|
||||||
|
}
|
||||||
if (allianceScore > hordeScore)
|
if (allianceScore > hordeScore)
|
||||||
|
{
|
||||||
return ALLIANCE;
|
return ALLIANCE;
|
||||||
|
}
|
||||||
|
|
||||||
// If the values are equal, fall back to number of players on each team
|
// If the values are equal, fall back to number of players on each team
|
||||||
return BattleGround::GetPrematureWinner();
|
return BattleGround::GetPrematureWinner();
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,9 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recv_data)
|
||||||
// expected bracket entry
|
// expected bracket entry
|
||||||
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->getLevel());
|
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->getLevel());
|
||||||
if (!bracketEntry)
|
if (!bracketEntry)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
GroupJoinBattlegroundResult err = ERR_BATTLEGROUND_NONE;
|
GroupJoinBattlegroundResult err = ERR_BATTLEGROUND_NONE;
|
||||||
|
|
||||||
|
|
@ -319,7 +321,9 @@ void WorldSession::HandlePVPLogDataOpcode(WorldPacket & /*recv_data*/)
|
||||||
|
|
||||||
// arena finish version will send in BattleGround::EndBattleGround directly
|
// arena finish version will send in BattleGround::EndBattleGround directly
|
||||||
if (bg->isArena())
|
if (bg->isArena())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
sBattleGroundMgr.BuildPvpLogDataPacket(&data, bg);
|
sBattleGroundMgr.BuildPvpLogDataPacket(&data, bg);
|
||||||
|
|
@ -422,7 +426,9 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket& recv_data)
|
||||||
// expected bracket entry
|
// expected bracket entry
|
||||||
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->getLevel());
|
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->getLevel());
|
||||||
if (!bracketEntry)
|
if (!bracketEntry)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// some checks if player isn't cheating - it is not exactly cheating, but we can not allow it
|
// some checks if player isn't cheating - it is not exactly cheating, but we can not allow it
|
||||||
if (action == 1 && ginfo.arenaType == ARENA_TYPE_NONE)
|
if (action == 1 && ginfo.arenaType == ARENA_TYPE_NONE)
|
||||||
|
|
@ -670,7 +676,9 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recv_data)
|
||||||
|
|
||||||
// ignore if we already in BG or BG queue
|
// ignore if we already in BG or BG queue
|
||||||
if (_player->InBattleGround())
|
if (_player->InBattleGround())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ArenaType arenatype = ArenaTeam::GetTypeBySlot(arenaslot);
|
ArenaType arenatype = ArenaTeam::GetTypeBySlot(arenaslot);
|
||||||
uint32 arenaRating = 0;
|
uint32 arenaRating = 0;
|
||||||
|
|
@ -693,14 +701,20 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recv_data)
|
||||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, arenatype);
|
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, arenatype);
|
||||||
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->getLevel());
|
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->getLevel());
|
||||||
if (!bracketEntry)
|
if (!bracketEntry)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Group* grp = _player->GetGroup();
|
Group* grp = _player->GetGroup();
|
||||||
// no group found, error
|
// no group found, error
|
||||||
if (!grp)
|
if (!grp)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (grp->GetLeaderGuid() != _player->GetObjectGuid())
|
if (grp->GetLeaderGuid() != _player->GetObjectGuid())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 ateamId = _player->GetArenaTeamId(arenaslot);
|
uint32 ateamId = _player->GetArenaTeamId(arenaslot);
|
||||||
// check real arena team existence only here (if it was moved to group->CanJoin .. () then we would have to get it twice)
|
// check real arena team existence only here (if it was moved to group->CanJoin .. () then we would have to get it twice)
|
||||||
|
|
@ -720,7 +734,9 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
ArenaTeamMember const* at_member = at->GetMember(citr->guid);
|
ArenaTeamMember const* at_member = at->GetMember(citr->guid);
|
||||||
if (!at_member) // group member joining to arena must be in leader arena team
|
if (!at_member) // group member joining to arena must be in leader arena team
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// calc avg personal rating
|
// calc avg personal rating
|
||||||
avg_pers_rating += at_member->personal_rating;
|
avg_pers_rating += at_member->personal_rating;
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,9 @@ bool BattleGroundQueue::SelectionPool::KickGroup(uint32 size)
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
else if (!found && (*itr)->Players.size() >= (*groupToKick)->Players.size())
|
else if (!found && (*itr)->Players.size() >= (*groupToKick)->Players.size())
|
||||||
{ groupToKick = itr; }
|
{
|
||||||
|
groupToKick = itr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// if pool is empty, do nothing
|
// if pool is empty, do nothing
|
||||||
if (GetPlayerCount())
|
if (GetPlayerCount())
|
||||||
|
|
@ -743,7 +745,9 @@ bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BattleGround
|
||||||
bool BattleGroundQueue::CheckSkirmishForSameFaction(BattleGroundBracketId bracket_id, uint32 minPlayersPerTeam)
|
bool BattleGroundQueue::CheckSkirmishForSameFaction(BattleGroundBracketId bracket_id, uint32 minPlayersPerTeam)
|
||||||
{
|
{
|
||||||
if (m_SelectionPools[TEAM_INDEX_ALLIANCE].GetPlayerCount() < minPlayersPerTeam && m_SelectionPools[TEAM_INDEX_HORDE].GetPlayerCount() < minPlayersPerTeam)
|
if (m_SelectionPools[TEAM_INDEX_ALLIANCE].GetPlayerCount() < minPlayersPerTeam && m_SelectionPools[TEAM_INDEX_HORDE].GetPlayerCount() < minPlayersPerTeam)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
PvpTeamIndex teamIdx = TEAM_INDEX_ALLIANCE;
|
PvpTeamIndex teamIdx = TEAM_INDEX_ALLIANCE;
|
||||||
PvpTeamIndex otherTeamIdx = TEAM_INDEX_HORDE;
|
PvpTeamIndex otherTeamIdx = TEAM_INDEX_HORDE;
|
||||||
Team otherTeamId = HORDE;
|
Team otherTeamId = HORDE;
|
||||||
|
|
@ -763,7 +767,9 @@ bool BattleGroundQueue::CheckSkirmishForSameFaction(BattleGroundBracketId bracke
|
||||||
if (ginfo == *itr_team)
|
if (ginfo == *itr_team)
|
||||||
break;
|
break;
|
||||||
if (itr_team == m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + teamIdx].end())
|
if (itr_team == m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE + teamIdx].end())
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
GroupsQueueType::iterator itr_team2 = itr_team;
|
GroupsQueueType::iterator itr_team2 = itr_team;
|
||||||
++itr_team2;
|
++itr_team2;
|
||||||
// invite players to other selection pool
|
// invite players to other selection pool
|
||||||
|
|
@ -774,7 +780,9 @@ bool BattleGroundQueue::CheckSkirmishForSameFaction(BattleGroundBracketId bracke
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (m_SelectionPools[otherTeamIdx].GetPlayerCount() != minPlayersPerTeam)
|
if (m_SelectionPools[otherTeamIdx].GetPlayerCount() != minPlayersPerTeam)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// here we have correct 2 selections and we need to change one teams team and move selection pool teams to other team's queue
|
// here we have correct 2 selections and we need to change one teams team and move selection pool teams to other team's queue
|
||||||
for (GroupsQueueType::iterator itr = m_SelectionPools[otherTeamIdx].SelectedGroups.begin(); itr != m_SelectionPools[otherTeamIdx].SelectedGroups.end(); ++itr)
|
for (GroupsQueueType::iterator itr = m_SelectionPools[otherTeamIdx].SelectedGroups.begin(); itr != m_SelectionPools[otherTeamIdx].SelectedGroups.end(); ++itr)
|
||||||
|
|
@ -1724,7 +1732,9 @@ BattleGround* BattleGroundMgr::GetBattleGroundThroughClientInstance(uint32 insta
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bg->isArena())
|
if (bg->isArena())
|
||||||
|
{
|
||||||
return GetBattleGround(instanceId, bgTypeId);
|
return GetBattleGround(instanceId, bgTypeId);
|
||||||
|
}
|
||||||
|
|
||||||
for (BattleGroundSet::iterator itr = m_BattleGrounds[bgTypeId].begin(); itr != m_BattleGrounds[bgTypeId].end(); ++itr)
|
for (BattleGroundSet::iterator itr = m_BattleGrounds[bgTypeId].begin(); itr != m_BattleGrounds[bgTypeId].end(); ++itr)
|
||||||
{
|
{
|
||||||
|
|
@ -2307,7 +2317,9 @@ void BattleGroundMgr::ToggleTesting()
|
||||||
sWorld.SendWorldText(LANG_DEBUG_BG_ON);
|
sWorld.SendWorldText(LANG_DEBUG_BG_ON);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ sWorld.SendWorldText(LANG_DEBUG_BG_OFF); }
|
{
|
||||||
|
sWorld.SendWorldText(LANG_DEBUG_BG_OFF);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundMgr::ToggleArenaTesting()
|
void BattleGroundMgr::ToggleArenaTesting()
|
||||||
|
|
@ -2543,7 +2555,9 @@ void BattleGroundMgr::LoadBattleEventIndexes()
|
||||||
m_GameObjectBattleEventIndexMap[dbTableGuidLow] = events;
|
m_GameObjectBattleEventIndexMap[dbTableGuidLow] = events;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_CreatureBattleEventIndexMap[dbTableGuidLow] = events; }
|
{
|
||||||
|
m_CreatureBattleEventIndexMap[dbTableGuidLow] = events;
|
||||||
|
}
|
||||||
|
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,9 @@ void BattleGroundWS::RespawnDroppedFlag(Team team)
|
||||||
SendMessageToAll(LANG_BG_WS_ALLIANCE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
SendMessageToAll(LANG_BG_WS_ALLIANCE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ SendMessageToAll(LANG_BG_WS_HORDE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL); }
|
{
|
||||||
|
SendMessageToAll(LANG_BG_WS_HORDE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||||
|
}
|
||||||
|
|
||||||
PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED);
|
PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED);
|
||||||
|
|
||||||
|
|
@ -182,7 +184,9 @@ void BattleGroundWS::RespawnDroppedFlag(Team team)
|
||||||
obj->Delete();
|
obj->Delete();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ sLog.outError("Unknown dropped flag bg: %s", GetDroppedFlagGuid(team).GetString().c_str()); }
|
{
|
||||||
|
sLog.outError("Unknown dropped flag bg: %s", GetDroppedFlagGuid(team).GetString().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
ClearDroppedFlagGuid(team);
|
ClearDroppedFlagGuid(team);
|
||||||
}
|
}
|
||||||
|
|
@ -245,7 +249,9 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player* source)
|
||||||
SendMessageToAll(LANG_BG_WS_CAPTURED_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, source);
|
SendMessageToAll(LANG_BG_WS_CAPTURED_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, source);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, source); }
|
{
|
||||||
|
SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, source);
|
||||||
|
}
|
||||||
|
|
||||||
UpdateFlagState(source->GetTeam(), 1); // flag state none
|
UpdateFlagState(source->GetTeam(), 1); // flag state none
|
||||||
UpdateTeamScore(source->GetTeam());
|
UpdateTeamScore(source->GetTeam());
|
||||||
|
|
@ -258,7 +264,9 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player* source)
|
||||||
winner = ALLIANCE;
|
winner = ALLIANCE;
|
||||||
}
|
}
|
||||||
else if (m_TeamScores[TEAM_INDEX_HORDE] == BG_WS_MAX_TEAM_SCORE)
|
else if (m_TeamScores[TEAM_INDEX_HORDE] == BG_WS_MAX_TEAM_SCORE)
|
||||||
{ winner = HORDE; }
|
{
|
||||||
|
winner = HORDE;
|
||||||
|
}
|
||||||
|
|
||||||
if (winner)
|
if (winner)
|
||||||
{
|
{
|
||||||
|
|
@ -482,7 +490,9 @@ void BattleGroundWS::RemovePlayer(Player* plr, ObjectGuid guid)
|
||||||
RespawnFlag(ALLIANCE, false);
|
RespawnFlag(ALLIANCE, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ EventPlayerDroppedFlag(plr); }
|
{
|
||||||
|
EventPlayerDroppedFlag(plr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (IsHordeFlagPickedUp() && m_flagCarrierHorde == guid)
|
if (IsHordeFlagPickedUp() && m_flagCarrierHorde == guid)
|
||||||
{
|
{
|
||||||
|
|
@ -493,7 +503,9 @@ void BattleGroundWS::RemovePlayer(Player* plr, ObjectGuid guid)
|
||||||
RespawnFlag(HORDE, false);
|
RespawnFlag(HORDE, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ EventPlayerDroppedFlag(plr); }
|
{
|
||||||
|
EventPlayerDroppedFlag(plr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -504,7 +516,9 @@ void BattleGroundWS::UpdateFlagState(Team team, uint32 value)
|
||||||
UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, value);
|
UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ UpdateWorldState(BG_WS_FLAG_STATE_HORDE, value); }
|
{
|
||||||
|
UpdateWorldState(BG_WS_FLAG_STATE_HORDE, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundWS::UpdateTeamScore(Team team)
|
void BattleGroundWS::UpdateTeamScore(Team team)
|
||||||
|
|
@ -636,7 +650,9 @@ WorldSafeLocsEntry const* BattleGroundWS::GetClosestGraveYard(Player* player)
|
||||||
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_ALLIANCE);
|
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_ALLIANCE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_FLAGROOM_ALLIANCE); }
|
{
|
||||||
|
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_FLAGROOM_ALLIANCE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -645,7 +661,9 @@ WorldSafeLocsEntry const* BattleGroundWS::GetClosestGraveYard(Player* player)
|
||||||
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_HORDE);
|
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_HORDE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_FLAGROOM_HORDE); }
|
{
|
||||||
|
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_FLAGROOM_HORDE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -659,18 +677,26 @@ void BattleGroundWS::FillInitialWorldStates(WorldPacket& data, uint32& count)
|
||||||
FillInitialWorldState(data, count, BG_WS_FLAG_UNK_ALLIANCE, -1);
|
FillInitialWorldState(data, count, BG_WS_FLAG_UNK_ALLIANCE, -1);
|
||||||
}
|
}
|
||||||
else if (m_FlagState[TEAM_INDEX_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
else if (m_FlagState[TEAM_INDEX_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||||
{ FillInitialWorldState(data, count, BG_WS_FLAG_UNK_ALLIANCE, 1); }
|
{
|
||||||
|
FillInitialWorldState(data, count, BG_WS_FLAG_UNK_ALLIANCE, 1);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ FillInitialWorldState(data, count, BG_WS_FLAG_UNK_ALLIANCE, 0); }
|
{
|
||||||
|
FillInitialWorldState(data, count, BG_WS_FLAG_UNK_ALLIANCE, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_FlagState[TEAM_INDEX_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
|
if (m_FlagState[TEAM_INDEX_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||||
{
|
{
|
||||||
FillInitialWorldState(data, count, BG_WS_FLAG_UNK_HORDE, -1);
|
FillInitialWorldState(data, count, BG_WS_FLAG_UNK_HORDE, -1);
|
||||||
}
|
}
|
||||||
else if (m_FlagState[TEAM_INDEX_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
else if (m_FlagState[TEAM_INDEX_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||||
{ FillInitialWorldState(data, count, BG_WS_FLAG_UNK_HORDE, 1); }
|
{
|
||||||
|
FillInitialWorldState(data, count, BG_WS_FLAG_UNK_HORDE, 1);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ FillInitialWorldState(data, count, BG_WS_FLAG_UNK_HORDE, 0); }
|
{
|
||||||
|
FillInitialWorldState(data, count, BG_WS_FLAG_UNK_HORDE, 0);
|
||||||
|
}
|
||||||
|
|
||||||
FillInitialWorldState(data, count, BG_WS_FLAG_CAPTURES_MAX, BG_WS_MAX_TEAM_SCORE);
|
FillInitialWorldState(data, count, BG_WS_FLAG_CAPTURES_MAX, BG_WS_MAX_TEAM_SCORE);
|
||||||
|
|
||||||
|
|
@ -679,14 +705,18 @@ void BattleGroundWS::FillInitialWorldStates(WorldPacket& data, uint32& count)
|
||||||
FillInitialWorldState(data, count, BG_WS_FLAG_STATE_HORDE, 2);
|
FillInitialWorldState(data, count, BG_WS_FLAG_STATE_HORDE, 2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ FillInitialWorldState(data, count, BG_WS_FLAG_STATE_HORDE, 1); }
|
{
|
||||||
|
FillInitialWorldState(data, count, BG_WS_FLAG_STATE_HORDE, 1);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_FlagState[TEAM_INDEX_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
if (m_FlagState[TEAM_INDEX_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||||
{
|
{
|
||||||
FillInitialWorldState(data, count, BG_WS_FLAG_STATE_ALLIANCE, 2);
|
FillInitialWorldState(data, count, BG_WS_FLAG_STATE_ALLIANCE, 2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ FillInitialWorldState(data, count, BG_WS_FLAG_STATE_ALLIANCE, 1); }
|
{
|
||||||
|
FillInitialWorldState(data, count, BG_WS_FLAG_STATE_ALLIANCE, 1);
|
||||||
|
}
|
||||||
|
|
||||||
FillInitialWorldState(data, count, BG_WS_TIME_ENABLED, WORLD_STATE_ADD);
|
FillInitialWorldState(data, count, BG_WS_TIME_ENABLED, WORLD_STATE_ADD);
|
||||||
FillInitialWorldState(data, count, BG_WS_TIME_REMAINING, GetRemainingTimeInMinutes());
|
FillInitialWorldState(data, count, BG_WS_TIME_REMAINING, GetRemainingTimeInMinutes());
|
||||||
|
|
|
||||||
|
|
@ -116,10 +116,14 @@ bool ChatHandler::HandleServerInfoCommand(char* /*args*/)
|
||||||
PSendSysMessage(LANG_USING_SCRIPT_LIB, ver);
|
PSendSysMessage(LANG_USING_SCRIPT_LIB, ver);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ SendSysMessage(LANG_USING_SCRIPT_LIB_UNKNOWN); }
|
{
|
||||||
|
SendSysMessage(LANG_USING_SCRIPT_LIB_UNKNOWN);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ SendSysMessage(LANG_USING_SCRIPT_LIB_NONE); }
|
{
|
||||||
|
SendSysMessage(LANG_USING_SCRIPT_LIB_NONE);
|
||||||
|
}
|
||||||
|
|
||||||
PSendSysMessage(LANG_USING_WORLD_DB, sWorld.GetDBVersion());
|
PSendSysMessage(LANG_USING_WORLD_DB, sWorld.GetDBVersion());
|
||||||
PSendSysMessage(LANG_CONNECTED_USERS, activeClientsNum, maxActiveClientsNum, queuedClientsNum, maxQueuedClientsNum);
|
PSendSysMessage(LANG_CONNECTED_USERS, activeClientsNum, maxActiveClientsNum, queuedClientsNum, maxQueuedClientsNum);
|
||||||
|
|
@ -201,7 +205,9 @@ bool ChatHandler::HandleGMListIngameCommand(char* /*args*/)
|
||||||
{ PSendSysMessage("%s - %s", iter->first.c_str(), iter->second ? accepts : not_accept); }
|
{ PSendSysMessage("%s - %s", iter->first.c_str(), iter->second ? accepts : not_accept); }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ SendSysMessage(LANG_GMS_NOT_LOGGED); }
|
{
|
||||||
|
SendSysMessage(LANG_GMS_NOT_LOGGED);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -221,7 +221,9 @@ bool ChatHandler::HandleGMChatCommand(char* args)
|
||||||
m_session->SendNotification(LANG_GM_CHAT_ON);
|
m_session->SendNotification(LANG_GM_CHAT_ON);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_session->SendNotification(LANG_GM_CHAT_OFF); }
|
{
|
||||||
|
m_session->SendNotification(LANG_GM_CHAT_OFF);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -361,7 +363,9 @@ bool ChatHandler::HandleGPSCommand(char* args)
|
||||||
PSendSysMessage("You are OUTdoor");
|
PSendSysMessage("You are OUTdoor");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ PSendSysMessage("You are INdoor"); }
|
{
|
||||||
|
PSendSysMessage("You are INdoor");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -512,7 +516,9 @@ bool ChatHandler::HandleSummonCommand(char* args)
|
||||||
}
|
}
|
||||||
// save only in non-flight case
|
// save only in non-flight case
|
||||||
else
|
else
|
||||||
{ target->SaveRecallPosition(); }
|
{
|
||||||
|
target->SaveRecallPosition();
|
||||||
|
}
|
||||||
|
|
||||||
// before GM
|
// before GM
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
|
|
@ -644,7 +650,9 @@ bool ChatHandler::HandleAppearCommand(char* args)
|
||||||
group->BindToInstance(save, !save->CanReset());
|
group->BindToInstance(save, !save->CanReset());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ _player->BindToInstance(save, !save->CanReset()); }
|
{
|
||||||
|
_player->BindToInstance(save, !save->CanReset());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -668,7 +676,9 @@ bool ChatHandler::HandleAppearCommand(char* args)
|
||||||
}
|
}
|
||||||
// save only in non-flight case
|
// save only in non-flight case
|
||||||
else
|
else
|
||||||
{ _player->SaveRecallPosition(); }
|
{
|
||||||
|
_player->SaveRecallPosition();
|
||||||
|
}
|
||||||
|
|
||||||
// to point to see at target with same orientation
|
// to point to see at target with same orientation
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
|
|
@ -731,7 +741,9 @@ bool ChatHandler::HandleRecallCommand(char* args)
|
||||||
bool ChatHandler::HandleModifyHolyPowerCommand(char* args)
|
bool ChatHandler::HandleModifyHolyPowerCommand(char* args)
|
||||||
{
|
{
|
||||||
if (!*args)
|
if (!*args)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int32 power = atoi(args);
|
int32 power = atoi(args);
|
||||||
|
|
||||||
|
|
@ -752,7 +764,9 @@ bool ChatHandler::HandleModifyHolyPowerCommand(char* args)
|
||||||
|
|
||||||
// check online security
|
// check online security
|
||||||
if (HasLowerSecurity(chr))
|
if (HasLowerSecurity(chr))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int32 maxPower = int32(chr->GetMaxPower(POWER_HOLY_POWER));
|
int32 maxPower = int32(chr->GetMaxPower(POWER_HOLY_POWER));
|
||||||
if (power > maxPower)
|
if (power > maxPower)
|
||||||
|
|
@ -953,7 +967,9 @@ bool ChatHandler::HandleModifyRageCommand(char* args)
|
||||||
bool ChatHandler::HandleModifyRunicPowerCommand(char* args)
|
bool ChatHandler::HandleModifyRunicPowerCommand(char* args)
|
||||||
{
|
{
|
||||||
if (!*args)
|
if (!*args)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int32 rune = atoi(args) * 10;
|
int32 rune = atoi(args) * 10;
|
||||||
int32 runem = atoi(args) * 10;
|
int32 runem = atoi(args) * 10;
|
||||||
|
|
@ -1096,7 +1112,9 @@ bool ChatHandler::HandleModifyTalentCommand(char* args)
|
||||||
{
|
{
|
||||||
// check online security
|
// check online security
|
||||||
if (HasLowerSecurity((Player*)owner))
|
if (HasLowerSecurity((Player*)owner))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
((Pet*)target)->SetFreeTalentPoints(tp);
|
((Pet*)target)->SetFreeTalentPoints(tp);
|
||||||
((Player*)owner)->SendTalentsInfoData(true);
|
((Player*)owner)->SendTalentsInfoData(true);
|
||||||
|
|
@ -1127,7 +1145,9 @@ bool ChatHandler::HandleTaxiCheatCommand(char* args)
|
||||||
}
|
}
|
||||||
// check online security
|
// check online security
|
||||||
else if (HasLowerSecurity(chr))
|
else if (HasLowerSecurity(chr))
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
|
|
@ -1362,7 +1382,9 @@ bool ChatHandler::HandleModifyBWalkCommand(char* args)
|
||||||
bool ChatHandler::HandleModifyFlyCommand(char* args)
|
bool ChatHandler::HandleModifyFlyCommand(char* args)
|
||||||
{
|
{
|
||||||
if (!*args)
|
if (!*args)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
float modSpeed = (float)atof(args);
|
float modSpeed = (float)atof(args);
|
||||||
|
|
||||||
|
|
@ -1383,7 +1405,9 @@ bool ChatHandler::HandleModifyFlyCommand(char* args)
|
||||||
|
|
||||||
// check online security
|
// check online security
|
||||||
if (HasLowerSecurity(chr))
|
if (HasLowerSecurity(chr))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
PSendSysMessage(LANG_YOU_CHANGE_FLY_SPEED, modSpeed, GetNameLink(chr).c_str());
|
PSendSysMessage(LANG_YOU_CHANGE_FLY_SPEED, modSpeed, GetNameLink(chr).c_str());
|
||||||
if (needReportToTarget(chr))
|
if (needReportToTarget(chr))
|
||||||
|
|
@ -1734,7 +1758,9 @@ bool ChatHandler::HandleModifyMoneyCommand(char* args)
|
||||||
|
|
||||||
int64 addmoney;
|
int64 addmoney;
|
||||||
if (!ExtractInt64(&args, addmoney))
|
if (!ExtractInt64(&args, addmoney))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint64 moneyuser = chr->GetMoney();
|
uint64 moneyuser = chr->GetMoney();
|
||||||
|
|
||||||
|
|
@ -1780,7 +1806,9 @@ bool ChatHandler::HandleModifyMoneyCommand(char* args)
|
||||||
chr->SetMoney(MAX_MONEY_AMOUNT);
|
chr->SetMoney(MAX_MONEY_AMOUNT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ chr->ModifyMoney(addmoney); }
|
{
|
||||||
|
chr->ModifyMoney(addmoney);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DETAIL_LOG("USER2: %s, ADD: %s, RESULT: %s\n",
|
DETAIL_LOG("USER2: %s, ADD: %s, RESULT: %s\n",
|
||||||
|
|
@ -1876,7 +1904,9 @@ bool ChatHandler::HandleLookupAreaCommand(char* args)
|
||||||
ss << areaEntry->ID << " - |cffffffff|Harea:" << areaEntry->ID << "|h[" << name << " " << localeNames[loc] << "]|h|r";
|
ss << areaEntry->ID << " - |cffffffff|Harea:" << areaEntry->ID << "|h[" << name << " " << localeNames[loc] << "]|h|r";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ ss << areaEntry->ID << " - " << name << " " << localeNames[loc]; }
|
{
|
||||||
|
ss << areaEntry->ID << " - " << name << " " << localeNames[loc];
|
||||||
|
}
|
||||||
|
|
||||||
SendSysMessage(ss.str().c_str());
|
SendSysMessage(ss.str().c_str());
|
||||||
|
|
||||||
|
|
@ -1931,7 +1961,9 @@ bool ChatHandler::HandleLookupTeleCommand(char* args)
|
||||||
reply << " |cffffffff|Htele:" << itr->first << "|h[" << tele->name << "]|h|r\n";
|
reply << " |cffffffff|Htele:" << itr->first << "|h[" << tele->name << "]|h|r\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ reply << " " << itr->first << " " << tele->name << "\n"; }
|
{
|
||||||
|
reply << " " << itr->first << " " << tele->name << "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reply.str().empty())
|
if (reply.str().empty())
|
||||||
|
|
@ -1939,7 +1971,9 @@ bool ChatHandler::HandleLookupTeleCommand(char* args)
|
||||||
SendSysMessage(LANG_COMMAND_TELE_NOLOCATION);
|
SendSysMessage(LANG_COMMAND_TELE_NOLOCATION);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ PSendSysMessage(LANG_COMMAND_TELE_LOCATION, reply.str().c_str()); }
|
{
|
||||||
|
PSendSysMessage(LANG_COMMAND_TELE_LOCATION, reply.str().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -2159,7 +2193,9 @@ bool ChatHandler::HandleTeleGroupCommand(char* args)
|
||||||
}
|
}
|
||||||
// save only in non-flight case
|
// save only in non-flight case
|
||||||
else
|
else
|
||||||
{ pl->SaveRecallPosition(); }
|
{
|
||||||
|
pl->SaveRecallPosition();
|
||||||
|
}
|
||||||
|
|
||||||
pl->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation);
|
pl->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation);
|
||||||
}
|
}
|
||||||
|
|
@ -2259,7 +2295,9 @@ bool ChatHandler::HandleGroupgoCommand(char* args)
|
||||||
}
|
}
|
||||||
// save only in non-flight case
|
// save only in non-flight case
|
||||||
else
|
else
|
||||||
{ pl->SaveRecallPosition(); }
|
{
|
||||||
|
pl->SaveRecallPosition();
|
||||||
|
}
|
||||||
|
|
||||||
// before GM
|
// before GM
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
|
|
@ -2314,7 +2352,9 @@ bool ChatHandler::HandleGoHelper(Player* player, uint32 mapid, float x, float y,
|
||||||
}
|
}
|
||||||
// save only in non-flight case
|
// save only in non-flight case
|
||||||
else
|
else
|
||||||
{ player->SaveRecallPosition(); }
|
{
|
||||||
|
player->SaveRecallPosition();
|
||||||
|
}
|
||||||
|
|
||||||
player->TeleportTo(mapid, x, y, z, ort);
|
player->TeleportTo(mapid, x, y, z, ort);
|
||||||
|
|
||||||
|
|
@ -2381,7 +2421,9 @@ bool ChatHandler::HandleGoCommand(char* args)
|
||||||
}
|
}
|
||||||
// link case
|
// link case
|
||||||
else if (!ExtractLocationFromLink(&args, mapid, x, y, z))
|
else if (!ExtractLocationFromLink(&args, mapid, x, y, z))
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return HandleGoHelper(_player, mapid, x, y, &z);
|
return HandleGoHelper(_player, mapid, x, y, &z);
|
||||||
}
|
}
|
||||||
|
|
@ -2472,7 +2514,9 @@ bool ChatHandler::HandleGoZoneXYCommand(char* args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ areaid = _player->GetZoneId(); }
|
{
|
||||||
|
areaid = _player->GetZoneId();
|
||||||
|
}
|
||||||
|
|
||||||
AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaid);
|
AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaid);
|
||||||
|
|
||||||
|
|
@ -2540,7 +2584,9 @@ bool ChatHandler::HandleGoGridCommand(char* args)
|
||||||
bool ChatHandler::HandleModifyDrunkCommand(char* args)
|
bool ChatHandler::HandleModifyDrunkCommand(char* args)
|
||||||
{
|
{
|
||||||
if (!*args)
|
if (!*args)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint8 drunkValue = (uint8)atoi(args);
|
uint8 drunkValue = (uint8)atoi(args);
|
||||||
if (drunkValue > 100)
|
if (drunkValue > 100)
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,9 @@ void ChatHandler::ShowTriggerTargetListHelper(uint32 id, AreaTrigger const* at,
|
||||||
snprintf(dist_buf, 50, GetMangosString(LANG_TRIGGER_DIST), dist);
|
snprintf(dist_buf, 50, GetMangosString(LANG_TRIGGER_DIST), dist);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ dist_buf[0] = '\0'; }
|
{
|
||||||
|
dist_buf[0] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
PSendSysMessage(LANG_TRIGGER_TARGET_LIST_CHAT,
|
PSendSysMessage(LANG_TRIGGER_TARGET_LIST_CHAT,
|
||||||
subpart ? " -> " : "", id, id, at->target_mapId, at->target_X, at->target_Y, at->target_Z, dist_buf);
|
subpart ? " -> " : "", id, id, at->target_mapId, at->target_X, at->target_Y, at->target_Z, dist_buf);
|
||||||
|
|
@ -526,7 +528,9 @@ bool ChatHandler::HandleGoTriggerCommand(char* args)
|
||||||
return HandleGoHelper(_player, at->target_mapId, at->target_X, at->target_Y, &at->target_Z);
|
return HandleGoHelper(_player, at->target_mapId, at->target_X, at->target_Y, &at->target_Z);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return HandleGoHelper(_player, atEntry->mapid, atEntry->x, atEntry->y, &atEntry->z); }
|
{
|
||||||
|
return HandleGoHelper(_player, atEntry->mapid, atEntry->x, atEntry->y, &atEntry->z);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChatHandler::HandleGoGraveyardCommand(char* args)
|
bool ChatHandler::HandleGoGraveyardCommand(char* args)
|
||||||
|
|
@ -927,7 +931,9 @@ bool ChatHandler::HandleGameObjectTargetCommand(char* args)
|
||||||
initString = false;
|
initString = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ eventFilter << "," << *itr; }
|
{
|
||||||
|
eventFilter << "," << *itr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!initString)
|
if (!initString)
|
||||||
|
|
@ -935,7 +941,9 @@ bool ChatHandler::HandleGameObjectTargetCommand(char* args)
|
||||||
eventFilter << "))";
|
eventFilter << "))";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ eventFilter << ")"; }
|
{
|
||||||
|
eventFilter << ")";
|
||||||
|
}
|
||||||
|
|
||||||
result = WorldDatabase.PQuery("SELECT gameobject.guid, id, position_x, position_y, position_z, orientation, map, "
|
result = WorldDatabase.PQuery("SELECT gameobject.guid, id, position_x, position_y, position_z, orientation, map, "
|
||||||
"(POW(position_x - %f, 2) + POW(position_y - %f, 2) + POW(position_z - %f, 2)) AS order_ FROM gameobject "
|
"(POW(position_x - %f, 2) + POW(position_y - %f, 2) + POW(position_z - %f, 2)) AS order_ FROM gameobject "
|
||||||
|
|
@ -1012,7 +1020,9 @@ bool ChatHandler::HandleGameObjectTargetCommand(char* args)
|
||||||
PSendSysMessage(LANG_COMMAND_GO_STATUS_DOOR, target->GetGoState(), target->getLootState(), GetOnOffStr(target->IsCollisionEnabled()), goI->door.startOpen ? "open" : "closed");
|
PSendSysMessage(LANG_COMMAND_GO_STATUS_DOOR, target->GetGoState(), target->getLootState(), GetOnOffStr(target->IsCollisionEnabled()), goI->door.startOpen ? "open" : "closed");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ PSendSysMessage(LANG_COMMAND_GO_STATUS, target->GetGoState(), target->getLootState(), GetOnOffStr(target->IsCollisionEnabled())); }
|
{
|
||||||
|
PSendSysMessage(LANG_COMMAND_GO_STATUS, target->GetGoState(), target->getLootState(), GetOnOffStr(target->IsCollisionEnabled()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1288,10 +1298,14 @@ bool ChatHandler::HandleGameObjectPhaseCommand(char* args)
|
||||||
// number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r
|
// number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r
|
||||||
uint32 lowguid;
|
uint32 lowguid;
|
||||||
if (!ExtractUint32KeyFromLink(&args, "Hgameobject", lowguid))
|
if (!ExtractUint32KeyFromLink(&args, "Hgameobject", lowguid))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!lowguid)
|
if (!lowguid)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
GameObject* obj = NULL;
|
GameObject* obj = NULL;
|
||||||
|
|
||||||
|
|
@ -1440,7 +1454,9 @@ void ChatHandler::ShowAchievementListHelper(AchievementEntry const* achEntry, Lo
|
||||||
bool ChatHandler::HandleLookupAchievementCommand(char* args)
|
bool ChatHandler::HandleLookupAchievementCommand(char* args)
|
||||||
{
|
{
|
||||||
if (!*args)
|
if (!*args)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Can be NULL at console call
|
// Can be NULL at console call
|
||||||
Player* target = getSelectedPlayer();
|
Player* target = getSelectedPlayer();
|
||||||
|
|
@ -1449,7 +1465,9 @@ bool ChatHandler::HandleLookupAchievementCommand(char* args)
|
||||||
std::wstring wnamepart;
|
std::wstring wnamepart;
|
||||||
|
|
||||||
if (!Utf8toWStr(namepart, wnamepart))
|
if (!Utf8toWStr(namepart, wnamepart))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// converting string that we try to find to lower case
|
// converting string that we try to find to lower case
|
||||||
wstrToLower(wnamepart);
|
wstrToLower(wnamepart);
|
||||||
|
|
@ -1501,7 +1519,9 @@ bool ChatHandler::HandleCharacterAchievementsCommand(char* args)
|
||||||
{
|
{
|
||||||
Player* target;
|
Player* target;
|
||||||
if (!ExtractPlayerTarget(&args, &target))
|
if (!ExtractPlayerTarget(&args, &target))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
LocaleConstant loc = GetSessionDbcLocale();
|
LocaleConstant loc = GetSessionDbcLocale();
|
||||||
|
|
||||||
|
|
@ -1526,7 +1546,9 @@ void ChatHandler::ShowFactionListHelper(FactionEntry const* factionEntry, Locale
|
||||||
ss << factionEntry->ID << " - |cffffffff|Hfaction:" << factionEntry->ID << "|h[" << name << " " << localeNames[loc] << "]|h|r";
|
ss << factionEntry->ID << " - |cffffffff|Hfaction:" << factionEntry->ID << "|h[" << name << " " << localeNames[loc] << "]|h|r";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ ss << factionEntry->ID << " - " << name << " " << localeNames[loc]; }
|
{
|
||||||
|
ss << factionEntry->ID << " - " << name << " " << localeNames[loc];
|
||||||
|
}
|
||||||
|
|
||||||
if (repState) // and then target!=NULL also
|
if (repState) // and then target!=NULL also
|
||||||
{
|
{
|
||||||
|
|
@ -1561,7 +1583,9 @@ void ChatHandler::ShowFactionListHelper(FactionEntry const* factionEntry, Locale
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (target)
|
else if (target)
|
||||||
{ ss << GetMangosString(LANG_FACTION_NOREPUTATION); }
|
{
|
||||||
|
ss << GetMangosString(LANG_FACTION_NOREPUTATION);
|
||||||
|
}
|
||||||
|
|
||||||
SendSysMessage(ss.str().c_str());
|
SendSysMessage(ss.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
@ -1821,15 +1845,21 @@ bool ChatHandler::HandleNpcAddVendorCurrencyCommand(char* args)
|
||||||
|
|
||||||
uint32 maxcount;
|
uint32 maxcount;
|
||||||
if (!ExtractUInt32(&args, maxcount))
|
if (!ExtractUInt32(&args, maxcount))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 incrtime;
|
uint32 incrtime;
|
||||||
if (!ExtractOptUInt32(&args, incrtime, 0))
|
if (!ExtractOptUInt32(&args, incrtime, 0))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 extendedcost;
|
uint32 extendedcost;
|
||||||
if (!ExtractUInt32(&args, extendedcost))
|
if (!ExtractUInt32(&args, extendedcost))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Creature* vendor = getSelectedCreature();
|
Creature* vendor = getSelectedCreature();
|
||||||
|
|
||||||
|
|
@ -1874,7 +1904,9 @@ bool ChatHandler::HandleNpcAddVendorItemCommand(char* args)
|
||||||
|
|
||||||
uint32 extendedcost;
|
uint32 extendedcost;
|
||||||
if (!ExtractOptUInt32(&args, extendedcost, 0))
|
if (!ExtractOptUInt32(&args, extendedcost, 0))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Creature* vendor = getSelectedCreature();
|
Creature* vendor = getSelectedCreature();
|
||||||
|
|
||||||
|
|
@ -1898,7 +1930,9 @@ bool ChatHandler::HandleNpcAddVendorItemCommand(char* args)
|
||||||
bool ChatHandler::HandleNpcDelVendorCurrencyCommand(char* args)
|
bool ChatHandler::HandleNpcDelVendorCurrencyCommand(char* args)
|
||||||
{
|
{
|
||||||
if (!*args)
|
if (!*args)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Creature* vendor = getSelectedCreature();
|
Creature* vendor = getSelectedCreature();
|
||||||
if (!vendor || !vendor->IsVendor())
|
if (!vendor || !vendor->IsVendor())
|
||||||
|
|
@ -2092,7 +2126,9 @@ bool ChatHandler::HandleNpcDeleteCommand(char* args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ unit = getSelectedCreature(); }
|
{
|
||||||
|
unit = getSelectedCreature();
|
||||||
|
}
|
||||||
|
|
||||||
if (!unit)
|
if (!unit)
|
||||||
{
|
{
|
||||||
|
|
@ -2112,7 +2148,9 @@ bool ChatHandler::HandleNpcDeleteCommand(char* args)
|
||||||
Creature::DeleteFromDB(unit->GetGUIDLow(), data);
|
Creature::DeleteFromDB(unit->GetGUIDLow(), data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ unit->AddObjectToRemoveList(); }
|
{
|
||||||
|
unit->AddObjectToRemoveList();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CREATURE_SUBTYPE_PET:
|
case CREATURE_SUBTYPE_PET:
|
||||||
|
|
@ -2167,7 +2205,9 @@ bool ChatHandler::HandleNpcMoveCommand(char* args)
|
||||||
pCreature = player->GetMap()->GetCreature(data->GetObjectGuid(lowguid));
|
pCreature = player->GetMap()->GetCreature(data->GetObjectGuid(lowguid));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ lowguid = pCreature->GetGUIDLow(); }
|
{
|
||||||
|
lowguid = pCreature->GetGUIDLow();
|
||||||
|
}
|
||||||
|
|
||||||
float x = player->GetPositionX();
|
float x = player->GetPositionX();
|
||||||
float y = player->GetPositionY();
|
float y = player->GetPositionY();
|
||||||
|
|
@ -2264,11 +2304,17 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(char* args)
|
||||||
move_type = IDLE_MOTION_TYPE;
|
move_type = IDLE_MOTION_TYPE;
|
||||||
}
|
}
|
||||||
else if (strncmp(type_str, "random", strlen(type_str)) == 0)
|
else if (strncmp(type_str, "random", strlen(type_str)) == 0)
|
||||||
{ move_type = RANDOM_MOTION_TYPE; }
|
{
|
||||||
|
move_type = RANDOM_MOTION_TYPE;
|
||||||
|
}
|
||||||
else if (strncmp(type_str, "way", strlen(type_str)) == 0)
|
else if (strncmp(type_str, "way", strlen(type_str)) == 0)
|
||||||
{ move_type = WAYPOINT_MOTION_TYPE; }
|
{
|
||||||
|
move_type = WAYPOINT_MOTION_TYPE;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool doNotDelete = ExtractLiteralArg(&args, "NODEL") != NULL;
|
bool doNotDelete = ExtractLiteralArg(&args, "NODEL") != NULL;
|
||||||
if (!doNotDelete && *args) // need fail if false in result wrong literal
|
if (!doNotDelete && *args) // need fail if false in result wrong literal
|
||||||
|
|
@ -2302,7 +2348,9 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(char* args)
|
||||||
PSendSysMessage(LANG_MOVE_TYPE_SET_NODEL, type_str);
|
PSendSysMessage(LANG_MOVE_TYPE_SET_NODEL, type_str);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ PSendSysMessage(LANG_MOVE_TYPE_SET, type_str); }
|
{
|
||||||
|
PSendSysMessage(LANG_MOVE_TYPE_SET, type_str);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -2407,7 +2455,9 @@ bool ChatHandler::HandleNpcSpawnDistCommand(char* args)
|
||||||
u_guidlow = pCreature->GetGUIDLow();
|
u_guidlow = pCreature->GetGUIDLow();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
pCreature->SetRespawnRadius((float)option);
|
pCreature->SetRespawnRadius((float)option);
|
||||||
pCreature->SetDefaultMovementType(mtype);
|
pCreature->SetDefaultMovementType(mtype);
|
||||||
|
|
@ -2532,7 +2582,9 @@ bool ChatHandler::HandleNpcTameCommand(char* /*args*/)
|
||||||
bool ChatHandler::HandleNpcSetPhaseCommand(char* args)
|
bool ChatHandler::HandleNpcSetPhaseCommand(char* args)
|
||||||
{
|
{
|
||||||
if (!*args)
|
if (!*args)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 phasemask = (uint32) atoi(args);
|
uint32 phasemask = (uint32) atoi(args);
|
||||||
if (phasemask == 0)
|
if (phasemask == 0)
|
||||||
|
|
@ -2581,7 +2633,9 @@ bool ChatHandler::HandleNpcSetDeathStateCommand(char* args)
|
||||||
pCreature->SetDeadByDefault(true);
|
pCreature->SetDeadByDefault(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ pCreature->SetDeadByDefault(false); }
|
{
|
||||||
|
pCreature->SetDeadByDefault(false);
|
||||||
|
}
|
||||||
|
|
||||||
pCreature->SaveToDB();
|
pCreature->SaveToDB();
|
||||||
pCreature->Respawn();
|
pCreature->Respawn();
|
||||||
|
|
@ -2595,7 +2649,9 @@ bool ChatHandler::HandleNpcNameCommand(char* /*args*/)
|
||||||
{
|
{
|
||||||
/* Temp. disabled
|
/* Temp. disabled
|
||||||
if (!*args)
|
if (!*args)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (strlen((char*)args)>75)
|
if (strlen((char*)args)>75)
|
||||||
{
|
{
|
||||||
|
|
@ -2742,7 +2798,9 @@ bool ChatHandler::HandleDeMorphCommand(char* /*args*/)
|
||||||
|
|
||||||
// check online security
|
// check online security
|
||||||
else if (target->GetTypeId() == TYPEID_PLAYER && HasLowerSecurity((Player*)target))
|
else if (target->GetTypeId() == TYPEID_PLAYER && HasLowerSecurity((Player*)target))
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
target->DeMorph();
|
target->DeMorph();
|
||||||
|
|
||||||
|
|
@ -2775,7 +2833,9 @@ bool ChatHandler::HandleModifyMorphCommand(char* args)
|
||||||
|
|
||||||
// check online security
|
// check online security
|
||||||
else if (target->GetTypeId() == TYPEID_PLAYER && HasLowerSecurity((Player*)target))
|
else if (target->GetTypeId() == TYPEID_PLAYER && HasLowerSecurity((Player*)target))
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
target->SetDisplayId(display_id);
|
target->SetDisplayId(display_id);
|
||||||
|
|
||||||
|
|
@ -2814,7 +2874,9 @@ bool ChatHandler::HandleKickPlayerCommand(char* args)
|
||||||
bool ChatHandler::HandleModifyPhaseCommand(char* args)
|
bool ChatHandler::HandleModifyPhaseCommand(char* args)
|
||||||
{
|
{
|
||||||
if (!*args)
|
if (!*args)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 phasemask = (uint32)atoi(args);
|
uint32 phasemask = (uint32)atoi(args);
|
||||||
|
|
||||||
|
|
@ -2824,7 +2886,9 @@ bool ChatHandler::HandleModifyPhaseCommand(char* args)
|
||||||
|
|
||||||
// check online security
|
// check online security
|
||||||
else if (target->GetTypeId() == TYPEID_PLAYER && HasLowerSecurity((Player*)target))
|
else if (target->GetTypeId() == TYPEID_PLAYER && HasLowerSecurity((Player*)target))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
target->SetPhaseMask(phasemask, true);
|
target->SetPhaseMask(phasemask, true);
|
||||||
|
|
||||||
|
|
@ -2962,7 +3026,9 @@ bool ChatHandler::HandleTicketCommand(char* args)
|
||||||
PSendSysMessage(LANG_COMMAND_TICKETCOUNT, count, GetOnOffStr(accept));
|
PSendSysMessage(LANG_COMMAND_TICKETCOUNT, count, GetOnOffStr(accept));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ PSendSysMessage(LANG_COMMAND_TICKETCOUNT_CONSOLE, count); }
|
{
|
||||||
|
PSendSysMessage(LANG_COMMAND_TICKETCOUNT_CONSOLE, count);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -3146,7 +3212,9 @@ bool ChatHandler::HandleDelTicketCommand(char* args)
|
||||||
PSendSysMessage(LANG_COMMAND_TICKETPLAYERDEL, GetNameLink(pl).c_str());
|
PSendSysMessage(LANG_COMMAND_TICKETPLAYERDEL, GetNameLink(pl).c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ PSendSysMessage(LANG_COMMAND_TICKETDEL); }
|
{
|
||||||
|
PSendSysMessage(LANG_COMMAND_TICKETDEL);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -3591,7 +3659,9 @@ bool ChatHandler::HandleWpModifyCommand(char* args)
|
||||||
{
|
{
|
||||||
uint32 waittime;
|
uint32 waittime;
|
||||||
if (!ExtractUInt32(&args, waittime))
|
if (!ExtractUInt32(&args, waittime))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
sWaypointMgr.SetNodeWaittime(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), wpId, wpPathId, wpSource, waittime);
|
sWaypointMgr.SetNodeWaittime(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), wpId, wpPathId, wpSource, waittime);
|
||||||
}
|
}
|
||||||
|
|
@ -3599,7 +3669,9 @@ bool ChatHandler::HandleWpModifyCommand(char* args)
|
||||||
{
|
{
|
||||||
uint32 scriptId;
|
uint32 scriptId;
|
||||||
if (!ExtractUInt32(&args, scriptId))
|
if (!ExtractUInt32(&args, scriptId))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!sWaypointMgr.SetNodeScriptId(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), wpId, wpPathId, wpSource, scriptId))
|
if (!sWaypointMgr.SetNodeScriptId(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), wpId, wpPathId, wpSource, scriptId))
|
||||||
PSendSysMessage(LANG_WAYPOINT_INFO_UNK_SCRIPTID, scriptId);
|
PSendSysMessage(LANG_WAYPOINT_INFO_UNK_SCRIPTID, scriptId);
|
||||||
|
|
@ -3608,7 +3680,9 @@ bool ChatHandler::HandleWpModifyCommand(char* args)
|
||||||
{
|
{
|
||||||
float ori;
|
float ori;
|
||||||
if (!ExtractFloat(&args, ori))
|
if (!ExtractFloat(&args, ori))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
sWaypointMgr.SetNodeOrientation(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), wpId, wpPathId, wpSource, ori);
|
sWaypointMgr.SetNodeOrientation(wpOwner->GetEntry(), wpOwner->GetGUIDLow(), wpId, wpPathId, wpSource, ori);
|
||||||
}
|
}
|
||||||
|
|
@ -3649,7 +3723,9 @@ bool ChatHandler::HandleWpShowCommand(char* args)
|
||||||
|
|
||||||
char* subCmd_str = ExtractLiteralArg(&args);
|
char* subCmd_str = ExtractLiteralArg(&args);
|
||||||
if (!subCmd_str)
|
if (!subCmd_str)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
std::string subCmd = subCmd_str; ///< info, on, off, first, last
|
std::string subCmd = subCmd_str; ///< info, on, off, first, last
|
||||||
|
|
||||||
uint32 dbGuid = 0;
|
uint32 dbGuid = 0;
|
||||||
|
|
@ -3670,7 +3746,9 @@ bool ChatHandler::HandleWpShowCommand(char* args)
|
||||||
else // Guid must be provided
|
else // Guid must be provided
|
||||||
{
|
{
|
||||||
if (!ExtractUInt32(&args, dbGuid)) // No creature selected and no dbGuid provided
|
if (!ExtractUInt32(&args, dbGuid)) // No creature selected and no dbGuid provided
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (ExtractOptInt32(&args, wpPathId, 0)) // Fill path-id and source
|
if (ExtractOptInt32(&args, wpPathId, 0)) // Fill path-id and source
|
||||||
{
|
{
|
||||||
|
|
@ -3846,7 +3924,9 @@ bool ChatHandler::HandleWpShowCommand(char* args)
|
||||||
bool ChatHandler::HandleWpExportCommand(char* args)
|
bool ChatHandler::HandleWpExportCommand(char* args)
|
||||||
{
|
{
|
||||||
if (!*args)
|
if (!*args)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Creature* wpOwner = NULL;
|
Creature* wpOwner = NULL;
|
||||||
WaypointPathOrigin wpOrigin = PATH_NO_PATH;
|
WaypointPathOrigin wpOrigin = PATH_NO_PATH;
|
||||||
|
|
@ -4047,7 +4127,9 @@ bool ChatHandler::HandleCharacterCustomizeCommand(char* args)
|
||||||
ObjectGuid target_guid;
|
ObjectGuid target_guid;
|
||||||
std::string target_name;
|
std::string target_name;
|
||||||
if (!ExtractPlayerTarget(&args, &target, &target_guid, &target_name))
|
if (!ExtractPlayerTarget(&args, &target, &target_guid, &target_name))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (target)
|
if (target)
|
||||||
{
|
{
|
||||||
|
|
@ -4163,7 +4245,9 @@ bool ChatHandler::HandleHonorKillsUpdateCommand(char* /*args*/)
|
||||||
|
|
||||||
// check online security
|
// check online security
|
||||||
if (HasLowerSecurity(target))
|
if (HasLowerSecurity(target))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
target->UpdateHonorKills();
|
target->UpdateHonorKills();
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -4215,7 +4299,9 @@ bool ChatHandler::HandleLookupEventCommand(char* args)
|
||||||
PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT, id, id, eventData.description.c_str(), active);
|
PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT, id, id, eventData.description.c_str(), active);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, id, eventData.description.c_str(), active); }
|
{
|
||||||
|
PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, id, eventData.description.c_str(), active);
|
||||||
|
}
|
||||||
|
|
||||||
++counter;
|
++counter;
|
||||||
}
|
}
|
||||||
|
|
@ -4261,7 +4347,9 @@ bool ChatHandler::HandleEventListCommand(char* args)
|
||||||
state = inactive;
|
state = inactive;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ state = active; }
|
{
|
||||||
|
state = active;
|
||||||
|
}
|
||||||
|
|
||||||
GameEventData const& eventData = events[event_id];
|
GameEventData const& eventData = events[event_id];
|
||||||
|
|
||||||
|
|
@ -4270,7 +4358,9 @@ bool ChatHandler::HandleEventListCommand(char* args)
|
||||||
PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT, event_id, event_id, eventData.description.c_str(), state);
|
PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT, event_id, event_id, eventData.description.c_str(), state);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, event_id, eventData.description.c_str(), state); }
|
{
|
||||||
|
PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, event_id, eventData.description.c_str(), state);
|
||||||
|
}
|
||||||
|
|
||||||
++counter;
|
++counter;
|
||||||
}
|
}
|
||||||
|
|
@ -4831,7 +4921,9 @@ bool ChatHandler::LookupPlayerSearchCommand(QueryResult* result, uint32* limit)
|
||||||
ShowPlayerListHelper(chars, limit, true, false);
|
ShowPlayerListHelper(chars, limit, true, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ delete chars; }
|
{
|
||||||
|
delete chars;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (result->NextRow());
|
while (result->NextRow());
|
||||||
|
|
@ -5220,7 +5312,9 @@ bool ChatHandler::HandleWaterwalkCommand(char* args)
|
||||||
bool ChatHandler::HandleLookupTitleCommand(char* args)
|
bool ChatHandler::HandleLookupTitleCommand(char* args)
|
||||||
{
|
{
|
||||||
if (!*args)
|
if (!*args)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// can be NULL in console call
|
// can be NULL in console call
|
||||||
Player* target = getSelectedPlayer();
|
Player* target = getSelectedPlayer();
|
||||||
|
|
@ -5232,7 +5326,9 @@ bool ChatHandler::HandleLookupTitleCommand(char* args)
|
||||||
std::wstring wnamepart;
|
std::wstring wnamepart;
|
||||||
|
|
||||||
if (!Utf8toWStr(namepart, wnamepart))
|
if (!Utf8toWStr(namepart, wnamepart))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// converting string that we try to find to lower case
|
// converting string that we try to find to lower case
|
||||||
wstrToLower(wnamepart);
|
wstrToLower(wnamepart);
|
||||||
|
|
@ -5298,7 +5394,9 @@ bool ChatHandler::HandleTitlesAddCommand(char* args)
|
||||||
// number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r
|
// number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r
|
||||||
uint32 id;
|
uint32 id;
|
||||||
if (!ExtractUint32KeyFromLink(&args, "Htitle", id))
|
if (!ExtractUint32KeyFromLink(&args, "Htitle", id))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (id <= 0)
|
if (id <= 0)
|
||||||
{
|
{
|
||||||
|
|
@ -5317,7 +5415,9 @@ bool ChatHandler::HandleTitlesAddCommand(char* args)
|
||||||
|
|
||||||
// check online security
|
// check online security
|
||||||
if (HasLowerSecurity(target))
|
if (HasLowerSecurity(target))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
|
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
|
||||||
if (!titleInfo)
|
if (!titleInfo)
|
||||||
|
|
@ -5344,7 +5444,9 @@ bool ChatHandler::HandleTitlesRemoveCommand(char* args)
|
||||||
// number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r
|
// number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r
|
||||||
uint32 id;
|
uint32 id;
|
||||||
if (!ExtractUint32KeyFromLink(&args, "Htitle", id))
|
if (!ExtractUint32KeyFromLink(&args, "Htitle", id))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (id <= 0)
|
if (id <= 0)
|
||||||
{
|
{
|
||||||
|
|
@ -5363,7 +5465,9 @@ bool ChatHandler::HandleTitlesRemoveCommand(char* args)
|
||||||
|
|
||||||
// check online security
|
// check online security
|
||||||
if (HasLowerSecurity(target))
|
if (HasLowerSecurity(target))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
|
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
|
||||||
if (!titleInfo)
|
if (!titleInfo)
|
||||||
|
|
@ -5396,7 +5500,9 @@ bool ChatHandler::HandleTitlesRemoveCommand(char* args)
|
||||||
bool ChatHandler::HandleTitlesSetMaskCommand(char* args)
|
bool ChatHandler::HandleTitlesSetMaskCommand(char* args)
|
||||||
{
|
{
|
||||||
if (!*args)
|
if (!*args)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint64 titles = 0;
|
uint64 titles = 0;
|
||||||
|
|
||||||
|
|
@ -5412,7 +5518,9 @@ bool ChatHandler::HandleTitlesSetMaskCommand(char* args)
|
||||||
|
|
||||||
// check online security
|
// check online security
|
||||||
if (HasLowerSecurity(target))
|
if (HasLowerSecurity(target))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint64 titles2 = titles;
|
uint64 titles2 = titles;
|
||||||
|
|
||||||
|
|
@ -5438,7 +5546,9 @@ bool ChatHandler::HandleCharacterTitlesCommand(char* args)
|
||||||
{
|
{
|
||||||
Player* target;
|
Player* target;
|
||||||
if (!ExtractPlayerTarget(&args, &target))
|
if (!ExtractPlayerTarget(&args, &target))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
LocaleConstant loc = GetSessionDbcLocale();
|
LocaleConstant loc = GetSessionDbcLocale();
|
||||||
char const* targetName = target->GetName();
|
char const* targetName = target->GetName();
|
||||||
|
|
@ -5476,7 +5586,9 @@ bool ChatHandler::HandleTitlesCurrentCommand(char* args)
|
||||||
// number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r
|
// number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r
|
||||||
uint32 id;
|
uint32 id;
|
||||||
if (!ExtractUint32KeyFromLink(&args, "Htitle", id))
|
if (!ExtractUint32KeyFromLink(&args, "Htitle", id))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (id <= 0)
|
if (id <= 0)
|
||||||
{
|
{
|
||||||
|
|
@ -5495,7 +5607,9 @@ bool ChatHandler::HandleTitlesCurrentCommand(char* args)
|
||||||
|
|
||||||
// check online security
|
// check online security
|
||||||
if (HasLowerSecurity(target))
|
if (HasLowerSecurity(target))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
|
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id);
|
||||||
if (!titleInfo)
|
if (!titleInfo)
|
||||||
|
|
@ -5669,7 +5783,9 @@ bool ChatHandler::HandleMmapLocCommand(char* /*args*/)
|
||||||
PSendSysMessage("Dt [%02i,%02i]", tile->header->x, tile->header->y);
|
PSendSysMessage("Dt [%02i,%02i]", tile->header->x, tile->header->y);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ PSendSysMessage("Dt [??,??] (no tile loaded)"); }
|
{
|
||||||
|
PSendSysMessage("Dt [??,??] (no tile loaded)");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,9 @@ bool ChatHandler::HandleAHBotStatusCommand(char* args)
|
||||||
SendSysMessage(LANG_AHBOT_STATUS_MIDBAR_CONSOLE);
|
SendSysMessage(LANG_AHBOT_STATUS_MIDBAR_CONSOLE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ SendSysMessage(LANG_AHBOT_STATUS_TITLE1_CHAT); }
|
{
|
||||||
|
SendSysMessage(LANG_AHBOT_STATUS_TITLE1_CHAT);
|
||||||
|
}
|
||||||
|
|
||||||
uint32 fmtId = m_session ? LANG_AHBOT_STATUS_FORMAT_CHAT : LANG_AHBOT_STATUS_FORMAT_CONSOLE;
|
uint32 fmtId = m_session ? LANG_AHBOT_STATUS_FORMAT_CHAT : LANG_AHBOT_STATUS_FORMAT_CONSOLE;
|
||||||
|
|
||||||
|
|
@ -227,7 +229,9 @@ bool ChatHandler::HandleAHBotStatusCommand(char* args)
|
||||||
SendSysMessage(LANG_AHBOT_STATUS_MIDBAR_CONSOLE);
|
SendSysMessage(LANG_AHBOT_STATUS_MIDBAR_CONSOLE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ SendSysMessage(LANG_AHBOT_STATUS_TITLE2_CHAT); }
|
{
|
||||||
|
SendSysMessage(LANG_AHBOT_STATUS_TITLE2_CHAT);
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < MAX_AUCTION_QUALITY; ++i)
|
for (int i = 0; i < MAX_AUCTION_QUALITY; ++i)
|
||||||
PSendSysMessage(fmtId, GetMangosString(ahbotQualityIds[i]),
|
PSendSysMessage(fmtId, GetMangosString(ahbotQualityIds[i]),
|
||||||
|
|
@ -1367,14 +1371,18 @@ bool ChatHandler::HandleAchievementCommand(char* args)
|
||||||
if (nameStr)
|
if (nameStr)
|
||||||
{
|
{
|
||||||
if (!ExtractPlayerTarget(&nameStr, &target))
|
if (!ExtractPlayerTarget(&nameStr, &target))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
target = getSelectedPlayer();
|
target = getSelectedPlayer();
|
||||||
|
|
||||||
uint32 achId;
|
uint32 achId;
|
||||||
if (!ExtractUint32KeyFromLink(&args, "Hachievement", achId))
|
if (!ExtractUint32KeyFromLink(&args, "Hachievement", achId))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
AchievementEntry const* achEntry = sAchievementStore.LookupEntry(achId);
|
AchievementEntry const* achEntry = sAchievementStore.LookupEntry(achId);
|
||||||
if (!achEntry)
|
if (!achEntry)
|
||||||
|
|
@ -1406,11 +1414,15 @@ bool ChatHandler::HandleAchievementAddCommand(char* args)
|
||||||
|
|
||||||
Player* target;
|
Player* target;
|
||||||
if (!ExtractPlayerTarget(&nameStr, &target))
|
if (!ExtractPlayerTarget(&nameStr, &target))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 achId;
|
uint32 achId;
|
||||||
if (!ExtractUint32KeyFromLink(&args, "Hachievement", achId))
|
if (!ExtractUint32KeyFromLink(&args, "Hachievement", achId))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
AchievementEntry const* achEntry = sAchievementStore.LookupEntry(achId);
|
AchievementEntry const* achEntry = sAchievementStore.LookupEntry(achId);
|
||||||
if (!achEntry || achEntry->flags & ACHIEVEMENT_FLAG_COUNTER)
|
if (!achEntry || achEntry->flags & ACHIEVEMENT_FLAG_COUNTER)
|
||||||
|
|
@ -1448,11 +1460,15 @@ bool ChatHandler::HandleAchievementRemoveCommand(char* args)
|
||||||
|
|
||||||
Player* target;
|
Player* target;
|
||||||
if (!ExtractPlayerTarget(&nameStr, &target))
|
if (!ExtractPlayerTarget(&nameStr, &target))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 achId;
|
uint32 achId;
|
||||||
if (!ExtractUint32KeyFromLink(&args, "Hachievement", achId))
|
if (!ExtractUint32KeyFromLink(&args, "Hachievement", achId))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
AchievementEntry const* achEntry = sAchievementStore.LookupEntry(achId);
|
AchievementEntry const* achEntry = sAchievementStore.LookupEntry(achId);
|
||||||
if (!achEntry)
|
if (!achEntry)
|
||||||
|
|
@ -1484,10 +1500,14 @@ bool ChatHandler::HandleAchievementCriteriaAddCommand(char* args)
|
||||||
// maybe player first
|
// maybe player first
|
||||||
char* nameStr = ExtractArg(&args);
|
char* nameStr = ExtractArg(&args);
|
||||||
if (!ExtractPlayerTarget(&nameStr, &target))
|
if (!ExtractPlayerTarget(&nameStr, &target))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!ExtractUint32KeyFromLink(&args, "Hachievement_criteria", criId))
|
if (!ExtractUint32KeyFromLink(&args, "Hachievement_criteria", criId))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
target = getSelectedPlayer();
|
target = getSelectedPlayer();
|
||||||
|
|
@ -1502,7 +1522,9 @@ bool ChatHandler::HandleAchievementCriteriaAddCommand(char* args)
|
||||||
|
|
||||||
AchievementEntry const* achEntry = sAchievementStore.LookupEntry(criEntry->referredAchievement);
|
AchievementEntry const* achEntry = sAchievementStore.LookupEntry(criEntry->referredAchievement);
|
||||||
if (!achEntry)
|
if (!achEntry)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
LocaleConstant loc = GetSessionDbcLocale();
|
LocaleConstant loc = GetSessionDbcLocale();
|
||||||
|
|
||||||
|
|
@ -1523,7 +1545,9 @@ bool ChatHandler::HandleAchievementCriteriaAddCommand(char* args)
|
||||||
|
|
||||||
uint32 val;
|
uint32 val;
|
||||||
if (!ExtractOptUInt32(&args, val, maxValue ? maxValue : 1))
|
if (!ExtractOptUInt32(&args, val, maxValue ? maxValue : 1))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 new_val;
|
uint32 new_val;
|
||||||
|
|
||||||
|
|
@ -1551,10 +1575,14 @@ bool ChatHandler::HandleAchievementCriteriaRemoveCommand(char* args)
|
||||||
// maybe player first
|
// maybe player first
|
||||||
char* nameStr = ExtractArg(&args);
|
char* nameStr = ExtractArg(&args);
|
||||||
if (!ExtractPlayerTarget(&nameStr, &target))
|
if (!ExtractPlayerTarget(&nameStr, &target))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!ExtractUint32KeyFromLink(&args, "Hachievement_criteria", criId))
|
if (!ExtractUint32KeyFromLink(&args, "Hachievement_criteria", criId))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
target = getSelectedPlayer();
|
target = getSelectedPlayer();
|
||||||
|
|
@ -1569,7 +1597,9 @@ bool ChatHandler::HandleAchievementCriteriaRemoveCommand(char* args)
|
||||||
|
|
||||||
AchievementEntry const* achEntry = sAchievementStore.LookupEntry(criEntry->referredAchievement);
|
AchievementEntry const* achEntry = sAchievementStore.LookupEntry(criEntry->referredAchievement);
|
||||||
if (!achEntry)
|
if (!achEntry)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
LocaleConstant loc = GetSessionDbcLocale();
|
LocaleConstant loc = GetSessionDbcLocale();
|
||||||
|
|
||||||
|
|
@ -1590,7 +1620,9 @@ bool ChatHandler::HandleAchievementCriteriaRemoveCommand(char* args)
|
||||||
|
|
||||||
uint32 change;
|
uint32 change;
|
||||||
if (!ExtractOptUInt32(&args, change, maxValue ? maxValue : 1))
|
if (!ExtractOptUInt32(&args, change, maxValue ? maxValue : 1))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 newval = change < progress ? progress - change : 0;
|
uint32 newval = change < progress ? progress - change : 0;
|
||||||
|
|
||||||
|
|
@ -1723,7 +1755,9 @@ bool ChatHandler::HandleUnLearnCommand(char* args)
|
||||||
target->removeSpell(spell_id, false, !allRanks);
|
target->removeSpell(spell_id, false, !allRanks);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ SendSysMessage(LANG_FORGET_SPELL); }
|
{
|
||||||
|
SendSysMessage(LANG_FORGET_SPELL);
|
||||||
|
}
|
||||||
|
|
||||||
if (GetTalentSpellCost(spell_id))
|
if (GetTalentSpellCost(spell_id))
|
||||||
target->SendTalentsInfoData(false);
|
target->SendTalentsInfoData(false);
|
||||||
|
|
@ -2721,7 +2755,9 @@ bool ChatHandler::HandleLearnCommand(char* args)
|
||||||
targetPlayer->learnSpellHighRank(spell);
|
targetPlayer->learnSpellHighRank(spell);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ targetPlayer->learnSpell(spell, false); }
|
{
|
||||||
|
targetPlayer->learnSpell(spell, false);
|
||||||
|
}
|
||||||
|
|
||||||
uint32 first_spell = sSpellMgr.GetFirstSpellInChain(spell);
|
uint32 first_spell = sSpellMgr.GetFirstSpellInChain(spell);
|
||||||
if (GetTalentSpellCost(first_spell))
|
if (GetTalentSpellCost(first_spell))
|
||||||
|
|
@ -2969,11 +3005,17 @@ bool ChatHandler::HandleListItemCommand(char* args)
|
||||||
item_pos = "[equipped]";
|
item_pos = "[equipped]";
|
||||||
}
|
}
|
||||||
else if (Player::IsInventoryPos(item_bag, item_slot))
|
else if (Player::IsInventoryPos(item_bag, item_slot))
|
||||||
{ item_pos = "[in inventory]"; }
|
{
|
||||||
|
item_pos = "[in inventory]";
|
||||||
|
}
|
||||||
else if (Player::IsBankPos(item_bag, item_slot))
|
else if (Player::IsBankPos(item_bag, item_slot))
|
||||||
{ item_pos = "[in bank]"; }
|
{
|
||||||
|
item_pos = "[in bank]";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ item_pos = ""; }
|
{
|
||||||
|
item_pos = "";
|
||||||
|
}
|
||||||
|
|
||||||
PSendSysMessage(LANG_ITEMLIST_SLOT,
|
PSendSysMessage(LANG_ITEMLIST_SLOT,
|
||||||
item_guid, owner_name.c_str(), owner_guid, owner_acc, item_pos);
|
item_guid, owner_name.c_str(), owner_guid, owner_acc, item_pos);
|
||||||
|
|
@ -2989,7 +3031,9 @@ bool ChatHandler::HandleListItemCommand(char* args)
|
||||||
count -= res_count;
|
count -= res_count;
|
||||||
}
|
}
|
||||||
else if (count)
|
else if (count)
|
||||||
{ count = 0; }
|
{
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// mail case
|
// mail case
|
||||||
|
|
@ -3011,7 +3055,9 @@ bool ChatHandler::HandleListItemCommand(char* args)
|
||||||
item_id, uint32(count));
|
item_id, uint32(count));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ result = NULL; }
|
{
|
||||||
|
result = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
|
@ -3042,7 +3088,9 @@ bool ChatHandler::HandleListItemCommand(char* args)
|
||||||
count -= res_count;
|
count -= res_count;
|
||||||
}
|
}
|
||||||
else if (count)
|
else if (count)
|
||||||
{ count = 0; }
|
{
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// auction case
|
// auction case
|
||||||
|
|
@ -3063,7 +3111,9 @@ bool ChatHandler::HandleListItemCommand(char* args)
|
||||||
item_id, uint32(count));
|
item_id, uint32(count));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ result = NULL; }
|
{
|
||||||
|
result = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
|
@ -3202,7 +3252,9 @@ bool ChatHandler::HandleListObjectCommand(char* args)
|
||||||
PSendSysMessage(LANG_GO_LIST_CHAT, guid, PrepareStringNpcOrGoSpawnInformation<GameObject>(guid).c_str(), guid, gInfo->name, x, y, z, mapid);
|
PSendSysMessage(LANG_GO_LIST_CHAT, guid, PrepareStringNpcOrGoSpawnInformation<GameObject>(guid).c_str(), guid, gInfo->name, x, y, z, mapid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ PSendSysMessage(LANG_GO_LIST_CONSOLE, guid, PrepareStringNpcOrGoSpawnInformation<GameObject>(guid).c_str(), gInfo->name, x, y, z, mapid); }
|
{
|
||||||
|
PSendSysMessage(LANG_GO_LIST_CONSOLE, guid, PrepareStringNpcOrGoSpawnInformation<GameObject>(guid).c_str(), gInfo->name, x, y, z, mapid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while (result->NextRow());
|
while (result->NextRow());
|
||||||
|
|
||||||
|
|
@ -3279,7 +3331,9 @@ bool ChatHandler::HandleListCreatureCommand(char* args)
|
||||||
PSendSysMessage(LANG_CREATURE_LIST_CHAT, guid, PrepareStringNpcOrGoSpawnInformation<Creature>(guid).c_str(), guid, cInfo->Name, x, y, z, mapid);
|
PSendSysMessage(LANG_CREATURE_LIST_CHAT, guid, PrepareStringNpcOrGoSpawnInformation<Creature>(guid).c_str(), guid, cInfo->Name, x, y, z, mapid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ PSendSysMessage(LANG_CREATURE_LIST_CONSOLE, guid, PrepareStringNpcOrGoSpawnInformation<Creature>(guid).c_str(), cInfo->Name, x, y, z, mapid); }
|
{
|
||||||
|
PSendSysMessage(LANG_CREATURE_LIST_CONSOLE, guid, PrepareStringNpcOrGoSpawnInformation<Creature>(guid).c_str(), cInfo->Name, x, y, z, mapid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while (result->NextRow());
|
while (result->NextRow());
|
||||||
|
|
||||||
|
|
@ -3317,7 +3371,9 @@ void ChatHandler::ShowItemListHelper(uint32 itemId, int loc_idx, Player* target
|
||||||
PSendSysMessage(LANG_ITEM_LIST_CHAT, itemId, itemId, name.c_str(), usableStr);
|
PSendSysMessage(LANG_ITEM_LIST_CHAT, itemId, itemId, name.c_str(), usableStr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ PSendSysMessage(LANG_ITEM_LIST_CONSOLE, itemId, name.c_str(), usableStr); }
|
{
|
||||||
|
PSendSysMessage(LANG_ITEM_LIST_CONSOLE, itemId, name.c_str(), usableStr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChatHandler::HandleLookupItemCommand(char* args)
|
bool ChatHandler::HandleLookupItemCommand(char* args)
|
||||||
|
|
@ -3436,7 +3492,9 @@ bool ChatHandler::HandleLookupItemSetCommand(char* args)
|
||||||
PSendSysMessage(LANG_ITEMSET_LIST_CHAT, id, id, name.c_str(), localeNames[loc]);
|
PSendSysMessage(LANG_ITEMSET_LIST_CHAT, id, id, name.c_str(), localeNames[loc]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ PSendSysMessage(LANG_ITEMSET_LIST_CONSOLE, id, name.c_str(), localeNames[loc]); }
|
{
|
||||||
|
PSendSysMessage(LANG_ITEMSET_LIST_CONSOLE, id, name.c_str(), localeNames[loc]);
|
||||||
|
}
|
||||||
++counter;
|
++counter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3529,7 +3587,9 @@ bool ChatHandler::HandleLookupSkillCommand(char* args)
|
||||||
PSendSysMessage(LANG_SKILL_LIST_CHAT, id, id, name.c_str(), localeNames[loc], knownStr, valStr);
|
PSendSysMessage(LANG_SKILL_LIST_CHAT, id, id, name.c_str(), localeNames[loc], knownStr, valStr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ PSendSysMessage(LANG_SKILL_LIST_CONSOLE, id, name.c_str(), localeNames[loc], knownStr, valStr); }
|
{
|
||||||
|
PSendSysMessage(LANG_SKILL_LIST_CONSOLE, id, name.c_str(), localeNames[loc], knownStr, valStr);
|
||||||
|
}
|
||||||
|
|
||||||
++counter;
|
++counter;
|
||||||
}
|
}
|
||||||
|
|
@ -3593,7 +3653,9 @@ void ChatHandler::ShowSpellListHelper(Player* target, SpellEntry const* spellInf
|
||||||
ss << id << " - |cffffffff|Hspell:" << id << "|h[" << spellInfo->SpellName[loc];
|
ss << id << " - |cffffffff|Hspell:" << id << "|h[" << spellInfo->SpellName[loc];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ ss << id << " - " << spellInfo->SpellName[loc]; }
|
{
|
||||||
|
ss << id << " - " << spellInfo->SpellName[loc];
|
||||||
|
}
|
||||||
|
|
||||||
// include rank in link name
|
// include rank in link name
|
||||||
if (rank)
|
if (rank)
|
||||||
|
|
@ -3606,7 +3668,9 @@ void ChatHandler::ShowSpellListHelper(Player* target, SpellEntry const* spellInf
|
||||||
ss << " " << localeNames[loc] << "]|h|r";
|
ss << " " << localeNames[loc] << "]|h|r";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ ss << " " << localeNames[loc]; }
|
{
|
||||||
|
ss << " " << localeNames[loc];
|
||||||
|
}
|
||||||
|
|
||||||
if (talent)
|
if (talent)
|
||||||
{
|
{
|
||||||
|
|
@ -3635,7 +3699,9 @@ void ChatHandler::ShowSpellListHelper(Player* target, SpellEntry const* spellInf
|
||||||
bool ChatHandler::HandleLookupCurrencyCommand(char* args)
|
bool ChatHandler::HandleLookupCurrencyCommand(char* args)
|
||||||
{
|
{
|
||||||
if (!*args)
|
if (!*args)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// can be NULL at console call
|
// can be NULL at console call
|
||||||
Player* target = getSelectedPlayer();
|
Player* target = getSelectedPlayer();
|
||||||
|
|
@ -3644,7 +3710,9 @@ bool ChatHandler::HandleLookupCurrencyCommand(char* args)
|
||||||
std::wstring wnamepart;
|
std::wstring wnamepart;
|
||||||
|
|
||||||
if (!Utf8toWStr(namepart, wnamepart))
|
if (!Utf8toWStr(namepart, wnamepart))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// converting string that we try to find to lower case
|
// converting string that we try to find to lower case
|
||||||
wstrToLower(wnamepart);
|
wstrToLower(wnamepart);
|
||||||
|
|
@ -3792,10 +3860,14 @@ void ChatHandler::ShowQuestListHelper(uint32 questId, int32 loc_idx, Player* tar
|
||||||
statusStr = GetMangosString(LANG_COMMAND_QUEST_REWARDED);
|
statusStr = GetMangosString(LANG_COMMAND_QUEST_REWARDED);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ statusStr = GetMangosString(LANG_COMMAND_QUEST_COMPLETE); }
|
{
|
||||||
|
statusStr = GetMangosString(LANG_COMMAND_QUEST_COMPLETE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (status == QUEST_STATUS_INCOMPLETE)
|
else if (status == QUEST_STATUS_INCOMPLETE)
|
||||||
{ statusStr = GetMangosString(LANG_COMMAND_QUEST_ACTIVE); }
|
{
|
||||||
|
statusStr = GetMangosString(LANG_COMMAND_QUEST_ACTIVE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_session)
|
if (m_session)
|
||||||
|
|
@ -3803,7 +3875,9 @@ void ChatHandler::ShowQuestListHelper(uint32 questId, int32 loc_idx, Player* tar
|
||||||
PSendSysMessage(LANG_QUEST_LIST_CHAT, qinfo->GetQuestId(), qinfo->GetQuestId(), qinfo->GetQuestLevel(), title.c_str(), statusStr);
|
PSendSysMessage(LANG_QUEST_LIST_CHAT, qinfo->GetQuestId(), qinfo->GetQuestId(), qinfo->GetQuestLevel(), title.c_str(), statusStr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ PSendSysMessage(LANG_QUEST_LIST_CONSOLE, qinfo->GetQuestId(), title.c_str(), statusStr); }
|
{
|
||||||
|
PSendSysMessage(LANG_QUEST_LIST_CONSOLE, qinfo->GetQuestId(), title.c_str(), statusStr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChatHandler::HandleLookupQuestCommand(char* args)
|
bool ChatHandler::HandleLookupQuestCommand(char* args)
|
||||||
|
|
@ -3902,7 +3976,9 @@ bool ChatHandler::HandleLookupCreatureCommand(char* args)
|
||||||
PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name);
|
PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CHAT, id, id, name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name); }
|
{
|
||||||
|
PSendSysMessage(LANG_CREATURE_ENTRY_LIST_CONSOLE, id, name);
|
||||||
|
}
|
||||||
|
|
||||||
++counter;
|
++counter;
|
||||||
}
|
}
|
||||||
|
|
@ -3954,7 +4030,9 @@ bool ChatHandler::HandleLookupObjectCommand(char* args)
|
||||||
PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, itr->id, itr->id, name.c_str());
|
PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, itr->id, itr->id, name.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, itr->id, name.c_str()); }
|
{
|
||||||
|
PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, itr->id, name.c_str());
|
||||||
|
}
|
||||||
++counter;
|
++counter;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -3975,7 +4053,9 @@ bool ChatHandler::HandleLookupObjectCommand(char* args)
|
||||||
PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, itr->id, itr->id, name.c_str());
|
PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, itr->id, itr->id, name.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, itr->id, name.c_str()); }
|
{
|
||||||
|
PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, itr->id, name.c_str());
|
||||||
|
}
|
||||||
++counter;
|
++counter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4417,19 +4497,27 @@ bool ChatHandler::HandleDamageCommand(char* args)
|
||||||
bool ChatHandler::HandleModifyCurrencyCommand(char* args)
|
bool ChatHandler::HandleModifyCurrencyCommand(char* args)
|
||||||
{
|
{
|
||||||
if (!*args)
|
if (!*args)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 currencyId;
|
uint32 currencyId;
|
||||||
if (!ExtractUint32KeyFromLink(&args, "Hcurrency", currencyId))
|
if (!ExtractUint32KeyFromLink(&args, "Hcurrency", currencyId))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
CurrencyTypesEntry const * entry = sCurrencyTypesStore.LookupEntry(currencyId);
|
CurrencyTypesEntry const * entry = sCurrencyTypesStore.LookupEntry(currencyId);
|
||||||
if (!entry)
|
if (!entry)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int32 amount;
|
int32 amount;
|
||||||
if (!ExtractInt32(&args, amount))
|
if (!ExtractInt32(&args, amount))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Player* target = getSelectedPlayer();
|
Player* target = getSelectedPlayer();
|
||||||
if (!target)
|
if (!target)
|
||||||
|
|
@ -4565,11 +4653,17 @@ bool ChatHandler::HandleLinkGraveCommand(char* args)
|
||||||
g_team = TEAM_BOTH_ALLOWED;
|
g_team = TEAM_BOTH_ALLOWED;
|
||||||
}
|
}
|
||||||
else if (strncmp(teamStr, "horde", strlen(teamStr)) == 0)
|
else if (strncmp(teamStr, "horde", strlen(teamStr)) == 0)
|
||||||
{ g_team = HORDE; }
|
{
|
||||||
|
g_team = HORDE;
|
||||||
|
}
|
||||||
else if (strncmp(teamStr, "alliance", strlen(teamStr)) == 0)
|
else if (strncmp(teamStr, "alliance", strlen(teamStr)) == 0)
|
||||||
{ g_team = ALLIANCE; }
|
{
|
||||||
|
g_team = ALLIANCE;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
WorldSafeLocsEntry const* graveyard = sWorldSafeLocsStore.LookupEntry(g_id);
|
WorldSafeLocsEntry const* graveyard = sWorldSafeLocsStore.LookupEntry(g_id);
|
||||||
if (!graveyard)
|
if (!graveyard)
|
||||||
|
|
@ -4596,7 +4690,9 @@ bool ChatHandler::HandleLinkGraveCommand(char* args)
|
||||||
PSendSysMessage(LANG_COMMAND_GRAVEYARDLINKED, g_id, zoneId);
|
PSendSysMessage(LANG_COMMAND_GRAVEYARDLINKED, g_id, zoneId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ PSendSysMessage(LANG_COMMAND_GRAVEYARDALRLINKED, g_id, zoneId); }
|
{
|
||||||
|
PSendSysMessage(LANG_COMMAND_GRAVEYARDALRLINKED, g_id, zoneId);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -4612,11 +4708,17 @@ bool ChatHandler::HandleNearGraveCommand(char* args)
|
||||||
g_team = TEAM_BOTH_ALLOWED;
|
g_team = TEAM_BOTH_ALLOWED;
|
||||||
}
|
}
|
||||||
else if (strncmp(args, "horde", argslen) == 0)
|
else if (strncmp(args, "horde", argslen) == 0)
|
||||||
{ g_team = HORDE; }
|
{
|
||||||
|
g_team = HORDE;
|
||||||
|
}
|
||||||
else if (strncmp(args, "alliance", argslen) == 0)
|
else if (strncmp(args, "alliance", argslen) == 0)
|
||||||
{ g_team = ALLIANCE; }
|
{
|
||||||
|
g_team = ALLIANCE;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Player* player = m_session->GetPlayer();
|
Player* player = m_session->GetPlayer();
|
||||||
uint32 zone_id = player->GetZoneId();
|
uint32 zone_id = player->GetZoneId();
|
||||||
|
|
@ -4642,11 +4744,17 @@ bool ChatHandler::HandleNearGraveCommand(char* args)
|
||||||
team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_ANY);
|
team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_ANY);
|
||||||
}
|
}
|
||||||
else if (data->team == HORDE)
|
else if (data->team == HORDE)
|
||||||
{ team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_HORDE); }
|
{
|
||||||
|
team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_HORDE);
|
||||||
|
}
|
||||||
else if (data->team == ALLIANCE)
|
else if (data->team == ALLIANCE)
|
||||||
{ team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_ALLIANCE); }
|
{
|
||||||
|
team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_ALLIANCE);
|
||||||
|
}
|
||||||
else // Actually, this case can not happen
|
else // Actually, this case can not happen
|
||||||
{ team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_NOTEAM); }
|
{
|
||||||
|
team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_NOTEAM);
|
||||||
|
}
|
||||||
|
|
||||||
PSendSysMessage(LANG_COMMAND_GRAVEYARDNEAREST, g_id, team_name.c_str(), zone_id);
|
PSendSysMessage(LANG_COMMAND_GRAVEYARDNEAREST, g_id, team_name.c_str(), zone_id);
|
||||||
}
|
}
|
||||||
|
|
@ -4659,16 +4767,22 @@ bool ChatHandler::HandleNearGraveCommand(char* args)
|
||||||
team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_ANY);
|
team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_ANY);
|
||||||
}
|
}
|
||||||
else if (g_team == HORDE)
|
else if (g_team == HORDE)
|
||||||
{ team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_HORDE); }
|
{
|
||||||
|
team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_HORDE);
|
||||||
|
}
|
||||||
else if (g_team == ALLIANCE)
|
else if (g_team == ALLIANCE)
|
||||||
{ team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_ALLIANCE); }
|
{
|
||||||
|
team_name = GetMangosString(LANG_COMMAND_GRAVEYARD_ALLIANCE);
|
||||||
|
}
|
||||||
|
|
||||||
if (g_team == TEAM_BOTH_ALLOWED)
|
if (g_team == TEAM_BOTH_ALLOWED)
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_COMMAND_ZONENOGRAVEYARDS, zone_id);
|
PSendSysMessage(LANG_COMMAND_ZONENOGRAVEYARDS, zone_id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ PSendSysMessage(LANG_COMMAND_ZONENOGRAFACTION, zone_id, team_name.c_str()); }
|
{
|
||||||
|
PSendSysMessage(LANG_COMMAND_ZONENOGRAFACTION, zone_id, team_name.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -4716,7 +4830,9 @@ bool ChatHandler::HandleNpcChangeEntryCommand(char* args)
|
||||||
SendSysMessage(LANG_DONE);
|
SendSysMessage(LANG_DONE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ SendSysMessage(LANG_ERROR); }
|
{
|
||||||
|
SendSysMessage(LANG_ERROR);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4823,11 +4939,15 @@ bool ChatHandler::HandleNpcAddWeaponCommand(char* /*args*/)
|
||||||
|
|
||||||
char* pSlotID = strtok((char*)args, " ");
|
char* pSlotID = strtok((char*)args, " ");
|
||||||
if (!pSlotID)
|
if (!pSlotID)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
char* pItemID = strtok(NULL, " ");
|
char* pItemID = strtok(NULL, " ");
|
||||||
if (!pItemID)
|
if (!pItemID)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 ItemID = atoi(pItemID);
|
uint32 ItemID = atoi(pItemID);
|
||||||
uint32 SlotID = atoi(pSlotID);
|
uint32 SlotID = atoi(pSlotID);
|
||||||
|
|
@ -4934,9 +5054,13 @@ void ChatHandler::HandleCharacterLevel(Player* player, ObjectGuid player_guid, u
|
||||||
ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_PROGRESS_RESET, GetNameLink().c_str());
|
ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_PROGRESS_RESET, GetNameLink().c_str());
|
||||||
}
|
}
|
||||||
else if (oldlevel < newlevel)
|
else if (oldlevel < newlevel)
|
||||||
{ ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_UP, GetNameLink().c_str(), newlevel); }
|
{
|
||||||
|
ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_UP, GetNameLink().c_str(), newlevel);
|
||||||
|
}
|
||||||
else // if(oldlevel > newlevel)
|
else // if(oldlevel > newlevel)
|
||||||
{ ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_DOWN, GetNameLink().c_str(), newlevel); }
|
{
|
||||||
|
ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_DOWN, GetNameLink().c_str(), newlevel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -4966,7 +5090,9 @@ bool ChatHandler::HandleCharacterLevelCommand(char* args)
|
||||||
nolevel = true;
|
nolevel = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Player* target;
|
Player* target;
|
||||||
|
|
@ -5019,7 +5145,9 @@ bool ChatHandler::HandleLevelUpCommand(char* args)
|
||||||
nameStr = ExtractArg(&args);
|
nameStr = ExtractArg(&args);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5192,11 +5320,17 @@ bool ChatHandler::HandleAuctionItemCommand(char* args)
|
||||||
houseid = 1;
|
houseid = 1;
|
||||||
}
|
}
|
||||||
else if (strncmp(typeStr, "horde", strlen(typeStr)) == 0)
|
else if (strncmp(typeStr, "horde", strlen(typeStr)) == 0)
|
||||||
{ houseid = 6; }
|
{
|
||||||
|
houseid = 6;
|
||||||
|
}
|
||||||
else if (strncmp(typeStr, "goblin", strlen(typeStr)) == 0)
|
else if (strncmp(typeStr, "goblin", strlen(typeStr)) == 0)
|
||||||
{ houseid = 7; }
|
{
|
||||||
|
houseid = 7;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// parse item str
|
// parse item str
|
||||||
char* itemStr = ExtractArg(&args);
|
char* itemStr = ExtractArg(&args);
|
||||||
|
|
@ -5233,11 +5367,17 @@ bool ChatHandler::HandleAuctionItemCommand(char* args)
|
||||||
etime = 1 * MIN_AUCTION_TIME;
|
etime = 1 * MIN_AUCTION_TIME;
|
||||||
}
|
}
|
||||||
else if (strncmp(timeStr, "long", strlen(timeStr)) == 0)
|
else if (strncmp(timeStr, "long", strlen(timeStr)) == 0)
|
||||||
{ etime = 2 * MIN_AUCTION_TIME; }
|
{
|
||||||
|
etime = 2 * MIN_AUCTION_TIME;
|
||||||
|
}
|
||||||
else if (strncmp(timeStr, "verylong", strlen(timeStr)) == 0)
|
else if (strncmp(timeStr, "verylong", strlen(timeStr)) == 0)
|
||||||
{ etime = 4 * MIN_AUCTION_TIME; }
|
{
|
||||||
|
etime = 4 * MIN_AUCTION_TIME;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AuctionHouseEntry const* auctionHouseEntry = sAuctionHouseStore.LookupEntry(houseid);
|
AuctionHouseEntry const* auctionHouseEntry = sAuctionHouseStore.LookupEntry(houseid);
|
||||||
|
|
@ -5543,7 +5683,9 @@ bool ChatHandler::HandleResetAchievementsCommand(char* args)
|
||||||
Player* target;
|
Player* target;
|
||||||
ObjectGuid target_guid;
|
ObjectGuid target_guid;
|
||||||
if (!ExtractPlayerTarget(&args, &target, &target_guid))
|
if (!ExtractPlayerTarget(&args, &target, &target_guid))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (target)
|
if (target)
|
||||||
target->GetAchievementMgr().Reset();
|
target->GetAchievementMgr().Reset();
|
||||||
|
|
@ -5844,7 +5986,9 @@ bool ChatHandler::HandleServerShutDownCommand(char* args)
|
||||||
{
|
{
|
||||||
uint32 delay;
|
uint32 delay;
|
||||||
if (!ExtractUInt32(&args, delay))
|
if (!ExtractUInt32(&args, delay))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 exitcode;
|
uint32 exitcode;
|
||||||
if (!ExtractOptUInt32(&args, exitcode, SHUTDOWN_EXIT_CODE))
|
if (!ExtractOptUInt32(&args, exitcode, SHUTDOWN_EXIT_CODE))
|
||||||
|
|
@ -6232,7 +6376,9 @@ bool ChatHandler::HandleBanHelper(BanMode mode, char* args)
|
||||||
PSendSysMessage(LANG_BAN_YOUBANNED, nameOrIP.c_str(), secsToTimeString(duration_secs, true).c_str(), reason);
|
PSendSysMessage(LANG_BAN_YOUBANNED, nameOrIP.c_str(), secsToTimeString(duration_secs, true).c_str(), reason);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ PSendSysMessage(LANG_BAN_YOUPERMBANNED, nameOrIP.c_str(), reason); }
|
{
|
||||||
|
PSendSysMessage(LANG_BAN_YOUPERMBANNED, nameOrIP.c_str(), reason);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case BAN_SYNTAX_ERROR:
|
case BAN_SYNTAX_ERROR:
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -6317,7 +6463,9 @@ bool ChatHandler::HandleUnBanHelper(BanMode mode, char* args)
|
||||||
PSendSysMessage(LANG_UNBAN_UNBANNED, nameOrIP.c_str());
|
PSendSysMessage(LANG_UNBAN_UNBANNED, nameOrIP.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ PSendSysMessage(LANG_UNBAN_ERROR, nameOrIP.c_str()); }
|
{
|
||||||
|
PSendSysMessage(LANG_UNBAN_ERROR, nameOrIP.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -6524,7 +6672,9 @@ bool ChatHandler::HandleBanListHelper(QueryResult* result)
|
||||||
}
|
}
|
||||||
// "character" case, name need extract from another DB
|
// "character" case, name need extract from another DB
|
||||||
else
|
else
|
||||||
{ sAccountMgr.GetName(account_id, account_name); }
|
{
|
||||||
|
sAccountMgr.GetName(account_id, account_name);
|
||||||
|
}
|
||||||
|
|
||||||
// No SQL injection. id is uint32.
|
// No SQL injection. id is uint32.
|
||||||
QueryResult* banInfo = LoginDatabase.PQuery("SELECT bandate,unbandate,bannedby,banreason FROM account_banned WHERE id = %u ORDER BY unbandate", account_id);
|
QueryResult* banInfo = LoginDatabase.PQuery("SELECT bandate,unbandate,bannedby,banreason FROM account_banned WHERE id = %u ORDER BY unbandate", account_id);
|
||||||
|
|
@ -6817,7 +6967,9 @@ bool ChatHandler::HandlePDumpWriteCommand(char* args)
|
||||||
lowguid = guid.GetCounter();
|
lowguid = guid.GetCounter();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ guid = ObjectGuid(HIGHGUID_PLAYER, lowguid); }
|
{
|
||||||
|
guid = ObjectGuid(HIGHGUID_PLAYER, lowguid);
|
||||||
|
}
|
||||||
|
|
||||||
if (!sObjectMgr.GetPlayerAccountIdByGUID(guid))
|
if (!sObjectMgr.GetPlayerAccountIdByGUID(guid))
|
||||||
{
|
{
|
||||||
|
|
@ -6876,16 +7028,22 @@ bool ChatHandler::HandleMovegensCommand(char* /*args*/)
|
||||||
target = static_cast<ChaseMovementGenerator<Player> const*>(*itr)->GetTarget();
|
target = static_cast<ChaseMovementGenerator<Player> const*>(*itr)->GetTarget();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ target = static_cast<ChaseMovementGenerator<Creature> const*>(*itr)->GetTarget(); }
|
{
|
||||||
|
target = static_cast<ChaseMovementGenerator<Creature> const*>(*itr)->GetTarget();
|
||||||
|
}
|
||||||
|
|
||||||
if (!target)
|
if (!target)
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_MOVEGENS_CHASE_NULL);
|
SendSysMessage(LANG_MOVEGENS_CHASE_NULL);
|
||||||
}
|
}
|
||||||
else if (target->GetTypeId() == TYPEID_PLAYER)
|
else if (target->GetTypeId() == TYPEID_PLAYER)
|
||||||
{ PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName(), target->GetGUIDLow()); }
|
{
|
||||||
|
PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName(), target->GetGUIDLow());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ PSendSysMessage(LANG_MOVEGENS_CHASE_CREATURE, target->GetName(), target->GetGUIDLow()); }
|
{
|
||||||
|
PSendSysMessage(LANG_MOVEGENS_CHASE_CREATURE, target->GetName(), target->GetGUIDLow());
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FOLLOW_MOTION_TYPE:
|
case FOLLOW_MOTION_TYPE:
|
||||||
|
|
@ -6896,16 +7054,22 @@ bool ChatHandler::HandleMovegensCommand(char* /*args*/)
|
||||||
target = static_cast<FollowMovementGenerator<Player> const*>(*itr)->GetTarget();
|
target = static_cast<FollowMovementGenerator<Player> const*>(*itr)->GetTarget();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ target = static_cast<FollowMovementGenerator<Creature> const*>(*itr)->GetTarget(); }
|
{
|
||||||
|
target = static_cast<FollowMovementGenerator<Creature> const*>(*itr)->GetTarget();
|
||||||
|
}
|
||||||
|
|
||||||
if (!target)
|
if (!target)
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_MOVEGENS_FOLLOW_NULL);
|
SendSysMessage(LANG_MOVEGENS_FOLLOW_NULL);
|
||||||
}
|
}
|
||||||
else if (target->GetTypeId() == TYPEID_PLAYER)
|
else if (target->GetTypeId() == TYPEID_PLAYER)
|
||||||
{ PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName(), target->GetGUIDLow()); }
|
{
|
||||||
|
PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName(), target->GetGUIDLow());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ PSendSysMessage(LANG_MOVEGENS_FOLLOW_CREATURE, target->GetName(), target->GetGUIDLow()); }
|
{
|
||||||
|
PSendSysMessage(LANG_MOVEGENS_FOLLOW_CREATURE, target->GetName(), target->GetGUIDLow());
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case HOME_MOTION_TYPE:
|
case HOME_MOTION_TYPE:
|
||||||
|
|
@ -6914,7 +7078,9 @@ bool ChatHandler::HandleMovegensCommand(char* /*args*/)
|
||||||
PSendSysMessage(LANG_MOVEGENS_HOME_CREATURE, x, y, z);
|
PSendSysMessage(LANG_MOVEGENS_HOME_CREATURE, x, y, z);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ SendSysMessage(LANG_MOVEGENS_HOME_PLAYER); }
|
{
|
||||||
|
SendSysMessage(LANG_MOVEGENS_HOME_PLAYER);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case FLIGHT_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_FLIGHT); break;
|
case FLIGHT_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_FLIGHT); break;
|
||||||
case POINT_MOTION_TYPE:
|
case POINT_MOTION_TYPE:
|
||||||
|
|
@ -6951,13 +7117,21 @@ bool ChatHandler::HandleServerPLimitCommand(char* args)
|
||||||
sWorld.SetPlayerLimit(-SEC_PLAYER);
|
sWorld.SetPlayerLimit(-SEC_PLAYER);
|
||||||
}
|
}
|
||||||
else if (strncmp(param, "moderator", l) == 0)
|
else if (strncmp(param, "moderator", l) == 0)
|
||||||
{ sWorld.SetPlayerLimit(-SEC_MODERATOR); }
|
{
|
||||||
|
sWorld.SetPlayerLimit(-SEC_MODERATOR);
|
||||||
|
}
|
||||||
else if (strncmp(param, "gamemaster", l) == 0)
|
else if (strncmp(param, "gamemaster", l) == 0)
|
||||||
{ sWorld.SetPlayerLimit(-SEC_GAMEMASTER); }
|
{
|
||||||
|
sWorld.SetPlayerLimit(-SEC_GAMEMASTER);
|
||||||
|
}
|
||||||
else if (strncmp(param, "administrator", l) == 0)
|
else if (strncmp(param, "administrator", l) == 0)
|
||||||
{ sWorld.SetPlayerLimit(-SEC_ADMINISTRATOR); }
|
{
|
||||||
|
sWorld.SetPlayerLimit(-SEC_ADMINISTRATOR);
|
||||||
|
}
|
||||||
else if (strncmp(param, "reset", l) == 0)
|
else if (strncmp(param, "reset", l) == 0)
|
||||||
{ sWorld.SetPlayerLimit(sConfig.GetIntDefault("PlayerLimit", DEFAULT_PLAYER_LIMIT)); }
|
{
|
||||||
|
sWorld.SetPlayerLimit(sConfig.GetIntDefault("PlayerLimit", DEFAULT_PLAYER_LIMIT));
|
||||||
|
}
|
||||||
else if (ExtractInt32(¶m, val))
|
else if (ExtractInt32(¶m, val))
|
||||||
{
|
{
|
||||||
if (val < -SEC_ADMINISTRATOR)
|
if (val < -SEC_ADMINISTRATOR)
|
||||||
|
|
@ -6968,7 +7142,9 @@ bool ChatHandler::HandleServerPLimitCommand(char* args)
|
||||||
sWorld.SetPlayerLimit(val);
|
sWorld.SetPlayerLimit(val);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// kick all low security level players
|
// kick all low security level players
|
||||||
if (sWorld.GetPlayerAmountLimit() > SEC_PLAYER)
|
if (sWorld.GetPlayerAmountLimit() > SEC_PLAYER)
|
||||||
|
|
@ -7398,7 +7574,9 @@ bool ChatHandler::HandleGMListFullCommand(char* /*args*/)
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ PSendSysMessage(LANG_GMLIST_EMPTY); }
|
{
|
||||||
|
PSendSysMessage(LANG_GMLIST_EMPTY);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -7462,7 +7640,9 @@ bool ChatHandler::ShowPlayerListHelper(QueryResult* result, uint32* limit, bool
|
||||||
PSendSysMessage(LANG_CHARACTERS_LIST_LINE_CONSOLE, guid, name.c_str(), race_name, class_name, level);
|
PSendSysMessage(LANG_CHARACTERS_LIST_LINE_CONSOLE, guid, name.c_str(), race_name, class_name, level);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ PSendSysMessage(LANG_CHARACTERS_LIST_LINE_CHAT, guid, name.c_str(), name.c_str(), race_name, class_name, level); }
|
{
|
||||||
|
PSendSysMessage(LANG_CHARACTERS_LIST_LINE_CHAT, guid, name.c_str(), name.c_str(), race_name, class_name, level);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while (result->NextRow());
|
while (result->NextRow());
|
||||||
|
|
||||||
|
|
@ -7941,10 +8121,14 @@ bool ChatHandler::HandleShowGearScoreCommand(char* args)
|
||||||
|
|
||||||
uint32 withBags, withBank;
|
uint32 withBags, withBank;
|
||||||
if (!ExtractOptUInt32(&args, withBags, 1))
|
if (!ExtractOptUInt32(&args, withBags, 1))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!ExtractOptUInt32(&args, withBank, 0))
|
if (!ExtractOptUInt32(&args, withBank, 0))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// always recalculate gear score for display
|
// always recalculate gear score for display
|
||||||
player->ResetCachedGearScore();
|
player->ResetCachedGearScore();
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,9 @@ bool ChatHandler::GetDeletedCharacterInfoList(DeletedInfoList& foundList, std::s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ resultChar = CharacterDatabase.Query("SELECT guid, deleteInfos_Name, deleteInfos_Account, deleteDate FROM characters WHERE deleteDate IS NOT NULL"); }
|
{
|
||||||
|
resultChar = CharacterDatabase.Query("SELECT guid, deleteInfos_Name, deleteInfos_Account, deleteDate FROM characters WHERE deleteDate IS NOT NULL");
|
||||||
|
}
|
||||||
|
|
||||||
if (resultChar)
|
if (resultChar)
|
||||||
{
|
{
|
||||||
|
|
@ -344,7 +346,9 @@ bool ChatHandler::HandleCharacterDeletedRestoreCommand(char* args)
|
||||||
HandleCharacterDeletedRestoreHelper(delInfo);
|
HandleCharacterDeletedRestoreHelper(delInfo);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ SendSysMessage(LANG_CHARACTER_DELETED_ERR_RENAME); }
|
{
|
||||||
|
SendSysMessage(LANG_CHARACTER_DELETED_ERR_RENAME);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -442,7 +446,9 @@ bool ChatHandler::HandleCharacterEraseCommand(char* args)
|
||||||
target->GetSession()->KickPlayer();
|
target->GetSession()->KickPlayer();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ account_id = sObjectMgr.GetPlayerAccountIdByGUID(target_guid); }
|
{
|
||||||
|
account_id = sObjectMgr.GetPlayerAccountIdByGUID(target_guid);
|
||||||
|
}
|
||||||
|
|
||||||
std::string account_name;
|
std::string account_name;
|
||||||
sAccountMgr.GetName(account_id, account_name);
|
sAccountMgr.GetName(account_id, account_name);
|
||||||
|
|
|
||||||
|
|
@ -278,7 +278,9 @@ bool ChatHandler::HandleDebugPlayMovieCommand(char* args)
|
||||||
// #movieid - ID decimal number from Movie.dbc (1st column)
|
// #movieid - ID decimal number from Movie.dbc (1st column)
|
||||||
uint32 dwId;
|
uint32 dwId;
|
||||||
if (!ExtractUInt32(&args, dwId))
|
if (!ExtractUInt32(&args, dwId))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!sMovieStore.LookupEntry(dwId))
|
if (!sMovieStore.LookupEntry(dwId))
|
||||||
{
|
{
|
||||||
|
|
@ -322,7 +324,9 @@ bool ChatHandler::HandleDebugPlaySoundCommand(char* args)
|
||||||
unit->PlayDistanceSound(dwSoundId, m_session->GetPlayer());
|
unit->PlayDistanceSound(dwSoundId, m_session->GetPlayer());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ unit->PlayDirectSound(dwSoundId, m_session->GetPlayer()); }
|
{
|
||||||
|
unit->PlayDirectSound(dwSoundId, m_session->GetPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
PSendSysMessage(LANG_YOU_HEAR_SOUND, dwSoundId);
|
PSendSysMessage(LANG_YOU_HEAR_SOUND, dwSoundId);
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -395,7 +399,9 @@ bool ChatHandler::HandleDebugGetLootRecipientCommand(char* /*args*/)
|
||||||
target->GetLootRecipientGuid().GetString().c_str(),
|
target->GetLootRecipientGuid().GetString().c_str(),
|
||||||
target->GetLootGroupRecipientId());
|
target->GetLootGroupRecipientId());
|
||||||
else
|
else
|
||||||
{ SendSysMessage("loot recipient: offline "); }
|
{
|
||||||
|
SendSysMessage("loot recipient: offline ");
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -440,11 +446,17 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
||||||
state_str = "removed";
|
state_str = "removed";
|
||||||
}
|
}
|
||||||
else if (strncmp(args, "queue", strlen(args)) == 0)
|
else if (strncmp(args, "queue", strlen(args)) == 0)
|
||||||
{ list_queue = true; }
|
{
|
||||||
|
list_queue = true;
|
||||||
|
}
|
||||||
else if (strncmp(args, "all", strlen(args)) == 0)
|
else if (strncmp(args, "all", strlen(args)) == 0)
|
||||||
{ check_all = true; }
|
{
|
||||||
|
check_all = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Player* player = getSelectedPlayer();
|
Player* player = getSelectedPlayer();
|
||||||
if (!player)
|
if (!player)
|
||||||
|
|
@ -755,7 +767,9 @@ bool ChatHandler::HandleDebugSendLargePacketCommand(char* /*args*/)
|
||||||
bool ChatHandler::HandleDebugSendSetPhaseShiftCommand(char* args)
|
bool ChatHandler::HandleDebugSendSetPhaseShiftCommand(char* args)
|
||||||
{
|
{
|
||||||
if (!*args)
|
if (!*args)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
char* m = strtok((char*)args, " ");
|
char* m = strtok((char*)args, " ");
|
||||||
char* p = strtok(NULL, " ");
|
char* p = strtok(NULL, " ");
|
||||||
|
|
@ -836,15 +850,25 @@ bool ChatHandler::HandleSetValueHelper(Object* target, uint32 field, char* typeS
|
||||||
base = 10;
|
base = 10;
|
||||||
}
|
}
|
||||||
else if (strncmp(typeStr, "int", strlen(typeStr)) == 0)
|
else if (strncmp(typeStr, "int", strlen(typeStr)) == 0)
|
||||||
{ base = 10; }
|
{
|
||||||
|
base = 10;
|
||||||
|
}
|
||||||
else if (strncmp(typeStr, "hex", strlen(typeStr)) == 0)
|
else if (strncmp(typeStr, "hex", strlen(typeStr)) == 0)
|
||||||
{ base = 16; }
|
{
|
||||||
|
base = 16;
|
||||||
|
}
|
||||||
else if (strncmp(typeStr, "bit", strlen(typeStr)) == 0)
|
else if (strncmp(typeStr, "bit", strlen(typeStr)) == 0)
|
||||||
{ base = 2; }
|
{
|
||||||
|
base = 2;
|
||||||
|
}
|
||||||
else if (strncmp(typeStr, "float", strlen(typeStr)) == 0)
|
else if (strncmp(typeStr, "float", strlen(typeStr)) == 0)
|
||||||
{ base = 0; }
|
{
|
||||||
|
base = 0;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (base)
|
if (base)
|
||||||
{
|
{
|
||||||
|
|
@ -956,15 +980,25 @@ bool ChatHandler::HandleGetValueHelper(Object* target, uint32 field, char* typeS
|
||||||
base = 10;
|
base = 10;
|
||||||
}
|
}
|
||||||
else if (strncmp(typeStr, "int", strlen(typeStr)) == 0)
|
else if (strncmp(typeStr, "int", strlen(typeStr)) == 0)
|
||||||
{ base = 10; }
|
{
|
||||||
|
base = 10;
|
||||||
|
}
|
||||||
else if (strncmp(typeStr, "hex", strlen(typeStr)) == 0)
|
else if (strncmp(typeStr, "hex", strlen(typeStr)) == 0)
|
||||||
{ base = 16; }
|
{
|
||||||
|
base = 16;
|
||||||
|
}
|
||||||
else if (strncmp(typeStr, "bit", strlen(typeStr)) == 0)
|
else if (strncmp(typeStr, "bit", strlen(typeStr)) == 0)
|
||||||
{ base = 2; }
|
{
|
||||||
|
base = 2;
|
||||||
|
}
|
||||||
else if (strncmp(typeStr, "float", strlen(typeStr)) == 0)
|
else if (strncmp(typeStr, "float", strlen(typeStr)) == 0)
|
||||||
{ base = 0; }
|
{
|
||||||
|
base = 0;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (base)
|
if (base)
|
||||||
{
|
{
|
||||||
|
|
@ -1075,15 +1109,25 @@ bool ChatHandler::HandlerDebugModValueHelper(Object* target, uint32 field, char*
|
||||||
type = 1;
|
type = 1;
|
||||||
}
|
}
|
||||||
else if (strncmp(typeStr, "float", strlen(typeStr)) == 0)
|
else if (strncmp(typeStr, "float", strlen(typeStr)) == 0)
|
||||||
{ type = 0; }
|
{
|
||||||
|
type = 0;
|
||||||
|
}
|
||||||
else if (strncmp(typeStr, "|=", strlen("|=") + 1) == 0) // exactly copy
|
else if (strncmp(typeStr, "|=", strlen("|=") + 1) == 0) // exactly copy
|
||||||
{ type = 2; }
|
{
|
||||||
|
type = 2;
|
||||||
|
}
|
||||||
else if (strncmp(typeStr, "&=", strlen("&=") + 1) == 0) // exactly copy
|
else if (strncmp(typeStr, "&=", strlen("&=") + 1) == 0) // exactly copy
|
||||||
{ type = 3; }
|
{
|
||||||
|
type = 3;
|
||||||
|
}
|
||||||
else if (strncmp(typeStr, "&=~", strlen("&=~") + 1) == 0) // exactly copy
|
else if (strncmp(typeStr, "&=~", strlen("&=~") + 1) == 0) // exactly copy
|
||||||
{ type = 4; }
|
{
|
||||||
|
type = 4;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (type)
|
if (type)
|
||||||
{
|
{
|
||||||
|
|
@ -1285,9 +1329,13 @@ bool ChatHandler::HandleDebugSpellModsCommand(char* args)
|
||||||
opcode = SMSG_SET_FLAT_SPELL_MODIFIER;
|
opcode = SMSG_SET_FLAT_SPELL_MODIFIER;
|
||||||
}
|
}
|
||||||
else if (strncmp(typeStr, "pct", strlen(typeStr)) == 0)
|
else if (strncmp(typeStr, "pct", strlen(typeStr)) == 0)
|
||||||
{ opcode = SMSG_SET_PCT_SPELL_MODIFIER; }
|
{
|
||||||
|
opcode = SMSG_SET_PCT_SPELL_MODIFIER;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 effidx;
|
uint32 effidx;
|
||||||
if (!ExtractUInt32(&args, effidx) || effidx >= 64 + 32)
|
if (!ExtractUInt32(&args, effidx) || effidx >= 64 + 32)
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,9 @@ bool FleeingMovementGenerator<T>::_getPoint(T& owner, float& x, float& y, float&
|
||||||
angle_to_caster = fright->GetAngle(&owner);
|
angle_to_caster = fright->GetAngle(&owner);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ angle_to_caster = frand(0, 2 * M_PI_F); }
|
{
|
||||||
|
angle_to_caster = frand(0, 2 * M_PI_F);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -116,7 +118,9 @@ bool FleeingMovementGenerator<T>::_getPoint(T& owner, float& x, float& y, float&
|
||||||
|
|
||||||
// try to fix z
|
// try to fix z
|
||||||
if (!owner.GetMap()->GetHeightInRange(owner.GetPhaseMask(), x, y, z))
|
if (!owner.GetMap()->GetHeightInRange(owner.GetPhaseMask(), x, y, z))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (owner.GetTypeId() == TYPEID_PLAYER)
|
if (owner.GetTypeId() == TYPEID_PLAYER)
|
||||||
{
|
{
|
||||||
|
|
@ -126,7 +130,9 @@ bool FleeingMovementGenerator<T>::_getPoint(T& owner, float& x, float& y, float&
|
||||||
{
|
{
|
||||||
z = testZ;
|
z = testZ;
|
||||||
if (!owner.GetMap()->GetHeightInRange(owner.GetPhaseMask(), x, y, z))
|
if (!owner.GetMap()->GetHeightInRange(owner.GetPhaseMask(), x, y, z))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,9 @@ void MotionMaster::Initialize()
|
||||||
(static_cast<WaypointMovementGenerator<Creature>*>(top()))->InitializeWaypointPath(*((Creature*)(m_owner)), 0, PATH_NO_PATH, 0, 0);
|
(static_cast<WaypointMovementGenerator<Creature>*>(top()))->InitializeWaypointPath(*((Creature*)(m_owner)), 0, PATH_NO_PATH, 0, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ push(&si_idleMovement); }
|
{
|
||||||
|
push(&si_idleMovement);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MotionMaster::~MotionMaster()
|
MotionMaster::~MotionMaster()
|
||||||
|
|
@ -98,7 +100,9 @@ void MotionMaster::UpdateMotion(uint32 diff)
|
||||||
MovementExpired();
|
MovementExpired();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_cleanFlag &= ~MMCF_UPDATE; }
|
{
|
||||||
|
m_cleanFlag &= ~MMCF_UPDATE;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_expList)
|
if (m_expList)
|
||||||
{
|
{
|
||||||
|
|
@ -155,7 +159,9 @@ void MotionMaster::DelayedClean(bool reset, bool all)
|
||||||
m_cleanFlag |= MMCF_RESET;
|
m_cleanFlag |= MMCF_RESET;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_cleanFlag &= ~MMCF_RESET; }
|
{
|
||||||
|
m_cleanFlag &= ~MMCF_RESET;
|
||||||
|
}
|
||||||
|
|
||||||
if (empty() || (!all && size() == 1))
|
if (empty() || (!all && size() == 1))
|
||||||
{
|
{
|
||||||
|
|
@ -228,7 +234,9 @@ void MotionMaster::DelayedExpire(bool reset)
|
||||||
m_cleanFlag |= MMCF_RESET;
|
m_cleanFlag |= MMCF_RESET;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_cleanFlag &= ~MMCF_RESET; }
|
{
|
||||||
|
m_cleanFlag &= ~MMCF_RESET;
|
||||||
|
}
|
||||||
|
|
||||||
if (empty() || size() == 1)
|
if (empty() || size() == 1)
|
||||||
{
|
{
|
||||||
|
|
@ -316,7 +324,9 @@ void MotionMaster::MoveTargetedHome()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ sLog.outError("%s attempt targeted home", m_owner->GetGuidStr().c_str()); }
|
{
|
||||||
|
sLog.outError("%s attempt targeted home", m_owner->GetGuidStr().c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotionMaster::MoveConfused()
|
void MotionMaster::MoveConfused()
|
||||||
|
|
@ -328,7 +338,9 @@ void MotionMaster::MoveConfused()
|
||||||
Mutate(new ConfusedMovementGenerator<Player>());
|
Mutate(new ConfusedMovementGenerator<Player>());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ Mutate(new ConfusedMovementGenerator<Creature>()); }
|
{
|
||||||
|
Mutate(new ConfusedMovementGenerator<Creature>());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotionMaster::MoveChase(Unit* target, float dist, float angle)
|
void MotionMaster::MoveChase(Unit* target, float dist, float angle)
|
||||||
|
|
@ -346,7 +358,9 @@ void MotionMaster::MoveChase(Unit* target, float dist, float angle)
|
||||||
Mutate(new ChaseMovementGenerator<Player>(*target, dist, angle));
|
Mutate(new ChaseMovementGenerator<Player>(*target, dist, angle));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ Mutate(new ChaseMovementGenerator<Creature>(*target, dist, angle)); }
|
{
|
||||||
|
Mutate(new ChaseMovementGenerator<Creature>(*target, dist, angle));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotionMaster::MoveFollow(Unit* target, float dist, float angle)
|
void MotionMaster::MoveFollow(Unit* target, float dist, float angle)
|
||||||
|
|
@ -371,7 +385,9 @@ void MotionMaster::MoveFollow(Unit* target, float dist, float angle)
|
||||||
Mutate(new FollowMovementGenerator<Player>(*target, dist, angle));
|
Mutate(new FollowMovementGenerator<Player>(*target, dist, angle));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ Mutate(new FollowMovementGenerator<Creature>(*target, dist, angle)); }
|
{
|
||||||
|
Mutate(new FollowMovementGenerator<Creature>(*target, dist, angle));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotionMaster::MovePoint(uint32 id, float x, float y, float z, bool generatePath)
|
void MotionMaster::MovePoint(uint32 id, float x, float y, float z, bool generatePath)
|
||||||
|
|
@ -383,7 +399,9 @@ void MotionMaster::MovePoint(uint32 id, float x, float y, float z, bool generate
|
||||||
Mutate(new PointMovementGenerator<Player>(id, x, y, z, generatePath));
|
Mutate(new PointMovementGenerator<Player>(id, x, y, z, generatePath));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ Mutate(new PointMovementGenerator<Creature>(id, x, y, z, generatePath)); }
|
{
|
||||||
|
Mutate(new PointMovementGenerator<Creature>(id, x, y, z, generatePath));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotionMaster::MoveSeekAssistance(float x, float y, float z)
|
void MotionMaster::MoveSeekAssistance(float x, float y, float z)
|
||||||
|
|
@ -434,7 +452,9 @@ void MotionMaster::MoveFleeing(Unit* enemy, uint32 time)
|
||||||
Mutate(new TimedFleeingMovementGenerator(enemy->GetObjectGuid(), time));
|
Mutate(new TimedFleeingMovementGenerator(enemy->GetObjectGuid(), time));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ Mutate(new FleeingMovementGenerator<Creature>(enemy->GetObjectGuid())); }
|
{
|
||||||
|
Mutate(new FleeingMovementGenerator<Creature>(enemy->GetObjectGuid()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -542,7 +562,9 @@ bool MotionMaster::SetNextWaypoint(uint32 pointId)
|
||||||
for (Impl::container_type::reverse_iterator rItr = Impl::c.rbegin(); rItr != Impl::c.rend(); ++rItr)
|
for (Impl::container_type::reverse_iterator rItr = Impl::c.rbegin(); rItr != Impl::c.rend(); ++rItr)
|
||||||
{
|
{
|
||||||
if ((*rItr)->GetMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
|
if ((*rItr)->GetMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
|
||||||
|
{
|
||||||
return (static_cast<WaypointMovementGenerator<Creature>*>(*rItr))->SetNextWaypoint(pointId);
|
return (static_cast<WaypointMovementGenerator<Creature>*>(*rItr))->SetNextWaypoint(pointId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,9 @@ class MotionMaster : private std::stack<MovementGenerator*>
|
||||||
DelayedClean(reset, all);
|
DelayedClean(reset, all);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ DirectClean(reset, all); }
|
{
|
||||||
|
DirectClean(reset, all);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void MovementExpired(bool reset = true)
|
void MovementExpired(bool reset = true)
|
||||||
{
|
{
|
||||||
|
|
@ -108,7 +110,9 @@ class MotionMaster : private std::stack<MovementGenerator*>
|
||||||
DelayedExpire(reset);
|
DelayedExpire(reset);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ DirectExpire(reset); }
|
{
|
||||||
|
DirectExpire(reset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveIdle();
|
void MoveIdle();
|
||||||
|
|
|
||||||
|
|
@ -189,10 +189,14 @@ void PathFinder::BuildPolyPath(const Vector3& startPos, const Vector3& endPos)
|
||||||
(endPoly == INVALID_POLYREF && m_sourceUnit->GetTerrain()->IsUnderWater(endPos.x, endPos.y, endPos.z)))
|
(endPoly == INVALID_POLYREF && m_sourceUnit->GetTerrain()->IsUnderWater(endPos.x, endPos.y, endPos.z)))
|
||||||
{ m_type = ((Creature*)m_sourceUnit)->CanSwim() ? PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH) : PATHFIND_NOPATH; }
|
{ m_type = ((Creature*)m_sourceUnit)->CanSwim() ? PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH) : PATHFIND_NOPATH; }
|
||||||
else
|
else
|
||||||
{ m_type = ((Creature*)m_sourceUnit)->CanFly() ? PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH) : PATHFIND_NOPATH; }
|
{
|
||||||
|
m_type = ((Creature*)m_sourceUnit)->CanFly() ? PathType(PATHFIND_NORMAL | PATHFIND_NOT_USING_PATH) : PATHFIND_NOPATH;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_type = PATHFIND_NOPATH; }
|
{
|
||||||
|
m_type = PATHFIND_NOPATH;
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -407,7 +411,9 @@ void PathFinder::BuildPolyPath(const Vector3& startPos, const Vector3& endPos)
|
||||||
m_type = PATHFIND_NORMAL;
|
m_type = PATHFIND_NORMAL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_type = PATHFIND_INCOMPLETE; }
|
{
|
||||||
|
m_type = PATHFIND_INCOMPLETE;
|
||||||
|
}
|
||||||
|
|
||||||
// generate the point-path out of our up-to-date poly-path
|
// generate the point-path out of our up-to-date poly-path
|
||||||
BuildPointPath(startPoint, endPoint);
|
BuildPointPath(startPoint, endPoint);
|
||||||
|
|
@ -719,7 +725,9 @@ dtStatus PathFinder::findSmoothPath(const float* startPos, const float* endPos,
|
||||||
len = 1.0f;
|
len = 1.0f;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ len = SMOOTH_PATH_STEP_SIZE / len; }
|
{
|
||||||
|
len = SMOOTH_PATH_STEP_SIZE / len;
|
||||||
|
}
|
||||||
|
|
||||||
float moveTgt[VERTEX_SIZE];
|
float moveTgt[VERTEX_SIZE];
|
||||||
dtVmad(moveTgt, iterPos, delta, len);
|
dtVmad(moveTgt, iterPos, delta, len);
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,9 @@ void EffectMovementGenerator::Finalize(Unit& unit)
|
||||||
unit.GetMotionMaster()->MoveChase(victim);
|
unit.GetMotionMaster()->MoveChase(victim);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ unit.GetMotionMaster()->Initialize(); }
|
{
|
||||||
|
unit.GetMotionMaster()->Initialize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,9 @@ bool TargetedMovementGeneratorMedium<T, D>::RequiresNewPosition(T& owner, float
|
||||||
return !i_target->IsWithinDist3d(x, y, z, this->GetDynamicTargetDistance(owner, true));
|
return !i_target->IsWithinDist3d(x, y, z, this->GetDynamicTargetDistance(owner, true));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return !i_target->IsWithinDist2d(x, y, this->GetDynamicTargetDistance(owner, true)); }
|
{
|
||||||
|
return !i_target->IsWithinDist2d(x, y, this->GetDynamicTargetDistance(owner, true));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------//
|
//-----------------------------------------------//
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,9 @@ void WaypointMovementGenerator<Creature>::OnArrived(Creature& creature)
|
||||||
creature.MonsterText(textData, NULL);
|
creature.MonsterText(textData, NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ sLog.outErrorDb("%s reached waypoint %u, attempted to do text %i, but required text-data could not be found", creature.GetGuidStr().c_str(), i_currentNode, textId); }
|
{
|
||||||
|
sLog.outErrorDb("%s reached waypoint %u, attempted to do text %i, but required text-data could not be found", creature.GetGuidStr().c_str(), i_currentNode, textId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -240,7 +242,9 @@ void WaypointMovementGenerator<Creature>::StartMove(Creature& creature)
|
||||||
creature.AI()->MovementInform(EXTERNAL_WAYPOINT_FINISHED_LAST + m_pathId, currPoint->first);
|
creature.AI()->MovementInform(EXTERNAL_WAYPOINT_FINISHED_LAST + m_pathId, currPoint->first);
|
||||||
|
|
||||||
if (creature.IsDead() || !creature.IsInWorld()) // Might have happened with above calls
|
if (creature.IsDead() || !creature.IsInWorld()) // Might have happened with above calls
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
i_currentNode = currPoint->first;
|
i_currentNode = currPoint->first;
|
||||||
|
|
@ -382,11 +386,15 @@ void WaypointMovementGenerator<Creature>::AddToWaypointPauseTime(int32 waitTimeD
|
||||||
bool WaypointMovementGenerator<Creature>::SetNextWaypoint(uint32 pointId)
|
bool WaypointMovementGenerator<Creature>::SetNextWaypoint(uint32 pointId)
|
||||||
{
|
{
|
||||||
if (!i_path || i_path->empty())
|
if (!i_path || i_path->empty())
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
WaypointPath::const_iterator currPoint = i_path->find(pointId);
|
WaypointPath::const_iterator currPoint = i_path->find(pointId);
|
||||||
if (currPoint == i_path->end())
|
if (currPoint == i_path->end())
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Allow Moving with next tick
|
// Allow Moving with next tick
|
||||||
// Handle allow movement this way to not interact with PAUSED state.
|
// Handle allow movement this way to not interact with PAUSED state.
|
||||||
|
|
|
||||||
|
|
@ -74,11 +74,17 @@ ArenaTeam::~ArenaTeam()
|
||||||
bool ArenaTeam::Create(ObjectGuid captainGuid, ArenaType type, std::string arenaTeamName)
|
bool ArenaTeam::Create(ObjectGuid captainGuid, ArenaType type, std::string arenaTeamName)
|
||||||
{
|
{
|
||||||
if (!IsArenaTypeValid(type))
|
if (!IsArenaTypeValid(type))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
if (!sObjectMgr.GetPlayer(captainGuid)) // player not exist
|
if (!sObjectMgr.GetPlayer(captainGuid)) // player not exist
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
if (sObjectMgr.GetArenaTeamByName(arenaTeamName)) // arena team with this name already exist
|
if (sObjectMgr.GetArenaTeamByName(arenaTeamName)) // arena team with this name already exist
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
DEBUG_LOG("GUILD: creating arena team %s to leader: %s", arenaTeamName.c_str(), captainGuid.GetString().c_str());
|
DEBUG_LOG("GUILD: creating arena team %s to leader: %s", arenaTeamName.c_str(), captainGuid.GetString().c_str());
|
||||||
|
|
||||||
|
|
@ -113,7 +119,9 @@ bool ArenaTeam::AddMember(ObjectGuid playerGuid)
|
||||||
|
|
||||||
// arena team is full (can't have more than type * 2 players!)
|
// arena team is full (can't have more than type * 2 players!)
|
||||||
if (GetMembersSize() >= GetMaxMembersSize())
|
if (GetMembersSize() >= GetMaxMembersSize())
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Player* pl = sObjectMgr.GetPlayer(playerGuid);
|
Player* pl = sObjectMgr.GetPlayer(playerGuid);
|
||||||
if (pl)
|
if (pl)
|
||||||
|
|
@ -132,7 +140,9 @@ bool ArenaTeam::AddMember(ObjectGuid playerGuid)
|
||||||
// 0 1
|
// 0 1
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT name, class FROM characters WHERE guid='%u'", playerGuid.GetCounter());
|
QueryResult* result = CharacterDatabase.PQuery("SELECT name, class FROM characters WHERE guid='%u'", playerGuid.GetCounter());
|
||||||
if (!result)
|
if (!result)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
plName = (*result)[0].GetCppString();
|
plName = (*result)[0].GetCppString();
|
||||||
plClass = (*result)[1].GetUInt8();
|
plClass = (*result)[1].GetUInt8();
|
||||||
|
|
@ -193,7 +203,9 @@ bool ArenaTeam::AddMember(ObjectGuid playerGuid)
|
||||||
bool ArenaTeam::LoadArenaTeamFromDB(QueryResult* arenaTeamDataResult)
|
bool ArenaTeam::LoadArenaTeamFromDB(QueryResult* arenaTeamDataResult)
|
||||||
{
|
{
|
||||||
if (!arenaTeamDataResult)
|
if (!arenaTeamDataResult)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Field* fields = arenaTeamDataResult->Fetch();
|
Field* fields = arenaTeamDataResult->Fetch();
|
||||||
|
|
||||||
|
|
@ -203,7 +215,9 @@ bool ArenaTeam::LoadArenaTeamFromDB(QueryResult* arenaTeamDataResult)
|
||||||
m_Type = ArenaType(fields[3].GetUInt32());
|
m_Type = ArenaType(fields[3].GetUInt32());
|
||||||
|
|
||||||
if (!IsArenaTypeValid(m_Type))
|
if (!IsArenaTypeValid(m_Type))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
m_BackgroundColor = fields[4].GetUInt32();
|
m_BackgroundColor = fields[4].GetUInt32();
|
||||||
m_EmblemStyle = fields[5].GetUInt32();
|
m_EmblemStyle = fields[5].GetUInt32();
|
||||||
|
|
@ -224,7 +238,9 @@ bool ArenaTeam::LoadArenaTeamFromDB(QueryResult* arenaTeamDataResult)
|
||||||
bool ArenaTeam::LoadMembersFromDB(QueryResult* arenaTeamMembersResult)
|
bool ArenaTeam::LoadMembersFromDB(QueryResult* arenaTeamMembersResult)
|
||||||
{
|
{
|
||||||
if (!arenaTeamMembersResult)
|
if (!arenaTeamMembersResult)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool captainPresentInTeam = false;
|
bool captainPresentInTeam = false;
|
||||||
|
|
||||||
|
|
@ -267,7 +283,9 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult* arenaTeamMembersResult)
|
||||||
|
|
||||||
// arena team can't be > 2 * arenatype (2 for 2x2, 3 for 3x3, 5 for 5x5)
|
// arena team can't be > 2 * arenatype (2 for 2x2, 3 for 3x3, 5 for 5x5)
|
||||||
if (GetMembersSize() >= GetMaxMembersSize())
|
if (GetMembersSize() >= GetMaxMembersSize())
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (newmember.guid == GetCaptainGuid())
|
if (newmember.guid == GetCaptainGuid())
|
||||||
captainPresentInTeam = true;
|
captainPresentInTeam = true;
|
||||||
|
|
@ -429,7 +447,9 @@ void ArenaTeam::InspectStats(WorldSession* session, ObjectGuid guid)
|
||||||
{
|
{
|
||||||
ArenaTeamMember* member = GetMember(guid);
|
ArenaTeamMember* member = GetMember(guid);
|
||||||
if (!member)
|
if (!member)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
WorldPacket data(MSG_INSPECT_ARENA_TEAMS, 8 + 1 + 4 * 6);
|
WorldPacket data(MSG_INSPECT_ARENA_TEAMS, 8 + 1 + 4 * 6);
|
||||||
data << guid; // player guid
|
data << guid; // player guid
|
||||||
|
|
@ -587,7 +607,9 @@ bool ArenaTeam::HaveMember(ObjectGuid guid) const
|
||||||
{
|
{
|
||||||
for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
|
for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
|
||||||
if (itr->guid == guid)
|
if (itr->guid == guid)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -734,7 +756,9 @@ void ArenaTeam::UpdateArenaPointsHelper(std::map<uint32, uint32>& PlayerPoints)
|
||||||
// helper function for arena point distribution (this way, when distributing, no actual calculation is required, just a few comparisons)
|
// helper function for arena point distribution (this way, when distributing, no actual calculation is required, just a few comparisons)
|
||||||
// 10 played games per week is a minimum
|
// 10 played games per week is a minimum
|
||||||
if (m_stats.games_week < 10)
|
if (m_stats.games_week < 10)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
// to get points, a player has to participate in at least 30% of the matches
|
// to get points, a player has to participate in at least 30% of the matches
|
||||||
uint32 min_plays = (uint32) ceil(m_stats.games_week * 0.3);
|
uint32 min_plays = (uint32) ceil(m_stats.games_week * 0.3);
|
||||||
for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
|
for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
|
||||||
|
|
@ -788,7 +812,9 @@ bool ArenaTeam::IsFighting() const
|
||||||
if (Player* p = sObjectMgr.GetPlayer(itr->guid))
|
if (Player* p = sObjectMgr.GetPlayer(itr->guid))
|
||||||
{
|
{
|
||||||
if (p->GetMap()->IsBattleArena())
|
if (p->GetMap()->IsBattleArena())
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,9 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction)
|
||||||
if (auction_owner)
|
if (auction_owner)
|
||||||
owner_name = auction_owner->GetName();
|
owner_name = auction_owner->GetName();
|
||||||
else if (ownerGuid && !sObjectMgr.GetPlayerNameByGUID(ownerGuid, owner_name))
|
else if (ownerGuid && !sObjectMgr.GetPlayerNameByGUID(ownerGuid, owner_name))
|
||||||
{ owner_name = sObjectMgr.GetMangosStringForDBCLocale(LANG_UNKNOWN); }
|
{
|
||||||
|
owner_name = sObjectMgr.GetMangosStringForDBCLocale(LANG_UNKNOWN);
|
||||||
|
}
|
||||||
|
|
||||||
uint32 owner_accid = sObjectMgr.GetPlayerAccountIdByGUID(ownerGuid);
|
uint32 owner_accid = sObjectMgr.GetPlayerAccountIdByGUID(ownerGuid);
|
||||||
|
|
||||||
|
|
@ -150,7 +152,9 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!bidder)
|
else if (!bidder)
|
||||||
{ bidder_accId = sObjectMgr.GetPlayerAccountIdByGUID(bidder_guid); }
|
{
|
||||||
|
bidder_accId = sObjectMgr.GetPlayerAccountIdByGUID(bidder_guid);
|
||||||
|
}
|
||||||
|
|
||||||
if (auction_owner)
|
if (auction_owner)
|
||||||
auction_owner->GetSession()->SendAuctionOwnerNotification(auction);
|
auction_owner->GetSession()->SendAuctionOwnerNotification(auction);
|
||||||
|
|
@ -679,11 +683,17 @@ int AuctionEntry::CompareAuctionEntry(uint32 column, const AuctionEntry* auc, Pl
|
||||||
ItemPrototype const* itemProto1 = ObjectMgr::GetItemPrototype(itemTemplate);
|
ItemPrototype const* itemProto1 = ObjectMgr::GetItemPrototype(itemTemplate);
|
||||||
ItemPrototype const* itemProto2 = ObjectMgr::GetItemPrototype(auc->itemTemplate);
|
ItemPrototype const* itemProto2 = ObjectMgr::GetItemPrototype(auc->itemTemplate);
|
||||||
if (!itemProto2 || !itemProto1)
|
if (!itemProto2 || !itemProto1)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
if (itemProto1->RequiredLevel < itemProto2->RequiredLevel)
|
if (itemProto1->RequiredLevel < itemProto2->RequiredLevel)
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
else if (itemProto1->RequiredLevel > itemProto2->RequiredLevel)
|
else if (itemProto1->RequiredLevel > itemProto2->RequiredLevel)
|
||||||
|
{
|
||||||
return +1;
|
return +1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1: // quality = 1
|
case 1: // quality = 1
|
||||||
|
|
@ -691,47 +701,71 @@ int AuctionEntry::CompareAuctionEntry(uint32 column, const AuctionEntry* auc, Pl
|
||||||
ItemPrototype const* itemProto1 = ObjectMgr::GetItemPrototype(itemTemplate);
|
ItemPrototype const* itemProto1 = ObjectMgr::GetItemPrototype(itemTemplate);
|
||||||
ItemPrototype const* itemProto2 = ObjectMgr::GetItemPrototype(auc->itemTemplate);
|
ItemPrototype const* itemProto2 = ObjectMgr::GetItemPrototype(auc->itemTemplate);
|
||||||
if (!itemProto2 || !itemProto1)
|
if (!itemProto2 || !itemProto1)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
if (itemProto1->Quality < itemProto2->Quality)
|
if (itemProto1->Quality < itemProto2->Quality)
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
else if (itemProto1->Quality > itemProto2->Quality)
|
else if (itemProto1->Quality > itemProto2->Quality)
|
||||||
|
{
|
||||||
return +1;
|
return +1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2: // buyoutthenbid = 2
|
case 2: // buyoutthenbid = 2
|
||||||
if (buyout != auc->buyout)
|
if (buyout != auc->buyout)
|
||||||
{
|
{
|
||||||
if (buyout < auc->buyout)
|
if (buyout < auc->buyout)
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
else if (buyout > auc->buyout)
|
else if (buyout > auc->buyout)
|
||||||
|
{
|
||||||
return +1;
|
return +1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (bid < auc->bid)
|
if (bid < auc->bid)
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
else if (bid > auc->bid)
|
else if (bid > auc->bid)
|
||||||
|
{
|
||||||
return +1;
|
return +1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3: // duration = 3
|
case 3: // duration = 3
|
||||||
if (expireTime < auc->expireTime)
|
if (expireTime < auc->expireTime)
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
else if (expireTime > auc->expireTime)
|
else if (expireTime > auc->expireTime)
|
||||||
|
{
|
||||||
return +1;
|
return +1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4: // status = 4
|
case 4: // status = 4
|
||||||
if (bidder < auc->bidder)
|
if (bidder < auc->bidder)
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
else if (bidder > auc->bidder)
|
else if (bidder > auc->bidder)
|
||||||
|
{
|
||||||
return +1;
|
return +1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 5: // name = 5
|
case 5: // name = 5
|
||||||
{
|
{
|
||||||
ItemPrototype const* itemProto1 = ObjectMgr::GetItemPrototype(itemTemplate);
|
ItemPrototype const* itemProto1 = ObjectMgr::GetItemPrototype(itemTemplate);
|
||||||
ItemPrototype const* itemProto2 = ObjectMgr::GetItemPrototype(auc->itemTemplate);
|
ItemPrototype const* itemProto2 = ObjectMgr::GetItemPrototype(auc->itemTemplate);
|
||||||
if (!itemProto2 || !itemProto1)
|
if (!itemProto2 || !itemProto1)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int32 loc_idx = viewPlayer->GetSession()->GetSessionDbLocaleIndex();
|
int32 loc_idx = viewPlayer->GetSession()->GetSessionDbLocaleIndex();
|
||||||
|
|
||||||
|
|
@ -754,16 +788,24 @@ int AuctionEntry::CompareAuctionEntry(uint32 column, const AuctionEntry* auc, Pl
|
||||||
if (bid1 != bid2)
|
if (bid1 != bid2)
|
||||||
{
|
{
|
||||||
if (bid1 < bid2)
|
if (bid1 < bid2)
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
else if (bid1 > bid2)
|
else if (bid1 > bid2)
|
||||||
|
{
|
||||||
return +1;
|
return +1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (buyout < auc->buyout)
|
if (buyout < auc->buyout)
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
else if (buyout > auc->buyout)
|
else if (buyout > auc->buyout)
|
||||||
|
{
|
||||||
return +1;
|
return +1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
@ -776,24 +818,36 @@ int AuctionEntry::CompareAuctionEntry(uint32 column, const AuctionEntry* auc, Pl
|
||||||
uint64 bid2 = auc->bid ? auc->bid : auc->startbid;
|
uint64 bid2 = auc->bid ? auc->bid : auc->startbid;
|
||||||
|
|
||||||
if (bid1 < bid2)
|
if (bid1 < bid2)
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
else if (bid1 > bid2)
|
else if (bid1 > bid2)
|
||||||
|
{
|
||||||
return +1;
|
return +1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 9: // quantity = 9
|
case 9: // quantity = 9
|
||||||
{
|
{
|
||||||
if (itemCount < auc->itemCount)
|
if (itemCount < auc->itemCount)
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
else if (itemCount > auc->itemCount)
|
else if (itemCount > auc->itemCount)
|
||||||
|
{
|
||||||
return +1;
|
return +1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 10: // buyout = 10
|
case 10: // buyout = 10
|
||||||
if (buyout < auc->buyout)
|
if (buyout < auc->buyout)
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
else if (buyout > auc->buyout)
|
else if (buyout > auc->buyout)
|
||||||
|
{
|
||||||
return +1;
|
return +1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 11: // unused = 11
|
case 11: // unused = 11
|
||||||
default:
|
default:
|
||||||
|
|
@ -806,12 +860,16 @@ int AuctionEntry::CompareAuctionEntry(uint32 column, const AuctionEntry* auc, Pl
|
||||||
bool AuctionSorter::operator()(const AuctionEntry* auc1, const AuctionEntry* auc2) const
|
bool AuctionSorter::operator()(const AuctionEntry* auc1, const AuctionEntry* auc2) const
|
||||||
{
|
{
|
||||||
if (m_sort[0] == MAX_AUCTION_SORT) // not sorted
|
if (m_sort[0] == MAX_AUCTION_SORT) // not sorted
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for (uint32 i = 0; i < MAX_AUCTION_SORT; ++i)
|
for (uint32 i = 0; i < MAX_AUCTION_SORT; ++i)
|
||||||
{
|
{
|
||||||
if (m_sort[i] == MAX_AUCTION_SORT) // end of sort
|
if (m_sort[i] == MAX_AUCTION_SORT) // end of sort
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int res = auc1->CompareAuctionEntry(m_sort[i] & ~AUCTION_SORT_REVERSED, auc2, m_viewPlayer);
|
int res = auc1->CompareAuctionEntry(m_sort[i] & ~AUCTION_SORT_REVERSED, auc2, m_viewPlayer);
|
||||||
// "equal" by used column
|
// "equal" by used column
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,9 @@ Item* Bag::GetItemByLimitedCategory(uint32 limitedCategory) const
|
||||||
{
|
{
|
||||||
for (uint32 i = 0; i < GetBagSize(); ++i)
|
for (uint32 i = 0; i < GetBagSize(); ++i)
|
||||||
if (m_bagslot[i] && m_bagslot[i]->GetProto()->ItemLimitCategory == limitedCategory)
|
if (m_bagslot[i] && m_bagslot[i]->GetProto()->ItemLimitCategory == limitedCategory)
|
||||||
|
{
|
||||||
return m_bagslot[i];
|
return m_bagslot[i];
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,9 @@ CalendarEvent::~CalendarEvent()
|
||||||
bool CalendarEvent::AddInvite(CalendarInvite* invite)
|
bool CalendarEvent::AddInvite(CalendarInvite* invite)
|
||||||
{
|
{
|
||||||
if (!invite)
|
if (!invite)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return m_Invitee.insert(CalendarInviteMap::value_type(invite->InviteId, invite)).second;
|
return m_Invitee.insert(CalendarInviteMap::value_type(invite->InviteId, invite)).second;
|
||||||
}
|
}
|
||||||
|
|
@ -51,7 +53,9 @@ CalendarInvite* CalendarEvent::GetInviteById(uint64 inviteId)
|
||||||
{
|
{
|
||||||
CalendarInviteMap::iterator itr = m_Invitee.find(inviteId);
|
CalendarInviteMap::iterator itr = m_Invitee.find(inviteId);
|
||||||
if (itr != m_Invitee.end())
|
if (itr != m_Invitee.end())
|
||||||
|
{
|
||||||
return itr->second;
|
return itr->second;
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -61,7 +65,9 @@ CalendarInvite* CalendarEvent::GetInviteByGuid(ObjectGuid const& guid)
|
||||||
while (inviteItr != m_Invitee.end())
|
while (inviteItr != m_Invitee.end())
|
||||||
{
|
{
|
||||||
if (inviteItr->second->InviteeGuid == guid)
|
if (inviteItr->second->InviteeGuid == guid)
|
||||||
|
{
|
||||||
return inviteItr->second;
|
return inviteItr->second;
|
||||||
|
}
|
||||||
++inviteItr;
|
++inviteItr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -249,7 +255,9 @@ CalendarEvent* CalendarMgr::AddEvent(ObjectGuid const& guid, std::string title,
|
||||||
{
|
{
|
||||||
Player* player = sObjectMgr.GetPlayer(guid);
|
Player* player = sObjectMgr.GetPlayer(guid);
|
||||||
if (!player)
|
if (!player)
|
||||||
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (title.empty())
|
if (title.empty())
|
||||||
{
|
{
|
||||||
|
|
@ -356,7 +364,9 @@ CalendarInvite* CalendarMgr::AddInvite(CalendarEvent* event, ObjectGuid const& s
|
||||||
{
|
{
|
||||||
Player* sender = sObjectMgr.GetPlayer(senderGuid);
|
Player* sender = sObjectMgr.GetPlayer(senderGuid);
|
||||||
if (!event || !sender)
|
if (!event || !sender)
|
||||||
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
sObjectMgr.GetPlayerNameByGUID(inviteeGuid, name);
|
sObjectMgr.GetPlayerNameByGUID(inviteeGuid, name);
|
||||||
|
|
@ -477,7 +487,9 @@ void CalendarMgr::CopyEvent(uint64 eventId, time_t newTime, ObjectGuid const& gu
|
||||||
CALENDAR_MAX_INVITES, event->DungeonId, newTime, event->UnknownTime, event->Flags);
|
CALENDAR_MAX_INVITES, event->DungeonId, newTime, event->UnknownTime, event->Flags);
|
||||||
|
|
||||||
if (!newEvent)
|
if (!newEvent)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (newEvent->IsGuildAnnouncement())
|
if (newEvent->IsGuildAnnouncement())
|
||||||
AddInvite(newEvent, guid, guid, CALENDAR_STATUS_CONFIRMED, CALENDAR_RANK_OWNER, "", time(NULL));
|
AddInvite(newEvent, guid, guid, CALENDAR_STATUS_CONFIRMED, CALENDAR_RANK_OWNER, "", time(NULL));
|
||||||
|
|
@ -686,7 +698,9 @@ bool CalendarMgr::CanAddEvent(ObjectGuid const& guid)
|
||||||
// count all event created by guid
|
// count all event created by guid
|
||||||
for (CalendarEventStore::iterator itr = m_EventStore.begin(); itr != m_EventStore.end(); ++itr)
|
for (CalendarEventStore::iterator itr = m_EventStore.begin(); itr != m_EventStore.end(); ++itr)
|
||||||
if ((itr->second.CreatorGuid == guid) && (++totalEvents >= CALENDAR_MAX_EVENTS))
|
if ((itr->second.CreatorGuid == guid) && (++totalEvents >= CALENDAR_MAX_EVENTS))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -694,13 +708,17 @@ bool CalendarMgr::CanAddEvent(ObjectGuid const& guid)
|
||||||
bool CalendarMgr::CanAddGuildEvent(uint32 guildId)
|
bool CalendarMgr::CanAddGuildEvent(uint32 guildId)
|
||||||
{
|
{
|
||||||
if (!guildId)
|
if (!guildId)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 totalEvents = 0;
|
uint32 totalEvents = 0;
|
||||||
// count all guild events in a guild
|
// count all guild events in a guild
|
||||||
for (CalendarEventStore::iterator itr = m_EventStore.begin(); itr != m_EventStore.end(); ++itr)
|
for (CalendarEventStore::iterator itr = m_EventStore.begin(); itr != m_EventStore.end(); ++itr)
|
||||||
if ((itr->second.GuildId == guildId) && (++totalEvents >= CALENDAR_MAX_GUILD_EVENTS))
|
if ((itr->second.GuildId == guildId) && (++totalEvents >= CALENDAR_MAX_GUILD_EVENTS))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -721,7 +739,9 @@ bool CalendarMgr::CanAddInviteTo(ObjectGuid const& guid)
|
||||||
while (ci_itr != cInvMap->end())
|
while (ci_itr != cInvMap->end())
|
||||||
{
|
{
|
||||||
if ((ci_itr->second->InviteeGuid == guid) && (++totalInvites >= CALENDAR_MAX_INVITES))
|
if ((ci_itr->second->InviteeGuid == guid) && (++totalInvites >= CALENDAR_MAX_INVITES))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
++ci_itr;
|
++ci_itr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -277,7 +277,9 @@ bool Corpse::IsHostileTo(Unit const* unit) const
|
||||||
return owner->IsHostileTo(unit);
|
return owner->IsHostileTo(unit);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Corpse::IsFriendlyTo(Unit const* unit) const
|
bool Corpse::IsFriendlyTo(Unit const* unit) const
|
||||||
|
|
@ -287,7 +289,9 @@ bool Corpse::IsFriendlyTo(Unit const* unit) const
|
||||||
return owner->IsFriendlyTo(unit);
|
return owner->IsFriendlyTo(unit);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return true; }
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Corpse::IsExpired(time_t t) const
|
bool Corpse::IsExpired(time_t t) const
|
||||||
|
|
@ -297,5 +301,7 @@ bool Corpse::IsExpired(time_t t) const
|
||||||
return m_time < t - 60 * MINUTE;
|
return m_time < t - 60 * MINUTE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return m_time < t - 3 * DAY; }
|
{
|
||||||
|
return m_time < t - 3 * DAY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,9 @@ void CreatureCreatePos::SelectFinalPoint(Creature* cr)
|
||||||
m_pos.z = m_closeObject->GetPositionZ();
|
m_pos.z = m_closeObject->GetPositionZ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_closeObject->GetClosePoint(m_pos.x, m_pos.y, m_pos.z, cr->GetObjectBoundingRadius(), m_dist, m_angle); }
|
{
|
||||||
|
m_closeObject->GetClosePoint(m_pos.x, m_pos.y, m_pos.z, cr->GetObjectBoundingRadius(), m_dist, m_angle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -638,7 +640,9 @@ void Creature::Update(uint32 update_diff, uint32 diff)
|
||||||
LoadCreatureAddon(true);
|
LoadCreatureAddon(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ SetDeathState(JUST_ALIVED); }
|
{
|
||||||
|
SetDeathState(JUST_ALIVED);
|
||||||
|
}
|
||||||
|
|
||||||
// Call AI respawn virtual function
|
// Call AI respawn virtual function
|
||||||
if (AI())
|
if (AI())
|
||||||
|
|
@ -679,7 +683,9 @@ void Creature::Update(uint32 update_diff, uint32 diff)
|
||||||
StopGroupLoot();
|
StopGroupLoot();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_groupLootTimer -= update_diff; }
|
{
|
||||||
|
m_groupLootTimer -= update_diff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
@ -767,7 +773,9 @@ void Creature::RegenerateAll(uint32 update_diff)
|
||||||
m_regenTimer = 0;
|
m_regenTimer = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_regenTimer -= update_diff; }
|
{
|
||||||
|
m_regenTimer -= update_diff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (m_regenTimer != 0)
|
if (m_regenTimer != 0)
|
||||||
{
|
{
|
||||||
|
|
@ -787,7 +795,9 @@ void Creature::RegenerateAll(uint32 update_diff)
|
||||||
void Creature::RegeneratePower()
|
void Creature::RegeneratePower()
|
||||||
{
|
{
|
||||||
if (!IsRegeneratingPower())
|
if (!IsRegeneratingPower())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Powers powerType = GetPowerType();
|
Powers powerType = GetPowerType();
|
||||||
uint32 curValue = GetPower(powerType);
|
uint32 curValue = GetPower(powerType);
|
||||||
|
|
@ -877,10 +887,14 @@ void Creature::RegenerateHealth()
|
||||||
addvalue = uint32(Spirit * 0.25 * HealthIncreaseRate);
|
addvalue = uint32(Spirit * 0.25 * HealthIncreaseRate);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ addvalue = uint32(Spirit * 0.80 * HealthIncreaseRate); }
|
{
|
||||||
|
addvalue = uint32(Spirit * 0.80 * HealthIncreaseRate);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ addvalue = maxValue / 3; }
|
{
|
||||||
|
addvalue = maxValue / 3;
|
||||||
|
}
|
||||||
|
|
||||||
ModifyHealth(addvalue);
|
ModifyHealth(addvalue);
|
||||||
}
|
}
|
||||||
|
|
@ -1318,7 +1332,9 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ displayId = 0; }
|
{
|
||||||
|
displayId = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// data->guid = guid don't must be update at save
|
// data->guid = guid don't must be update at save
|
||||||
|
|
@ -1378,7 +1394,9 @@ void Creature::SelectLevel(uint32 forcedLevel /*= USE_DEFAULT_DATABASE_LEVEL*/)
|
||||||
{
|
{
|
||||||
CreatureInfo const* cinfo = GetCreatureInfo();
|
CreatureInfo const* cinfo = GetCreatureInfo();
|
||||||
if (!cinfo)
|
if (!cinfo)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 rank = IsPet() ? 0 : cinfo->Rank; // TODO :: IsPet probably not needed here
|
uint32 rank = IsPet() ? 0 : cinfo->Rank; // TODO :: IsPet probably not needed here
|
||||||
|
|
||||||
|
|
@ -1555,7 +1573,9 @@ void Creature::SelectLevel(const CreatureInfo* cinfo, float percentHealth /*= 10
|
||||||
SetHealth(health);
|
SetHealth(health);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ SetHealthPercent(percentHealth); }
|
{
|
||||||
|
SetHealthPercent(percentHealth);
|
||||||
|
}
|
||||||
|
|
||||||
SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, float(health));
|
SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, float(health));
|
||||||
|
|
||||||
|
|
@ -1812,7 +1832,9 @@ void Creature::LoadEquipment(uint32 equip_entry, bool force)
|
||||||
|
|
||||||
EquipmentInfo const* einfo = sObjectMgr.GetEquipmentInfo(equip_entry);
|
EquipmentInfo const* einfo = sObjectMgr.GetEquipmentInfo(equip_entry);
|
||||||
if (!einfo)
|
if (!einfo)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_equipmentId = equip_entry;
|
m_equipmentId = equip_entry;
|
||||||
for (uint8 i = 0; i < MAX_VIRTUAL_ITEM_SLOT; ++i)
|
for (uint8 i = 0; i < MAX_VIRTUAL_ITEM_SLOT; ++i)
|
||||||
|
|
@ -2060,7 +2082,9 @@ bool Creature::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectInd
|
||||||
{
|
{
|
||||||
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(index);
|
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(index);
|
||||||
if (!spellEffect)
|
if (!spellEffect)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!castOnSelf && GetCreatureInfo()->MechanicImmuneMask & (1 << (spellEffect->EffectMechanic - 1)))
|
if (!castOnSelf && GetCreatureInfo()->MechanicImmuneMask & (1 << (spellEffect->EffectMechanic - 1)))
|
||||||
{
|
{
|
||||||
|
|
@ -2080,7 +2104,9 @@ bool Creature::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectInd
|
||||||
}
|
}
|
||||||
// Spell effect taunt check
|
// Spell effect taunt check
|
||||||
else if (spellEffect->Effect == SPELL_EFFECT_ATTACK_ME)
|
else if (spellEffect->Effect == SPELL_EFFECT_ATTACK_ME)
|
||||||
{ return true; }
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Unit::IsImmuneToSpellEffect(spellInfo, index, castOnSelf);
|
return Unit::IsImmuneToSpellEffect(spellInfo, index, castOnSelf);
|
||||||
|
|
@ -2090,7 +2116,9 @@ bool Creature::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectInd
|
||||||
void Creature::SetLootStatus(CreatureLootStatus status)
|
void Creature::SetLootStatus(CreatureLootStatus status)
|
||||||
{
|
{
|
||||||
if (status <= m_lootStatus)
|
if (status <= m_lootStatus)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_lootStatus = status;
|
m_lootStatus = status;
|
||||||
switch (status)
|
switch (status)
|
||||||
|
|
@ -2122,14 +2150,18 @@ bool Creature::IsTappedBy(Player* plr) const
|
||||||
if (Player* recipient = GetLootRecipient())
|
if (Player* recipient = GetLootRecipient())
|
||||||
{
|
{
|
||||||
if (recipient == plr)
|
if (recipient == plr)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (Group* grp = recipient->GetGroup())
|
if (Group* grp = recipient->GetGroup())
|
||||||
{
|
{
|
||||||
if (Group* plrGroup = plr->GetGroup())
|
if (Group* plrGroup = plr->GetGroup())
|
||||||
{
|
{
|
||||||
if (plrGroup == grp)
|
if (plrGroup == grp)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -2334,7 +2366,9 @@ void Creature::CallAssistance()
|
||||||
SetNoCallAssistance(true);
|
SetNoCallAssistance(true);
|
||||||
|
|
||||||
if (GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_NO_CALL_ASSIST)
|
if (GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_NO_CALL_ASSIST)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
AI()->SendAIEventAround(AI_EVENT_CALL_ASSISTANCE, getVictim(), sWorld.getConfig(CONFIG_UINT32_CREATURE_FAMILY_ASSISTANCE_DELAY), sWorld.getConfig(CONFIG_FLOAT_CREATURE_FAMILY_ASSISTANCE_RADIUS));
|
AI()->SendAIEventAround(AI_EVENT_CALL_ASSISTANCE, getVictim(), sWorld.getConfig(CONFIG_UINT32_CREATURE_FAMILY_ASSISTANCE_DELAY), sWorld.getConfig(CONFIG_FLOAT_CREATURE_FAMILY_ASSISTANCE_RADIUS));
|
||||||
}
|
}
|
||||||
|
|
@ -2507,7 +2541,9 @@ CreatureDataAddon const* Creature::GetCreatureAddon() const
|
||||||
{
|
{
|
||||||
// If CreatureTemplateAddon for difficulty_entry_N exist, it's there for a reason
|
// If CreatureTemplateAddon for difficulty_entry_N exist, it's there for a reason
|
||||||
if (CreatureDataAddon const* addon = ObjectMgr::GetCreatureTemplateAddon(GetCreatureInfo()->Entry))
|
if (CreatureDataAddon const* addon = ObjectMgr::GetCreatureTemplateAddon(GetCreatureInfo()->Entry))
|
||||||
|
{
|
||||||
return addon;
|
return addon;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return CreatureTemplateAddon when nothing else exist
|
// Return CreatureTemplateAddon when nothing else exist
|
||||||
|
|
@ -2649,11 +2685,17 @@ bool Creature::MeetsSelectAttackingRequirement(Unit* pTarget, SpellEntry const*
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (selectFlags & SELECT_FLAG_POWER_RAGE && pTarget->GetPowerType() != POWER_RAGE)
|
else if (selectFlags & SELECT_FLAG_POWER_RAGE && pTarget->GetPowerType() != POWER_RAGE)
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
else if (selectFlags & SELECT_FLAG_POWER_ENERGY && pTarget->GetPowerType() != POWER_ENERGY)
|
else if (selectFlags & SELECT_FLAG_POWER_ENERGY && pTarget->GetPowerType() != POWER_ENERGY)
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
else if (selectFlags & SELECT_FLAG_POWER_RUNIC && pTarget->GetPowerType() != POWER_RUNIC_POWER)
|
else if (selectFlags & SELECT_FLAG_POWER_RUNIC && pTarget->GetPowerType() != POWER_RUNIC_POWER)
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (selectFlags & SELECT_FLAG_IN_MELEE_RANGE && !CanReachWithMeleeAttack(pTarget))
|
if (selectFlags & SELECT_FLAG_IN_MELEE_RANGE && !CanReachWithMeleeAttack(pTarget))
|
||||||
{
|
{
|
||||||
|
|
@ -2844,9 +2886,13 @@ time_t Creature::GetRespawnTimeEx() const
|
||||||
return m_respawnTime;
|
return m_respawnTime;
|
||||||
}
|
}
|
||||||
else if (m_corpseDecayTimer > 0) // dead (corpse)
|
else if (m_corpseDecayTimer > 0) // dead (corpse)
|
||||||
|
{
|
||||||
return now + m_respawnDelay + m_corpseDecayTimer / IN_MILLISECONDS;
|
return now + m_respawnDelay + m_corpseDecayTimer / IN_MILLISECONDS;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ return now; }
|
{
|
||||||
|
return now;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Creature::GetRespawnCoord(float& x, float& y, float& z, float* ori, float* dist) const
|
void Creature::GetRespawnCoord(float& x, float& y, float& z, float* ori, float* dist) const
|
||||||
|
|
@ -3051,7 +3097,9 @@ uint32 Creature::UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 us
|
||||||
vCount->count += diff * pProto->BuyCount;
|
vCount->count += diff * pProto->BuyCount;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ vCount->count = vItem->maxcount; }
|
{
|
||||||
|
vCount->count = vItem->maxcount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vCount->count = vCount->count > used_count ? vCount->count - used_count : 0;
|
vCount->count = vCount->count > used_count ? vCount->count - used_count : 0;
|
||||||
|
|
@ -3258,7 +3306,9 @@ void Creature::SetWalk(bool enable, bool asDefault)
|
||||||
clearUnitState(UNIT_STAT_RUNNING);
|
clearUnitState(UNIT_STAT_RUNNING);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ addUnitState(UNIT_STAT_RUNNING); }
|
{
|
||||||
|
addUnitState(UNIT_STAT_RUNNING);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nothing changed?
|
// Nothing changed?
|
||||||
|
|
@ -3272,7 +3322,9 @@ void Creature::SetWalk(bool enable, bool asDefault)
|
||||||
m_movementInfo.AddMovementFlag(MOVEFLAG_WALK_MODE);
|
m_movementInfo.AddMovementFlag(MOVEFLAG_WALK_MODE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_movementInfo.RemoveMovementFlag(MOVEFLAG_WALK_MODE); }
|
{
|
||||||
|
m_movementInfo.RemoveMovementFlag(MOVEFLAG_WALK_MODE);
|
||||||
|
}
|
||||||
|
|
||||||
if (IsInWorld())
|
if (IsInWorld())
|
||||||
{
|
{
|
||||||
|
|
@ -3299,7 +3351,9 @@ void Creature::SetLevitate(bool enable)
|
||||||
m_movementInfo.AddMovementFlag(MOVEFLAG_LEVITATING);
|
m_movementInfo.AddMovementFlag(MOVEFLAG_LEVITATING);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_movementInfo.RemoveMovementFlag(MOVEFLAG_LEVITATING); }
|
{
|
||||||
|
m_movementInfo.RemoveMovementFlag(MOVEFLAG_LEVITATING);
|
||||||
|
}
|
||||||
|
|
||||||
if (IsInWorld())
|
if (IsInWorld())
|
||||||
{
|
{
|
||||||
|
|
@ -3374,7 +3428,9 @@ void Creature::SetRoot(bool enable)
|
||||||
m_movementInfo.AddMovementFlag(MOVEFLAG_ROOT);
|
m_movementInfo.AddMovementFlag(MOVEFLAG_ROOT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_movementInfo.RemoveMovementFlag(MOVEFLAG_ROOT); }
|
{
|
||||||
|
m_movementInfo.RemoveMovementFlag(MOVEFLAG_ROOT);
|
||||||
|
}
|
||||||
|
|
||||||
if (IsInWorld())
|
if (IsInWorld())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -170,9 +170,13 @@ struct CreatureInfo
|
||||||
return SKILL_HERBALISM;
|
return SKILL_HERBALISM;
|
||||||
}
|
}
|
||||||
else if (CreatureTypeFlags & CREATURE_TYPEFLAGS_MININGLOOT)
|
else if (CreatureTypeFlags & CREATURE_TYPEFLAGS_MININGLOOT)
|
||||||
{ return SKILL_MINING; }
|
{
|
||||||
|
return SKILL_MINING;
|
||||||
|
}
|
||||||
else if (CreatureTypeFlags & CREATURE_TYPEFLAGS_ENGINEERLOOT)
|
else if (CreatureTypeFlags & CREATURE_TYPEFLAGS_ENGINEERLOOT)
|
||||||
|
{
|
||||||
return SKILL_ENGINEERING;
|
return SKILL_ENGINEERING;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ return SKILL_SKINNING; } // normal case
|
{ return SKILL_SKINNING; } // normal case
|
||||||
}
|
}
|
||||||
|
|
@ -185,7 +189,9 @@ struct CreatureInfo
|
||||||
bool isTameable(bool exotic) const
|
bool isTameable(bool exotic) const
|
||||||
{
|
{
|
||||||
if (CreatureType != CREATURE_TYPE_BEAST || Family == 0 || (CreatureTypeFlags & CREATURE_TYPEFLAGS_TAMEABLE) == 0)
|
if (CreatureType != CREATURE_TYPE_BEAST || Family == 0 || (CreatureTypeFlags & CREATURE_TYPEFLAGS_TAMEABLE) == 0)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// if can tame exotic then can tame any temable
|
// if can tame exotic then can tame any temable
|
||||||
return exotic || !IsExotic();
|
return exotic || !IsExotic();
|
||||||
|
|
@ -798,7 +804,9 @@ class Creature : public Unit
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return m_charmInfo->GetCharmSpell(pos)->GetAction(); }
|
{
|
||||||
|
return m_charmInfo->GetCharmSpell(pos)->GetAction();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetCombatStartPosition(float x, float y, float z) { m_combatStartX = x; m_combatStartY = y; m_combatStartZ = z; }
|
void SetCombatStartPosition(float x, float y, float z) { m_combatStartX = x; m_combatStartY = y; m_combatStartZ = z; }
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,9 @@ CanCastResult CreatureAI::CanCastSpell(Unit* pTarget, const SpellEntry* pSpell,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pSpell->HasAttribute(SPELL_ATTR_EX2_IGNORE_LOS) && !m_creature->IsWithinLOSInMap(pTarget) && m_creature != pTarget)
|
if (!pSpell->HasAttribute(SPELL_ATTR_EX2_IGNORE_LOS) && !m_creature->IsWithinLOSInMap(pTarget) && m_creature != pTarget)
|
||||||
|
{
|
||||||
return CAST_FAIL_NOT_IN_LOS;
|
return CAST_FAIL_NOT_IN_LOS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (const SpellRangeEntry* pSpellRange = sSpellRangeStore.LookupEntry(pSpell->rangeIndex))
|
if (const SpellRangeEntry* pSpellRange = sSpellRangeStore.LookupEntry(pSpell->rangeIndex))
|
||||||
|
|
@ -99,7 +101,9 @@ CanCastResult CreatureAI::CanCastSpell(Unit* pTarget, const SpellEntry* pSpell,
|
||||||
return CAST_OK;
|
return CAST_OK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return CAST_FAIL_OTHER; }
|
{
|
||||||
|
return CAST_FAIL_OTHER;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CanCastResult CreatureAI::DoCastSpellIfCan(Unit* pTarget, uint32 uiSpell, uint32 uiCastFlags, ObjectGuid uiOriginalCasterGUID)
|
CanCastResult CreatureAI::DoCastSpellIfCan(Unit* pTarget, uint32 uiSpell, uint32 uiCastFlags, ObjectGuid uiOriginalCasterGUID)
|
||||||
|
|
@ -162,7 +166,9 @@ CanCastResult CreatureAI::DoCastSpellIfCan(Unit* pTarget, uint32 uiSpell, uint32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return CAST_FAIL_IS_CASTING; }
|
{
|
||||||
|
return CAST_FAIL_IS_CASTING;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CreatureAI::DoMeleeAttackIfReady()
|
bool CreatureAI::DoMeleeAttackIfReady()
|
||||||
|
|
@ -179,7 +185,9 @@ void CreatureAI::SetCombatMovement(bool enable, bool stopOrStartMovement /*=fals
|
||||||
m_creature->clearUnitState(UNIT_STAT_NO_COMBAT_MOVEMENT);
|
m_creature->clearUnitState(UNIT_STAT_NO_COMBAT_MOVEMENT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_creature->addUnitState(UNIT_STAT_NO_COMBAT_MOVEMENT); }
|
{
|
||||||
|
m_creature->addUnitState(UNIT_STAT_NO_COMBAT_MOVEMENT);
|
||||||
|
}
|
||||||
|
|
||||||
if (stopOrStartMovement && m_creature->getVictim()) // Only change current movement while in combat
|
if (stopOrStartMovement && m_creature->getVictim()) // Only change current movement while in combat
|
||||||
{
|
{
|
||||||
|
|
@ -188,7 +196,9 @@ void CreatureAI::SetCombatMovement(bool enable, bool stopOrStartMovement /*=fals
|
||||||
m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim(), m_attackDistance, m_attackAngle);
|
m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim(), m_attackDistance, m_attackAngle);
|
||||||
}
|
}
|
||||||
else if (!enable && m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE)
|
else if (!enable && m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE)
|
||||||
{ m_creature->StopMoving(); }
|
{
|
||||||
|
m_creature->StopMoving();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,9 @@ namespace FactorySelector
|
||||||
{
|
{
|
||||||
// charmed creature may have some script even if its not supposed to be that way (ex: Eye of Acherus)
|
// charmed creature may have some script even if its not supposed to be that way (ex: Eye of Acherus)
|
||||||
if (creature->IsCharmed())
|
if (creature->IsCharmed())
|
||||||
|
{
|
||||||
return scriptedAI;
|
return scriptedAI;
|
||||||
|
}
|
||||||
|
|
||||||
// Allow scripting AI for normal creatures and not controlled pets (guardians and mini-pets)
|
// Allow scripting AI for normal creatures and not controlled pets (guardians and mini-pets)
|
||||||
if (!creature->IsPet() || !static_cast<Pet*>(creature)->isControlled())
|
if (!creature->IsPet() || !static_cast<Pet*>(creature)->isControlled())
|
||||||
|
|
@ -71,7 +73,9 @@ namespace FactorySelector
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (creature->IsTotem())
|
else if (creature->IsTotem())
|
||||||
{ ai_factory = ai_registry.GetRegistryItem("TotemAI"); }
|
{
|
||||||
|
ai_factory = ai_registry.GetRegistryItem("TotemAI");
|
||||||
|
}
|
||||||
|
|
||||||
// select by script name
|
// select by script name
|
||||||
if (!ai_factory && !ainame.empty())
|
if (!ai_factory && !ainame.empty())
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,9 @@ bool CreatureEventAIHolder::UpdateRepeatTimer(Creature* creature, uint32 repeatM
|
||||||
Time = repeatMin;
|
Time = repeatMin;
|
||||||
}
|
}
|
||||||
else if (repeatMax > repeatMin)
|
else if (repeatMax > repeatMin)
|
||||||
{ Time = urand(repeatMin, repeatMax); }
|
{
|
||||||
|
Time = urand(repeatMin, repeatMax);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sLog.outErrorEventAI("Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", creature->GetEntry(), Event.event_id, Event.event_type);
|
sLog.outErrorEventAI("Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", creature->GetEntry(), Event.event_id, Event.event_type);
|
||||||
|
|
@ -83,9 +85,13 @@ void CreatureEventAI::GetAIInformation(ChatHandler& reader)
|
||||||
reader.PSendSysMessage("%u Type%3u (%s) Timer(%3us) actions[type(param1)]: %2u(%5u) -- %2u(%u) -- %2u(%5u)", itr->Event.event_id, itr->Event.event_type, itr->Enabled ? "On" : "Off", itr->Time / 1000, itr->Event.action[0].type, itr->Event.action[0].raw.param1, itr->Event.action[1].type, itr->Event.action[1].raw.param1, itr->Event.action[2].type, itr->Event.action[2].raw.param1);
|
reader.PSendSysMessage("%u Type%3u (%s) Timer(%3us) actions[type(param1)]: %2u(%5u) -- %2u(%u) -- %2u(%5u)", itr->Event.event_id, itr->Event.event_type, itr->Enabled ? "On" : "Off", itr->Time / 1000, itr->Event.action[0].type, itr->Event.action[0].raw.param1, itr->Event.action[1].type, itr->Event.action[1].raw.param1, itr->Event.action[2].type, itr->Event.action[2].raw.param1);
|
||||||
}
|
}
|
||||||
else if (itr->Event.action[1].type != ACTION_T_NONE)
|
else if (itr->Event.action[1].type != ACTION_T_NONE)
|
||||||
{ reader.PSendSysMessage("%u Type%3u (%s) Timer(%3us) actions[type(param1)]: %2u(%5u) -- %2u(%5u)", itr->Event.event_id, itr->Event.event_type, itr->Enabled ? "On" : "Off", itr->Time / 1000, itr->Event.action[0].type, itr->Event.action[0].raw.param1, itr->Event.action[1].type, itr->Event.action[1].raw.param1); }
|
{
|
||||||
|
reader.PSendSysMessage("%u Type%3u (%s) Timer(%3us) actions[type(param1)]: %2u(%5u) -- %2u(%5u)", itr->Event.event_id, itr->Event.event_type, itr->Enabled ? "On" : "Off", itr->Time / 1000, itr->Event.action[0].type, itr->Event.action[0].raw.param1, itr->Event.action[1].type, itr->Event.action[1].raw.param1);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ reader.PSendSysMessage("%u Type%3u (%s) Timer(%3us) action[type(param1)]: %2u(%5u)", itr->Event.event_id, itr->Event.event_type, itr->Enabled ? "On" : "Off", itr->Time / 1000, itr->Event.action[0].type, itr->Event.action[0].raw.param1); }
|
{
|
||||||
|
reader.PSendSysMessage("%u Type%3u (%s) Timer(%3us) action[type(param1)]: %2u(%5u)", itr->Event.event_id, itr->Event.event_type, itr->Enabled ? "On" : "Off", itr->Time / 1000, itr->Event.action[0].type, itr->Event.action[0].raw.param1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -130,7 +136,9 @@ CreatureEventAI::CreatureEventAI(Creature* c) : CreatureAI(c),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (IsEventFlagsFitForNormalMap(i->event_flags))
|
else if (IsEventFlagsFitForNormalMap(i->event_flags))
|
||||||
{ ++events_count; }
|
{
|
||||||
|
++events_count;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// EventMap had events but they were not added because they must be for instance
|
// EventMap had events but they were not added because they must be for instance
|
||||||
if (events_count == 0)
|
if (events_count == 0)
|
||||||
|
|
@ -158,7 +166,9 @@ CreatureEventAI::CreatureEventAI(Creature* c) : CreatureAI(c),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (IsEventFlagsFitForNormalMap(i->event_flags))
|
else if (IsEventFlagsFitForNormalMap(i->event_flags))
|
||||||
{ storeEvent = true; }
|
{
|
||||||
|
storeEvent = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (storeEvent)
|
if (storeEvent)
|
||||||
{
|
{
|
||||||
|
|
@ -313,11 +323,15 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
|
||||||
break;
|
break;
|
||||||
case EVENT_T_RANGE:
|
case EVENT_T_RANGE:
|
||||||
if (!m_creature->IsInCombat() || !m_creature->getVictim() || !m_creature->IsInMap(m_creature->getVictim()))
|
if (!m_creature->IsInCombat() || !m_creature->getVictim() || !m_creature->IsInMap(m_creature->getVictim()))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// DISCUSS TODO - Likely replace IsInRange check with CombatReach checks (as used rather for such checks)
|
// DISCUSS TODO - Likely replace IsInRange check with CombatReach checks (as used rather for such checks)
|
||||||
if (!m_creature->IsInRange(m_creature->getVictim(), (float)event.range.minDist, (float)event.range.maxDist))
|
if (!m_creature->IsInRange(m_creature->getVictim(), (float)event.range.minDist, (float)event.range.maxDist))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Repeat Timers
|
// Repeat Timers
|
||||||
pHolder.UpdateRepeatTimer(m_creature, event.range.repeatMin, event.range.repeatMax);
|
pHolder.UpdateRepeatTimer(m_creature, event.range.repeatMin, event.range.repeatMax);
|
||||||
|
|
@ -645,9 +659,13 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
textId = action.text.TextId[rnd % 3];
|
textId = action.text.TextId[rnd % 3];
|
||||||
}
|
}
|
||||||
else if (action.text.TextId[1] && (rnd % 2))
|
else if (action.text.TextId[1] && (rnd % 2))
|
||||||
{ textId = action.text.TextId[1]; }
|
{
|
||||||
|
textId = action.text.TextId[1];
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ textId = action.text.TextId[0]; }
|
{
|
||||||
|
textId = action.text.TextId[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// ACTION_T_CHANCED_TEXT, chance hits
|
// ACTION_T_CHANCED_TEXT, chance hits
|
||||||
else if ((rnd % 100) < action.chanced_text.chance)
|
else if ((rnd % 100) < action.chanced_text.chance)
|
||||||
|
|
@ -657,7 +675,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
textId = action.chanced_text.TextId[rnd % 2];
|
textId = action.chanced_text.TextId[rnd % 2];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ textId = action.chanced_text.TextId[0]; }
|
{
|
||||||
|
textId = action.chanced_text.TextId[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (textId)
|
if (textId)
|
||||||
|
|
@ -702,7 +722,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
m_creature->SetFactionTemporary(action.set_faction.factionId, action.set_faction.factionFlags);
|
m_creature->SetFactionTemporary(action.set_faction.factionId, action.set_faction.factionFlags);
|
||||||
}
|
}
|
||||||
else // no id provided, assume reset and then use default
|
else // no id provided, assume reset and then use default
|
||||||
{ m_creature->ClearTemporaryFaction(); }
|
{
|
||||||
|
m_creature->ClearTemporaryFaction();
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -721,10 +743,14 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
}
|
}
|
||||||
// if no param1, then use value from param2 (modelId)
|
// if no param1, then use value from param2 (modelId)
|
||||||
else
|
else
|
||||||
{ m_creature->SetDisplayId(action.morph.modelId); }
|
{
|
||||||
|
m_creature->SetDisplayId(action.morph.modelId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_creature->DeMorph(); }
|
{
|
||||||
|
m_creature->DeMorph();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_T_SOUND: //4
|
case ACTION_T_SOUND: //4
|
||||||
|
|
@ -842,14 +868,18 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
pCreature = m_creature->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, action.summon.duration);
|
pCreature = m_creature->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, action.summon.duration);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ pCreature = m_creature->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OOC_DESPAWN, 0); }
|
{
|
||||||
|
pCreature = m_creature->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OOC_DESPAWN, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (!pCreature)
|
if (!pCreature)
|
||||||
{
|
{
|
||||||
sLog.outErrorEventAI("failed to spawn creature %u. Spawn event %d is on creature %d", action.summon.creatureId, EventId, m_creature->GetEntry());
|
sLog.outErrorEventAI("failed to spawn creature %u. Spawn event %d is on creature %d", action.summon.creatureId, EventId, m_creature->GetEntry());
|
||||||
}
|
}
|
||||||
else if (action.summon.target != TARGET_T_SELF && target)
|
else if (action.summon.target != TARGET_T_SELF && target)
|
||||||
{ pCreature->AI()->AttackStart(target); }
|
{
|
||||||
|
pCreature->AI()->AttackStart(target);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_T_THREAT_SINGLE_PCT: //13
|
case ACTION_T_THREAT_SINGLE_PCT: //13
|
||||||
|
|
@ -858,7 +888,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
m_creature->GetThreatManager().modifyThreatPercent(target, action.threat_single_pct.percent);
|
m_creature->GetThreatManager().modifyThreatPercent(target, action.threat_single_pct.percent);
|
||||||
}
|
}
|
||||||
else if (reportTargetError)
|
else if (reportTargetError)
|
||||||
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_THREAT_SINGLE_PCT(%u), target-type %u", EventId, action.type, action.threat_single_pct.target); }
|
{
|
||||||
|
sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_THREAT_SINGLE_PCT(%u), target-type %u", EventId, action.type, action.threat_single_pct.target);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_T_THREAT_ALL_PCT: //14
|
case ACTION_T_THREAT_ALL_PCT: //14
|
||||||
{
|
{
|
||||||
|
|
@ -879,7 +911,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (reportTargetError)
|
else if (reportTargetError)
|
||||||
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_QUEST_EVENT(%u), target-type %u", EventId, action.type, action.quest_event.target); }
|
{
|
||||||
|
sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_QUEST_EVENT(%u), target-type %u", EventId, action.type, action.quest_event.target);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_T_CAST_EVENT: //16
|
case ACTION_T_CAST_EVENT: //16
|
||||||
if (Unit* target = GetTargetByType(action.cast_event.target, pActionInvoker, pAIEventSender, reportTargetError, 0, SELECT_FLAG_PLAYER))
|
if (Unit* target = GetTargetByType(action.cast_event.target, pActionInvoker, pAIEventSender, reportTargetError, 0, SELECT_FLAG_PLAYER))
|
||||||
|
|
@ -890,7 +924,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (reportTargetError)
|
else if (reportTargetError)
|
||||||
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_CST_EVENT(%u), target-type %u", EventId, action.type, action.cast_event.target); }
|
{
|
||||||
|
sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_CST_EVENT(%u), target-type %u", EventId, action.type, action.cast_event.target);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_T_SET_UNIT_FIELD: //17
|
case ACTION_T_SET_UNIT_FIELD: //17
|
||||||
{
|
{
|
||||||
|
|
@ -903,7 +939,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (reportTargetError)
|
else if (reportTargetError)
|
||||||
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_SET_UNIT_FIELD(%u), target-type %u", EventId, action.type, action.set_unit_field.target); }
|
{
|
||||||
|
sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_SET_UNIT_FIELD(%u), target-type %u", EventId, action.type, action.set_unit_field.target);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -913,7 +951,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
target->SetFlag(UNIT_FIELD_FLAGS, action.unit_flag.value);
|
target->SetFlag(UNIT_FIELD_FLAGS, action.unit_flag.value);
|
||||||
}
|
}
|
||||||
else if (reportTargetError)
|
else if (reportTargetError)
|
||||||
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_SET_UNIT_FLAG(%u), target-type %u", EventId, action.type, action.unit_flag.target); }
|
{
|
||||||
|
sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_SET_UNIT_FLAG(%u), target-type %u", EventId, action.type, action.unit_flag.target);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_T_REMOVE_UNIT_FLAG: //19
|
case ACTION_T_REMOVE_UNIT_FLAG: //19
|
||||||
if (Unit* target = GetTargetByType(action.unit_flag.target, pActionInvoker, pAIEventSender, reportTargetError))
|
if (Unit* target = GetTargetByType(action.unit_flag.target, pActionInvoker, pAIEventSender, reportTargetError))
|
||||||
|
|
@ -921,7 +961,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
target->RemoveFlag(UNIT_FIELD_FLAGS, action.unit_flag.value);
|
target->RemoveFlag(UNIT_FIELD_FLAGS, action.unit_flag.value);
|
||||||
}
|
}
|
||||||
else if (reportTargetError)
|
else if (reportTargetError)
|
||||||
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_REMOVE_UNIT_FLAG(%u), target-type %u", EventId, action.type, action.unit_flag.target); }
|
{
|
||||||
|
sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_REMOVE_UNIT_FLAG(%u), target-type %u", EventId, action.type, action.unit_flag.target);
|
||||||
|
}
|
||||||
case ACTION_T_AUTO_ATTACK: //20
|
case ACTION_T_AUTO_ATTACK: //20
|
||||||
m_MeleeEnabled = action.auto_attack.state != 0;
|
m_MeleeEnabled = action.auto_attack.state != 0;
|
||||||
break;
|
break;
|
||||||
|
|
@ -939,7 +981,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
m_creature->SendMeleeAttackStart(m_creature->getVictim());
|
m_creature->SendMeleeAttackStart(m_creature->getVictim());
|
||||||
}
|
}
|
||||||
else if (action.combat_movement.melee && m_creature->IsInCombat() && m_creature->getVictim())
|
else if (action.combat_movement.melee && m_creature->IsInCombat() && m_creature->getVictim())
|
||||||
{ m_creature->SendMeleeAttackStop(m_creature->getVictim()); }
|
{
|
||||||
|
m_creature->SendMeleeAttackStop(m_creature->getVictim());
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_T_SET_PHASE: //22
|
case ACTION_T_SET_PHASE: //22
|
||||||
m_Phase = action.set_phase.phase;
|
m_Phase = action.set_phase.phase;
|
||||||
|
|
@ -959,7 +1003,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
m_Phase = MAX_PHASE - 1;
|
m_Phase = MAX_PHASE - 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_Phase = new_phase; }
|
{
|
||||||
|
m_Phase = new_phase;
|
||||||
|
}
|
||||||
|
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_EVENT_AI_DEV, "CreatureEventAI: ACTION_T_INC_PHASE - script %u for %s, phase is now %u", EventId, m_creature->GetGuidStr().c_str(), m_Phase);
|
DEBUG_FILTER_LOG(LOG_FILTER_EVENT_AI_DEV, "CreatureEventAI: ACTION_T_INC_PHASE - script %u for %s, phase is now %u", EventId, m_creature->GetGuidStr().c_str(), m_Phase);
|
||||||
break;
|
break;
|
||||||
|
|
@ -979,7 +1025,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
temp->GroupEventHappens(action.quest_event_all.questId, m_creature);
|
temp->GroupEventHappens(action.quest_event_all.questId, m_creature);
|
||||||
}
|
}
|
||||||
else if (pActionInvoker && pActionInvoker->GetTypeId() == TYPEID_PLAYER)
|
else if (pActionInvoker && pActionInvoker->GetTypeId() == TYPEID_PLAYER)
|
||||||
{ ((Player*)pActionInvoker)->GroupEventHappens(action.quest_event_all.questId, m_creature); }
|
{
|
||||||
|
((Player*)pActionInvoker)->GroupEventHappens(action.quest_event_all.questId, m_creature);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_T_CAST_EVENT_ALL: //27
|
case ACTION_T_CAST_EVENT_ALL: //27
|
||||||
{
|
{
|
||||||
|
|
@ -997,7 +1045,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
target->RemoveAurasDueToSpell(action.remove_aura.spellId);
|
target->RemoveAurasDueToSpell(action.remove_aura.spellId);
|
||||||
}
|
}
|
||||||
else if (reportTargetError)
|
else if (reportTargetError)
|
||||||
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_REMOVEAURASFROMSPELL(%u), target-type %u", EventId, action.type, action.remove_aura.target); }
|
{
|
||||||
|
sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_REMOVEAURASFROMSPELL(%u), target-type %u", EventId, action.type, action.remove_aura.target);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_T_RANGED_MOVEMENT: //29
|
case ACTION_T_RANGED_MOVEMENT: //29
|
||||||
m_attackDistance = (float)action.ranged_movement.distance;
|
m_attackDistance = (float)action.ranged_movement.distance;
|
||||||
|
|
@ -1023,7 +1073,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
m_Phase = action.random_phase_range.phaseMin + (rnd % (action.random_phase_range.phaseMax - action.random_phase_range.phaseMin));
|
m_Phase = action.random_phase_range.phaseMin + (rnd % (action.random_phase_range.phaseMax - action.random_phase_range.phaseMin));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ sLog.outErrorEventAI("ACTION_T_RANDOM_PHASE_RANGE can not have Param2 <= Param1. Divide by Zero. Event = %d. CreatureEntry = %d", EventId, m_creature->GetEntry()); }
|
{
|
||||||
|
sLog.outErrorEventAI("ACTION_T_RANDOM_PHASE_RANGE can not have Param2 <= Param1. Divide by Zero. Event = %d. CreatureEntry = %d", EventId, m_creature->GetEntry());
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_T_SUMMON_ID: //32
|
case ACTION_T_SUMMON_ID: //32
|
||||||
{
|
{
|
||||||
|
|
@ -1046,14 +1098,18 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
pCreature = m_creature->SummonCreature(action.summon_id.creatureId, i->second.position_x, i->second.position_y, i->second.position_z, i->second.orientation, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, i->second.SpawnTimeSecs);
|
pCreature = m_creature->SummonCreature(action.summon_id.creatureId, i->second.position_x, i->second.position_y, i->second.position_z, i->second.orientation, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, i->second.SpawnTimeSecs);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ pCreature = m_creature->SummonCreature(action.summon_id.creatureId, i->second.position_x, i->second.position_y, i->second.position_z, i->second.orientation, TEMPSUMMON_TIMED_OOC_DESPAWN, 0); }
|
{
|
||||||
|
pCreature = m_creature->SummonCreature(action.summon_id.creatureId, i->second.position_x, i->second.position_y, i->second.position_z, i->second.orientation, TEMPSUMMON_TIMED_OOC_DESPAWN, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (!pCreature)
|
if (!pCreature)
|
||||||
{
|
{
|
||||||
sLog.outErrorEventAI("failed to spawn creature %u. EventId %d.Creature %d", action.summon_id.creatureId, EventId, m_creature->GetEntry());
|
sLog.outErrorEventAI("failed to spawn creature %u. EventId %d.Creature %d", action.summon_id.creatureId, EventId, m_creature->GetEntry());
|
||||||
}
|
}
|
||||||
else if (action.summon_id.target != TARGET_T_SELF && target)
|
else if (action.summon_id.target != TARGET_T_SELF && target)
|
||||||
{ pCreature->AI()->AttackStart(target); }
|
{
|
||||||
|
pCreature->AI()->AttackStart(target);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -1074,7 +1130,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (reportTargetError)
|
else if (reportTargetError)
|
||||||
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_KILLED_MONSTER(%u), target-type %u", EventId, action.type, action.killed_monster.target); }
|
{
|
||||||
|
sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_KILLED_MONSTER(%u), target-type %u", EventId, action.type, action.killed_monster.target);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_T_SET_INST_DATA: //34
|
case ACTION_T_SET_INST_DATA: //34
|
||||||
|
|
@ -1155,7 +1213,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
m_InvinceabilityHpLevel = m_creature->GetMaxHealth() * action.invincibility_hp_level.hp_level / 100;
|
m_InvinceabilityHpLevel = m_creature->GetMaxHealth() * action.invincibility_hp_level.hp_level / 100;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_InvinceabilityHpLevel = action.invincibility_hp_level.hp_level; }
|
{
|
||||||
|
m_InvinceabilityHpLevel = action.invincibility_hp_level.hp_level;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ACTION_T_MOUNT_TO_ENTRY_OR_MODEL: //43
|
case ACTION_T_MOUNT_TO_ENTRY_OR_MODEL: //43
|
||||||
|
|
@ -1173,10 +1233,14 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||||
}
|
}
|
||||||
// if no param1, then use value from param2 (modelId)
|
// if no param1, then use value from param2 (modelId)
|
||||||
else
|
else
|
||||||
{ m_creature->Mount(action.mount.modelId); }
|
{
|
||||||
|
m_creature->Mount(action.mount.modelId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_creature->Unmount(); }
|
{
|
||||||
|
m_creature->Unmount();
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -1242,7 +1306,9 @@ void CreatureEventAI::JustRespawned() // NOTE that this is
|
||||||
}
|
}
|
||||||
// Handle Spawned Events
|
// Handle Spawned Events
|
||||||
else if (SpawnedEventConditionsCheck((*i).Event))
|
else if (SpawnedEventConditionsCheck((*i).Event))
|
||||||
{ ProcessEvent(*i); }
|
{
|
||||||
|
ProcessEvent(*i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1763,7 +1829,9 @@ void CreatureEventAI::DamageTaken(Unit* dealer, uint32& damage)
|
||||||
damage = 0;
|
damage = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ damage = m_creature->GetHealth() - m_InvinceabilityHpLevel; }
|
{
|
||||||
|
damage = m_creature->GetHealth() - m_InvinceabilityHpLevel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 step = m_throwAIEventStep != 100 ? m_throwAIEventStep : 0;
|
uint32 step = m_throwAIEventStep != 100 ? m_throwAIEventStep : 0;
|
||||||
|
|
|
||||||
|
|
@ -598,7 +598,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
||||||
sLog.outErrorEventAI("Event %u Action %u has not set chance param1. Text will not be displayed", i, j + 1);
|
sLog.outErrorEventAI("Event %u Action %u has not set chance param1. Text will not be displayed", i, j + 1);
|
||||||
}
|
}
|
||||||
else if (action.chanced_text.chance >= 100)
|
else if (action.chanced_text.chance >= 100)
|
||||||
{ sLog.outErrorEventAI("Event %u Action %u has set chance param1 >= 100. Text will always be displayed", i, j + 1); }
|
{
|
||||||
|
sLog.outErrorEventAI("Event %u Action %u has set chance param1 >= 100. Text will always be displayed", i, j + 1);
|
||||||
|
}
|
||||||
// no break here to check texts
|
// no break here to check texts
|
||||||
case ACTION_T_TEXT:
|
case ACTION_T_TEXT:
|
||||||
{
|
{
|
||||||
|
|
@ -629,7 +631,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
||||||
action.text.TextId[k] = 0;
|
action.text.TextId[k] = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ usedTextIds.insert(action.text.TextId[k]); }
|
{
|
||||||
|
usedTextIds.insert(action.text.TextId[k]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -786,7 +790,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ sLog.outErrorEventAI("Event %u Action %u uses nonexistent Quest entry %u.", i, j + 1, action.quest_event.questId); }
|
{
|
||||||
|
sLog.outErrorEventAI("Event %u Action %u uses nonexistent Quest entry %u.", i, j + 1, action.quest_event.questId);
|
||||||
|
}
|
||||||
|
|
||||||
IsValidTargetType(temp.event_type, action.type, action.quest_event.target, i, j + 1);
|
IsValidTargetType(temp.event_type, action.type, action.quest_event.target, i, j + 1);
|
||||||
break;
|
break;
|
||||||
|
|
@ -824,7 +830,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
||||||
sLog.outErrorEventAI("Event %u Action %u is incrementing phase by 0. Was this intended?", i, j + 1);
|
sLog.outErrorEventAI("Event %u Action %u is incrementing phase by 0. Was this intended?", i, j + 1);
|
||||||
}
|
}
|
||||||
else if (std::abs(action.set_inc_phase.step) > MAX_PHASE - 1)
|
else if (std::abs(action.set_inc_phase.step) > MAX_PHASE - 1)
|
||||||
{ sLog.outErrorEventAI("Event %u Action %u is change phase by too large for any use %i.", i, j + 1, action.set_inc_phase.step); }
|
{
|
||||||
|
sLog.outErrorEventAI("Event %u Action %u is change phase by too large for any use %i.", i, j + 1, action.set_inc_phase.step);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_T_QUEST_EVENT_ALL:
|
case ACTION_T_QUEST_EVENT_ALL:
|
||||||
if (Quest const* qid = sObjectMgr.GetQuestTemplate(action.quest_event_all.questId))
|
if (Quest const* qid = sObjectMgr.GetQuestTemplate(action.quest_event_all.questId))
|
||||||
|
|
@ -835,7 +843,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ sLog.outErrorEventAI("Event %u Action %u uses nonexistent Quest entry %u.", i, j + 1, action.quest_event_all.questId); }
|
{
|
||||||
|
sLog.outErrorEventAI("Event %u Action %u uses nonexistent Quest entry %u.", i, j + 1, action.quest_event_all.questId);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_T_CAST_EVENT_ALL:
|
case ACTION_T_CAST_EVENT_ALL:
|
||||||
if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.cast_event_all.creatureId))
|
if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.cast_event_all.creatureId))
|
||||||
|
|
@ -1047,7 +1057,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
||||||
sLog.outErrorEventAI("EventAI not has script for creature entry (%u), but AIName = '%s'.", i, cInfo->AIName);
|
sLog.outErrorEventAI("EventAI not has script for creature entry (%u), but AIName = '%s'.", i, cInfo->AIName);
|
||||||
}
|
}
|
||||||
else if (!ainame && hasevent)
|
else if (!ainame && hasevent)
|
||||||
{ sLog.outErrorEventAI("EventAI has script for creature entry (%u), but AIName = '%s' instead 'EventAI'.", i, cInfo->AIName); }
|
{
|
||||||
|
sLog.outErrorEventAI("EventAI has script for creature entry (%u), but AIName = '%s' instead 'EventAI'.", i, cInfo->AIName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,9 @@ void DynamicObject::Update(uint32 /*update_diff*/, uint32 p_time)
|
||||||
m_aliveDuration -= p_time;
|
m_aliveDuration -= p_time;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ deleteThis = true; }
|
{
|
||||||
|
deleteThis = true;
|
||||||
|
}
|
||||||
|
|
||||||
// have radius and work as persistent effect
|
// have radius and work as persistent effect
|
||||||
if (m_radius)
|
if (m_radius)
|
||||||
|
|
@ -201,7 +203,9 @@ void DynamicObject::Delay(int32 delaytime)
|
||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_affected.erase(iter++); }
|
{
|
||||||
|
m_affected.erase(iter++);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -229,7 +233,9 @@ bool DynamicObject::IsHostileTo(Unit const* unit) const
|
||||||
return owner->IsHostileTo(unit);
|
return owner->IsHostileTo(unit);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DynamicObject::IsFriendlyTo(Unit const* unit) const
|
bool DynamicObject::IsFriendlyTo(Unit const* unit) const
|
||||||
|
|
@ -239,5 +245,7 @@ bool DynamicObject::IsFriendlyTo(Unit const* unit) const
|
||||||
return owner->IsFriendlyTo(unit);
|
return owner->IsFriendlyTo(unit);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return true; }
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,11 +49,17 @@ namespace MaNGOS
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (pl_level <= 39)
|
else if (pl_level <= 39)
|
||||||
{ return pl_level - 5 - pl_level / 10; }
|
{
|
||||||
|
return pl_level - 5 - pl_level / 10;
|
||||||
|
}
|
||||||
else if (pl_level <= 59)
|
else if (pl_level <= 59)
|
||||||
|
{
|
||||||
return pl_level - 1 - pl_level / 5;
|
return pl_level - 1 - pl_level / 5;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return pl_level - 9;
|
return pl_level - 9;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline XPColorChar GetColorCode(uint32 pl_level, uint32 mob_level)
|
inline XPColorChar GetColorCode(uint32 pl_level, uint32 mob_level)
|
||||||
|
|
@ -63,13 +69,21 @@ namespace MaNGOS
|
||||||
return RED;
|
return RED;
|
||||||
}
|
}
|
||||||
else if (mob_level >= pl_level + 3)
|
else if (mob_level >= pl_level + 3)
|
||||||
{ return ORANGE; }
|
{
|
||||||
|
return ORANGE;
|
||||||
|
}
|
||||||
else if (mob_level >= pl_level - 2)
|
else if (mob_level >= pl_level - 2)
|
||||||
{ return YELLOW; }
|
{
|
||||||
|
return YELLOW;
|
||||||
|
}
|
||||||
else if (mob_level > GetGrayLevel(pl_level))
|
else if (mob_level > GetGrayLevel(pl_level))
|
||||||
{ return GREEN; }
|
{
|
||||||
|
return GREEN;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ return GRAY; }
|
{
|
||||||
|
return GRAY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint32 GetZeroDifference(uint32 pl_level)
|
inline uint32 GetZeroDifference(uint32 pl_level)
|
||||||
|
|
|
||||||
|
|
@ -253,7 +253,9 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
|
||||||
((BattleGroundMap*)map)->GetBG()->HandleGameObjectCreate(this);
|
((BattleGroundMap*)map)->GetBG()->HandleGameObjectCreate(this);
|
||||||
}
|
}
|
||||||
else if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript(GetZoneId()))
|
else if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript(GetZoneId()))
|
||||||
{ outdoorPvP->HandleGameObjectCreate(this); }
|
{
|
||||||
|
outdoorPvP->HandleGameObjectCreate(this);
|
||||||
|
}
|
||||||
|
|
||||||
// Notify the map's instance data.
|
// Notify the map's instance data.
|
||||||
// Only works if you create the object in it, not if it is moves to that map.
|
// Only works if you create the object in it, not if it is moves to that map.
|
||||||
|
|
@ -539,7 +541,9 @@ void GameObject::Update(uint32 update_diff, uint32 p_time)
|
||||||
SetUInt32Value(GAMEOBJECT_FLAGS, (GetGOInfo()->flags & ~(GO_FLAG_LOCKED | GO_FLAG_INTERACT_COND | GO_FLAG_NO_INTERACT)) | currentLockOrInteractFlags);
|
SetUInt32Value(GAMEOBJECT_FLAGS, (GetGOInfo()->flags & ~(GO_FLAG_LOCKED | GO_FLAG_INTERACT_COND | GO_FLAG_NO_INTERACT)) | currentLockOrInteractFlags);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ SetUInt32Value(GAMEOBJECT_FLAGS, GetGOInfo()->flags); }
|
{
|
||||||
|
SetUInt32Value(GAMEOBJECT_FLAGS, GetGOInfo()->flags);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loot.clear();
|
loot.clear();
|
||||||
|
|
@ -615,7 +619,9 @@ void GameObject::Delete()
|
||||||
sPoolMgr.UpdatePool<GameObject>(*GetMap()->GetPersistentState(), poolid, GetGUIDLow());
|
sPoolMgr.UpdatePool<GameObject>(*GetMap()->GetPersistentState(), poolid, GetGUIDLow());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ AddObjectToRemoveList(); }
|
{
|
||||||
|
AddObjectToRemoveList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameObject::SaveToDB()
|
void GameObject::SaveToDB()
|
||||||
|
|
@ -845,7 +851,9 @@ bool GameObject::isVisibleForInState(Player const* u, WorldObject const* viewPoi
|
||||||
|
|
||||||
// invisible at client always
|
// invisible at client always
|
||||||
if (!GetGOInfo()->displayId)
|
if (!GetGOInfo()->displayId)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Transport always visible at this step implementation
|
// Transport always visible at this step implementation
|
||||||
if (IsTransport() && IsInMap(u))
|
if (IsTransport() && IsInMap(u))
|
||||||
|
|
@ -881,14 +889,18 @@ bool GameObject::isVisibleForInState(Player const* u, WorldObject const* viewPoi
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (u->IsFriendlyTo(owner))
|
if (u->IsFriendlyTo(owner))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// handle environment traps (spawned by DB)
|
// handle environment traps (spawned by DB)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (this->IsFriendlyTo(u))
|
if (this->IsFriendlyTo(u))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
trapNotVisible = true;
|
trapNotVisible = true;
|
||||||
}
|
}
|
||||||
|
|
@ -897,11 +909,15 @@ bool GameObject::isVisibleForInState(Player const* u, WorldObject const* viewPoi
|
||||||
if (Aura* aura = ((Player*)u)->GetAura(2836, EFFECT_INDEX_0))
|
if (Aura* aura = ((Player*)u)->GetAura(2836, EFFECT_INDEX_0))
|
||||||
{
|
{
|
||||||
if (roll_chance_i(aura->GetModifier()->m_amount) && u->IsInFront(this, 15.0f))
|
if (roll_chance_i(aura->GetModifier()->m_amount) && u->IsInFront(this, 15.0f))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trapNotVisible)
|
if (trapNotVisible)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1156,14 +1172,18 @@ void GameObject::SwitchDoorOrButton(bool activate, bool alternative /* = false *
|
||||||
SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
|
SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); }
|
{
|
||||||
|
RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
|
||||||
|
}
|
||||||
|
|
||||||
if (GetGoState() == GO_STATE_READY) // if closed -> open
|
if (GetGoState() == GO_STATE_READY) // if closed -> open
|
||||||
{
|
{
|
||||||
SetGoState(alternative ? GO_STATE_ACTIVE_ALTERNATIVE : GO_STATE_ACTIVE);
|
SetGoState(alternative ? GO_STATE_ACTIVE_ALTERNATIVE : GO_STATE_ACTIVE);
|
||||||
}
|
}
|
||||||
else // if open -> close
|
else // if open -> close
|
||||||
{ SetGoState(GO_STATE_READY); }
|
{
|
||||||
|
SetGoState(GO_STATE_READY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameObject::Use(Unit* user)
|
void GameObject::Use(Unit* user)
|
||||||
|
|
@ -1412,7 +1432,9 @@ void GameObject::Use(Unit* user)
|
||||||
SendGameObjectCustomAnim(GetObjectGuid());
|
SendGameObjectCustomAnim(GetObjectGuid());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ SetGoState(GO_STATE_ACTIVE); }
|
{
|
||||||
|
SetGoState(GO_STATE_ACTIVE);
|
||||||
|
}
|
||||||
|
|
||||||
m_cooldownTime = time(NULL) + info->GetAutoCloseTime();
|
m_cooldownTime = time(NULL) + info->GetAutoCloseTime();
|
||||||
|
|
||||||
|
|
@ -1460,7 +1482,9 @@ void GameObject::Use(Unit* user)
|
||||||
GetMap()->ScriptsStart(DBS_ON_GO_USE, GetGUIDLow(), spellCaster, this);
|
GetMap()->ScriptsStart(DBS_ON_GO_USE, GetGUIDLow(), spellCaster, this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return; }
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// cast this spell later if provided
|
// cast this spell later if provided
|
||||||
spellId = info->goober.spellId;
|
spellId = info->goober.spellId;
|
||||||
|
|
@ -1587,7 +1611,9 @@ void GameObject::Use(Unit* user)
|
||||||
SetLootState(GO_JUST_DEACTIVATED);
|
SetLootState(GO_JUST_DEACTIVATED);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ player->SendLoot(GetObjectGuid(), success ? LOOT_FISHING : LOOT_FISHING_FAIL); }
|
{
|
||||||
|
player->SendLoot(GetObjectGuid(), success ? LOOT_FISHING : LOOT_FISHING_FAIL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -1661,7 +1687,9 @@ void GameObject::Use(Unit* user)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return; }
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
spellCaster = player;
|
spellCaster = player;
|
||||||
|
|
@ -1712,7 +1740,9 @@ void GameObject::Use(Unit* user)
|
||||||
}
|
}
|
||||||
// reset ritual for this GO
|
// reset ritual for this GO
|
||||||
else
|
else
|
||||||
{ ClearAllUsesData(); }
|
{
|
||||||
|
ClearAllUsesData();
|
||||||
|
}
|
||||||
|
|
||||||
// go to end function to spell casting
|
// go to end function to spell casting
|
||||||
break;
|
break;
|
||||||
|
|
@ -1879,10 +1909,14 @@ void GameObject::Use(Unit* user)
|
||||||
{
|
{
|
||||||
GameObjectInfo const* info = GetGOInfo();
|
GameObjectInfo const* info = GetGOInfo();
|
||||||
if (!info)
|
if (!info)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (user->GetTypeId() != TYPEID_PLAYER)
|
if (user->GetTypeId() != TYPEID_PLAYER)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Player* player = (Player*)user;
|
Player* player = (Player*)user;
|
||||||
|
|
||||||
|
|
@ -2379,13 +2413,21 @@ void GameObject::SetCapturePointSlider(float value, bool isLocked)
|
||||||
m_captureState = CAPTURE_STATE_WIN_ALLIANCE;
|
m_captureState = CAPTURE_STATE_WIN_ALLIANCE;
|
||||||
}
|
}
|
||||||
else if ((int)m_captureSlider == CAPTURE_SLIDER_HORDE)
|
else if ((int)m_captureSlider == CAPTURE_SLIDER_HORDE)
|
||||||
{ m_captureState = CAPTURE_STATE_WIN_HORDE; }
|
{
|
||||||
|
m_captureState = CAPTURE_STATE_WIN_HORDE;
|
||||||
|
}
|
||||||
else if (m_captureSlider > CAPTURE_SLIDER_MIDDLE + info->capturePoint.neutralPercent * 0.5f)
|
else if (m_captureSlider > CAPTURE_SLIDER_MIDDLE + info->capturePoint.neutralPercent * 0.5f)
|
||||||
{ m_captureState = CAPTURE_STATE_PROGRESS_ALLIANCE; }
|
{
|
||||||
|
m_captureState = CAPTURE_STATE_PROGRESS_ALLIANCE;
|
||||||
|
}
|
||||||
else if (m_captureSlider < CAPTURE_SLIDER_MIDDLE - info->capturePoint.neutralPercent * 0.5f)
|
else if (m_captureSlider < CAPTURE_SLIDER_MIDDLE - info->capturePoint.neutralPercent * 0.5f)
|
||||||
{ m_captureState = CAPTURE_STATE_PROGRESS_HORDE; }
|
{
|
||||||
|
m_captureState = CAPTURE_STATE_PROGRESS_HORDE;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ m_captureState = CAPTURE_STATE_NEUTRAL; }
|
{
|
||||||
|
m_captureState = CAPTURE_STATE_NEUTRAL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameObject::TickCapturePoint()
|
void GameObject::TickCapturePoint()
|
||||||
|
|
@ -2413,7 +2455,9 @@ void GameObject::TickCapturePoint()
|
||||||
++rangePlayers;
|
++rangePlayers;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ --rangePlayers; }
|
{
|
||||||
|
--rangePlayers;
|
||||||
|
}
|
||||||
|
|
||||||
ObjectGuid guid = (*itr)->GetObjectGuid();
|
ObjectGuid guid = (*itr)->GetObjectGuid();
|
||||||
if (!tempUsers.erase(guid))
|
if (!tempUsers.erase(guid))
|
||||||
|
|
@ -2462,7 +2506,9 @@ void GameObject::TickCapturePoint()
|
||||||
rangePlayers = maxSuperiority;
|
rangePlayers = maxSuperiority;
|
||||||
}
|
}
|
||||||
else if (rangePlayers < -maxSuperiority)
|
else if (rangePlayers < -maxSuperiority)
|
||||||
{ rangePlayers = -maxSuperiority; }
|
{
|
||||||
|
rangePlayers = -maxSuperiority;
|
||||||
|
}
|
||||||
|
|
||||||
// time to capture from 0% to 100% is maxTime for minSuperiority amount of players and minTime for maxSuperiority amount of players (linear function: y = dy/dx*x+d)
|
// time to capture from 0% to 100% is maxTime for minSuperiority amount of players and minTime for maxSuperiority amount of players (linear function: y = dy/dx*x+d)
|
||||||
float deltaSlider = info->capturePoint.minTime;
|
float deltaSlider = info->capturePoint.minTime;
|
||||||
|
|
@ -2597,7 +2643,9 @@ void GameObject::DealGameObjectDamage(uint32 damage, uint32 spell, Unit* caster)
|
||||||
MANGOS_ASSERT(spell && sSpellStore.LookupEntry(spell) && caster);
|
MANGOS_ASSERT(spell && sSpellStore.LookupEntry(spell) && caster);
|
||||||
|
|
||||||
if (!damage)
|
if (!damage)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ForceGameObjectHealth(-int32(damage), caster);
|
ForceGameObjectHealth(-int32(damage), caster);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -694,7 +694,9 @@ class GameObject : public WorldObject
|
||||||
return m_respawnTime;
|
return m_respawnTime;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return now; }
|
{
|
||||||
|
return now;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetRespawnTime(time_t respawn)
|
void SetRespawnTime(time_t respawn)
|
||||||
|
|
|
||||||
|
|
@ -350,7 +350,9 @@ bool Guild::CheckGuildStructure()
|
||||||
{ return false; } // guild will disbanded and deleted in caller
|
{ return false; } // guild will disbanded and deleted in caller
|
||||||
}
|
}
|
||||||
else if (GM_rights != GR_GUILDMASTER)
|
else if (GM_rights != GR_GUILDMASTER)
|
||||||
{ SetLeader(m_LeaderGuid); }
|
{
|
||||||
|
SetLeader(m_LeaderGuid);
|
||||||
|
}
|
||||||
|
|
||||||
// Allow only 1 guildmaster, set other to officer
|
// Allow only 1 guildmaster, set other to officer
|
||||||
for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
|
for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
|
||||||
|
|
@ -825,7 +827,9 @@ void Guild::AddRank(const std::string& name_, uint32 rights, uint32 money)
|
||||||
void Guild::DelRank(uint32 rankId)
|
void Guild::DelRank(uint32 rankId)
|
||||||
{
|
{
|
||||||
if (rankId >= m_Ranks.size())
|
if (rankId >= m_Ranks.size())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// client won't allow to have less than GUILD_RANKS_MIN_COUNT ranks in guild
|
// client won't allow to have less than GUILD_RANKS_MIN_COUNT ranks in guild
|
||||||
if (m_Ranks.size() <= GUILD_RANKS_MIN_COUNT || rankId < GUILD_RANKS_MIN_COUNT)
|
if (m_Ranks.size() <= GUILD_RANKS_MIN_COUNT || rankId < GUILD_RANKS_MIN_COUNT)
|
||||||
|
|
@ -846,10 +850,14 @@ void Guild::DelRank(uint32 rankId)
|
||||||
void Guild::SwitchRank(uint32 rankId, bool up)
|
void Guild::SwitchRank(uint32 rankId, bool up)
|
||||||
{
|
{
|
||||||
if (rankId >= m_Ranks.size())
|
if (rankId >= m_Ranks.size())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ((rankId == GR_GUILDMASTER && up) || (rankId == GetLowestRank() && !up))
|
if ((rankId == GR_GUILDMASTER && up) || (rankId == GetLowestRank() && !up))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 otherRankId = rankId + (up ? -1 : 1);
|
uint32 otherRankId = rankId + (up ? -1 : 1);
|
||||||
DEBUG_LOG("rank: %u otherrank %u", rankId, otherRankId);
|
DEBUG_LOG("rank: %u otherrank %u", rankId, otherRankId);
|
||||||
|
|
@ -1048,7 +1056,9 @@ void Guild::Roster(WorldSession* session /*= NULL*/)
|
||||||
session->SendPacket(&data);
|
session->SendPacket(&data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ BroadcastPacket(&data); }
|
{
|
||||||
|
BroadcastPacket(&data);
|
||||||
|
}
|
||||||
DEBUG_LOG("WORLD: Sent (SMSG_GUILD_ROSTER)");
|
DEBUG_LOG("WORLD: Sent (SMSG_GUILD_ROSTER)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1254,12 +1264,16 @@ void Guild::LogGuildEvent(uint8 EventType, ObjectGuid playerGuid1, ObjectGuid pl
|
||||||
void Guild::DisplayGuildBankContent(WorldSession* session, uint8 TabId)
|
void Guild::DisplayGuildBankContent(WorldSession* session, uint8 TabId)
|
||||||
{
|
{
|
||||||
if (TabId >= GetPurchasedTabs())
|
if (TabId >= GetPurchasedTabs())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
GuildBankTab const* tab = m_TabListMap[TabId];
|
GuildBankTab const* tab = m_TabListMap[TabId];
|
||||||
|
|
||||||
if (!IsMemberHaveRights(session->GetPlayer()->GetGUIDLow(), TabId, GUILD_BANK_RIGHT_VIEW_TAB))
|
if (!IsMemberHaveRights(session->GetPlayer()->GetGUIDLow(), TabId, GUILD_BANK_RIGHT_VIEW_TAB))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
WorldPacket data(SMSG_GUILD_BANK_LIST, 1200);
|
WorldPacket data(SMSG_GUILD_BANK_LIST, 1200);
|
||||||
ByteBuffer buffer;
|
ByteBuffer buffer;
|
||||||
|
|
@ -1395,7 +1409,9 @@ void Guild::DisplayGuildBankContentUpdate(uint8 TabId, GuildItemPosCountVec cons
|
||||||
Item* Guild::GetItem(uint8 TabId, uint8 SlotId)
|
Item* Guild::GetItem(uint8 TabId, uint8 SlotId)
|
||||||
{
|
{
|
||||||
if (TabId >= GetPurchasedTabs() || SlotId >= GUILD_BANK_MAX_SLOTS)
|
if (TabId >= GetPurchasedTabs() || SlotId >= GUILD_BANK_MAX_SLOTS)
|
||||||
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
return m_TabListMap[TabId]->Slots[SlotId];
|
return m_TabListMap[TabId]->Slots[SlotId];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1436,7 +1452,9 @@ void Guild::DisplayGuildBankTabsInfo(WorldSession* session)
|
||||||
void Guild::CreateNewBankTab()
|
void Guild::CreateNewBankTab()
|
||||||
{
|
{
|
||||||
if (GetPurchasedTabs() >= GUILD_BANK_MAX_TABS)
|
if (GetPurchasedTabs() >= GUILD_BANK_MAX_TABS)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 tabId = GetPurchasedTabs(); // next free id
|
uint32 tabId = GetPurchasedTabs(); // next free id
|
||||||
m_TabListMap.push_back(new GuildBankTab);
|
m_TabListMap.push_back(new GuildBankTab);
|
||||||
|
|
@ -1450,7 +1468,9 @@ void Guild::CreateNewBankTab()
|
||||||
void Guild::SetGuildBankTabInfo(uint8 TabId, std::string Name, std::string Icon)
|
void Guild::SetGuildBankTabInfo(uint8 TabId, std::string Name, std::string Icon)
|
||||||
{
|
{
|
||||||
if (m_TabListMap[TabId]->Name == Name && m_TabListMap[TabId]->Icon == Icon)
|
if (m_TabListMap[TabId]->Name == Name && m_TabListMap[TabId]->Icon == Icon)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_TabListMap[TabId]->Name = Name;
|
m_TabListMap[TabId]->Name = Name;
|
||||||
m_TabListMap[TabId]->Icon = Icon;
|
m_TabListMap[TabId]->Icon = Icon;
|
||||||
|
|
@ -1463,7 +1483,9 @@ void Guild::SetGuildBankTabInfo(uint8 TabId, std::string Name, std::string Icon)
|
||||||
uint32 Guild::GetBankRights(uint32 rankId, uint8 TabId) const
|
uint32 Guild::GetBankRights(uint32 rankId, uint8 TabId) const
|
||||||
{
|
{
|
||||||
if (rankId >= m_Ranks.size() || TabId >= GUILD_BANK_MAX_TABS)
|
if (rankId >= m_Ranks.size() || TabId >= GUILD_BANK_MAX_TABS)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return m_Ranks[rankId].TabRight[TabId];
|
return m_Ranks[rankId].TabRight[TabId];
|
||||||
}
|
}
|
||||||
|
|
@ -1508,7 +1530,9 @@ void Guild::LoadGuildBankFromDB()
|
||||||
// 0 1 2 3 4 5
|
// 0 1 2 3 4 5
|
||||||
result = CharacterDatabase.PQuery("SELECT data, text, TabId, SlotId, item_guid, item_entry FROM guild_bank_item JOIN item_instance ON item_guid = guid WHERE guildid='%u' ORDER BY TabId", m_Id);
|
result = CharacterDatabase.PQuery("SELECT data, text, TabId, SlotId, item_guid, item_entry FROM guild_bank_item JOIN item_instance ON item_guid = guid WHERE guildid='%u' ORDER BY TabId", m_Id);
|
||||||
if (!result)
|
if (!result)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
@ -1571,7 +1595,9 @@ bool Guild::MemberMoneyWithdraw(uint64 amount, uint32 LowGuid)
|
||||||
uint64 MoneyWithDrawRight = GetMemberMoneyWithdrawRem(LowGuid);
|
uint64 MoneyWithDrawRight = GetMemberMoneyWithdrawRem(LowGuid);
|
||||||
|
|
||||||
if (MoneyWithDrawRight < amount || GetGuildBankMoney() < amount)
|
if (MoneyWithDrawRight < amount || GetGuildBankMoney() < amount)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
SetBankMoney(GetGuildBankMoney() - amount);
|
SetBankMoney(GetGuildBankMoney() - amount);
|
||||||
|
|
||||||
|
|
@ -1579,7 +1605,9 @@ bool Guild::MemberMoneyWithdraw(uint64 amount, uint32 LowGuid)
|
||||||
{
|
{
|
||||||
MemberList::iterator itr = members.find(LowGuid);
|
MemberList::iterator itr = members.find(LowGuid);
|
||||||
if (itr == members.end())
|
if (itr == members.end())
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
itr->second.BankRemMoney -= amount;
|
itr->second.BankRemMoney -= amount;
|
||||||
CharacterDatabase.PExecute("UPDATE guild_member SET BankRemMoney='%u' WHERE guildid='%u' AND guid='%u'",
|
CharacterDatabase.PExecute("UPDATE guild_member SET BankRemMoney='%u' WHERE guildid='%u' AND guid='%u'",
|
||||||
itr->second.BankRemMoney, m_Id, LowGuid);
|
itr->second.BankRemMoney, m_Id, LowGuid);
|
||||||
|
|
@ -1610,13 +1638,17 @@ bool Guild::MemberItemWithdraw(uint8 TabId, uint32 LowGuid)
|
||||||
uint32 SlotsWithDrawRight = GetMemberSlotWithdrawRem(LowGuid, TabId);
|
uint32 SlotsWithDrawRight = GetMemberSlotWithdrawRem(LowGuid, TabId);
|
||||||
|
|
||||||
if (SlotsWithDrawRight == 0)
|
if (SlotsWithDrawRight == 0)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (SlotsWithDrawRight < WITHDRAW_SLOT_UNLIMITED)
|
if (SlotsWithDrawRight < WITHDRAW_SLOT_UNLIMITED)
|
||||||
{
|
{
|
||||||
MemberList::iterator itr = members.find(LowGuid);
|
MemberList::iterator itr = members.find(LowGuid);
|
||||||
if (itr == members.end())
|
if (itr == members.end())
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
--itr->second.BankRemSlotsTab[TabId];
|
--itr->second.BankRemSlotsTab[TabId];
|
||||||
CharacterDatabase.PExecute("UPDATE guild_member SET BankRemSlotsTab%u='%u' WHERE guildid='%u' AND guid='%u'",
|
CharacterDatabase.PExecute("UPDATE guild_member SET BankRemSlotsTab%u='%u' WHERE guildid='%u' AND guid='%u'",
|
||||||
uint32(TabId), itr->second.BankRemSlotsTab[TabId], m_Id, LowGuid);
|
uint32(TabId), itr->second.BankRemSlotsTab[TabId], m_Id, LowGuid);
|
||||||
|
|
@ -1628,10 +1660,14 @@ bool Guild::IsMemberHaveRights(uint32 LowGuid, uint8 TabId, uint32 rights) const
|
||||||
{
|
{
|
||||||
MemberList::const_iterator itr = members.find(LowGuid);
|
MemberList::const_iterator itr = members.find(LowGuid);
|
||||||
if (itr == members.end())
|
if (itr == members.end())
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (itr->second.RankId == GR_GUILDMASTER)
|
if (itr->second.RankId == GR_GUILDMASTER)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return (GetBankRights(itr->second.RankId, TabId) & rights) == rights;
|
return (GetBankRights(itr->second.RankId, TabId) & rights) == rights;
|
||||||
}
|
}
|
||||||
|
|
@ -1640,14 +1676,20 @@ uint32 Guild::GetMemberSlotWithdrawRem(uint32 LowGuid, uint8 TabId)
|
||||||
{
|
{
|
||||||
MemberList::iterator itr = members.find(LowGuid);
|
MemberList::iterator itr = members.find(LowGuid);
|
||||||
if (itr == members.end())
|
if (itr == members.end())
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
MemberSlot& member = itr->second;
|
MemberSlot& member = itr->second;
|
||||||
if (member.RankId == GR_GUILDMASTER)
|
if (member.RankId == GR_GUILDMASTER)
|
||||||
|
{
|
||||||
return WITHDRAW_SLOT_UNLIMITED;
|
return WITHDRAW_SLOT_UNLIMITED;
|
||||||
|
}
|
||||||
|
|
||||||
if ((GetBankRights(member.RankId, TabId) & GUILD_BANK_RIGHT_VIEW_TAB) != GUILD_BANK_RIGHT_VIEW_TAB)
|
if ((GetBankRights(member.RankId, TabId) & GUILD_BANK_RIGHT_VIEW_TAB) != GUILD_BANK_RIGHT_VIEW_TAB)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 curTime = uint32(time(NULL) / MINUTE);
|
uint32 curTime = uint32(time(NULL) / MINUTE);
|
||||||
if (curTime - member.BankResetTimeTab[TabId] >= 24 * HOUR / MINUTE)
|
if (curTime - member.BankResetTimeTab[TabId] >= 24 * HOUR / MINUTE)
|
||||||
|
|
@ -1664,11 +1706,15 @@ uint64 Guild::GetMemberMoneyWithdrawRem(uint32 LowGuid)
|
||||||
{
|
{
|
||||||
MemberList::iterator itr = members.find(LowGuid);
|
MemberList::iterator itr = members.find(LowGuid);
|
||||||
if (itr == members.end())
|
if (itr == members.end())
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
MemberSlot& member = itr->second;
|
MemberSlot& member = itr->second;
|
||||||
if (member.RankId == GR_GUILDMASTER)
|
if (member.RankId == GR_GUILDMASTER)
|
||||||
|
{
|
||||||
return WITHDRAW_MONEY_UNLIMITED;
|
return WITHDRAW_MONEY_UNLIMITED;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 curTime = uint32(time(NULL) / MINUTE); // minutes
|
uint32 curTime = uint32(time(NULL) / MINUTE); // minutes
|
||||||
// 24 hours
|
// 24 hours
|
||||||
|
|
@ -1685,7 +1731,9 @@ uint64 Guild::GetMemberMoneyWithdrawRem(uint32 LowGuid)
|
||||||
void Guild::SetBankMoneyPerDay(uint32 rankId, uint32 money)
|
void Guild::SetBankMoneyPerDay(uint32 rankId, uint32 money)
|
||||||
{
|
{
|
||||||
if (rankId >= m_Ranks.size())
|
if (rankId >= m_Ranks.size())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (rankId == GR_GUILDMASTER)
|
if (rankId == GR_GUILDMASTER)
|
||||||
money = (uint32)WITHDRAW_MONEY_UNLIMITED;
|
money = (uint32)WITHDRAW_MONEY_UNLIMITED;
|
||||||
|
|
@ -1738,20 +1786,28 @@ void Guild::SetBankRightsAndSlots(uint32 rankId, uint8 TabId, uint32 right, uint
|
||||||
uint32 Guild::GetBankMoneyPerDay(uint32 rankId)
|
uint32 Guild::GetBankMoneyPerDay(uint32 rankId)
|
||||||
{
|
{
|
||||||
if (rankId >= m_Ranks.size())
|
if (rankId >= m_Ranks.size())
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (rankId == GR_GUILDMASTER)
|
if (rankId == GR_GUILDMASTER)
|
||||||
|
{
|
||||||
return (uint32)WITHDRAW_MONEY_UNLIMITED;
|
return (uint32)WITHDRAW_MONEY_UNLIMITED;
|
||||||
|
}
|
||||||
return m_Ranks[rankId].BankMoneyPerDay;
|
return m_Ranks[rankId].BankMoneyPerDay;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Guild::GetBankSlotPerDay(uint32 rankId, uint8 TabId)
|
uint32 Guild::GetBankSlotPerDay(uint32 rankId, uint8 TabId)
|
||||||
{
|
{
|
||||||
if (rankId >= m_Ranks.size() || TabId >= GUILD_BANK_MAX_TABS)
|
if (rankId >= m_Ranks.size() || TabId >= GUILD_BANK_MAX_TABS)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (rankId == GR_GUILDMASTER)
|
if (rankId == GR_GUILDMASTER)
|
||||||
|
{
|
||||||
return WITHDRAW_SLOT_UNLIMITED;
|
return WITHDRAW_SLOT_UNLIMITED;
|
||||||
|
}
|
||||||
return m_Ranks[rankId].TabSlotPerDay[TabId];
|
return m_Ranks[rankId].TabSlotPerDay[TabId];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1761,7 +1817,9 @@ uint32 Guild::GetBankSlotPerDay(uint32 rankId, uint8 TabId)
|
||||||
bool Guild::LoadBankRightsFromDB(QueryResult* guildBankTabRightsResult)
|
bool Guild::LoadBankRightsFromDB(QueryResult* guildBankTabRightsResult)
|
||||||
{
|
{
|
||||||
if (!guildBankTabRightsResult)
|
if (!guildBankTabRightsResult)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
@ -1850,7 +1908,9 @@ void Guild::LoadGuildBankEventLogFromDB()
|
||||||
// 0 1 2 3 4 5 6
|
// 0 1 2 3 4 5 6
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT LogGuid, EventType, PlayerGuid, ItemOrMoney, ItemStackCount, DestTabId, TimeStamp FROM guild_bank_eventlog WHERE guildid='%u' AND TabId='%u' ORDER BY TimeStamp DESC,LogGuid DESC LIMIT %u", m_Id, GUILD_BANK_MONEY_LOGS_TAB, GUILD_BANK_MAX_LOGS);
|
QueryResult* result = CharacterDatabase.PQuery("SELECT LogGuid, EventType, PlayerGuid, ItemOrMoney, ItemStackCount, DestTabId, TimeStamp FROM guild_bank_eventlog WHERE guildid='%u' AND TabId='%u' ORDER BY TimeStamp DESC,LogGuid DESC LIMIT %u", m_Id, GUILD_BANK_MONEY_LOGS_TAB, GUILD_BANK_MAX_LOGS);
|
||||||
if (!result)
|
if (!result)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bool isNextMoneyLogGuidSet = false;
|
bool isNextMoneyLogGuidSet = false;
|
||||||
do
|
do
|
||||||
|
|
@ -1886,7 +1946,9 @@ void Guild::LoadGuildBankEventLogFromDB()
|
||||||
void Guild::DisplayGuildBankLogs(WorldSession* session, uint8 TabId)
|
void Guild::DisplayGuildBankLogs(WorldSession* session, uint8 TabId)
|
||||||
{
|
{
|
||||||
if (TabId > GUILD_BANK_MAX_TABS)
|
if (TabId > GUILD_BANK_MAX_TABS)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ByteBuffer buffer;
|
ByteBuffer buffer;
|
||||||
bool hasCashFlow = GetLevel() >= 5 && TabId == GUILD_BANK_MAX_TABS; // has Cash Flow perk
|
bool hasCashFlow = GetLevel() >= 5 && TabId == GUILD_BANK_MAX_TABS; // has Cash Flow perk
|
||||||
|
|
@ -2013,7 +2075,9 @@ void Guild::AppendDisplayGuildBankSlot(WorldPacket& data, ByteBuffer& buffer, Gu
|
||||||
Item* Guild::StoreItem(uint8 tabId, GuildItemPosCountVec const& dest, Item* pItem)
|
Item* Guild::StoreItem(uint8 tabId, GuildItemPosCountVec const& dest, Item* pItem)
|
||||||
{
|
{
|
||||||
if (!pItem)
|
if (!pItem)
|
||||||
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
Item* lastItem = pItem;
|
Item* lastItem = pItem;
|
||||||
|
|
||||||
|
|
@ -2040,7 +2104,9 @@ Item* Guild::StoreItem(uint8 tabId, GuildItemPosCountVec const& dest, Item* pIte
|
||||||
Item* Guild::_StoreItem(uint8 tab, uint8 slot, Item* pItem, uint32 count, bool clone)
|
Item* Guild::_StoreItem(uint8 tab, uint8 slot, Item* pItem, uint32 count, bool clone)
|
||||||
{
|
{
|
||||||
if (!pItem)
|
if (!pItem)
|
||||||
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
DEBUG_LOG("GUILD STORAGE: StoreItem tab = %u, slot = %u, item = %u, count = %u", tab, slot, pItem->GetEntry(), count);
|
DEBUG_LOG("GUILD STORAGE: StoreItem tab = %u, slot = %u, item = %u, count = %u", tab, slot, pItem->GetEntry(), count);
|
||||||
|
|
||||||
|
|
@ -2054,7 +2120,9 @@ Item* Guild::_StoreItem(uint8 tab, uint8 slot, Item* pItem, uint32 count, bool c
|
||||||
pItem->SetCount(count);
|
pItem->SetCount(count);
|
||||||
|
|
||||||
if (!pItem)
|
if (!pItem)
|
||||||
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
m_TabListMap[tab]->Slots[slot] = pItem;
|
m_TabListMap[tab]->Slots[slot] = pItem;
|
||||||
|
|
||||||
|
|
@ -2111,11 +2179,15 @@ InventoryResult Guild::_CanStoreItem_InSpecificSlot(uint8 tab, uint8 slot, Guild
|
||||||
{
|
{
|
||||||
// check item type
|
// check item type
|
||||||
if (pItem2->GetEntry() != pSrcItem->GetEntry())
|
if (pItem2->GetEntry() != pSrcItem->GetEntry())
|
||||||
|
{
|
||||||
return EQUIP_ERR_ITEM_CANT_STACK;
|
return EQUIP_ERR_ITEM_CANT_STACK;
|
||||||
|
}
|
||||||
|
|
||||||
// check free space
|
// check free space
|
||||||
if (pItem2->GetCount() >= pSrcItem->GetMaxStackCount())
|
if (pItem2->GetCount() >= pSrcItem->GetMaxStackCount())
|
||||||
|
{
|
||||||
return EQUIP_ERR_ITEM_CANT_STACK;
|
return EQUIP_ERR_ITEM_CANT_STACK;
|
||||||
|
}
|
||||||
|
|
||||||
need_space = pSrcItem->GetMaxStackCount() - pItem2->GetCount();
|
need_space = pSrcItem->GetMaxStackCount() - pItem2->GetCount();
|
||||||
}
|
}
|
||||||
|
|
@ -2166,7 +2238,9 @@ InventoryResult Guild::_CanStoreItem_InTab(uint8 tab, GuildItemPosCountVec& dest
|
||||||
count -= need_space;
|
count -= need_space;
|
||||||
|
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
|
{
|
||||||
return EQUIP_ERR_OK;
|
return EQUIP_ERR_OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2183,7 +2257,9 @@ InventoryResult Guild::_CanStoreItem_InTab(uint8 tab, GuildItemPosCountVec& dest
|
||||||
count -= need_space;
|
count -= need_space;
|
||||||
|
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
|
{
|
||||||
return EQUIP_ERR_OK;
|
return EQUIP_ERR_OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2195,20 +2271,28 @@ InventoryResult Guild::CanStoreItem(uint8 tab, uint8 slot, GuildItemPosCountVec&
|
||||||
DEBUG_LOG("GUILD STORAGE: CanStoreItem tab = %u, slot = %u, item = %u, count = %u", tab, slot, pItem->GetEntry(), count);
|
DEBUG_LOG("GUILD STORAGE: CanStoreItem tab = %u, slot = %u, item = %u, count = %u", tab, slot, pItem->GetEntry(), count);
|
||||||
|
|
||||||
if (count > pItem->GetCount())
|
if (count > pItem->GetCount())
|
||||||
|
{
|
||||||
return EQUIP_ERR_COULDNT_SPLIT_ITEMS;
|
return EQUIP_ERR_COULDNT_SPLIT_ITEMS;
|
||||||
|
}
|
||||||
|
|
||||||
if (pItem->IsSoulBound())
|
if (pItem->IsSoulBound())
|
||||||
|
{
|
||||||
return EQUIP_ERR_CANT_DROP_SOULBOUND;
|
return EQUIP_ERR_CANT_DROP_SOULBOUND;
|
||||||
|
}
|
||||||
|
|
||||||
// in specific slot
|
// in specific slot
|
||||||
if (slot != NULL_SLOT)
|
if (slot != NULL_SLOT)
|
||||||
{
|
{
|
||||||
InventoryResult res = _CanStoreItem_InSpecificSlot(tab, slot, dest, count, swap, pItem);
|
InventoryResult res = _CanStoreItem_InSpecificSlot(tab, slot, dest, count, swap, pItem);
|
||||||
if (res != EQUIP_ERR_OK)
|
if (res != EQUIP_ERR_OK)
|
||||||
|
{
|
||||||
return res;
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
|
{
|
||||||
return EQUIP_ERR_OK;
|
return EQUIP_ERR_OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// not specific slot or have space for partly store only in specific slot
|
// not specific slot or have space for partly store only in specific slot
|
||||||
|
|
@ -2218,19 +2302,27 @@ InventoryResult Guild::CanStoreItem(uint8 tab, uint8 slot, GuildItemPosCountVec&
|
||||||
{
|
{
|
||||||
InventoryResult res = _CanStoreItem_InTab(tab, dest, count, true, pItem, slot);
|
InventoryResult res = _CanStoreItem_InTab(tab, dest, count, true, pItem, slot);
|
||||||
if (res != EQUIP_ERR_OK)
|
if (res != EQUIP_ERR_OK)
|
||||||
|
{
|
||||||
return res;
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
|
{
|
||||||
return EQUIP_ERR_OK;
|
return EQUIP_ERR_OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// search free slot in bag for place to
|
// search free slot in bag for place to
|
||||||
InventoryResult res = _CanStoreItem_InTab(tab, dest, count, false, pItem, slot);
|
InventoryResult res = _CanStoreItem_InTab(tab, dest, count, false, pItem, slot);
|
||||||
if (res != EQUIP_ERR_OK)
|
if (res != EQUIP_ERR_OK)
|
||||||
|
{
|
||||||
return res;
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
|
{
|
||||||
return EQUIP_ERR_OK;
|
return EQUIP_ERR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
return EQUIP_ERR_BANK_FULL;
|
return EQUIP_ERR_BANK_FULL;
|
||||||
}
|
}
|
||||||
|
|
@ -2238,13 +2330,19 @@ InventoryResult Guild::CanStoreItem(uint8 tab, uint8 slot, GuildItemPosCountVec&
|
||||||
void Guild::SetGuildBankTabText(uint8 TabId, std::string text)
|
void Guild::SetGuildBankTabText(uint8 TabId, std::string text)
|
||||||
{
|
{
|
||||||
if (TabId >= GetPurchasedTabs())
|
if (TabId >= GetPurchasedTabs())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_TabListMap[TabId])
|
if (!m_TabListMap[TabId])
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_TabListMap[TabId]->Text == text)
|
if (m_TabListMap[TabId]->Text == text)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
utf8truncate(text, 500); // DB and client size limitation
|
utf8truncate(text, 500); // DB and client size limitation
|
||||||
|
|
||||||
|
|
@ -2276,11 +2374,15 @@ void Guild::SwapItems(Player* pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankTa
|
||||||
{
|
{
|
||||||
// empty operation
|
// empty operation
|
||||||
if (BankTab == BankTabDst && BankTabSlot == BankTabSlotDst)
|
if (BankTab == BankTabDst && BankTabSlot == BankTabSlotDst)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Item* pItemSrc = GetItem(BankTab, BankTabSlot);
|
Item* pItemSrc = GetItem(BankTab, BankTabSlot);
|
||||||
if (!pItemSrc) // may prevent crash
|
if (!pItemSrc) // may prevent crash
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (SplitedAmount > pItemSrc->GetCount())
|
if (SplitedAmount > pItemSrc->GetCount())
|
||||||
return; // cheating?
|
return; // cheating?
|
||||||
|
|
@ -2293,12 +2395,16 @@ void Guild::SwapItems(Player* pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankTa
|
||||||
{
|
{
|
||||||
// check dest pos rights (if different tabs)
|
// check dest pos rights (if different tabs)
|
||||||
if (!IsMemberHaveRights(pl->GetGUIDLow(), BankTabDst, GUILD_BANK_RIGHT_DEPOSIT_ITEM))
|
if (!IsMemberHaveRights(pl->GetGUIDLow(), BankTabDst, GUILD_BANK_RIGHT_DEPOSIT_ITEM))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// check source pos rights (if different tabs)
|
// check source pos rights (if different tabs)
|
||||||
uint32 remRight = GetMemberSlotWithdrawRem(pl->GetGUIDLow(), BankTab);
|
uint32 remRight = GetMemberSlotWithdrawRem(pl->GetGUIDLow(), BankTab);
|
||||||
if (remRight <= 0)
|
if (remRight <= 0)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SplitedAmount)
|
if (SplitedAmount)
|
||||||
|
|
@ -2368,12 +2474,16 @@ void Guild::SwapItems(Player* pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankTa
|
||||||
{
|
{
|
||||||
// check source pos rights (item swapped to src)
|
// check source pos rights (item swapped to src)
|
||||||
if (!IsMemberHaveRights(pl->GetGUIDLow(), BankTab, GUILD_BANK_RIGHT_DEPOSIT_ITEM))
|
if (!IsMemberHaveRights(pl->GetGUIDLow(), BankTab, GUILD_BANK_RIGHT_DEPOSIT_ITEM))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// check dest pos rights (item swapped to src)
|
// check dest pos rights (item swapped to src)
|
||||||
uint32 remRightDst = GetMemberSlotWithdrawRem(pl->GetGUIDLow(), BankTabDst);
|
uint32 remRightDst = GetMemberSlotWithdrawRem(pl->GetGUIDLow(), BankTabDst);
|
||||||
if (remRightDst <= 0)
|
if (remRightDst <= 0)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
|
|
@ -2403,7 +2513,9 @@ void Guild::MoveFromBankToChar(Player* pl, uint8 BankTab, uint8 BankTabSlot, uin
|
||||||
Item* pItemChar = pl->GetItemByPos(PlayerBag, PlayerSlot);
|
Item* pItemChar = pl->GetItemByPos(PlayerBag, PlayerSlot);
|
||||||
|
|
||||||
if (!pItemBank) // Problem to get bank item
|
if (!pItemBank) // Problem to get bank item
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (SplitedAmount > pItemBank->GetCount())
|
if (SplitedAmount > pItemBank->GetCount())
|
||||||
return; // cheating?
|
return; // cheating?
|
||||||
|
|
@ -2458,7 +2570,9 @@ void Guild::MoveFromBankToChar(Player* pl, uint8 BankTab, uint8 BankTabSlot, uin
|
||||||
// check source pos rights (item moved to inventory)
|
// check source pos rights (item moved to inventory)
|
||||||
uint32 remRight = GetMemberSlotWithdrawRem(pl->GetGUIDLow(), BankTab);
|
uint32 remRight = GetMemberSlotWithdrawRem(pl->GetGUIDLow(), BankTab);
|
||||||
if (remRight <= 0)
|
if (remRight <= 0)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
LogBankEvent(GUILD_BANK_LOG_WITHDRAW_ITEM, BankTab, pl->GetGUIDLow(), pItemBank->GetEntry(), pItemBank->GetCount());
|
LogBankEvent(GUILD_BANK_LOG_WITHDRAW_ITEM, BankTab, pl->GetGUIDLow(), pItemBank->GetEntry(), pItemBank->GetCount());
|
||||||
|
|
@ -2474,7 +2588,9 @@ void Guild::MoveFromBankToChar(Player* pl, uint8 BankTab, uint8 BankTabSlot, uin
|
||||||
{
|
{
|
||||||
// check source pos rights (item swapped to bank)
|
// check source pos rights (item swapped to bank)
|
||||||
if (!IsMemberHaveRights(pl->GetGUIDLow(), BankTab, GUILD_BANK_RIGHT_DEPOSIT_ITEM))
|
if (!IsMemberHaveRights(pl->GetGUIDLow(), BankTab, GUILD_BANK_RIGHT_DEPOSIT_ITEM))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (pItemChar)
|
if (pItemChar)
|
||||||
{
|
{
|
||||||
|
|
@ -2507,7 +2623,9 @@ void Guild::MoveFromBankToChar(Player* pl, uint8 BankTab, uint8 BankTabSlot, uin
|
||||||
// check source pos rights (item moved to inventory)
|
// check source pos rights (item moved to inventory)
|
||||||
uint32 remRight = GetMemberSlotWithdrawRem(pl->GetGUIDLow(), BankTab);
|
uint32 remRight = GetMemberSlotWithdrawRem(pl->GetGUIDLow(), BankTab);
|
||||||
if (remRight <= 0)
|
if (remRight <= 0)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (pItemChar)
|
if (pItemChar)
|
||||||
{
|
{
|
||||||
|
|
@ -2551,7 +2669,9 @@ void Guild::MoveFromCharToBank(Player* pl, uint8 PlayerBag, uint8 PlayerSlot, ui
|
||||||
Item* pItemChar = pl->GetItemByPos(PlayerBag, PlayerSlot);
|
Item* pItemChar = pl->GetItemByPos(PlayerBag, PlayerSlot);
|
||||||
|
|
||||||
if (!pItemChar) // Problem to get item from player
|
if (!pItemChar) // Problem to get item from player
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!pItemChar->CanBeTraded())
|
if (!pItemChar->CanBeTraded())
|
||||||
{
|
{
|
||||||
|
|
@ -2561,7 +2681,9 @@ void Guild::MoveFromCharToBank(Player* pl, uint8 PlayerBag, uint8 PlayerSlot, ui
|
||||||
|
|
||||||
// check source pos rights (item moved to bank)
|
// check source pos rights (item moved to bank)
|
||||||
if (!IsMemberHaveRights(pl->GetGUIDLow(), BankTab, GUILD_BANK_RIGHT_DEPOSIT_ITEM))
|
if (!IsMemberHaveRights(pl->GetGUIDLow(), BankTab, GUILD_BANK_RIGHT_DEPOSIT_ITEM))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (SplitedAmount > pItemChar->GetCount())
|
if (SplitedAmount > pItemChar->GetCount())
|
||||||
return; // cheating?
|
return; // cheating?
|
||||||
|
|
@ -2659,7 +2781,9 @@ void Guild::MoveFromCharToBank(Player* pl, uint8 PlayerBag, uint8 PlayerSlot, ui
|
||||||
// check bank pos rights (item swapped with inventory)
|
// check bank pos rights (item swapped with inventory)
|
||||||
uint32 remRight = GetMemberSlotWithdrawRem(pl->GetGUIDLow(), BankTab);
|
uint32 remRight = GetMemberSlotWithdrawRem(pl->GetGUIDLow(), BankTab);
|
||||||
if (remRight <= 0)
|
if (remRight <= 0)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// logging item move to bank
|
// logging item move to bank
|
||||||
|
|
@ -2714,7 +2838,9 @@ void Guild::BroadcastEvent(GuildEvents event, ObjectGuid guid, char const* str1
|
||||||
data << str2;
|
data << str2;
|
||||||
}
|
}
|
||||||
else if (str1)
|
else if (str1)
|
||||||
{ data << str1; }
|
{
|
||||||
|
data << str1;
|
||||||
|
}
|
||||||
|
|
||||||
if (guid)
|
if (guid)
|
||||||
data << ObjectGuid(guid);
|
data << ObjectGuid(guid);
|
||||||
|
|
@ -2749,7 +2875,9 @@ bool GuildItemPosCount::isContainedIn(GuildItemPosCountVec const& vec) const
|
||||||
{
|
{
|
||||||
for (GuildItemPosCountVec::const_iterator itr = vec.begin(); itr != vec.end(); ++itr)
|
for (GuildItemPosCountVec::const_iterator itr = vec.begin(); itr != vec.end(); ++itr)
|
||||||
if (itr->Slot == this->Slot)
|
if (itr->Slot == this->Slot)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -424,7 +424,9 @@ class Guild
|
||||||
{
|
{
|
||||||
for (MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr)
|
for (MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr)
|
||||||
if (itr->second.RankId == rankId)
|
if (itr->second.RankId == rankId)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,9 @@ void AddItemsSetItem(Player* player, Item* item)
|
||||||
player->ItemSetEff[x] = eff;
|
player->ItemSetEff[x] = eff;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ player->ItemSetEff.push_back(eff); }
|
{
|
||||||
|
player->ItemSetEff.push_back(eff);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
++eff->item_count;
|
++eff->item_count;
|
||||||
|
|
@ -228,7 +230,9 @@ bool ItemCanGoIntoBag(ItemPrototype const* pProto, ItemPrototype const* pBagProt
|
||||||
return true;
|
return true;
|
||||||
case ITEM_SUBCLASS_MINING_CONTAINER:
|
case ITEM_SUBCLASS_MINING_CONTAINER:
|
||||||
if (!(pProto->BagFamily & BAG_FAMILY_MINING_SUPP))
|
if (!(pProto->BagFamily & BAG_FAMILY_MINING_SUPP))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
case ITEM_SUBCLASS_ENGINEERING_CONTAINER:
|
case ITEM_SUBCLASS_ENGINEERING_CONTAINER:
|
||||||
if (!(pProto->BagFamily & BAG_FAMILY_ENGINEERING_SUPP))
|
if (!(pProto->BagFamily & BAG_FAMILY_ENGINEERING_SUPP))
|
||||||
|
|
@ -238,19 +242,27 @@ bool ItemCanGoIntoBag(ItemPrototype const* pProto, ItemPrototype const* pBagProt
|
||||||
return true;
|
return true;
|
||||||
case ITEM_SUBCLASS_GEM_CONTAINER:
|
case ITEM_SUBCLASS_GEM_CONTAINER:
|
||||||
if (!(pProto->BagFamily & BAG_FAMILY_GEMS))
|
if (!(pProto->BagFamily & BAG_FAMILY_GEMS))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
case ITEM_SUBCLASS_LEATHERWORKING_CONTAINER:
|
case ITEM_SUBCLASS_LEATHERWORKING_CONTAINER:
|
||||||
if (!(pProto->BagFamily & BAG_FAMILY_LEATHERWORKING_SUPP))
|
if (!(pProto->BagFamily & BAG_FAMILY_LEATHERWORKING_SUPP))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
case ITEM_SUBCLASS_INSCRIPTION_CONTAINER:
|
case ITEM_SUBCLASS_INSCRIPTION_CONTAINER:
|
||||||
if (!(pProto->BagFamily & BAG_FAMILY_INSCRIPTION_SUPP))
|
if (!(pProto->BagFamily & BAG_FAMILY_INSCRIPTION_SUPP))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
case ITEM_SUBCLASS_FISHING_CONTAINER:
|
case ITEM_SUBCLASS_FISHING_CONTAINER:
|
||||||
if (!(pProto->BagFamily & BAG_FAMILY_FISHING_SUPP))
|
if (!(pProto->BagFamily & BAG_FAMILY_FISHING_SUPP))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -280,7 +292,9 @@ bool ItemCanGoIntoBag(ItemPrototype const* pProto, ItemPrototype const* pBagProt
|
||||||
uint32 ItemPrototype::GetArmor() const
|
uint32 ItemPrototype::GetArmor() const
|
||||||
{
|
{
|
||||||
if (Quality >= ITEM_QUALITY_HEIRLOOM) // heirlooms have it's own dbc...
|
if (Quality >= ITEM_QUALITY_HEIRLOOM) // heirlooms have it's own dbc...
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (Class == ITEM_CLASS_ARMOR && SubClass == ITEM_SUBCLASS_ARMOR_SHIELD)
|
if (Class == ITEM_CLASS_ARMOR && SubClass == ITEM_SUBCLASS_ARMOR_SHIELD)
|
||||||
{
|
{
|
||||||
|
|
@ -295,7 +309,9 @@ uint32 ItemPrototype::GetArmor() const
|
||||||
ItemArmorTotalEntry const* iat = sItemArmorTotalStore.LookupEntry(ItemLevel);
|
ItemArmorTotalEntry const* iat = sItemArmorTotalStore.LookupEntry(ItemLevel);
|
||||||
|
|
||||||
if (!iaq || !iat)
|
if (!iaq || !iat)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (InventoryType != INVTYPE_HEAD && InventoryType != INVTYPE_CHEST && InventoryType != INVTYPE_SHOULDERS &&
|
if (InventoryType != INVTYPE_HEAD && InventoryType != INVTYPE_CHEST && InventoryType != INVTYPE_SHOULDERS &&
|
||||||
InventoryType != INVTYPE_LEGS && InventoryType != INVTYPE_FEET && InventoryType != INVTYPE_WRISTS &&
|
InventoryType != INVTYPE_LEGS && InventoryType != INVTYPE_FEET && InventoryType != INVTYPE_WRISTS &&
|
||||||
|
|
@ -311,7 +327,9 @@ uint32 ItemPrototype::GetArmor() const
|
||||||
al = sArmorLocationStore.LookupEntry(InventoryType);
|
al = sArmorLocationStore.LookupEntry(InventoryType);
|
||||||
|
|
||||||
if (!al)
|
if (!al)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
float iatMult, alMult;
|
float iatMult, alMult;
|
||||||
|
|
||||||
|
|
@ -347,7 +365,9 @@ float ItemPrototype::getDPS() const
|
||||||
if (Class == ITEM_CLASS_WEAPON)
|
if (Class == ITEM_CLASS_WEAPON)
|
||||||
{
|
{
|
||||||
if (Quality >= ITEM_QUALITY_HEIRLOOM) // heirlooms have it's own dbc...
|
if (Quality >= ITEM_QUALITY_HEIRLOOM) // heirlooms have it's own dbc...
|
||||||
|
{
|
||||||
return damage;
|
return damage;
|
||||||
|
}
|
||||||
|
|
||||||
ItemDamageEntry const* id = NULL;
|
ItemDamageEntry const* id = NULL;
|
||||||
|
|
||||||
|
|
@ -395,7 +415,9 @@ float ItemPrototype::getDPS() const
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!id)
|
if (!id)
|
||||||
|
{
|
||||||
return damage;
|
return damage;
|
||||||
|
}
|
||||||
|
|
||||||
return id->Value[Quality];
|
return id->Value[Quality];
|
||||||
}
|
}
|
||||||
|
|
@ -455,7 +477,9 @@ bool Item::Create(uint32 guidlow, uint32 itemid, Player const* owner)
|
||||||
bool Item::IsNotEmptyBag() const
|
bool Item::IsNotEmptyBag() const
|
||||||
{
|
{
|
||||||
if (Bag const* bag = ToBag())
|
if (Bag const* bag = ToBag())
|
||||||
|
{
|
||||||
return !bag->IsEmpty();
|
return !bag->IsEmpty();
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -820,7 +844,9 @@ uint32 Item::GetSkill()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return item_weapon_skills[proto->SubClass]; }
|
{
|
||||||
|
return item_weapon_skills[proto->SubClass];
|
||||||
|
}
|
||||||
|
|
||||||
case ITEM_CLASS_ARMOR:
|
case ITEM_CLASS_ARMOR:
|
||||||
if (proto->SubClass >= MAX_ITEM_SUBCLASS_ARMOR)
|
if (proto->SubClass >= MAX_ITEM_SUBCLASS_ARMOR)
|
||||||
|
|
@ -828,7 +854,9 @@ uint32 Item::GetSkill()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return item_armor_skills[proto->SubClass]; }
|
{
|
||||||
|
return item_armor_skills[proto->SubClass];
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -846,7 +874,9 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id)
|
||||||
|
|
||||||
// item must have one from this field values not null if it can have random enchantments
|
// item must have one from this field values not null if it can have random enchantments
|
||||||
if ((!itemProto->RandomProperty) && (!itemProto->RandomSuffix))
|
if ((!itemProto->RandomProperty) && (!itemProto->RandomSuffix))
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Random Property case
|
// Random Property case
|
||||||
if (itemProto->RandomProperty)
|
if (itemProto->RandomProperty)
|
||||||
|
|
@ -920,7 +950,9 @@ bool Item::UpdateItemSuffixFactor()
|
||||||
{
|
{
|
||||||
uint32 suffixFactor = GenerateEnchSuffixFactor(GetEntry());
|
uint32 suffixFactor = GenerateEnchSuffixFactor(GetEntry());
|
||||||
if (GetItemSuffixFactor() == suffixFactor)
|
if (GetItemSuffixFactor() == suffixFactor)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
SetUInt32Value(ITEM_FIELD_PROPERTY_SEED, suffixFactor);
|
SetUInt32Value(ITEM_FIELD_PROPERTY_SEED, suffixFactor);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1086,7 +1118,9 @@ bool Item::IsBoundByEnchant() const
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enchant_slot == TRANSMOGRIFY_ENCHANTMENT_SLOT)
|
if (enchant_slot == TRANSMOGRIFY_ENCHANTMENT_SLOT)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (enchant_slot > PRISMATIC_ENCHANTMENT_SLOT && enchant_slot < PROP_ENCHANTMENT_SLOT_0)
|
if (enchant_slot > PRISMATIC_ENCHANTMENT_SLOT && enchant_slot < PROP_ENCHANTMENT_SLOT_0)
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1118,7 +1152,9 @@ bool Item::IsFitToSpellRequirements(SpellEntry const* spellInfo) const
|
||||||
{
|
{
|
||||||
// EffectItemType[0] is the associated scroll itemID, if a scroll can be made
|
// EffectItemType[0] is the associated scroll itemID, if a scroll can be made
|
||||||
if (spellEffect_0->EffectItemType == 0)
|
if (spellEffect_0->EffectItemType == 0)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
// Other checks do not apply to vellum enchants, so return final result
|
// Other checks do not apply to vellum enchants, so return final result
|
||||||
int32 eqItemClass = spellInfo->GetEquippedItemClass();
|
int32 eqItemClass = spellInfo->GetEquippedItemClass();
|
||||||
return proto->SubClass == ITEM_SUBCLASS_VELLUM && (eqItemClass == ITEM_CLASS_WEAPON || eqItemClass == ITEM_CLASS_ARMOR);
|
return proto->SubClass == ITEM_SUBCLASS_VELLUM && (eqItemClass == ITEM_CLASS_WEAPON || eqItemClass == ITEM_CLASS_ARMOR);
|
||||||
|
|
@ -1127,7 +1163,9 @@ bool Item::IsFitToSpellRequirements(SpellEntry const* spellInfo) const
|
||||||
|
|
||||||
SpellEquippedItemsEntry const* equippedItems = spellInfo->GetSpellEquippedItems();
|
SpellEquippedItemsEntry const* equippedItems = spellInfo->GetSpellEquippedItems();
|
||||||
if (!equippedItems)
|
if (!equippedItems)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (equippedItems->EquippedItemClass != -1) // -1 == any item class
|
if (equippedItems->EquippedItemClass != -1) // -1 == any item class
|
||||||
{
|
{
|
||||||
|
|
@ -1339,7 +1377,9 @@ void Item::SendTimeUpdate(Player* owner)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_PLAYERBOTS
|
#ifdef ENABLE_PLAYERBOTS
|
||||||
if (!owner || !owner->IsInWorld() || owner->GetPlayerbotAI())
|
if (!owner || !owner->IsInWorld() || owner->GetPlayerbotAI())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint32 duration = GetUInt32Value(ITEM_FIELD_DURATION);
|
uint32 duration = GetUInt32Value(ITEM_FIELD_DURATION);
|
||||||
|
|
@ -1380,7 +1420,9 @@ Item* Item::CreateItem(uint32 item, uint32 count, Player const* player, uint32 r
|
||||||
return pItem;
|
return pItem;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ delete pItem; }
|
{
|
||||||
|
delete pItem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -1422,7 +1464,9 @@ bool Item::IsBindedNotWith(Player const* player) const
|
||||||
|
|
||||||
// not BOA item case
|
// not BOA item case
|
||||||
if (!IsBoundAccountWide())
|
if (!IsBoundAccountWide())
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// online
|
// online
|
||||||
if (Player* owner = GetOwner())
|
if (Player* owner = GetOwner())
|
||||||
|
|
@ -1514,7 +1558,9 @@ bool Item::HasMaxCharges() const
|
||||||
|
|
||||||
for (int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
|
for (int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
|
||||||
if (GetSpellCharges(i) != itemProto->Spells[i].SpellCharges)
|
if (GetSpellCharges(i) != itemProto->Spells[i].SpellCharges)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1563,7 +1609,9 @@ void Item::SetLootState(ItemLootUpdateState state)
|
||||||
}
|
}
|
||||||
// temporary must stay until remove (ignore any changes)
|
// temporary must stay until remove (ignore any changes)
|
||||||
else if (m_lootState != ITEM_LOOT_TEMPORARY)
|
else if (m_lootState != ITEM_LOOT_TEMPORARY)
|
||||||
{ m_lootState = ITEM_LOOT_UNCHANGED; }
|
{
|
||||||
|
m_lootState = ITEM_LOOT_UNCHANGED;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ITEM_LOOT_REMOVED:
|
case ITEM_LOOT_REMOVED:
|
||||||
// if loot not saved then it existence in past can be just ignored
|
// if loot not saved then it existence in past can be just ignored
|
||||||
|
|
@ -1628,17 +1676,23 @@ int32 Item::GetReforgableStat(ItemModType statType) const
|
||||||
ItemPrototype const* proto = GetProto();
|
ItemPrototype const* proto = GetProto();
|
||||||
for (uint32 i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
|
for (uint32 i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
|
||||||
if (proto->ItemStat[i].ItemStatType == statType)
|
if (proto->ItemStat[i].ItemStatType == statType)
|
||||||
|
{
|
||||||
return proto->ItemStat[i].ItemStatValue;
|
return proto->ItemStat[i].ItemStatValue;
|
||||||
|
}
|
||||||
|
|
||||||
int32 randomPropId = GetItemRandomPropertyId();
|
int32 randomPropId = GetItemRandomPropertyId();
|
||||||
if (!randomPropId)
|
if (!randomPropId)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (randomPropId < 0)
|
if (randomPropId < 0)
|
||||||
{
|
{
|
||||||
ItemRandomSuffixEntry const* randomSuffix = sItemRandomSuffixStore.LookupEntry(-randomPropId);
|
ItemRandomSuffixEntry const* randomSuffix = sItemRandomSuffixStore.LookupEntry(-randomPropId);
|
||||||
if (!randomSuffix)
|
if (!randomSuffix)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
for (uint32 e = PROP_ENCHANTMENT_SLOT_0; e <= PROP_ENCHANTMENT_SLOT_4; ++e)
|
for (uint32 e = PROP_ENCHANTMENT_SLOT_0; e <= PROP_ENCHANTMENT_SLOT_4; ++e)
|
||||||
{
|
{
|
||||||
|
|
@ -1651,7 +1705,9 @@ int32 Item::GetReforgableStat(ItemModType statType) const
|
||||||
for (int k = 0; k < 5; ++k)
|
for (int k = 0; k < 5; ++k)
|
||||||
{
|
{
|
||||||
if (randomSuffix->enchant_id[k] == enchant->ID)
|
if (randomSuffix->enchant_id[k] == enchant->ID)
|
||||||
|
{
|
||||||
return int32((randomSuffix->prefix[k] * GetItemSuffixFactor()) / 10000);
|
return int32((randomSuffix->prefix[k] * GetItemSuffixFactor()) / 10000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1662,7 +1718,9 @@ int32 Item::GetReforgableStat(ItemModType statType) const
|
||||||
{
|
{
|
||||||
ItemRandomPropertiesEntry const* randomProp = sItemRandomPropertiesStore.LookupEntry(randomPropId);
|
ItemRandomPropertiesEntry const* randomProp = sItemRandomPropertiesStore.LookupEntry(randomPropId);
|
||||||
if (!randomProp)
|
if (!randomProp)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
for (uint32 e = PROP_ENCHANTMENT_SLOT_0; e <= PROP_ENCHANTMENT_SLOT_4; ++e)
|
for (uint32 e = PROP_ENCHANTMENT_SLOT_0; e <= PROP_ENCHANTMENT_SLOT_4; ++e)
|
||||||
{
|
{
|
||||||
|
|
@ -1675,7 +1733,9 @@ int32 Item::GetReforgableStat(ItemModType statType) const
|
||||||
for (int k = 0; k < 3; ++k)
|
for (int k = 0; k < 3; ++k)
|
||||||
{
|
{
|
||||||
if (randomProp->enchant_id[k] == enchant->ID)
|
if (randomProp->enchant_id[k] == enchant->ID)
|
||||||
|
{
|
||||||
return int32(enchant->amount[k]);
|
return int32(enchant->amount[k]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -168,13 +168,19 @@ uint32 GenerateEnchSuffixFactor(uint32 item_id)
|
||||||
ItemPrototype const* itemProto = ObjectMgr::GetItemPrototype(item_id);
|
ItemPrototype const* itemProto = ObjectMgr::GetItemPrototype(item_id);
|
||||||
|
|
||||||
if (!itemProto)
|
if (!itemProto)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
if (!itemProto->RandomSuffix)
|
if (!itemProto->RandomSuffix)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
RandomPropertiesPointsEntry const* randomProperty = sRandomPropertiesPointsStore.LookupEntry(itemProto->ItemLevel);
|
RandomPropertiesPointsEntry const* randomProperty = sRandomPropertiesPointsStore.LookupEntry(itemProto->ItemLevel);
|
||||||
if (!randomProperty)
|
if (!randomProperty)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 suffixFactor;
|
uint32 suffixFactor;
|
||||||
switch (itemProto->InventoryType)
|
switch (itemProto->InventoryType)
|
||||||
|
|
|
||||||
|
|
@ -274,11 +274,15 @@ bool LootStoreItem::Roll(bool rate) const
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == LOOTITEM_TYPE_CURRENCY)
|
if (type == LOOTITEM_TYPE_CURRENCY)
|
||||||
|
{
|
||||||
return roll_chance_f(chance * (rate ? sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_CURRENCY) : 1.0f));
|
return roll_chance_f(chance * (rate ? sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_CURRENCY) : 1.0f));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (needs_quest)
|
if (needs_quest)
|
||||||
|
{
|
||||||
return roll_chance_f(chance * (rate ? sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_ITEM_QUEST) : 1.0f));
|
return roll_chance_f(chance * (rate ? sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_ITEM_QUEST) : 1.0f));
|
||||||
|
}
|
||||||
|
|
||||||
ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(itemid);
|
ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(itemid);
|
||||||
|
|
||||||
|
|
@ -436,7 +440,9 @@ bool LootItem::AllowedForPlayer(Player const* player, WorldObject const* lootTar
|
||||||
{
|
{
|
||||||
// DB conditions check
|
// DB conditions check
|
||||||
if (conditionId && !sObjectMgr.IsPlayerMeetToCondition(conditionId, player, player->GetMap(), lootTarget, CONDITION_FROM_LOOT))
|
if (conditionId && !sObjectMgr.IsPlayerMeetToCondition(conditionId, player, player->GetMap(), lootTarget, CONDITION_FROM_LOOT))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (type == LOOT_ITEM_TYPE_ITEM)
|
if (type == LOOT_ITEM_TYPE_ITEM)
|
||||||
{
|
{
|
||||||
|
|
@ -592,7 +598,9 @@ bool Loot::FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner,
|
||||||
}
|
}
|
||||||
// ... for personal loot
|
// ... for personal loot
|
||||||
else
|
else
|
||||||
{ FillNotNormalLootFor(loot_owner); }
|
{
|
||||||
|
FillNotNormalLootFor(loot_owner);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -753,7 +761,9 @@ void Loot::NotifyItemRemoved(uint8 lootIndex)
|
||||||
pl->SendNotifyLootItemRemoved(lootIndex);
|
pl->SendNotifyLootItemRemoved(lootIndex);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_playersLooting.erase(i); }
|
{
|
||||||
|
m_playersLooting.erase(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -770,7 +780,9 @@ void Loot::NotifyMoneyRemoved()
|
||||||
pl->SendNotifyLootMoneyRemoved();
|
pl->SendNotifyLootMoneyRemoved();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_playersLooting.erase(i); }
|
{
|
||||||
|
m_playersLooting.erase(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -808,7 +820,9 @@ void Loot::NotifyQuestItemRemoved(uint8 questIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_playersLooting.erase(i); }
|
{
|
||||||
|
m_playersLooting.erase(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -821,9 +835,13 @@ void Loot::generateMoneyLoot(uint32 minAmount, uint32 maxAmount)
|
||||||
gold = uint32(maxAmount * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY));
|
gold = uint32(maxAmount * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY));
|
||||||
}
|
}
|
||||||
else if ((maxAmount - minAmount) < 32700)
|
else if ((maxAmount - minAmount) < 32700)
|
||||||
{ gold = uint32(urand(minAmount, maxAmount) * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY)); }
|
{
|
||||||
|
gold = uint32(urand(minAmount, maxAmount) * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ gold = uint32(urand(minAmount >> 8, maxAmount >> 8) * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY)) << 8; }
|
{
|
||||||
|
gold = uint32(urand(minAmount >> 8, maxAmount >> 8) * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY)) << 8;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1071,7 +1089,9 @@ void LootTemplate::LootGroup::AddEntry(LootStoreItem& item)
|
||||||
ExplicitlyChanced.push_back(item);
|
ExplicitlyChanced.push_back(item);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ EqualChanced.push_back(item); }
|
{
|
||||||
|
EqualChanced.push_back(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rolls an item from the group, returns NULL if all miss their chances
|
// Rolls an item from the group, returns NULL if all miss their chances
|
||||||
|
|
@ -1197,7 +1217,9 @@ void LootTemplate::LootGroup::CheckLootRefs(LootIdSet* ref_set) const
|
||||||
LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef);
|
LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef);
|
||||||
}
|
}
|
||||||
else if (ref_set)
|
else if (ref_set)
|
||||||
{ ref_set->erase(-ieItr->mincountOrRef); }
|
{
|
||||||
|
ref_set->erase(-ieItr->mincountOrRef);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1210,7 +1232,9 @@ void LootTemplate::LootGroup::CheckLootRefs(LootIdSet* ref_set) const
|
||||||
LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef);
|
LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef);
|
||||||
}
|
}
|
||||||
else if (ref_set)
|
else if (ref_set)
|
||||||
{ ref_set->erase(-ieItr->mincountOrRef); }
|
{
|
||||||
|
ref_set->erase(-ieItr->mincountOrRef);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1229,7 +1253,9 @@ void LootTemplate::AddEntry(LootStoreItem& item)
|
||||||
Groups[item.group - 1].AddEntry(item); // Adds new entry to the group
|
Groups[item.group - 1].AddEntry(item); // Adds new entry to the group
|
||||||
}
|
}
|
||||||
else // Non-grouped entries and references are stored together
|
else // Non-grouped entries and references are stored together
|
||||||
{ Entries.push_back(item); }
|
{
|
||||||
|
Entries.push_back(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rolls for every item in the template and adds the rolled items the the loot
|
// Rolls for every item in the template and adds the rolled items the the loot
|
||||||
|
|
@ -1369,7 +1395,9 @@ void LootTemplate::CheckLootRefs(LootIdSet* ref_set) const
|
||||||
LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef);
|
LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef);
|
||||||
}
|
}
|
||||||
else if (ref_set)
|
else if (ref_set)
|
||||||
{ ref_set->erase(-ieItr->mincountOrRef); }
|
{
|
||||||
|
ref_set->erase(-ieItr->mincountOrRef);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1394,7 +1422,9 @@ void LoadLootTemplates_Creature()
|
||||||
LootTemplates_Creature.ReportNotExistedId(lootid);
|
LootTemplates_Creature.ReportNotExistedId(lootid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ ids_setUsed.insert(lootid); }
|
{
|
||||||
|
ids_setUsed.insert(lootid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1426,7 +1456,9 @@ void LoadLootTemplates_Disenchant()
|
||||||
LootTemplates_Disenchant.ReportNotExistedId(lootid);
|
LootTemplates_Disenchant.ReportNotExistedId(lootid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ ids_setUsed.insert(lootid); }
|
{
|
||||||
|
ids_setUsed.insert(lootid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1473,7 +1505,9 @@ void LoadLootTemplates_Gameobject()
|
||||||
LootTemplates_Gameobject.ReportNotExistedId(lootid);
|
LootTemplates_Gameobject.ReportNotExistedId(lootid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ ids_setUsed.insert(lootid); }
|
{
|
||||||
|
ids_setUsed.insert(lootid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
|
for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
|
||||||
|
|
@ -1504,7 +1538,9 @@ void LoadLootTemplates_Item()
|
||||||
}
|
}
|
||||||
// wdb have wrong data cases, so skip by default
|
// wdb have wrong data cases, so skip by default
|
||||||
else if (!sLog.HasLogFilter(LOG_FILTER_DB_STRICTED_CHECK))
|
else if (!sLog.HasLogFilter(LOG_FILTER_DB_STRICTED_CHECK))
|
||||||
{ LootTemplates_Item.ReportNotExistedId(proto->ItemId); }
|
{
|
||||||
|
LootTemplates_Item.ReportNotExistedId(proto->ItemId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1554,7 +1590,9 @@ void LoadLootTemplates_Pickpocketing()
|
||||||
LootTemplates_Pickpocketing.ReportNotExistedId(lootid);
|
LootTemplates_Pickpocketing.ReportNotExistedId(lootid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ ids_setUsed.insert(lootid); }
|
{
|
||||||
|
ids_setUsed.insert(lootid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1624,7 +1662,9 @@ void LoadLootTemplates_Skinning()
|
||||||
LootTemplates_Skinning.ReportNotExistedId(lootid);
|
LootTemplates_Skinning.ReportNotExistedId(lootid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ ids_setUsed.insert(lootid); }
|
{
|
||||||
|
ids_setUsed.insert(lootid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1574,7 +1574,9 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z, Map* atMap
|
||||||
z = max_z;
|
z = max_z;
|
||||||
}
|
}
|
||||||
else if (z < ground_z)
|
else if (z < ground_z)
|
||||||
{ z = ground_z; }
|
{
|
||||||
|
z = ground_z;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -1601,7 +1603,9 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z, Map* atMap
|
||||||
z = max_z;
|
z = max_z;
|
||||||
}
|
}
|
||||||
else if (z < ground_z)
|
else if (z < ground_z)
|
||||||
{ z = ground_z; }
|
{
|
||||||
|
z = ground_z;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -1681,7 +1685,9 @@ namespace MaNGOS
|
||||||
text = i_textData->Content[loc_idx + 1].c_str();
|
text = i_textData->Content[loc_idx + 1].c_str();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ text = i_textData->Content[0].c_str(); }
|
{
|
||||||
|
text = i_textData->Content[0].c_str();
|
||||||
|
}
|
||||||
|
|
||||||
ChatHandler::BuildChatPacket(data, i_msgtype, text, i_language, CHAT_TAG_NONE, i_object.GetObjectGuid(), i_object.GetNameForLocaleIdx(loc_idx),
|
ChatHandler::BuildChatPacket(data, i_msgtype, text, i_language, CHAT_TAG_NONE, i_object.GetObjectGuid(), i_object.GetNameForLocaleIdx(loc_idx),
|
||||||
i_target ? i_target->GetObjectGuid() : ObjectGuid(), i_target ? i_target->GetNameForLocaleIdx(loc_idx) : "");
|
i_target ? i_target->GetObjectGuid() : ObjectGuid(), i_target ? i_target->GetNameForLocaleIdx(loc_idx) : "");
|
||||||
|
|
@ -1906,7 +1912,9 @@ GameObject* WorldObject::SummonGameObject(uint32 id, float x, float y, float z,
|
||||||
Map *map = GetMap();
|
Map *map = GetMap();
|
||||||
|
|
||||||
if (!map)
|
if (!map)
|
||||||
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!pGameObj->Create(map->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), id, map, GetPhaseMask(), x, y, z, angle))
|
if (!pGameObj->Create(map->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), id, map, GetPhaseMask(), x, y, z, angle))
|
||||||
{
|
{
|
||||||
|
|
@ -2001,7 +2009,9 @@ namespace MaNGOS
|
||||||
angle -= 2.0f * M_PI_F;
|
angle -= 2.0f * M_PI_F;
|
||||||
}
|
}
|
||||||
else if (angle < -M_PI_F)
|
else if (angle < -M_PI_F)
|
||||||
{ angle += 2.0f * M_PI_F; }
|
{
|
||||||
|
angle += 2.0f * M_PI_F;
|
||||||
|
}
|
||||||
|
|
||||||
i_selector.AddUsedArea(u, angle, dist2d);
|
i_selector.AddUsedArea(u, angle, dist2d);
|
||||||
}
|
}
|
||||||
|
|
@ -2035,7 +2045,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
||||||
if (searcher)
|
if (searcher)
|
||||||
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
|
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
|
||||||
else
|
else
|
||||||
{ UpdateGroundPositionZ(x, y, z); }
|
{
|
||||||
|
UpdateGroundPositionZ(x, y, z);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2063,7 +2075,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
||||||
if (searcher)
|
if (searcher)
|
||||||
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
|
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
|
||||||
else
|
else
|
||||||
{ UpdateGroundPositionZ(x, y, z); }
|
{
|
||||||
|
UpdateGroundPositionZ(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
if (fabs(init_z - z) < dist && IsWithinLOS(x, y, z))
|
if (fabs(init_z - z) < dist && IsWithinLOS(x, y, z))
|
||||||
{
|
{
|
||||||
|
|
@ -2087,7 +2101,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
||||||
if (searcher)
|
if (searcher)
|
||||||
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
|
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
|
||||||
else
|
else
|
||||||
{ UpdateGroundPositionZ(x, y, z); }
|
{
|
||||||
|
UpdateGroundPositionZ(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
if (fabs(init_z - z) < dist && IsWithinLOS(x, y, z))
|
if (fabs(init_z - z) < dist && IsWithinLOS(x, y, z))
|
||||||
{
|
{
|
||||||
|
|
@ -2105,7 +2121,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
||||||
if (searcher)
|
if (searcher)
|
||||||
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
|
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
|
||||||
else
|
else
|
||||||
{ UpdateGroundPositionZ(x, y, z); }
|
{
|
||||||
|
UpdateGroundPositionZ(x, y, z);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2121,7 +2139,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
||||||
if (searcher)
|
if (searcher)
|
||||||
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
|
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
|
||||||
else
|
else
|
||||||
{ UpdateGroundPositionZ(x, y, z); }
|
{
|
||||||
|
UpdateGroundPositionZ(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
if (fabs(init_z - z) < dist && IsWithinLOS(x, y, z))
|
if (fabs(init_z - z) < dist && IsWithinLOS(x, y, z))
|
||||||
{
|
{
|
||||||
|
|
@ -2136,7 +2156,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
||||||
if (searcher)
|
if (searcher)
|
||||||
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
|
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
|
||||||
else
|
else
|
||||||
{ UpdateGroundPositionZ(x, y, z); }
|
{
|
||||||
|
UpdateGroundPositionZ(x, y, z);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldObject::SetPhaseMask(uint32 newPhaseMask, bool update)
|
void WorldObject::SetPhaseMask(uint32 newPhaseMask, bool update)
|
||||||
|
|
@ -2158,7 +2180,9 @@ void WorldObject::PlayDistanceSound(uint32 sound_id, Player const* target /*= NU
|
||||||
target->SendDirectMessage(&data);
|
target->SendDirectMessage(&data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ SendMessageToSet(&data, true); }
|
{
|
||||||
|
SendMessageToSet(&data, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldObject::PlayDirectSound(uint32 sound_id, Player const* target /*= NULL*/) const
|
void WorldObject::PlayDirectSound(uint32 sound_id, Player const* target /*= NULL*/) const
|
||||||
|
|
@ -2171,7 +2195,9 @@ void WorldObject::PlayDirectSound(uint32 sound_id, Player const* target /*= NULL
|
||||||
target->SendDirectMessage(&data);
|
target->SendDirectMessage(&data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ SendMessageToSet(&data, true); }
|
{
|
||||||
|
SendMessageToSet(&data, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldObject::PlayMusic(uint32 sound_id, Player const* target /*= NULL*/) const
|
void WorldObject::PlayMusic(uint32 sound_id, Player const* target /*= NULL*/) const
|
||||||
|
|
@ -2183,7 +2209,9 @@ void WorldObject::PlayMusic(uint32 sound_id, Player const* target /*= NULL*/) co
|
||||||
target->SendDirectMessage(&data);
|
target->SendDirectMessage(&data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ SendMessageToSet(&data, true); }
|
{
|
||||||
|
SendMessageToSet(&data, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldObject::UpdateVisibilityAndView()
|
void WorldObject::UpdateVisibilityAndView()
|
||||||
|
|
@ -2288,7 +2316,9 @@ void WorldObject::SetActiveObjectState(bool active)
|
||||||
GetMap()->RemoveFromActive(this);
|
GetMap()->RemoveFromActive(this);
|
||||||
}
|
}
|
||||||
else if (!IsActiveObject() && active)
|
else if (!IsActiveObject() && active)
|
||||||
{ GetMap()->AddToActive(this); }
|
{
|
||||||
|
GetMap()->AddToActive(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
m_isActiveObject = active;
|
m_isActiveObject = active;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -292,7 +292,9 @@ class Object
|
||||||
RemoveFlag(index, flag);
|
RemoveFlag(index, flag);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ SetFlag(index, flag); }
|
{
|
||||||
|
SetFlag(index, flag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -316,7 +318,9 @@ class Object
|
||||||
SetFlag(index, flag);
|
SetFlag(index, flag);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ RemoveFlag(index, flag); }
|
{
|
||||||
|
RemoveFlag(index, flag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetByteFlag(uint16 index, uint8 offset, uint8 newFlag);
|
void SetByteFlag(uint16 index, uint8 offset, uint8 newFlag);
|
||||||
|
|
@ -329,7 +333,9 @@ class Object
|
||||||
RemoveByteFlag(index, offset, flag);
|
RemoveByteFlag(index, offset, flag);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ SetByteFlag(index, offset, flag); }
|
{
|
||||||
|
SetByteFlag(index, offset, flag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HasByteFlag(uint16 index, uint8 offset, uint8 flag) const
|
bool HasByteFlag(uint16 index, uint8 offset, uint8 flag) const
|
||||||
|
|
@ -346,7 +352,9 @@ class Object
|
||||||
SetByteFlag(index, offset, flag);
|
SetByteFlag(index, offset, flag);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ RemoveByteFlag(index, offset, flag); }
|
{
|
||||||
|
RemoveByteFlag(index, offset, flag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetShortFlag(uint16 index, bool highpart, uint16 newFlag);
|
void SetShortFlag(uint16 index, bool highpart, uint16 newFlag);
|
||||||
|
|
@ -359,7 +367,9 @@ class Object
|
||||||
RemoveShortFlag(index, highpart, flag);
|
RemoveShortFlag(index, highpart, flag);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ SetShortFlag(index, highpart, flag); }
|
{
|
||||||
|
SetShortFlag(index, highpart, flag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HasShortFlag(uint16 index, bool highpart, uint8 flag) const
|
bool HasShortFlag(uint16 index, bool highpart, uint8 flag) const
|
||||||
|
|
@ -375,7 +385,9 @@ class Object
|
||||||
SetShortFlag(index, highpart, flag);
|
SetShortFlag(index, highpart, flag);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ RemoveShortFlag(index, highpart, flag); }
|
{
|
||||||
|
RemoveShortFlag(index, highpart, flag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetFlag64(uint16 index, uint64 newFlag)
|
void SetFlag64(uint16 index, uint64 newFlag)
|
||||||
|
|
@ -399,7 +411,9 @@ class Object
|
||||||
RemoveFlag64(index, flag);
|
RemoveFlag64(index, flag);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ SetFlag64(index, flag); }
|
{
|
||||||
|
SetFlag64(index, flag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HasFlag64(uint16 index, uint64 flag) const
|
bool HasFlag64(uint16 index, uint64 flag) const
|
||||||
|
|
@ -415,7 +429,9 @@ class Object
|
||||||
SetFlag64(index, flag);
|
SetFlag64(index, flag);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ RemoveFlag64(index, flag); }
|
{
|
||||||
|
RemoveFlag64(index, flag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearUpdateMask(bool remove);
|
void ClearUpdateMask(bool remove);
|
||||||
|
|
|
||||||
|
|
@ -130,20 +130,26 @@ LanguageDesc const* GetLanguageDescByID(uint32 lang)
|
||||||
bool SpellClickInfo::IsFitToRequirements(Player const* player, Creature const* clickedCreature) const
|
bool SpellClickInfo::IsFitToRequirements(Player const* player, Creature const* clickedCreature) const
|
||||||
{
|
{
|
||||||
if (conditionId)
|
if (conditionId)
|
||||||
|
{
|
||||||
return sObjectMgr.IsPlayerMeetToCondition(conditionId, player, player->GetMap(), clickedCreature, CONDITION_FROM_SPELLCLICK);
|
return sObjectMgr.IsPlayerMeetToCondition(conditionId, player, player->GetMap(), clickedCreature, CONDITION_FROM_SPELLCLICK);
|
||||||
|
}
|
||||||
|
|
||||||
if (questStart)
|
if (questStart)
|
||||||
{
|
{
|
||||||
// not in expected required quest state
|
// not in expected required quest state
|
||||||
if (!player || ((!questStartCanActive || !player->IsActiveQuest(questStart)) && !player->GetQuestRewardStatus(questStart)))
|
if (!player || ((!questStartCanActive || !player->IsActiveQuest(questStart)) && !player->GetQuestRewardStatus(questStart)))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (questEnd)
|
if (questEnd)
|
||||||
{
|
{
|
||||||
// not in expected forbidden quest state
|
// not in expected forbidden quest state
|
||||||
if (!player || player->GetQuestRewardStatus(questEnd))
|
if (!player || player->GetQuestRewardStatus(questEnd))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -220,7 +226,9 @@ ArenaTeam* ObjectMgr::GetArenaTeamById(uint32 arenateamid) const
|
||||||
{
|
{
|
||||||
ArenaTeamMap::const_iterator itr = mArenaTeamMap.find(arenateamid);
|
ArenaTeamMap::const_iterator itr = mArenaTeamMap.find(arenateamid);
|
||||||
if (itr != mArenaTeamMap.end())
|
if (itr != mArenaTeamMap.end())
|
||||||
|
{
|
||||||
return itr->second;
|
return itr->second;
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -229,7 +237,9 @@ ArenaTeam* ObjectMgr::GetArenaTeamByName(const std::string& arenateamname) const
|
||||||
{
|
{
|
||||||
for (ArenaTeamMap::const_iterator itr = mArenaTeamMap.begin(); itr != mArenaTeamMap.end(); ++itr)
|
for (ArenaTeamMap::const_iterator itr = mArenaTeamMap.begin(); itr != mArenaTeamMap.end(); ++itr)
|
||||||
if (itr->second->GetName() == arenateamname)
|
if (itr->second->GetName() == arenateamname)
|
||||||
|
{
|
||||||
return itr->second;
|
return itr->second;
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -238,7 +248,9 @@ ArenaTeam* ObjectMgr::GetArenaTeamByCaptain(ObjectGuid guid) const
|
||||||
{
|
{
|
||||||
for (ArenaTeamMap::const_iterator itr = mArenaTeamMap.begin(); itr != mArenaTeamMap.end(); ++itr)
|
for (ArenaTeamMap::const_iterator itr = mArenaTeamMap.begin(); itr != mArenaTeamMap.end(); ++itr)
|
||||||
if (itr->second->GetCaptainGuid() == guid)
|
if (itr->second->GetCaptainGuid() == guid)
|
||||||
|
{
|
||||||
return itr->second;
|
return itr->second;
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -641,7 +653,9 @@ void ObjectMgr::LoadCreatureTemplates()
|
||||||
const_cast<CreatureInfo*>(cInfo)->ModelId[i] = 0;
|
const_cast<CreatureInfo*>(cInfo)->ModelId[i] = 0;
|
||||||
}
|
}
|
||||||
else if (!displayScaleEntry)
|
else if (!displayScaleEntry)
|
||||||
{ displayScaleEntry = displayEntry; }
|
{
|
||||||
|
displayScaleEntry = displayEntry;
|
||||||
|
}
|
||||||
|
|
||||||
CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->ModelId[i]);
|
CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->ModelId[i]);
|
||||||
if (!minfo)
|
if (!minfo)
|
||||||
|
|
@ -791,7 +805,9 @@ void ObjectMgr::LoadCreatureTemplates()
|
||||||
const_cast<CreatureInfo*>(cInfo)->Scale = displayScaleEntry->Scale;
|
const_cast<CreatureInfo*>(cInfo)->Scale = displayScaleEntry->Scale;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ const_cast<CreatureInfo*>(cInfo)->Scale = DEFAULT_OBJECT_SCALE; }
|
{
|
||||||
|
const_cast<CreatureInfo*>(cInfo)->Scale = DEFAULT_OBJECT_SCALE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1021,12 +1037,16 @@ void ObjectMgr::LoadCreatureClassLvlStats()
|
||||||
CreatureClassLvlStats const* ObjectMgr::GetCreatureClassLvlStats(uint32 level, uint32 unitClass, int32 expansion) const
|
CreatureClassLvlStats const* ObjectMgr::GetCreatureClassLvlStats(uint32 level, uint32 unitClass, int32 expansion) const
|
||||||
{
|
{
|
||||||
if (expansion < 0)
|
if (expansion < 0)
|
||||||
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
CreatureClassLvlStats const* cCLS = &m_creatureClassLvlStats[level][classToIndex[unitClass]][expansion];
|
CreatureClassLvlStats const* cCLS = &m_creatureClassLvlStats[level][classToIndex[unitClass]][expansion];
|
||||||
|
|
||||||
if (cCLS->BaseHealth != 0 && cCLS->BaseDamage > 0.1f)
|
if (cCLS->BaseHealth != 0 && cCLS->BaseDamage > 0.1f)
|
||||||
|
{
|
||||||
return cCLS;
|
return cCLS;
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -1084,7 +1104,9 @@ void ObjectMgr::LoadEquipmentTemplates()
|
||||||
uint32 ObjectMgr::GetCreatureModelAlternativeModel(uint32 modelId) const
|
uint32 ObjectMgr::GetCreatureModelAlternativeModel(uint32 modelId) const
|
||||||
{
|
{
|
||||||
if (const CreatureModelInfo* modelInfo = GetCreatureModelInfo(modelId))
|
if (const CreatureModelInfo* modelInfo = GetCreatureModelInfo(modelId))
|
||||||
|
{
|
||||||
return modelInfo->modelid_alternative;
|
return modelInfo->modelid_alternative;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -1107,10 +1129,14 @@ CreatureModelInfo const* ObjectMgr::GetCreatureModelRandomGender(uint32 display_
|
||||||
return minfo; // not fatal, just use the previous one
|
return minfo; // not fatal, just use the previous one
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return minfo_tmp; }
|
{
|
||||||
|
return minfo_tmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return minfo; }
|
{
|
||||||
|
return minfo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 ObjectMgr::GetModelForRace(uint32 sourceModelId, uint32 racemask)
|
uint32 ObjectMgr::GetModelForRace(uint32 sourceModelId, uint32 racemask)
|
||||||
|
|
@ -1230,7 +1256,9 @@ void ObjectMgr::LoadCreatureModelInfo()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ sLog.outErrorDb("Table `creature_model_info` expect have data for character race %u female model id %u", race, raceEntry->model_f); }
|
{
|
||||||
|
sLog.outErrorDb("Table `creature_model_info` expect have data for character race %u female model id %u", race, raceEntry->model_f);
|
||||||
|
}
|
||||||
|
|
||||||
if (CreatureModelInfo const* minfo = GetCreatureModelInfo(raceEntry->model_m))
|
if (CreatureModelInfo const* minfo = GetCreatureModelInfo(raceEntry->model_m))
|
||||||
{
|
{
|
||||||
|
|
@ -1257,7 +1285,9 @@ void ObjectMgr::LoadCreatureModelInfo()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ sLog.outErrorDb("Table `creature_model_info` expect have data for character race %u male model id %u", race, raceEntry->model_m); }
|
{
|
||||||
|
sLog.outErrorDb("Table `creature_model_info` expect have data for character race %u male model id %u", race, raceEntry->model_m);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sLog.outString(">> Loaded %u creature model based info", sCreatureModelStorage.GetRecordCount());
|
sLog.outString(">> Loaded %u creature model based info", sCreatureModelStorage.GetRecordCount());
|
||||||
|
|
@ -3565,7 +3595,9 @@ void ObjectMgr::GetPlayerLevelInfo(uint32 race, uint32 class_, uint32 level, Pla
|
||||||
*info = pInfo->levelInfo[level - 1];
|
*info = pInfo->levelInfo[level - 1];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ BuildPlayerLevelInfo(race, class_, level, info); }
|
{
|
||||||
|
BuildPlayerLevelInfo(race, class_, level, info);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectMgr::BuildPlayerLevelInfo(uint8 race, uint8 _class, uint8 level, PlayerLevelInfo* info) const
|
void ObjectMgr::BuildPlayerLevelInfo(uint8 race, uint8 _class, uint8 level, PlayerLevelInfo* info) const
|
||||||
|
|
@ -3816,7 +3848,9 @@ void ObjectMgr::LoadGroups()
|
||||||
mGroupMap.erase(itr++);
|
mGroupMap.erase(itr++);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ ++itr; }
|
{
|
||||||
|
++itr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- loading instances --
|
// -- loading instances --
|
||||||
|
|
@ -4368,7 +4402,9 @@ void ObjectMgr::LoadQuests()
|
||||||
qinfo->RewChoiceItemId[j] = 0; // no changes, quest will not reward this
|
qinfo->RewChoiceItemId[j] = 0; // no changes, quest will not reward this
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ choice_found = true; }
|
{
|
||||||
|
choice_found = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!qinfo->RewChoiceItemCount[j])
|
if (!qinfo->RewChoiceItemCount[j])
|
||||||
{
|
{
|
||||||
|
|
@ -4507,7 +4543,9 @@ void ObjectMgr::LoadQuests()
|
||||||
qinfo->RewMailDelaySecs = 0; // no mail will send to player
|
qinfo->RewMailDelaySecs = 0; // no mail will send to player
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ usedMailTemplates[qinfo->RewMailTemplateId] = qinfo->GetQuestId(); }
|
{
|
||||||
|
usedMailTemplates[qinfo->RewMailTemplateId] = qinfo->GetQuestId();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qinfo->NextQuestInChain)
|
if (qinfo->NextQuestInChain)
|
||||||
|
|
@ -4520,7 +4558,9 @@ void ObjectMgr::LoadQuests()
|
||||||
qinfo->NextQuestInChain = 0;
|
qinfo->NextQuestInChain = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ qNextItr->second->prevChainQuests.push_back(qinfo->GetQuestId()); }
|
{
|
||||||
|
qNextItr->second->prevChainQuests.push_back(qinfo->GetQuestId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// fill additional data stores
|
// fill additional data stores
|
||||||
|
|
@ -6906,7 +6946,9 @@ void ObjectMgr::LoadPetNames()
|
||||||
PetHalfName1[entry].push_back(word);
|
PetHalfName1[entry].push_back(word);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ PetHalfName0[entry].push_back(word); }
|
{
|
||||||
|
PetHalfName0[entry].push_back(word);
|
||||||
|
}
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
while (result->NextRow());
|
while (result->NextRow());
|
||||||
|
|
@ -7702,7 +7744,9 @@ void ObjectMgr::GetConditions(uint32 conditionId, std::vector<PlayerCondition co
|
||||||
{
|
{
|
||||||
const PlayerCondition* condition = sConditionStorage.LookupEntry<PlayerCondition>(conditionId);
|
const PlayerCondition* condition = sConditionStorage.LookupEntry<PlayerCondition>(conditionId);
|
||||||
if (!condition)
|
if (!condition)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (condition->m_condition == CONDITION_OR || condition->m_condition == CONDITION_AND)
|
if (condition->m_condition == CONDITION_OR || condition->m_condition == CONDITION_AND)
|
||||||
{
|
{
|
||||||
|
|
@ -7869,7 +7913,9 @@ void ObjectMgr::LoadGameobjectQuestRelations()
|
||||||
sLog.outErrorDb("Table `quest_relations` have data for nonexistent gameobject entry (%u) and existing quest %u", itr->first, itr->second);
|
sLog.outErrorDb("Table `quest_relations` have data for nonexistent gameobject entry (%u) and existing quest %u", itr->first, itr->second);
|
||||||
}
|
}
|
||||||
else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
|
else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
|
||||||
{ sLog.outErrorDb("Table `quest_relations` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second); }
|
{
|
||||||
|
sLog.outErrorDb("Table `quest_relations` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -7885,7 +7931,9 @@ void ObjectMgr::LoadGameobjectInvolvedRelations()
|
||||||
sLog.outErrorDb("Table `quest_relations` have data for nonexistent gameobject entry (%u) and existing quest %u", itr->first, itr->second);
|
sLog.outErrorDb("Table `quest_relations` have data for nonexistent gameobject entry (%u) and existing quest %u", itr->first, itr->second);
|
||||||
}
|
}
|
||||||
else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
|
else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
|
||||||
{ sLog.outErrorDb("Table `quest_relations` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second); }
|
{
|
||||||
|
sLog.outErrorDb("Table `quest_relations` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -7901,7 +7949,9 @@ void ObjectMgr::LoadCreatureQuestRelations()
|
||||||
sLog.outErrorDb("Table `quest_relations` have data for nonexistent creature entry (%u) and existing quest %u", itr->first, itr->second);
|
sLog.outErrorDb("Table `quest_relations` have data for nonexistent creature entry (%u) and existing quest %u", itr->first, itr->second);
|
||||||
}
|
}
|
||||||
else if (!(cInfo->NpcFlags & UNIT_NPC_FLAG_QUESTGIVER))
|
else if (!(cInfo->NpcFlags & UNIT_NPC_FLAG_QUESTGIVER))
|
||||||
{ sLog.outErrorDb("Table `quest_relations` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second); }
|
{
|
||||||
|
sLog.outErrorDb("Table `quest_relations` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -7917,7 +7967,9 @@ void ObjectMgr::LoadCreatureInvolvedRelations()
|
||||||
sLog.outErrorDb("Table `quest_relations` have data for nonexistent creature entry (%u) and existing quest %u", itr->first, itr->second);
|
sLog.outErrorDb("Table `quest_relations` have data for nonexistent creature entry (%u) and existing quest %u", itr->first, itr->second);
|
||||||
}
|
}
|
||||||
else if (!(cInfo->NpcFlags & UNIT_NPC_FLAG_QUESTGIVER))
|
else if (!(cInfo->NpcFlags & UNIT_NPC_FLAG_QUESTGIVER))
|
||||||
{ sLog.outErrorDb("Table `quest_relations` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second); }
|
{
|
||||||
|
sLog.outErrorDb("Table `quest_relations` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -8287,11 +8339,17 @@ inline void _DoStringError(int32 entry, char const* text, ...)
|
||||||
sLog.outErrorScriptLib("%s", buf);
|
sLog.outErrorScriptLib("%s", buf);
|
||||||
}
|
}
|
||||||
else if (entry <= MIN_CREATURE_AI_TEXT_STRING_ID) // eventAI error
|
else if (entry <= MIN_CREATURE_AI_TEXT_STRING_ID) // eventAI error
|
||||||
{ sLog.outErrorEventAI("%s", buf); }
|
{
|
||||||
|
sLog.outErrorEventAI("%s", buf);
|
||||||
|
}
|
||||||
else if (entry < MIN_DB_SCRIPT_STRING_ID) // mangos string error
|
else if (entry < MIN_DB_SCRIPT_STRING_ID) // mangos string error
|
||||||
{ sLog.outError("%s", buf); }
|
{
|
||||||
|
sLog.outError("%s", buf);
|
||||||
|
}
|
||||||
else // if (entry > MIN_DB_SCRIPT_STRING_ID) // DB script text error
|
else // if (entry > MIN_DB_SCRIPT_STRING_ID) // DB script text error
|
||||||
{ sLog.outErrorDb("DB-SCRIPTS: %s", buf); }
|
{
|
||||||
|
sLog.outErrorDb("DB-SCRIPTS: %s", buf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min_value, int32 max_value, bool extra_content)
|
bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min_value, int32 max_value, bool extra_content)
|
||||||
|
|
@ -8329,7 +8387,9 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min
|
||||||
mMangosStringLocaleMap.erase(itr++);
|
mMangosStringLocaleMap.erase(itr++);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ ++itr; }
|
{
|
||||||
|
++itr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sLog.outString("Loading texts from %s%s", table, extra_content ? ", with additional data" : "");
|
sLog.outString("Loading texts from %s%s", table, extra_content ? ", with additional data" : "");
|
||||||
|
|
@ -8349,7 +8409,9 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min
|
||||||
sLog.outErrorDb(">> Loaded 0 mangos strings. DB table `%s` is empty. Can not continue.", table);
|
sLog.outErrorDb(">> Loaded 0 mangos strings. DB table `%s` is empty. Can not continue.", table);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ sLog.outString(">> Loaded 0 string templates. DB table `%s` is empty.", table); }
|
{
|
||||||
|
sLog.outString(">> Loaded 0 string templates. DB table `%s` is empty.", table);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -8450,7 +8512,9 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min
|
||||||
sLog.outString(">> Loaded %u MaNGOS strings from table %s", count, table);
|
sLog.outString(">> Loaded %u MaNGOS strings from table %s", count, table);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ sLog.outString(">> Loaded %u %s templates from %s", count, extra_content ? "text" : "string", table); }
|
{
|
||||||
|
sLog.outString(">> Loaded %u %s templates from %s", count, extra_content ? "text" : "string", table);
|
||||||
|
}
|
||||||
sLog.outString();
|
sLog.outString();
|
||||||
|
|
||||||
m_loadedStringCount[min_value] = count;
|
m_loadedStringCount[min_value] = count;
|
||||||
|
|
@ -8469,7 +8533,9 @@ const char* ObjectMgr::GetMangosString(int32 entry, int locale_idx) const
|
||||||
return msl->Content[locale_idx + 1].c_str();
|
return msl->Content[locale_idx + 1].c_str();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return msl->Content[0].c_str(); }
|
{
|
||||||
|
return msl->Content[0].c_str();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_DoStringError(entry, "Entry %i not found but requested", entry);
|
_DoStringError(entry, "Entry %i not found but requested", entry);
|
||||||
|
|
@ -8537,10 +8603,14 @@ bool ObjectMgr::CheckDeclinedNames(const std::wstring& mainpart, DeclinedName co
|
||||||
{
|
{
|
||||||
std::wstring wname;
|
std::wstring wname;
|
||||||
if (!Utf8toWStr(names.name[i], wname))
|
if (!Utf8toWStr(names.name[i], wname))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (mainpart != GetMainPartOfName(wname, i + 1))
|
if (mainpart != GetMainPartOfName(wname, i + 1))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -8609,7 +8679,9 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return uint32(player->GetTeam()) == m_value1; }
|
{
|
||||||
|
return uint32(player->GetTeam()) == m_value1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case CONDITION_SKILL:
|
case CONDITION_SKILL:
|
||||||
return player->HasSkill(m_value1) && player->GetBaseSkillValue(m_value1) >= m_value2;
|
return player->HasSkill(m_value1) && player->GetBaseSkillValue(m_value1) >= m_value2;
|
||||||
|
|
@ -8799,7 +8871,9 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co
|
||||||
return !player->HasSkill(m_value1);
|
return !player->HasSkill(m_value1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return player->HasSkill(m_value1) && player->GetBaseSkillValue(m_value1) < m_value2; }
|
{
|
||||||
|
return player->HasSkill(m_value1) && player->GetBaseSkillValue(m_value1) < m_value2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case CONDITION_REPUTATION_RANK_MAX:
|
case CONDITION_REPUTATION_RANK_MAX:
|
||||||
{
|
{
|
||||||
|
|
@ -8892,7 +8966,9 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return !player->IsAlive() || (m_value2 && source && !source->IsWithinDistInMap(player, m_value2)); }
|
{
|
||||||
|
return !player->IsAlive() || (m_value2 && source && !source->IsWithinDistInMap(player, m_value2));
|
||||||
|
}
|
||||||
case 2: // All players in instance dead or out of range
|
case 2: // All players in instance dead or out of range
|
||||||
for (Map::PlayerList::const_iterator itr = map->GetPlayers().begin(); itr != map->GetPlayers().end(); ++itr)
|
for (Map::PlayerList::const_iterator itr = map->GetPlayers().begin(); itr != map->GetPlayers().end(); ++itr)
|
||||||
{
|
{
|
||||||
|
|
@ -9456,9 +9532,13 @@ SkillRangeType GetSkillRangeType(SkillLineEntry const* pSkill, bool racial)
|
||||||
return SKILL_RANGE_RANK;
|
return SKILL_RANGE_RANK;
|
||||||
}
|
}
|
||||||
else if (racial)
|
else if (racial)
|
||||||
{ return SKILL_RANGE_NONE; }
|
{
|
||||||
|
return SKILL_RANGE_NONE;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ return SKILL_RANGE_MONO; }
|
{
|
||||||
|
return SKILL_RANGE_MONO;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
case SKILL_CATEGORY_ATTRIBUTES: // not found in dbc
|
case SKILL_CATEGORY_ATTRIBUTES: // not found in dbc
|
||||||
case SKILL_CATEGORY_GENERIC: // only GENERIC(DND)
|
case SKILL_CATEGORY_GENERIC: // only GENERIC(DND)
|
||||||
|
|
@ -9546,7 +9626,9 @@ GameTele const* ObjectMgr::GetGameTele(const std::string& name) const
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
}
|
}
|
||||||
else if (alt == NULL && itr->second.wnameLow.find(wname) != std::wstring::npos)
|
else if (alt == NULL && itr->second.wnameLow.find(wname) != std::wstring::npos)
|
||||||
{ alt = &itr->second; }
|
{
|
||||||
|
alt = &itr->second;
|
||||||
|
}
|
||||||
|
|
||||||
return alt;
|
return alt;
|
||||||
}
|
}
|
||||||
|
|
@ -10208,7 +10290,9 @@ void ObjectMgr::LoadGossipMenuItems(std::set<uint32>& gossipScriptSet)
|
||||||
sLog.outErrorDb("Gossip menu option (MenuId: %u Id: %u) have action_menu_id = %u for nonexistent menu", gMenuItem.menu_id, gMenuItem.id, gMenuItem.action_menu_id);
|
sLog.outErrorDb("Gossip menu option (MenuId: %u Id: %u) have action_menu_id = %u for nonexistent menu", gMenuItem.menu_id, gMenuItem.id, gMenuItem.action_menu_id);
|
||||||
}
|
}
|
||||||
else if (!sLog.HasLogFilter(LOG_FILTER_DB_STRICTED_CHECK))
|
else if (!sLog.HasLogFilter(LOG_FILTER_DB_STRICTED_CHECK))
|
||||||
{ menu_ids.erase(gMenuItem.action_menu_id); }
|
{
|
||||||
|
menu_ids.erase(gMenuItem.action_menu_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gMenuItem.option_icon >= GOSSIP_ICON_MAX)
|
if (gMenuItem.option_icon >= GOSSIP_ICON_MAX)
|
||||||
|
|
@ -10306,7 +10390,9 @@ void ObjectMgr::LoadGossipMenus()
|
||||||
{
|
{
|
||||||
ScriptChainMap const* scm = sScriptMgr.GetScriptChainMap(DBS_ON_GOSSIP);
|
ScriptChainMap const* scm = sScriptMgr.GetScriptChainMap(DBS_ON_GOSSIP);
|
||||||
if (!scm)
|
if (!scm)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Check which script-ids in db_scripts type DBS_ON_GOSSIP are not used
|
// Check which script-ids in db_scripts type DBS_ON_GOSSIP are not used
|
||||||
std::set<uint32> gossipScriptSet;
|
std::set<uint32> gossipScriptSet;
|
||||||
|
|
@ -10894,7 +10980,9 @@ bool FindCreatureData::operator()(CreatureDataPair const& dataPair)
|
||||||
// skip not spawned (in any state),
|
// skip not spawned (in any state),
|
||||||
uint16 pool_id = sPoolMgr.IsPartOfAPool<Creature>(dataPair.first);
|
uint16 pool_id = sPoolMgr.IsPartOfAPool<Creature>(dataPair.first);
|
||||||
if (pool_id && !i_player->GetMap()->GetPersistentState()->IsSpawnedPoolObject<Creature>(dataPair.first))
|
if (pool_id && !i_player->GetMap()->GetPersistentState()->IsSpawnedPoolObject<Creature>(dataPair.first))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!i_spawnedData || new_dist < i_spawnedDist)
|
if (!i_spawnedData || new_dist < i_spawnedDist)
|
||||||
{
|
{
|
||||||
|
|
@ -10930,7 +11018,9 @@ bool DoDisplayText(WorldObject* source, int32 entry, Unit const* target /*=NULL*
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ source->PlayDirectSound(data->SoundId); }
|
{
|
||||||
|
source->PlayDirectSound(data->SoundId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->Emote)
|
if (data->Emote)
|
||||||
|
|
@ -10959,10 +11049,14 @@ bool DoDisplayText(WorldObject* source, int32 entry, Unit const* target /*=NULL*
|
||||||
CreatureDataPair const* FindCreatureData::GetResult() const
|
CreatureDataPair const* FindCreatureData::GetResult() const
|
||||||
{
|
{
|
||||||
if (i_spawnedData)
|
if (i_spawnedData)
|
||||||
|
{
|
||||||
return i_spawnedData;
|
return i_spawnedData;
|
||||||
|
}
|
||||||
|
|
||||||
if (i_mapData)
|
if (i_mapData)
|
||||||
|
{
|
||||||
return i_mapData;
|
return i_mapData;
|
||||||
|
}
|
||||||
|
|
||||||
return i_anyData;
|
return i_anyData;
|
||||||
}
|
}
|
||||||
|
|
@ -10971,18 +11065,24 @@ bool FindGOData::operator()(GameObjectDataPair const& dataPair)
|
||||||
{
|
{
|
||||||
// skip wrong entry ids
|
// skip wrong entry ids
|
||||||
if (i_id && dataPair.second.id != i_id)
|
if (i_id && dataPair.second.id != i_id)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!i_anyData)
|
if (!i_anyData)
|
||||||
i_anyData = &dataPair;
|
i_anyData = &dataPair;
|
||||||
|
|
||||||
// without player we can't find more stricted cases, so use fouded
|
// without player we can't find more stricted cases, so use fouded
|
||||||
if (!i_player)
|
if (!i_player)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// skip diff. map cases
|
// skip diff. map cases
|
||||||
if (dataPair.second.mapid != i_player->GetMapId())
|
if (dataPair.second.mapid != i_player->GetMapId())
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
float new_dist = i_player->GetDistance2d(dataPair.second.posX, dataPair.second.posY);
|
float new_dist = i_player->GetDistance2d(dataPair.second.posX, dataPair.second.posY);
|
||||||
|
|
||||||
|
|
@ -10995,7 +11095,9 @@ bool FindGOData::operator()(GameObjectDataPair const& dataPair)
|
||||||
// skip not spawned (in any state)
|
// skip not spawned (in any state)
|
||||||
uint16 pool_id = sPoolMgr.IsPartOfAPool<GameObject>(dataPair.first);
|
uint16 pool_id = sPoolMgr.IsPartOfAPool<GameObject>(dataPair.first);
|
||||||
if (pool_id && !i_player->GetMap()->GetPersistentState()->IsSpawnedPoolObject<GameObject>(dataPair.first))
|
if (pool_id && !i_player->GetMap()->GetPersistentState()->IsSpawnedPoolObject<GameObject>(dataPair.first))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!i_spawnedData || new_dist < i_spawnedDist)
|
if (!i_spawnedData || new_dist < i_spawnedDist)
|
||||||
{
|
{
|
||||||
|
|
@ -11009,10 +11111,14 @@ bool FindGOData::operator()(GameObjectDataPair const& dataPair)
|
||||||
GameObjectDataPair const* FindGOData::GetResult() const
|
GameObjectDataPair const* FindGOData::GetResult() const
|
||||||
{
|
{
|
||||||
if (i_mapData)
|
if (i_mapData)
|
||||||
|
{
|
||||||
return i_mapData;
|
return i_mapData;
|
||||||
|
}
|
||||||
|
|
||||||
if (i_spawnedData)
|
if (i_spawnedData)
|
||||||
|
{
|
||||||
return i_spawnedData;
|
return i_spawnedData;
|
||||||
|
}
|
||||||
|
|
||||||
return i_anyData;
|
return i_anyData;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -740,7 +740,9 @@ class ObjectMgr
|
||||||
{
|
{
|
||||||
QuestPOIMap::const_iterator itr = mQuestPOIMap.find(questId);
|
QuestPOIMap::const_iterator itr = mQuestPOIMap.find(questId);
|
||||||
if (itr != mQuestPOIMap.end())
|
if (itr != mQuestPOIMap.end())
|
||||||
|
{
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -748,7 +750,9 @@ class ObjectMgr
|
||||||
{
|
{
|
||||||
DungeonFinderRequirementsMap::const_iterator itr = mDungeonFinderRequirementsMap.find(MAKE_PAIR32(mapId, difficulty));
|
DungeonFinderRequirementsMap::const_iterator itr = mDungeonFinderRequirementsMap.find(MAKE_PAIR32(mapId, difficulty));
|
||||||
if (itr != mDungeonFinderRequirementsMap.end())
|
if (itr != mDungeonFinderRequirementsMap.end())
|
||||||
|
{
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -960,11 +964,15 @@ class ObjectMgr
|
||||||
{
|
{
|
||||||
MailLevelRewardMap::const_iterator map_itr = m_mailLevelRewardMap.find(level);
|
MailLevelRewardMap::const_iterator map_itr = m_mailLevelRewardMap.find(level);
|
||||||
if (map_itr == m_mailLevelRewardMap.end())
|
if (map_itr == m_mailLevelRewardMap.end())
|
||||||
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
for (MailLevelRewardList::const_iterator set_itr = map_itr->second.begin(); set_itr != map_itr->second.end(); ++set_itr)
|
for (MailLevelRewardList::const_iterator set_itr = map_itr->second.begin(); set_itr != map_itr->second.end(); ++set_itr)
|
||||||
if (set_itr->raceMask & raceMask)
|
if (set_itr->raceMask & raceMask)
|
||||||
|
{
|
||||||
return &*set_itr;
|
return &*set_itr;
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -1277,7 +1285,9 @@ class ObjectMgr
|
||||||
{
|
{
|
||||||
ItemConvertMap::const_iterator iter = m_ItemConvert.find(itemEntry);
|
ItemConvertMap::const_iterator iter = m_ItemConvert.find(itemEntry);
|
||||||
if (iter == m_ItemConvert.end())
|
if (iter == m_ItemConvert.end())
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
ItemPrototype const* proto = GetItemPrototype(iter->second);
|
ItemPrototype const* proto = GetItemPrototype(iter->second);
|
||||||
return (proto && proto->AllowableRace & raceMask) ? iter->second : 0;
|
return (proto && proto->AllowableRace & raceMask) ? iter->second : 0;
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,9 @@ void ObjectPosSelector::AddUsedArea(WorldObject const* obj, float angle, float d
|
||||||
m_UsedAreaLists[USED_POS_PLUS].insert(UsedArea(angle, OccupiedArea(sr_angle, obj)));
|
m_UsedAreaLists[USED_POS_PLUS].insert(UsedArea(angle, OccupiedArea(sr_angle, obj)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_UsedAreaLists[USED_POS_MINUS].insert(UsedArea(-angle, OccupiedArea(sr_angle, obj))); }
|
{
|
||||||
|
m_UsedAreaLists[USED_POS_MINUS].insert(UsedArea(-angle, OccupiedArea(sr_angle, obj)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -135,7 +137,9 @@ void ObjectPosSelector::InitializeAngle(UsedAreaSide side)
|
||||||
m_stepAngle[side] = std::max(m_searchedForReqHAngle + otherArea.second.angleOffset - otherArea.first, 0.0f);
|
m_stepAngle[side] = std::max(m_searchedForReqHAngle + otherArea.second.angleOffset - otherArea.first, 0.0f);
|
||||||
}
|
}
|
||||||
else // Other side empty. start from 0
|
else // Other side empty. start from 0
|
||||||
{ m_stepAngle[side] = 0.0f; }
|
{
|
||||||
|
m_stepAngle[side] = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
// As m_stepAngle will be incremented first in ::NextSideAngle
|
// As m_stepAngle will be incremented first in ::NextSideAngle
|
||||||
m_stepAngle[side] -= m_searchedForReqHAngle;
|
m_stepAngle[side] -= m_searchedForReqHAngle;
|
||||||
|
|
@ -171,7 +175,9 @@ bool ObjectPosSelector::NextAngle(float& angle)
|
||||||
}
|
}
|
||||||
// both sides finishes
|
// both sides finishes
|
||||||
else
|
else
|
||||||
{ break; }
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// no angles
|
// no angles
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,9 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
||||||
ownerid,PET_SAVE_AS_CURRENT,PET_SAVE_LAST_STABLE_SLOT);
|
ownerid,PET_SAVE_AS_CURRENT,PET_SAVE_LAST_STABLE_SLOT);
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Field* fields = result->Fetch();
|
Field* fields = result->Fetch();
|
||||||
|
|
||||||
|
|
@ -601,7 +603,9 @@ void Pet::RegenerateAll(uint32 update_diff)
|
||||||
m_regenTimer = 4000;
|
m_regenTimer = 4000;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_regenTimer -= update_diff; }
|
{
|
||||||
|
m_regenTimer -= update_diff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Pet::CanTakeMoreActiveSpells(uint32 spellid)
|
bool Pet::CanTakeMoreActiveSpells(uint32 spellid)
|
||||||
|
|
@ -842,7 +846,9 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
|
||||||
SetName(cFamily->Name[sWorld.GetDefaultDbcLocale()]);
|
SetName(cFamily->Name[sWorld.GetDefaultDbcLocale()]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ SetName(creature->GetNameForLocaleIdx(sObjectMgr.GetDBCLocaleIndex())); }
|
{
|
||||||
|
SetName(creature->GetNameForLocaleIdx(sObjectMgr.GetDBCLocaleIndex()));
|
||||||
|
}
|
||||||
|
|
||||||
SetByteValue(UNIT_FIELD_BYTES_0, 1, CLASS_WARRIOR);
|
SetByteValue(UNIT_FIELD_BYTES_0, 1, CLASS_WARRIOR);
|
||||||
SetByteValue(UNIT_FIELD_BYTES_0, 2, GENDER_NONE);
|
SetByteValue(UNIT_FIELD_BYTES_0, 2, GENDER_NONE);
|
||||||
|
|
@ -1195,10 +1201,14 @@ uint32 Pet::GetCurrentFoodBenefitLevel(uint32 itemlevel)
|
||||||
}
|
}
|
||||||
// -10..-6
|
// -10..-6
|
||||||
else if (getLevel() <= itemlevel + 10) // pure guess, but sounds good
|
else if (getLevel() <= itemlevel + 10) // pure guess, but sounds good
|
||||||
{ return 17000; }
|
{
|
||||||
|
return 17000;
|
||||||
|
}
|
||||||
// -14..-11
|
// -14..-11
|
||||||
else if (getLevel() <= itemlevel + 14) // level 55 food gets green on 70, makes sense to me
|
else if (getLevel() <= itemlevel + 14) // level 55 food gets green on 70, makes sense to me
|
||||||
{ return 8000; }
|
{
|
||||||
|
return 8000;
|
||||||
|
}
|
||||||
// -15 or less
|
// -15 or less
|
||||||
else
|
else
|
||||||
{ return 0; } // food too low level
|
{ return 0; } // food too low level
|
||||||
|
|
@ -1407,7 +1417,9 @@ void Pet::_LoadAuras(uint32 timediff)
|
||||||
remaincharges = procCharges;
|
remaincharges = procCharges;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ remaincharges = 0; }
|
{
|
||||||
|
remaincharges = 0;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 defstackamount = spellproto->GetStackAmount();
|
uint32 defstackamount = spellproto->GetStackAmount();
|
||||||
if (!defstackamount)
|
if (!defstackamount)
|
||||||
|
|
@ -1417,7 +1429,9 @@ void Pet::_LoadAuras(uint32 timediff)
|
||||||
else if (defstackamount < stackcount)
|
else if (defstackamount < stackcount)
|
||||||
stackcount = defstackamount;
|
stackcount = defstackamount;
|
||||||
else if (!stackcount)
|
else if (!stackcount)
|
||||||
{ stackcount = 1; }
|
{
|
||||||
|
stackcount = 1;
|
||||||
|
}
|
||||||
|
|
||||||
SpellAuraHolder* holder = CreateSpellAuraHolder(spellproto, this, NULL);
|
SpellAuraHolder* holder = CreateSpellAuraHolder(spellproto, this, NULL);
|
||||||
holder->SetLoadedState(casterGuid, ObjectGuid(HIGHGUID_ITEM, item_lowguid), stackcount, remaincharges, maxduration, remaintime);
|
holder->SetLoadedState(casterGuid, ObjectGuid(HIGHGUID_ITEM, item_lowguid), stackcount, remaincharges, maxduration, remaintime);
|
||||||
|
|
@ -1444,7 +1458,9 @@ void Pet::_LoadAuras(uint32 timediff)
|
||||||
AddSpellAuraHolder(holder);
|
AddSpellAuraHolder(holder);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ delete holder; }
|
{
|
||||||
|
delete holder;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while (result->NextRow());
|
while (result->NextRow());
|
||||||
|
|
||||||
|
|
@ -1557,7 +1573,9 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
|
||||||
CharacterDatabase.PExecute("DELETE FROM pet_spell WHERE spell = '%u'", spell_id);
|
CharacterDatabase.PExecute("DELETE FROM pet_spell WHERE spell = '%u'", spell_id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ sLog.outError("Pet::addSpell: nonexistent in SpellStore spell #%u request.", spell_id); }
|
{
|
||||||
|
sLog.outError("Pet::addSpell: nonexistent in SpellStore spell #%u request.", spell_id);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -1580,12 +1598,16 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
|
||||||
ToggleAutocast(spell_id, true);
|
ToggleAutocast(spell_id, true);
|
||||||
}
|
}
|
||||||
else if (active == ACT_DISABLED)
|
else if (active == ACT_DISABLED)
|
||||||
{ ToggleAutocast(spell_id, false); }
|
{
|
||||||
|
ToggleAutocast(spell_id, false);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 oldspell_id = 0;
|
uint32 oldspell_id = 0;
|
||||||
|
|
@ -1601,10 +1623,14 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
|
||||||
newspell.active = ACT_PASSIVE;
|
newspell.active = ACT_PASSIVE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ newspell.active = ACT_DISABLED; }
|
{
|
||||||
|
newspell.active = ACT_DISABLED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ newspell.active = active; }
|
{
|
||||||
|
newspell.active = active;
|
||||||
|
}
|
||||||
|
|
||||||
// talent: unlearn all other talent ranks (high and low)
|
// talent: unlearn all other talent ranks (high and low)
|
||||||
if (TalentSpellPos const* talentPos = GetTalentSpellPos(spell_id))
|
if (TalentSpellPos const* talentPos = GetTalentSpellPos(spell_id))
|
||||||
|
|
@ -1647,7 +1673,9 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
|
||||||
}
|
}
|
||||||
// ignore new lesser rank
|
// ignore new lesser rank
|
||||||
else if (sSpellMgr.IsHighRankOfSpell(itr2->first, spell_id))
|
else if (sSpellMgr.IsHighRankOfSpell(itr2->first, spell_id))
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1659,7 +1687,9 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
|
||||||
CastSpell(this, spell_id, true);
|
CastSpell(this, spell_id, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_charmInfo->AddSpellToActionBar(spell_id, ActiveStates(newspell.active)); }
|
{
|
||||||
|
m_charmInfo->AddSpellToActionBar(spell_id, ActiveStates(newspell.active));
|
||||||
|
}
|
||||||
|
|
||||||
if (newspell.active == ACT_ENABLED)
|
if (newspell.active == ACT_ENABLED)
|
||||||
{
|
{
|
||||||
|
|
@ -1776,7 +1806,9 @@ bool Pet::removeSpell(uint32 spell_id, bool learn_prev, bool clear_ab)
|
||||||
m_spells.erase(itr);
|
m_spells.erase(itr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ itr->second.state = PETSPELL_REMOVED; }
|
{
|
||||||
|
itr->second.state = PETSPELL_REMOVED;
|
||||||
|
}
|
||||||
|
|
||||||
RemoveAurasDueToSpell(spell_id);
|
RemoveAurasDueToSpell(spell_id);
|
||||||
|
|
||||||
|
|
@ -1798,7 +1830,9 @@ bool Pet::removeSpell(uint32 spell_id, bool learn_prev, bool clear_ab)
|
||||||
learnSpell(prev_id);
|
learnSpell(prev_id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ learn_prev = false; }
|
{
|
||||||
|
learn_prev = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if remove last rank or non-ranked then update action bar at server and client if need
|
// if remove last rank or non-ranked then update action bar at server and client if need
|
||||||
|
|
@ -1843,7 +1877,9 @@ bool Pet::resetTalents(bool no_cost)
|
||||||
{
|
{
|
||||||
Unit* owner = GetOwner();
|
Unit* owner = GetOwner();
|
||||||
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
|
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// not need after this call
|
// not need after this call
|
||||||
if (((Player*)owner)->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
|
if (((Player*)owner)->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
|
||||||
|
|
@ -1851,11 +1887,15 @@ bool Pet::resetTalents(bool no_cost)
|
||||||
|
|
||||||
CreatureInfo const* ci = GetCreatureInfo();
|
CreatureInfo const* ci = GetCreatureInfo();
|
||||||
if (!ci)
|
if (!ci)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
// Check pet talent type
|
// Check pet talent type
|
||||||
CreatureFamilyEntry const* pet_family = sCreatureFamilyStore.LookupEntry(ci->Family);
|
CreatureFamilyEntry const* pet_family = sCreatureFamilyStore.LookupEntry(ci->Family);
|
||||||
if (!pet_family || pet_family->petTalentType < 0)
|
if (!pet_family || pet_family->petTalentType < 0)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Player* player = (Player*)owner;
|
Player* player = (Player*)owner;
|
||||||
|
|
||||||
|
|
@ -1930,7 +1970,9 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/)
|
||||||
|
|
||||||
// no offline pets
|
// no offline pets
|
||||||
if (!resultPets)
|
if (!resultPets)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QueryResult* result = CharacterDatabase.PQuery(
|
QueryResult* result = CharacterDatabase.PQuery(
|
||||||
"SELECT DISTINCT pet_spell.spell FROM pet_spell, character_pet "
|
"SELECT DISTINCT pet_spell.spell FROM pet_spell, character_pet "
|
||||||
|
|
@ -1988,7 +2030,9 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/)
|
||||||
delete result;
|
delete result;
|
||||||
|
|
||||||
if (!need_execute)
|
if (!need_execute)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ss << ")";
|
ss << ")";
|
||||||
|
|
||||||
|
|
@ -2024,7 +2068,9 @@ void Pet::InitTalentForLevel()
|
||||||
|
|
||||||
Unit* owner = GetOwner();
|
Unit* owner = GetOwner();
|
||||||
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
|
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_loading)
|
if (!m_loading)
|
||||||
((Player*)owner)->SendTalentsInfoData(true);
|
((Player*)owner)->SendTalentsInfoData(true);
|
||||||
|
|
@ -2041,13 +2087,19 @@ uint32 Pet::resetTalentsCost() const
|
||||||
}
|
}
|
||||||
// then 50 silver
|
// then 50 silver
|
||||||
else if (m_resetTalentsCost < 50 * SILVER)
|
else if (m_resetTalentsCost < 50 * SILVER)
|
||||||
{ return 50 * SILVER; }
|
{
|
||||||
|
return 50 * SILVER;
|
||||||
|
}
|
||||||
// then 1 gold
|
// then 1 gold
|
||||||
else if (m_resetTalentsCost < 1 * GOLD)
|
else if (m_resetTalentsCost < 1 * GOLD)
|
||||||
{ return 1 * GOLD; }
|
{
|
||||||
|
return 1 * GOLD;
|
||||||
|
}
|
||||||
// then increasing at a rate of 1 gold; cap 10 gold
|
// then increasing at a rate of 1 gold; cap 10 gold
|
||||||
else
|
else
|
||||||
{ return (m_resetTalentsCost + 1 * GOLD > 10 * GOLD ? 10 * GOLD : m_resetTalentsCost + 1 * GOLD); }
|
{
|
||||||
|
return (m_resetTalentsCost + 1 * GOLD > 10 * GOLD ? 10 * GOLD : m_resetTalentsCost + 1 * GOLD);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8 Pet::GetMaxTalentPointsForLevel(uint32 level)
|
uint8 Pet::GetMaxTalentPointsForLevel(uint32 level)
|
||||||
|
|
@ -2174,7 +2226,9 @@ void Pet::LearnPetPassives()
|
||||||
void Pet::CastPetAuras(bool current)
|
void Pet::CastPetAuras(bool current)
|
||||||
{
|
{
|
||||||
if (!isControlled())
|
if (!isControlled())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Unit* owner = GetOwner();
|
Unit* owner = GetOwner();
|
||||||
|
|
||||||
|
|
@ -2188,14 +2242,18 @@ void Pet::CastPetAuras(bool current)
|
||||||
owner->RemovePetAura(pa);
|
owner->RemovePetAura(pa);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ CastPetAura(pa); }
|
{
|
||||||
|
CastPetAura(pa);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pet::CastOwnerTalentAuras()
|
void Pet::CastOwnerTalentAuras()
|
||||||
{
|
{
|
||||||
if (!GetOwner() || GetOwner()->GetTypeId() != TYPEID_PLAYER)
|
if (!GetOwner() || GetOwner()->GetTypeId() != TYPEID_PLAYER)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Player* pOwner = static_cast<Player *>(GetOwner());
|
Player* pOwner = static_cast<Player *>(GetOwner());
|
||||||
|
|
||||||
|
|
@ -2244,7 +2302,9 @@ void Pet::CastPetAura(PetAura const* aura)
|
||||||
CastCustomSpell(this, auraId, &basePoints, NULL, NULL, true);
|
CastCustomSpell(this, auraId, &basePoints, NULL, NULL, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ CastSpell(this, auraId, true); }
|
{
|
||||||
|
CastSpell(this, auraId, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DoPetLearnSpell
|
struct DoPetLearnSpell
|
||||||
|
|
@ -2335,7 +2395,9 @@ void Pet::ApplyModeFlags(PetModeFlags mode, bool apply)
|
||||||
|
|
||||||
Unit* owner = GetOwner();
|
Unit* owner = GetOwner();
|
||||||
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
|
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
WorldPacket data(SMSG_PET_MODE, 12);
|
WorldPacket data(SMSG_PET_MODE, 12);
|
||||||
data << GetObjectGuid();
|
data << GetObjectGuid();
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,9 @@ void PetAI::MoveInLineOfSight(Unit* pWho)
|
||||||
{
|
{
|
||||||
if (Unit* victim = m_creature->getVictim())
|
if (Unit* victim = m_creature->getVictim())
|
||||||
if (victim->IsAlive())
|
if (victim->IsAlive())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (CharmInfo* charmInfo = m_creature->GetCharmInfo())
|
if (CharmInfo* charmInfo = m_creature->GetCharmInfo())
|
||||||
{
|
{
|
||||||
|
|
@ -154,7 +156,9 @@ void PetAI::UpdateAI(const uint32 diff)
|
||||||
// UpdateAllies self set update timer
|
// UpdateAllies self set update timer
|
||||||
{ UpdateAllies(); }
|
{ UpdateAllies(); }
|
||||||
else
|
else
|
||||||
{ m_updateAlliesTimer -= diff; }
|
{
|
||||||
|
m_updateAlliesTimer -= diff;
|
||||||
|
}
|
||||||
|
|
||||||
if (inCombat && !victim)
|
if (inCombat && !victim)
|
||||||
{
|
{
|
||||||
|
|
@ -214,7 +218,9 @@ void PetAI::UpdateAI(const uint32 diff)
|
||||||
((Pet*)m_creature)->SetSpellOpener();
|
((Pet*)m_creature)->SetSpellOpener();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Autocast (casted only in combat or persistent spells in any state)
|
// Autocast (casted only in combat or persistent spells in any state)
|
||||||
else if (!m_creature->IsNonMeleeSpellCasted(false))
|
else if (!m_creature->IsNonMeleeSpellCasted(false))
|
||||||
|
|
@ -357,7 +363,9 @@ void PetAI::UpdateAI(const uint32 diff)
|
||||||
|
|
||||||
// Stop here if casting spell (No melee and no movement)
|
// Stop here if casting spell (No melee and no movement)
|
||||||
if (m_creature->IsNonMeleeSpellCasted(false))
|
if (m_creature->IsNonMeleeSpellCasted(false))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (victim)
|
if (victim)
|
||||||
{
|
{
|
||||||
|
|
@ -465,7 +473,9 @@ void PetAI::UpdateAllies()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (owner->GetTypeId() == TYPEID_PLAYER)
|
else if (owner->GetTypeId() == TYPEID_PLAYER)
|
||||||
{ pGroup = ((Player*)owner)->GetGroup(); }
|
{
|
||||||
|
pGroup = ((Player*)owner)->GetGroup();
|
||||||
|
}
|
||||||
|
|
||||||
// only pet and owner/not in group->ok
|
// only pet and owner/not in group->ok
|
||||||
if (m_AllySet.size() == 2 && !pGroup)
|
if (m_AllySet.size() == 2 && !pGroup)
|
||||||
|
|
@ -499,7 +509,9 @@ void PetAI::UpdateAllies()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // remove group
|
else // remove group
|
||||||
{ m_AllySet.insert(owner->GetObjectGuid()); }
|
{
|
||||||
|
m_AllySet.insert(owner->GetObjectGuid());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PetAI::AttackedBy(Unit* attacker)
|
void PetAI::AttackedBy(Unit* attacker)
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -246,7 +246,9 @@ struct Glyph
|
||||||
void SetId(uint32 newId)
|
void SetId(uint32 newId)
|
||||||
{
|
{
|
||||||
if (newId == id)
|
if (newId == id)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (id == 0 && uState == GLYPH_UNCHANGED) // not exist yet in db and already saved
|
if (id == 0 && uState == GLYPH_UNCHANGED) // not exist yet in db and already saved
|
||||||
{
|
{
|
||||||
|
|
@ -925,7 +927,9 @@ class PlayerTaxi
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void AppendTaximaskTo(ByteBuffer& data, bool all);
|
void AppendTaximaskTo(ByteBuffer& data, bool all);
|
||||||
|
|
||||||
|
|
@ -1197,7 +1201,9 @@ class Player : public Unit
|
||||||
m_ExtraFlags |= PLAYER_EXTRA_AUCTION_ENEMY;
|
m_ExtraFlags |= PLAYER_EXTRA_AUCTION_ENEMY;
|
||||||
}
|
}
|
||||||
else if (state > 0)
|
else if (state > 0)
|
||||||
{ m_ExtraFlags |= PLAYER_EXTRA_AUCTION_NEUTRAL; }
|
{
|
||||||
|
m_ExtraFlags |= PLAYER_EXTRA_AUCTION_NEUTRAL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -2307,7 +2313,9 @@ class Player : public Unit
|
||||||
{
|
{
|
||||||
for (int i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
for (int i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||||
if (m_bgBattleGroundQueueID[i].invitedToInstance == instanceId)
|
if (m_bgBattleGroundQueueID[i].invitedToInstance == instanceId)
|
||||||
|
{
|
||||||
return m_bgBattleGroundQueueID[i].bgQueueTypeId;
|
return m_bgBattleGroundQueueID[i].bgQueueTypeId;
|
||||||
|
}
|
||||||
return BATTLEGROUND_QUEUE_NONE;
|
return BATTLEGROUND_QUEUE_NONE;
|
||||||
}
|
}
|
||||||
uint32 GetBattleGroundQueueIndex(BattleGroundQueueTypeId bgQueueTypeId) const
|
uint32 GetBattleGroundQueueIndex(BattleGroundQueueTypeId bgQueueTypeId) const
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,9 @@ int
|
||||||
ReactorAI::Permissible(const Creature* creature)
|
ReactorAI::Permissible(const Creature* creature)
|
||||||
{
|
{
|
||||||
if (creature->IsCivilian() || creature->IsNeutralToAll())
|
if (creature->IsCivilian() || creature->IsNeutralToAll())
|
||||||
|
{
|
||||||
return PERMIT_BASE_REACTIVE;
|
return PERMIT_BASE_REACTIVE;
|
||||||
|
}
|
||||||
|
|
||||||
return PERMIT_BASE_NO;
|
return PERMIT_BASE_NO;
|
||||||
}
|
}
|
||||||
|
|
@ -49,7 +51,9 @@ void
|
||||||
ReactorAI::AttackStart(Unit* p)
|
ReactorAI::AttackStart(Unit* p)
|
||||||
{
|
{
|
||||||
if (!p || !m_creature->CanAttackByItself())
|
if (!p || !m_creature->CanAttackByItself())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_creature->Attack(p, true))
|
if (m_creature->Attack(p, true))
|
||||||
{
|
{
|
||||||
|
|
@ -75,7 +79,9 @@ ReactorAI::UpdateAI(const uint32 /*time_diff*/)
|
||||||
{
|
{
|
||||||
// update i_victimGuid if i_creature.getVictim() !=0 and changed
|
// update i_victimGuid if i_creature.getVictim() !=0 and changed
|
||||||
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
|
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
i_victimGuid = m_creature->getVictim()->GetObjectGuid();
|
i_victimGuid = m_creature->getVictim()->GetObjectGuid();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,9 @@ ReputationRank ReputationMgr::ReputationToRank(int32 standing)
|
||||||
{
|
{
|
||||||
limit -= PointsInRank[i];
|
limit -= PointsInRank[i];
|
||||||
if (standing >= limit)
|
if (standing >= limit)
|
||||||
|
{
|
||||||
return ReputationRank(i);
|
return ReputationRank(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return MIN_REPUTATION_RANK;
|
return MIN_REPUTATION_RANK;
|
||||||
}
|
}
|
||||||
|
|
@ -61,7 +63,9 @@ int32 ReputationMgr::GetReputation(uint32 faction_id) const
|
||||||
int32 ReputationMgr::GetBaseReputation(FactionEntry const* factionEntry) const
|
int32 ReputationMgr::GetBaseReputation(FactionEntry const* factionEntry) const
|
||||||
{
|
{
|
||||||
if (!factionEntry)
|
if (!factionEntry)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 raceMask = m_player->getRaceMask();
|
uint32 raceMask = m_player->getRaceMask();
|
||||||
uint32 classMask = m_player->getClassMask();
|
uint32 classMask = m_player->getClassMask();
|
||||||
|
|
@ -75,10 +79,14 @@ int32 ReputationMgr::GetReputation(FactionEntry const* factionEntry) const
|
||||||
{
|
{
|
||||||
// Faction without recorded reputation. Just ignore.
|
// Faction without recorded reputation. Just ignore.
|
||||||
if (!factionEntry)
|
if (!factionEntry)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (FactionState const* state = GetState(factionEntry))
|
if (FactionState const* state = GetState(factionEntry))
|
||||||
|
{
|
||||||
return GetBaseReputation(factionEntry) + state->Standing;
|
return GetBaseReputation(factionEntry) + state->Standing;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -106,7 +114,9 @@ void ReputationMgr::ApplyForceReaction(uint32 faction_id, ReputationRank rank, b
|
||||||
uint32 ReputationMgr::GetDefaultStateFlags(FactionEntry const* factionEntry) const
|
uint32 ReputationMgr::GetDefaultStateFlags(FactionEntry const* factionEntry) const
|
||||||
{
|
{
|
||||||
if (!factionEntry)
|
if (!factionEntry)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 raceMask = m_player->getRaceMask();
|
uint32 raceMask = m_player->getRaceMask();
|
||||||
uint32 classMask = m_player->getClassMask();
|
uint32 classMask = m_player->getClassMask();
|
||||||
|
|
@ -201,7 +211,9 @@ void ReputationMgr::SendInitialReputations()
|
||||||
void ReputationMgr::SendVisible(FactionState const* faction) const
|
void ReputationMgr::SendVisible(FactionState const* faction) const
|
||||||
{
|
{
|
||||||
if (m_player->GetSession()->PlayerLoading())
|
if (m_player->GetSession()->PlayerLoading())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// make faction visible in reputation list at client
|
// make faction visible in reputation list at client
|
||||||
WorldPacket data(SMSG_SET_FACTION_VISIBLE, 4);
|
WorldPacket data(SMSG_SET_FACTION_VISIBLE, 4);
|
||||||
|
|
@ -361,7 +373,9 @@ bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, in
|
||||||
achievementManager.UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION, factionEntry->ID);
|
achievementManager.UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION, factionEntry->ID);
|
||||||
|
|
||||||
if (new_rank > old_rank)
|
if (new_rank > old_rank)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -369,7 +383,9 @@ bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, in
|
||||||
void ReputationMgr::SetVisible(FactionTemplateEntry const* factionTemplateEntry)
|
void ReputationMgr::SetVisible(FactionTemplateEntry const* factionTemplateEntry)
|
||||||
{
|
{
|
||||||
if (!factionTemplateEntry->faction)
|
if (!factionTemplateEntry->faction)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction))
|
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction))
|
||||||
SetVisible(factionEntry);
|
SetVisible(factionEntry);
|
||||||
|
|
@ -378,11 +394,15 @@ void ReputationMgr::SetVisible(FactionTemplateEntry const* factionTemplateEntry)
|
||||||
void ReputationMgr::SetVisible(FactionEntry const* factionEntry)
|
void ReputationMgr::SetVisible(FactionEntry const* factionEntry)
|
||||||
{
|
{
|
||||||
if (factionEntry->reputationListID < 0)
|
if (factionEntry->reputationListID < 0)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
FactionStateList::iterator itr = m_factions.find(factionEntry->reputationListID);
|
FactionStateList::iterator itr = m_factions.find(factionEntry->reputationListID);
|
||||||
if (itr == m_factions.end())
|
if (itr == m_factions.end())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SetVisible(&itr->second);
|
SetVisible(&itr->second);
|
||||||
}
|
}
|
||||||
|
|
@ -391,11 +411,15 @@ void ReputationMgr::SetVisible(FactionState* faction)
|
||||||
{
|
{
|
||||||
// always invisible or hidden faction can't be make visible
|
// always invisible or hidden faction can't be make visible
|
||||||
if (faction->Flags & (FACTION_FLAG_INVISIBLE_FORCED | FACTION_FLAG_HIDDEN))
|
if (faction->Flags & (FACTION_FLAG_INVISIBLE_FORCED | FACTION_FLAG_HIDDEN))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// already set
|
// already set
|
||||||
if (faction->Flags & FACTION_FLAG_VISIBLE)
|
if (faction->Flags & FACTION_FLAG_VISIBLE)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
faction->Flags |= FACTION_FLAG_VISIBLE;
|
faction->Flags |= FACTION_FLAG_VISIBLE;
|
||||||
faction->needSend = true;
|
faction->needSend = true;
|
||||||
|
|
@ -410,11 +434,15 @@ void ReputationMgr::SetAtWar(RepListID repListID, bool on)
|
||||||
{
|
{
|
||||||
FactionStateList::iterator itr = m_factions.find(repListID);
|
FactionStateList::iterator itr = m_factions.find(repListID);
|
||||||
if (itr == m_factions.end())
|
if (itr == m_factions.end())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// always invisible or hidden faction can't change war state
|
// always invisible or hidden faction can't change war state
|
||||||
if (itr->second.Flags & (FACTION_FLAG_INVISIBLE_FORCED | FACTION_FLAG_HIDDEN))
|
if (itr->second.Flags & (FACTION_FLAG_INVISIBLE_FORCED | FACTION_FLAG_HIDDEN))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SetAtWar(&itr->second, on);
|
SetAtWar(&itr->second, on);
|
||||||
}
|
}
|
||||||
|
|
@ -423,11 +451,15 @@ void ReputationMgr::SetAtWar(FactionState* faction, bool atWar)
|
||||||
{
|
{
|
||||||
// not allow declare war to faction unless already hated or less
|
// not allow declare war to faction unless already hated or less
|
||||||
if (atWar && (faction->Flags & FACTION_FLAG_PEACE_FORCED) && ReputationToRank(faction->Standing) > REP_HATED)
|
if (atWar && (faction->Flags & FACTION_FLAG_PEACE_FORCED) && ReputationToRank(faction->Standing) > REP_HATED)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// already set
|
// already set
|
||||||
if (((faction->Flags & FACTION_FLAG_AT_WAR) != 0) == atWar)
|
if (((faction->Flags & FACTION_FLAG_AT_WAR) != 0) == atWar)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (atWar)
|
if (atWar)
|
||||||
faction->Flags |= FACTION_FLAG_AT_WAR;
|
faction->Flags |= FACTION_FLAG_AT_WAR;
|
||||||
|
|
@ -442,7 +474,9 @@ void ReputationMgr::SetInactive(RepListID repListID, bool on)
|
||||||
{
|
{
|
||||||
FactionStateList::iterator itr = m_factions.find(repListID);
|
FactionStateList::iterator itr = m_factions.find(repListID);
|
||||||
if (itr == m_factions.end())
|
if (itr == m_factions.end())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SetInactive(&itr->second, on);
|
SetInactive(&itr->second, on);
|
||||||
}
|
}
|
||||||
|
|
@ -451,11 +485,15 @@ void ReputationMgr::SetInactive(FactionState* faction, bool inactive)
|
||||||
{
|
{
|
||||||
// always invisible or hidden faction can't be inactive
|
// always invisible or hidden faction can't be inactive
|
||||||
if (inactive && ((faction->Flags & (FACTION_FLAG_INVISIBLE_FORCED | FACTION_FLAG_HIDDEN)) || !(faction->Flags & FACTION_FLAG_VISIBLE)))
|
if (inactive && ((faction->Flags & (FACTION_FLAG_INVISIBLE_FORCED | FACTION_FLAG_HIDDEN)) || !(faction->Flags & FACTION_FLAG_VISIBLE)))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// already set
|
// already set
|
||||||
if (((faction->Flags & FACTION_FLAG_INACTIVE) != 0) == inactive)
|
if (((faction->Flags & FACTION_FLAG_INACTIVE) != 0) == inactive)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (inactive)
|
if (inactive)
|
||||||
faction->Flags |= FACTION_FLAG_INACTIVE;
|
faction->Flags |= FACTION_FLAG_INACTIVE;
|
||||||
|
|
|
||||||
|
|
@ -60,12 +60,16 @@ bool PlayerSocial::AddToSocialList(ObjectGuid friend_guid, bool ignore)
|
||||||
if (ignore)
|
if (ignore)
|
||||||
{
|
{
|
||||||
if (GetNumberOfSocialsWithFlag(SOCIAL_FLAG_IGNORED) >= SOCIALMGR_IGNORE_LIMIT)
|
if (GetNumberOfSocialsWithFlag(SOCIAL_FLAG_IGNORED) >= SOCIALMGR_IGNORE_LIMIT)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (GetNumberOfSocialsWithFlag(SOCIAL_FLAG_FRIEND) >= SOCIALMGR_FRIEND_LIMIT)
|
if (GetNumberOfSocialsWithFlag(SOCIAL_FLAG_FRIEND) >= SOCIALMGR_FRIEND_LIMIT)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 flag = SOCIAL_FLAG_FRIEND;
|
uint32 flag = SOCIAL_FLAG_FRIEND;
|
||||||
|
|
@ -92,7 +96,9 @@ void PlayerSocial::RemoveFromSocialList(ObjectGuid friend_guid, bool ignore)
|
||||||
{
|
{
|
||||||
PlayerSocialMap::iterator itr = m_playerSocialMap.find(friend_guid.GetCounter());
|
PlayerSocialMap::iterator itr = m_playerSocialMap.find(friend_guid.GetCounter());
|
||||||
if (itr == m_playerSocialMap.end()) // not exist
|
if (itr == m_playerSocialMap.end()) // not exist
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 flag = SOCIAL_FLAG_FRIEND;
|
uint32 flag = SOCIAL_FLAG_FRIEND;
|
||||||
if (ignore)
|
if (ignore)
|
||||||
|
|
@ -114,7 +120,9 @@ void PlayerSocial::SetFriendNote(ObjectGuid friend_guid, std::string note)
|
||||||
{
|
{
|
||||||
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid.GetCounter());
|
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid.GetCounter());
|
||||||
if (itr == m_playerSocialMap.end()) // not exist
|
if (itr == m_playerSocialMap.end()) // not exist
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
utf8truncate(note, 48); // DB and client size limitation
|
utf8truncate(note, 48); // DB and client size limitation
|
||||||
|
|
||||||
|
|
@ -128,7 +136,9 @@ void PlayerSocial::SendSocialList()
|
||||||
{
|
{
|
||||||
Player* plr = sObjectMgr.GetPlayer(ObjectGuid(HIGHGUID_PLAYER, m_playerLowGuid));
|
Player* plr = sObjectMgr.GetPlayer(ObjectGuid(HIGHGUID_PLAYER, m_playerLowGuid));
|
||||||
if (!plr)
|
if (!plr)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 size = m_playerSocialMap.size();
|
uint32 size = m_playerSocialMap.size();
|
||||||
|
|
||||||
|
|
@ -164,7 +174,9 @@ bool PlayerSocial::HasFriend(ObjectGuid friend_guid)
|
||||||
{
|
{
|
||||||
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid.GetCounter());
|
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid.GetCounter());
|
||||||
if (itr != m_playerSocialMap.end())
|
if (itr != m_playerSocialMap.end())
|
||||||
|
{
|
||||||
return itr->second.Flags & SOCIAL_FLAG_FRIEND;
|
return itr->second.Flags & SOCIAL_FLAG_FRIEND;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -172,7 +184,9 @@ bool PlayerSocial::HasIgnore(ObjectGuid ignore_guid)
|
||||||
{
|
{
|
||||||
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(ignore_guid.GetCounter());
|
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(ignore_guid.GetCounter());
|
||||||
if (itr != m_playerSocialMap.end())
|
if (itr != m_playerSocialMap.end())
|
||||||
|
{
|
||||||
return itr->second.Flags & SOCIAL_FLAG_IGNORED;
|
return itr->second.Flags & SOCIAL_FLAG_IGNORED;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -187,7 +201,9 @@ SocialMgr::~SocialMgr()
|
||||||
void SocialMgr::GetFriendInfo(Player* player, uint32 friend_lowguid, FriendInfo& friendInfo)
|
void SocialMgr::GetFriendInfo(Player* player, uint32 friend_lowguid, FriendInfo& friendInfo)
|
||||||
{
|
{
|
||||||
if (!player)
|
if (!player)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Player* pFriend = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, friend_lowguid));
|
Player* pFriend = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, friend_lowguid));
|
||||||
|
|
||||||
|
|
@ -273,7 +289,9 @@ void SocialMgr::SendFriendStatus(Player* player, FriendsResult result, ObjectGui
|
||||||
void SocialMgr::BroadcastToFriendListers(Player* player, WorldPacket* packet)
|
void SocialMgr::BroadcastToFriendListers(Player* player, WorldPacket* packet)
|
||||||
{
|
{
|
||||||
if (!player)
|
if (!player)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Team team = player->GetTeam();
|
Team team = player->GetTeam();
|
||||||
AccountTypes security = player->GetSession()->GetSecurity();
|
AccountTypes security = player->GetSession()->GetSecurity();
|
||||||
|
|
@ -307,7 +325,9 @@ PlayerSocial* SocialMgr::LoadFromDB(QueryResult* result, ObjectGuid guid)
|
||||||
social->SetPlayerGuid(guid);
|
social->SetPlayerGuid(guid);
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
|
{
|
||||||
return social;
|
return social;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 friend_guid = 0;
|
uint32 friend_guid = 0;
|
||||||
uint32 flags = 0;
|
uint32 flags = 0;
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -89,19 +89,25 @@ float CalculateDefaultCoefficient(SpellEntry const* spellProto, DamageEffectType
|
||||||
inline float GetSpellMinRange(SpellRangeEntry const* range, bool friendly = false)
|
inline float GetSpellMinRange(SpellRangeEntry const* range, bool friendly = false)
|
||||||
{
|
{
|
||||||
if (!range)
|
if (!range)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
return (friendly ? range->minRangeFriendly : range->minRange);
|
return (friendly ? range->minRangeFriendly : range->minRange);
|
||||||
}
|
}
|
||||||
inline float GetSpellMaxRange(SpellRangeEntry const* range, bool friendly = false)
|
inline float GetSpellMaxRange(SpellRangeEntry const* range, bool friendly = false)
|
||||||
{
|
{
|
||||||
if (!range)
|
if (!range)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
return (friendly ? range->maxRangeFriendly : range->maxRange);
|
return (friendly ? range->maxRangeFriendly : range->maxRange);
|
||||||
}
|
}
|
||||||
inline uint32 GetSpellRecoveryTime(SpellEntry const *spellInfo)
|
inline uint32 GetSpellRecoveryTime(SpellEntry const *spellInfo)
|
||||||
{
|
{
|
||||||
if(SpellCooldownsEntry const* cooldowns = spellInfo->GetSpellCooldowns())
|
if(SpellCooldownsEntry const* cooldowns = spellInfo->GetSpellCooldowns())
|
||||||
|
{
|
||||||
return cooldowns->RecoveryTime > cooldowns->CategoryRecoveryTime ? cooldowns->RecoveryTime : cooldowns->CategoryRecoveryTime;
|
return cooldowns->RecoveryTime > cooldowns->CategoryRecoveryTime ? cooldowns->RecoveryTime : cooldowns->CategoryRecoveryTime;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int32 GetSpellDuration(SpellEntry const *spellInfo);
|
int32 GetSpellDuration(SpellEntry const *spellInfo);
|
||||||
|
|
@ -117,7 +123,9 @@ inline bool IsSpellHaveEffect(SpellEntry const* spellInfo, SpellEffects effect)
|
||||||
{
|
{
|
||||||
if(SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(i)))
|
if(SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(i)))
|
||||||
if(SpellEffects(effectEntry->Effect) == effect)
|
if(SpellEffects(effectEntry->Effect) == effect)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -126,7 +134,9 @@ inline bool IsAuraApplyEffect(SpellEntry const* spellInfo, SpellEffectIndex effe
|
||||||
{
|
{
|
||||||
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(SpellEffectIndex(effecIdx));
|
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(SpellEffectIndex(effecIdx));
|
||||||
if (!spellEffect)
|
if (!spellEffect)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
switch (spellEffect->Effect)
|
switch (spellEffect->Effect)
|
||||||
{
|
{
|
||||||
|
|
@ -147,7 +157,9 @@ inline bool IsSpellAppliesAura(SpellEntry const* spellInfo, uint32 effectMask =
|
||||||
for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
|
for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
|
||||||
if (effectMask & (1 << i))
|
if (effectMask & (1 << i))
|
||||||
if (IsAuraApplyEffect(spellInfo, SpellEffectIndex(i)))
|
if (IsAuraApplyEffect(spellInfo, SpellEffectIndex(i)))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -156,7 +168,9 @@ inline bool IsEffectHandledOnDelayedSpellLaunch(SpellEntry const* spellInfo, Spe
|
||||||
{
|
{
|
||||||
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(effecIdx);
|
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(effecIdx);
|
||||||
if(!effectEntry)
|
if(!effectEntry)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
switch (effectEntry->Effect)
|
switch (effectEntry->Effect)
|
||||||
{
|
{
|
||||||
case SPELL_EFFECT_SCHOOL_DAMAGE:
|
case SPELL_EFFECT_SCHOOL_DAMAGE:
|
||||||
|
|
@ -174,7 +188,9 @@ inline bool IsPeriodicRegenerateEffect(SpellEntry const* spellInfo, SpellEffectI
|
||||||
{
|
{
|
||||||
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(effecIdx);
|
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(effecIdx);
|
||||||
if(!effectEntry)
|
if(!effectEntry)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
switch (AuraType(effectEntry->EffectApplyAuraName))
|
switch (AuraType(effectEntry->EffectApplyAuraName))
|
||||||
{
|
{
|
||||||
|
|
@ -195,7 +211,9 @@ inline bool IsSpellHaveAura(SpellEntry const* spellInfo, AuraType aura, uint32 e
|
||||||
if (effectMask & (1 << i))
|
if (effectMask & (1 << i))
|
||||||
if(SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(i)))
|
if(SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(i)))
|
||||||
if(AuraType(effectEntry->EffectApplyAuraName) == aura)
|
if(AuraType(effectEntry->EffectApplyAuraName) == aura)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -205,7 +223,9 @@ inline bool IsSpellLastAuraEffect(SpellEntry const* spellInfo, SpellEffectIndex
|
||||||
{
|
{
|
||||||
if(SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(i)))
|
if(SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(i)))
|
||||||
if(effectEntry->EffectApplyAuraName)
|
if(effectEntry->EffectApplyAuraName)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -243,7 +263,9 @@ inline bool IsLootCraftingSpell(SpellEntry const* spellInfo)
|
||||||
{
|
{
|
||||||
SpellEffectEntry const* spellEffect0 = spellInfo->GetSpellEffect(EFFECT_INDEX_0);
|
SpellEffectEntry const* spellEffect0 = spellInfo->GetSpellEffect(EFFECT_INDEX_0);
|
||||||
if (!spellEffect0)
|
if (!spellEffect0)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
SpellTotemsEntry const* totems = spellInfo->GetSpellTotems();
|
SpellTotemsEntry const* totems = spellInfo->GetSpellTotems();
|
||||||
|
|
||||||
|
|
@ -273,7 +295,9 @@ inline bool IsSpellRemoveAllMovementAndControlLossEffects(SpellEntry const* spel
|
||||||
{
|
{
|
||||||
SpellEffectEntry const* spellEffect0 = spellProto->GetSpellEffect(EFFECT_INDEX_0);
|
SpellEffectEntry const* spellEffect0 = spellProto->GetSpellEffect(EFFECT_INDEX_0);
|
||||||
if (!spellEffect0)
|
if (!spellEffect0)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return spellEffect0->EffectApplyAuraName == SPELL_AURA_MECHANIC_IMMUNITY &&
|
return spellEffect0->EffectApplyAuraName == SPELL_AURA_MECHANIC_IMMUNITY &&
|
||||||
spellEffect0->EffectMiscValue == 1 &&
|
spellEffect0->EffectMiscValue == 1 &&
|
||||||
|
|
@ -351,14 +375,20 @@ inline bool IsSpellWithCasterSourceTargetsOnly(SpellEntry const* spellInfo)
|
||||||
|
|
||||||
uint32 targetA = effectEntry->EffectImplicitTargetA;
|
uint32 targetA = effectEntry->EffectImplicitTargetA;
|
||||||
if(targetA && !IsCasterSourceTarget(targetA))
|
if(targetA && !IsCasterSourceTarget(targetA))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 targetB = effectEntry->EffectImplicitTargetB;
|
uint32 targetB = effectEntry->EffectImplicitTargetB;
|
||||||
if(targetB && !IsCasterSourceTarget(targetB))
|
if(targetB && !IsCasterSourceTarget(targetB))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!targetA && !targetB)
|
if (!targetA && !targetB)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -439,13 +469,19 @@ inline bool IsAreaOfEffectSpell(SpellEntry const* spellInfo)
|
||||||
{
|
{
|
||||||
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(EFFECT_INDEX_0);
|
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(EFFECT_INDEX_0);
|
||||||
if(effectEntry && (IsAreaEffectTarget(Targets(effectEntry->EffectImplicitTargetA)) || IsAreaEffectTarget(Targets(effectEntry->EffectImplicitTargetB))))
|
if(effectEntry && (IsAreaEffectTarget(Targets(effectEntry->EffectImplicitTargetA)) || IsAreaEffectTarget(Targets(effectEntry->EffectImplicitTargetB))))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
effectEntry = spellInfo->GetSpellEffect(EFFECT_INDEX_1);
|
effectEntry = spellInfo->GetSpellEffect(EFFECT_INDEX_1);
|
||||||
if(effectEntry && (IsAreaEffectTarget(Targets(effectEntry->EffectImplicitTargetA)) || IsAreaEffectTarget(Targets(effectEntry->EffectImplicitTargetB))))
|
if(effectEntry && (IsAreaEffectTarget(Targets(effectEntry->EffectImplicitTargetA)) || IsAreaEffectTarget(Targets(effectEntry->EffectImplicitTargetB))))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
effectEntry = spellInfo->GetSpellEffect(EFFECT_INDEX_2);
|
effectEntry = spellInfo->GetSpellEffect(EFFECT_INDEX_2);
|
||||||
if(effectEntry && (IsAreaEffectTarget(Targets(effectEntry->EffectImplicitTargetA)) || IsAreaEffectTarget(Targets(effectEntry->EffectImplicitTargetB))))
|
if(effectEntry && (IsAreaEffectTarget(Targets(effectEntry->EffectImplicitTargetA)) || IsAreaEffectTarget(Targets(effectEntry->EffectImplicitTargetB))))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -470,7 +506,9 @@ inline bool HasAreaAuraEffect(SpellEntry const* spellInfo)
|
||||||
if(!effectEntry)
|
if(!effectEntry)
|
||||||
continue;
|
continue;
|
||||||
if (IsAreaAuraEffect(effectEntry->Effect))
|
if (IsAreaAuraEffect(effectEntry->Effect))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -554,11 +592,15 @@ inline bool IsChanneledSpell(SpellEntry const* spellInfo)
|
||||||
inline bool IsNeedCastSpellAtFormApply(SpellEntry const* spellInfo, ShapeshiftForm form)
|
inline bool IsNeedCastSpellAtFormApply(SpellEntry const* spellInfo, ShapeshiftForm form)
|
||||||
{
|
{
|
||||||
if ((!spellInfo->HasAttribute(SPELL_ATTR_PASSIVE) && !spellInfo->HasAttribute(SPELL_ATTR_UNK7)) || !form)
|
if ((!spellInfo->HasAttribute(SPELL_ATTR_PASSIVE) && !spellInfo->HasAttribute(SPELL_ATTR_UNK7)) || !form)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
SpellShapeshiftEntry const* shapeShift = spellInfo->GetSpellShapeshift();
|
SpellShapeshiftEntry const* shapeShift = spellInfo->GetSpellShapeshift();
|
||||||
if (!shapeShift)
|
if (!shapeShift)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// passive spells with SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT are already active without shapeshift, do no recast!
|
// passive spells with SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT are already active without shapeshift, do no recast!
|
||||||
return (shapeShift->Stances & (1<<(form-1)) && !(spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT));
|
return (shapeShift->Stances & (1<<(form-1)) && !(spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT));
|
||||||
|
|
@ -623,10 +665,14 @@ inline Mechanics GetEffectMechanic(SpellEntry const* spellInfo, SpellEffectIndex
|
||||||
{
|
{
|
||||||
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(effect));
|
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(effect));
|
||||||
if (effectEntry && effectEntry->EffectMechanic)
|
if (effectEntry && effectEntry->EffectMechanic)
|
||||||
|
{
|
||||||
return Mechanics(effectEntry->EffectMechanic);
|
return Mechanics(effectEntry->EffectMechanic);
|
||||||
|
}
|
||||||
SpellCategoriesEntry const* spellCategory = spellInfo->GetSpellCategories();
|
SpellCategoriesEntry const* spellCategory = spellInfo->GetSpellCategories();
|
||||||
if (spellCategory && spellCategory->Mechanic)
|
if (spellCategory && spellCategory->Mechanic)
|
||||||
|
{
|
||||||
return Mechanics(spellCategory->Mechanic);
|
return Mechanics(spellCategory->Mechanic);
|
||||||
|
}
|
||||||
return MECHANIC_NONE;
|
return MECHANIC_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -634,9 +680,13 @@ inline uint32 GetDispellMask(DispelType dispel)
|
||||||
{
|
{
|
||||||
// If dispell all
|
// If dispell all
|
||||||
if (dispel == DISPEL_ALL)
|
if (dispel == DISPEL_ALL)
|
||||||
|
{
|
||||||
return DISPEL_ALL_MASK;
|
return DISPEL_ALL_MASK;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return (1 << dispel);
|
return (1 << dispel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Diminishing Returns interaction with spells
|
// Diminishing Returns interaction with spells
|
||||||
|
|
@ -850,14 +900,20 @@ class PetAura
|
||||||
{
|
{
|
||||||
std::map<uint32, uint32>::const_iterator itr = auras.find(petEntry);
|
std::map<uint32, uint32>::const_iterator itr = auras.find(petEntry);
|
||||||
if (itr != auras.end())
|
if (itr != auras.end())
|
||||||
|
{
|
||||||
return itr->second;
|
return itr->second;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::map<uint32, uint32>::const_iterator itr2 = auras.find(0);
|
std::map<uint32, uint32>::const_iterator itr2 = auras.find(0);
|
||||||
if (itr2 != auras.end())
|
if (itr2 != auras.end())
|
||||||
|
{
|
||||||
return itr2->second;
|
return itr2->second;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -996,7 +1052,9 @@ class SpellMgr
|
||||||
{
|
{
|
||||||
SpellElixirMap::const_iterator itr = mSpellElixirs.find(spellid);
|
SpellElixirMap::const_iterator itr = mSpellElixirs.find(spellid);
|
||||||
if (itr == mSpellElixirs.end())
|
if (itr == mSpellElixirs.end())
|
||||||
|
{
|
||||||
return 0x0;
|
return 0x0;
|
||||||
|
}
|
||||||
|
|
||||||
return itr->second;
|
return itr->second;
|
||||||
}
|
}
|
||||||
|
|
@ -1007,22 +1065,34 @@ class SpellMgr
|
||||||
|
|
||||||
// flasks must have all bits set from ELIXIR_FLASK_MASK
|
// flasks must have all bits set from ELIXIR_FLASK_MASK
|
||||||
if ((mask & ELIXIR_FLASK_MASK) == ELIXIR_FLASK_MASK)
|
if ((mask & ELIXIR_FLASK_MASK) == ELIXIR_FLASK_MASK)
|
||||||
|
{
|
||||||
return SPELL_FLASK_ELIXIR;
|
return SPELL_FLASK_ELIXIR;
|
||||||
|
}
|
||||||
else if (mask & ELIXIR_BATTLE_MASK)
|
else if (mask & ELIXIR_BATTLE_MASK)
|
||||||
|
{
|
||||||
return SPELL_BATTLE_ELIXIR;
|
return SPELL_BATTLE_ELIXIR;
|
||||||
|
}
|
||||||
else if (mask & ELIXIR_GUARDIAN_MASK)
|
else if (mask & ELIXIR_GUARDIAN_MASK)
|
||||||
|
{
|
||||||
return SPELL_GUARDIAN_ELIXIR;
|
return SPELL_GUARDIAN_ELIXIR;
|
||||||
|
}
|
||||||
else if (mask & ELIXIR_WELL_FED)
|
else if (mask & ELIXIR_WELL_FED)
|
||||||
|
{
|
||||||
return SPELL_WELL_FED;
|
return SPELL_WELL_FED;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return SPELL_NORMAL;
|
return SPELL_NORMAL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SpellThreatEntry const* GetSpellThreatEntry(uint32 spellid) const
|
SpellThreatEntry const* GetSpellThreatEntry(uint32 spellid) const
|
||||||
{
|
{
|
||||||
SpellThreatMap::const_iterator itr = mSpellThreatMap.find(spellid);
|
SpellThreatMap::const_iterator itr = mSpellThreatMap.find(spellid);
|
||||||
if (itr != mSpellThreatMap.end())
|
if (itr != mSpellThreatMap.end())
|
||||||
|
{
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -1030,10 +1100,14 @@ class SpellMgr
|
||||||
float GetSpellThreatMultiplier(SpellEntry const* spellInfo) const
|
float GetSpellThreatMultiplier(SpellEntry const* spellInfo) const
|
||||||
{
|
{
|
||||||
if (!spellInfo)
|
if (!spellInfo)
|
||||||
|
{
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
if (SpellThreatEntry const* entry = GetSpellThreatEntry(spellInfo->Id))
|
if (SpellThreatEntry const* entry = GetSpellThreatEntry(spellInfo->Id))
|
||||||
|
{
|
||||||
return entry->multiplier;
|
return entry->multiplier;
|
||||||
|
}
|
||||||
|
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
}
|
}
|
||||||
|
|
@ -1043,7 +1117,9 @@ class SpellMgr
|
||||||
{
|
{
|
||||||
SpellProcEventMap::const_iterator itr = mSpellProcEventMap.find(spellId);
|
SpellProcEventMap::const_iterator itr = mSpellProcEventMap.find(spellId);
|
||||||
if (itr != mSpellProcEventMap.end())
|
if (itr != mSpellProcEventMap.end())
|
||||||
|
{
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1052,7 +1128,9 @@ class SpellMgr
|
||||||
{
|
{
|
||||||
SpellProcItemEnchantMap::const_iterator itr = mSpellProcItemEnchantMap.find(spellid);
|
SpellProcItemEnchantMap::const_iterator itr = mSpellProcItemEnchantMap.find(spellid);
|
||||||
if (itr == mSpellProcItemEnchantMap.end())
|
if (itr == mSpellProcItemEnchantMap.end())
|
||||||
|
{
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
return itr->second;
|
return itr->second;
|
||||||
}
|
}
|
||||||
|
|
@ -1065,7 +1143,9 @@ class SpellMgr
|
||||||
// Lookup data
|
// Lookup data
|
||||||
SpellBonusMap::const_iterator itr = mSpellBonusMap.find(spellId);
|
SpellBonusMap::const_iterator itr = mSpellBonusMap.find(spellId);
|
||||||
if (itr != mSpellBonusMap.end())
|
if (itr != mSpellBonusMap.end())
|
||||||
|
{
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -1075,7 +1155,9 @@ class SpellMgr
|
||||||
{
|
{
|
||||||
SpellTargetPositionMap::const_iterator itr = mSpellTargetPositions.find(spell_id);
|
SpellTargetPositionMap::const_iterator itr = mSpellTargetPositions.find(spell_id);
|
||||||
if (itr != mSpellTargetPositions.end())
|
if (itr != mSpellTargetPositions.end())
|
||||||
|
{
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1084,7 +1166,9 @@ class SpellMgr
|
||||||
{
|
{
|
||||||
SpellChainMap::const_iterator itr = mSpellChains.find(spell_id);
|
SpellChainMap::const_iterator itr = mSpellChains.find(spell_id);
|
||||||
if (itr == mSpellChains.end())
|
if (itr == mSpellChains.end())
|
||||||
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
}
|
}
|
||||||
|
|
@ -1092,7 +1176,9 @@ class SpellMgr
|
||||||
uint32 GetFirstSpellInChain(uint32 spell_id) const
|
uint32 GetFirstSpellInChain(uint32 spell_id) const
|
||||||
{
|
{
|
||||||
if (SpellChainNode const* node = GetSpellChainNode(spell_id))
|
if (SpellChainNode const* node = GetSpellChainNode(spell_id))
|
||||||
|
{
|
||||||
return node->first;
|
return node->first;
|
||||||
|
}
|
||||||
|
|
||||||
return spell_id;
|
return spell_id;
|
||||||
}
|
}
|
||||||
|
|
@ -1100,7 +1186,9 @@ class SpellMgr
|
||||||
uint32 GetPrevSpellInChain(uint32 spell_id) const
|
uint32 GetPrevSpellInChain(uint32 spell_id) const
|
||||||
{
|
{
|
||||||
if (SpellChainNode const* node = GetSpellChainNode(spell_id))
|
if (SpellChainNode const* node = GetSpellChainNode(spell_id))
|
||||||
|
{
|
||||||
return node->prev;
|
return node->prev;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -1123,7 +1211,9 @@ class SpellMgr
|
||||||
uint8 GetSpellRank(uint32 spell_id) const
|
uint8 GetSpellRank(uint32 spell_id) const
|
||||||
{
|
{
|
||||||
if (SpellChainNode const* node = GetSpellChainNode(spell_id))
|
if (SpellChainNode const* node = GetSpellChainNode(spell_id))
|
||||||
|
{
|
||||||
return node->rank;
|
return node->rank;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -1136,12 +1226,16 @@ class SpellMgr
|
||||||
|
|
||||||
// not ordered correctly by rank value
|
// not ordered correctly by rank value
|
||||||
if (itr == mSpellChains.end() || !rank2 || itr->second.rank <= rank2)
|
if (itr == mSpellChains.end() || !rank2 || itr->second.rank <= rank2)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// check present in same rank chain
|
// check present in same rank chain
|
||||||
for (; itr != mSpellChains.end(); itr = mSpellChains.find(itr->second.prev))
|
for (; itr != mSpellChains.end(); itr = mSpellChains.find(itr->second.prev))
|
||||||
if (itr->second.prev == spell2)
|
if (itr->second.prev == spell2)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -1164,9 +1258,13 @@ class SpellMgr
|
||||||
{
|
{
|
||||||
SpellLearnSkillMap::const_iterator itr = mSpellLearnSkills.find(spell_id);
|
SpellLearnSkillMap::const_iterator itr = mSpellLearnSkills.find(spell_id);
|
||||||
if (itr != mSpellLearnSkills.end())
|
if (itr != mSpellLearnSkills.end())
|
||||||
|
{
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsSpellLearnSpell(uint32 spell_id) const
|
bool IsSpellLearnSpell(uint32 spell_id) const
|
||||||
|
|
@ -1184,7 +1282,9 @@ class SpellMgr
|
||||||
SpellLearnSpellMapBounds bounds = GetSpellLearnSpellMapBounds(spell_id1);
|
SpellLearnSpellMapBounds bounds = GetSpellLearnSpellMapBounds(spell_id1);
|
||||||
for (SpellLearnSpellMap::const_iterator i = bounds.first; i != bounds.second; ++i)
|
for (SpellLearnSpellMap::const_iterator i = bounds.first; i != bounds.second; ++i)
|
||||||
if (i->second.spell == spell_id2)
|
if (i->second.spell == spell_id2)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1213,18 +1313,26 @@ class SpellMgr
|
||||||
{
|
{
|
||||||
SpellPetAuraMap::const_iterator itr = mSpellPetAuraMap.find((spell_id << 8) + eff);
|
SpellPetAuraMap::const_iterator itr = mSpellPetAuraMap.find((spell_id << 8) + eff);
|
||||||
if (itr != mSpellPetAuraMap.end())
|
if (itr != mSpellPetAuraMap.end())
|
||||||
|
{
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PetLevelupSpellSet const* GetPetLevelupSpellList(uint32 petFamily) const
|
PetLevelupSpellSet const* GetPetLevelupSpellList(uint32 petFamily) const
|
||||||
{
|
{
|
||||||
PetLevelupSpellMap::const_iterator itr = mPetLevelupSpellMap.find(petFamily);
|
PetLevelupSpellMap::const_iterator itr = mPetLevelupSpellMap.find(petFamily);
|
||||||
if (itr != mPetLevelupSpellMap.end())
|
if (itr != mPetLevelupSpellMap.end())
|
||||||
|
{
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// < 0 for petspelldata id, > 0 for creature_id
|
// < 0 for petspelldata id, > 0 for creature_id
|
||||||
|
|
@ -1232,7 +1340,9 @@ class SpellMgr
|
||||||
{
|
{
|
||||||
PetDefaultSpellsMap::const_iterator itr = mPetDefaultSpellsMap.find(id);
|
PetDefaultSpellsMap::const_iterator itr = mPetDefaultSpellsMap.find(id);
|
||||||
if (itr != mPetDefaultSpellsMap.end())
|
if (itr != mPetDefaultSpellsMap.end())
|
||||||
|
{
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,9 @@ void Player::UpdateResistances(uint32 school)
|
||||||
pet->UpdateResistances(school);
|
pet->UpdateResistances(school);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ UpdateArmor(); }
|
{
|
||||||
|
UpdateArmor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::UpdateArmor()
|
void Player::UpdateArmor()
|
||||||
|
|
@ -648,7 +650,9 @@ void Player::UpdateAllSpellCritChances()
|
||||||
void Player::UpdateExpertise(WeaponAttackType attack)
|
void Player::UpdateExpertise(WeaponAttackType attack)
|
||||||
{
|
{
|
||||||
if (attack == RANGED_ATTACK)
|
if (attack == RANGED_ATTACK)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int32 expertise = int32(GetRatingBonusValue(CR_EXPERTISE));
|
int32 expertise = int32(GetRatingBonusValue(CR_EXPERTISE));
|
||||||
|
|
||||||
|
|
@ -736,7 +740,9 @@ void Player::UpdateMasteryAuras()
|
||||||
|
|
||||||
std::vector<uint32> const* masterySpells = GetTalentTreeMasterySpells(m_talentsPrimaryTree[m_activeSpec]);
|
std::vector<uint32> const* masterySpells = GetTalentTreeMasterySpells(m_talentsPrimaryTree[m_activeSpec]);
|
||||||
if (!masterySpells)
|
if (!masterySpells)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (uint32 i = 0; i < masterySpells->size(); ++i)
|
for (uint32 i = 0; i < masterySpells->size(); ++i)
|
||||||
{
|
{
|
||||||
|
|
@ -825,7 +831,9 @@ void Creature::UpdateResistances(uint32 school)
|
||||||
SetResistance(SpellSchools(school), int32(value));
|
SetResistance(SpellSchools(school), int32(value));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ UpdateArmor(); }
|
{
|
||||||
|
UpdateArmor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Creature::UpdateArmor()
|
void Creature::UpdateArmor()
|
||||||
|
|
@ -983,7 +991,9 @@ void Pet::UpdateResistances(uint32 school)
|
||||||
SetResistance(SpellSchools(school), int32(value));
|
SetResistance(SpellSchools(school), int32(value));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ UpdateArmor(); }
|
{
|
||||||
|
UpdateArmor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pet::UpdateArmor()
|
void Pet::UpdateArmor()
|
||||||
|
|
@ -1051,7 +1061,9 @@ void Pet::UpdateAttackPowerAndDamage(bool ranged)
|
||||||
val = GetStat(STAT_STRENGTH) - 10.0f;
|
val = GetStat(STAT_STRENGTH) - 10.0f;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ val = 2 * GetStat(STAT_STRENGTH) - 20.0f; }
|
{
|
||||||
|
val = 2 * GetStat(STAT_STRENGTH) - 20.0f;
|
||||||
|
}
|
||||||
|
|
||||||
Unit* owner = GetOwner();
|
Unit* owner = GetOwner();
|
||||||
if (owner && owner->GetTypeId() == TYPEID_PLAYER)
|
if (owner && owner->GetTypeId() == TYPEID_PLAYER)
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,9 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff)
|
||||||
m_timer -= update_diff;
|
m_timer -= update_diff;
|
||||||
}
|
}
|
||||||
else if (m_timer != m_lifetime)
|
else if (m_timer != m_lifetime)
|
||||||
{ m_timer = m_lifetime; }
|
{
|
||||||
|
m_timer = m_lifetime;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -122,10 +124,14 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_timer -= update_diff; }
|
{
|
||||||
|
m_timer -= update_diff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (m_timer != m_lifetime)
|
else if (m_timer != m_lifetime)
|
||||||
{ m_timer = m_lifetime; }
|
{
|
||||||
|
m_timer = m_lifetime;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN:
|
case TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN:
|
||||||
|
|
@ -145,10 +151,14 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_timer -= update_diff; }
|
{
|
||||||
|
m_timer -= update_diff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (m_timer != m_lifetime)
|
else if (m_timer != m_lifetime)
|
||||||
{ m_timer = m_lifetime; }
|
{
|
||||||
|
m_timer = m_lifetime;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN:
|
case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN:
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,9 @@ bool Totem::Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo const*
|
||||||
Team team = owner->GetTypeId() == TYPEID_PLAYER ? ((Player*)owner)->GetTeam() : TEAM_NONE;
|
Team team = owner->GetTypeId() == TYPEID_PLAYER ? ((Player*)owner)->GetTeam() : TEAM_NONE;
|
||||||
|
|
||||||
if (!CreateFromProto(guidlow, cinfo, team))
|
if (!CreateFromProto(guidlow, cinfo, team))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// special model selection case for totems
|
// special model selection case for totems
|
||||||
if (owner->GetTypeId() == TYPEID_PLAYER)
|
if (owner->GetTypeId() == TYPEID_PLAYER)
|
||||||
|
|
@ -65,7 +67,9 @@ bool Totem::Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo const*
|
||||||
cPos.m_pos.z = owner->GetPositionZ();
|
cPos.m_pos.z = owner->GetPositionZ();
|
||||||
|
|
||||||
if (!cPos.Relocate(this))
|
if (!cPos.Relocate(this))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Notify the map's instance data.
|
// Notify the map's instance data.
|
||||||
// Only works if you create the object in it, not if it is moves to that map.
|
// Only works if you create the object in it, not if it is moves to that map.
|
||||||
|
|
@ -111,7 +115,9 @@ void Totem::Summon(Unit* owner)
|
||||||
|
|
||||||
// there are some totems, which exist just for their visual appeareance
|
// there are some totems, which exist just for their visual appeareance
|
||||||
if (!GetSpell())
|
if (!GetSpell())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (m_type)
|
switch (m_type)
|
||||||
{
|
{
|
||||||
|
|
@ -174,7 +180,9 @@ void Totem::SetOwner(Unit* owner)
|
||||||
Unit* Totem::GetOwner()
|
Unit* Totem::GetOwner()
|
||||||
{
|
{
|
||||||
if (ObjectGuid ownerGuid = GetOwnerGuid())
|
if (ObjectGuid ownerGuid = GetOwnerGuid())
|
||||||
|
{
|
||||||
return ObjectAccessor::GetUnit(*this, ownerGuid);
|
return ObjectAccessor::GetUnit(*this, ownerGuid);
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -199,7 +207,9 @@ bool Totem::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex
|
||||||
// Mana Spring, Healing stream, Mana tide
|
// Mana Spring, Healing stream, Mana tide
|
||||||
// Flags : 0x00000002000 | 0x00000004000 | 0x00004000000 -> 0x00004006000
|
// Flags : 0x00000002000 | 0x00000004000 | 0x00004000000 -> 0x00004006000
|
||||||
if (spellInfo->GetSpellFamilyName() == SPELLFAMILY_SHAMAN && spellInfo->IsFitToFamilyMask(UI64LIT(0x00004006000)))
|
if (spellInfo->GetSpellFamilyName() == SPELLFAMILY_SHAMAN && spellInfo->IsFitToFamilyMask(UI64LIT(0x00004006000)))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(index);
|
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(index);
|
||||||
if (spellEffect)
|
if (spellEffect)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,9 @@ int
|
||||||
TotemAI::Permissible(const Creature* creature)
|
TotemAI::Permissible(const Creature* creature)
|
||||||
{
|
{
|
||||||
if (creature->IsTotem())
|
if (creature->IsTotem())
|
||||||
|
{
|
||||||
return PERMIT_BASE_PROACTIVE;
|
return PERMIT_BASE_PROACTIVE;
|
||||||
|
}
|
||||||
|
|
||||||
return PERMIT_BASE_NO;
|
return PERMIT_BASE_NO;
|
||||||
}
|
}
|
||||||
|
|
@ -59,15 +61,21 @@ void
|
||||||
TotemAI::UpdateAI(const uint32 /*diff*/)
|
TotemAI::UpdateAI(const uint32 /*diff*/)
|
||||||
{
|
{
|
||||||
if (getTotem().GetTotemType() != TOTEM_ACTIVE)
|
if (getTotem().GetTotemType() != TOTEM_ACTIVE)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_creature->IsAlive() || m_creature->IsNonMeleeSpellCasted(false))
|
if (!m_creature->IsAlive() || m_creature->IsNonMeleeSpellCasted(false))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Search spell
|
// Search spell
|
||||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(getTotem().GetSpell());
|
SpellEntry const* spellInfo = sSpellStore.LookupEntry(getTotem().GetSpell());
|
||||||
if (!spellInfo)
|
if (!spellInfo)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Get spell rangy
|
// Get spell rangy
|
||||||
SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex);
|
SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex);
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1385,7 +1385,9 @@ class Unit : public WorldObject
|
||||||
bool CanUseEquippedWeapon(WeaponAttackType attackType) const
|
bool CanUseEquippedWeapon(WeaponAttackType attackType) const
|
||||||
{
|
{
|
||||||
if (IsInFeralForm())
|
if (IsInFeralForm())
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
switch (attackType)
|
switch (attackType)
|
||||||
{
|
{
|
||||||
|
|
@ -1456,10 +1458,14 @@ class Unit : public WorldObject
|
||||||
Unit* getAttackerForHelper() // If someone wants to help, who to give them
|
Unit* getAttackerForHelper() // If someone wants to help, who to give them
|
||||||
{
|
{
|
||||||
if (getVictim() != NULL)
|
if (getVictim() != NULL)
|
||||||
|
{
|
||||||
return getVictim();
|
return getVictim();
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_attackers.empty())
|
if (!m_attackers.empty())
|
||||||
|
{
|
||||||
return *(m_attackers.begin());
|
return *(m_attackers.begin());
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -1900,7 +1906,9 @@ class Unit : public WorldObject
|
||||||
bool IsContestedGuard() const
|
bool IsContestedGuard() const
|
||||||
{
|
{
|
||||||
if (FactionTemplateEntry const* entry = getFactionTemplateEntry())
|
if (FactionTemplateEntry const* entry = getFactionTemplateEntry())
|
||||||
|
{
|
||||||
return entry->IsContestedGuardFaction();
|
return entry->IsContestedGuardFaction();
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -3296,7 +3304,9 @@ class Unit : public WorldObject
|
||||||
{
|
{
|
||||||
VisibleAuraMap::const_iterator itr = m_visibleAuras.find(slot);
|
VisibleAuraMap::const_iterator itr = m_visibleAuras.find(slot);
|
||||||
if (itr != m_visibleAuras.end())
|
if (itr != m_visibleAuras.end())
|
||||||
|
{
|
||||||
return itr->second;
|
return itr->second;
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
void SetVisibleAura(uint8 slot, SpellAuraHolder* holder)
|
void SetVisibleAura(uint8 slot, SpellAuraHolder* holder)
|
||||||
|
|
|
||||||
|
|
@ -189,12 +189,16 @@ void VehicleInfo::Board(Unit* passenger, uint8 seat)
|
||||||
|
|
||||||
// This check is also called in Spell::CheckCast()
|
// This check is also called in Spell::CheckCast()
|
||||||
if (!CanBoard(passenger))
|
if (!CanBoard(passenger))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Use the planned seat only if the seat is valid, possible to choose and empty
|
// Use the planned seat only if the seat is valid, possible to choose and empty
|
||||||
if (!IsSeatAvailableFor(passenger, seat))
|
if (!IsSeatAvailableFor(passenger, seat))
|
||||||
if (!GetUsableSeatFor(passenger, seat))
|
if (!GetUsableSeatFor(passenger, seat))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
VehicleSeatEntry const* seatEntry = GetSeatEntry(seat);
|
VehicleSeatEntry const* seatEntry = GetSeatEntry(seat);
|
||||||
MANGOS_ASSERT(seatEntry);
|
MANGOS_ASSERT(seatEntry);
|
||||||
|
|
@ -259,25 +263,33 @@ void VehicleInfo::SwitchSeat(Unit* passenger, uint8 seat)
|
||||||
|
|
||||||
// Switching seats is not possible
|
// Switching seats is not possible
|
||||||
if (m_vehicleEntry->m_flags & VEHICLE_FLAG_DISABLE_SWITCH)
|
if (m_vehicleEntry->m_flags & VEHICLE_FLAG_DISABLE_SWITCH)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
PassengerMap::const_iterator itr = m_passengers.find(passenger);
|
PassengerMap::const_iterator itr = m_passengers.find(passenger);
|
||||||
MANGOS_ASSERT(itr != m_passengers.end());
|
MANGOS_ASSERT(itr != m_passengers.end());
|
||||||
|
|
||||||
// We are already boarded to this seat
|
// We are already boarded to this seat
|
||||||
if (itr->second->GetTransportSeat() == seat)
|
if (itr->second->GetTransportSeat() == seat)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if it's a valid seat
|
// Check if it's a valid seat
|
||||||
if (!IsSeatAvailableFor(passenger, seat))
|
if (!IsSeatAvailableFor(passenger, seat))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
VehicleSeatEntry const* seatEntry = GetSeatEntry(itr->second->GetTransportSeat());
|
VehicleSeatEntry const* seatEntry = GetSeatEntry(itr->second->GetTransportSeat());
|
||||||
MANGOS_ASSERT(seatEntry);
|
MANGOS_ASSERT(seatEntry);
|
||||||
|
|
||||||
// Switching seats is only allowed if this flag is set
|
// Switching seats is only allowed if this flag is set
|
||||||
if (~seatEntry->m_flags & SEAT_FLAG_CAN_SWITCH)
|
if (~seatEntry->m_flags & SEAT_FLAG_CAN_SWITCH)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Remove passenger modifications of the old seat
|
// Remove passenger modifications of the old seat
|
||||||
RemoveSeatMods(passenger, seatEntry->m_flags);
|
RemoveSeatMods(passenger, seatEntry->m_flags);
|
||||||
|
|
@ -379,31 +391,45 @@ void VehicleInfo::UnBoard(Unit* passenger, bool changeVehicle)
|
||||||
bool VehicleInfo::CanBoard(Unit* passenger) const
|
bool VehicleInfo::CanBoard(Unit* passenger) const
|
||||||
{
|
{
|
||||||
if (!passenger)
|
if (!passenger)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Passenger is this vehicle
|
// Passenger is this vehicle
|
||||||
if (passenger == m_owner)
|
if (passenger == m_owner)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Passenger is already on this vehicle (in this case switching seats is required)
|
// Passenger is already on this vehicle (in this case switching seats is required)
|
||||||
if (passenger->IsBoarded() && passenger->GetTransportInfo()->GetTransport() == m_owner)
|
if (passenger->IsBoarded() && passenger->GetTransportInfo()->GetTransport() == m_owner)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Prevent circular boarding: passenger (could only be vehicle) must not have m_owner on board
|
// Prevent circular boarding: passenger (could only be vehicle) must not have m_owner on board
|
||||||
if (passenger->IsVehicle() && passenger->GetVehicleInfo()->HasOnBoard(m_owner))
|
if (passenger->IsVehicle() && passenger->GetVehicleInfo()->HasOnBoard(m_owner))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if we have at least one empty seat
|
// Check if we have at least one empty seat
|
||||||
if (!GetEmptySeats())
|
if (!GetEmptySeats())
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Passenger is already boarded
|
// Passenger is already boarded
|
||||||
if (m_passengers.find(passenger) != m_passengers.end())
|
if (m_passengers.find(passenger) != m_passengers.end())
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Check for empty player seats
|
// Check for empty player seats
|
||||||
if (passenger->GetTypeId() == TYPEID_PLAYER)
|
if (passenger->GetTypeId() == TYPEID_PLAYER)
|
||||||
|
{
|
||||||
return GetEmptySeatsMask() & m_playerSeats;
|
return GetEmptySeatsMask() & m_playerSeats;
|
||||||
|
}
|
||||||
|
|
||||||
// Check for empty creature seats
|
// Check for empty creature seats
|
||||||
return GetEmptySeatsMask() & m_creatureSeats;
|
return GetEmptySeatsMask() & m_creatureSeats;
|
||||||
|
|
@ -413,7 +439,9 @@ Unit* VehicleInfo::GetPassenger(uint8 seat) const
|
||||||
{
|
{
|
||||||
for (PassengerMap::const_iterator itr = m_passengers.begin(); itr != m_passengers.end(); ++itr)
|
for (PassengerMap::const_iterator itr = m_passengers.begin(); itr != m_passengers.end(); ++itr)
|
||||||
if (itr->second->GetTransportSeat() == seat)
|
if (itr->second->GetTransportSeat() == seat)
|
||||||
|
{
|
||||||
return (Unit*)itr->first;
|
return (Unit*)itr->first;
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -468,14 +496,18 @@ bool VehicleInfo::GetUsableSeatFor(Unit* passenger, uint8& seat) const
|
||||||
|
|
||||||
// No usable seats available
|
// No usable seats available
|
||||||
if (!possibleSeats)
|
if (!possibleSeats)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Start with 0
|
// Start with 0
|
||||||
seat = 0;
|
seat = 0;
|
||||||
|
|
||||||
for (uint8 i = 1; seat < MAX_VEHICLE_SEAT; i <<= 1, ++seat)
|
for (uint8 i = 1; seat < MAX_VEHICLE_SEAT; i <<= 1, ++seat)
|
||||||
if (possibleSeats & i)
|
if (possibleSeats & i)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,9 @@ void OutdoorPvP::BuffTeam(Team team, uint32 spellId, bool remove /*= false*/)
|
||||||
player->RemoveAurasDueToSpell(spellId);
|
player->RemoveAurasDueToSpell(spellId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ player->CastSpell(player, spellId, true); }
|
{
|
||||||
|
player->CastSpell(player, spellId, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -208,6 +210,8 @@ void OutdoorPvP::RespawnGO(const WorldObject* objRef, ObjectGuid goGuid, bool re
|
||||||
go->Refresh();
|
go->Refresh();
|
||||||
}
|
}
|
||||||
else if (go->isSpawned())
|
else if (go->isSpawned())
|
||||||
{ go->SetLootState(GO_JUST_DEACTIVATED); }
|
{
|
||||||
|
go->SetLootState(GO_JUST_DEACTIVATED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -142,11 +142,17 @@ void OutdoorPvPEP::HandleGameObjectCreate(GameObject* go)
|
||||||
InitBanner(go, TOWER_ID_NORTHPASS);
|
InitBanner(go, TOWER_ID_NORTHPASS);
|
||||||
}
|
}
|
||||||
else if (go->IsWithinDist2d(plaguelandsTowerLocations[TOWER_ID_CROWNGUARD][0], plaguelandsTowerLocations[TOWER_ID_CROWNGUARD][1], 50.0f))
|
else if (go->IsWithinDist2d(plaguelandsTowerLocations[TOWER_ID_CROWNGUARD][0], plaguelandsTowerLocations[TOWER_ID_CROWNGUARD][1], 50.0f))
|
||||||
{ InitBanner(go, TOWER_ID_CROWNGUARD); }
|
{
|
||||||
|
InitBanner(go, TOWER_ID_CROWNGUARD);
|
||||||
|
}
|
||||||
else if (go->IsWithinDist2d(plaguelandsTowerLocations[TOWER_ID_EASTWALL][0], plaguelandsTowerLocations[TOWER_ID_EASTWALL][1], 50.0f))
|
else if (go->IsWithinDist2d(plaguelandsTowerLocations[TOWER_ID_EASTWALL][0], plaguelandsTowerLocations[TOWER_ID_EASTWALL][1], 50.0f))
|
||||||
{ InitBanner(go, TOWER_ID_EASTWALL); }
|
{
|
||||||
|
InitBanner(go, TOWER_ID_EASTWALL);
|
||||||
|
}
|
||||||
else if (go->IsWithinDist2d(plaguelandsTowerLocations[TOWER_ID_PLAGUEWOOD][0], plaguelandsTowerLocations[TOWER_ID_PLAGUEWOOD][1], 50.0f))
|
else if (go->IsWithinDist2d(plaguelandsTowerLocations[TOWER_ID_PLAGUEWOOD][0], plaguelandsTowerLocations[TOWER_ID_PLAGUEWOOD][1], 50.0f))
|
||||||
{ InitBanner(go, TOWER_ID_PLAGUEWOOD); }
|
{
|
||||||
|
InitBanner(go, TOWER_ID_PLAGUEWOOD);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case GO_LORDAERON_SHRINE_ALLIANCE:
|
case GO_LORDAERON_SHRINE_ALLIANCE:
|
||||||
m_lordaeronShrineAlliance = go->GetObjectGuid();
|
m_lordaeronShrineAlliance = go->GetObjectGuid();
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,9 @@ void OutdoorPvPGH::HandleCreatureCreate(Creature* creature)
|
||||||
{
|
{
|
||||||
// only handle summoned creatures
|
// only handle summoned creatures
|
||||||
if (!creature->IsTemporarySummon())
|
if (!creature->IsTemporarySummon())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (creature->GetEntry())
|
switch (creature->GetEntry())
|
||||||
{
|
{
|
||||||
|
|
@ -80,7 +82,9 @@ bool OutdoorPvPGH::HandleEvent(uint32 eventId, GameObject* go)
|
||||||
{
|
{
|
||||||
// If we are not using the lighthouse return
|
// If we are not using the lighthouse return
|
||||||
if (go->GetEntry() != GO_VENTURE_BAY_LIGHTHOUSE)
|
if (go->GetEntry() != GO_VENTURE_BAY_LIGHTHOUSE)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool eventHandled = true;
|
bool eventHandled = true;
|
||||||
|
|
||||||
|
|
@ -89,7 +93,9 @@ bool OutdoorPvPGH::HandleEvent(uint32 eventId, GameObject* go)
|
||||||
case EVENT_LIGHTHOUSE_WIN_ALLIANCE:
|
case EVENT_LIGHTHOUSE_WIN_ALLIANCE:
|
||||||
// Ignore the event if the zone is already in alliance control
|
// Ignore the event if the zone is already in alliance control
|
||||||
if (m_zoneOwner == ALLIANCE)
|
if (m_zoneOwner == ALLIANCE)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Spawn the npcs only when the tower is fully controlled. Also allow the event to handle summons in DB.
|
// Spawn the npcs only when the tower is fully controlled. Also allow the event to handle summons in DB.
|
||||||
m_zoneOwner = ALLIANCE;
|
m_zoneOwner = ALLIANCE;
|
||||||
|
|
@ -100,7 +106,9 @@ bool OutdoorPvPGH::HandleEvent(uint32 eventId, GameObject* go)
|
||||||
case EVENT_LIGHTHOUSE_WIN_HORDE:
|
case EVENT_LIGHTHOUSE_WIN_HORDE:
|
||||||
// Ignore the event if the zone is already in horde control
|
// Ignore the event if the zone is already in horde control
|
||||||
if (m_zoneOwner == HORDE)
|
if (m_zoneOwner == HORDE)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Spawn the npcs only when the tower is fully controlled. Also allow the event to handle summons in DB.
|
// Spawn the npcs only when the tower is fully controlled. Also allow the event to handle summons in DB.
|
||||||
m_zoneOwner = HORDE;
|
m_zoneOwner = HORDE;
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,9 @@ void OutdoorPvPNA::HandleCreatureCreate(Creature* creature)
|
||||||
case NPC_ALLIANCE_HANAANI_GUARD:
|
case NPC_ALLIANCE_HANAANI_GUARD:
|
||||||
// prevent updating guard counter on owner take over
|
// prevent updating guard counter on owner take over
|
||||||
if (m_guardsLeft == MAX_NA_GUARDS)
|
if (m_guardsLeft == MAX_NA_GUARDS)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_guardsLeft == 0)
|
if (m_guardsLeft == 0)
|
||||||
{
|
{
|
||||||
|
|
@ -159,7 +161,9 @@ void OutdoorPvPNA::HandleCreatureCreate(Creature* creature)
|
||||||
void OutdoorPvPNA::HandleCreatureDeath(Creature* creature)
|
void OutdoorPvPNA::HandleCreatureDeath(Creature* creature)
|
||||||
{
|
{
|
||||||
if (creature->GetEntry() != NPC_HORDE_HALAANI_GUARD && creature->GetEntry() != NPC_ALLIANCE_HANAANI_GUARD)
|
if (creature->GetEntry() != NPC_HORDE_HALAANI_GUARD && creature->GetEntry() != NPC_ALLIANCE_HANAANI_GUARD)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// get the location of the dead guard for future respawn
|
// get the location of the dead guard for future respawn
|
||||||
float x, y, z, o;
|
float x, y, z, o;
|
||||||
|
|
@ -303,7 +307,9 @@ bool OutdoorPvPNA::HandleEvent(uint32 eventId, GameObject* go)
|
||||||
{
|
{
|
||||||
// If we are not using the Halaa banner return
|
// If we are not using the Halaa banner return
|
||||||
if (go->GetEntry() != GO_HALAA_BANNER)
|
if (go->GetEntry() != GO_HALAA_BANNER)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool eventHandled = true;
|
bool eventHandled = true;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -307,11 +307,15 @@ bool OutdoorPvPZM::HandleGameObjectUse(Player* player, GameObject* go)
|
||||||
break;
|
break;
|
||||||
case GO_ZANGA_BANNER_CENTER_ALLIANCE:
|
case GO_ZANGA_BANNER_CENTER_ALLIANCE:
|
||||||
if (team == ALLIANCE || !player->HasAura(SPELL_BATTLE_STANDARD_HORDE))
|
if (team == ALLIANCE || !player->HasAura(SPELL_BATTLE_STANDARD_HORDE))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case GO_ZANGA_BANNER_CENTER_HORDE:
|
case GO_ZANGA_BANNER_CENTER_HORDE:
|
||||||
if (team == HORDE || !player->HasAura(SPELL_BATTLE_STANDARD_ALLIANCE))
|
if (team == HORDE || !player->HasAura(SPELL_BATTLE_STANDARD_ALLIANCE))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,9 @@ void HostileReference::updateOnlineStatus()
|
||||||
{ online = true; } // not accessable but stays online
|
{ online = true; } // not accessable but stays online
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ accessible = true; }
|
{
|
||||||
|
accessible = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setAccessibleState(accessible);
|
setAccessibleState(accessible);
|
||||||
setOnlineOfflineState(online);
|
setOnlineOfflineState(online);
|
||||||
|
|
@ -283,7 +285,9 @@ void ThreatContainer::modifyThreatPercent(Unit* pVictim, int32 pPercent)
|
||||||
delete ref;
|
delete ref;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ ref->addThreatPercent(pPercent); }
|
{
|
||||||
|
ref->addThreatPercent(pPercent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -527,7 +531,9 @@ Unit* ThreatManager::getHostileTarget()
|
||||||
float ThreatManager::getThreat(Unit* pVictim, bool pAlsoSearchOfflineList)
|
float ThreatManager::getThreat(Unit* pVictim, bool pAlsoSearchOfflineList)
|
||||||
{
|
{
|
||||||
if (!pVictim)
|
if (!pVictim)
|
||||||
|
{
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
float threat = 0.0f;
|
float threat = 0.0f;
|
||||||
|
|
||||||
|
|
@ -574,7 +580,9 @@ void ThreatManager::setCurrentVictim(HostileReference* pHostileReference)
|
||||||
{
|
{
|
||||||
// including NULL==NULL case
|
// including NULL==NULL case
|
||||||
if (pHostileReference == iCurrentVictim)
|
if (pHostileReference == iCurrentVictim)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (pHostileReference)
|
if (pHostileReference)
|
||||||
iOwner->SendHighestThreatUpdate(pHostileReference);
|
iOwner->SendHighestThreatUpdate(pHostileReference);
|
||||||
|
|
@ -637,7 +645,9 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat
|
||||||
iUpdateNeed = true;
|
iUpdateNeed = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ iThreatOfflineContainer.remove(hostileReference); }
|
{
|
||||||
|
iThreatOfflineContainer.remove(hostileReference);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -645,7 +655,9 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat
|
||||||
void ThreatManager::UpdateForClient(uint32 diff)
|
void ThreatManager::UpdateForClient(uint32 diff)
|
||||||
{
|
{
|
||||||
if (!iUpdateNeed || isThreatListEmpty())
|
if (!iUpdateNeed || isThreatListEmpty())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
iUpdateTimer.Update(diff);
|
iUpdateTimer.Update(diff);
|
||||||
if (iUpdateTimer.Passed())
|
if (iUpdateTimer.Passed())
|
||||||
|
|
|
||||||
|
|
@ -290,7 +290,9 @@ static bool ReadDBCBuildFileText(const std::string& dbc_path, char const* locale
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int ReadDBCLocale(const std::string sDataPath)
|
int ReadDBCLocale(const std::string sDataPath)
|
||||||
|
|
@ -329,19 +331,25 @@ static uint32 ReadDBCBuild(const std::string& dbc_path, LocaleNameStr const*&loc
|
||||||
ReadDBCBuildFileText(dbc_path, localeNameStr->name, text);
|
ReadDBCBuildFileText(dbc_path, localeNameStr->name, text);
|
||||||
|
|
||||||
if (text.empty())
|
if (text.empty())
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
size_t pos = text.find("version=\"");
|
size_t pos = text.find("version=\"");
|
||||||
size_t pos1 = pos + strlen("version=\"");
|
size_t pos1 = pos + strlen("version=\"");
|
||||||
size_t pos2 = text.find("\"", pos1);
|
size_t pos2 = text.find("\"", pos1);
|
||||||
if (pos == text.npos || pos2 == text.npos || pos1 >= pos2)
|
if (pos == text.npos || pos2 == text.npos || pos1 >= pos2)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
std::string build_str = text.substr(pos1, pos2 - pos1);
|
std::string build_str = text.substr(pos1, pos2 - pos1);
|
||||||
|
|
||||||
int build = atoi(build_str.c_str());
|
int build = atoi(build_str.c_str());
|
||||||
if (build <= 0)
|
if (build <= 0)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return build;
|
return build;
|
||||||
}
|
}
|
||||||
|
|
@ -906,17 +914,23 @@ SimpleFactionsList const* GetFactionTeamList(uint32 faction)
|
||||||
{
|
{
|
||||||
FactionTeamMap::const_iterator itr = sFactionTeamMap.find(faction);
|
FactionTeamMap::const_iterator itr = sFactionTeamMap.find(faction);
|
||||||
if (itr == sFactionTeamMap.end())
|
if (itr == sFactionTeamMap.end())
|
||||||
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
char const* GetPetName(uint32 petfamily, uint32 dbclang)
|
char const* GetPetName(uint32 petfamily, uint32 dbclang)
|
||||||
{
|
{
|
||||||
if (!petfamily)
|
if (!petfamily)
|
||||||
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
CreatureFamilyEntry const* pet_family = sCreatureFamilyStore.LookupEntry(petfamily);
|
CreatureFamilyEntry const* pet_family = sCreatureFamilyStore.LookupEntry(petfamily);
|
||||||
if (!pet_family)
|
if (!pet_family)
|
||||||
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
return pet_family->Name[dbclang] ? pet_family->Name[dbclang] : NULL;
|
return pet_family->Name[dbclang] ? pet_family->Name[dbclang] : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -924,7 +938,9 @@ TalentSpellPos const* GetTalentSpellPos(uint32 spellId)
|
||||||
{
|
{
|
||||||
TalentSpellPosMap::const_iterator itr = sTalentSpellPosMap.find(spellId);
|
TalentSpellPosMap::const_iterator itr = sTalentSpellPosMap.find(spellId);
|
||||||
if (itr == sTalentSpellPosMap.end())
|
if (itr == sTalentSpellPosMap.end())
|
||||||
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
}
|
}
|
||||||
|
|
@ -933,7 +949,9 @@ SpellEffectEntry const* GetSpellEffectEntry(uint32 spellId, SpellEffectIndex eff
|
||||||
{
|
{
|
||||||
SpellEffectMap::const_iterator itr = sSpellEffectMap.find(spellId);
|
SpellEffectMap::const_iterator itr = sSpellEffectMap.find(spellId);
|
||||||
if(itr == sSpellEffectMap.end())
|
if(itr == sSpellEffectMap.end())
|
||||||
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return itr->second.effects[effect];
|
return itr->second.effects[effect];
|
||||||
}
|
}
|
||||||
|
|
@ -941,7 +959,9 @@ SpellEffectEntry const* GetSpellEffectEntry(uint32 spellId, SpellEffectIndex eff
|
||||||
uint32 GetTalentSpellCost(TalentSpellPos const* pos)
|
uint32 GetTalentSpellCost(TalentSpellPos const* pos)
|
||||||
{
|
{
|
||||||
if (pos)
|
if (pos)
|
||||||
|
{
|
||||||
return pos->rank + 1;
|
return pos->rank + 1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -955,7 +975,9 @@ int32 GetAreaFlagByAreaID(uint32 area_id)
|
||||||
{
|
{
|
||||||
AreaFlagByAreaID::iterator i = sAreaFlagByAreaID.find(area_id);
|
AreaFlagByAreaID::iterator i = sAreaFlagByAreaID.find(area_id);
|
||||||
if (i == sAreaFlagByAreaID.end())
|
if (i == sAreaFlagByAreaID.end())
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return i->second;
|
return i->second;
|
||||||
}
|
}
|
||||||
|
|
@ -964,7 +986,9 @@ WMOAreaTableEntry const* GetWMOAreaTableEntryByTripple(int32 rootid, int32 adtid
|
||||||
{
|
{
|
||||||
WMOAreaInfoByTripple::iterator i = sWMOAreaInfoByTripple.find(WMOAreaTableTripple(rootid, adtid, groupid));
|
WMOAreaInfoByTripple::iterator i = sWMOAreaInfoByTripple.find(WMOAreaTableTripple(rootid, adtid, groupid));
|
||||||
if (i == sWMOAreaInfoByTripple.end())
|
if (i == sWMOAreaInfoByTripple.end())
|
||||||
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
return i->second;
|
return i->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -972,7 +996,9 @@ AreaTableEntry const* GetAreaEntryByAreaID(uint32 area_id)
|
||||||
{
|
{
|
||||||
int32 areaflag = GetAreaFlagByAreaID(area_id);
|
int32 areaflag = GetAreaFlagByAreaID(area_id);
|
||||||
if (areaflag < 0)
|
if (areaflag < 0)
|
||||||
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return sAreaStore.LookupEntry(areaflag);
|
return sAreaStore.LookupEntry(areaflag);
|
||||||
}
|
}
|
||||||
|
|
@ -980,10 +1006,14 @@ AreaTableEntry const* GetAreaEntryByAreaID(uint32 area_id)
|
||||||
AreaTableEntry const* GetAreaEntryByAreaFlagAndMap(uint32 area_flag, uint32 map_id)
|
AreaTableEntry const* GetAreaEntryByAreaFlagAndMap(uint32 area_flag, uint32 map_id)
|
||||||
{
|
{
|
||||||
if (area_flag)
|
if (area_flag)
|
||||||
|
{
|
||||||
return sAreaStore.LookupEntry(area_flag);
|
return sAreaStore.LookupEntry(area_flag);
|
||||||
|
}
|
||||||
|
|
||||||
if (MapEntry const* mapEntry = sMapStore.LookupEntry(map_id))
|
if (MapEntry const* mapEntry = sMapStore.LookupEntry(map_id))
|
||||||
|
{
|
||||||
return GetAreaEntryByAreaID(mapEntry->linked_zone);
|
return GetAreaEntryByAreaID(mapEntry->linked_zone);
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -992,18 +1022,26 @@ uint32 GetAreaFlagByMapId(uint32 mapid)
|
||||||
{
|
{
|
||||||
AreaFlagByMapID::iterator i = sAreaFlagByMapID.find(mapid);
|
AreaFlagByMapID::iterator i = sAreaFlagByMapID.find(mapid);
|
||||||
if (i == sAreaFlagByMapID.end())
|
if (i == sAreaFlagByMapID.end())
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return i->second;
|
return i->second;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId)
|
uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId)
|
||||||
{
|
{
|
||||||
if (mapid != 530 && mapid != 571 && mapid != 732) // speed for most cases
|
if (mapid != 530 && mapid != 571 && mapid != 732) // speed for most cases
|
||||||
|
{
|
||||||
return mapid;
|
return mapid;
|
||||||
|
}
|
||||||
|
|
||||||
if (WorldMapAreaEntry const* wma = sWorldMapAreaStore.LookupEntry(zoneId))
|
if (WorldMapAreaEntry const* wma = sWorldMapAreaStore.LookupEntry(zoneId))
|
||||||
|
{
|
||||||
return wma->virtual_map_id >= 0 ? wma->virtual_map_id : wma->map_id;
|
return wma->virtual_map_id >= 0 ? wma->virtual_map_id : wma->map_id;
|
||||||
|
}
|
||||||
|
|
||||||
return mapid;
|
return mapid;
|
||||||
}
|
}
|
||||||
|
|
@ -1012,11 +1050,15 @@ ContentLevels GetContentLevelsForMap(uint32 mapid)
|
||||||
{
|
{
|
||||||
MapEntry const* mapEntry = sMapStore.LookupEntry(mapid);
|
MapEntry const* mapEntry = sMapStore.LookupEntry(mapid);
|
||||||
if (!mapEntry)
|
if (!mapEntry)
|
||||||
|
{
|
||||||
return CONTENT_1_60;
|
return CONTENT_1_60;
|
||||||
|
}
|
||||||
|
|
||||||
// exceptions for 648 - Goblin Starter area and 654 - Worgen Starter area
|
// exceptions for 648 - Goblin Starter area and 654 - Worgen Starter area
|
||||||
if (mapid == 648 || mapid == 654)
|
if (mapid == 648 || mapid == 654)
|
||||||
|
{
|
||||||
return CONTENT_1_60;
|
return CONTENT_1_60;
|
||||||
|
}
|
||||||
|
|
||||||
switch (mapEntry->Expansion())
|
switch (mapEntry->Expansion())
|
||||||
{
|
{
|
||||||
|
|
@ -1034,7 +1076,9 @@ ChatChannelsEntry const* GetChannelEntryFor(uint32 channel_id)
|
||||||
{
|
{
|
||||||
ChatChannelsEntry const* ch = sChatChannelsStore.LookupEntry(i);
|
ChatChannelsEntry const* ch = sChatChannelsStore.LookupEntry(i);
|
||||||
if (ch && ch->ChannelID == channel_id)
|
if (ch && ch->ChannelID == channel_id)
|
||||||
|
{
|
||||||
return ch;
|
return ch;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -1042,19 +1086,29 @@ ChatChannelsEntry const* GetChannelEntryFor(uint32 channel_id)
|
||||||
bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId)
|
bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId)
|
||||||
{
|
{
|
||||||
if (requiredTotemCategoryId == 0)
|
if (requiredTotemCategoryId == 0)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
if (itemTotemCategoryId == 0)
|
if (itemTotemCategoryId == 0)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
TotemCategoryEntry const* itemEntry = sTotemCategoryStore.LookupEntry(itemTotemCategoryId);
|
TotemCategoryEntry const* itemEntry = sTotemCategoryStore.LookupEntry(itemTotemCategoryId);
|
||||||
if (!itemEntry)
|
if (!itemEntry)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
TotemCategoryEntry const* reqEntry = sTotemCategoryStore.LookupEntry(requiredTotemCategoryId);
|
TotemCategoryEntry const* reqEntry = sTotemCategoryStore.LookupEntry(requiredTotemCategoryId);
|
||||||
if (!reqEntry)
|
if (!reqEntry)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (itemEntry->categoryType != reqEntry->categoryType)
|
if (itemEntry->categoryType != reqEntry->categoryType)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return (itemEntry->categoryMask & reqEntry->categoryMask) == reqEntry->categoryMask;
|
return (itemEntry->categoryMask & reqEntry->categoryMask) == reqEntry->categoryMask;
|
||||||
}
|
}
|
||||||
|
|
@ -1065,7 +1119,9 @@ bool Zone2MapCoordinates(float& x, float& y, uint32 zone)
|
||||||
|
|
||||||
// if not listed then map coordinates (instance)
|
// if not listed then map coordinates (instance)
|
||||||
if (!maEntry || maEntry->x2 == maEntry->x1 || maEntry->y2 == maEntry->y1)
|
if (!maEntry || maEntry->x2 == maEntry->x1 || maEntry->y2 == maEntry->y1)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
std::swap(x, y); // at client map coords swapped
|
std::swap(x, y); // at client map coords swapped
|
||||||
x = x * ((maEntry->x2 - maEntry->x1) / 100) + maEntry->x1;
|
x = x * ((maEntry->x2 - maEntry->x1) / 100) + maEntry->x1;
|
||||||
|
|
@ -1080,7 +1136,9 @@ bool Map2ZoneCoordinates(float& x, float& y, uint32 zone)
|
||||||
|
|
||||||
// if not listed then map coordinates (instance)
|
// if not listed then map coordinates (instance)
|
||||||
if (!maEntry || maEntry->x2 == maEntry->x1 || maEntry->y2 == maEntry->y1)
|
if (!maEntry || maEntry->x2 == maEntry->x1 || maEntry->y2 == maEntry->y1)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
x = (x - maEntry->x1) / ((maEntry->x2 - maEntry->x1) / 100);
|
x = (x - maEntry->x1) / ((maEntry->x2 - maEntry->x1) / 100);
|
||||||
y = (y - maEntry->y1) / ((maEntry->y2 - maEntry->y1) / 100); // client y coord from top to down
|
y = (y - maEntry->y1) / ((maEntry->y2 - maEntry->y1) / 100); // client y coord from top to down
|
||||||
|
|
@ -1093,7 +1151,9 @@ ContentLevels GetContentLevelsForMapAndZone(uint32 mapId, uint32 zoneId)
|
||||||
{
|
{
|
||||||
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
|
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
|
||||||
if (!mapEntry)
|
if (!mapEntry)
|
||||||
|
{
|
||||||
return CONTENT_1_60;
|
return CONTENT_1_60;
|
||||||
|
}
|
||||||
|
|
||||||
if (mapEntry->rootPhaseMap != -1)
|
if (mapEntry->rootPhaseMap != -1)
|
||||||
mapId = mapEntry->rootPhaseMap;
|
mapId = mapEntry->rootPhaseMap;
|
||||||
|
|
@ -1146,7 +1206,9 @@ PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 lev
|
||||||
|
|
||||||
// exactly fit
|
// exactly fit
|
||||||
if (entry->maxLevel >= level)
|
if (entry->maxLevel >= level)
|
||||||
|
{
|
||||||
return entry;
|
return entry;
|
||||||
|
}
|
||||||
|
|
||||||
// remember for possible out-of-range case (search higher from existed)
|
// remember for possible out-of-range case (search higher from existed)
|
||||||
if (!maxEntry || maxEntry->maxLevel < entry->maxLevel)
|
if (!maxEntry || maxEntry->maxLevel < entry->maxLevel)
|
||||||
|
|
@ -1162,7 +1224,9 @@ PvPDifficultyEntry const* GetBattlegroundBracketById(uint32 mapid, BattleGroundB
|
||||||
for (uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i)
|
for (uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i)
|
||||||
if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i))
|
if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i))
|
||||||
if (entry->mapId == mapid && entry->GetBracketId() == id)
|
if (entry->mapId == mapid && entry->GetBracketId() == id)
|
||||||
|
{
|
||||||
return entry;
|
return entry;
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -1176,7 +1240,9 @@ std::vector<uint32> const* GetTalentTreeMasterySpells(uint32 talentTree)
|
||||||
{
|
{
|
||||||
TalentTreeSpellsMap::const_iterator itr = sTalentTreeMasterySpellsMap.find(talentTree);
|
TalentTreeSpellsMap::const_iterator itr = sTalentTreeMasterySpellsMap.find(talentTree);
|
||||||
if (itr == sTalentTreeMasterySpellsMap.end())
|
if (itr == sTalentTreeMasterySpellsMap.end())
|
||||||
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
}
|
}
|
||||||
|
|
@ -1185,7 +1251,9 @@ std::vector<uint32> const* GetTalentTreePrimarySpells(uint32 talentTree)
|
||||||
{
|
{
|
||||||
TalentTreeSpellsMap::const_iterator itr = sTalentTreePrimarySpellsMap.find(talentTree);
|
TalentTreeSpellsMap::const_iterator itr = sTalentTreePrimarySpellsMap.find(talentTree);
|
||||||
if (itr == sTalentTreePrimarySpellsMap.end())
|
if (itr == sTalentTreePrimarySpellsMap.end())
|
||||||
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
}
|
}
|
||||||
|
|
@ -1194,7 +1262,9 @@ uint32 GetTalentTreeRolesMask(uint32 talentTree)
|
||||||
{
|
{
|
||||||
TalentTreeRolesMap::const_iterator itr = sTalentTreeRolesMap.find(talentTree);
|
TalentTreeRolesMap::const_iterator itr = sTalentTreeRolesMap.find(talentTree);
|
||||||
if (itr == sTalentTreeRolesMap.end())
|
if (itr == sTalentTreeRolesMap.end())
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return itr->second;
|
return itr->second;
|
||||||
}
|
}
|
||||||
|
|
@ -1202,14 +1272,18 @@ uint32 GetTalentTreeRolesMask(uint32 talentTree)
|
||||||
bool IsPointInAreaTriggerZone(AreaTriggerEntry const* atEntry, uint32 mapid, float x, float y, float z, float delta)
|
bool IsPointInAreaTriggerZone(AreaTriggerEntry const* atEntry, uint32 mapid, float x, float y, float z, float delta)
|
||||||
{
|
{
|
||||||
if (mapid != atEntry->mapid)
|
if (mapid != atEntry->mapid)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (atEntry->radius > 0)
|
if (atEntry->radius > 0)
|
||||||
{
|
{
|
||||||
// if we have radius check it
|
// if we have radius check it
|
||||||
float dist2 = (x - atEntry->x) * (x - atEntry->x) + (y - atEntry->y) * (y - atEntry->y) + (z - atEntry->z) * (z - atEntry->z);
|
float dist2 = (x - atEntry->x) * (x - atEntry->x) + (y - atEntry->y) * (y - atEntry->y) + (z - atEntry->z) * (z - atEntry->z);
|
||||||
if (dist2 > (atEntry->radius + delta) * (atEntry->radius + delta))
|
if (dist2 > (atEntry->radius + delta) * (atEntry->radius + delta))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -1248,7 +1322,9 @@ uint32 GetCreatureModelRace(uint32 model_id)
|
||||||
{
|
{
|
||||||
CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(model_id);
|
CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(model_id);
|
||||||
if (!displayEntry)
|
if (!displayEntry)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
CreatureDisplayInfoExtraEntry const* extraEntry = sCreatureDisplayInfoExtraStore.LookupEntry(displayEntry->ExtendedDisplayInfoID);
|
CreatureDisplayInfoExtraEntry const* extraEntry = sCreatureDisplayInfoExtraStore.LookupEntry(displayEntry->ExtendedDisplayInfoID);
|
||||||
return extraEntry ? extraEntry->Race : 0;
|
return extraEntry ? extraEntry->Race : 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -518,7 +518,9 @@ struct AchievementCriteriaEntry
|
||||||
bool IsExplicitlyStartedTimedCriteria() const
|
bool IsExplicitlyStartedTimedCriteria() const
|
||||||
{
|
{
|
||||||
if (!timeLimit)
|
if (!timeLimit)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// in case raw.value == timedCriteriaMiscId in timedCriteriaMiscId stored spellid/itemids for cast/use, so repeating aura start at first cast/use until fails
|
// in case raw.value == timedCriteriaMiscId in timedCriteriaMiscId stored spellid/itemids for cast/use, so repeating aura start at first cast/use until fails
|
||||||
return requiredType == ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST || raw.value != timedCriteriaMiscId;
|
return requiredType == ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST || raw.value != timedCriteriaMiscId;
|
||||||
|
|
@ -984,10 +986,14 @@ struct FactionTemplateEntry
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 4; ++i)
|
for (int i = 0; i < 4; ++i)
|
||||||
if (enemyFaction[i] == entry.faction)
|
if (enemyFaction[i] == entry.faction)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
for (int i = 0; i < 4; ++i)
|
for (int i = 0; i < 4; ++i)
|
||||||
if (friendFaction[i] == entry.faction)
|
if (friendFaction[i] == entry.faction)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return (friendlyMask & entry.ourMask) || (ourMask & entry.friendlyMask);
|
return (friendlyMask & entry.ourMask) || (ourMask & entry.friendlyMask);
|
||||||
}
|
}
|
||||||
|
|
@ -997,10 +1003,14 @@ struct FactionTemplateEntry
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 4; ++i)
|
for (int i = 0; i < 4; ++i)
|
||||||
if (enemyFaction[i] == entry.faction)
|
if (enemyFaction[i] == entry.faction)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
for (int i = 0; i < 4; ++i)
|
for (int i = 0; i < 4; ++i)
|
||||||
if (friendFaction[i] == entry.faction)
|
if (friendFaction[i] == entry.faction)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return (hostileMask & entry.ourMask) != 0;
|
return (hostileMask & entry.ourMask) != 0;
|
||||||
}
|
}
|
||||||
|
|
@ -1009,7 +1019,9 @@ struct FactionTemplateEntry
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 4; ++i)
|
for (int i = 0; i < 4; ++i)
|
||||||
if (enemyFaction[i] != 0)
|
if (enemyFaction[i] != 0)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return hostileMask == 0 && friendlyMask == 0;
|
return hostileMask == 0 && friendlyMask == 0;
|
||||||
}
|
}
|
||||||
bool IsContestedGuardFaction() const { return (factionFlags & FACTION_TEMPLATE_FLAG_CONTESTED_GUARD) != 0; }
|
bool IsContestedGuardFaction() const { return (factionFlags & FACTION_TEMPLATE_FLAG_CONTESTED_GUARD) != 0; }
|
||||||
|
|
@ -1622,7 +1634,9 @@ struct ScalingStatValuesEntry
|
||||||
uint32 getSpellBonus(uint32 mask) const
|
uint32 getSpellBonus(uint32 mask) const
|
||||||
{
|
{
|
||||||
if (mask & 0x00008000)
|
if (mask & 0x00008000)
|
||||||
|
{
|
||||||
return spellBonus;
|
return spellBonus;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -1879,7 +1893,9 @@ struct SpellEffectEntry
|
||||||
uint32 GetRadiusIndex() const
|
uint32 GetRadiusIndex() const
|
||||||
{
|
{
|
||||||
if (EffectRadiusIndex != 0)
|
if (EffectRadiusIndex != 0)
|
||||||
|
{
|
||||||
return EffectRadiusIndex;
|
return EffectRadiusIndex;
|
||||||
|
}
|
||||||
|
|
||||||
return EffectRadiusMaxIndex;
|
return EffectRadiusMaxIndex;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -282,7 +282,9 @@ bool WorldSession::Update(PacketFilter& updater)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (_player->IsInWorld())
|
else if (_player->IsInWorld())
|
||||||
{ ExecuteOpcode(opHandle, packet); }
|
{
|
||||||
|
ExecuteOpcode(opHandle, packet);
|
||||||
|
}
|
||||||
|
|
||||||
// lag can cause STATUS_LOGGEDIN opcodes to arrive after the player started a transfer
|
// lag can cause STATUS_LOGGEDIN opcodes to arrive after the player started a transfer
|
||||||
|
|
||||||
|
|
@ -306,9 +308,13 @@ bool WorldSession::Update(PacketFilter& updater)
|
||||||
LogUnexpectedOpcode(packet, "the player has not logged in yet");
|
LogUnexpectedOpcode(packet, "the player has not logged in yet");
|
||||||
}
|
}
|
||||||
else if (_player->IsInWorld())
|
else if (_player->IsInWorld())
|
||||||
{ LogUnexpectedOpcode(packet, "the player is still in world"); }
|
{
|
||||||
|
LogUnexpectedOpcode(packet, "the player is still in world");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ ExecuteOpcode(opHandle, packet); }
|
{
|
||||||
|
ExecuteOpcode(opHandle, packet);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case STATUS_AUTHED:
|
case STATUS_AUTHED:
|
||||||
// prevent cheating with skip queue wait
|
// prevent cheating with skip queue wait
|
||||||
|
|
@ -471,7 +477,9 @@ void WorldSession::LogoutPlayer(bool Save)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((*itr)->GetTypeId() == TYPEID_PLAYER)
|
else if ((*itr)->GetTypeId() == TYPEID_PLAYER)
|
||||||
{ aset.insert((Player*)(*itr)); }
|
{
|
||||||
|
aset.insert((Player*)(*itr));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_player->SetPvPDeath(!aset.empty());
|
_player->SetPvPDeath(!aset.empty());
|
||||||
|
|
@ -758,7 +766,9 @@ void WorldSession::SendSetPhaseShift(uint32 phaseMask, uint16 mapId)
|
||||||
void WorldSession::SendSetPhaseShift(std::set<uint32> const& phaseIds, std::set<uint32> const& terrainswaps)
|
void WorldSession::SendSetPhaseShift(std::set<uint32> const& phaseIds, std::set<uint32> const& terrainswaps)
|
||||||
{
|
{
|
||||||
if (PlayerLoading())
|
if (PlayerLoading())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ObjectGuid guid = _player->GetObjectGuid();
|
ObjectGuid guid = _player->GetObjectGuid();
|
||||||
|
|
||||||
|
|
@ -863,7 +873,9 @@ void WorldSession::LoadAccountData(QueryResult* result, uint32 mask)
|
||||||
m_accountData[i] = AccountData();
|
m_accountData[i] = AccountData();
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
@ -915,7 +927,9 @@ void WorldSession::SetAccountData(AccountDataType type, time_t time_, const std:
|
||||||
{
|
{
|
||||||
// _player can be NULL and packet received after logout but m_GUID still store correct guid
|
// _player can be NULL and packet received after logout but m_GUID still store correct guid
|
||||||
if (!m_GUIDLow)
|
if (!m_GUIDLow)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
static SqlStatementID delId;
|
static SqlStatementID delId;
|
||||||
static SqlStatementID insId;
|
static SqlStatementID insId;
|
||||||
|
|
@ -1038,12 +1052,16 @@ void WorldSession::SaveTutorialsData()
|
||||||
void WorldSession::ReadAddonsInfo(ByteBuffer &data)
|
void WorldSession::ReadAddonsInfo(ByteBuffer &data)
|
||||||
{
|
{
|
||||||
if (data.rpos() + 4 > data.size())
|
if (data.rpos() + 4 > data.size())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
uint32 size;
|
uint32 size;
|
||||||
data >> size;
|
data >> size;
|
||||||
|
|
||||||
if (!size)
|
if (!size)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (size > 0xFFFFF)
|
if (size > 0xFFFFF)
|
||||||
{
|
{
|
||||||
|
|
@ -1071,7 +1089,9 @@ void WorldSession::ReadAddonsInfo(ByteBuffer &data)
|
||||||
|
|
||||||
// check next addon data format correctness
|
// check next addon data format correctness
|
||||||
if (addonInfo.rpos() + 1 > addonInfo.size())
|
if (addonInfo.rpos() + 1 > addonInfo.size())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
addonInfo >> addonName;
|
addonInfo >> addonName;
|
||||||
|
|
||||||
|
|
@ -1182,7 +1202,9 @@ void WorldSession::ExecuteOpcode(OpcodeHandler const& opHandle, WorldPacket* pac
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
if (!sEluna->OnPacketReceive(this, *packet))
|
if (!sEluna->OnPacketReceive(this, *packet))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
#endif /* ENABLE_ELUNA */
|
#endif /* ENABLE_ELUNA */
|
||||||
|
|
||||||
// need prevent do internal far teleports in handlers because some handlers do lot steps
|
// need prevent do internal far teleports in handlers because some handlers do lot steps
|
||||||
|
|
|
||||||
|
|
@ -272,7 +272,9 @@ int WorldSocket::open(void* a)
|
||||||
data << ServerToClient;
|
data << ServerToClient;
|
||||||
|
|
||||||
if (SendPacket(data) == -1)
|
if (SendPacket(data) == -1)
|
||||||
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// Send startup packet.
|
// Send startup packet.
|
||||||
WorldPacket packet (SMSG_AUTH_CHALLENGE, 37);
|
WorldPacket packet (SMSG_AUTH_CHALLENGE, 37);
|
||||||
|
|
@ -368,7 +370,9 @@ int WorldSocket::handle_output(ACE_HANDLE)
|
||||||
const size_t send_len = m_OutBuffer->length();
|
const size_t send_len = m_OutBuffer->length();
|
||||||
|
|
||||||
if (send_len == 0)
|
if (send_len == 0)
|
||||||
|
{
|
||||||
return handle_output_queue(Guard);
|
return handle_output_queue(Guard);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef MSG_NOSIGNAL
|
#ifdef MSG_NOSIGNAL
|
||||||
ssize_t n = peer().send(m_OutBuffer->rd_ptr(), send_len, MSG_NOSIGNAL);
|
ssize_t n = peer().send(m_OutBuffer->rd_ptr(), send_len, MSG_NOSIGNAL);
|
||||||
|
|
@ -411,7 +415,9 @@ int WorldSocket::handle_output(ACE_HANDLE)
|
||||||
int WorldSocket::handle_output_queue(GuardType& g)
|
int WorldSocket::handle_output_queue(GuardType& g)
|
||||||
{
|
{
|
||||||
if (msg_queue()->is_empty())
|
if (msg_queue()->is_empty())
|
||||||
|
{
|
||||||
return cancel_wakeup_output(g);
|
return cancel_wakeup_output(g);
|
||||||
|
}
|
||||||
|
|
||||||
ACE_Message_Block* mblk;
|
ACE_Message_Block* mblk;
|
||||||
|
|
||||||
|
|
@ -746,7 +752,9 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct)
|
||||||
|
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
if (!sEluna->OnPacketReceive(m_Session, *new_pct))
|
if (!sEluna->OnPacketReceive(m_Session, *new_pct))
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
#endif /* ENABLE_ELUNA */
|
#endif /* ENABLE_ELUNA */
|
||||||
return HandleAuthSession(*new_pct);
|
return HandleAuthSession(*new_pct);
|
||||||
case CMSG_KEEP_ALIVE:
|
case CMSG_KEEP_ALIVE:
|
||||||
|
|
@ -795,7 +803,9 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return 0; }
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ACE_NOTREACHED(return 0);
|
ACE_NOTREACHED(return 0);
|
||||||
|
|
@ -1101,7 +1111,9 @@ int WorldSocket::HandlePing(WorldPacket& recvPacket)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ m_OverSpeedPings = 0; }
|
{
|
||||||
|
m_OverSpeedPings = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// critical section
|
// critical section
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,9 @@ int WorldSocketMgr::svc()
|
||||||
sockets_->erase(t);
|
sockets_->erase(t);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ ++i; }
|
{
|
||||||
|
++i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -127,7 +129,9 @@ int WorldSocketMgr::StartNetwork(ACE_INET_Addr& addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (activate(THR_NEW_LWP | THR_JOINABLE, num_threads) == -1)
|
if (activate(THR_NEW_LWP | THR_JOINABLE, num_threads) == -1)
|
||||||
return -1;
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
sLog.outString("Max allowed socket connections: %d", ACE::max_handles());
|
sLog.outString("Max allowed socket connections: %d", ACE::max_handles());
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,9 @@ void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ ss << ","; }
|
{
|
||||||
|
ss << ",";
|
||||||
|
}
|
||||||
ss << id;
|
ss << id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -140,7 +142,9 @@ bool CharacterDatabaseCleaner::TalentCheck(uint32 talent_id)
|
||||||
{
|
{
|
||||||
TalentEntry const* talentInfo = sTalentStore.LookupEntry(talent_id);
|
TalentEntry const* talentInfo = sTalentStore.LookupEntry(talent_id);
|
||||||
if (!talentInfo)
|
if (!talentInfo)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return sTalentTabStore.LookupEntry(talentInfo->TalentTab);
|
return sTalentTabStore.LookupEntry(talentInfo->TalentTab);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,9 @@ bool changenth(std::string& str, int n, const char* with, bool insert = false, b
|
||||||
str.replace(s, e - s, with);
|
str.replace(s, e - s, with);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ str.insert(s, with); }
|
{
|
||||||
|
str.insert(s, with);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -191,7 +193,9 @@ bool changetoknth(std::string& str, int n, const char* with, bool insert = false
|
||||||
str.replace(s, e - s, with);
|
str.replace(s, e - s, with);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ str.insert(s, with); }
|
{
|
||||||
|
str.insert(s, with);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -359,7 +363,9 @@ void PlayerDumpWriter::DumpTableContent(std::string& dump, uint32 guid, char con
|
||||||
wherestr = GenerateWhereStr(fieldname, *guids, guids_itr);
|
wherestr = GenerateWhereStr(fieldname, *guids, guids_itr);
|
||||||
}
|
}
|
||||||
else // not set case, get single guid string
|
else // not set case, get single guid string
|
||||||
{ wherestr = GenerateWhereStr(fieldname, guid); }
|
{
|
||||||
|
wherestr = GenerateWhereStr(fieldname, guid);
|
||||||
|
}
|
||||||
|
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT * FROM %s WHERE %s", tableFrom, wherestr.c_str());
|
QueryResult* result = CharacterDatabase.PQuery("SELECT * FROM %s WHERE %s", tableFrom, wherestr.c_str());
|
||||||
if (!result)
|
if (!result)
|
||||||
|
|
@ -421,12 +427,16 @@ std::string PlayerDumpWriter::GetDump(uint32 guid)
|
||||||
dump += "UPDATE character_db_version SET " + reqName + " = 1 WHERE FALSE;\n\n";
|
dump += "UPDATE character_db_version SET " + reqName + " = 1 WHERE FALSE;\n\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ sLog.outError("Table 'character_db_version' not have revision guard field, revision guard query not added to pdump."); }
|
{
|
||||||
|
sLog.outError("Table 'character_db_version' not have revision guard field, revision guard query not added to pdump.");
|
||||||
|
}
|
||||||
|
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ sLog.outError("Character DB not have 'character_db_version' table, revision guard query not added to pdump."); }
|
{
|
||||||
|
sLog.outError("Character DB not have 'character_db_version' table, revision guard query not added to pdump.");
|
||||||
|
}
|
||||||
|
|
||||||
for (DumpTable* itr = &dumpTables[0]; itr->isValid(); ++itr)
|
for (DumpTable* itr = &dumpTables[0]; itr->isValid(); ++itr)
|
||||||
{ DumpTableContent(dump, guid, itr->name, itr->name, itr->type); }
|
{ DumpTableContent(dump, guid, itr->name, itr->name, itr->type); }
|
||||||
|
|
@ -491,7 +501,9 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ guid = sObjectMgr.m_CharGuids.GetNextAfterMaxUsed(); }
|
{
|
||||||
|
guid = sObjectMgr.m_CharGuids.GetNextAfterMaxUsed();
|
||||||
|
}
|
||||||
|
|
||||||
// normalize the name if specified and check if it exists
|
// normalize the name if specified and check if it exists
|
||||||
if (!normalizePlayerName(name))
|
if (!normalizePlayerName(name))
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,9 @@ std::string Warden::Penalty(WardenCheck* check /*= NULL*/)
|
||||||
void WorldSession::HandleWardenDataOpcode(WorldPacket& recvData)
|
void WorldSession::HandleWardenDataOpcode(WorldPacket& recvData)
|
||||||
{
|
{
|
||||||
if (!_warden || recvData.empty())
|
if (!_warden || recvData.empty())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_warden->DecryptData(const_cast<uint8*>(recvData.contents()), recvData.size());
|
_warden->DecryptData(const_cast<uint8*>(recvData.contents()), recvData.size());
|
||||||
uint8 opcode;
|
uint8 opcode;
|
||||||
|
|
@ -290,10 +292,14 @@ void Warden::HandleData(ByteBuffer& /*buff*/)
|
||||||
void Warden::LogPositiveToDB(WardenCheck* check)
|
void Warden::LogPositiveToDB(WardenCheck* check)
|
||||||
{
|
{
|
||||||
if (!check || !_session)
|
if (!check || !_session)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (uint32(check->Action) < sWorld.getConfig(CONFIG_UINT32_WARDEN_DB_LOGLEVEL))
|
if (uint32(check->Action) < sWorld.getConfig(CONFIG_UINT32_WARDEN_DB_LOGLEVEL))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
static SqlStatementID insWardenPositive;
|
static SqlStatementID insWardenPositive;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -287,7 +287,9 @@ WardenCheck* WardenCheckMgr::GetWardenDataById(uint16 build, uint16 Id)
|
||||||
{
|
{
|
||||||
MultiCheckContainer::const_iterator it = MCheckStore.find(ComposeMultiCheckKey(build, Id));
|
MultiCheckContainer::const_iterator it = MCheckStore.find(ComposeMultiCheckKey(build, Id));
|
||||||
if (it != MCheckStore.end())
|
if (it != MCheckStore.end())
|
||||||
|
{
|
||||||
return it->second;
|
return it->second;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return CheckStore[Id];
|
return CheckStore[Id];
|
||||||
}
|
}
|
||||||
|
|
@ -301,12 +303,16 @@ WardenCheckResult* WardenCheckMgr::GetWardenResultById(uint16 build, uint16 Id)
|
||||||
{
|
{
|
||||||
MultiResultContainer::const_iterator it = MCheckResultStore.find(ComposeMultiCheckKey(build, Id));
|
MultiResultContainer::const_iterator it = MCheckResultStore.find(ComposeMultiCheckKey(build, Id));
|
||||||
if (it != MCheckResultStore.end())
|
if (it != MCheckResultStore.end())
|
||||||
|
{
|
||||||
return it->second;
|
return it->second;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckResultContainer::const_iterator itr = CheckResultStore.find(Id);
|
CheckResultContainer::const_iterator itr = CheckResultStore.find(Id);
|
||||||
if (itr != CheckResultStore.end())
|
if (itr != CheckResultStore.end())
|
||||||
|
{
|
||||||
return itr->second;
|
return itr->second;
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -230,7 +230,9 @@ uint32 AccountMgr::GetCharactersCount(uint32 acc_id)
|
||||||
return charcount;
|
return charcount;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ return 0; }
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AccountMgr::CheckPassword(uint32 accid, std::string passwd)
|
bool AccountMgr::CheckPassword(uint32 accid, std::string passwd)
|
||||||
|
|
|
||||||
|
|
@ -277,23 +277,35 @@ bool AchievementCriteriaRequirement::Meets(uint32 criteria_id, Player const* sou
|
||||||
return true;
|
return true;
|
||||||
case ACHIEVEMENT_CRITERIA_REQUIRE_T_CREATURE:
|
case ACHIEVEMENT_CRITERIA_REQUIRE_T_CREATURE:
|
||||||
if (!target || target->GetTypeId() != TYPEID_UNIT)
|
if (!target || target->GetTypeId() != TYPEID_UNIT)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return target->GetEntry() == creature.id;
|
return target->GetEntry() == creature.id;
|
||||||
case ACHIEVEMENT_CRITERIA_REQUIRE_T_PLAYER_CLASS_RACE:
|
case ACHIEVEMENT_CRITERIA_REQUIRE_T_PLAYER_CLASS_RACE:
|
||||||
if (!target || target->GetTypeId() != TYPEID_PLAYER)
|
if (!target || target->GetTypeId() != TYPEID_PLAYER)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
if (classRace.class_id && classRace.class_id != ((Player*)target)->getClass())
|
if (classRace.class_id && classRace.class_id != ((Player*)target)->getClass())
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
if (classRace.race_id && classRace.race_id != ((Player*)target)->getRace())
|
if (classRace.race_id && classRace.race_id != ((Player*)target)->getRace())
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
case ACHIEVEMENT_CRITERIA_REQUIRE_T_PLAYER_LESS_HEALTH:
|
case ACHIEVEMENT_CRITERIA_REQUIRE_T_PLAYER_LESS_HEALTH:
|
||||||
if (!target || target->GetTypeId() != TYPEID_PLAYER)
|
if (!target || target->GetTypeId() != TYPEID_PLAYER)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return target->GetHealth() * 100 <= health.percent * target->GetMaxHealth();
|
return target->GetHealth() * 100 <= health.percent * target->GetMaxHealth();
|
||||||
case ACHIEVEMENT_CRITERIA_REQUIRE_T_PLAYER_DEAD:
|
case ACHIEVEMENT_CRITERIA_REQUIRE_T_PLAYER_DEAD:
|
||||||
if (!target || target->GetTypeId() != TYPEID_PLAYER || target->IsAlive() || ((Player*)target)->GetDeathTimer() == 0)
|
if (!target || target->GetTypeId() != TYPEID_PLAYER || target->IsAlive() || ((Player*)target)->GetDeathTimer() == 0)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
// flag set == must be same team, not set == different team
|
// flag set == must be same team, not set == different team
|
||||||
return (((Player*)target)->GetTeam() == source->GetTeam()) == (player_dead.own_team_flag != 0);
|
return (((Player*)target)->GetTeam() == source->GetTeam()) == (player_dead.own_team_flag != 0);
|
||||||
case ACHIEVEMENT_CRITERIA_REQUIRE_S_AURA:
|
case ACHIEVEMENT_CRITERIA_REQUIRE_S_AURA:
|
||||||
|
|
@ -310,11 +322,15 @@ bool AchievementCriteriaRequirement::Meets(uint32 criteria_id, Player const* sou
|
||||||
return miscvalue1 >= value.minvalue;
|
return miscvalue1 >= value.minvalue;
|
||||||
case ACHIEVEMENT_CRITERIA_REQUIRE_T_LEVEL:
|
case ACHIEVEMENT_CRITERIA_REQUIRE_T_LEVEL:
|
||||||
if (!target)
|
if (!target)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return target->getLevel() >= level.minlevel;
|
return target->getLevel() >= level.minlevel;
|
||||||
case ACHIEVEMENT_CRITERIA_REQUIRE_T_GENDER:
|
case ACHIEVEMENT_CRITERIA_REQUIRE_T_GENDER:
|
||||||
if (!target)
|
if (!target)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return target->getGender() == gender.gender;
|
return target->getGender() == gender.gender;
|
||||||
case ACHIEVEMENT_CRITERIA_REQUIRE_DISABLED:
|
case ACHIEVEMENT_CRITERIA_REQUIRE_DISABLED:
|
||||||
return false; // always fail
|
return false; // always fail
|
||||||
|
|
@ -324,7 +340,9 @@ bool AchievementCriteriaRequirement::Meets(uint32 criteria_id, Player const* sou
|
||||||
return source->GetMap()->GetPlayersCountExceptGMs() <= map_players.maxcount;
|
return source->GetMap()->GetPlayersCountExceptGMs() <= map_players.maxcount;
|
||||||
case ACHIEVEMENT_CRITERIA_REQUIRE_T_TEAM:
|
case ACHIEVEMENT_CRITERIA_REQUIRE_T_TEAM:
|
||||||
if (!target || target->GetTypeId() != TYPEID_PLAYER)
|
if (!target || target->GetTypeId() != TYPEID_PLAYER)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return ((Player*)target)->GetTeam() == Team(team.team);
|
return ((Player*)target)->GetTeam() == Team(team.team);
|
||||||
case ACHIEVEMENT_CRITERIA_REQUIRE_S_DRUNK:
|
case ACHIEVEMENT_CRITERIA_REQUIRE_S_DRUNK:
|
||||||
return (uint32)Player::GetDrunkenstateByValue(source->GetDrunkValue()) >= drunk.state;
|
return (uint32)Player::GetDrunkenstateByValue(source->GetDrunkValue()) >= drunk.state;
|
||||||
|
|
@ -334,13 +352,17 @@ bool AchievementCriteriaRequirement::Meets(uint32 criteria_id, Player const* sou
|
||||||
{
|
{
|
||||||
BattleGround* bg = source->GetBattleGround();
|
BattleGround* bg = source->GetBattleGround();
|
||||||
if (!bg)
|
if (!bg)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return bg->IsTeamScoreInRange(source->GetTeam() == ALLIANCE ? HORDE : ALLIANCE, bg_loss_team_score.min_score, bg_loss_team_score.max_score);
|
return bg->IsTeamScoreInRange(source->GetTeam() == ALLIANCE ? HORDE : ALLIANCE, bg_loss_team_score.min_score, bg_loss_team_score.max_score);
|
||||||
}
|
}
|
||||||
case ACHIEVEMENT_CRITERIA_REQUIRE_INSTANCE_SCRIPT:
|
case ACHIEVEMENT_CRITERIA_REQUIRE_INSTANCE_SCRIPT:
|
||||||
{
|
{
|
||||||
if (!source->IsInWorld())
|
if (!source->IsInWorld())
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
InstanceData* data = source->GetInstanceData();
|
InstanceData* data = source->GetInstanceData();
|
||||||
if (!data)
|
if (!data)
|
||||||
{
|
{
|
||||||
|
|
@ -354,7 +376,9 @@ bool AchievementCriteriaRequirement::Meets(uint32 criteria_id, Player const* sou
|
||||||
{
|
{
|
||||||
Item* item = source->GetItemByPos(INVENTORY_SLOT_BAG_0, miscvalue1);
|
Item* item = source->GetItemByPos(INVENTORY_SLOT_BAG_0, miscvalue1);
|
||||||
if (!item)
|
if (!item)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
ItemPrototype const* proto = item->GetProto();
|
ItemPrototype const* proto = item->GetProto();
|
||||||
return proto->ItemLevel >= equipped_item.item_level && proto->Quality >= equipped_item.item_quality;
|
return proto->ItemLevel >= equipped_item.item_level && proto->Quality >= equipped_item.item_quality;
|
||||||
}
|
}
|
||||||
|
|
@ -375,7 +399,9 @@ bool AchievementCriteriaRequirement::Meets(uint32 criteria_id, Player const* sou
|
||||||
case ACHIEVEMENT_CRITERIA_REQUIRE_KNOWN_TITLE:
|
case ACHIEVEMENT_CRITERIA_REQUIRE_KNOWN_TITLE:
|
||||||
{
|
{
|
||||||
if (CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(known_title.title_id))
|
if (CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(known_title.title_id))
|
||||||
|
{
|
||||||
return source && source->HasTitle(titleInfo->bit_index);
|
return source && source->HasTitle(titleInfo->bit_index);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -387,7 +413,9 @@ bool AchievementCriteriaRequirementSet::Meets(Player const* source, Unit const*
|
||||||
{
|
{
|
||||||
for (Storage::const_iterator itr = storage.begin(); itr != storage.end(); ++itr)
|
for (Storage::const_iterator itr = storage.begin(); itr != storage.end(); ++itr)
|
||||||
if (!itr->Meets(criteria_id, source, target, miscvalue))
|
if (!itr->Meets(criteria_id, source, target, miscvalue))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -430,7 +458,9 @@ void AchievementMgr::ResetAchievementCriteria(AchievementCriteriaTypes type, uin
|
||||||
DETAIL_FILTER_LOG(LOG_FILTER_ACHIEVEMENT_UPDATES, "AchievementMgr::ResetAchievementCriteria(%u, %u, %u)", type, miscvalue1, miscvalue2);
|
DETAIL_FILTER_LOG(LOG_FILTER_ACHIEVEMENT_UPDATES, "AchievementMgr::ResetAchievementCriteria(%u, %u, %u)", type, miscvalue1, miscvalue2);
|
||||||
|
|
||||||
if (!sWorld.getConfig(CONFIG_BOOL_GM_ALLOW_ACHIEVEMENT_GAINS) && m_player->GetSession()->GetSecurity() > SEC_PLAYER)
|
if (!sWorld.getConfig(CONFIG_BOOL_GM_ALLOW_ACHIEVEMENT_GAINS) && m_player->GetSession()->GetSecurity() > SEC_PLAYER)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
AchievementCriteriaEntryList const& achievementCriteriaList = sAchievementMgr.GetAchievementCriteriaByType(type);
|
AchievementCriteriaEntryList const& achievementCriteriaList = sAchievementMgr.GetAchievementCriteriaByType(type);
|
||||||
for (AchievementCriteriaEntryList::const_iterator i = achievementCriteriaList.begin(); i != achievementCriteriaList.end(); ++i)
|
for (AchievementCriteriaEntryList::const_iterator i = achievementCriteriaList.begin(); i != achievementCriteriaList.end(); ++i)
|
||||||
|
|
@ -614,7 +644,9 @@ void AchievementMgr::LoadFromDB(QueryResult* achievementResult, QueryResult* cri
|
||||||
void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement)
|
void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement)
|
||||||
{
|
{
|
||||||
if (GetPlayer()->GetSession()->PlayerLoading())
|
if (GetPlayer()->GetSession()->PlayerLoading())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_ACHIEVEMENT_UPDATES, "AchievementMgr::SendAchievementEarned(%u)", achievement->ID);
|
DEBUG_FILTER_LOG(LOG_FILTER_ACHIEVEMENT_UPDATES, "AchievementMgr::SendAchievementEarned(%u)", achievement->ID);
|
||||||
|
|
||||||
|
|
@ -705,7 +737,9 @@ void AchievementMgr::StartTimedAchievementCriteria(AchievementCriteriaTypes type
|
||||||
DETAIL_FILTER_LOG(LOG_FILTER_ACHIEVEMENT_UPDATES, "AchievementMgr::StartTimedAchievementCriteria(%u, %u)", type, timedRequirementId);
|
DETAIL_FILTER_LOG(LOG_FILTER_ACHIEVEMENT_UPDATES, "AchievementMgr::StartTimedAchievementCriteria(%u, %u)", type, timedRequirementId);
|
||||||
|
|
||||||
if (!sWorld.getConfig(CONFIG_BOOL_GM_ALLOW_ACHIEVEMENT_GAINS) && m_player->GetSession()->GetSecurity() > SEC_PLAYER)
|
if (!sWorld.getConfig(CONFIG_BOOL_GM_ALLOW_ACHIEVEMENT_GAINS) && m_player->GetSession()->GetSecurity() > SEC_PLAYER)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
AchievementCriteriaEntryList const& achievementCriteriaList = sAchievementMgr.GetAchievementCriteriaByType(type);
|
AchievementCriteriaEntryList const& achievementCriteriaList = sAchievementMgr.GetAchievementCriteriaByType(type);
|
||||||
for (AchievementCriteriaEntryList::const_iterator i = achievementCriteriaList.begin(); i != achievementCriteriaList.end(); ++i)
|
for (AchievementCriteriaEntryList::const_iterator i = achievementCriteriaList.begin(); i != achievementCriteriaList.end(); ++i)
|
||||||
|
|
@ -766,7 +800,9 @@ void AchievementMgr::StartTimedAchievementCriteria(AchievementCriteriaTypes type
|
||||||
void AchievementMgr::DoFailedTimedAchievementCriterias()
|
void AchievementMgr::DoFailedTimedAchievementCriterias()
|
||||||
{
|
{
|
||||||
if (m_criteriaFailTimes.empty())
|
if (m_criteriaFailTimes.empty())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
for (AchievementCriteriaFailTimeMap::iterator iter = m_criteriaFailTimes.begin(); iter != m_criteriaFailTimes.end();)
|
for (AchievementCriteriaFailTimeMap::iterator iter = m_criteriaFailTimes.begin(); iter != m_criteriaFailTimes.end();)
|
||||||
|
|
@ -812,7 +848,9 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
|
||||||
DETAIL_FILTER_LOG(LOG_FILTER_ACHIEVEMENT_UPDATES, "AchievementMgr::UpdateAchievementCriteria(%u, %u, %u, %u)", type, miscvalue1, miscvalue2, time);
|
DETAIL_FILTER_LOG(LOG_FILTER_ACHIEVEMENT_UPDATES, "AchievementMgr::UpdateAchievementCriteria(%u, %u, %u, %u)", type, miscvalue1, miscvalue2, time);
|
||||||
|
|
||||||
if (!sWorld.getConfig(CONFIG_BOOL_GM_ALLOW_ACHIEVEMENT_GAINS) && m_player->GetSession()->GetSecurity() > SEC_PLAYER)
|
if (!sWorld.getConfig(CONFIG_BOOL_GM_ALLOW_ACHIEVEMENT_GAINS) && m_player->GetSession()->GetSecurity() > SEC_PLAYER)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
AchievementCriteriaEntryList const& achievementCriteriaList = sAchievementMgr.GetAchievementCriteriaByType(type);
|
AchievementCriteriaEntryList const& achievementCriteriaList = sAchievementMgr.GetAchievementCriteriaByType(type);
|
||||||
for (AchievementCriteriaEntryList::const_iterator itr = achievementCriteriaList.begin(); itr != achievementCriteriaList.end(); ++itr)
|
for (AchievementCriteriaEntryList::const_iterator itr = achievementCriteriaList.begin(); itr != achievementCriteriaList.end(); ++itr)
|
||||||
|
|
@ -1043,7 +1081,9 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
|
||||||
case ACHIEVEMENT_CRITERIA_TYPE_CURRENCY_EARNED:
|
case ACHIEVEMENT_CRITERIA_TYPE_CURRENCY_EARNED:
|
||||||
{
|
{
|
||||||
if (!miscvalue1 || !miscvalue2 || miscvalue1 != achievementCriteria->currencyEarned.currencyId)
|
if (!miscvalue1 || !miscvalue2 || miscvalue1 != achievementCriteria->currencyEarned.currencyId)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
change = miscvalue2;
|
change = miscvalue2;
|
||||||
progressType = PROGRESS_ACCUMULATE;
|
progressType = PROGRESS_ACCUMULATE;
|
||||||
|
|
@ -1905,18 +1945,24 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve
|
||||||
{
|
{
|
||||||
// counter can never complete
|
// counter can never complete
|
||||||
if (achievement->flags & ACHIEVEMENT_FLAG_COUNTER)
|
if (achievement->flags & ACHIEVEMENT_FLAG_COUNTER)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (achievement->flags & (ACHIEVEMENT_FLAG_REALM_FIRST_REACH | ACHIEVEMENT_FLAG_REALM_FIRST_KILL))
|
if (achievement->flags & (ACHIEVEMENT_FLAG_REALM_FIRST_REACH | ACHIEVEMENT_FLAG_REALM_FIRST_KILL))
|
||||||
{
|
{
|
||||||
// someone on this realm has already completed that achievement
|
// someone on this realm has already completed that achievement
|
||||||
if (sAchievementMgr.IsRealmCompleted(achievement))
|
if (sAchievementMgr.IsRealmCompleted(achievement))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CriteriaProgressMap::const_iterator itr = m_criteriaProgress.find(achievementCriteria->ID);
|
CriteriaProgressMap::const_iterator itr = m_criteriaProgress.find(achievementCriteria->ID);
|
||||||
if (itr == m_criteriaProgress.end())
|
if (itr == m_criteriaProgress.end())
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
CriteriaProgress const* progress = &itr->second;
|
CriteriaProgress const* progress = &itr->second;
|
||||||
|
|
||||||
|
|
@ -1929,11 +1975,15 @@ void AchievementMgr::CompletedCriteriaFor(AchievementEntry const* achievement)
|
||||||
{
|
{
|
||||||
// counter can never complete
|
// counter can never complete
|
||||||
if (achievement->flags & ACHIEVEMENT_FLAG_COUNTER)
|
if (achievement->flags & ACHIEVEMENT_FLAG_COUNTER)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// already completed and stored
|
// already completed and stored
|
||||||
if (m_completedAchievements.find(achievement->ID) != m_completedAchievements.end())
|
if (m_completedAchievements.find(achievement->ID) != m_completedAchievements.end())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (IsCompletedAchievement(achievement))
|
if (IsCompletedAchievement(achievement))
|
||||||
CompletedAchievement(achievement);
|
CompletedAchievement(achievement);
|
||||||
|
|
@ -1943,7 +1993,9 @@ bool AchievementMgr::IsCompletedAchievement(AchievementEntry const* entry)
|
||||||
{
|
{
|
||||||
// counter can never complete
|
// counter can never complete
|
||||||
if (entry->flags & ACHIEVEMENT_FLAG_COUNTER)
|
if (entry->flags & ACHIEVEMENT_FLAG_COUNTER)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// for achievement with referenced achievement criterias get from referenced and counter from self
|
// for achievement with referenced achievement criterias get from referenced and counter from self
|
||||||
uint32 achievementForTestId = entry->refAchievement ? entry->refAchievement : entry->ID;
|
uint32 achievementForTestId = entry->refAchievement ? entry->refAchievement : entry->ID;
|
||||||
|
|
@ -1951,7 +2003,9 @@ bool AchievementMgr::IsCompletedAchievement(AchievementEntry const* entry)
|
||||||
|
|
||||||
AchievementCriteriaEntryList const* cList = sAchievementMgr.GetAchievementCriteriaByAchievement(achievementForTestId);
|
AchievementCriteriaEntryList const* cList = sAchievementMgr.GetAchievementCriteriaByAchievement(achievementForTestId);
|
||||||
if (!cList)
|
if (!cList)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
// For SUMM achievements, we have to count the progress of each criteria of the achievement.
|
// For SUMM achievements, we have to count the progress of each criteria of the achievement.
|
||||||
|
|
@ -1971,7 +2025,9 @@ bool AchievementMgr::IsCompletedAchievement(AchievementEntry const* entry)
|
||||||
|
|
||||||
// for counters, field4 contains the main count requirement
|
// for counters, field4 contains the main count requirement
|
||||||
if (count >= criteria->raw.count)
|
if (count >= criteria->raw.count)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -1992,12 +2048,16 @@ bool AchievementMgr::IsCompletedAchievement(AchievementEntry const* entry)
|
||||||
|
|
||||||
// completed as have req. count of completed criterias
|
// completed as have req. count of completed criterias
|
||||||
if (achievementForTestCount > 0 && achievementForTestCount <= count)
|
if (achievementForTestCount > 0 && achievementForTestCount <= count)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// all criterias completed requirement
|
// all criterias completed requirement
|
||||||
if (completed_all && achievementForTestCount == 0)
|
if (completed_all && achievementForTestCount == 0)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -2021,11 +2081,15 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* criteri
|
||||||
{
|
{
|
||||||
// not create record for 0 counter
|
// not create record for 0 counter
|
||||||
if (changeValue == 0)
|
if (changeValue == 0)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// not start manually started timed achievements
|
// not start manually started timed achievements
|
||||||
if (criteria->IsExplicitlyStartedTimedCriteria())
|
if (criteria->IsExplicitlyStartedTimedCriteria())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
progress = &m_criteriaProgress[criteria->ID];
|
progress = &m_criteriaProgress[criteria->ID];
|
||||||
|
|
||||||
|
|
@ -2065,7 +2129,9 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* criteri
|
||||||
|
|
||||||
// not update (not mark as changed) if counter will have same value
|
// not update (not mark as changed) if counter will have same value
|
||||||
if (progress->counter == newValue)
|
if (progress->counter == newValue)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
progress->counter = newValue;
|
progress->counter = newValue;
|
||||||
|
|
@ -2121,7 +2187,9 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
|
||||||
{
|
{
|
||||||
DETAIL_LOG("AchievementMgr::CompletedAchievement(%u)", achievement->ID);
|
DETAIL_LOG("AchievementMgr::CompletedAchievement(%u)", achievement->ID);
|
||||||
if (achievement->flags & ACHIEVEMENT_FLAG_COUNTER || m_completedAchievements.find(achievement->ID) != m_completedAchievements.end())
|
if (achievement->flags & ACHIEVEMENT_FLAG_COUNTER || m_completedAchievements.find(achievement->ID) != m_completedAchievements.end())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SendAchievementEarned(achievement);
|
SendAchievementEarned(achievement);
|
||||||
CompletedAchievementData& ca = m_completedAchievements[achievement->ID];
|
CompletedAchievementData& ca = m_completedAchievements[achievement->ID];
|
||||||
|
|
@ -2140,7 +2208,9 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
|
||||||
|
|
||||||
// no rewards
|
// no rewards
|
||||||
if (!reward)
|
if (!reward)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// titles
|
// titles
|
||||||
if (uint32 titleId = reward->titleId[GetPlayer()->GetTeam() == HORDE ? 1 : 0])
|
if (uint32 titleId = reward->titleId[GetPlayer()->GetTeam() == HORDE ? 1 : 0])
|
||||||
|
|
@ -2189,11 +2259,15 @@ void AchievementMgr::IncompletedAchievement(AchievementEntry const* achievement)
|
||||||
{
|
{
|
||||||
DETAIL_LOG("AchievementMgr::IncompletedAchievement(%u)", achievement->ID);
|
DETAIL_LOG("AchievementMgr::IncompletedAchievement(%u)", achievement->ID);
|
||||||
if (achievement->flags & ACHIEVEMENT_FLAG_COUNTER)
|
if (achievement->flags & ACHIEVEMENT_FLAG_COUNTER)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CompletedAchievementMap::iterator itr = m_completedAchievements.find(achievement->ID);
|
CompletedAchievementMap::iterator itr = m_completedAchievements.find(achievement->ID);
|
||||||
if (itr == m_completedAchievements.end())
|
if (itr == m_completedAchievements.end())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
WorldPacket data(SMSG_ACHIEVEMENT_DELETED, 4);
|
WorldPacket data(SMSG_ACHIEVEMENT_DELETED, 4);
|
||||||
data << uint32(achievement->ID);
|
data << uint32(achievement->ID);
|
||||||
|
|
@ -2210,7 +2284,9 @@ void AchievementMgr::IncompletedAchievement(AchievementEntry const* achievement)
|
||||||
|
|
||||||
// no rewards
|
// no rewards
|
||||||
if (!reward)
|
if (!reward)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// titles
|
// titles
|
||||||
if (uint32 titleId = reward->titleId[GetPlayer()->GetTeam() == HORDE ? 0 : 1])
|
if (uint32 titleId = reward->titleId[GetPlayer()->GetTeam() == HORDE ? 0 : 1])
|
||||||
|
|
@ -2394,7 +2470,9 @@ AchievementReward const* AchievementGlobalMgr::GetAchievementReward(AchievementE
|
||||||
AchievementRewardsMapBounds bounds = m_achievementRewards.equal_range(achievement->ID);
|
AchievementRewardsMapBounds bounds = m_achievementRewards.equal_range(achievement->ID);
|
||||||
for (AchievementRewardsMap::const_iterator iter = bounds.first; iter != bounds.second; ++iter)
|
for (AchievementRewardsMap::const_iterator iter = bounds.first; iter != bounds.second; ++iter)
|
||||||
if (iter->second.gender == GENDER_NONE || uint8(iter->second.gender) == gender)
|
if (iter->second.gender == GENDER_NONE || uint8(iter->second.gender) == gender)
|
||||||
|
{
|
||||||
return &iter->second;
|
return &iter->second;
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -2404,7 +2482,9 @@ AchievementRewardLocale const* AchievementGlobalMgr::GetAchievementRewardLocale(
|
||||||
AchievementRewardLocalesMapBounds bounds = m_achievementRewardLocales.equal_range(achievement->ID);
|
AchievementRewardLocalesMapBounds bounds = m_achievementRewardLocales.equal_range(achievement->ID);
|
||||||
for (AchievementRewardLocalesMap::const_iterator iter = bounds.first; iter != bounds.second; ++iter)
|
for (AchievementRewardLocalesMap::const_iterator iter = bounds.first; iter != bounds.second; ++iter)
|
||||||
if (iter->second.gender == GENDER_NONE || uint8(iter->second.gender) == gender)
|
if (iter->second.gender == GENDER_NONE || uint8(iter->second.gender) == gender)
|
||||||
|
{
|
||||||
return &iter->second;
|
return &iter->second;
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,13 +41,19 @@ void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket& recv_data)
|
||||||
|
|
||||||
Player* player = sObjectMgr.GetPlayer(guid);
|
Player* player = sObjectMgr.GetPlayer(guid);
|
||||||
if (!player)
|
if (!player)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!_player->IsWithinDistInMap(player, INSPECT_DISTANCE, false))
|
if (!_player->IsWithinDistInMap(player, INSPECT_DISTANCE, false))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_player->IsHostileTo(player))
|
if (_player->IsHostileTo(player))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (uint8 i = 0; i < MAX_ARENA_SLOT; ++i)
|
for (uint8 i = 0; i < MAX_ARENA_SLOT; ++i)
|
||||||
{
|
{
|
||||||
|
|
@ -96,10 +102,14 @@ void WorldSession::HandleArenaTeamCreateOpcode(WorldPacket& recv_data)
|
||||||
|
|
||||||
ArenaType type = ArenaTeam::GetTypeBySlot(slot);
|
ArenaType type = ArenaTeam::GetTypeBySlot(slot);
|
||||||
if (!IsArenaTypeValid(type))
|
if (!IsArenaTypeValid(type))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!IsArenaTypeValid(ArenaType(type)))
|
if (!IsArenaTypeValid(ArenaType(type)))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_player->GetArenaTeamId(slot))
|
if (_player->GetArenaTeamId(slot))
|
||||||
{
|
{
|
||||||
|
|
@ -148,7 +158,9 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket& recv_data)
|
||||||
if (!Invitedname.empty())
|
if (!Invitedname.empty())
|
||||||
{
|
{
|
||||||
if (!normalizePlayerName(Invitedname))
|
if (!normalizePlayerName(Invitedname))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
player = ObjectAccessor::FindPlayerByName(Invitedname.c_str());
|
player = ObjectAccessor::FindPlayerByName(Invitedname.c_str());
|
||||||
}
|
}
|
||||||
|
|
@ -180,7 +192,9 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket& recv_data)
|
||||||
|
|
||||||
// OK result but not send invite
|
// OK result but not send invite
|
||||||
if (player->GetSocial()->HasIgnore(GetPlayer()->GetObjectGuid()))
|
if (player->GetSocial()->HasIgnore(GetPlayer()->GetObjectGuid()))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GUILD) && player->GetTeam() != GetPlayer()->GetTeam())
|
if (!sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GUILD) && player->GetTeam() != GetPlayer()->GetTeam())
|
||||||
{
|
{
|
||||||
|
|
@ -224,7 +238,9 @@ void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket & /*recv_data*/)
|
||||||
|
|
||||||
ArenaTeam* at = sObjectMgr.GetArenaTeamById(_player->GetArenaTeamIdInvited());
|
ArenaTeam* at = sObjectMgr.GetArenaTeamById(_player->GetArenaTeamIdInvited());
|
||||||
if (!at)
|
if (!at)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_player->GetArenaTeamId(at->GetSlot()))
|
if (_player->GetArenaTeamId(at->GetSlot()))
|
||||||
{
|
{
|
||||||
|
|
@ -268,7 +284,9 @@ void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket& recv_data)
|
||||||
|
|
||||||
ArenaTeam* at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
|
ArenaTeam* at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
|
||||||
if (!at)
|
if (!at)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_player->GetObjectGuid() == at->GetCaptainGuid() && at->GetMembersSize() > 1)
|
if (_player->GetObjectGuid() == at->GetCaptainGuid() && at->GetMembersSize() > 1)
|
||||||
{
|
{
|
||||||
|
|
@ -304,10 +322,14 @@ void WorldSession::HandleArenaTeamDisbandOpcode(WorldPacket& recv_data)
|
||||||
if (ArenaTeam* at = sObjectMgr.GetArenaTeamById(ArenaTeamId))
|
if (ArenaTeam* at = sObjectMgr.GetArenaTeamById(ArenaTeamId))
|
||||||
{
|
{
|
||||||
if (at->GetCaptainGuid() != _player->GetObjectGuid())
|
if (at->GetCaptainGuid() != _player->GetObjectGuid())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (at->IsFighting())
|
if (at->IsFighting())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
at->Disband(this);
|
at->Disband(this);
|
||||||
delete at;
|
delete at;
|
||||||
|
|
@ -326,7 +348,9 @@ void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket& recv_data)
|
||||||
|
|
||||||
ArenaTeam* at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
|
ArenaTeam* at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
|
||||||
if (!at) // arena team not found
|
if (!at) // arena team not found
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (at->GetCaptainGuid() != _player->GetObjectGuid())
|
if (at->GetCaptainGuid() != _player->GetObjectGuid())
|
||||||
{
|
{
|
||||||
|
|
@ -335,7 +359,9 @@ void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket& recv_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!normalizePlayerName(name))
|
if (!normalizePlayerName(name))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ArenaTeamMember* member = at->GetMember(name);
|
ArenaTeamMember* member = at->GetMember(name);
|
||||||
if (!member) // member not found
|
if (!member) // member not found
|
||||||
|
|
@ -368,7 +394,9 @@ void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket& recv_data)
|
||||||
|
|
||||||
ArenaTeam* at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
|
ArenaTeam* at = sObjectMgr.GetArenaTeamById(ArenaTeamId);
|
||||||
if (!at) // arena team not found
|
if (!at) // arena team not found
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (at->GetCaptainGuid() != _player->GetObjectGuid())
|
if (at->GetCaptainGuid() != _player->GetObjectGuid())
|
||||||
{
|
{
|
||||||
|
|
@ -377,7 +405,9 @@ void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket& recv_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!normalizePlayerName(name))
|
if (!normalizePlayerName(name))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ArenaTeamMember* member = at->GetMember(name);
|
ArenaTeamMember* member = at->GetMember(name);
|
||||||
if (!member) // member not found
|
if (!member) // member not found
|
||||||
|
|
@ -387,7 +417,9 @@ void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket& recv_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (at->GetCaptainGuid() == member->guid) // target player already captain
|
if (at->GetCaptainGuid() == member->guid) // target player already captain
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
at->SetCaptain(member->guid);
|
at->SetCaptain(member->guid);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -274,7 +274,9 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recv_data)
|
||||||
|
|
||||||
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
|
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
|
||||||
if (!auctionHouseEntry)
|
if (!auctionHouseEntry)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// always return pointer
|
// always return pointer
|
||||||
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry);
|
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry);
|
||||||
|
|
@ -392,7 +394,9 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recv_data)
|
||||||
|
|
||||||
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
|
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
|
||||||
if (!auctionHouseEntry)
|
if (!auctionHouseEntry)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// always return pointer
|
// always return pointer
|
||||||
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry);
|
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry);
|
||||||
|
|
@ -444,7 +448,9 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recv_data)
|
||||||
|
|
||||||
// cheating
|
// cheating
|
||||||
if (price < auction->startbid)
|
if (price < auction->startbid)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SendAuctionCommandResult(auction, AUCTION_BID_PLACED, AUCTION_OK);
|
SendAuctionCommandResult(auction, AUCTION_BID_PLACED, AUCTION_OK);
|
||||||
|
|
||||||
|
|
@ -467,7 +473,9 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recv_data)
|
||||||
|
|
||||||
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
|
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
|
||||||
if (!auctionHouseEntry)
|
if (!auctionHouseEntry)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// always return pointer
|
// always return pointer
|
||||||
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry);
|
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry);
|
||||||
|
|
@ -494,7 +502,9 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
uint64 auctionCut = auction->GetAuctionCut();
|
uint64 auctionCut = auction->GetAuctionCut();
|
||||||
if (pl->GetMoney() < auctionCut) // player doesn't have enough money, maybe message needed
|
if (pl->GetMoney() < auctionCut) // player doesn't have enough money, maybe message needed
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (auction->bidder) // if auction have real existed bidder send mail
|
if (auction->bidder) // if auction have real existed bidder send mail
|
||||||
SendAuctionCancelledToBidderMail(auction);
|
SendAuctionCancelledToBidderMail(auction);
|
||||||
|
|
@ -547,7 +557,9 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket& recv_data)
|
||||||
|
|
||||||
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
|
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
|
||||||
if (!auctionHouseEntry)
|
if (!auctionHouseEntry)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// always return pointer
|
// always return pointer
|
||||||
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry);
|
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry);
|
||||||
|
|
@ -591,7 +603,9 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket& recv_data)
|
||||||
|
|
||||||
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
|
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
|
||||||
if (!auctionHouseEntry)
|
if (!auctionHouseEntry)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// always return pointer
|
// always return pointer
|
||||||
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry);
|
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry);
|
||||||
|
|
@ -629,7 +643,9 @@ void WorldSession::HandleAuctionListItems(WorldPacket& recv_data)
|
||||||
recv_data >> usable >> isFull >> unk >> sortCount;
|
recv_data >> usable >> isFull >> unk >> sortCount;
|
||||||
|
|
||||||
if (sortCount >= MAX_AUCTION_SORT)
|
if (sortCount >= MAX_AUCTION_SORT)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint8 Sort[MAX_AUCTION_SORT];
|
uint8 Sort[MAX_AUCTION_SORT];
|
||||||
memset(Sort, MAX_AUCTION_SORT, MAX_AUCTION_SORT);
|
memset(Sort, MAX_AUCTION_SORT, MAX_AUCTION_SORT);
|
||||||
|
|
@ -641,7 +657,9 @@ void WorldSession::HandleAuctionListItems(WorldPacket& recv_data)
|
||||||
recv_data >> column;
|
recv_data >> column;
|
||||||
|
|
||||||
if (column >= MAX_AUCTION_SORT)
|
if (column >= MAX_AUCTION_SORT)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
recv_data >> reversed;
|
recv_data >> reversed;
|
||||||
Sort[i] = (reversed > 0) ? (column |= AUCTION_SORT_REVERSED) : column;
|
Sort[i] = (reversed > 0) ? (column |= AUCTION_SORT_REVERSED) : column;
|
||||||
|
|
@ -649,7 +667,9 @@ void WorldSession::HandleAuctionListItems(WorldPacket& recv_data)
|
||||||
|
|
||||||
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
|
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
|
||||||
if (!auctionHouseEntry)
|
if (!auctionHouseEntry)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// always return pointer
|
// always return pointer
|
||||||
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry);
|
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry);
|
||||||
|
|
@ -676,7 +696,9 @@ void WorldSession::HandleAuctionListItems(WorldPacket& recv_data)
|
||||||
// converting string that we try to find to lower case
|
// converting string that we try to find to lower case
|
||||||
std::wstring wsearchedname;
|
std::wstring wsearchedname;
|
||||||
if (!Utf8toWStr(searchedname, wsearchedname))
|
if (!Utf8toWStr(searchedname, wsearchedname))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
wstrToLower(wsearchedname);
|
wstrToLower(wsearchedname);
|
||||||
|
|
||||||
|
|
@ -700,7 +722,9 @@ void WorldSession::HandleAuctionListPendingSales(WorldPacket& recv_data)
|
||||||
|
|
||||||
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
|
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
|
||||||
if (!auctionHouseEntry)
|
if (!auctionHouseEntry)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -749,7 +749,9 @@ void CalendarMgr::SendCalendarEventInviteAlert(CalendarInvite const* invite)
|
||||||
|
|
||||||
CalendarEvent const* event = invite->GetCalendarEvent();
|
CalendarEvent const* event = invite->GetCalendarEvent();
|
||||||
if (!event)
|
if (!event)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
WorldPacket data(SMSG_CALENDAR_EVENT_INVITE_ALERT);
|
WorldPacket data(SMSG_CALENDAR_EVENT_INVITE_ALERT);
|
||||||
data << uint64(event->EventId);
|
data << uint64(event->EventId);
|
||||||
|
|
@ -821,7 +823,9 @@ void CalendarMgr::SendCalendarEventInvite(CalendarInvite const* invite)
|
||||||
void CalendarMgr::SendCalendarCommandResult(Player* player, CalendarError err, char const* param /*= NULL*/)
|
void CalendarMgr::SendCalendarCommandResult(Player* player, CalendarError err, char const* param /*= NULL*/)
|
||||||
{
|
{
|
||||||
if (!player)
|
if (!player)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_CALENDAR, "SMSG_CALENDAR_COMMAND_RESULT (%u)", err);
|
DEBUG_FILTER_LOG(LOG_FILTER_CALENDAR, "SMSG_CALENDAR_COMMAND_RESULT (%u)", err);
|
||||||
WorldPacket data(SMSG_CALENDAR_COMMAND_RESULT, 0);
|
WorldPacket data(SMSG_CALENDAR_COMMAND_RESULT, 0);
|
||||||
|
|
@ -858,7 +862,9 @@ void CalendarMgr::SendCalendarEventRemovedAlert(CalendarEvent const* event)
|
||||||
void CalendarMgr::SendCalendarEvent(Player* player, CalendarEvent const* event, uint32 sendType)
|
void CalendarMgr::SendCalendarEvent(Player* player, CalendarEvent const* event, uint32 sendType)
|
||||||
{
|
{
|
||||||
if (!player || !event)
|
if (!player || !event)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::string timeStr = TimeToTimestampStr(event->EventTime);
|
std::string timeStr = TimeToTimestampStr(event->EventTime);
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_CALENDAR, "SendCalendarEvent> sendType[%u], CreatorGuid[%s], EventId[" UI64FMTD "], Type[%u], Flags[%u], Title[%s]",
|
DEBUG_FILTER_LOG(LOG_FILTER_CALENDAR, "SendCalendarEvent> sendType[%u], CreatorGuid[%s], EventId[" UI64FMTD "], Type[%u], Flags[%u], Title[%s]",
|
||||||
|
|
@ -1017,7 +1023,9 @@ void CalendarMgr::SendPacketToAllEventRelatives(WorldPacket packet, CalendarEven
|
||||||
void CalendarMgr::SendCalendarRaidLockoutRemove(Player* player, DungeonPersistentState const* save)
|
void CalendarMgr::SendCalendarRaidLockoutRemove(Player* player, DungeonPersistentState const* save)
|
||||||
{
|
{
|
||||||
if (!save || !player)
|
if (!save || !player)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
DEBUG_LOG("SMSG_CALENDAR_RAID_LOCKOUT_REMOVED [%s]", player->GetObjectGuid().GetString().c_str());
|
DEBUG_LOG("SMSG_CALENDAR_RAID_LOCKOUT_REMOVED [%s]", player->GetObjectGuid().GetString().c_str());
|
||||||
time_t currTime = time(NULL);
|
time_t currTime = time(NULL);
|
||||||
|
|
@ -1034,7 +1042,9 @@ void CalendarMgr::SendCalendarRaidLockoutRemove(Player* player, DungeonPersisten
|
||||||
void CalendarMgr::SendCalendarRaidLockoutAdd(Player* player, DungeonPersistentState const* save)
|
void CalendarMgr::SendCalendarRaidLockoutAdd(Player* player, DungeonPersistentState const* save)
|
||||||
{
|
{
|
||||||
if (!save || !player)
|
if (!save || !player)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
DEBUG_LOG("SMSG_CALENDAR_RAID_LOCKOUT_ADDED [%s]", player->GetObjectGuid().GetString().c_str());
|
DEBUG_LOG("SMSG_CALENDAR_RAID_LOCKOUT_ADDED [%s]", player->GetObjectGuid().GetString().c_str());
|
||||||
time_t currTime = time(NULL);
|
time_t currTime = time(NULL);
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,9 @@ inline void
|
||||||
Cell::Visit(const CellPair& standing_cell, TypeContainerVisitor<T, CONTAINER> &visitor, Map& m, float x, float y, float radius) const
|
Cell::Visit(const CellPair& standing_cell, TypeContainerVisitor<T, CONTAINER> &visitor, Map& m, float x, float y, float radius) const
|
||||||
{
|
{
|
||||||
if (standing_cell.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || standing_cell.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP)
|
if (standing_cell.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || standing_cell.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// no jokes here... Actually placing ASSERT() here was good idea, but
|
// no jokes here... Actually placing ASSERT() here was good idea, but
|
||||||
// we had some problems with DynamicObjects, which pass radius = 0.0f (DB issue?)
|
// we had some problems with DynamicObjects, which pass radius = 0.0f (DB issue?)
|
||||||
|
|
@ -149,7 +151,9 @@ Cell::VisitCircle(TypeContainerVisitor<T, CONTAINER> &visitor, Map& m, const Cel
|
||||||
// if x_shift == 0 then we have too small cell area, which were already
|
// if x_shift == 0 then we have too small cell area, which were already
|
||||||
// visited at previous step, so just return from procedure...
|
// visited at previous step, so just return from procedure...
|
||||||
if (x_shift == 0)
|
if (x_shift == 0)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 y_start = end_cell.y_coord;
|
uint32 y_start = end_cell.y_coord;
|
||||||
uint32 y_end = begin_cell.y_coord;
|
uint32 y_end = begin_cell.y_coord;
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,9 @@ void Channel::Join(Player* player, const char* password)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player->GetGuildId() && (GetFlags() == 0x38))
|
if (player->GetGuildId() && (GetFlags() == 0x38))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// join channel
|
// join channel
|
||||||
player->JoinedChannel(this);
|
player->JoinedChannel(this);
|
||||||
|
|
@ -343,7 +345,9 @@ void Channel::SetMode(Player* player, const char* targetName, bool moderator, bo
|
||||||
|
|
||||||
ObjectGuid targetGuid = target->GetObjectGuid();
|
ObjectGuid targetGuid = target->GetObjectGuid();
|
||||||
if (moderator && guid == m_ownerGuid && targetGuid == m_ownerGuid)
|
if (moderator && guid == m_ownerGuid && targetGuid == m_ownerGuid)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!IsOn(targetGuid))
|
if (!IsOn(targetGuid))
|
||||||
{
|
{
|
||||||
|
|
@ -588,7 +592,9 @@ void Channel::Moderate(Player* player)
|
||||||
void Channel::Say(Player* player, const char* text, uint32 lang)
|
void Channel::Say(Player* player, const char* text, uint32 lang)
|
||||||
{
|
{
|
||||||
if (!text)
|
if (!text)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ObjectGuid guid = player->GetObjectGuid();
|
ObjectGuid guid = player->GetObjectGuid();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -239,7 +239,9 @@ private:
|
||||||
{
|
{
|
||||||
PlayerList::const_iterator p_itr = m_players.find(guid);
|
PlayerList::const_iterator p_itr = m_players.find(guid);
|
||||||
if (p_itr == m_players.end())
|
if (p_itr == m_players.end())
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return p_itr->second.flags;
|
return p_itr->second.flags;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,9 @@ void WorldSession::HandleJoinChannelOpcode(WorldPacket& recvPacket)
|
||||||
pass = recvPacket.ReadString(passwordLength);
|
pass = recvPacket.ReadString(passwordLength);
|
||||||
|
|
||||||
if (channelname.empty())
|
if (channelname.empty())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
if (Channel* chn = cMgr->GetJoinChannel(channelname, channel_id))
|
if (Channel* chn = cMgr->GetJoinChannel(channelname, channel_id))
|
||||||
|
|
@ -60,7 +62,9 @@ void WorldSession::HandleLeaveChannelOpcode(WorldPacket& recvPacket)
|
||||||
channelname = recvPacket.ReadString(recvPacket.ReadBits(8));
|
channelname = recvPacket.ReadString(recvPacket.ReadBits(8));
|
||||||
|
|
||||||
if (channelname.empty())
|
if (channelname.empty())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
{
|
{
|
||||||
|
|
@ -112,7 +116,9 @@ void WorldSession::HandleChannelSetOwnerOpcode(WorldPacket& recvPacket)
|
||||||
channelname = recvPacket.ReadString(channelLen);
|
channelname = recvPacket.ReadString(channelLen);
|
||||||
|
|
||||||
if (!normalizePlayerName(newp))
|
if (!normalizePlayerName(newp))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||||
|
|
@ -143,7 +149,9 @@ void WorldSession::HandleChannelModeratorOpcode(WorldPacket& recvPacket)
|
||||||
channelname = recvPacket.ReadString(channelLen);
|
channelname = recvPacket.ReadString(channelLen);
|
||||||
|
|
||||||
if (!normalizePlayerName(otp))
|
if (!normalizePlayerName(otp))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||||
|
|
@ -163,7 +171,9 @@ void WorldSession::HandleChannelUnmoderatorOpcode(WorldPacket& recvPacket)
|
||||||
channelname = recvPacket.ReadString(channelLen);
|
channelname = recvPacket.ReadString(channelLen);
|
||||||
|
|
||||||
if (!normalizePlayerName(otp))
|
if (!normalizePlayerName(otp))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||||
|
|
@ -183,7 +193,9 @@ void WorldSession::HandleChannelMuteOpcode(WorldPacket& recvPacket)
|
||||||
channelname = recvPacket.ReadString(channelLen);
|
channelname = recvPacket.ReadString(channelLen);
|
||||||
|
|
||||||
if (!normalizePlayerName(otp))
|
if (!normalizePlayerName(otp))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||||
|
|
@ -203,7 +215,9 @@ void WorldSession::HandleChannelUnmuteOpcode(WorldPacket& recvPacket)
|
||||||
channelname = recvPacket.ReadString(channelLen);
|
channelname = recvPacket.ReadString(channelLen);
|
||||||
|
|
||||||
if (!normalizePlayerName(otp))
|
if (!normalizePlayerName(otp))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||||
|
|
@ -223,7 +237,9 @@ void WorldSession::HandleChannelInviteOpcode(WorldPacket& recvPacket)
|
||||||
channelname = recvPacket.ReadString(channelLen);
|
channelname = recvPacket.ReadString(channelLen);
|
||||||
|
|
||||||
if (!normalizePlayerName(otp))
|
if (!normalizePlayerName(otp))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||||
|
|
@ -243,7 +259,9 @@ void WorldSession::HandleChannelKickOpcode(WorldPacket& recvPacket)
|
||||||
otp = recvPacket.ReadString(nameLen);
|
otp = recvPacket.ReadString(nameLen);
|
||||||
|
|
||||||
if (!normalizePlayerName(otp))
|
if (!normalizePlayerName(otp))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||||
|
|
@ -263,7 +281,9 @@ void WorldSession::HandleChannelBanOpcode(WorldPacket& recvPacket)
|
||||||
channelname = recvPacket.ReadString(channelLen);
|
channelname = recvPacket.ReadString(channelLen);
|
||||||
|
|
||||||
if (!normalizePlayerName(otp))
|
if (!normalizePlayerName(otp))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||||
|
|
@ -283,7 +303,9 @@ void WorldSession::HandleChannelUnbanOpcode(WorldPacket& recvPacket)
|
||||||
channelname = recvPacket.ReadString(channelLen);
|
channelname = recvPacket.ReadString(channelLen);
|
||||||
|
|
||||||
if (!normalizePlayerName(otp))
|
if (!normalizePlayerName(otp))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
|
||||||
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
if (Channel* chn = cMgr->GetChannel(channelname, _player))
|
||||||
|
|
|
||||||
|
|
@ -567,7 +567,9 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recv_data)
|
||||||
|
|
||||||
// can't delete loaded character
|
// can't delete loaded character
|
||||||
if (sObjectMgr.GetPlayer(guid))
|
if (sObjectMgr.GetPlayer(guid))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 accountId = 0;
|
uint32 accountId = 0;
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
@ -603,7 +605,9 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recv_data)
|
||||||
|
|
||||||
// prevent deleting other players' characters using cheating tools
|
// prevent deleting other players' characters using cheating tools
|
||||||
if (accountId != GetAccountId())
|
if (accountId != GetAccountId())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::string IP_str = GetRemoteAddress();
|
std::string IP_str = GetRemoteAddress();
|
||||||
BASIC_LOG("Account: %d (IP: %s) Delete Character:[%s] (guid: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), lowguid);
|
BASIC_LOG("Account: %d (IP: %s) Delete Character:[%s] (guid: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), lowguid);
|
||||||
|
|
@ -1198,19 +1202,25 @@ void WorldSession::HandleAlterAppearanceOpcode(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
BarberShopStyleEntry const* bs_skinTone = sBarberShopStyleStore.LookupEntry(skinTone);
|
BarberShopStyleEntry const* bs_skinTone = sBarberShopStyleStore.LookupEntry(skinTone);
|
||||||
if (!bs_skinTone || bs_skinTone->type != 3 || bs_skinTone->race != _player->getRace() || bs_skinTone->gender != _player->getGender())
|
if (!bs_skinTone || bs_skinTone->type != 3 || bs_skinTone->race != _player->getRace() || bs_skinTone->gender != _player->getGender())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
skinTone_id = bs_skinTone->hair_id;
|
skinTone_id = bs_skinTone->hair_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
BarberShopStyleEntry const* bs_hair = sBarberShopStyleStore.LookupEntry(Hair);
|
BarberShopStyleEntry const* bs_hair = sBarberShopStyleStore.LookupEntry(Hair);
|
||||||
|
|
||||||
if (!bs_hair || bs_hair->type != 0 || bs_hair->race != _player->getRace() || bs_hair->gender != _player->getGender())
|
if (!bs_hair || bs_hair->type != 0 || bs_hair->race != _player->getRace() || bs_hair->gender != _player->getGender())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
BarberShopStyleEntry const* bs_facialHair = sBarberShopStyleStore.LookupEntry(FacialHair);
|
BarberShopStyleEntry const* bs_facialHair = sBarberShopStyleStore.LookupEntry(FacialHair);
|
||||||
|
|
||||||
if (!bs_facialHair || bs_facialHair->type != 2 || bs_facialHair->race != _player->getRace() || bs_facialHair->gender != _player->getGender())
|
if (!bs_facialHair || bs_facialHair->type != 2 || bs_facialHair->race != _player->getRace() || bs_facialHair->gender != _player->getGender())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 Cost = _player->GetBarberShopCost(bs_hair->hair_id, Color, bs_facialHair->hair_id, skinTone_id);
|
uint32 Cost = _player->GetBarberShopCost(bs_hair->hair_id, Color, bs_facialHair->hair_id, skinTone_id);
|
||||||
|
|
||||||
|
|
@ -1371,7 +1381,9 @@ void WorldSession::HandleEquipmentSetSaveOpcode(WorldPacket& recv_data)
|
||||||
recv_data >> iconName;
|
recv_data >> iconName;
|
||||||
|
|
||||||
if (index >= MAX_EQUIPMENT_SET_INDEX) // client set slots amount
|
if (index >= MAX_EQUIPMENT_SET_INDEX) // client set slots amount
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
EquipmentSet eqSet;
|
EquipmentSet eqSet;
|
||||||
|
|
||||||
|
|
@ -1397,10 +1409,14 @@ void WorldSession::HandleEquipmentSetSaveOpcode(WorldPacket& recv_data)
|
||||||
Item* item = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
|
Item* item = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
|
||||||
|
|
||||||
if (!item && itemGuid) // cheating check 1
|
if (!item && itemGuid) // cheating check 1
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (item && item->GetObjectGuid() != itemGuid) // cheating check 2
|
if (item && item->GetObjectGuid() != itemGuid) // cheating check 2
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
eqSet.Items[i] = itemGuid.GetCounter();
|
eqSet.Items[i] = itemGuid.GetCounter();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -128,7 +128,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
// Disabled addon channel?
|
// Disabled addon channel?
|
||||||
if (!sWorld.getConfig(CONFIG_BOOL_ADDON_CHANNEL))
|
if (!sWorld.getConfig(CONFIG_BOOL_ADDON_CHANNEL))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// LANG_ADDON should not be changed nor be affected by flood control
|
// LANG_ADDON should not be changed nor be affected by flood control
|
||||||
else
|
else
|
||||||
|
|
@ -203,7 +205,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
break;
|
break;
|
||||||
|
|
@ -212,7 +216,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg))
|
if (!sEluna->OnChat(GetPlayer(), type, lang, msg))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
#endif /* ENABLE_ELUNA */
|
#endif /* ENABLE_ELUNA */
|
||||||
GetPlayer()->Say(msg, lang);
|
GetPlayer()->Say(msg, lang);
|
||||||
}
|
}
|
||||||
|
|
@ -220,7 +226,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
if (!sEluna->OnChat(GetPlayer(), type, LANG_UNIVERSAL, msg))
|
if (!sEluna->OnChat(GetPlayer(), type, LANG_UNIVERSAL, msg))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
#endif /* ENABLE_ELUNA */
|
#endif /* ENABLE_ELUNA */
|
||||||
GetPlayer()->TextEmote(msg);
|
GetPlayer()->TextEmote(msg);
|
||||||
}
|
}
|
||||||
|
|
@ -228,7 +236,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg))
|
if (!sEluna->OnChat(GetPlayer(), type, lang, msg))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
#endif /* ENABLE_ELUNA */
|
#endif /* ENABLE_ELUNA */
|
||||||
GetPlayer()->Yell(msg, lang);
|
GetPlayer()->Yell(msg, lang);
|
||||||
}
|
}
|
||||||
|
|
@ -284,7 +294,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
// Used by Eluna
|
// Used by Eluna
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, player))
|
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, player))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
#endif /* ENABLE_ELUNA */
|
#endif /* ENABLE_ELUNA */
|
||||||
GetPlayer()->Whisper(msg, lang, player->GetObjectGuid());
|
GetPlayer()->Whisper(msg, lang, player->GetObjectGuid());
|
||||||
} break;
|
} break;
|
||||||
|
|
@ -302,7 +314,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
break;
|
break;
|
||||||
|
|
@ -313,15 +327,21 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
group = _player->GetGroup();
|
group = _player->GetGroup();
|
||||||
if (!group || group->isBGGroup())
|
if (!group || group->isBGGroup())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((type == CHAT_MSG_PARTY_LEADER) && !group->IsLeader(_player->GetObjectGuid()))
|
if ((type == CHAT_MSG_PARTY_LEADER) && !group->IsLeader(_player->GetObjectGuid()))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
// Used by Eluna
|
// Used by Eluna
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
#endif /* ENABLE_ELUNA */
|
#endif /* ENABLE_ELUNA */
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
|
|
@ -342,7 +362,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
break;
|
break;
|
||||||
|
|
@ -353,7 +375,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
// Used by Eluna
|
// Used by Eluna
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, guild))
|
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, guild))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
#endif /* ENABLE_ELUNA */
|
#endif /* ENABLE_ELUNA */
|
||||||
|
|
||||||
guild->BroadcastToGuild(this, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL);
|
guild->BroadcastToGuild(this, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL);
|
||||||
|
|
@ -373,7 +397,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
break;
|
break;
|
||||||
|
|
@ -384,7 +410,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
// Used by Eluna
|
// Used by Eluna
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, guild))
|
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, guild))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
#endif /* ENABLE_ELUNA */
|
#endif /* ENABLE_ELUNA */
|
||||||
|
|
||||||
guild->BroadcastToOfficers(this, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL);
|
guild->BroadcastToOfficers(this, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL);
|
||||||
|
|
@ -404,7 +432,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
break;
|
break;
|
||||||
|
|
@ -415,13 +445,17 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
group = GetPlayer()->GetGroup();
|
group = GetPlayer()->GetGroup();
|
||||||
if (!group || group->isBGGroup() || !group->isRaidGroup())
|
if (!group || group->isBGGroup() || !group->isRaidGroup())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used by Eluna
|
// Used by Eluna
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
#endif /* ENABLE_ELUNA */
|
#endif /* ENABLE_ELUNA */
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
|
|
@ -440,7 +474,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
break;
|
break;
|
||||||
|
|
@ -451,13 +487,17 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
group = GetPlayer()->GetGroup();
|
group = GetPlayer()->GetGroup();
|
||||||
if (!group || group->isBGGroup() || !group->isRaidGroup() || !group->IsLeader(_player->GetObjectGuid()))
|
if (!group || group->isBGGroup() || !group->isRaidGroup() || !group->IsLeader(_player->GetObjectGuid()))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used by Eluna
|
// Used by Eluna
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
#endif /* ENABLE_ELUNA */
|
#endif /* ENABLE_ELUNA */
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
|
|
@ -471,7 +511,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
msg = recv_data.ReadString(recv_data.ReadBits(9));
|
msg = recv_data.ReadString(recv_data.ReadBits(9));
|
||||||
|
|
||||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
break;
|
break;
|
||||||
|
|
@ -484,7 +526,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
// Used by Eluna
|
// Used by Eluna
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
#endif /* ENABLE_ELUNA */
|
#endif /* ENABLE_ELUNA */
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
|
|
@ -499,7 +543,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
msg = recv_data.ReadString(recv_data.ReadBits(9));
|
msg = recv_data.ReadString(recv_data.ReadBits(9));
|
||||||
|
|
||||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
break;
|
break;
|
||||||
|
|
@ -507,12 +553,16 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
// battleground raid is always in Player->GetGroup(), never in GetOriginalGroup()
|
// battleground raid is always in Player->GetGroup(), never in GetOriginalGroup()
|
||||||
Group* group = GetPlayer()->GetGroup();
|
Group* group = GetPlayer()->GetGroup();
|
||||||
if (!group || !group->isBGGroup())
|
if (!group || !group->isBGGroup())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Used by Eluna
|
// Used by Eluna
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
#endif /* ENABLE_ELUNA */
|
#endif /* ENABLE_ELUNA */
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
|
|
@ -526,7 +576,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
msg = recv_data.ReadString(recv_data.ReadBits(9));
|
msg = recv_data.ReadString(recv_data.ReadBits(9));
|
||||||
|
|
||||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
break;
|
break;
|
||||||
|
|
@ -534,12 +586,16 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
// battleground raid is always in Player->GetGroup(), never in GetOriginalGroup()
|
// battleground raid is always in Player->GetGroup(), never in GetOriginalGroup()
|
||||||
Group* group = GetPlayer()->GetGroup();
|
Group* group = GetPlayer()->GetGroup();
|
||||||
if (!group || !group->isBGGroup() || !group->IsLeader(GetPlayer()->GetObjectGuid()))
|
if (!group || !group->isBGGroup() || !group->IsLeader(GetPlayer()->GetObjectGuid()))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Used by Eluna
|
// Used by Eluna
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
#endif /* ENABLE_ELUNA */
|
#endif /* ENABLE_ELUNA */
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
|
|
@ -556,7 +612,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
channel = recv_data.ReadString(channelLength);
|
channel = recv_data.ReadString(channelLength);
|
||||||
|
|
||||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (msg.empty())
|
if (msg.empty())
|
||||||
break;
|
break;
|
||||||
|
|
@ -568,7 +626,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
// Used by Eluna
|
// Used by Eluna
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, chn))
|
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, chn))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
#endif /* ENABLE_ELUNA */
|
#endif /* ENABLE_ELUNA */
|
||||||
chn->Say(_player, msg.c_str(), lang);
|
chn->Say(_player, msg.c_str(), lang);
|
||||||
}
|
}
|
||||||
|
|
@ -602,7 +662,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
// Used by Eluna
|
// Used by Eluna
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg))
|
if (!sEluna->OnChat(GetPlayer(), type, lang, msg))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
#endif /* ENABLE_ELUNA */
|
#endif /* ENABLE_ELUNA */
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -631,7 +693,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
||||||
// Used by Eluna
|
// Used by Eluna
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg))
|
if (!sEluna->OnChat(GetPlayer(), type, lang, msg))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
#endif /* ENABLE_ELUNA */
|
#endif /* ENABLE_ELUNA */
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
@ -663,7 +727,9 @@ void WorldSession::HandleAddonMessagechatOpcode(WorldPacket& recv_data)
|
||||||
|
|
||||||
// Disabled addon channel?
|
// Disabled addon channel?
|
||||||
if (!sWorld.getConfig(CONFIG_BOOL_ADDON_CHANNEL))
|
if (!sWorld.getConfig(CONFIG_BOOL_ADDON_CHANNEL))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
|
@ -676,7 +742,9 @@ void WorldSession::HandleAddonMessagechatOpcode(WorldPacket& recv_data)
|
||||||
|
|
||||||
Group* group = _player->GetGroup();
|
Group* group = _player->GetGroup();
|
||||||
if (!group || !group->isBGGroup())
|
if (!group || !group->isBGGroup())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
ChatHandler::BuildChatPacket(data, type, msg.c_str(), LANG_ADDON);
|
ChatHandler::BuildChatPacket(data, type, msg.c_str(), LANG_ADDON);
|
||||||
|
|
@ -758,7 +826,9 @@ void WorldSession::HandleAddonMessagechatOpcode(WorldPacket& recv_data)
|
||||||
void WorldSession::HandleEmoteOpcode(WorldPacket& recv_data)
|
void WorldSession::HandleEmoteOpcode(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
if (!GetPlayer()->IsAlive() || GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
if (!GetPlayer()->IsAlive() || GetPlayer()->hasUnitState(UNIT_STAT_DIED))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 emote;
|
uint32 emote;
|
||||||
recv_data >> emote;
|
recv_data >> emote;
|
||||||
|
|
@ -808,7 +878,9 @@ namespace MaNGOS
|
||||||
void WorldSession::HandleTextEmoteOpcode(WorldPacket& recv_data)
|
void WorldSession::HandleTextEmoteOpcode(WorldPacket& recv_data)
|
||||||
{
|
{
|
||||||
if (!GetPlayer()->IsAlive())
|
if (!GetPlayer()->IsAlive())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!GetPlayer()->CanSpeak())
|
if (!GetPlayer()->CanSpeak())
|
||||||
{
|
{
|
||||||
|
|
@ -831,7 +903,9 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket& recv_data)
|
||||||
|
|
||||||
EmotesTextEntry const* em = sEmotesTextStore.LookupEntry(text_emote);
|
EmotesTextEntry const* em = sEmotesTextStore.LookupEntry(text_emote);
|
||||||
if (!em)
|
if (!em)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 emote_id = em->textid;
|
uint32 emote_id = em->textid;
|
||||||
|
|
||||||
|
|
@ -882,7 +956,9 @@ void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recv_data)
|
||||||
|
|
||||||
Player* player = sObjectMgr.GetPlayer(iguid);
|
Player* player = sObjectMgr.GetPlayer(iguid);
|
||||||
if (!player || !player->GetSession())
|
if (!player || !player->GetSession())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_IGNORED, _player->GetName(), LANG_UNIVERSAL, CHAT_TAG_NONE, _player->GetObjectGuid());
|
ChatHandler::BuildChatPacket(data, CHAT_MSG_IGNORED, _player->GetName(), LANG_UNIVERSAL, CHAT_TAG_NONE, _player->GetObjectGuid());
|
||||||
|
|
|
||||||
|
|
@ -284,15 +284,21 @@ bool CreatureLinkingMgr::IsLinkedEventTrigger(Creature* pCreature) const
|
||||||
{
|
{
|
||||||
// Entry case
|
// Entry case
|
||||||
if (m_eventTriggers.find(pCreature->GetEntry()) != m_eventTriggers.end())
|
if (m_eventTriggers.find(pCreature->GetEntry()) != m_eventTriggers.end())
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Guid case
|
// Guid case
|
||||||
if (m_eventGuidTriggers.find(pCreature->GetGUIDLow()) != m_eventGuidTriggers.end())
|
if (m_eventGuidTriggers.find(pCreature->GetGUIDLow()) != m_eventGuidTriggers.end())
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Also return true for npcs that trigger reverse actions, or for followers(needed in respawn)
|
// Also return true for npcs that trigger reverse actions, or for followers(needed in respawn)
|
||||||
if (CreatureLinkingInfo const* pInfo = GetLinkedTriggerInformation(pCreature))
|
if (CreatureLinkingInfo const* pInfo = GetLinkedTriggerInformation(pCreature))
|
||||||
|
{
|
||||||
return pInfo->linkingFlag & EVENT_MASK_TRIGGER_TO;
|
return pInfo->linkingFlag & EVENT_MASK_TRIGGER_TO;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -332,7 +338,9 @@ CreatureLinkingInfo const* CreatureLinkingMgr::GetLinkedTriggerInformation(uint3
|
||||||
for (CreatureLinkingMap::const_iterator iter = bounds.first; iter != bounds.second; ++iter)
|
for (CreatureLinkingMap::const_iterator iter = bounds.first; iter != bounds.second; ++iter)
|
||||||
{
|
{
|
||||||
if (iter->second.mapId == mapId)
|
if (iter->second.mapId == mapId)
|
||||||
|
{
|
||||||
return &(iter->second);
|
return &(iter->second);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -343,7 +351,9 @@ void CreatureLinkingHolder::AddSlaveToHolder(Creature* pCreature)
|
||||||
{
|
{
|
||||||
CreatureLinkingInfo const* pInfo = sCreatureLinkingMgr.GetLinkedTriggerInformation(pCreature);
|
CreatureLinkingInfo const* pInfo = sCreatureLinkingMgr.GetLinkedTriggerInformation(pCreature);
|
||||||
if (!pInfo)
|
if (!pInfo)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (pInfo->mapId == INVALID_MAP_ID) // Guid case, store master->slaves for fast access
|
if (pInfo->mapId == INVALID_MAP_ID) // Guid case, store master->slaves for fast access
|
||||||
{
|
{
|
||||||
|
|
@ -397,11 +407,15 @@ void CreatureLinkingHolder::AddSlaveToHolder(Creature* pCreature)
|
||||||
void CreatureLinkingHolder::AddMasterToHolder(Creature* pCreature)
|
void CreatureLinkingHolder::AddMasterToHolder(Creature* pCreature)
|
||||||
{
|
{
|
||||||
if (pCreature->IsPet())
|
if (pCreature->IsPet())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Only add master NPCs (by entry)
|
// Only add master NPCs (by entry)
|
||||||
if (!sCreatureLinkingMgr.IsLinkedMaster(pCreature))
|
if (!sCreatureLinkingMgr.IsLinkedMaster(pCreature))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Check, if already stored
|
// Check, if already stored
|
||||||
BossGuidMapBounds bounds = m_masterGuid.equal_range(pCreature->GetEntry());
|
BossGuidMapBounds bounds = m_masterGuid.equal_range(pCreature->GetEntry());
|
||||||
|
|
@ -417,14 +431,20 @@ void CreatureLinkingHolder::DoCreatureLinkingEvent(CreatureLinkingEvent eventTyp
|
||||||
{
|
{
|
||||||
// This check will be needed in reload case
|
// This check will be needed in reload case
|
||||||
if (!sCreatureLinkingMgr.IsLinkedEventTrigger(pSource))
|
if (!sCreatureLinkingMgr.IsLinkedEventTrigger(pSource))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Ignore atypic behaviour
|
// Ignore atypic behaviour
|
||||||
if (pSource->IsControlledByPlayer())
|
if (pSource->IsControlledByPlayer())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (eventType == LINKING_EVENT_AGGRO && !pEnemy)
|
if (eventType == LINKING_EVENT_AGGRO && !pEnemy)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 eventFlagFilter = 0;
|
uint32 eventFlagFilter = 0;
|
||||||
uint32 reverseEventFlagFilter = 0;
|
uint32 reverseEventFlagFilter = 0;
|
||||||
|
|
@ -477,7 +497,9 @@ void CreatureLinkingHolder::DoCreatureLinkingEvent(CreatureLinkingEvent eventTyp
|
||||||
{
|
{
|
||||||
case LINKING_EVENT_AGGRO:
|
case LINKING_EVENT_AGGRO:
|
||||||
if (pMaster->IsControlledByPlayer())
|
if (pMaster->IsControlledByPlayer())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (pMaster->IsInCombat())
|
if (pMaster->IsInCombat())
|
||||||
pMaster->SetInCombatWith(pEnemy);
|
pMaster->SetInCombatWith(pEnemy);
|
||||||
|
|
@ -505,7 +527,9 @@ void CreatureLinkingHolder::DoCreatureLinkingEvent(CreatureLinkingEvent eventTyp
|
||||||
void CreatureLinkingHolder::ProcessSlaveGuidList(CreatureLinkingEvent eventType, Creature* pSource, uint32 flag, uint16 searchRange, GuidList& slaveGuidList, Unit* pEnemy)
|
void CreatureLinkingHolder::ProcessSlaveGuidList(CreatureLinkingEvent eventType, Creature* pSource, uint32 flag, uint16 searchRange, GuidList& slaveGuidList, Unit* pEnemy)
|
||||||
{
|
{
|
||||||
if (!flag)
|
if (!flag)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (GuidList::iterator slave_itr = slaveGuidList.begin(); slave_itr != slaveGuidList.end();)
|
for (GuidList::iterator slave_itr = slaveGuidList.begin(); slave_itr != slaveGuidList.end();)
|
||||||
{
|
{
|
||||||
|
|
@ -538,7 +562,9 @@ void CreatureLinkingHolder::ProcessSlave(CreatureLinkingEvent eventType, Creatur
|
||||||
if (flag & FLAG_AGGRO_ON_AGGRO)
|
if (flag & FLAG_AGGRO_ON_AGGRO)
|
||||||
{
|
{
|
||||||
if (pSlave->IsControlledByPlayer())
|
if (pSlave->IsControlledByPlayer())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (pSlave->IsInCombat())
|
if (pSlave->IsInCombat())
|
||||||
pSlave->SetInCombatWith(pEnemy);
|
pSlave->SetInCombatWith(pEnemy);
|
||||||
|
|
@ -619,7 +645,9 @@ bool CreatureLinkingHolder::IsSlaveInRangeOfBoss(Creature const* pSlave, Creatur
|
||||||
bool CreatureLinkingHolder::IsSlaveInRangeOfBoss(Creature const* pBoss, float sX, float sY, uint16 searchRange) const
|
bool CreatureLinkingHolder::IsSlaveInRangeOfBoss(Creature const* pBoss, float sX, float sY, uint16 searchRange) const
|
||||||
{
|
{
|
||||||
if (!searchRange)
|
if (!searchRange)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Do some calculations
|
// Do some calculations
|
||||||
float mX, mY, mZ, dx, dy;
|
float mX, mY, mZ, dx, dy;
|
||||||
|
|
@ -643,7 +671,9 @@ bool CreatureLinkingHolder::CanSpawn(Creature* pCreature) const
|
||||||
{
|
{
|
||||||
CreatureLinkingInfo const* pInfo = sCreatureLinkingMgr.GetLinkedTriggerInformation(pCreature);
|
CreatureLinkingInfo const* pInfo = sCreatureLinkingMgr.GetLinkedTriggerInformation(pCreature);
|
||||||
if (!pInfo)
|
if (!pInfo)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
float sx, sy, sz;
|
float sx, sy, sz;
|
||||||
pCreature->GetRespawnCoord(sx, sy, sz);
|
pCreature->GetRespawnCoord(sx, sy, sz);
|
||||||
|
|
@ -666,13 +696,19 @@ bool CreatureLinkingHolder::CanSpawn(uint32 lowGuid, Map* _map, CreatureLinkingI
|
||||||
{
|
{
|
||||||
CreatureData const* data = sObjectMgr.GetCreatureData(lowGuid);
|
CreatureData const* data = sObjectMgr.GetCreatureData(lowGuid);
|
||||||
if (!data)
|
if (!data)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
pInfo = sCreatureLinkingMgr.GetLinkedTriggerInformation(data->id, lowGuid, data->mapid);
|
pInfo = sCreatureLinkingMgr.GetLinkedTriggerInformation(data->id, lowGuid, data->mapid);
|
||||||
if (!pInfo)
|
if (!pInfo)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
// Has lowGuid npc actually spawning linked?
|
// Has lowGuid npc actually spawning linked?
|
||||||
if (!sCreatureLinkingMgr.IsSpawnedByLinkedMob(pInfo))
|
if (!sCreatureLinkingMgr.IsSpawnedByLinkedMob(pInfo))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
sx = data->posX; // Fill position data
|
sx = data->posX; // Fill position data
|
||||||
sy = data->posY;
|
sy = data->posY;
|
||||||
|
|
@ -684,11 +720,17 @@ bool CreatureLinkingHolder::CanSpawn(uint32 lowGuid, Map* _map, CreatureLinkingI
|
||||||
return false; // This should never happen
|
return false; // This should never happen
|
||||||
|
|
||||||
if (pInfo->linkingFlag & FLAG_CANT_SPAWN_IF_BOSS_DEAD)
|
if (pInfo->linkingFlag & FLAG_CANT_SPAWN_IF_BOSS_DEAD)
|
||||||
|
{
|
||||||
return IsRespawnReady(pInfo->masterDBGuid, _map);
|
return IsRespawnReady(pInfo->masterDBGuid, _map);
|
||||||
|
}
|
||||||
else if (pInfo->linkingFlag & FLAG_CANT_SPAWN_IF_BOSS_ALIVE)
|
else if (pInfo->linkingFlag & FLAG_CANT_SPAWN_IF_BOSS_ALIVE)
|
||||||
|
{
|
||||||
return !IsRespawnReady(pInfo->masterDBGuid, _map);
|
return !IsRespawnReady(pInfo->masterDBGuid, _map);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search for nearby master
|
// Search for nearby master
|
||||||
|
|
@ -699,11 +741,17 @@ bool CreatureLinkingHolder::CanSpawn(uint32 lowGuid, Map* _map, CreatureLinkingI
|
||||||
if (pMaster && IsSlaveInRangeOfBoss(pMaster, sx, sy, pInfo->searchRange))
|
if (pMaster && IsSlaveInRangeOfBoss(pMaster, sx, sy, pInfo->searchRange))
|
||||||
{
|
{
|
||||||
if (pInfo->linkingFlag & FLAG_CANT_SPAWN_IF_BOSS_DEAD)
|
if (pInfo->linkingFlag & FLAG_CANT_SPAWN_IF_BOSS_DEAD)
|
||||||
|
{
|
||||||
return pMaster->IsAlive();
|
return pMaster->IsAlive();
|
||||||
|
}
|
||||||
else if (pInfo->linkingFlag & FLAG_CANT_SPAWN_IF_BOSS_ALIVE)
|
else if (pInfo->linkingFlag & FLAG_CANT_SPAWN_IF_BOSS_ALIVE)
|
||||||
|
{
|
||||||
return !pMaster->IsAlive();
|
return !pMaster->IsAlive();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -715,7 +763,9 @@ bool CreatureLinkingHolder::TryFollowMaster(Creature* pCreature)
|
||||||
{
|
{
|
||||||
CreatureLinkingInfo const* pInfo = sCreatureLinkingMgr.GetLinkedTriggerInformation(pCreature);
|
CreatureLinkingInfo const* pInfo = sCreatureLinkingMgr.GetLinkedTriggerInformation(pCreature);
|
||||||
if (!pInfo || !(pInfo->linkingFlag & FLAG_FOLLOW))
|
if (!pInfo || !(pInfo->linkingFlag & FLAG_FOLLOW))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Creature* pMaster = NULL;
|
Creature* pMaster = NULL;
|
||||||
if (pInfo->mapId != INVALID_MAP_ID) // entry case
|
if (pInfo->mapId != INVALID_MAP_ID) // entry case
|
||||||
|
|
|
||||||
|
|
@ -282,11 +282,15 @@ bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags
|
||||||
{
|
{
|
||||||
MANGOS_ASSERT(type < MAX_DISABLE_TYPES);
|
MANGOS_ASSERT(type < MAX_DISABLE_TYPES);
|
||||||
if (m_DisableMap[type].empty())
|
if (m_DisableMap[type].empty())
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
DisableTypeMap::iterator itr = m_DisableMap[type].find(entry);
|
DisableTypeMap::iterator itr = m_DisableMap[type].find(entry);
|
||||||
if (itr == m_DisableMap[type].end()) // not disabled
|
if (itr == m_DisableMap[type].end()) // not disabled
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
|
@ -324,9 +328,13 @@ bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (spellFlags & SPELL_DISABLE_DEPRECATED_SPELL) // call not from spellcast
|
else if (spellFlags & SPELL_DISABLE_DEPRECATED_SPELL) // call not from spellcast
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
else if (flags & SPELL_DISABLE_LOS)
|
else if (flags & SPELL_DISABLE_LOS)
|
||||||
|
{
|
||||||
return (spellFlags & SPELL_DISABLE_LOS) != 0;
|
return (spellFlags & SPELL_DISABLE_LOS) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -358,9 +366,13 @@ bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags
|
||||||
return false;
|
return false;
|
||||||
case DISABLE_TYPE_QUEST:
|
case DISABLE_TYPE_QUEST:
|
||||||
if (!unit)
|
if (!unit)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
if (Player const* player = unit->ToPlayer())
|
if (Player const* player = unit->ToPlayer())
|
||||||
|
{
|
||||||
return !player->isGameMaster();
|
return !player->isGameMaster();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
case DISABLE_TYPE_BATTLEGROUND:
|
case DISABLE_TYPE_BATTLEGROUND:
|
||||||
case DISABLE_TYPE_OUTDOORPVP:
|
case DISABLE_TYPE_OUTDOORPVP:
|
||||||
|
|
|
||||||
|
|
@ -36,13 +36,17 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
|
||||||
recvPacket >> guid;
|
recvPacket >> guid;
|
||||||
|
|
||||||
if (!GetPlayer()->duel) // ignore accept from duel-sender
|
if (!GetPlayer()->duel) // ignore accept from duel-sender
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Player* pl = GetPlayer();
|
Player* pl = GetPlayer();
|
||||||
Player* plTarget = pl->duel->opponent;
|
Player* plTarget = pl->duel->opponent;
|
||||||
|
|
||||||
if (pl == pl->duel->initiator || !plTarget || pl == plTarget || pl->duel->startTime != 0 || plTarget->duel->startTime != 0)
|
if (pl == pl->duel->initiator || !plTarget || pl == plTarget || pl->duel->startTime != 0 || plTarget->duel->startTime != 0)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "WORLD: received CMSG_DUEL_ACCEPTED");
|
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "WORLD: received CMSG_DUEL_ACCEPTED");
|
||||||
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "Player 1 is: %u (%s)", pl->GetGUIDLow(), pl->GetName());
|
DEBUG_FILTER_LOG(LOG_FILTER_COMBAT, "Player 1 is: %u (%s)", pl->GetGUIDLow(), pl->GetName());
|
||||||
|
|
@ -62,7 +66,9 @@ void WorldSession::HandleDuelCancelledOpcode(WorldPacket& recvPacket)
|
||||||
|
|
||||||
// no duel requested
|
// no duel requested
|
||||||
if (!GetPlayer()->duel)
|
if (!GetPlayer()->duel)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// player surrendered in a duel using /forfeit
|
// player surrendered in a duel using /forfeit
|
||||||
if (GetPlayer()->duel->startTime != 0)
|
if (GetPlayer()->duel->startTime != 0)
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,9 @@ bool GameEventMgr::CheckOneGameEvent(uint16 entry, time_t currenttime) const
|
||||||
((currenttime - mGameEvent[entry].start) % (mGameEvent[entry].occurence * MINUTE)) < (mGameEvent[entry].length * MINUTE))
|
((currenttime - mGameEvent[entry].start) % (mGameEvent[entry].occurence * MINUTE)) < (mGameEvent[entry].length * MINUTE))
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 GameEventMgr::NextCheck(uint16 entry) const
|
uint32 GameEventMgr::NextCheck(uint16 entry) const
|
||||||
|
|
@ -58,11 +60,15 @@ uint32 GameEventMgr::NextCheck(uint16 entry) const
|
||||||
|
|
||||||
// outdated event: we return max
|
// outdated event: we return max
|
||||||
if (currenttime > mGameEvent[entry].end)
|
if (currenttime > mGameEvent[entry].end)
|
||||||
|
{
|
||||||
return max_ge_check_delay;
|
return max_ge_check_delay;
|
||||||
|
}
|
||||||
|
|
||||||
// never started event, we return delay before start
|
// never started event, we return delay before start
|
||||||
if (mGameEvent[entry].start > currenttime)
|
if (mGameEvent[entry].start > currenttime)
|
||||||
|
{
|
||||||
return uint32(mGameEvent[entry].start - currenttime);
|
return uint32(mGameEvent[entry].start - currenttime);
|
||||||
|
}
|
||||||
|
|
||||||
uint32 delay;
|
uint32 delay;
|
||||||
// in event, we return the end of it
|
// in event, we return the end of it
|
||||||
|
|
@ -73,9 +79,13 @@ uint32 GameEventMgr::NextCheck(uint16 entry) const
|
||||||
delay = (mGameEvent[entry].occurence * MINUTE) - ((currenttime - mGameEvent[entry].start) % (mGameEvent[entry].occurence * MINUTE));
|
delay = (mGameEvent[entry].occurence * MINUTE) - ((currenttime - mGameEvent[entry].start) % (mGameEvent[entry].occurence * MINUTE));
|
||||||
// In case the end is before next check
|
// In case the end is before next check
|
||||||
if (mGameEvent[entry].end < time_t(currenttime + delay))
|
if (mGameEvent[entry].end < time_t(currenttime + delay))
|
||||||
|
{
|
||||||
return uint32(mGameEvent[entry].end - currenttime);
|
return uint32(mGameEvent[entry].end - currenttime);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return delay;
|
return delay;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameEventMgr::StartEvent(uint16 event_id, bool overwrite /*=false*/, bool resume /*=false*/)
|
void GameEventMgr::StartEvent(uint16 event_id, bool overwrite /*=false*/, bool resume /*=false*/)
|
||||||
|
|
@ -884,11 +894,15 @@ GameEventCreatureData const* GameEventMgr::GetCreatureUpdateDataForActiveEvent(u
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!event_id)
|
if (!event_id)
|
||||||
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
for (GameEventCreatureDataList::const_iterator itr = mGameEventCreatureData[event_id].begin(); itr != mGameEventCreatureData[event_id].end(); ++itr)
|
for (GameEventCreatureDataList::const_iterator itr = mGameEventCreatureData[event_id].begin(); itr != mGameEventCreatureData[event_id].end(); ++itr)
|
||||||
if (itr->first == lowguid)
|
if (itr->first == lowguid)
|
||||||
|
{
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -1020,7 +1034,9 @@ int16 GameEventMgr::GetGameEventId<Pool>(uint32 guid_or_poolid)
|
||||||
for (uint16 i = 0; i < mGameEventSpawnPoolIds.size(); ++i)
|
for (uint16 i = 0; i < mGameEventSpawnPoolIds.size(); ++i)
|
||||||
for (IdList::const_iterator itr = mGameEventSpawnPoolIds[i].begin(); itr != mGameEventSpawnPoolIds[i].end(); ++itr)
|
for (IdList::const_iterator itr = mGameEventSpawnPoolIds[i].begin(); itr != mGameEventSpawnPoolIds[i].end(); ++itr)
|
||||||
if (*itr == guid_or_poolid)
|
if (*itr == guid_or_poolid)
|
||||||
|
{
|
||||||
return i;
|
return i;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1032,11 +1048,15 @@ GameEventMgr::GameEventMgr()
|
||||||
bool GameEventMgr::IsActiveHoliday(HolidayIds id)
|
bool GameEventMgr::IsActiveHoliday(HolidayIds id)
|
||||||
{
|
{
|
||||||
if (id == HOLIDAY_NONE)
|
if (id == HOLIDAY_NONE)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for (GameEventMgr::ActiveEvents::const_iterator itr = m_ActiveEvents.begin(); itr != m_ActiveEvents.end(); ++itr)
|
for (GameEventMgr::ActiveEvents::const_iterator itr = m_ActiveEvents.begin(); itr != m_ActiveEvents.end(); ++itr)
|
||||||
if (mGameEvent[*itr].holiday_id == id)
|
if (mGameEvent[*itr].holiday_id == id)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,9 @@ void GossipMenu::AddMenuItem(uint8 Icon, int32 itemText, uint32 dtSender, uint32
|
||||||
uint32 GossipMenu::MenuItemSender(unsigned int ItemId)
|
uint32 GossipMenu::MenuItemSender(unsigned int ItemId)
|
||||||
{
|
{
|
||||||
if (ItemId >= m_gItems.size())
|
if (ItemId >= m_gItems.size())
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return m_gItems[ ItemId ].m_gSender;
|
return m_gItems[ ItemId ].m_gSender;
|
||||||
}
|
}
|
||||||
|
|
@ -105,7 +107,9 @@ uint32 GossipMenu::MenuItemSender(unsigned int ItemId)
|
||||||
uint32 GossipMenu::MenuItemAction(unsigned int ItemId)
|
uint32 GossipMenu::MenuItemAction(unsigned int ItemId)
|
||||||
{
|
{
|
||||||
if (ItemId >= m_gItems.size())
|
if (ItemId >= m_gItems.size())
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return m_gItems[ ItemId ].m_gOptionId;
|
return m_gItems[ ItemId ].m_gOptionId;
|
||||||
}
|
}
|
||||||
|
|
@ -113,7 +117,9 @@ uint32 GossipMenu::MenuItemAction(unsigned int ItemId)
|
||||||
bool GossipMenu::MenuItemCoded(unsigned int ItemId)
|
bool GossipMenu::MenuItemCoded(unsigned int ItemId)
|
||||||
{
|
{
|
||||||
if (ItemId >= m_gItems.size())
|
if (ItemId >= m_gItems.size())
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return m_gItems[ ItemId ].m_gCoded;
|
return m_gItems[ ItemId ].m_gCoded;
|
||||||
}
|
}
|
||||||
|
|
@ -356,7 +362,9 @@ void QuestMenu::AddMenuItem(uint32 QuestId, uint8 Icon)
|
||||||
{
|
{
|
||||||
Quest const* qinfo = sObjectMgr.GetQuestTemplate(QuestId);
|
Quest const* qinfo = sObjectMgr.GetQuestTemplate(QuestId);
|
||||||
if (!qinfo)
|
if (!qinfo)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
MANGOS_ASSERT(m_qItems.size() <= GOSSIP_MAX_MENU_ITEMS);
|
MANGOS_ASSERT(m_qItems.size() <= GOSSIP_MAX_MENU_ITEMS);
|
||||||
|
|
||||||
|
|
@ -372,7 +380,9 @@ bool QuestMenu::HasItem(uint32 questid)
|
||||||
{
|
{
|
||||||
for (QuestMenuItemList::const_iterator i = m_qItems.begin(); i != m_qItems.end(); ++i)
|
for (QuestMenuItemList::const_iterator i = m_qItems.begin(); i != m_qItems.end(); ++i)
|
||||||
if (i->m_qId == questid)
|
if (i->m_qId == questid)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,9 @@ struct CoordPair
|
||||||
x_coord -= val;
|
x_coord -= val;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ x_coord = 0; }
|
{
|
||||||
|
x_coord = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator>>(const uint32 val)
|
void operator>>(const uint32 val)
|
||||||
|
|
@ -111,7 +113,9 @@ struct CoordPair
|
||||||
x_coord += val;
|
x_coord += val;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ x_coord = LIMIT - 1; }
|
{
|
||||||
|
x_coord = LIMIT - 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator-=(const uint32 val)
|
void operator-=(const uint32 val)
|
||||||
|
|
@ -121,7 +125,9 @@ struct CoordPair
|
||||||
y_coord -= val;
|
y_coord -= val;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ y_coord = 0; }
|
{
|
||||||
|
y_coord = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator+=(const uint32 val)
|
void operator+=(const uint32 val)
|
||||||
|
|
@ -131,7 +137,9 @@ struct CoordPair
|
||||||
y_coord += val;
|
y_coord += val;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ y_coord = LIMIT - 1; }
|
{
|
||||||
|
y_coord = LIMIT - 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CoordPair& normalize()
|
CoordPair& normalize()
|
||||||
|
|
@ -179,7 +187,9 @@ namespace MaNGOS
|
||||||
c = MAP_HALFSIZE - 0.5;
|
c = MAP_HALFSIZE - 0.5;
|
||||||
}
|
}
|
||||||
else if (c < -(MAP_HALFSIZE - 0.5))
|
else if (c < -(MAP_HALFSIZE - 0.5))
|
||||||
{ c = -(MAP_HALFSIZE - 0.5); }
|
{
|
||||||
|
c = -(MAP_HALFSIZE - 0.5);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool IsValidMapCoord(float c)
|
inline bool IsValidMapCoord(float c)
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,9 @@ bool GridMap::loadData(char* filename)
|
||||||
// Not return error if file not found
|
// Not return error if file not found
|
||||||
FILE* in = fopen(filename, "rb");
|
FILE* in = fopen(filename, "rb");
|
||||||
if (!in)
|
if (!in)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
fread(&header, sizeof(header), 1, in);
|
fread(&header, sizeof(header), 1, in);
|
||||||
if (header.mapMagic == *((uint32 const*)(MAP_MAGIC)) &&
|
if (header.mapMagic == *((uint32 const*)(MAP_MAGIC)) &&
|
||||||
|
|
@ -152,7 +154,9 @@ bool GridMap::loadAreaData(FILE* in, uint32 offset, uint32 /*size*/)
|
||||||
fseek(in, offset, SEEK_SET);
|
fseek(in, offset, SEEK_SET);
|
||||||
fread(&header, sizeof(header), 1, in);
|
fread(&header, sizeof(header), 1, in);
|
||||||
if (header.fourcc != *((uint32 const*)(MAP_AREA_MAGIC)))
|
if (header.fourcc != *((uint32 const*)(MAP_AREA_MAGIC)))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
m_gridArea = header.gridArea;
|
m_gridArea = header.gridArea;
|
||||||
if (!(header.flags & MAP_AREA_NO_AREA))
|
if (!(header.flags & MAP_AREA_NO_AREA))
|
||||||
|
|
@ -170,7 +174,9 @@ bool GridMap::loadHeightData(FILE* in, uint32 offset, uint32 /*size*/)
|
||||||
fseek(in, offset, SEEK_SET);
|
fseek(in, offset, SEEK_SET);
|
||||||
fread(&header, sizeof(header), 1, in);
|
fread(&header, sizeof(header), 1, in);
|
||||||
if (header.fourcc != *((uint32 const*)(MAP_HEIGHT_MAGIC)))
|
if (header.fourcc != *((uint32 const*)(MAP_HEIGHT_MAGIC)))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
m_gridHeight = header.gridHeight;
|
m_gridHeight = header.gridHeight;
|
||||||
if (!(header.flags & MAP_HEIGHT_NO_HEIGHT))
|
if (!(header.flags & MAP_HEIGHT_NO_HEIGHT))
|
||||||
|
|
@ -211,10 +217,14 @@ bool GridMap::loadHeightData(FILE* in, uint32 offset, uint32 /*size*/)
|
||||||
bool GridMap::loadHolesData(FILE* in, uint32 offset, uint32 size)
|
bool GridMap::loadHolesData(FILE* in, uint32 offset, uint32 size)
|
||||||
{
|
{
|
||||||
if (fseek(in, offset, SEEK_SET) != 0)
|
if (fseek(in, offset, SEEK_SET) != 0)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (fread(&m_holes, sizeof(m_holes), 1, in) != 1)
|
if (fread(&m_holes, sizeof(m_holes), 1, in) != 1)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -224,7 +234,9 @@ bool GridMap::loadGridMapLiquidData(FILE* in, uint32 offset, uint32 /*size*/)
|
||||||
fseek(in, offset, SEEK_SET);
|
fseek(in, offset, SEEK_SET);
|
||||||
fread(&header, sizeof(header), 1, in);
|
fread(&header, sizeof(header), 1, in);
|
||||||
if (header.fourcc != *((uint32 const*)(MAP_LIQUID_MAGIC)))
|
if (header.fourcc != *((uint32 const*)(MAP_LIQUID_MAGIC)))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
m_liquidType = header.liquidType;
|
m_liquidType = header.liquidType;
|
||||||
m_liquid_offX = header.offsetX;
|
m_liquid_offX = header.offsetX;
|
||||||
|
|
@ -254,7 +266,9 @@ bool GridMap::loadGridMapLiquidData(FILE* in, uint32 offset, uint32 /*size*/)
|
||||||
uint16 GridMap::getArea(float x, float y)
|
uint16 GridMap::getArea(float x, float y)
|
||||||
{
|
{
|
||||||
if (!m_area_map)
|
if (!m_area_map)
|
||||||
|
{
|
||||||
return m_gridArea;
|
return m_gridArea;
|
||||||
|
}
|
||||||
|
|
||||||
x = 16 * (32 - x / SIZE_OF_GRIDS);
|
x = 16 * (32 - x / SIZE_OF_GRIDS);
|
||||||
y = 16 * (32 - y / SIZE_OF_GRIDS);
|
y = 16 * (32 - y / SIZE_OF_GRIDS);
|
||||||
|
|
@ -283,7 +297,9 @@ bool GridMap::isHole(int row, int col) const
|
||||||
float GridMap::getHeightFromFloat(float x, float y) const
|
float GridMap::getHeightFromFloat(float x, float y) const
|
||||||
{
|
{
|
||||||
if (!m_V8 || !m_V9)
|
if (!m_V8 || !m_V9)
|
||||||
|
{
|
||||||
return INVALID_HEIGHT_VALUE;
|
return INVALID_HEIGHT_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
x = MAP_RESOLUTION * (32 - x / SIZE_OF_GRIDS);
|
x = MAP_RESOLUTION * (32 - x / SIZE_OF_GRIDS);
|
||||||
y = MAP_RESOLUTION * (32 - y / SIZE_OF_GRIDS);
|
y = MAP_RESOLUTION * (32 - y / SIZE_OF_GRIDS);
|
||||||
|
|
@ -296,7 +312,9 @@ float GridMap::getHeightFromFloat(float x, float y) const
|
||||||
y_int &= (MAP_RESOLUTION - 1);
|
y_int &= (MAP_RESOLUTION - 1);
|
||||||
|
|
||||||
if (isHole(x_int, y_int))
|
if (isHole(x_int, y_int))
|
||||||
|
{
|
||||||
return INVALID_HEIGHT_VALUE;
|
return INVALID_HEIGHT_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
// Height stored as: h5 - its v8 grid, h1-h4 - its v9 grid
|
// Height stored as: h5 - its v8 grid, h1-h4 - its v9 grid
|
||||||
// +--------------> X
|
// +--------------> X
|
||||||
|
|
@ -368,7 +386,9 @@ float GridMap::getHeightFromFloat(float x, float y) const
|
||||||
float GridMap::getHeightFromUint8(float x, float y) const
|
float GridMap::getHeightFromUint8(float x, float y) const
|
||||||
{
|
{
|
||||||
if (!m_uint8_V8 || !m_uint8_V9)
|
if (!m_uint8_V8 || !m_uint8_V9)
|
||||||
|
{
|
||||||
return m_gridHeight;
|
return m_gridHeight;
|
||||||
|
}
|
||||||
|
|
||||||
x = MAP_RESOLUTION * (32 - x / SIZE_OF_GRIDS);
|
x = MAP_RESOLUTION * (32 - x / SIZE_OF_GRIDS);
|
||||||
y = MAP_RESOLUTION * (32 - y / SIZE_OF_GRIDS);
|
y = MAP_RESOLUTION * (32 - y / SIZE_OF_GRIDS);
|
||||||
|
|
@ -436,7 +456,9 @@ float GridMap::getHeightFromUint8(float x, float y) const
|
||||||
float GridMap::getHeightFromUint16(float x, float y) const
|
float GridMap::getHeightFromUint16(float x, float y) const
|
||||||
{
|
{
|
||||||
if (!m_uint16_V8 || !m_uint16_V9)
|
if (!m_uint16_V8 || !m_uint16_V9)
|
||||||
|
{
|
||||||
return m_gridHeight;
|
return m_gridHeight;
|
||||||
|
}
|
||||||
|
|
||||||
x = MAP_RESOLUTION * (32 - x / SIZE_OF_GRIDS);
|
x = MAP_RESOLUTION * (32 - x / SIZE_OF_GRIDS);
|
||||||
y = MAP_RESOLUTION * (32 - y / SIZE_OF_GRIDS);
|
y = MAP_RESOLUTION * (32 - y / SIZE_OF_GRIDS);
|
||||||
|
|
@ -504,7 +526,9 @@ float GridMap::getHeightFromUint16(float x, float y) const
|
||||||
float GridMap::getLiquidLevel(float x, float y)
|
float GridMap::getLiquidLevel(float x, float y)
|
||||||
{
|
{
|
||||||
if (!m_liquid_map)
|
if (!m_liquid_map)
|
||||||
|
{
|
||||||
return m_liquidLevel;
|
return m_liquidLevel;
|
||||||
|
}
|
||||||
|
|
||||||
x = MAP_RESOLUTION * (32 - x / SIZE_OF_GRIDS);
|
x = MAP_RESOLUTION * (32 - x / SIZE_OF_GRIDS);
|
||||||
y = MAP_RESOLUTION * (32 - y / SIZE_OF_GRIDS);
|
y = MAP_RESOLUTION * (32 - y / SIZE_OF_GRIDS);
|
||||||
|
|
@ -513,10 +537,14 @@ float GridMap::getLiquidLevel(float x, float y)
|
||||||
int cy_int = ((int)y & (MAP_RESOLUTION - 1)) - m_liquid_offX;
|
int cy_int = ((int)y & (MAP_RESOLUTION - 1)) - m_liquid_offX;
|
||||||
|
|
||||||
if (cx_int < 0 || cx_int >= m_liquid_height)
|
if (cx_int < 0 || cx_int >= m_liquid_height)
|
||||||
|
{
|
||||||
return INVALID_HEIGHT_VALUE;
|
return INVALID_HEIGHT_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (cy_int < 0 || cy_int >= m_liquid_width)
|
if (cy_int < 0 || cy_int >= m_liquid_width)
|
||||||
|
{
|
||||||
return INVALID_HEIGHT_VALUE;
|
return INVALID_HEIGHT_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
return m_liquid_map[cx_int * m_liquid_width + cy_int];
|
return m_liquid_map[cx_int * m_liquid_width + cy_int];
|
||||||
}
|
}
|
||||||
|
|
@ -524,7 +552,9 @@ float GridMap::getLiquidLevel(float x, float y)
|
||||||
uint8 GridMap::getTerrainType(float x, float y)
|
uint8 GridMap::getTerrainType(float x, float y)
|
||||||
{
|
{
|
||||||
if (!m_liquidFlags)
|
if (!m_liquidFlags)
|
||||||
|
{
|
||||||
return (uint8)m_liquidType;
|
return (uint8)m_liquidType;
|
||||||
|
}
|
||||||
|
|
||||||
x = 16 * (32 - x / SIZE_OF_GRIDS);
|
x = 16 * (32 - x / SIZE_OF_GRIDS);
|
||||||
y = 16 * (32 - y / SIZE_OF_GRIDS);
|
y = 16 * (32 - y / SIZE_OF_GRIDS);
|
||||||
|
|
@ -538,7 +568,9 @@ GridMapLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 Re
|
||||||
{
|
{
|
||||||
// Check water type (if no water return)
|
// Check water type (if no water return)
|
||||||
if (!m_liquidFlags && !m_liquidType)
|
if (!m_liquidFlags && !m_liquidType)
|
||||||
|
{
|
||||||
return LIQUID_MAP_NO_WATER;
|
return LIQUID_MAP_NO_WATER;
|
||||||
|
}
|
||||||
|
|
||||||
// Get cell
|
// Get cell
|
||||||
float cx = MAP_RESOLUTION * (32 - x / SIZE_OF_GRIDS);
|
float cx = MAP_RESOLUTION * (32 - x / SIZE_OF_GRIDS);
|
||||||
|
|
@ -585,21 +617,29 @@ GridMapLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 Re
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == 0)
|
if (type == 0)
|
||||||
|
{
|
||||||
return LIQUID_MAP_NO_WATER;
|
return LIQUID_MAP_NO_WATER;
|
||||||
|
}
|
||||||
|
|
||||||
// Check req liquid type mask
|
// Check req liquid type mask
|
||||||
if (ReqLiquidType && !(ReqLiquidType & type))
|
if (ReqLiquidType && !(ReqLiquidType & type))
|
||||||
|
{
|
||||||
return LIQUID_MAP_NO_WATER;
|
return LIQUID_MAP_NO_WATER;
|
||||||
|
}
|
||||||
|
|
||||||
// Check water level:
|
// Check water level:
|
||||||
// Check water height map
|
// Check water height map
|
||||||
int lx_int = x_int - m_liquid_offY;
|
int lx_int = x_int - m_liquid_offY;
|
||||||
if (lx_int < 0 || lx_int >= m_liquid_height)
|
if (lx_int < 0 || lx_int >= m_liquid_height)
|
||||||
|
{
|
||||||
return LIQUID_MAP_NO_WATER;
|
return LIQUID_MAP_NO_WATER;
|
||||||
|
}
|
||||||
|
|
||||||
int ly_int = y_int - m_liquid_offX;
|
int ly_int = y_int - m_liquid_offX;
|
||||||
if (ly_int < 0 || ly_int >= m_liquid_width)
|
if (ly_int < 0 || ly_int >= m_liquid_width)
|
||||||
|
{
|
||||||
return LIQUID_MAP_NO_WATER;
|
return LIQUID_MAP_NO_WATER;
|
||||||
|
}
|
||||||
|
|
||||||
// Get water level
|
// Get water level
|
||||||
float liquid_level = m_liquid_map ? m_liquid_map[lx_int * m_liquid_width + ly_int] : m_liquidLevel;
|
float liquid_level = m_liquid_map ? m_liquid_map[lx_int * m_liquid_width + ly_int] : m_liquidLevel;
|
||||||
|
|
@ -609,7 +649,9 @@ GridMapLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 Re
|
||||||
|
|
||||||
// Check water level and ground level
|
// Check water level and ground level
|
||||||
if (liquid_level < ground_level || z < ground_level - 2)
|
if (liquid_level < ground_level || z < ground_level - 2)
|
||||||
|
{
|
||||||
return LIQUID_MAP_NO_WATER;
|
return LIQUID_MAP_NO_WATER;
|
||||||
|
}
|
||||||
|
|
||||||
// All ok in water -> store data
|
// All ok in water -> store data
|
||||||
if (data)
|
if (data)
|
||||||
|
|
@ -625,13 +667,19 @@ GridMapLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 Re
|
||||||
|
|
||||||
// Get position delta
|
// Get position delta
|
||||||
if (delta > 20) // Under water
|
if (delta > 20) // Under water
|
||||||
|
{
|
||||||
return LIQUID_MAP_UNDER_WATER;
|
return LIQUID_MAP_UNDER_WATER;
|
||||||
|
}
|
||||||
|
|
||||||
if (delta > 0) // In water
|
if (delta > 0) // In water
|
||||||
|
{
|
||||||
return LIQUID_MAP_IN_WATER;
|
return LIQUID_MAP_IN_WATER;
|
||||||
|
}
|
||||||
|
|
||||||
if (delta > -1) // Walk on water
|
if (delta > -1) // Walk on water
|
||||||
|
{
|
||||||
return LIQUID_MAP_WATER_WALK;
|
return LIQUID_MAP_WATER_WALK;
|
||||||
|
}
|
||||||
// Above water
|
// Above water
|
||||||
return LIQUID_MAP_ABOVE_WATER;
|
return LIQUID_MAP_ABOVE_WATER;
|
||||||
}
|
}
|
||||||
|
|
@ -756,7 +804,9 @@ void TerrainInfo::CleanUpGrids(const uint32 diff)
|
||||||
{
|
{
|
||||||
i_timer.Update(diff);
|
i_timer.Update(diff);
|
||||||
if (!i_timer.Passed())
|
if (!i_timer.Passed())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (int y = 0; y < MAX_NUMBER_OF_GRIDS; ++y)
|
for (int y = 0; y < MAX_NUMBER_OF_GRIDS; ++y)
|
||||||
{
|
{
|
||||||
|
|
@ -803,7 +853,9 @@ int TerrainInfo::UnrefGrid(const uint32& x, const uint32& y)
|
||||||
|
|
||||||
LOCK_GUARD _lock(m_refMutex);
|
LOCK_GUARD _lock(m_refMutex);
|
||||||
if (iRef > 0)
|
if (iRef > 0)
|
||||||
|
{
|
||||||
return (iRef -= 1);
|
return (iRef -= 1);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -853,7 +905,9 @@ float TerrainInfo::GetHeightStatic(float x, float y, float z, bool useVmaps/*=tr
|
||||||
|
|
||||||
// we are already under the surface or vmap height above map heigt
|
// we are already under the surface or vmap height above map heigt
|
||||||
if (z < mapHeight || vmapHeight > mapHeight)
|
if (z < mapHeight || vmapHeight > mapHeight)
|
||||||
|
{
|
||||||
return vmapHeight;
|
return vmapHeight;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return mapHeight; // better use .map surface height
|
return mapHeight; // better use .map surface height
|
||||||
}
|
}
|
||||||
|
|
@ -872,9 +926,13 @@ inline bool IsOutdoorWMO(uint32 mogpFlags, int32 adtId, int32 rootId, int32 grou
|
||||||
if (wmoEntry && atEntry)
|
if (wmoEntry && atEntry)
|
||||||
{
|
{
|
||||||
if (atEntry->flags & AREA_FLAG_OUTSIDE)
|
if (atEntry->flags & AREA_FLAG_OUTSIDE)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
if (atEntry->flags & AREA_FLAG_INSIDE)
|
if (atEntry->flags & AREA_FLAG_INSIDE)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
outdoor = mogpFlags & 0x8;
|
outdoor = mogpFlags & 0x8;
|
||||||
|
|
@ -882,7 +940,9 @@ inline bool IsOutdoorWMO(uint32 mogpFlags, int32 adtId, int32 rootId, int32 grou
|
||||||
if (wmoEntry)
|
if (wmoEntry)
|
||||||
{
|
{
|
||||||
if (wmoEntry->Flags & 4)
|
if (wmoEntry->Flags & 4)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if ((wmoEntry->Flags & 2) != 0)
|
if ((wmoEntry->Flags & 2) != 0)
|
||||||
outdoor = false;
|
outdoor = false;
|
||||||
|
|
@ -897,7 +957,9 @@ bool TerrainInfo::IsOutdoors(float x, float y, float z) const
|
||||||
|
|
||||||
// no wmo found? -> outside by default
|
// no wmo found? -> outside by default
|
||||||
if (!GetAreaInfo(x, y, z, mogpFlags, adtId, rootId, groupId))
|
if (!GetAreaInfo(x, y, z, mogpFlags, adtId, rootId, groupId))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
AreaTableEntry const* atEntry = 0;
|
AreaTableEntry const* atEntry = 0;
|
||||||
WMOAreaTableEntry const* wmoEntry = GetWMOAreaTableEntryByTripple(rootId, adtId, groupId);
|
WMOAreaTableEntry const* wmoEntry = GetWMOAreaTableEntryByTripple(rootId, adtId, groupId);
|
||||||
|
|
@ -923,7 +985,9 @@ bool TerrainInfo::GetAreaInfo(float x, float y, float z, uint32& flags, int32& a
|
||||||
float _mapheight = gmap->getHeight(x, y);
|
float _mapheight = gmap->getHeight(x, y);
|
||||||
// z + 2.0f condition taken from GetHeightStatic(), not sure if it's such a great choice...
|
// z + 2.0f condition taken from GetHeightStatic(), not sure if it's such a great choice...
|
||||||
if (z + 2.0f > _mapheight && _mapheight > vmap_z)
|
if (z + 2.0f > _mapheight && _mapheight > vmap_z)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -971,9 +1035,13 @@ uint16 TerrainInfo::GetAreaFlag(float x, float y, float z, bool* isOutdoors) con
|
||||||
uint8 TerrainInfo::GetTerrainType(float x, float y) const
|
uint8 TerrainInfo::GetTerrainType(float x, float y) const
|
||||||
{
|
{
|
||||||
if (GridMap* gmap = const_cast<TerrainInfo*>(this)->GetGrid(x, y))
|
if (GridMap* gmap = const_cast<TerrainInfo*>(this)->GetGrid(x, y))
|
||||||
|
{
|
||||||
return gmap->getTerrainType(x, y);
|
return gmap->getTerrainType(x, y);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 TerrainInfo::GetAreaId(float x, float y, float z) const
|
uint32 TerrainInfo::GetAreaId(float x, float y, float z) const
|
||||||
|
|
@ -1048,11 +1116,17 @@ GridMapLiquidStatus TerrainInfo::getLiquidStatus(float x, float y, float z, uint
|
||||||
|
|
||||||
// Get position delta
|
// Get position delta
|
||||||
if (delta > 20) // Under water
|
if (delta > 20) // Under water
|
||||||
|
{
|
||||||
return LIQUID_MAP_UNDER_WATER;
|
return LIQUID_MAP_UNDER_WATER;
|
||||||
|
}
|
||||||
if (delta > 0) // In water
|
if (delta > 0) // In water
|
||||||
|
{
|
||||||
return LIQUID_MAP_IN_WATER;
|
return LIQUID_MAP_IN_WATER;
|
||||||
|
}
|
||||||
if (delta > -1) // Walk on water
|
if (delta > -1) // Walk on water
|
||||||
|
{
|
||||||
return LIQUID_MAP_WATER_WALK;
|
return LIQUID_MAP_WATER_WALK;
|
||||||
|
}
|
||||||
result = LIQUID_MAP_ABOVE_WATER;
|
result = LIQUID_MAP_ABOVE_WATER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1103,7 +1177,9 @@ bool TerrainInfo::IsSwimmable(float x, float y, float pZ, float radius /*= 1.5f*
|
||||||
if (getLiquidStatus(x, y, pZ, MAP_ALL_LIQUIDS, liquid_ptr))
|
if (getLiquidStatus(x, y, pZ, MAP_ALL_LIQUIDS, liquid_ptr))
|
||||||
{
|
{
|
||||||
if (liquid_ptr->level - liquid_ptr->depth_level > radius) // is unit have enough space to swim
|
if (liquid_ptr->level - liquid_ptr->depth_level > radius) // is unit have enough space to swim
|
||||||
return true;
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1114,7 +1190,9 @@ bool TerrainInfo::IsUnderWater(float x, float y, float z) const
|
||||||
if (const_cast<TerrainInfo*>(this)->GetGrid(x, y))
|
if (const_cast<TerrainInfo*>(this)->GetGrid(x, y))
|
||||||
{
|
{
|
||||||
if (getLiquidStatus(x, y, z, MAP_LIQUID_TYPE_WATER | MAP_LIQUID_TYPE_OCEAN)&LIQUID_MAP_UNDER_WATER)
|
if (getLiquidStatus(x, y, z, MAP_LIQUID_TYPE_WATER | MAP_LIQUID_TYPE_OCEAN)&LIQUID_MAP_UNDER_WATER)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -1228,7 +1306,9 @@ float TerrainInfo::GetWaterLevel(float x, float y, float z, float* pGround /*= N
|
||||||
|
|
||||||
GridMapLiquidStatus res = getLiquidStatus(x, y, ground_z, MAP_ALL_LIQUIDS, &liquid_status);
|
GridMapLiquidStatus res = getLiquidStatus(x, y, ground_z, MAP_ALL_LIQUIDS, &liquid_status);
|
||||||
if (!res)
|
if (!res)
|
||||||
|
{
|
||||||
return VMAP_INVALID_HEIGHT_VALUE;
|
return VMAP_INVALID_HEIGHT_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
return liquid_status.level;
|
return liquid_status.level;
|
||||||
}
|
}
|
||||||
|
|
@ -1272,7 +1352,9 @@ TerrainInfo* TerrainManager::LoadTerrain(const uint32 mapId)
|
||||||
void TerrainManager::UnloadTerrain(const uint32 mapId)
|
void TerrainManager::UnloadTerrain(const uint32 mapId)
|
||||||
{
|
{
|
||||||
if (sWorld.getConfig(CONFIG_BOOL_GRID_UNLOAD) == 0)
|
if (sWorld.getConfig(CONFIG_BOOL_GRID_UNLOAD) == 0)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Guard _guard(*this);
|
Guard _guard(*this);
|
||||||
|
|
||||||
|
|
@ -1309,9 +1391,13 @@ uint32 TerrainManager::GetAreaIdByAreaFlag(uint16 areaflag, uint32 map_id)
|
||||||
AreaTableEntry const* entry = GetAreaEntryByAreaFlagAndMap(areaflag, map_id);
|
AreaTableEntry const* entry = GetAreaEntryByAreaFlagAndMap(areaflag, map_id);
|
||||||
|
|
||||||
if (entry)
|
if (entry)
|
||||||
|
{
|
||||||
return entry->ID;
|
return entry->ID;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 TerrainManager::GetZoneIdByAreaFlag(uint16 areaflag, uint32 map_id)
|
uint32 TerrainManager::GetZoneIdByAreaFlag(uint16 areaflag, uint32 map_id)
|
||||||
|
|
@ -1319,9 +1405,13 @@ uint32 TerrainManager::GetZoneIdByAreaFlag(uint16 areaflag, uint32 map_id)
|
||||||
AreaTableEntry const* entry = GetAreaEntryByAreaFlagAndMap(areaflag, map_id);
|
AreaTableEntry const* entry = GetAreaEntryByAreaFlagAndMap(areaflag, map_id);
|
||||||
|
|
||||||
if (entry)
|
if (entry)
|
||||||
|
{
|
||||||
return (entry->zone != 0) ? entry->zone : entry->ID;
|
return (entry->zone != 0) ? entry->zone : entry->ID;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TerrainManager::GetZoneAndAreaIdByAreaFlag(uint32& zoneid, uint32& areaid, uint16 areaflag, uint32 map_id)
|
void TerrainManager::GetZoneAndAreaIdByAreaFlag(uint32& zoneid, uint32& areaid, uint16 areaflag, uint32 map_id)
|
||||||
|
|
|
||||||
|
|
@ -193,15 +193,21 @@ bool CannibalizeObjectCheck::operator()(Corpse* u)
|
||||||
{
|
{
|
||||||
// ignore bones
|
// ignore bones
|
||||||
if (u->GetType() == CORPSE_BONES)
|
if (u->GetType() == CORPSE_BONES)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Player* owner = ObjectAccessor::FindPlayer(u->GetOwnerGuid());
|
Player* owner = ObjectAccessor::FindPlayer(u->GetOwnerGuid());
|
||||||
|
|
||||||
if (!owner || i_fobj->IsFriendlyTo(owner))
|
if (!owner || i_fobj->IsFriendlyTo(owner))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (i_fobj->IsWithinDistInMap(u, i_range))
|
if (i_fobj->IsWithinDistInMap(u, i_range))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -214,7 +220,9 @@ void MaNGOS::RespawnDo::operator()(Creature* u) const
|
||||||
{
|
{
|
||||||
BattleGroundEventIdx eventId = sBattleGroundMgr.GetCreatureEventIndex(u->GetGUIDLow());
|
BattleGroundEventIdx eventId = sBattleGroundMgr.GetCreatureEventIndex(u->GetGUIDLow());
|
||||||
if (!((BattleGroundMap*)map)->GetBG()->IsActiveEvent(eventId.event1, eventId.event2))
|
if (!((BattleGroundMap*)map)->GetBG()->IsActiveEvent(eventId.event1, eventId.event2))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u->Respawn();
|
u->Respawn();
|
||||||
|
|
@ -228,7 +236,9 @@ void MaNGOS::RespawnDo::operator()(GameObject* u) const
|
||||||
{
|
{
|
||||||
BattleGroundEventIdx eventId = sBattleGroundMgr.GetGameObjectEventIndex(u->GetGUIDLow());
|
BattleGroundEventIdx eventId = sBattleGroundMgr.GetGameObjectEventIndex(u->GetGUIDLow());
|
||||||
if (!((BattleGroundMap*)map)->GetBG()->IsActiveEvent(eventId.event1, eventId.event2))
|
if (!((BattleGroundMap*)map)->GetBG()->IsActiveEvent(eventId.event1, eventId.event2))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u->Respawn();
|
u->Respawn();
|
||||||
|
|
@ -237,18 +247,26 @@ void MaNGOS::RespawnDo::operator()(GameObject* u) const
|
||||||
void MaNGOS::CallOfHelpCreatureInRangeDo::operator()(Creature* u)
|
void MaNGOS::CallOfHelpCreatureInRangeDo::operator()(Creature* u)
|
||||||
{
|
{
|
||||||
if (u == i_funit)
|
if (u == i_funit)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!u->CanAssistTo(i_funit, i_enemy, false))
|
if (!u->CanAssistTo(i_funit, i_enemy, false))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// too far
|
// too far
|
||||||
if (!i_funit->IsWithinDistInMap(u, i_range))
|
if (!i_funit->IsWithinDistInMap(u, i_range))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// only if see assisted creature
|
// only if see assisted creature
|
||||||
if (!i_funit->IsWithinLOSInMap(u))
|
if (!i_funit->IsWithinLOSInMap(u))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (u->AI())
|
if (u->AI())
|
||||||
u->AI()->AttackStart(i_enemy);
|
u->AI()->AttackStart(i_enemy);
|
||||||
|
|
@ -257,18 +275,26 @@ void MaNGOS::CallOfHelpCreatureInRangeDo::operator()(Creature* u)
|
||||||
bool MaNGOS::AnyAssistCreatureInRangeCheck::operator()(Creature* u)
|
bool MaNGOS::AnyAssistCreatureInRangeCheck::operator()(Creature* u)
|
||||||
{
|
{
|
||||||
if (u == i_funit)
|
if (u == i_funit)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!u->CanAssistTo(i_funit, i_enemy))
|
if (!u->CanAssistTo(i_funit, i_enemy))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// too far
|
// too far
|
||||||
if (!i_funit->IsWithinDistInMap(u, i_range))
|
if (!i_funit->IsWithinDistInMap(u, i_range))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// only if see assisted creature
|
// only if see assisted creature
|
||||||
if (!i_funit->IsWithinLOSInMap(u))
|
if (!i_funit->IsWithinLOSInMap(u))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
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