mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19:37:03 +00:00
[Sync] Some long overdue project sync
This commit is contained in:
parent
a479a2ccc5
commit
65ec4ea06e
76 changed files with 1693 additions and 1489 deletions
|
|
@ -62,7 +62,7 @@ class LootTemplate::LootGroup // A set of loot def
|
|||
public:
|
||||
void AddEntry(LootStoreItem& item); // Adds an entry to the group (at loading stage)
|
||||
bool HasQuestDrop() const; // True if group includes at least 1 quest drop entry
|
||||
bool HasQuestDropForPlayer(Player const* player) const;
|
||||
bool HasQuestDropForPlayer(Player const* player) const; // The same for active quests of the player
|
||||
// The same for active quests of the player
|
||||
void Process(Loot& loot) const; // Rolls an item from the group (if any) and adds the item to the loot
|
||||
float RawTotalChance() const; // Overall chance for the group (without equal chanced items)
|
||||
|
|
@ -82,7 +82,7 @@ class LootTemplate::LootGroup // A set of loot def
|
|||
void LootStore::Clear()
|
||||
{
|
||||
for (LootTemplateMap::const_iterator itr = m_LootTemplates.begin(); itr != m_LootTemplates.end(); ++itr)
|
||||
delete itr->second;
|
||||
{ delete itr->second; }
|
||||
m_LootTemplates.clear();
|
||||
}
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ void LootStore::Clear()
|
|||
void LootStore::Verify() const
|
||||
{
|
||||
for (LootTemplateMap::const_iterator i = m_LootTemplates.begin(); i != m_LootTemplates.end(); ++i)
|
||||
i->second->Verify(*this, i->first);
|
||||
{ i->second->Verify(*this, i->first); }
|
||||
}
|
||||
|
||||
// Loads a *_loot_template DB table into loot store
|
||||
|
|
@ -152,7 +152,7 @@ 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
|
||||
|
|
@ -193,7 +193,7 @@ 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);
|
||||
|
|
@ -204,7 +204,7 @@ 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;
|
||||
}
|
||||
|
|
@ -214,7 +214,7 @@ 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;
|
||||
}
|
||||
|
|
@ -224,20 +224,20 @@ void LootStore::LoadAndCollectLootIds(LootIdSet& ids_set)
|
|||
LoadLootTable();
|
||||
|
||||
for (LootTemplateMap::const_iterator tab = m_LootTemplates.begin(); tab != m_LootTemplates.end(); ++tab)
|
||||
ids_set.insert(tab->first);
|
||||
{ ids_set.insert(tab->first); }
|
||||
}
|
||||
|
||||
void LootStore::CheckLootRefs(LootIdSet* ref_set) const
|
||||
{
|
||||
for (LootTemplateMap::const_iterator ltItr = m_LootTemplates.begin(); ltItr != m_LootTemplates.end(); ++ltItr)
|
||||
ltItr->second->CheckLootRefs(ref_set);
|
||||
{ ltItr->second->CheckLootRefs(ref_set); }
|
||||
}
|
||||
|
||||
void LootStore::ReportUnusedIds(LootIdSet const& ids_set) const
|
||||
{
|
||||
// all still listed ids isn't referenced
|
||||
for (LootIdSet::const_iterator itr = ids_set.begin(); itr != ids_set.end(); ++itr)
|
||||
sLog.outErrorDb("Table '%s' entry %d isn't %s and not referenced from loot, and then useless.", GetName(), *itr, GetEntryName());
|
||||
{ sLog.outErrorDb("Table '%s' entry %d isn't %s and not referenced from loot, and then useless.", GetName(), *itr, GetEntryName()); }
|
||||
}
|
||||
|
||||
void LootStore::ReportNotExistedId(uint32 id) const
|
||||
|
|
@ -254,10 +254,10 @@ 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));
|
||||
|
|
@ -473,7 +473,7 @@ 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)
|
||||
{
|
||||
|
|
@ -500,7 +500,7 @@ 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
|
||||
{
|
||||
|
|
@ -514,7 +514,7 @@ void Loot::AddItem(LootStoreItem const& item)
|
|||
{
|
||||
ItemPrototype const* proto = ObjectMgr::GetItemPrototype(item.itemid);
|
||||
if (!proto || !(proto->Flags & ITEM_FLAG_PARTY_LOOT))
|
||||
++unlootedCount;
|
||||
{ ++unlootedCount; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -524,14 +524,14 @@ 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;
|
||||
}
|
||||
|
||||
|
|
@ -546,11 +546,11 @@ 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
|
||||
FillNotNormalLootFor(loot_owner);
|
||||
{ FillNotNormalLootFor(loot_owner); }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -565,11 +565,11 @@ 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())
|
||||
|
|
@ -624,7 +624,7 @@ QuestItemList* Loot::FillFFALoot(Player* player)
|
|||
|
||||
QuestItemList* Loot::FillQuestLoot(Player* player)
|
||||
{
|
||||
if (items.size() == MAX_NR_LOOT_ITEMS) return NULL;
|
||||
if (items.size() == MAX_NR_LOOT_ITEMS) { return NULL; }
|
||||
QuestItemList* ql = new QuestItemList();
|
||||
|
||||
for (uint8 i = 0; i < m_questItems.size(); ++i)
|
||||
|
|
@ -639,12 +639,12 @@ 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())
|
||||
|
|
@ -696,9 +696,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);
|
||||
{ m_playersLooting.erase(i); }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -711,9 +711,9 @@ void Loot::NotifyMoneyRemoved()
|
|||
i_next = i;
|
||||
++i_next;
|
||||
if (Player* pl = ObjectAccessor::FindPlayer(*i))
|
||||
pl->SendNotifyLootMoneyRemoved();
|
||||
{ pl->SendNotifyLootMoneyRemoved(); }
|
||||
else
|
||||
m_playersLooting.erase(i);
|
||||
{ m_playersLooting.erase(i); }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -740,14 +740,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
|
||||
m_playersLooting.erase(i);
|
||||
{ m_playersLooting.erase(i); }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -756,11 +756,11 @@ 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));
|
||||
{ gold = uint32(urand(minAmount, maxAmount) * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY)); }
|
||||
else
|
||||
gold = uint32(urand(minAmount >> 8, maxAmount >> 8) * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY)) << 8;
|
||||
{ gold = uint32(urand(minAmount >> 8, maxAmount >> 8) * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY)) << 8; }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -776,7 +776,7 @@ 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;
|
||||
}
|
||||
|
|
@ -813,7 +813,7 @@ 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;
|
||||
}
|
||||
|
|
@ -830,7 +830,7 @@ 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;
|
||||
}
|
||||
|
|
@ -840,7 +840,7 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem** qite
|
|||
}
|
||||
|
||||
if (is_looted)
|
||||
return NULL;
|
||||
{ return NULL; }
|
||||
|
||||
return item;
|
||||
}
|
||||
|
|
@ -897,7 +897,7 @@ 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
|
||||
|
|
@ -915,7 +915,7 @@ 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
|
||||
|
|
@ -992,9 +992,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);
|
||||
{ EqualChanced.push_back(item); }
|
||||
}
|
||||
|
||||
// Rolls an item from the group, returns NULL if all miss their chances
|
||||
|
|
@ -1007,15 +1007,15 @@ 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
|
||||
}
|
||||
|
|
@ -1025,10 +1025,10 @@ 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;
|
||||
}
|
||||
|
||||
|
|
@ -1037,10 +1037,10 @@ 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;
|
||||
}
|
||||
|
||||
|
|
@ -1049,7 +1049,7 @@ 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
|
||||
|
|
@ -1059,7 +1059,7 @@ 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;
|
||||
}
|
||||
|
|
@ -1070,7 +1070,7 @@ float LootTemplate::LootGroup::TotalChance() const
|
|||
float result = RawTotalChance();
|
||||
|
||||
if (!EqualChanced.empty() && result < 100.0f)
|
||||
return 100.0f;
|
||||
{ return 100.0f; }
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -1096,9 +1096,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);
|
||||
{ ref_set->erase(-ieItr->mincountOrRef); }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1107,9 +1107,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);
|
||||
{ ref_set->erase(-ieItr->mincountOrRef); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1124,11 +1124,11 @@ void LootTemplate::AddEntry(LootStoreItem& item)
|
|||
if (item.group > 0 && item.mincountOrRef > 0) // Group
|
||||
{
|
||||
if (item.group >= Groups.size())
|
||||
Groups.resize(item.group); // Adds new group the the loot template if needed
|
||||
{ Groups.resize(item.group); } // Adds new group the the loot template if needed
|
||||
Groups[item.group - 1].AddEntry(item); // Adds new entry to the group
|
||||
}
|
||||
else // Non-grouped entries and references are stored together
|
||||
Entries.push_back(item);
|
||||
{ Entries.push_back(item); }
|
||||
}
|
||||
|
||||
// Rolls for every item in the template and adds the rolled items the the loot
|
||||
|
|
@ -1137,7 +1137,7 @@ void LootTemplate::Process(Loot& loot, LootStore const& store, bool rate, uint8
|
|||
if (groupId) // Group reference uses own processing of the group
|
||||
{
|
||||
if (groupId > Groups.size())
|
||||
return; // Error message already printed at loading stage
|
||||
{ return; } // Error message already printed at loading stage
|
||||
|
||||
Groups[groupId - 1].Process(loot);
|
||||
return;
|
||||
|
|
@ -1147,29 +1147,29 @@ void LootTemplate::Process(Loot& loot, LootStore const& store, bool rate, uint8
|
|||
for (LootStoreItemList::const_iterator i = Entries.begin() ; i != Entries.end() ; ++i)
|
||||
{
|
||||
if (!i->Roll(rate))
|
||||
continue; // Bad luck for the entry
|
||||
{ continue; } // Bad luck for the entry
|
||||
|
||||
if (i->mincountOrRef < 0 && i->type == LOOT_ITEM_TYPE_ITEM) // References processing
|
||||
{
|
||||
LootTemplate const* Referenced = LootTemplates_Reference.GetLootFor(-i->mincountOrRef);
|
||||
|
||||
if (!Referenced)
|
||||
continue; // Error message already printed at loading stage
|
||||
{ continue; } // Error message already printed at loading stage
|
||||
|
||||
// Check condition
|
||||
if (i->conditionId && !sObjectMgr.IsPlayerMeetToCondition(i->conditionId, NULL, NULL, loot.GetLootTarget(), CONDITION_FROM_REFERING_LOOT))
|
||||
continue;
|
||||
{ continue; }
|
||||
|
||||
for (uint32 loop = 0; loop < i->maxcount; ++loop) // Ref multiplicator
|
||||
Referenced->Process(loot, store, rate, i->group);
|
||||
{ Referenced->Process(loot, store, rate, i->group); }
|
||||
}
|
||||
else // Plain entries (not a reference, not grouped)
|
||||
loot.AddItem(*i); // Chance is already checked, just add
|
||||
{ loot.AddItem(*i); } // Chance is already checked, just add
|
||||
}
|
||||
|
||||
// Now processing groups
|
||||
for (LootGroups::const_iterator i = Groups.begin() ; i != Groups.end() ; ++i)
|
||||
i->Process(loot);
|
||||
{ i->Process(loot); }
|
||||
}
|
||||
|
||||
// True if template includes at least 1 quest drop entry
|
||||
|
|
@ -1178,7 +1178,7 @@ bool LootTemplate::HasQuestDrop(LootTemplateMap const& store, uint8 groupId) con
|
|||
if (groupId) // Group reference
|
||||
{
|
||||
if (groupId > Groups.size())
|
||||
return false; // Error message [should be] already printed at loading stage
|
||||
{ return false; } // Error message [should be] already printed at loading stage
|
||||
return Groups[groupId - 1].HasQuestDrop();
|
||||
}
|
||||
|
||||
|
|
@ -1188,18 +1188,18 @@ bool LootTemplate::HasQuestDrop(LootTemplateMap const& store, uint8 groupId) con
|
|||
{
|
||||
LootTemplateMap::const_iterator Referenced = store.find(-i->mincountOrRef);
|
||||
if (Referenced == store.end())
|
||||
continue; // Error message [should be] already printed at loading stage
|
||||
{ continue; } // Error message [should be] already printed at loading stage
|
||||
if (Referenced->second->HasQuestDrop(store, i->group))
|
||||
return true;
|
||||
{ return true; }
|
||||
}
|
||||
else if (i->needs_quest)
|
||||
return true; // quest drop found
|
||||
{ return true; } // quest drop found
|
||||
}
|
||||
|
||||
// Now processing groups
|
||||
for (LootGroups::const_iterator i = Groups.begin() ; i != Groups.end() ; ++i)
|
||||
if (i->HasQuestDrop())
|
||||
return true;
|
||||
{ return true; }
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1210,7 +1210,7 @@ bool LootTemplate::HasQuestDropForPlayer(LootTemplateMap const& store, Player co
|
|||
if (groupId) // Group reference
|
||||
{
|
||||
if (groupId > Groups.size())
|
||||
return false; // Error message already printed at loading stage
|
||||
{ return false; } // Error message already printed at loading stage
|
||||
return Groups[groupId - 1].HasQuestDropForPlayer(player);
|
||||
}
|
||||
|
||||
|
|
@ -1221,18 +1221,18 @@ bool LootTemplate::HasQuestDropForPlayer(LootTemplateMap const& store, Player co
|
|||
{
|
||||
LootTemplateMap::const_iterator Referenced = store.find(-i->mincountOrRef);
|
||||
if (Referenced == store.end())
|
||||
continue; // Error message already printed at loading stage
|
||||
{ continue; } // Error message already printed at loading stage
|
||||
if (Referenced->second->HasQuestDropForPlayer(store, player, i->group))
|
||||
return true;
|
||||
{ return true; }
|
||||
}
|
||||
else if (player->HasQuestForItem(i->itemid))
|
||||
return true; // active quest drop found
|
||||
{ return true; } // active quest drop found
|
||||
}
|
||||
|
||||
// Now checking groups
|
||||
for (LootGroups::const_iterator i = Groups.begin(); i != Groups.end(); ++i)
|
||||
if (i->HasQuestDropForPlayer(player))
|
||||
return true;
|
||||
{ return true; }
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1242,7 +1242,7 @@ void LootTemplate::Verify(LootStore const& lootstore, uint32 id) const
|
|||
{
|
||||
// Checking group chances
|
||||
for (uint32 i = 0; i < Groups.size(); ++i)
|
||||
Groups[i].Verify(lootstore, id, i + 1);
|
||||
{ Groups[i].Verify(lootstore, id, i + 1); }
|
||||
|
||||
// TODO: References validity checks
|
||||
}
|
||||
|
|
@ -1254,14 +1254,14 @@ 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);
|
||||
{ ref_set->erase(-ieItr->mincountOrRef); }
|
||||
}
|
||||
}
|
||||
|
||||
for (LootGroups::const_iterator grItr = Groups.begin(); grItr != Groups.end(); ++grItr)
|
||||
grItr->CheckLootRefs(ref_set);
|
||||
{ grItr->CheckLootRefs(ref_set); }
|
||||
}
|
||||
|
||||
void LoadLootTemplates_Creature()
|
||||
|
|
@ -1284,7 +1284,7 @@ void LoadLootTemplates_Creature()
|
|||
}
|
||||
}
|
||||
for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
|
||||
ids_set.erase(*itr);
|
||||
{ ids_set.erase(*itr); }
|
||||
|
||||
// for alterac valley we've defined Player-loot inside creature_loot_template id=0
|
||||
// this hack is used, so that we won't need to create an extra table player_loot_template for just one case
|
||||
|
|
@ -1314,7 +1314,7 @@ void LoadLootTemplates_Disenchant()
|
|||
}
|
||||
}
|
||||
for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
|
||||
ids_set.erase(*itr);
|
||||
{ ids_set.erase(*itr); }
|
||||
// output error for any still listed (not referenced from appropriate table) ids
|
||||
LootTemplates_Disenchant.ReportUnusedIds(ids_set);
|
||||
}
|
||||
|
|
@ -1329,7 +1329,7 @@ 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
|
||||
|
|
@ -1356,7 +1356,7 @@ void LoadLootTemplates_Gameobject()
|
|||
}
|
||||
}
|
||||
for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
|
||||
ids_set.erase(*itr);
|
||||
{ ids_set.erase(*itr); }
|
||||
|
||||
// output error for any still listed (not referenced from appropriate table) ids
|
||||
LootTemplates_Gameobject.ReportUnusedIds(ids_set);
|
||||
|
|
@ -1373,13 +1373,13 @@ 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);
|
||||
{ LootTemplates_Item.ReportNotExistedId(proto->ItemId); }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1432,7 +1432,7 @@ void LoadLootTemplates_Pickpocketing()
|
|||
}
|
||||
}
|
||||
for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
|
||||
ids_set.erase(*itr);
|
||||
{ ids_set.erase(*itr); }
|
||||
|
||||
// output error for any still listed (not referenced from appropriate table) ids
|
||||
LootTemplates_Pickpocketing.ReportUnusedIds(ids_set);
|
||||
|
|
@ -1472,7 +1472,7 @@ 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);
|
||||
|
|
@ -1498,7 +1498,7 @@ void LoadLootTemplates_Skinning()
|
|||
}
|
||||
}
|
||||
for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
|
||||
ids_set.erase(*itr);
|
||||
{ ids_set.erase(*itr); }
|
||||
|
||||
// output error for any still listed (not referenced from appropriate table) ids
|
||||
LootTemplates_Skinning.ReportUnusedIds(ids_set);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue