diff options
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 396 |
1 files changed, 243 insertions, 153 deletions
diff --git a/src/map/script.c b/src/map/script.c index befb85304..f3c839555 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -159,10 +159,8 @@ const char* script_op2name(int op) { RETURN_OP_NAME(C_SUB_POST); RETURN_OP_NAME(C_ADD_PRE); RETURN_OP_NAME(C_SUB_PRE); -#ifdef PCRE_SUPPORT RETURN_OP_NAME(C_RE_EQ); RETURN_OP_NAME(C_RE_NE); -#endif // PCRE_SUPPORT default: ShowDebug("script_op2name: unexpected op=%d\n", op); @@ -1379,6 +1377,10 @@ const char* parse_simpleexpr(const char *p) return pv; } + if (script->str_data[l].type == C_INT && script->str_data[l].deprecated) { + disp_warning_message("This constant is deprecated and it will be removed in a future version. Please see the script documentation and constants.conf for an alternative.\n", p); + } + p=script->skip_word(p); if( *p == '[' ) { // array(name[i] => getelementofarray(name,i) ) @@ -1442,10 +1444,8 @@ const char* script_parse_subexpr(const char* p,int limit) || (op=C_XOR, opl=4, len=1,*p=='^') // ^ || (op=C_EQ, opl=6, len=2,*p=='=' && p[1]=='=') // == || (op=C_NE, opl=6, len=2,*p=='!' && p[1]=='=') // != -#ifdef PCRE_SUPPORT || (op=C_RE_EQ, opl=6, len=2,*p=='~' && p[1]=='=') // ~= || (op=C_RE_NE, opl=6, len=2,*p=='~' && p[1]=='!') // ~! -#endif // PCRE_SUPPORT || (op=C_R_SHIFT,opl=8, len=2,*p=='>' && p[1]=='>') // >> || (op=C_GE, opl=7, len=2,*p=='>' && p[1]=='=') // >= || (op=C_GT, opl=7, len=1,*p=='>') // > @@ -2231,25 +2231,31 @@ bool script_get_constant(const char* name, int* value) return false; } value[0] = script->str_data[n].val; + if (script->str_data[n].deprecated) { + ShowWarning("The constant '%s' is deprecated and it will be removed in a future version. Please see the script documentation and constants.conf for an alternative.\n", name); + } return true; } /// Creates new constant or parameter with given value. -void script_set_constant(const char* name, int value, bool isparameter) { +void script_set_constant(const char *name, int value, bool is_parameter, bool is_deprecated) +{ int n = script->add_str(name); if( script->str_data[n].type == C_NOP ) {// new - script->str_data[n].type = isparameter ? C_PARAM : C_INT; + script->str_data[n].type = is_parameter ? C_PARAM : C_INT; script->str_data[n].val = value; + script->str_data[n].deprecated = is_deprecated ? 1 : 0; } else if( script->str_data[n].type == C_PARAM || script->str_data[n].type == C_INT ) {// existing parameter or constant ShowError("script_set_constant: Attempted to overwrite existing %s '%s' (old value=%d, new value=%d).\n", ( script->str_data[n].type == C_PARAM ) ? "parameter" : "constant", name, script->str_data[n].val, value); } else {// existing name - ShowError("script_set_constant: Invalid name for %s '%s' (already defined as %s).\n", isparameter ? "parameter" : "constant", name, script->op2name(script->str_data[n].type)); + ShowError("script_set_constant: Invalid name for %s '%s' (already defined as %s).\n", is_parameter ? "parameter" : "constant", name, script->op2name(script->str_data[n].type)); } } /* adds data to a existent constant in the database, inserted normally via parse */ -void script_set_constant2(const char *name, int value, bool isparameter) { +void script_set_constant2(const char *name, int value, bool is_parameter, bool is_deprecated) +{ int n = script->add_str(name); if( script->str_data[n].type == C_PARAM ) { @@ -2273,36 +2279,88 @@ void script_set_constant2(const char *name, int value, bool isparameter) { script->str_data[n].label = -1; } - script->str_data[n].type = isparameter ? C_PARAM : C_INT; + script->str_data[n].type = is_parameter ? C_PARAM : C_INT; script->str_data[n].val = value; - + script->str_data[n].deprecated = is_deprecated ? 1 : 0; } -/*========================================== - * Reading constant databases - * const.txt - *------------------------------------------*/ -void read_constdb(void) { - FILE *fp; - char line[1024],name[1024],val[1024]; - int type; - sprintf(line, "%s/const.txt", map->db_path); - fp=fopen(line, "r"); - if(fp==NULL) { - ShowError("can't read %s\n", line); - return ; +/** + * Loads the constants database from constants.conf + */ +void read_constdb(void) +{ + config_t constants_conf; + char filepath[256]; + config_setting_t *cdb; + config_setting_t *t; + int i = 0; + + sprintf(filepath, "%s/constants.conf", map->db_path); + + if (libconfig->read_file(&constants_conf, filepath) || !(cdb = libconfig->setting_get_member(constants_conf.root, "constants_db"))) { + ShowError("can't read %s\n", filepath); + return; } - while (fgets(line, sizeof(line), fp)) { - if (line[0] == '/' && line[1] == '/') + + while ((t = libconfig->setting_get_elem(cdb, i++))) { + bool is_parameter = false; + bool is_deprecated = false; + int value = 0; + const char *name = config_setting_name(t); + const char *p = name; + + while (*p != '\0') { + if (!ISALNUM(*p) && *p != '_') + break; + p++; + } + if (*p != '\0') { + ShowWarning("read_constdb: Invalid constant name %s. Skipping.\n", name); continue; - type = 0; - if (sscanf(line, "%1023[A-Za-z0-9_],%1023[-0-9xXA-Fa-f],%d", name, val, &type) >=2 - || sscanf(line, "%1023[A-Za-z0-9_] %1023[-0-9xXA-Fa-f] %d", name, val, &type) >=2 - ) { - script->set_constant(name, (int)strtol(val, NULL, 0), (bool)type); } + if (strcmp(name, "comment__") == 0) { + const char *comment = libconfig->setting_get_string(t); + if (comment == NULL) + continue; + if (*comment == '\0') + comment = NULL; + script->constdb_comment(comment); + continue; + } + if (config_setting_is_aggregate(t)) { + int i32; + if (!libconfig->setting_lookup_int(t, "Value", &i32)) { + ShowWarning("read_constdb: Invalid entry for %s. Skipping.\n", name); + continue; + } + value = i32; + if (libconfig->setting_lookup_bool(t, "Parameter", &i32)) { + if (i32 != 0) + is_parameter = true; + } + if (libconfig->setting_lookup_bool(t, "Deprecated", &i32)) { + if (i32 != 0) + is_deprecated = true; + } + } else { + value = libconfig->setting_get_int(t); + } + script->set_constant(name, value, is_parameter, is_deprecated); } - fclose(fp); + script->constdb_comment(NULL); + libconfig->destroy(&constants_conf); +} + +/** + * Sets the current constdb comment. + * + * This function does nothing (used by plugins only) + * + * @param comment The comment to set (NULL to unset) + */ +void script_constdb_comment(const char *comment) +{ + (void)comment; } // Standard UNIX tab size is 8 @@ -3699,7 +3757,6 @@ void op_2str(struct script_state* st, int op, const char* s1, const char* s2) case C_GE: a = (strcmp(s1,s2) >= 0); break; case C_LT: a = (strcmp(s1,s2) < 0); break; case C_LE: a = (strcmp(s1,s2) <= 0); break; -#ifdef PCRE_SUPPORT case C_RE_EQ: case C_RE_NE: { @@ -3764,7 +3821,6 @@ void op_2str(struct script_state* st, int op, const char* s1, const char* s2) libpcre->free(extra_regex); } break; -#endif // PCRE_SUPPORT case C_ADD: { char* buf = (char *)aMalloc((strlen(s1)+strlen(s2)+1)*sizeof(char)); @@ -3789,7 +3845,7 @@ void op_2str(struct script_state* st, int op, const char* s1, const char* s2) void op_2num(struct script_state* st, int op, int i1, int i2) { int ret; - double ret_double; + int64 ret64; switch( op ) { case C_AND: ret = i1 & i2; break; @@ -3821,25 +3877,21 @@ void op_2num(struct script_state* st, int op, int i1, int i2) ret = i1 % i2; break; default: - switch( op ) - {// operators that can overflow/underflow - case C_ADD: ret = i1 + i2; ret_double = (double)i1 + (double)i2; break; - case C_SUB: ret = i1 - i2; ret_double = (double)i1 - (double)i2; break; - case C_MUL: ret = i1 * i2; ret_double = (double)i1 * (double)i2; break; + switch (op) { // operators that can overflow/underflow + case C_ADD: ret = i1 + i2; ret64 = (int64)i1 + i2; break; + case C_SUB: ret = i1 - i2; ret64 = (int64)i1 - i2; break; + case C_MUL: ret = i1 * i2; ret64 = (int64)i1 * i2; break; default: ShowError("script:op_2num: unexpected number operator %s i1=%d i2=%d\n", script->op2name(op), i1, i2); script->reportsrc(st); script_pushnil(st); return; } - if( ret_double < (double)INT_MIN ) - { + if (ret64 < INT_MIN) { ShowWarning("script:op_2num: underflow detected op=%s i1=%d i2=%d\n", script->op2name(op), i1, i2); script->reportsrc(st); ret = INT_MIN; - } - else if( ret_double > (double)INT_MAX ) - { + } else if (ret64 > INT_MAX) { ShowWarning("script:op_2num: overflow detected op=%s i1=%d i2=%d\n", script->op2name(op), i1, i2); script->reportsrc(st); ret = INT_MAX; @@ -4361,10 +4413,8 @@ void run_script_main(struct script_state *st) { case C_LOR: case C_R_SHIFT: case C_L_SHIFT: -#ifdef PCRE_SUPPORT case C_RE_EQ: case C_RE_NE: -#endif // PCRE_SUPPORT script->op_2(st, c); break; @@ -9648,20 +9698,18 @@ BUILDIN(makepet) BUILDIN(getexp) { int base=0,job=0; - double bonus; struct map_session_data *sd = script->rid2sd(st); if (sd == NULL) return true; - base=script_getnum(st,2); - job =script_getnum(st,3); - if(base<0 || job<0) + base = script_getnum(st,2); + job = script_getnum(st,3); + if (base < 0 || job < 0) return true; // bonus for npc-given exp - bonus = battle_config.quest_exp_rate / 100.; - base = (int) cap_value(base * bonus, 0, INT_MAX); - job = (int) cap_value(job * bonus, 0, INT_MAX); + base = cap_value(apply_percentrate(base, battle_config.quest_exp_rate, 100), 0, INT_MAX); + job = cap_value(apply_percentrate(job, battle_config.quest_exp_rate, 100), 0, INT_MAX); pc->gainexp(sd, &sd->bl, base, job, true); @@ -11684,7 +11732,7 @@ BUILDIN(getmapflag) case MF_RESET: script_pushint(st,map->list[m].flag.reset); break; case MF_NOTOMB: script_pushint(st,map->list[m].flag.notomb); break; case MF_NOCASHSHOP: script_pushint(st,map->list[m].flag.nocashshop); break; - case MF_NOVIEWID: script_pushint(st,map->list[m].flag.noviewid); break; + case MF_NOVIEWID: script_pushint(st,map->list[m].flag.noviewid); break; } } @@ -11808,7 +11856,7 @@ BUILDIN(setmapflag) { case MF_RESET: map->list[m].flag.reset = 1; break; case MF_NOTOMB: map->list[m].flag.notomb = 1; break; case MF_NOCASHSHOP: map->list[m].flag.nocashshop = 1; break; - case MF_NOVIEWID: map->list[m].flag.noviewid = (val <= 0) ? 0 : val; break; + case MF_NOVIEWID: map->list[m].flag.noviewid = (val <= 0) ? EQP_NONE : val; break; } } @@ -11895,7 +11943,7 @@ BUILDIN(removemapflag) { case MF_RESET: map->list[m].flag.reset = 0; break; case MF_NOTOMB: map->list[m].flag.notomb = 0; break; case MF_NOCASHSHOP: map->list[m].flag.nocashshop = 0; break; - case MF_NOVIEWID: map->list[m].flag.noviewid = 0; break; + case MF_NOVIEWID: map->list[m].flag.noviewid = EQP_NONE; break; } } @@ -18450,7 +18498,7 @@ BUILDIN(setcashmount) if (sd->sc.data[SC_ALL_RIDING]) status_change_end(&sd->bl, SC_ALL_RIDING, INVALID_TIMER); else - sc_start(NULL,&sd->bl, SC_ALL_RIDING, 100, 0, -1); + sc_start(NULL,&sd->bl, SC_ALL_RIDING, 100, 25, -1); script_pushint(st,1);//in both cases, return 1. } return true; @@ -20067,7 +20115,6 @@ BUILDIN(_) { } // declarations that were supposed to be exported from npc_chat.c -#ifdef PCRE_SUPPORT BUILDIN(defpattern); BUILDIN(activatepset); BUILDIN(deactivatepset); @@ -20080,7 +20127,6 @@ BUILDIN(pcre_match) { script->op_2str(st, C_RE_EQ, input, regex); return true; } -#endif /** * Adds a built-in script function. @@ -20497,13 +20543,11 @@ void script_parse_builtin(void) { BUILDIN_DEF(getrefine,""), // returns the refined number of the current item, or an item with index specified [celest] BUILDIN_DEF(night,""), // sets the server to night time BUILDIN_DEF(day,""), // sets the server to day time -#ifdef PCRE_SUPPORT BUILDIN_DEF(defpattern,"iss"), // Define pattern to listen for [MouseJstr] BUILDIN_DEF(activatepset,"i"), // Activate a pattern set [MouseJstr] BUILDIN_DEF(deactivatepset,"i"), // Deactive a pattern set [MouseJstr] BUILDIN_DEF(deletepset,"i"), // Delete a pattern set [MouseJstr] BUILDIN_DEF(pcre_match,"ss"), -#endif BUILDIN_DEF(dispbottom,"s?"), //added from jA [Lupus] BUILDIN_DEF(getusersname,""), BUILDIN_DEF(recovery,""), @@ -20778,119 +20822,164 @@ void script_label_add(int key, int pos) { /** * Sets source-end constants for scripts to play with **/ -void script_hardcoded_constants(void) { - /* server defines */ - script->set_constant("PACKETVER",PACKETVER,false); - script->set_constant("MAX_LEVEL",MAX_LEVEL,false); - script->set_constant("MAX_STORAGE",MAX_STORAGE,false); - script->set_constant("MAX_GUILD_STORAGE",MAX_GUILD_STORAGE,false); - script->set_constant("MAX_CART",MAX_INVENTORY,false); - script->set_constant("MAX_INVENTORY",MAX_INVENTORY,false); - script->set_constant("MAX_ZENY",MAX_ZENY,false); - script->set_constant("MAX_BG_MEMBERS",MAX_BG_MEMBERS,false); - script->set_constant("MAX_CHAT_USERS",MAX_CHAT_USERS,false); - script->set_constant("MAX_REFINE",MAX_REFINE,false); - - /* status options */ - script->set_constant("Option_Nothing",OPTION_NOTHING,false); - script->set_constant("Option_Sight",OPTION_SIGHT,false); - script->set_constant("Option_Hide",OPTION_HIDE,false); - script->set_constant("Option_Cloak",OPTION_CLOAK,false); - script->set_constant("Option_Falcon",OPTION_FALCON,false); - script->set_constant("Option_Riding",OPTION_RIDING,false); - script->set_constant("Option_Invisible",OPTION_INVISIBLE,false); - script->set_constant("Option_Orcish",OPTION_ORCISH,false); - script->set_constant("Option_Wedding",OPTION_WEDDING,false); - script->set_constant("Option_Chasewalk",OPTION_CHASEWALK,false); - script->set_constant("Option_Flying",OPTION_FLYING,false); - script->set_constant("Option_Xmas",OPTION_XMAS,false); - script->set_constant("Option_Transform",OPTION_TRANSFORM,false); - script->set_constant("Option_Summer",OPTION_SUMMER,false); - script->set_constant("Option_Dragon1",OPTION_DRAGON1,false); - script->set_constant("Option_Wug",OPTION_WUG,false); - script->set_constant("Option_Wugrider",OPTION_WUGRIDER,false); - script->set_constant("Option_Madogear",OPTION_MADOGEAR,false); - script->set_constant("Option_Dragon2",OPTION_DRAGON2,false); - script->set_constant("Option_Dragon3",OPTION_DRAGON3,false); - script->set_constant("Option_Dragon4",OPTION_DRAGON4,false); - script->set_constant("Option_Dragon5",OPTION_DRAGON5,false); - script->set_constant("Option_Hanbok",OPTION_HANBOK,false); - script->set_constant("Option_Oktoberfest",OPTION_OKTOBERFEST,false); - - /* status option compounds */ - script->set_constant("Option_Dragon",OPTION_DRAGON,false); - script->set_constant("Option_Costume",OPTION_COSTUME,false); - - /* send_target */ - script->set_constant("ALL_CLIENT",ALL_CLIENT,false); - script->set_constant("ALL_SAMEMAP",ALL_SAMEMAP,false); - script->set_constant("AREA",AREA,false); - script->set_constant("AREA_WOS",AREA_WOS,false); - script->set_constant("AREA_WOC",AREA_WOC,false); - script->set_constant("AREA_WOSC",AREA_WOSC,false); - script->set_constant("AREA_CHAT_WOC",AREA_CHAT_WOC,false); - script->set_constant("CHAT",CHAT,false); - script->set_constant("CHAT_WOS",CHAT_WOS,false); - script->set_constant("PARTY",PARTY,false); - script->set_constant("PARTY_WOS",PARTY_WOS,false); - script->set_constant("PARTY_SAMEMAP",PARTY_SAMEMAP,false); - script->set_constant("PARTY_SAMEMAP_WOS",PARTY_SAMEMAP_WOS,false); - script->set_constant("PARTY_AREA",PARTY_AREA,false); - script->set_constant("PARTY_AREA_WOS",PARTY_AREA_WOS,false); - script->set_constant("GUILD",GUILD,false); - script->set_constant("GUILD_WOS",GUILD_WOS,false); - script->set_constant("GUILD_SAMEMAP",GUILD_SAMEMAP,false); - script->set_constant("GUILD_SAMEMAP_WOS",GUILD_SAMEMAP_WOS,false); - script->set_constant("GUILD_AREA",GUILD_AREA,false); - script->set_constant("GUILD_AREA_WOS",GUILD_AREA_WOS,false); - script->set_constant("GUILD_NOBG",GUILD_NOBG,false); - script->set_constant("DUEL",DUEL,false); - script->set_constant("DUEL_WOS",DUEL_WOS,false); - script->set_constant("SELF",SELF,false); - script->set_constant("BG",BG,false); - script->set_constant("BG_WOS",BG_WOS,false); - script->set_constant("BG_SAMEMAP",BG_SAMEMAP,false); - script->set_constant("BG_SAMEMAP_WOS",BG_SAMEMAP_WOS,false); - script->set_constant("BG_AREA",BG_AREA,false); - script->set_constant("BG_AREA_WOS",BG_AREA_WOS,false); - script->set_constant("BG_QUEUE",BG_QUEUE,false); - - /* Renewal */ +void script_hardcoded_constants(void) +{ + script->constdb_comment("Boolean"); + script->set_constant("true", 1, false, false); + script->set_constant("false", 0, false, false); + + script->constdb_comment("Server defines"); + script->set_constant("PACKETVER",PACKETVER,false, false); + script->set_constant("MAX_LEVEL",MAX_LEVEL,false, false); + script->set_constant("MAX_STORAGE",MAX_STORAGE,false, false); + script->set_constant("MAX_GUILD_STORAGE",MAX_GUILD_STORAGE,false, false); + script->set_constant("MAX_CART",MAX_INVENTORY,false, false); + script->set_constant("MAX_INVENTORY",MAX_INVENTORY,false, false); + script->set_constant("MAX_ZENY",MAX_ZENY,false, false); + script->set_constant("MAX_BG_MEMBERS",MAX_BG_MEMBERS,false, false); + script->set_constant("MAX_CHAT_USERS",MAX_CHAT_USERS,false, false); + script->set_constant("MAX_REFINE",MAX_REFINE,false, false); + + script->constdb_comment("status options"); + script->set_constant("Option_Nothing",OPTION_NOTHING,false, false); + script->set_constant("Option_Sight",OPTION_SIGHT,false, false); + script->set_constant("Option_Hide",OPTION_HIDE,false, false); + script->set_constant("Option_Cloak",OPTION_CLOAK,false, false); + script->set_constant("Option_Falcon",OPTION_FALCON,false, false); + script->set_constant("Option_Riding",OPTION_RIDING,false, false); + script->set_constant("Option_Invisible",OPTION_INVISIBLE,false, false); + script->set_constant("Option_Orcish",OPTION_ORCISH,false, false); + script->set_constant("Option_Wedding",OPTION_WEDDING,false, false); + script->set_constant("Option_Chasewalk",OPTION_CHASEWALK,false, false); + script->set_constant("Option_Flying",OPTION_FLYING,false, false); + script->set_constant("Option_Xmas",OPTION_XMAS,false, false); + script->set_constant("Option_Transform",OPTION_TRANSFORM,false, false); + script->set_constant("Option_Summer",OPTION_SUMMER,false, false); + script->set_constant("Option_Dragon1",OPTION_DRAGON1,false, false); + script->set_constant("Option_Wug",OPTION_WUG,false, false); + script->set_constant("Option_Wugrider",OPTION_WUGRIDER,false, false); + script->set_constant("Option_Madogear",OPTION_MADOGEAR,false, false); + script->set_constant("Option_Dragon2",OPTION_DRAGON2,false, false); + script->set_constant("Option_Dragon3",OPTION_DRAGON3,false, false); + script->set_constant("Option_Dragon4",OPTION_DRAGON4,false, false); + script->set_constant("Option_Dragon5",OPTION_DRAGON5,false, false); + script->set_constant("Option_Hanbok",OPTION_HANBOK,false, false); + script->set_constant("Option_Oktoberfest",OPTION_OKTOBERFEST,false, false); + + script->constdb_comment("status option compounds"); + script->set_constant("Option_Dragon",OPTION_DRAGON,false, false); + script->set_constant("Option_Costume",OPTION_COSTUME,false, false); + + script->constdb_comment("send_target"); + script->set_constant("ALL_CLIENT",ALL_CLIENT,false, false); + script->set_constant("ALL_SAMEMAP",ALL_SAMEMAP,false, false); + script->set_constant("AREA",AREA,false, false); + script->set_constant("AREA_WOS",AREA_WOS,false, false); + script->set_constant("AREA_WOC",AREA_WOC,false, false); + script->set_constant("AREA_WOSC",AREA_WOSC,false, false); + script->set_constant("AREA_CHAT_WOC",AREA_CHAT_WOC,false, false); + script->set_constant("CHAT",CHAT,false, false); + script->set_constant("CHAT_WOS",CHAT_WOS,false, false); + script->set_constant("PARTY",PARTY,false, false); + script->set_constant("PARTY_WOS",PARTY_WOS,false, false); + script->set_constant("PARTY_SAMEMAP",PARTY_SAMEMAP,false, false); + script->set_constant("PARTY_SAMEMAP_WOS",PARTY_SAMEMAP_WOS,false, false); + script->set_constant("PARTY_AREA",PARTY_AREA,false, false); + script->set_constant("PARTY_AREA_WOS",PARTY_AREA_WOS,false, false); + script->set_constant("GUILD",GUILD,false, false); + script->set_constant("GUILD_WOS",GUILD_WOS,false, false); + script->set_constant("GUILD_SAMEMAP",GUILD_SAMEMAP,false, false); + script->set_constant("GUILD_SAMEMAP_WOS",GUILD_SAMEMAP_WOS,false, false); + script->set_constant("GUILD_AREA",GUILD_AREA,false, false); + script->set_constant("GUILD_AREA_WOS",GUILD_AREA_WOS,false, false); + script->set_constant("GUILD_NOBG",GUILD_NOBG,false, false); + script->set_constant("DUEL",DUEL,false, false); + script->set_constant("DUEL_WOS",DUEL_WOS,false, false); + script->set_constant("SELF",SELF,false, false); + script->set_constant("BG",BG,false, false); + script->set_constant("BG_WOS",BG_WOS,false, false); + script->set_constant("BG_SAMEMAP",BG_SAMEMAP,false, false); + script->set_constant("BG_SAMEMAP_WOS",BG_SAMEMAP_WOS,false, false); + script->set_constant("BG_AREA",BG_AREA,false, false); + script->set_constant("BG_AREA_WOS",BG_AREA_WOS,false, false); + script->set_constant("BG_QUEUE",BG_QUEUE,false, false); + + script->constdb_comment("LOOK_ constants, use in setlook/changelook script commands"); + script->set_constant("LOOK_BASE", LOOK_BASE, false, false); + script->set_constant("LOOK_HAIR", LOOK_HAIR, false, false); + script->set_constant("LOOK_WEAPON", LOOK_WEAPON, false, false); + script->set_constant("LOOK_HEAD_BOTTOM", LOOK_HEAD_BOTTOM, false, false); + script->set_constant("LOOK_HEAD_TOP", LOOK_HEAD_TOP, false, false); + script->set_constant("LOOK_HEAD_MID", LOOK_HEAD_MID, false, false); + script->set_constant("LOOK_HAIR_COLOR", LOOK_HAIR_COLOR, false, false); + script->set_constant("LOOK_CLOTHES_COLOR", LOOK_CLOTHES_COLOR, false, false); + script->set_constant("LOOK_SHIELD", LOOK_SHIELD, false, false); + script->set_constant("LOOK_SHOES", LOOK_SHOES, false, false); + script->set_constant("LOOK_BODY", LOOK_BODY, false, false); + script->set_constant("LOOK_FLOOR", LOOK_FLOOR, false, false); + script->set_constant("LOOK_ROBE", LOOK_ROBE, false, false); + script->set_constant("LOOK_BODY2", LOOK_BODY2, false, false); + + script->constdb_comment("Equip Position in Bits, use with *getiteminfo type 5, or @inventorylist_equip"); + script->set_constant("EQP_HEAD_LOW", EQP_HEAD_LOW, false, false); + script->set_constant("EQP_HEAD_MID", EQP_HEAD_MID, false, false); + script->set_constant("EQP_HEAD_TOP", EQP_HEAD_TOP, false, false); + script->set_constant("EQP_HAND_R", EQP_HAND_R, false, false); + script->set_constant("EQP_HAND_L", EQP_HAND_L, false, false); + script->set_constant("EQP_ARMOR", EQP_ARMOR, false, false); + script->set_constant("EQP_SHOES", EQP_SHOES, false, false); + script->set_constant("EQP_GARMENT", EQP_GARMENT, false, false); + script->set_constant("EQP_ACC_L", EQP_ACC_L, false, false); + script->set_constant("EQP_ACC_R", EQP_ACC_R, false, false); + script->set_constant("EQP_COSTUME_HEAD_TOP", EQP_COSTUME_HEAD_TOP, false, false); + script->set_constant("EQP_COSTUME_HEAD_MID", EQP_COSTUME_HEAD_MID, false, false); + script->set_constant("EQP_COSTUME_HEAD_LOW", EQP_COSTUME_HEAD_LOW, false, false); + script->set_constant("EQP_COSTUME_GARMENT", EQP_COSTUME_GARMENT, false, false); + script->set_constant("EQP_AMMO", EQP_AMMO, false, false); + script->set_constant("EQP_SHADOW_ARMOR", EQP_SHADOW_ARMOR, false, false); + script->set_constant("EQP_SHADOW_WEAPON", EQP_SHADOW_WEAPON, false, false); + script->set_constant("EQP_SHADOW_SHIELD", EQP_SHADOW_SHIELD, false, false); + script->set_constant("EQP_SHADOW_SHOES", EQP_SHADOW_SHOES, false, false); + script->set_constant("EQP_SHADOW_ACC_R", EQP_SHADOW_ACC_R, false, false); + script->set_constant("EQP_SHADOW_ACC_L", EQP_SHADOW_ACC_L, false, false); + + script->constdb_comment("Renewal"); #ifdef RENEWAL - script->set_constant("RENEWAL", 1, false); + script->set_constant("RENEWAL", 1, false, false); #else - script->set_constant("RENEWAL", 0, false); + script->set_constant("RENEWAL", 0, false, false); #endif #ifdef RENEWAL_CAST - script->set_constant("RENEWAL_CAST", 1, false); + script->set_constant("RENEWAL_CAST", 1, false, false); #else - script->set_constant("RENEWAL_CAST", 0, false); + script->set_constant("RENEWAL_CAST", 0, false, false); #endif #ifdef RENEWAL_DROP - script->set_constant("RENEWAL_DROP", 1, false); + script->set_constant("RENEWAL_DROP", 1, false, false); #else - script->set_constant("RENEWAL_DROP", 0, false); + script->set_constant("RENEWAL_DROP", 0, false, false); #endif #ifdef RENEWAL_EXP - script->set_constant("RENEWAL_EXP", 1, false); + script->set_constant("RENEWAL_EXP", 1, false, false); #else - script->set_constant("RENEWAL_EXP", 0, false); + script->set_constant("RENEWAL_EXP", 0, false, false); #endif #ifdef RENEWAL_LVDMG - script->set_constant("RENEWAL_LVDMG", 1, false); + script->set_constant("RENEWAL_LVDMG", 1, false, false); #else - script->set_constant("RENEWAL_LVDMG", 0, false); + script->set_constant("RENEWAL_LVDMG", 0, false, false); #endif #ifdef RENEWAL_EDP - script->set_constant("RENEWAL_EDP", 1, false); + script->set_constant("RENEWAL_EDP", 1, false, false); #else - script->set_constant("RENEWAL_EDP", 0, false); + script->set_constant("RENEWAL_EDP", 0, false, false); #endif #ifdef RENEWAL_ASPD - script->set_constant("RENEWAL_ASPD", 1, false); + script->set_constant("RENEWAL_ASPD", 1, false, false); #else - script->set_constant("RENEWAL_ASPD", 0, false); + script->set_constant("RENEWAL_ASPD", 0, false, false); #endif + script->constdb_comment(NULL); } /** @@ -21068,6 +21157,7 @@ void script_defaults(void) { script->parse_expr = parse_expr; script->parse_line = parse_line; script->read_constdb = read_constdb; + script->constdb_comment = script_constdb_comment; script->print_line = script_print_line; script->errorwarning_sub = script_errorwarning_sub; script->set_reg = set_reg; |