From db43ad3b72fe207e6cc03a1fd341ea598d123319 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 4 Oct 2013 19:19:53 +0300 Subject: add pickup and drop sound effects. Works like equip/unequip effects. --- src/being/playerinfo.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/being/playerinfo.cpp') diff --git a/src/being/playerinfo.cpp b/src/being/playerinfo.cpp index 3d311dd91..169ee5be3 100644 --- a/src/being/playerinfo.cpp +++ b/src/being/playerinfo.cpp @@ -24,6 +24,7 @@ #include "client.h" #include "configuration.h" #include "depricatedevent.h" +#include "flooritem.h" #include "inventory.h" #include "itemsoundmanager.h" @@ -321,14 +322,31 @@ void useEquipItem2(const Item *const item, bool sfx) { if (mProtectedItems.find(item->getId()) == mProtectedItems.end()) { - Net::getInventoryHandler()->useItem(item); if (sfx) ItemSoundManager::playSfx(item, SOUND_EVENT_USE); + Net::getInventoryHandler()->useItem(item); } } } } +void dropItem(const Item *const item, const int amount, bool sfx) +{ + if (item && mProtectedItems.find(item->getId()) == mProtectedItems.end()) + { + if (sfx) + ItemSoundManager::playSfx(item, SOUND_EVENT_DROP); + Net::getInventoryHandler()->dropItem(item, amount); + } +} + +void pickUpItem(const FloorItem *const item, bool sfx) +{ + if (sfx) + ItemSoundManager::playSfx(item, SOUND_EVENT_PICKUP); + Net::getPlayerHandler()->pickUp(item); +} + // --- Misc ------------------------------------------------------------------- void setBackend(const PlayerInfoBackend &backend) -- cgit v1.2.3-70-g09d2