diff options
| author | Shauren <none@none> | 2010-09-11 21:28:55 +0200 |
|---|---|---|
| committer | Shauren <none@none> | 2010-09-11 21:28:55 +0200 |
| commit | d714d0eb20767ec6acbe48aafcbb008aafd35a0e (patch) | |
| tree | 2213adfa26c29ee526febbe0aa473289e78bfdf2 /src/server/game/Entities | |
| parent | 1de7e5bed179a2c1bcaf7cdb68fb377c39afd51a (diff) | |
Core/Loot: Reverted revision 44a1f284dd3e
Core/Loot: Implemented automatic currency distribution in better way, applying all conditions and updating achievements
Closes issue #3912.
--HG--
branch : trunk
extra : rebase_source : 35c2a59d213793ee29dfd0fc1acb7c15b375b049
Diffstat (limited to 'src/server/game/Entities')
| -rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 68 | ||||
| -rw-r--r-- | src/server/game/Entities/Player/Player.h | 1 |
2 files changed, 69 insertions, 0 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index fc9c83a395b..34719457084 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -22723,6 +22723,74 @@ void Player::AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore cons } } +void Player::StoreLootItem(uint8 lootSlot, Loot* loot) +{ + QuestItem *qitem = NULL; + QuestItem *ffaitem = NULL; + QuestItem *conditem = NULL; + + LootItem *item = loot->LootItemInSlot(lootSlot, this, &qitem, &ffaitem, &conditem); + + if (!item) + { + SendEquipError(EQUIP_ERR_ALREADY_LOOTED, NULL, NULL); + return; + } + + // questitems use the blocked field for other purposes + if (!qitem && item->is_blocked) + { + SendLootRelease(GetLootGUID()); + return; + } + + ItemPosCountVec dest; + uint8 msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item->itemid, item->count); + if (msg == EQUIP_ERR_OK) + { + Item * newitem = StoreNewItem(dest, item->itemid, true, item->randomPropertyId); + + if (qitem) + { + qitem->is_looted = true; + //freeforall is 1 if everyone's supposed to get the quest item. + if (item->freeforall || loot->GetPlayerQuestItems().size() == 1) + SendNotifyLootItemRemoved(lootSlot); + else + loot->NotifyQuestItemRemoved(qitem->index); + } + else + { + if (ffaitem) + { + //freeforall case, notify only one player of the removal + ffaitem->is_looted = true; + SendNotifyLootItemRemoved(lootSlot); + } + else + { + //not freeforall, notify everyone + if (conditem) + conditem->is_looted = true; + loot->NotifyItemRemoved(lootSlot); + } + } + + //if only one person is supposed to loot the item, then set it to looted + if (!item->freeforall) + item->is_looted = true; + + --loot->unlootedCount; + + SendNewItem(newitem, uint32(item->count), false, false, true); + GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item->itemid, item->count); + GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, loot->loot_type, item->count); + GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM, item->itemid, item->count); + } + else + SendEquipError(msg, NULL, NULL, item->itemid); +} + uint32 Player::CalculateTalentsPoints() const { uint32 base_talent = getLevel() < 10 ? 0 : getLevel()-9; diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 30f93b2be4c..c1b8d75dcb8 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1194,6 +1194,7 @@ class Player : public Unit, public GridObject<Player> bool StoreNewItemInBestSlots(uint32 item_id, uint32 item_count); void AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore const& store, bool broadcast = false); void AutoStoreLoot(uint32 loot_id, LootStore const& store, bool broadcast = false) { AutoStoreLoot(NULL_BAG,NULL_SLOT,loot_id,store,broadcast); } + void StoreLootItem(uint8 lootSlot, Loot* loot); uint8 _CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count = NULL) const; uint8 _CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item *pItem = NULL, bool swap = false, uint32* no_space_count = NULL) const; |
