summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-03-27 13:22:55 -0300
committershennetsind <ind@henn.et>2013-03-27 13:22:55 -0300
commit90f117f6b071c9c12bb8b521b6de46301639e75c (patch)
treeb9b7c509abe0d7009ab7483a9201f4bcb579bce1 /src/map/script.c
parentc58f741a0f2b807cbeb065c2dbbfe4f86dfb95b2 (diff)
downloadhercules-90f117f6b071c9c12bb8b521b6de46301639e75c.tar.gz
hercules-90f117f6b071c9c12bb8b521b6de46301639e75c.tar.bz2
hercules-90f117f6b071c9c12bb8b521b6de46301639e75c.tar.xz
hercules-90f117f6b071c9c12bb8b521b6de46301639e75c.zip
Introducing Hercules' Map Zone Database
Click the link for full info~! http://hercules.ws/board/topic/302-introducing-hercules-map-zone-database/ Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c56
1 files changed, 30 insertions, 26 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 4c913651a..0e45f4821 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -384,7 +384,7 @@ enum {
MF_NORETURN,
MF_NOWARPTO,
MF_NIGHTMAREDROP,
- MF_RESTRICTED,
+ MF_ZONE,
MF_NOCOMMAND,
MF_NODROP,
MF_JEXP,
@@ -9558,8 +9558,8 @@ static int buildin_announce_sub(struct block_list *bl, va_list ap)
return 0;
}
/* Runs item effect on attached character.
- * consumeitem <item id>;
- * consumeitem "<item name>"; */
+ * itemeffect <item id>;
+ * itemeffect "<item name>"; */
BUILDIN_FUNC(itemeffect) {
TBL_NPC *nd;
TBL_PC *sd;
@@ -9579,14 +9579,14 @@ BUILDIN_FUNC(itemeffect) {
ShowError( "buildin_itemeffect: Nonexistant item %s requested.\n", name );
return 1;
}
- }else if( data_isint( data ) ){
+ } else if( data_isint( data ) ){
int nameid = conv_num( st, data );
if( ( item_data = itemdb_exists( nameid ) ) == NULL ){
ShowError("buildin_itemeffect: Nonexistant item %d requested.\n", nameid );
return 1;
}
- }else{
+ } else {
ShowError("buildin_itemeffect: invalid data type for argument #1 (%d).", data->type );
return 1;
}
@@ -10707,10 +10707,6 @@ BUILDIN_FUNC(getmapflag)
case MF_FOG: script_pushint(st,map[m].flag.fog); break;
case MF_SAKURA: script_pushint(st,map[m].flag.sakura); break;
case MF_LEAVES: script_pushint(st,map[m].flag.leaves); break;
- /**
- * No longer available, keeping here just in case it's back someday. [Ind]
- **/
- //case MF_RAIN: script_pushint(st,map[m].flag.rain); break;
case MF_NOGO: script_pushint(st,map[m].flag.nogo); break;
case MF_CLOUDS: script_pushint(st,map[m].flag.clouds); break;
case MF_CLOUDS2: script_pushint(st,map[m].flag.clouds2); break;
@@ -10725,7 +10721,6 @@ BUILDIN_FUNC(getmapflag)
case MF_NORETURN: script_pushint(st,map[m].flag.noreturn); break;
case MF_NOWARPTO: script_pushint(st,map[m].flag.nowarpto); break;
case MF_NIGHTMAREDROP: script_pushint(st,map[m].flag.pvp_nightmaredrop); break;
- case MF_RESTRICTED: script_pushint(st,map[m].flag.restricted); break;
case MF_NOCOMMAND: script_pushint(st,map[m].nocommand); break;
case MF_NODROP: script_pushint(st,map[m].flag.nodrop); break;
case MF_JEXP: script_pushint(st,map[m].jexp); break;
@@ -10764,15 +10759,27 @@ static int script_mapflag_pvp_sub(struct block_list *bl,va_list ap) {
BUILDIN_FUNC(setmapflag)
{
int16 m,i;
- const char *str;
+ const char *str, *val2;
+ struct script_data* data;
int val=0;
str=script_getstr(st,2);
- i=script_getnum(st,3);
+
+ i = script_getnum(st, 3);
+
if(script_hasdata(st,4)){
- val=script_getnum(st,4);
+ data = script_getdata(st,4);
+ get_val(st, data);
+
+
+ if( data_isstring(data) )
+ val2 = script_getstr(st, 4);
+ else
+ val = script_getnum(st, 4);
+
}
m = map_mapname2mapid(str);
+
if(m >= 0) {
switch(i) {
case MF_NOMEMO: map[m].flag.nomemo = 1; break;
@@ -10821,9 +10828,13 @@ BUILDIN_FUNC(setmapflag)
case MF_NORETURN: map[m].flag.noreturn = 1; break;
case MF_NOWARPTO: map[m].flag.nowarpto = 1; break;
case MF_NIGHTMAREDROP: map[m].flag.pvp_nightmaredrop = 1; break;
- case MF_RESTRICTED:
- map[m].zone |= 1<<(val+1);
- map[m].flag.restricted=1;
+ case MF_ZONE: {
+ char zone[6] = "zone\0";
+ char empty[1] = "\0";
+ char params[MAP_ZONE_MAPFLAG_LENGTH];
+ memcpy(params, val2, MAP_ZONE_MAPFLAG_LENGTH);
+ npc_parse_mapflag(map[m].name, empty, zone, params, empty, empty, empty);
+ }
break;
case MF_NOCOMMAND: map[m].nocommand = (val <= 0) ? 100 : val; break;
case MF_NODROP: map[m].flag.nodrop = 1; break;
@@ -10887,10 +10898,6 @@ BUILDIN_FUNC(removemapflag)
case MF_FOG: map[m].flag.fog = 0; break;
case MF_SAKURA: map[m].flag.sakura = 0; break;
case MF_LEAVES: map[m].flag.leaves = 0; break;
- /**
- * No longer available, keeping here just in case it's back someday. [Ind]
- **/
- //case MF_RAIN: map[m].flag.rain = 0; break;
case MF_NOGO: map[m].flag.nogo = 0; break;
case MF_CLOUDS: map[m].flag.clouds = 0; break;
case MF_CLOUDS2: map[m].flag.clouds2 = 0; break;
@@ -10905,11 +10912,8 @@ BUILDIN_FUNC(removemapflag)
case MF_NORETURN: map[m].flag.noreturn = 0; break;
case MF_NOWARPTO: map[m].flag.nowarpto = 0; break;
case MF_NIGHTMAREDROP: map[m].flag.pvp_nightmaredrop = 0; break;
- case MF_RESTRICTED:
- map[m].zone ^= 1<<(val+1);
- if (map[m].zone == 0){
- map[m].flag.restricted=0;
- }
+ case MF_ZONE:/* reset zone state, mapflags cant be removed however */
+ map[m].zone = &map_zone_all;
break;
case MF_NOCOMMAND: map[m].nocommand = 0; break;
case MF_NODROP: map[m].flag.nodrop = 0; break;
@@ -17566,7 +17570,7 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(isloggedin,"i?"),
BUILDIN_DEF(setmapflagnosave,"ssii"),
BUILDIN_DEF(getmapflag,"si"),
- BUILDIN_DEF(setmapflag,"si?"),
+ BUILDIN_DEF(setmapflag,"sv?"),
BUILDIN_DEF(removemapflag,"si?"),
BUILDIN_DEF(pvpon,"s"),
BUILDIN_DEF(pvpoff,"s"),