summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-01-24 02:56:13 +0300
committerAndrei Karas <akaras@inbox.ru>2016-01-24 02:56:13 +0300
commit8f08ff5f6d1b5f4a0bad31c20c2d13848c6b984f (patch)
tree6be2d1cc1d88aad3064363a6487d8c77ffeeb500 /src
parent77cc71cde657cca6c2747a41e3c1672cd4c6092b (diff)
downloadplugin-8f08ff5f6d1b5f4a0bad31c20c2d13848c6b984f.tar.gz
plugin-8f08ff5f6d1b5f4a0bad31c20c2d13848c6b984f.tar.bz2
plugin-8f08ff5f6d1b5f4a0bad31c20c2d13848c6b984f.tar.xz
plugin-8f08ff5f6d1b5f4a0bad31c20c2d13848c6b984f.zip
Not allow use equipped items in craft.
Diffstat (limited to 'src')
-rw-r--r--src/emap/craft.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/emap/craft.c b/src/emap/craft.c
index 54cf7b9..4c5cb5d 100644
--- a/src/emap/craft.c
+++ b/src/emap/craft.c
@@ -143,7 +143,8 @@ bool craft_checkstr(TBL_PC *sd, const char *craftstr)
if (!amount)
continue;
if(sd->status.inventory[f].nameid == 0 ||
- sd->status.inventory[f].amount < amount)
+ sd->status.inventory[f].amount < amount ||
+ sd->status.inventory[f].equip > 0)
{
return false;
}
@@ -335,7 +336,8 @@ bool craft_validate(TBL_PC *sd, const int id)
if (invIndex < 0 ||
invIndex >= MAX_INVENTORY ||
!sd->status.inventory[invIndex].nameid ||
- !sd->status.inventory[invIndex].amount)
+ sd->status.inventory[invIndex].amount <= 0 ||
+ sd->status.inventory[invIndex].equip > 0)
{
return false;
}
@@ -348,7 +350,8 @@ bool craft_validate(TBL_PC *sd, const int id)
if (!amount)
continue;
if(sd->status.inventory[f].nameid == 0 ||
- sd->status.inventory[f].amount < amount)
+ sd->status.inventory[f].amount < amount ||
+ sd->status.inventory[f].equip > 0)
{
return false;
}
@@ -364,7 +367,8 @@ static int find_inventory_item(TBL_PC *sd,
for (i = 0; i < MAX_INVENTORY; i++)
{
if (sd->status.inventory[i].nameid == id &&
- sd->status.inventory[i].amount >= amount)
+ sd->status.inventory[i].amount >= amount &&
+ sd->status.inventory[i].equip == 0)
{
return i;
}