From a27910e47cdc5db22c860e439b2b468024618411 Mon Sep 17 00:00:00 2001 From: ErikasKontenis Date: Sun, 16 Feb 2020 19:43:42 +0200 Subject: [PATCH] give bag on player death if 790 --- src/const.h | 2 ++ src/monsters.cpp | 2 +- src/player.cpp | 9 +++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/const.h b/src/const.h index 5cc9f41..4e695e8 100644 --- a/src/const.h +++ b/src/const.h @@ -276,6 +276,8 @@ enum item_t : uint16_t { ITEM_FULLSPLASH = 2886, ITEM_SMALLSPLASH = 2889, + ITEM_BAG = 2853, + ITEM_PARCEL = 3503, ITEM_PARCEL_STAMPED = 3504, ITEM_LETTER = 3505, diff --git a/src/monsters.cpp b/src/monsters.cpp index ca294e2..1d11d2e 100644 --- a/src/monsters.cpp +++ b/src/monsters.cpp @@ -52,7 +52,7 @@ void MonsterType::createLoot(Container* corpse) return; } - Item* bagItem = Item::CreateItem(2853, 1); + Item* bagItem = Item::CreateItem(ITEM_BAG, 1); if (!bagItem) { return; } diff --git a/src/player.cpp b/src/player.cpp index 90a303b..96ac98b 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -1599,6 +1599,15 @@ void Player::dropLoot(Container* corpse, Creature*) } } } + + if (g_game.getClientVersion() >= CLIENT_VERSION_790) { + if (!inventory[CONST_SLOT_BACKPACK]) { + Item* bagItem = Item::CreateItem(ITEM_BAG, 1); + if (bagItem) { + g_game.internalPlayerAddItem(this, bagItem, false, CONST_SLOT_BACKPACK); + } + } + } } void Player::death(Creature* lastHitCreature)