diff options
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 70 |
1 files changed, 55 insertions, 15 deletions
diff --git a/src/map/script.c b/src/map/script.c index 26072cf66..3b5264de9 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -7407,6 +7407,49 @@ BUILDIN(getguildmasterid) } /*========================================== + * Get the information of the members of a guild by type. + * getguildmember <guild_id>{,<type>}; + * @param guild_id: ID of guild + * @param type: + * 0 : name (default) + * 1 : character ID + * 2 : account ID + *------------------------------------------*/ +BUILDIN(getguildmember) +{ + struct guild *g = NULL; + int j = 0; + + g = guild->search(script_getnum(st,2)); + + if (g) { + int i, type = 0; + + if (script_hasdata(st,3)) + type = script_getnum(st,3); + + for ( i = 0; i < MAX_GUILD; i++ ) { + if ( g->member[i].account_id ) { + switch (type) { + case 2: + mapreg->setreg(reference_uid(script->add_str("$@guildmemberaid"), j),g->member[i].account_id); + break; + case 1: + mapreg->setreg(reference_uid(script->add_str("$@guildmembercid"), j), g->member[i].char_id); + break; + default: + mapreg->setregstr(reference_uid(script->add_str("$@guildmembername$"), j), g->member[i].name); + break; + } + j++; + } + } + } + mapreg->setreg(script->add_str("$@guildmembercount"), j); + return true; +} + +/*========================================== * Get char string information by type : * Return by @type : * 0 : char_name @@ -9029,7 +9072,7 @@ BUILDIN(monster) int class_ = script_getnum(st,6); int amount = script_getnum(st,7); const char *event = ""; - unsigned int size = SZ_MEDIUM; + unsigned int size = SZ_SMALL; unsigned int ai = AI_NONE; int mob_id; @@ -9138,7 +9181,7 @@ BUILDIN(areamonster) { int class_ = script_getnum(st,8); int amount = script_getnum(st,9); const char *event = ""; - unsigned int size = SZ_MEDIUM; + unsigned int size = SZ_SMALL; unsigned int ai = AI_NONE; int mob_id; @@ -10044,14 +10087,9 @@ BUILDIN(hideonnpc) * sc_start <effect_id>,<duration>,<val1>{,<rate>,<flag>,{<unit_id>}}; * sc_start2 <effect_id>,<duration>,<val1>,<val2>{,<rate,<flag>,{<unit_id>}}; * sc_start4 <effect_id>,<duration>,<val1>,<val2>,<val3>,<val4>{,<rate,<flag>,{<unit_id>}}; - * <flag> - * &1: Cannot be avoided (it has to start) - * &2: Tick should not be reduced (by vit, luk, lv, etc) - * &4: sc_data loaded, no value has to be altered. - * &8: rate should not be reduced + * <flag>: @see enum scstart_flag */ -BUILDIN(sc_start) -{ +BUILDIN(sc_start) { TBL_NPC * nd = map->id2nd(st->oid); struct block_list* bl; enum sc_type type; @@ -10070,11 +10108,11 @@ BUILDIN(sc_start) tick = script_getnum(st,3); val1 = script_getnum(st,4); - //If from NPC we make default flag 1 to be unavoidable + //If from NPC we make default flag SCFLAG_NOAVOID to be unavoidable if(nd && nd->bl.id == npc->fake_nd->bl.id) - flag = script_hasdata(st,5+start_type)?script_getnum(st,5+start_type):2; + flag = script_hasdata(st,5+start_type) ? script_getnum(st,5+start_type) : SCFLAG_FIXEDTICK; else - flag = script_hasdata(st,5+start_type)?script_getnum(st,5+start_type):1; + flag = script_hasdata(st,5+start_type) ? script_getnum(st,5+start_type) : SCFLAG_NOAVOID; rate = script_hasdata(st,4+start_type)?min(script_getnum(st,4+start_type),10000):10000; @@ -10177,7 +10215,7 @@ BUILDIN(getscrate) { bl = map->id2bl(st->rid); if (bl) - rate = status->get_sc_def(bl, bl, (sc_type)type, 10000, 10000, 0); + rate = status->get_sc_def(bl, bl, (sc_type)type, 10000, 10000, SCFLAG_NONE); script_pushint(st,rate); return true; @@ -13458,7 +13496,7 @@ BUILDIN(summon) clif->skill_poseffect(&sd->bl,AM_CALLHOMUN,1,sd->bl.x,sd->bl.y,tick); - md = mob->once_spawn_sub(&sd->bl, sd->bl.m, sd->bl.x, sd->bl.y, str, class_, event, SZ_MEDIUM, AI_NONE); + md = mob->once_spawn_sub(&sd->bl, sd->bl.m, sd->bl.x, sd->bl.y, str, class_, event, SZ_SMALL, AI_NONE); if (md) { md->master_id=sd->bl.id; md->special_state.ai = AI_ATTACK; @@ -16020,7 +16058,7 @@ BUILDIN(mercenary_sc_start) { tick = script_getnum(st,3); val1 = script_getnum(st,4); - status->change_start(NULL, &sd->md->bl, type, 10000, val1, 0, 0, 0, tick, 2); + status->change_start(NULL, &sd->md->bl, type, 10000, val1, 0, 0, 0, tick, SCFLAG_FIXEDTICK); return true; } @@ -18800,6 +18838,7 @@ void script_parse_builtin(void) { BUILDIN_DEF(getguildname,"i"), BUILDIN_DEF(getguildmaster,"i"), BUILDIN_DEF(getguildmasterid,"i"), + BUILDIN_DEF(getguildmember,"i?"), BUILDIN_DEF(strcharinfo,"i"), BUILDIN_DEF(strnpcinfo,"i"), BUILDIN_DEF(getequipid,"i"), @@ -19282,6 +19321,7 @@ void script_hardcoded_constants(void) { 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); |