diff options
-rw-r--r-- | conf/battle/items.conf | 8 | ||||
-rw-r--r-- | doc/script_commands.txt | 18 | ||||
-rw-r--r-- | src/map/battle.c | 1 | ||||
-rw-r--r-- | src/map/battle.h | 1 | ||||
-rw-r--r-- | src/map/clif.c | 11 | ||||
-rw-r--r-- | src/map/pc.c | 3 | ||||
-rw-r--r-- | src/map/script.c | 6 | ||||
-rw-r--r-- | src/map/script.h | 1 |
8 files changed, 32 insertions, 17 deletions
diff --git a/conf/battle/items.conf b/conf/battle/items.conf index 343b4212e..4401072d5 100644 --- a/conf/battle/items.conf +++ b/conf/battle/items.conf @@ -79,4 +79,10 @@ autospell_stacking: no // Will disabled consumables (disabled by item_noequip.txt) be consumed when trying to use them? // 1 (official): yes // 0: no -item_restricted_consumption_type:1
\ No newline at end of file +item_restricted_consumption_type:1 + +// Enable all NPC to allow changing of equipments while interacting? (Note 1) +// Script commands 'enable_items/disable_items' will not be override. (see doc/script_commands.txt) +// 1 : yes(official) +// 0 : no +item_enabled_npc:1
\ No newline at end of file diff --git a/doc/script_commands.txt b/doc/script_commands.txt index a5ba6e065..22b316d2c 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -1,4 +1,4 @@ -//===== Hercules Documentation ================================ +//===== Hercules Documentation ================================ //= Hercules Script Commands //===== By: ================================================== //= Hercules Dev Team @@ -1208,7 +1208,7 @@ with other command, such as "if", but often used on it's own. Label: mes "This will be seen"; -Note by FlavioJS: goto's are "evil" and should be avoided if possible (ò_ó) +Note by FlavioJS: goto's are "evil" and should be avoided if possible (_) --------------------------------------- @@ -4441,13 +4441,15 @@ getrandgroupitem(1,3); *enable_items; *disable_items; -These commands enable item usage while an NPC is running. When enable_items is -run, items can be used during scripts until disable_items is called. -To avoid possible exploits, when enable_items is invoked, it will only enable -item usage while running that script in particular. Note that if a different -script also calls enable_items, it will override the last call (so you may +These commands enable/disable changing of equipments while an NPC is running. When disable_items is +run, equipments cannot be changed during scripts until enable_items is called or the script has terminated. +To avoid possible exploits, when disable_items is invoked, it will only disable +changing equips while running that script in particular. Note that if a different +script also calls disable_items, it will override the last call (so you may want to call this command at the start of your script without assuming the effect is still in effect). +If 'item_enabled_npc' option is set to Yes in 'items.conf' all NPC are allowing changing of equipment by default +except for those have been set with 'disable_items'. --------------------------------------- @@ -6435,7 +6437,7 @@ placement of the illustration and takes following values: 3 - middle of screen in a movable window with an empty title bar 4 - middle of screen without the window header, but still movable -The picture is read from data\texture\유저인터페이스\illust, from both the GRF archive +The picture is read from data\texture\???????\illust, from both the GRF archive and data folder, and is required to be a bitmap. The file extension .bmp can be omitted. Magenta color (#ff00ff) is considered transparent. There is no limit placed on the size of the illustrations by the client, although loading of large 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 { |