mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 19:37:02 +00:00
[11007] Implement use personal loot slot types that fix problems with some loot cases.
For example it fix looting 43016. Also use enum and clarify uses diff loot slot types.
This commit is contained in:
parent
5e74d1e425
commit
f7d49a4254
4 changed files with 43 additions and 8 deletions
|
|
@ -741,7 +741,8 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
|
||||||
{
|
{
|
||||||
if (!l.items[i].is_looted && !l.items[i].freeforall && !l.items[i].conditionId && l.items[i].AllowedForPlayer(lv.viewer))
|
if (!l.items[i].is_looted && !l.items[i].freeforall && !l.items[i].conditionId && l.items[i].AllowedForPlayer(lv.viewer))
|
||||||
{
|
{
|
||||||
uint8 slot_type = (l.items[i].is_blocked || l.items[i].is_underthreshold) ? 0 : 1;
|
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(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
|
b << uint8(slot_type); // 0 - get 1 - look only
|
||||||
|
|
@ -751,13 +752,25 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ALL_PERMISSION:
|
case ALL_PERMISSION:
|
||||||
|
case OWNER_PERMISSION:
|
||||||
case MASTER_PERMISSION:
|
case MASTER_PERMISSION:
|
||||||
{
|
{
|
||||||
for (uint8 i = 0; i < l.items.size(); ++i)
|
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))
|
if (!l.items[i].is_looted && !l.items[i].freeforall && !l.items[i].conditionId && l.items[i].AllowedForPlayer(lv.viewer))
|
||||||
{
|
{
|
||||||
uint8 slot_type = (lv.permission==MASTER_PERMISSION && !l.items[i].is_underthreshold) ? 2 : 0;
|
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(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
|
b << uint8(slot_type); // 0 - get 2 - master selection
|
||||||
++itemsShown;
|
++itemsShown;
|
||||||
|
|
@ -769,6 +782,9 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
|
||||||
return b; // nothing output more
|
return b; // nothing output more
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// in next cases used same slot type for all items
|
||||||
|
LootSlotType slot_type = lv.permission == OWNER_PERMISSION ? LOOT_SLOT_OWNER : LOOT_SLOT_NORMAL;
|
||||||
|
|
||||||
QuestItemMap const& lootPlayerQuestItems = l.GetPlayerQuestItems();
|
QuestItemMap const& lootPlayerQuestItems = l.GetPlayerQuestItems();
|
||||||
QuestItemMap::const_iterator q_itr = lootPlayerQuestItems.find(lv.viewer->GetGUIDLow());
|
QuestItemMap::const_iterator q_itr = lootPlayerQuestItems.find(lv.viewer->GetGUIDLow());
|
||||||
if (q_itr != lootPlayerQuestItems.end())
|
if (q_itr != lootPlayerQuestItems.end())
|
||||||
|
|
@ -781,7 +797,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
|
||||||
{
|
{
|
||||||
b << uint8(l.items.size() + (qi - q_list->begin()));
|
b << uint8(l.items.size() + (qi - q_list->begin()));
|
||||||
b << item;
|
b << item;
|
||||||
b << uint8(0); // allow loot
|
b << uint8(slot_type); // allow loot
|
||||||
++itemsShown;
|
++itemsShown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -798,7 +814,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
|
||||||
if (!fi->is_looted && !item.is_looted)
|
if (!fi->is_looted && !item.is_looted)
|
||||||
{
|
{
|
||||||
b << uint8(fi->index) << item;
|
b << uint8(fi->index) << item;
|
||||||
b << uint8(0); // allow loot
|
b << uint8(slot_type); // allow loot
|
||||||
++itemsShown;
|
++itemsShown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -815,7 +831,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
|
||||||
if (!ci->is_looted && !item.is_looted)
|
if (!ci->is_looted && !item.is_looted)
|
||||||
{
|
{
|
||||||
b << uint8(ci->index) << item;
|
b << uint8(ci->index) << item;
|
||||||
b << uint8(0); // allow loot
|
b << uint8(slot_type); // allow loot
|
||||||
++itemsShown;
|
++itemsShown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,8 @@ enum PermissionTypes
|
||||||
ALL_PERMISSION = 0,
|
ALL_PERMISSION = 0,
|
||||||
GROUP_PERMISSION = 1,
|
GROUP_PERMISSION = 1,
|
||||||
MASTER_PERMISSION = 2,
|
MASTER_PERMISSION = 2,
|
||||||
NONE_PERMISSION = 3
|
OWNER_PERMISSION = 3, // for single player only loots
|
||||||
|
NONE_PERMISSION = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
enum LootType
|
enum LootType
|
||||||
|
|
@ -55,6 +56,17 @@ enum LootType
|
||||||
LOOT_INSIGNIA = 22 // unsupported by client, sending LOOT_CORPSE instead
|
LOOT_INSIGNIA = 22 // unsupported by client, sending LOOT_CORPSE instead
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum LootSlotType
|
||||||
|
{
|
||||||
|
LOOT_SLOT_NORMAL = 0, // can be looted
|
||||||
|
LOOT_SLOT_VIEW = 1, // can be only view (ignore any loot attempts)
|
||||||
|
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_OWNER = 4, // ignore binding confirmation and etc, for single player looting
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Player;
|
class Player;
|
||||||
class LootStore;
|
class LootStore;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7954,6 +7954,8 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
permission = OWNER_PERMISSION;
|
||||||
|
|
||||||
loot = &item->loot;
|
loot = &item->loot;
|
||||||
|
|
||||||
if (!item->HasGeneratedLoot())
|
if (!item->HasGeneratedLoot())
|
||||||
|
|
@ -8009,6 +8011,8 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
|
||||||
|
|
||||||
if (bones->lootRecipient != this)
|
if (bones->lootRecipient != this)
|
||||||
permission = NONE_PERMISSION;
|
permission = NONE_PERMISSION;
|
||||||
|
else
|
||||||
|
permission = OWNER_PERMISSION;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case HIGHGUID_UNIT:
|
case HIGHGUID_UNIT:
|
||||||
|
|
@ -8044,6 +8048,7 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
|
||||||
const uint32 a = urand(0, creature->getLevel()/2);
|
const uint32 a = urand(0, creature->getLevel()/2);
|
||||||
const uint32 b = urand(0, getLevel()/2);
|
const uint32 b = urand(0, getLevel()/2);
|
||||||
loot->gold = uint32(10 * (a + b) * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY));
|
loot->gold = uint32(10 * (a + b) * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY));
|
||||||
|
permission = OWNER_PERMISSION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -8106,6 +8111,8 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
|
||||||
// let reopen skinning loot if will closed.
|
// let reopen skinning loot if will closed.
|
||||||
if (!loot->empty())
|
if (!loot->empty())
|
||||||
creature->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
|
creature->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
|
||||||
|
|
||||||
|
permission = OWNER_PERMISSION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// set group rights only for loot_type != LOOT_SKINNING
|
// set group rights only for loot_type != LOOT_SKINNING
|
||||||
|
|
@ -8131,7 +8138,7 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
|
||||||
permission = NONE_PERMISSION;
|
permission = NONE_PERMISSION;
|
||||||
}
|
}
|
||||||
else if (recipient == this)
|
else if (recipient == this)
|
||||||
permission = ALL_PERMISSION;
|
permission = OWNER_PERMISSION;
|
||||||
else
|
else
|
||||||
permission = NONE_PERMISSION;
|
permission = NONE_PERMISSION;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "11006"
|
#define REVISION_NR "11007"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue