summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt1
-rw-r--r--conf-tmpl/Changelog.txt3
-rw-r--r--conf-tmpl/battle/client.conf30
-rw-r--r--src/map/script.c130
4 files changed, 85 insertions, 79 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index adbca472b..9ab8b7f9f 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -4,6 +4,7 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2007/03/22
+ * Corrected setitemscript not correctly updating the item's script.
* Added define MAX_CHARS so you can easily mod the server to support a
different amount of characters per account (however, there is still the
issue of hexing the client to support this change)
diff --git a/conf-tmpl/Changelog.txt b/conf-tmpl/Changelog.txt
index 8d3252dd9..af2d5c8e8 100644
--- a/conf-tmpl/Changelog.txt
+++ b/conf-tmpl/Changelog.txt
@@ -1,5 +1,8 @@
Date Added
+2007/03/22
+ * Made packet_ver_flag's description use hexadecimal values for the packet
+ versions, and changed the default to 0xFFFF. [Skotlex]
2007/03/19
* Removed the 'charsave_method' setting from inter_athena.conf
2007/03/17
diff --git a/conf-tmpl/battle/client.conf b/conf-tmpl/battle/client.conf
index ba92ce6b0..a9546e845 100644
--- a/conf-tmpl/battle/client.conf
+++ b/conf-tmpl/battle/client.conf
@@ -30,21 +30,21 @@
// Set here which client version do you accept. Add all values of clients:
// Clients older than accepted versions, and versions not set to 'accepted'
// here will be rejected when logging in
-// 1: Clients 2004-09-06aSakray and older (packet versions 4-9)
-// 2: 2004-09-06aSakexe (version 10)
-// 4: 2004-09-21aSakray (version 11)
-// 8: 2004-10-11aSakexe (version 12)
-// 16: 2004-10-25aSakexe (version 13)
-// 32: 2004-11-01aSakexe (version 14)
-// 64: 2004-12-06aSakexe (version 15)
-// 128: 2005-01-10aSakexe (version 16)
-// 256: 2005-05-09aSakexe (version 17)
-// 512: 2005-06-28aSakexe (version 18)
-// 1024: 2006-04-03aSakexe (version 19)
-// 2048: 2007-01-08aSakexe (version 20)
-// 4096: 2007-02-12aSakexe (version 21)
-// default value: 8191 (all clients)
-packet_ver_flag: 8191
+// 0x0001: Clients 2004-09-06aSakray and older (packet versions 4-9)
+// 0x0002: 2004-09-06aSakexe (version 10)
+// 0x0004: 2004-09-21aSakray (version 11)
+// 0x0008: 2004-10-11aSakexe (version 12)
+// 0x0010: 2004-10-25aSakexe (version 13)
+// 0x0020: 2004-11-01aSakexe (version 14)
+// 0x0040: 2004-12-06aSakexe (version 15)
+// 0x0080: 2005-01-10aSakexe (version 16)
+// 0x0100: 2005-05-09aSakexe (version 17)
+// 0x0200: 2005-06-28aSakexe (version 18)
+// 0x0400: 2006-04-03aSakexe (version 19)
+// 0x0800: 2007-01-08aSakexe (version 20)
+// 0x1000: 2007-02-12aSakexe (version 21)
+// default value: 0xFFFF (all clients)
+packet_ver_flag: 0xFFFF
// Minimum delay between whisper/global/party/guild messages (in ms)
// Messages that break this threshold are silently omitted.
diff --git a/src/map/script.c b/src/map/script.c
index e75456b63..62c88a8b9 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -12198,27 +12198,34 @@ BUILDIN_FUNC(setitemscript)
int item_id,n=0;
const char *script;
struct item_data *i_data;
- struct script_code *dstscript;
+ struct script_code **dstscript;
item_id = conv_num(st,script_getdata(st,2));
script = conv_str(st,script_getdata(st,3));
- if( st->end>st->start+4 )
+ if( script_hasdata(st,4) )
n=conv_num(st,script_getdata(st,4));
i_data = itemdb_exists(item_id);
- if (i_data && script!=NULL && script[0]=='{' && n<3) {
- if(n==2)
- dstscript = i_data->unequip_script;
- else if(n==1)
- dstscript = i_data->equip_script;
- else
- dstscript = i_data->script;
- if(dstscript)
- script_free_code(dstscript);
- dstscript = parse_script(script, "script_setitemscript", 0, 0);
- script_pushint(st,1);
- } else
+ if (!i_data || script==NULL || script[0]!='{') {
script_pushint(st,0);
+ return 0;
+ }
+ switch (n) {
+ case 2:
+ dstscript = &i_data->unequip_script;
+ break;
+ case 1:
+ dstscript = &i_data->equip_script;
+ break;
+ default:
+ dstscript = &i_data->script;
+ break;
+ }
+ if(*dstscript)
+ script_free_code(*dstscript);
+
+ *dstscript = parse_script(script, "script_setitemscript", 0, 0);
+ script_pushint(st,1);
return 0;
}
@@ -12838,14 +12845,10 @@ BUILDIN_FUNC(unitwarp)
y = (short)conv_num(st, script_getdata(st,5));
bl = map_id2bl(unit_id);
- if( map > 0 && bl != NULL )
- {
+ if( map >= 0 && bl != NULL )
script_pushint(st, unit_warp(bl,map,x,y,0));
- }
else
- {
script_pushint(st, 0);
- }
return 0;
}
@@ -12860,57 +12863,56 @@ BUILDIN_FUNC(unitwarp)
BUILDIN_FUNC(unitattack)
{
struct block_list* unit_bl;
+ struct block_list* target_bl = NULL;
+ struct script_data* data;
+ int actiontype = 0;
// get unit
unit_bl = map_id2bl(conv_num(st, script_getdata(st, 2)));
- if( unit_bl != NULL )
+ if( unit_bl == NULL ) {
+ script_pushint(st, 0);
+ return 0;
+ }
+
+ data = script_getdata(st, 3);
+ get_val(st, data);
+ if( data_isstring(data) )
{
- struct block_list* target_bl = NULL;
- struct script_data* data;
- int actiontype = 0;
-
- // get target
- data = script_getdata(st, 3);
- get_val(st, data);
- if( data_isstring(data) )
- {
- struct map_session_data* sd = map_nick2sd(conv_str(st, data));
- if( sd != NULL )
- target_bl = &sd->bl;
- }
- if( target_bl == NULL )
- target_bl = map_id2bl(conv_num(st, data));
-
- // get actiontype
- if( script_hasdata(st,4) )
- actiontype = conv_num(st, script_getdata(st, 4));
-
- // request the attack
- if( target_bl != NULL )
- {
- switch( unit_bl->type )
- {
- case BL_PC:
- clif_parse_ActionRequest_sub(((TBL_PC *)unit_bl), actiontype > 0 ? 0x07 : 0x00, target_bl->id, gettick());
- script_pushint(st, 1);
- return 0;
- case BL_MOB:
- ((TBL_MOB *)unit_bl)->state.killer = 1;
- ((TBL_MOB *)unit_bl)->target_id = target_bl->id;
- break;
- case BL_PET:
- ((TBL_PET *)unit_bl)->target_id = target_bl->id;
- break;
- default:
- ShowError("script:unitattack: unsupported source unit type %d\n", unit_bl->type);
- script_pushint(st, 0);
- return 0;
- }
- script_pushint(st, unit_walktobl(unit_bl, target_bl, 65025, 2));
- }
+ struct map_session_data* sd = map_nick2sd(conv_str(st, data));
+ if( sd != NULL )
+ target_bl = &sd->bl;
+ } else
+ target_bl = map_id2bl(conv_num(st, data));
+ // request the attack
+ if( target_bl == NULL )
+ {
+ script_pushint(st, 0);
+ return 0;
}
- script_pushint(st, 0);
+
+ // get actiontype
+ if( script_hasdata(st,4) )
+ actiontype = conv_num(st, script_getdata(st, 4));
+ switch( unit_bl->type )
+ {
+ case BL_PC:
+ clif_parse_ActionRequest_sub(((TBL_PC *)unit_bl), actiontype > 0 ? 0x07 : 0x00, target_bl->id, gettick());
+ script_pushint(st, 1);
+ return 0;
+ case BL_MOB:
+ ((TBL_MOB *)unit_bl)->state.killer = 1;
+ ((TBL_MOB *)unit_bl)->target_id = target_bl->id;
+ break;
+ case BL_PET:
+ ((TBL_PET *)unit_bl)->target_id = target_bl->id;
+ break;
+ default:
+ ShowError("script:unitattack: unsupported source unit type %d\n", unit_bl->type);
+ script_pushint(st, 0);
+ return 0;
+ }
+ script_pushint(st, unit_walktobl(unit_bl, target_bl, 65025, 2));
return 0;
}