mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19:37:03 +00:00
Apply style fix
This commit is contained in:
parent
5531a0087d
commit
35405dd549
155 changed files with 10968 additions and 3660 deletions
|
|
@ -73,7 +73,9 @@ class ObjectRegistry
|
|||
if (iter != i_registeredObjects.end())
|
||||
{
|
||||
if (!replace)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
delete iter->second;
|
||||
i_registeredObjects.erase(iter);
|
||||
}
|
||||
|
|
@ -94,7 +96,9 @@ class ObjectRegistry
|
|||
if (iter != i_registeredObjects.end())
|
||||
{
|
||||
if (delete_object)
|
||||
{ delete iter->second; }
|
||||
{
|
||||
delete iter->second;
|
||||
}
|
||||
i_registeredObjects.erase(iter);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,7 +131,9 @@ class Grid
|
|||
bool AddGridObject(SPECIFIC_OBJECT* obj)
|
||||
{
|
||||
if (obj->IsActiveObject())
|
||||
{ m_activeGridObjects.insert(obj); }
|
||||
{
|
||||
m_activeGridObjects.insert(obj);
|
||||
}
|
||||
|
||||
return i_container.template insert<SPECIFIC_OBJECT>(obj);
|
||||
}
|
||||
|
|
@ -146,7 +148,9 @@ class Grid
|
|||
bool RemoveGridObject(SPECIFIC_OBJECT* obj)
|
||||
{
|
||||
if (obj->IsActiveObject())
|
||||
{ m_activeGridObjects.erase(obj); }
|
||||
{
|
||||
m_activeGridObjects.erase(obj);
|
||||
}
|
||||
|
||||
return i_container.template remove<SPECIFIC_OBJECT>(obj);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,9 @@ class GridReference : public Reference<GridRefManager<OBJECT>, OBJECT>
|
|||
{
|
||||
// called from unlink()
|
||||
if (this->isValid())
|
||||
{ this->getTarget()->decSize(); }
|
||||
{
|
||||
this->getTarget()->decSize();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -208,7 +208,9 @@ class TypeUnorderedMapContainer
|
|||
{
|
||||
typename UNORDERED_MAP<KEY_TYPE, SPECIFIC_TYPE*>::iterator i = elements._element.find(hdl);
|
||||
if (i == elements._element.end())
|
||||
{ return NULL; }
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{ return i->second; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,7 +137,9 @@ namespace MaNGOS
|
|||
void* p = malloc(sizeof(T));
|
||||
|
||||
if (!p)
|
||||
{ return NULL; }
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return new(p) T;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,19 +82,25 @@ void EventProcessor::KillAllEvents(bool force)
|
|||
delete i_old->second;
|
||||
|
||||
if (!force) // need per-element cleanup
|
||||
{ m_events.erase(i_old); }
|
||||
{
|
||||
m_events.erase(i_old);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// fast clear event list (in force case)
|
||||
if (force)
|
||||
{ m_events.clear(); }
|
||||
{
|
||||
m_events.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void EventProcessor::AddEvent(BasicEvent* Event, uint64 e_time, bool set_addtime)
|
||||
{
|
||||
if (set_addtime)
|
||||
{ Event->m_addTime = m_time; }
|
||||
{
|
||||
Event->m_addTime = m_time;
|
||||
}
|
||||
|
||||
Event->m_execTime = e_time;
|
||||
m_events.insert(std::pair<uint64, BasicEvent*>(e_time, Event));
|
||||
|
|
|
|||
|
|
@ -88,7 +88,9 @@ class Reference : public LinkedListElement
|
|||
{
|
||||
assert(fromObj); // fromObj MUST not be NULL
|
||||
if (isValid())
|
||||
{ unlink(); }
|
||||
{
|
||||
unlink();
|
||||
}
|
||||
|
||||
if (toObj != NULL)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -144,7 +144,9 @@ class AHB_Seller_Config
|
|||
uint32 GetMinTime() const
|
||||
{
|
||||
if (m_minTime < 1)
|
||||
{ return 1; }
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else if ((m_maxTime) && (m_minTime > m_maxTime))
|
||||
{ return m_maxTime; }
|
||||
else
|
||||
|
|
@ -161,7 +163,9 @@ class AHB_Seller_Config
|
|||
void SetMissedItemsPerClass(AuctionQuality quality, ItemClass itemclass, uint32 found)
|
||||
{
|
||||
if (m_ItemInfo[quality].ItemClassInfos[itemclass].AmountOfItems > found)
|
||||
{ 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
|
||||
{ m_ItemInfo[quality].ItemClassInfos[itemclass].MissItems = 0; }
|
||||
}
|
||||
|
|
@ -421,10 +425,14 @@ bool AuctionBotConfig::Initialize()
|
|||
return false;
|
||||
}
|
||||
if ((getConfig(CONFIG_UINT32_AHBOT_ALLIANCE_ITEM_AMOUNT_RATIO) == 0) && (getConfig(CONFIG_UINT32_AHBOT_HORDE_ITEM_AMOUNT_RATIO) == 0) && (getConfig(CONFIG_UINT32_AHBOT_NEUTRAL_ITEM_AMOUNT_RATIO) == 0))
|
||||
{ sLog.outString("AuctionHouseBot SELLER is disabled! (If you want to use it please set config in 'ahbot.conf')"); }
|
||||
{
|
||||
sLog.outString("AuctionHouseBot SELLER is disabled! (If you want to use it please set config in 'ahbot.conf')");
|
||||
}
|
||||
|
||||
if (!getConfig(CONFIG_BOOL_AHBOT_BUYER_ALLIANCE_ENABLED) && !getConfig(CONFIG_BOOL_AHBOT_BUYER_HORDE_ENABLED) && !getConfig(CONFIG_BOOL_AHBOT_BUYER_NEUTRAL_ENABLED))
|
||||
{ sLog.outString("AuctionHouseBot BUYER is disabled! (If you want to use it please set config in 'ahbot.conf')"); }
|
||||
{
|
||||
sLog.outString("AuctionHouseBot BUYER is disabled! (If you want to use it please set config in 'ahbot.conf')");
|
||||
}
|
||||
|
||||
m_ItemsPerCycleBoost = getConfig(CONFIG_UINT32_AHBOT_ITEMS_PER_CYCLE_BOOST);
|
||||
m_ItemsPerCycleNormal = getConfig(CONFIG_UINT32_AHBOT_ITEMS_PER_CYCLE_NORMAL);
|
||||
|
|
@ -439,7 +447,9 @@ void AuctionBotConfig::SetAHBotId(const std::string& BotCharName)
|
|||
{
|
||||
m_BotId = sObjectMgr.GetPlayerGuidByName(BotCharName.c_str()).GetCounter();
|
||||
if (!m_BotId)
|
||||
{ sLog.outError("AHBot uses an invalid character name `%s`", BotCharName.c_str()); }
|
||||
{
|
||||
sLog.outError("AHBot uses an invalid character name `%s`", BotCharName.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -488,7 +498,9 @@ void AuctionBotConfig::GetConfigFromFile()
|
|||
{
|
||||
// Check config file version
|
||||
if (m_AhBotCfg.GetIntDefault("ConfVersion", 0) != AUCTIONHOUSEBOT_CONF_VERSION)
|
||||
{ sLog.outError("AHBot: Configuration file version doesn't match expected version. Some config variables may be wrong or missing."); }
|
||||
{
|
||||
sLog.outError("AHBot: Configuration file version doesn't match expected version. Some config variables may be wrong or missing.");
|
||||
}
|
||||
|
||||
setConfigMax(CONFIG_UINT32_AHBOT_ALLIANCE_ITEM_AMOUNT_RATIO , "AuctionHouseBot.Alliance.Items.Amount.Ratio" , 100, 10000);
|
||||
setConfigMax(CONFIG_UINT32_AHBOT_HORDE_ITEM_AMOUNT_RATIO , "AuctionHouseBot.Horde.Items.Amount.Ratio" , 100, 10000);
|
||||
|
|
@ -664,7 +676,9 @@ bool AuctionBotBuyer::Initialize()
|
|||
}
|
||||
}
|
||||
if (!active_house)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// load Check interval
|
||||
m_CheckInterval = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_BUYER_RECHECK_INTERVAL) * MINUTE;
|
||||
|
|
@ -700,7 +714,9 @@ void AuctionBotBuyer::LoadConfig()
|
|||
{
|
||||
m_HouseConfig[i].BuyerEnabled = sAuctionBotConfig.getConfigBuyerEnabled(AuctionHouseType(i));
|
||||
if (m_HouseConfig[i].BuyerEnabled)
|
||||
{ LoadBuyerValues(m_HouseConfig[i]); }
|
||||
{
|
||||
LoadBuyerValues(m_HouseConfig[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -727,12 +743,16 @@ uint32 AuctionBotBuyer::GetBuyableEntry(AHB_Buyer_Config& config)
|
|||
if (Aentry->buyout != 0)
|
||||
{
|
||||
if (Aentry->buyout / item->GetCount() < buyerItem.MinBuyPrice)
|
||||
{ buyerItem.MinBuyPrice = Aentry->buyout / item->GetCount(); }
|
||||
{
|
||||
buyerItem.MinBuyPrice = Aentry->buyout / item->GetCount();
|
||||
}
|
||||
else if (buyerItem.MinBuyPrice == 0)
|
||||
{ buyerItem.MinBuyPrice = Aentry->buyout / item->GetCount(); }
|
||||
}
|
||||
if (Aentry->startbid / item->GetCount() < buyerItem.MinBidPrice)
|
||||
{ buyerItem.MinBidPrice = Aentry->startbid / item->GetCount(); }
|
||||
{
|
||||
buyerItem.MinBidPrice = Aentry->startbid / item->GetCount();
|
||||
}
|
||||
else if (buyerItem.MinBidPrice == 0)
|
||||
{ buyerItem.MinBidPrice = Aentry->startbid / item->GetCount(); }
|
||||
|
||||
|
|
@ -779,7 +799,9 @@ void AuctionBotBuyer::PrepareListOfEntry(AHB_Buyer_Config& config)
|
|||
for (CheckEntryMap::iterator itr = config.CheckedEntry.begin(); itr != config.CheckedEntry.end();)
|
||||
{
|
||||
if (itr->second.LastExist < (Now - 5))
|
||||
{ config.CheckedEntry.erase(itr++); }
|
||||
{
|
||||
config.CheckedEntry.erase(itr++);
|
||||
}
|
||||
else
|
||||
{ ++itr; }
|
||||
}
|
||||
|
|
@ -794,14 +816,18 @@ bool AuctionBotBuyer::IsBuyableEntry(uint64 buyoutPrice, double InGame_BuyPrice,
|
|||
if (buyoutPrice <= MinBuyPrice)
|
||||
{
|
||||
if (buyoutPrice <= MaxBuyablePrice)
|
||||
{ Chance = MaxChance; }
|
||||
{
|
||||
Chance = MaxChance;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((buyoutPrice > 0) && (MaxBuyablePrice > 0))
|
||||
{
|
||||
double ratio = buyoutPrice / MaxBuyablePrice;
|
||||
if (ratio < 10)
|
||||
{ Chance = MaxChance - (ratio * (MaxChance / 10)); }
|
||||
{
|
||||
Chance = MaxChance - (ratio * (MaxChance / 10));
|
||||
}
|
||||
else { Chance = 1; }
|
||||
}
|
||||
}
|
||||
|
|
@ -809,14 +835,18 @@ bool AuctionBotBuyer::IsBuyableEntry(uint64 buyoutPrice, double InGame_BuyPrice,
|
|||
else if (buyoutPrice <= InGame_BuyPrice)
|
||||
{
|
||||
if (buyoutPrice <= MaxBuyablePrice)
|
||||
{ Chance = MaxChance / 5; }
|
||||
{
|
||||
Chance = MaxChance / 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((buyoutPrice > 0) && (MaxBuyablePrice > 0))
|
||||
{
|
||||
double ratio = buyoutPrice / MaxBuyablePrice;
|
||||
if (ratio < 10)
|
||||
{ Chance = (MaxChance / 5) - (ratio * (MaxChance / 50)); }
|
||||
{
|
||||
Chance = (MaxChance / 5) - (ratio * (MaxChance / 50));
|
||||
}
|
||||
else { Chance = 1; }
|
||||
}
|
||||
}
|
||||
|
|
@ -829,7 +859,9 @@ bool AuctionBotBuyer::IsBuyableEntry(uint64 buyoutPrice, double InGame_BuyPrice,
|
|||
{
|
||||
double ratio = buyoutPrice / MaxBuyablePrice;
|
||||
if (ratio < 10)
|
||||
{ Chance = (MaxChance / 5) - (ratio * (MaxChance / 50)); }
|
||||
{
|
||||
Chance = (MaxChance / 5) - (ratio * (MaxChance / 50));
|
||||
}
|
||||
else { Chance = 0; }
|
||||
}
|
||||
else { Chance = 0; }
|
||||
|
|
@ -852,14 +884,18 @@ bool AuctionBotBuyer::IsBidableEntry(uint64 bidPrice, double InGame_BuyPrice, do
|
|||
if (bidPrice <= MinBidPrice)
|
||||
{
|
||||
if ((InGame_BuyPrice != 0) && (bidPrice < (InGame_BuyPrice - (InGame_BuyPrice / 30))))
|
||||
{ Chance = MaxChance; }
|
||||
{
|
||||
Chance = MaxChance;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bidPrice < MaxBidablePrice)
|
||||
{
|
||||
double ratio = MaxBidablePrice / bidPrice;
|
||||
if (ratio < 3)
|
||||
{ Chance = ((MaxChance / 500) * ratio); }
|
||||
{
|
||||
Chance = ((MaxChance / 500) * ratio);
|
||||
}
|
||||
else
|
||||
{ Chance = (MaxChance / 500); }
|
||||
}
|
||||
|
|
@ -873,7 +909,9 @@ bool AuctionBotBuyer::IsBidableEntry(uint64 bidPrice, double InGame_BuyPrice, do
|
|||
{
|
||||
double ratio = MaxBidablePrice / bidPrice;
|
||||
if (ratio < 4)
|
||||
{ Chance = ((MaxChance / 1000) * ratio); }
|
||||
{
|
||||
Chance = ((MaxChance / 1000) * ratio);
|
||||
}
|
||||
else
|
||||
{ Chance = (MaxChance / 1000); }
|
||||
}
|
||||
|
|
@ -940,7 +978,9 @@ void AuctionBotBuyer::addNewAuctionBuyerBotBid(AHB_Buyer_Config& config)
|
|||
}
|
||||
|
||||
if (BuyCycles == 0)
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
uint32 MaxChance = 5000;
|
||||
|
||||
|
|
@ -1024,12 +1064,16 @@ void AuctionBotBuyer::addNewAuctionBuyerBotBid(AHB_Buyer_Config& config)
|
|||
else
|
||||
{
|
||||
if (IsBidableEntry(bidPriceByItem, InGame_BuyPrice, MaxBidablePrice, minBidPrice, MaxChance / 2, config.FactionChance))
|
||||
{ PlaceBidToEntry(auction, bidPrice); }
|
||||
{
|
||||
PlaceBidToEntry(auction, bidPrice);
|
||||
}
|
||||
}
|
||||
}
|
||||
else // buyout = 0 mean only bid are possible
|
||||
if (IsBidableEntry(bidPriceByItem, InGame_BuyPrice, MaxBidablePrice, minBidPrice, MaxChance, config.FactionChance))
|
||||
{ PlaceBidToEntry(auction, bidPrice); }
|
||||
{
|
||||
PlaceBidToEntry(auction, bidPrice);
|
||||
}
|
||||
|
||||
auctionEval.LastChecked = Now;
|
||||
--BuyCycles;
|
||||
|
|
@ -1044,7 +1088,9 @@ bool AuctionBotBuyer::Update(AuctionHouseType houseType)
|
|||
{
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: %s buying ...", AuctionBotConfig::GetHouseTypeName(houseType));
|
||||
if (GetBuyableEntry(m_HouseConfig[houseType]) > 0)
|
||||
{ addNewAuctionBuyerBotBid(m_HouseConfig[houseType]); }
|
||||
{
|
||||
addNewAuctionBuyerBotBid(m_HouseConfig[houseType]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else { return false; }
|
||||
|
|
@ -1132,7 +1178,9 @@ bool AuctionBotSeller::Initialize()
|
|||
|
||||
uint32 entry = fields[0].GetUInt32();
|
||||
if (!entry)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
lootItems.push_back(fields[0].GetUInt32());
|
||||
}
|
||||
|
|
@ -1159,25 +1207,35 @@ bool AuctionBotSeller::Initialize()
|
|||
bar.step();
|
||||
|
||||
if (!prototype)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// skip items with too high quality (code can't propertly work with its)
|
||||
if (prototype->Quality >= MAX_AUCTION_QUALITY)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// forced exclude filter
|
||||
bool isExcludeItem = false;
|
||||
for (size_t i = 0; (i < excludeItems.size() && (!isExcludeItem)); ++i)
|
||||
if (itemID == excludeItems[i])
|
||||
{ isExcludeItem = true; }
|
||||
{
|
||||
isExcludeItem = true;
|
||||
}
|
||||
if (isExcludeItem)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// forced include filter
|
||||
bool isForcedIncludeItem = false;
|
||||
for (size_t i = 0; (i < includeItems.size() && (!isForcedIncludeItem)); ++i)
|
||||
if (itemID == includeItems[i])
|
||||
{ isForcedIncludeItem = true; }
|
||||
{
|
||||
isForcedIncludeItem = true;
|
||||
}
|
||||
|
||||
if (isForcedIncludeItem)
|
||||
{
|
||||
|
|
@ -1191,23 +1249,33 @@ bool AuctionBotSeller::Initialize()
|
|||
{
|
||||
case NO_BIND:
|
||||
if (!sAuctionBotConfig.getConfig(CONFIG_BOOL_AHBOT_BIND_NO))
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case BIND_WHEN_PICKED_UP:
|
||||
if (!sAuctionBotConfig.getConfig(CONFIG_BOOL_AHBOT_BIND_PICKUP))
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case BIND_WHEN_EQUIPPED:
|
||||
if (!sAuctionBotConfig.getConfig(CONFIG_BOOL_AHBOT_BIND_EQUIP))
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case BIND_WHEN_USE:
|
||||
if (!sAuctionBotConfig.getConfig(CONFIG_BOOL_AHBOT_BIND_USE))
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case BIND_QUEST_ITEM:
|
||||
if (!sAuctionBotConfig.getConfig(CONFIG_BOOL_AHBOT_BIND_QUEST))
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
|
|
@ -1217,12 +1285,16 @@ bool AuctionBotSeller::Initialize()
|
|||
if (sAuctionBotConfig.getConfig(CONFIG_BOOL_AHBOT_BUYPRICE_SELLER))
|
||||
{
|
||||
if (prototype->BuyPrice == 0)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (prototype->SellPrice == 0)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// vendor filter
|
||||
|
|
@ -1231,10 +1303,14 @@ bool AuctionBotSeller::Initialize()
|
|||
bool IsVendorItem = false;
|
||||
for (size_t i = 0; (i < npcItems.size()) && (!IsVendorItem); ++i)
|
||||
if (itemID == npcItems[i])
|
||||
{ IsVendorItem = true; }
|
||||
{
|
||||
IsVendorItem = true;
|
||||
}
|
||||
|
||||
if (IsVendorItem)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// loot filter
|
||||
|
|
@ -1243,9 +1319,13 @@ bool AuctionBotSeller::Initialize()
|
|||
bool isLootItem = false;
|
||||
for (size_t i = 0; (i < lootItems.size()) && (!isLootItem); ++i)
|
||||
if (itemID == lootItems[i])
|
||||
{ isLootItem = true; }
|
||||
{
|
||||
isLootItem = true;
|
||||
}
|
||||
if (isLootItem)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// not vendor/loot filter
|
||||
|
|
@ -1256,14 +1336,20 @@ bool AuctionBotSeller::Initialize()
|
|||
|
||||
for (size_t i = 0; (i < npcItems.size()) && (!IsVendorItem); ++i)
|
||||
if (itemID == npcItems[i])
|
||||
{ IsVendorItem = true; }
|
||||
{
|
||||
IsVendorItem = true;
|
||||
}
|
||||
|
||||
for (size_t i = 0; (i < lootItems.size()) && (!isLootItem); ++i)
|
||||
if (itemID == lootItems[i])
|
||||
{ isLootItem = true; }
|
||||
{
|
||||
isLootItem = true;
|
||||
}
|
||||
|
||||
if ((!isLootItem) && (!IsVendorItem))
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// item class/subclass specific filters
|
||||
|
|
@ -1275,32 +1361,44 @@ bool AuctionBotSeller::Initialize()
|
|||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_ITEM_MIN_ITEM_LEVEL))
|
||||
{
|
||||
if (prototype->ItemLevel < value)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_ITEM_MAX_ITEM_LEVEL))
|
||||
{
|
||||
if (prototype->ItemLevel > value)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_ITEM_MIN_REQ_LEVEL))
|
||||
{
|
||||
if (prototype->RequiredLevel < value)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_ITEM_MAX_REQ_LEVEL))
|
||||
{
|
||||
if (prototype->RequiredLevel > value)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_ITEM_MIN_SKILL_RANK))
|
||||
{
|
||||
if (prototype->RequiredSkillRank < value)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_ITEM_MAX_SKILL_RANK))
|
||||
{
|
||||
if (prototype->RequiredSkillRank > value)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -1311,22 +1409,30 @@ bool AuctionBotSeller::Initialize()
|
|||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_ITEM_MIN_REQ_LEVEL))
|
||||
{
|
||||
if (prototype->RequiredLevel < value)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_ITEM_MAX_REQ_LEVEL))
|
||||
{
|
||||
if (prototype->RequiredLevel > value)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_ITEM_MIN_SKILL_RANK))
|
||||
{
|
||||
if (prototype->RequiredSkillRank < value)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_ITEM_MAX_SKILL_RANK))
|
||||
{
|
||||
if (prototype->RequiredSkillRank > value)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -1351,10 +1457,14 @@ bool AuctionBotSeller::Initialize()
|
|||
{
|
||||
// skip any not locked lootable items (mostly quest specific or reward cases)
|
||||
if (!prototype->LockID)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!sAuctionBotConfig.getConfig(CONFIG_BOOL_AHBOT_LOCKBOX_ENABLED))
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
@ -1378,10 +1488,14 @@ bool AuctionBotSeller::Initialize()
|
|||
{
|
||||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_TRADEGOOD_MIN_ITEM_LEVEL))
|
||||
if (prototype->ItemLevel < value)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_TRADEGOOD_MAX_ITEM_LEVEL))
|
||||
if (prototype->ItemLevel > value)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ITEM_CLASS_CONTAINER:
|
||||
|
|
@ -1389,10 +1503,14 @@ bool AuctionBotSeller::Initialize()
|
|||
{
|
||||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_CONTAINER_MIN_ITEM_LEVEL))
|
||||
if (prototype->ItemLevel < value)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (uint32 value = sAuctionBotConfig.getConfig(CONFIG_UINT32_AHBOT_CLASS_CONTAINER_MAX_ITEM_LEVEL))
|
||||
if (prototype->ItemLevel > value)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -1436,7 +1554,9 @@ void AuctionBotSeller::LoadConfig()
|
|||
{
|
||||
for (int i = 0; i < MAX_AUCTION_HOUSE_TYPE; ++i)
|
||||
if (sAuctionBotConfig.getConfigItemAmountRatio(AuctionHouseType(i)))
|
||||
{ LoadSellerValues(m_HouseConfig[i]); }
|
||||
{
|
||||
LoadSellerValues(m_HouseConfig[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void AuctionBotSeller::LoadItemsQuantity(AHB_Seller_Config& config)
|
||||
|
|
@ -1721,7 +1841,9 @@ void AuctionBotSeller::SetItemsRatio(uint32 al, uint32 ho, uint32 ne)
|
|||
void AuctionBotSeller::SetItemsRatioForHouse(AuctionHouseType house, uint32 val)
|
||||
{
|
||||
if (val > 10000) // apply same upper limit as used for config load
|
||||
{ val = 10000; }
|
||||
{
|
||||
val = 10000;
|
||||
}
|
||||
|
||||
switch (house)
|
||||
{
|
||||
|
|
@ -1831,7 +1953,9 @@ void AuctionBotSeller::addNewAuctions(AHB_Seller_Config& config)
|
|||
uint64 bidPrice = 0;
|
||||
// Not sure if i will keep the next test
|
||||
if (sAuctionBotConfig.getConfig(CONFIG_BOOL_AHBOT_BUYPRICE_SELLER))
|
||||
{ buyoutPrice = prototype->BuyPrice * item->GetCount(); }
|
||||
{
|
||||
buyoutPrice = prototype->BuyPrice * item->GetCount();
|
||||
}
|
||||
else
|
||||
{ buyoutPrice = prototype->SellPrice * item->GetCount(); }
|
||||
// Price of items are set here
|
||||
|
|
@ -1847,7 +1971,9 @@ bool AuctionBotSeller::Update(AuctionHouseType houseType)
|
|||
{
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_AHBOT_SELLER, "AHBot: %s selling ...", AuctionBotConfig::GetHouseTypeName(houseType));
|
||||
if (SetStat(m_HouseConfig[houseType]))
|
||||
{ addNewAuctions(m_HouseConfig[houseType]); }
|
||||
{
|
||||
addNewAuctions(m_HouseConfig[houseType]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
|
@ -1901,25 +2027,33 @@ void AuctionHouseBot::Initialize()
|
|||
void AuctionHouseBot::SetItemsRatio(uint32 al, uint32 ho, uint32 ne)
|
||||
{
|
||||
if (AuctionBotSeller* seller = dynamic_cast<AuctionBotSeller*>(m_Seller))
|
||||
{ seller->SetItemsRatio(al, ho, ne); }
|
||||
{
|
||||
seller->SetItemsRatio(al, ho, ne);
|
||||
}
|
||||
}
|
||||
|
||||
void AuctionHouseBot::SetItemsRatioForHouse(AuctionHouseType house, uint32 val)
|
||||
{
|
||||
if (AuctionBotSeller* seller = dynamic_cast<AuctionBotSeller*>(m_Seller))
|
||||
{ seller->SetItemsRatioForHouse(house, val); }
|
||||
{
|
||||
seller->SetItemsRatioForHouse(house, val);
|
||||
}
|
||||
}
|
||||
|
||||
void AuctionHouseBot::SetItemsAmount(uint32(&vals) [MAX_AUCTION_QUALITY])
|
||||
{
|
||||
if (AuctionBotSeller* seller = dynamic_cast<AuctionBotSeller*>(m_Seller))
|
||||
{ seller->SetItemsAmount(vals); }
|
||||
{
|
||||
seller->SetItemsAmount(vals);
|
||||
}
|
||||
}
|
||||
|
||||
void AuctionHouseBot::SetItemsAmountForQuality(AuctionQuality quality, uint32 val)
|
||||
{
|
||||
if (AuctionBotSeller* seller = dynamic_cast<AuctionBotSeller*>(m_Seller))
|
||||
{ seller->SetItemsAmountForQuality(quality, val); }
|
||||
{
|
||||
seller->SetItemsAmountForQuality(quality, val);
|
||||
}
|
||||
}
|
||||
|
||||
bool AuctionHouseBot::ReloadAllConfig()
|
||||
|
|
@ -1953,7 +2087,9 @@ void AuctionHouseBot::PrepareStatusInfos(AuctionHouseBotStatusInfo& statusInfo)
|
|||
if (Aentry->owner == sAuctionBotConfig.GetAHBotId()) // Add only ahbot items
|
||||
{
|
||||
if (prototype->Quality < MAX_AUCTION_QUALITY)
|
||||
{ ++statusInfo[i].QualityInfo[prototype->Quality]; }
|
||||
{
|
||||
++statusInfo[i].QualityInfo[prototype->Quality];
|
||||
}
|
||||
|
||||
++statusInfo[i].ItemsCount;
|
||||
}
|
||||
|
|
@ -1982,7 +2118,9 @@ void AuctionHouseBot::Update()
|
|||
{
|
||||
// nothing do...
|
||||
if (!m_Buyer && !m_Seller)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// scan all possible update cases until first success
|
||||
for (uint32 count = 0; count < 2 * MAX_AUCTION_HOUSE_TYPE; ++count)
|
||||
|
|
@ -1992,21 +2130,29 @@ void AuctionHouseBot::Update()
|
|||
if (m_OperationSelector < MAX_AUCTION_HOUSE_TYPE)
|
||||
{
|
||||
if (m_Seller)
|
||||
{ successStep = m_Seller->Update(AuctionHouseType(m_OperationSelector)); }
|
||||
{
|
||||
successStep = m_Seller->Update(AuctionHouseType(m_OperationSelector));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_Buyer)
|
||||
{ successStep = m_Buyer->Update(AuctionHouseType(m_OperationSelector - MAX_AUCTION_HOUSE_TYPE)); }
|
||||
{
|
||||
successStep = m_Buyer->Update(AuctionHouseType(m_OperationSelector - MAX_AUCTION_HOUSE_TYPE));
|
||||
}
|
||||
}
|
||||
|
||||
++m_OperationSelector;
|
||||
if (m_OperationSelector >= 2 * MAX_AUCTION_HOUSE_TYPE)
|
||||
{ m_OperationSelector = 0; }
|
||||
{
|
||||
m_OperationSelector = 0;
|
||||
}
|
||||
|
||||
// one success update per call
|
||||
if (successStep)
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/** @} */
|
||||
|
|
|
|||
|
|
@ -211,7 +211,9 @@ void BattleGround::BroadcastWorker(Do& _do)
|
|||
{
|
||||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
if (Player* plr = ObjectAccessor::FindPlayer(itr->first))
|
||||
{ _do(plr); }
|
||||
{
|
||||
_do(plr);
|
||||
}
|
||||
}
|
||||
|
||||
BattleGround::BattleGround(): m_BuffChange(false), m_ArenaBuffSpawned(false), m_StartDelayTime(0), m_startMaxDist(0)
|
||||
|
|
@ -300,12 +302,16 @@ BattleGround::~BattleGround()
|
|||
// skip template bgs as they were never added to visible bg list
|
||||
BattleGroundBracketId bracketId = GetBracketId();
|
||||
if (bracketId != BG_BRACKET_ID_TEMPLATE)
|
||||
{ sBattleGroundMgr.DeleteClientVisibleInstanceId(GetTypeID(), bracketId, GetClientInstanceID()); }
|
||||
{
|
||||
sBattleGroundMgr.DeleteClientVisibleInstanceId(GetTypeID(), bracketId, GetClientInstanceID());
|
||||
}
|
||||
|
||||
// unload map
|
||||
// map can be null at bg destruction
|
||||
if (m_Map)
|
||||
{ m_Map->SetUnload(); }
|
||||
{
|
||||
m_Map->SetUnload();
|
||||
}
|
||||
|
||||
// remove from bg free slot queue
|
||||
this->RemoveFromBGFreeSlotQueue();
|
||||
|
|
@ -333,7 +339,9 @@ void BattleGround::Update(uint32 diff)
|
|||
// ]]
|
||||
// BattleGround Template instance can not be updated, because it would be deleted
|
||||
if (!GetInvitedCount(HORDE) && !GetInvitedCount(ALLIANCE))
|
||||
{ delete this; }
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -377,13 +385,17 @@ void BattleGround::Update(uint32 diff)
|
|||
if (newtime > (MINUTE * IN_MILLISECONDS))
|
||||
{
|
||||
if (newtime / (MINUTE * IN_MILLISECONDS) != m_PrematureCountDownTimer / (MINUTE * IN_MILLISECONDS))
|
||||
{ PSendMessageToAll(LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING, CHAT_MSG_SYSTEM, NULL, (uint32)(m_PrematureCountDownTimer / (MINUTE * IN_MILLISECONDS))); }
|
||||
{
|
||||
PSendMessageToAll(LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING, CHAT_MSG_SYSTEM, NULL, (uint32)(m_PrematureCountDownTimer / (MINUTE * IN_MILLISECONDS)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// announce every 15 seconds
|
||||
if (newtime / (15 * IN_MILLISECONDS) != m_PrematureCountDownTimer / (15 * IN_MILLISECONDS))
|
||||
{ PSendMessageToAll(LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING_SECS, CHAT_MSG_SYSTEM, NULL, (uint32)(m_PrematureCountDownTimer / IN_MILLISECONDS)); }
|
||||
{
|
||||
PSendMessageToAll(LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING_SECS, CHAT_MSG_SYSTEM, NULL, (uint32)(m_PrematureCountDownTimer / IN_MILLISECONDS));
|
||||
}
|
||||
}
|
||||
m_PrematureCountDownTimer = newtime;
|
||||
}
|
||||
|
|
@ -438,7 +450,9 @@ void BattleGround::Update(uint32 diff)
|
|||
SetStartDelayTime(m_StartDelayTimes[BG_STARTING_EVENT_FIRST]);
|
||||
// first start warning - 2 or 1 minute, only if defined
|
||||
if (m_StartMessageIds[BG_STARTING_EVENT_FIRST])
|
||||
{ SendMessageToAll(m_StartMessageIds[BG_STARTING_EVENT_FIRST], CHAT_MSG_BG_SYSTEM_NEUTRAL); }
|
||||
{
|
||||
SendMessageToAll(m_StartMessageIds[BG_STARTING_EVENT_FIRST], CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
}
|
||||
}
|
||||
// After 1 minute or 30 seconds, warning is signalled
|
||||
else if (GetStartDelayTime() <= m_StartDelayTimes[BG_STARTING_EVENT_SECOND] && !(m_Events & BG_STARTING_EVENT_2))
|
||||
|
|
@ -551,10 +565,14 @@ void BattleGround::SendPacketToAll(WorldPacket* packet)
|
|||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
if (itr->second.OfflineRemoveTime)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Player* plr = sObjectMgr.GetPlayer(itr->first))
|
||||
{ plr->GetSession()->SendPacket(packet); }
|
||||
{
|
||||
plr->GetSession()->SendPacket(packet);
|
||||
}
|
||||
else
|
||||
{ sLog.outError("BattleGround:SendPacketToAll: %s not found!", itr->first.GetString().c_str()); }
|
||||
}
|
||||
|
|
@ -572,7 +590,9 @@ void BattleGround::SendPacketToTeam(Team teamId, WorldPacket* packet, Player* se
|
|||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
if (itr->second.OfflineRemoveTime)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Player* plr = sObjectMgr.GetPlayer(itr->first);
|
||||
if (!plr)
|
||||
|
|
@ -582,13 +602,17 @@ void BattleGround::SendPacketToTeam(Team teamId, WorldPacket* packet, Player* se
|
|||
}
|
||||
|
||||
if (!self && sender == plr)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Team team = itr->second.PlayerTeam;
|
||||
if (!team) { team = plr->GetTeam(); }
|
||||
|
||||
if (team == teamId)
|
||||
{ plr->GetSession()->SendPacket(packet); }
|
||||
{
|
||||
plr->GetSession()->SendPacket(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -615,7 +639,9 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, Team teamId)
|
|||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
if (itr->second.OfflineRemoveTime)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Player* plr = sObjectMgr.GetPlayer(itr->first);
|
||||
if (!plr)
|
||||
|
|
@ -645,7 +671,9 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, Team teamId)
|
|||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
if (itr->second.OfflineRemoveTime)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Player* plr = sObjectMgr.GetPlayer(itr->first);
|
||||
|
||||
|
|
@ -659,7 +687,9 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, Team teamId)
|
|||
if (!team) { team = plr->GetTeam(); }
|
||||
|
||||
if (team == teamId)
|
||||
{ plr->CastSpell(plr, SpellID, true); }
|
||||
{
|
||||
plr->CastSpell(plr, SpellID, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -673,7 +703,9 @@ void BattleGround::RewardHonorToTeam(uint32 Honor, Team teamId)
|
|||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
if (itr->second.OfflineRemoveTime)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Player* plr = sObjectMgr.GetPlayer(itr->first);
|
||||
|
||||
|
|
@ -687,7 +719,9 @@ void BattleGround::RewardHonorToTeam(uint32 Honor, Team teamId)
|
|||
if (!team) { team = plr->GetTeam(); }
|
||||
|
||||
if (team == teamId)
|
||||
{ UpdatePlayerScore(plr, SCORE_BONUS_HONOR, Honor); }
|
||||
{
|
||||
UpdatePlayerScore(plr, SCORE_BONUS_HONOR, Honor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -702,12 +736,16 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation,
|
|||
FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction_id);
|
||||
|
||||
if (!factionEntry)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
if (itr->second.OfflineRemoveTime)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Player* plr = sObjectMgr.GetPlayer(itr->first);
|
||||
|
||||
|
|
@ -721,7 +759,9 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation,
|
|||
if (!team) { team = plr->GetTeam(); }
|
||||
|
||||
if (team == teamId)
|
||||
{ plr->GetReputationMgr().ModifyReputation(factionEntry, Reputation); }
|
||||
{
|
||||
plr->GetReputationMgr().ModifyReputation(factionEntry, Reputation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -873,7 +913,9 @@ void BattleGround::EndBattleGround(Team winner)
|
|||
|
||||
// should remove spirit of redemption
|
||||
if (plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||
{ plr->RemoveSpellsCausingAura(SPELL_AURA_MOD_SHAPESHIFT); }
|
||||
{
|
||||
plr->RemoveSpellsCausingAura(SPELL_AURA_MOD_SHAPESHIFT);
|
||||
}
|
||||
|
||||
if (!plr->IsAlive())
|
||||
{
|
||||
|
|
@ -976,7 +1018,9 @@ void BattleGround::EndBattleGround(Team winner)
|
|||
}
|
||||
|
||||
if (winmsg_id)
|
||||
{ SendMessageToAll(winmsg_id, CHAT_MSG_BG_SYSTEM_NEUTRAL); }
|
||||
{
|
||||
SendMessageToAll(winmsg_id, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -1018,19 +1062,25 @@ void BattleGround::RewardMark(Player* plr, uint32 count)
|
|||
{
|
||||
case BATTLEGROUND_AV:
|
||||
if (count == ITEM_WINNER_COUNT)
|
||||
{ RewardSpellCast(plr, SPELL_AV_MARK_WINNER); }
|
||||
{
|
||||
RewardSpellCast(plr, SPELL_AV_MARK_WINNER);
|
||||
}
|
||||
else
|
||||
{ RewardSpellCast(plr, SPELL_AV_MARK_LOSER); }
|
||||
break;
|
||||
case BATTLEGROUND_WS:
|
||||
if (count == ITEM_WINNER_COUNT)
|
||||
{ RewardSpellCast(plr, SPELL_WS_MARK_WINNER); }
|
||||
{
|
||||
RewardSpellCast(plr, SPELL_WS_MARK_WINNER);
|
||||
}
|
||||
else
|
||||
{ RewardSpellCast(plr, SPELL_WS_MARK_LOSER); }
|
||||
break;
|
||||
case BATTLEGROUND_AB:
|
||||
if (count == ITEM_WINNER_COUNT)
|
||||
{ RewardSpellCast(plr, SPELL_AB_MARK_WINNER); }
|
||||
{
|
||||
RewardSpellCast(plr, SPELL_AB_MARK_WINNER);
|
||||
}
|
||||
else
|
||||
{ RewardSpellCast(plr, SPELL_AB_MARK_LOSER); }
|
||||
break;
|
||||
|
|
@ -1084,14 +1134,20 @@ void BattleGround::RewardItem(Player* plr, uint32 item_id, uint32 count)
|
|||
}
|
||||
|
||||
if (msg != EQUIP_ERR_OK) // convert to possible store amount
|
||||
{ count -= no_space_count; }
|
||||
{
|
||||
count -= no_space_count;
|
||||
}
|
||||
|
||||
if (count != 0 && !dest.empty()) // can add some
|
||||
if (Item* item = plr->StoreNewItem(dest, item_id, true, 0))
|
||||
{ plr->SendNewItem(item, count, true, false); }
|
||||
{
|
||||
plr->SendNewItem(item, count, true, false);
|
||||
}
|
||||
|
||||
if (no_space_count > 0)
|
||||
{ SendRewardMarkByMail(plr, item_id, no_space_count); }
|
||||
{
|
||||
SendRewardMarkByMail(plr, item_id, no_space_count);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -1104,11 +1160,15 @@ void BattleGround::SendRewardMarkByMail(Player* plr, uint32 mark, uint32 count)
|
|||
{
|
||||
uint32 bmEntry = GetBattlemasterEntry();
|
||||
if (!bmEntry)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ItemPrototype const* markProto = ObjectMgr::GetItemPrototype(mark);
|
||||
if (!markProto)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Item* markItem = Item::CreateItem(mark, count, plr))
|
||||
{
|
||||
|
|
@ -1202,7 +1262,9 @@ void BattleGround::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool Sen
|
|||
{
|
||||
// should remove spirit of redemption
|
||||
if (plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||
{ plr->RemoveSpellsCausingAura(SPELL_AURA_MOD_SHAPESHIFT); }
|
||||
{
|
||||
plr->RemoveSpellsCausingAura(SPELL_AURA_MOD_SHAPESHIFT);
|
||||
}
|
||||
|
||||
plr->RemoveAurasDueToSpell(isArena() ? SPELL_ARENA_DAMPENING : SPELL_BATTLEGROUND_DAMPENING);
|
||||
plr->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
|
||||
|
|
@ -1300,7 +1362,9 @@ void BattleGround::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool Sen
|
|||
plr->SetBGTeam(TEAM_NONE);
|
||||
|
||||
if (Transport)
|
||||
{ plr->TeleportToBGEntryPoint(); }
|
||||
{
|
||||
plr->TeleportToBGEntryPoint();
|
||||
}
|
||||
|
||||
DETAIL_LOG("BATTLEGROUND: Removed player %s from BattleGround.", plr->GetName());
|
||||
}
|
||||
|
|
@ -1331,7 +1395,9 @@ void BattleGround::Reset()
|
|||
}
|
||||
|
||||
if (m_InvitedAlliance > 0 || m_InvitedHorde > 0)
|
||||
{ sLog.outError("BattleGround system: bad counter, m_InvitedAlliance: %d, m_InvitedHorde: %d", m_InvitedAlliance, m_InvitedHorde); }
|
||||
{
|
||||
sLog.outError("BattleGround system: bad counter, m_InvitedAlliance: %d, m_InvitedHorde: %d", m_InvitedAlliance, m_InvitedHorde);
|
||||
}
|
||||
|
||||
m_InvitedAlliance = 0;
|
||||
m_InvitedHorde = 0;
|
||||
|
|
@ -1375,7 +1441,9 @@ void BattleGround::AddPlayer(Player* plr)
|
|||
{
|
||||
// remove afk from player
|
||||
if (plr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK))
|
||||
{ plr->ToggleAFK(); }
|
||||
{
|
||||
plr->ToggleAFK();
|
||||
}
|
||||
|
||||
// score struct must be created in inherited class
|
||||
|
||||
|
|
@ -1473,7 +1541,9 @@ void BattleGround::AddOrSetPlayerToCorrectBgGroup(Player* plr, ObjectGuid plr_gu
|
|||
group->AddMember(plr_guid, plr->GetName());
|
||||
if (Group* originalGroup = plr->GetOriginalGroup())
|
||||
if (originalGroup->IsLeader(plr_guid))
|
||||
{ group->ChangeLeader(plr_guid); }
|
||||
{
|
||||
group->ChangeLeader(plr_guid);
|
||||
}
|
||||
}
|
||||
}
|
||||
else // first player joined
|
||||
|
|
@ -1568,7 +1638,9 @@ uint32 BattleGround::GetFreeSlotsForTeam(Team team) const
|
|||
{
|
||||
// return free slot count to MaxPlayerPerTeam
|
||||
if (GetStatus() == STATUS_WAIT_JOIN || GetStatus() == STATUS_IN_PROGRESS)
|
||||
{ return (GetInvitedCount(team) < GetMaxPlayersPerTeam()) ? GetMaxPlayersPerTeam() - GetInvitedCount(team) : 0; }
|
||||
{
|
||||
return (GetInvitedCount(team) < GetMaxPlayersPerTeam()) ? GetMaxPlayersPerTeam() - GetInvitedCount(team) : 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1594,7 +1666,9 @@ void BattleGround::UpdatePlayerScore(Player* Source, uint32 type, uint32 value)
|
|||
BattleGroundScoreMap::const_iterator itr = m_PlayerScores.find(Source->GetObjectGuid());
|
||||
|
||||
if (itr == m_PlayerScores.end()) // player not found...
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
|
@ -1685,10 +1759,14 @@ void BattleGround::OnObjectDBLoad(Creature* creature)
|
|||
{
|
||||
const BattleGroundEventIdx eventId = sBattleGroundMgr.GetCreatureEventIndex(creature->GetGUIDLow());
|
||||
if (eventId.event1 == BG_EVENT_NONE)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_EventObjects[MAKE_PAIR32(eventId.event1, eventId.event2)].creatures.push_back(creature->GetObjectGuid());
|
||||
if (!IsActiveEvent(eventId.event1, eventId.event2))
|
||||
{ SpawnBGCreature(creature->GetObjectGuid(), RESPAWN_ONE_DAY); }
|
||||
{
|
||||
SpawnBGCreature(creature->GetObjectGuid(), RESPAWN_ONE_DAY);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -1701,7 +1779,9 @@ ObjectGuid BattleGround::GetSingleCreatureGuid(uint8 event1, uint8 event2)
|
|||
{
|
||||
GuidVector::const_iterator itr = m_EventObjects[MAKE_PAIR32(event1, event2)].creatures.begin();
|
||||
if (itr != m_EventObjects[MAKE_PAIR32(event1, event2)].creatures.end())
|
||||
{ return *itr; }
|
||||
{
|
||||
return *itr;
|
||||
}
|
||||
return ObjectGuid();
|
||||
}
|
||||
|
||||
|
|
@ -1713,7 +1793,9 @@ void BattleGround::OnObjectDBLoad(GameObject* obj)
|
|||
{
|
||||
const BattleGroundEventIdx eventId = sBattleGroundMgr.GetGameObjectEventIndex(obj->GetGUIDLow());
|
||||
if (eventId.event1 == BG_EVENT_NONE)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_EventObjects[MAKE_PAIR32(eventId.event1, eventId.event2)].gameobjects.push_back(obj->GetObjectGuid());
|
||||
if (!IsActiveEvent(eventId.event1, eventId.event2))
|
||||
{
|
||||
|
|
@ -1723,7 +1805,9 @@ void BattleGround::OnObjectDBLoad(GameObject* obj)
|
|||
{
|
||||
// it's possible, that doors aren't spawned anymore (wsg)
|
||||
if (GetStatus() >= STATUS_IN_PROGRESS && IsDoor(eventId.event1, eventId.event2))
|
||||
{ DoorOpen(obj->GetObjectGuid()); }
|
||||
{
|
||||
DoorOpen(obj->GetObjectGuid());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1811,12 +1895,16 @@ void BattleGround::SpawnBGObject(ObjectGuid guid, uint32 respawntime)
|
|||
|
||||
GameObject* obj = map->GetGameObject(guid);
|
||||
if (!obj)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (respawntime == 0)
|
||||
{
|
||||
// we need to change state from GO_JUST_DEACTIVATED to GO_READY in case battleground is starting again
|
||||
if (obj->getLootState() == GO_JUST_DEACTIVATED)
|
||||
{ obj->SetLootState(GO_READY); }
|
||||
{
|
||||
obj->SetLootState(GO_READY);
|
||||
}
|
||||
obj->SetRespawnTime(0);
|
||||
map->Add(obj);
|
||||
}
|
||||
|
|
@ -1839,7 +1927,9 @@ void BattleGround::SpawnBGCreature(ObjectGuid guid, uint32 respawntime)
|
|||
|
||||
Creature* obj = map->GetCreature(guid);
|
||||
if (!obj)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (respawntime == 0)
|
||||
{
|
||||
obj->Respawn();
|
||||
|
|
@ -1877,7 +1967,9 @@ void BattleGround::SendYellToAll(int32 entry, uint32 language, ObjectGuid guid)
|
|||
{
|
||||
Creature* source = GetBgMap()->GetCreature(guid);
|
||||
if (!source)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
MaNGOS::BattleGroundYellBuilder bg_builder(Language(language), entry, source);
|
||||
MaNGOS::LocalizedPacketDo<MaNGOS::BattleGroundYellBuilder> bg_do(bg_builder);
|
||||
BroadcastWorker(bg_do);
|
||||
|
|
@ -1929,7 +2021,9 @@ void BattleGround::SendYell2ToAll(int32 entry, uint32 language, ObjectGuid guid,
|
|||
{
|
||||
Creature* source = GetBgMap()->GetCreature(guid);
|
||||
if (!source)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
MaNGOS::BattleGround2YellBuilder bg_builder(language, entry, source, arg1, arg2);
|
||||
MaNGOS::LocalizedPacketDo<MaNGOS::BattleGround2YellBuilder> bg_do(bg_builder);
|
||||
BroadcastWorker(bg_do);
|
||||
|
|
@ -1957,7 +2051,9 @@ void BattleGround::HandleTriggerBuff(ObjectGuid go_guid)
|
|||
{
|
||||
GameObject* obj = GetBgMap()->GetGameObject(go_guid);
|
||||
if (!obj || obj->GetGoType() != GAMEOBJECT_TYPE_TRAP || !obj->isSpawned())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
obj->SetLootState(GO_JUST_DEACTIVATED); // can be despawned or destroyed
|
||||
return;
|
||||
|
|
@ -1984,10 +2080,14 @@ void BattleGround::HandleKillPlayer(Player* player, Player* killer)
|
|||
Player* plr = sObjectMgr.GetPlayer(itr->first);
|
||||
|
||||
if (!plr || plr == killer)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (plr->GetTeam() == killer->GetTeam() && plr->IsAtGroupRewardDistance(player))
|
||||
{ UpdatePlayerScore(plr, SCORE_HONORABLE_KILLS, 1); }
|
||||
{
|
||||
UpdatePlayerScore(plr, SCORE_HONORABLE_KILLS, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2006,7 +2106,9 @@ Team BattleGround::GetPlayerTeam(ObjectGuid guid)
|
|||
{
|
||||
BattleGroundPlayerMap::const_iterator itr = m_Players.find(guid);
|
||||
if (itr != m_Players.end())
|
||||
{ return itr->second.PlayerTeam; }
|
||||
{
|
||||
return itr->second.PlayerTeam;
|
||||
}
|
||||
return TEAM_NONE;
|
||||
}
|
||||
|
||||
|
|
@ -2019,7 +2121,9 @@ bool BattleGround::IsPlayerInBattleGround(ObjectGuid guid)
|
|||
{
|
||||
BattleGroundPlayerMap::const_iterator itr = m_Players.find(guid);
|
||||
if (itr != m_Players.end())
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -2030,7 +2134,9 @@ bool BattleGround::IsPlayerInBattleGround(ObjectGuid guid)
|
|||
void BattleGround::PlayerAddedToBGCheckIfBGIsRunning(Player* plr)
|
||||
{
|
||||
if (GetStatus() != STATUS_WAIT_LEAVE)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
WorldPacket data;
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
|
||||
|
|
@ -2058,7 +2164,9 @@ uint32 BattleGround::GetAlivePlayersCountByTeam(Team team) const
|
|||
{
|
||||
Player* pl = sObjectMgr.GetPlayer(itr->first);
|
||||
if (pl && pl->IsAlive())
|
||||
{ ++count; }
|
||||
{
|
||||
++count;
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
|
|
@ -2082,10 +2190,14 @@ void BattleGround::SetBgRaid(Team team, Group* bg_raid)
|
|||
Group*& old_raid = m_BgRaids[GetTeamIndexByTeamId(team)];
|
||||
|
||||
if (old_raid)
|
||||
{ old_raid->SetBattlegroundGroup(NULL); }
|
||||
{
|
||||
old_raid->SetBattlegroundGroup(NULL);
|
||||
}
|
||||
|
||||
if (bg_raid)
|
||||
{ bg_raid->SetBattlegroundGroup(this); }
|
||||
{
|
||||
bg_raid->SetBattlegroundGroup(this);
|
||||
}
|
||||
|
||||
old_raid = bg_raid;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -664,7 +664,9 @@ class BattleGround
|
|||
uint32 GetInvitedCount(Team team) const
|
||||
{
|
||||
if (team == ALLIANCE)
|
||||
{ return m_InvitedAlliance; }
|
||||
{
|
||||
return m_InvitedAlliance;
|
||||
}
|
||||
else
|
||||
{ return m_InvitedHorde; }
|
||||
}
|
||||
|
|
@ -1030,7 +1032,9 @@ class BattleGround
|
|||
void UpdatePlayersCountByTeam(Team team, bool remove)
|
||||
{
|
||||
if (remove)
|
||||
{ --m_PlayersCount[GetTeamIndexByTeamId(team)]; }
|
||||
{
|
||||
--m_PlayersCount[GetTeamIndexByTeamId(team)];
|
||||
}
|
||||
else
|
||||
{ ++m_PlayersCount[GetTeamIndexByTeamId(team)]; }
|
||||
}
|
||||
|
|
@ -1193,7 +1197,9 @@ class BattleGround
|
|||
bool IsActiveEvent(uint8 event1, uint8 event2)
|
||||
{
|
||||
if (m_ActiveEvents.find(event1) == m_ActiveEvents.end())
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return m_ActiveEvents[event1] == event2;
|
||||
}
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -68,7 +68,9 @@ void BattleGroundAB::Update(uint32 diff)
|
|||
if (m_BannerTimers[node].timer)
|
||||
{
|
||||
if (m_BannerTimers[node].timer > diff)
|
||||
{ m_BannerTimers[node].timer -= diff; }
|
||||
{
|
||||
m_BannerTimers[node].timer -= diff;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_BannerTimers[node].timer = 0;
|
||||
|
|
@ -80,7 +82,9 @@ void BattleGroundAB::Update(uint32 diff)
|
|||
if (m_NodeTimers[node])
|
||||
{
|
||||
if (m_NodeTimers[node] > diff)
|
||||
{ m_NodeTimers[node] -= diff; }
|
||||
{
|
||||
m_NodeTimers[node] -= diff;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_NodeTimers[node] = 0;
|
||||
|
|
@ -109,7 +113,9 @@ void BattleGroundAB::Update(uint32 diff)
|
|||
|
||||
for (uint8 team = 0; team < PVP_TEAM_COUNT; ++team)
|
||||
if (m_Nodes[node] == team + BG_AB_NODE_TYPE_OCCUPIED)
|
||||
{ ++team_points[team]; }
|
||||
{
|
||||
++team_points[team];
|
||||
}
|
||||
}
|
||||
|
||||
// Accumulate points
|
||||
|
|
@ -117,7 +123,9 @@ void BattleGroundAB::Update(uint32 diff)
|
|||
{
|
||||
int points = team_points[team];
|
||||
if (!points)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
m_lastTick[team] += diff;
|
||||
if (m_lastTick[team] > BG_AB_TickIntervals[points])
|
||||
{
|
||||
|
|
@ -138,7 +146,9 @@ void BattleGroundAB::Update(uint32 diff)
|
|||
if (!m_IsInformedNearVictory && m_TeamScores[team] > BG_AB_WARNING_NEAR_VICTORY_SCORE)
|
||||
{
|
||||
if (team == TEAM_INDEX_ALLIANCE)
|
||||
{ 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
|
||||
{ SendMessageToAll(LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL); }
|
||||
PlaySoundToAll(BG_AB_SOUND_NEAR_VICTORY);
|
||||
|
|
@ -146,11 +156,17 @@ void BattleGroundAB::Update(uint32 diff)
|
|||
}
|
||||
|
||||
if (m_TeamScores[team] > BG_AB_MAX_TEAM_SCORE)
|
||||
{ m_TeamScores[team] = BG_AB_MAX_TEAM_SCORE; }
|
||||
{
|
||||
m_TeamScores[team] = BG_AB_MAX_TEAM_SCORE;
|
||||
}
|
||||
if (team == TEAM_INDEX_ALLIANCE)
|
||||
{ UpdateWorldState(BG_AB_OP_RESOURCES_ALLY, m_TeamScores[team]); }
|
||||
{
|
||||
UpdateWorldState(BG_AB_OP_RESOURCES_ALLY, m_TeamScores[team]);
|
||||
}
|
||||
if (team == TEAM_INDEX_HORDE)
|
||||
{ UpdateWorldState(BG_AB_OP_RESOURCES_HORDE, m_TeamScores[team]); }
|
||||
{
|
||||
UpdateWorldState(BG_AB_OP_RESOURCES_HORDE, m_TeamScores[team]);
|
||||
}
|
||||
|
||||
// update achievement flags
|
||||
// we increased m_TeamScores[team] so we just need to check if it is 500 more than other teams resources
|
||||
|
|
@ -163,9 +179,13 @@ void BattleGroundAB::Update(uint32 diff)
|
|||
|
||||
// Test win condition
|
||||
if (m_TeamScores[TEAM_INDEX_ALLIANCE] >= BG_AB_MAX_TEAM_SCORE)
|
||||
{ EndBattleGround(ALLIANCE); }
|
||||
{
|
||||
EndBattleGround(ALLIANCE);
|
||||
}
|
||||
if (m_TeamScores[TEAM_INDEX_HORDE] >= BG_AB_MAX_TEAM_SCORE)
|
||||
{ EndBattleGround(HORDE); }
|
||||
{
|
||||
EndBattleGround(HORDE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -213,13 +233,17 @@ bool BattleGroundAB::HandleAreaTrigger(Player* source, uint32 trigger)
|
|||
{
|
||||
case 3948: // Arathi Basin Alliance Exit.
|
||||
if (source->GetTeam() != ALLIANCE)
|
||||
{ source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_ALLIANCE_USE); }
|
||||
{
|
||||
source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_ALLIANCE_USE);
|
||||
}
|
||||
else
|
||||
{ source->LeaveBattleground(); }
|
||||
break;
|
||||
case 3949: // Arathi Basin Horde Exit.
|
||||
if (source->GetTeam() != HORDE)
|
||||
{ source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_HORDE_USE); }
|
||||
{
|
||||
source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_HORDE_USE);
|
||||
}
|
||||
else
|
||||
{ source->LeaveBattleground(); }
|
||||
break;
|
||||
|
|
@ -250,7 +274,9 @@ void BattleGroundAB::_CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool
|
|||
// cause the node-type is in the generic form
|
||||
// please see in the headerfile for the ids
|
||||
if (type != BG_AB_NODE_TYPE_NEUTRAL)
|
||||
{ type += teamIndex; }
|
||||
{
|
||||
type += teamIndex;
|
||||
}
|
||||
|
||||
SpawnEvent(node, type, true); // will automaticly despawn other events
|
||||
}
|
||||
|
|
@ -297,7 +323,9 @@ void BattleGroundAB::FillInitialWorldStates(WorldPacket& data, uint32& count)
|
|||
uint8 ally = 0, horde = 0;
|
||||
for (uint8 node = 0; node < BG_AB_NODES_MAX; ++node)
|
||||
if (m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_OCCUPIED)
|
||||
{ ++ally; }
|
||||
{
|
||||
++ally;
|
||||
}
|
||||
else if (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)
|
||||
{ ++horde; }
|
||||
|
||||
|
|
@ -324,7 +352,9 @@ void BattleGroundAB::_SendNodeUpdate(uint8 node)
|
|||
const uint8 plusArray[] = {0, 2, 3, 0, 1};
|
||||
|
||||
if (m_prevNodes[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
|
||||
{ UpdateWorldState(BG_AB_OP_NODEICONS[node], WORLD_STATE_REMOVE); }
|
||||
|
||||
|
|
@ -334,7 +364,9 @@ void BattleGroundAB::_SendNodeUpdate(uint8 node)
|
|||
uint8 ally = 0, horde = 0;
|
||||
for (uint8 i = 0; i < BG_AB_NODES_MAX; ++i)
|
||||
if (m_Nodes[i] == BG_AB_NODE_STATUS_ALLY_OCCUPIED)
|
||||
{ ++ally; }
|
||||
{
|
||||
++ally;
|
||||
}
|
||||
else if (m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)
|
||||
{ ++horde; }
|
||||
|
||||
|
|
@ -353,12 +385,18 @@ void BattleGroundAB::_NodeOccupied(uint8 node, Team team)
|
|||
for (uint8 i = 0; i < BG_AB_NODES_MAX; ++i)
|
||||
{
|
||||
if (m_Nodes[node] == GetTeamIndexByTeamId(team) + BG_AB_NODE_TYPE_OCCUPIED && !m_NodeTimers[i])
|
||||
{ ++capturedNodes; }
|
||||
{
|
||||
++capturedNodes;
|
||||
}
|
||||
}
|
||||
if (capturedNodes >= 5)
|
||||
{ CastSpellOnTeam(SPELL_AB_QUEST_REWARD_5_BASES, team); }
|
||||
{
|
||||
CastSpellOnTeam(SPELL_AB_QUEST_REWARD_5_BASES, team);
|
||||
}
|
||||
if (capturedNodes >= 4)
|
||||
{ CastSpellOnTeam(SPELL_AB_QUEST_REWARD_4_BASES, team); }
|
||||
{
|
||||
CastSpellOnTeam(SPELL_AB_QUEST_REWARD_4_BASES, team);
|
||||
}
|
||||
}
|
||||
|
||||
/* Invoked if a player used a banner as a gameobject */
|
||||
|
|
@ -370,18 +408,24 @@ void BattleGroundAB::_NodeOccupied(uint8 node, Team team)
|
|||
void BattleGroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* target_obj)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
uint8 event = (sBattleGroundMgr.GetGameObjectEventIndex(target_obj->GetGUIDLow())).event1;
|
||||
if (event >= BG_AB_NODES_MAX) // not a node
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
BG_AB_Nodes node = BG_AB_Nodes(event);
|
||||
|
||||
PvpTeamIndex teamIndex = GetTeamIndexByTeamId(source->GetTeam());
|
||||
|
||||
// Check if player really could use this banner, not cheated
|
||||
if (!(m_Nodes[node] == 0 || teamIndex == m_Nodes[node] % 2))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
uint32 sound;
|
||||
|
|
@ -400,7 +444,9 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* target
|
|||
m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
|
||||
|
||||
if (teamIndex == 0)
|
||||
{ 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
|
||||
{ SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node), LANG_BG_HORDE); }
|
||||
|
||||
|
|
@ -421,7 +467,9 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* target
|
|||
m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
|
||||
|
||||
if (teamIndex == TEAM_INDEX_ALLIANCE)
|
||||
{ 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
|
||||
{ SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); }
|
||||
}
|
||||
|
|
@ -438,7 +486,9 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* target
|
|||
_NodeOccupied(node, (teamIndex == TEAM_INDEX_ALLIANCE) ? ALLIANCE : HORDE);
|
||||
|
||||
if (teamIndex == TEAM_INDEX_ALLIANCE)
|
||||
{ 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
|
||||
{ SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); }
|
||||
}
|
||||
|
|
@ -456,7 +506,9 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* target
|
|||
m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
|
||||
|
||||
if (teamIndex == TEAM_INDEX_ALLIANCE)
|
||||
{ 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
|
||||
{ SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); }
|
||||
|
||||
|
|
@ -467,7 +519,9 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* target
|
|||
if (m_Nodes[node] >= BG_AB_NODE_TYPE_OCCUPIED)
|
||||
{
|
||||
if (teamIndex == TEAM_INDEX_ALLIANCE)
|
||||
{ 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
|
||||
{ SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_HORDE, NULL, LANG_BG_HORDE, _GetNodeNameId(node)); }
|
||||
}
|
||||
|
|
@ -539,7 +593,9 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
|
|||
std::vector<uint8> nodes;
|
||||
for (uint8 i = 0; i < BG_AB_NODES_MAX; ++i)
|
||||
if (m_Nodes[i] == teamIndex + 3)
|
||||
{ nodes.push_back(i); }
|
||||
{
|
||||
nodes.push_back(i);
|
||||
}
|
||||
|
||||
WorldSafeLocsEntry const* good_entry = NULL;
|
||||
// If so, select the closest node to place ghost on
|
||||
|
|
@ -553,7 +609,9 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
|
|||
{
|
||||
WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[nodes[i]]);
|
||||
if (!entry)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
float dist = (entry->x - plr_x) * (entry->x - plr_x) + (entry->y - plr_y) * (entry->y - plr_y);
|
||||
if (mindist > dist)
|
||||
{
|
||||
|
|
@ -565,7 +623,9 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
|
|||
}
|
||||
// If not, place ghost on starting location
|
||||
if (!good_entry)
|
||||
{ good_entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[teamIndex + 5]); }
|
||||
{
|
||||
good_entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[teamIndex + 5]);
|
||||
}
|
||||
|
||||
return good_entry;
|
||||
}
|
||||
|
|
@ -580,7 +640,9 @@ void BattleGroundAB::UpdatePlayerScore(Player* source, uint32 type, uint32 value
|
|||
{
|
||||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
|
||||
if (itr == m_PlayerScores.end()) // player not found...
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
|
@ -615,10 +677,14 @@ Team BattleGroundAB::GetPrematureWinner()
|
|||
int32 allianceScore = m_TeamScores[TEAM_INDEX_ALLIANCE];
|
||||
|
||||
if (hordeScore > allianceScore)
|
||||
{ return HORDE; }
|
||||
{
|
||||
return HORDE;
|
||||
}
|
||||
|
||||
if (allianceScore > hordeScore)
|
||||
{ return ALLIANCE; }
|
||||
{
|
||||
return ALLIANCE;
|
||||
}
|
||||
|
||||
// If the values are equal, fall back to number of players on each team
|
||||
return BattleGround::GetPrematureWinner();
|
||||
|
|
|
|||
|
|
@ -43,7 +43,9 @@ BattleGroundAV::BattleGroundAV(): m_HonorMapComplete(0), m_RepTowerDestruction(0
|
|||
void BattleGroundAV::HandleKillPlayer(Player* player, Player* killer)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BattleGround::HandleKillPlayer(player, killer);
|
||||
UpdateScore(GetTeamIndexByTeamId(player->GetTeam()), -1);
|
||||
|
|
@ -53,10 +55,14 @@ void BattleGroundAV::HandleKillUnit(Creature* creature, Player* killer)
|
|||
{
|
||||
DEBUG_LOG("BattleGroundAV: HandleKillUnit %i", creature->GetEntry());
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
uint8 event1 = (sBattleGroundMgr.GetCreatureEventIndex(creature->GetGUIDLow())).event1;
|
||||
if (event1 == BG_EVENT_NONE)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (event1)
|
||||
{
|
||||
case BG_AV_BOSS_A:
|
||||
|
|
@ -75,7 +81,9 @@ void BattleGroundAV::HandleKillUnit(Creature* creature, Player* killer)
|
|||
break;
|
||||
case BG_AV_CAPTAIN_A:
|
||||
if (IsActiveEvent(BG_AV_NodeEventCaptainDead_A, 0))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
RewardReputationToTeam(BG_AV_FACTION_H, m_RepCaptain, HORDE);
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_CAPTAIN), HORDE);
|
||||
UpdateScore(TEAM_INDEX_ALLIANCE, (-1) * BG_AV_RES_CAPTAIN);
|
||||
|
|
@ -84,7 +92,9 @@ void BattleGroundAV::HandleKillUnit(Creature* creature, Player* killer)
|
|||
break;
|
||||
case BG_AV_CAPTAIN_H:
|
||||
if (IsActiveEvent(BG_AV_NodeEventCaptainDead_H, 0))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
RewardReputationToTeam(BG_AV_FACTION_A, m_RepCaptain, ALLIANCE);
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_CAPTAIN), ALLIANCE);
|
||||
UpdateScore(TEAM_INDEX_HORDE, (-1) * BG_AV_RES_CAPTAIN);
|
||||
|
|
@ -103,7 +113,9 @@ void BattleGroundAV::HandleKillUnit(Creature* creature, Player* killer)
|
|||
void BattleGroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
BattleGroundAVTeamIndex teamIdx = GetAVTeamIndexByTeamId(player->GetTeam());
|
||||
MANGOS_ASSERT(teamIdx != BG_AV_TEAM_NEUTRAL);
|
||||
|
||||
|
|
@ -123,7 +135,9 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
|||
DEBUG_LOG("BattleGroundAV: Quest %i completed starting with unit upgrading..", questid);
|
||||
for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i)
|
||||
if (m_Nodes[i].Owner == teamIdx && m_Nodes[i].State == POINT_CONTROLLED)
|
||||
{ PopulateNode(i); }
|
||||
{
|
||||
PopulateNode(i);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case BG_AV_QUEST_A_COMMANDER1:
|
||||
|
|
@ -131,21 +145,27 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
|||
m_Team_QuestStatus[teamIdx][1]++;
|
||||
reputation = 1;
|
||||
if (m_Team_QuestStatus[teamIdx][1] == 120)
|
||||
{ DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid); }
|
||||
{
|
||||
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
|
||||
}
|
||||
break;
|
||||
case BG_AV_QUEST_A_COMMANDER2:
|
||||
case BG_AV_QUEST_H_COMMANDER2:
|
||||
m_Team_QuestStatus[teamIdx][2]++;
|
||||
reputation = 2;
|
||||
if (m_Team_QuestStatus[teamIdx][2] == 60)
|
||||
{ DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid); }
|
||||
{
|
||||
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
|
||||
}
|
||||
break;
|
||||
case BG_AV_QUEST_A_COMMANDER3:
|
||||
case BG_AV_QUEST_H_COMMANDER3:
|
||||
m_Team_QuestStatus[teamIdx][3]++;
|
||||
reputation = 5;
|
||||
if (m_Team_QuestStatus[teamIdx][1] == 30)
|
||||
{ DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid); }
|
||||
{
|
||||
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
|
||||
}
|
||||
break;
|
||||
case BG_AV_QUEST_A_BOSS1:
|
||||
case BG_AV_QUEST_H_BOSS1:
|
||||
|
|
@ -156,7 +176,9 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
|||
m_Team_QuestStatus[teamIdx][4]++;
|
||||
reputation += 1;
|
||||
if (m_Team_QuestStatus[teamIdx][4] >= 200)
|
||||
{ DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid); }
|
||||
{
|
||||
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
|
||||
}
|
||||
break;
|
||||
case BG_AV_QUEST_A_NEAR_MINE:
|
||||
case BG_AV_QUEST_H_NEAR_MINE:
|
||||
|
|
@ -166,7 +188,9 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
|||
{
|
||||
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
|
||||
if (m_Team_QuestStatus[teamIdx][6] == 7)
|
||||
{ DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - ground assault ready", questid); }
|
||||
{
|
||||
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - ground assault ready", questid);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case BG_AV_QUEST_A_OTHER_MINE:
|
||||
|
|
@ -177,7 +201,9 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
|||
{
|
||||
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
|
||||
if (m_Team_QuestStatus[teamIdx][5] == 20)
|
||||
{ DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - ground assault ready", questid); }
|
||||
{
|
||||
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - ground assault ready", questid);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case BG_AV_QUEST_A_RIDER_HIDE:
|
||||
|
|
@ -188,7 +214,9 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
|||
{
|
||||
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
|
||||
if (m_Team_QuestStatus[teamIdx][8] == 25)
|
||||
{ DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - rider assault ready", questid); }
|
||||
{
|
||||
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - rider assault ready", questid);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case BG_AV_QUEST_A_RIDER_TAME:
|
||||
|
|
@ -199,7 +227,9 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
|||
{
|
||||
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
|
||||
if (m_Team_QuestStatus[teamIdx][7] == 25)
|
||||
{ DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - rider assault ready", questid); }
|
||||
{
|
||||
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - rider assault ready", questid);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
@ -208,7 +238,9 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player* player)
|
|||
break;
|
||||
}
|
||||
if (reputation)
|
||||
{ RewardReputationToTeam((player->GetTeam() == ALLIANCE) ? BG_AV_FACTION_A : BG_AV_FACTION_H, reputation, player->GetTeam()); }
|
||||
{
|
||||
RewardReputationToTeam((player->GetTeam() == ALLIANCE) ? BG_AV_FACTION_A : BG_AV_FACTION_H, reputation, player->GetTeam());
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundAV::UpdateScore(PvpTeamIndex teamIdx, int32 points)
|
||||
|
|
@ -241,7 +273,9 @@ void BattleGroundAV::Update(uint32 diff)
|
|||
BattleGround::Update(diff);
|
||||
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// add points from mine owning, and look if the neutral team can reclaim the mine
|
||||
for (uint8 mine = 0; mine < BG_AV_MAX_MINES; ++mine)
|
||||
|
|
@ -256,7 +290,9 @@ void BattleGroundAV::Update(uint32 diff)
|
|||
}
|
||||
|
||||
if (m_Mine_Reclaim_Timer[mine] > diff)
|
||||
{ m_Mine_Reclaim_Timer[mine] -= diff; }
|
||||
{
|
||||
m_Mine_Reclaim_Timer[mine] -= diff;
|
||||
}
|
||||
else
|
||||
{ ChangeMineOwner(mine, BG_AV_TEAM_NEUTRAL); }
|
||||
}
|
||||
|
|
@ -268,7 +304,9 @@ void BattleGroundAV::Update(uint32 diff)
|
|||
if (m_Nodes[i].State == POINT_ASSAULTED)
|
||||
{
|
||||
if (m_Nodes[i].Timer > diff)
|
||||
{ m_Nodes[i].Timer -= diff; }
|
||||
{
|
||||
m_Nodes[i].Timer -= diff;
|
||||
}
|
||||
else
|
||||
{ EventPlayerDestroyedPoint(i); }
|
||||
}
|
||||
|
|
@ -303,20 +341,28 @@ void BattleGroundAV::EndBattleGround(Team winner)
|
|||
for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i)
|
||||
if (m_Nodes[i].State == POINT_CONTROLLED)
|
||||
if (m_Nodes[i].TotalOwner == BG_AV_TEAM_ALLIANCE)
|
||||
{ ++tower_survived[TEAM_INDEX_ALLIANCE]; }
|
||||
{
|
||||
++tower_survived[TEAM_INDEX_ALLIANCE];
|
||||
}
|
||||
for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i)
|
||||
if (m_Nodes[i].State == POINT_CONTROLLED)
|
||||
if (m_Nodes[i].TotalOwner == BG_AV_TEAM_HORDE)
|
||||
{ ++tower_survived[TEAM_INDEX_HORDE]; }
|
||||
{
|
||||
++tower_survived[TEAM_INDEX_HORDE];
|
||||
}
|
||||
|
||||
// graves all controlled
|
||||
for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
|
||||
if (m_Nodes[i].State == POINT_CONTROLLED && m_Nodes[i].Owner != BG_AV_TEAM_NEUTRAL)
|
||||
{ ++graves_owned[m_Nodes[i].Owner]; }
|
||||
{
|
||||
++graves_owned[m_Nodes[i].Owner];
|
||||
}
|
||||
|
||||
for (uint8 i = 0; i < BG_AV_MAX_MINES; ++i)
|
||||
if (m_Mine_Owner[i] != BG_AV_TEAM_NEUTRAL)
|
||||
{ ++mines_owned[m_Mine_Owner[i]]; }
|
||||
{
|
||||
++mines_owned[m_Mine_Owner[i]];
|
||||
}
|
||||
|
||||
// now we have the values give the honor/reputation to the teams:
|
||||
Team team[PVP_TEAM_COUNT] = { ALLIANCE, HORDE };
|
||||
|
|
@ -330,9 +376,13 @@ void BattleGroundAV::EndBattleGround(Team winner)
|
|||
}
|
||||
DEBUG_LOG("BattleGroundAV: EndbattleGround: bgteam: %u towers:%u honor:%u rep:%u", i, tower_survived[i], GetBonusHonorFromKill(tower_survived[i] * BG_AV_KILL_SURVIVING_TOWER), tower_survived[i] * BG_AV_REP_SURVIVING_TOWER);
|
||||
if (graves_owned[i])
|
||||
{ RewardReputationToTeam(faction[i], graves_owned[i] * m_RepOwnedGrave, team[i]); }
|
||||
{
|
||||
RewardReputationToTeam(faction[i], graves_owned[i] * m_RepOwnedGrave, team[i]);
|
||||
}
|
||||
if (mines_owned[i])
|
||||
{ RewardReputationToTeam(faction[i], mines_owned[i] * m_RepOwnedMine, team[i]); }
|
||||
{
|
||||
RewardReputationToTeam(faction[i], mines_owned[i] * m_RepOwnedMine, team[i]);
|
||||
}
|
||||
// captain survived?:
|
||||
if (!IsActiveEvent(BG_AV_NodeEventCaptainDead_A + GetTeamIndexByTeamId(team[i]), 0))
|
||||
{
|
||||
|
|
@ -358,13 +408,17 @@ bool BattleGroundAV::HandleAreaTrigger(Player* source, uint32 trigger)
|
|||
case 95:
|
||||
case 2608:
|
||||
if (source->GetTeam() != ALLIANCE)
|
||||
{ source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_ALLIANCE_USE); }
|
||||
{
|
||||
source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_ALLIANCE_USE);
|
||||
}
|
||||
else
|
||||
{ source->LeaveBattleground(); }
|
||||
break;
|
||||
case 2606:
|
||||
if (source->GetTeam() != HORDE)
|
||||
{ source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_HORDE_USE); }
|
||||
{
|
||||
source->GetSession()->SendNotification(LANG_BATTLEGROUND_ONLY_HORDE_USE);
|
||||
}
|
||||
else
|
||||
{ source->LeaveBattleground(); }
|
||||
break;
|
||||
|
|
@ -378,7 +432,9 @@ void BattleGroundAV::UpdatePlayerScore(Player* source, uint32 type, uint32 value
|
|||
{
|
||||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
|
||||
if (itr == m_PlayerScores.end()) // player not found...
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
|
@ -441,7 +497,9 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, BattleGroundAVTeamIndex teamIdx
|
|||
// TODO changing the owner should result in setting respawntime to infinite for current creatures (they should fight the new ones), spawning new mine owners creatures and changing the chest - objects so that the current owning team can use them
|
||||
MANGOS_ASSERT(mine == BG_AV_NORTH_MINE || mine == BG_AV_SOUTH_MINE);
|
||||
if (m_Mine_Owner[mine] == teamIdx)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_Mine_PrevOwner[mine] = m_Mine_Owner[mine];
|
||||
m_Mine_Owner[mine] = teamIdx;
|
||||
|
|
@ -464,9 +522,13 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, BattleGroundAVTeamIndex teamIdx
|
|||
bool BattleGroundAV::PlayerCanDoMineQuest(int32 GOId, Team team)
|
||||
{
|
||||
if (GOId == BG_AV_OBJECTID_MINE_N)
|
||||
{ return (m_Mine_Owner[BG_AV_NORTH_MINE] == GetAVTeamIndexByTeamId(team)); }
|
||||
{
|
||||
return (m_Mine_Owner[BG_AV_NORTH_MINE] == GetAVTeamIndexByTeamId(team));
|
||||
}
|
||||
if (GOId == BG_AV_OBJECTID_MINE_S)
|
||||
{ return (m_Mine_Owner[BG_AV_SOUTH_MINE] == GetAVTeamIndexByTeamId(team)); }
|
||||
{
|
||||
return (m_Mine_Owner[BG_AV_SOUTH_MINE] == GetAVTeamIndexByTeamId(team));
|
||||
}
|
||||
return true; // cause it's no mine'object it is ok if this is true
|
||||
}
|
||||
|
||||
|
|
@ -479,7 +541,9 @@ void BattleGroundAV::PopulateNode(BG_AV_Nodes node)
|
|||
{
|
||||
uint32 graveDefenderType;
|
||||
if (m_Team_QuestStatus[teamIdx][0] < 500)
|
||||
{ graveDefenderType = 0; }
|
||||
{
|
||||
graveDefenderType = 0;
|
||||
}
|
||||
else if (m_Team_QuestStatus[teamIdx][0] < 1000)
|
||||
{ graveDefenderType = 1; }
|
||||
else if (m_Team_QuestStatus[teamIdx][0] < 1500)
|
||||
|
|
@ -488,7 +552,9 @@ void BattleGroundAV::PopulateNode(BG_AV_Nodes node)
|
|||
{ graveDefenderType = 3; }
|
||||
|
||||
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
|
||||
{ SpawnEvent(BG_AV_NODES_MAX + node, m_Nodes[node].PrevOwner * BG_AV_MAX_GRAVETYPES + graveDefenderType, false); }
|
||||
}
|
||||
|
|
@ -499,11 +565,15 @@ void BattleGroundAV::PopulateNode(BG_AV_Nodes node)
|
|||
void BattleGroundAV::EventPlayerClickedOnFlag(Player* source, GameObject* target_obj)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
DEBUG_LOG("BattleGroundAV: using gameobject %i", target_obj->GetEntry());
|
||||
uint8 event = (sBattleGroundMgr.GetGameObjectEventIndex(target_obj->GetGUIDLow())).event1;
|
||||
if (event >= BG_AV_NODES_MAX) // not a node
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
BG_AV_Nodes node = BG_AV_Nodes(event);
|
||||
switch ((sBattleGroundMgr.GetGameObjectEventIndex(target_obj->GetGUIDLow())).event2 % BG_AV_MAX_STATES)
|
||||
{
|
||||
|
|
@ -525,7 +595,9 @@ void BattleGroundAV::EventPlayerDefendsPoint(Player* player, BG_AV_Nodes node)
|
|||
PvpTeamIndex teamIdx = GetTeamIndexByTeamId(player->GetTeam());
|
||||
|
||||
if (m_Nodes[node].Owner == BattleGroundAVTeamIndex(teamIdx) || m_Nodes[node].State != POINT_ASSAULTED)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (m_Nodes[node].TotalOwner == BG_AV_TEAM_NEUTRAL) // initial snowfall capture
|
||||
{
|
||||
// until snowfall doesn't belong to anyone it is better handled in assault - code (best would be to have a special function
|
||||
|
|
@ -571,7 +643,9 @@ void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, BG_AV_Nodes node)
|
|||
PvpTeamIndex teamIdx = GetTeamIndexByTeamId(player->GetTeam());
|
||||
DEBUG_LOG("BattleGroundAV: player assaults node %i", node);
|
||||
if (m_Nodes[node].Owner == BattleGroundAVTeamIndex(teamIdx) || BattleGroundAVTeamIndex(teamIdx) == m_Nodes[node].TotalOwner)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AssaultNode(node, teamIdx); // update nodeinfo variables
|
||||
UpdateNodeWorldState(node); // send mapicon
|
||||
|
|
@ -612,7 +686,9 @@ void BattleGroundAV::FillInitialWorldStates(WorldPacket& data, uint32& count)
|
|||
}
|
||||
|
||||
if (m_Nodes[BG_AV_NODES_SNOWFALL_GRAVE].Owner == BG_AV_TEAM_NEUTRAL) // cause neutral teams aren't handled generic
|
||||
{ FillInitialWorldState(data, count, AV_SNOWFALL_N, WORLD_STATE_ADD); }
|
||||
{
|
||||
FillInitialWorldState(data, count, AV_SNOWFALL_N, WORLD_STATE_ADD);
|
||||
}
|
||||
|
||||
FillInitialWorldState(data, count, BG_AV_Alliance_Score, m_TeamScores[TEAM_INDEX_ALLIANCE]);
|
||||
FillInitialWorldState(data, count, BG_AV_Horde_Score, m_TeamScores[TEAM_INDEX_HORDE]);
|
||||
|
|
@ -629,18 +705,24 @@ void BattleGroundAV::FillInitialWorldStates(WorldPacket& data, uint32& count)
|
|||
|
||||
FillInitialWorldState(data, count, BG_AV_MineWorldStates[BG_AV_NORTH_MINE][m_Mine_Owner[BG_AV_NORTH_MINE]], WORLD_STATE_ADD);
|
||||
if (m_Mine_Owner[BG_AV_NORTH_MINE] != m_Mine_PrevOwner[BG_AV_NORTH_MINE])
|
||||
{ FillInitialWorldState(data, count, BG_AV_MineWorldStates[BG_AV_NORTH_MINE][m_Mine_PrevOwner[BG_AV_NORTH_MINE]], WORLD_STATE_REMOVE); }
|
||||
{
|
||||
FillInitialWorldState(data, count, BG_AV_MineWorldStates[BG_AV_NORTH_MINE][m_Mine_PrevOwner[BG_AV_NORTH_MINE]], WORLD_STATE_REMOVE);
|
||||
}
|
||||
|
||||
FillInitialWorldState(data, count, BG_AV_MineWorldStates[BG_AV_SOUTH_MINE][m_Mine_Owner[BG_AV_SOUTH_MINE]], WORLD_STATE_ADD);
|
||||
if (m_Mine_Owner[BG_AV_SOUTH_MINE] != m_Mine_PrevOwner[BG_AV_SOUTH_MINE])
|
||||
{ FillInitialWorldState(data, count, BG_AV_MineWorldStates[BG_AV_SOUTH_MINE][m_Mine_PrevOwner[BG_AV_SOUTH_MINE]], WORLD_STATE_REMOVE); }
|
||||
{
|
||||
FillInitialWorldState(data, count, BG_AV_MineWorldStates[BG_AV_SOUTH_MINE][m_Mine_PrevOwner[BG_AV_SOUTH_MINE]], WORLD_STATE_REMOVE);
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundAV::UpdateNodeWorldState(BG_AV_Nodes node)
|
||||
{
|
||||
UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].State, m_Nodes[node].Owner)], WORLD_STATE_ADD);
|
||||
if (m_Nodes[node].PrevOwner == BG_AV_TEAM_NEUTRAL) // currently only snowfall is supported as neutral node
|
||||
{ UpdateWorldState(AV_SNOWFALL_N, WORLD_STATE_REMOVE); }
|
||||
{
|
||||
UpdateWorldState(AV_SNOWFALL_N, WORLD_STATE_REMOVE);
|
||||
}
|
||||
else
|
||||
{ UpdateWorldState(BG_AV_NodeWorldStates[node][GetWorldStateType(m_Nodes[node].PrevState, m_Nodes[node].PrevOwner)], WORLD_STATE_REMOVE); }
|
||||
}
|
||||
|
|
@ -651,7 +733,9 @@ void BattleGroundAV::SendMineWorldStates(uint32 mine)
|
|||
|
||||
UpdateWorldState(BG_AV_MineWorldStates[mine][m_Mine_Owner[mine]], WORLD_STATE_ADD);
|
||||
if (m_Mine_Owner[mine] != m_Mine_PrevOwner[mine])
|
||||
{ UpdateWorldState(BG_AV_MineWorldStates[mine][m_Mine_PrevOwner[mine]], WORLD_STATE_REMOVE); }
|
||||
{
|
||||
UpdateWorldState(BG_AV_MineWorldStates[mine][m_Mine_PrevOwner[mine]], WORLD_STATE_REMOVE);
|
||||
}
|
||||
}
|
||||
|
||||
WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player* plr)
|
||||
|
|
@ -667,10 +751,14 @@ WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player* plr)
|
|||
for (uint8 i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i)
|
||||
{
|
||||
if (m_Nodes[i].Owner != teamIdx || m_Nodes[i].State != POINT_CONTROLLED)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(BG_AV_GraveyardIds[i]);
|
||||
if (!entry)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
float dist = (entry->x - x) * (entry->x - x) + (entry->y - y) * (entry->y - y);
|
||||
if (mindist > dist)
|
||||
{
|
||||
|
|
@ -681,7 +769,9 @@ WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player* plr)
|
|||
}
|
||||
// If not, place ghost in the starting-cave
|
||||
if (!good_entry)
|
||||
{ good_entry = sWorldSafeLocsStore.LookupEntry(BG_AV_GraveyardIds[teamIdx + 7]); }
|
||||
{
|
||||
good_entry = sWorldSafeLocsStore.LookupEntry(BG_AV_GraveyardIds[teamIdx + 7]);
|
||||
}
|
||||
|
||||
return good_entry;
|
||||
}
|
||||
|
|
@ -746,7 +836,9 @@ void BattleGroundAV::InitNode(BG_AV_Nodes node, BattleGroundAVTeamIndex teamIdx,
|
|||
m_Nodes[node].Tower = tower;
|
||||
m_ActiveEvents[node] = teamIdx * BG_AV_MAX_STATES + m_Nodes[node].State;
|
||||
if (IsGrave(node)) // grave-creatures are special cause of a quest
|
||||
{ m_ActiveEvents[node + BG_AV_NODES_MAX] = teamIdx * BG_AV_MAX_GRAVETYPES; }
|
||||
{
|
||||
m_ActiveEvents[node + BG_AV_NODES_MAX] = teamIdx * BG_AV_MAX_GRAVETYPES;
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundAV::DefendNode(BG_AV_Nodes node, PvpTeamIndex teamIdx)
|
||||
|
|
@ -821,9 +913,13 @@ Team BattleGroundAV::GetPrematureWinner()
|
|||
int32 allianceScore = m_TeamScores[TEAM_INDEX_ALLIANCE];
|
||||
|
||||
if (hordeScore > allianceScore)
|
||||
{ return HORDE; }
|
||||
{
|
||||
return HORDE;
|
||||
}
|
||||
if (allianceScore > hordeScore)
|
||||
{ return ALLIANCE; }
|
||||
{
|
||||
return ALLIANCE;
|
||||
}
|
||||
|
||||
// If the values are equal, fall back to number of players on each team
|
||||
return BattleGround::GetPrematureWinner();
|
||||
|
|
|
|||
|
|
@ -51,10 +51,14 @@ void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket& recv_data)
|
|||
Creature* pCreature = GetPlayer()->GetMap()->GetCreature(guid);
|
||||
|
||||
if (!pCreature)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!pCreature->IsBattleMaster()) // it's not battlemaster
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Stop the npc if moving
|
||||
pCreature->StopMoving();
|
||||
|
|
@ -62,7 +66,9 @@ void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket& recv_data)
|
|||
BattleGroundTypeId bgTypeId = sBattleGroundMgr.GetBattleMasterBG(pCreature->GetEntry());
|
||||
|
||||
if (bgTypeId == BATTLEGROUND_TYPE_NONE)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_player->GetBGAccessByLevel(bgTypeId))
|
||||
{
|
||||
|
|
@ -121,12 +127,16 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recv_data)
|
|||
|
||||
// ignore if player is already in BG
|
||||
if (_player->InBattleGround())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// get bg instance or bg template if instance not found
|
||||
BattleGround* bg = NULL;
|
||||
if (instanceId)
|
||||
{ bg = sBattleGroundMgr.GetBattleGroundThroughClientInstance(instanceId, bgTypeId); }
|
||||
{
|
||||
bg = sBattleGroundMgr.GetBattleGroundThroughClientInstance(instanceId, bgTypeId);
|
||||
}
|
||||
|
||||
if (!bg && !(bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId)))
|
||||
{
|
||||
|
|
@ -158,16 +168,22 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recv_data)
|
|||
{ return; }
|
||||
// check if has free queue slots
|
||||
if (!_player->HasFreeBattleGroundQueueId())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
grp = _player->GetGroup();
|
||||
// no group found, error
|
||||
if (!grp)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (grp->GetLeaderGuid() != _player->GetObjectGuid())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
err = grp->CanJoinBattleGroundQueue(bg, bgQueueTypeId, 0, bg->GetMaxPlayersPerTeam(), false, 0);
|
||||
isPremade = sWorld.getConfig(CONFIG_UINT32_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH) &&
|
||||
(grp->GetMembersCount() >= bg->GetMinPlayersPerTeam());
|
||||
|
|
@ -230,7 +246,9 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode(WorldPacket & /*recv_
|
|||
|
||||
BattleGround* bg = _player->GetBattleGround();
|
||||
if (!bg) // can't be received if player not in battleground
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player* flagCarrierA = NULL;
|
||||
Player* flagCarrierH = NULL;
|
||||
|
|
@ -295,7 +313,9 @@ void WorldSession::HandlePVPLogDataOpcode(WorldPacket & /*recv_data*/)
|
|||
|
||||
BattleGround* bg = _player->GetBattleGround();
|
||||
if (!bg)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// arena finish version will send in BattleGround::EndBattleGround directly
|
||||
if (bg->isArena())
|
||||
|
|
@ -388,7 +408,9 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket& recv_data)
|
|||
|
||||
// bg template might and must be used in case of leaving queue, when instance is not created yet
|
||||
if (!bg && action == 0)
|
||||
{ bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId); }
|
||||
{
|
||||
bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
|
||||
}
|
||||
if (!bg)
|
||||
{
|
||||
sLog.outError("BattlegroundHandler: bg_template not found for instance id %u type id %u.", ginfo.IsInvitedToBGInstanceGUID, bgTypeId);
|
||||
|
|
@ -454,7 +476,9 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket& recv_data)
|
|||
// this is still needed here if battleground "jumping" shouldn't add deserter debuff
|
||||
// also this is required to prevent stuck at old battleground after SetBattleGroundId set to new
|
||||
if (BattleGround* currentBg = _player->GetBattleGround())
|
||||
{ currentBg->RemovePlayerAtLeave(_player->GetObjectGuid(), false, true); }
|
||||
{
|
||||
currentBg->RemovePlayerAtLeave(_player->GetObjectGuid(), false, true);
|
||||
}
|
||||
|
||||
// set the destination instance id
|
||||
_player->SetBattleGroundId(bg->GetInstanceID(), bgTypeId);
|
||||
|
|
@ -501,7 +525,9 @@ void WorldSession::HandleLeaveBattlefieldOpcode(WorldPacket& recv_data)
|
|||
if (_player->IsInCombat())
|
||||
if (BattleGround* bg = _player->GetBattleGround())
|
||||
if (bg->GetStatus() != STATUS_WAIT_LEAVE)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_player->LeaveBattleground();
|
||||
}
|
||||
|
|
@ -518,7 +544,9 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recv_data*/)
|
|||
{
|
||||
BattleGroundQueueTypeId bgQueueTypeId = _player->GetBattleGroundQueueTypeId(i);
|
||||
if (!bgQueueTypeId)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
BattleGroundTypeId bgTypeId = BattleGroundMgr::BGTemplateId(bgQueueTypeId);
|
||||
ArenaType arenaType = BattleGroundMgr::BGArenaType(bgQueueTypeId);
|
||||
|
|
@ -541,12 +569,16 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recv_data*/)
|
|||
BattleGroundQueue& bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId];
|
||||
GroupQueueInfo ginfo;
|
||||
if (!bgQueue.GetPlayerGroupInfoData(_player->GetObjectGuid(), &ginfo))
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (ginfo.IsInvitedToBGInstanceGUID)
|
||||
{
|
||||
bg = sBattleGroundMgr.GetBattleGround(ginfo.IsInvitedToBGInstanceGUID, bgTypeId);
|
||||
if (!bg)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
uint32 remainingTime = WorldTimer::getMSTimeDiff(WorldTimer::getMSTime(), ginfo.RemoveInviteTime);
|
||||
// send status invited to BattleGround
|
||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, _player, i, STATUS_WAIT_JOIN, remainingTime, 0, arenaType);
|
||||
|
|
@ -556,7 +588,9 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recv_data*/)
|
|||
{
|
||||
bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
|
||||
if (!bg)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// expected bracket entry
|
||||
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->getLevel());
|
||||
|
|
@ -577,17 +611,23 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket& recv_data)
|
|||
|
||||
BattleGround* bg = _player->GetBattleGround();
|
||||
if (!bg)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ObjectGuid guid;
|
||||
recv_data >> guid;
|
||||
|
||||
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
|
||||
if (!unit)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!unit->IsSpiritService()) // it's not spirit service
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
unit->SendAreaSpiritHealerQueryOpcode(GetPlayer());
|
||||
}
|
||||
|
|
@ -598,17 +638,23 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket& recv_data)
|
|||
|
||||
BattleGround* bg = _player->GetBattleGround();
|
||||
if (!bg)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ObjectGuid guid;
|
||||
recv_data >> guid;
|
||||
|
||||
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
|
||||
if (!unit)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!unit->IsSpiritService()) // it's not spirit service
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
sScriptMgr.OnGossipHello(GetPlayer(), unit);
|
||||
}
|
||||
|
|
@ -800,4 +846,4 @@ void WorldSession::HandleRequestRatedBgInfo(WorldPacket & recvData)
|
|||
data << uint32(0);
|
||||
|
||||
SendPacket(&data);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,7 +128,9 @@ bool BattleGroundQueue::SelectionPool::KickGroup(uint32 size)
|
|||
PlayerCount -= ginfo->Players.size();
|
||||
// return false if we kicked smaller group or there are enough players in selection pool
|
||||
if (ginfo->Players.size() <= size + 1)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -148,7 +150,9 @@ bool BattleGroundQueue::SelectionPool::AddGroup(GroupQueueInfo* ginfo, uint32 de
|
|||
return true;
|
||||
}
|
||||
if (PlayerCount < desiredCount)
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -236,10 +240,14 @@ GroupQueueInfo* BattleGroundQueue::AddGroup(Player* leader, Group* grp, BattleGr
|
|||
GroupsQueueType::const_iterator itr;
|
||||
for (itr = m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_ALLIANCE].begin(); itr != m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_ALLIANCE].end(); ++itr)
|
||||
if (!(*itr)->IsInvitedToBGInstanceGUID)
|
||||
{ qAlliance += (*itr)->Players.size(); }
|
||||
{
|
||||
qAlliance += (*itr)->Players.size();
|
||||
}
|
||||
for (itr = m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_HORDE].begin(); itr != m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_HORDE].end(); ++itr)
|
||||
if (!(*itr)->IsInvitedToBGInstanceGUID)
|
||||
{ qHorde += (*itr)->Players.size(); }
|
||||
{
|
||||
qHorde += (*itr)->Players.size();
|
||||
}
|
||||
|
||||
// Show queue status to player only (when joining queue)
|
||||
if (sWorld.getConfig(CONFIG_UINT32_BATTLEGROUND_QUEUE_ANNOUNCER_JOIN) == 1)
|
||||
|
|
@ -304,7 +312,9 @@ uint32 BattleGroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattleG
|
|||
}
|
||||
// check if there is enought values(we always add values > 0)
|
||||
if (m_WaitTimes[team_index][bracket_id][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME - 1])
|
||||
{ return (m_SumOfWaitTimes[team_index][bracket_id] / COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME); }
|
||||
{
|
||||
return (m_SumOfWaitTimes[team_index][bracket_id] / COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME);
|
||||
}
|
||||
else
|
||||
// if there aren't enough values return 0 - not available
|
||||
{ return 0; }
|
||||
|
|
@ -369,14 +379,18 @@ void BattleGroundQueue::RemovePlayer(ObjectGuid guid, bool decreaseInvitedCount)
|
|||
// remove player queue info from group queue info
|
||||
GroupQueueInfoPlayers::iterator pitr = group->Players.find(guid);
|
||||
if (pitr != group->Players.end())
|
||||
{ group->Players.erase(pitr); }
|
||||
{
|
||||
group->Players.erase(pitr);
|
||||
}
|
||||
|
||||
// if invited to bg, and should decrease invited count, then do it
|
||||
if (decreaseInvitedCount && group->IsInvitedToBGInstanceGUID)
|
||||
{
|
||||
BattleGround* bg = sBattleGroundMgr.GetBattleGround(group->IsInvitedToBGInstanceGUID, group->BgTypeId);
|
||||
if (bg)
|
||||
{ bg->DecreaseInvitedCount(group->GroupTeam); }
|
||||
{
|
||||
bg->DecreaseInvitedCount(group->GroupTeam);
|
||||
}
|
||||
}
|
||||
|
||||
// remove player queue info
|
||||
|
|
@ -446,7 +460,9 @@ bool BattleGroundQueue::GetPlayerGroupInfoData(ObjectGuid guid, GroupQueueInfo*
|
|||
// ACE_Guard<ACE_Recursive_Thread_Mutex> g(m_Lock);
|
||||
QueuedPlayersMap::const_iterator qItr = m_QueuedPlayers.find(guid);
|
||||
if (qItr == m_QueuedPlayers.end())
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
*ginfo = *(qItr->second.GroupInfo);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -455,7 +471,9 @@ bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo* ginfo, BattleGround* bg,
|
|||
{
|
||||
// set side if needed
|
||||
if (side)
|
||||
{ ginfo->GroupTeam = side; }
|
||||
{
|
||||
ginfo->GroupTeam = side;
|
||||
}
|
||||
|
||||
if (!ginfo->IsInvitedToBGInstanceGUID)
|
||||
{
|
||||
|
|
@ -479,7 +497,9 @@ bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo* ginfo, BattleGround* bg,
|
|||
Player* plr = sObjectMgr.GetPlayer(itr->first);
|
||||
// if offline, skip him, this should not happen - player is removed from queue when he logs out
|
||||
if (!plr)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// invite the player
|
||||
PlayerInvitedToBGUpdateAverageWaitTime(ginfo, bracket_id);
|
||||
|
|
@ -541,7 +561,9 @@ void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BattleGroundBracketId
|
|||
|
||||
// if ofc like BG queue invitation is set in config, then we are happy
|
||||
if (sWorld.getConfig(CONFIG_UINT32_BATTLEGROUND_INVITATION_TYPE) == 0)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
if we reached this code, then we have to solve NP - complete problem called Subset sum problem
|
||||
|
|
@ -569,7 +591,9 @@ void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BattleGroundBracketId
|
|||
if (!m_SelectionPools[TEAM_INDEX_ALLIANCE].GetPlayerCount())
|
||||
{
|
||||
if (aliFree <= diffHorde + 1)
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
m_SelectionPools[TEAM_INDEX_HORDE].KickGroup(diffHorde - diffAli);
|
||||
}
|
||||
}
|
||||
|
|
@ -584,7 +608,9 @@ void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BattleGroundBracketId
|
|||
if (!m_SelectionPools[TEAM_INDEX_HORDE].GetPlayerCount())
|
||||
{
|
||||
if (hordeFree <= diffAli + 1)
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
m_SelectionPools[TEAM_INDEX_ALLIANCE].KickGroup(diffAli - diffHorde);
|
||||
}
|
||||
}
|
||||
|
|
@ -607,10 +633,14 @@ bool BattleGroundQueue::CheckPremadeMatch(BattleGroundBracketId bracket_id, uint
|
|||
GroupsQueueType::const_iterator ali_group, horde_group;
|
||||
for (ali_group = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].begin(); ali_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].end(); ++ali_group)
|
||||
if (!(*ali_group)->IsInvitedToBGInstanceGUID)
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
for (horde_group = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].begin(); horde_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].end(); ++horde_group)
|
||||
if (!(*horde_group)->IsInvitedToBGInstanceGUID)
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (ali_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].end() && horde_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].end())
|
||||
{
|
||||
|
|
@ -625,7 +655,9 @@ bool BattleGroundQueue::CheckPremadeMatch(BattleGroundBracketId bracket_id, uint
|
|||
{
|
||||
// if itr can join BG and player count is less that maxPlayers, then add group to selectionpool
|
||||
if (!(*itr)->IsInvitedToBGInstanceGUID && !m_SelectionPools[i].AddGroup((*itr), maxPlayers))
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// premade selection pools are set
|
||||
|
|
@ -667,14 +699,18 @@ bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BattleGround
|
|||
{
|
||||
m_SelectionPools[i].AddGroup(*(itr_team[i]), maxPlayers);
|
||||
if (m_SelectionPools[i].GetPlayerCount() >= minPlayers)
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// try to invite same number of players - this cycle may cause longer wait time even if there are enough players in queue, but we want ballanced bg
|
||||
uint32 j = TEAM_INDEX_ALLIANCE;
|
||||
if (m_SelectionPools[TEAM_INDEX_HORDE].GetPlayerCount() < m_SelectionPools[TEAM_INDEX_ALLIANCE].GetPlayerCount())
|
||||
{ j = TEAM_INDEX_HORDE; }
|
||||
{
|
||||
j = TEAM_INDEX_HORDE;
|
||||
}
|
||||
if (sWorld.getConfig(CONFIG_UINT32_BATTLEGROUND_INVITATION_TYPE) != 0
|
||||
&& m_SelectionPools[TEAM_INDEX_HORDE].GetPlayerCount() >= minPlayers && m_SelectionPools[TEAM_INDEX_ALLIANCE].GetPlayerCount() >= minPlayers)
|
||||
{
|
||||
|
|
@ -684,15 +720,21 @@ bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BattleGround
|
|||
{
|
||||
if (!(*(itr_team[j]))->IsInvitedToBGInstanceGUID)
|
||||
if (!m_SelectionPools[j].AddGroup(*(itr_team[j]), m_SelectionPools[(j + 1) % PVP_TEAM_COUNT].GetPlayerCount()))
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
// do not allow to start bg with more than 2 players more on 1 faction
|
||||
if (abs((int32)(m_SelectionPools[TEAM_INDEX_HORDE].GetPlayerCount() - m_SelectionPools[TEAM_INDEX_ALLIANCE].GetPlayerCount())) > 2)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// allow 1v0 if debug bg
|
||||
if (sBattleGroundMgr.isTesting() && bg_template->isBattleGround() && (m_SelectionPools[TEAM_INDEX_ALLIANCE].GetPlayerCount() || m_SelectionPools[TEAM_INDEX_HORDE].GetPlayerCount()))
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// return true if there are enough players in selection pools - enable to work .debug bg command correctly
|
||||
return m_SelectionPools[TEAM_INDEX_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[TEAM_INDEX_HORDE].GetPlayerCount() >= minPlayers;
|
||||
}
|
||||
|
|
@ -826,7 +868,9 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI
|
|||
uint32 MinPlayersPerTeam = bg_template->GetMinPlayersPerTeam();
|
||||
uint32 MaxPlayersPerTeam = bg_template->GetMaxPlayersPerTeam();
|
||||
if (sBattleGroundMgr.isTesting())
|
||||
{ MinPlayersPerTeam = 1; }
|
||||
{
|
||||
MinPlayersPerTeam = 1;
|
||||
}
|
||||
if (bg_template->isArena())
|
||||
{
|
||||
if (sBattleGroundMgr.isArenaTesting())
|
||||
|
|
@ -1052,12 +1096,16 @@ bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
|||
Player* plr = sObjectMgr.GetPlayer(m_PlayerGuid);
|
||||
// player logged off (we should do nothing, he is correctly removed from queue in another procedure)
|
||||
if (!plr)
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
BattleGround* bg = sBattleGroundMgr.GetBattleGround(m_BgInstanceGUID, m_BgTypeId);
|
||||
// if battleground ended and its instance deleted - do nothing
|
||||
if (!bg)
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
|
||||
uint32 queueSlot = plr->GetBattleGroundQueueIndex(bgQueueTypeId);
|
||||
|
|
@ -1671,7 +1719,9 @@ BattleGround* BattleGroundMgr::GetBattleGroundThroughClientInstance(uint32 insta
|
|||
// SMSG_BATTLEFIELD_LIST we need to find the battleground with this clientinstance-id
|
||||
BattleGround* bg = GetBattleGroundTemplate(bgTypeId);
|
||||
if (!bg)
|
||||
{ return NULL; }
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (bg->isArena())
|
||||
return GetBattleGround(instanceId, bgTypeId);
|
||||
|
|
@ -1679,7 +1729,9 @@ BattleGround* BattleGroundMgr::GetBattleGroundThroughClientInstance(uint32 insta
|
|||
for (BattleGroundSet::iterator itr = m_BattleGrounds[bgTypeId].begin(); itr != m_BattleGrounds[bgTypeId].end(); ++itr)
|
||||
{
|
||||
if (itr->second->GetClientInstanceID() == instanceId)
|
||||
{ return itr->second; }
|
||||
{
|
||||
return itr->second;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -1694,7 +1746,9 @@ BattleGround* BattleGroundMgr::GetBattleGround(uint32 InstanceID, BattleGroundTy
|
|||
{
|
||||
itr = m_BattleGrounds[i].find(InstanceID);
|
||||
if (itr != m_BattleGrounds[i].end())
|
||||
{ return itr->second; }
|
||||
{
|
||||
return itr->second;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -1724,7 +1778,9 @@ uint32 BattleGroundMgr::CreateClientVisibleInstanceId(BattleGroundTypeId bgTypeI
|
|||
for (ClientBattleGroundIdSet::const_iterator itr = ids.begin(); itr != ids.end();)
|
||||
{
|
||||
if ((++lastId) != *itr) // if there is a gap between the ids, we will break..
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
lastId = *itr;
|
||||
}
|
||||
ids.insert(lastId + 1);
|
||||
|
|
@ -1975,7 +2031,9 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
|||
|
||||
// sLog.outDetail("Creating battleground %s, %u-%u", bl->name[sWorld.GetDBClang()], MinLvl, MaxLvl);
|
||||
if (!CreateBattleGround(bgTypeID, IsArena, MinPlayersPerTeam, MaxPlayersPerTeam, bl->minLevel, bl->maxLevel, bl->name[sWorld.GetDefaultDbcLocale()], bl->mapid[0], AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3]))
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
++count;
|
||||
}
|
||||
|
|
@ -2064,7 +2122,9 @@ void BattleGroundMgr::DistributeArenaPoints()
|
|||
void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket* data, ObjectGuid guid, Player* plr, BattleGroundTypeId bgTypeId)
|
||||
{
|
||||
if (!plr)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BattleGround* bgTemplate = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
|
||||
|
||||
|
|
@ -2121,7 +2181,9 @@ void BattleGroundMgr::SendToBattleGround(Player* pl, uint32 instanceId, BattleGr
|
|||
float x, y, z, O;
|
||||
Team team = pl->GetBGTeam();
|
||||
if (team == 0)
|
||||
{ team = pl->GetTeam(); }
|
||||
{
|
||||
team = pl->GetTeam();
|
||||
}
|
||||
bg->GetTeamStartLoc(team, x, y, z, O);
|
||||
|
||||
DETAIL_LOG("BATTLEGROUND: Sending %s to map %u, X %f, Y %f, Z %f, O %f", pl->GetName(), mapid, x, y, z, O);
|
||||
|
|
@ -2241,7 +2303,9 @@ void BattleGroundMgr::ToggleTesting()
|
|||
{
|
||||
m_Testing = !m_Testing;
|
||||
if (m_Testing)
|
||||
{ sWorld.SendWorldText(LANG_DEBUG_BG_ON); }
|
||||
{
|
||||
sWorld.SendWorldText(LANG_DEBUG_BG_ON);
|
||||
}
|
||||
else
|
||||
{ sWorld.SendWorldText(LANG_DEBUG_BG_OFF); }
|
||||
}
|
||||
|
|
@ -2270,7 +2334,9 @@ void BattleGroundMgr::ScheduleQueueUpdate(uint32 arenaRating, ArenaType arenaTyp
|
|||
}
|
||||
}
|
||||
if (!found)
|
||||
{ m_QueueUpdateScheduler.push_back(schedule_id); }
|
||||
{
|
||||
m_QueueUpdateScheduler.push_back(schedule_id);
|
||||
}
|
||||
}
|
||||
|
||||
uint32 BattleGroundMgr::GetMaxRatingDifference() const
|
||||
|
|
@ -2473,7 +2539,9 @@ void BattleGroundMgr::LoadBattleEventIndexes()
|
|||
}
|
||||
|
||||
if (gameobject)
|
||||
{ m_GameObjectBattleEventIndexMap[dbTableGuidLow] = events; }
|
||||
{
|
||||
m_GameObjectBattleEventIndexMap[dbTableGuidLow] = events;
|
||||
}
|
||||
else
|
||||
{ m_CreatureBattleEventIndexMap[dbTableGuidLow] = events; }
|
||||
|
||||
|
|
|
|||
|
|
@ -572,7 +572,9 @@ class BattleGroundMgr
|
|||
{
|
||||
BattleMastersMap::const_iterator itr = mBattleMastersMap.find(entry);
|
||||
if (itr != mBattleMastersMap.end())
|
||||
{ return itr->second; }
|
||||
{
|
||||
return itr->second;
|
||||
}
|
||||
return BATTLEGROUND_TYPE_NONE;
|
||||
}
|
||||
|
||||
|
|
@ -591,7 +593,9 @@ class BattleGroundMgr
|
|||
{
|
||||
CreatureBattleEventIndexesMap::const_iterator itr = m_CreatureBattleEventIndexMap.find(dbTableGuidLow);
|
||||
if (itr != m_CreatureBattleEventIndexMap.end())
|
||||
{ return itr->second; }
|
||||
{
|
||||
return itr->second;
|
||||
}
|
||||
return m_CreatureBattleEventIndexMap.find(-1)->second;
|
||||
}
|
||||
/**
|
||||
|
|
@ -604,7 +608,9 @@ class BattleGroundMgr
|
|||
{
|
||||
GameObjectBattleEventIndexesMap::const_iterator itr = m_GameObjectBattleEventIndexMap.find(dbTableGuidLow);
|
||||
if (itr != m_GameObjectBattleEventIndexMap.end())
|
||||
{ return itr->second; }
|
||||
{
|
||||
return itr->second;
|
||||
}
|
||||
return m_GameObjectBattleEventIndexMap.find(-1)->second;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -162,11 +162,15 @@ void BattleGroundWS::RespawnFlag(Team team, bool captured)
|
|||
void BattleGroundWS::RespawnDroppedFlag(Team team)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RespawnFlag(team, false);
|
||||
if (team == ALLIANCE)
|
||||
{ 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
|
||||
{ SendMessageToAll(LANG_BG_WS_HORDE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL); }
|
||||
|
||||
|
|
@ -174,7 +178,9 @@ void BattleGroundWS::RespawnDroppedFlag(Team team)
|
|||
|
||||
GameObject* obj = GetBgMap()->GetGameObject(GetDroppedFlagGuid(team));
|
||||
if (obj)
|
||||
{ obj->Delete(); }
|
||||
{
|
||||
obj->Delete();
|
||||
}
|
||||
else
|
||||
{ sLog.outError("Unknown dropped flag bg: %s", GetDroppedFlagGuid(team).GetString().c_str()); }
|
||||
|
||||
|
|
@ -184,7 +190,9 @@ void BattleGroundWS::RespawnDroppedFlag(Team team)
|
|||
void BattleGroundWS::EventPlayerCapturedFlag(Player* source)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_LastCapturedFlagTeam = source->GetTeam();
|
||||
|
||||
|
|
@ -192,28 +200,36 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player* source)
|
|||
if (source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
if (!IsHordeFlagPickedUp())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
ClearHordeFlagCarrier(); // must be before aura remove to prevent 2 events (drop+capture) at the same time
|
||||
// horde flag in base (but not respawned yet)
|
||||
m_FlagState[TEAM_INDEX_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
|
||||
// Drop Horde Flag from Player
|
||||
source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
|
||||
if (m_TeamScores[TEAM_INDEX_ALLIANCE] < BG_WS_MAX_TEAM_SCORE)
|
||||
{ m_TeamScores[TEAM_INDEX_ALLIANCE] += 1; }
|
||||
{
|
||||
m_TeamScores[TEAM_INDEX_ALLIANCE] += 1;
|
||||
}
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE);
|
||||
RewardReputationToTeam(890, m_ReputationCapture, ALLIANCE);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!IsAllianceFlagPickedUp())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
ClearAllianceFlagCarrier(); // must be before aura remove to prevent 2 events (drop+capture) at the same time
|
||||
// alliance flag in base (but not respawned yet)
|
||||
m_FlagState[TEAM_INDEX_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
|
||||
// Drop Alliance Flag from Player
|
||||
source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
|
||||
if (m_TeamScores[TEAM_INDEX_HORDE] < BG_WS_MAX_TEAM_SCORE)
|
||||
{ m_TeamScores[TEAM_INDEX_HORDE] += 1; }
|
||||
{
|
||||
m_TeamScores[TEAM_INDEX_HORDE] += 1;
|
||||
}
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE);
|
||||
RewardReputationToTeam(889, m_ReputationCapture, HORDE);
|
||||
}
|
||||
|
|
@ -225,7 +241,9 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player* source)
|
|||
SpawnEvent(WS_EVENT_FLAG_H, 0, false);
|
||||
|
||||
if (source->GetTeam() == ALLIANCE)
|
||||
{ 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
|
||||
{ SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, source); }
|
||||
|
||||
|
|
@ -236,7 +254,9 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player* source)
|
|||
|
||||
Team winner = TEAM_NONE;
|
||||
if (m_TeamScores[TEAM_INDEX_ALLIANCE] == BG_WS_MAX_TEAM_SCORE)
|
||||
{ winner = ALLIANCE; }
|
||||
{
|
||||
winner = ALLIANCE;
|
||||
}
|
||||
else if (m_TeamScores[TEAM_INDEX_HORDE] == BG_WS_MAX_TEAM_SCORE)
|
||||
{ winner = HORDE; }
|
||||
|
||||
|
|
@ -264,7 +284,9 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player* source)
|
|||
if (source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
if (!IsHordeFlagPickedUp())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (GetHordeFlagCarrierGuid() == source->GetObjectGuid())
|
||||
{
|
||||
ClearHordeFlagCarrier();
|
||||
|
|
@ -274,7 +296,9 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player* source)
|
|||
else
|
||||
{
|
||||
if (!IsAllianceFlagPickedUp())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (GetAllianceFlagCarrierGuid() == source->GetObjectGuid())
|
||||
{
|
||||
ClearAllianceFlagCarrier();
|
||||
|
|
@ -289,7 +313,9 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player* source)
|
|||
if (source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
if (!IsHordeFlagPickedUp())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (GetHordeFlagCarrierGuid() == source->GetObjectGuid())
|
||||
{
|
||||
ClearHordeFlagCarrier();
|
||||
|
|
@ -302,7 +328,9 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player* source)
|
|||
else
|
||||
{
|
||||
if (!IsAllianceFlagPickedUp())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (GetAllianceFlagCarrierGuid() == source->GetObjectGuid())
|
||||
{
|
||||
ClearAllianceFlagCarrier();
|
||||
|
|
@ -336,7 +364,9 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player* source)
|
|||
void BattleGroundWS::EventPlayerClickedOnFlag(Player* source, GameObject* target_obj)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int32 message_id = 0;
|
||||
ChatMsg type;
|
||||
|
|
@ -432,7 +462,9 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player* source, GameObject* target
|
|||
}
|
||||
|
||||
if (!message_id)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SendMessageToAll(message_id, type, source);
|
||||
source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
|
|
@ -468,7 +500,9 @@ void BattleGroundWS::RemovePlayer(Player* plr, ObjectGuid guid)
|
|||
void BattleGroundWS::UpdateFlagState(Team team, uint32 value)
|
||||
{
|
||||
if (team == ALLIANCE)
|
||||
{ UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, value); }
|
||||
{
|
||||
UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, value);
|
||||
}
|
||||
else
|
||||
{ UpdateWorldState(BG_WS_FLAG_STATE_HORDE, value); }
|
||||
}
|
||||
|
|
@ -485,19 +519,25 @@ bool BattleGroundWS::HandleAreaTrigger(Player* source, uint32 trigger)
|
|||
{
|
||||
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (trigger)
|
||||
{
|
||||
case 3646: // Alliance Flag spawn
|
||||
if (m_FlagState[TEAM_INDEX_HORDE] && !m_FlagState[TEAM_INDEX_ALLIANCE])
|
||||
if (GetHordeFlagCarrierGuid() == source->GetObjectGuid())
|
||||
{ EventPlayerCapturedFlag(source); }
|
||||
{
|
||||
EventPlayerCapturedFlag(source);
|
||||
}
|
||||
break;
|
||||
case 3647: // Horde Flag spawn
|
||||
if (m_FlagState[TEAM_INDEX_ALLIANCE] && !m_FlagState[TEAM_INDEX_HORDE])
|
||||
if (GetAllianceFlagCarrierGuid() == source->GetObjectGuid())
|
||||
{ EventPlayerCapturedFlag(source); }
|
||||
{
|
||||
EventPlayerCapturedFlag(source);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
|
|
@ -551,7 +591,9 @@ void BattleGroundWS::EndBattleGround(Team winner)
|
|||
void BattleGroundWS::HandleKillPlayer(Player* player, Player* killer)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
EventPlayerDroppedFlag(player);
|
||||
|
||||
|
|
@ -562,7 +604,9 @@ void BattleGroundWS::UpdatePlayerScore(Player* source, uint32 type, uint32 value
|
|||
{
|
||||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(source->GetObjectGuid());
|
||||
if (itr == m_PlayerScores.end()) // player not found
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
|
@ -588,14 +632,18 @@ WorldSafeLocsEntry const* BattleGroundWS::GetClosestGraveYard(Player* player)
|
|||
if (player->GetTeam() == ALLIANCE)
|
||||
{
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{ return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_ALLIANCE); }
|
||||
{
|
||||
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_ALLIANCE);
|
||||
}
|
||||
else
|
||||
{ return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_FLAGROOM_ALLIANCE); }
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{ return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_HORDE); }
|
||||
{
|
||||
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_HORDE);
|
||||
}
|
||||
else
|
||||
{ return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_FLAGROOM_HORDE); }
|
||||
}
|
||||
|
|
@ -607,14 +655,18 @@ void BattleGroundWS::FillInitialWorldStates(WorldPacket& data, uint32& count)
|
|||
FillInitialWorldState(data, count, BG_WS_FLAG_CAPTURES_HORDE, m_TeamScores[TEAM_INDEX_HORDE]);
|
||||
|
||||
if (m_FlagState[TEAM_INDEX_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
{ 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)
|
||||
{ FillInitialWorldState(data, count, BG_WS_FLAG_UNK_ALLIANCE, 1); }
|
||||
else
|
||||
{ FillInitialWorldState(data, count, BG_WS_FLAG_UNK_ALLIANCE, 0); }
|
||||
|
||||
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)
|
||||
{ FillInitialWorldState(data, count, BG_WS_FLAG_UNK_HORDE, 1); }
|
||||
else
|
||||
|
|
@ -623,12 +675,16 @@ void BattleGroundWS::FillInitialWorldStates(WorldPacket& data, uint32& count)
|
|||
FillInitialWorldState(data, count, BG_WS_FLAG_CAPTURES_MAX, BG_WS_MAX_TEAM_SCORE);
|
||||
|
||||
if (m_FlagState[TEAM_INDEX_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
{ FillInitialWorldState(data, count, BG_WS_FLAG_STATE_HORDE, 2); }
|
||||
{
|
||||
FillInitialWorldState(data, count, BG_WS_FLAG_STATE_HORDE, 2);
|
||||
}
|
||||
else
|
||||
{ FillInitialWorldState(data, count, BG_WS_FLAG_STATE_HORDE, 1); }
|
||||
|
||||
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
|
||||
{ FillInitialWorldState(data, count, BG_WS_FLAG_STATE_ALLIANCE, 1); }
|
||||
|
||||
|
|
@ -642,9 +698,13 @@ Team BattleGroundWS::GetPrematureWinner()
|
|||
int32 allianceScore = m_TeamScores[TEAM_INDEX_ALLIANCE];
|
||||
|
||||
if (hordeScore > allianceScore)
|
||||
{ return HORDE; }
|
||||
{
|
||||
return HORDE;
|
||||
}
|
||||
if (allianceScore > hordeScore)
|
||||
{ return ALLIANCE; }
|
||||
{
|
||||
return ALLIANCE;
|
||||
}
|
||||
|
||||
// If the values are equal, fall back to number of players on each team
|
||||
return BattleGround::GetPrematureWinner();
|
||||
|
|
|
|||
|
|
@ -46,7 +46,9 @@ bool ChatHandler::HandleHelpCommand(char* args)
|
|||
else
|
||||
{
|
||||
if (!ShowHelpForCommand(getCommandTable(), args))
|
||||
{ SendSysMessage(LANG_NO_CMD); }
|
||||
{
|
||||
SendSysMessage(LANG_NO_CMD);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -62,7 +64,9 @@ bool ChatHandler::HandleAccountCommand(char* args)
|
|||
{
|
||||
// let show subcommands at unexpected data in args
|
||||
if (*args)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
AccountTypes gmlevel = GetAccessLevel();
|
||||
PSendSysMessage(LANG_ACCOUNT_LEVEL, uint32(gmlevel));
|
||||
|
|
@ -108,7 +112,9 @@ bool ChatHandler::HandleServerInfoCommand(char* /*args*/)
|
|||
{
|
||||
char const* ver = sScriptMgr.GetScriptLibraryVersion();
|
||||
if (ver && *ver)
|
||||
{ PSendSysMessage(LANG_USING_SCRIPT_LIB, ver); }
|
||||
{
|
||||
PSendSysMessage(LANG_USING_SCRIPT_LIB, ver);
|
||||
}
|
||||
else
|
||||
{ SendSysMessage(LANG_USING_SCRIPT_LIB_UNKNOWN); }
|
||||
}
|
||||
|
|
@ -161,7 +167,9 @@ bool ChatHandler::HandleSaveCommand(char* /*args*/)
|
|||
// save or plan save after 20 sec (logout delay) if current next save time more this value and _not_ output any messages to prevent cheat planning
|
||||
uint32 save_interval = sWorld.getConfig(CONFIG_UINT32_INTERVAL_SAVE);
|
||||
if (save_interval == 0 || (save_interval > 20 * IN_MILLISECONDS && player->GetSaveTimer() <= save_interval - 20 * IN_MILLISECONDS))
|
||||
{ player->SaveToDB(); }
|
||||
{
|
||||
player->SaveToDB();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -214,7 +222,9 @@ bool ChatHandler::HandleAccountPasswordCommand(char* args)
|
|||
char* new_pass_c = ExtractQuotedOrLiteralArg(&args);
|
||||
|
||||
if (!old_pass || !new_pass || !new_pass_c)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string password_old = old_pass;
|
||||
std::string password_new = new_pass;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -44,18 +44,24 @@
|
|||
bool ChatHandler::HandleAccountDeleteCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string account_name;
|
||||
uint32 account_id = ExtractAccountId(&args, &account_name);
|
||||
if (!account_id)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Commands not recommended call from chat, but support anyway
|
||||
/// can delete only for account with less security
|
||||
/// This is also reject self apply in fact
|
||||
if (HasLowerSecurityAccount(NULL, account_id, true))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
AccountOpResult result = sAccountMgr.DeleteAccount(account_id);
|
||||
switch (result)
|
||||
|
|
@ -94,12 +100,16 @@ bool ChatHandler::GetDeletedCharacterInfoList(DeletedInfoList& foundList, std::s
|
|||
{
|
||||
// search by GUID
|
||||
if (isNumeric(searchString))
|
||||
{ resultChar = CharacterDatabase.PQuery("SELECT guid, deleteInfos_Name, deleteInfos_Account, deleteDate FROM characters WHERE deleteDate IS NOT NULL AND guid = %u", uint32(atoi(searchString.c_str()))); }
|
||||
{
|
||||
resultChar = CharacterDatabase.PQuery("SELECT guid, deleteInfos_Name, deleteInfos_Account, deleteDate FROM characters WHERE deleteDate IS NOT NULL AND guid = %u", uint32(atoi(searchString.c_str())));
|
||||
}
|
||||
// search by name
|
||||
else
|
||||
{
|
||||
if (!normalizePlayerName(searchString))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
resultChar = CharacterDatabase.PQuery("SELECT guid, deleteInfos_Name, deleteInfos_Account, deleteDate FROM characters WHERE deleteDate IS NOT NULL AND deleteInfos_Name " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), searchString.c_str());
|
||||
}
|
||||
|
|
@ -157,7 +167,9 @@ std::string ChatHandler::GenerateDeletedCharacterGUIDsWhereStr(DeletedInfoList::
|
|||
|
||||
DeletedInfoList::const_iterator itr2 = itr;
|
||||
if (++itr2 != itr_end)
|
||||
{ wherestr << "','"; }
|
||||
{
|
||||
wherestr << "','";
|
||||
}
|
||||
}
|
||||
wherestr << "')";
|
||||
return wherestr.str();
|
||||
|
|
@ -197,7 +209,9 @@ void ChatHandler::HandleCharacterDeletedListHelper(DeletedInfoList const& foundL
|
|||
}
|
||||
|
||||
if (!m_session)
|
||||
{ SendSysMessage(LANG_CHARACTER_DELETED_LIST_BAR); }
|
||||
{
|
||||
SendSysMessage(LANG_CHARACTER_DELETED_LIST_BAR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -214,7 +228,9 @@ bool ChatHandler::HandleCharacterDeletedListCommand(char* args)
|
|||
{
|
||||
DeletedInfoList foundList;
|
||||
if (!GetDeletedCharacterInfoList(foundList, args))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// if no characters have been found, output a warning
|
||||
if (foundList.empty())
|
||||
|
|
@ -278,7 +294,9 @@ bool ChatHandler::HandleCharacterDeletedRestoreCommand(char* args)
|
|||
{
|
||||
// It is required to submit at least one argument
|
||||
if (!*args)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string searchString;
|
||||
std::string newCharName;
|
||||
|
|
@ -290,7 +308,9 @@ bool ChatHandler::HandleCharacterDeletedRestoreCommand(char* args)
|
|||
|
||||
DeletedInfoList foundList;
|
||||
if (!GetDeletedCharacterInfoList(foundList, searchString))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (foundList.empty())
|
||||
{
|
||||
|
|
@ -343,11 +363,15 @@ bool ChatHandler::HandleCharacterDeletedDeleteCommand(char* args)
|
|||
{
|
||||
// It is required to submit at least one argument
|
||||
if (!*args)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
DeletedInfoList foundList;
|
||||
if (!GetDeletedCharacterInfoList(foundList, args))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (foundList.empty())
|
||||
{
|
||||
|
|
@ -381,10 +405,14 @@ bool ChatHandler::HandleCharacterDeletedOldCommand(char* args)
|
|||
int32 keepDays = sWorld.getConfig(CONFIG_UINT32_CHARDELETE_KEEP_DAYS);
|
||||
|
||||
if (!ExtractOptInt32(&args, keepDays, sWorld.getConfig(CONFIG_UINT32_CHARDELETE_KEEP_DAYS)))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (keepDays < 0)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Player::DeleteOldCharacters((uint32)keepDays);
|
||||
return true;
|
||||
|
|
@ -394,13 +422,17 @@ bool ChatHandler::HandleCharacterEraseCommand(char* args)
|
|||
{
|
||||
char* nameStr = ExtractLiteralArg(&args);
|
||||
if (!nameStr)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Player* target;
|
||||
ObjectGuid target_guid;
|
||||
std::string target_name;
|
||||
if (!ExtractPlayerTarget(&nameStr, &target, &target_guid, &target_name))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 account_id;
|
||||
|
||||
|
|
@ -441,7 +473,9 @@ bool ChatHandler::HandleAccountOnlineListCommand(char* args)
|
|||
{
|
||||
uint32 limit;
|
||||
if (!ExtractOptUInt32(&args, limit, 100))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
///- Get the list of accounts ID logged to the realm
|
||||
// 0 1 2 3 4
|
||||
|
|
@ -457,7 +491,9 @@ bool ChatHandler::HandleAccountCreateCommand(char* args)
|
|||
char* szAcc = ExtractQuotedOrLiteralArg(&args);
|
||||
char* szPassword = ExtractQuotedOrLiteralArg(&args);
|
||||
if (!szAcc || !szPassword)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// normalized in accmgr.CreateAccount
|
||||
std::string account_name = szAcc;
|
||||
|
|
@ -503,13 +539,17 @@ bool ChatHandler::HandleServerLogFilterCommand(char* args)
|
|||
SendSysMessage(LANG_LOG_FILTERS_STATE_HEADER);
|
||||
for (int i = 0; i < LOG_FILTER_COUNT; ++i)
|
||||
if (*logFilterData[i].name)
|
||||
{ PSendSysMessage(" %-20s = %s", logFilterData[i].name, GetOnOffStr(sLog.HasLogFilter(1 << i))); }
|
||||
{
|
||||
PSendSysMessage(" %-20s = %s", logFilterData[i].name, GetOnOffStr(sLog.HasLogFilter(1 << i)));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
char* filtername = ExtractLiteralArg(&args);
|
||||
if (!filtername)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool value;
|
||||
if (!ExtractOnOff(&args, value))
|
||||
|
|
@ -529,7 +569,9 @@ bool ChatHandler::HandleServerLogFilterCommand(char* args)
|
|||
for (int i = 0; i < LOG_FILTER_COUNT; ++i)
|
||||
{
|
||||
if (!*logFilterData[i].name)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!strncmp(filtername, logFilterData[i].name, strlen(filtername)))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -41,28 +41,40 @@
|
|||
bool ChatHandler::HandleDebugSendSpellFailCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 failnum;
|
||||
if (!ExtractUInt32(&args, failnum) || failnum > 255)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 failarg1;
|
||||
if (!ExtractOptUInt32(&args, failarg1, 0))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 failarg2;
|
||||
if (!ExtractOptUInt32(&args, failarg2, 0))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
WorldPacket data(SMSG_CAST_FAILED, 5);
|
||||
data << uint8(0);
|
||||
data << uint32(133);
|
||||
data << uint8(failnum);
|
||||
if (failarg1 || failarg2)
|
||||
{ data << uint32(failarg1); }
|
||||
{
|
||||
data << uint32(failarg1);
|
||||
}
|
||||
if (failarg2)
|
||||
{ data << uint32(failarg2); }
|
||||
{
|
||||
data << uint32(failarg2);
|
||||
}
|
||||
|
||||
m_session->SendPacket(&data);
|
||||
|
||||
|
|
@ -81,11 +93,15 @@ bool ChatHandler::HandleDebugSendPoiCommand(char* args)
|
|||
|
||||
uint32 icon;
|
||||
if (!ExtractUInt32(&args, icon))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 flags;
|
||||
if (!ExtractUInt32(&args, flags))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
DETAIL_LOG("Command : POI, NPC = %u, icon = %u flags = %u", target->GetGUIDLow(), icon, flags);
|
||||
pPlayer->PlayerTalkClass->SendPointOfInterest(target->GetPositionX(), target->GetPositionY(), Poi_Icon(icon), flags, 30, "Test POI");
|
||||
|
|
@ -95,7 +111,9 @@ bool ChatHandler::HandleDebugSendPoiCommand(char* args)
|
|||
bool ChatHandler::HandleDebugSendEquipErrorCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8 msg = atoi(args);
|
||||
m_session->GetPlayer()->SendEquipError(InventoryResult(msg), NULL, NULL);
|
||||
|
|
@ -105,7 +123,9 @@ bool ChatHandler::HandleDebugSendEquipErrorCommand(char* args)
|
|||
bool ChatHandler::HandleDebugSendSellErrorCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8 msg = atoi(args);
|
||||
m_session->GetPlayer()->SendSellError(SellResult(msg), 0, ObjectGuid(), 0);
|
||||
|
|
@ -115,7 +135,9 @@ bool ChatHandler::HandleDebugSendSellErrorCommand(char* args)
|
|||
bool ChatHandler::HandleDebugSendBuyErrorCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8 msg = atoi(args);
|
||||
m_session->GetPlayer()->SendBuyError(BuyResult(msg), 0, 0, 0);
|
||||
|
|
@ -126,11 +148,15 @@ bool ChatHandler::HandleDebugSendOpcodeCommand(char* /*args*/)
|
|||
{
|
||||
Unit* unit = getSelectedUnit();
|
||||
if (!unit || (unit->GetTypeId() != TYPEID_PLAYER))
|
||||
{ unit = m_session->GetPlayer(); }
|
||||
{
|
||||
unit = m_session->GetPlayer();
|
||||
}
|
||||
|
||||
std::ifstream stream("opcode.txt");
|
||||
if (!stream.is_open())
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 opcode = 0;
|
||||
if (!(stream >> opcode))
|
||||
|
|
@ -145,7 +171,9 @@ bool ChatHandler::HandleDebugSendOpcodeCommand(char* /*args*/)
|
|||
while (stream >> type)
|
||||
{
|
||||
if (type.empty())
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (type == "uint8")
|
||||
{
|
||||
|
|
@ -209,11 +237,15 @@ bool ChatHandler::HandleDebugUpdateWorldStateCommand(char* args)
|
|||
{
|
||||
uint32 world;
|
||||
if (!ExtractUInt32(&args, world))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 state;
|
||||
if (!ExtractUInt32(&args, state))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_session->GetPlayer()->SendUpdateWorldState(world, state);
|
||||
return true;
|
||||
|
|
@ -225,7 +257,9 @@ bool ChatHandler::HandleDebugPlayCinematicCommand(char* args)
|
|||
// #cinematicid - ID decimal number from CinemaicSequences.dbc (1st column)
|
||||
uint32 dwId;
|
||||
if (!ExtractUInt32(&args, dwId))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sCinematicSequencesStore.LookupEntry(dwId))
|
||||
{
|
||||
|
|
@ -264,7 +298,9 @@ bool ChatHandler::HandleDebugPlaySoundCommand(char* args)
|
|||
// #soundid - ID decimal number from SoundEntries.dbc (1st column)
|
||||
uint32 dwSoundId;
|
||||
if (!ExtractUInt32(&args, dwSoundId))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sSoundEntriesStore.LookupEntry(dwSoundId))
|
||||
{
|
||||
|
|
@ -282,7 +318,9 @@ bool ChatHandler::HandleDebugPlaySoundCommand(char* args)
|
|||
}
|
||||
|
||||
if (m_session->GetPlayer()->GetSelectionGuid())
|
||||
{ unit->PlayDistanceSound(dwSoundId, m_session->GetPlayer()); }
|
||||
{
|
||||
unit->PlayDistanceSound(dwSoundId, m_session->GetPlayer());
|
||||
}
|
||||
else
|
||||
{ unit->PlayDirectSound(dwSoundId, m_session->GetPlayer()); }
|
||||
|
||||
|
|
@ -297,7 +335,9 @@ bool ChatHandler::HandleDebugSendChannelNotifyCommand(char* args)
|
|||
|
||||
uint32 code;
|
||||
if (!ExtractUInt32(&args, code) || code > 255)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
WorldPacket data(SMSG_CHANNEL_NOTIFY, (1 + 10));
|
||||
data << uint8(code); // notify type
|
||||
|
|
@ -315,7 +355,9 @@ bool ChatHandler::HandleDebugSendChatMsgCommand(char* args)
|
|||
|
||||
uint32 type;
|
||||
if (!ExtractUInt32(&args, type) || type > 255)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, ChatMsg(type), msg, LANG_UNIVERSAL, CHAT_TAG_NONE, m_session->GetPlayer()->GetObjectGuid(), m_session->GetPlayerName());
|
||||
|
|
@ -327,7 +369,9 @@ bool ChatHandler::HandleDebugSendQuestPartyMsgCommand(char* args)
|
|||
{
|
||||
uint32 msg;
|
||||
if (!ExtractUInt32(&args, msg))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_session->GetPlayer()->SendPushToPartyResponse(m_session->GetPlayer(), msg);
|
||||
return true;
|
||||
|
|
@ -337,10 +381,14 @@ bool ChatHandler::HandleDebugGetLootRecipientCommand(char* /*args*/)
|
|||
{
|
||||
Creature* target = getSelectedCreature();
|
||||
if (!target)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!target->HasLootRecipient())
|
||||
{ SendSysMessage("loot recipient: no loot recipient"); }
|
||||
{
|
||||
SendSysMessage("loot recipient: no loot recipient");
|
||||
}
|
||||
else if (Player* recipient = target->GetLootRecipient())
|
||||
PSendSysMessage("loot recipient: %s with raw data %s from group %u",
|
||||
recipient->GetGuidStr().c_str(),
|
||||
|
|
@ -362,7 +410,9 @@ bool ChatHandler::HandleDebugSendQuestInvalidMsgCommand(char* args)
|
|||
bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemUpdateState state = ITEM_UNCHANGED;
|
||||
bool list_queue = false, check_all = false;
|
||||
|
|
@ -406,7 +456,9 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
|||
for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i)
|
||||
{
|
||||
if (i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
|
||||
if (!item) { continue; }
|
||||
|
|
@ -455,7 +507,9 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
|||
item->GetGuidStr().c_str(), bag_slot, item->GetSlot(), st.c_str());
|
||||
}
|
||||
if (updateQueue.empty())
|
||||
{ PSendSysMessage("updatequeue empty"); }
|
||||
{
|
||||
PSendSysMessage("updatequeue empty");
|
||||
}
|
||||
}
|
||||
|
||||
if (check_all)
|
||||
|
|
@ -465,7 +519,9 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
|||
for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i)
|
||||
{
|
||||
if (i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
|
||||
if (!item) { continue; }
|
||||
|
|
@ -638,7 +694,9 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
|||
}
|
||||
}
|
||||
if (!error)
|
||||
{ SendSysMessage("All OK!"); }
|
||||
{
|
||||
SendSysMessage("All OK!");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -691,7 +749,9 @@ bool ChatHandler::HandleDebugPhaseCommand(char* args)
|
|||
{
|
||||
uint32 emote_id;
|
||||
if (!ExtractUInt32(&args, emote_id))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_session->GetPlayer()->HandleEmoteCommand(emote_id);
|
||||
return true;
|
||||
|
|
@ -702,7 +762,9 @@ bool ChatHandler::HandleDebugAnimCommand(char* args)
|
|||
{
|
||||
uint32 emote_id;
|
||||
if (!ExtractUInt32(&args, emote_id))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_session->GetPlayer()->HandleEmoteCommand(emote_id);
|
||||
return true;
|
||||
|
|
@ -712,7 +774,9 @@ bool ChatHandler::HandleDebugSetAuraStateCommand(char* args)
|
|||
{
|
||||
int32 state;
|
||||
if (!ExtractInt32(&args, state))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Unit* unit = getSelectedUnit();
|
||||
if (!unit)
|
||||
|
|
@ -747,7 +811,9 @@ bool ChatHandler::HandleSetValueHelper(Object* target, uint32 field, char* typeS
|
|||
|
||||
uint32 base; // 0 -> float
|
||||
if (!typeStr)
|
||||
{ base = 10; }
|
||||
{
|
||||
base = 10;
|
||||
}
|
||||
else if (strncmp(typeStr, "int", strlen(typeStr)) == 0)
|
||||
{ base = 10; }
|
||||
else if (strncmp(typeStr, "hex", strlen(typeStr)) == 0)
|
||||
|
|
@ -763,7 +829,9 @@ bool ChatHandler::HandleSetValueHelper(Object* target, uint32 field, char* typeS
|
|||
{
|
||||
uint32 iValue;
|
||||
if (!ExtractUInt32Base(&valStr, iValue, base))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
DEBUG_LOG(GetMangosString(LANG_SET_UINT), guid.GetString().c_str(), field, iValue);
|
||||
target->SetUInt32Value(field , iValue);
|
||||
|
|
@ -773,7 +841,9 @@ bool ChatHandler::HandleSetValueHelper(Object* target, uint32 field, char* typeS
|
|||
{
|
||||
float fValue;
|
||||
if (!ExtractFloat(&valStr, fValue))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
DEBUG_LOG(GetMangosString(LANG_SET_FLOAT), guid.GetString().c_str(), field, fValue);
|
||||
target->SetFloatValue(field , fValue);
|
||||
|
|
@ -787,23 +857,33 @@ bool ChatHandler::HandleDebugSetItemValueCommand(char* args)
|
|||
{
|
||||
uint32 guid;
|
||||
if (!ExtractUInt32(&args, guid))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 field;
|
||||
if (!ExtractUInt32(&args, field))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
char* typeStr = ExtractOptNotLastArg(&args);
|
||||
if (!typeStr)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
char* valStr = ExtractLiteralArg(&args);
|
||||
if (!valStr)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Item* item = m_session->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, guid));
|
||||
if (!item)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return HandleSetValueHelper(item, field, typeStr, valStr);
|
||||
}
|
||||
|
|
@ -820,15 +900,21 @@ bool ChatHandler::HandleDebugSetValueCommand(char* args)
|
|||
|
||||
uint32 field;
|
||||
if (!ExtractUInt32(&args, field))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
char* typeStr = ExtractOptNotLastArg(&args);
|
||||
if (!typeStr)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
char* valStr = ExtractLiteralArg(&args);
|
||||
if (!valStr)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return HandleSetValueHelper(target, field, typeStr, valStr);
|
||||
}
|
||||
|
|
@ -845,7 +931,9 @@ bool ChatHandler::HandleGetValueHelper(Object* target, uint32 field, char* typeS
|
|||
|
||||
uint32 base; // 0 -> float
|
||||
if (!typeStr)
|
||||
{ base = 10; }
|
||||
{
|
||||
base = 10;
|
||||
}
|
||||
else if (strncmp(typeStr, "int", strlen(typeStr)) == 0)
|
||||
{ base = 10; }
|
||||
else if (strncmp(typeStr, "hex", strlen(typeStr)) == 0)
|
||||
|
|
@ -899,19 +987,27 @@ bool ChatHandler::HandleDebugGetItemValueCommand(char* args)
|
|||
{
|
||||
uint32 guid;
|
||||
if (!ExtractUInt32(&args, guid))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 field;
|
||||
if (!ExtractUInt32(&args, field))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
char* typeStr = ExtractLiteralArg(&args);
|
||||
if (!typeStr && *args) // optional arg but check format fail case
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Item* item = m_session->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, guid));
|
||||
if (!item)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return HandleGetValueHelper(item, field, typeStr);
|
||||
}
|
||||
|
|
@ -928,11 +1024,15 @@ bool ChatHandler::HandleDebugGetValueCommand(char* args)
|
|||
|
||||
uint32 field;
|
||||
if (!ExtractUInt32(&args, field))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
char* typeStr = ExtractLiteralArg(&args);
|
||||
if (!typeStr && *args) // optional arg but check format fail case
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return HandleGetValueHelper(target, field, typeStr);
|
||||
}
|
||||
|
|
@ -950,7 +1050,9 @@ bool ChatHandler::HandlerDebugModValueHelper(Object* target, uint32 field, char*
|
|||
|
||||
uint32 type; // 0 -> float 1 -> int add 2-> bit or 3 -> bit and 4 -> bit and not
|
||||
if (strncmp(typeStr, "int", strlen(typeStr)) == 0)
|
||||
{ type = 1; }
|
||||
{
|
||||
type = 1;
|
||||
}
|
||||
else if (strncmp(typeStr, "float", strlen(typeStr)) == 0)
|
||||
{ type = 0; }
|
||||
else if (strncmp(typeStr, "|=", strlen("|=") + 1) == 0) // exactly copy
|
||||
|
|
@ -966,7 +1068,9 @@ bool ChatHandler::HandlerDebugModValueHelper(Object* target, uint32 field, char*
|
|||
{
|
||||
uint32 iValue;
|
||||
if (!ExtractUInt32Base(&valStr, iValue, type == 1 ? 10 : 16))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 value = target->GetUInt32Value(field);
|
||||
const char* guidString = guid.GetString().c_str();
|
||||
|
|
@ -1002,7 +1106,9 @@ bool ChatHandler::HandlerDebugModValueHelper(Object* target, uint32 field, char*
|
|||
{
|
||||
float fValue;
|
||||
if (!ExtractFloat(&valStr, fValue))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
float value = target->GetFloatValue(field);
|
||||
|
||||
|
|
@ -1021,23 +1127,33 @@ bool ChatHandler::HandleDebugModItemValueCommand(char* args)
|
|||
{
|
||||
uint32 guid;
|
||||
if (!ExtractUInt32(&args, guid))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 field;
|
||||
if (!ExtractUInt32(&args, field))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
char* typeStr = ExtractLiteralArg(&args);
|
||||
if (!typeStr)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
char* valStr = ExtractLiteralArg(&args);
|
||||
if (!valStr)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Item* item = m_session->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, guid));
|
||||
if (!item)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return HandlerDebugModValueHelper(item, field, typeStr, valStr);
|
||||
}
|
||||
|
|
@ -1054,15 +1170,21 @@ bool ChatHandler::HandleDebugModValueCommand(char* args)
|
|||
|
||||
uint32 field;
|
||||
if (!ExtractUInt32(&args, field))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
char* typeStr = ExtractLiteralArg(&args);
|
||||
if (!typeStr && *args) // optional arg but check format fail case
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
char* valStr = ExtractLiteralArg(&args);
|
||||
if (!valStr)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return HandlerDebugModValueHelper(target, field, typeStr, valStr);
|
||||
}
|
||||
|
|
@ -1071,11 +1193,15 @@ bool ChatHandler::HandleDebugSpellCoefsCommand(char* args)
|
|||
{
|
||||
uint32 spellid = ExtractSpellIdFromLink(&args);
|
||||
if (!spellid)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
SpellEntry const* spellEntry = sSpellStore.LookupEntry(spellid);
|
||||
if (!spellEntry)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellid);
|
||||
|
||||
|
|
@ -1128,11 +1254,15 @@ bool ChatHandler::HandleDebugSpellModsCommand(char* args)
|
|||
{
|
||||
char* typeStr = ExtractLiteralArg(&args);
|
||||
if (!typeStr)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Opcodes opcode;
|
||||
if (strncmp(typeStr, "flat", strlen(typeStr)) == 0)
|
||||
{ opcode = SMSG_SET_FLAT_SPELL_MODIFIER; }
|
||||
{
|
||||
opcode = SMSG_SET_FLAT_SPELL_MODIFIER;
|
||||
}
|
||||
else if (strncmp(typeStr, "pct", strlen(typeStr)) == 0)
|
||||
{ opcode = SMSG_SET_PCT_SPELL_MODIFIER; }
|
||||
else
|
||||
|
|
@ -1140,15 +1270,21 @@ bool ChatHandler::HandleDebugSpellModsCommand(char* args)
|
|||
|
||||
uint32 effidx;
|
||||
if (!ExtractUInt32(&args, effidx) || effidx >= 64 + 32)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 spellmodop;
|
||||
if (!ExtractUInt32(&args, spellmodop) || spellmodop >= MAX_SPELLMOD)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int32 value;
|
||||
if (!ExtractInt32(&args, value))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Player* chr = getSelectedPlayer();
|
||||
if (chr == NULL)
|
||||
|
|
@ -1160,7 +1296,9 @@ bool ChatHandler::HandleDebugSpellModsCommand(char* args)
|
|||
|
||||
// check online security
|
||||
if (HasLowerSecurity(chr))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
PSendSysMessage(LANG_YOU_CHANGE_SPELLMODS, opcode == SMSG_SET_FLAT_SPELL_MODIFIER ? "flat" : "pct",
|
||||
spellmodop, value, effidx, GetNameLink(chr).c_str());
|
||||
|
|
|
|||
|
|
@ -37,7 +37,9 @@ void ConfusedMovementGenerator<T>::Initialize(T& unit)
|
|||
unit.GetPosition(i_x, i_y, i_z);
|
||||
|
||||
if (!unit.IsAlive() || unit.hasUnitState(UNIT_STAT_NOT_MOVE))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
unit.StopMoving();
|
||||
unit.addUnitState(UNIT_STAT_CONFUSED_MOVE);
|
||||
|
|
@ -57,7 +59,9 @@ void ConfusedMovementGenerator<T>::Reset(T& unit)
|
|||
i_nextMoveTime.Reset(0);
|
||||
|
||||
if (!unit.IsAlive() || unit.hasUnitState(UNIT_STAT_NOT_MOVE))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
unit.StopMoving();
|
||||
unit.addUnitState(UNIT_STAT_CONFUSED | UNIT_STAT_CONFUSED_MOVE);
|
||||
|
|
@ -68,7 +72,9 @@ bool ConfusedMovementGenerator<T>::Update(T& unit, const uint32& diff)
|
|||
{
|
||||
// ignore in case other no reaction state
|
||||
if (unit.hasUnitState(UNIT_STAT_CAN_NOT_REACT & ~UNIT_STAT_CONFUSED))
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (i_nextMoveTime.Passed())
|
||||
{
|
||||
|
|
@ -76,7 +82,9 @@ bool ConfusedMovementGenerator<T>::Update(T& unit, const uint32& diff)
|
|||
unit.addUnitState(UNIT_STAT_CONFUSED_MOVE);
|
||||
|
||||
if (unit.movespline->Finalized())
|
||||
{ i_nextMoveTime.Reset(urand(800, 1500)); }
|
||||
{
|
||||
i_nextMoveTime.Reset(urand(800, 1500));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -39,7 +39,9 @@ void FleeingMovementGenerator<T>::_setTargetLocation(T& owner)
|
|||
{
|
||||
// ignore in case other no reaction state
|
||||
if (owner.hasUnitState((UNIT_STAT_CAN_NOT_REACT | UNIT_STAT_NOT_MOVE) & ~UNIT_STAT_FLEEING))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
float x, y, z;
|
||||
if (!_getPoint(owner, x, y, z))
|
||||
|
|
@ -76,7 +78,9 @@ bool FleeingMovementGenerator<T>::_getPoint(T& owner, float& x, float& y, float&
|
|||
{
|
||||
dist_from_caster = fright->GetDistance(&owner);
|
||||
if (dist_from_caster > 0.2f)
|
||||
{ angle_to_caster = fright->GetAngle(&owner); }
|
||||
{
|
||||
angle_to_caster = fright->GetAngle(&owner);
|
||||
}
|
||||
else
|
||||
{ angle_to_caster = frand(0, 2 * M_PI_F); }
|
||||
}
|
||||
|
|
@ -172,7 +176,9 @@ template<class T>
|
|||
bool FleeingMovementGenerator<T>::Update(T& owner, const uint32& time_diff)
|
||||
{
|
||||
if (!owner.IsAlive())
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// ignore in case other no reaction state
|
||||
if (owner.hasUnitState((UNIT_STAT_CAN_NOT_REACT | UNIT_STAT_NOT_MOVE) & ~UNIT_STAT_FLEEING))
|
||||
|
|
@ -183,7 +189,9 @@ bool FleeingMovementGenerator<T>::Update(T& owner, const uint32& time_diff)
|
|||
|
||||
i_nextCheckTime.Update(time_diff);
|
||||
if (i_nextCheckTime.Passed() && owner.movespline->Finalized())
|
||||
{ _setTargetLocation(owner); }
|
||||
{
|
||||
_setTargetLocation(owner);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -217,7 +225,9 @@ void TimedFleeingMovementGenerator::Finalize(Unit& owner)
|
|||
bool TimedFleeingMovementGenerator::Update(Unit& owner, const uint32& time_diff)
|
||||
{
|
||||
if (!owner.IsAlive())
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// ignore in case other no reaction state
|
||||
if (owner.hasUnitState((UNIT_STAT_CAN_NOT_REACT | UNIT_STAT_NOT_MOVE) & ~UNIT_STAT_FLEEING))
|
||||
|
|
@ -228,7 +238,9 @@ bool TimedFleeingMovementGenerator::Update(Unit& owner, const uint32& time_diff)
|
|||
|
||||
i_totalFleeTime.Update(time_diff);
|
||||
if (i_totalFleeTime.Passed())
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// This calls grant-parent Update method hiden by FleeingMovementGenerator::Update(Creature &, const uint32 &) version
|
||||
// This is done instead of casting Unit& to Creature& and call parent method, then we can use Unit directly
|
||||
|
|
|
|||
|
|
@ -42,7 +42,9 @@ void HomeMovementGenerator<Creature>::Reset(Creature&)
|
|||
void HomeMovementGenerator<Creature>::_setTargetLocation(Creature& owner)
|
||||
{
|
||||
if (owner.hasUnitState(UNIT_STAT_NOT_MOVE))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Movement::MoveSplineInit init(owner);
|
||||
float x, y, z, o;
|
||||
|
|
@ -71,7 +73,9 @@ void HomeMovementGenerator<Creature>::Finalize(Creature& owner)
|
|||
if (arrived)
|
||||
{
|
||||
if (owner.GetTemporaryFactionFlags() & TEMPFACTION_RESTORE_REACH_HOME)
|
||||
{ owner.ClearTemporaryFaction(); }
|
||||
{
|
||||
owner.ClearTemporaryFaction();
|
||||
}
|
||||
|
||||
owner.SetWalk(!owner.hasUnitState(UNIT_STAT_RUNNING_STATE) && !owner.IsLevitating(), false);
|
||||
owner.LoadCreatureAddon(true);
|
||||
|
|
|
|||
|
|
@ -60,7 +60,9 @@ bool
|
|||
DistractMovementGenerator::Update(Unit& /*owner*/, const uint32& time_diff)
|
||||
{
|
||||
if (time_diff > m_timer)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_timer -= time_diff;
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -76,14 +76,18 @@ MotionMaster::~MotionMaster()
|
|||
MovementGenerator* m = top();
|
||||
pop();
|
||||
if (!isStatic(m))
|
||||
{ delete m; }
|
||||
{
|
||||
delete m;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MotionMaster::UpdateMotion(uint32 diff)
|
||||
{
|
||||
if (m_owner->hasUnitState(UNIT_STAT_CAN_NOT_MOVE))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MANGOS_ASSERT(!empty());
|
||||
m_cleanFlag |= MMCF_UPDATE;
|
||||
|
|
@ -102,14 +106,18 @@ void MotionMaster::UpdateMotion(uint32 diff)
|
|||
{
|
||||
MovementGenerator* mg = (*m_expList)[i];
|
||||
if (!isStatic(mg))
|
||||
{ delete mg; }
|
||||
{
|
||||
delete mg;
|
||||
}
|
||||
}
|
||||
|
||||
delete m_expList;
|
||||
m_expList = NULL;
|
||||
|
||||
if (empty())
|
||||
{ Initialize(); }
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
if (m_cleanFlag & MMCF_RESET)
|
||||
{
|
||||
|
|
@ -128,7 +136,9 @@ void MotionMaster::DirectClean(bool reset, bool all)
|
|||
curr->Finalize(*m_owner);
|
||||
|
||||
if (!isStatic(curr))
|
||||
{ delete curr; }
|
||||
{
|
||||
delete curr;
|
||||
}
|
||||
}
|
||||
|
||||
if (!all && reset)
|
||||
|
|
@ -141,15 +151,21 @@ void MotionMaster::DirectClean(bool reset, bool all)
|
|||
void MotionMaster::DelayedClean(bool reset, bool all)
|
||||
{
|
||||
if (reset)
|
||||
{ m_cleanFlag |= MMCF_RESET; }
|
||||
{
|
||||
m_cleanFlag |= MMCF_RESET;
|
||||
}
|
||||
else
|
||||
{ m_cleanFlag &= ~MMCF_RESET; }
|
||||
|
||||
if (empty() || (!all && size() == 1))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_expList)
|
||||
{ m_expList = new ExpireList(); }
|
||||
{
|
||||
m_expList = new ExpireList();
|
||||
}
|
||||
|
||||
while (all ? !empty() : size() > 1)
|
||||
{
|
||||
|
|
@ -158,14 +174,18 @@ void MotionMaster::DelayedClean(bool reset, bool all)
|
|||
curr->Finalize(*m_owner);
|
||||
|
||||
if (!isStatic(curr))
|
||||
{ m_expList->push_back(curr); }
|
||||
{
|
||||
m_expList->push_back(curr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MotionMaster::DirectExpire(bool reset)
|
||||
{
|
||||
if (empty() || size() == 1)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MovementGenerator* curr = top();
|
||||
pop();
|
||||
|
|
@ -185,31 +205,43 @@ void MotionMaster::DirectExpire(bool reset)
|
|||
curr->Finalize(*m_owner);
|
||||
|
||||
if (!isStatic(curr))
|
||||
{ delete curr; }
|
||||
{
|
||||
delete curr;
|
||||
}
|
||||
|
||||
if (empty())
|
||||
{ Initialize(); }
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
// Prevent reseting possible new pushed MMGen
|
||||
if (reset && top() == nowTop)
|
||||
{ top()->Reset(*m_owner); }
|
||||
{
|
||||
top()->Reset(*m_owner);
|
||||
}
|
||||
}
|
||||
|
||||
void MotionMaster::DelayedExpire(bool reset)
|
||||
{
|
||||
if (reset)
|
||||
{ m_cleanFlag |= MMCF_RESET; }
|
||||
{
|
||||
m_cleanFlag |= MMCF_RESET;
|
||||
}
|
||||
else
|
||||
{ m_cleanFlag &= ~MMCF_RESET; }
|
||||
|
||||
if (empty() || size() == 1)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MovementGenerator* curr = top();
|
||||
pop();
|
||||
|
||||
if (!m_expList)
|
||||
{ m_expList = new ExpireList(); }
|
||||
{
|
||||
m_expList = new ExpireList();
|
||||
}
|
||||
|
||||
// also drop stored under top() targeted motions
|
||||
while (!empty() && (top()->GetMovementGeneratorType() == CHASE_MOTION_TYPE || top()->GetMovementGeneratorType() == FOLLOW_MOTION_TYPE))
|
||||
|
|
@ -223,13 +255,17 @@ void MotionMaster::DelayedExpire(bool reset)
|
|||
curr->Finalize(*m_owner);
|
||||
|
||||
if (!isStatic(curr))
|
||||
{ m_expList->push_back(curr); }
|
||||
{
|
||||
m_expList->push_back(curr);
|
||||
}
|
||||
}
|
||||
|
||||
void MotionMaster::MoveIdle()
|
||||
{
|
||||
if (empty() || !isStatic(top()))
|
||||
{ push(&si_idleMovement); }
|
||||
{
|
||||
push(&si_idleMovement);
|
||||
}
|
||||
}
|
||||
|
||||
void MotionMaster::MoveRandomAroundPoint(float x, float y, float z, float radius, float verticalZ)
|
||||
|
|
@ -248,7 +284,9 @@ void MotionMaster::MoveRandomAroundPoint(float x, float y, float z, float radius
|
|||
void MotionMaster::MoveTargetedHome()
|
||||
{
|
||||
if (m_owner->hasUnitState(UNIT_STAT_LOST_CONTROL))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Clear(false);
|
||||
|
||||
|
|
@ -256,7 +294,9 @@ void MotionMaster::MoveTargetedHome()
|
|||
{
|
||||
// Manual exception for linked mobs
|
||||
if (m_owner->IsLinkingEventTrigger() && m_owner->GetMap()->GetCreatureLinkingHolder()->TryFollowMaster((Creature*)m_owner))
|
||||
{ DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s refollowed linked master", m_owner->GetGuidStr().c_str()); }
|
||||
{
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s refollowed linked master", m_owner->GetGuidStr().c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s targeted home", m_owner->GetGuidStr().c_str());
|
||||
|
|
@ -284,7 +324,9 @@ void MotionMaster::MoveConfused()
|
|||
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s move confused", m_owner->GetGuidStr().c_str());
|
||||
|
||||
if (m_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{ Mutate(new ConfusedMovementGenerator<Player>()); }
|
||||
{
|
||||
Mutate(new ConfusedMovementGenerator<Player>());
|
||||
}
|
||||
else
|
||||
{ Mutate(new ConfusedMovementGenerator<Creature>()); }
|
||||
}
|
||||
|
|
@ -293,12 +335,16 @@ void MotionMaster::MoveChase(Unit* target, float dist, float angle)
|
|||
{
|
||||
// ignore movement request if target not exist
|
||||
if (!target)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s chase to %s", m_owner->GetGuidStr().c_str(), target->GetGuidStr().c_str());
|
||||
|
||||
if (m_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{ Mutate(new ChaseMovementGenerator<Player>(*target, dist, angle)); }
|
||||
{
|
||||
Mutate(new ChaseMovementGenerator<Player>(*target, dist, angle));
|
||||
}
|
||||
else
|
||||
{ Mutate(new ChaseMovementGenerator<Creature>(*target, dist, angle)); }
|
||||
}
|
||||
|
|
@ -306,18 +352,24 @@ void MotionMaster::MoveChase(Unit* target, float dist, float angle)
|
|||
void MotionMaster::MoveFollow(Unit* target, float dist, float angle)
|
||||
{
|
||||
if (m_owner->hasUnitState(UNIT_STAT_LOST_CONTROL))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Clear();
|
||||
|
||||
// ignore movement request if target not exist
|
||||
if (!target)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s follow to %s", m_owner->GetGuidStr().c_str(), target->GetGuidStr().c_str());
|
||||
|
||||
if (m_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{ Mutate(new FollowMovementGenerator<Player>(*target, dist, angle)); }
|
||||
{
|
||||
Mutate(new FollowMovementGenerator<Player>(*target, dist, angle));
|
||||
}
|
||||
else
|
||||
{ Mutate(new FollowMovementGenerator<Creature>(*target, dist, angle)); }
|
||||
}
|
||||
|
|
@ -327,7 +379,9 @@ void MotionMaster::MovePoint(uint32 id, float x, float y, float z, bool generate
|
|||
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s targeted point (Id: %u X: %f Y: %f Z: %f)", m_owner->GetGuidStr().c_str(), id, x, y, z);
|
||||
|
||||
if (m_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{ Mutate(new PointMovementGenerator<Player>(id, x, y, z, generatePath)); }
|
||||
{
|
||||
Mutate(new PointMovementGenerator<Player>(id, x, y, z, generatePath));
|
||||
}
|
||||
else
|
||||
{ Mutate(new PointMovementGenerator<Creature>(id, x, y, z, generatePath)); }
|
||||
}
|
||||
|
|
@ -363,16 +417,22 @@ void MotionMaster::MoveSeekAssistanceDistract(uint32 time)
|
|||
void MotionMaster::MoveFleeing(Unit* enemy, uint32 time)
|
||||
{
|
||||
if (!enemy)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s flee from %s", m_owner->GetGuidStr().c_str(), enemy->GetGuidStr().c_str());
|
||||
|
||||
if (m_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{ Mutate(new FleeingMovementGenerator<Player>(enemy->GetObjectGuid())); }
|
||||
{
|
||||
Mutate(new FleeingMovementGenerator<Player>(enemy->GetObjectGuid()));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (time)
|
||||
{ Mutate(new TimedFleeingMovementGenerator(enemy->GetObjectGuid(), time)); }
|
||||
{
|
||||
Mutate(new TimedFleeingMovementGenerator(enemy->GetObjectGuid(), time));
|
||||
}
|
||||
else
|
||||
{ Mutate(new FleeingMovementGenerator<Creature>(enemy->GetObjectGuid())); }
|
||||
}
|
||||
|
|
@ -434,7 +494,9 @@ void MotionMaster::MoveDistract(uint32 timer)
|
|||
void MotionMaster::MoveFlyOrLand(uint32 id, float x, float y, float z, bool liftOff)
|
||||
{
|
||||
if (m_owner->GetTypeId() != TYPEID_UNIT)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s targeted point for %s (Id: %u X: %f Y: %f Z: %f)", m_owner->GetGuidStr().c_str(), liftOff ? "liftoff" : "landing", id, x, y, z);
|
||||
Mutate(new FlyOrLandMovementGenerator(id, x, y, z, liftOff));
|
||||
|
|
@ -457,7 +519,9 @@ void MotionMaster::Mutate(MovementGenerator* m)
|
|||
}
|
||||
|
||||
if (!empty())
|
||||
{ top()->Interrupt(*m_owner); }
|
||||
{
|
||||
top()->Interrupt(*m_owner);
|
||||
}
|
||||
}
|
||||
|
||||
m->Initialize(*m_owner);
|
||||
|
|
@ -488,7 +552,9 @@ uint32 MotionMaster::getLastReachedWaypoint() const
|
|||
for (Impl::container_type::const_reverse_iterator rItr = Impl::c.rbegin(); rItr != Impl::c.rend(); ++rItr)
|
||||
{
|
||||
if ((*rItr)->GetMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
|
||||
{ return (static_cast<WaypointMovementGenerator<Creature>*>(*rItr))->getLastReachedWaypoint(); }
|
||||
{
|
||||
return (static_cast<WaypointMovementGenerator<Creature>*>(*rItr))->getLastReachedWaypoint();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -496,7 +562,9 @@ uint32 MotionMaster::getLastReachedWaypoint() const
|
|||
MovementGeneratorType MotionMaster::GetCurrentMovementGeneratorType() const
|
||||
{
|
||||
if (empty())
|
||||
{ return IDLE_MOTION_TYPE; }
|
||||
{
|
||||
return IDLE_MOTION_TYPE;
|
||||
}
|
||||
|
||||
return top()->GetMovementGeneratorType();
|
||||
}
|
||||
|
|
@ -516,7 +584,9 @@ void MotionMaster::GetWaypointPathInformation(std::ostringstream& oss) const
|
|||
bool MotionMaster::GetDestination(float& x, float& y, float& z)
|
||||
{
|
||||
if (m_owner->movespline->Finalized())
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const G3D::Vector3& dest = m_owner->movespline->FinalDestination();
|
||||
x = dest.x;
|
||||
|
|
@ -558,7 +628,9 @@ void MotionMaster::MoveFall()
|
|||
|
||||
// Abort too if the ground is very near
|
||||
if (fabs(m_owner->GetPositionZ() - tz) < 0.1f)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Movement::MoveSplineInit init(*m_owner);
|
||||
init.MoveTo(m_owner->GetPositionX(), m_owner->GetPositionY(), tz);
|
||||
|
|
|
|||
|
|
@ -95,14 +95,18 @@ class MotionMaster : private std::stack<MovementGenerator*>
|
|||
void Clear(bool reset = true, bool all = false)
|
||||
{
|
||||
if (m_cleanFlag & MMCF_UPDATE)
|
||||
{ DelayedClean(reset, all); }
|
||||
{
|
||||
DelayedClean(reset, all);
|
||||
}
|
||||
else
|
||||
{ DirectClean(reset, all); }
|
||||
}
|
||||
void MovementExpired(bool reset = true)
|
||||
{
|
||||
if (m_cleanFlag & MMCF_UPDATE)
|
||||
{ DelayedExpire(reset); }
|
||||
{
|
||||
DelayedExpire(reset);
|
||||
}
|
||||
else
|
||||
{ DirectExpire(reset); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,9 @@ bool PathFinder::calculate(float destX, float destY, float destZ, bool forceDest
|
|||
dtPolyRef PathFinder::getPathPolyByPosition(const dtPolyRef* polyPath, uint32 polyPathSize, const float* point, float* distance) const
|
||||
{
|
||||
if (!polyPath || !polyPathSize)
|
||||
{ return INVALID_POLYREF; }
|
||||
{
|
||||
return INVALID_POLYREF;
|
||||
}
|
||||
|
||||
dtPolyRef nearestPoly = INVALID_POLYREF;
|
||||
float minDist2d = FLT_MAX;
|
||||
|
|
@ -110,11 +112,15 @@ dtPolyRef PathFinder::getPathPolyByPosition(const dtPolyRef* polyPath, uint32 po
|
|||
}
|
||||
|
||||
if (minDist2d < 1.0f) // shortcut out - close enough for us
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (distance)
|
||||
{ *distance = dtSqrt(minDist3d); }
|
||||
{
|
||||
*distance = dtSqrt(minDist3d);
|
||||
}
|
||||
|
||||
return (minDist2d < 3.0f) ? nearestPoly : INVALID_POLYREF;
|
||||
}
|
||||
|
|
@ -126,7 +132,9 @@ dtPolyRef PathFinder::getPolyByLocation(const float* point, float* distance) con
|
|||
// we need to use the expensive navMesh.findNearestPoly
|
||||
dtPolyRef polyRef = getPathPolyByPosition(m_pathPolyRefs, m_polyLength, point, distance);
|
||||
if (polyRef != INVALID_POLYREF)
|
||||
{ return polyRef; }
|
||||
{
|
||||
return polyRef;
|
||||
}
|
||||
|
||||
// we don't have it in our old path
|
||||
// try to get it by findNearestPoly()
|
||||
|
|
@ -205,13 +213,17 @@ void PathFinder::BuildPolyPath(const Vector3& startPos, const Vector3& endPos)
|
|||
{
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_PATHFINDING, "++ BuildPolyPath :: underWater case\n");
|
||||
if (owner->CanSwim())
|
||||
{ buildShotrcut = true; }
|
||||
{
|
||||
buildShotrcut = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_PATHFINDING, "++ BuildPolyPath :: flying case\n");
|
||||
if (owner->CanFly())
|
||||
{ buildShotrcut = true; }
|
||||
{
|
||||
buildShotrcut = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -391,7 +403,9 @@ void PathFinder::BuildPolyPath(const Vector3& startPos, const Vector3& endPos)
|
|||
|
||||
// by now we know what type of path we can get
|
||||
if (m_pathPolyRefs[m_polyLength - 1] == endPoly && !(m_type & PATHFIND_INCOMPLETE))
|
||||
{ m_type = PATHFIND_NORMAL; }
|
||||
{
|
||||
m_type = PATHFIND_NORMAL;
|
||||
}
|
||||
else
|
||||
{ m_type = PATHFIND_INCOMPLETE; }
|
||||
|
||||
|
|
@ -576,12 +590,16 @@ uint32 PathFinder::fixupCorridor(dtPolyRef* path, uint32 npath, uint32 maxPath,
|
|||
}
|
||||
}
|
||||
if (found)
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If no intersection found just return current path.
|
||||
if (furthestPath == -1 || furthestVisited == -1)
|
||||
{ return npath; }
|
||||
{
|
||||
return npath;
|
||||
}
|
||||
|
||||
// Concatenate paths.
|
||||
|
||||
|
|
@ -590,10 +608,14 @@ uint32 PathFinder::fixupCorridor(dtPolyRef* path, uint32 npath, uint32 maxPath,
|
|||
uint32 orig = uint32(furthestPath + 1) < npath ? furthestPath + 1 : npath;
|
||||
uint32 size = npath > orig ? npath - orig : 0;
|
||||
if (req + size > maxPath)
|
||||
{ size = maxPath - req; }
|
||||
{
|
||||
size = maxPath - req;
|
||||
}
|
||||
|
||||
if (size)
|
||||
{ memmove(path + req, path + orig, size * sizeof(dtPolyRef)); }
|
||||
{
|
||||
memmove(path + req, path + orig, size * sizeof(dtPolyRef));
|
||||
}
|
||||
|
||||
// Store visited
|
||||
for (uint32 i = 0; i < req; ++i)
|
||||
|
|
@ -615,7 +637,9 @@ bool PathFinder::getSteerTarget(const float* startPos, const float* endPos,
|
|||
dtStatus dtResult = m_navMeshQuery->findStraightPath(startPos, endPos, path, pathSize,
|
||||
steerPath, steerPathFlags, steerPathPolys, (int*)&nsteerPath, MAX_STEER_POINTS);
|
||||
if (!nsteerPath || dtStatusFailed(dtResult))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Find vertex far enough to steer to.
|
||||
uint32 ns = 0;
|
||||
|
|
@ -629,7 +653,9 @@ bool PathFinder::getSteerTarget(const float* startPos, const float* endPos,
|
|||
}
|
||||
// Failed to find good point to steer to.
|
||||
if (ns >= nsteerPath)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
dtVcopy(steerPos, &steerPath[ns * VERTEX_SIZE]);
|
||||
steerPos[1] = startPos[1]; // keep Z value
|
||||
|
|
@ -653,11 +679,15 @@ dtStatus PathFinder::findSmoothPath(const float* startPos, const float* endPos,
|
|||
float iterPos[VERTEX_SIZE], targetPos[VERTEX_SIZE];
|
||||
dtStatus dtResult = m_navMeshQuery->closestPointOnPolyBoundary(polys[0], startPos, iterPos);
|
||||
if (dtStatusFailed(dtResult))
|
||||
{ return DT_FAILURE; }
|
||||
{
|
||||
return DT_FAILURE;
|
||||
}
|
||||
|
||||
dtResult = m_navMeshQuery->closestPointOnPolyBoundary(polys[npolys - 1], endPos, targetPos);
|
||||
if (dtStatusFailed(dtResult))
|
||||
{ return DT_FAILURE; }
|
||||
{
|
||||
return DT_FAILURE;
|
||||
}
|
||||
|
||||
dtVcopy(&smoothPath[nsmoothPath * VERTEX_SIZE], iterPos);
|
||||
++nsmoothPath;
|
||||
|
|
@ -672,7 +702,9 @@ dtStatus PathFinder::findSmoothPath(const float* startPos, const float* endPos,
|
|||
dtPolyRef steerPosRef = INVALID_POLYREF;
|
||||
|
||||
if (!getSteerTarget(iterPos, targetPos, SMOOTH_PATH_SLOP, polys, npolys, steerPos, steerPosFlag, steerPosRef))
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
bool endOfPath = (steerPosFlag & DT_STRAIGHTPATH_END);
|
||||
bool offMeshConnection = (steerPosFlag & DT_STRAIGHTPATH_OFFMESH_CONNECTION);
|
||||
|
|
@ -683,7 +715,9 @@ dtStatus PathFinder::findSmoothPath(const float* startPos, const float* endPos,
|
|||
float len = dtSqrt(dtVdot(delta, delta));
|
||||
// If the steer target is end of path or off-mesh link, do not move past the location.
|
||||
if ((endOfPath || offMeshConnection) && len < SMOOTH_PATH_STEP_SIZE)
|
||||
{ len = 1.0f; }
|
||||
{
|
||||
len = 1.0f;
|
||||
}
|
||||
else
|
||||
{ len = SMOOTH_PATH_STEP_SIZE / len; }
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,9 @@ template<class T>
|
|||
void PointMovementGenerator<T>::Initialize(T& unit)
|
||||
{
|
||||
if (unit.hasUnitState(UNIT_STAT_CAN_NOT_REACT | UNIT_STAT_NOT_MOVE))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
unit.StopMoving();
|
||||
|
||||
|
|
@ -52,7 +54,9 @@ void PointMovementGenerator<T>::Finalize(T& unit)
|
|||
unit.clearUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE);
|
||||
|
||||
if (unit.movespline->Finalized())
|
||||
{ MovementInform(unit); }
|
||||
{
|
||||
MovementInform(unit);
|
||||
}
|
||||
}
|
||||
|
||||
template<class T>
|
||||
|
|
@ -79,7 +83,9 @@ bool PointMovementGenerator<T>::Update(T& unit, const uint32& diff)
|
|||
}
|
||||
|
||||
if (!unit.hasUnitState(UNIT_STAT_ROAMING_MOVE) && unit.movespline->Finalized())
|
||||
{ Initialize(unit); }
|
||||
{
|
||||
Initialize(unit);
|
||||
}
|
||||
|
||||
return !unit.movespline->Finalized();
|
||||
}
|
||||
|
|
@ -93,7 +99,9 @@ template <>
|
|||
void PointMovementGenerator<Creature>::MovementInform(Creature& unit)
|
||||
{
|
||||
if (unit.AI())
|
||||
{ unit.AI()->MovementInform(POINT_MOTION_TYPE, id); }
|
||||
{
|
||||
unit.AI()->MovementInform(POINT_MOTION_TYPE, id);
|
||||
}
|
||||
|
||||
if (unit.IsTemporarySummon())
|
||||
{
|
||||
|
|
@ -101,7 +109,9 @@ void PointMovementGenerator<Creature>::MovementInform(Creature& unit)
|
|||
if (pSummon->GetSummonerGuid().IsCreatureOrVehicle())
|
||||
if (Creature* pSummoner = unit.GetMap()->GetCreature(pSummon->GetSummonerGuid()))
|
||||
if (pSummoner->AI())
|
||||
{ pSummoner->AI()->SummonedMovementInform(&unit, POINT_MOTION_TYPE, id); }
|
||||
{
|
||||
pSummoner->AI()->SummonedMovementInform(&unit, POINT_MOTION_TYPE, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -123,7 +133,9 @@ void AssistanceMovementGenerator::Finalize(Unit& unit)
|
|||
((Creature*)&unit)->SetNoCallAssistance(false);
|
||||
((Creature*)&unit)->CallAssistance();
|
||||
if (unit.IsAlive())
|
||||
{ unit.GetMotionMaster()->MoveSeekAssistanceDistract(sWorld.getConfig(CONFIG_UINT32_CREATURE_FAMILY_ASSISTANCE_DELAY)); }
|
||||
{
|
||||
unit.GetMotionMaster()->MoveSeekAssistanceDistract(sWorld.getConfig(CONFIG_UINT32_CREATURE_FAMILY_ASSISTANCE_DELAY));
|
||||
}
|
||||
}
|
||||
|
||||
bool EffectMovementGenerator::Update(Unit& unit, const uint32&)
|
||||
|
|
@ -134,15 +146,21 @@ bool EffectMovementGenerator::Update(Unit& unit, const uint32&)
|
|||
void EffectMovementGenerator::Finalize(Unit& unit)
|
||||
{
|
||||
if (unit.GetTypeId() != TYPEID_UNIT)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (((Creature&)unit).AI() && unit.movespline->Finalized())
|
||||
{ ((Creature&)unit).AI()->MovementInform(EFFECT_MOTION_TYPE, m_Id); }
|
||||
{
|
||||
((Creature&)unit).AI()->MovementInform(EFFECT_MOTION_TYPE, m_Id);
|
||||
}
|
||||
// Need restore previous movement since we have no proper states system
|
||||
if (unit.IsAlive() && !unit.hasUnitState(UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING | UNIT_STAT_NO_COMBAT_MOVEMENT))
|
||||
{
|
||||
if (Unit* victim = unit.getVictim())
|
||||
{ unit.GetMotionMaster()->MoveChase(victim); }
|
||||
{
|
||||
unit.GetMotionMaster()->MoveChase(victim);
|
||||
}
|
||||
else
|
||||
{ unit.GetMotionMaster()->Initialize(); }
|
||||
}
|
||||
|
|
@ -151,7 +169,9 @@ void EffectMovementGenerator::Finalize(Unit& unit)
|
|||
void FlyOrLandMovementGenerator::Initialize(Unit& unit)
|
||||
{
|
||||
if (unit.hasUnitState(UNIT_STAT_CAN_NOT_REACT | UNIT_STAT_NOT_MOVE))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
unit.StopMoving();
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,9 @@ void RandomMovementGenerator<Creature>::Initialize(Creature& creature)
|
|||
creature.addUnitState(UNIT_STAT_ROAMING); // _MOVE set in _setRandomLocation
|
||||
|
||||
if (!creature.IsAlive() || creature.hasUnitState(UNIT_STAT_NOT_MOVE))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_setRandomLocation(creature);
|
||||
}
|
||||
|
|
@ -116,7 +118,9 @@ bool RandomMovementGenerator<Creature>::Update(Creature& creature, const uint32&
|
|||
{
|
||||
i_nextMoveTime.Update(diff);
|
||||
if (i_nextMoveTime.Passed())
|
||||
{ _setRandomLocation(creature); }
|
||||
{
|
||||
_setRandomLocation(creature);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,10 +38,14 @@ template<class T, typename D>
|
|||
void TargetedMovementGeneratorMedium<T, D>::_setTargetLocation(T& owner, bool updateDestination)
|
||||
{
|
||||
if (!i_target.isValid() || !i_target->IsInWorld())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (owner.hasUnitState(UNIT_STAT_NOT_MOVE))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
float x, y, z;
|
||||
|
||||
|
|
@ -55,7 +59,9 @@ void TargetedMovementGeneratorMedium<T, D>::_setTargetLocation(T& owner, bool up
|
|||
if (!RequiresNewPosition(owner, x, y, z))
|
||||
{
|
||||
if (!owner.movespline->Finalized())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Chase Movement and angle == 0 case: Chase to current angle
|
||||
else if (this->GetMovementGeneratorType() == CHASE_MOTION_TYPE && i_angle == 0.0f)
|
||||
|
|
@ -78,14 +84,18 @@ void TargetedMovementGeneratorMedium<T, D>::_setTargetLocation(T& owner, bool up
|
|||
}
|
||||
|
||||
if (!i_path)
|
||||
{ i_path = new PathFinder(&owner); }
|
||||
{
|
||||
i_path = new PathFinder(&owner);
|
||||
}
|
||||
|
||||
// allow pets following their master to cheat while generating paths
|
||||
bool forceDest = (owner.GetTypeId() == TYPEID_UNIT && ((Creature*)&owner)->IsPet()
|
||||
&& owner.hasUnitState(UNIT_STAT_FOLLOW));
|
||||
i_path->calculate(x, y, z, forceDest);
|
||||
if (i_path->getPathType() & PATHFIND_NOPATH)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
D::_addUnitStateMove(owner);
|
||||
i_targetReached = false;
|
||||
|
|
@ -101,10 +111,14 @@ template<class T, typename D>
|
|||
bool TargetedMovementGeneratorMedium<T, D>::Update(T& owner, const uint32& time_diff)
|
||||
{
|
||||
if (!i_target.isValid() || !i_target->IsInWorld())
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!owner.IsAlive())
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (owner.hasUnitState(UNIT_STAT_NOT_MOVE))
|
||||
{
|
||||
|
|
@ -122,7 +136,9 @@ bool TargetedMovementGeneratorMedium<T, D>::Update(T& owner, const uint32& time_
|
|||
if (owner.IsNonMeleeSpellCasted(false, false, true))
|
||||
{
|
||||
if (!owner.IsStopped())
|
||||
{ owner.StopMoving(); }
|
||||
{
|
||||
owner.StopMoving();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -143,12 +159,16 @@ bool TargetedMovementGeneratorMedium<T, D>::Update(T& owner, const uint32& time_
|
|||
}
|
||||
|
||||
if (m_speedChanged || targetMoved)
|
||||
{ _setTargetLocation(owner, targetMoved); }
|
||||
{
|
||||
_setTargetLocation(owner, targetMoved);
|
||||
}
|
||||
|
||||
if (owner.movespline->Finalized())
|
||||
{
|
||||
if (i_angle == 0.f && !owner.HasInArc(0.01f, i_target.getTarget()))
|
||||
{ owner.SetInFront(i_target.getTarget()); }
|
||||
{
|
||||
owner.SetInFront(i_target.getTarget());
|
||||
}
|
||||
|
||||
if (!i_targetReached)
|
||||
{
|
||||
|
|
@ -170,7 +190,9 @@ bool TargetedMovementGeneratorMedium<T, D>::RequiresNewPosition(T& owner, float
|
|||
{
|
||||
// More distance let have better performance, less distance let have more sensitive reaction at target move.
|
||||
if (owner.GetTypeId() == TYPEID_UNIT && ((Creature*)&owner)->CanFly())
|
||||
{ return !i_target->IsWithinDist3d(x, y, z, this->GetDynamicTargetDistance(owner, true)); }
|
||||
{
|
||||
return !i_target->IsWithinDist3d(x, y, z, this->GetDynamicTargetDistance(owner, true));
|
||||
}
|
||||
else
|
||||
{ return !i_target->IsWithinDist2d(x, y, this->GetDynamicTargetDistance(owner, true)); }
|
||||
}
|
||||
|
|
@ -191,7 +213,9 @@ template<class T>
|
|||
void ChaseMovementGenerator<T>::_reachTarget(T& owner)
|
||||
{
|
||||
if (owner.CanReachWithMeleeAttack(this->i_target.getTarget()))
|
||||
{ owner.Attack(this->i_target.getTarget(), true); }
|
||||
{
|
||||
owner.Attack(this->i_target.getTarget(), true);
|
||||
}
|
||||
}
|
||||
|
||||
template<>
|
||||
|
|
@ -236,7 +260,9 @@ template<class T>
|
|||
float ChaseMovementGenerator<T>::GetDynamicTargetDistance(T& owner, bool forRangeCheck) const
|
||||
{
|
||||
if (!forRangeCheck)
|
||||
{ return this->i_offset + CHASE_DEFAULT_RANGE_FACTOR * this->i_target->GetCombatReach(&owner); }
|
||||
{
|
||||
return this->i_offset + CHASE_DEFAULT_RANGE_FACTOR * this->i_target->GetCombatReach(&owner);
|
||||
}
|
||||
|
||||
return CHASE_RECHASE_RANGE_FACTOR * this->i_target->GetCombatReach(&owner) - this->i_target->GetObjectBoundingRadius();
|
||||
}
|
||||
|
|
@ -270,7 +296,9 @@ void FollowMovementGenerator<Creature>::_updateSpeed(Creature& u)
|
|||
{
|
||||
// pet only sync speed with owner
|
||||
if (!((Creature&)u).IsPet() || !i_target.isValid() || i_target->GetObjectGuid() != u.GetOwnerGuid())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
u.UpdateSpeed(MOVE_RUN, true);
|
||||
u.UpdateSpeed(MOVE_WALK, true);
|
||||
|
|
@ -326,12 +354,16 @@ template<class T>
|
|||
float FollowMovementGenerator<T>::GetDynamicTargetDistance(T& owner, bool forRangeCheck) const
|
||||
{
|
||||
if (!forRangeCheck)
|
||||
{ return this->i_offset + owner.GetObjectBoundingRadius() + this->i_target->GetObjectBoundingRadius(); }
|
||||
{
|
||||
return this->i_offset + owner.GetObjectBoundingRadius() + this->i_target->GetObjectBoundingRadius();
|
||||
}
|
||||
|
||||
float allowed_dist = sWorld.getConfig(CONFIG_FLOAT_RATE_TARGET_POS_RECALCULATION_RANGE) - this->i_target->GetObjectBoundingRadius();
|
||||
allowed_dist += FOLLOW_RECALCULATE_FACTOR * (owner.GetObjectBoundingRadius() + this->i_target->GetObjectBoundingRadius());
|
||||
if (this->i_offset > FOLLOW_DIST_GAP_FOR_DIST_FACTOR)
|
||||
{ allowed_dist += FOLLOW_DIST_RECALCULATE_FACTOR * this->i_offset; }
|
||||
{
|
||||
allowed_dist += FOLLOW_DIST_RECALCULATE_FACTOR * this->i_offset;
|
||||
}
|
||||
|
||||
return allowed_dist;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,9 @@ void WaypointMovementGenerator<Creature>::LoadPath(Creature& creature, int32 pat
|
|||
}
|
||||
|
||||
if (i_path->empty())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Initialize the i_currentNode to point to the first node
|
||||
i_currentNode = i_path->begin()->first;
|
||||
m_lastReachedWaypoint = 0;
|
||||
|
|
@ -107,12 +109,16 @@ void WaypointMovementGenerator<Creature>::Reset(Creature& creature)
|
|||
void WaypointMovementGenerator<Creature>::OnArrived(Creature& creature)
|
||||
{
|
||||
if (!i_path || i_path->empty())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_lastReachedWaypoint = i_currentNode;
|
||||
|
||||
if (m_isArrivalDone)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
creature.clearUnitState(UNIT_STAT_ROAMING_MOVE);
|
||||
m_isArrivalDone = true;
|
||||
|
|
@ -131,13 +137,19 @@ void WaypointMovementGenerator<Creature>::OnArrived(Creature& creature)
|
|||
if (WaypointBehavior* behavior = node.behavior)
|
||||
{
|
||||
if (behavior->emote != 0)
|
||||
{ creature.HandleEmote(behavior->emote); }
|
||||
{
|
||||
creature.HandleEmote(behavior->emote);
|
||||
}
|
||||
|
||||
if (behavior->spell != 0)
|
||||
{ creature.CastSpell(&creature, behavior->spell, false); }
|
||||
{
|
||||
creature.CastSpell(&creature, behavior->spell, false);
|
||||
}
|
||||
|
||||
if (behavior->model1 != 0)
|
||||
{ creature.SetDisplayId(behavior->model1); }
|
||||
{
|
||||
creature.SetDisplayId(behavior->model1);
|
||||
}
|
||||
|
||||
if (behavior->textid[0])
|
||||
{
|
||||
|
|
@ -150,14 +162,18 @@ void WaypointMovementGenerator<Creature>::OnArrived(Creature& creature)
|
|||
for (; i < MAX_WAYPOINT_TEXT; ++i)
|
||||
{
|
||||
if (!behavior->textid[i])
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
textId = behavior->textid[urand(0, i - 1)];
|
||||
}
|
||||
|
||||
if (MangosStringLocale const* textData = sObjectMgr.GetMangosStringLocale(textId))
|
||||
{ creature.MonsterText(textData, NULL); }
|
||||
{
|
||||
creature.MonsterText(textData, NULL);
|
||||
}
|
||||
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); }
|
||||
}
|
||||
|
|
@ -179,13 +195,19 @@ void WaypointMovementGenerator<Creature>::OnArrived(Creature& creature)
|
|||
void WaypointMovementGenerator<Creature>::StartMove(Creature& creature)
|
||||
{
|
||||
if (!i_path || i_path->empty())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Stopped(creature))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!creature.IsAlive() || creature.hasUnitState(UNIT_STAT_NOT_MOVE))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
WaypointPath::const_iterator currPoint = i_path->find(i_currentNode);
|
||||
MANGOS_ASSERT(currPoint != i_path->end());
|
||||
|
|
@ -193,7 +215,9 @@ void WaypointMovementGenerator<Creature>::StartMove(Creature& creature)
|
|||
if (WaypointBehavior* behavior = currPoint->second.behavior)
|
||||
{
|
||||
if (behavior->model2 != 0)
|
||||
{ creature.SetDisplayId(behavior->model2); }
|
||||
{
|
||||
creature.SetDisplayId(behavior->model2);
|
||||
}
|
||||
creature.SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
|
||||
}
|
||||
|
||||
|
|
@ -231,7 +255,9 @@ void WaypointMovementGenerator<Creature>::StartMove(Creature& creature)
|
|||
init.MoveTo(nextNode.x, nextNode.y, nextNode.z, true);
|
||||
|
||||
if (nextNode.orientation != 100 && nextNode.delay != 0)
|
||||
{ init.SetFacing(nextNode.orientation); }
|
||||
{
|
||||
init.SetFacing(nextNode.orientation);
|
||||
}
|
||||
creature.SetWalk(!creature.hasUnitState(UNIT_STAT_RUNNING_STATE) && !creature.IsLevitating(), false);
|
||||
init.Launch();
|
||||
}
|
||||
|
|
@ -256,12 +282,16 @@ bool WaypointMovementGenerator<Creature>::Update(Creature& creature, const uint3
|
|||
if (Stopped(creature))
|
||||
{
|
||||
if (CanMove(diff, creature))
|
||||
{ StartMove(creature); }
|
||||
{
|
||||
StartMove(creature);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (creature.IsStopped())
|
||||
{ Stop(STOP_TIME_FOR_PLAYER); }
|
||||
{
|
||||
Stop(STOP_TIME_FOR_PLAYER);
|
||||
}
|
||||
else if (creature.movespline->Finalized())
|
||||
{
|
||||
OnArrived(creature);
|
||||
|
|
@ -291,12 +321,16 @@ bool WaypointMovementGenerator<Creature>::GetResetPosition(Creature&, float& x,
|
|||
{
|
||||
// prevent a crash at empty waypoint path.
|
||||
if (!i_path || i_path->empty())
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
WaypointPath::const_iterator lastPoint = i_path->find(m_lastReachedWaypoint);
|
||||
// Special case: Before the first waypoint is reached, m_lastReachedWaypoint is set to 0 (which may not be contained in i_path)
|
||||
if (!m_lastReachedWaypoint && lastPoint == i_path->end())
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
MANGOS_ASSERT(lastPoint != i_path->end());
|
||||
|
||||
|
|
@ -369,14 +403,18 @@ bool WaypointMovementGenerator<Creature>::SetNextWaypoint(uint32 pointId)
|
|||
uint32 FlightPathMovementGenerator::GetPathAtMapEnd() const
|
||||
{
|
||||
if (i_currentNode >= i_path->size())
|
||||
{ return i_path->size(); }
|
||||
{
|
||||
return i_path->size();
|
||||
}
|
||||
|
||||
uint32 curMapId = (*i_path)[i_currentNode].mapid;
|
||||
|
||||
for (uint32 i = i_currentNode; i < i_path->size(); ++i)
|
||||
{
|
||||
if ((*i_path)[i].mapid != curMapId)
|
||||
{ return i; }
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return i_path->size();
|
||||
|
|
@ -400,7 +438,9 @@ void FlightPathMovementGenerator::Finalize(Player& player)
|
|||
{
|
||||
player.GetHostileRefManager().setOnlineOfflineState(true);
|
||||
if (player.pvpInfo.inHostileArea)
|
||||
{ player.CastSpell(&player, 2479, true); }
|
||||
{
|
||||
player.CastSpell(&player, 2479, true);
|
||||
}
|
||||
|
||||
// update z position to ground and orientation for landing point
|
||||
// this prevent cheating with landing point at lags
|
||||
|
|
@ -448,7 +488,9 @@ bool FlightPathMovementGenerator::Update(Player& player, const uint32& diff)
|
|||
{
|
||||
DoEventIfAny(player, (*i_path)[i_currentNode], departureEvent);
|
||||
if (pointId == i_currentNode)
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
i_currentNode += (uint32)departureEvent;
|
||||
departureEvent = !departureEvent;
|
||||
}
|
||||
|
|
@ -461,7 +503,9 @@ bool FlightPathMovementGenerator::Update(Player& player, const uint32& diff)
|
|||
void FlightPathMovementGenerator::SetCurrentNodeAfterTeleport()
|
||||
{
|
||||
if (i_path->empty())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 map0 = (*i_path)[0].mapid;
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,9 @@ int AggressorAI::Permissible(const Creature* creature)
|
|||
{
|
||||
// have some hostile factions, it will be selected by IsHostileTo check at MoveInLineOfSight
|
||||
if (!creature->IsCivilian() && !creature->IsNeutralToAll())
|
||||
{ return PERMIT_BASE_PROACTIVE; }
|
||||
{
|
||||
return PERMIT_BASE_PROACTIVE;
|
||||
}
|
||||
|
||||
return PERMIT_BASE_NO;
|
||||
}
|
||||
|
|
@ -47,7 +49,9 @@ void AggressorAI::MoveInLineOfSight(Unit* u)
|
|||
{
|
||||
// Ignore Z for flying creatures
|
||||
if (!m_creature->CanFly() && m_creature->GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_creature->CanInitiateAttack() && u->IsTargetableForAttack() &&
|
||||
m_creature->IsHostileTo(u) && u->isInAccessablePlaceFor(m_creature))
|
||||
|
|
@ -111,7 +115,9 @@ void AggressorAI::EnterEvadeMode()
|
|||
|
||||
// Remove ChaseMovementGenerator from MotionMaster stack list, and add HomeMovementGenerator instead
|
||||
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE)
|
||||
{ m_creature->GetMotionMaster()->MoveTargetedHome(); }
|
||||
{
|
||||
m_creature->GetMotionMaster()->MoveTargetedHome();
|
||||
}
|
||||
}
|
||||
|
||||
m_creature->DeleteThreatList();
|
||||
|
|
@ -124,7 +130,9 @@ void AggressorAI::UpdateAI(const uint32 /*diff*/)
|
|||
{
|
||||
// update i_victimGuid if m_creature->getVictim() !=0 and changed
|
||||
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
i_victimGuid = m_creature->getVictim()->GetObjectGuid();
|
||||
|
||||
|
|
@ -140,7 +148,9 @@ bool AggressorAI::IsVisible(Unit* pl) const
|
|||
void AggressorAI::AttackStart(Unit* u)
|
||||
{
|
||||
if (!u || !m_creature->CanAttackByItself())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_creature->Attack(u, true))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -62,7 +62,9 @@ AuctionHouseMgr::~AuctionHouseMgr()
|
|||
AuctionHouseObject* AuctionHouseMgr::GetAuctionsMap(AuctionHouseEntry const* house)
|
||||
{
|
||||
if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
|
||||
{ return &mAuctions[AUCTION_HOUSE_NEUTRAL]; }
|
||||
{
|
||||
return &mAuctions[AUCTION_HOUSE_NEUTRAL];
|
||||
}
|
||||
|
||||
// team have linked auction houses
|
||||
switch (GetAuctionHouseTeam(house))
|
||||
|
|
@ -84,7 +86,9 @@ uint64 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32
|
|||
float min_deposit = float(sWorld.getConfig(CONFIG_UINT32_AUCTION_DEPOSIT_MIN));
|
||||
|
||||
if (deposit < min_deposit)
|
||||
{ deposit = min_deposit; }
|
||||
{
|
||||
deposit = min_deposit;
|
||||
}
|
||||
|
||||
return uint64(deposit * sWorld.getConfig(CONFIG_FLOAT_RATE_AUCTION_DEPOSIT));
|
||||
}
|
||||
|
|
@ -94,7 +98,9 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction)
|
|||
{
|
||||
Item* pItem = GetAItem(auction->itemGuidLow);
|
||||
if (!pItem)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ObjectGuid bidder_guid = ObjectGuid(HIGHGUID_PLAYER, auction->bidder);
|
||||
Player* bidder = sObjectMgr.GetPlayer(bidder_guid);
|
||||
|
|
@ -123,7 +129,9 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction)
|
|||
if (bidder_security > SEC_PLAYER) // not do redundant DB requests
|
||||
{
|
||||
if (!sObjectMgr.GetPlayerNameByGUID(bidder_guid, bidder_name))
|
||||
{ bidder_name = sObjectMgr.GetMangosStringForDBCLocale(LANG_UNKNOWN); }
|
||||
{
|
||||
bidder_name = sObjectMgr.GetMangosStringForDBCLocale(LANG_UNKNOWN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -196,7 +204,9 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction)
|
|||
|
||||
uint32 owner_accId = 0;
|
||||
if (!owner)
|
||||
{ owner_accId = sObjectMgr.GetPlayerAccountIdByGUID(owner_guid); }
|
||||
{
|
||||
owner_accId = sObjectMgr.GetPlayerAccountIdByGUID(owner_guid);
|
||||
}
|
||||
|
||||
// owner exist
|
||||
if (owner || owner_accId)
|
||||
|
|
@ -245,7 +255,9 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction)
|
|||
|
||||
uint32 owner_accId = 0;
|
||||
if (!owner)
|
||||
{ owner_accId = sObjectMgr.GetPlayerAccountIdByGUID(owner_guid); }
|
||||
{
|
||||
owner_accId = sObjectMgr.GetPlayerAccountIdByGUID(owner_guid);
|
||||
}
|
||||
|
||||
// owner exist
|
||||
if (owner || owner_accId)
|
||||
|
|
@ -561,7 +573,9 @@ AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(Unit* unit)
|
|||
{
|
||||
Player* player = (Player*)unit;
|
||||
if (player->GetAuctionAccessMode() > 0)
|
||||
{ houseid = 7; }
|
||||
{
|
||||
houseid = 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (((Player*)unit)->GetTeam())
|
||||
|
|
@ -630,7 +644,9 @@ void AuctionHouseObject::BuildListBidderItems(WorldPacket& data, Player* player,
|
|||
if (Aentry->bidder == player->GetGUIDLow())
|
||||
{
|
||||
if (itr->second->BuildAuctionInfo(data))
|
||||
{ ++count; }
|
||||
{
|
||||
++count;
|
||||
}
|
||||
++totalcount;
|
||||
}
|
||||
}
|
||||
|
|
@ -646,7 +662,9 @@ void AuctionHouseObject::BuildListOwnerItems(WorldPacket& data, Player* player,
|
|||
if (Aentry->owner == player->GetGUIDLow())
|
||||
{
|
||||
if (Aentry->BuildAuctionInfo(data))
|
||||
{ ++count; }
|
||||
{
|
||||
++count;
|
||||
}
|
||||
++totalcount;
|
||||
}
|
||||
}
|
||||
|
|
@ -818,7 +836,9 @@ void WorldSession::BuildListAuctionItems(std::vector<AuctionEntry*> const& aucti
|
|||
continue;
|
||||
Item* item = sAuctionMgr.GetAItem(Aentry->itemGuidLow);
|
||||
if (!item)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isFull)
|
||||
{
|
||||
|
|
@ -830,19 +850,29 @@ void WorldSession::BuildListAuctionItems(std::vector<AuctionEntry*> const& aucti
|
|||
ItemPrototype const* proto = item->GetProto();
|
||||
|
||||
if (itemClass != 0xffffffff && proto->Class != itemClass)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (itemSubClass != 0xffffffff && proto->SubClass != itemSubClass)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (inventoryType != 0xffffffff && proto->InventoryType != inventoryType)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (quality != 0xffffffff && proto->Quality < quality)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (levelmin != 0x00 && (proto->RequiredLevel < levelmin || (levelmax != 0x00 && proto->RequiredLevel > levelmax)))
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (usable != 0x00)
|
||||
{
|
||||
|
|
@ -867,7 +897,9 @@ void WorldSession::BuildListAuctionItems(std::vector<AuctionEntry*> const& aucti
|
|||
sObjectMgr.GetItemLocaleStrings(proto->ItemId, loc_idx, &name);
|
||||
|
||||
if (!wsearchedname.empty() && !Utf8FitTo(name, wsearchedname))
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (count < 50 && totalcount >= listfrom)
|
||||
{
|
||||
|
|
@ -942,7 +974,9 @@ AuctionEntry* AuctionHouseObject::AddAuction(AuctionHouseEntry const* auctionHou
|
|||
AH->SaveToDB();
|
||||
|
||||
if (pl)
|
||||
{ pl->SaveInventoryAndGoldToDB(); }
|
||||
{
|
||||
pl->SaveInventoryAndGoldToDB();
|
||||
}
|
||||
|
||||
CharacterDatabase.CommitTransaction();
|
||||
|
||||
|
|
@ -993,7 +1027,9 @@ uint64 AuctionEntry::GetAuctionOutBid() const
|
|||
{
|
||||
uint64 outbid = (bid / 100) * 5;
|
||||
if (!outbid)
|
||||
{ outbid = 1; }
|
||||
{
|
||||
outbid = 1;
|
||||
}
|
||||
return outbid;
|
||||
}
|
||||
|
||||
|
|
@ -1018,7 +1054,9 @@ void AuctionEntry::AuctionBidWinning(Player* newbidder)
|
|||
CharacterDatabase.BeginTransaction();
|
||||
CharacterDatabase.PExecute("UPDATE auction SET itemguid = 0, moneyTime = '" UI64FMTD "', buyguid = '%u', lastbid = '" UI64FMTD "' WHERE id = '%u'", (uint64)moneyDeliveryTime, bidder, bid, Id);
|
||||
if (newbidder)
|
||||
{ newbidder->SaveInventoryAndGoldToDB(); }
|
||||
{
|
||||
newbidder->SaveInventoryAndGoldToDB();
|
||||
}
|
||||
CharacterDatabase.CommitTransaction();
|
||||
|
||||
sAuctionMgr.SendAuctionWonMail(this);
|
||||
|
|
@ -1030,7 +1068,9 @@ bool AuctionEntry::UpdateBid(uint64 newbid, Player* newbidder /*=NULL*/)
|
|||
|
||||
// bid can't be greater buyout
|
||||
if (buyout && newbid > buyout)
|
||||
{ newbid = buyout; }
|
||||
{
|
||||
newbid = buyout;
|
||||
}
|
||||
|
||||
if (newbidder && newbidder->GetGUIDLow() == bidder)
|
||||
{
|
||||
|
|
@ -1042,7 +1082,9 @@ bool AuctionEntry::UpdateBid(uint64 newbid, Player* newbidder /*=NULL*/)
|
|||
newbidder->ModifyMoney(-int64(newbid));
|
||||
|
||||
if (bidder) // return money to old bidder if present
|
||||
{ WorldSession::SendAuctionOutbiddedMail(this); }
|
||||
{
|
||||
WorldSession::SendAuctionOutbiddedMail(this);
|
||||
}
|
||||
}
|
||||
|
||||
bidder = newbidder ? newbidder->GetGUIDLow() : 0;
|
||||
|
|
@ -1057,7 +1099,9 @@ bool AuctionEntry::UpdateBid(uint64 newbid, Player* newbidder /*=NULL*/)
|
|||
CharacterDatabase.BeginTransaction();
|
||||
CharacterDatabase.PExecute("UPDATE auction SET buyguid = '%u', lastbid = '" UI64FMTD "' WHERE id = '%u'", bidder, bid, Id);
|
||||
if (newbidder)
|
||||
{ newbidder->SaveInventoryAndGoldToDB(); }
|
||||
{
|
||||
newbidder->SaveInventoryAndGoldToDB();
|
||||
}
|
||||
CharacterDatabase.CommitTransaction();
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,14 +49,18 @@ void Bag::AddToWorld()
|
|||
|
||||
for (uint32 i = 0; i < GetBagSize(); ++i)
|
||||
if (m_bagslot[i])
|
||||
{ m_bagslot[i]->AddToWorld(); }
|
||||
{
|
||||
m_bagslot[i]->AddToWorld();
|
||||
}
|
||||
}
|
||||
|
||||
void Bag::RemoveFromWorld()
|
||||
{
|
||||
for (uint32 i = 0; i < GetBagSize(); ++i)
|
||||
if (m_bagslot[i])
|
||||
{ m_bagslot[i]->RemoveFromWorld(); }
|
||||
{
|
||||
m_bagslot[i]->RemoveFromWorld();
|
||||
}
|
||||
|
||||
Item::RemoveFromWorld();
|
||||
}
|
||||
|
|
@ -66,7 +70,9 @@ bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner)
|
|||
ItemPrototype const* itemProto = ObjectMgr::GetItemPrototype(itemid);
|
||||
|
||||
if (!itemProto || itemProto->ContainerSlots > MAX_BAG_SIZE)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Object::_Create(guidlow, 0, HIGHGUID_CONTAINER);
|
||||
|
||||
|
|
@ -101,7 +107,9 @@ void Bag::SaveToDB()
|
|||
bool Bag::LoadFromDB(uint32 guidLow, Field* fields, ObjectGuid ownerGuid)
|
||||
{
|
||||
if (!Item::LoadFromDB(guidLow, fields, ownerGuid))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// cleanup bag content related item value fields (its will be filled correctly from `character_inventory`)
|
||||
for (int i = 0; i < MAX_BAG_SIZE; ++i)
|
||||
|
|
@ -119,7 +127,9 @@ void Bag::DeleteFromDB()
|
|||
{
|
||||
for (int i = 0; i < MAX_BAG_SIZE; ++i)
|
||||
if (m_bagslot[i])
|
||||
{ m_bagslot[i]->DeleteFromDB(); }
|
||||
{
|
||||
m_bagslot[i]->DeleteFromDB();
|
||||
}
|
||||
|
||||
Item::DeleteFromDB();
|
||||
}
|
||||
|
|
@ -129,7 +139,9 @@ uint32 Bag::GetFreeSlots() const
|
|||
uint32 slots = 0;
|
||||
for (uint32 i = 0; i < GetBagSize(); ++i)
|
||||
if (!m_bagslot[i])
|
||||
{ ++slots; }
|
||||
{
|
||||
++slots;
|
||||
}
|
||||
|
||||
return slots;
|
||||
}
|
||||
|
|
@ -139,7 +151,9 @@ void Bag::RemoveItem(uint8 slot, bool /*update*/)
|
|||
MANGOS_ASSERT(slot < MAX_BAG_SIZE);
|
||||
|
||||
if (m_bagslot[slot])
|
||||
{ m_bagslot[slot]->SetContainer(NULL); }
|
||||
{
|
||||
m_bagslot[slot]->SetContainer(NULL);
|
||||
}
|
||||
|
||||
m_bagslot[slot] = NULL;
|
||||
SetGuidValue(CONTAINER_FIELD_SLOT_1 + (slot * 2), ObjectGuid());
|
||||
|
|
@ -166,7 +180,9 @@ void Bag::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) cons
|
|||
|
||||
for (uint32 i = 0; i < GetBagSize(); ++i)
|
||||
if (m_bagslot[i])
|
||||
{ m_bagslot[i]->BuildCreateUpdateBlockForPlayer(data, target); }
|
||||
{
|
||||
m_bagslot[i]->BuildCreateUpdateBlockForPlayer(data, target);
|
||||
}
|
||||
}
|
||||
|
||||
// If the bag is empty returns true
|
||||
|
|
@ -174,7 +190,9 @@ bool Bag::IsEmpty() const
|
|||
{
|
||||
for (uint32 i = 0; i < GetBagSize(); ++i)
|
||||
if (m_bagslot[i])
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -183,7 +201,9 @@ Item* Bag::GetItemByEntry(uint32 item) const
|
|||
{
|
||||
for (uint32 i = 0; i < GetBagSize(); ++i)
|
||||
if (m_bagslot[i] && m_bagslot[i]->GetEntry() == item)
|
||||
{ return m_bagslot[i]; }
|
||||
{
|
||||
return m_bagslot[i];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -204,7 +224,9 @@ uint32 Bag::GetItemCount(uint32 item, Item* eItem) const
|
|||
for (uint32 i = 0; i < GetBagSize(); ++i)
|
||||
if (m_bagslot[i])
|
||||
if (m_bagslot[i] != eItem && m_bagslot[i]->GetEntry() == item)
|
||||
{ count += m_bagslot[i]->GetCount(); }
|
||||
{
|
||||
count += m_bagslot[i]->GetCount();
|
||||
}
|
||||
|
||||
if (eItem && eItem->GetProto()->GemProperties)
|
||||
for (uint32 i = 0; i < GetBagSize(); ++i)
|
||||
|
|
@ -232,7 +254,9 @@ uint8 Bag::GetSlotByItemGUID(ObjectGuid guid) const
|
|||
for (uint32 i = 0; i < GetBagSize(); ++i)
|
||||
if (m_bagslot[i] != 0)
|
||||
if (m_bagslot[i]->GetObjectGuid() == guid)
|
||||
{ return i; }
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
return NULL_SLOT;
|
||||
}
|
||||
|
|
@ -240,7 +264,9 @@ uint8 Bag::GetSlotByItemGUID(ObjectGuid guid) const
|
|||
Item* Bag::GetItemByPos(uint8 slot) const
|
||||
{
|
||||
if (slot < GetBagSize())
|
||||
{ return m_bagslot[slot]; }
|
||||
{
|
||||
return m_bagslot[slot];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,7 +78,9 @@ class Bag : public Item
|
|||
inline Item* NewItemOrBag(ItemPrototype const* proto)
|
||||
{
|
||||
if (proto->InventoryType == INVTYPE_BAG)
|
||||
{ return new Bag; }
|
||||
{
|
||||
return new Bag;
|
||||
}
|
||||
|
||||
return new Item;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,9 @@ void Camera::UpdateForCurrentViewPoint()
|
|||
m_gridRef.unlink();
|
||||
|
||||
if (GridType* grid = m_source->GetViewPoint().m_grid)
|
||||
{ grid->AddWorldObject(this); }
|
||||
{
|
||||
grid->AddWorldObject(this);
|
||||
}
|
||||
|
||||
UpdateVisibilityForOwner();
|
||||
}
|
||||
|
|
@ -63,7 +65,9 @@ void Camera::SetView(WorldObject* obj, bool update_far_sight_field /*= true*/)
|
|||
MANGOS_ASSERT(obj);
|
||||
|
||||
if (m_source == obj)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_owner.IsInMap(obj))
|
||||
{
|
||||
|
|
@ -80,17 +84,23 @@ void Camera::SetView(WorldObject* obj, bool update_far_sight_field /*= true*/)
|
|||
// detach and deregister from active objects if there are no more reasons to be active
|
||||
m_source->GetViewPoint().Detach(this);
|
||||
if (!m_source->IsActiveObject())
|
||||
{ m_source->GetMap()->RemoveFromActive(m_source); }
|
||||
{
|
||||
m_source->GetMap()->RemoveFromActive(m_source);
|
||||
}
|
||||
|
||||
m_source = obj;
|
||||
|
||||
if (!m_source->IsActiveObject())
|
||||
{ m_source->GetMap()->AddToActive(m_source); }
|
||||
{
|
||||
m_source->GetMap()->AddToActive(m_source);
|
||||
}
|
||||
|
||||
m_source->GetViewPoint().Attach(this);
|
||||
|
||||
if (update_far_sight_field)
|
||||
{ m_owner.SetGuidValue(PLAYER_FARSIGHT, (m_source == &m_owner ? ObjectGuid() : m_source->GetObjectGuid())); }
|
||||
{
|
||||
m_owner.SetGuidValue(PLAYER_FARSIGHT, (m_source == &m_owner ? ObjectGuid() : m_source->GetObjectGuid()));
|
||||
}
|
||||
|
||||
UpdateForCurrentViewPoint();
|
||||
}
|
||||
|
|
@ -98,7 +108,9 @@ void Camera::SetView(WorldObject* obj, bool update_far_sight_field /*= true*/)
|
|||
void Camera::Event_ViewPointVisibilityChanged()
|
||||
{
|
||||
if (!m_owner.HaveAtClient(m_source))
|
||||
{ ResetView(); }
|
||||
{
|
||||
ResetView();
|
||||
}
|
||||
}
|
||||
|
||||
void Camera::ResetView(bool update_far_sight_field /*= true*/)
|
||||
|
|
|
|||
|
|
@ -55,7 +55,9 @@ void Corpse::AddToWorld()
|
|||
{
|
||||
///- Register the corpse for guid lookup
|
||||
if (!IsInWorld())
|
||||
{ sObjectAccessor.AddObject(this); }
|
||||
{
|
||||
sObjectAccessor.AddObject(this);
|
||||
}
|
||||
|
||||
Object::AddToWorld();
|
||||
}
|
||||
|
|
@ -64,7 +66,9 @@ void Corpse::RemoveFromWorld()
|
|||
{
|
||||
///- Remove the corpse from the accessor
|
||||
if (IsInWorld())
|
||||
{ sObjectAccessor.RemoveObject(this); }
|
||||
{
|
||||
sObjectAccessor.RemoveObject(this);
|
||||
}
|
||||
|
||||
Object::RemoveFromWorld();
|
||||
}
|
||||
|
|
@ -232,9 +236,13 @@ bool Corpse::LoadFromDB(uint32 lowguid, Field* fields)
|
|||
|
||||
uint32 flags = CORPSE_FLAG_UNK2;
|
||||
if (playerFlags & PLAYER_FLAGS_HIDE_HELM)
|
||||
{ flags |= CORPSE_FLAG_HIDE_HELM; }
|
||||
{
|
||||
flags |= CORPSE_FLAG_HIDE_HELM;
|
||||
}
|
||||
if (playerFlags & PLAYER_FLAGS_HIDE_CLOAK)
|
||||
{ flags |= CORPSE_FLAG_HIDE_CLOAK; }
|
||||
{
|
||||
flags |= CORPSE_FLAG_HIDE_CLOAK;
|
||||
}
|
||||
SetUInt32Value(CORPSE_FIELD_FLAGS, flags);
|
||||
|
||||
// no need to mark corpse as lootable, because corpses are not saved in battle grounds
|
||||
|
|
@ -265,7 +273,9 @@ bool Corpse::isVisibleForInState(Player const* u, WorldObject const* viewPoint,
|
|||
bool Corpse::IsHostileTo(Unit const* unit) const
|
||||
{
|
||||
if (Player* owner = sObjectMgr.GetPlayer(GetOwnerGuid()))
|
||||
{ return owner->IsHostileTo(unit); }
|
||||
{
|
||||
return owner->IsHostileTo(unit);
|
||||
}
|
||||
else
|
||||
{ return false; }
|
||||
}
|
||||
|
|
@ -273,7 +283,9 @@ bool Corpse::IsHostileTo(Unit const* unit) const
|
|||
bool Corpse::IsFriendlyTo(Unit const* unit) const
|
||||
{
|
||||
if (Player* owner = sObjectMgr.GetPlayer(GetOwnerGuid()))
|
||||
{ return owner->IsFriendlyTo(unit); }
|
||||
{
|
||||
return owner->IsFriendlyTo(unit);
|
||||
}
|
||||
else
|
||||
{ return true; }
|
||||
}
|
||||
|
|
@ -281,7 +293,9 @@ bool Corpse::IsFriendlyTo(Unit const* unit) const
|
|||
bool Corpse::IsExpired(time_t t) const
|
||||
{
|
||||
if (m_type == CORPSE_BONES)
|
||||
{ return m_time < t - 60 * MINUTE; }
|
||||
{
|
||||
return m_time < t - 60 * MINUTE;
|
||||
}
|
||||
else
|
||||
{ return m_time < t - 3 * DAY; }
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -166,7 +166,9 @@ struct CreatureInfo
|
|||
SkillType GetRequiredLootSkill() const
|
||||
{
|
||||
if (CreatureTypeFlags & CREATURE_TYPEFLAGS_HERBLOOT)
|
||||
{ return SKILL_HERBALISM; }
|
||||
{
|
||||
return SKILL_HERBALISM;
|
||||
}
|
||||
else if (CreatureTypeFlags & CREATURE_TYPEFLAGS_MININGLOOT)
|
||||
{ return SKILL_MINING; }
|
||||
else if (CreatureTypeFlags & CREATURE_TYPEFLAGS_ENGINEERLOOT)
|
||||
|
|
@ -565,7 +567,9 @@ class Creature : public Unit
|
|||
bool IsElite() const
|
||||
{
|
||||
if (IsPet())
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 Rank = GetCreatureInfo()->Rank;
|
||||
return Rank != CREATURE_ELITE_NORMAL && Rank != CREATURE_ELITE_RARE;
|
||||
|
|
@ -574,7 +578,9 @@ class Creature : public Unit
|
|||
bool IsWorldBoss() const
|
||||
{
|
||||
if (IsPet())
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return GetCreatureInfo()->Rank == CREATURE_ELITE_WORLDBOSS;
|
||||
}
|
||||
|
|
@ -785,7 +791,9 @@ class Creature : public Unit
|
|||
virtual uint32 GetPetAutoSpellOnPos(uint8 pos) const
|
||||
{
|
||||
if (pos >= CREATURE_MAX_SPELLS || m_charmInfo->GetCharmSpell(pos)->GetType() != ACT_ENABLED)
|
||||
{ return 0; }
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{ return m_charmInfo->GetCharmSpell(pos)->GetAction(); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,9 @@ CreatureAI::~CreatureAI()
|
|||
void CreatureAI::AttackedBy(Unit* attacker)
|
||||
{
|
||||
if (!m_creature->getVictim())
|
||||
{ AttackStart(attacker); }
|
||||
{
|
||||
AttackStart(attacker);
|
||||
}
|
||||
}
|
||||
|
||||
CanCastResult CreatureAI::CanCastSpell(Unit* pTarget, const SpellEntry* pSpell, bool isTriggered)
|
||||
|
|
@ -50,17 +52,25 @@ CanCastResult CreatureAI::CanCastSpell(Unit* pTarget, const SpellEntry* pSpell,
|
|||
{
|
||||
// State does not allow
|
||||
if (m_creature->hasUnitState(UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL))
|
||||
{ return CAST_FAIL_STATE; }
|
||||
{
|
||||
return CAST_FAIL_STATE;
|
||||
}
|
||||
|
||||
if (pSpell->GetPreventionType() == SPELL_PREVENTION_TYPE_SILENCE && m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
|
||||
{ return CAST_FAIL_STATE; }
|
||||
{
|
||||
return CAST_FAIL_STATE;
|
||||
}
|
||||
|
||||
if (pSpell->GetPreventionType() == SPELL_PREVENTION_TYPE_PACIFY && m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED))
|
||||
{ return CAST_FAIL_STATE; }
|
||||
{
|
||||
return CAST_FAIL_STATE;
|
||||
}
|
||||
|
||||
// Check for power (also done by Spell::CheckCast())
|
||||
if (m_creature->GetPower((Powers)pSpell->powerType) < Spell::CalculatePowerCost(pSpell, m_creature))
|
||||
{ return CAST_FAIL_POWER; }
|
||||
{
|
||||
return CAST_FAIL_POWER;
|
||||
}
|
||||
|
||||
if (!pSpell->HasAttribute(SPELL_ATTR_EX2_IGNORE_LOS) && !m_creature->IsWithinLOSInMap(pTarget) && m_creature != pTarget)
|
||||
return CAST_FAIL_NOT_IN_LOS;
|
||||
|
|
@ -74,12 +84,16 @@ CanCastResult CreatureAI::CanCastSpell(Unit* pTarget, const SpellEntry* pSpell,
|
|||
float fDistance = m_creature->GetCombatDistance(pTarget, pSpell->rangeIndex == SPELL_RANGE_IDX_COMBAT);
|
||||
|
||||
if (fDistance > (m_creature->IsHostileTo(pTarget) ? pSpellRange->maxRange : pSpellRange->maxRangeFriendly))
|
||||
{ return CAST_FAIL_TOO_FAR; }
|
||||
{
|
||||
return CAST_FAIL_TOO_FAR;
|
||||
}
|
||||
|
||||
float fMinRange = m_creature->IsHostileTo(pTarget) ? pSpellRange->minRange : pSpellRange->minRangeFriendly;
|
||||
|
||||
if (fMinRange && fDistance < fMinRange)
|
||||
{ return CAST_FAIL_TOO_CLOSE; }
|
||||
{
|
||||
return CAST_FAIL_TOO_CLOSE;
|
||||
}
|
||||
}
|
||||
|
||||
return CAST_OK;
|
||||
|
|
@ -93,7 +107,9 @@ CanCastResult CreatureAI::DoCastSpellIfCan(Unit* pTarget, uint32 uiSpell, uint32
|
|||
Unit* pCaster = m_creature;
|
||||
|
||||
if (uiCastFlags & CAST_FORCE_TARGET_SELF)
|
||||
{ pCaster = pTarget; }
|
||||
{
|
||||
pCaster = pTarget;
|
||||
}
|
||||
|
||||
// Allowed to cast only if not casting (unless we interrupt ourself) or if spell is triggered
|
||||
if (!pCaster->IsNonMeleeSpellCasted(false) || (uiCastFlags & (CAST_TRIGGERED | CAST_INTERRUPT_PREVIOUS)))
|
||||
|
|
@ -104,7 +120,9 @@ CanCastResult CreatureAI::DoCastSpellIfCan(Unit* pTarget, uint32 uiSpell, uint32
|
|||
if (uiCastFlags & CAST_AURA_NOT_PRESENT)
|
||||
{
|
||||
if (pTarget->HasAura(uiSpell))
|
||||
{ return CAST_FAIL_TARGET_AURA; }
|
||||
{
|
||||
return CAST_FAIL_TARGET_AURA;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if can not cast spell
|
||||
|
|
@ -120,7 +138,9 @@ CanCastResult CreatureAI::DoCastSpellIfCan(Unit* pTarget, uint32 uiSpell, uint32
|
|||
|
||||
// Interrupt any previous spell
|
||||
if ((uiCastFlags & CAST_INTERRUPT_PREVIOUS) && pCaster->IsNonMeleeSpellCasted(false))
|
||||
{ pCaster->InterruptNonMeleeSpells(false); }
|
||||
{
|
||||
pCaster->InterruptNonMeleeSpells(false);
|
||||
}
|
||||
|
||||
// Creature should always stop before it will cast a non-instant spell
|
||||
if (GetSpellCastTime(pSpell))
|
||||
|
|
@ -155,14 +175,18 @@ void CreatureAI::SetCombatMovement(bool enable, bool stopOrStartMovement /*=fals
|
|||
m_isCombatMovement = enable;
|
||||
|
||||
if (enable)
|
||||
{ m_creature->clearUnitState(UNIT_STAT_NO_COMBAT_MOVEMENT); }
|
||||
{
|
||||
m_creature->clearUnitState(UNIT_STAT_NO_COMBAT_MOVEMENT);
|
||||
}
|
||||
else
|
||||
{ m_creature->addUnitState(UNIT_STAT_NO_COMBAT_MOVEMENT); }
|
||||
|
||||
if (stopOrStartMovement && m_creature->getVictim()) // Only change current movement while in combat
|
||||
{
|
||||
if (enable)
|
||||
{ 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)
|
||||
{ m_creature->StopMoving(); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,9 @@ namespace FactorySelector
|
|||
|
||||
// Allow scripting AI for normal creatures and not controlled pets (guardians and mini-pets)
|
||||
if (!creature->IsPet() || !static_cast<Pet*>(creature)->isControlled())
|
||||
{ return scriptedAI; }
|
||||
{
|
||||
return scriptedAI;
|
||||
}
|
||||
}
|
||||
|
||||
CreatureAIRegistry& ai_registry(CreatureAIRepository::Instance());
|
||||
|
|
@ -64,17 +66,23 @@ namespace FactorySelector
|
|||
{
|
||||
Unit* controler = creature->GetOwner() ? creature->GetOwner() : creature->GetCharmer();
|
||||
if (controler && controler->GetTypeId() == TYPEID_PLAYER && controler->IsAlive())
|
||||
{ ai_factory = ai_registry.GetRegistryItem("PetAI"); }
|
||||
{
|
||||
ai_factory = ai_registry.GetRegistryItem("PetAI");
|
||||
}
|
||||
}
|
||||
else if (creature->IsTotem())
|
||||
{ ai_factory = ai_registry.GetRegistryItem("TotemAI"); }
|
||||
|
||||
// select by script name
|
||||
if (!ai_factory && !ainame.empty())
|
||||
{ ai_factory = ai_registry.GetRegistryItem(ainame.c_str()); }
|
||||
{
|
||||
ai_factory = ai_registry.GetRegistryItem(ainame.c_str());
|
||||
}
|
||||
|
||||
if (!ai_factory && creature->IsGuard())
|
||||
{ ai_factory = ai_registry.GetRegistryItem("GuardAI"); }
|
||||
{
|
||||
ai_factory = ai_registry.GetRegistryItem("GuardAI");
|
||||
}
|
||||
|
||||
// select by permit check
|
||||
if (!ai_factory)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -44,13 +44,17 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts(bool check_entry_use)
|
|||
sObjectMgr.LoadMangosStrings(WorldDatabase, "creature_ai_texts", MIN_CREATURE_AI_TEXT_STRING_ID, MAX_CREATURE_AI_TEXT_STRING_ID, true);
|
||||
|
||||
if (check_entry_use)
|
||||
{ CheckUnusedAITexts(); }
|
||||
{
|
||||
CheckUnusedAITexts();
|
||||
}
|
||||
}
|
||||
|
||||
void CreatureEventAIMgr::CheckUnusedAITexts()
|
||||
{
|
||||
if (m_usedTextsAmount == sObjectMgr.GetLoadedStringsCount(MIN_CREATURE_AI_TEXT_STRING_ID))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
sLog.outString("Checking EventAI for unused texts, this might take a while");
|
||||
|
||||
|
|
@ -58,7 +62,9 @@ void CreatureEventAIMgr::CheckUnusedAITexts()
|
|||
// check not used strings this is negative range
|
||||
for (int32 i = MAX_CREATURE_AI_TEXT_STRING_ID + 1; i <= MIN_CREATURE_AI_TEXT_STRING_ID; ++i)
|
||||
if (sObjectMgr.GetMangosStringLocale(i))
|
||||
{ idx_set.insert(i); }
|
||||
{
|
||||
idx_set.insert(i);
|
||||
}
|
||||
|
||||
for (CreatureEventAI_Event_Map::const_iterator itr = m_CreatureEventAI_Event_Map.begin(); itr != m_CreatureEventAI_Event_Map.end(); ++itr)
|
||||
{
|
||||
|
|
@ -78,7 +84,9 @@ void CreatureEventAIMgr::CheckUnusedAITexts()
|
|||
int k = action.type == ACTION_T_TEXT ? 0 : 1;
|
||||
for (; k < 3; ++k)
|
||||
if (action.text.TextId[k])
|
||||
{ idx_set.erase(action.text.TextId[k]); }
|
||||
{
|
||||
idx_set.erase(action.text.TextId[k]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
|
|
@ -106,7 +114,9 @@ bool IsValidTargetType(EventAI_Type eventType, EventAI_ActionType actionType, ui
|
|||
case TARGET_T_HOSTILE_RANDOM:
|
||||
case TARGET_T_HOSTILE_RANDOM_NOT_TOP:
|
||||
if (actionType == ACTION_T_QUEST_EVENT || actionType == ACTION_T_CAST_EVENT || actionType == ACTION_T_QUEST_EVENT_ALL || actionType == ACTION_T_KILLED_MONSTER)
|
||||
{ sLog.outErrorEventAI("Event %u Action%u uses LIKELY bad Target type %u for event-type %u (must target player)", eventId, action, targetType, eventType); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action%u uses LIKELY bad Target type %u for event-type %u (must target player)", eventId, action, targetType, eventType);
|
||||
}
|
||||
// no break, check if valid at all
|
||||
case TARGET_T_HOSTILE:
|
||||
case TARGET_T_HOSTILE_SECOND_AGGRO:
|
||||
|
|
@ -305,7 +315,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
|||
|
||||
// No chance of this event occuring
|
||||
if (temp.event_chance == 0)
|
||||
{ sLog.outErrorEventAI("Event %u has 0 percent chance. Event will never trigger!", i); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u has 0 percent chance. Event will never trigger!", i);
|
||||
}
|
||||
// Chance above 100, force it to be 100
|
||||
else if (temp.event_chance > 100)
|
||||
{
|
||||
|
|
@ -320,9 +332,13 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
|||
case EVENT_T_TIMER_OOC:
|
||||
case EVENT_T_TIMER_GENERIC:
|
||||
if (temp.timer.initialMax < temp.timer.initialMin)
|
||||
{ sLog.outErrorEventAI("Creature %u are using timed event(%u) with param2 < param1 (InitialMax < InitialMin). Event will never repeat.", temp.creature_id, i); }
|
||||
{
|
||||
sLog.outErrorEventAI("Creature %u are using timed event(%u) with param2 < param1 (InitialMax < InitialMin). Event will never repeat.", temp.creature_id, i);
|
||||
}
|
||||
if (temp.timer.repeatMax < temp.timer.repeatMin)
|
||||
{ sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); }
|
||||
{
|
||||
sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
|
||||
}
|
||||
break;
|
||||
case EVENT_T_HP:
|
||||
case EVENT_T_MANA:
|
||||
|
|
@ -330,10 +346,14 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
|||
case EVENT_T_TARGET_MANA:
|
||||
case EVENT_T_ENERGY:
|
||||
if (temp.percent_range.percentMax > 100)
|
||||
{ sLog.outErrorEventAI("Creature %u are using percentage event(%u) with param2 (MinPercent) > 100. Event will never trigger! ", temp.creature_id, i); }
|
||||
{
|
||||
sLog.outErrorEventAI("Creature %u are using percentage event(%u) with param2 (MinPercent) > 100. Event will never trigger! ", temp.creature_id, i);
|
||||
}
|
||||
|
||||
if (temp.percent_range.percentMax <= temp.percent_range.percentMin)
|
||||
{ sLog.outErrorEventAI("Creature %u are using percentage event(%u) with param1 <= param2 (MaxPercent <= MinPercent). Event will never trigger! ", temp.creature_id, i); }
|
||||
{
|
||||
sLog.outErrorEventAI("Creature %u are using percentage event(%u) with param1 <= param2 (MaxPercent <= MinPercent). Event will never trigger! ", temp.creature_id, i);
|
||||
}
|
||||
|
||||
if (temp.event_flags & EFLAG_REPEATABLE && !temp.percent_range.repeatMin && !temp.percent_range.repeatMax)
|
||||
{
|
||||
|
|
@ -352,24 +372,36 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
|||
}
|
||||
|
||||
if ((temp.spell_hit.schoolMask & pSpell->SchoolMask) != pSpell->SchoolMask)
|
||||
{ sLog.outErrorEventAI("Creature %u has param1(spellId %u) but param2 is not -1 and not equal to spell's school mask. Event %u can never trigger.", temp.creature_id, temp.spell_hit.schoolMask, i); }
|
||||
{
|
||||
sLog.outErrorEventAI("Creature %u has param1(spellId %u) but param2 is not -1 and not equal to spell's school mask. Event %u can never trigger.", temp.creature_id, temp.spell_hit.schoolMask, i);
|
||||
}
|
||||
}
|
||||
|
||||
if (!temp.spell_hit.schoolMask)
|
||||
{ sLog.outErrorEventAI("Creature %u is using invalid SpellSchoolMask(%u) defined in event %u.", temp.creature_id, temp.spell_hit.schoolMask, i); }
|
||||
{
|
||||
sLog.outErrorEventAI("Creature %u is using invalid SpellSchoolMask(%u) defined in event %u.", temp.creature_id, temp.spell_hit.schoolMask, i);
|
||||
}
|
||||
|
||||
if (temp.spell_hit.repeatMax < temp.spell_hit.repeatMin)
|
||||
{ sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); }
|
||||
{
|
||||
sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
|
||||
}
|
||||
break;
|
||||
case EVENT_T_RANGE:
|
||||
if (temp.range.maxDist < temp.range.minDist)
|
||||
{ sLog.outErrorEventAI("Creature %u are using event(%u) with param2 < param1 (MaxDist < MinDist). Event will never repeat.", temp.creature_id, i); }
|
||||
{
|
||||
sLog.outErrorEventAI("Creature %u are using event(%u) with param2 < param1 (MaxDist < MinDist). Event will never repeat.", temp.creature_id, i);
|
||||
}
|
||||
if (temp.range.repeatMax < temp.range.repeatMin)
|
||||
{ sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); }
|
||||
{
|
||||
sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
|
||||
}
|
||||
break;
|
||||
case EVENT_T_OOC_LOS:
|
||||
if (temp.ooc_los.repeatMax < temp.ooc_los.repeatMin)
|
||||
{ sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); }
|
||||
{
|
||||
sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
|
||||
}
|
||||
break;
|
||||
case EVENT_T_SPAWNED:
|
||||
switch (temp.spawned.condition)
|
||||
|
|
@ -378,11 +410,15 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
|||
break;
|
||||
case SPAWNED_EVENT_MAP:
|
||||
if (!sMapStore.LookupEntry(temp.spawned.conditionValue1))
|
||||
{ sLog.outErrorEventAI("Creature %u are using spawned event(%u) with param1 = %u 'map specific' but map (param2: %u) does not exist. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1); }
|
||||
{
|
||||
sLog.outErrorEventAI("Creature %u are using spawned event(%u) with param1 = %u 'map specific' but map (param2: %u) does not exist. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1);
|
||||
}
|
||||
break;
|
||||
case SPAWNED_EVENT_ZONE:
|
||||
if (!GetAreaEntryByAreaID(temp.spawned.conditionValue1))
|
||||
{ sLog.outErrorEventAI("Creature %u are using spawned event(%u) with param1 = %u 'area specific' but area (param2: %u) does not exist. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1); }
|
||||
{
|
||||
sLog.outErrorEventAI("Creature %u are using spawned event(%u) with param1 = %u 'area specific' but area (param2: %u) does not exist. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
sLog.outErrorEventAI("Creature %u are using invalid spawned event %u mode (%u) in param1", temp.creature_id, i, temp.spawned.condition);
|
||||
|
|
@ -391,11 +427,15 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
|||
break;
|
||||
case EVENT_T_FRIENDLY_HP:
|
||||
if (temp.friendly_hp.repeatMax < temp.friendly_hp.repeatMin)
|
||||
{ sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); }
|
||||
{
|
||||
sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
|
||||
}
|
||||
break;
|
||||
case EVENT_T_FRIENDLY_IS_CC:
|
||||
if (temp.friendly_is_cc.repeatMax < temp.friendly_is_cc.repeatMin)
|
||||
{ sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); }
|
||||
{
|
||||
sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
|
||||
}
|
||||
break;
|
||||
case EVENT_T_FRIENDLY_MISSING_BUFF:
|
||||
{
|
||||
|
|
@ -411,29 +451,41 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
|||
continue;
|
||||
}
|
||||
if (temp.friendly_buff.repeatMax < temp.friendly_buff.repeatMin)
|
||||
{ sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); }
|
||||
{
|
||||
sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EVENT_T_KILL:
|
||||
if (temp.kill.repeatMax < temp.kill.repeatMin)
|
||||
{ sLog.outErrorEventAI("Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); }
|
||||
{
|
||||
sLog.outErrorEventAI("Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
|
||||
}
|
||||
break;
|
||||
case EVENT_T_TARGET_CASTING:
|
||||
if (temp.target_casting.repeatMax < temp.target_casting.repeatMin)
|
||||
{ sLog.outErrorEventAI("Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); }
|
||||
{
|
||||
sLog.outErrorEventAI("Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
|
||||
}
|
||||
break;
|
||||
case EVENT_T_SUMMONED_UNIT:
|
||||
case EVENT_T_SUMMONED_JUST_DIED:
|
||||
case EVENT_T_SUMMONED_JUST_DESPAWN:
|
||||
if (!sCreatureStorage.LookupEntry<CreatureInfo>(temp.summoned.creatureId))
|
||||
{ sLog.outErrorEventAI("Creature %u are using event(%u) with nonexistent creature template id (%u) in param1, skipped.", temp.creature_id, i, temp.summoned.creatureId); }
|
||||
{
|
||||
sLog.outErrorEventAI("Creature %u are using event(%u) with nonexistent creature template id (%u) in param1, skipped.", temp.creature_id, i, temp.summoned.creatureId);
|
||||
}
|
||||
if (temp.summoned.repeatMax < temp.summoned.repeatMin)
|
||||
{ sLog.outErrorEventAI("Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); }
|
||||
{
|
||||
sLog.outErrorEventAI("Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
|
||||
}
|
||||
break;
|
||||
case EVENT_T_QUEST_ACCEPT:
|
||||
case EVENT_T_QUEST_COMPLETE:
|
||||
if (!sObjectMgr.GetQuestTemplate(temp.quest.questId))
|
||||
{ sLog.outErrorEventAI("Creature %u are using event(%u) with nonexistent quest id (%u) in param1, skipped.", temp.creature_id, i, temp.quest.questId); }
|
||||
{
|
||||
sLog.outErrorEventAI("Creature %u are using event(%u) with nonexistent quest id (%u) in param1, skipped.", temp.creature_id, i, temp.quest.questId);
|
||||
}
|
||||
sLog.outErrorEventAI("Creature %u using not implemented event (%u) in event %u.", temp.creature_id, temp.event_id, i);
|
||||
continue;
|
||||
|
||||
|
|
@ -491,7 +543,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
|||
continue;
|
||||
}
|
||||
if (temp.buffed.repeatMax < temp.buffed.repeatMin)
|
||||
{ sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); }
|
||||
{
|
||||
sLog.outErrorEventAI("Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EVENT_T_RECEIVE_AI_EVENT:
|
||||
|
|
@ -540,7 +594,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
|||
case ACTION_T_CHANCED_TEXT:
|
||||
// Check first param as chance
|
||||
if (!action.chanced_text.chance)
|
||||
{ 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)
|
||||
{ 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
|
||||
|
|
@ -553,10 +609,14 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
|||
if (action.text.TextId[k])
|
||||
{
|
||||
if (k > firstTextParam && not_set)
|
||||
{ sLog.outErrorEventAI("Event %u Action %u has param%d, but it follow after not set param. Required for randomized text.", i, j + 1, k + 1); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u has param%d, but it follow after not set param. Required for randomized text.", i, j + 1, k + 1);
|
||||
}
|
||||
|
||||
if (!action.text.TextId[k])
|
||||
{ not_set = true; }
|
||||
{
|
||||
not_set = true;
|
||||
}
|
||||
// range negative
|
||||
else if (action.text.TextId[k] > MIN_CREATURE_AI_TEXT_STRING_ID || action.text.TextId[k] <= MAX_CREATURE_AI_TEXT_STRING_ID)
|
||||
{
|
||||
|
|
@ -607,33 +667,51 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
|||
break;
|
||||
case ACTION_T_SOUND:
|
||||
if (!sSoundEntriesStore.LookupEntry(action.sound.soundId))
|
||||
{ sLog.outErrorEventAI("Event %u Action %u uses nonexistent SoundID %u.", i, j + 1, action.sound.soundId); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u uses nonexistent SoundID %u.", i, j + 1, action.sound.soundId);
|
||||
}
|
||||
break;
|
||||
case ACTION_T_EMOTE:
|
||||
if (!sEmotesStore.LookupEntry(action.emote.emoteId))
|
||||
{ sLog.outErrorEventAI("Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j + 1, action.emote.emoteId); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j + 1, action.emote.emoteId);
|
||||
}
|
||||
break;
|
||||
case ACTION_T_RANDOM_SOUND:
|
||||
if (!sSoundEntriesStore.LookupEntry(action.random_sound.soundId1))
|
||||
{ sLog.outErrorEventAI("Event %u Action %u param1 uses nonexistent SoundID %u.", i, j + 1, action.random_sound.soundId1); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u param1 uses nonexistent SoundID %u.", i, j + 1, action.random_sound.soundId1);
|
||||
}
|
||||
if (action.random_sound.soundId2 >= 0 && !sSoundEntriesStore.LookupEntry(action.random_sound.soundId2))
|
||||
{ sLog.outErrorEventAI("Event %u Action %u param2 uses nonexistent SoundID %u.", i, j + 1, action.random_sound.soundId2); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u param2 uses nonexistent SoundID %u.", i, j + 1, action.random_sound.soundId2);
|
||||
}
|
||||
if (action.random_sound.soundId3 >= 0 && !sSoundEntriesStore.LookupEntry(action.random_sound.soundId3))
|
||||
{ sLog.outErrorEventAI("Event %u Action %u param3 uses nonexistent SoundID %u.", i, j + 1, action.random_sound.soundId3); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u param3 uses nonexistent SoundID %u.", i, j + 1, action.random_sound.soundId3);
|
||||
}
|
||||
break;
|
||||
case ACTION_T_RANDOM_EMOTE:
|
||||
if (!sEmotesStore.LookupEntry(action.random_emote.emoteId1))
|
||||
{ sLog.outErrorEventAI("Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j + 1, action.random_emote.emoteId1); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j + 1, action.random_emote.emoteId1);
|
||||
}
|
||||
if (action.random_emote.emoteId2 >= 0 && !sEmotesStore.LookupEntry(action.random_emote.emoteId2))
|
||||
{ sLog.outErrorEventAI("Event %u Action %u param2 (EmoteId: %u) are not valid.", i, j + 1, action.random_emote.emoteId2); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u param2 (EmoteId: %u) are not valid.", i, j + 1, action.random_emote.emoteId2);
|
||||
}
|
||||
if (action.random_emote.emoteId3 >= 0 && !sEmotesStore.LookupEntry(action.random_emote.emoteId3))
|
||||
{ sLog.outErrorEventAI("Event %u Action %u param3 (EmoteId: %u) are not valid.", i, j + 1, action.random_emote.emoteId3); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u param3 (EmoteId: %u) are not valid.", i, j + 1, action.random_emote.emoteId3);
|
||||
}
|
||||
break;
|
||||
case ACTION_T_CAST:
|
||||
{
|
||||
const SpellEntry* spell = sSpellStore.LookupEntry(action.cast.spellId);
|
||||
if (!spell)
|
||||
{ sLog.outErrorEventAI("Event %u Action %u uses nonexistent SpellID %u.", i, j + 1, action.cast.spellId); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u uses nonexistent SpellID %u.", i, j + 1, action.cast.spellId);
|
||||
}
|
||||
/* FIXME: temp.raw.param3 not have event tipes with recovery time in it....
|
||||
else
|
||||
{
|
||||
|
|
@ -648,7 +726,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
|||
|
||||
// Cast is always triggered if target is forced to cast on self
|
||||
if (action.cast.castFlags & CAST_FORCE_TARGET_SELF)
|
||||
{ action.cast.castFlags |= CAST_TRIGGERED; }
|
||||
{
|
||||
action.cast.castFlags |= CAST_TRIGGERED;
|
||||
}
|
||||
|
||||
IsValidTargetType(temp.event_type, action.type, action.cast.target, i, j + 1);
|
||||
|
||||
|
|
@ -657,7 +737,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
|||
{
|
||||
// spell must be cast on self, but is not
|
||||
if ((IsOnlySelfTargeting(spell) || spell->rangeIndex == SPELL_RANGE_IDX_SELF_ONLY) && action.cast.target != TARGET_T_SELF && !(action.cast.castFlags & CAST_FORCE_TARGET_SELF))
|
||||
{ sLog.outErrorEventAI("Event %u Action %u uses SpellID %u that must be self cast (target is %u)", i, j + 1, action.cast.spellId, action.cast.target); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u uses SpellID %u that must be self cast (target is %u)", i, j + 1, action.cast.spellId, action.cast.target);
|
||||
}
|
||||
|
||||
// TODO: spell must be cast on enemy, but is not
|
||||
|
||||
|
|
@ -676,24 +758,32 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
|||
}
|
||||
case ACTION_T_SUMMON:
|
||||
if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.summon.creatureId))
|
||||
{ sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.summon.creatureId); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.summon.creatureId);
|
||||
}
|
||||
|
||||
IsValidTargetType(temp.event_type, action.type, action.summon.target, i, j + 1);
|
||||
break;
|
||||
case ACTION_T_THREAT_SINGLE_PCT:
|
||||
if (std::abs(action.threat_single_pct.percent) > 100)
|
||||
{ sLog.outErrorEventAI("Event %u Action %u uses invalid percent value %u.", i, j + 1, action.threat_single_pct.percent); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u uses invalid percent value %u.", i, j + 1, action.threat_single_pct.percent);
|
||||
}
|
||||
IsValidTargetType(temp.event_type, action.type, action.threat_single_pct.target, i, j + 1);
|
||||
break;
|
||||
case ACTION_T_THREAT_ALL_PCT:
|
||||
if (std::abs(action.threat_all_pct.percent) > 100)
|
||||
{ sLog.outErrorEventAI("Event %u Action %u uses invalid percent value %u.", i, j + 1, action.threat_all_pct.percent); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u uses invalid percent value %u.", i, j + 1, action.threat_all_pct.percent);
|
||||
}
|
||||
break;
|
||||
case ACTION_T_QUEST_EVENT:
|
||||
if (Quest const* qid = sObjectMgr.GetQuestTemplate(action.quest_event.questId))
|
||||
{
|
||||
if (!qid->HasSpecialFlag(QUEST_SPECIAL_FLAG_EXPLORATION_OR_EVENT))
|
||||
{ sLog.outErrorEventAI("Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j + 1, action.quest_event.questId); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j + 1, action.quest_event.questId);
|
||||
}
|
||||
}
|
||||
else
|
||||
{ sLog.outErrorEventAI("Event %u Action %u uses nonexistent Quest entry %u.", i, j + 1, action.quest_event.questId); }
|
||||
|
|
@ -702,14 +792,20 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
|||
break;
|
||||
case ACTION_T_CAST_EVENT:
|
||||
if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.cast_event.creatureId))
|
||||
{ sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.cast_event.creatureId); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.cast_event.creatureId);
|
||||
}
|
||||
if (!sSpellStore.LookupEntry(action.cast_event.spellId))
|
||||
{ sLog.outErrorEventAI("Event %u Action %u uses nonexistent SpellID %u.", i, j + 1, action.cast_event.spellId); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u uses nonexistent SpellID %u.", i, j + 1, action.cast_event.spellId);
|
||||
}
|
||||
IsValidTargetType(temp.event_type, action.type, action.cast_event.target, i, j + 1);
|
||||
break;
|
||||
case ACTION_T_SET_UNIT_FIELD:
|
||||
if (action.set_unit_field.field < OBJECT_END || action.set_unit_field.field >= UNIT_END)
|
||||
{ sLog.outErrorEventAI("Event %u Action %u param1 (UNIT_FIELD*). Index out of range for intended use.", i, j + 1); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u param1 (UNIT_FIELD*). Index out of range for intended use.", i, j + 1);
|
||||
}
|
||||
IsValidTargetType(temp.event_type, action.type, action.set_unit_field.target, i, j + 1);
|
||||
break;
|
||||
case ACTION_T_SET_UNIT_FLAG:
|
||||
|
|
@ -718,11 +814,15 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
|||
break;
|
||||
case ACTION_T_SET_PHASE:
|
||||
if (action.set_phase.phase >= MAX_PHASE)
|
||||
{ sLog.outErrorEventAI("Event %u Action %u attempts to set phase >= %u. Phase mask can not be used past phase %u.", i, j + 1, MAX_PHASE, MAX_PHASE - 1); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u attempts to set phase >= %u. Phase mask can not be used past phase %u.", i, j + 1, MAX_PHASE, MAX_PHASE - 1);
|
||||
}
|
||||
break;
|
||||
case ACTION_T_INC_PHASE:
|
||||
if (action.set_inc_phase.step == 0)
|
||||
{ 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)
|
||||
{ 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;
|
||||
|
|
@ -730,35 +830,53 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
|||
if (Quest const* qid = sObjectMgr.GetQuestTemplate(action.quest_event_all.questId))
|
||||
{
|
||||
if (!qid->HasSpecialFlag(QUEST_SPECIAL_FLAG_EXPLORATION_OR_EVENT))
|
||||
{ sLog.outErrorEventAI("Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j + 1, action.quest_event_all.questId); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j + 1, action.quest_event_all.questId);
|
||||
}
|
||||
}
|
||||
else
|
||||
{ sLog.outErrorEventAI("Event %u Action %u uses nonexistent Quest entry %u.", i, j + 1, action.quest_event_all.questId); }
|
||||
break;
|
||||
case ACTION_T_CAST_EVENT_ALL:
|
||||
if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.cast_event_all.creatureId))
|
||||
{ sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.cast_event_all.creatureId); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.cast_event_all.creatureId);
|
||||
}
|
||||
if (!sSpellStore.LookupEntry(action.cast_event_all.spellId))
|
||||
{ sLog.outErrorEventAI("Event %u Action %u uses nonexistent SpellID %u.", i, j + 1, action.cast_event_all.spellId); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u uses nonexistent SpellID %u.", i, j + 1, action.cast_event_all.spellId);
|
||||
}
|
||||
break;
|
||||
case ACTION_T_REMOVEAURASFROMSPELL:
|
||||
if (!sSpellStore.LookupEntry(action.remove_aura.spellId))
|
||||
{ sLog.outErrorEventAI("Event %u Action %u uses nonexistent SpellID %u.", i, j + 1, action.remove_aura.spellId); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u uses nonexistent SpellID %u.", i, j + 1, action.remove_aura.spellId);
|
||||
}
|
||||
IsValidTargetType(temp.event_type, action.type, action.remove_aura.target, i, j + 1);
|
||||
break;
|
||||
case ACTION_T_RANDOM_PHASE: // PhaseId1, PhaseId2, PhaseId3
|
||||
if (action.random_phase.phase1 >= MAX_PHASE)
|
||||
{ sLog.outErrorEventAI("Event %u Action %u attempts to set phase1 >= %u. Phase mask can not be used past phase %u.", i, j + 1, MAX_PHASE, MAX_PHASE - 1); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u attempts to set phase1 >= %u. Phase mask can not be used past phase %u.", i, j + 1, MAX_PHASE, MAX_PHASE - 1);
|
||||
}
|
||||
if (action.random_phase.phase2 >= MAX_PHASE)
|
||||
{ sLog.outErrorEventAI("Event %u Action %u attempts to set phase2 >= %u. Phase mask can not be used past phase %u.", i, j + 1, MAX_PHASE, MAX_PHASE - 1); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u attempts to set phase2 >= %u. Phase mask can not be used past phase %u.", i, j + 1, MAX_PHASE, MAX_PHASE - 1);
|
||||
}
|
||||
if (action.random_phase.phase3 >= MAX_PHASE)
|
||||
{ sLog.outErrorEventAI("Event %u Action %u attempts to set phase3 >= %u. Phase mask can not be used past phase %u.", i, j + 1, MAX_PHASE, MAX_PHASE - 1); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u attempts to set phase3 >= %u. Phase mask can not be used past phase %u.", i, j + 1, MAX_PHASE, MAX_PHASE - 1);
|
||||
}
|
||||
break;
|
||||
case ACTION_T_RANDOM_PHASE_RANGE: // PhaseMin, PhaseMax
|
||||
if (action.random_phase_range.phaseMin >= MAX_PHASE)
|
||||
{ sLog.outErrorEventAI("Event %u Action %u attempts to set phaseMin >= %u. Phase mask can not be used past phase %u.", i, j + 1, MAX_PHASE, MAX_PHASE - 1); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u attempts to set phaseMin >= %u. Phase mask can not be used past phase %u.", i, j + 1, MAX_PHASE, MAX_PHASE - 1);
|
||||
}
|
||||
if (action.random_phase_range.phaseMin >= MAX_PHASE)
|
||||
{ sLog.outErrorEventAI("Event %u Action %u attempts to set phaseMax >= %u. Phase mask can not be used past phase %u.", i, j + 1, MAX_PHASE, MAX_PHASE - 1); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u attempts to set phaseMax >= %u. Phase mask can not be used past phase %u.", i, j + 1, MAX_PHASE, MAX_PHASE - 1);
|
||||
}
|
||||
if (action.random_phase_range.phaseMin >= action.random_phase_range.phaseMax)
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u attempts to set phaseMax <= phaseMin.", i, j + 1);
|
||||
|
|
@ -768,21 +886,29 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
|||
break;
|
||||
case ACTION_T_SUMMON_ID:
|
||||
if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.summon_id.creatureId))
|
||||
{ sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.summon_id.creatureId); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.summon_id.creatureId);
|
||||
}
|
||||
IsValidTargetType(temp.event_type, action.type, action.summon_id.target, i, j + 1);
|
||||
if (m_CreatureEventAI_Summon_Map.find(action.summon_id.spawnId) == m_CreatureEventAI_Summon_Map.end())
|
||||
{ sLog.outErrorEventAI("Event %u Action %u summons missing CreatureEventAI_Summon %u", i, j + 1, action.summon_id.spawnId); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u summons missing CreatureEventAI_Summon %u", i, j + 1, action.summon_id.spawnId);
|
||||
}
|
||||
break;
|
||||
case ACTION_T_KILLED_MONSTER:
|
||||
if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.killed_monster.creatureId))
|
||||
{ sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.killed_monster.creatureId); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.killed_monster.creatureId);
|
||||
}
|
||||
IsValidTargetType(temp.event_type, action.type, action.killed_monster.target, i, j + 1);
|
||||
break;
|
||||
case ACTION_T_SET_INST_DATA:
|
||||
if (!(temp.event_flags & EFLAG_DIFFICULTY_ALL))
|
||||
sLog.outErrorEventAI("Event %u Action %u. Cannot set instance data without difficulty event flags.", i, j + 1);
|
||||
if (action.set_inst_data.value > 4/*SPECIAL*/)
|
||||
{ sLog.outErrorEventAI("Event %u Action %u attempts to set instance data above encounter state 4. Custom case?", i, j + 1); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u attempts to set instance data above encounter state 4. Custom case?", i, j + 1);
|
||||
}
|
||||
break;
|
||||
case ACTION_T_SET_INST_DATA64:
|
||||
if (!(temp.event_flags & EFLAG_DIFFICULTY_ALL))
|
||||
|
|
@ -791,7 +917,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
|||
break;
|
||||
case ACTION_T_UPDATE_TEMPLATE:
|
||||
if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.update_template.creatureId))
|
||||
{ sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.update_template.creatureId); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u uses nonexistent creature entry %u.", i, j + 1, action.update_template.creatureId);
|
||||
}
|
||||
break;
|
||||
case ACTION_T_SET_SHEATH:
|
||||
if (action.set_sheath.sheath >= MAX_SHEATH_STATE)
|
||||
|
|
@ -859,7 +987,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
|||
continue;
|
||||
}
|
||||
if (action.throwEvent.radius > SIZE_OF_GRIDS)
|
||||
{ sLog.outErrorEventAI("Event %u Action %u uses unexpectedly huge radius %u (expected to be less than %f)", i, j + 1, action.throwEvent.radius, SIZE_OF_GRIDS); }
|
||||
{
|
||||
sLog.outErrorEventAI("Event %u Action %u uses unexpectedly huge radius %u (expected to be less than %f)", i, j + 1, action.throwEvent.radius, SIZE_OF_GRIDS);
|
||||
}
|
||||
|
||||
if (action.throwEvent.radius == 0)
|
||||
{
|
||||
|
|
@ -913,7 +1043,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
|||
bool ainame = strcmp(cInfo->AIName, "EventAI") == 0;
|
||||
bool hasevent = m_CreatureEventAI_Event_Map.find(i) != m_CreatureEventAI_Event_Map.end();
|
||||
if (ainame && !hasevent)
|
||||
{ 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)
|
||||
{ sLog.outErrorEventAI("EventAI has script for creature entry (%u), but AIName = '%s' instead 'EventAI'.", i, cInfo->AIName); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,9 @@ void DynamicObject::AddToWorld()
|
|||
{
|
||||
///- Register the dynamicObject for guid lookup
|
||||
if (!IsInWorld())
|
||||
{ GetMap()->GetObjectsStore().insert<DynamicObject>(GetObjectGuid(), (DynamicObject*)this); }
|
||||
{
|
||||
GetMap()->GetObjectsStore().insert<DynamicObject>(GetObjectGuid(), (DynamicObject*)this);
|
||||
}
|
||||
|
||||
Object::AddToWorld();
|
||||
}
|
||||
|
|
@ -134,7 +136,9 @@ void DynamicObject::Update(uint32 /*update_diff*/, uint32 p_time)
|
|||
bool deleteThis = false;
|
||||
|
||||
if (m_aliveDuration > int32(p_time))
|
||||
{ m_aliveDuration -= p_time; }
|
||||
{
|
||||
m_aliveDuration -= p_time;
|
||||
}
|
||||
else
|
||||
{ deleteThis = true; }
|
||||
|
||||
|
|
@ -204,11 +208,15 @@ void DynamicObject::Delay(int32 delaytime)
|
|||
bool DynamicObject::isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const
|
||||
{
|
||||
if (!IsInWorld() || !u->IsInWorld())
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// always seen by owner
|
||||
if (GetCasterGuid() == u->GetObjectGuid())
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// normal case
|
||||
return IsWithinDistInMap(viewPoint, GetMap()->GetVisibilityDistance() + (inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false);
|
||||
|
|
@ -217,7 +225,9 @@ bool DynamicObject::isVisibleForInState(Player const* u, WorldObject const* view
|
|||
bool DynamicObject::IsHostileTo(Unit const* unit) const
|
||||
{
|
||||
if (Unit* owner = GetCaster())
|
||||
{ return owner->IsHostileTo(unit); }
|
||||
{
|
||||
return owner->IsHostileTo(unit);
|
||||
}
|
||||
else
|
||||
{ return false; }
|
||||
}
|
||||
|
|
@ -225,7 +235,9 @@ bool DynamicObject::IsHostileTo(Unit const* unit) const
|
|||
bool DynamicObject::IsFriendlyTo(Unit const* unit) const
|
||||
{
|
||||
if (Unit* owner = GetCaster())
|
||||
{ return owner->IsFriendlyTo(unit); }
|
||||
{
|
||||
return owner->IsFriendlyTo(unit);
|
||||
}
|
||||
else
|
||||
{ return true; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,9 @@ namespace MaNGOS
|
|||
inline uint32 GetGrayLevel(uint32 pl_level)
|
||||
{
|
||||
if (pl_level <= 5)
|
||||
{ return 0; }
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (pl_level <= 39)
|
||||
{ return pl_level - 5 - pl_level / 10; }
|
||||
else if (pl_level <= 59)
|
||||
|
|
@ -57,7 +59,9 @@ namespace MaNGOS
|
|||
inline XPColorChar GetColorCode(uint32 pl_level, uint32 mob_level)
|
||||
{
|
||||
if (mob_level >= pl_level + 5)
|
||||
{ return RED; }
|
||||
{
|
||||
return RED;
|
||||
}
|
||||
else if (mob_level >= pl_level + 3)
|
||||
{ return ORANGE; }
|
||||
else if (mob_level >= pl_level - 2)
|
||||
|
|
@ -102,7 +106,9 @@ namespace MaNGOS
|
|||
{
|
||||
uint32 nLevelDiff = mob_level - pl_level;
|
||||
if (nLevelDiff > 4)
|
||||
{ nLevelDiff = 4; }
|
||||
{
|
||||
nLevelDiff = 4;
|
||||
}
|
||||
return ((pl_level * 5 + nBaseExp) * (20 + nLevelDiff) / 10 + 1) / 2;
|
||||
}
|
||||
else
|
||||
|
|
@ -126,10 +132,14 @@ namespace MaNGOS
|
|||
|
||||
uint32 xp_gain = BaseGain(pl->getLevel(), u->getLevel(), GetContentLevelsForMapAndZone(pl->GetMapId(), pl->GetZoneId()));
|
||||
if (xp_gain == 0)
|
||||
{ return 0; }
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->IsElite())
|
||||
{ xp_gain *= 2; }
|
||||
{
|
||||
xp_gain *= 2;
|
||||
}
|
||||
|
||||
return (uint32)(xp_gain * sWorld.getConfig(CONFIG_FLOAT_RATE_XP_KILL));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,9 @@ void GMTicketMgr::LoadGMTickets()
|
|||
|
||||
uint32 guidlow = fields[0].GetUInt32();
|
||||
if (!guidlow)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ObjectGuid guid = ObjectGuid(HIGHGUID_PLAYER, guidlow);
|
||||
GMTicket& ticket = m_GMTicketMap[guid];
|
||||
|
|
@ -89,7 +91,9 @@ void GMTicketMgr::DeleteAll()
|
|||
for (GMTicketMap::const_iterator itr = m_GMTicketMap.begin(); itr != m_GMTicketMap.end(); ++itr)
|
||||
{
|
||||
if (Player* owner = sObjectMgr.GetPlayer(itr->first))
|
||||
{ owner->GetSession()->SendGMTicketGetTicket(0x0A); }
|
||||
{
|
||||
owner->GetSession()->SendGMTicketGetTicket(0x0A);
|
||||
}
|
||||
}
|
||||
CharacterDatabase.Execute("DELETE FROM character_ticket");
|
||||
m_GMTicketListByCreatingOrder.clear();
|
||||
|
|
|
|||
|
|
@ -187,7 +187,9 @@ class GMTicketMgr
|
|||
{
|
||||
GMTicketMap::iterator itr = m_GMTicketMap.find(guid);
|
||||
if (itr == m_GMTicketMap.end())
|
||||
{ return NULL; }
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return &(itr->second);
|
||||
}
|
||||
|
||||
|
|
@ -199,12 +201,16 @@ class GMTicketMgr
|
|||
GMTicket* GetGMTicketByOrderPos(uint32 pos)
|
||||
{
|
||||
if (pos >= GetTicketCount())
|
||||
{ return NULL; }
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GMTicketList::iterator itr = m_GMTicketListByCreatingOrder.begin();
|
||||
std::advance(itr, pos);
|
||||
if (itr == m_GMTicketListByCreatingOrder.end())
|
||||
{ return NULL; }
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return *itr;
|
||||
}
|
||||
|
||||
|
|
@ -220,7 +226,9 @@ class GMTicketMgr
|
|||
{
|
||||
GMTicketMap::iterator itr = m_GMTicketMap.find(guid);
|
||||
if (itr == m_GMTicketMap.end())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
itr->second.DeleteFromDB();
|
||||
m_GMTicketListByCreatingOrder.remove(&itr->second);
|
||||
m_GMTicketMap.erase(itr);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -690,7 +690,9 @@ class GameObject : public WorldObject
|
|||
{
|
||||
time_t now = time(NULL);
|
||||
if (m_respawnTime > now)
|
||||
{ return m_respawnTime; }
|
||||
{
|
||||
return m_respawnTime;
|
||||
}
|
||||
else
|
||||
{ return now; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,9 @@
|
|||
int GuardAI::Permissible(const Creature* creature)
|
||||
{
|
||||
if (creature->IsGuard())
|
||||
{ return PERMIT_BASE_SPECIAL; }
|
||||
{
|
||||
return PERMIT_BASE_SPECIAL;
|
||||
}
|
||||
|
||||
return PERMIT_BASE_NO;
|
||||
}
|
||||
|
|
@ -44,7 +46,9 @@ void GuardAI::MoveInLineOfSight(Unit* u)
|
|||
{
|
||||
// Ignore Z for flying creatures
|
||||
if (!m_creature->CanFly() && m_creature->GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_creature->getVictim() && u->IsTargetableForAttack() &&
|
||||
(u->IsHostileToPlayers() || m_creature->IsHostileTo(u) /*|| u->getVictim() && m_creature->IsFriendlyTo(u->getVictim())*/) &&
|
||||
|
|
@ -107,14 +111,18 @@ void GuardAI::EnterEvadeMode()
|
|||
|
||||
// Remove ChaseMovementGenerator from MotionMaster stack list, and add HomeMovementGenerator instead
|
||||
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE)
|
||||
{ m_creature->GetMotionMaster()->MoveTargetedHome(); }
|
||||
{
|
||||
m_creature->GetMotionMaster()->MoveTargetedHome();
|
||||
}
|
||||
}
|
||||
|
||||
void GuardAI::UpdateAI(const uint32 /*diff*/)
|
||||
{
|
||||
// update i_victimGuid if i_creature.getVictim() !=0 and changed
|
||||
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
i_victimGuid = m_creature->getVictim()->GetObjectGuid();
|
||||
|
||||
|
|
@ -130,7 +138,9 @@ bool GuardAI::IsVisible(Unit* pl) const
|
|||
void GuardAI::AttackStart(Unit* u)
|
||||
{
|
||||
if (!u)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_creature->Attack(u, true))
|
||||
{
|
||||
|
|
@ -146,5 +156,7 @@ void GuardAI::AttackStart(Unit* u)
|
|||
void GuardAI::JustDied(Unit* killer)
|
||||
{
|
||||
if (Player* pkiller = killer->GetCharmerOrOwnerPlayerOrPlayerItself())
|
||||
{ m_creature->SendZoneUnderAttackMessage(pkiller); }
|
||||
{
|
||||
m_creature->SendZoneUnderAttackMessage(pkiller);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,9 @@ void MemberSlot::ChangeRank(uint32 newRank)
|
|||
Player* player = sObjectMgr.GetPlayer(guid);
|
||||
// If player not online data in data field will be loaded from guild tabs no need to update it !!
|
||||
if (player)
|
||||
{ player->SetRank(newRank); }
|
||||
{
|
||||
player->SetRank(newRank);
|
||||
}
|
||||
|
||||
CharacterDatabase.PExecute("UPDATE guild_member SET rank='%u' WHERE guid='%u'", newRank, guid.GetCounter());
|
||||
}
|
||||
|
|
@ -117,11 +119,15 @@ Guild::~Guild()
|
|||
bool Guild::Create(Player* leader, std::string gname)
|
||||
{
|
||||
if (sGuildMgr.GetGuildByName(gname))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
WorldSession* lSession = leader->GetSession();
|
||||
if (!lSession)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_LeaderGuid = leader->GetObjectGuid();
|
||||
m_Name = gname;
|
||||
|
|
@ -179,12 +185,16 @@ bool Guild::AddMember(ObjectGuid plGuid, uint32 plRank)
|
|||
if (pl)
|
||||
{
|
||||
if (pl->GetGuildId() != 0)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Player::GetGuildIdFromDB(plGuid) != 0) // player already in guild
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// remove all player signs from another petitions
|
||||
|
|
@ -296,7 +306,9 @@ void Guild::SetGINFO(std::string ginfo)
|
|||
bool Guild::LoadGuildFromDB(QueryResult* guildDataResult)
|
||||
{
|
||||
if (!guildDataResult)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Field* fields = guildDataResult->Fetch();
|
||||
|
||||
|
|
@ -345,7 +357,9 @@ bool Guild::CheckGuildStructure()
|
|||
{
|
||||
MemberSlot &member = itr->second;
|
||||
if (member.RankId == GR_GUILDMASTER && m_LeaderGuid != member.guid)
|
||||
{ member.ChangeRank(GR_OFFICER); }
|
||||
{
|
||||
member.ChangeRank(GR_OFFICER);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -373,7 +387,9 @@ bool Guild::LoadRanksFromDB(QueryResult* guildRanksResult)
|
|||
fields = guildRanksResult->Fetch();
|
||||
// condition that would be true when all ranks in QueryResult will be processed and guild without ranks is being processed
|
||||
if (!fields)
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
uint32 guildId = fields[0].GetUInt32();
|
||||
if (guildId < m_Id)
|
||||
|
|
@ -385,7 +401,9 @@ bool Guild::LoadRanksFromDB(QueryResult* guildRanksResult)
|
|||
}
|
||||
|
||||
if (guildId > m_Id) // we loaded all ranks for this guild already, break cycle
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
uint32 rankID = fields[1].GetUInt32();
|
||||
std::string rankName = fields[2].GetCppString();
|
||||
|
|
@ -393,11 +411,15 @@ bool Guild::LoadRanksFromDB(QueryResult* guildRanksResult)
|
|||
uint32 rankMoney = fields[4].GetUInt32();
|
||||
|
||||
if (rankID != m_Ranks.size()) // guild_rank.ids are sequence 0,1,2,3..
|
||||
{ broken_ranks = true; }
|
||||
{
|
||||
broken_ranks = true;
|
||||
}
|
||||
|
||||
// first rank is guildmaster, prevent loss leader rights
|
||||
if (m_Ranks.empty())
|
||||
{ rankRights |= GR_RIGHT_ALL; }
|
||||
{
|
||||
rankRights |= GR_RIGHT_ALL;
|
||||
}
|
||||
|
||||
AddRank(rankName, rankRights, rankMoney);
|
||||
}
|
||||
|
|
@ -432,14 +454,18 @@ bool Guild::LoadRanksFromDB(QueryResult* guildRanksResult)
|
|||
bool Guild::LoadMembersFromDB(QueryResult* guildMembersResult)
|
||||
{
|
||||
if (!guildMembersResult)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
Field* fields = guildMembersResult->Fetch();
|
||||
// this condition will be true when all rows in QueryResult are processed and new guild without members is going to be loaded - prevent crash
|
||||
if (!fields)
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
uint32 guildId = fields[0].GetUInt32();
|
||||
if (guildId < m_Id)
|
||||
{
|
||||
|
|
@ -459,7 +485,9 @@ bool Guild::LoadMembersFromDB(QueryResult* guildMembersResult)
|
|||
newmember.RankId = fields[2].GetUInt32();
|
||||
// don't allow member to have not existing rank!
|
||||
if (newmember.RankId >= m_Ranks.size())
|
||||
{ newmember.RankId = GetLowestRank(); }
|
||||
{
|
||||
newmember.RankId = GetLowestRank();
|
||||
}
|
||||
|
||||
newmember.Pnote = fields[3].GetCppString();
|
||||
newmember.OFFnote = fields[4].GetCppString();
|
||||
|
|
@ -504,7 +532,9 @@ bool Guild::LoadMembersFromDB(QueryResult* guildMembersResult)
|
|||
while (guildMembersResult->NextRow());
|
||||
|
||||
if (members.empty())
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
UpdateAccountsNumber();
|
||||
|
||||
|
|
@ -515,7 +545,9 @@ void Guild::SetLeader(ObjectGuid guid)
|
|||
{
|
||||
MemberSlot* slot = GetMemberSlot(guid);
|
||||
if (!slot)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_LeaderGuid = guid;
|
||||
slot->ChangeRank(GR_GUILDMASTER);
|
||||
|
|
@ -558,13 +590,17 @@ bool Guild::DelMember(ObjectGuid guid, bool isDisbanding)
|
|||
}
|
||||
|
||||
if (!best)
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
SetLeader(newLeaderGUID);
|
||||
|
||||
// If player not online data in data field will be loaded from guild tabs no need to update it !!
|
||||
if (Player* newLeader = sObjectMgr.GetPlayer(newLeaderGUID))
|
||||
{ newLeader->SetRank(GR_GUILDMASTER); }
|
||||
{
|
||||
newLeader->SetRank(GR_GUILDMASTER);
|
||||
}
|
||||
|
||||
// when leader non-exist (at guild load with deleted leader only) not send broadcasts
|
||||
if (oldLeader)
|
||||
|
|
@ -588,7 +624,9 @@ bool Guild::DelMember(ObjectGuid guid, bool isDisbanding)
|
|||
CharacterDatabase.PExecute("DELETE FROM guild_member WHERE guid = '%u'", lowguid);
|
||||
|
||||
if (!isDisbanding)
|
||||
{ UpdateAccountsNumber(); }
|
||||
{
|
||||
UpdateAccountsNumber();
|
||||
}
|
||||
|
||||
// Used by Eluna
|
||||
#ifdef ENABLE_ELUNA
|
||||
|
|
@ -612,11 +650,15 @@ bool Guild::ChangeMemberRank(ObjectGuid guid, uint8 newRank)
|
|||
void Guild::BroadcastToGuild(WorldSession* session, const std::string& msg, uint32 language)
|
||||
{
|
||||
if (!session)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player* player = session->GetPlayer();
|
||||
if (!player || !HasRankRight(player->GetRank(), GR_RIGHT_GCHATSPEAK))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_GUILD, msg.c_str(), Language(language), player->GetChatTag(), player->GetObjectGuid(), player->GetName());
|
||||
|
|
@ -626,7 +668,9 @@ void Guild::BroadcastToGuild(WorldSession* session, const std::string& msg, uint
|
|||
Player* pl = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
||||
|
||||
if (pl && pl->GetSession() && HasRankRight(pl->GetRank(), GR_RIGHT_GCHATLISTEN) && !pl->GetSocial()->HasIgnore(player->GetObjectGuid()))
|
||||
{ pl->GetSession()->SendPacket(&data); }
|
||||
{
|
||||
pl->GetSession()->SendPacket(&data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -650,11 +694,15 @@ void Guild::BroadcastAddonToGuild(WorldSession* session, const std::string& msg,
|
|||
void Guild::BroadcastToOfficers(WorldSession* session, const std::string& msg, uint32 language)
|
||||
{
|
||||
if (!session)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player* player = session->GetPlayer();
|
||||
if (!player || !HasRankRight(player->GetRank(), GR_RIGHT_OFFCHATSPEAK))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr)
|
||||
{
|
||||
|
|
@ -691,7 +739,9 @@ void Guild::BroadcastPacket(WorldPacket* packet)
|
|||
{
|
||||
Player* player = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
||||
if (player)
|
||||
{ player->GetSession()->SendPacket(packet); }
|
||||
{
|
||||
player->GetSession()->SendPacket(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -703,7 +753,9 @@ void Guild::BroadcastPacketToRank(WorldPacket* packet, uint32 rankId)
|
|||
{
|
||||
Player* player = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first));
|
||||
if (player)
|
||||
{ player->GetSession()->SendPacket(packet); }
|
||||
{
|
||||
player->GetSession()->SendPacket(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -744,7 +796,9 @@ void Guild::MassInviteToEvent(WorldSession* session, uint32 minLevel, uint32 max
|
|||
void Guild::CreateRank(std::string name_, uint32 rights)
|
||||
{
|
||||
if (m_Ranks.size() >= GUILD_RANKS_MAX_COUNT)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// ranks are sequence 0,1,2,... where 0 means guildmaster
|
||||
uint32 new_rank_id = m_Ranks.size();
|
||||
|
|
@ -775,7 +829,9 @@ void Guild::DelRank(uint32 rankId)
|
|||
|
||||
// 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)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RankList::iterator itr = m_Ranks.erase(m_Ranks.begin() + rankId);
|
||||
// delete lowest guild_rank
|
||||
|
|
@ -826,7 +882,9 @@ void Guild::SwitchRank(uint32 rankId, bool up)
|
|||
std::string Guild::GetRankName(uint32 rankId)
|
||||
{
|
||||
if (rankId >= m_Ranks.size())
|
||||
{ return "<unknown>"; }
|
||||
{
|
||||
return "<unknown>";
|
||||
}
|
||||
|
||||
return m_Ranks[rankId].Name;
|
||||
}
|
||||
|
|
@ -834,7 +892,9 @@ std::string Guild::GetRankName(uint32 rankId)
|
|||
uint32 Guild::GetRankRights(uint32 rankId)
|
||||
{
|
||||
if (rankId >= m_Ranks.size())
|
||||
{ return 0; }
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return m_Ranks[rankId].Rights;
|
||||
}
|
||||
|
|
@ -842,7 +902,9 @@ uint32 Guild::GetRankRights(uint32 rankId)
|
|||
void Guild::SetRankName(uint32 rankId, std::string name_)
|
||||
{
|
||||
if (rankId >= m_Ranks.size())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_Ranks[rankId].Name = name_;
|
||||
|
||||
|
|
@ -854,7 +916,9 @@ void Guild::SetRankName(uint32 rankId, std::string name_)
|
|||
void Guild::SetRankRights(uint32 rankId, uint32 rights)
|
||||
{
|
||||
if (rankId >= m_Ranks.size())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_Ranks[rankId].Rights = rights;
|
||||
|
||||
|
|
@ -980,7 +1044,9 @@ void Guild::Roster(WorldSession* session /*= NULL*/)
|
|||
data << uint32(0);
|
||||
|
||||
if (session)
|
||||
{ session->SendPacket(&data); }
|
||||
{
|
||||
session->SendPacket(&data);
|
||||
}
|
||||
else
|
||||
{ BroadcastPacket(&data); }
|
||||
DEBUG_LOG("WORLD: Sent (SMSG_GUILD_ROSTER)");
|
||||
|
|
@ -996,7 +1062,9 @@ void Guild::Query(WorldSession* session)
|
|||
for (size_t i = 0 ; i < GUILD_RANKS_MAX_COUNT; ++i) // show always 10 ranks
|
||||
{
|
||||
if (i < m_Ranks.size())
|
||||
{ data << m_Ranks[i].Name; }
|
||||
{
|
||||
data << m_Ranks[i].Name;
|
||||
}
|
||||
else
|
||||
{ data << uint8(0); } // null string
|
||||
}
|
||||
|
|
@ -1079,7 +1147,9 @@ uint32 Guild::GetAccountsNumber()
|
|||
{
|
||||
// not need recalculation
|
||||
if (m_accountsNumber)
|
||||
{ return m_accountsNumber; }
|
||||
{
|
||||
return m_accountsNumber;
|
||||
}
|
||||
|
||||
// We use a set to be sure each element will be unique
|
||||
std::set<uint32> accountsIdSet;
|
||||
|
|
@ -1119,7 +1189,9 @@ void Guild::LoadGuildEventLogFromDB()
|
|||
// 0 1 2 3 4 5
|
||||
QueryResult* result = CharacterDatabase.PQuery("SELECT LogGuid, EventType, PlayerGuid1, PlayerGuid2, NewRank, TimeStamp FROM guild_eventlog WHERE guildid=%u ORDER BY TimeStamp DESC,LogGuid DESC LIMIT %u", m_Id, GUILD_EVENTLOG_MAX_RECORDS);
|
||||
if (!result)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
bool isNextLogGuidSet = false;
|
||||
// uint32 configCount = sWorld.getConfig(CONFIG_UINT32_GUILD_EVENT_LOG_COUNT);
|
||||
// First event in list will be the oldest and the latest event is last event in list
|
||||
|
|
@ -1164,7 +1236,9 @@ void Guild::LogGuildEvent(uint8 EventType, ObjectGuid playerGuid1, ObjectGuid pl
|
|||
m_GuildEventLogNextGuid = (m_GuildEventLogNextGuid + 1) % sWorld.getConfig(CONFIG_UINT32_GUILD_EVENT_LOG_COUNT);
|
||||
// Check max records limit
|
||||
if (m_GuildEventLog.size() >= GUILD_EVENTLOG_MAX_RECORDS)
|
||||
{ m_GuildEventLog.pop_front(); }
|
||||
{
|
||||
m_GuildEventLog.pop_front();
|
||||
}
|
||||
// Add event to list
|
||||
m_GuildEventLog.push_back(NewEvent);
|
||||
// Save event to DB
|
||||
|
|
|
|||
|
|
@ -401,7 +401,9 @@ class Guild
|
|||
for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first)))
|
||||
if (player != except)
|
||||
{ _do(player); }
|
||||
{
|
||||
_do(player);
|
||||
}
|
||||
}
|
||||
|
||||
void CreateRank(std::string name, uint32 rights);
|
||||
|
|
@ -443,7 +445,9 @@ class Guild
|
|||
{
|
||||
for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
|
||||
if (itr->second.Name == name)
|
||||
{ return &itr->second; }
|
||||
{
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,9 @@ void AddItemsSetItem(Player* player, Item* item)
|
|||
}
|
||||
|
||||
if (set->required_skill_id && player->GetSkillValue(set->required_skill_id) < set->required_skill_value)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ItemSetEffect* eff = NULL;
|
||||
|
||||
|
|
@ -69,10 +71,14 @@ void AddItemsSetItem(Player* player, Item* item)
|
|||
size_t x = 0;
|
||||
for (; x < player->ItemSetEff.size(); ++x)
|
||||
if (!player->ItemSetEff[x])
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (x < player->ItemSetEff.size())
|
||||
{ player->ItemSetEff[x] = eff; }
|
||||
{
|
||||
player->ItemSetEff[x] = eff;
|
||||
}
|
||||
else
|
||||
{ player->ItemSetEff.push_back(eff); }
|
||||
}
|
||||
|
|
@ -82,18 +88,26 @@ void AddItemsSetItem(Player* player, Item* item)
|
|||
for (uint32 x = 0; x < 8; ++x)
|
||||
{
|
||||
if (!set->spells[x])
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// not enough for spell
|
||||
if (set->items_to_triggerspell[x] > eff->item_count)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32 z = 0;
|
||||
for (; z < 8; ++z)
|
||||
if (eff->spells[z] && eff->spells[z]->Id == set->spells[x])
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (z < 8)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// new spell
|
||||
for (uint32 y = 0; y < 8; ++y)
|
||||
|
|
@ -141,18 +155,24 @@ void RemoveItemsSetItem(Player* player, ItemPrototype const* proto)
|
|||
|
||||
// can be in case now enough skill requirement for set appling but set has been appliend when skill requirement not enough
|
||||
if (!eff)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
--eff->item_count;
|
||||
|
||||
for (uint32 x = 0; x < 8; ++x)
|
||||
{
|
||||
if (!set->spells[x])
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// enough for spell
|
||||
if (set->items_to_triggerspell[x] <= eff->item_count)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (uint32 z = 0; z < 8; ++z)
|
||||
{
|
||||
|
|
@ -177,7 +197,9 @@ void RemoveItemsSetItem(Player* player, ItemPrototype const* proto)
|
|||
bool ItemCanGoIntoBag(ItemPrototype const* pProto, ItemPrototype const* pBagProto)
|
||||
{
|
||||
if (!pProto || !pBagProto)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (pBagProto->Class)
|
||||
{
|
||||
|
|
@ -188,15 +210,21 @@ bool ItemCanGoIntoBag(ItemPrototype const* pProto, ItemPrototype const* pBagProt
|
|||
return true;
|
||||
case ITEM_SUBCLASS_SOUL_CONTAINER:
|
||||
if (!(pProto->BagFamily & BAG_FAMILY_SOUL_SHARDS))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case ITEM_SUBCLASS_HERB_CONTAINER:
|
||||
if (!(pProto->BagFamily & BAG_FAMILY_HERBS))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case ITEM_SUBCLASS_ENCHANTING_CONTAINER:
|
||||
if (!(pProto->BagFamily & BAG_FAMILY_ENCHANTING_SUPP))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case ITEM_SUBCLASS_MINING_CONTAINER:
|
||||
if (!(pProto->BagFamily & BAG_FAMILY_MINING_SUPP))
|
||||
|
|
@ -204,7 +232,9 @@ bool ItemCanGoIntoBag(ItemPrototype const* pProto, ItemPrototype const* pBagProt
|
|||
return true;
|
||||
case ITEM_SUBCLASS_ENGINEERING_CONTAINER:
|
||||
if (!(pProto->BagFamily & BAG_FAMILY_ENGINEERING_SUPP))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case ITEM_SUBCLASS_GEM_CONTAINER:
|
||||
if (!(pProto->BagFamily & BAG_FAMILY_GEMS))
|
||||
|
|
@ -230,11 +260,15 @@ bool ItemCanGoIntoBag(ItemPrototype const* pProto, ItemPrototype const* pBagProt
|
|||
{
|
||||
case ITEM_SUBCLASS_QUIVER:
|
||||
if (!(pProto->BagFamily & BAG_FAMILY_ARROWS))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case ITEM_SUBCLASS_AMMO_POUCH:
|
||||
if (!(pProto->BagFamily & BAG_FAMILY_BULLETS))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
|
@ -402,7 +436,9 @@ bool Item::Create(uint32 guidlow, uint32 itemid, Player const* owner)
|
|||
|
||||
ItemPrototype const* itemProto = ObjectMgr::GetItemPrototype(itemid);
|
||||
if (!itemProto)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
SetUInt32Value(ITEM_FIELD_STACK_COUNT, 1);
|
||||
SetUInt32Value(ITEM_FIELD_MAXDURABILITY, itemProto->MaxDurability);
|
||||
|
|
@ -426,7 +462,9 @@ bool Item::IsNotEmptyBag() const
|
|||
void Item::UpdateDuration(Player* owner, uint32 diff)
|
||||
{
|
||||
if (!GetUInt32Value(ITEM_FIELD_DURATION))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// DEBUG_LOG("Item::UpdateDuration Item (Entry: %u Duration %u Diff %u)", GetEntry(), GetUInt32Value(ITEM_FIELD_DURATION), diff);
|
||||
|
||||
|
|
@ -546,11 +584,15 @@ void Item::SaveToDB()
|
|||
|
||||
LootItem* item = loot.LootItemInSlot(i, owner, &qitem);
|
||||
if (!item)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// questitems use the blocked field for other purposes
|
||||
if (!qitem && item->is_blocked)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
stmt.addUInt32(GetGUIDLow());
|
||||
stmt.addUInt32(owner->GetGUIDLow());
|
||||
|
|
@ -565,7 +607,9 @@ void Item::SaveToDB()
|
|||
}
|
||||
|
||||
if (m_lootState != ITEM_LOOT_NONE && m_lootState != ITEM_LOOT_TEMPORARY)
|
||||
{ SetLootState(ITEM_LOOT_UNCHANGED); }
|
||||
{
|
||||
SetLootState(ITEM_LOOT_UNCHANGED);
|
||||
}
|
||||
|
||||
SetState(ITEM_UNCHANGED);
|
||||
}
|
||||
|
|
@ -596,14 +640,18 @@ bool Item::LoadFromDB(uint32 guidLow, Field* fields, ObjectGuid ownerGuid)
|
|||
|
||||
ItemPrototype const* proto = GetProto();
|
||||
if (!proto)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// update max durability (and durability) if need
|
||||
if (proto->MaxDurability != GetUInt32Value(ITEM_FIELD_MAXDURABILITY))
|
||||
{
|
||||
SetUInt32Value(ITEM_FIELD_MAXDURABILITY, proto->MaxDurability);
|
||||
if (GetUInt32Value(ITEM_FIELD_DURABILITY) > proto->MaxDurability)
|
||||
{ SetUInt32Value(ITEM_FIELD_DURABILITY, proto->MaxDurability); }
|
||||
{
|
||||
SetUInt32Value(ITEM_FIELD_DURABILITY, proto->MaxDurability);
|
||||
}
|
||||
|
||||
need_save = true;
|
||||
}
|
||||
|
|
@ -768,13 +816,17 @@ uint32 Item::GetSkill()
|
|||
{
|
||||
case ITEM_CLASS_WEAPON:
|
||||
if (proto->SubClass >= MAX_ITEM_SUBCLASS_WEAPON)
|
||||
{ return 0; }
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{ return item_weapon_skills[proto->SubClass]; }
|
||||
|
||||
case ITEM_CLASS_ARMOR:
|
||||
if (proto->SubClass >= MAX_ITEM_SUBCLASS_ARMOR)
|
||||
{ return 0; }
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{ return item_armor_skills[proto->SubClass]; }
|
||||
|
||||
|
|
@ -788,7 +840,9 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id)
|
|||
ItemPrototype const* itemProto = sItemStorage.LookupEntry<ItemPrototype>(item_id);
|
||||
|
||||
if (!itemProto)
|
||||
{ return 0; }
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// item must have one from this field values not null if it can have random enchantments
|
||||
if ((!itemProto->RandomProperty) && (!itemProto->RandomSuffix))
|
||||
|
|
@ -825,7 +879,9 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id)
|
|||
void Item::SetItemRandomProperties(int32 randomPropId)
|
||||
{
|
||||
if (!randomPropId)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (randomPropId > 0)
|
||||
{
|
||||
|
|
@ -875,7 +931,9 @@ void Item::SetState(ItemUpdateState state, Player* forplayer)
|
|||
{
|
||||
// pretend the item never existed
|
||||
if (forplayer || GetOwnerGuid())
|
||||
{ RemoveFromUpdateQueueOf(forplayer); }
|
||||
{
|
||||
RemoveFromUpdateQueueOf(forplayer);
|
||||
}
|
||||
delete this;
|
||||
return;
|
||||
}
|
||||
|
|
@ -886,7 +944,9 @@ void Item::SetState(ItemUpdateState state, Player* forplayer)
|
|||
if (uState != ITEM_NEW) { uState = state; }
|
||||
|
||||
if (forplayer || GetOwnerGuid())
|
||||
{ AddToUpdateQueueOf(forplayer); }
|
||||
{
|
||||
AddToUpdateQueueOf(forplayer);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -900,7 +960,9 @@ void Item::SetState(ItemUpdateState state, Player* forplayer)
|
|||
void Item::AddToUpdateQueueOf(Player* player)
|
||||
{
|
||||
if (IsInUpdateQueue())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player)
|
||||
{
|
||||
|
|
@ -921,7 +983,9 @@ void Item::AddToUpdateQueueOf(Player* player)
|
|||
}
|
||||
|
||||
if (player->m_itemUpdateQueueBlocked)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player->m_itemUpdateQueue.push_back(this);
|
||||
uQueuePos = player->m_itemUpdateQueue.size() - 1;
|
||||
|
|
@ -930,7 +994,9 @@ void Item::AddToUpdateQueueOf(Player* player)
|
|||
void Item::RemoveFromUpdateQueueOf(Player* player)
|
||||
{
|
||||
if (!IsInUpdateQueue())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player)
|
||||
{
|
||||
|
|
@ -951,7 +1017,9 @@ void Item::RemoveFromUpdateQueueOf(Player* player)
|
|||
}
|
||||
|
||||
if (player->m_itemUpdateQueueBlocked)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player->m_itemUpdateQueue[uQueuePos] = NULL;
|
||||
uQueuePos = -1;
|
||||
|
|
@ -970,23 +1038,35 @@ bool Item::IsEquipped() const
|
|||
bool Item::CanBeTraded(bool mail) const
|
||||
{
|
||||
if ((!mail || !IsBoundAccountWide()) && IsSoulBound())
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (IsBag() && (Player::IsBagPos(GetPos()) || !((Bag const*)this)->IsEmpty()))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Player* owner = GetOwner())
|
||||
{
|
||||
if (owner->CanUnequipItem(GetPos(), false) != EQUIP_ERR_OK)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (owner->GetLootGuid() == GetObjectGuid())
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (HasGeneratedLoot())
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IsBoundByEnchant())
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -998,7 +1078,9 @@ bool Item::IsBoundByEnchant() const
|
|||
{
|
||||
uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot));
|
||||
if (!enchant_id)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (enchant_slot == TRANSMOGRIFY_ENCHANTMENT_SLOT)
|
||||
return true;
|
||||
|
|
@ -1008,10 +1090,14 @@ bool Item::IsBoundByEnchant() const
|
|||
|
||||
SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
|
||||
if (!enchantEntry)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (enchantEntry->slot & ENCHANTMENT_CAN_SOULBOUND)
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1069,14 +1155,20 @@ bool Item::IsTargetValidForItemUse(Unit* pUnitTarget)
|
|||
ItemRequiredTargetMapBounds bounds = sObjectMgr.GetItemRequiredTargetMapBounds(GetProto()->ItemId);
|
||||
|
||||
if (bounds.first == bounds.second)
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!pUnitTarget)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (ItemRequiredTargetMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
if (itr->second.IsFitToRequirements(pUnitTarget))
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1085,7 +1177,9 @@ void Item::SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint
|
|||
{
|
||||
// Better lost small time at check in comparison lost time at item save to DB.
|
||||
if ((GetEnchantmentId(slot) == id) && (GetEnchantmentDuration(slot) == duration) && (GetEnchantmentCharges(slot) == charges))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (slot < MAX_INSPECTED_ENCHANTMENT_SLOT)
|
||||
{
|
||||
|
|
@ -1106,7 +1200,9 @@ void Item::SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint
|
|||
void Item::SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration)
|
||||
{
|
||||
if (GetEnchantmentDuration(slot) == duration)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET, duration);
|
||||
SetState(ITEM_CHANGED);
|
||||
|
|
@ -1115,7 +1211,9 @@ void Item::SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration)
|
|||
void Item::SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges)
|
||||
{
|
||||
if (GetEnchantmentCharges(slot) == charges)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET, charges);
|
||||
SetState(ITEM_CHANGED);
|
||||
|
|
@ -1124,7 +1222,9 @@ void Item::SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges)
|
|||
void Item::ClearEnchantment(EnchantmentSlot slot)
|
||||
{
|
||||
if (!GetEnchantmentId(slot))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint8 x = 0; x < 3; ++x)
|
||||
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + x, 0);
|
||||
|
|
@ -1241,7 +1341,9 @@ void Item::SendTimeUpdate(Player* owner)
|
|||
|
||||
uint32 duration = GetUInt32Value(ITEM_FIELD_DURATION);
|
||||
if (!duration)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
WorldPacket data(SMSG_ITEM_TIME_UPDATE, (8 + 4));
|
||||
data << ObjectGuid(GetObjectGuid());
|
||||
|
|
@ -1257,7 +1359,9 @@ Item* Item::CreateItem(uint32 item, uint32 count, Player const* player, uint32 r
|
|||
if (ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(item))
|
||||
{
|
||||
if (count > pProto->GetMaxStackSize())
|
||||
{ count = pProto->GetMaxStackSize(); }
|
||||
{
|
||||
count = pProto->GetMaxStackSize();
|
||||
}
|
||||
|
||||
MANGOS_ASSERT(count != 0 && "pProto->Stackable == 0 but checked at loading already");
|
||||
|
||||
|
|
@ -1266,7 +1370,9 @@ Item* Item::CreateItem(uint32 item, uint32 count, Player const* player, uint32 r
|
|||
{
|
||||
pItem->SetCount(count);
|
||||
if (uint32 randId = randomPropertyId ? randomPropertyId : Item::GenerateItemRandomPropertyId(item))
|
||||
{ pItem->SetItemRandomProperties(randId); }
|
||||
{
|
||||
pItem->SetItemRandomProperties(randId);
|
||||
}
|
||||
|
||||
return pItem;
|
||||
}
|
||||
|
|
@ -1280,7 +1386,9 @@ Item* Item::CloneItem(uint32 count, Player const* player) const
|
|||
{
|
||||
Item* newItem = CreateItem(GetEntry(), count, player, GetItemRandomPropertyId());
|
||||
if (!newItem)
|
||||
{ return NULL; }
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
newItem->SetGuidValue(ITEM_FIELD_CREATOR, GetGuidValue(ITEM_FIELD_CREATOR));
|
||||
newItem->SetGuidValue(ITEM_FIELD_GIFTCREATOR, GetGuidValue(ITEM_FIELD_GIFTCREATOR));
|
||||
|
|
@ -1293,15 +1401,21 @@ bool Item::IsBindedNotWith(Player const* player) const
|
|||
{
|
||||
// own item
|
||||
if (GetOwnerGuid() == player->GetObjectGuid())
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// has loot with diff owner
|
||||
if (HasGeneratedLoot())
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// not binded item
|
||||
if (!IsSoulBound())
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// not BOA item case
|
||||
if (!IsBoundAccountWide())
|
||||
|
|
@ -1322,19 +1436,25 @@ bool Item::IsBindedNotWith(Player const* player) const
|
|||
void Item::AddToClientUpdateList()
|
||||
{
|
||||
if (Player* pl = GetOwner())
|
||||
{ pl->GetMap()->AddUpdateObject(this); }
|
||||
{
|
||||
pl->GetMap()->AddUpdateObject(this);
|
||||
}
|
||||
}
|
||||
|
||||
void Item::RemoveFromClientUpdateList()
|
||||
{
|
||||
if (Player* pl = GetOwner())
|
||||
{ pl->GetMap()->RemoveUpdateObject(this); }
|
||||
{
|
||||
pl->GetMap()->RemoveUpdateObject(this);
|
||||
}
|
||||
}
|
||||
|
||||
void Item::BuildUpdateData(UpdateDataMapType& update_players)
|
||||
{
|
||||
if (Player* pl = GetOwner())
|
||||
{ BuildUpdateDataForPlayer(pl, update_players); }
|
||||
{
|
||||
BuildUpdateDataForPlayer(pl, update_players);
|
||||
}
|
||||
|
||||
ClearUpdateMask(false);
|
||||
}
|
||||
|
|
@ -1343,15 +1463,21 @@ InventoryResult Item::CanBeMergedPartlyWith(ItemPrototype const* proto) const
|
|||
{
|
||||
// check item type
|
||||
if (GetEntry() != proto->ItemId)
|
||||
{ return EQUIP_ERR_ITEM_CANT_STACK; }
|
||||
{
|
||||
return EQUIP_ERR_ITEM_CANT_STACK;
|
||||
}
|
||||
|
||||
// check free space (full stacks can't be target of merge
|
||||
if (GetCount() >= proto->GetMaxStackSize())
|
||||
{ return EQUIP_ERR_ITEM_CANT_STACK; }
|
||||
{
|
||||
return EQUIP_ERR_ITEM_CANT_STACK;
|
||||
}
|
||||
|
||||
// not allow merge looting currently items
|
||||
if (HasGeneratedLoot())
|
||||
{ return EQUIP_ERR_ALREADY_LOOTED; }
|
||||
{
|
||||
return EQUIP_ERR_ALREADY_LOOTED;
|
||||
}
|
||||
|
||||
return EQUIP_ERR_OK;
|
||||
}
|
||||
|
|
@ -1359,10 +1485,14 @@ InventoryResult Item::CanBeMergedPartlyWith(ItemPrototype const* proto) const
|
|||
bool ItemRequiredTarget::IsFitToRequirements(Unit* pUnitTarget) const
|
||||
{
|
||||
if (pUnitTarget->GetTypeId() != TYPEID_UNIT)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pUnitTarget->GetEntry() != m_uiTargetEntry)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (m_uiType)
|
||||
{
|
||||
|
|
@ -1418,12 +1548,16 @@ void Item::SetLootState(ItemLootUpdateState state)
|
|||
case ITEM_LOOT_CHANGED:
|
||||
// new loot must stay in new state until saved, temporary must stay until remove
|
||||
if (m_lootState != ITEM_LOOT_NEW && m_lootState != ITEM_LOOT_TEMPORARY)
|
||||
{ m_lootState = m_lootState == ITEM_LOOT_NONE ? ITEM_LOOT_NEW : state; }
|
||||
{
|
||||
m_lootState = m_lootState == ITEM_LOOT_NONE ? ITEM_LOOT_NEW : state;
|
||||
}
|
||||
break;
|
||||
case ITEM_LOOT_UNCHANGED:
|
||||
// expected that called after DB update or load
|
||||
if (m_lootState == ITEM_LOOT_REMOVED)
|
||||
{ m_lootState = ITEM_LOOT_NONE; }
|
||||
{
|
||||
m_lootState = ITEM_LOOT_NONE;
|
||||
}
|
||||
// temporary must stay until remove (ignore any changes)
|
||||
else if (m_lootState != ITEM_LOOT_TEMPORARY)
|
||||
{ m_lootState = ITEM_LOOT_UNCHANGED; }
|
||||
|
|
@ -1441,7 +1575,9 @@ void Item::SetLootState(ItemLootUpdateState state)
|
|||
}
|
||||
|
||||
if (m_lootState != ITEM_LOOT_NONE && m_lootState != ITEM_LOOT_UNCHANGED && m_lootState != ITEM_LOOT_TEMPORARY)
|
||||
{ SetState(ITEM_CHANGED); }
|
||||
{
|
||||
SetState(ITEM_CHANGED);
|
||||
}
|
||||
}
|
||||
|
||||
uint32 Item::GetScriptId() const
|
||||
|
|
|
|||
|
|
@ -150,7 +150,9 @@ void LootStore::LoadLootTable()
|
|||
LootStoreItem storeitem = LootStoreItem(item, type, chanceOrQuestChance, group, conditionId, mincountOrRef, maxcount);
|
||||
|
||||
if (!storeitem.IsValid(*this, entry)) // Validity checks
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Looking for the template of the entry
|
||||
// often entries are put together
|
||||
|
|
@ -191,7 +193,9 @@ bool LootStore::HaveQuestLootFor(uint32 loot_id) const
|
|||
{
|
||||
LootTemplateMap::const_iterator itr = m_LootTemplates.find(loot_id);
|
||||
if (itr == m_LootTemplates.end())
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// scan loot for quest items
|
||||
return itr->second->HasQuestDrop(m_LootTemplates);
|
||||
|
|
@ -202,7 +206,9 @@ bool LootStore::HaveQuestLootForPlayer(uint32 loot_id, Player* player) const
|
|||
LootTemplateMap::const_iterator tab = m_LootTemplates.find(loot_id);
|
||||
if (tab != m_LootTemplates.end())
|
||||
if (tab->second->HasQuestDropForPlayer(m_LootTemplates, player))
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -212,7 +218,9 @@ LootTemplate const* LootStore::GetLootFor(uint32 loot_id) const
|
|||
LootTemplateMap::const_iterator tab = m_LootTemplates.find(loot_id);
|
||||
|
||||
if (tab == m_LootTemplates.end())
|
||||
{ return NULL; }
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return tab->second;
|
||||
}
|
||||
|
|
@ -256,10 +264,14 @@ void LootStore::ReportNotExistedId(uint32 id) const
|
|||
bool LootStoreItem::Roll(bool rate) const
|
||||
{
|
||||
if (chance >= 100.0f)
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mincountOrRef < 0) // reference case
|
||||
{ return roll_chance_f(chance * (rate ? sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_ITEM_REFERENCED) : 1.0f)); }
|
||||
{
|
||||
return roll_chance_f(chance * (rate ? sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_ITEM_REFERENCED) : 1.0f));
|
||||
}
|
||||
|
||||
if (type == LOOTITEM_TYPE_CURRENCY)
|
||||
return roll_chance_f(chance * (rate ? sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_CURRENCY) : 1.0f));
|
||||
|
|
@ -430,41 +442,57 @@ bool LootItem::AllowedForPlayer(Player const* player, WorldObject const* lootTar
|
|||
{
|
||||
ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(itemid);
|
||||
if (!pProto)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// not show loot for not own team
|
||||
if ((pProto->Flags2 & ITEM_FLAG2_HORDE_ONLY) && player->GetTeam() != HORDE)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((pProto->Flags2 & ITEM_FLAG2_ALLIANCE_ONLY) && player->GetTeam() != ALLIANCE)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (needs_quest)
|
||||
{
|
||||
// Checking quests for quest-only drop (check only quests requirements in this case)
|
||||
if (!player->HasQuestForItem(itemid))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not quest only drop (check quest starting items for already accepted non-repeatable quests)
|
||||
if (pProto->StartQuest && player->GetQuestStatus(pProto->StartQuest) != QUEST_STATUS_NONE && !player->HasQuestForItem(itemid))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (type == LOOT_ITEM_TYPE_CURRENCY)
|
||||
{
|
||||
CurrencyTypesEntry const * currency = sCurrencyTypesStore.LookupEntry(itemid);
|
||||
if (!itemid)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!player->isGameMaster())
|
||||
{
|
||||
if (currency->Category == CURRENCY_CATEGORY_META)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (currency->Category == CURRENCY_CATEGORY_ARCHAEOLOGY && !player->HasSkill(SKILL_ARCHAEOLOGY))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -475,7 +503,9 @@ LootSlotType LootItem::GetSlotTypeForSharedLoot(PermissionTypes permission, Play
|
|||
{
|
||||
// ignore currencies, looted items, FFA (each player get own copy) and not allowed items
|
||||
if (currency || is_looted || freeforall || (conditionId && !condition_ok) || !AllowedForPlayer(viewer, lootTarget))
|
||||
{ return MAX_LOOT_SLOT_TYPE; }
|
||||
{
|
||||
return MAX_LOOT_SLOT_TYPE;
|
||||
}
|
||||
|
||||
switch (permission)
|
||||
{
|
||||
|
|
@ -502,7 +532,9 @@ void Loot::AddItem(LootStoreItem const& item)
|
|||
if (item.needs_quest) // Quest drop
|
||||
{
|
||||
if (m_questItems.size() < MAX_NR_QUEST_ITEMS)
|
||||
{ m_questItems.push_back(LootItem(item)); }
|
||||
{
|
||||
m_questItems.push_back(LootItem(item));
|
||||
}
|
||||
}
|
||||
else if (items.size() < MAX_NR_LOOT_ITEMS) // Non-quest drop
|
||||
{
|
||||
|
|
@ -516,7 +548,9 @@ void Loot::AddItem(LootStoreItem const& item)
|
|||
{
|
||||
ItemPrototype const* proto = ObjectMgr::GetItemPrototype(item.itemid);
|
||||
if (!proto || !(proto->Flags & ITEM_FLAG_PARTY_LOOT))
|
||||
{ ++unlootedCount; }
|
||||
{
|
||||
++unlootedCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -526,14 +560,18 @@ bool Loot::FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner,
|
|||
{
|
||||
// Must be provided
|
||||
if (!loot_owner)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
LootTemplate const* tab = store.GetLootFor(loot_id);
|
||||
|
||||
if (!tab)
|
||||
{
|
||||
if (!noEmptyError)
|
||||
{ sLog.outErrorDb("Table '%s' loot id #%u used but it doesn't have records.", store.GetName(), loot_id); }
|
||||
{
|
||||
sLog.outErrorDb("Table '%s' loot id #%u used but it doesn't have records.", store.GetName(), loot_id);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -548,7 +586,9 @@ bool Loot::FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner,
|
|||
{
|
||||
for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
if (Player* pl = itr->getSource())
|
||||
{ FillNotNormalLootFor(pl); }
|
||||
{
|
||||
FillNotNormalLootFor(pl);
|
||||
}
|
||||
}
|
||||
// ... for personal loot
|
||||
else
|
||||
|
|
@ -567,11 +607,15 @@ void Loot::FillNotNormalLootFor(Player* pl)
|
|||
|
||||
qmapitr = m_playerQuestItems.find(plguid);
|
||||
if (qmapitr == m_playerQuestItems.end())
|
||||
{ FillQuestLoot(pl); }
|
||||
{
|
||||
FillQuestLoot(pl);
|
||||
}
|
||||
|
||||
qmapitr = m_playerFFAItems.find(plguid);
|
||||
if (qmapitr == m_playerFFAItems.end())
|
||||
{ FillFFALoot(pl); }
|
||||
{
|
||||
FillFFALoot(pl);
|
||||
}
|
||||
|
||||
qmapitr = m_playerNonQuestNonFFANonCurrencyConditionalItems.find(plguid);
|
||||
if (qmapitr == m_playerNonQuestNonFFANonCurrencyConditionalItems.end())
|
||||
|
|
@ -641,12 +685,16 @@ QuestItemList* Loot::FillQuestLoot(Player* player)
|
|||
//
|
||||
// increase once if one looter only, looter-times if free for all
|
||||
if (item.freeforall || !item.is_blocked)
|
||||
{ ++unlootedCount; }
|
||||
{
|
||||
++unlootedCount;
|
||||
}
|
||||
|
||||
item.is_blocked = true;
|
||||
|
||||
if (items.size() + ql->size() == MAX_NR_LOOT_ITEMS)
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ql->empty())
|
||||
|
|
@ -698,7 +746,9 @@ void Loot::NotifyItemRemoved(uint8 lootIndex)
|
|||
i_next = i;
|
||||
++i_next;
|
||||
if (Player* pl = ObjectAccessor::FindPlayer(*i))
|
||||
{ pl->SendNotifyLootItemRemoved(lootIndex); }
|
||||
{
|
||||
pl->SendNotifyLootItemRemoved(lootIndex);
|
||||
}
|
||||
else
|
||||
{ m_playersLooting.erase(i); }
|
||||
}
|
||||
|
|
@ -713,7 +763,9 @@ void Loot::NotifyMoneyRemoved()
|
|||
i_next = i;
|
||||
++i_next;
|
||||
if (Player* pl = ObjectAccessor::FindPlayer(*i))
|
||||
{ pl->SendNotifyLootMoneyRemoved(); }
|
||||
{
|
||||
pl->SendNotifyLootMoneyRemoved();
|
||||
}
|
||||
else
|
||||
{ m_playersLooting.erase(i); }
|
||||
}
|
||||
|
|
@ -742,10 +794,14 @@ void Loot::NotifyQuestItemRemoved(uint8 questIndex)
|
|||
uint8 j;
|
||||
for (j = 0; j < pql.size(); ++j)
|
||||
if (pql[j].index == questIndex)
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (j < pql.size())
|
||||
{ pl->SendNotifyLootItemRemoved(items.size() + j); }
|
||||
{
|
||||
pl->SendNotifyLootItemRemoved(items.size() + j);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -758,7 +814,9 @@ void Loot::generateMoneyLoot(uint32 minAmount, uint32 maxAmount)
|
|||
if (maxAmount > 0)
|
||||
{
|
||||
if (maxAmount <= minAmount)
|
||||
{ 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)
|
||||
{ gold = uint32(urand(minAmount, maxAmount) * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY)); }
|
||||
else
|
||||
|
|
@ -778,7 +836,9 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem** qite
|
|||
{
|
||||
QuestItem* qitem2 = &itr->second->at(questSlot);
|
||||
if (qitem)
|
||||
{ *qitem = qitem2; }
|
||||
{
|
||||
*qitem = qitem2;
|
||||
}
|
||||
item = &m_questItems[qitem2->index];
|
||||
is_looted = qitem2->is_looted;
|
||||
}
|
||||
|
|
@ -815,7 +875,9 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem** qite
|
|||
{
|
||||
QuestItem* ffaitem2 = (QuestItem*) & (*iter);
|
||||
if (ffaitem)
|
||||
{ *ffaitem = ffaitem2; }
|
||||
{
|
||||
*ffaitem = ffaitem2;
|
||||
}
|
||||
is_looted = ffaitem2->is_looted;
|
||||
break;
|
||||
}
|
||||
|
|
@ -832,7 +894,9 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem** qite
|
|||
{
|
||||
QuestItem* conditem2 = (QuestItem*) & (*iter);
|
||||
if (conditem)
|
||||
{ *conditem = conditem2; }
|
||||
{
|
||||
*conditem = conditem2;
|
||||
}
|
||||
is_looted = conditem2->is_looted;
|
||||
break;
|
||||
}
|
||||
|
|
@ -842,7 +906,9 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem** qite
|
|||
}
|
||||
|
||||
if (is_looted)
|
||||
{ return NULL; }
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
|
@ -899,7 +965,9 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
|
|||
{
|
||||
LootSlotType slot_type = l.items[i].GetSlotTypeForSharedLoot(lv.permission, lv.viewer, l.GetLootTarget());
|
||||
if (slot_type >= MAX_LOOT_SLOT_TYPE)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
b << uint8(i) << l.items[i];
|
||||
b << uint8(slot_type); // 0 - get 1 - look only 2 - master selection
|
||||
|
|
@ -917,7 +985,9 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
|
|||
|
||||
LootSlotType slot_type = item.GetSlotTypeForSharedLoot(lv.permission, lv.viewer, l.GetLootTarget(), !ci->is_looted);
|
||||
if (slot_type >= MAX_LOOT_SLOT_TYPE)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
b << uint8(ci->index) << item;
|
||||
b << uint8(slot_type); // allow loot
|
||||
|
|
@ -994,7 +1064,9 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
|
|||
void LootTemplate::LootGroup::AddEntry(LootStoreItem& item)
|
||||
{
|
||||
if (item.chance != 0)
|
||||
{ ExplicitlyChanced.push_back(item); }
|
||||
{
|
||||
ExplicitlyChanced.push_back(item);
|
||||
}
|
||||
else
|
||||
{ EqualChanced.push_back(item); }
|
||||
}
|
||||
|
|
@ -1009,15 +1081,21 @@ LootStoreItem const* LootTemplate::LootGroup::Roll() const
|
|||
for (uint32 i = 0; i < ExplicitlyChanced.size(); ++i) // check each explicitly chanced entry in the template and modify its chance based on quality.
|
||||
{
|
||||
if (ExplicitlyChanced[i].chance >= 100.0f)
|
||||
{ return &ExplicitlyChanced[i]; }
|
||||
{
|
||||
return &ExplicitlyChanced[i];
|
||||
}
|
||||
|
||||
Roll -= ExplicitlyChanced[i].chance;
|
||||
if (Roll < 0)
|
||||
{ return &ExplicitlyChanced[i]; }
|
||||
{
|
||||
return &ExplicitlyChanced[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!EqualChanced.empty()) // If nothing selected yet - an item is taken from equal-chanced part
|
||||
{ return &EqualChanced[irand(0, EqualChanced.size() - 1)]; }
|
||||
{
|
||||
return &EqualChanced[irand(0, EqualChanced.size() - 1)];
|
||||
}
|
||||
|
||||
return NULL; // Empty drop from the group
|
||||
}
|
||||
|
|
@ -1027,10 +1105,14 @@ bool LootTemplate::LootGroup::HasQuestDrop() const
|
|||
{
|
||||
for (LootStoreItemList::const_iterator i = ExplicitlyChanced.begin(); i != ExplicitlyChanced.end(); ++i)
|
||||
if (i->needs_quest)
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
for (LootStoreItemList::const_iterator i = EqualChanced.begin(); i != EqualChanced.end(); ++i)
|
||||
if (i->needs_quest)
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1039,10 +1121,14 @@ bool LootTemplate::LootGroup::HasQuestDropForPlayer(Player const* player) const
|
|||
{
|
||||
for (LootStoreItemList::const_iterator i = ExplicitlyChanced.begin(); i != ExplicitlyChanced.end(); ++i)
|
||||
if (player->HasQuestForItem(i->itemid))
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
for (LootStoreItemList::const_iterator i = EqualChanced.begin(); i != EqualChanced.end(); ++i)
|
||||
if (player->HasQuestForItem(i->itemid))
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1051,7 +1137,9 @@ void LootTemplate::LootGroup::Process(Loot& loot) const
|
|||
{
|
||||
LootStoreItem const* item = Roll();
|
||||
if (item != NULL)
|
||||
{ loot.AddItem(*item); }
|
||||
{
|
||||
loot.AddItem(*item);
|
||||
}
|
||||
}
|
||||
|
||||
// Overall chance for the group without equal chanced items
|
||||
|
|
@ -1061,7 +1149,9 @@ float LootTemplate::LootGroup::RawTotalChance() const
|
|||
|
||||
for (LootStoreItemList::const_iterator i = ExplicitlyChanced.begin(); i != ExplicitlyChanced.end(); ++i)
|
||||
if (!i->needs_quest)
|
||||
{ result += i->chance; }
|
||||
{
|
||||
result += i->chance;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -1072,7 +1162,9 @@ float LootTemplate::LootGroup::TotalChance() const
|
|||
float result = RawTotalChance();
|
||||
|
||||
if (!EqualChanced.empty() && result < 100.0f)
|
||||
{ return 100.0f; }
|
||||
{
|
||||
return 100.0f;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -1098,7 +1190,9 @@ void LootTemplate::LootGroup::CheckLootRefs(LootIdSet* ref_set) const
|
|||
if (ieItr->mincountOrRef < 0)
|
||||
{
|
||||
if (!LootTemplates_Reference.GetLootFor(-ieItr->mincountOrRef))
|
||||
{ LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef); }
|
||||
{
|
||||
LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef);
|
||||
}
|
||||
else if (ref_set)
|
||||
{ ref_set->erase(-ieItr->mincountOrRef); }
|
||||
}
|
||||
|
|
@ -1109,7 +1203,9 @@ void LootTemplate::LootGroup::CheckLootRefs(LootIdSet* ref_set) const
|
|||
if (ieItr->mincountOrRef < 0)
|
||||
{
|
||||
if (!LootTemplates_Reference.GetLootFor(-ieItr->mincountOrRef))
|
||||
{ LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef); }
|
||||
{
|
||||
LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef);
|
||||
}
|
||||
else if (ref_set)
|
||||
{ ref_set->erase(-ieItr->mincountOrRef); }
|
||||
}
|
||||
|
|
@ -1160,7 +1256,9 @@ void LootTemplate::Process(Loot& loot, LootStore const& store, bool rate, uint8
|
|||
|
||||
// Check condition
|
||||
if (i->conditionId && !sObjectMgr.IsPlayerMeetToCondition(i->conditionId, NULL, NULL, loot.GetLootTarget(), CONDITION_FROM_REFERING_LOOT))
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (uint32 loop = 0; loop < i->maxcount; ++loop) // Ref multiplicator
|
||||
{ Referenced->Process(loot, store, rate, i->group); }
|
||||
|
|
@ -1192,7 +1290,9 @@ bool LootTemplate::HasQuestDrop(LootTemplateMap const& store, uint8 groupId) con
|
|||
if (Referenced == store.end())
|
||||
{ continue; } // Error message [should be] already printed at loading stage
|
||||
if (Referenced->second->HasQuestDrop(store, i->group))
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (i->needs_quest)
|
||||
{ return true; } // quest drop found
|
||||
|
|
@ -1201,7 +1301,9 @@ bool LootTemplate::HasQuestDrop(LootTemplateMap const& store, uint8 groupId) con
|
|||
// Now processing groups
|
||||
for (LootGroups::const_iterator i = Groups.begin() ; i != Groups.end() ; ++i)
|
||||
if (i->HasQuestDrop())
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1225,7 +1327,9 @@ bool LootTemplate::HasQuestDropForPlayer(LootTemplateMap const& store, Player co
|
|||
if (Referenced == store.end())
|
||||
{ continue; } // Error message already printed at loading stage
|
||||
if (Referenced->second->HasQuestDropForPlayer(store, player, i->group))
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (player->HasQuestForItem(i->itemid))
|
||||
{ return true; } // active quest drop found
|
||||
|
|
@ -1234,7 +1338,9 @@ bool LootTemplate::HasQuestDropForPlayer(LootTemplateMap const& store, Player co
|
|||
// Now checking groups
|
||||
for (LootGroups::const_iterator i = Groups.begin(); i != Groups.end(); ++i)
|
||||
if (i->HasQuestDropForPlayer(player))
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1256,7 +1362,9 @@ void LootTemplate::CheckLootRefs(LootIdSet* ref_set) const
|
|||
if (ieItr->mincountOrRef < 0)
|
||||
{
|
||||
if (!LootTemplates_Reference.GetLootFor(-ieItr->mincountOrRef))
|
||||
{ LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef); }
|
||||
{
|
||||
LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef);
|
||||
}
|
||||
else if (ref_set)
|
||||
{ ref_set->erase(-ieItr->mincountOrRef); }
|
||||
}
|
||||
|
|
@ -1279,7 +1387,9 @@ void LoadLootTemplates_Creature()
|
|||
if (uint32 lootid = cInfo->LootId)
|
||||
{
|
||||
if (ids_set.find(lootid) == ids_set.end())
|
||||
{ LootTemplates_Creature.ReportNotExistedId(lootid); }
|
||||
{
|
||||
LootTemplates_Creature.ReportNotExistedId(lootid);
|
||||
}
|
||||
else
|
||||
{ ids_setUsed.insert(lootid); }
|
||||
}
|
||||
|
|
@ -1309,7 +1419,9 @@ void LoadLootTemplates_Disenchant()
|
|||
if (uint32 lootid = proto->DisenchantID)
|
||||
{
|
||||
if (ids_set.find(lootid) == ids_set.end())
|
||||
{ LootTemplates_Disenchant.ReportNotExistedId(lootid); }
|
||||
{
|
||||
LootTemplates_Disenchant.ReportNotExistedId(lootid);
|
||||
}
|
||||
else
|
||||
{ ids_setUsed.insert(lootid); }
|
||||
}
|
||||
|
|
@ -1331,7 +1443,9 @@ void LoadLootTemplates_Fishing()
|
|||
{
|
||||
if (AreaTableEntry const* areaEntry = sAreaStore.LookupEntry(i))
|
||||
if (ids_set.find(areaEntry->ID) != ids_set.end())
|
||||
{ ids_set.erase(areaEntry->ID); }
|
||||
{
|
||||
ids_set.erase(areaEntry->ID);
|
||||
}
|
||||
}
|
||||
|
||||
// by default (look config options) fishing at fail provide junk loot, entry 0 use for store this loot
|
||||
|
|
@ -1352,7 +1466,9 @@ void LoadLootTemplates_Gameobject()
|
|||
if (uint32 lootid = itr->GetLootId())
|
||||
{
|
||||
if (ids_set.find(lootid) == ids_set.end())
|
||||
{ LootTemplates_Gameobject.ReportNotExistedId(lootid); }
|
||||
{
|
||||
LootTemplates_Gameobject.ReportNotExistedId(lootid);
|
||||
}
|
||||
else
|
||||
{ ids_setUsed.insert(lootid); }
|
||||
}
|
||||
|
|
@ -1375,10 +1491,14 @@ void LoadLootTemplates_Item()
|
|||
if (ItemPrototype const* proto = sItemStorage.LookupEntry<ItemPrototype>(i))
|
||||
{
|
||||
if (!(proto->Flags & ITEM_FLAG_LOOTABLE))
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ids_set.find(proto->ItemId) != ids_set.end() || proto->MaxMoneyLoot > 0)
|
||||
{ ids_set.erase(proto->ItemId); }
|
||||
{
|
||||
ids_set.erase(proto->ItemId);
|
||||
}
|
||||
// wdb have wrong data cases, so skip by default
|
||||
else if (!sLog.HasLogFilter(LOG_FILTER_DB_STRICTED_CHECK))
|
||||
{ LootTemplates_Item.ReportNotExistedId(proto->ItemId); }
|
||||
|
|
@ -1427,7 +1547,9 @@ void LoadLootTemplates_Pickpocketing()
|
|||
if (uint32 lootid = cInfo->PickpocketLootId)
|
||||
{
|
||||
if (ids_set.find(lootid) == ids_set.end())
|
||||
{ LootTemplates_Pickpocketing.ReportNotExistedId(lootid); }
|
||||
{
|
||||
LootTemplates_Pickpocketing.ReportNotExistedId(lootid);
|
||||
}
|
||||
else
|
||||
{ ids_setUsed.insert(lootid); }
|
||||
}
|
||||
|
|
@ -1474,7 +1596,9 @@ void LoadLootTemplates_Mail()
|
|||
for (uint32 i = 1; i < sMailTemplateStore.GetNumRows(); ++i)
|
||||
if (sMailTemplateStore.LookupEntry(i))
|
||||
if (ids_set.find(i) != ids_set.end())
|
||||
{ ids_set.erase(i); }
|
||||
{
|
||||
ids_set.erase(i);
|
||||
}
|
||||
|
||||
// output error for any still listed (not referenced from appropriate table) ids
|
||||
LootTemplates_Mail.ReportUnusedIds(ids_set);
|
||||
|
|
@ -1493,7 +1617,9 @@ void LoadLootTemplates_Skinning()
|
|||
if (uint32 lootid = cInfo->SkinningLootId)
|
||||
{
|
||||
if (ids_set.find(lootid) == ids_set.end())
|
||||
{ LootTemplates_Skinning.ReportNotExistedId(lootid); }
|
||||
{
|
||||
LootTemplates_Skinning.ReportNotExistedId(lootid);
|
||||
}
|
||||
else
|
||||
{ ids_setUsed.insert(lootid); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,9 @@ void Object::_InitValues()
|
|||
void Object::_Create(uint32 guidlow, uint32 entry, HighGuid guidhigh)
|
||||
{
|
||||
if (!m_uint32Values)
|
||||
{ _InitValues(); }
|
||||
{
|
||||
_InitValues();
|
||||
}
|
||||
|
||||
ObjectGuid guid = ObjectGuid(guidhigh, entry, guidlow);
|
||||
SetGuidValue(OBJECT_FIELD_GUID, guid);
|
||||
|
|
@ -114,7 +116,9 @@ void Object::SetObjectScale(float newScale)
|
|||
void Object::SendForcedObjectUpdate()
|
||||
{
|
||||
if (!m_inWorld || !m_objectUpdated)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateDataMapType update_players;
|
||||
|
||||
|
|
@ -133,14 +137,18 @@ void Object::SendForcedObjectUpdate()
|
|||
void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const
|
||||
{
|
||||
if (!target)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
uint8 updatetype = UPDATETYPE_CREATE_OBJECT;
|
||||
uint16 updateFlags = m_updateFlag;
|
||||
|
||||
/** lower flag1 **/
|
||||
if (target == this) // building packet for yourself
|
||||
{ updateFlags |= UPDATEFLAG_SELF; }
|
||||
{
|
||||
updateFlags |= UPDATEFLAG_SELF;
|
||||
}
|
||||
|
||||
if (m_itsNewObject)
|
||||
{
|
||||
|
|
@ -518,7 +526,9 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 updateFlags) const
|
|||
void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* updateMask, Player* target) const
|
||||
{
|
||||
if (!target)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 valuesCount = m_valuesCount;
|
||||
if(GetTypeId() == TYPEID_PLAYER && target != this)
|
||||
|
|
@ -532,7 +542,9 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* u
|
|||
if (isType(TYPEMASK_GAMEOBJECT) && !((GameObject*)this)->IsTransport())
|
||||
{
|
||||
if (((GameObject*)this)->ActivateToQuest(target) || target->isGameMaster())
|
||||
{ IsActivateToQuest = true; }
|
||||
{
|
||||
IsActivateToQuest = true;
|
||||
}
|
||||
|
||||
updateMask->SetBit(GAMEOBJECT_DYNAMIC);
|
||||
}
|
||||
|
|
@ -550,7 +562,9 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* u
|
|||
if (isType(TYPEMASK_GAMEOBJECT) && !((GameObject*)this)->IsTransport())
|
||||
{
|
||||
if (((GameObject*)this)->ActivateToQuest(target) || target->isGameMaster())
|
||||
{ IsActivateToQuest = true; }
|
||||
{
|
||||
IsActivateToQuest = true;
|
||||
}
|
||||
|
||||
updateMask->SetBit(GAMEOBJECT_DYNAMIC);
|
||||
updateMask->SetBit(GAMEOBJECT_BYTES_1); // why do we need this here?
|
||||
|
|
@ -595,7 +609,9 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* u
|
|||
if (appendValue & UNIT_NPC_FLAG_STABLEMASTER)
|
||||
{
|
||||
if (target->getClass() != CLASS_HUNTER)
|
||||
{ appendValue &= ~UNIT_NPC_FLAG_STABLEMASTER; }
|
||||
{
|
||||
appendValue &= ~UNIT_NPC_FLAG_STABLEMASTER;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -656,14 +672,18 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* u
|
|||
/* If we're not allowed to loot the target, destroy the lootable flag */
|
||||
if (!target->isAllowedToLoot((Creature*)this))
|
||||
if (send_value & UNIT_DYNFLAG_LOOTABLE)
|
||||
{ send_value = send_value & ~UNIT_DYNFLAG_LOOTABLE; }
|
||||
{
|
||||
send_value = send_value & ~UNIT_DYNFLAG_LOOTABLE;
|
||||
}
|
||||
|
||||
/* If we are allowed to loot it and mob is tapped by us, destroy the tapped flag */
|
||||
bool is_tapped = target->IsTappedByMeOrMyGroup((Creature*)this);
|
||||
|
||||
/* If the creature has tapped flag but is tapped by us, remove the flag */
|
||||
if (send_value & UNIT_DYNFLAG_TAPPED && is_tapped)
|
||||
{ send_value = send_value & ~UNIT_DYNFLAG_TAPPED; }
|
||||
{
|
||||
send_value = send_value & ~UNIT_DYNFLAG_TAPPED;
|
||||
}
|
||||
|
||||
*data << send_value;
|
||||
}
|
||||
|
|
@ -753,7 +773,9 @@ void Object::ClearUpdateMask(bool remove)
|
|||
if (m_objectUpdated)
|
||||
{
|
||||
if (remove)
|
||||
{ RemoveFromClientUpdateList(); }
|
||||
{
|
||||
RemoveFromClientUpdateList();
|
||||
}
|
||||
m_objectUpdated = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -765,7 +787,9 @@ bool Object::LoadValues(const char* data)
|
|||
Tokens tokens = StrSplit(data, " ");
|
||||
|
||||
if (tokens.size() != m_valuesCount)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Tokens::iterator iter;
|
||||
int index;
|
||||
|
|
@ -785,7 +809,9 @@ void Object::_SetUpdateBits(UpdateMask* updateMask, Player* target) const
|
|||
|
||||
for (uint16 index = 0; index < valuesCount; ++index )
|
||||
if (m_changedValues[index])
|
||||
{ updateMask->SetBit(index); }
|
||||
{
|
||||
updateMask->SetBit(index);
|
||||
}
|
||||
}
|
||||
|
||||
void Object::_SetCreateBits(UpdateMask* updateMask, Player* target) const
|
||||
|
|
@ -796,7 +822,9 @@ void Object::_SetCreateBits(UpdateMask* updateMask, Player* target) const
|
|||
|
||||
for (uint16 index = 0; index < valuesCount; ++index)
|
||||
if (GetUInt32Value(index) != 0)
|
||||
{ updateMask->SetBit(index); }
|
||||
{
|
||||
updateMask->SetBit(index);
|
||||
}
|
||||
}
|
||||
|
||||
void Object::SetInt32Value(uint16 index, int32 value)
|
||||
|
|
@ -897,7 +925,9 @@ void Object::SetUInt16Value(uint16 index, uint8 offset, uint16 value)
|
|||
void Object::SetStatFloatValue(uint16 index, float value)
|
||||
{
|
||||
if (value < 0)
|
||||
{ value = 0.0f; }
|
||||
{
|
||||
value = 0.0f;
|
||||
}
|
||||
|
||||
SetFloatValue(index, value);
|
||||
}
|
||||
|
|
@ -905,7 +935,9 @@ void Object::SetStatFloatValue(uint16 index, float value)
|
|||
void Object::SetStatInt32Value(uint16 index, int32 value)
|
||||
{
|
||||
if (value < 0)
|
||||
{ value = 0; }
|
||||
{
|
||||
value = 0;
|
||||
}
|
||||
|
||||
SetUInt32Value(index, uint32(value));
|
||||
}
|
||||
|
|
@ -915,7 +947,9 @@ void Object::ApplyModUInt32Value(uint16 index, int32 val, bool apply)
|
|||
int32 cur = GetUInt32Value(index);
|
||||
cur += (apply ? val : -val);
|
||||
if (cur < 0)
|
||||
{ cur = 0; }
|
||||
{
|
||||
cur = 0;
|
||||
}
|
||||
SetUInt32Value(index, cur);
|
||||
}
|
||||
|
||||
|
|
@ -938,7 +972,9 @@ void Object::ApplyModPositiveFloatValue(uint16 index, float val, bool apply)
|
|||
float cur = GetFloatValue(index);
|
||||
cur += (apply ? val : -val);
|
||||
if (cur < 0)
|
||||
{ cur = 0; }
|
||||
{
|
||||
cur = 0;
|
||||
}
|
||||
SetFloatValue(index, cur);
|
||||
}
|
||||
|
||||
|
|
@ -1145,7 +1181,9 @@ void WorldObject::Relocate(float x, float y, float z, float orientation)
|
|||
m_position.o = NormalizeOrientation(orientation);
|
||||
|
||||
if (isType(TYPEMASK_UNIT))
|
||||
{ ((Unit*)this)->m_movementInfo.ChangePosition(x, y, z, orientation); }
|
||||
{
|
||||
((Unit*)this)->m_movementInfo.ChangePosition(x, y, z, orientation);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldObject::Relocate(float x, float y, float z)
|
||||
|
|
@ -1155,7 +1193,9 @@ void WorldObject::Relocate(float x, float y, float z)
|
|||
m_position.z = z;
|
||||
|
||||
if (isType(TYPEMASK_UNIT))
|
||||
{ ((Unit*)this)->m_movementInfo.ChangePosition(x, y, z, GetOrientation()); }
|
||||
{
|
||||
((Unit*)this)->m_movementInfo.ChangePosition(x, y, z, GetOrientation());
|
||||
}
|
||||
}
|
||||
|
||||
void WorldObject::SetOrientation(float orientation)
|
||||
|
|
@ -1163,7 +1203,9 @@ void WorldObject::SetOrientation(float orientation)
|
|||
m_position.o = NormalizeOrientation(orientation);
|
||||
|
||||
if (isType(TYPEMASK_UNIT))
|
||||
{ ((Unit*)this)->m_movementInfo.ChangeOrientation(orientation); }
|
||||
{
|
||||
((Unit*)this)->m_movementInfo.ChangeOrientation(orientation);
|
||||
}
|
||||
}
|
||||
|
||||
uint32 WorldObject::GetZoneId() const
|
||||
|
|
@ -1330,7 +1372,9 @@ bool WorldObject::IsInRange(WorldObject const* obj, float minRange, float maxRan
|
|||
{
|
||||
float mindist = minRange + sizefactor;
|
||||
if (distsq < mindist * mindist)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
float maxdist = maxRange + sizefactor;
|
||||
|
|
@ -1350,7 +1394,9 @@ bool WorldObject::IsInRange2d(float x, float y, float minRange, float maxRange)
|
|||
{
|
||||
float mindist = minRange + sizefactor;
|
||||
if (distsq < mindist * mindist)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
float maxdist = maxRange + sizefactor;
|
||||
|
|
@ -1371,7 +1417,9 @@ bool WorldObject::IsInRange3d(float x, float y, float z, float minRange, float m
|
|||
{
|
||||
float mindist = minRange + sizefactor;
|
||||
if (distsq < mindist * mindist)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
float maxdist = maxRange + sizefactor;
|
||||
|
|
@ -1381,7 +1429,9 @@ bool WorldObject::IsInRange3d(float x, float y, float z, float minRange, float m
|
|||
float WorldObject::GetAngle(const WorldObject* obj) const
|
||||
{
|
||||
if (!obj)
|
||||
{ return 0.0f; }
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
// Rework the assert, when more cases where such a call can happen have been fixed
|
||||
// MANGOS_ASSERT(obj != this || PrintEntryError("GetAngle (for self)"));
|
||||
|
|
@ -1408,7 +1458,9 @@ bool WorldObject::HasInArc(const float arcangle, const WorldObject* obj) const
|
|||
{
|
||||
// always have self in arc
|
||||
if (obj == this)
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
float arc = arcangle;
|
||||
|
||||
|
|
@ -1421,7 +1473,9 @@ bool WorldObject::HasInArc(const float arcangle, const WorldObject* obj) const
|
|||
// move angle to range -pi ... +pi
|
||||
angle = NormalizeOrientation(angle);
|
||||
if (angle > M_PI_F)
|
||||
{ angle -= 2.0f * M_PI_F; }
|
||||
{
|
||||
angle -= 2.0f * M_PI_F;
|
||||
}
|
||||
|
||||
float lborder = -1 * (arc / 2.0f); // in range -pi..0
|
||||
float rborder = (arc / 2.0f); // in range 0..pi
|
||||
|
|
@ -1490,7 +1544,9 @@ void WorldObject::UpdateGroundPositionZ(float x, float y, float& z) const
|
|||
void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z, Map* atMap /*=NULL*/) const
|
||||
{
|
||||
if (!atMap)
|
||||
{ atMap = GetMap(); }
|
||||
{
|
||||
atMap = GetMap();
|
||||
}
|
||||
|
||||
switch (GetTypeId())
|
||||
{
|
||||
|
|
@ -1508,7 +1564,9 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z, Map* atMap
|
|||
if (max_z > INVALID_HEIGHT)
|
||||
{
|
||||
if (z > max_z)
|
||||
{ z = max_z; }
|
||||
{
|
||||
z = max_z;
|
||||
}
|
||||
else if (z < ground_z)
|
||||
{ z = ground_z; }
|
||||
}
|
||||
|
|
@ -1517,7 +1575,9 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z, Map* atMap
|
|||
{
|
||||
float ground_z = atMap->GetHeight(GetPhaseMask(), x, y, z);
|
||||
if (z < ground_z)
|
||||
{ z = ground_z; }
|
||||
{
|
||||
z = ground_z;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -1531,7 +1591,9 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z, Map* atMap
|
|||
if (max_z > INVALID_HEIGHT)
|
||||
{
|
||||
if (z > max_z)
|
||||
{ z = max_z; }
|
||||
{
|
||||
z = max_z;
|
||||
}
|
||||
else if (z < ground_z)
|
||||
{ z = ground_z; }
|
||||
}
|
||||
|
|
@ -1548,7 +1610,9 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z, Map* atMap
|
|||
{
|
||||
float ground_z = atMap->GetHeight(GetPhaseMask(), x, y, z);
|
||||
if (ground_z > INVALID_HEIGHT)
|
||||
{ z = ground_z; }
|
||||
{
|
||||
z = ground_z;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1586,7 +1650,9 @@ void WorldObject::MonsterTextEmote(const char* text, Unit const* target, bool Is
|
|||
void WorldObject::MonsterWhisper(const char* text, Unit const* target, bool IsBossWhisper) const
|
||||
{
|
||||
if (!target || target->GetTypeId() != TYPEID_PLAYER)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
WorldPacket data(SMSG_MESSAGECHAT, 200);
|
||||
ChatHandler::BuildChatPacket(data, IsBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, text, LANG_UNIVERSAL, CHAT_TAG_NONE, GetObjectGuid(), GetName(),
|
||||
|
|
@ -1605,7 +1671,9 @@ namespace MaNGOS
|
|||
{
|
||||
char const* text = NULL;
|
||||
if ((int32)i_textData->Content.size() > loc_idx + 1 && !i_textData->Content[loc_idx + 1].empty())
|
||||
{ text = i_textData->Content[loc_idx + 1].c_str(); }
|
||||
{
|
||||
text = i_textData->Content[loc_idx + 1].c_str();
|
||||
}
|
||||
else
|
||||
{ text = i_textData->Content[0].c_str(); }
|
||||
|
||||
|
|
@ -1653,7 +1721,9 @@ void WorldObject::MonsterText(MangosStringLocale const* textData, Unit const* ta
|
|||
case CHAT_TYPE_WHISPER:
|
||||
{
|
||||
if (!target || target->GetTypeId() != TYPEID_PLAYER)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
MaNGOS::MonsterChatBuilder say_build(*this, CHAT_MSG_MONSTER_WHISPER, textData, LANG_UNIVERSAL, target);
|
||||
MaNGOS::LocalizedPacketDo<MaNGOS::MonsterChatBuilder> say_do(say_build);
|
||||
say_do((Player*)target);
|
||||
|
|
@ -1662,7 +1732,9 @@ void WorldObject::MonsterText(MangosStringLocale const* textData, Unit const* ta
|
|||
case CHAT_TYPE_BOSS_WHISPER:
|
||||
{
|
||||
if (!target || target->GetTypeId() != TYPEID_PLAYER)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
MaNGOS::MonsterChatBuilder say_build(*this, CHAT_MSG_RAID_BOSS_WHISPER, textData, LANG_UNIVERSAL, target);
|
||||
MaNGOS::LocalizedPacketDo<MaNGOS::MonsterChatBuilder> say_do(say_build);
|
||||
say_do((Player*)target);
|
||||
|
|
@ -1676,7 +1748,9 @@ void WorldObject::MonsterText(MangosStringLocale const* textData, Unit const* ta
|
|||
Map::PlayerList const& pList = GetMap()->GetPlayers();
|
||||
for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr)
|
||||
if (itr->getSource()->GetZoneId() == zoneid)
|
||||
{ say_do(itr->getSource()); }
|
||||
{
|
||||
say_do(itr->getSource());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1686,14 +1760,18 @@ void WorldObject::SendMessageToSet(WorldPacket* data, bool /*bToSelf*/) const
|
|||
{
|
||||
// if object is in world, map for it already created!
|
||||
if (IsInWorld())
|
||||
{ GetMap()->MessageBroadcast(this, data); }
|
||||
{
|
||||
GetMap()->MessageBroadcast(this, data);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldObject::SendMessageToSetInRange(WorldPacket* data, float dist, bool /*bToSelf*/) const
|
||||
{
|
||||
// if object is in world, map for it already created!
|
||||
if (IsInWorld())
|
||||
{ GetMap()->MessageDistBroadcast(this, data, dist); }
|
||||
{
|
||||
GetMap()->MessageDistBroadcast(this, data, dist);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldObject::SendMessageToSetExcept(WorldPacket* data, Player const* skipped_receiver) const
|
||||
|
|
@ -1768,12 +1846,16 @@ Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, floa
|
|||
|
||||
Team team = TEAM_NONE;
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
{ team = ((Player*)this)->GetTeam(); }
|
||||
{
|
||||
team = ((Player*)this)->GetTeam();
|
||||
}
|
||||
|
||||
CreatureCreatePos pos(GetMap(), x, y, z, ang, GetPhaseMask());
|
||||
|
||||
if (x == 0.0f && y == 0.0f && z == 0.0f)
|
||||
{ pos = CreatureCreatePos(this, GetOrientation(), CONTACT_DISTANCE, ang); }
|
||||
{
|
||||
pos = CreatureCreatePos(this, GetOrientation(), CONTACT_DISTANCE, ang);
|
||||
}
|
||||
|
||||
if (!pCreature->Create(GetMap()->GenerateLocalLowGuid(cinfo->GetHighGuid()), pos, cinfo, team))
|
||||
{
|
||||
|
|
@ -1792,7 +1874,9 @@ Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, floa
|
|||
pCreature->Summon(spwtype, despwtime); // Also initializes the AI and MMGen
|
||||
|
||||
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->AI())
|
||||
{ ((Creature*)this)->AI()->JustSummoned(pCreature); }
|
||||
{
|
||||
((Creature*)this)->AI()->JustSummoned(pCreature);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_ELUNA
|
||||
if (Unit* summoner = ToUnit())
|
||||
|
|
@ -1801,7 +1885,9 @@ Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, floa
|
|||
|
||||
// Creature Linking, Initial load is handled like respawn
|
||||
if (pCreature->IsLinkingEventTrigger())
|
||||
{ GetMap()->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_RESPAWN, pCreature); }
|
||||
{
|
||||
GetMap()->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_RESPAWN, pCreature);
|
||||
}
|
||||
|
||||
// return the creature therewith the summoner has access to it
|
||||
return pCreature;
|
||||
|
|
@ -1847,7 +1933,9 @@ namespace MaNGOS
|
|||
{
|
||||
// skip self or target
|
||||
if (c == i_searcher || c == &i_object)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
float x, y, z;
|
||||
|
||||
|
|
@ -1865,7 +1953,9 @@ namespace MaNGOS
|
|||
{
|
||||
// skip self or target
|
||||
if (u == i_searcher || u == &i_object)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
float x, y;
|
||||
|
||||
|
|
@ -1885,19 +1975,25 @@ namespace MaNGOS
|
|||
// It is ok for the objects to require a bit more space
|
||||
float delta = u->GetObjectBoundingRadius();
|
||||
if (i_selector.m_searchPosFor && i_selector.m_searchPosFor != u)
|
||||
{ delta += i_selector.m_searchPosFor->GetObjectBoundingRadius(); }
|
||||
{
|
||||
delta += i_selector.m_searchPosFor->GetObjectBoundingRadius();
|
||||
}
|
||||
|
||||
delta *= OCCUPY_POS_DEPTH_FACTOR; // Increase by factor
|
||||
|
||||
// u is too near/far away from i_object. Do not consider it to occupy space
|
||||
if (fabs(i_selector.m_searcherDist - dist2d) > delta)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
float angle = i_object.GetAngle(u) - i_absAngle;
|
||||
|
||||
// move angle to range -pi ... +pi, range before is -2Pi..2Pi
|
||||
if (angle > M_PI_F)
|
||||
{ angle -= 2.0f * M_PI_F; }
|
||||
{
|
||||
angle -= 2.0f * M_PI_F;
|
||||
}
|
||||
else if (angle < -M_PI_F)
|
||||
{ angle += 2.0f * M_PI_F; }
|
||||
|
||||
|
|
@ -1964,7 +2060,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
|||
{ UpdateGroundPositionZ(x, y, z); }
|
||||
|
||||
if (fabs(init_z - z) < dist && IsWithinLOS(x, y, z))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
first_los_conflict = true; // first point have LOS problems
|
||||
}
|
||||
|
|
@ -1986,7 +2084,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
|||
{ UpdateGroundPositionZ(x, y, z); }
|
||||
|
||||
if (fabs(init_z - z) < dist && IsWithinLOS(x, y, z))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// BAD NEWS: not free pos (or used or have LOS problems)
|
||||
|
|
@ -2018,7 +2118,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
|
|||
{ UpdateGroundPositionZ(x, y, z); }
|
||||
|
||||
if (fabs(init_z - z) < dist && IsWithinLOS(x, y, z))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// BAD BAD NEWS: all found pos (free and used) have LOS problem :(
|
||||
|
|
@ -2046,7 +2148,9 @@ void WorldObject::PlayDistanceSound(uint32 sound_id, Player const* target /*= NU
|
|||
data << GetObjectGuid();
|
||||
data << GetObjectGuid();
|
||||
if (target)
|
||||
{ target->SendDirectMessage(&data); }
|
||||
{
|
||||
target->SendDirectMessage(&data);
|
||||
}
|
||||
else
|
||||
{ SendMessageToSet(&data, true); }
|
||||
}
|
||||
|
|
@ -2057,7 +2161,9 @@ void WorldObject::PlayDirectSound(uint32 sound_id, Player const* target /*= NULL
|
|||
data << uint32(sound_id);
|
||||
data << ObjectGuid();
|
||||
if (target)
|
||||
{ target->SendDirectMessage(&data); }
|
||||
{
|
||||
target->SendDirectMessage(&data);
|
||||
}
|
||||
else
|
||||
{ SendMessageToSet(&data, true); }
|
||||
}
|
||||
|
|
@ -2067,7 +2173,9 @@ void WorldObject::PlayMusic(uint32 sound_id, Player const* target /*= NULL*/) co
|
|||
WorldPacket data(SMSG_PLAY_MUSIC, 4);
|
||||
data << uint32(sound_id);
|
||||
if (target)
|
||||
{ target->SendDirectMessage(&data); }
|
||||
{
|
||||
target->SendDirectMessage(&data);
|
||||
}
|
||||
else
|
||||
{ SendMessageToSet(&data, true); }
|
||||
}
|
||||
|
|
@ -2106,7 +2214,9 @@ struct WorldObjectChangeAccumulator
|
|||
// send self fields changes in another way, otherwise
|
||||
// with new camera system when player's camera too far from player, camera wouldn't receive packets and changes from player
|
||||
if (i_object.isType(TYPEMASK_PLAYER))
|
||||
{ i_object.BuildUpdateDataForPlayer((Player*)&i_object, i_updateDatas); }
|
||||
{
|
||||
i_object.BuildUpdateDataForPlayer((Player*)&i_object, i_updateDatas);
|
||||
}
|
||||
}
|
||||
|
||||
void Visit(CameraMapType& m)
|
||||
|
|
@ -2115,7 +2225,9 @@ struct WorldObjectChangeAccumulator
|
|||
{
|
||||
Player* owner = iter->getSource()->GetOwner();
|
||||
if (owner != &i_object && owner->HaveAtClient(&i_object))
|
||||
{ i_object.BuildUpdateDataForPlayer(owner, i_updateDatas); }
|
||||
{
|
||||
i_object.BuildUpdateDataForPlayer(owner, i_updateDatas);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2157,14 +2269,18 @@ bool WorldObject::PrintCoordinatesError(float x, float y, float z, char const* d
|
|||
void WorldObject::SetActiveObjectState(bool active)
|
||||
{
|
||||
if (m_isActiveObject == active || (isType(TYPEMASK_PLAYER) && !active)) // player shouldn't became inactive, never
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsInWorld() && !isType(TYPEMASK_PLAYER))
|
||||
// player's update implemented in a different from other active worldobject's way
|
||||
// it's considired to use generic way in future
|
||||
{
|
||||
if (IsActiveObject() && !active)
|
||||
{ GetMap()->RemoveFromActive(this); }
|
||||
{
|
||||
GetMap()->RemoveFromActive(this);
|
||||
}
|
||||
else if (!IsActiveObject() && active)
|
||||
{ GetMap()->AddToActive(this); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,7 +128,9 @@ class WorldUpdateCounter
|
|||
time_t timeElapsed()
|
||||
{
|
||||
if (!m_tmStart)
|
||||
{ m_tmStart = WorldTimer::tickPrevTime(); }
|
||||
{
|
||||
m_tmStart = WorldTimer::tickPrevTime();
|
||||
}
|
||||
|
||||
return WorldTimer::getMSTimeDiff(m_tmStart, WorldTimer::tickTime());
|
||||
}
|
||||
|
|
@ -148,7 +150,9 @@ class Object
|
|||
virtual void AddToWorld()
|
||||
{
|
||||
if (m_inWorld)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_inWorld = true;
|
||||
|
||||
|
|
@ -284,7 +288,9 @@ class Object
|
|||
void ToggleFlag(uint16 index, uint32 flag)
|
||||
{
|
||||
if (HasFlag(index, flag))
|
||||
{ RemoveFlag(index, flag); }
|
||||
{
|
||||
RemoveFlag(index, flag);
|
||||
}
|
||||
else
|
||||
{ SetFlag(index, flag); }
|
||||
}
|
||||
|
|
@ -306,7 +312,9 @@ class Object
|
|||
void ApplyModFlag(uint16 index, uint32 flag, bool apply)
|
||||
{
|
||||
if (apply)
|
||||
{ SetFlag(index, flag); }
|
||||
{
|
||||
SetFlag(index, flag);
|
||||
}
|
||||
else
|
||||
{ RemoveFlag(index, flag); }
|
||||
}
|
||||
|
|
@ -317,7 +325,9 @@ class Object
|
|||
void ToggleByteFlag(uint16 index, uint8 offset, uint8 flag)
|
||||
{
|
||||
if (HasByteFlag(index, offset, flag))
|
||||
{ RemoveByteFlag(index, offset, flag); }
|
||||
{
|
||||
RemoveByteFlag(index, offset, flag);
|
||||
}
|
||||
else
|
||||
{ SetByteFlag(index, offset, flag); }
|
||||
}
|
||||
|
|
@ -332,7 +342,9 @@ class Object
|
|||
void ApplyModByteFlag(uint16 index, uint8 offset, uint32 flag, bool apply)
|
||||
{
|
||||
if (apply)
|
||||
{ SetByteFlag(index, offset, flag); }
|
||||
{
|
||||
SetByteFlag(index, offset, flag);
|
||||
}
|
||||
else
|
||||
{ RemoveByteFlag(index, offset, flag); }
|
||||
}
|
||||
|
|
@ -343,7 +355,9 @@ class Object
|
|||
void ToggleShortFlag(uint16 index, bool highpart, uint8 flag)
|
||||
{
|
||||
if (HasShortFlag(index, highpart, flag))
|
||||
{ RemoveShortFlag(index, highpart, flag); }
|
||||
{
|
||||
RemoveShortFlag(index, highpart, flag);
|
||||
}
|
||||
else
|
||||
{ SetShortFlag(index, highpart, flag); }
|
||||
}
|
||||
|
|
@ -357,7 +371,9 @@ class Object
|
|||
void ApplyModShortFlag(uint16 index, bool highpart, uint32 flag, bool apply)
|
||||
{
|
||||
if (apply)
|
||||
{ SetShortFlag(index, highpart, flag); }
|
||||
{
|
||||
SetShortFlag(index, highpart, flag);
|
||||
}
|
||||
else
|
||||
{ RemoveShortFlag(index, highpart, flag); }
|
||||
}
|
||||
|
|
@ -379,7 +395,9 @@ class Object
|
|||
void ToggleFlag64(uint16 index, uint64 flag)
|
||||
{
|
||||
if (HasFlag64(index, flag))
|
||||
{ RemoveFlag64(index, flag); }
|
||||
{
|
||||
RemoveFlag64(index, flag);
|
||||
}
|
||||
else
|
||||
{ SetFlag64(index, flag); }
|
||||
}
|
||||
|
|
@ -393,7 +411,9 @@ class Object
|
|||
void ApplyModFlag64(uint16 index, uint64 flag, bool apply)
|
||||
{
|
||||
if (apply)
|
||||
{ SetFlag64(index, flag); }
|
||||
{
|
||||
SetFlag64(index, flag);
|
||||
}
|
||||
else
|
||||
{ RemoveFlag64(index, flag); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,13 +59,19 @@ Unit*
|
|||
ObjectAccessor::GetUnit(WorldObject const& u, ObjectGuid guid)
|
||||
{
|
||||
if (!guid)
|
||||
{ return NULL; }
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (guid.IsPlayer())
|
||||
{ return FindPlayer(guid); }
|
||||
{
|
||||
return FindPlayer(guid);
|
||||
}
|
||||
|
||||
if (!u.IsInWorld())
|
||||
{ return NULL; }
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return u.GetMap()->GetAnyTypeCreature(guid);
|
||||
}
|
||||
|
|
@ -74,9 +80,13 @@ Corpse* ObjectAccessor::GetCorpseInMap(ObjectGuid guid, uint32 mapid)
|
|||
{
|
||||
Corpse* ret = HashMapHolder<Corpse>::Find(guid);
|
||||
if (!ret)
|
||||
{ return NULL; }
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
if (ret->GetMapId() != mapid)
|
||||
{ return NULL; }
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -84,11 +94,15 @@ Corpse* ObjectAccessor::GetCorpseInMap(ObjectGuid guid, uint32 mapid)
|
|||
Player* ObjectAccessor::FindPlayer(ObjectGuid guid, bool inWorld /*= true*/)
|
||||
{
|
||||
if (!guid)
|
||||
{ return NULL; }
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Player* plr = HashMapHolder<Player>::Find(guid);
|
||||
if (!plr || (!plr->IsInWorld() && inWorld))
|
||||
{ return NULL; }
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return plr;
|
||||
}
|
||||
|
|
@ -99,7 +113,9 @@ Player* ObjectAccessor::FindPlayerByName(const char* name)
|
|||
HashMapHolder<Player>::MapType& m = sObjectAccessor.GetPlayers();
|
||||
for (HashMapHolder<Player>::MapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
if (iter->second->IsInWorld() && (::strcmp(name, iter->second->GetName()) == 0))
|
||||
{ return iter->second; }
|
||||
{
|
||||
return iter->second;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -130,7 +146,9 @@ ObjectAccessor::GetCorpseForPlayerGUID(ObjectGuid guid)
|
|||
Player2CorpsesMapType::iterator iter = i_player2corpse.find(guid);
|
||||
|
||||
if (iter == i_player2corpse.end())
|
||||
{ return NULL; }
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MANGOS_ASSERT(iter->second->GetType() != CORPSE_BONES);
|
||||
return iter->second;
|
||||
|
|
@ -145,7 +163,9 @@ ObjectAccessor::RemoveCorpse(Corpse* corpse)
|
|||
|
||||
Player2CorpsesMapType::iterator iter = i_player2corpse.find(corpse->GetOwnerGuid());
|
||||
if (iter == i_player2corpse.end())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// build mapid*cellid -> guid_set map
|
||||
CellPair cell_pair = MaNGOS::ComputeCellPair(corpse->GetPositionX(), corpse->GetPositionY());
|
||||
|
|
@ -218,7 +238,9 @@ ObjectAccessor::ConvertCorpseForPlayer(ObjectGuid player_guid, bool insignia)
|
|||
// do not load the map if it's not loaded
|
||||
Map* map = sMapMgr.FindMap(corpse->GetMapId(), corpse->GetInstanceId());
|
||||
if (map)
|
||||
{ map->Remove(corpse, false); }
|
||||
{
|
||||
map->Remove(corpse, false);
|
||||
}
|
||||
|
||||
// remove corpse from DB
|
||||
corpse->DeleteFromDB();
|
||||
|
|
@ -250,7 +272,9 @@ ObjectAccessor::ConvertCorpseForPlayer(ObjectGuid player_guid, bool insignia)
|
|||
for (int i = 0; i < EQUIPMENT_SLOT_END; ++i)
|
||||
{
|
||||
if (corpse->GetUInt32Value(CORPSE_FIELD_ITEM + i))
|
||||
{ bones->SetUInt32Value(CORPSE_FIELD_ITEM + i, 0); }
|
||||
{
|
||||
bones->SetUInt32Value(CORPSE_FIELD_ITEM + i, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// add bones in grid store if grid loaded where corpse placed
|
||||
|
|
@ -273,7 +297,9 @@ void ObjectAccessor::RemoveOldCorpses()
|
|||
++next;
|
||||
|
||||
if (!itr->second->IsExpired(now))
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ConvertCorpseForPlayer(itr->first);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,12 +60,16 @@ std::string ObjectGuid::GetString() const
|
|||
{
|
||||
std::string name;
|
||||
if (sObjectMgr.GetPlayerNameByGUID(*this, name))
|
||||
{ str << " " << name; }
|
||||
{
|
||||
str << " " << name;
|
||||
}
|
||||
}
|
||||
|
||||
str << " (";
|
||||
if (HasEntry())
|
||||
{ str << (IsPet() ? "Petnumber: " : "Entry: ") << GetEntry() << " "; }
|
||||
{
|
||||
str << (IsPet() ? "Petnumber: " : "Entry: ") << GetEntry() << " ";
|
||||
}
|
||||
str << "Guid: " << GetCounter() << ")";
|
||||
return str.str();
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -649,7 +649,9 @@ class ObjectMgr
|
|||
{
|
||||
QuestAreaTriggerMap::const_iterator itr = mQuestAreaTriggerMap.find(Trigger_ID);
|
||||
if (itr != mQuestAreaTriggerMap.end())
|
||||
{ return itr->second; }
|
||||
{
|
||||
return itr->second;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
bool IsTavernAreaTrigger(uint32 Trigger_ID) const
|
||||
|
|
@ -674,7 +676,9 @@ class ObjectMgr
|
|||
{
|
||||
AreaTriggerMap::const_iterator itr = mAreaTriggers.find(trigger);
|
||||
if (itr != mAreaTriggers.end())
|
||||
{ return &itr->second; }
|
||||
{
|
||||
return &itr->second;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -685,7 +689,9 @@ class ObjectMgr
|
|||
{
|
||||
RepRewardRateMap::const_iterator itr = m_RepRewardRateMap.find(factionId);
|
||||
if (itr != m_RepRewardRateMap.end())
|
||||
{ return &itr->second; }
|
||||
{
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -694,7 +700,9 @@ class ObjectMgr
|
|||
{
|
||||
RepOnKillMap::const_iterator itr = mRepOnKill.find(id);
|
||||
if (itr != mRepOnKill.end())
|
||||
{ return &itr->second; }
|
||||
{
|
||||
return &itr->second;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -702,7 +710,9 @@ class ObjectMgr
|
|||
{
|
||||
RepSpilloverTemplateMap::const_iterator itr = m_RepSpilloverTemplateMap.find(factionId);
|
||||
if (itr != m_RepSpilloverTemplateMap.end())
|
||||
{ return &itr->second; }
|
||||
{
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -711,7 +721,9 @@ class ObjectMgr
|
|||
{
|
||||
PointOfInterestMap::const_iterator itr = mPointsOfInterest.find(id);
|
||||
if (itr != mPointsOfInterest.end())
|
||||
{ return &itr->second; }
|
||||
{
|
||||
return &itr->second;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -735,7 +747,9 @@ class ObjectMgr
|
|||
{
|
||||
DungeonFinderRewardsMap::const_iterator itr = mDungeonFinderRewardsMap.find(level);
|
||||
if (itr != mDungeonFinderRewardsMap.end())
|
||||
{ return &itr->second; }
|
||||
{
|
||||
return &itr->second;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -884,13 +898,17 @@ class ObjectMgr
|
|||
uint32 GenerateStaticCreatureLowGuid()
|
||||
{
|
||||
if (m_StaticCreatureGuids.GetNextAfterMaxUsed() >= m_FirstTemporaryCreatureGuid)
|
||||
{ return 0; }
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return m_StaticCreatureGuids.Generate();
|
||||
}
|
||||
uint32 GenerateStaticGameObjectLowGuid()
|
||||
{
|
||||
if (m_StaticGameObjectGuids.GetNextAfterMaxUsed() >= m_FirstTemporaryGameObjectGuid)
|
||||
{ return 0; }
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return m_StaticGameObjectGuids.Generate();
|
||||
}
|
||||
|
||||
|
|
@ -966,7 +984,9 @@ class ObjectMgr
|
|||
{
|
||||
for (CreatureDataMap::const_iterator itr = mCreatureDataMap.begin(); itr != mCreatureDataMap.end(); ++itr)
|
||||
if (worker(*itr))
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CreatureLocale const* GetCreatureLocale(uint32 entry) const
|
||||
|
|
@ -1059,7 +1079,9 @@ class ObjectMgr
|
|||
{
|
||||
for (GameObjectDataMap::const_iterator itr = mGameObjectDataMap.begin(); itr != mGameObjectDataMap.end(); ++itr)
|
||||
if (worker(*itr)) // arg = GameObjectDataPair
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
MangosStringLocale const* GetMangosStringLocale(int32 entry) const
|
||||
|
|
@ -1072,7 +1094,9 @@ class ObjectMgr
|
|||
{
|
||||
std::map<int32, uint32>::const_iterator itr = m_loadedStringCount.find(minEntry);
|
||||
if (itr != m_loadedStringCount.end())
|
||||
{ return itr->second; }
|
||||
{
|
||||
return itr->second;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1134,7 +1158,9 @@ class ObjectMgr
|
|||
{
|
||||
CacheNpcTextIdMap::const_iterator iter = m_mCacheNpcTextIdMap.find(entry);
|
||||
if (iter == m_mCacheNpcTextIdMap.end())
|
||||
{ return 0; }
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return iter->second;
|
||||
}
|
||||
|
|
@ -1143,7 +1169,9 @@ class ObjectMgr
|
|||
{
|
||||
CacheTrainerSpellMap::const_iterator iter = m_mCacheTrainerSpellMap.find(entry);
|
||||
if (iter == m_mCacheTrainerSpellMap.end())
|
||||
{ return NULL; }
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &iter->second;
|
||||
}
|
||||
|
|
@ -1152,7 +1180,9 @@ class ObjectMgr
|
|||
{
|
||||
CacheTrainerSpellMap::const_iterator iter = m_mCacheTrainerTemplateSpellMap.find(entry);
|
||||
if (iter == m_mCacheTrainerTemplateSpellMap.end())
|
||||
{ return NULL; }
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &iter->second;
|
||||
}
|
||||
|
|
@ -1161,7 +1191,9 @@ class ObjectMgr
|
|||
{
|
||||
CacheVendorItemMap::const_iterator iter = m_mCacheVendorItemMap.find(entry);
|
||||
if (iter == m_mCacheVendorItemMap.end())
|
||||
{ return NULL; }
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &iter->second;
|
||||
}
|
||||
|
|
@ -1170,7 +1202,9 @@ class ObjectMgr
|
|||
{
|
||||
CacheVendorItemMap::const_iterator iter = m_mCacheVendorTemplateItemMap.find(entry);
|
||||
if (iter == m_mCacheVendorTemplateItemMap.end())
|
||||
{ return NULL; }
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &iter->second;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,11 +33,15 @@ ObjectPosSelector::ObjectPosSelector(float x, float y, float dist, float searche
|
|||
{
|
||||
// if size == 0, m_anglestep will become 0 -> freeze
|
||||
if (searchedForSize == 0.0f)
|
||||
{ searchedForSize = DEFAULT_WORLD_OBJECT_SIZE; }
|
||||
{
|
||||
searchedForSize = DEFAULT_WORLD_OBJECT_SIZE;
|
||||
}
|
||||
|
||||
// undefined behaviour
|
||||
if (m_searcherDist == 0.0f)
|
||||
{ m_searcherDist = DEFAULT_WORLD_OBJECT_SIZE; }
|
||||
{
|
||||
m_searcherDist = DEFAULT_WORLD_OBJECT_SIZE;
|
||||
}
|
||||
|
||||
m_searchedForReqHAngle = atan(OCCUPY_POS_ANGLE_ATAN_FACTOR * searchedForSize / m_searcherDist);
|
||||
|
||||
|
|
@ -64,13 +68,17 @@ void ObjectPosSelector::AddUsedArea(WorldObject const* obj, float angle, float d
|
|||
|
||||
// skip some unexpected results.
|
||||
if (dist == 0.0f)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// (half) angle that obj occupies
|
||||
float sr_angle = atan(OCCUPY_POS_ANGLE_ATAN_FACTOR * obj->GetObjectBoundingRadius() / dist);
|
||||
|
||||
if (angle >= 0)
|
||||
{ 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
|
||||
{ m_UsedAreaLists[USED_POS_MINUS].insert(UsedArea(-angle, OccupiedArea(sr_angle, obj))); }
|
||||
}
|
||||
|
|
@ -149,13 +157,17 @@ bool ObjectPosSelector::NextAngle(float& angle)
|
|||
if (m_stepAngle[USED_POS_PLUS] < M_PI_F && m_stepAngle[USED_POS_PLUS] <= m_stepAngle[USED_POS_MINUS])
|
||||
{
|
||||
if (NextSideAngle(USED_POS_PLUS, angle))
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// -- direction less updated
|
||||
else if (m_stepAngle[USED_POS_MINUS] < M_PI_F)
|
||||
{
|
||||
if (NextSideAngle(USED_POS_MINUS, angle))
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// both sides finishes
|
||||
else
|
||||
|
|
@ -182,7 +194,9 @@ bool ObjectPosSelector::NextSideAngle(UsedAreaSide side, float& angle)
|
|||
|
||||
// prevent jump to another side
|
||||
if (m_stepAngle[side] > M_PI_F)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// no used area anymore on this side
|
||||
if (m_nextUsedAreaItr[side] == m_UsedAreaLists[side].end())
|
||||
|
|
|
|||
|
|
@ -51,7 +51,9 @@ Pet::Pet(PetType type) :
|
|||
CharmInfo* charmInfo = InitCharmInfo(this);
|
||||
|
||||
if (type == MINI_PET) // always passive
|
||||
{ charmInfo->SetReactState(REACT_PASSIVE); }
|
||||
{
|
||||
charmInfo->SetReactState(REACT_PASSIVE);
|
||||
}
|
||||
}
|
||||
|
||||
Pet::~Pet()
|
||||
|
|
@ -63,7 +65,9 @@ void Pet::AddToWorld()
|
|||
{
|
||||
///- Register the pet for guid lookup
|
||||
if (!IsInWorld())
|
||||
{ GetMap()->GetObjectsStore().insert<Pet>(GetObjectGuid(), (Pet*)this); }
|
||||
{
|
||||
GetMap()->GetObjectsStore().insert<Pet>(GetObjectGuid(), (Pet*)this);
|
||||
}
|
||||
|
||||
Unit::AddToWorld();
|
||||
}
|
||||
|
|
@ -72,7 +76,9 @@ void Pet::RemoveFromWorld()
|
|||
{
|
||||
///- Remove the pet from the accessor
|
||||
if (IsInWorld())
|
||||
{ GetMap()->GetObjectsStore().erase<Pet>(GetObjectGuid(), (Pet*)NULL); }
|
||||
{
|
||||
GetMap()->GetObjectsStore().erase<Pet>(GetObjectGuid(), (Pet*)NULL);
|
||||
}
|
||||
|
||||
///- Don't call the function for Creature, normal mobs + totems go in a different storage
|
||||
Unit::RemoveFromWorld();
|
||||
|
|
@ -200,7 +206,9 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
|||
sLog.outError("Pet have incorrect type (%u) for pet loading.", getPetType());
|
||||
|
||||
if (owner->IsPvP())
|
||||
{ SetPvP(true); }
|
||||
{
|
||||
SetPvP(true);
|
||||
}
|
||||
|
||||
if (owner->IsFFAPvP())
|
||||
SetFFAPvP(true);
|
||||
|
|
@ -292,7 +300,9 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
|||
{
|
||||
((Player*)owner)->PetSpellInitialize();
|
||||
if (((Player*)owner)->GetGroup())
|
||||
{ ((Player*)owner)->SetGroupUpdateFlag(GROUP_UPDATE_PET); }
|
||||
{
|
||||
((Player*)owner)->SetGroupUpdateFlag(GROUP_UPDATE_PET);
|
||||
}
|
||||
|
||||
((Player*)owner)->SendTalentsInfoData(true);
|
||||
}
|
||||
|
|
@ -323,19 +333,27 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
|||
void Pet::SavePetToDB(PetSaveMode mode)
|
||||
{
|
||||
if (!GetEntry())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// save only fully controlled creature
|
||||
if (!isControlled())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// not save not player pets
|
||||
if (!GetOwnerGuid().IsPlayer())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player* pOwner = (Player*)GetOwner();
|
||||
if (!pOwner)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// current/stable/not_in_slot
|
||||
if (mode >= PET_SAVE_AS_CURRENT)
|
||||
|
|
@ -355,7 +373,9 @@ void Pet::SavePetToDB(PetSaveMode mode)
|
|||
{
|
||||
// pet will lost anyway at restore temporary unsummoned
|
||||
if (getPetType() == HUNTER_PET)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// for warlock case
|
||||
mode = PET_SAVE_NOT_IN_SLOT;
|
||||
|
|
@ -366,7 +386,9 @@ void Pet::SavePetToDB(PetSaveMode mode)
|
|||
|
||||
// stable and not in slot saves
|
||||
if (mode != PET_SAVE_AS_CURRENT)
|
||||
{ RemoveAllAuras(); }
|
||||
{
|
||||
RemoveAllAuras();
|
||||
}
|
||||
|
||||
// save pet's data as one single transaction
|
||||
CharacterDatabase.BeginTransaction();
|
||||
|
|
@ -445,7 +467,9 @@ void Pet::SavePetToDB(PetSaveMode mode)
|
|||
void Pet::DeleteFromDB(uint32 guidlow, bool separate_transaction)
|
||||
{
|
||||
if (separate_transaction)
|
||||
{ CharacterDatabase.BeginTransaction(); }
|
||||
{
|
||||
CharacterDatabase.BeginTransaction();
|
||||
}
|
||||
|
||||
static SqlStatementID delPet ;
|
||||
static SqlStatementID delDeclName ;
|
||||
|
|
@ -469,7 +493,9 @@ void Pet::DeleteFromDB(uint32 guidlow, bool separate_transaction)
|
|||
stmt.PExecute(guidlow);
|
||||
|
||||
if (separate_transaction)
|
||||
{ CharacterDatabase.CommitTransaction(); }
|
||||
{
|
||||
CharacterDatabase.CommitTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
void Pet::SetDeathState(DeathState s) // overwrite virtual Creature::SetDeathState and Unit::SetDeathState
|
||||
|
|
@ -479,7 +505,9 @@ void Pet::SetDeathState(DeathState s) // overwrite virtual
|
|||
{
|
||||
// remove summoned pet (no corpse)
|
||||
if (getPetType() == SUMMON_PET)
|
||||
{ Unsummon(PET_SAVE_NOT_IN_SLOT); }
|
||||
{
|
||||
Unsummon(PET_SAVE_NOT_IN_SLOT);
|
||||
}
|
||||
// other will despawn at corpse desppawning (Pet::Update code)
|
||||
else
|
||||
{
|
||||
|
|
@ -500,7 +528,9 @@ void Pet::SetDeathState(DeathState s) // overwrite virtual
|
|||
void Pet::Update(uint32 update_diff, uint32 diff)
|
||||
{
|
||||
if (m_removed) // pet already removed, just wait in remove queue, no updates
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (m_deathState)
|
||||
{
|
||||
|
|
@ -538,7 +568,9 @@ void Pet::Update(uint32 update_diff, uint32 diff)
|
|||
if (m_duration > 0)
|
||||
{
|
||||
if (m_duration > (int32)update_diff)
|
||||
{ m_duration -= (int32)update_diff; }
|
||||
{
|
||||
m_duration -= (int32)update_diff;
|
||||
}
|
||||
else
|
||||
{
|
||||
Unsummon(getPetType() != SUMMON_PET ? PET_SAVE_AS_DELETED : PET_SAVE_NOT_IN_SLOT, owner);
|
||||
|
|
@ -560,7 +592,9 @@ void Pet::RegenerateAll(uint32 update_diff)
|
|||
if (m_regenTimer <= update_diff)
|
||||
{
|
||||
if (!IsInCombat() || IsPolymorphed())
|
||||
{ RegenerateHealth(); }
|
||||
{
|
||||
RegenerateHealth();
|
||||
}
|
||||
|
||||
RegeneratePower();
|
||||
|
||||
|
|
@ -576,17 +610,23 @@ bool Pet::CanTakeMoreActiveSpells(uint32 spellid)
|
|||
uint32 chainstartstore[ACTIVE_SPELLS_MAX];
|
||||
|
||||
if (IsPassiveSpell(spellid))
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
chainstartstore[0] = sSpellMgr.GetFirstSpellInChain(spellid);
|
||||
|
||||
for (PetSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
|
||||
{
|
||||
if (itr->second.state == PETSPELL_REMOVED)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (IsPassiveSpell(itr->first))
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32 chainstart = sSpellMgr.GetFirstSpellInChain(itr->first);
|
||||
|
||||
|
|
@ -595,14 +635,18 @@ bool Pet::CanTakeMoreActiveSpells(uint32 spellid)
|
|||
for (x = 0; x < activecount; ++x)
|
||||
{
|
||||
if (chainstart == chainstartstore[x])
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (x == activecount) // spellchain not yet saved -> add active count
|
||||
{
|
||||
++activecount;
|
||||
if (activecount > ACTIVE_SPELLS_MAX)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
chainstartstore[x] = chainstart;
|
||||
}
|
||||
}
|
||||
|
|
@ -612,14 +656,18 @@ bool Pet::CanTakeMoreActiveSpells(uint32 spellid)
|
|||
void Pet::Unsummon(PetSaveMode mode, Unit* owner /*= NULL*/)
|
||||
{
|
||||
if (!owner)
|
||||
{ owner = GetOwner(); }
|
||||
{
|
||||
owner = GetOwner();
|
||||
}
|
||||
|
||||
CombatStop();
|
||||
|
||||
if (owner)
|
||||
{
|
||||
if (GetOwnerGuid() != owner->GetObjectGuid())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player* p_owner = owner->GetTypeId() == TYPEID_PLAYER ? (Player*)owner : NULL;
|
||||
|
||||
|
|
@ -661,7 +709,9 @@ void Pet::Unsummon(PetSaveMode mode, Unit* owner /*= NULL*/)
|
|||
p_owner->RemovePetActionBar();
|
||||
|
||||
if (p_owner->GetGroup())
|
||||
{ p_owner->SetGroupUpdateFlag(GROUP_UPDATE_PET); }
|
||||
{
|
||||
p_owner->SetGroupUpdateFlag(GROUP_UPDATE_PET);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -678,7 +728,9 @@ void Pet::Unsummon(PetSaveMode mode, Unit* owner /*= NULL*/)
|
|||
break;
|
||||
default:
|
||||
if (owner->GetPetGuid() == GetObjectGuid())
|
||||
{ owner->SetPet(NULL); }
|
||||
{
|
||||
owner->SetPet(NULL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -691,20 +743,28 @@ void Pet::Unsummon(PetSaveMode mode, Unit* owner /*= NULL*/)
|
|||
void Pet::GivePetXP(uint32 xp)
|
||||
{
|
||||
if (getPetType() != HUNTER_PET)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (xp < 1)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsAlive())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 level = getLevel();
|
||||
uint32 maxlevel = std::min(sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL), GetOwner()->getLevel());
|
||||
|
||||
// pet not receive xp for level equal to owner level
|
||||
if (level >= maxlevel)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
xp *= sWorld.getConfig(CONFIG_FLOAT_RATE_PET_XP_KILL);
|
||||
|
||||
|
|
@ -728,7 +788,9 @@ void Pet::GivePetXP(uint32 xp)
|
|||
void Pet::GivePetLevel(uint32 level)
|
||||
{
|
||||
if (!level || level == getLevel())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (getPetType() == HUNTER_PET)
|
||||
{
|
||||
|
|
@ -756,7 +818,9 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
|
|||
BASIC_LOG("Create pet");
|
||||
uint32 pet_number = sObjectMgr.GeneratePetNumber();
|
||||
if (!Create(guid, pos, creature->GetCreatureInfo(), pet_number))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
CreatureInfo const* cInfo = GetCreatureInfo();
|
||||
if (!cInfo)
|
||||
|
|
@ -774,7 +838,9 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
|
|||
SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
|
||||
|
||||
if (CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cInfo->Family))
|
||||
{ SetName(cFamily->Name[sWorld.GetDefaultDbcLocale()]); }
|
||||
{
|
||||
SetName(cFamily->Name[sWorld.GetDefaultDbcLocale()]);
|
||||
}
|
||||
else
|
||||
{ SetName(creature->GetNameForLocaleIdx(sObjectMgr.GetDBCLocaleIndex())); }
|
||||
|
||||
|
|
@ -918,7 +984,9 @@ void Pet::InitStatsForLevel(uint32 petlevel)
|
|||
// 40% damage bonus of mage's frost damage
|
||||
float val = owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FROST) * 0.4f;
|
||||
if (val < 0)
|
||||
{ val = 0; }
|
||||
{
|
||||
val = 0;
|
||||
}
|
||||
SetBonusDamage(int32(val));
|
||||
break;
|
||||
}
|
||||
|
|
@ -1097,15 +1165,21 @@ void Pet::InitStatsForLevel(uint32 petlevel)
|
|||
bool Pet::HaveInDiet(ItemPrototype const* item) const
|
||||
{
|
||||
if (!item->FoodType)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
CreatureInfo const* cInfo = GetCreatureInfo();
|
||||
if (!cInfo)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cInfo->Family);
|
||||
if (!cFamily)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 diet = cFamily->petFoodMask;
|
||||
uint32 FoodMask = 1 << (item->FoodType - 1);
|
||||
|
|
@ -1116,7 +1190,9 @@ uint32 Pet::GetCurrentFoodBenefitLevel(uint32 itemlevel)
|
|||
{
|
||||
// -5 or greater food level
|
||||
if (getLevel() <= itemlevel + 5) // possible to feed level 60 pet with level 55 level food for full effect
|
||||
{ return 35000; }
|
||||
{
|
||||
return 35000;
|
||||
}
|
||||
// -10..-6
|
||||
else if (getLevel() <= itemlevel + 10) // pure guess, but sounds good
|
||||
{ return 17000; }
|
||||
|
|
@ -1158,7 +1234,9 @@ void Pet::_LoadSpellCooldowns()
|
|||
|
||||
// skip outdated cooldown
|
||||
if (db_time <= curTime)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
data << uint32(spell_id);
|
||||
data << uint32(uint32(db_time - curTime)*IN_MILLISECONDS);
|
||||
|
|
@ -1192,7 +1270,9 @@ void Pet::_SaveSpellCooldowns()
|
|||
for (CreatureSpellCooldowns::iterator itr = m_CreatureSpellCooldowns.begin(); itr != m_CreatureSpellCooldowns.end();)
|
||||
{
|
||||
if (itr->second <= curTime)
|
||||
{ m_CreatureSpellCooldowns.erase(itr++); }
|
||||
{
|
||||
m_CreatureSpellCooldowns.erase(itr++);
|
||||
}
|
||||
else
|
||||
{
|
||||
stmt = CharacterDatabase.CreateStatement(insSpellCD, "INSERT INTO pet_spell_cooldown (guid,spell,time) VALUES (?, ?, ?)");
|
||||
|
|
@ -1231,7 +1311,9 @@ void Pet::_SaveSpells()
|
|||
|
||||
// prevent saving family passives to DB
|
||||
if (itr->second.type == PETSPELL_FAMILY)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (itr->second.state)
|
||||
{
|
||||
|
|
@ -1303,12 +1385,16 @@ void Pet::_LoadAuras(uint32 timediff)
|
|||
|
||||
// do not load single target auras (unless they were cast by the player)
|
||||
if (casterGuid != GetObjectGuid() && IsSingleTargetSpell(spellproto))
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (remaintime != -1 && !IsPositiveSpell(spellproto))
|
||||
{
|
||||
if (remaintime / IN_MILLISECONDS <= int32(timediff))
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
remaintime -= timediff * IN_MILLISECONDS;
|
||||
}
|
||||
|
|
@ -1325,7 +1411,9 @@ void Pet::_LoadAuras(uint32 timediff)
|
|||
|
||||
uint32 defstackamount = spellproto->GetStackAmount();
|
||||
if (!defstackamount)
|
||||
{ stackcount = 1; }
|
||||
{
|
||||
stackcount = 1;
|
||||
}
|
||||
else if (defstackamount < stackcount)
|
||||
stackcount = defstackamount;
|
||||
else if (!stackcount)
|
||||
|
|
@ -1337,18 +1425,24 @@ void Pet::_LoadAuras(uint32 timediff)
|
|||
for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)
|
||||
{
|
||||
if ((effIndexMask & (1 << i)) == 0)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Aura* aura = CreateAura(spellproto, SpellEffectIndex(i), NULL, holder, this);
|
||||
if (!damage[i])
|
||||
{ damage[i] = aura->GetModifier()->m_amount; }
|
||||
{
|
||||
damage[i] = aura->GetModifier()->m_amount;
|
||||
}
|
||||
|
||||
aura->SetLoadedState(damage[i], periodicTime[i]);
|
||||
holder->AddAura(aura, SpellEffectIndex(i));
|
||||
}
|
||||
|
||||
if (!holder->IsEmptyHolder())
|
||||
{ AddSpellAuraHolder(holder); }
|
||||
{
|
||||
AddSpellAuraHolder(holder);
|
||||
}
|
||||
else
|
||||
{ delete holder; }
|
||||
}
|
||||
|
|
@ -1369,7 +1463,9 @@ void Pet::_SaveAuras()
|
|||
SpellAuraHolderMap const& auraHolders = GetSpellAuraHolderMap();
|
||||
|
||||
if (auraHolders.empty())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
stmt = CharacterDatabase.CreateStatement(insAuras, "INSERT INTO pet_aura (guid, caster_guid, item_guid, spell, stackcount, remaincharges, "
|
||||
"basepoints0, basepoints1, basepoints2, periodictime0, periodictime1, periodictime2, maxduration, remaintime, effIndexMask) "
|
||||
|
|
@ -1413,7 +1509,9 @@ void Pet::_SaveAuras()
|
|||
{
|
||||
// don't save not own area auras
|
||||
if (aur->IsAreaAura() && holder->GetCasterGuid() != GetObjectGuid())
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
damage[i] = aur->GetModifier()->m_amount;
|
||||
periodicTime[i] = aur->GetModifier()->periodictime;
|
||||
|
|
@ -1422,7 +1520,9 @@ void Pet::_SaveAuras()
|
|||
}
|
||||
|
||||
if (!effIndexMask)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
stmt.addUInt32(m_charmInfo->GetPetNumber());
|
||||
stmt.addUInt64(holder->GetCasterGuid().GetRawValue());
|
||||
|
|
@ -1476,7 +1576,9 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
|
|||
itr->second.state = PETSPELL_UNCHANGED;
|
||||
|
||||
if (active == ACT_ENABLED)
|
||||
{ ToggleAutocast(spell_id, true); }
|
||||
{
|
||||
ToggleAutocast(spell_id, true);
|
||||
}
|
||||
else if (active == ACT_DISABLED)
|
||||
{ ToggleAutocast(spell_id, false); }
|
||||
|
||||
|
|
@ -1495,7 +1597,9 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
|
|||
if (active == ACT_DECIDE) // active was not used before, so we save it's autocast/passive state here
|
||||
{
|
||||
if (IsPassiveSpell(spellInfo))
|
||||
{ newspell.active = ACT_PASSIVE; }
|
||||
{
|
||||
newspell.active = ACT_PASSIVE;
|
||||
}
|
||||
else
|
||||
{ newspell.active = ACT_DISABLED; }
|
||||
}
|
||||
|
|
@ -1551,12 +1655,16 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
|
|||
m_spells[spell_id] = newspell;
|
||||
|
||||
if (IsPassiveSpell(spellInfo))
|
||||
{ CastSpell(this, spell_id, true); }
|
||||
{
|
||||
CastSpell(this, spell_id, true);
|
||||
}
|
||||
else
|
||||
{ m_charmInfo->AddSpellToActionBar(spell_id, ActiveStates(newspell.active)); }
|
||||
|
||||
if (newspell.active == ACT_ENABLED)
|
||||
{ ToggleAutocast(spell_id, true); }
|
||||
{
|
||||
ToggleAutocast(spell_id, true);
|
||||
}
|
||||
|
||||
uint32 talentCost = GetTalentSpellCost(spell_id);
|
||||
if (talentCost)
|
||||
|
|
@ -1571,7 +1679,9 @@ bool Pet::learnSpell(uint32 spell_id)
|
|||
{
|
||||
// prevent duplicated entires in spell book
|
||||
if (!addSpell(spell_id))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_loading)
|
||||
{
|
||||
|
|
@ -1652,13 +1762,19 @@ bool Pet::removeSpell(uint32 spell_id, bool learn_prev, bool clear_ab)
|
|||
{
|
||||
PetSpellMap::iterator itr = m_spells.find(spell_id);
|
||||
if (itr == m_spells.end())
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (itr->second.state == PETSPELL_REMOVED)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (itr->second.state == PETSPELL_NEW)
|
||||
{ m_spells.erase(itr); }
|
||||
{
|
||||
m_spells.erase(itr);
|
||||
}
|
||||
else
|
||||
{ itr->second.state = PETSPELL_REMOVED; }
|
||||
|
||||
|
|
@ -1678,7 +1794,9 @@ bool Pet::removeSpell(uint32 spell_id, bool learn_prev, bool clear_ab)
|
|||
if (learn_prev)
|
||||
{
|
||||
if (uint32 prev_id = sSpellMgr.GetPrevSpellInChain(spell_id))
|
||||
{ learnSpell(prev_id); }
|
||||
{
|
||||
learnSpell(prev_id);
|
||||
}
|
||||
else
|
||||
{ learn_prev = false; }
|
||||
}
|
||||
|
|
@ -1691,7 +1809,9 @@ bool Pet::removeSpell(uint32 spell_id, bool learn_prev, bool clear_ab)
|
|||
// need update action bar for last removed rank
|
||||
if (Unit* owner = GetOwner())
|
||||
if (owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{ ((Player*)owner)->PetSpellInitialize(); }
|
||||
{
|
||||
((Player*)owner)->PetSpellInitialize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1704,7 +1824,9 @@ void Pet::CleanupActionBar()
|
|||
if (UnitActionBarEntry const* ab = m_charmInfo->GetActionBarEntry(i))
|
||||
if (uint32 action = ab->GetAction())
|
||||
if (ab->IsActionBarForSpell() && !HasSpell(action))
|
||||
{ m_charmInfo->SetActionBar(i, 0, ACT_DISABLED); }
|
||||
{
|
||||
m_charmInfo->SetActionBar(i, 0, ACT_DISABLED);
|
||||
}
|
||||
}
|
||||
|
||||
void Pet::InitPetCreateSpells()
|
||||
|
|
@ -1914,7 +2036,9 @@ uint32 Pet::resetTalentsCost() const
|
|||
|
||||
// The first time reset costs 10 silver; after 1 day cost is reset to 10 silver
|
||||
if (m_resetTalentsCost < 10 * SILVER || days > 0)
|
||||
{ return 10 * SILVER; }
|
||||
{
|
||||
return 10 * SILVER;
|
||||
}
|
||||
// then 50 silver
|
||||
else if (m_resetTalentsCost < 50 * SILVER)
|
||||
{ return 50 * SILVER; }
|
||||
|
|
@ -1938,7 +2062,9 @@ uint8 Pet::GetMaxTalentPointsForLevel(uint32 level)
|
|||
void Pet::ToggleAutocast(uint32 spellid, bool apply)
|
||||
{
|
||||
if (IsPassiveSpell(spellid))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PetSpellMap::iterator itr = m_spells.find(spellid);
|
||||
PetSpell &petSpell = itr->second;
|
||||
|
|
@ -1958,7 +2084,9 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply)
|
|||
{
|
||||
petSpell.active = ACT_ENABLED;
|
||||
if (petSpell.state != PETSPELL_NEW)
|
||||
{ petSpell.state = PETSPELL_CHANGED; }
|
||||
{
|
||||
petSpell.state = PETSPELL_CHANGED;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1975,7 +2103,9 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply)
|
|||
{
|
||||
petSpell.active = ACT_DISABLED;
|
||||
if (petSpell.state != PETSPELL_NEW)
|
||||
{ petSpell.state = PETSPELL_CHANGED; }
|
||||
{
|
||||
petSpell.state = PETSPELL_CHANGED;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1991,17 +2121,23 @@ bool Pet::Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo const* ci
|
|||
m_originalEntry = cinfo->Entry;
|
||||
|
||||
if (!InitEntry(cinfo->Entry))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
cPos.SelectFinalPoint(this);
|
||||
|
||||
if (!cPos.Relocate(this))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
SetSheath(SHEATH_STATE_MELEE);
|
||||
|
||||
if (getPetType() == MINI_PET) // always non-attackable
|
||||
{ SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); }
|
||||
{
|
||||
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2017,11 +2153,15 @@ void Pet::LearnPetPassives()
|
|||
{
|
||||
CreatureInfo const* cInfo = GetCreatureInfo();
|
||||
if (!cInfo)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cInfo->Family);
|
||||
if (!cFamily)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PetFamilySpellsStore::const_iterator petStore = sPetFamilySpellsStore.find(cFamily->ID);
|
||||
if (petStore != sPetFamilySpellsStore.end())
|
||||
|
|
@ -2044,7 +2184,9 @@ void Pet::CastPetAuras(bool current)
|
|||
++itr;
|
||||
|
||||
if (!current && pa->IsRemovedOnChangePet())
|
||||
{ owner->RemovePetAura(pa); }
|
||||
{
|
||||
owner->RemovePetAura(pa);
|
||||
}
|
||||
else
|
||||
{ CastPetAura(pa); }
|
||||
}
|
||||
|
|
@ -2092,7 +2234,9 @@ void Pet::CastPetAura(PetAura const* aura)
|
|||
{
|
||||
uint32 auraId = aura->GetAura(GetEntry());
|
||||
if (!auraId)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (auraId == 35696) // Demonic Knowledge
|
||||
{
|
||||
|
|
@ -2122,7 +2266,9 @@ void Pet::SynchronizeLevelWithOwner()
|
|||
{
|
||||
Unit* owner = GetOwner();
|
||||
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (getPetType())
|
||||
{
|
||||
|
|
@ -2133,7 +2279,9 @@ void Pet::SynchronizeLevelWithOwner()
|
|||
// can't be greater owner level
|
||||
case HUNTER_PET:
|
||||
if (getLevel() > owner->getLevel())
|
||||
{ GivePetLevel(owner->getLevel()); }
|
||||
{
|
||||
GivePetLevel(owner->getLevel());
|
||||
}
|
||||
else if (getLevel() + 5 < owner->getLevel())
|
||||
GivePetLevel(owner->getLevel() - 5);
|
||||
break;
|
||||
|
|
@ -2148,7 +2296,9 @@ void Pet::SetModeFlags(PetModeFlags mode)
|
|||
|
||||
Unit* owner = GetOwner();
|
||||
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
WorldPacket data(SMSG_PET_MODE, 12);
|
||||
data << GetObjectGuid();
|
||||
|
|
|
|||
|
|
@ -37,7 +37,9 @@
|
|||
int PetAI::Permissible(const Creature* creature)
|
||||
{
|
||||
if (creature->IsPet())
|
||||
{ return PERMIT_BASE_SPECIAL; }
|
||||
{
|
||||
return PERMIT_BASE_SPECIAL;
|
||||
}
|
||||
|
||||
return PERMIT_BASE_NO;
|
||||
}
|
||||
|
|
@ -75,7 +77,9 @@ void PetAI::MoveInLineOfSight(Unit* pWho)
|
|||
void PetAI::AttackStart(Unit* u)
|
||||
{
|
||||
if (!u || (m_creature->IsPet() && ((Pet*)m_creature)->getPetType() == MINI_PET))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_creature->Attack(u, true))
|
||||
{
|
||||
|
|
@ -103,7 +107,9 @@ bool PetAI::_needToStop() const
|
|||
{
|
||||
// This is needed for charmed creatures, as once their target was reset other effects can trigger threat
|
||||
if (m_creature->IsCharmed() && m_creature->getVictim() == m_creature->GetCharmer())
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return !m_creature->getVictim()->IsTargetableForAttack();
|
||||
}
|
||||
|
|
@ -129,7 +135,9 @@ void PetAI::_stopAttack()
|
|||
void PetAI::UpdateAI(const uint32 diff)
|
||||
{
|
||||
if (!m_creature->IsAlive())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Unit* owner = m_creature->GetCharmerOrOwner();
|
||||
Unit* victim = NULL;
|
||||
|
|
@ -218,21 +226,29 @@ void PetAI::UpdateAI(const uint32 diff)
|
|||
{
|
||||
uint32 spellID = m_creature->GetPetAutoSpellOnPos(i);
|
||||
if (!spellID)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellID);
|
||||
if (!spellInfo)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (m_creature->GetCharmInfo() && m_creature->GetCharmInfo()->GetGlobalCooldownMgr().HasGlobalCooldown(spellInfo))
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// ignore some combinations of combat state and combat/noncombat spells
|
||||
if (!inCombat)
|
||||
{
|
||||
// ignore attacking spells, and allow only self/around spells
|
||||
if (!IsPositiveSpell(spellInfo->Id))
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// non combat spells allowed
|
||||
// only pet spells have IsNonCombatSpell and not fit this reqs:
|
||||
|
|
@ -242,14 +258,18 @@ void PetAI::UpdateAI(const uint32 diff)
|
|||
int32 duration = GetSpellDuration(spellInfo);
|
||||
SpellPowerEntry const* spellPower = spellInfo->GetSpellPower();
|
||||
if (spellPower && (spellPower->manaCost || spellPower->ManaCostPercentage || spellPower->manaPerSecond) && duration > 0)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// allow only spell without cooldown > duration
|
||||
int32 cooldown = GetSpellRecoveryTime(spellInfo);
|
||||
|
||||
// allow only spell not on cooldown
|
||||
if (cooldown != 0 && duration < cooldown)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
// just ignore non-combat spells
|
||||
|
|
@ -272,7 +292,9 @@ void PetAI::UpdateAI(const uint32 diff)
|
|||
|
||||
// only buff targets that are in combat, unless the spell can only be cast while out of combat
|
||||
if (!Target)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (spell->CanAutoCast(Target))
|
||||
{
|
||||
|
|
@ -282,7 +304,9 @@ void PetAI::UpdateAI(const uint32 diff)
|
|||
}
|
||||
}
|
||||
if (!spellUsed)
|
||||
{ delete spell; }
|
||||
{
|
||||
delete spell;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -303,10 +327,14 @@ void PetAI::UpdateAI(const uint32 diff)
|
|||
{
|
||||
m_creature->SetInFront(target);
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
{ m_creature->SendCreateUpdateToPlayer((Player*)target); }
|
||||
{
|
||||
m_creature->SendCreateUpdateToPlayer((Player*)target);
|
||||
}
|
||||
|
||||
if (owner && owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{ m_creature->SendCreateUpdateToPlayer((Player*)owner); }
|
||||
{
|
||||
m_creature->SendCreateUpdateToPlayer((Player*)owner);
|
||||
}
|
||||
}
|
||||
|
||||
m_creature->AddCreatureSpellCooldown(spell->m_spellInfo->Id);
|
||||
|
|
@ -433,16 +461,22 @@ void PetAI::UpdateAllies()
|
|||
m_updateAlliesTimer = 10 * IN_MILLISECONDS; // update friendly targets every 10 seconds, lesser checks increase performance
|
||||
|
||||
if (!owner)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{ pGroup = ((Player*)owner)->GetGroup(); }
|
||||
|
||||
// only pet and owner/not in group->ok
|
||||
if (m_AllySet.size() == 2 && !pGroup)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
// owner is in group; group members filled in already (no raid -> subgroupcount = whole count)
|
||||
if (pGroup && !pGroup->isRaidGroup() && m_AllySet.size() == (pGroup->GetMembersCount() + 2))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_AllySet.clear();
|
||||
m_AllySet.insert(m_creature->GetObjectGuid());
|
||||
|
|
@ -452,10 +486,14 @@ void PetAI::UpdateAllies()
|
|||
{
|
||||
Player* target = itr->getSource();
|
||||
if (!target || !pGroup->SameSubGroup((Player*)owner, target))
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (target->GetObjectGuid() == owner->GetObjectGuid())
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
m_AllySet.insert(target->GetObjectGuid());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -224,11 +224,15 @@ bool PlayerTaxi::LoadTaxiDestinationsFromString(const std::string& values, Team
|
|||
}
|
||||
|
||||
if (m_TaxiDestinations.empty())
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check integrity
|
||||
if (m_TaxiDestinations.size() < 2)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (size_t i = 1; i < m_TaxiDestinations.size(); ++i)
|
||||
{
|
||||
|
|
@ -236,12 +240,16 @@ bool PlayerTaxi::LoadTaxiDestinationsFromString(const std::string& values, Team
|
|||
uint32 path;
|
||||
sObjectMgr.GetTaxiPath(m_TaxiDestinations[i - 1], m_TaxiDestinations[i], path, cost);
|
||||
if (!path)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// can't load taxi path without mount set (quest taxi path?)
|
||||
if (!sObjectMgr.GetTaxiMountDisplayId(GetTaxiSource(), team, true))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -249,7 +257,9 @@ bool PlayerTaxi::LoadTaxiDestinationsFromString(const std::string& values, Team
|
|||
std::string PlayerTaxi::SaveTaxiDestinationsToString()
|
||||
{
|
||||
if (m_TaxiDestinations.empty())
|
||||
{ return ""; }
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
std::ostringstream ss;
|
||||
|
||||
|
|
@ -262,7 +272,9 @@ std::string PlayerTaxi::SaveTaxiDestinationsToString()
|
|||
uint32 PlayerTaxi::GetCurrentTaxiPath() const
|
||||
{
|
||||
if (m_TaxiDestinations.size() < 2)
|
||||
{ return 0; }
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32 path;
|
||||
uint32 cost;
|
||||
|
|
@ -294,7 +306,9 @@ bool TradeData::HasItem(ObjectGuid item_guid) const
|
|||
{
|
||||
for (int i = 0; i < TRADE_SLOT_COUNT; ++i)
|
||||
if (m_items[i] == item_guid)
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -309,7 +323,9 @@ void TradeData::SetItem(TradeSlots slot, Item* item)
|
|||
ObjectGuid itemGuid = item ? item->GetObjectGuid() : ObjectGuid();
|
||||
|
||||
if (m_items[slot] == itemGuid)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_items[slot] = itemGuid;
|
||||
|
||||
|
|
@ -320,7 +336,9 @@ void TradeData::SetItem(TradeSlots slot, Item* item)
|
|||
|
||||
// need remove possible trader spell applied to changed item
|
||||
if (slot == TRADE_SLOT_NONTRADED)
|
||||
{ GetTraderData()->SetSpell(0); }
|
||||
{
|
||||
GetTraderData()->SetSpell(0);
|
||||
}
|
||||
|
||||
// need remove possible player spell applied (possible move reagent)
|
||||
SetSpell(0);
|
||||
|
|
@ -331,7 +349,9 @@ void TradeData::SetSpell(uint32 spell_id, Item* castItem /*= NULL*/)
|
|||
ObjectGuid itemGuid = castItem ? castItem->GetObjectGuid() : ObjectGuid();
|
||||
|
||||
if (m_spell == spell_id && m_spellCastItem == itemGuid)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_spell = spell_id;
|
||||
m_spellCastItem = itemGuid;
|
||||
|
|
@ -346,7 +366,9 @@ void TradeData::SetSpell(uint32 spell_id, Item* castItem /*= NULL*/)
|
|||
void TradeData::SetMoney(uint64 money)
|
||||
{
|
||||
if (m_money == money)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (money > m_player->GetMoney())
|
||||
{
|
||||
|
|
@ -377,7 +399,9 @@ void TradeData::SetAccepted(bool state, bool crosssend /*= false*/)
|
|||
if (!state)
|
||||
{
|
||||
if (crosssend)
|
||||
{ m_trader->GetSession()->SendTradeStatus(TRADE_STATUS_BACK_TO_TRADE); }
|
||||
{
|
||||
m_trader->GetSession()->SendTradeStatus(TRADE_STATUS_BACK_TO_TRADE);
|
||||
}
|
||||
else
|
||||
{ m_player->GetSession()->SendTradeStatus(TRADE_STATUS_BACK_TO_TRADE); }
|
||||
}
|
||||
|
|
@ -405,11 +429,15 @@ Player::Player(WorldSession* session): Unit(), m_mover(this), m_camera(this), m_
|
|||
|
||||
m_ExtraFlags = 0;
|
||||
if (GetSession()->GetSecurity() >= SEC_GAMEMASTER)
|
||||
{ SetAcceptTicket(true); }
|
||||
{
|
||||
SetAcceptTicket(true);
|
||||
}
|
||||
|
||||
// players always accept
|
||||
if (GetSession()->GetSecurity() == SEC_PLAYER)
|
||||
{ SetAcceptWhispers(true); }
|
||||
{
|
||||
SetAcceptWhispers(true);
|
||||
}
|
||||
|
||||
m_comboPoints = 0;
|
||||
|
||||
|
|
@ -786,14 +814,18 @@ bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 c
|
|||
for (int j = 0; j < MAX_OUTFIT_ITEMS; ++j)
|
||||
{
|
||||
if (oEntry->ItemId[j] <= 0)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32 item_id = oEntry->ItemId[j];
|
||||
|
||||
// just skip, reported in ObjectMgr::LoadItemPrototypes
|
||||
ItemPrototype const* iProto = ObjectMgr::GetItemPrototype(item_id);
|
||||
if (!iProto)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// BuyCount by default
|
||||
int32 count = iProto->BuyCount;
|
||||
|
|
@ -850,7 +882,9 @@ bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 c
|
|||
// if this is ammo then use it
|
||||
msg = CanUseAmmo(pItem->GetEntry());
|
||||
if (msg == EQUIP_ERR_OK)
|
||||
{ SetAmmo(pItem->GetEntry()); }
|
||||
{
|
||||
SetAmmo(pItem->GetEntry());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -872,7 +906,9 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount)
|
|||
uint16 eDest;
|
||||
uint8 msg = CanEquipNewItem(NULL_SLOT, eDest, titem_id, false);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
EquipNewItem(eDest, titem_id, true);
|
||||
AutoUnequipOffhandIfNeed();
|
||||
|
|
@ -907,7 +943,9 @@ Item* Player::StoreNewItemInInventorySlot(uint32 itemEntry, uint32 amount)
|
|||
if (msg == EQUIP_ERR_OK)
|
||||
{
|
||||
if (Item* pItem = StoreNewItem(vDest, itemEntry, true, Item::GenerateItemRandomPropertyId(itemEntry)))
|
||||
{ return pItem; }
|
||||
{
|
||||
return pItem;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
@ -918,7 +956,9 @@ void Player::SendMirrorTimer(MirrorTimerType Type, uint32 MaxValue, uint32 Curre
|
|||
if (int(MaxValue) == DISABLED_MIRROR_TIMER)
|
||||
{
|
||||
if (int(CurrentValue) != DISABLED_MIRROR_TIMER)
|
||||
{ StopMirrorTimer(Type); }
|
||||
{
|
||||
StopMirrorTimer(Type);
|
||||
}
|
||||
return;
|
||||
}
|
||||
WorldPacket data(SMSG_START_MIRROR_TIMER, (21));
|
||||
|
|
@ -942,13 +982,17 @@ void Player::StopMirrorTimer(MirrorTimerType Type)
|
|||
uint32 Player::EnvironmentalDamage(EnviromentalDamage type, uint32 damage)
|
||||
{
|
||||
if (!IsAlive() || isGameMaster())
|
||||
{ return 0; }
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Absorb, resist some environmental damage type
|
||||
uint32 absorb = 0;
|
||||
uint32 resist = 0;
|
||||
if (type == DAMAGE_LAVA)
|
||||
{ CalculateDamageAbsorbAndResist(this, SPELL_SCHOOL_MASK_FIRE, DIRECT_DAMAGE, damage, &absorb, &resist); }
|
||||
{
|
||||
CalculateDamageAbsorbAndResist(this, SPELL_SCHOOL_MASK_FIRE, DIRECT_DAMAGE, damage, &absorb, &resist);
|
||||
}
|
||||
else if (type == DAMAGE_SLIME)
|
||||
{ CalculateDamageAbsorbAndResist(this, SPELL_SCHOOL_MASK_NATURE, DIRECT_DAMAGE, damage, &absorb, &resist); }
|
||||
|
||||
|
|
@ -993,7 +1037,9 @@ int32 Player::getMaxTimer(MirrorTimerType timer)
|
|||
{
|
||||
case FATIGUE_TIMER:
|
||||
if (GetSession()->GetSecurity() >= (AccountTypes)sWorld.getConfig(CONFIG_UINT32_TIMERBAR_FATIGUE_GMLEVEL))
|
||||
{ return DISABLED_MIRROR_TIMER; }
|
||||
{
|
||||
return DISABLED_MIRROR_TIMER;
|
||||
}
|
||||
return sWorld.getConfig(CONFIG_UINT32_TIMERBAR_FATIGUE_MAX) * IN_MILLISECONDS;
|
||||
case BREATH_TIMER:
|
||||
{
|
||||
|
|
@ -1009,7 +1055,9 @@ int32 Player::getMaxTimer(MirrorTimerType timer)
|
|||
case FIRE_TIMER:
|
||||
{
|
||||
if (!IsAlive() || GetSession()->GetSecurity() >= (AccountTypes)sWorld.getConfig(CONFIG_UINT32_TIMERBAR_FIRE_GMLEVEL))
|
||||
{ return DISABLED_MIRROR_TIMER; }
|
||||
{
|
||||
return DISABLED_MIRROR_TIMER;
|
||||
}
|
||||
return sWorld.getConfig(CONFIG_UINT32_TIMERBAR_FIRE_MAX) * IN_MILLISECONDS;
|
||||
}
|
||||
default:
|
||||
|
|
@ -1022,13 +1070,17 @@ void Player::UpdateMirrorTimers()
|
|||
{
|
||||
// Desync flags for update on next HandleDrowning
|
||||
if (m_MirrorTimerFlags)
|
||||
{ m_MirrorTimerFlagsLast = ~m_MirrorTimerFlags; }
|
||||
{
|
||||
m_MirrorTimerFlagsLast = ~m_MirrorTimerFlags;
|
||||
}
|
||||
}
|
||||
|
||||
void Player::HandleDrowning(uint32 time_diff)
|
||||
{
|
||||
if (!m_MirrorTimerFlags)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// In water
|
||||
if (m_MirrorTimerFlags & UNDERWATER_INWATER)
|
||||
|
|
@ -1061,7 +1113,9 @@ void Player::HandleDrowning(uint32 time_diff)
|
|||
// Need breath regen
|
||||
m_MirrorTimer[BREATH_TIMER] += 10 * time_diff;
|
||||
if (m_MirrorTimer[BREATH_TIMER] >= UnderWaterTime || !IsAlive())
|
||||
{ StopMirrorTimer(BREATH_TIMER); }
|
||||
{
|
||||
StopMirrorTimer(BREATH_TIMER);
|
||||
}
|
||||
else if (m_MirrorTimerFlagsLast & UNDERWATER_INWATER)
|
||||
{ SendMirrorTimer(BREATH_TIMER, UnderWaterTime, m_MirrorTimer[BREATH_TIMER], 10); }
|
||||
}
|
||||
|
|
@ -1099,7 +1153,9 @@ void Player::HandleDrowning(uint32 time_diff)
|
|||
int32 DarkWaterTime = getMaxTimer(FATIGUE_TIMER);
|
||||
m_MirrorTimer[FATIGUE_TIMER] += 10 * time_diff;
|
||||
if (m_MirrorTimer[FATIGUE_TIMER] >= DarkWaterTime || !IsAlive())
|
||||
{ StopMirrorTimer(FATIGUE_TIMER); }
|
||||
{
|
||||
StopMirrorTimer(FATIGUE_TIMER);
|
||||
}
|
||||
else if (m_MirrorTimerFlagsLast & UNDERWATER_INDARKWATER)
|
||||
{ SendMirrorTimer(FATIGUE_TIMER, DarkWaterTime, m_MirrorTimer[FATIGUE_TIMER], 10); }
|
||||
}
|
||||
|
|
@ -1108,7 +1164,9 @@ void Player::HandleDrowning(uint32 time_diff)
|
|||
{
|
||||
// Breath timer not activated - activate it
|
||||
if (m_MirrorTimer[FIRE_TIMER] == DISABLED_MIRROR_TIMER)
|
||||
{ m_MirrorTimer[FIRE_TIMER] = getMaxTimer(FIRE_TIMER); }
|
||||
{
|
||||
m_MirrorTimer[FIRE_TIMER] = getMaxTimer(FIRE_TIMER);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_MirrorTimer[FIRE_TIMER] -= time_diff;
|
||||
|
|
@ -1119,7 +1177,9 @@ void Player::HandleDrowning(uint32 time_diff)
|
|||
// TODO: Check this formula
|
||||
uint32 damage = urand(600, 700);
|
||||
if (m_MirrorTimerFlags & UNDERWATER_INLAVA)
|
||||
{ EnvironmentalDamage(DAMAGE_LAVA, damage); }
|
||||
{
|
||||
EnvironmentalDamage(DAMAGE_LAVA, damage);
|
||||
}
|
||||
// need to skip Slime damage in Undercity,
|
||||
// maybe someone can find better way to handle environmental damage
|
||||
//else if (m_zoneUpdateId != 1497)
|
||||
|
|
@ -13117,7 +13177,9 @@ void Player::OnGossipSelect(WorldObject* pSource, uint32 gossipListId, uint32 me
|
|||
if (pMenuData.m_gAction_script)
|
||||
{
|
||||
if (pSource->GetTypeId() == TYPEID_UNIT)
|
||||
{ GetMap()->ScriptsStart(DBS_ON_GOSSIP, pMenuData.m_gAction_script, pSource, this, Map::SCRIPT_EXEC_PARAM_UNIQUE_BY_SOURCE); }
|
||||
{
|
||||
GetMap()->ScriptsStart(DBS_ON_GOSSIP, pMenuData.m_gAction_script, pSource, this, Map::SCRIPT_EXEC_PARAM_UNIQUE_BY_SOURCE);
|
||||
}
|
||||
else if (pSource->GetTypeId() == TYPEID_GAMEOBJECT)
|
||||
{ GetMap()->ScriptsStart(DBS_ON_GOSSIP, pMenuData.m_gAction_script, this, pSource, Map::SCRIPT_EXEC_PARAM_UNIQUE_BY_TARGET); }
|
||||
}
|
||||
|
|
@ -13160,7 +13222,9 @@ uint32 Player::GetGossipTextId(uint32 menuId, WorldObject* pSource)
|
|||
|
||||
// Start related script
|
||||
if (scriptId)
|
||||
{ GetMap()->ScriptsStart(DBS_ON_GOSSIP, scriptId, this, pSource, Map::SCRIPT_EXEC_PARAM_UNIQUE_BY_TARGET); }
|
||||
{
|
||||
GetMap()->ScriptsStart(DBS_ON_GOSSIP, scriptId, this, pSource, Map::SCRIPT_EXEC_PARAM_UNIQUE_BY_TARGET);
|
||||
}
|
||||
|
||||
return textId;
|
||||
}
|
||||
|
|
@ -13705,7 +13769,9 @@ void Player::AddQuest(Quest const* pQuest, Object* questGiver)
|
|||
|
||||
// starting initial DB quest script
|
||||
if (pQuest->GetQuestStartScript() != 0)
|
||||
{ GetMap()->ScriptsStart(DBS_ON_QUEST_START, pQuest->GetQuestStartScript(), questGiver, this, Map::SCRIPT_EXEC_PARAM_UNIQUE_BY_SOURCE); }
|
||||
{
|
||||
GetMap()->ScriptsStart(DBS_ON_QUEST_START, pQuest->GetQuestStartScript(), questGiver, this, Map::SCRIPT_EXEC_PARAM_UNIQUE_BY_SOURCE);
|
||||
}
|
||||
}
|
||||
|
||||
// remove start item if not need
|
||||
|
|
@ -13928,7 +13994,9 @@ void Player::RewardQuest(Quest const* pQuest, uint32 reward, Object* questGiver,
|
|||
}
|
||||
|
||||
if (!handled && pQuest->GetQuestCompleteScript() != 0)
|
||||
{ GetMap()->ScriptsStart(DBS_ON_QUEST_END, pQuest->GetQuestCompleteScript(), questGiver, this, Map::SCRIPT_EXEC_PARAM_UNIQUE_BY_SOURCE); }
|
||||
{
|
||||
GetMap()->ScriptsStart(DBS_ON_QUEST_END, pQuest->GetQuestCompleteScript(), questGiver, this, Map::SCRIPT_EXEC_PARAM_UNIQUE_BY_SOURCE);
|
||||
}
|
||||
|
||||
// cast spells after mark quest complete (some spells have quest completed state reqyurements in spell_area data)
|
||||
if (pQuest->GetRewSpellCast() > 0)
|
||||
|
|
@ -16022,7 +16090,9 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder)
|
|||
case 1: SetGameMaster(true); break; // enable
|
||||
case 2: // save state
|
||||
if (extraflags & PLAYER_EXTRA_GM_ON)
|
||||
{ SetGameMaster(true); }
|
||||
{
|
||||
SetGameMaster(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -16084,7 +16154,9 @@ bool Player::IsTappedByMeOrMyGroup(Creature* creature)
|
|||
{
|
||||
/* Nobody tapped the monster (solo kill by another NPC) */
|
||||
if (!creature->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* If there is a loot recipient, assign it to recipient */
|
||||
if (Player* recipient = creature->GetLootRecipient())
|
||||
|
|
@ -18183,7 +18255,9 @@ void Player::outDebugStatsValues() const
|
|||
{
|
||||
// optimize disabled debug output
|
||||
if (!sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG) || sLog.HasLogFilter(LOG_FILTER_PLAYER_STATS))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
sLog.outDebug("HP is: \t\t\t%u\t\tMP is: \t\t\t%u", GetMaxHealth(), GetMaxPower(POWER_MANA));
|
||||
sLog.outDebug("AGILITY is: \t\t%f\t\tSTRENGTH is: \t\t%f", GetStat(STAT_AGILITY), GetStat(STAT_STRENGTH));
|
||||
|
|
|
|||
|
|
@ -209,7 +209,9 @@ struct ActionButton
|
|||
{
|
||||
packedData = newData;
|
||||
if (uState != ACTIONBUTTON_NEW)
|
||||
{ uState = ACTIONBUTTON_CHANGED; }
|
||||
{
|
||||
uState = ACTIONBUTTON_CHANGED;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -1185,7 +1187,9 @@ class Player : public Unit
|
|||
m_ExtraFlags &= ~(PLAYER_EXTRA_AUCTION_ENEMY | PLAYER_EXTRA_AUCTION_NEUTRAL);
|
||||
|
||||
if (state < 0)
|
||||
{ m_ExtraFlags |= PLAYER_EXTRA_AUCTION_ENEMY; }
|
||||
{
|
||||
m_ExtraFlags |= PLAYER_EXTRA_AUCTION_ENEMY;
|
||||
}
|
||||
else if (state > 0)
|
||||
{ m_ExtraFlags |= PLAYER_EXTRA_AUCTION_NEUTRAL; }
|
||||
}
|
||||
|
|
@ -1308,7 +1312,9 @@ class Player : public Unit
|
|||
InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item* pItem, bool swap = false) const
|
||||
{
|
||||
if (!pItem)
|
||||
{ return EQUIP_ERR_ITEM_NOT_FOUND; }
|
||||
{
|
||||
return EQUIP_ERR_ITEM_NOT_FOUND;
|
||||
}
|
||||
uint32 count = pItem->GetCount();
|
||||
return _CanStoreItem(bag, slot, dest, pItem->GetEntry(), count, pItem, swap, NULL);
|
||||
}
|
||||
|
|
@ -2284,7 +2290,9 @@ class Player : public Unit
|
|||
{
|
||||
for (int i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||
if (m_bgBattleGroundQueueID[i].bgQueueTypeId != BATTLEGROUND_QUEUE_NONE)
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -2300,14 +2308,18 @@ class Player : public Unit
|
|||
{
|
||||
for (int i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||
if (m_bgBattleGroundQueueID[i].bgQueueTypeId == bgQueueTypeId)
|
||||
{ return i; }
|
||||
{
|
||||
return i;
|
||||
}
|
||||
return PLAYER_MAX_BATTLEGROUND_QUEUES;
|
||||
}
|
||||
bool IsInvitedForBattleGroundQueueType(BattleGroundQueueTypeId bgQueueTypeId) const
|
||||
{
|
||||
for (int i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||
if (m_bgBattleGroundQueueID[i].bgQueueTypeId == bgQueueTypeId)
|
||||
{ return m_bgBattleGroundQueueID[i].invitedToInstance != 0; }
|
||||
{
|
||||
return m_bgBattleGroundQueueID[i].invitedToInstance != 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool InBattleGroundQueueForBattleGroundQueueType(BattleGroundQueueTypeId bgQueueTypeId) const
|
||||
|
|
@ -2338,7 +2350,9 @@ class Player : public Unit
|
|||
{
|
||||
for (int i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||
if (m_bgBattleGroundQueueID[i].bgQueueTypeId == BATTLEGROUND_QUEUE_NONE)
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void RemoveBattleGroundQueueId(BattleGroundQueueTypeId val)
|
||||
|
|
@ -2357,13 +2371,17 @@ class Player : public Unit
|
|||
{
|
||||
for (int i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||
if (m_bgBattleGroundQueueID[i].bgQueueTypeId == bgQueueTypeId)
|
||||
{ m_bgBattleGroundQueueID[i].invitedToInstance = instanceId; }
|
||||
{
|
||||
m_bgBattleGroundQueueID[i].invitedToInstance = instanceId;
|
||||
}
|
||||
}
|
||||
bool IsInvitedForBattleGroundInstance(uint32 instanceId) const
|
||||
{
|
||||
for (int i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||
if (m_bgBattleGroundQueueID[i].invitedToInstance == instanceId)
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
WorldLocation const& GetBattleGroundEntryPoint() const { return m_bgData.joinPos; }
|
||||
|
|
@ -2876,7 +2894,9 @@ class Player : public Unit
|
|||
void ScheduleDelayedOperation(uint32 operation)
|
||||
{
|
||||
if (operation < DELAYED_END)
|
||||
{ m_DelayedOperations |= operation; }
|
||||
{
|
||||
m_DelayedOperations |= operation;
|
||||
}
|
||||
}
|
||||
|
||||
void _fillGearScoreData(Item* item, GearScoreVec* gearScore, uint32& twoHandScore);
|
||||
|
|
|
|||
|
|
@ -40,7 +40,9 @@
|
|||
bool Player::UpdateStats(Stats stat)
|
||||
{
|
||||
if (stat > STAT_SPIRIT)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// value = ((base_value * base_pct) + total_value) * total_pct
|
||||
float value = GetTotalStatValue(stat);
|
||||
|
|
@ -346,7 +348,9 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
|
|||
{
|
||||
UpdateDamagePhysical(BASE_ATTACK);
|
||||
if (CanDualWield() && haveOffhandWeapon()) // allow update offhand damage only if player knows DualWield Spec and has equipped offhand weapon
|
||||
{ UpdateDamagePhysical(OFF_ATTACK); }
|
||||
{
|
||||
UpdateDamagePhysical(OFF_ATTACK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -711,7 +715,9 @@ void Player::UpdateManaRegen()
|
|||
// Set regen rate in cast state apply only on spirit based regen
|
||||
int32 modManaRegenInterrupt = GetTotalAuraModifier(SPELL_AURA_MOD_MANA_REGEN_INTERRUPT);
|
||||
if (modManaRegenInterrupt > 100)
|
||||
{ modManaRegenInterrupt = 100; }
|
||||
{
|
||||
modManaRegenInterrupt = 100;
|
||||
}
|
||||
|
||||
SetStatFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER, base_regen + power_regen_mp5 + spirit_regen * modManaRegenInterrupt / 100.0f);
|
||||
SetStatFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER, base_regen + 0.001f + power_regen_mp5 + spirit_regen);
|
||||
|
|
@ -868,7 +874,9 @@ void Creature::UpdateAttackPowerAndDamage(bool ranged)
|
|||
SetFloatValue(index_mult, attPowerMultiplier); // UNIT_FIELD_(RANGED)_ATTACK_POWER_MULTIPLIER field
|
||||
|
||||
if (ranged)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// automatically update weapon damage after attack power modification
|
||||
UpdateDamagePhysical(BASE_ATTACK);
|
||||
|
|
@ -878,7 +886,9 @@ void Creature::UpdateAttackPowerAndDamage(bool ranged)
|
|||
void Creature::UpdateDamagePhysical(WeaponAttackType attType)
|
||||
{
|
||||
if (attType > OFF_ATTACK)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UnitMods unitMod = (attType == BASE_ATTACK ? UNIT_MOD_DAMAGE_MAINHAND : UNIT_MOD_DAMAGE_OFFHAND);
|
||||
|
||||
|
|
@ -909,7 +919,9 @@ void Creature::UpdateDamagePhysical(WeaponAttackType attType)
|
|||
bool Pet::UpdateStats(Stats stat)
|
||||
{
|
||||
if (stat > STAT_SPIRIT)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// value = ((base_value * base_pct) + total_value) * total_pct
|
||||
float value = GetTotalStatValue(stat);
|
||||
|
|
@ -1026,14 +1038,18 @@ void Pet::UpdateMaxPower(Powers power)
|
|||
void Pet::UpdateAttackPowerAndDamage(bool ranged)
|
||||
{
|
||||
if (ranged)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
float val = 0.0f;
|
||||
float bonusAP = 0.0f;
|
||||
UnitMods unitMod = UNIT_MOD_ATTACK_POWER;
|
||||
|
||||
if (GetEntry() == 416) // imp's attack power
|
||||
{ val = GetStat(STAT_STRENGTH) - 10.0f; }
|
||||
{
|
||||
val = GetStat(STAT_STRENGTH) - 10.0f;
|
||||
}
|
||||
else
|
||||
{ val = 2 * GetStat(STAT_STRENGTH) - 20.0f; }
|
||||
|
||||
|
|
@ -1087,7 +1103,9 @@ void Pet::UpdateAttackPowerAndDamage(bool ranged)
|
|||
void Pet::UpdateDamagePhysical(WeaponAttackType attType)
|
||||
{
|
||||
if (attType > BASE_ATTACK)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UnitMods unitMod = UNIT_MOD_DAMAGE_MAINHAND;
|
||||
|
||||
|
|
|
|||
|
|
@ -604,7 +604,9 @@ Unit::~Unit()
|
|||
void Unit::Update(uint32 update_diff, uint32 p_time)
|
||||
{
|
||||
if (!IsInWorld())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*if(p_time > m_AurasCheck)
|
||||
{
|
||||
|
|
@ -639,7 +641,9 @@ void Unit::Update(uint32 update_diff, uint32 p_time)
|
|||
{
|
||||
// m_CombatTimer set at aura start and it will be freeze until aura removing
|
||||
if (m_CombatTimer <= update_diff)
|
||||
{ CombatStop(); }
|
||||
{
|
||||
CombatStop();
|
||||
}
|
||||
else
|
||||
{ m_CombatTimer -= update_diff; }
|
||||
}
|
||||
|
|
@ -684,10 +688,14 @@ bool Unit::UpdateMeleeAttackingState()
|
|||
{
|
||||
Unit* victim = getVictim();
|
||||
if (!victim || IsNonMeleeSpellCasted(false))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isAttackReady(BASE_ATTACK) && !(isAttackReady(OFF_ATTACK) && haveOffhandWeapon()))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8 swingError = 0;
|
||||
if (!CanReachWithMeleeAttack(victim))
|
||||
|
|
@ -711,7 +719,9 @@ bool Unit::UpdateMeleeAttackingState()
|
|||
if (haveOffhandWeapon())
|
||||
{
|
||||
if (getAttackTimer(OFF_ATTACK) < ATTACK_DISPLAY_DELAY)
|
||||
{ setAttackTimer(OFF_ATTACK, ATTACK_DISPLAY_DELAY); }
|
||||
{
|
||||
setAttackTimer(OFF_ATTACK, ATTACK_DISPLAY_DELAY);
|
||||
}
|
||||
}
|
||||
AttackerStateUpdate(victim, BASE_ATTACK);
|
||||
resetAttackTimer(BASE_ATTACK);
|
||||
|
|
@ -721,7 +731,9 @@ bool Unit::UpdateMeleeAttackingState()
|
|||
// prevent base and off attack in same time, delay attack at 0.2 sec
|
||||
uint32 base_att = getAttackTimer(BASE_ATTACK);
|
||||
if (base_att < ATTACK_DISPLAY_DELAY)
|
||||
{ setAttackTimer(BASE_ATTACK, ATTACK_DISPLAY_DELAY); }
|
||||
{
|
||||
setAttackTimer(BASE_ATTACK, ATTACK_DISPLAY_DELAY);
|
||||
}
|
||||
// do attack
|
||||
AttackerStateUpdate(victim, OFF_ATTACK);
|
||||
resetAttackTimer(OFF_ATTACK);
|
||||
|
|
@ -732,7 +744,9 @@ bool Unit::UpdateMeleeAttackingState()
|
|||
if (player && swingError != player->LastSwingErrorMsg())
|
||||
{
|
||||
if (swingError == 1)
|
||||
{ player->SendAttackSwingNotInRange(); }
|
||||
{
|
||||
player->SendAttackSwingNotInRange();
|
||||
}
|
||||
else if (swingError == 2)
|
||||
{ player->SendAttackSwingBadFacingAttack(); }
|
||||
player->SwingErrorMsg(swingError);
|
||||
|
|
@ -744,10 +758,14 @@ bool Unit::UpdateMeleeAttackingState()
|
|||
bool Unit::haveOffhandWeapon() const
|
||||
{
|
||||
if (!CanUseEquippedWeapon(OFF_ATTACK))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
{ return ((Player*)this)->GetWeaponForAttack(OFF_ATTACK, true, true); }
|
||||
{
|
||||
return ((Player*)this)->GetWeaponForAttack(OFF_ATTACK, true, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32 ItemId = GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1);
|
||||
|
|
@ -781,7 +799,9 @@ float Unit::GetCombatReach(Unit const* pVictim, bool forMeleeRange /*=true*/, fl
|
|||
BASE_MELEERANGE_OFFSET + flat_mod;
|
||||
|
||||
if (forMeleeRange && reach < ATTACK_DISTANCE)
|
||||
{ reach = ATTACK_DISTANCE; }
|
||||
{
|
||||
reach = ATTACK_DISTANCE;
|
||||
}
|
||||
|
||||
return reach;
|
||||
}
|
||||
|
|
@ -856,7 +876,9 @@ void Unit::DealDamageMods(Unit* pVictim, uint32& damage, uint32* absorb)
|
|||
if (!pVictim->IsAlive() || pVictim->IsTaxiFlying() || (pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode()))
|
||||
{
|
||||
if (absorb)
|
||||
{ *absorb += damage; }
|
||||
{
|
||||
*absorb += damage;
|
||||
}
|
||||
damage = 0;
|
||||
return;
|
||||
}
|
||||
|
|
@ -874,13 +896,19 @@ void Unit::DealDamageMods(Unit* pVictim, uint32& damage, uint32* absorb)
|
|||
|
||||
// Script Event damage Deal
|
||||
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->AI())
|
||||
{ ((Creature*)this)->AI()->DamageDeal(pVictim, damage); }
|
||||
{
|
||||
((Creature*)this)->AI()->DamageDeal(pVictim, damage);
|
||||
}
|
||||
// Script Event damage taken
|
||||
if (pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->AI())
|
||||
{ ((Creature*)pVictim)->AI()->DamageTaken(this, damage); }
|
||||
{
|
||||
((Creature*)pVictim)->AI()->DamageTaken(this, damage);
|
||||
}
|
||||
|
||||
if (absorb && originalDamage > damage)
|
||||
{ *absorb += (originalDamage - damage); }
|
||||
{
|
||||
*absorb += (originalDamage - damage);
|
||||
}
|
||||
}
|
||||
|
||||
uint32 Unit::DealDamage(Unit* pVictim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellEntry const* spellProto, bool durabilityLoss)
|
||||
|
|
@ -1030,7 +1058,9 @@ uint32 Unit::DealDamage(Unit* pVictim, uint32 damage, CleanDamage const* cleanDa
|
|||
((Player*)pVictim)->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_RECEIVED, damage);
|
||||
|
||||
if (pVictim->GetTypeId() == TYPEID_UNIT && !((Creature*)pVictim)->IsPet() && !((Creature*)pVictim)->HasLootRecipient())
|
||||
{ ((Creature*)pVictim)->SetLootRecipient(this); }
|
||||
{
|
||||
((Creature*)pVictim)->SetLootRecipient(this);
|
||||
}
|
||||
|
||||
if (health <= damage)
|
||||
{
|
||||
|
|
@ -1049,13 +1079,17 @@ uint32 Unit::DealDamage(Unit* pVictim, uint32 damage, CleanDamage const* cleanDa
|
|||
group_tap = ((Creature*)pVictim)->GetGroupLootRecipient();
|
||||
|
||||
if (Player* recipient = ((Creature*)pVictim)->GetOriginalLootRecipient())
|
||||
{ player_tap = recipient; }
|
||||
{
|
||||
player_tap = recipient;
|
||||
}
|
||||
}
|
||||
// in player kill case group tap selected by player_tap (killer-player itself, or charmer, or owner, etc)
|
||||
else
|
||||
{
|
||||
if (player_tap)
|
||||
{ group_tap = player_tap->GetGroup(); }
|
||||
{
|
||||
group_tap = player_tap->GetGroup();
|
||||
}
|
||||
}
|
||||
|
||||
// Spirit of Redemtion Talent
|
||||
|
|
@ -1089,7 +1123,9 @@ uint32 Unit::DealDamage(Unit* pVictim, uint32 damage, CleanDamage const* cleanDa
|
|||
data << pVictim->GetObjectGuid(); // victim
|
||||
|
||||
if (group_tap)
|
||||
{ group_tap->BroadcastPacket(&data, false, group_tap->GetMemberGroup(player_tap->GetObjectGuid()), player_tap->GetObjectGuid()); }
|
||||
{
|
||||
group_tap->BroadcastPacket(&data, false, group_tap->GetMemberGroup(player_tap->GetObjectGuid()), player_tap->GetObjectGuid());
|
||||
}
|
||||
|
||||
player_tap->SendDirectMessage(&data);
|
||||
}
|
||||
|
|
@ -1100,7 +1136,9 @@ uint32 Unit::DealDamage(Unit* pVictim, uint32 damage, CleanDamage const* cleanDa
|
|||
if (player_tap != pVictim)
|
||||
{
|
||||
if (group_tap)
|
||||
{ group_tap->RewardGroupAtKill(pVictim, player_tap); }
|
||||
{
|
||||
group_tap->RewardGroupAtKill(pVictim, player_tap);
|
||||
}
|
||||
else if (player_tap)
|
||||
{ player_tap->RewardSinglePlayerAtKill(pVictim); }
|
||||
}
|
||||
|
|
@ -1120,7 +1158,9 @@ uint32 Unit::DealDamage(Unit* pVictim, uint32 damage, CleanDamage const* cleanDa
|
|||
// save value before aura remove
|
||||
uint32 ressSpellId = pVictim->GetUInt32Value(PLAYER_SELF_RES_SPELL);
|
||||
if (!ressSpellId)
|
||||
{ ressSpellId = ((Player*)pVictim)->GetResurrectionSpellId(); }
|
||||
{
|
||||
ressSpellId = ((Player*)pVictim)->GetResurrectionSpellId();
|
||||
}
|
||||
|
||||
// Remove all expected to remove at death auras (most important negative case like DoT or periodic triggers)
|
||||
pVictim->RemoveAllAurasOnDeath();
|
||||
|
|
@ -1136,7 +1176,9 @@ uint32 Unit::DealDamage(Unit* pVictim, uint32 damage, CleanDamage const* cleanDa
|
|||
|
||||
// Call KilledUnit for creatures
|
||||
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->AI())
|
||||
{ ((Creature*)this)->AI()->KilledUnit(pVictim); }
|
||||
{
|
||||
((Creature*)this)->AI()->KilledUnit(pVictim);
|
||||
}
|
||||
|
||||
if (Creature* killer = ToCreature())
|
||||
{
|
||||
|
|
@ -1160,7 +1202,9 @@ uint32 Unit::DealDamage(Unit* pVictim, uint32 damage, CleanDamage const* cleanDa
|
|||
// remember victim PvP death for corpse type and corpse reclaim delay
|
||||
// at original death (not at SpiritOfRedemtionTalent timeout)
|
||||
if (!damageFromSpiritOfRedemtionTalent)
|
||||
{ playerVictim->SetPvPDeath(player_tap != NULL); }
|
||||
{
|
||||
playerVictim->SetPvPDeath(player_tap != NULL);
|
||||
}
|
||||
|
||||
// achievement stuff
|
||||
playerVictim->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, health);
|
||||
|
|
@ -1208,7 +1252,9 @@ uint32 Unit::DealDamage(Unit* pVictim, uint32 damage, CleanDamage const* cleanDa
|
|||
{
|
||||
// selfkills are not handled in outdoor pvp scripts
|
||||
if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript(playerVictim->GetCachedZoneId()))
|
||||
{ outdoorPvP->HandlePlayerKill(player_tap, playerVictim); }
|
||||
{
|
||||
outdoorPvP->HandlePlayerKill(player_tap, playerVictim);
|
||||
}
|
||||
}
|
||||
|
||||
// Used by Eluna
|
||||
|
|
@ -1282,14 +1328,18 @@ uint32 Unit::DealDamage(Unit* pVictim, uint32 damage, CleanDamage const* cleanDa
|
|||
{
|
||||
// skip channeled spell (processed differently below)
|
||||
if (i == CURRENT_CHANNELED_SPELL)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Spell* spell = pVictim->GetCurrentSpell(CurrentSpellTypes(i)))
|
||||
{
|
||||
if (spell->getState() == SPELL_STATE_PREPARING)
|
||||
{
|
||||
if(spell->m_spellInfo->GetInterruptFlags() & SPELL_INTERRUPT_FLAG_ABORT_ON_DMG)
|
||||
{ pVictim->InterruptSpell(CurrentSpellTypes(i)); }
|
||||
{
|
||||
pVictim->InterruptSpell(CurrentSpellTypes(i));
|
||||
}
|
||||
else
|
||||
{ spell->Delayed(); }
|
||||
}
|
||||
|
|
@ -1305,7 +1355,9 @@ uint32 Unit::DealDamage(Unit* pVictim, uint32 damage, CleanDamage const* cleanDa
|
|||
if (channelInterruptFlags & CHANNEL_FLAG_DELAY)
|
||||
{
|
||||
if (pVictim != this) // don't shorten the duration of channeling if you damage yourself
|
||||
{ spell->DelayedChannel(); }
|
||||
{
|
||||
spell->DelayedChannel();
|
||||
}
|
||||
}
|
||||
else if ((channelInterruptFlags & (CHANNEL_FLAG_DAMAGE | CHANNEL_FLAG_DAMAGE2)))
|
||||
{
|
||||
|
|
@ -1353,7 +1405,9 @@ struct PetOwnerKilledUnitHelper
|
|||
if (pTarget->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
if (((Creature*)pTarget)->AI())
|
||||
{ ((Creature*)pTarget)->AI()->OwnerKilledUnit(m_victim); }
|
||||
{
|
||||
((Creature*)pTarget)->AI()->OwnerKilledUnit(m_victim);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1369,7 +1423,9 @@ void Unit::JustKilledCreature(Creature* victim, Player* responsiblePlayer)
|
|||
if (victim->GetCreatureType() == CREATURE_TYPE_CRITTER && GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if (CreatureInfo const* normalInfo = ObjectMgr::GetCreatureTemplate(victim->GetEntry()))
|
||||
{ ((Player*)this)->KilledMonster(normalInfo, victim->GetObjectGuid()); }
|
||||
{
|
||||
((Player*)this)->KilledMonster(normalInfo, victim->GetObjectGuid());
|
||||
}
|
||||
}
|
||||
|
||||
// Interrupt channeling spell when a Possessed Summoned is killed
|
||||
|
|
@ -1381,14 +1437,18 @@ void Unit::JustKilledCreature(Creature* victim, Player* responsiblePlayer)
|
|||
{
|
||||
Spell* channeledSpell = creator->GetCurrentSpell(CURRENT_CHANNELED_SPELL);
|
||||
if (channeledSpell && channeledSpell->m_spellInfo->Id == spellInfo->Id)
|
||||
{ creator->InterruptNonMeleeSpells(false); }
|
||||
{
|
||||
creator->InterruptNonMeleeSpells(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ******************************* Inform various hooks ************************************ */
|
||||
// Inform victim's AI
|
||||
if (victim->AI())
|
||||
{ victim->AI()->JustDied(this); }
|
||||
{
|
||||
victim->AI()->JustDied(this);
|
||||
}
|
||||
|
||||
// Inform Owner
|
||||
Unit* pOwner = victim->GetCharmerOrOwner();
|
||||
|
|
@ -1398,17 +1458,23 @@ void Unit::JustKilledCreature(Creature* victim, Player* responsiblePlayer)
|
|||
if (pSummon->GetSummonerGuid().IsCreatureOrVehicle())
|
||||
if (Creature* pSummoner = victim->GetMap()->GetCreature(pSummon->GetSummonerGuid()))
|
||||
if (pSummoner->AI())
|
||||
{ pSummoner->AI()->SummonedCreatureJustDied(victim); }
|
||||
{
|
||||
pSummoner->AI()->SummonedCreatureJustDied(victim);
|
||||
}
|
||||
}
|
||||
else if (pOwner && pOwner->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
if (((Creature*)pOwner)->AI())
|
||||
{ ((Creature*)pOwner)->AI()->SummonedCreatureJustDied(victim); }
|
||||
{
|
||||
((Creature*)pOwner)->AI()->SummonedCreatureJustDied(victim);
|
||||
}
|
||||
}
|
||||
|
||||
// Inform Instance Data and Linking
|
||||
if (InstanceData* mapInstance = victim->GetInstanceData())
|
||||
{ mapInstance->OnCreatureDeath(victim); }
|
||||
{
|
||||
mapInstance->OnCreatureDeath(victim);
|
||||
}
|
||||
|
||||
if (responsiblePlayer) // killedby Player, inform BG
|
||||
if (BattleGround* bg = responsiblePlayer->GetBattleGround())
|
||||
|
|
@ -1421,13 +1487,17 @@ void Unit::JustKilledCreature(Creature* victim, Player* responsiblePlayer)
|
|||
|
||||
// Notify the outdoor pvp script
|
||||
if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript(responsiblePlayer ? responsiblePlayer->GetCachedZoneId() : GetZoneId()))
|
||||
{ outdoorPvP->HandleCreatureDeath(victim); }
|
||||
{
|
||||
outdoorPvP->HandleCreatureDeath(victim);
|
||||
}
|
||||
|
||||
// Start creature death script
|
||||
GetMap()->ScriptsStart(DBS_ON_CREATURE_DEATH, victim->GetEntry(), victim, responsiblePlayer ? responsiblePlayer : this);
|
||||
|
||||
if (victim->IsLinkingEventTrigger())
|
||||
{ victim->GetMap()->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_DIE, victim); }
|
||||
{
|
||||
victim->GetMap()->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_DIE, victim);
|
||||
}
|
||||
|
||||
// Dungeon specific stuff
|
||||
if (victim->GetInstanceId())
|
||||
|
|
@ -1441,7 +1511,9 @@ void Unit::JustKilledCreature(Creature* victim, Player* responsiblePlayer)
|
|||
if (m->IsRaidOrHeroicDungeon())
|
||||
{
|
||||
if (victim->GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_INSTANCE_BIND)
|
||||
{ ((DungeonMap*)m)->PermBindAllPlayers(creditedPlayer); }
|
||||
{
|
||||
((DungeonMap*)m)->PermBindAllPlayers(creditedPlayer);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1450,7 +1522,9 @@ void Unit::JustKilledCreature(Creature* victim, Player* responsiblePlayer)
|
|||
// until the players leave the instance
|
||||
time_t resettime = victim->GetRespawnTimeEx() + 2 * HOUR;
|
||||
if (save->GetResetTime() < resettime)
|
||||
{ save->SetResetTime(resettime); }
|
||||
{
|
||||
save->SetResetTime(resettime);
|
||||
}
|
||||
}
|
||||
// update encounter state if needed
|
||||
((DungeonMap*)m)->GetPersistanceState()->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, victim->GetEntry());
|
||||
|
|
@ -1484,7 +1558,9 @@ void Unit::CastStop(uint32 except_spellid)
|
|||
{
|
||||
for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i)
|
||||
if (m_currentSpells[i] && m_currentSpells[i]->m_spellInfo->Id != except_spellid)
|
||||
{ InterruptSpell(CurrentSpellTypes(i), false); }
|
||||
{
|
||||
InterruptSpell(CurrentSpellTypes(i), false);
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item* castItem, Aura* triggeredByAura, ObjectGuid originalCaster, SpellEntry const* triggeredBy)
|
||||
|
|
@ -1494,7 +1570,9 @@ void Unit::CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item* castIte
|
|||
if (!spellInfo)
|
||||
{
|
||||
if (triggeredByAura)
|
||||
{ sLog.outError("CastSpell: unknown spell id %i by caster: %s triggered by aura %u (eff %u)", spellId, GetGuidStr().c_str(), triggeredByAura->GetId(), triggeredByAura->GetEffIndex()); }
|
||||
{
|
||||
sLog.outError("CastSpell: unknown spell id %i by caster: %s triggered by aura %u (eff %u)", spellId, GetGuidStr().c_str(), triggeredByAura->GetId(), triggeredByAura->GetEffIndex());
|
||||
}
|
||||
else
|
||||
{ sLog.outError("CastSpell: unknown spell id %i by caster: %s", spellId, GetGuidStr().c_str()); }
|
||||
return;
|
||||
|
|
@ -1508,19 +1586,25 @@ void Unit::CastSpell(Unit* Victim, SpellEntry const* spellInfo, bool triggered,
|
|||
if (!spellInfo)
|
||||
{
|
||||
if (triggeredByAura)
|
||||
{ sLog.outError("CastSpell: unknown spell by caster: %s triggered by aura %u (eff %u)", GetGuidStr().c_str(), triggeredByAura->GetId(), triggeredByAura->GetEffIndex()); }
|
||||
{
|
||||
sLog.outError("CastSpell: unknown spell by caster: %s triggered by aura %u (eff %u)", GetGuidStr().c_str(), triggeredByAura->GetId(), triggeredByAura->GetEffIndex());
|
||||
}
|
||||
else
|
||||
{ sLog.outError("CastSpell: unknown spell by caster: %s", GetGuidStr().c_str()); }
|
||||
return;
|
||||
}
|
||||
|
||||
if (castItem)
|
||||
{ DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "WORLD: cast Item spellId - %i", spellInfo->Id); }
|
||||
{
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "WORLD: cast Item spellId - %i", spellInfo->Id);
|
||||
}
|
||||
|
||||
if (triggeredByAura)
|
||||
{
|
||||
if (!originalCaster)
|
||||
{ originalCaster = triggeredByAura->GetCasterGuid(); }
|
||||
{
|
||||
originalCaster = triggeredByAura->GetCasterGuid();
|
||||
}
|
||||
|
||||
triggeredBy = triggeredByAura->GetSpellProto();
|
||||
}
|
||||
|
|
@ -1540,7 +1624,9 @@ void Unit::CastSpell(Unit* Victim, SpellEntry const* spellInfo, bool triggered,
|
|||
targets.setUnitTarget(Victim);
|
||||
|
||||
if (spellInfo->GetTargets() & TARGET_FLAG_DEST_LOCATION)
|
||||
{ targets.setDestination(Victim->GetPositionX(), Victim->GetPositionY(), Victim->GetPositionZ()); }
|
||||
{
|
||||
targets.setDestination(Victim->GetPositionX(), Victim->GetPositionY(), Victim->GetPositionZ());
|
||||
}
|
||||
if (spellInfo->GetTargets() & TARGET_FLAG_SOURCE_LOCATION)
|
||||
if (WorldObject* caster = spell->GetCastingObject())
|
||||
targets.setSource(caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ());
|
||||
|
|
@ -1577,12 +1663,16 @@ void Unit::CastCustomSpell(Unit* Victim, SpellEntry const* spellInfo, int32 cons
|
|||
}
|
||||
|
||||
if (castItem)
|
||||
{ DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "WORLD: cast Item spellId - %i", spellInfo->Id); }
|
||||
{
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "WORLD: cast Item spellId - %i", spellInfo->Id);
|
||||
}
|
||||
|
||||
if (triggeredByAura)
|
||||
{
|
||||
if (!originalCaster)
|
||||
{ originalCaster = triggeredByAura->GetCasterGuid(); }
|
||||
{
|
||||
originalCaster = triggeredByAura->GetCasterGuid();
|
||||
}
|
||||
|
||||
triggeredBy = triggeredByAura->GetSpellProto();
|
||||
}
|
||||
|
|
@ -1590,23 +1680,33 @@ void Unit::CastCustomSpell(Unit* Victim, SpellEntry const* spellInfo, int32 cons
|
|||
Spell* spell = new Spell(this, spellInfo, triggered, originalCaster, triggeredBy);
|
||||
|
||||
if (bp0)
|
||||
{ spell->m_currentBasePoints[EFFECT_INDEX_0] = *bp0; }
|
||||
{
|
||||
spell->m_currentBasePoints[EFFECT_INDEX_0] = *bp0;
|
||||
}
|
||||
|
||||
if (bp1)
|
||||
{ spell->m_currentBasePoints[EFFECT_INDEX_1] = *bp1; }
|
||||
{
|
||||
spell->m_currentBasePoints[EFFECT_INDEX_1] = *bp1;
|
||||
}
|
||||
|
||||
if (bp2)
|
||||
{ spell->m_currentBasePoints[EFFECT_INDEX_2] = *bp2; }
|
||||
{
|
||||
spell->m_currentBasePoints[EFFECT_INDEX_2] = *bp2;
|
||||
}
|
||||
|
||||
SpellCastTargets targets;
|
||||
targets.setUnitTarget(Victim);
|
||||
spell->m_CastItem = castItem;
|
||||
|
||||
if (spellInfo->GetTargets() & TARGET_FLAG_DEST_LOCATION)
|
||||
{ targets.setDestination(Victim->GetPositionX(), Victim->GetPositionY(), Victim->GetPositionZ()); }
|
||||
{
|
||||
targets.setDestination(Victim->GetPositionX(), Victim->GetPositionY(), Victim->GetPositionZ());
|
||||
}
|
||||
if (spellInfo->GetTargets() & TARGET_FLAG_SOURCE_LOCATION)
|
||||
if (WorldObject* caster = spell->GetCastingObject())
|
||||
{ targets.setSource(caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ()); }
|
||||
{
|
||||
targets.setSource(caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ());
|
||||
}
|
||||
|
||||
spell->SpellStart(&targets, triggeredByAura);
|
||||
}
|
||||
|
|
@ -1641,12 +1741,16 @@ void Unit::CastSpell(float x, float y, float z, SpellEntry const* spellInfo, boo
|
|||
}
|
||||
|
||||
if (castItem)
|
||||
{ DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "WORLD: cast Item spellId - %i", spellInfo->Id); }
|
||||
{
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "WORLD: cast Item spellId - %i", spellInfo->Id);
|
||||
}
|
||||
|
||||
if (triggeredByAura)
|
||||
{
|
||||
if (!originalCaster)
|
||||
{ originalCaster = triggeredByAura->GetCasterGuid(); }
|
||||
{
|
||||
originalCaster = triggeredByAura->GetCasterGuid();
|
||||
}
|
||||
|
||||
triggeredBy = triggeredByAura->GetSpellProto();
|
||||
}
|
||||
|
|
@ -1656,13 +1760,19 @@ void Unit::CastSpell(float x, float y, float z, SpellEntry const* spellInfo, boo
|
|||
SpellCastTargets targets;
|
||||
|
||||
if (spellInfo->GetTargets() & TARGET_FLAG_DEST_LOCATION)
|
||||
{ targets.setDestination(x, y, z); }
|
||||
{
|
||||
targets.setDestination(x, y, z);
|
||||
}
|
||||
if (spellInfo->GetTargets() & TARGET_FLAG_SOURCE_LOCATION)
|
||||
{ targets.setSource(x, y, z); }
|
||||
{
|
||||
targets.setSource(x, y, z);
|
||||
}
|
||||
|
||||
// Spell cast with x,y,z but without dbc target-mask, set destination
|
||||
if (!(targets.m_targetMask & (TARGET_FLAG_DEST_LOCATION | TARGET_FLAG_SOURCE_LOCATION)))
|
||||
{ targets.setDestination(x, y, z); }
|
||||
{
|
||||
targets.setDestination(x, y, z);
|
||||
}
|
||||
|
||||
spell->m_CastItem = castItem;
|
||||
spell->SpellStart(&targets, triggeredByAura);
|
||||
|
|
@ -1687,7 +1797,9 @@ void Unit::CalculateSpellDamage(SpellNonMeleeDamage* damageInfo, int32 damage, S
|
|||
Unit* pVictim = damageInfo->target;
|
||||
|
||||
if (damage < 0)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this || !pVictim)
|
||||
return;
|
||||
|
|
@ -1767,15 +1879,21 @@ void Unit::CalculateSpellDamage(SpellNonMeleeDamage* damageInfo, int32 damage, S
|
|||
void Unit::DealSpellDamage(SpellNonMeleeDamage* damageInfo, bool durabilityLoss)
|
||||
{
|
||||
if (!damageInfo)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Unit* pVictim = damageInfo->target;
|
||||
|
||||
if (!this || !pVictim)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!pVictim->IsAlive() || pVictim->IsTaxiFlying() || (pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode()))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SpellEntry const* spellProto = sSpellStore.LookupEntry(damageInfo->SpellID);
|
||||
if (spellProto == NULL)
|
||||
|
|
@ -1815,9 +1933,13 @@ void Unit::CalculateMeleeDamage(Unit* pVictim, CalcDamageInfo* damageInfo, Weapo
|
|||
damageInfo->hitOutCome = MELEE_HIT_EVADE;
|
||||
|
||||
if (!this || !pVictim)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!this->IsAlive() || !pVictim->IsAlive())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Select HitInfo/procAttacker/procVictim flag based on attack type
|
||||
switch (attackType)
|
||||
|
|
@ -2001,17 +2123,25 @@ void Unit::CalculateMeleeDamage(Unit* pVictim, CalcDamageInfo* damageInfo, Weapo
|
|||
|
||||
// apply max/min bounds
|
||||
if (lowEnd < 0.01f) // the low end must not go bellow 0.01f
|
||||
{ lowEnd = 0.01f; }
|
||||
{
|
||||
lowEnd = 0.01f;
|
||||
}
|
||||
else if (lowEnd > maxLowEnd) // the smaller value of this and 0.6 is kept as the low end
|
||||
{ lowEnd = maxLowEnd; }
|
||||
|
||||
if (highEnd < 0.2f) // high end limits
|
||||
{ highEnd = 0.2f; }
|
||||
{
|
||||
highEnd = 0.2f;
|
||||
}
|
||||
if (highEnd > 0.99f)
|
||||
{ highEnd = 0.99f; }
|
||||
{
|
||||
highEnd = 0.99f;
|
||||
}
|
||||
|
||||
if (lowEnd > highEnd) // prevent negative range size
|
||||
{ lowEnd = highEnd; }
|
||||
{
|
||||
lowEnd = highEnd;
|
||||
}
|
||||
|
||||
reducePercent = lowEnd + rand_norm_f() * (highEnd - lowEnd);
|
||||
|
||||
|
|
@ -2057,7 +2187,9 @@ void Unit::CalculateMeleeDamage(Unit* pVictim, CalcDamageInfo* damageInfo, Weapo
|
|||
damageInfo->procEx |= PROC_EX_ABSORB;
|
||||
}
|
||||
if (damageInfo->resist)
|
||||
{ damageInfo->HitInfo |= HITINFO_RESIST; }
|
||||
{
|
||||
damageInfo->HitInfo |= HITINFO_RESIST;
|
||||
}
|
||||
}
|
||||
else // Umpossible get negative result but....
|
||||
{ damageInfo->damage = 0; }
|
||||
|
|
@ -2069,10 +2201,14 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
|
|||
Unit* pVictim = damageInfo->target;
|
||||
|
||||
if (!this || !pVictim)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!pVictim->IsAlive() || pVictim->IsTaxiFlying() || (pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode()))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// You don't lose health from damage taken from another player while in a sanctuary
|
||||
// You still see it in the combat log though
|
||||
|
|
@ -2081,9 +2217,13 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
|
|||
|
||||
// Hmmmm dont like this emotes client must by self do all animations
|
||||
if (damageInfo->HitInfo & HITINFO_CRITICALHIT)
|
||||
{ pVictim->HandleEmoteCommand(EMOTE_ONESHOT_WOUNDCRITICAL); }
|
||||
{
|
||||
pVictim->HandleEmoteCommand(EMOTE_ONESHOT_WOUNDCRITICAL);
|
||||
}
|
||||
if (damageInfo->blocked_amount && damageInfo->TargetState != VICTIMSTATE_BLOCKS)
|
||||
{ pVictim->HandleEmoteCommand(EMOTE_ONESHOT_PARRYSHIELD); }
|
||||
{
|
||||
pVictim->HandleEmoteCommand(EMOTE_ONESHOT_PARRYSHIELD);
|
||||
}
|
||||
|
||||
// This seems to reduce the victims time until next attack if your attack was parried
|
||||
if (damageInfo->TargetState == VICTIMSTATE_PARRY)
|
||||
|
|
@ -2140,7 +2280,9 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
|
|||
|
||||
// there is a newbie protection, at level 10 just 7% base chance; assuming linear function
|
||||
if (pVictim->getLevel() < 30)
|
||||
{ Probability = 0.65f * pVictim->getLevel() + 0.5f; }
|
||||
{
|
||||
Probability = 0.65f * pVictim->getLevel() + 0.5f;
|
||||
}
|
||||
|
||||
uint32 VictimDefense = pVictim->GetMaxSkillValueForLevel(this);
|
||||
uint32 AttackerMeleeSkill = GetMaxSkillValueForLevel();
|
||||
|
|
@ -2148,10 +2290,14 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
|
|||
Probability *= AttackerMeleeSkill / (float)VictimDefense;
|
||||
|
||||
if (Probability > 40.0f)
|
||||
{ Probability = 40.0f; }
|
||||
{
|
||||
Probability = 40.0f;
|
||||
}
|
||||
|
||||
if (roll_chance_f(Probability))
|
||||
{ CastSpell(pVictim, 1604, true); }
|
||||
{
|
||||
CastSpell(pVictim, 1604, true);
|
||||
}
|
||||
}
|
||||
|
||||
// If not miss
|
||||
|
|
@ -2159,7 +2305,9 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
|
|||
{
|
||||
// on weapon hit casts
|
||||
if (GetTypeId() == TYPEID_PLAYER && pVictim->IsAlive())
|
||||
{ ((Player*)this)->CastItemCombatSpell(pVictim, damageInfo->attackType); }
|
||||
{
|
||||
((Player*)this)->CastItemCombatSpell(pVictim, damageInfo->attackType);
|
||||
}
|
||||
|
||||
// victim's damage shield
|
||||
std::set<Aura*> alreadyDone;
|
||||
|
|
@ -2219,11 +2367,15 @@ void Unit::HandleEmoteState(uint32 emote_id)
|
|||
void Unit::HandleEmote(uint32 emote_id)
|
||||
{
|
||||
if (!emote_id)
|
||||
{ HandleEmoteState(0); }
|
||||
{
|
||||
HandleEmoteState(0);
|
||||
}
|
||||
else if (EmotesEntry const* emoteEntry = sEmotesStore.LookupEntry(emote_id))
|
||||
{
|
||||
if (emoteEntry->EmoteType) // 1,2 states, 0 command
|
||||
{ HandleEmoteState(emote_id); }
|
||||
{
|
||||
HandleEmoteState(emote_id);
|
||||
}
|
||||
else
|
||||
{ HandleEmoteCommand(emote_id); }
|
||||
}
|
||||
|
|
@ -2282,7 +2434,9 @@ uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage)
|
|||
}
|
||||
|
||||
if (armor < 0.0f)
|
||||
{ armor = 0.0f; }
|
||||
{
|
||||
armor = 0.0f;
|
||||
}
|
||||
|
||||
float levelModifier = (float)getLevel();
|
||||
if (levelModifier > 59)
|
||||
|
|
@ -2292,9 +2446,13 @@ uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage)
|
|||
tmpvalue = tmpvalue / (1.0f + tmpvalue);
|
||||
|
||||
if (tmpvalue < 0.0f)
|
||||
{ tmpvalue = 0.0f; }
|
||||
{
|
||||
tmpvalue = 0.0f;
|
||||
}
|
||||
if (tmpvalue > 0.75f)
|
||||
{ tmpvalue = 0.75f; }
|
||||
{
|
||||
tmpvalue = 0.75f;
|
||||
}
|
||||
|
||||
newdamage = uint32(damage - (damage * tmpvalue));
|
||||
|
||||
|
|
@ -2304,7 +2462,9 @@ uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage)
|
|||
void Unit::CalculateDamageAbsorbAndResist(Unit* pCaster, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32* absorb, uint32* resist, bool canReflect)
|
||||
{
|
||||
if (!pCaster || !IsAlive() || !damage)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Magic damage, check for resists
|
||||
if ((schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0)
|
||||
|
|
@ -2319,9 +2479,13 @@ void Unit::CalculateDamageAbsorbAndResist(Unit* pCaster, SpellSchoolMask schoolM
|
|||
|
||||
tmpvalue2 *= (float)(0.15f / getLevel());
|
||||
if (tmpvalue2 < 0.0f)
|
||||
{ tmpvalue2 = 0.0f; }
|
||||
{
|
||||
tmpvalue2 = 0.0f;
|
||||
}
|
||||
if (tmpvalue2 > 0.75f)
|
||||
{ tmpvalue2 = 0.75f; }
|
||||
{
|
||||
tmpvalue2 = 0.75f;
|
||||
}
|
||||
uint32 ran = urand(0, 100);
|
||||
float faq[4] = {24.0f, 6.0f, 4.0f, 6.0f};
|
||||
uint8 m = 0;
|
||||
|
|
@ -2330,16 +2494,22 @@ void Unit::CalculateDamageAbsorbAndResist(Unit* pCaster, SpellSchoolMask schoolM
|
|||
{
|
||||
Binom += 2400 * (powf(tmpvalue2, float(i)) * powf((1 - tmpvalue2), float(4 - i))) / faq[i];
|
||||
if (ran > Binom)
|
||||
{ ++m; }
|
||||
{
|
||||
++m;
|
||||
}
|
||||
else
|
||||
{ break; }
|
||||
}
|
||||
if (damagetype == DOT && m == 4)
|
||||
{ *resist += uint32(damage - 1); }
|
||||
{
|
||||
*resist += uint32(damage - 1);
|
||||
}
|
||||
else
|
||||
{ *resist += uint32(damage * m / 4); }
|
||||
if (*resist > damage)
|
||||
{ *resist = damage; }
|
||||
{
|
||||
*resist = damage;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ *resist = 0; }
|
||||
|
|
@ -2620,7 +2790,9 @@ void Unit::CalculateDamageAbsorbAndResist(Unit* pCaster, SpellSchoolMask schoolM
|
|||
// currentAbsorb - damage can be absorbed by shield
|
||||
// If need absorb less damage
|
||||
if (RemainingDamage < currentAbsorb)
|
||||
{ currentAbsorb = RemainingDamage; }
|
||||
{
|
||||
currentAbsorb = RemainingDamage;
|
||||
}
|
||||
|
||||
RemainingDamage -= currentAbsorb;
|
||||
|
||||
|
|
@ -2632,10 +2804,14 @@ void Unit::CalculateDamageAbsorbAndResist(Unit* pCaster, SpellSchoolMask schoolM
|
|||
// Reduce shield amount
|
||||
mod->m_amount -= currentAbsorb;
|
||||
if ((*i)->GetHolder()->DropAuraCharge())
|
||||
{ mod->m_amount = 0; }
|
||||
{
|
||||
mod->m_amount = 0;
|
||||
}
|
||||
// Need remove it later
|
||||
if (mod->m_amount <= 0)
|
||||
{ existExpired = true; }
|
||||
{
|
||||
existExpired = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove all expired absorb auras
|
||||
|
|
@ -2668,11 +2844,15 @@ void Unit::CalculateDamageAbsorbAndResist(Unit* pCaster, SpellSchoolMask schoolM
|
|||
|
||||
// check damage school mask
|
||||
if (((*i)->GetModifier()->m_miscvalue & schoolMask) == 0)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int32 currentAbsorb;
|
||||
if (RemainingDamage >= (*i)->GetModifier()->m_amount)
|
||||
{ currentAbsorb = (*i)->GetModifier()->m_amount; }
|
||||
{
|
||||
currentAbsorb = (*i)->GetModifier()->m_amount;
|
||||
}
|
||||
else
|
||||
{ currentAbsorb = RemainingDamage; }
|
||||
|
||||
|
|
@ -2681,11 +2861,15 @@ void Unit::CalculateDamageAbsorbAndResist(Unit* pCaster, SpellSchoolMask schoolM
|
|||
if (float manaMultiplier = (spellEffect ? spellEffect->EffectMultipleValue : 0))
|
||||
{
|
||||
if (Player* modOwner = GetSpellModOwner())
|
||||
{ modOwner->ApplySpellMod((*i)->GetId(), SPELLMOD_MULTIPLE_VALUE, manaMultiplier); }
|
||||
{
|
||||
modOwner->ApplySpellMod((*i)->GetId(), SPELLMOD_MULTIPLE_VALUE, manaMultiplier);
|
||||
}
|
||||
|
||||
int32 maxAbsorb = int32(GetPower(POWER_MANA) / manaMultiplier);
|
||||
if (currentAbsorb > maxAbsorb)
|
||||
{ currentAbsorb = maxAbsorb; }
|
||||
{
|
||||
currentAbsorb = maxAbsorb;
|
||||
}
|
||||
|
||||
int32 manaReduction = int32(currentAbsorb * manaMultiplier);
|
||||
ApplyPowerMod(POWER_MANA, manaReduction, false);
|
||||
|
|
@ -3941,7 +4125,7 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell)
|
|||
m_currentSpells[CSpellType] = pSpell;
|
||||
pSpell->SetReferencedFromCurrent(true);
|
||||
|
||||
pSpell->SetSelfContainer(&(m_currentSpells[pSpell->GetCurrentContainer()])); // this works, but is not safe - <looks at Cédric>
|
||||
pSpell->SetSelfContainer(&(m_currentSpells[pSpell->GetCurrentContainer()])); // this works, but is not safe - <looks at C<EFBFBD>dric>
|
||||
|
||||
// original and faulty code - delete once the above has been proven to work
|
||||
// pSpell->m_selfContainer = &(m_currentSpells[pSpell->GetCurrentContainer()]); // m_selfContainer is not accessible, due to being a protected member
|
||||
|
|
@ -8529,23 +8713,31 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy)
|
|||
{
|
||||
// only alive units can be in combat
|
||||
if (!IsAlive())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (PvP)
|
||||
{ m_CombatTimer = 5000; }
|
||||
{
|
||||
m_CombatTimer = 5000;
|
||||
}
|
||||
|
||||
bool creatureNotInCombat = GetTypeId() == TYPEID_UNIT && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT);
|
||||
|
||||
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT);
|
||||
|
||||
if (IsCharmed() || (GetTypeId() != TYPEID_PLAYER && ((Creature*)this)->IsPet()))
|
||||
{ SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT); }
|
||||
{
|
||||
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT);
|
||||
}
|
||||
|
||||
// interrupt all delayed non-combat casts
|
||||
for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i)
|
||||
if (Spell* spell = GetCurrentSpell(CurrentSpellTypes(i)))
|
||||
if (IsNonCombatSpell(spell->m_spellInfo))
|
||||
{ InterruptSpell(CurrentSpellTypes(i), false); }
|
||||
{
|
||||
InterruptSpell(CurrentSpellTypes(i), false);
|
||||
}
|
||||
|
||||
if (getRace() == RACE_WORGEN && !IsInWorgenForm(true) && HasWorgenForm())
|
||||
CastSpell(this, 97709, true); // cast Altered Form
|
||||
|
|
@ -8562,17 +8754,25 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy)
|
|||
Creature* pCreature = (Creature*)this;
|
||||
|
||||
if (pCreature->AI())
|
||||
{ pCreature->AI()->EnterCombat(enemy); }
|
||||
{
|
||||
pCreature->AI()->EnterCombat(enemy);
|
||||
}
|
||||
|
||||
// Some bosses are set into combat with zone
|
||||
if (GetMap()->IsDungeon() && (pCreature->GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_AGGRO_ZONE) && enemy && enemy->IsControlledByPlayer())
|
||||
{ pCreature->SetInCombatWithZone(); }
|
||||
{
|
||||
pCreature->SetInCombatWithZone();
|
||||
}
|
||||
|
||||
if (InstanceData* mapInstance = GetInstanceData())
|
||||
{ mapInstance->OnCreatureEnterCombat(pCreature); }
|
||||
{
|
||||
mapInstance->OnCreatureEnterCombat(pCreature);
|
||||
}
|
||||
|
||||
if (m_isCreatureLinkingTrigger)
|
||||
{ GetMap()->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_AGGRO, pCreature, enemy); }
|
||||
{
|
||||
GetMap()->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_AGGRO, pCreature, enemy);
|
||||
}
|
||||
}
|
||||
|
||||
// Used by Eluna
|
||||
|
|
@ -8588,7 +8788,9 @@ void Unit::ClearInCombat()
|
|||
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT);
|
||||
|
||||
if (IsCharmed() || (GetTypeId() != TYPEID_PLAYER && ((Creature*)this)->IsPet()))
|
||||
{ RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT); }
|
||||
{
|
||||
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT);
|
||||
}
|
||||
|
||||
// Used by Eluna
|
||||
#ifdef ENABLE_ELUNA
|
||||
|
|
|
|||
|
|
@ -2779,7 +2779,9 @@ class Unit : public WorldObject
|
|||
ObjectGuid const& GetCharmerOrOwnerOrOwnGuid() const
|
||||
{
|
||||
if (ObjectGuid const& guid = GetCharmerOrOwnerGuid())
|
||||
{ return guid; }
|
||||
{
|
||||
return guid;
|
||||
}
|
||||
return GetObjectGuid();
|
||||
}
|
||||
/**
|
||||
|
|
@ -2839,7 +2841,9 @@ class Unit : public WorldObject
|
|||
Unit* GetCharmerOrOwnerOrSelf()
|
||||
{
|
||||
if (Unit* u = GetCharmerOrOwner())
|
||||
{ return u; }
|
||||
{
|
||||
return u;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
|
@ -3658,29 +3662,39 @@ void Unit::CallForAllControlledUnits(Func const& func, uint32 controlledMask)
|
|||
{
|
||||
if (controlledMask & CONTROLLED_PET)
|
||||
if (Pet* pet = GetPet())
|
||||
{ func(pet); }
|
||||
{
|
||||
func(pet);
|
||||
}
|
||||
|
||||
if (controlledMask & CONTROLLED_MINIPET)
|
||||
if (Pet* mini = GetMiniPet())
|
||||
{ func(mini); }
|
||||
{
|
||||
func(mini);
|
||||
}
|
||||
|
||||
if (controlledMask & CONTROLLED_GUARDIANS)
|
||||
{
|
||||
for (GuidSet::const_iterator itr = m_guardianPets.begin(); itr != m_guardianPets.end();)
|
||||
if (Pet* guardian = _GetPet(*(itr++)))
|
||||
{ func(guardian); }
|
||||
{
|
||||
func(guardian);
|
||||
}
|
||||
}
|
||||
|
||||
if (controlledMask & CONTROLLED_TOTEMS)
|
||||
{
|
||||
for (int i = 0; i < MAX_TOTEM_SLOT; ++i)
|
||||
if (Unit* totem = _GetTotem(TotemSlot(i)))
|
||||
{ func(totem); }
|
||||
{
|
||||
func(totem);
|
||||
}
|
||||
}
|
||||
|
||||
if (controlledMask & CONTROLLED_CHARM)
|
||||
if (Unit* charm = GetCharm())
|
||||
{ func(charm); }
|
||||
{
|
||||
func(charm);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -3690,19 +3704,25 @@ bool Unit::CheckAllControlledUnits(Func const& func, uint32 controlledMask) cons
|
|||
if (controlledMask & CONTROLLED_PET)
|
||||
if (Pet const* pet = GetPet())
|
||||
if (func(pet))
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (controlledMask & CONTROLLED_MINIPET)
|
||||
if (Pet const* mini = GetMiniPet())
|
||||
if (func(mini))
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (controlledMask & CONTROLLED_GUARDIANS)
|
||||
{
|
||||
for (GuidSet::const_iterator itr = m_guardianPets.begin(); itr != m_guardianPets.end();)
|
||||
if (Pet const* guardian = _GetPet(*(itr++)))
|
||||
if (func(guardian))
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (controlledMask & CONTROLLED_TOTEMS)
|
||||
|
|
@ -3710,13 +3730,17 @@ bool Unit::CheckAllControlledUnits(Func const& func, uint32 controlledMask) cons
|
|||
for (int i = 0; i < MAX_TOTEM_SLOT; ++i)
|
||||
if (Unit const* totem = _GetTotem(TotemSlot(i)))
|
||||
if (func(totem))
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (controlledMask & CONTROLLED_CHARM)
|
||||
if (Unit const* charm = GetCharm())
|
||||
if (func(charm))
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,9 @@ void OutdoorPvP::HandlePlayerLeaveZone(Player* player, bool isMainZone)
|
|||
{
|
||||
// remove the world state information from the player
|
||||
if (isMainZone && !player->GetSession()->PlayerLogout())
|
||||
{ SendRemoveWorldStates(player); }
|
||||
{
|
||||
SendRemoveWorldStates(player);
|
||||
}
|
||||
|
||||
sLog.outDebug("Player %s left an Outdoor PvP zone", player->GetName());
|
||||
}
|
||||
|
|
@ -71,10 +73,14 @@ void OutdoorPvP::SendUpdateWorldState(uint32 field, uint32 value)
|
|||
{
|
||||
// only send world state update to main zone
|
||||
if (!itr->second)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Player* player = sObjectMgr.GetPlayer(itr->first))
|
||||
{ player->SendUpdateWorldState(field, value); }
|
||||
{
|
||||
player->SendUpdateWorldState(field, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -117,23 +123,31 @@ void OutdoorPvP::HandlePlayerKill(Player* killer, Player* victim)
|
|||
Player* groupMember = itr->getSource();
|
||||
|
||||
if (!groupMember)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// skip if too far away
|
||||
if (!groupMember->IsAtGroupRewardDistance(victim))
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// creature kills must be notified, even if not inside objective / not outdoor pvp active
|
||||
// player kills only count if active and inside objective
|
||||
if (groupMember->CanUseCapturePoint())
|
||||
{ HandlePlayerKillInsideArea(groupMember); }
|
||||
{
|
||||
HandlePlayerKillInsideArea(groupMember);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// creature kills must be notified, even if not inside objective / not outdoor pvp active
|
||||
if (killer && killer->CanUseCapturePoint())
|
||||
{ HandlePlayerKillInsideArea(killer); }
|
||||
{
|
||||
HandlePlayerKillInsideArea(killer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -146,7 +160,9 @@ void OutdoorPvP::BuffTeam(Team team, uint32 spellId, bool remove /*= false*/)
|
|||
if (player && player->GetTeam() == team)
|
||||
{
|
||||
if (remove)
|
||||
{ player->RemoveAurasDueToSpell(spellId); }
|
||||
{
|
||||
player->RemoveAurasDueToSpell(spellId);
|
||||
}
|
||||
else
|
||||
{ player->CastSpell(player, spellId, true); }
|
||||
}
|
||||
|
|
@ -169,7 +185,9 @@ uint32 OutdoorPvP::GetBannerArtKit(Team team, uint32 artKitAlliance /*= CAPTURE_
|
|||
void OutdoorPvP::SetBannerVisual(const WorldObject* objRef, ObjectGuid goGuid, uint32 artKit, uint32 animId)
|
||||
{
|
||||
if (GameObject* go = objRef->GetMap()->GetGameObject(goGuid))
|
||||
{ SetBannerVisual(go, artKit, animId); }
|
||||
{
|
||||
SetBannerVisual(go, artKit, animId);
|
||||
}
|
||||
}
|
||||
|
||||
void OutdoorPvP::SetBannerVisual(GameObject* go, uint32 artKit, uint32 animId)
|
||||
|
|
@ -186,7 +204,9 @@ void OutdoorPvP::RespawnGO(const WorldObject* objRef, ObjectGuid goGuid, bool re
|
|||
go->SetRespawnTime(7 * DAY);
|
||||
|
||||
if (respawn)
|
||||
{ go->Refresh(); }
|
||||
{
|
||||
go->Refresh();
|
||||
}
|
||||
else if (go->isSpawned())
|
||||
{ go->SetLootState(GO_JUST_DEACTIVATED); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,11 +75,15 @@ void OutdoorPvPEP::HandlePlayerEnterZone(Player* player, bool isMainZone)
|
|||
{
|
||||
case ALLIANCE:
|
||||
if (m_towersAlliance > 0)
|
||||
{ player->CastSpell(player, plaguelandsTowerBuffs[m_towersAlliance - 1].spellIdAlliance, true); }
|
||||
{
|
||||
player->CastSpell(player, plaguelandsTowerBuffs[m_towersAlliance - 1].spellIdAlliance, true);
|
||||
}
|
||||
break;
|
||||
case HORDE:
|
||||
if (m_towersHorde > 0)
|
||||
{ player->CastSpell(player, plaguelandsTowerBuffs[m_towersHorde - 1].spellIdHorde, true); }
|
||||
{
|
||||
player->CastSpell(player, plaguelandsTowerBuffs[m_towersHorde - 1].spellIdHorde, true);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -134,7 +138,9 @@ void OutdoorPvPEP::HandleGameObjectCreate(GameObject* go)
|
|||
case GO_TOWER_BANNER:
|
||||
// sort banners
|
||||
if (go->IsWithinDist2d(plaguelandsTowerLocations[TOWER_ID_NORTHPASS][0], plaguelandsTowerLocations[TOWER_ID_NORTHPASS][1], 50.0f))
|
||||
{ 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))
|
||||
{ InitBanner(go, TOWER_ID_CROWNGUARD); }
|
||||
else if (go->IsWithinDist2d(plaguelandsTowerLocations[TOWER_ID_EASTWALL][0], plaguelandsTowerLocations[TOWER_ID_EASTWALL][1], 50.0f))
|
||||
|
|
@ -202,7 +208,9 @@ bool OutdoorPvPEP::HandleEvent(uint32 eventId, GameObject* go)
|
|||
if (plaguelandsTowerEvents[i][j].team != m_towerOwner[i])
|
||||
{
|
||||
if (plaguelandsTowerEvents[i][j].defenseMessage)
|
||||
{ sWorld.SendDefenseMessage(ZONE_ID_EASTERN_PLAGUELANDS, plaguelandsTowerEvents[i][j].defenseMessage); }
|
||||
{
|
||||
sWorld.SendDefenseMessage(ZONE_ID_EASTERN_PLAGUELANDS, plaguelandsTowerEvents[i][j].defenseMessage);
|
||||
}
|
||||
|
||||
return ProcessCaptureEvent(go, i, plaguelandsTowerEvents[i][j].team, plaguelandsTowerEvents[i][j].worldState);
|
||||
}
|
||||
|
|
@ -259,7 +267,9 @@ bool OutdoorPvPEP::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team
|
|||
SendUpdateWorldState(WORLD_STATE_EP_TOWER_COUNT_ALLIANCE, m_towersAlliance);
|
||||
|
||||
if (m_towersAlliance == 0)
|
||||
{ BuffTeam(ALLIANCE, plaguelandsTowerBuffs[0].spellIdAlliance, true); }
|
||||
{
|
||||
BuffTeam(ALLIANCE, plaguelandsTowerBuffs[0].spellIdAlliance, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -268,7 +278,9 @@ bool OutdoorPvPEP::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team
|
|||
SendUpdateWorldState(WORLD_STATE_EP_TOWER_COUNT_HORDE, m_towersHorde);
|
||||
|
||||
if (m_towersHorde == 0)
|
||||
{ BuffTeam(HORDE, plaguelandsTowerBuffs[0].spellIdHorde, true); }
|
||||
{
|
||||
BuffTeam(HORDE, plaguelandsTowerBuffs[0].spellIdHorde, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -291,7 +303,9 @@ bool OutdoorPvPEP::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team
|
|||
case TOWER_ID_EASTWALL:
|
||||
// Return false - allow the DB to handle summons
|
||||
if (m_towerOwner[TOWER_ID_NORTHPASS] != team)
|
||||
{ eventHandled = false; }
|
||||
{
|
||||
eventHandled = false;
|
||||
}
|
||||
break;
|
||||
case TOWER_ID_PLAGUEWOOD:
|
||||
// Return false - allow the DB to handle summons
|
||||
|
|
@ -335,7 +349,9 @@ bool OutdoorPvPEP::HandleGameObjectUse(Player* /*player*/, GameObject* go)
|
|||
{
|
||||
// prevent despawning after go use
|
||||
if (go->GetEntry() == GO_LORDAERON_SHRINE_ALLIANCE || go->GetEntry() == GO_LORDAERON_SHRINE_HORDE)
|
||||
{ go->SetRespawnTime(0); }
|
||||
{
|
||||
go->SetRespawnTime(0);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -350,7 +366,9 @@ void OutdoorPvPEP::InitBanner(GameObject* go, uint32 towerId)
|
|||
void OutdoorPvPEP::UnsummonFlightMaster(const WorldObject* objRef)
|
||||
{
|
||||
if (Creature* flightMaster = objRef->GetMap()->GetCreature(m_flightMaster))
|
||||
{ flightMaster->ForcedDespawn(); }
|
||||
{
|
||||
flightMaster->ForcedDespawn();
|
||||
}
|
||||
}
|
||||
|
||||
// Handle the unsummon of the soldiers when the Eastwall tower is lost
|
||||
|
|
@ -359,7 +377,9 @@ void OutdoorPvPEP::UnsummonSoldiers(const WorldObject* objRef)
|
|||
for (GuidList::const_iterator itr = m_soldiers.begin(); itr != m_soldiers.end(); ++itr)
|
||||
{
|
||||
if (Creature* soldier = objRef->GetMap()->GetCreature(*itr))
|
||||
{ soldier->ForcedDespawn(); }
|
||||
{
|
||||
soldier->ForcedDespawn();
|
||||
}
|
||||
}
|
||||
|
||||
m_soldiers.clear();
|
||||
|
|
|
|||
|
|
@ -139,7 +139,9 @@ OutdoorPvP* OutdoorPvPMgr::GetScriptOfAffectedZone(uint32 zoneId)
|
|||
void OutdoorPvPMgr::HandlePlayerEnterZone(Player* player, uint32 zoneId)
|
||||
{
|
||||
if (OutdoorPvP* script = GetScript(zoneId))
|
||||
{ script->HandlePlayerEnterZone(player, true); }
|
||||
{
|
||||
script->HandlePlayerEnterZone(player, true);
|
||||
}
|
||||
else if (OutdoorPvP* affectedScript = GetScriptOfAffectedZone(zoneId))
|
||||
affectedScript->HandlePlayerEnterZone(player, false);
|
||||
}
|
||||
|
|
@ -154,7 +156,9 @@ void OutdoorPvPMgr::HandlePlayerLeaveZone(Player* player, uint32 zoneId)
|
|||
{
|
||||
// teleport: called once from Player::CleanupsBeforeDelete, once from Player::UpdateZone
|
||||
if (OutdoorPvP* script = GetScript(zoneId))
|
||||
{ script->HandlePlayerLeaveZone(player, true); }
|
||||
{
|
||||
script->HandlePlayerLeaveZone(player, true);
|
||||
}
|
||||
else if (OutdoorPvP* affectedScript = GetScriptOfAffectedZone(zoneId))
|
||||
affectedScript->HandlePlayerLeaveZone(player, false);
|
||||
}
|
||||
|
|
@ -163,11 +167,15 @@ void OutdoorPvPMgr::Update(uint32 diff)
|
|||
{
|
||||
m_updateTimer.Update(diff);
|
||||
if (!m_updateTimer.Passed())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint8 i = 0; i < MAX_OPVP_ID; ++i)
|
||||
if (m_scripts[i])
|
||||
{ m_scripts[i]->Update(m_updateTimer.GetCurrent()); }
|
||||
{
|
||||
m_scripts[i]->Update(m_updateTimer.GetCurrent());
|
||||
}
|
||||
|
||||
m_updateTimer.Reset();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,9 @@ void OutdoorPvPSI::HandlePlayerEnterZone(Player* player, bool isMainZone)
|
|||
|
||||
// buff the player if same team is controlling the zone
|
||||
if (player->GetTeam() == m_zoneOwner)
|
||||
{ player->CastSpell(player, SPELL_CENARION_FAVOR, true); }
|
||||
{
|
||||
player->CastSpell(player, SPELL_CENARION_FAVOR, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove buffs when player leaves zone
|
||||
|
|
@ -72,13 +74,17 @@ void OutdoorPvPSI::HandlePlayerLeaveZone(Player* player, bool isMainZone)
|
|||
bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 triggerId)
|
||||
{
|
||||
if (player->isGameMaster() || player->IsDead())
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (triggerId)
|
||||
{
|
||||
case AREATRIGGER_SILITHUS_ALLIANCE:
|
||||
if (player->GetTeam() != ALLIANCE || !player->HasAura(SPELL_SILITHYST))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// update counter
|
||||
++ m_resourcesAlliance;
|
||||
|
|
@ -104,11 +110,15 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 triggerId)
|
|||
|
||||
// give quest credit if necessary
|
||||
if (player->GetQuestStatus(QUEST_SCOURING_DESERT_ALLIANCE) == QUEST_STATUS_INCOMPLETE)
|
||||
{ player->KilledMonsterCredit(NPC_SILITHUS_DUST_QUEST_ALLIANCE); }
|
||||
{
|
||||
player->KilledMonsterCredit(NPC_SILITHUS_DUST_QUEST_ALLIANCE);
|
||||
}
|
||||
break;
|
||||
case AREATRIGGER_SILITHUS_HORDE:
|
||||
if (player->GetTeam() != HORDE || !player->HasAura(SPELL_SILITHYST))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// update counter
|
||||
++ m_resourcesHorde;
|
||||
|
|
@ -134,7 +144,9 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 triggerId)
|
|||
|
||||
// give quest credit if necessary
|
||||
if (player->GetQuestStatus(QUEST_SCOURING_DESERT_HORDE) == QUEST_STATUS_INCOMPLETE)
|
||||
{ player->KilledMonsterCredit(NPC_SILITHUS_DUST_QUEST_HORDE); }
|
||||
{
|
||||
player->KilledMonsterCredit(NPC_SILITHUS_DUST_QUEST_HORDE);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
|
|
@ -167,7 +179,9 @@ static SilithusSpawnLocation silithusFlagDropLocations[2] =
|
|||
bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId)
|
||||
{
|
||||
if (spellId != SPELL_SILITHYST)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// don't drop flag at area trigger
|
||||
// we are checking distance from the AT hard-coded coordinates because it's much faster than checking the area trigger store
|
||||
|
|
@ -175,11 +189,15 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId)
|
|||
{
|
||||
case ALLIANCE:
|
||||
if (player->IsWithinDist3d(silithusFlagDropLocations[0].x, silithusFlagDropLocations[0].y, silithusFlagDropLocations[0].z, 5.0f))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case HORDE:
|
||||
if (player->IsWithinDist3d(silithusFlagDropLocations[1].x, silithusFlagDropLocations[1].y, silithusFlagDropLocations[1].z, 5.0f))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -40,18 +40,26 @@ float ThreatCalcHelper::CalcThreat(Unit* pHatedUnit, Unit* /*pHatingUnit*/, floa
|
|||
{
|
||||
// all flat mods applied early
|
||||
if (!threat)
|
||||
{ return 0.0f; }
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
if (pThreatSpell)
|
||||
{
|
||||
if (pThreatSpell->HasAttribute(SPELL_ATTR_EX_NO_THREAT))
|
||||
{ return 0.0f; }
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
if (Player* modOwner = pHatedUnit->GetSpellModOwner())
|
||||
{ modOwner->ApplySpellMod(pThreatSpell->Id, SPELLMOD_THREAT, threat); }
|
||||
{
|
||||
modOwner->ApplySpellMod(pThreatSpell->Id, SPELLMOD_THREAT, threat);
|
||||
}
|
||||
|
||||
if (crit)
|
||||
{ threat *= pHatedUnit->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CRITICAL_THREAT, schoolMask); }
|
||||
{
|
||||
threat *= pHatedUnit->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CRITICAL_THREAT, schoolMask);
|
||||
}
|
||||
}
|
||||
|
||||
threat = pHatedUnit->ApplyTotalThreatModifier(threat, schoolMask);
|
||||
|
|
@ -100,7 +108,9 @@ void HostileReference::sourceObjectDestroyLink()
|
|||
void HostileReference::fireStatusChanged(ThreatRefStatusChangeEvent& pThreatRefStatusChangeEvent)
|
||||
{
|
||||
if (getSource())
|
||||
{ getSource()->processThreatEvent(&pThreatRefStatusChangeEvent); }
|
||||
{
|
||||
getSource()->processThreatEvent(&pThreatRefStatusChangeEvent);
|
||||
}
|
||||
}
|
||||
|
||||
//============================================================
|
||||
|
|
@ -114,7 +124,9 @@ void HostileReference::addThreat(float pMod)
|
|||
// the threat is changed. Source and target unit have to be availabe
|
||||
// if the link was cut before relink it again
|
||||
if (!isOnline())
|
||||
{ updateOnlineStatus(); }
|
||||
{
|
||||
updateOnlineStatus();
|
||||
}
|
||||
if (pMod != 0.0f)
|
||||
{
|
||||
ThreatRefStatusChangeEvent event(UEV_THREAT_REF_THREAT_CHANGE, this, pMod);
|
||||
|
|
@ -140,7 +152,9 @@ void HostileReference::updateOnlineStatus()
|
|||
if (!isValid())
|
||||
{
|
||||
if (Unit* target = ObjectAccessor::GetUnit(*getSourceUnit(), getUnitGuid()))
|
||||
{ link(target, getSource()); }
|
||||
{
|
||||
link(target, getSource());
|
||||
}
|
||||
}
|
||||
// only check for online status if
|
||||
// ref is valid
|
||||
|
|
@ -251,7 +265,9 @@ HostileReference* ThreatContainer::addThreat(Unit* pVictim, float pThreat)
|
|||
{
|
||||
HostileReference* ref = getReferenceByTarget(pVictim);
|
||||
if (ref)
|
||||
{ ref->addThreat(pThreat); }
|
||||
{
|
||||
ref->addThreat(pThreat);
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
||||
|
|
@ -318,7 +334,9 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* pAttacker, Hostile
|
|||
if (!onlySecondChoiceTargetsFound && pAttacker->IsSecondChoiceTarget(pTarget, pCurrentRef == pCurrentVictim))
|
||||
{
|
||||
if (iter != lastRef)
|
||||
{ ++iter; }
|
||||
{
|
||||
++iter;
|
||||
}
|
||||
else
|
||||
{
|
||||
// if we reached to this point, everyone in the threatlist is a second choice target. In such a situation the target with the highest threat should be attacked.
|
||||
|
|
@ -328,7 +346,9 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* pAttacker, Hostile
|
|||
|
||||
// current victim is a second choice target, so don't compare threat with it below
|
||||
if (pCurrentRef == pCurrentVictim)
|
||||
{ pCurrentVictim = NULL; }
|
||||
{
|
||||
pCurrentVictim = NULL;
|
||||
}
|
||||
|
||||
// second choice targets are only handled threat dependend if we have only have second choice targets
|
||||
continue;
|
||||
|
|
@ -385,7 +405,9 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* pAttacker, Hostile
|
|||
++iter;
|
||||
}
|
||||
if (!found)
|
||||
{ pCurrentRef = NULL; }
|
||||
{
|
||||
pCurrentRef = NULL;
|
||||
}
|
||||
|
||||
return pCurrentRef;
|
||||
}
|
||||
|
|
@ -421,15 +443,21 @@ void ThreatManager::addThreat(Unit* pVictim, float pThreat, bool crit, SpellScho
|
|||
|
||||
// not to self
|
||||
if (pVictim == getOwner())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// not to GM
|
||||
if (!pVictim || (pVictim->GetTypeId() == TYPEID_PLAYER && ((Player*)pVictim)->isGameMaster()))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// not to dead and not for dead
|
||||
if (!pVictim->IsAlive() || !getOwner()->IsAlive())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MANGOS_ASSERT(getOwner()->GetTypeId() == TYPEID_UNIT);
|
||||
|
||||
|
|
@ -588,7 +616,9 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat
|
|||
else
|
||||
{
|
||||
if (getCurrentVictim() && hostileReference->getThreat() > (1.1f * getCurrentVictim()->getThreat()))
|
||||
{ setDirty(true); }
|
||||
{
|
||||
setDirty(true);
|
||||
}
|
||||
iThreatContainer.addReference(hostileReference);
|
||||
iUpdateNeed = true;
|
||||
iThreatOfflineContainer.remove(hostileReference);
|
||||
|
|
|
|||
|
|
@ -260,7 +260,9 @@ bool IsAcceptableClientBuild(uint32 build)
|
|||
int accepted_versions[] = EXPECTED_MANGOSD_CLIENT_BUILD;
|
||||
for (int i = 0; accepted_versions[i]; ++i)
|
||||
if (int(build) == accepted_versions[i])
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -237,7 +237,9 @@ inline SpellSchools GetFirstSchoolInMask(SpellSchoolMask mask)
|
|||
{
|
||||
for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
|
||||
if (mask & (1 << i))
|
||||
{ return SpellSchools(i); }
|
||||
{
|
||||
return SpellSchools(i);
|
||||
}
|
||||
|
||||
return SPELL_SCHOOL_NORMAL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,12 +65,16 @@ static bool MapSessionFilterHelper(WorldSession* session, OpcodeHandler const& o
|
|||
{
|
||||
// we do not process thread-unsafe packets
|
||||
if (opHandle.packetProcessing == PROCESS_THREADUNSAFE)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// we do not process not loggined player packets
|
||||
Player* plr = session->GetPlayer();
|
||||
if (!plr)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// in Map::Update() we do not process packets where player is not in world!
|
||||
return plr->IsInWorld();
|
||||
|
|
@ -81,7 +85,9 @@ bool MapSessionFilter::Process(WorldPacket* packet)
|
|||
{
|
||||
OpcodeHandler const& opHandle = opcodeTable[packet->GetOpcode()];
|
||||
if (opHandle.packetProcessing == PROCESS_INPLACE)
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// let's check if our opcode can be really processed in Map::Update()
|
||||
return MapSessionFilterHelper(m_pSession, opHandle);
|
||||
|
|
@ -94,7 +100,9 @@ bool WorldSessionFilter::Process(WorldPacket* packet)
|
|||
OpcodeHandler const& opHandle = opcodeTable[packet->GetOpcode()];
|
||||
// check if packet handler is supposed to be safe
|
||||
if (opHandle.packetProcessing == PROCESS_INPLACE)
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// let's check if our opcode can't be processed in Map::Update()
|
||||
return !MapSessionFilterHelper(m_pSession, opHandle);
|
||||
|
|
@ -119,7 +127,9 @@ WorldSession::~WorldSession()
|
|||
{
|
||||
///- unload player if not unloaded
|
||||
if (_player)
|
||||
{ LogoutPlayer(true); }
|
||||
{
|
||||
LogoutPlayer(true);
|
||||
}
|
||||
|
||||
/// - If have unclosed socket, close it
|
||||
if (m_Socket)
|
||||
|
|
@ -165,7 +175,9 @@ void WorldSession::SendPacket(WorldPacket const* packet)
|
|||
#endif
|
||||
|
||||
if (!m_Socket)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (opcodeTable[packet->GetOpcode()].status == STATUS_UNHANDLED)
|
||||
{
|
||||
|
|
@ -212,7 +224,9 @@ void WorldSession::SendPacket(WorldPacket const* packet)
|
|||
#endif // !MANGOS_DEBUG
|
||||
|
||||
if (m_Socket->SendPacket(*packet) == -1)
|
||||
{ m_Socket->CloseSocket(); }
|
||||
{
|
||||
m_Socket->CloseSocket();
|
||||
}
|
||||
}
|
||||
|
||||
/// Add an incoming packet to the queue
|
||||
|
|
@ -263,7 +277,9 @@ bool WorldSession::Update(PacketFilter& updater)
|
|||
{
|
||||
// skip STATUS_LOGGEDIN opcode unexpected errors if player logout sometime ago - this can be network lag delayed packets
|
||||
if (!m_playerRecentlyLogout)
|
||||
{ LogUnexpectedOpcode(packet, "the player has not logged in yet"); }
|
||||
{
|
||||
LogUnexpectedOpcode(packet, "the player has not logged in yet");
|
||||
}
|
||||
}
|
||||
else if (_player->IsInWorld())
|
||||
{ ExecuteOpcode(opHandle, packet); }
|
||||
|
|
@ -286,7 +302,9 @@ bool WorldSession::Update(PacketFilter& updater)
|
|||
break;
|
||||
case STATUS_TRANSFER:
|
||||
if (!_player)
|
||||
{ LogUnexpectedOpcode(packet, "the player has not logged in yet"); }
|
||||
{
|
||||
LogUnexpectedOpcode(packet, "the player has not logged in yet");
|
||||
}
|
||||
else if (_player->IsInWorld())
|
||||
{ LogUnexpectedOpcode(packet, "the player is still in world"); }
|
||||
else
|
||||
|
|
@ -369,7 +387,9 @@ bool WorldSession::Update(PacketFilter& updater)
|
|||
///- If necessary, log the player out
|
||||
time_t currTime = time(NULL);
|
||||
if (!m_Socket || (ShouldLogOut(currTime) && !m_playerLoading))
|
||||
{ LogoutPlayer(true); }
|
||||
{
|
||||
LogoutPlayer(true);
|
||||
}
|
||||
// WARDEN ISSUE - commented out to stop crash
|
||||
// if (m_Socket && GetPlayer() && _warden)
|
||||
// _warden->Update();
|
||||
|
|
@ -414,7 +434,9 @@ void WorldSession::LogoutPlayer(bool Save)
|
|||
sLog.outChar("Account: %d (IP: %s) Logout Character:[%s] (guid: %u)", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName() , _player->GetGUIDLow());
|
||||
|
||||
if (ObjectGuid lootGuid = GetPlayer()->GetLootGuid())
|
||||
{ DoLootRelease(lootGuid); }
|
||||
{
|
||||
DoLootRelease(lootGuid);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_PLAYERBOTS
|
||||
if (_player->GetPlayerbotMgr())
|
||||
|
|
@ -444,7 +466,9 @@ void WorldSession::LogoutPlayer(bool Save)
|
|||
if (owner)
|
||||
{
|
||||
if (owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{ aset.insert((Player*)owner); }
|
||||
{
|
||||
aset.insert((Player*)owner);
|
||||
}
|
||||
}
|
||||
else if ((*itr)->GetTypeId() == TYPEID_PLAYER)
|
||||
{ aset.insert((Player*)(*itr)); }
|
||||
|
|
@ -463,7 +487,9 @@ void WorldSession::LogoutPlayer(bool Save)
|
|||
// this can't be called for all attackers.
|
||||
if (!aset.empty())
|
||||
if (BattleGround* bg = _player->GetBattleGround())
|
||||
{ bg->HandleKillPlayer(_player, *aset.begin()); }
|
||||
{
|
||||
bg->HandleKillPlayer(_player, *aset.begin());
|
||||
}
|
||||
}
|
||||
else if (_player->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||
{
|
||||
|
|
@ -476,7 +502,9 @@ void WorldSession::LogoutPlayer(bool Save)
|
|||
}
|
||||
// drop a flag if player is carrying it
|
||||
if (BattleGround* bg = _player->GetBattleGround())
|
||||
{ bg->EventPlayerLoggedOut(_player); }
|
||||
{
|
||||
bg->EventPlayerLoggedOut(_player);
|
||||
}
|
||||
|
||||
///- Teleport to home if the player is in an invalid instance
|
||||
if (!_player->m_InstanceValid && !_player->isGameMaster())
|
||||
|
|
@ -538,7 +566,9 @@ void WorldSession::LogoutPlayer(bool Save)
|
|||
///- empty buyback items and save the player in the database
|
||||
// some save parts only correctly work in case player present in map/player_lists (pets, etc)
|
||||
if (Save)
|
||||
{ _player->SaveToDB(); }
|
||||
{
|
||||
_player->SaveToDB();
|
||||
}
|
||||
|
||||
///- Leave all channels before player delete...
|
||||
_player->CleanupChannels();
|
||||
|
|
@ -549,11 +579,15 @@ void WorldSession::LogoutPlayer(bool Save)
|
|||
// remove player from the group if he is:
|
||||
// a) in group; b) not in raid group; c) logging out normally (not being kicked or disconnected)
|
||||
if (_player->GetGroup() && !_player->GetGroup()->isRaidGroup() && m_Socket)
|
||||
{ _player->RemoveFromGroup(); }
|
||||
{
|
||||
_player->RemoveFromGroup();
|
||||
}
|
||||
#endif
|
||||
///- Send update to group
|
||||
if (_player->GetGroup())
|
||||
{ _player->GetGroup()->SendUpdate(); }
|
||||
{
|
||||
_player->GetGroup()->SendUpdate();
|
||||
}
|
||||
|
||||
///- Broadcast a logout message to the player's friends
|
||||
sSocialMgr.SendFriendStatus(_player, FRIEND_OFFLINE, _player->GetObjectGuid(), true);
|
||||
|
|
@ -613,7 +647,9 @@ void WorldSession::LogoutPlayer(bool Save)
|
|||
void WorldSession::KickPlayer()
|
||||
{
|
||||
if (m_Socket)
|
||||
{ m_Socket->CloseSocket(); }
|
||||
{
|
||||
m_Socket->CloseSocket();
|
||||
}
|
||||
}
|
||||
|
||||
/// Cancel channeling handler
|
||||
|
|
@ -1152,7 +1188,9 @@ void WorldSession::ExecuteOpcode(OpcodeHandler const& opHandle, WorldPacket* pac
|
|||
// need prevent do internal far teleports in handlers because some handlers do lot steps
|
||||
// or call code that can do far teleports in some conditions unexpectedly for generic way work code
|
||||
if (_player)
|
||||
{ _player->SetCanDelayTeleport(true); }
|
||||
{
|
||||
_player->SetCanDelayTeleport(true);
|
||||
}
|
||||
|
||||
(this->*opHandle.handler)(*packet);
|
||||
|
||||
|
|
@ -1164,11 +1202,15 @@ void WorldSession::ExecuteOpcode(OpcodeHandler const& opHandle, WorldPacket* pac
|
|||
// we should execute delayed teleports only for alive(!) players
|
||||
// because we don't want player's ghost teleported from graveyard
|
||||
if (_player->IsHasDelayedTeleport())
|
||||
{ _player->TeleportTo(_player->m_teleport_dest, _player->m_teleport_options); }
|
||||
{
|
||||
_player->TeleportTo(_player->m_teleport_dest, _player->m_teleport_options);
|
||||
}
|
||||
}
|
||||
|
||||
if (packet->rpos() < packet->wpos() && sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG))
|
||||
{ LogUnprocessedTail(packet); }
|
||||
{
|
||||
LogUnprocessedTail(packet);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::InitWarden(uint16 build, BigNumber* k, std::string const& os)
|
||||
|
|
@ -1185,4 +1227,4 @@ void WorldSession::InitWarden(uint16 build, BigNumber* k, std::string const& os)
|
|||
_warden = new WardenMac();
|
||||
_warden->Init(this, k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -400,7 +400,9 @@ class WorldSession
|
|||
{
|
||||
m_Tutorials[intId] = value;
|
||||
if (m_tutorialState == TUTORIALDATA_UNCHANGED)
|
||||
{ m_tutorialState = TUTORIALDATA_CHANGED; }
|
||||
{
|
||||
m_tutorialState = TUTORIALDATA_CHANGED;
|
||||
}
|
||||
}
|
||||
}
|
||||
// used with item_page table
|
||||
|
|
|
|||
|
|
@ -129,7 +129,9 @@ WorldSocket::~WorldSocket(void)
|
|||
delete m_RecvWPct;
|
||||
|
||||
if (m_OutBuffer)
|
||||
{ m_OutBuffer->release(); }
|
||||
{
|
||||
m_OutBuffer->release();
|
||||
}
|
||||
|
||||
closing_ = true;
|
||||
|
||||
|
|
@ -147,7 +149,9 @@ void WorldSocket::CloseSocket(void)
|
|||
ACE_GUARD(LockType, Guard, m_OutBufferLock);
|
||||
|
||||
if (closing_)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
closing_ = true;
|
||||
peer().close_writer();
|
||||
|
|
@ -170,7 +174,9 @@ int WorldSocket::SendPacket(const WorldPacket& pct)
|
|||
ACE_GUARD_RETURN(LockType, Guard, m_OutBufferLock, -1);
|
||||
|
||||
if (closing_)
|
||||
{ return -1; }
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Dump outgoing packet.
|
||||
sLog.outWorldPacketDump(uint32(get_handle()), pct.GetOpcode(), pct.GetOpcodeName(), &pct, false);
|
||||
|
|
@ -232,7 +238,9 @@ int WorldSocket::open(void* a)
|
|||
|
||||
// Prevent double call to this func.
|
||||
if (m_OutBuffer)
|
||||
{ return -1; }
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
// This will also prevent the socket from being Updated
|
||||
// while we are initializing it.
|
||||
|
|
@ -240,7 +248,9 @@ int WorldSocket::open(void* a)
|
|||
|
||||
// Hook for the manager.
|
||||
if (sWorldSocketMgr->OnSocketOpen(this) == -1)
|
||||
{ return -1; }
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Allocate the buffer.
|
||||
ACE_NEW_RETURN(m_OutBuffer, ACE_Message_Block(m_OutBufferSize), -1);
|
||||
|
|
@ -273,7 +283,9 @@ int WorldSocket::open(void* a)
|
|||
packet << uint8(1);
|
||||
|
||||
if (SendPacket(packet) == -1)
|
||||
{ return -1; }
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Register with ACE Reactor
|
||||
if (reactor()->register_handler(this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK) == -1)
|
||||
|
|
@ -309,7 +321,9 @@ int WorldSocket::close(int)
|
|||
int WorldSocket::handle_input(ACE_HANDLE)
|
||||
{
|
||||
if (closing_)
|
||||
{ return -1; }
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (handle_input_missing_data())
|
||||
{
|
||||
|
|
@ -347,7 +361,9 @@ int WorldSocket::handle_output(ACE_HANDLE)
|
|||
ACE_GUARD_RETURN(LockType, Guard, m_OutBufferLock, -1);
|
||||
|
||||
if (closing_)
|
||||
{ return -1; }
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
const size_t send_len = m_OutBuffer->length();
|
||||
|
||||
|
|
@ -361,11 +377,15 @@ int WorldSocket::handle_output(ACE_HANDLE)
|
|||
#endif // MSG_NOSIGNAL
|
||||
|
||||
if (n == 0)
|
||||
{ return -1; }
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else if (n == -1)
|
||||
{
|
||||
if (errno == EWOULDBLOCK || errno == EAGAIN)
|
||||
{ return schedule_wakeup_output(Guard); }
|
||||
{
|
||||
return schedule_wakeup_output(Guard);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -458,7 +478,9 @@ int WorldSocket::handle_close(ACE_HANDLE h, ACE_Reactor_Mask)
|
|||
closing_ = true;
|
||||
|
||||
if (h == ACE_INVALID_HANDLE)
|
||||
{ peer().close_writer(); }
|
||||
{
|
||||
peer().close_writer();
|
||||
}
|
||||
}
|
||||
|
||||
// Critical section
|
||||
|
|
@ -475,10 +497,14 @@ int WorldSocket::handle_close(ACE_HANDLE h, ACE_Reactor_Mask)
|
|||
int WorldSocket::Update(void)
|
||||
{
|
||||
if (closing_)
|
||||
{ return -1; }
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (m_OutActive || (m_OutBuffer->length() == 0 && msg_queue()->is_empty()))
|
||||
{ return 0; }
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ret;
|
||||
do
|
||||
|
|
@ -545,7 +571,9 @@ int WorldSocket::handle_input_payload(void)
|
|||
m_Header.reset();
|
||||
|
||||
if (ret == -1)
|
||||
{ errno = EINVAL; }
|
||||
{
|
||||
errno = EINVAL;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -572,7 +600,9 @@ int WorldSocket::handle_input_missing_data(void)
|
|||
recv_size);
|
||||
|
||||
if (n <= 0)
|
||||
{ return (int)n; }
|
||||
{
|
||||
return (int)n;
|
||||
}
|
||||
|
||||
message_block.wr_ptr(n);
|
||||
|
||||
|
|
@ -642,7 +672,9 @@ int WorldSocket::handle_input_missing_data(void)
|
|||
int WorldSocket::cancel_wakeup_output(GuardType& g)
|
||||
{
|
||||
if (!m_OutActive)
|
||||
{ return 0; }
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
m_OutActive = false;
|
||||
|
||||
|
|
@ -662,7 +694,9 @@ int WorldSocket::cancel_wakeup_output(GuardType& g)
|
|||
int WorldSocket::schedule_wakeup_output(GuardType& g)
|
||||
{
|
||||
if (m_OutActive)
|
||||
{ return 0; }
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
m_OutActive = true;
|
||||
|
||||
|
|
@ -688,7 +722,9 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct)
|
|||
const ACE_UINT16 opcode = new_pct->GetOpcode();
|
||||
|
||||
if (closing_)
|
||||
{ return -1; }
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Dump received packet.
|
||||
sLog.outWorldPacketDump(uint32(get_handle()), new_pct->GetOpcode(), new_pct->GetOpcodeName(), new_pct, true);
|
||||
|
|
@ -917,7 +953,9 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
|||
id = fields[0].GetUInt32();
|
||||
security = fields[1].GetUInt16();
|
||||
if (security > SEC_ADMINISTRATOR) // prevent invalid security settings in DB
|
||||
{ security = SEC_ADMINISTRATOR; }
|
||||
{
|
||||
security = SEC_ADMINISTRATOR;
|
||||
}
|
||||
|
||||
K.SetHexStr(fields[2].GetString());
|
||||
|
||||
|
|
@ -925,7 +963,9 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
|||
|
||||
locale = LocaleConstant(fields[9].GetUInt8());
|
||||
if (locale >= MAX_LOCALE)
|
||||
{ locale = LOCALE_enUS; }
|
||||
{
|
||||
locale = LOCALE_enUS;
|
||||
}
|
||||
|
||||
delete result;
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,9 @@ int WorldSocketMgr::svc()
|
|||
{
|
||||
ACE_Time_Value interval(0, 10000);
|
||||
if (reactor_->run_reactor_event_loop(interval) == -1)
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
for (i = sockets_->begin(); i != sockets_->end();)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -33,14 +33,18 @@ void CharacterDatabaseCleaner::CleanDatabase()
|
|||
{
|
||||
// config to disable
|
||||
if (!sWorld.getConfig(CONFIG_BOOL_CLEAN_CHARACTER_DB))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
sLog.outString("Cleaning character database...");
|
||||
|
||||
// check flags which clean ups are necessary
|
||||
QueryResult* result = CharacterDatabase.PQuery("SELECT cleaning_flags FROM saved_variables");
|
||||
if (!result)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
uint32 flags = (*result)[0].GetUInt32();
|
||||
delete result;
|
||||
|
||||
|
|
@ -48,9 +52,13 @@ void CharacterDatabaseCleaner::CleanDatabase()
|
|||
if (flags & CLEANING_FLAG_ACHIEVEMENT_PROGRESS)
|
||||
CleanCharacterAchievementProgress();
|
||||
if (flags & CLEANING_FLAG_SKILLS)
|
||||
{ CleanCharacterSkills(); }
|
||||
{
|
||||
CleanCharacterSkills();
|
||||
}
|
||||
if (flags & CLEANING_FLAG_SPELLS)
|
||||
{ CleanCharacterSpell(); }
|
||||
{
|
||||
CleanCharacterSpell();
|
||||
}
|
||||
if (flags & CLEANING_FLAG_TALENTS)
|
||||
CleanCharacterTalent();
|
||||
CharacterDatabase.Execute("UPDATE saved_variables SET cleaning_flags = 0");
|
||||
|
|
|
|||
|
|
@ -80,7 +80,9 @@ static bool findtoknth(std::string& str, int n, std::string::size_type& s, std::
|
|||
std::string::size_type size = str.size();
|
||||
for (i = 1; s < size && i < n; ++s) if (str[s] == ' ') { ++i; }
|
||||
if (i < n)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
e = str.find(' ', s);
|
||||
|
||||
|
|
@ -91,7 +93,9 @@ std::string gettoknth(std::string& str, int n)
|
|||
{
|
||||
std::string::size_type s = 0, e = 0;
|
||||
if (!findtoknth(str, n, s, e))
|
||||
{ return ""; }
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
return str.substr(s, e - s);
|
||||
}
|
||||
|
|
@ -100,13 +104,17 @@ bool findnth(std::string& str, int n, std::string::size_type& s, std::string::si
|
|||
{
|
||||
s = str.find("VALUES ('") + 9;
|
||||
if (s == std::string::npos)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
e = str.find("'", s);
|
||||
if (e == std::string::npos)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
while (str[e - 1] == '\\');
|
||||
|
||||
|
|
@ -117,7 +125,9 @@ bool findnth(std::string& str, int n, std::string::size_type& s, std::string::si
|
|||
s = e + 4;
|
||||
e = str.find("'", s);
|
||||
if (e == std::string::npos)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
while (str[e - 1] == '\\');
|
||||
}
|
||||
|
|
@ -129,7 +139,9 @@ std::string gettablename(std::string& str)
|
|||
std::string::size_type s = 13;
|
||||
std::string::size_type e = str.find(_TABLE_SIM_, s);
|
||||
if (e == std::string::npos)
|
||||
{ return ""; }
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
return str.substr(s, e - s);
|
||||
}
|
||||
|
|
@ -138,12 +150,16 @@ bool changenth(std::string& str, int n, const char* with, bool insert = false, b
|
|||
{
|
||||
std::string::size_type s, e;
|
||||
if (!findnth(str, n, s, e))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (nonzero && str.substr(s, e - s) == "0")
|
||||
{ return true; } // not an error
|
||||
if (!insert)
|
||||
{ str.replace(s, e - s, with); }
|
||||
{
|
||||
str.replace(s, e - s, with);
|
||||
}
|
||||
else
|
||||
{ str.insert(s, with); }
|
||||
|
||||
|
|
@ -154,7 +170,9 @@ std::string getnth(std::string& str, int n)
|
|||
{
|
||||
std::string::size_type s, e;
|
||||
if (!findnth(str, n, s, e))
|
||||
{ return ""; }
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
return str.substr(s, e - s);
|
||||
}
|
||||
|
|
@ -163,11 +181,15 @@ bool changetoknth(std::string& str, int n, const char* with, bool insert = false
|
|||
{
|
||||
std::string::size_type s = 0, e = 0;
|
||||
if (!findtoknth(str, n, s, e))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (nonzero && str.substr(s, e - s) == "0")
|
||||
{ return true; } // not an error
|
||||
if (!insert)
|
||||
{ str.replace(s, e - s, with); }
|
||||
{
|
||||
str.replace(s, e - s, with);
|
||||
}
|
||||
else
|
||||
{ str.insert(s, with); }
|
||||
|
||||
|
|
@ -178,7 +200,9 @@ uint32 registerNewGuid(uint32 oldGuid, std::map<uint32, uint32>& guidMap, uint32
|
|||
{
|
||||
std::map<uint32, uint32>::const_iterator itr = guidMap.find(oldGuid);
|
||||
if (itr != guidMap.end())
|
||||
{ return itr->second; }
|
||||
{
|
||||
return itr->second;
|
||||
}
|
||||
|
||||
uint32 newguid = hiGuid + guidMap.size();
|
||||
guidMap[oldGuid] = newguid;
|
||||
|
|
@ -214,7 +238,9 @@ bool changetokGuid(std::string& str, int n, std::map<uint32, uint32>& guidMap, u
|
|||
std::string CreateDumpString(char const* tableName, QueryResult* result)
|
||||
{
|
||||
if (!tableName || !result)
|
||||
{ return ""; }
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
std::ostringstream ss;
|
||||
ss << "INSERT INTO " << _TABLE_SIM_ << tableName << _TABLE_SIM_ << " VALUES (";
|
||||
|
|
@ -222,10 +248,14 @@ std::string CreateDumpString(char const* tableName, QueryResult* result)
|
|||
for (uint32 i = 0; i < result->GetFieldCount(); ++i)
|
||||
{
|
||||
if (i != 0)
|
||||
{ ss << ", "; }
|
||||
{
|
||||
ss << ", ";
|
||||
}
|
||||
|
||||
if (fields[i].IsNULL())
|
||||
{ ss << "NULL"; }
|
||||
{
|
||||
ss << "NULL";
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string s = fields[i].GetCppString();
|
||||
|
|
@ -261,7 +291,9 @@ std::string PlayerDumpWriter::GenerateWhereStr(char const* field, GUIDs const& g
|
|||
|
||||
GUIDs::const_iterator itr2 = itr;
|
||||
if (++itr2 != guids.end())
|
||||
{ wherestr << "','"; }
|
||||
{
|
||||
wherestr << "','";
|
||||
}
|
||||
}
|
||||
wherestr << "')";
|
||||
return wherestr.str();
|
||||
|
|
@ -272,7 +304,9 @@ void StoreGUID(QueryResult* result, uint32 field, std::set<uint32>& guids)
|
|||
Field* fields = result->Fetch();
|
||||
uint32 guid = fields[field].GetUInt32();
|
||||
if (guid)
|
||||
{ guids.insert(guid); }
|
||||
{
|
||||
guids.insert(guid);
|
||||
}
|
||||
}
|
||||
|
||||
void StoreGUID(QueryResult* result, uint32 data, uint32 field, std::set<uint32>& guids)
|
||||
|
|
@ -281,7 +315,9 @@ void StoreGUID(QueryResult* result, uint32 data, uint32 field, std::set<uint32>&
|
|||
std::string dataStr = fields[data].GetCppString();
|
||||
uint32 guid = atoi(gettoknth(dataStr, field).c_str());
|
||||
if (guid)
|
||||
{ guids.insert(guid); }
|
||||
{
|
||||
guids.insert(guid);
|
||||
}
|
||||
}
|
||||
|
||||
// Writing - High-level functions
|
||||
|
|
@ -310,20 +346,26 @@ void PlayerDumpWriter::DumpTableContent(std::string& dump, uint32 guid, char con
|
|||
// setup for guids case start position
|
||||
GUIDs::const_iterator guids_itr;
|
||||
if (guids)
|
||||
{ guids_itr = guids->begin(); }
|
||||
{
|
||||
guids_itr = guids->begin();
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
std::string wherestr;
|
||||
|
||||
if (guids) // set case, get next guids string
|
||||
{ wherestr = GenerateWhereStr(fieldname, *guids, guids_itr); }
|
||||
{
|
||||
wherestr = GenerateWhereStr(fieldname, *guids, guids_itr);
|
||||
}
|
||||
else // not set case, get single guid string
|
||||
{ wherestr = GenerateWhereStr(fieldname, guid); }
|
||||
|
||||
QueryResult* result = CharacterDatabase.PQuery("SELECT * FROM %s WHERE %s", tableFrom, wherestr.c_str());
|
||||
if (!result)
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
|
|
@ -399,7 +441,9 @@ DumpReturn PlayerDumpWriter::WriteDump(const std::string& file, uint32 guid)
|
|||
{
|
||||
FILE* fout = fopen(file.c_str(), "w");
|
||||
if (!fout)
|
||||
{ return DUMP_FILE_OPEN_ERROR; }
|
||||
{
|
||||
return DUMP_FILE_OPEN_ERROR;
|
||||
}
|
||||
|
||||
std::string dump = GetDump(guid);
|
||||
|
||||
|
|
@ -418,11 +462,15 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
|||
// check character count
|
||||
uint32 charcount = sAccountMgr.GetCharactersCount(account);
|
||||
if (charcount >= 10)
|
||||
{ return DUMP_TOO_MANY_CHARS; }
|
||||
{
|
||||
return DUMP_TOO_MANY_CHARS;
|
||||
}
|
||||
|
||||
FILE* fin = fopen(file.c_str(), "r");
|
||||
if (!fin)
|
||||
{ return DUMP_FILE_OPEN_ERROR; }
|
||||
{
|
||||
return DUMP_FILE_OPEN_ERROR;
|
||||
}
|
||||
|
||||
QueryResult* result = NULL;
|
||||
char newguid[20], chraccount[20], newpetid[20], currpetid[20], lastpetid[20];
|
||||
|
|
@ -489,17 +537,23 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
|||
// skip empty strings
|
||||
size_t nw_pos = line.find_first_not_of(" \t\n\r\7");
|
||||
if (nw_pos == std::string::npos)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// skip NOTE
|
||||
if (line.substr(nw_pos, 15) == "IMPORTANT NOTE:")
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// add required_ check
|
||||
if (line.substr(nw_pos, 41) == "UPDATE character_db_version SET required_")
|
||||
{
|
||||
if (!CharacterDatabase.Execute(line.c_str()))
|
||||
{ ROLLBACK(DUMP_FILE_BROKEN); }
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
|
@ -536,7 +590,9 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
|||
{
|
||||
case DTT_CHAR_TABLE:
|
||||
if (!changenth(line, 1, newguid)) // character_*.guid update
|
||||
{ ROLLBACK(DUMP_FILE_BROKEN); }
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
}
|
||||
break;
|
||||
|
||||
case DTT_CHAR_NAME_TABLE:
|
||||
|
|
@ -553,10 +609,14 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
|||
case DTT_CHARACTER:
|
||||
{
|
||||
if (!changenth(line, 1, newguid)) // characters.guid update
|
||||
{ ROLLBACK(DUMP_FILE_BROKEN); }
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
}
|
||||
|
||||
if (!changenth(line, 2, chraccount)) // characters.account update
|
||||
{ ROLLBACK(DUMP_FILE_BROKEN); }
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
}
|
||||
|
||||
if (name.empty())
|
||||
{
|
||||
|
|
@ -570,7 +630,9 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
|||
delete result;
|
||||
|
||||
if (!changenth(line, 36, "1")) // characters.at_login set to "rename on login"
|
||||
{ ROLLBACK(DUMP_FILE_BROKEN); }
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
}
|
||||
|
||||
nameInvalidated = true;
|
||||
}
|
||||
|
|
@ -578,7 +640,9 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
|||
else
|
||||
{
|
||||
if (!changenth(line, 3, name.c_str())) // characters.name update
|
||||
{ ROLLBACK(DUMP_FILE_BROKEN); }
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
}
|
||||
|
||||
nameInvalidated = true;
|
||||
}
|
||||
|
|
@ -588,7 +652,9 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
|||
case DTT_INVENTORY:
|
||||
{
|
||||
if (!changenth(line, 1, newguid)) // character_inventory.guid update
|
||||
{ ROLLBACK(DUMP_FILE_BROKEN); }
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
}
|
||||
|
||||
if (!changeGuid(line, 2, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed(), true))
|
||||
{ ROLLBACK(DUMP_FILE_BROKEN); } // character_inventory.bag update
|
||||
|
|
@ -602,20 +668,26 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
|||
if (!changeGuid(line, 1, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed()))
|
||||
{ ROLLBACK(DUMP_FILE_BROKEN); } // item_instance.guid update
|
||||
if (!changenth(line, 2, newguid)) // item_instance.owner_guid update
|
||||
{ ROLLBACK(DUMP_FILE_BROKEN); }
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
}
|
||||
std::string vals = getnth(line, 3); // item_instance.data get
|
||||
if (!changetokGuid(vals, OBJECT_FIELD_GUID + 1, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed()))
|
||||
{ ROLLBACK(DUMP_FILE_BROKEN); } // item_instance.data.OBJECT_FIELD_GUID update
|
||||
if (!changetoknth(vals, ITEM_FIELD_OWNER + 1, newguid))
|
||||
{ ROLLBACK(DUMP_FILE_BROKEN); } // item_instance.data.ITEM_FIELD_OWNER update
|
||||
if (!changenth(line, 3, vals.c_str())) // item_instance.data update
|
||||
{ ROLLBACK(DUMP_FILE_BROKEN); }
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DTT_ITEM_GIFT:
|
||||
{
|
||||
if (!changenth(line, 1, newguid)) // character_gifts.guid update
|
||||
{ ROLLBACK(DUMP_FILE_BROKEN); }
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
}
|
||||
if (!changeGuid(line, 2, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed()))
|
||||
{ ROLLBACK(DUMP_FILE_BROKEN); } // character_gifts.item_guid update
|
||||
break;
|
||||
|
|
@ -626,7 +698,9 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
|||
if (!changeGuid(line, 1, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed()))
|
||||
{ ROLLBACK(DUMP_FILE_BROKEN); } // item_loot.guid update
|
||||
if (!changenth(line, 2, newguid)) // item_Loot.owner_guid update
|
||||
{ ROLLBACK(DUMP_FILE_BROKEN); }
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DTT_PET:
|
||||
|
|
@ -634,7 +708,9 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
|||
// store a map of old pet id to new inserted pet id for use by type 5 tables
|
||||
snprintf(currpetid, 20, "%s", getnth(line, 1).c_str());
|
||||
if (strlen(lastpetid) == 0)
|
||||
{ snprintf(lastpetid, 20, "%s", currpetid); }
|
||||
{
|
||||
snprintf(lastpetid, 20, "%s", currpetid);
|
||||
}
|
||||
|
||||
if (strcmp(lastpetid, currpetid) != 0)
|
||||
{
|
||||
|
|
@ -650,9 +726,13 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
|||
}
|
||||
|
||||
if (!changenth(line, 1, newpetid)) // character_pet.id update
|
||||
{ ROLLBACK(DUMP_FILE_BROKEN); }
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
}
|
||||
if (!changenth(line, 3, newguid)) // character_pet.owner update
|
||||
{ ROLLBACK(DUMP_FILE_BROKEN); }
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -663,12 +743,16 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
|||
// lookup currpetid and match to new inserted pet id
|
||||
std::map<uint32, uint32> :: const_iterator petids_iter = petids.find(atoi(currpetid));
|
||||
if (petids_iter == petids.end()) // couldn't find new inserted id
|
||||
{ ROLLBACK(DUMP_FILE_BROKEN); }
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
}
|
||||
|
||||
snprintf(newpetid, 20, "%d", petids_iter->second);
|
||||
|
||||
if (!changenth(line, 1, newpetid)) // pet_*.guid -> petid in fact
|
||||
{ ROLLBACK(DUMP_FILE_BROKEN); }
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -696,7 +780,9 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
|||
if (!changeGuid(line, 1, mails, sObjectMgr.m_MailIds.GetNextAfterMaxUsed()))
|
||||
{ ROLLBACK(DUMP_FILE_BROKEN); } // mail.id update
|
||||
if (!changenth(line, 6, newguid)) // mail.receiver update
|
||||
{ ROLLBACK(DUMP_FILE_BROKEN); }
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DTT_MAIL_ITEM: // mail_items
|
||||
|
|
@ -706,7 +792,9 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
|||
if (!changeGuid(line, 2, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed()))
|
||||
{ ROLLBACK(DUMP_FILE_BROKEN); } // mail_items.item_guid
|
||||
if (!changenth(line, 4, newguid)) // mail_items.receiver
|
||||
{ ROLLBACK(DUMP_FILE_BROKEN); }
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DTT_EQSET_TABLE:
|
||||
|
|
@ -726,7 +814,9 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
|||
}
|
||||
|
||||
if (execute_ok && !CharacterDatabase.Execute(line.c_str()))
|
||||
{ ROLLBACK(DUMP_FILE_BROKEN); }
|
||||
{
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
}
|
||||
}
|
||||
|
||||
CharacterDatabase.CommitTransaction();
|
||||
|
|
@ -737,7 +827,9 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
|||
sObjectMgr.m_EquipmentSetIds.Set(sObjectMgr.m_EquipmentSetIds.GetNextAfterMaxUsed() + eqsets.size());
|
||||
|
||||
if (incHighest)
|
||||
{ sObjectMgr.m_CharGuids.Set(sObjectMgr.m_CharGuids.GetNextAfterMaxUsed() + 1); }
|
||||
{
|
||||
sObjectMgr.m_CharGuids.Set(sObjectMgr.m_CharGuids.GetNextAfterMaxUsed() + 1);
|
||||
}
|
||||
|
||||
fclose(fin);
|
||||
|
||||
|
|
|
|||
|
|
@ -132,10 +132,14 @@ AccountOpResult AccountMgr::ChangeUsername(uint32 accid, std::string new_uname,
|
|||
delete result;
|
||||
|
||||
if (utf8length(new_uname) > MAX_ACCOUNT_STR)
|
||||
{ return AOR_NAME_TOO_LONG; }
|
||||
{
|
||||
return AOR_NAME_TOO_LONG;
|
||||
}
|
||||
|
||||
if (utf8length(new_passwd) > MAX_ACCOUNT_STR)
|
||||
{ return AOR_PASS_TOO_LONG; }
|
||||
{
|
||||
return AOR_PASS_TOO_LONG;
|
||||
}
|
||||
|
||||
normalizeString(new_uname);
|
||||
normalizeString(new_passwd);
|
||||
|
|
@ -158,7 +162,9 @@ AccountOpResult AccountMgr::ChangePassword(uint32 accid, std::string new_passwd)
|
|||
{ return AOR_NAME_NOT_EXIST; } // account doesn't exist
|
||||
|
||||
if (utf8length(new_passwd) > MAX_ACCOUNT_STR)
|
||||
{ return AOR_PASS_TOO_LONG; }
|
||||
{
|
||||
return AOR_PASS_TOO_LONG;
|
||||
}
|
||||
|
||||
normalizeString(new_passwd);
|
||||
|
||||
|
|
@ -175,7 +181,9 @@ uint32 AccountMgr::GetId(std::string username)
|
|||
LoginDatabase.escape_string(username);
|
||||
QueryResult* result = LoginDatabase.PQuery("SELECT id FROM account WHERE username = '%s'", username.c_str());
|
||||
if (!result)
|
||||
{ return 0; }
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32 id = (*result)[0].GetUInt32();
|
||||
|
|
@ -229,7 +237,9 @@ bool AccountMgr::CheckPassword(uint32 accid, std::string passwd)
|
|||
{
|
||||
std::string username;
|
||||
if (!GetName(accid, username))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
normalizeString(passwd);
|
||||
normalizeString(username);
|
||||
|
|
@ -250,7 +260,9 @@ bool AccountMgr::normalizeString(std::string& utf8str)
|
|||
size_t wstr_len = MAX_ACCOUNT_STR;
|
||||
|
||||
if (!Utf8toWStr(utf8str, wstr_buf, wstr_len))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (uint32 i = 0; i <= wstr_len; ++i)
|
||||
wstr_buf[i] = wcharToUpperOnlyLatin(wstr_buf[i]);
|
||||
|
|
|
|||
|
|
@ -243,13 +243,19 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
|
|||
msg = recv_data.ReadString(msgLength);
|
||||
|
||||
if (msg.empty())
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (ChatHandler(this).ParseCommands(msg.c_str()))
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!normalizePlayerName(to))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -97,7 +97,9 @@ struct CoordPair
|
|||
void operator<<(const uint32 val)
|
||||
{
|
||||
if (x_coord > val)
|
||||
{ x_coord -= val; }
|
||||
{
|
||||
x_coord -= val;
|
||||
}
|
||||
else
|
||||
{ x_coord = 0; }
|
||||
}
|
||||
|
|
@ -105,7 +107,9 @@ struct CoordPair
|
|||
void operator>>(const uint32 val)
|
||||
{
|
||||
if (x_coord + val < LIMIT)
|
||||
{ x_coord += val; }
|
||||
{
|
||||
x_coord += val;
|
||||
}
|
||||
else
|
||||
{ x_coord = LIMIT - 1; }
|
||||
}
|
||||
|
|
@ -113,7 +117,9 @@ struct CoordPair
|
|||
void operator-=(const uint32 val)
|
||||
{
|
||||
if (y_coord > val)
|
||||
{ y_coord -= val; }
|
||||
{
|
||||
y_coord -= val;
|
||||
}
|
||||
else
|
||||
{ y_coord = 0; }
|
||||
}
|
||||
|
|
@ -121,7 +127,9 @@ struct CoordPair
|
|||
void operator+=(const uint32 val)
|
||||
{
|
||||
if (y_coord + val < LIMIT)
|
||||
{ y_coord += val; }
|
||||
{
|
||||
y_coord += val;
|
||||
}
|
||||
else
|
||||
{ y_coord = LIMIT - 1; }
|
||||
}
|
||||
|
|
@ -167,7 +175,9 @@ namespace MaNGOS
|
|||
inline void NormalizeMapCoord(float& c)
|
||||
{
|
||||
if (c > MAP_HALFSIZE - 0.5)
|
||||
{ c = MAP_HALFSIZE - 0.5; }
|
||||
{
|
||||
c = MAP_HALFSIZE - 0.5;
|
||||
}
|
||||
else if (c < -(MAP_HALFSIZE - 0.5))
|
||||
{ c = -(MAP_HALFSIZE - 0.5); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -787,7 +787,9 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke
|
|||
for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i)
|
||||
{
|
||||
if (Aura* aura = holder->GetAuraByEffectIndex(SpellEffectIndex(i)))
|
||||
{ *data << int32(aura->GetModifier()->m_amount); }
|
||||
{
|
||||
*data << int32(aura->GetModifier()->m_amount);
|
||||
}
|
||||
else
|
||||
{ *data << int32(0); }
|
||||
}
|
||||
|
|
@ -884,7 +886,9 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke
|
|||
for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i)
|
||||
{
|
||||
if (Aura* aura = holder->GetAuraByEffectIndex(SpellEffectIndex(i)))
|
||||
{ *data << int32(aura->GetModifier()->m_amount); }
|
||||
{
|
||||
*data << int32(aura->GetModifier()->m_amount);
|
||||
}
|
||||
else
|
||||
{ *data << int32(0); }
|
||||
}
|
||||
|
|
@ -1018,7 +1022,9 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket& recv_data)
|
|||
for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i)
|
||||
{
|
||||
if (Aura* aura = holder->GetAuraByEffectIndex(SpellEffectIndex(i)))
|
||||
{ data << int32(aura->GetModifier()->m_amount); }
|
||||
{
|
||||
data << int32(aura->GetModifier()->m_amount);
|
||||
}
|
||||
else
|
||||
{ data << int32(0); }
|
||||
}
|
||||
|
|
@ -1057,7 +1063,9 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket& recv_data)
|
|||
for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i)
|
||||
{
|
||||
if (Aura* aura = holder->GetAuraByEffectIndex(SpellEffectIndex(i)))
|
||||
{ data << int32(aura->GetModifier()->m_amount); }
|
||||
{
|
||||
data << int32(aura->GetModifier()->m_amount);
|
||||
}
|
||||
else
|
||||
{ data << int32(0); }
|
||||
}
|
||||
|
|
@ -1130,4 +1138,4 @@ void WorldSession::HandleGroupRequestJoinUpdates(WorldPacket& recv_data)
|
|||
data << uint32(group->GetMembersCount() - 1);
|
||||
data << ObjectGuid(group->GetLeaderGuid());
|
||||
SendPacket(&data);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,16 +32,22 @@ void InstanceData::SaveToDB() const
|
|||
{
|
||||
// no reason to save BGs/Arenas
|
||||
if (instance->IsBattleGroundOrArena())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Save())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::string data = Save();
|
||||
CharacterDatabase.escape_string(data);
|
||||
|
||||
if (instance->Instanceable())
|
||||
{ CharacterDatabase.PExecute("UPDATE instance SET data = '%s' WHERE id = '%u'", data.c_str(), instance->GetInstanceId()); }
|
||||
{
|
||||
CharacterDatabase.PExecute("UPDATE instance SET data = '%s' WHERE id = '%u'", data.c_str(), instance->GetInstanceId());
|
||||
}
|
||||
else
|
||||
{ CharacterDatabase.PExecute("UPDATE world SET data = '%s' WHERE map = '%u'", data.c_str(), instance->GetId()); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,9 @@ Map::~Map()
|
|||
UnloadAll(true);
|
||||
|
||||
if (!m_scriptSchedule.empty())
|
||||
{ sScriptMgr.DecreaseScheduledScriptCount(m_scriptSchedule.size()); }
|
||||
{
|
||||
sScriptMgr.DecreaseScheduledScriptCount(m_scriptSchedule.size());
|
||||
}
|
||||
|
||||
if (m_persistentState)
|
||||
{ m_persistentState->SetUsedByMapState(NULL); } // field pointer can be deleted after this
|
||||
|
|
@ -77,7 +79,9 @@ Map::~Map()
|
|||
|
||||
// release reference count
|
||||
if (m_TerrainData->Release())
|
||||
{ sTerrainMgr.UnloadTerrain(m_TerrainData->GetMapId()); }
|
||||
{
|
||||
sTerrainMgr.UnloadTerrain(m_TerrainData->GetMapId());
|
||||
}
|
||||
|
||||
delete m_weatherSystem;
|
||||
m_weatherSystem = NULL;
|
||||
|
|
@ -86,10 +90,14 @@ Map::~Map()
|
|||
void Map::LoadMapAndVMap(int gx, int gy)
|
||||
{
|
||||
if (m_bLoadedGrids[gx][gy])
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_TerrainData->Load(gx, gy))
|
||||
{ m_bLoadedGrids[gx][gy] = true; }
|
||||
{
|
||||
m_bLoadedGrids[gx][gy] = true;
|
||||
}
|
||||
}
|
||||
|
||||
Map::Map(uint32 id, time_t expiry, uint32 InstanceId, uint8 SpawnMode)
|
||||
|
|
@ -245,7 +253,9 @@ Map::EnsureGridCreated(const GridPair& p)
|
|||
int gy = (MAX_NUMBER_OF_GRIDS - 1) - p.y_coord;
|
||||
|
||||
if (!m_bLoadedGrids[gx][gy])
|
||||
{ LoadMapAndVMap(gx, gy); }
|
||||
{
|
||||
LoadMapAndVMap(gx, gy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -274,7 +284,9 @@ Map::EnsureGridLoadedAtEnter(const Cell& cell, Player* player)
|
|||
{ grid = getNGrid(cell.GridX(), cell.GridY()); }
|
||||
|
||||
if (player)
|
||||
{ AddToGrid(player, grid, cell); }
|
||||
{
|
||||
AddToGrid(player, grid, cell);
|
||||
}
|
||||
}
|
||||
|
||||
bool Map::EnsureGridLoaded(const Cell& cell)
|
||||
|
|
@ -337,7 +349,9 @@ bool Map::Add(Player* player)
|
|||
#endif /* ENABLE_ELUNA */
|
||||
|
||||
if (i_data)
|
||||
{ i_data->OnPlayerEnter(player); }
|
||||
{
|
||||
i_data->OnPlayerEnter(player);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -359,7 +373,9 @@ Map::Add(T* obj)
|
|||
|
||||
Cell cell(p);
|
||||
if (obj->IsActiveObject())
|
||||
{ EnsureGridLoadedAtEnter(cell); }
|
||||
{
|
||||
EnsureGridLoadedAtEnter(cell);
|
||||
}
|
||||
else
|
||||
{ EnsureGridCreated(GridPair(cell.GridX(), cell.GridY())); }
|
||||
|
||||
|
|
@ -370,7 +386,9 @@ Map::Add(T* obj)
|
|||
obj->AddToWorld();
|
||||
|
||||
if (obj->IsActiveObject())
|
||||
{ AddToActive(obj); }
|
||||
{
|
||||
AddToActive(obj);
|
||||
}
|
||||
|
||||
DEBUG_LOG("%s enters grid[%u,%u]", obj->GetGuidStr().c_str(), cell.GridX(), cell.GridY());
|
||||
|
||||
|
|
@ -394,7 +412,9 @@ void Map::MessageBroadcast(Player const* player, WorldPacket* msg, bool to_self)
|
|||
cell.SetNoCreate();
|
||||
|
||||
if (!loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MaNGOS::MessageDeliverer post_man(*player, msg, to_self);
|
||||
TypeContainerVisitor<MaNGOS::MessageDeliverer, WorldTypeMapContainer > message(post_man);
|
||||
|
|
@ -415,7 +435,9 @@ void Map::MessageBroadcast(WorldObject const* obj, WorldPacket* msg)
|
|||
cell.SetNoCreate();
|
||||
|
||||
if (!loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: currently on continents when Visibility.Distance.InFlight > Visibility.Distance.Continents
|
||||
// we have alot of blinking mobs because monster move packet send is broken...
|
||||
|
|
@ -438,7 +460,9 @@ void Map::MessageDistBroadcast(Player const* player, WorldPacket* msg, float dis
|
|||
cell.SetNoCreate();
|
||||
|
||||
if (!loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MaNGOS::MessageDistDeliverer post_man(*player, msg, dist, to_self, own_team_only);
|
||||
TypeContainerVisitor<MaNGOS::MessageDistDeliverer , WorldTypeMapContainer > message(post_man);
|
||||
|
|
@ -459,7 +483,9 @@ void Map::MessageDistBroadcast(WorldObject const* obj, WorldPacket* msg, float d
|
|||
cell.SetNoCreate();
|
||||
|
||||
if (!loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MaNGOS::ObjectMessageDistDeliverer post_man(*obj, msg, dist);
|
||||
TypeContainerVisitor<MaNGOS::ObjectMessageDistDeliverer, WorldTypeMapContainer > message(post_man);
|
||||
|
|
@ -515,7 +541,9 @@ void Map::Update(const uint32& t_diff)
|
|||
Player* plr = m_mapRefIter->getSource();
|
||||
|
||||
if (!plr->IsInWorld() || !plr->IsPositionValid())
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// lets update mobs/objects in ALL visible cells around player!
|
||||
CellArea area = Cell::CalculateCellArea(plr->GetPositionX(), plr->GetPositionY(), GetVisibilityDistance());
|
||||
|
|
@ -553,7 +581,9 @@ void Map::Update(const uint32& t_diff)
|
|||
++m_activeNonPlayersIter;
|
||||
|
||||
if (!obj->IsInWorld() || !obj->IsPositionValid())
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// lets update mobs/objects in ALL visible cells around player!
|
||||
CellArea area = Cell::CalculateCellArea(obj->GetPositionX(), obj->GetPositionY(), GetVisibilityDistance());
|
||||
|
|
@ -598,14 +628,18 @@ void Map::Update(const uint32& t_diff)
|
|||
|
||||
///- Process necessary scripts
|
||||
if (!m_scriptSchedule.empty())
|
||||
{ ScriptsProcess(); }
|
||||
{
|
||||
ScriptsProcess();
|
||||
}
|
||||
|
||||
#ifdef ENABLE_ELUNA
|
||||
sEluna->OnUpdate(this, t_diff);
|
||||
#endif /* ENABLE_ELUNA */
|
||||
|
||||
if (i_data)
|
||||
{ i_data->Update(t_diff); }
|
||||
{
|
||||
i_data->Update(t_diff);
|
||||
}
|
||||
|
||||
m_weatherSystem->UpdateWeathers(t_diff);
|
||||
}
|
||||
|
|
@ -617,10 +651,14 @@ void Map::Remove(Player* player, bool remove)
|
|||
#endif /* ENABLE_ELUNA */
|
||||
|
||||
if (i_data)
|
||||
{ i_data->OnPlayerLeave(player); }
|
||||
{
|
||||
i_data->OnPlayerLeave(player);
|
||||
}
|
||||
|
||||
if (remove)
|
||||
{ player->CleanupsBeforeDelete(); }
|
||||
{
|
||||
player->CleanupsBeforeDelete();
|
||||
}
|
||||
else
|
||||
{ player->RemoveFromWorld(); }
|
||||
|
||||
|
|
@ -630,7 +668,9 @@ void Map::Remove(Player* player, bool remove)
|
|||
// nocheck_prev will return the padding element of the RefManager
|
||||
// instead of NULL in the case of prev
|
||||
if (m_mapRefIter == player->GetMapRef())
|
||||
{ m_mapRefIter = m_mapRefIter->nocheck_prev(); }
|
||||
{
|
||||
m_mapRefIter = m_mapRefIter->nocheck_prev();
|
||||
}
|
||||
player->GetMapRef().unlink();
|
||||
CellPair p = MaNGOS::ComputeCellPair(player->GetPositionX(), player->GetPositionY());
|
||||
if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP)
|
||||
|
|
@ -639,7 +679,9 @@ void Map::Remove(Player* player, bool remove)
|
|||
player->ResetMap();
|
||||
|
||||
if (remove)
|
||||
{ DeleteFromWorld(player); }
|
||||
{
|
||||
DeleteFromWorld(player);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -663,7 +705,9 @@ void Map::Remove(Player* player, bool remove)
|
|||
|
||||
player->ResetMap();
|
||||
if (remove)
|
||||
{ DeleteFromWorld(player); }
|
||||
{
|
||||
DeleteFromWorld(player);
|
||||
}
|
||||
}
|
||||
|
||||
template<class T>
|
||||
|
|
@ -679,17 +723,23 @@ Map::Remove(T* obj, bool remove)
|
|||
|
||||
Cell cell(p);
|
||||
if (!loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)))
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_LOG("Remove object (GUID: %u TypeId:%u) from grid[%u,%u]", obj->GetGUIDLow(), obj->GetTypeId(), cell.data.Part.grid_x, cell.data.Part.grid_y);
|
||||
NGridType* grid = getNGrid(cell.GridX(), cell.GridY());
|
||||
MANGOS_ASSERT(grid != NULL);
|
||||
|
||||
if (obj->IsActiveObject())
|
||||
{ RemoveFromActive(obj); }
|
||||
{
|
||||
RemoveFromActive(obj);
|
||||
}
|
||||
|
||||
if (remove)
|
||||
{ obj->CleanupsBeforeDelete(); }
|
||||
{
|
||||
obj->CleanupsBeforeDelete();
|
||||
}
|
||||
else
|
||||
{ obj->RemoveFromWorld(); }
|
||||
|
||||
|
|
@ -701,7 +751,9 @@ Map::Remove(T* obj, bool remove)
|
|||
{
|
||||
// if option set then object already saved at this moment
|
||||
if (!sWorld.getConfig(CONFIG_BOOL_SAVE_RESPAWN_TIME_IMMEDIATELY))
|
||||
{ obj->SaveRespawnTime(); }
|
||||
{
|
||||
obj->SaveRespawnTime();
|
||||
}
|
||||
|
||||
// Note: In case resurrectable corpse and pet its removed from global lists in own destructor
|
||||
delete obj;
|
||||
|
|
@ -728,7 +780,9 @@ void Map::PlayerRelocation(Player* player, float x, float y, float z, float orie
|
|||
NGridType* oldGrid = getNGrid(old_cell.GridX(), old_cell.GridY());
|
||||
RemoveFromGrid(player, oldGrid, old_cell);
|
||||
if (!old_cell.DiffGrid(new_cell))
|
||||
{ AddToGrid(player, oldGrid, new_cell); }
|
||||
{
|
||||
AddToGrid(player, oldGrid, new_cell);
|
||||
}
|
||||
else
|
||||
{ EnsureGridLoadedAtEnter(new_cell, player); }
|
||||
|
||||
|
|
@ -828,7 +882,9 @@ bool Map::UnloadGrid(const uint32& x, const uint32& y, bool pForce)
|
|||
|
||||
{
|
||||
if (!pForce && ActiveObjectsNearGrid(x, y))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "Unloading grid[%u,%u] for map %u", x, y, i_id);
|
||||
ObjectGridUnloader unloader(*grid);
|
||||
|
|
@ -969,7 +1025,9 @@ void Map::SendInitTransports(Player* player)
|
|||
|
||||
// no transports at map
|
||||
if (tmap.find(player->GetMapId()) == tmap.end())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateData transData(player->GetMapId());
|
||||
|
||||
|
|
@ -1001,7 +1059,9 @@ void Map::SendRemoveTransports(Player* player)
|
|||
|
||||
// no transports at map
|
||||
if (tmap.find(player->GetMapId()) == tmap.end())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateData transData(player->GetMapId());
|
||||
|
||||
|
|
@ -1010,7 +1070,9 @@ void Map::SendRemoveTransports(Player* player)
|
|||
// except used transport
|
||||
for (MapManager::TransportSet::const_iterator i = tset.begin(); i != tset.end(); ++i)
|
||||
if ((*i) != player->GetTransport() && (*i)->GetMapId() != i_id)
|
||||
{ (*i)->BuildOutOfRangeUpdateBlock(&transData); }
|
||||
{
|
||||
(*i)->BuildOutOfRangeUpdateBlock(&transData);
|
||||
}
|
||||
|
||||
WorldPacket packet;
|
||||
transData.BuildPacket(&packet);
|
||||
|
|
@ -1052,7 +1114,9 @@ void Map::AddObjectToRemoveList(WorldObject* obj)
|
|||
void Map::RemoveAllObjectsInRemoveList()
|
||||
{
|
||||
if (i_objectsToRemove.empty())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// DEBUG_LOG("Object remover 1 check.");
|
||||
while (!i_objectsToRemove.empty())
|
||||
|
|
@ -1067,7 +1131,9 @@ void Map::RemoveAllObjectsInRemoveList()
|
|||
// ??? WTF
|
||||
Corpse* corpse = GetCorpse(obj->GetObjectGuid());
|
||||
if (!corpse)
|
||||
{ sLog.outError("Try delete corpse/bones %u that not in map", obj->GetGUIDLow()); }
|
||||
{
|
||||
sLog.outError("Try delete corpse/bones %u that not in map", obj->GetGUIDLow());
|
||||
}
|
||||
else
|
||||
{ Remove(corpse, true); }
|
||||
break;
|
||||
|
|
@ -1094,7 +1160,9 @@ uint32 Map::GetPlayersCountExceptGMs() const
|
|||
uint32 count = 0;
|
||||
for (MapRefManager::const_iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
|
||||
if (!itr->getSource()->isGameMaster())
|
||||
{ ++count; }
|
||||
{
|
||||
++count;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
|
@ -1175,7 +1243,9 @@ void Map::AddToActive(WorldObject* obj)
|
|||
c->GetRespawnCoord(x, y, z);
|
||||
GridPair p = MaNGOS::ComputeGridPair(x, y);
|
||||
if (getNGrid(p.x_coord, p.y_coord))
|
||||
{ getNGrid(p.x_coord, p.y_coord)->incUnloadActiveLock(); }
|
||||
{
|
||||
getNGrid(p.x_coord, p.y_coord)->incUnloadActiveLock();
|
||||
}
|
||||
else
|
||||
{
|
||||
GridPair p2 = MaNGOS::ComputeGridPair(c->GetPositionX(), c->GetPositionY());
|
||||
|
|
@ -1193,10 +1263,14 @@ void Map::RemoveFromActive(WorldObject* obj)
|
|||
{
|
||||
ActiveNonPlayers::iterator itr = m_activeNonPlayers.find(obj);
|
||||
if (itr == m_activeNonPlayersIter)
|
||||
{ ++m_activeNonPlayersIter; }
|
||||
{
|
||||
++m_activeNonPlayersIter;
|
||||
}
|
||||
|
||||
if (itr != m_activeNonPlayers.end())
|
||||
{ m_activeNonPlayers.erase(itr); }
|
||||
{
|
||||
m_activeNonPlayers.erase(itr);
|
||||
}
|
||||
}
|
||||
else
|
||||
{ m_activeNonPlayers.erase(obj); }
|
||||
|
|
@ -1212,7 +1286,9 @@ void Map::RemoveFromActive(WorldObject* obj)
|
|||
c->GetRespawnCoord(x, y, z);
|
||||
GridPair p = MaNGOS::ComputeGridPair(x, y);
|
||||
if (getNGrid(p.x_coord, p.y_coord))
|
||||
{ getNGrid(p.x_coord, p.y_coord)->decUnloadActiveLock(); }
|
||||
{
|
||||
getNGrid(p.x_coord, p.y_coord)->decUnloadActiveLock();
|
||||
}
|
||||
else
|
||||
{
|
||||
GridPair p2 = MaNGOS::ComputeGridPair(c->GetPositionX(), c->GetPositionY());
|
||||
|
|
@ -1431,7 +1507,9 @@ bool DungeonMap::Add(Player* player)
|
|||
// Is it needed?
|
||||
|
||||
if (!CanEnter(player))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// check for existing instance binds
|
||||
InstancePlayerBind* playerBind = player->GetBoundInstance(GetId(), GetDifficulty());
|
||||
|
|
@ -1479,7 +1557,9 @@ bool DungeonMap::Add(Player* player)
|
|||
|
||||
// bind to the group or keep using the group save
|
||||
if (!groupBind)
|
||||
{ pGroup->BindToInstance(GetPersistanceState(), false); }
|
||||
{
|
||||
pGroup->BindToInstance(GetPersistanceState(), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// can not jump to a different instance without resetting it
|
||||
|
|
@ -1495,7 +1575,9 @@ bool DungeonMap::Add(Player* player)
|
|||
GetPersistanceState()->GetPlayerCount(), GetPersistanceState()->GetGroupCount());
|
||||
|
||||
if (groupBind->state)
|
||||
{ sLog.outError("GroupBind save players: %d, group count: %d", groupBind->state->GetPlayerCount(), groupBind->state->GetGroupCount()); }
|
||||
{
|
||||
sLog.outError("GroupBind save players: %d, group count: %d", groupBind->state->GetPlayerCount(), groupBind->state->GetGroupCount());
|
||||
}
|
||||
else
|
||||
{ sLog.outError("GroupBind save NULL"); }
|
||||
MANGOS_ASSERT(false);
|
||||
|
|
@ -1516,7 +1598,9 @@ bool DungeonMap::Add(Player* player)
|
|||
{
|
||||
// set up a solo bind or continue using it
|
||||
if (!playerBind)
|
||||
{ player->BindToInstance(GetPersistanceState(), false); }
|
||||
{
|
||||
player->BindToInstance(GetPersistanceState(), false);
|
||||
}
|
||||
else
|
||||
// can not jump to a different instance without resetting it
|
||||
{ MANGOS_ASSERT(playerBind->state == GetPersistentState()); }
|
||||
|
|
@ -1550,7 +1634,9 @@ void DungeonMap::Remove(Player* player, bool remove)
|
|||
|
||||
// if last player set unload timer
|
||||
if (!m_unloadTimer && m_mapRefManager.getSize() == 1)
|
||||
{ m_unloadTimer = m_unloadWhenEmpty ? MIN_UNLOAD_DELAY : std::max(sWorld.getConfig(CONFIG_UINT32_INSTANCE_UNLOAD_DELAY), (uint32)MIN_UNLOAD_DELAY); }
|
||||
{
|
||||
m_unloadTimer = m_unloadWhenEmpty ? MIN_UNLOAD_DELAY : std::max(sWorld.getConfig(CONFIG_UINT32_INSTANCE_UNLOAD_DELAY), (uint32)MIN_UNLOAD_DELAY);
|
||||
}
|
||||
|
||||
Map::Remove(player, remove);
|
||||
|
||||
|
|
@ -1620,7 +1706,9 @@ void DungeonMap::PermBindAllPlayers(Player* player)
|
|||
|
||||
// if the leader is not in the instance the group will not get a perm bind
|
||||
if (group && group->GetLeaderGuid() == plr->GetObjectGuid())
|
||||
{ group->BindToInstance(GetPersistanceState(), true); }
|
||||
{
|
||||
group->BindToInstance(GetPersistanceState(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1629,7 +1717,9 @@ void DungeonMap::UnloadAll(bool pForce)
|
|||
TeleportAllPlayersTo(TELEPORT_LOCATION_HOMEBIND);
|
||||
|
||||
if (m_resetAfterUnload == true)
|
||||
{ GetPersistanceState()->DeleteRespawnTimes(); }
|
||||
{
|
||||
GetPersistanceState()->DeleteRespawnTimes();
|
||||
}
|
||||
|
||||
Map::UnloadAll(pForce);
|
||||
}
|
||||
|
|
@ -1689,10 +1779,14 @@ void BattleGroundMap::InitVisibilityDistance()
|
|||
bool BattleGroundMap::CanEnter(Player* player)
|
||||
{
|
||||
if (!Map::CanEnter(player))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (player->GetBattleGroundId() != GetInstanceId())
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// player number limit is checked in bgmgr, no need to do it here
|
||||
return true;
|
||||
|
|
@ -1701,7 +1795,9 @@ bool BattleGroundMap::CanEnter(Player* player)
|
|||
bool BattleGroundMap::Add(Player* player)
|
||||
{
|
||||
if (!CanEnter(player))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// reset instance validity, battleground maps do not homebind
|
||||
player->m_InstanceValid = true;
|
||||
|
|
@ -1750,11 +1846,15 @@ bool Map::ScriptsStart(DBScriptType type, uint32 id, Object* source, Object* tar
|
|||
///- Find the script chain map
|
||||
ScriptChainMap const *scm = sScriptMgr.GetScriptChainMap(type);
|
||||
if (!scm)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ScriptChainMap::const_iterator s = scm->find(id);
|
||||
if (s == scm->end())
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// prepare static data
|
||||
ObjectGuid sourceGuid = source->GetObjectGuid();
|
||||
|
|
@ -1809,7 +1909,9 @@ void Map::ScriptCommandStart(ScriptInfo const& script, uint32 delay, Object* sou
|
|||
void Map::ScriptsProcess()
|
||||
{
|
||||
if (m_scriptSchedule.empty())
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
///- Process overdue queued scripts
|
||||
ScriptScheduleMap::iterator iter = m_scriptSchedule.begin();
|
||||
|
|
@ -1942,7 +2044,9 @@ DynamicObject* Map::GetDynamicObject(ObjectGuid guid)
|
|||
Unit* Map::GetUnit(ObjectGuid guid)
|
||||
{
|
||||
if (guid.IsPlayer())
|
||||
{ return GetPlayer(guid); }
|
||||
{
|
||||
return GetPlayer(guid);
|
||||
}
|
||||
|
||||
return GetAnyTypeCreature(guid);
|
||||
}
|
||||
|
|
@ -2113,7 +2217,9 @@ void Map::PlayDirectSoundToMap(uint32 soundId, uint32 zoneId /*=0*/) const
|
|||
Map::PlayerList const& pList = GetPlayers();
|
||||
for (PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr)
|
||||
if (!zoneId || itr->getSource()->GetZoneId() == zoneId)
|
||||
{ itr->getSource()->SendDirectMessage(&data); }
|
||||
{
|
||||
itr->getSource()->SendDirectMessage(&data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -42,7 +42,9 @@ namespace MMAP
|
|||
MMapManager* MMapFactory::createOrGetMMapManager()
|
||||
{
|
||||
if (g_MMapManager == NULL)
|
||||
{ g_MMapManager = new MMapManager(); }
|
||||
{
|
||||
g_MMapManager = new MMapManager();
|
||||
}
|
||||
|
||||
return g_MMapManager;
|
||||
}
|
||||
|
|
@ -50,7 +52,9 @@ namespace MMAP
|
|||
void MMapFactory::preventPathfindingOnMaps(const char* ignoreMapIds)
|
||||
{
|
||||
if (!g_mmapDisabledIds)
|
||||
{ g_mmapDisabledIds = new std::set<uint32>(); }
|
||||
{
|
||||
g_mmapDisabledIds = new std::set<uint32>();
|
||||
}
|
||||
|
||||
uint32 strLenght = strlen(ignoreMapIds) + 1;
|
||||
char* mapList = new char[strLenght];
|
||||
|
|
@ -143,7 +147,9 @@ namespace MMAP
|
|||
{
|
||||
// we already have this map loaded?
|
||||
if (loadedMMaps.find(mapId) != loadedMMaps.end())
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// load and init dtNavMesh - read parameters from file
|
||||
uint32 pathLen = sWorld.GetDataPath().length() + strlen("mmaps/%03i.mmap") + 1;
|
||||
|
|
@ -154,7 +160,9 @@ namespace MMAP
|
|||
if (!file)
|
||||
{
|
||||
if (MMapFactory::IsPathfindingEnabled(mapId))
|
||||
{ sLog.outError("MMAP:loadMapData: Error: Could not open mmap file '%s'", fileName); }
|
||||
{
|
||||
sLog.outError("MMAP:loadMapData: Error: Could not open mmap file '%s'", fileName);
|
||||
}
|
||||
delete[] fileName;
|
||||
return false;
|
||||
}
|
||||
|
|
@ -194,7 +202,9 @@ namespace MMAP
|
|||
{
|
||||
// make sure the mmap is loaded and ready to load tiles
|
||||
if (!loadMapData(mapId))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// get this mmap data
|
||||
MMapData* mmap = loadedMMaps[mapId];
|
||||
|
|
|
|||
|
|
@ -117,17 +117,25 @@ bool ScriptMgr::CanSpellEffectStartDBScript(SpellEntry const* spellinfo, SpellEf
|
|||
{
|
||||
uint8 priority = GetSpellStartDBScriptPriority(spellinfo, effIdx);
|
||||
if (!priority)
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
|
||||
{
|
||||
uint8 currentPriority = GetSpellStartDBScriptPriority(spellinfo, SpellEffectIndex(i));
|
||||
if (currentPriority < priority) // lower priority, continue checking
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (currentPriority > priority) // take other index with higher priority
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (i < effIdx) // same priority at lower index
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -136,7 +144,9 @@ bool ScriptMgr::CanSpellEffectStartDBScript(SpellEntry const* spellinfo, SpellEf
|
|||
void ScriptMgr::LoadScripts(DBScriptType type)
|
||||
{
|
||||
if (IsScriptScheduled()) // function don't must be called in time scripts use.
|
||||
{ return; }
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_dbScripts[type].clear(); // need for reload support
|
||||
|
||||
|
|
@ -486,7 +496,9 @@ void ScriptMgr::LoadScripts(DBScriptType type)
|
|||
}
|
||||
}
|
||||
if (hasErrored)
|
||||
{ continue; }
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SCRIPT_COMMAND_PLAY_SOUND: // 16
|
||||
|
|
@ -499,9 +511,13 @@ void ScriptMgr::LoadScripts(DBScriptType type)
|
|||
}
|
||||
// bitmask: 0/1=target-player, 0/2=with distance dependent, 0/4=map wide, 0/8=zone wide
|
||||
if (tmp.playSound.flags & ~(1 | 2 | 4 | 8))
|
||||
{ sLog.outErrorDb("Table `db_scripts [type = %d]` using unsupported sound flags (datalong2: %u) in SCRIPT_COMMAND_PLAY_SOUND for script id %u, unsupported flags will be ignored", type, tmp.playSound.flags, tmp.id); }
|
||||
{
|
||||
sLog.outErrorDb("Table `db_scripts [type = %d]` using unsupported sound flags (datalong2: %u) in SCRIPT_COMMAND_PLAY_SOUND for script id %u, unsupported flags will be ignored", type, tmp.playSound.flags, tmp.id);
|
||||
}
|
||||
if ((tmp.playSound.flags & (1 | 2)) > 0 && (tmp.playSound.flags & (4 | 8)) > 0)
|
||||
{ sLog.outErrorDb("Table `db_scripts [type = %d]` uses sound flags (datalong2: %u) in SCRIPT_COMMAND_PLAY_SOUND for script id %u, combining (1|2) with (4|8) makes no sense", type, tmp.playSound.flags, tmp.id); }
|
||||
{
|
||||
sLog.outErrorDb("Table `db_scripts [type = %d]` uses sound flags (datalong2: %u) in SCRIPT_COMMAND_PLAY_SOUND for script id %u, combining (1|2) with (4|8) makes no sense", type, tmp.playSound.flags, tmp.id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SCRIPT_COMMAND_CREATE_ITEM: // 17
|
||||
|
|
@ -874,7 +890,9 @@ void ScriptMgr::LoadDbScriptStrings()
|
|||
|
||||
for (int32 i = MIN_DB_SCRIPT_STRING_ID; i < MAX_DB_SCRIPT_STRING_ID; ++i)
|
||||
if (sObjectMgr.GetMangosStringLocale(i))
|
||||
{ ids.insert(i); }
|
||||
{
|
||||
ids.insert(i);
|
||||
}
|
||||
|
||||
CheckScriptTexts(ids);
|
||||
sWaypointMgr.CheckTextsExistance(ids);
|
||||
|
|
@ -918,7 +936,9 @@ bool ScriptAction::GetScriptCommandObject(const ObjectGuid guid, bool includeIte
|
|||
resultObject = NULL;
|
||||
|
||||
if (!guid)
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (guid.GetHigh())
|
||||
{
|
||||
|
|
@ -944,7 +964,9 @@ bool ScriptAction::GetScriptCommandObject(const ObjectGuid guid, bool includeIte
|
|||
if (includeItem)
|
||||
{
|
||||
if (Player* player = m_map->GetPlayer(m_ownerGuid))
|
||||
{ resultObject = player->GetItemByGuid(guid); }
|
||||
{
|
||||
resultObject = player->GetItemByGuid(guid);
|
||||
}
|
||||
break;
|
||||
}
|
||||
// else no break, but display error message
|
||||
|
|
@ -955,7 +977,9 @@ bool ScriptAction::GetScriptCommandObject(const ObjectGuid guid, bool includeIte
|
|||
}
|
||||
|
||||
if (resultObject && !resultObject->IsInWorld())
|
||||
{ resultObject = NULL; }
|
||||
{
|
||||
resultObject = NULL;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1013,7 +1037,9 @@ bool ScriptAction::GetScriptProcessTargets(WorldObject* pOrigSource, WorldObject
|
|||
// Prefer non-players as searcher
|
||||
WorldObject* pSearcher = pOrigSource ? pOrigSource : pOrigTarget;
|
||||
if (pSearcher->GetTypeId() == TYPEID_PLAYER && pOrigTarget && pOrigTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
{ pSearcher = pOrigTarget; }
|
||||
{
|
||||
pSearcher = pOrigTarget;
|
||||
}
|
||||
|
||||
if (m_script->IsCreatureBuddy())
|
||||
{
|
||||
|
|
@ -1076,10 +1102,14 @@ bool ScriptAction::GetScriptProcessTargets(WorldObject* pOrigSource, WorldObject
|
|||
}
|
||||
|
||||
if (m_script->data_flags & SCRIPT_FLAG_REVERSE_DIRECTION)
|
||||
{ std::swap(pFinalSource, pFinalTarget); }
|
||||
{
|
||||
std::swap(pFinalSource, pFinalTarget);
|
||||
}
|
||||
|
||||
if (m_script->data_flags & SCRIPT_FLAG_SOURCE_TARGETS_SELF)
|
||||
{ pFinalTarget = pFinalSource; }
|
||||
{
|
||||
pFinalTarget = pFinalSource;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1147,9 +1177,13 @@ bool ScriptAction::HandleScriptStep()
|
|||
Object* source = NULL;
|
||||
Object* target = NULL;
|
||||
if (!GetScriptCommandObject(m_sourceGuid, true, source))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!GetScriptCommandObject(m_targetGuid, false, target))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Give some debug log output for easier use
|
||||
DEBUG_LOG("DB-SCRIPTS: Process table `db_scripts [type = %d]` id %u, command %u for source %s (%sin world), target %s (%sin world)", m_type, m_script->id, m_script->command, m_sourceGuid.GetString().c_str(), source ? "" : "not ", m_targetGuid.GetString().c_str(), target ? "" : "not ");
|
||||
|
|
@ -1158,7 +1192,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
pSource = source && source->isType(TYPEMASK_WORLDOBJECT) ? (WorldObject*)source : NULL;
|
||||
pTarget = target && target->isType(TYPEMASK_WORLDOBJECT) ? (WorldObject*)target : NULL;
|
||||
if (!GetScriptProcessTargets(pSource, pTarget, pSource, pTarget))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
pSourceOrItem = pSource ? pSource : (source && source->isType(TYPEMASK_ITEM) ? source : NULL);
|
||||
}
|
||||
|
|
@ -1183,7 +1219,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
for (; i < MAX_TEXT_ID; ++i)
|
||||
{
|
||||
if (!m_script->textId[i])
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Use one random
|
||||
|
|
@ -1191,20 +1229,26 @@ bool ScriptAction::HandleScriptStep()
|
|||
}
|
||||
|
||||
if (!DoDisplayText(pSource, textId, unitTarget))
|
||||
{ sLog.outErrorDb(" DB-SCRIPTS: Process table `db_scripts [type = %d]` id %u, could not display text %i properly", m_type, m_script->id, textId); }
|
||||
{
|
||||
sLog.outErrorDb(" DB-SCRIPTS: Process table `db_scripts [type = %d]` id %u, could not display text %i properly", m_type, m_script->id, textId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SCRIPT_COMMAND_EMOTE: // 1
|
||||
{
|
||||
if (LogIfNotUnit(pSource))
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
std::vector<uint32> emotes;
|
||||
emotes.push_back(m_script->emote.emoteId);
|
||||
for (int i = 0; i < MAX_TEXT_ID; ++i)
|
||||
{
|
||||
if (!m_script->textId[i])
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
emotes.push_back(uint32(m_script->textId[i]));
|
||||
}
|
||||
|
||||
|
|
@ -1228,7 +1272,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
case SCRIPT_COMMAND_MOVE_TO: // 3
|
||||
{
|
||||
if (LogIfNotUnit(pSource))
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// Just turn around
|
||||
if ((m_script->x == 0.0f && m_script->y == 0.0f && m_script->z == 0.0f) ||
|
||||
|
|
@ -1248,7 +1294,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
|
||||
// Normal Movement
|
||||
if (m_script->moveTo.travelSpeed)
|
||||
{ ((Unit*)pSource)->MonsterMoveWithSpeed(m_script->x, m_script->y, m_script->z, m_script->moveTo.travelSpeed * 0.01f); }
|
||||
{
|
||||
((Unit*)pSource)->MonsterMoveWithSpeed(m_script->x, m_script->y, m_script->z, m_script->moveTo.travelSpeed * 0.01f);
|
||||
}
|
||||
else
|
||||
{
|
||||
((Unit*)pSource)->GetMotionMaster()->Clear();
|
||||
|
|
@ -1288,7 +1336,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
{
|
||||
Player* pPlayer = GetPlayerTargetOrSourceAndLog(pSource, pTarget);
|
||||
if (!pPlayer)
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
pPlayer->TeleportTo(m_script->teleportTo.mapId, m_script->x, m_script->y, m_script->z, m_script->o);
|
||||
break;
|
||||
|
|
@ -1297,11 +1347,15 @@ bool ScriptAction::HandleScriptStep()
|
|||
{
|
||||
Player* pPlayer = GetPlayerTargetOrSourceAndLog(pSource, pTarget);
|
||||
if (!pPlayer)
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
WorldObject* pWorldObject = NULL;
|
||||
if (pSource && pSource->isType(TYPEMASK_CREATURE_OR_GAMEOBJECT))
|
||||
{ pWorldObject = pSource; }
|
||||
{
|
||||
pWorldObject = pSource;
|
||||
}
|
||||
else if (pTarget && pTarget->isType(TYPEMASK_CREATURE_OR_GAMEOBJECT))
|
||||
{ pWorldObject = pTarget; }
|
||||
|
||||
|
|
@ -1315,13 +1369,17 @@ bool ScriptAction::HandleScriptStep()
|
|||
bool failQuest = false;
|
||||
// Creature must be alive for giving credit
|
||||
if (pWorldObject && pWorldObject->GetTypeId() == TYPEID_UNIT && !((Creature*)pWorldObject)->IsAlive())
|
||||
{ failQuest = true; }
|
||||
{
|
||||
failQuest = true;
|
||||
}
|
||||
else if (m_script->questExplored.distance != 0 && !pWorldObject->IsWithinDistInMap(pPlayer, float(m_script->questExplored.distance)))
|
||||
{ failQuest = true; }
|
||||
|
||||
// quest id and flags checked at script loading
|
||||
if (!failQuest)
|
||||
{ pPlayer->AreaExploredOrEventHappens(m_script->questExplored.questId); }
|
||||
{
|
||||
pPlayer->AreaExploredOrEventHappens(m_script->questExplored.questId);
|
||||
}
|
||||
else
|
||||
{ pPlayer->FailQuest(m_script->questExplored.questId); }
|
||||
|
||||
|
|
@ -1331,7 +1389,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
{
|
||||
Player* pPlayer = GetPlayerTargetOrSourceAndLog(pSource, pTarget);
|
||||
if (!pPlayer)
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
uint32 creatureEntry = m_script->killCredit.creatureEntry;
|
||||
WorldObject* pRewardSource = pSource && pSource->GetTypeId() == TYPEID_UNIT ? pSource : (pTarget && pTarget->GetTypeId() == TYPEID_UNIT ? pTarget : NULL);
|
||||
|
|
@ -1340,7 +1400,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
if (!creatureEntry)
|
||||
{
|
||||
if (pRewardSource)
|
||||
{ creatureEntry = pRewardSource->GetEntry(); }
|
||||
{
|
||||
creatureEntry = pRewardSource->GetEntry();
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog.outErrorDb(" DB-SCRIPTS: Process table `db_scripts [type = %d]` id %u, command %u called for dynamic killcredit without creature partner, skipping.", m_type, m_script->id, m_script->command);
|
||||
|
|
@ -1352,7 +1414,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
{
|
||||
WorldObject* pSearcher = pRewardSource ? pRewardSource : (pSource ? pSource : pTarget);
|
||||
if (pSearcher != pRewardSource)
|
||||
{ sLog.outDebug(" DB-SCRIPTS: Process table `db_scripts [type = %d]` id %u, SCRIPT_COMMAND_KILL_CREDIT called for groupCredit without creature as searcher, script might need adjustment.", m_type, m_script->id); }
|
||||
{
|
||||
sLog.outDebug(" DB-SCRIPTS: Process table `db_scripts [type = %d]` id %u, SCRIPT_COMMAND_KILL_CREDIT called for groupCredit without creature as searcher, script might need adjustment.", m_type, m_script->id);
|
||||
}
|
||||
pPlayer->RewardPlayerAndGroupAtEvent(creatureEntry, pSearcher);
|
||||
}
|
||||
else
|
||||
|
|
@ -1377,7 +1441,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
else
|
||||
{
|
||||
if (LogIfNotGameObject(pSource))
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
pGo = (GameObject*)pSource;
|
||||
}
|
||||
|
|
@ -1435,7 +1501,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
{
|
||||
GameObjectData const* goData = sObjectMgr.GetGOData(m_script->changeDoor.goGuid);
|
||||
if (!goData) // checked at load
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO - Was a change, before random map
|
||||
pDoor = m_map->GetGameObject(ObjectGuid(HIGHGUID_GAMEOBJECT, goData->id, m_script->changeDoor.goGuid));
|
||||
|
|
@ -1443,7 +1511,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
else
|
||||
{
|
||||
if (LogIfNotGameObject(pSource))
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
pDoor = (GameObject*)pSource;
|
||||
}
|
||||
|
|
@ -1467,16 +1537,22 @@ bool ScriptAction::HandleScriptStep()
|
|||
pDoor->UseDoorOrButton(time_to_reset);
|
||||
|
||||
if (pTarget && pTarget->isType(TYPEMASK_GAMEOBJECT) && ((GameObject*)pTarget)->GetGoType() == GAMEOBJECT_TYPE_BUTTON)
|
||||
{ ((GameObject*)pTarget)->UseDoorOrButton(time_to_reset); }
|
||||
{
|
||||
((GameObject*)pTarget)->UseDoorOrButton(time_to_reset);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case SCRIPT_COMMAND_ACTIVATE_OBJECT: // 13
|
||||
{
|
||||
if (LogIfNotUnit(pSource))
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (LogIfNotGameObject(pTarget))
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
((GameObject*)pTarget)->Use((Unit*)pSource);
|
||||
break;
|
||||
|
|
@ -1484,7 +1560,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
case SCRIPT_COMMAND_REMOVE_AURA: // 14
|
||||
{
|
||||
if (LogIfNotUnit(pSource))
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
((Unit*)pSource)->RemoveAurasDueToSpell(m_script->removeAura.spellId);
|
||||
break;
|
||||
|
|
@ -1492,7 +1570,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
case SCRIPT_COMMAND_CAST_SPELL: // 15
|
||||
{
|
||||
if (LogIfNotUnit(pTarget)) // TODO - Change when support for casting without victim will be supported
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// Select Spell
|
||||
uint32 spell = m_script->castSpell.spellId;
|
||||
|
|
@ -1511,7 +1591,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
}
|
||||
|
||||
if (LogIfNotUnit(pSource))
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
((Unit*)pSource)->CastSpell(((Unit*)pTarget), spell, (m_script->data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL) != 0);
|
||||
|
||||
break;
|
||||
|
|
@ -1530,7 +1612,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
{
|
||||
pSoundTarget = GetPlayerTargetOrSourceAndLog(pSource, pTarget);
|
||||
if (!pSoundTarget)
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_script->data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL)
|
||||
|
|
@ -1538,7 +1622,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
else
|
||||
{
|
||||
if (m_script->playSound.flags & 2)
|
||||
{ pSource->PlayDistanceSound(m_script->playSound.soundId, pSoundTarget); }
|
||||
{
|
||||
pSource->PlayDistanceSound(m_script->playSound.soundId, pSoundTarget);
|
||||
}
|
||||
else if (m_script->playSound.flags & (4 | 8))
|
||||
{ m_map->PlayDirectSoundToMap(m_script->playSound.soundId, (m_script->playSound.flags & 8) ? pSource->GetZoneId() : 0); }
|
||||
else
|
||||
|
|
@ -1550,10 +1636,14 @@ bool ScriptAction::HandleScriptStep()
|
|||
{
|
||||
Player* pPlayer = GetPlayerTargetOrSourceAndLog(pSource, pTarget);
|
||||
if (!pPlayer)
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (Item* pItem = pPlayer->StoreNewItemInInventorySlot(m_script->createItem.itemEntry, m_script->createItem.amount))
|
||||
{ pPlayer->SendNewItem(pItem, m_script->createItem.amount, true, false); }
|
||||
{
|
||||
pPlayer->SendNewItem(pItem, m_script->createItem.amount, true, false);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -1567,7 +1657,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
}
|
||||
|
||||
if (LogIfNotCreature(pTarget))
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
((Creature*)pTarget)->ForcedDespawn(m_script->despawn.despawnDelay);
|
||||
|
||||
|
|
@ -1586,7 +1678,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
case SCRIPT_COMMAND_MOVEMENT: // 20
|
||||
{
|
||||
if (LogIfNotCreature(pSource))
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// Consider add additional checks for cases where creature should not change movementType
|
||||
// (pet? in combat? already using same MMgen as script try to apply?)
|
||||
|
|
@ -1598,7 +1692,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
break;
|
||||
case RANDOM_MOTION_TYPE:
|
||||
if (m_script->data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL)
|
||||
{ ((Creature*)pSource)->GetMotionMaster()->MoveRandomAroundPoint(pSource->GetPositionX(), pSource->GetPositionY(), pSource->GetPositionZ(), float(m_script->movement.wanderDistance)); }
|
||||
{
|
||||
((Creature*)pSource)->GetMotionMaster()->MoveRandomAroundPoint(pSource->GetPositionX(), pSource->GetPositionY(), pSource->GetPositionZ(), float(m_script->movement.wanderDistance));
|
||||
}
|
||||
else
|
||||
{
|
||||
float respX, respY, respZ, respO, wander_distance;
|
||||
|
|
@ -1617,7 +1713,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
case SCRIPT_COMMAND_SET_ACTIVEOBJECT: // 21
|
||||
{
|
||||
if (LogIfNotCreature(pSource))
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
((Creature*)pSource)->SetActiveObjectState(m_script->activeObject.activate);
|
||||
break;
|
||||
|
|
@ -1625,10 +1723,14 @@ bool ScriptAction::HandleScriptStep()
|
|||
case SCRIPT_COMMAND_SET_FACTION: // 22
|
||||
{
|
||||
if (LogIfNotCreature(pSource))
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_script->faction.factionId)
|
||||
{ ((Creature*)pSource)->SetFactionTemporary(m_script->faction.factionId, m_script->faction.flags); }
|
||||
{
|
||||
((Creature*)pSource)->SetFactionTemporary(m_script->faction.factionId, m_script->faction.flags);
|
||||
}
|
||||
else
|
||||
{ ((Creature*)pSource)->ClearTemporaryFaction(); }
|
||||
|
||||
|
|
@ -1637,10 +1739,14 @@ bool ScriptAction::HandleScriptStep()
|
|||
case SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL: // 23
|
||||
{
|
||||
if (LogIfNotCreature(pSource))
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (!m_script->morph.creatureOrModelEntry)
|
||||
{ ((Creature*)pSource)->DeMorph(); }
|
||||
{
|
||||
((Creature*)pSource)->DeMorph();
|
||||
}
|
||||
else if (m_script->data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL)
|
||||
{ ((Creature*)pSource)->SetDisplayId(m_script->morph.creatureOrModelEntry); }
|
||||
else
|
||||
|
|
@ -1656,10 +1762,14 @@ bool ScriptAction::HandleScriptStep()
|
|||
case SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL: // 24
|
||||
{
|
||||
if (LogIfNotCreature(pSource))
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (!m_script->mount.creatureOrModelEntry)
|
||||
{ ((Creature*)pSource)->Unmount(); }
|
||||
{
|
||||
((Creature*)pSource)->Unmount();
|
||||
}
|
||||
else if (m_script->data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL)
|
||||
{ ((Creature*)pSource)->Mount(m_script->mount.creatureOrModelEntry); }
|
||||
else
|
||||
|
|
@ -1675,7 +1785,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
case SCRIPT_COMMAND_SET_RUN: // 25
|
||||
{
|
||||
if (LogIfNotCreature(pSource))
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
((Creature*)pSource)->SetWalk(!m_script->run.run, true);
|
||||
|
||||
|
|
@ -1684,9 +1796,13 @@ bool ScriptAction::HandleScriptStep()
|
|||
case SCRIPT_COMMAND_ATTACK_START: // 26
|
||||
{
|
||||
if (LogIfNotCreature(pSource))
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (LogIfNotUnit(pTarget))
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
Creature* pAttacker = static_cast<Creature*>(pSource);
|
||||
Unit* unitTarget = static_cast<Unit*>(pTarget);
|
||||
|
|
@ -1704,7 +1820,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
case SCRIPT_COMMAND_GO_LOCK_STATE: // 27
|
||||
{
|
||||
if (LogIfNotGameObject(pSource))
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
GameObject* pGo = static_cast<GameObject*>(pSource);
|
||||
|
||||
|
|
@ -1717,12 +1835,16 @@ bool ScriptAction::HandleScriptStep()
|
|||
|
||||
// Lock or Unlock
|
||||
if (m_script->goLockState.lockState & 0x01)
|
||||
{ pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); }
|
||||
{
|
||||
pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED);
|
||||
}
|
||||
else if (m_script->goLockState.lockState & 0x02)
|
||||
{ pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); }
|
||||
// Set Non Interactable or Set Interactable
|
||||
if (m_script->goLockState.lockState & 0x04)
|
||||
{ pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NO_INTERACT); }
|
||||
{
|
||||
pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NO_INTERACT);
|
||||
}
|
||||
else if (m_script->goLockState.lockState & 0x08)
|
||||
{ pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NO_INTERACT); }
|
||||
|
||||
|
|
@ -1731,7 +1853,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
case SCRIPT_COMMAND_STAND_STATE: // 28
|
||||
{
|
||||
if (LogIfNotCreature(pSource))
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// Must be safe cast to Unit* here
|
||||
((Unit*)pSource)->SetStandState(m_script->standState.stand_state);
|
||||
|
|
@ -1740,11 +1864,15 @@ bool ScriptAction::HandleScriptStep()
|
|||
case SCRIPT_COMMAND_MODIFY_NPC_FLAGS: // 29
|
||||
{
|
||||
if (LogIfNotCreature(pSource))
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// Add Flags
|
||||
if (m_script->npcFlag.change_flag & 0x01)
|
||||
{ pSource->SetFlag(UNIT_NPC_FLAGS, m_script->npcFlag.flag); }
|
||||
{
|
||||
pSource->SetFlag(UNIT_NPC_FLAGS, m_script->npcFlag.flag);
|
||||
}
|
||||
// Remove Flags
|
||||
else if (m_script->npcFlag.change_flag & 0x02)
|
||||
{ pSource->RemoveFlag(UNIT_NPC_FLAGS, m_script->npcFlag.flag); }
|
||||
|
|
@ -1752,7 +1880,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
else
|
||||
{
|
||||
if (pSource->HasFlag(UNIT_NPC_FLAGS, m_script->npcFlag.flag))
|
||||
{ pSource->RemoveFlag(UNIT_NPC_FLAGS, m_script->npcFlag.flag); }
|
||||
{
|
||||
pSource->RemoveFlag(UNIT_NPC_FLAGS, m_script->npcFlag.flag);
|
||||
}
|
||||
else
|
||||
{ pSource->SetFlag(UNIT_NPC_FLAGS, m_script->npcFlag.flag); }
|
||||
}
|
||||
|
|
@ -1764,7 +1894,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
// only Player
|
||||
Player* pPlayer = GetPlayerTargetOrSourceAndLog(pSource, pTarget);
|
||||
if (!pPlayer)
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
pPlayer->ActivateTaxiPathTo(m_script->sendTaxiPath.taxiPathId);
|
||||
break;
|
||||
|
|
@ -1776,7 +1908,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
{
|
||||
WorldObject* pSearcher = pSource ? pSource : pTarget;
|
||||
if (pSearcher->GetTypeId() == TYPEID_PLAYER && pTarget && pTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
{ pSearcher = pTarget; }
|
||||
{
|
||||
pSearcher = pTarget;
|
||||
}
|
||||
|
||||
Creature* pCreatureBuddy = NULL;
|
||||
MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*pSearcher, m_script->terminateScript.npcEntry, true, false, m_script->terminateScript.searchDist, true);
|
||||
|
|
@ -1803,7 +1937,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
{
|
||||
Creature* cSource = static_cast<Creature*>(pSource);
|
||||
if (cSource->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
|
||||
{ (static_cast<WaypointMovementGenerator<Creature>* >(cSource->GetMotionMaster()->top()))->AddToWaypointPauseTime(m_script->textId[0]); }
|
||||
{
|
||||
(static_cast<WaypointMovementGenerator<Creature>* >(cSource->GetMotionMaster()->top()))->AddToWaypointPauseTime(m_script->textId[0]);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -1814,9 +1950,13 @@ bool ScriptAction::HandleScriptStep()
|
|||
case SCRIPT_COMMAND_PAUSE_WAYPOINTS: // 32
|
||||
{
|
||||
if (LogIfNotCreature(pSource))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (m_script->pauseWaypoint.doPause)
|
||||
{ ((Creature*)pSource)->addUnitState(UNIT_STAT_WAYPOINT_PAUSED); }
|
||||
{
|
||||
((Creature*)pSource)->addUnitState(UNIT_STAT_WAYPOINT_PAUSED);
|
||||
}
|
||||
else
|
||||
{ ((Creature*)pSource)->clearUnitState(UNIT_STAT_WAYPOINT_PAUSED); }
|
||||
break;
|
||||
|
|
@ -1839,7 +1979,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
WorldObject* second = pSource;
|
||||
// First case: target is player
|
||||
if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER)
|
||||
{ player = static_cast<Player*>(pTarget); }
|
||||
{
|
||||
player = static_cast<Player*>(pTarget);
|
||||
}
|
||||
// Second case: source is player
|
||||
else if (pSource && pSource->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
|
|
@ -1849,7 +1991,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
|
||||
bool terminateResult;
|
||||
if (m_script->data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL)
|
||||
{ terminateResult = !sObjectMgr.IsPlayerMeetToCondition(m_script->terminateCond.conditionId, player, m_map, second, CONDITION_FROM_DBSCRIPTS); }
|
||||
{
|
||||
terminateResult = !sObjectMgr.IsPlayerMeetToCondition(m_script->terminateCond.conditionId, player, m_map, second, CONDITION_FROM_DBSCRIPTS);
|
||||
}
|
||||
else
|
||||
{ terminateResult = sObjectMgr.IsPlayerMeetToCondition(m_script->terminateCond.conditionId, player, m_map, second, CONDITION_FROM_DBSCRIPTS); }
|
||||
|
||||
|
|
@ -1861,13 +2005,17 @@ bool ScriptAction::HandleScriptStep()
|
|||
{
|
||||
Player* member = groupRef->getSource();
|
||||
if (member->GetQuestStatus(m_script->terminateCond.failQuest) == QUEST_STATUS_INCOMPLETE)
|
||||
{ member->FailQuest(m_script->terminateCond.failQuest); }
|
||||
{
|
||||
member->FailQuest(m_script->terminateCond.failQuest);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (player->GetQuestStatus(m_script->terminateCond.failQuest) == QUEST_STATUS_INCOMPLETE)
|
||||
{ player->FailQuest(m_script->terminateCond.failQuest); }
|
||||
{
|
||||
player->FailQuest(m_script->terminateCond.failQuest);
|
||||
}
|
||||
}
|
||||
}
|
||||
return terminateResult;
|
||||
|
|
@ -1890,7 +2038,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
case SCRIPT_COMMAND_TURN_TO: // 36
|
||||
{
|
||||
if (LogIfNotUnit(pSource))
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
((Unit*)pSource)->SetFacingTo(pSource->GetAngle(pTarget));
|
||||
break;
|
||||
|
|
@ -2039,7 +2189,9 @@ bool ScriptAction::HandleScriptStep()
|
|||
case SCRIPT_COMMAND_CHANGE_ENTRY: // 45
|
||||
{
|
||||
if (LogIfNotCreature(pSource))
|
||||
{ break; }
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
((Creature*)pSource)->UpdateEntry(m_script->changeEntry.creatureEntry);
|
||||
break;
|
||||
|
|
@ -2224,13 +2376,17 @@ uint32 ScriptMgr::GetScriptId(const char* name) const
|
|||
// use binary search to find the script name in the sorted vector
|
||||
// assume "" is the first element
|
||||
if (!name)
|
||||
{ return 0; }
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ScriptNameMap::const_iterator itr =
|
||||
std::lower_bound(m_scriptNames.begin(), m_scriptNames.end(), name);
|
||||
|
||||
if (itr == m_scriptNames.end() || *itr != name)
|
||||
{ return 0; }
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return uint32(itr - m_scriptNames.begin());
|
||||
}
|
||||
|
|
@ -2337,7 +2493,9 @@ bool ScriptMgr::OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 send
|
|||
|
||||
#ifdef ENABLE_SD3
|
||||
if (code)
|
||||
{ return SD3::GossipSelectWithCode(pPlayer, pCreature, sender, action, code); }
|
||||
{
|
||||
return SD3::GossipSelectWithCode(pPlayer, pCreature, sender, action, code);
|
||||
}
|
||||
else
|
||||
{ return SD3::GossipSelect(pPlayer, pCreature, sender, action); }
|
||||
#else
|
||||
|
|
@ -2363,7 +2521,9 @@ bool ScriptMgr::OnGossipSelect(Player* pPlayer, GameObject* pGameObject, uint32
|
|||
|
||||
#ifdef ENABLE_SD3
|
||||
if (code)
|
||||
{ return SD3::GOGossipSelectWithCode(pPlayer, pGameObject, sender, action, code); }
|
||||
{
|
||||
return SD3::GOGossipSelectWithCode(pPlayer, pGameObject, sender, action, code);
|
||||
}
|
||||
else
|
||||
{ return SD3::GOGossipSelect(pPlayer, pGameObject, sender, action); }
|
||||
#else
|
||||
|
|
@ -2684,7 +2844,9 @@ void ScriptMgr::CollectPossibleEventIds(std::set<uint32>& eventIds)
|
|||
if (spell->Effect[j] == SPELL_EFFECT_SEND_EVENT)
|
||||
{
|
||||
if (spell->EffectMiscValue[j])
|
||||
{ eventIds.insert(spell->EffectMiscValue[j]); }
|
||||
{
|
||||
eventIds.insert(spell->EffectMiscValue[j]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
@ -2715,7 +2877,9 @@ bool StartEvents_Event(Map* map, uint32 id, Object* source, Object* target, bool
|
|||
|
||||
// Handle SD3 script
|
||||
if (sScriptMgr.OnProcessEvent(id, source, target, isStart))
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Handle PvP Calls
|
||||
if (forwardToPvp && source->GetTypeId() == TYPEID_GAMEOBJECT)
|
||||
|
|
@ -2726,7 +2890,9 @@ bool StartEvents_Event(Map* map, uint32 id, Object* source, Object* target, bool
|
|||
{
|
||||
bg = ((Player*)forwardToPvp)->GetBattleGround();
|
||||
if (!bg)
|
||||
{ opvp = sOutdoorPvPMgr.GetScript(((Player*)forwardToPvp)->GetCachedZoneId()); }
|
||||
{
|
||||
opvp = sOutdoorPvPMgr.GetScript(((Player*)forwardToPvp)->GetCachedZoneId());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -2741,15 +2907,21 @@ bool StartEvents_Event(Map* map, uint32 id, Object* source, Object* target, bool
|
|||
}
|
||||
|
||||
if (bg && bg->HandleEvent(id, static_cast<GameObject*>(source)))
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (opvp && opvp->HandleEvent(id, static_cast<GameObject*>(source)))
|
||||
{ return true; }
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Map::ScriptExecutionParam execParam = Map::SCRIPT_EXEC_PARAM_UNIQUE_BY_SOURCE_TARGET;
|
||||
if (source->isType(TYPEMASK_CREATURE_OR_GAMEOBJECT))
|
||||
{ execParam = Map::SCRIPT_EXEC_PARAM_UNIQUE_BY_SOURCE; }
|
||||
{
|
||||
execParam = Map::SCRIPT_EXEC_PARAM_UNIQUE_BY_SOURCE;
|
||||
}
|
||||
else if (target && target->isType(TYPEMASK_CREATURE_OR_GAMEOBJECT))
|
||||
{ execParam = Map::SCRIPT_EXEC_PARAM_UNIQUE_BY_TARGET; }
|
||||
|
||||
|
|
|
|||
|
|
@ -5331,7 +5331,9 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
}
|
||||
|
||||
if (!m_IsTriggeredSpell && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, m_spellInfo->Id, NULL, SPELL_ATTR_EX2_IGNORE_LOS) && VMAP::VMapFactory::checkSpellForLoS(m_spellInfo->Id) && !m_caster->IsWithinLOSInMap(target))
|
||||
{ return SPELL_FAILED_LINE_OF_SIGHT; }
|
||||
{
|
||||
return SPELL_FAILED_LINE_OF_SIGHT;
|
||||
}
|
||||
|
||||
// auto selection spell rank implemented in WorldSession::HandleCastSpellOpcode
|
||||
// this case can be triggered if rank not found (too low-level target for first rank)
|
||||
|
|
@ -7658,7 +7660,9 @@ bool Spell::CheckTarget(Unit* target, SpellEffectIndex eff)
|
|||
return false;
|
||||
|
||||
if (!m_spellInfo->HasAttribute(SPELL_ATTR_EX2_IGNORE_LOS) && !corpse->IsWithinLOSInMap(m_caster))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// all ok by some way or another, skip normal check
|
||||
|
|
@ -7668,7 +7672,9 @@ bool Spell::CheckTarget(Unit* target, SpellEffectIndex eff)
|
|||
if (target != m_caster)
|
||||
if (WorldObject* caster = GetCastingObject())
|
||||
if (!m_spellInfo->HasAttribute(SPELL_ATTR_EX2_IGNORE_LOS) && !target->IsWithinLOSInMap(caster))
|
||||
{ return false; }
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -40,7 +40,9 @@ namespace Movement
|
|||
float u = 1.f;
|
||||
int32 seg_time = spline.length(point_Idx, point_Idx + 1);
|
||||
if (seg_time > 0)
|
||||
{ u = (time_passed - spline.length(point_Idx)) / (float)seg_time; }
|
||||
{
|
||||
u = (time_passed - spline.length(point_Idx)) / (float)seg_time;
|
||||
}
|
||||
Location c;
|
||||
c.orientation = initialOrientation;
|
||||
spline.evaluate_percent(point_Idx, u, c);
|
||||
|
|
@ -55,7 +57,9 @@ namespace Movement
|
|||
if (splineflags.done && splineflags.isFacing())
|
||||
{
|
||||
if (splineflags.final_angle)
|
||||
{ c.orientation = facing.angle; }
|
||||
{
|
||||
c.orientation = facing.angle;
|
||||
}
|
||||
else if (splineflags.final_point)
|
||||
{ c.orientation = atan2(facing.f.y - c.y, facing.f.x - c.x); }
|
||||
// nothing to do for MoveSplineFlag::Final_Target flag
|
||||
|
|
@ -93,7 +97,9 @@ namespace Movement
|
|||
float z_now = spline.getPoint(spline.first()).z - Movement::computeFallElevation(MSToSec(time_passed));
|
||||
float final_z = FinalDestination().z;
|
||||
if (z_now < final_z)
|
||||
{ el = final_z; }
|
||||
{
|
||||
el = final_z;
|
||||
}
|
||||
else
|
||||
{ el = z_now; }
|
||||
}
|
||||
|
|
@ -301,7 +307,9 @@ namespace Movement
|
|||
str << "spline Id: " << GetId() << std::endl;
|
||||
str << "flags: " << splineflags.ToString() << std::endl;
|
||||
if (splineflags.final_angle)
|
||||
{ str << "facing angle: " << facing.angle; }
|
||||
{
|
||||
str << "facing angle: " << facing.angle;
|
||||
}
|
||||
else if (splineflags.final_target)
|
||||
{ str << "facing target: " << facing.target; }
|
||||
else if (splineflags.final_point)
|
||||
|
|
@ -326,7 +334,9 @@ namespace Movement
|
|||
{
|
||||
int32 point = point_Idx_offset + point_Idx - spline.first() + (int)Finalized();
|
||||
if (isCyclic())
|
||||
{ point = point % (spline.last() - spline.first()); }
|
||||
{
|
||||
point = point % (spline.last() - spline.first());
|
||||
}
|
||||
return point;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,9 @@ namespace Movement
|
|||
else if (moveFlags & MOVEFLAG_SWIMMING)
|
||||
{
|
||||
if (moveFlags & MOVEFLAG_BACKWARD /*&& speed_obj.swim >= speed_obj.swim_back*/)
|
||||
{ return MOVE_SWIM_BACK; }
|
||||
{
|
||||
return MOVE_SWIM_BACK;
|
||||
}
|
||||
else
|
||||
{ return MOVE_SWIM; }
|
||||
}
|
||||
|
|
@ -71,7 +73,9 @@ namespace Movement
|
|||
// there is a big chance that current position is unknown if current state is not finalized, need compute it
|
||||
// this also allows calculate spline position and update map position in much greater intervals
|
||||
if (!move_spline.Finalized() && !transportInfo)
|
||||
{ real_position = move_spline.ComputePosition(); }
|
||||
{
|
||||
real_position = move_spline.ComputePosition();
|
||||
}
|
||||
|
||||
if (args.path.empty())
|
||||
{
|
||||
|
|
@ -92,10 +96,14 @@ namespace Movement
|
|||
moveFlags |= MOVEFLAG_FORWARD;
|
||||
|
||||
if (args.velocity == 0.f)
|
||||
{ args.velocity = unit.GetSpeed(SelectSpeedType(moveFlags)); }
|
||||
{
|
||||
args.velocity = unit.GetSpeed(SelectSpeedType(moveFlags));
|
||||
}
|
||||
|
||||
if (!args.Validate(&unit))
|
||||
{ return 0; }
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
unit.m_movementInfo.SetMovementFlags((MovementFlags)moveFlags);
|
||||
move_spline.Initialize(args);
|
||||
|
|
|
|||
|
|
@ -131,7 +131,9 @@ namespace Movement
|
|||
if (splineflags & MoveSplineFlag::UncompressedPath)
|
||||
{
|
||||
if (splineflags.cyclic)
|
||||
{ WriteCatmullRomCyclicPath(spline, data); }
|
||||
{
|
||||
WriteCatmullRomCyclicPath(spline, data);
|
||||
}
|
||||
else
|
||||
{ WriteCatmullRomPath(spline, data); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -233,7 +233,9 @@ namespace Movement
|
|||
// first and last two indexes are space for special 'virtual points'
|
||||
// these points are required for proper C_Evaluate and C_Evaluate_Derivative methtod work
|
||||
if (cyclic)
|
||||
{ points[count] = controls[cyclic_point]; }
|
||||
{
|
||||
points[count] = controls[cyclic_point];
|
||||
}
|
||||
else
|
||||
{ points[count] = controls[count - 1]; }
|
||||
|
||||
|
|
@ -257,7 +259,9 @@ namespace Movement
|
|||
if (cyclic)
|
||||
{
|
||||
if (cyclic_point == 0)
|
||||
{ points[0] = controls[count - 1]; }
|
||||
{
|
||||
points[0] = controls[count - 1];
|
||||
}
|
||||
else
|
||||
{ points[0] = controls[0].lerp(controls[1], -1); }
|
||||
|
||||
|
|
|
|||
|
|
@ -84,7 +84,9 @@ namespace Movement
|
|||
void Increase()
|
||||
{
|
||||
if (m_counter == limit)
|
||||
{ init(); }
|
||||
{
|
||||
init();
|
||||
}
|
||||
else
|
||||
{ ++m_counter; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,20 +41,26 @@ namespace Movement
|
|||
float computeFallTime(float path_length, bool isSafeFall)
|
||||
{
|
||||
if (path_length < 0.f)
|
||||
{ return 0.f; }
|
||||
{
|
||||
return 0.f;
|
||||
}
|
||||
|
||||
float time;
|
||||
if (isSafeFall)
|
||||
{
|
||||
if (path_length >= terminal_savefall_length)
|
||||
{ time = (path_length - terminal_savefall_length) / terminalSavefallVelocity + terminalSavefallVelocity / gravity; }
|
||||
{
|
||||
time = (path_length - terminal_savefall_length) / terminalSavefallVelocity + terminalSavefallVelocity / gravity;
|
||||
}
|
||||
else
|
||||
{ time = sqrtf(2.f * path_length / gravity); }
|
||||
}
|
||||
else
|
||||
{
|
||||
if (path_length >= terminal_length)
|
||||
{ time = (path_length - terminal_length) / terminalVelocity + terminalFallTime; }
|
||||
{
|
||||
time = (path_length - terminal_length) / terminalVelocity + terminalFallTime;
|
||||
}
|
||||
else
|
||||
{ time = sqrtf(2.f * path_length / gravity); }
|
||||
}
|
||||
|
|
@ -68,12 +74,16 @@ namespace Movement
|
|||
float result;
|
||||
|
||||
if (isSafeFall)
|
||||
{ termVel = terminalSavefallVelocity; }
|
||||
{
|
||||
termVel = terminalSavefallVelocity;
|
||||
}
|
||||
else
|
||||
{ termVel = terminalVelocity; }
|
||||
|
||||
if (start_velocity > termVel)
|
||||
{ start_velocity = termVel; }
|
||||
{
|
||||
start_velocity = termVel;
|
||||
}
|
||||
|
||||
float terminal_time = terminalFallTime - start_velocity / gravity; // the time that needed to reach terminalVelocity
|
||||
|
||||
|
|
@ -201,7 +211,9 @@ namespace Movement
|
|||
for (int i = 0; i < N; ++i)
|
||||
{
|
||||
if ((t & (Flags)(1 << i)) && names[i] != NULL)
|
||||
{ str.append(" ").append(names[i]); }
|
||||
{
|
||||
str.append(" ").append(names[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,9 @@ void BIH::subdivide(int left, int right, std::vector<uint32>& tempTree, buildDat
|
|||
// perform quick consistency checks
|
||||
Vector3 d(gridBox.hi - gridBox.lo);
|
||||
if (d.x < 0 || d.y < 0 || d.z < 0)
|
||||
{ throw std::logic_error("negative node extents"); }
|
||||
{
|
||||
throw std::logic_error("negative node extents");
|
||||
}
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
if (nodeBox.hi[i] < gridBox.lo[i] || nodeBox.lo[i] > gridBox.hi[i])
|
||||
|
|
@ -88,7 +90,9 @@ void BIH::subdivide(int left, int right, std::vector<uint32>& tempTree, buildDat
|
|||
// stay left
|
||||
++i;
|
||||
if (clipL < maxb)
|
||||
{ clipL = maxb; }
|
||||
{
|
||||
clipL = maxb;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -98,7 +102,9 @@ void BIH::subdivide(int left, int right, std::vector<uint32>& tempTree, buildDat
|
|||
dat.indices[right] = t;
|
||||
--right;
|
||||
if (clipR > minb)
|
||||
{ clipR = minb; }
|
||||
{
|
||||
clipR = minb;
|
||||
}
|
||||
}
|
||||
nodeL = std::min(nodeL, minb);
|
||||
nodeR = std::max(nodeR, maxb);
|
||||
|
|
@ -245,11 +251,15 @@ void BIH::subdivide(int left, int right, std::vector<uint32>& tempTree, buildDat
|
|||
nodeBoxR.lo[axis] = clipR;
|
||||
// recurse
|
||||
if (nl > 0)
|
||||
{ subdivide(left, right, tempTree, dat, gridBoxL, nodeBoxL, nextIndex, depth + 1, stats); }
|
||||
{
|
||||
subdivide(left, right, tempTree, dat, gridBoxL, nodeBoxL, nextIndex, depth + 1, stats);
|
||||
}
|
||||
else
|
||||
{ stats.updateLeaf(depth + 1, 0); }
|
||||
if (nr > 0)
|
||||
{ subdivide(right + 1, rightOrig, tempTree, dat, gridBoxR, nodeBoxR, nextIndex + 3, depth + 1, stats); }
|
||||
{
|
||||
subdivide(right + 1, rightOrig, tempTree, dat, gridBoxR, nodeBoxR, nextIndex + 3, depth + 1, stats);
|
||||
}
|
||||
else
|
||||
{ stats.updateLeaf(depth + 1, 0); }
|
||||
}
|
||||
|
|
|
|||
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