[10689] Restore some item checkes for temporary loot case.

This commit is contained in:
VladimirMangos 2010-11-07 02:01:44 +03:00
parent e219ee99bb
commit bffc07e4bc
8 changed files with 80 additions and 64 deletions

View file

@ -1197,7 +1197,7 @@ void GameObject::Use(Unit* user)
SetLootState(GO_JUST_DEACTIVATED);
}
else
player->SendLoot(GetGUID(),LOOT_FISHING);
player->SendLoot(GetObjectGuid(),LOOT_FISHING);
}
else
{
@ -1392,7 +1392,7 @@ void GameObject::Use(Unit* 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);
return;
}

View file

@ -358,6 +358,8 @@ class MANGOS_DLL_SPEC Item : public Object
void SetLootState(ItemLootUpdateState state);
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; }
// Update States

View file

@ -418,9 +418,9 @@ void WorldSession::DoLootRelease(ObjectGuid lguid)
ItemPrototype const* proto = pItem->GetProto();
// destroy only 5 items from stack in case prospecting and milling
switch (pItem->loot.loot_type)
{
// temporary loot in stacking items, clear loot state, no auto loot move
case LOOT_MILLING:
case LOOT_PROSPECTING:
{
@ -437,6 +437,7 @@ void WorldSession::DoLootRelease(ObjectGuid lguid)
player->DestroyItemCount(pItem, count, true);
break;
}
// temporary loot, auto loot move
case LOOT_DISENCHANTING:
{
if (!pItem->loot.isLooted())
@ -446,6 +447,7 @@ void WorldSession::DoLootRelease(ObjectGuid lguid)
player->DestroyItem( pItem->GetBagSlot(),pItem->GetSlot(), true);
break;
}
// normal persistence loot
default:
{
// must be destroyed only if no loot

View file

@ -7819,7 +7819,7 @@ void Player::RemovedInsignia(Player* looterPlr)
// We retrieve this information at Player::SendLoot()
bones->loot.gold = getLevel();
bones->lootRecipient = looterPlr;
looterPlr->SendLoot(bones->GetGUID(), LOOT_INSIGNIA);
looterPlr->SendLoot(bones->GetObjectGuid(), LOOT_INSIGNIA);
}
void Player::SendLootRelease(ObjectGuid guid)
@ -8099,11 +8099,9 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
loot->loot_type = loot_type;
WorldPacket data(SMSG_LOOT_RESPONSE, (9+50)); // we guess size
data << guid;
data << ObjectGuid(guid);
data << uint8(loot_type);
data << LootView(*loot, this, permission);
SendDirectMessage(&data);
// 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)
{
// item used
if (pItem->HasTemporaryLoot())
{
if (no_space_count)
*no_space_count = count;
return EQUIP_ERR_ALREADY_LOOTED;
}
if (pItem->IsBindedNotWith(this))
{
if (no_space_count)
@ -10110,6 +10116,10 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
if (!pProto)
return EQUIP_ERR_ITEM_NOT_FOUND;
// item used
if (pItem->HasTemporaryLoot())
return EQUIP_ERR_ALREADY_LOOTED;
// item it 'bind'
if (pItem->IsBindedNotWith(this))
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();
if (pProto)
{
// item used
if (pItem->HasTemporaryLoot())
return EQUIP_ERR_ALREADY_LOOTED;
if (pItem->IsBindedNotWith(this))
return EQUIP_ERR_DONT_OWN_THAT_ITEM;
@ -10456,6 +10470,10 @@ uint8 Player::CanUnequipItem( uint16 pos, bool swap ) const
if (!pProto)
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
// - combat
// - in-progress arenas
@ -10487,6 +10505,10 @@ uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *p
if (!pProto)
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))
return EQUIP_ERR_DONT_OWN_THAT_ITEM;

View file

@ -6061,7 +6061,7 @@ SpellCastResult Spell::CheckItems()
if (item_prospectingskilllevel >p_caster->GetSkillValue(SKILL_JEWELCRAFTING))
return SPELL_FAILED_LOW_CASTLEVEL;
// 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;
if (!LootTemplates_Prospecting.HaveLootFor(m_targets.getItemTargetEntry()))
@ -6084,7 +6084,7 @@ SpellCastResult Spell::CheckItems()
if (item_millingskilllevel >p_caster->GetSkillValue(SKILL_INSCRIPTION))
return SPELL_FAILED_LOW_CASTLEVEL;
// 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;
if(!LootTemplates_Milling.HaveLootFor(m_targets.getItemTargetEntry()))

View file

@ -4420,7 +4420,7 @@ void Spell::EffectPickPocket(SpellEffectIndex /*eff_idx*/)
{
// Stealing successful
//DEBUG_LOG("Sending loot from pickpocket");
((Player*)m_caster)->SendLoot(unitTarget->GetGUID(),LOOT_PICKPOCKETING);
((Player*)m_caster)->SendLoot(unitTarget->GetObjectGuid(),LOOT_PICKPOCKETING);
}
else
{
@ -7096,7 +7096,7 @@ void Spell::EffectDisEnchant(SpellEffectIndex /*eff_idx*/)
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
}
@ -7400,7 +7400,7 @@ void Spell::EffectSkinning(SpellEffectIndex /*eff_idx*/)
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);
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*/)
{
if (m_caster->GetTypeId() != TYPEID_PLAYER)
if (m_caster->GetTypeId() != TYPEID_PLAYER || !itemTarget)
return;
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))
{
@ -7867,15 +7862,10 @@ void Spell::EffectProspecting(SpellEffectIndex /*eff_idx*/)
void Spell::EffectMilling(SpellEffectIndex /*eff_idx*/)
{
if(m_caster->GetTypeId() != TYPEID_PLAYER)
if (m_caster->GetTypeId() != TYPEID_PLAYER || !itemTarget)
return;
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))
{
@ -7884,7 +7874,7 @@ void Spell::EffectMilling(SpellEffectIndex /*eff_idx*/)
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*/)

View file

@ -265,7 +265,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
CharacterDatabase.PExecute("DELETE FROM character_gifts WHERE item_guid = '%u'", pItem->GetGUIDLow());
}
else
pUser->SendLoot(pItem->GetGUID(),LOOT_CORPSE);
pUser->SendLoot(pItem->GetObjectGuid(),LOOT_CORPSE);
}
void WorldSession::HandleGameObjectUseOpcode( WorldPacket & recv_data )

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10688"
#define REVISION_NR "10689"
#endif // __REVISION_NR_H__