diff options
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 181 |
1 files changed, 172 insertions, 9 deletions
diff --git a/src/map/script.c b/src/map/script.c index bd0fbb611..396d084a3 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -5400,6 +5400,9 @@ static int script_load_translation_file(const char *file, uint8 lang_id) if (line[i] == '\\' && line[i+1] == '"') { VECTOR_PUSH(*msg_ptr, '"'); i++; + } else if (line[i] == '\\' && line[i+1] == 'r') { + VECTOR_PUSH(*msg_ptr, '\r'); + i++; } else { VECTOR_PUSH(*msg_ptr, line[i]); } @@ -5418,6 +5421,9 @@ static int script_load_translation_file(const char *file, uint8 lang_id) if (line[i] == '\\' && line[i+1] == '"') { msgctxt[cursor] = '"'; i++; + } else if (line[i] == '\\' && line[i+1] == 'r') { + msgctxt[cursor] = '\r'; + i++; } else { msgctxt[cursor] = line[i]; } @@ -5439,6 +5445,9 @@ static int script_load_translation_file(const char *file, uint8 lang_id) if (line[i] == '\\' && line[i+1] == '"') { VECTOR_PUSH(msgid, '"'); i++; + } else if (line[i] == '\\' && line[i+1] == 'r') { + VECTOR_PUSH(msgid, '\r'); + i++; } else { VECTOR_PUSH(msgid, line[i]); } @@ -5458,6 +5467,9 @@ static int script_load_translation_file(const char *file, uint8 lang_id) if (line[i] == '\\' && line[i+1] == '"') { VECTOR_PUSH(msgstr, '"'); i++; + } else if (line[i] == '\\' && line[i+1] == 'r') { + VECTOR_PUSH(msgstr, '\r'); + i++; } else { VECTOR_PUSH(msgstr, line[i]); } @@ -8981,6 +8993,93 @@ static BUILDIN(getpartyleader) return true; } +enum guildinfo_type { + GUILDINFO_NAME, + GUILDINFO_ID, + GUILDINFO_LEVEL, + GUILDINFO_ONLINE, + GUILDINFO_AV_LEVEL, + GUILDINFO_MAX_MEMBERS, + GUILDINFO_EXP, + GUILDINFO_NEXT_EXP, + GUILDINFO_SKILL_POINTS, + GUILDINFO_MASTER_NAME, + GUILDINFO_MASTER_CID, +}; + +static BUILDIN(getguildinfo) +{ + struct guild *g = NULL; + + if (script_hasdata(st, 3)) { + if (script_isstringtype(st, 3)) { + const char *guild_name = script_getstr(st, 3); + g = guild->searchname(guild_name); + } else { + int guild_id = script_getnum(st, 3); + g = guild->search(guild_id); + } + } else { + struct map_session_data *sd = script->rid2sd(st); + g = sd ? sd->guild : NULL; + } + + enum guildinfo_type type = script_getnum(st, 2); + + if (g == NULL) { + // guild does not exist + switch (type) { + case GUILDINFO_NAME: + case GUILDINFO_MASTER_NAME: + script_pushconststr(st, ""); + break; + default: + script_pushint(st, -1); + } + } else { + switch (type) { + case GUILDINFO_NAME: + script_pushstrcopy(st, g->name); + break; + case GUILDINFO_ID: + script_pushint(st, g->guild_id); + break; + case GUILDINFO_LEVEL: + script_pushint(st, g->guild_lv); + break; + case GUILDINFO_ONLINE: + script_pushint(st, g->connect_member); + break; + case GUILDINFO_AV_LEVEL: + script_pushint(st, g->average_lv); + break; + case GUILDINFO_MAX_MEMBERS: + script_pushint(st, g->max_member); + break; + case GUILDINFO_EXP: + script_pushint(st, g->exp); + break; + case GUILDINFO_NEXT_EXP: + script_pushint(st, g->next_exp); + break; + case GUILDINFO_SKILL_POINTS: + script_pushint(st, g->skill_point); + break; + case GUILDINFO_MASTER_NAME: + script_pushstrcopy(st, g->member[0].name); + break; + case GUILDINFO_MASTER_CID: + script_pushint(st, g->member[0].char_id); + break; + default: + ShowError("script:getguildinfo: unknown info type!\n"); + st->state = END; + return false; + } + } + return true; +} + /*========================================== * Return the name of the @guild_id * null if not found @@ -15716,6 +15815,56 @@ static BUILDIN(specialeffect) return true; } +/*========================================== + * Special effects with num [4144] + *------------------------------------------*/ +static BUILDIN(specialeffectnum) +{ + struct block_list *bl = NULL; + int type = script_getnum(st, 2); + int num = script_getnum(st, 3); + int num2 = script_getnum(st, 4); + enum send_target target = AREA; + + if (script_hasdata(st, 5)) { + target = script_getnum(st, 5); + } + + if (script_hasdata(st, 6)) { + if (script_isstringtype(st, 6)) { + struct npc_data *nd = npc->name2id(script_getstr(st, 6)); + if (nd != NULL) { + bl = &nd->bl; + } + } else { + bl = map->id2bl(script_getnum(st, 6)); + } + } else { + bl = map->id2bl(st->oid); + } + + if (bl == NULL) { + return true; + } + + uint64 bigNum = ((uint64)num2) * 0xffffffff + num; + if (target == SELF) { + struct map_session_data *sd; + if (script_hasdata(st, 7)) { + sd = map->id2sd(script_getnum(st, 7)); + } else { + sd = script->rid2sd(st); + } + if (sd != NULL) { + clif->specialeffect_value_single(bl, type, bigNum, sd->fd); + } + } else { + clif->specialeffect_value(bl, type, bigNum, target); + } + + return true; +} + static BUILDIN(specialeffect2) { struct map_session_data *sd; @@ -15925,7 +16074,7 @@ static BUILDIN(recovery) return true; } -/* +/* * Get your current pet information */ static BUILDIN(getpetinfo) @@ -15978,7 +16127,7 @@ static BUILDIN(getpetinfo) case PETINFO_ACCESSORYFLAG: script_pushint(st, (pd->pet.equip != 0)? 1:0); break; - case PETINFO_EVO_EGGID: + case PETINFO_EVO_EGGID: if (VECTOR_DATA(pd->petDB->evolve_data) != NULL) script_pushint(st, VECTOR_DATA(pd->petDB->evolve_data)->petEggId); else @@ -24902,7 +25051,7 @@ static BUILDIN(showscript) if (script_hasdata(st, 4)) if (script_getnum(st, 4) == SELF) flag = SELF; - + clif->ShowScript(bl, msg, flag); return true; } @@ -25462,7 +25611,7 @@ static BUILDIN(clan_master) } nd->clan_id = clan_id; - clif->sc_load(&nd->bl, nd->bl.id, AREA, status->dbs->IconChangeTable[SC_CLAN_INFO], 0, clan_id, 0); + clif->sc_load(&nd->bl, nd->bl.id, AREA, status->get_sc_icon(SC_CLAN_INFO), 0, clan_id, 0); script_pushint(st, true); return true; @@ -25787,7 +25936,7 @@ static BUILDIN(identifyidx) script_pushint(st, false); return true; } - + if (sd->status.inventory[idx].nameid <= 0 || sd->status.inventory[idx].identify != 0) { script_pushint(st, false); return true; @@ -26089,10 +26238,11 @@ static void script_parse_builtin(void) BUILDIN_DEF(getpartyname,"i"), BUILDIN_DEF(getpartymember,"i?"), BUILDIN_DEF(getpartyleader,"i?"), - BUILDIN_DEF(getguildname,"i"), - BUILDIN_DEF(getguildmaster,"i"), - BUILDIN_DEF(getguildmasterid,"i"), + BUILDIN_DEF_DEPRECATED(getguildname,"i"), + BUILDIN_DEF_DEPRECATED(getguildmaster,"i"), + BUILDIN_DEF_DEPRECATED(getguildmasterid,"i"), BUILDIN_DEF(getguildmember,"i?"), + BUILDIN_DEF(getguildinfo,"i?"), BUILDIN_DEF(getguildonline, "i?"), BUILDIN_DEF(strcharinfo,"i??"), BUILDIN_DEF(strnpcinfo,"i??"), @@ -26269,6 +26419,7 @@ static void script_parse_builtin(void) BUILDIN_DEF(skilleffect,"vi"), // skill effect [Celest] BUILDIN_DEF(npcskilleffect,"viii"), // npc skill effect [Valaris] BUILDIN_DEF(specialeffect,"i???"), // npc skill effect [Valaris] + BUILDIN_DEF(specialeffectnum,"iii???"), // npc skill effect with num [4144] BUILDIN_DEF(removespecialeffect,"i???"), BUILDIN_DEF_DEPRECATED(specialeffect2,"i??"), // skill effect on players[Valaris] BUILDIN_DEF(nude,""), // nude command [Valaris] @@ -27208,6 +27359,19 @@ static void script_hardcoded_constants(void) script->set_constant("SIEGE_TYPE_SE", SIEGE_TYPE_SE, false, false); script->set_constant("SIEGE_TYPE_TE", SIEGE_TYPE_TE, false, false); + script->constdb_comment("guildinfo types"); + script->set_constant("GUILDINFO_NAME", GUILDINFO_NAME, false, false); + script->set_constant("GUILDINFO_ID", GUILDINFO_ID, false, false); + script->set_constant("GUILDINFO_LEVEL", GUILDINFO_LEVEL, false, false); + script->set_constant("GUILDINFO_ONLINE", GUILDINFO_ONLINE, false, false); + script->set_constant("GUILDINFO_AV_LEVEL", GUILDINFO_AV_LEVEL, false, false); + script->set_constant("GUILDINFO_MAX_MEMBERS", GUILDINFO_MAX_MEMBERS, false, false); + script->set_constant("GUILDINFO_EXP", GUILDINFO_EXP, false, false); + script->set_constant("GUILDINFO_NEXT_EXP", GUILDINFO_NEXT_EXP, false, false); + script->set_constant("GUILDINFO_SKILL_POINTS", GUILDINFO_SKILL_POINTS, false, false); + script->set_constant("GUILDINFO_MASTER_NAME", GUILDINFO_MASTER_NAME, false, false); + script->set_constant("GUILDINFO_MASTER_CID", GUILDINFO_MASTER_CID, false, false); + script->constdb_comment("Renewal"); #ifdef RENEWAL script->set_constant("RENEWAL", 1, false, false); @@ -27245,7 +27409,6 @@ static void script_hardcoded_constants(void) script->set_constant("RENEWAL_ASPD", 0, false, false); #endif script->constdb_comment(NULL); -#include "constants.inc" } /** |