diff options
-rw-r--r-- | db/pre-re/job_db.conf | 1 | ||||
-rw-r--r-- | doc/script_commands.txt | 14 | ||||
-rw-r--r-- | src/map/pc.c | 1 | ||||
-rw-r--r-- | src/map/script.c | 116 | ||||
-rw-r--r-- | src/map/unit.c | 9 |
5 files changed, 86 insertions, 55 deletions
diff --git a/db/pre-re/job_db.conf b/db/pre-re/job_db.conf index 5f5131726..74a765fbf 100644 --- a/db/pre-re/job_db.conf +++ b/db/pre-re/job_db.conf @@ -335,6 +335,7 @@ Priest: { Mace: 600 TwoHandMace: 600 Rod: 600 + // Knuckle: 500 /* Note. Official value is 2000 (default). To normalize aspd remove comment to this line. */ Book: 600 TwoHandRod: 600 } diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 6df1f6e87..b202f1b6b 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -4321,7 +4321,7 @@ Example: --------------------------------------- -*warpguild("<mapname>", <x>, <y>, <guild_id>) +*warpguild("<mapname>", <x>, <y>, <guild_id>, {"<from_mapname>"}) Warps a guild to specified map and coordinate given the guild id, which you can get with getcharid(CHAR_ID_GUILD). You can also request another guild id given @@ -4335,9 +4335,12 @@ SavePoint: All guild members are warped to the save point of the currently attached player (will fail if there's no player attached). +If you specify a from_mapname, warpguild() will only affect those on that map. + Example: warpguild("prontera", x, y, Guild_ID); + warpguild("prontera", x, y, Guild_ID, "payon"); // warp member from Payon map only. --------------------------------------- @@ -6475,15 +6478,16 @@ Size is 0 = normal 1 = small 2 = big. //===================================== --------------------------------------- -*addtimer(<ticks>, "NPC::OnLabel") -*deltimer("NPC::OnLabel") -*addtimercount("NPC::OnLabel", <ticks>) +*addtimer(<ticks>, "NPC::OnLabel"{, <account id>}) +*deltimer("NPC::OnLabel"{, <account id>}) +*addtimercount("NPC::OnLabel", <ticks>{, <account id>}) These commands will create, destroy, and delay a countdown timer - addtimer() to create, deltimer() to destroy and addtimercount() to delay it by the specified number of ticks. For all three cases, the event label given is the identifier of that timer. The timer runs on the character -object that is attached to the script, and can have multiple instances. +object that is attached to the script, and can have multiple instances. +If <acccount id> is passed, this player will be used instead. When the label is run, it is run as if the player that the timer runs on has clicked the NPC. diff --git a/src/map/pc.c b/src/map/pc.c index 2cf5d75b4..9ef7d084f 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -387,7 +387,6 @@ int pc_banding(struct map_session_data *sd, uint16 skill_lv) { return c; } -// Increases a player's fame points and displays a notice to him /** * Increases a player's fame points and displays a notice to them. * diff --git a/src/map/script.c b/src/map/script.c index a7e27fc1b..48c377d24 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -6672,61 +6672,67 @@ BUILDIN(warpparty) } /*========================================== * Warpguild - [Fredzilla] - * Syntax: warpguild "mapname",x,y,Guild_ID; + * Syntax: warpguild "mapname",x,y,Guild_ID,{"from_mapname"}; *------------------------------------------*/ BUILDIN(warpguild) { struct map_session_data *sd = NULL; - struct map_session_data *pl_sd; struct guild* g; - struct s_mapiterator* iter; int type; + int i; + int16 map_id = -1; - const char* str = script_getstr(st,2); - int x = script_getnum(st,3); - int y = script_getnum(st,4); - int gid = script_getnum(st,5); + const char *str = script_getstr(st, 2); + int x = script_getnum(st, 3); + int y = script_getnum(st, 4); + int gid = script_getnum(st, 5); + + if (script_hasdata(st, 6)) { + map_id = map->mapname2mapid(script_getstr(st, 6)); + } g = guild->search(gid); - if( g == NULL ) + if (g == NULL) return true; - type = ( strcmp(str,"Random")==0 ) ? 0 - : ( strcmp(str,"SavePointAll")==0 ) ? 1 - : ( strcmp(str,"SavePoint")==0 ) ? 2 + type = (strcmp(str, "Random") == 0) ? 0 + : (strcmp(str, "SavePointAll") == 0) ? 1 + : (strcmp(str, "SavePoint") == 0) ? 2 : 3; - if( type == 2 && ( sd = script->rid2sd(st) ) == NULL ) + if (type == 2 && (sd = script->rid2sd(st)) == NULL) {// "SavePoint" uses save point of the currently attached player return true; } - iter = mapit_getallusers(); - for (pl_sd = BL_UCAST(BL_PC, mapit->first(iter)); mapit->exists(iter); pl_sd = BL_UCAST(BL_PC, mapit->next(iter))) { - if( pl_sd->status.guild_id != gid ) - continue; + for (i = 0; i < MAX_GUILD; i++) { + if (g->member[i].online && g->member[i].sd != NULL) { + struct map_session_data *pl_sd = g->member[i].sd; - switch( type ) - { + if (map_id >= 0 && map_id != pl_sd->bl.m) + continue; + + switch (type) + { case 0: // Random - if(!map->list[pl_sd->bl.m].flag.nowarp) - pc->randomwarp(pl_sd,CLR_TELEPORT); + if (!map->list[pl_sd->bl.m].flag.nowarp) + pc->randomwarp(pl_sd, CLR_TELEPORT); break; case 1: // SavePointAll - if(!map->list[pl_sd->bl.m].flag.noreturn) - pc->setpos(pl_sd,pl_sd->status.save_point.map,pl_sd->status.save_point.x,pl_sd->status.save_point.y,CLR_TELEPORT); + if (!map->list[pl_sd->bl.m].flag.noreturn) + pc->setpos(pl_sd, pl_sd->status.save_point.map, pl_sd->status.save_point.x, pl_sd->status.save_point.y, CLR_TELEPORT); break; case 2: // SavePoint - if(!map->list[pl_sd->bl.m].flag.noreturn) - pc->setpos(pl_sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT); + if (!map->list[pl_sd->bl.m].flag.noreturn) + pc->setpos(pl_sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT); break; case 3: // m,x,y - if(!map->list[pl_sd->bl.m].flag.noreturn && !map->list[pl_sd->bl.m].flag.nowarp) - pc->setpos(pl_sd,script->mapindexname2id(st,str),x,y,CLR_TELEPORT); + if (!map->list[pl_sd->bl.m].flag.noreturn && !map->list[pl_sd->bl.m].flag.nowarp) + pc->setpos(pl_sd, script->mapindexname2id(st, str), x, y, CLR_TELEPORT); break; + } } } - mapit->free(iter); return true; } @@ -10785,19 +10791,29 @@ BUILDIN(donpcevent) *------------------------------------------*/ BUILDIN(addtimer) { - int tick = script_getnum(st,2); + int tick = script_getnum(st, 2); const char* event = script_getstr(st, 3); struct map_session_data *sd; script->check_event(st, event); - sd = script->rid2sd(st); - if( sd == NULL ) - return true; - if (!pc->addeventtimer(sd,tick,event)) { - ShowWarning("buildin_addtimer: Event timer is full, can't add new event timer. (cid:%d timer:%s)\n",sd->status.char_id,event); + if (script_hasdata(st, 4)) + sd = map->id2sd(script_getnum(st, 4)); + else + sd = script->rid2sd(st); + + if (sd == NULL) { + script_pushint(st, 0); return false; } + + if (!pc->addeventtimer(sd, tick, event)) { + ShowWarning("script:addtimer: Event timer is full, can't add new event timer. (cid:%d timer:%s)\n", sd->status.char_id, event); + script_pushint(st, 0); + return false; + } + + script_pushint(st, 1); return true; } /*========================================== @@ -10808,12 +10824,17 @@ BUILDIN(deltimer) struct map_session_data *sd; event=script_getstr(st, 2); - sd = script->rid2sd(st); - if( sd == NULL ) + + if (script_hasdata(st, 3)) + sd = map->id2sd(script_getnum(st, 3)); + else + sd = script->rid2sd(st); + + if (sd == NULL) return true; script->check_event(st, event); - pc->deleventtimer(sd,event); + pc->deleventtimer(sd, event); return true; } /*========================================== @@ -10824,14 +10845,19 @@ BUILDIN(addtimercount) int tick; struct map_session_data *sd; - event=script_getstr(st, 2); - tick=script_getnum(st,3); - sd = script->rid2sd(st); - if( sd == NULL ) + event = script_getstr(st, 2); + tick = script_getnum(st, 3); + + if (script_hasdata(st, 4)) + sd = map->id2sd(script_getnum(st, 4)); + else + sd = script->rid2sd(st); + + if (sd == NULL) return true; script->check_event(st, event); - pc->addeventtimercount(sd,event,tick); + pc->addeventtimercount(sd, event, tick); return true; } @@ -20981,7 +21007,7 @@ void script_parse_builtin(void) { BUILDIN_DEF(areawarp,"siiiisii??"), BUILDIN_DEF(warpchar,"siii"), // [LuzZza] BUILDIN_DEF(warpparty,"siii?"), // [Fredzilla] [Paradox924X] - BUILDIN_DEF(warpguild,"siii"), // [Fredzilla] + BUILDIN_DEF(warpguild,"siii?"), // [Fredzilla] BUILDIN_DEF(setlook,"ii"), BUILDIN_DEF(changelook,"ii"), // Simulates but don't Store it BUILDIN_DEF2(__setr,"set","rv"), @@ -21086,9 +21112,9 @@ void script_parse_builtin(void) { BUILDIN_DEF(clone,"siisi????"), BUILDIN_DEF(doevent,"s"), BUILDIN_DEF(donpcevent,"s"), - BUILDIN_DEF(addtimer,"is"), - BUILDIN_DEF(deltimer,"s"), - BUILDIN_DEF(addtimercount,"si"), + BUILDIN_DEF(addtimer,"is?"), + BUILDIN_DEF(deltimer,"s?"), + BUILDIN_DEF(addtimercount,"si?"), BUILDIN_DEF(initnpctimer,"??"), BUILDIN_DEF(stopnpctimer,"??"), BUILDIN_DEF(startnpctimer,"??"), diff --git a/src/map/unit.c b/src/map/unit.c index feb11f89e..7d68bef66 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -668,11 +668,12 @@ void unit_run_hit(struct block_list *bl, struct status_change *sc, struct map_se ud->state.running = 0; status_change_end(bl, type, INVALID_TIMER); - if( type == SC_RUN ) { - skill->blown(bl,bl,skill->get_blewcount(TK_RUN,lv),unit->getdir(bl),0); + if (type == SC_RUN) { + if (lv > 0) + skill->blown(bl, bl, skill->get_blewcount(TK_RUN, lv), unit->getdir(bl), 0); clif->fixpos(bl); //Why is a clif->slide (skill->blown) AND a fixpos needed? Ask Aegis. - clif->sc_end(bl,bl->id,AREA,SI_TING); - } else if( sd ) { + clif->sc_end(bl, bl->id, AREA, SI_TING); + } else if (sd) { clif->fixpos(bl); skill->castend_damage_id(bl, &sd->bl, RA_WUGDASH, lv, timer->gettick(), SD_LEVEL); } |