mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[10689] Restore some item checkes for temporary loot case.
This commit is contained in:
parent
e219ee99bb
commit
bffc07e4bc
8 changed files with 80 additions and 64 deletions
|
|
@ -1197,7 +1197,7 @@ void GameObject::Use(Unit* user)
|
||||||
SetLootState(GO_JUST_DEACTIVATED);
|
SetLootState(GO_JUST_DEACTIVATED);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
player->SendLoot(GetGUID(),LOOT_FISHING);
|
player->SendLoot(GetObjectGuid(),LOOT_FISHING);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -1392,7 +1392,7 @@ void GameObject::Use(Unit* user)
|
||||||
|
|
||||||
Player* player = (Player*)user;
|
Player* player = (Player*)user;
|
||||||
|
|
||||||
player->SendLoot(GetGUID(), LOOT_FISHINGHOLE);
|
player->SendLoot(GetObjectGuid(), LOOT_FISHINGHOLE);
|
||||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT, GetGOInfo()->id);
|
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT, GetGOInfo()->id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -358,6 +358,8 @@ class MANGOS_DLL_SPEC Item : public Object
|
||||||
|
|
||||||
void SetLootState(ItemLootUpdateState state);
|
void SetLootState(ItemLootUpdateState state);
|
||||||
bool HasGeneratedLoot() const { return m_lootState != ITEM_LOOT_NONE && m_lootState != ITEM_LOOT_REMOVED; }
|
bool HasGeneratedLoot() const { return m_lootState != ITEM_LOOT_NONE && m_lootState != ITEM_LOOT_REMOVED; }
|
||||||
|
bool HasTemporaryLoot() const { return m_lootState == ITEM_LOOT_TEMPORARY; }
|
||||||
|
|
||||||
bool HasSavedLoot() const { return m_lootState != ITEM_LOOT_NONE && m_lootState != ITEM_LOOT_NEW && m_lootState != ITEM_LOOT_TEMPORARY; }
|
bool HasSavedLoot() const { return m_lootState != ITEM_LOOT_NONE && m_lootState != ITEM_LOOT_NEW && m_lootState != ITEM_LOOT_TEMPORARY; }
|
||||||
|
|
||||||
// Update States
|
// Update States
|
||||||
|
|
|
||||||
|
|
@ -418,9 +418,9 @@ void WorldSession::DoLootRelease(ObjectGuid lguid)
|
||||||
|
|
||||||
ItemPrototype const* proto = pItem->GetProto();
|
ItemPrototype const* proto = pItem->GetProto();
|
||||||
|
|
||||||
// destroy only 5 items from stack in case prospecting and milling
|
|
||||||
switch (pItem->loot.loot_type)
|
switch (pItem->loot.loot_type)
|
||||||
{
|
{
|
||||||
|
// temporary loot in stacking items, clear loot state, no auto loot move
|
||||||
case LOOT_MILLING:
|
case LOOT_MILLING:
|
||||||
case LOOT_PROSPECTING:
|
case LOOT_PROSPECTING:
|
||||||
{
|
{
|
||||||
|
|
@ -437,6 +437,7 @@ void WorldSession::DoLootRelease(ObjectGuid lguid)
|
||||||
player->DestroyItemCount(pItem, count, true);
|
player->DestroyItemCount(pItem, count, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// temporary loot, auto loot move
|
||||||
case LOOT_DISENCHANTING:
|
case LOOT_DISENCHANTING:
|
||||||
{
|
{
|
||||||
if (!pItem->loot.isLooted())
|
if (!pItem->loot.isLooted())
|
||||||
|
|
@ -446,6 +447,7 @@ void WorldSession::DoLootRelease(ObjectGuid lguid)
|
||||||
player->DestroyItem( pItem->GetBagSlot(),pItem->GetSlot(), true);
|
player->DestroyItem( pItem->GetBagSlot(),pItem->GetSlot(), true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// normal persistence loot
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
// must be destroyed only if no loot
|
// must be destroyed only if no loot
|
||||||
|
|
|
||||||
|
|
@ -7819,7 +7819,7 @@ void Player::RemovedInsignia(Player* looterPlr)
|
||||||
// We retrieve this information at Player::SendLoot()
|
// We retrieve this information at Player::SendLoot()
|
||||||
bones->loot.gold = getLevel();
|
bones->loot.gold = getLevel();
|
||||||
bones->lootRecipient = looterPlr;
|
bones->lootRecipient = looterPlr;
|
||||||
looterPlr->SendLoot(bones->GetGUID(), LOOT_INSIGNIA);
|
looterPlr->SendLoot(bones->GetObjectGuid(), LOOT_INSIGNIA);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::SendLootRelease(ObjectGuid guid)
|
void Player::SendLootRelease(ObjectGuid guid)
|
||||||
|
|
@ -8099,11 +8099,9 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
|
||||||
loot->loot_type = loot_type;
|
loot->loot_type = loot_type;
|
||||||
|
|
||||||
WorldPacket data(SMSG_LOOT_RESPONSE, (9+50)); // we guess size
|
WorldPacket data(SMSG_LOOT_RESPONSE, (9+50)); // we guess size
|
||||||
|
data << ObjectGuid(guid);
|
||||||
data << guid;
|
|
||||||
data << uint8(loot_type);
|
data << uint8(loot_type);
|
||||||
data << LootView(*loot, this, permission);
|
data << LootView(*loot, this, permission);
|
||||||
|
|
||||||
SendDirectMessage(&data);
|
SendDirectMessage(&data);
|
||||||
|
|
||||||
// add 'this' player as one of the players that are looting 'loot'
|
// add 'this' player as one of the players that are looting 'loot'
|
||||||
|
|
@ -9623,6 +9621,14 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3
|
||||||
|
|
||||||
if (pItem)
|
if (pItem)
|
||||||
{
|
{
|
||||||
|
// item used
|
||||||
|
if (pItem->HasTemporaryLoot())
|
||||||
|
{
|
||||||
|
if (no_space_count)
|
||||||
|
*no_space_count = count;
|
||||||
|
return EQUIP_ERR_ALREADY_LOOTED;
|
||||||
|
}
|
||||||
|
|
||||||
if (pItem->IsBindedNotWith(this))
|
if (pItem->IsBindedNotWith(this))
|
||||||
{
|
{
|
||||||
if (no_space_count)
|
if (no_space_count)
|
||||||
|
|
@ -10110,6 +10116,10 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
|
||||||
if (!pProto)
|
if (!pProto)
|
||||||
return EQUIP_ERR_ITEM_NOT_FOUND;
|
return EQUIP_ERR_ITEM_NOT_FOUND;
|
||||||
|
|
||||||
|
// item used
|
||||||
|
if (pItem->HasTemporaryLoot())
|
||||||
|
return EQUIP_ERR_ALREADY_LOOTED;
|
||||||
|
|
||||||
// item it 'bind'
|
// item it 'bind'
|
||||||
if (pItem->IsBindedNotWith(this))
|
if (pItem->IsBindedNotWith(this))
|
||||||
return EQUIP_ERR_DONT_OWN_THAT_ITEM;
|
return EQUIP_ERR_DONT_OWN_THAT_ITEM;
|
||||||
|
|
@ -10313,6 +10323,10 @@ uint8 Player::CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bo
|
||||||
ItemPrototype const *pProto = pItem->GetProto();
|
ItemPrototype const *pProto = pItem->GetProto();
|
||||||
if (pProto)
|
if (pProto)
|
||||||
{
|
{
|
||||||
|
// item used
|
||||||
|
if (pItem->HasTemporaryLoot())
|
||||||
|
return EQUIP_ERR_ALREADY_LOOTED;
|
||||||
|
|
||||||
if (pItem->IsBindedNotWith(this))
|
if (pItem->IsBindedNotWith(this))
|
||||||
return EQUIP_ERR_DONT_OWN_THAT_ITEM;
|
return EQUIP_ERR_DONT_OWN_THAT_ITEM;
|
||||||
|
|
||||||
|
|
@ -10456,6 +10470,10 @@ uint8 Player::CanUnequipItem( uint16 pos, bool swap ) const
|
||||||
if (!pProto)
|
if (!pProto)
|
||||||
return EQUIP_ERR_ITEM_NOT_FOUND;
|
return EQUIP_ERR_ITEM_NOT_FOUND;
|
||||||
|
|
||||||
|
// item used
|
||||||
|
if (pItem->HasTemporaryLoot())
|
||||||
|
return EQUIP_ERR_ALREADY_LOOTED;
|
||||||
|
|
||||||
// do not allow unequipping gear except weapons, offhands, projectiles, relics in
|
// do not allow unequipping gear except weapons, offhands, projectiles, relics in
|
||||||
// - combat
|
// - combat
|
||||||
// - in-progress arenas
|
// - in-progress arenas
|
||||||
|
|
@ -10487,6 +10505,10 @@ uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *p
|
||||||
if (!pProto)
|
if (!pProto)
|
||||||
return swap ? EQUIP_ERR_ITEMS_CANT_BE_SWAPPED : EQUIP_ERR_ITEM_NOT_FOUND;
|
return swap ? EQUIP_ERR_ITEMS_CANT_BE_SWAPPED : EQUIP_ERR_ITEM_NOT_FOUND;
|
||||||
|
|
||||||
|
// item used
|
||||||
|
if (pItem->HasTemporaryLoot())
|
||||||
|
return EQUIP_ERR_ALREADY_LOOTED;
|
||||||
|
|
||||||
if (pItem->IsBindedNotWith(this))
|
if (pItem->IsBindedNotWith(this))
|
||||||
return EQUIP_ERR_DONT_OWN_THAT_ITEM;
|
return EQUIP_ERR_DONT_OWN_THAT_ITEM;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6061,7 +6061,7 @@ SpellCastResult Spell::CheckItems()
|
||||||
if (item_prospectingskilllevel >p_caster->GetSkillValue(SKILL_JEWELCRAFTING))
|
if (item_prospectingskilllevel >p_caster->GetSkillValue(SKILL_JEWELCRAFTING))
|
||||||
return SPELL_FAILED_LOW_CASTLEVEL;
|
return SPELL_FAILED_LOW_CASTLEVEL;
|
||||||
// make sure the player has the required ores in inventory
|
// make sure the player has the required ores in inventory
|
||||||
if(m_targets.getItemTarget()->GetCount() < 5)
|
if (m_targets.getItemTarget()->GetCount() < CalculateDamage(SpellEffectIndex(i), m_caster))
|
||||||
return SPELL_FAILED_NEED_MORE_ITEMS;
|
return SPELL_FAILED_NEED_MORE_ITEMS;
|
||||||
|
|
||||||
if (!LootTemplates_Prospecting.HaveLootFor(m_targets.getItemTargetEntry()))
|
if (!LootTemplates_Prospecting.HaveLootFor(m_targets.getItemTargetEntry()))
|
||||||
|
|
@ -6084,7 +6084,7 @@ SpellCastResult Spell::CheckItems()
|
||||||
if (item_millingskilllevel >p_caster->GetSkillValue(SKILL_INSCRIPTION))
|
if (item_millingskilllevel >p_caster->GetSkillValue(SKILL_INSCRIPTION))
|
||||||
return SPELL_FAILED_LOW_CASTLEVEL;
|
return SPELL_FAILED_LOW_CASTLEVEL;
|
||||||
// make sure the player has the required herbs in inventory
|
// make sure the player has the required herbs in inventory
|
||||||
if(m_targets.getItemTarget()->GetCount() < 5)
|
if (m_targets.getItemTarget()->GetCount() < CalculateDamage(SpellEffectIndex(i), m_caster))
|
||||||
return SPELL_FAILED_NEED_MORE_ITEMS;
|
return SPELL_FAILED_NEED_MORE_ITEMS;
|
||||||
|
|
||||||
if(!LootTemplates_Milling.HaveLootFor(m_targets.getItemTargetEntry()))
|
if(!LootTemplates_Milling.HaveLootFor(m_targets.getItemTargetEntry()))
|
||||||
|
|
|
||||||
|
|
@ -4420,7 +4420,7 @@ void Spell::EffectPickPocket(SpellEffectIndex /*eff_idx*/)
|
||||||
{
|
{
|
||||||
// Stealing successful
|
// Stealing successful
|
||||||
//DEBUG_LOG("Sending loot from pickpocket");
|
//DEBUG_LOG("Sending loot from pickpocket");
|
||||||
((Player*)m_caster)->SendLoot(unitTarget->GetGUID(),LOOT_PICKPOCKETING);
|
((Player*)m_caster)->SendLoot(unitTarget->GetObjectGuid(),LOOT_PICKPOCKETING);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -7096,7 +7096,7 @@ void Spell::EffectDisEnchant(SpellEffectIndex /*eff_idx*/)
|
||||||
|
|
||||||
p_caster->UpdateCraftSkill(m_spellInfo->Id);
|
p_caster->UpdateCraftSkill(m_spellInfo->Id);
|
||||||
|
|
||||||
((Player*)m_caster)->SendLoot(itemTarget->GetGUID(),LOOT_DISENCHANTING);
|
((Player*)m_caster)->SendLoot(itemTarget->GetObjectGuid(),LOOT_DISENCHANTING);
|
||||||
|
|
||||||
// item will be removed at disenchanting end
|
// item will be removed at disenchanting end
|
||||||
}
|
}
|
||||||
|
|
@ -7400,7 +7400,7 @@ void Spell::EffectSkinning(SpellEffectIndex /*eff_idx*/)
|
||||||
|
|
||||||
uint32 skill = creature->GetCreatureInfo()->GetRequiredLootSkill();
|
uint32 skill = creature->GetCreatureInfo()->GetRequiredLootSkill();
|
||||||
|
|
||||||
((Player*)m_caster)->SendLoot(creature->GetGUID(),LOOT_SKINNING);
|
((Player*)m_caster)->SendLoot(creature->GetObjectGuid(),LOOT_SKINNING);
|
||||||
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
|
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
|
||||||
|
|
||||||
int32 reqValue = targetLevel < 10 ? 0 : targetLevel < 20 ? (targetLevel-10)*10 : targetLevel*5;
|
int32 reqValue = targetLevel < 10 ? 0 : targetLevel < 20 ? (targetLevel-10)*10 : targetLevel*5;
|
||||||
|
|
@ -7845,15 +7845,10 @@ void Spell::EffectTransmitted(SpellEffectIndex eff_idx)
|
||||||
|
|
||||||
void Spell::EffectProspecting(SpellEffectIndex /*eff_idx*/)
|
void Spell::EffectProspecting(SpellEffectIndex /*eff_idx*/)
|
||||||
{
|
{
|
||||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
if (m_caster->GetTypeId() != TYPEID_PLAYER || !itemTarget)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player* p_caster = (Player*)m_caster;
|
Player* p_caster = (Player*)m_caster;
|
||||||
if (!itemTarget || !(itemTarget->GetProto()->Flags & ITEM_FLAG_PROSPECTABLE))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (itemTarget->GetCount() < 5)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (sWorld.getConfig(CONFIG_BOOL_SKILL_PROSPECTING))
|
if (sWorld.getConfig(CONFIG_BOOL_SKILL_PROSPECTING))
|
||||||
{
|
{
|
||||||
|
|
@ -7867,15 +7862,10 @@ void Spell::EffectProspecting(SpellEffectIndex /*eff_idx*/)
|
||||||
|
|
||||||
void Spell::EffectMilling(SpellEffectIndex /*eff_idx*/)
|
void Spell::EffectMilling(SpellEffectIndex /*eff_idx*/)
|
||||||
{
|
{
|
||||||
if(m_caster->GetTypeId() != TYPEID_PLAYER)
|
if (m_caster->GetTypeId() != TYPEID_PLAYER || !itemTarget)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player* p_caster = (Player*)m_caster;
|
Player* p_caster = (Player*)m_caster;
|
||||||
if (!itemTarget || !(itemTarget->GetProto()->Flags & ITEM_FLAG_MILLABLE))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(itemTarget->GetCount() < 5)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( sWorld.getConfig(CONFIG_BOOL_SKILL_MILLING))
|
if( sWorld.getConfig(CONFIG_BOOL_SKILL_MILLING))
|
||||||
{
|
{
|
||||||
|
|
@ -7884,7 +7874,7 @@ void Spell::EffectMilling(SpellEffectIndex /*eff_idx*/)
|
||||||
p_caster->UpdateGatherSkill(SKILL_INSCRIPTION, SkillValue, reqSkillValue);
|
p_caster->UpdateGatherSkill(SKILL_INSCRIPTION, SkillValue, reqSkillValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
((Player*)m_caster)->SendLoot(itemTarget->GetGUID(), LOOT_MILLING);
|
((Player*)m_caster)->SendLoot(itemTarget->GetObjectGuid(), LOOT_MILLING);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spell::EffectSkill(SpellEffectIndex /*eff_idx*/)
|
void Spell::EffectSkill(SpellEffectIndex /*eff_idx*/)
|
||||||
|
|
|
||||||
|
|
@ -265,7 +265,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_gifts WHERE item_guid = '%u'", pItem->GetGUIDLow());
|
CharacterDatabase.PExecute("DELETE FROM character_gifts WHERE item_guid = '%u'", pItem->GetGUIDLow());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pUser->SendLoot(pItem->GetGUID(),LOOT_CORPSE);
|
pUser->SendLoot(pItem->GetObjectGuid(),LOOT_CORPSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleGameObjectUseOpcode( WorldPacket & recv_data )
|
void WorldSession::HandleGameObjectUseOpcode( WorldPacket & recv_data )
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10688"
|
#define REVISION_NR "10689"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue