[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); 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;
} }

View file

@ -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

View file

@ -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

View file

@ -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)
@ -10107,11 +10113,15 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
ItemPrototype const *pProto = pItem->GetProto(); ItemPrototype const *pProto = pItem->GetProto();
// strange item // strange item
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;
Bag *pBag; Bag *pBag;
@ -10119,18 +10129,18 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
// item is 'one item only' // item is 'one item only'
uint8 res = CanTakeMoreSimilarItems(pItem); uint8 res = CanTakeMoreSimilarItems(pItem);
if(res != EQUIP_ERR_OK) if (res != EQUIP_ERR_OK)
return res; return res;
// search stack for merge to // search stack for merge to
if( pProto->Stackable != 1 ) if (pProto->Stackable != 1)
{ {
bool b_found = false; bool b_found = false;
for(int t = KEYRING_SLOT_START; t < KEYRING_SLOT_END; ++t) for(int t = KEYRING_SLOT_START; t < KEYRING_SLOT_END; ++t)
{ {
pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, t ); pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, t );
if( pItem2 && pItem2->CanBeMergedPartlyWith(pProto) == EQUIP_ERR_OK && inv_keys[t-KEYRING_SLOT_START] + pItem->GetCount() <= pProto->GetMaxStackSize()) if (pItem2 && pItem2->CanBeMergedPartlyWith(pProto) == EQUIP_ERR_OK && inv_keys[t-KEYRING_SLOT_START] + pItem->GetCount() <= pProto->GetMaxStackSize())
{ {
inv_keys[t-KEYRING_SLOT_START] += pItem->GetCount(); inv_keys[t-KEYRING_SLOT_START] += pItem->GetCount();
b_found = true; b_found = true;
@ -10142,7 +10152,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
for(int t = CURRENCYTOKEN_SLOT_START; t < CURRENCYTOKEN_SLOT_END; ++t) for(int t = CURRENCYTOKEN_SLOT_START; t < CURRENCYTOKEN_SLOT_END; ++t)
{ {
pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, t ); pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, t );
if( pItem2 && pItem2->CanBeMergedPartlyWith(pProto) == EQUIP_ERR_OK && inv_tokens[t-CURRENCYTOKEN_SLOT_START] + pItem->GetCount() <= pProto->GetMaxStackSize()) if (pItem2 && pItem2->CanBeMergedPartlyWith(pProto) == EQUIP_ERR_OK && inv_tokens[t-CURRENCYTOKEN_SLOT_START] + pItem->GetCount() <= pProto->GetMaxStackSize())
{ {
inv_tokens[t-CURRENCYTOKEN_SLOT_START] += pItem->GetCount(); inv_tokens[t-CURRENCYTOKEN_SLOT_START] += pItem->GetCount();
b_found = true; b_found = true;
@ -10154,7 +10164,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
for(int t = INVENTORY_SLOT_ITEM_START; t < INVENTORY_SLOT_ITEM_END; ++t) for(int t = INVENTORY_SLOT_ITEM_START; t < INVENTORY_SLOT_ITEM_END; ++t)
{ {
pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, t ); pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, t );
if( pItem2 && pItem2->CanBeMergedPartlyWith(pProto) == EQUIP_ERR_OK && inv_slot_items[t-INVENTORY_SLOT_ITEM_START] + pItem->GetCount() <= pProto->GetMaxStackSize()) if (pItem2 && pItem2->CanBeMergedPartlyWith(pProto) == EQUIP_ERR_OK && inv_slot_items[t-INVENTORY_SLOT_ITEM_START] + pItem->GetCount() <= pProto->GetMaxStackSize())
{ {
inv_slot_items[t-INVENTORY_SLOT_ITEM_START] += pItem->GetCount(); inv_slot_items[t-INVENTORY_SLOT_ITEM_START] += pItem->GetCount();
b_found = true; b_found = true;
@ -10166,12 +10176,12 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
for(int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t) for(int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t)
{ {
pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, t ); pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, t );
if( pBag ) if (pBag)
{ {
for(uint32 j = 0; j < pBag->GetBagSize(); ++j) for(uint32 j = 0; j < pBag->GetBagSize(); ++j)
{ {
pItem2 = GetItemByPos( t, j ); pItem2 = GetItemByPos( t, j );
if( pItem2 && pItem2->CanBeMergedPartlyWith(pProto) == EQUIP_ERR_OK && inv_bags[t-INVENTORY_SLOT_BAG_START][j] + pItem->GetCount() <= pProto->GetMaxStackSize()) if (pItem2 && pItem2->CanBeMergedPartlyWith(pProto) == EQUIP_ERR_OK && inv_bags[t-INVENTORY_SLOT_BAG_START][j] + pItem->GetCount() <= pProto->GetMaxStackSize())
{ {
inv_bags[t-INVENTORY_SLOT_BAG_START][j] += pItem->GetCount(); inv_bags[t-INVENTORY_SLOT_BAG_START][j] += pItem->GetCount();
b_found = true; b_found = true;
@ -10184,15 +10194,15 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
} }
// special bag case // special bag case
if( pProto->BagFamily ) if (pProto->BagFamily)
{ {
bool b_found = false; bool b_found = false;
if(pProto->BagFamily & BAG_FAMILY_MASK_KEYS) if (pProto->BagFamily & BAG_FAMILY_MASK_KEYS)
{ {
uint32 keyringSize = GetMaxKeyringSize(); uint32 keyringSize = GetMaxKeyringSize();
for(uint32 t = KEYRING_SLOT_START; t < KEYRING_SLOT_START+keyringSize; ++t) for(uint32 t = KEYRING_SLOT_START; t < KEYRING_SLOT_START+keyringSize; ++t)
{ {
if( inv_keys[t-KEYRING_SLOT_START] == 0 ) if (inv_keys[t-KEYRING_SLOT_START] == 0)
{ {
inv_keys[t-KEYRING_SLOT_START] = 1; inv_keys[t-KEYRING_SLOT_START] = 1;
b_found = true; b_found = true;
@ -10203,11 +10213,11 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
if (b_found) continue; if (b_found) continue;
if(pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS) if (pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS)
{ {
for(uint32 t = CURRENCYTOKEN_SLOT_START; t < CURRENCYTOKEN_SLOT_END; ++t) for(uint32 t = CURRENCYTOKEN_SLOT_START; t < CURRENCYTOKEN_SLOT_END; ++t)
{ {
if( inv_tokens[t-CURRENCYTOKEN_SLOT_START] == 0 ) if (inv_tokens[t-CURRENCYTOKEN_SLOT_START] == 0)
{ {
inv_tokens[t-CURRENCYTOKEN_SLOT_START] = 1; inv_tokens[t-CURRENCYTOKEN_SLOT_START] = 1;
b_found = true; b_found = true;
@ -10221,17 +10231,17 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
for(int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t) for(int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t)
{ {
pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, t ); pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, t );
if( pBag ) if (pBag)
{ {
pBagProto = pBag->GetProto(); pBagProto = pBag->GetProto();
// not plain container check // not plain container check
if( pBagProto && (pBagProto->Class != ITEM_CLASS_CONTAINER || pBagProto->SubClass != ITEM_SUBCLASS_CONTAINER) && if (pBagProto && (pBagProto->Class != ITEM_CLASS_CONTAINER || pBagProto->SubClass != ITEM_SUBCLASS_CONTAINER) &&
ItemCanGoIntoBag(pProto,pBagProto) ) ItemCanGoIntoBag(pProto,pBagProto) )
{ {
for(uint32 j = 0; j < pBag->GetBagSize(); ++j) for(uint32 j = 0; j < pBag->GetBagSize(); ++j)
{ {
if( inv_bags[t-INVENTORY_SLOT_BAG_START][j] == 0 ) if (inv_bags[t-INVENTORY_SLOT_BAG_START][j] == 0)
{ {
inv_bags[t-INVENTORY_SLOT_BAG_START][j] = 1; inv_bags[t-INVENTORY_SLOT_BAG_START][j] = 1;
b_found = true; b_found = true;
@ -10248,7 +10258,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
bool b_found = false; bool b_found = false;
for(int t = INVENTORY_SLOT_ITEM_START; t < INVENTORY_SLOT_ITEM_END; ++t) for(int t = INVENTORY_SLOT_ITEM_START; t < INVENTORY_SLOT_ITEM_END; ++t)
{ {
if( inv_slot_items[t-INVENTORY_SLOT_ITEM_START] == 0 ) if (inv_slot_items[t-INVENTORY_SLOT_ITEM_START] == 0)
{ {
inv_slot_items[t-INVENTORY_SLOT_ITEM_START] = 1; inv_slot_items[t-INVENTORY_SLOT_ITEM_START] = 1;
b_found = true; b_found = true;
@ -10261,17 +10271,17 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
for(int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t) for(int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t)
{ {
pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, t ); pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, t );
if( pBag ) if (pBag)
{ {
pBagProto = pBag->GetProto(); pBagProto = pBag->GetProto();
// special bag already checked // special bag already checked
if( pBagProto && (pBagProto->Class != ITEM_CLASS_CONTAINER || pBagProto->SubClass != ITEM_SUBCLASS_CONTAINER)) if (pBagProto && (pBagProto->Class != ITEM_CLASS_CONTAINER || pBagProto->SubClass != ITEM_SUBCLASS_CONTAINER))
continue; continue;
for(uint32 j = 0; j < pBag->GetBagSize(); ++j) for(uint32 j = 0; j < pBag->GetBagSize(); ++j)
{ {
if( inv_bags[t-INVENTORY_SLOT_BAG_START][j] == 0 ) if (inv_bags[t-INVENTORY_SLOT_BAG_START][j] == 0)
{ {
inv_bags[t-INVENTORY_SLOT_BAG_START][j] = 1; inv_bags[t-INVENTORY_SLOT_BAG_START][j] = 1;
b_found = true; b_found = true;
@ -10294,7 +10304,7 @@ uint8 Player::CanEquipNewItem( uint8 slot, uint16 &dest, uint32 item, bool swap
{ {
dest = 0; dest = 0;
Item *pItem = Item::CreateItem( item, 1, this ); Item *pItem = Item::CreateItem( item, 1, this );
if( pItem ) if (pItem)
{ {
uint8 result = CanEquipItem(slot, dest, pItem, swap ); uint8 result = CanEquipItem(slot, dest, pItem, swap );
delete pItem; delete pItem;
@ -10307,22 +10317,26 @@ uint8 Player::CanEquipNewItem( uint8 slot, uint16 &dest, uint32 item, bool swap
uint8 Player::CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bool not_loading ) const uint8 Player::CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bool not_loading ) const
{ {
dest = 0; dest = 0;
if( pItem ) if (pItem)
{ {
DEBUG_LOG( "STORAGE: CanEquipItem slot = %u, item = %u, count = %u", slot, pItem->GetEntry(), pItem->GetCount()); DEBUG_LOG( "STORAGE: CanEquipItem slot = %u, item = %u, count = %u", slot, pItem->GetEntry(), pItem->GetCount());
ItemPrototype const *pProto = pItem->GetProto(); ItemPrototype const *pProto = pItem->GetProto();
if( pProto ) if (pProto)
{ {
if(pItem->IsBindedNotWith(this)) // item used
if (pItem->HasTemporaryLoot())
return EQUIP_ERR_ALREADY_LOOTED;
if (pItem->IsBindedNotWith(this))
return EQUIP_ERR_DONT_OWN_THAT_ITEM; return EQUIP_ERR_DONT_OWN_THAT_ITEM;
// check count of items (skip for auto move for same player from bank) // check count of items (skip for auto move for same player from bank)
uint8 res = CanTakeMoreSimilarItems(pItem); uint8 res = CanTakeMoreSimilarItems(pItem);
if(res != EQUIP_ERR_OK) if (res != EQUIP_ERR_OK)
return res; return res;
// check this only in game // check this only in game
if(not_loading) if (not_loading)
{ {
// May be here should be more stronger checks; STUNNED checked // May be here should be more stronger checks; STUNNED checked
// ROOT, CONFUSED, DISTRACTED, FLEEING this needs to be checked. // ROOT, CONFUSED, DISTRACTED, FLEEING this needs to be checked.
@ -10332,20 +10346,20 @@ uint8 Player::CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bo
// do not allow equipping gear except weapons, offhands, projectiles, relics in // do not allow equipping gear except weapons, offhands, projectiles, relics in
// - combat // - combat
// - in-progress arenas // - in-progress arenas
if( !pProto->CanChangeEquipStateInCombat() ) if (!pProto->CanChangeEquipStateInCombat())
{ {
if( isInCombat() ) if( isInCombat() )
return EQUIP_ERR_NOT_IN_COMBAT; return EQUIP_ERR_NOT_IN_COMBAT;
if(BattleGround* bg = GetBattleGround()) if (BattleGround* bg = GetBattleGround())
if( bg->isArena() && bg->GetStatus() == STATUS_IN_PROGRESS ) if (bg->isArena() && bg->GetStatus() == STATUS_IN_PROGRESS)
return EQUIP_ERR_NOT_DURING_ARENA_MATCH; return EQUIP_ERR_NOT_DURING_ARENA_MATCH;
} }
if(isInCombat()&& pProto->Class == ITEM_CLASS_WEAPON && m_weaponChangeTimer != 0) if (isInCombat()&& pProto->Class == ITEM_CLASS_WEAPON && m_weaponChangeTimer != 0)
return EQUIP_ERR_CANT_DO_RIGHT_NOW; // maybe exist better err return EQUIP_ERR_CANT_DO_RIGHT_NOW; // maybe exist better err
if(IsNonMeleeSpellCasted(false)) if (IsNonMeleeSpellCasted(false))
return EQUIP_ERR_CANT_DO_RIGHT_NOW; return EQUIP_ERR_CANT_DO_RIGHT_NOW;
} }
@ -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;

View file

@ -6054,17 +6054,17 @@ SpellCastResult Spell::CheckItems()
if (!(m_targets.getItemTarget()->GetProto()->Flags & ITEM_FLAG_PROSPECTABLE)) if (!(m_targets.getItemTarget()->GetProto()->Flags & ITEM_FLAG_PROSPECTABLE))
return SPELL_FAILED_CANT_BE_PROSPECTED; return SPELL_FAILED_CANT_BE_PROSPECTED;
// prevent prospecting in trade slot // prevent prospecting in trade slot
if( m_targets.getItemTarget()->GetOwnerGUID() != m_caster->GetGUID() ) if (m_targets.getItemTarget()->GetOwnerGUID() != m_caster->GetGUID())
return SPELL_FAILED_CANT_BE_PROSPECTED; return SPELL_FAILED_CANT_BE_PROSPECTED;
// Check for enough skill in jewelcrafting // Check for enough skill in jewelcrafting
uint32 item_prospectingskilllevel = m_targets.getItemTarget()->GetProto()->RequiredSkillRank; uint32 item_prospectingskilllevel = m_targets.getItemTarget()->GetProto()->RequiredSkillRank;
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()))
return SPELL_FAILED_CANT_BE_PROSPECTED; return SPELL_FAILED_CANT_BE_PROSPECTED;
break; break;
@ -6077,14 +6077,14 @@ SpellCastResult Spell::CheckItems()
if (!(m_targets.getItemTarget()->GetProto()->Flags & ITEM_FLAG_MILLABLE)) if (!(m_targets.getItemTarget()->GetProto()->Flags & ITEM_FLAG_MILLABLE))
return SPELL_FAILED_CANT_BE_MILLED; return SPELL_FAILED_CANT_BE_MILLED;
// prevent milling in trade slot // prevent milling in trade slot
if( m_targets.getItemTarget()->GetOwnerGUID() != m_caster->GetGUID() ) if (m_targets.getItemTarget()->GetOwnerGUID() != m_caster->GetGUID())
return SPELL_FAILED_CANT_BE_MILLED; return SPELL_FAILED_CANT_BE_MILLED;
// Check for enough skill in inscription // Check for enough skill in inscription
uint32 item_millingskilllevel = m_targets.getItemTarget()->GetProto()->RequiredSkillRank; uint32 item_millingskilllevel = m_targets.getItemTarget()->GetProto()->RequiredSkillRank;
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()))

View file

@ -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*/)

View file

@ -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 )

View file

@ -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__