mirror of
https://github.com/mangosfour/server.git
synced 2025-12-17 16:37:00 +00:00
[11269] Apply to lootPlayerNonQuestNonFFAConditionalItems same loot rules as to notmal shared loot.
Also some code refactoring.
This commit is contained in:
parent
3edc98c4aa
commit
92a1e9b4d0
4 changed files with 54 additions and 65 deletions
|
|
@ -392,6 +392,27 @@ bool LootItem::AllowedForPlayer(Player const * player) const
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LootSlotType LootItem::GetSlotTypeForSharedLoot(PermissionTypes permission, Player* viewer, bool condition_ok /*= false*/) const
|
||||||
|
{
|
||||||
|
// ignore looted, FFA (each player get own copy) and not allowed items
|
||||||
|
if (is_looted || freeforall || conditionId && !condition_ok || !AllowedForPlayer(viewer))
|
||||||
|
return MAX_LOOT_SLOT_TYPE;
|
||||||
|
|
||||||
|
switch (permission)
|
||||||
|
{
|
||||||
|
case GROUP_PERMISSION:
|
||||||
|
return (is_blocked || is_underthreshold) ? LOOT_SLOT_NORMAL : LOOT_SLOT_VIEW;
|
||||||
|
case ALL_PERMISSION:
|
||||||
|
return LOOT_SLOT_NORMAL;
|
||||||
|
case OWNER_PERMISSION:
|
||||||
|
return LOOT_SLOT_OWNER;
|
||||||
|
case MASTER_PERMISSION:
|
||||||
|
return !is_underthreshold ? LOOT_SLOT_MASTER : LOOT_SLOT_NORMAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return MAX_LOOT_SLOT_TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// --------- Loot ---------
|
// --------- Loot ---------
|
||||||
//
|
//
|
||||||
|
|
@ -737,55 +758,38 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
|
||||||
size_t count_pos = b.wpos(); // pos of item count byte
|
size_t count_pos = b.wpos(); // pos of item count byte
|
||||||
b << uint8(0); // item count placeholder
|
b << uint8(0); // item count placeholder
|
||||||
|
|
||||||
switch (lv.permission)
|
if (lv.permission == NONE_PERMISSION)
|
||||||
{
|
|
||||||
case GROUP_PERMISSION:
|
|
||||||
{
|
|
||||||
// You are not the items proprietary, so you can only see
|
|
||||||
// blocked rolled items and quest items, and !ffa items
|
|
||||||
for (uint8 i = 0; i < l.items.size(); ++i)
|
|
||||||
{
|
|
||||||
if (!l.items[i].is_looted && !l.items[i].freeforall && !l.items[i].conditionId && l.items[i].AllowedForPlayer(lv.viewer))
|
|
||||||
{
|
|
||||||
LootSlotType slot_type = (l.items[i].is_blocked || l.items[i].is_underthreshold)
|
|
||||||
? LOOT_SLOT_NORMAL : LOOT_SLOT_VIEW;
|
|
||||||
|
|
||||||
b << uint8(i) << l.items[i]; //send the index and the item if it's not looted, and blocked or under threshold, free for all items will be sent later, only one-player loots here
|
|
||||||
b << uint8(slot_type); // 0 - get 1 - look only
|
|
||||||
++itemsShown;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case ALL_PERMISSION:
|
|
||||||
case OWNER_PERMISSION:
|
|
||||||
case MASTER_PERMISSION:
|
|
||||||
{
|
|
||||||
for (uint8 i = 0; i < l.items.size(); ++i)
|
|
||||||
{
|
|
||||||
if (!l.items[i].is_looted && !l.items[i].freeforall && !l.items[i].conditionId && l.items[i].AllowedForPlayer(lv.viewer))
|
|
||||||
{
|
|
||||||
LootSlotType slot_type = LOOT_SLOT_NORMAL;
|
|
||||||
|
|
||||||
switch(lv.permission)
|
|
||||||
{
|
|
||||||
case MASTER_PERMISSION:
|
|
||||||
if (!l.items[i].is_underthreshold)
|
|
||||||
slot_type = LOOT_SLOT_MASTER;
|
|
||||||
break;
|
|
||||||
case OWNER_PERMISSION:
|
|
||||||
slot_type = LOOT_SLOT_OWNER;
|
|
||||||
}
|
|
||||||
|
|
||||||
b << uint8(i) << l.items[i]; //only send one-player loot items now, free for all will be sent later
|
|
||||||
b << uint8(slot_type); // 0 - get 2 - master selection
|
|
||||||
++itemsShown;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return b; // nothing output more
|
return b; // nothing output more
|
||||||
|
|
||||||
|
|
||||||
|
for (uint8 i = 0; i < l.items.size(); ++i)
|
||||||
|
{
|
||||||
|
LootSlotType slot_type = l.items[i].GetSlotTypeForSharedLoot(lv.permission, lv.viewer);
|
||||||
|
if (slot_type >= MAX_LOOT_SLOT_TYPE)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
b << uint8(i) << l.items[i];
|
||||||
|
b << uint8(slot_type); // 0 - get 1 - look only 2 - master selection
|
||||||
|
++itemsShown;
|
||||||
|
}
|
||||||
|
|
||||||
|
QuestItemMap const& lootPlayerNonQuestNonFFAConditionalItems = l.GetPlayerNonQuestNonFFAConditionalItems();
|
||||||
|
QuestItemMap::const_iterator nn_itr = lootPlayerNonQuestNonFFAConditionalItems.find(lv.viewer->GetGUIDLow());
|
||||||
|
if (nn_itr != lootPlayerNonQuestNonFFAConditionalItems.end())
|
||||||
|
{
|
||||||
|
QuestItemList *conditional_list = nn_itr->second;
|
||||||
|
for (QuestItemList::const_iterator ci = conditional_list->begin() ; ci != conditional_list->end(); ++ci)
|
||||||
|
{
|
||||||
|
LootItem &item = l.items[ci->index];
|
||||||
|
|
||||||
|
LootSlotType slot_type = item.GetSlotTypeForSharedLoot(lv.permission, lv.viewer, !ci->is_looted);
|
||||||
|
if (slot_type >= MAX_LOOT_SLOT_TYPE)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
b << uint8(ci->index) << item;
|
||||||
|
b << uint8(slot_type); // allow loot
|
||||||
|
++itemsShown;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// in next cases used same slot type for all items
|
// in next cases used same slot type for all items
|
||||||
|
|
@ -826,23 +830,6 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QuestItemMap const& lootPlayerNonQuestNonFFAConditionalItems = l.GetPlayerNonQuestNonFFAConditionalItems();
|
|
||||||
QuestItemMap::const_iterator nn_itr = lootPlayerNonQuestNonFFAConditionalItems.find(lv.viewer->GetGUIDLow());
|
|
||||||
if (nn_itr != lootPlayerNonQuestNonFFAConditionalItems.end())
|
|
||||||
{
|
|
||||||
QuestItemList *conditional_list = nn_itr->second;
|
|
||||||
for (QuestItemList::const_iterator ci = conditional_list->begin() ; ci != conditional_list->end(); ++ci)
|
|
||||||
{
|
|
||||||
LootItem &item = l.items[ci->index];
|
|
||||||
if (!ci->is_looted && !item.is_looted)
|
|
||||||
{
|
|
||||||
b << uint8(ci->index) << item;
|
|
||||||
b << uint8(slot_type); // allow loot
|
|
||||||
++itemsShown;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//update number of items shown
|
//update number of items shown
|
||||||
b.put<uint8>(count_pos,itemsShown);
|
b.put<uint8>(count_pos,itemsShown);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ enum LootSlotType
|
||||||
LOOT_SLOT_MASTER = 2, // can be looted only master (error message)
|
LOOT_SLOT_MASTER = 2, // can be looted only master (error message)
|
||||||
LOOT_SLOT_REQS = 3, // can't be looted (error message about missing reqs)
|
LOOT_SLOT_REQS = 3, // can't be looted (error message about missing reqs)
|
||||||
LOOT_SLOT_OWNER = 4, // ignore binding confirmation and etc, for single player looting
|
LOOT_SLOT_OWNER = 4, // ignore binding confirmation and etc, for single player looting
|
||||||
|
MAX_LOOT_SLOT_TYPE // custom, use for mark skipped from show items
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -114,6 +115,7 @@ struct LootItem
|
||||||
|
|
||||||
// Basic checks for player/item compatibility - if false no chance to see the item in the loot
|
// Basic checks for player/item compatibility - if false no chance to see the item in the loot
|
||||||
bool AllowedForPlayer(Player const * player) const;
|
bool AllowedForPlayer(Player const * player) const;
|
||||||
|
LootSlotType GetSlotTypeForSharedLoot(PermissionTypes permission, Player* viewer, bool condition_ok = false) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<LootItem> LootItemList;
|
typedef std::vector<LootItem> LootItemList;
|
||||||
|
|
|
||||||
|
|
@ -1854,12 +1854,12 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
||||||
SpellAuraProcResult HandleModDamagePercentDoneAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
|
SpellAuraProcResult HandleModDamagePercentDoneAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
|
||||||
SpellAuraProcResult HandleModRating(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
|
SpellAuraProcResult HandleModRating(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
|
||||||
SpellAuraProcResult HandleManaShieldAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
|
SpellAuraProcResult HandleManaShieldAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
|
||||||
SpellAuraProcResult HandleNULLProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown)
|
SpellAuraProcResult HandleNULLProc(Unit* /*pVictim*/, uint32 /*damage*/, Aura* /*triggeredByAura*/, SpellEntry const* /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 /*cooldown*/)
|
||||||
{
|
{
|
||||||
// no proc handler for this aura type
|
// no proc handler for this aura type
|
||||||
return SPELL_AURA_PROC_OK;
|
return SPELL_AURA_PROC_OK;
|
||||||
}
|
}
|
||||||
SpellAuraProcResult HandleCantTrigger(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown)
|
SpellAuraProcResult HandleCantTrigger(Unit* /*pVictim*/, uint32 /*damage*/, Aura* /*triggeredByAura*/, SpellEntry const* /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 /*cooldown*/)
|
||||||
{
|
{
|
||||||
// this aura type can't proc
|
// this aura type can't proc
|
||||||
return SPELL_AURA_PROC_CANT_TRIGGER;
|
return SPELL_AURA_PROC_CANT_TRIGGER;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "11268"
|
#define REVISION_NR "11269"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue