diff options
author | ai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-04-09 09:09:35 +0000 |
---|---|---|
committer | ai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-04-09 09:09:35 +0000 |
commit | 1260d294ed795011b5b73284e308a6a01d9eef9e (patch) | |
tree | 6663a0ae44f8ac7d830598311411843401f129a1 /src/map/script.c | |
parent | 28532995686a5315ddf0ad6557ae00cb2fe76206 (diff) | |
download | hercules-1260d294ed795011b5b73284e308a6a01d9eef9e.tar.gz hercules-1260d294ed795011b5b73284e308a6a01d9eef9e.tar.bz2 hercules-1260d294ed795011b5b73284e308a6a01d9eef9e.tar.xz hercules-1260d294ed795011b5b73284e308a6a01d9eef9e.zip |
* Merged changes from trunk [14742:14782/trunk].
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/renewal@14783 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 85 |
1 files changed, 37 insertions, 48 deletions
diff --git a/src/map/script.c b/src/map/script.c index dec4a3f89..4e874b5f0 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -9268,46 +9268,22 @@ BUILDIN_FUNC(globalmes) /// Creates a waiting room (chat room) for this npc. /// -/// waitingroom "<title>",<limit>,<trigger>,"<event>"; -/// waitingroom "<title>",<limit>,"<event>",<trigger>; -/// waitingroom "<title>",<limit>,"<event>"; -/// waitingroom "<title>",<limit>; +/// waitingroom "<title>",<limit>{,"<event>"{,<trigger>{,<zeny>{,<minlvl>{,<maxlvl>}}}}}; BUILDIN_FUNC(waitingroom) { - struct npc_data* nd; - const char* title; - const char* ev = ""; - int limit; - int trigger = 0; + struct npc_data* nd; int pub = 1; - - title = script_getstr(st, 2); - limit = script_getnum(st, 3); - - if( script_hasdata(st,5) ) - { - struct script_data* last = script_getdata(st, 5); - get_val(st, last); - if( data_isstring(last) ) - {// ,<trigger>,"<event>" - trigger = script_getnum(st, 4); - ev = script_getstr(st, 5); - } - else - {// ,"<event>",<trigger> - ev = script_getstr(st, 4); - trigger = script_getnum(st,5); - } - } - else if( script_hasdata(st,4) ) - {// ,"<event>" - ev = script_getstr(st, 4); - trigger = limit; - } + const char* title = script_getstr(st, 2); + int limit = script_getnum(st, 3); + const char* ev = script_hasdata(st,4) ? script_getstr(st,4) : ""; + int trigger = script_hasdata(st,5) ? script_getnum(st,5) : limit; + int zeny = script_hasdata(st,6) ? script_getnum(st,6) : 0; + int minLvl = script_hasdata(st,7) ? script_getnum(st,7) : 1; + int maxLvl = script_hasdata(st,8) ? script_getnum(st,8) : MAX_LEVEL; nd = (struct npc_data *)map_id2bl(st->oid); if( nd != NULL ) - chat_createnpcchat(nd, title, limit, pub, trigger, ev); + chat_createnpcchat(nd, title, limit, pub, trigger, ev, zeny, minLvl, maxLvl); return 0; } @@ -9471,11 +9447,19 @@ BUILDIN_FUNC(warpwaitingpc) for( i = 0; i < n && cd->users > 0; i++ ) { sd = cd->usersd[0]; - if( sd == NULL ) - { - ShowDebug("script:warpwaitingpc: no user in chat room position 0 (cd->users=%d,%d/%d)\n", cd->users, i, n); - mapreg_setreg(reference_uid(add_str("$@warpwaitingpc"), i), 0); - continue;// Broken npc chat room? + + if( strcmp(map_name,"SavePoint") == 0 && map[sd->bl.m].flag.noteleport ) + {// can't teleport on this map + break; + } + + if( cd->zeny ) + {// fee set + if( (uint32)sd->status.zeny < cd->zeny ) + {// no zeny to cover set fee + break; + } + pc_payzeny(sd, cd->zeny); } mapreg_setreg(reference_uid(add_str("$@warpwaitingpc"), i), sd->bl.id); @@ -9483,12 +9467,7 @@ BUILDIN_FUNC(warpwaitingpc) if( strcmp(map_name,"Random") == 0 ) pc_randomwarp(sd,CLR_TELEPORT); else if( strcmp(map_name,"SavePoint") == 0 ) - { - if( map[sd->bl.m].flag.noteleport ) - return 0;// can't teleport on this map - pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT); - } else pc_setpos(sd, mapindex_name2id(map_name), x, y, CLR_OUTSIGHT); } @@ -11459,7 +11438,15 @@ BUILDIN_FUNC(specialeffect) clif_specialeffect(&nd->bl, type, target); } else - clif_specialeffect(bl, type, target); + { + if (target == SELF) { + TBL_PC *sd=script_rid2sd(st); + if (sd) + clif_specialeffect_single(bl,type,sd->fd); + } else { + clif_specialeffect(bl, type, target); + } + } return 0; } @@ -11792,6 +11779,8 @@ BUILDIN_FUNC(movenpc) if ((nd = npc_name2id(npc)) == NULL) return -1; + if (script_hasdata(st,5)) + nd->ud.dir = script_getnum(st,5); npc_movenpc(nd, x, y); return 0; } @@ -13111,7 +13100,7 @@ BUILDIN_FUNC(checkvending) // check vending [Nab4] sd = script_rid2sd(st); if(sd) - script_pushint(st,(sd->vender_id != 0)); + script_pushint(st,sd->state.vending); else script_pushint(st,0); @@ -15029,7 +15018,7 @@ struct script_function buildin_func[] = { BUILDIN_DEF(skillpointcount,""), BUILDIN_DEF(changebase,"i?"), BUILDIN_DEF(changesex,""), - BUILDIN_DEF(waitingroom,"si??"), + BUILDIN_DEF(waitingroom,"si?????"), BUILDIN_DEF(delwaitingroom,"?"), BUILDIN_DEF2(waitingroomkickall,"kickwaitingroomall","?"), BUILDIN_DEF(enablewaitingroomevent,"?"), @@ -15102,7 +15091,7 @@ struct script_function buildin_func[] = { BUILDIN_DEF(mapwarp,"ssii??"), // Added by RoVeRT BUILDIN_DEF(atcommand,"s"), // [MouseJstr] BUILDIN_DEF(charcommand,"s"), // [MouseJstr] - BUILDIN_DEF(movenpc,"sii"), // [MouseJstr] + BUILDIN_DEF(movenpc,"sii?"), // [MouseJstr] BUILDIN_DEF(message,"ss"), // [MouseJstr] BUILDIN_DEF(npctalk,"s"), // [Valaris] BUILDIN_DEF(mobcount,"ss"), |