summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormalufett <malufett.eat.my.binaries@gmail.com>2013-02-27 02:23:06 +0800
committermalufett <malufett.eat.my.binaries@gmail.com>2013-02-27 02:23:06 +0800
commitad792f41994ce54dc9e45fbdaaf591f38fccecee (patch)
tree2f9042554878cd443db1b422358ace08c92a6dc1 /src
parent06526e32ea7608dfc62ad5aeca91cf78ff3a446f (diff)
downloadhercules-ad792f41994ce54dc9e45fbdaaf591f38fccecee.tar.gz
hercules-ad792f41994ce54dc9e45fbdaaf591f38fccecee.tar.bz2
hercules-ad792f41994ce54dc9e45fbdaaf591f38fccecee.tar.xz
hercules-ad792f41994ce54dc9e45fbdaaf591f38fccecee.zip
Fixed Bug #6527
-Where all NPC don't allow changing of equipments by default and now can be set in 'items.conf'.
Diffstat (limited to 'src')
-rw-r--r--src/map/battle.c1
-rw-r--r--src/map/battle.h1
-rw-r--r--src/map/clif.c11
-rw-r--r--src/map/pc.c3
-rw-r--r--src/map/script.c6
-rw-r--r--src/map/script.h1
6 files changed, 15 insertions, 8 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 7fc9ad237..949b91a29 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -5913,6 +5913,7 @@ static const struct _battle_data {
{ "skill_trap_type", &battle_config.skill_trap_type, 0, 0, 1, },
{ "item_restricted_consumption_type", &battle_config.item_restricted_consumption_type,1, 0, 1, },
{ "max_walk_path", &battle_config.max_walk_path, 17, 1, MAX_WALKPATH, },
+ { "item_enabled_npc", &battle_config.item_enabled_npc, 1, 0, 1, },
};
#ifndef STATS_OPT_OUT
/**
diff --git a/src/map/battle.h b/src/map/battle.h
index 14bd70fee..0e888fc9e 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -489,6 +489,7 @@ extern struct Battle_Config
int skill_trap_type;
int item_restricted_consumption_type;
int max_walk_path;
+ int item_enabled_npc;
} battle_config;
diff --git a/src/map/clif.c b/src/map/clif.c
index 82ff333a1..ea05baa3c 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -10207,10 +10207,10 @@ void clif_parse_EquipItem(int fd,struct map_session_data *sd)
if (index < 0 || index >= MAX_INVENTORY)
return; //Out of bounds check.
- if(sd->npc_id) {
- if (sd->npc_id != sd->npc_item_flag)
+ if( sd->npc_id )
+ if ( !sd->npc_item_flag )
return;
- } else if (sd->state.storage_flag || sd->sc.opt1)
+ else if ( sd->state.storage_flag || sd->sc.opt1 )
; //You can equip/unequip stuff while storage is open/under status changes
else if ( pc_cant_act2(sd) )
return;
@@ -10247,7 +10247,10 @@ void clif_parse_UnequipItem(int fd,struct map_session_data *sd)
return;
}
- if (sd->state.storage_flag || sd->sc.opt1)
+ if( sd->npc_id )
+ if ( !sd->npc_item_flag )
+ return;
+ else if ( sd->state.storage_flag || sd->sc.opt1 )
; //You can equip/unequip stuff while storage is open/under status changes
else if ( pc_cant_act2(sd) )
return;
diff --git a/src/map/pc.c b/src/map/pc.c
index 7eae16193..a3b1335c9 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -4232,8 +4232,7 @@ int pc_useitem(struct map_session_data *sd,int n)
nullpo_ret(sd);
- //This flag enables you to use items while in an NPC. [Skotlex]
- if( sd->npc_id && sd->npc_id != sd->npc_item_flag ){
+ if( sd->npc_id ){
#ifdef RENEWAL
clif_msg(sd, 0x783); // TODO look for the client date that has this message.
#endif
diff --git a/src/map/script.c b/src/map/script.c
index c4ee96feb..604872dfd 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -3017,6 +3017,7 @@ struct script_state* script_alloc_state(struct script_code* script, int pos, int
st->rid = rid;
st->oid = oid;
st->sleep.timer = INVALID_TIMER;
+ st->npc_item_flag = battle_config.item_enabled_npc;
return st;
}
@@ -3644,6 +3645,7 @@ static void script_attach_state(struct script_state* st)
}
sd->st = st;
sd->npc_id = st->oid;
+ sd->npc_item_flag = st->npc_item_flag; // load default.
/**
* For the Secure NPC Timeout option (check config/Secure.h) [RR]
**/
@@ -6964,7 +6966,7 @@ BUILDIN_FUNC(enableitemuse)
TBL_PC *sd;
sd=script_rid2sd(st);
if (sd)
- sd->npc_item_flag = st->oid;
+ st->npc_item_flag = sd->npc_item_flag = 1;
return 0;
}
@@ -6973,7 +6975,7 @@ BUILDIN_FUNC(disableitemuse)
TBL_PC *sd;
sd=script_rid2sd(st);
if (sd)
- sd->npc_item_flag = 0;
+ st->npc_item_flag = sd->npc_item_flag = 0;
return 0;
}
diff --git a/src/map/script.h b/src/map/script.h
index b27b3d290..3e7f3087f 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -132,6 +132,7 @@ struct script_state {
int bk_npcid;
unsigned freeloop : 1;// used by buildin_freeloop
unsigned op2ref : 1;// used by op_2
+ unsigned npc_item_flag : 1;
};
struct script_reg {