diff options
author | shennetsind <ind@henn.et> | 2013-02-14 21:12:18 -0200 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2013-02-14 21:12:18 -0200 |
commit | 7d33212f95653edd621961487f5622611d62ae88 (patch) | |
tree | b992a814eeefc27de512231c5bf5eaf0c2efa111 /src/map/npc.c | |
parent | 82005a99f5b1cca68e9fb1ac6b1614c815e4bd45 (diff) | |
download | hercules-7d33212f95653edd621961487f5622611d62ae88.tar.gz hercules-7d33212f95653edd621961487f5622611d62ae88.tar.bz2 hercules-7d33212f95653edd621961487f5622611d62ae88.tar.xz hercules-7d33212f95653edd621961487f5622611d62ae88.zip |
New Mapflag adjust_unit_duration
Made as a improvement of the original ADJUST_TRAP_DURATION -- special thanks to Muad_Dib! .
This mapflag allows you to control the duration of unit skills in any map, for example.
"prontera mapflag adjust_unit_duration PR_SANCTUARY 50"
halves the duration of sanctuary in prontera
Another Example:
"prontera mapflag adjust_unit_duration WZ_QUAGMIRE 250"
Increases duration of quagmire by 2.5 times in prontera map.
Be aware that some skill units have their visual effect durations not controlled by the server (e.g. storm gust).
Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map/npc.c')
-rw-r--r-- | src/map/npc.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/map/npc.c b/src/map/npc.c index ba476e810..265fbb01f 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -3398,7 +3398,26 @@ static const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, con map[m].flag.guildlock=state; else if (!strcmpi(w3,"reset")) map[m].flag.reset=state; - else + else if (!strcmpi(w3,"adjust_unit_duration")) { + char *mod; + int skill_id; + + strtok(w4,"\t");/* makes w4 contain only 4th param */ + + if( !(mod = strtok(NULL,"\t")) ) {/* makes mod contain only the 5th param */ + ShowWarning("npc_parse_mapflag: Missing 5th param for 'adjust_unit_duration' flag! removing flag from %s (file '%s', line '%d').\n", map[m].name, filepath, strline(buffer,start-buffer)); + } else if( !( skill_id = skill_name2id(w4) ) || !skill_get_unit_id( skill_name2id(w4), 0) ) { + ShowWarning("npc_parse_mapflag: Unknown skill (%s) for 'adjust_unit_duration' flag! removing flag from %s (file '%s', line '%d').\n", w4, map[m].name, filepath, strline(buffer,start-buffer)); + } else if ( atoi(mod) < 1 || atoi(mod) > USHRT_MAX ) { + ShowWarning("npc_parse_mapflag: Invalid modifier '%d' for skill '%s' for 'adjust_unit_duration' flag! removing flag from %s (file '%s', line '%d').\n", atoi(mod), w4, map[m].name, filepath, strline(buffer,start-buffer)); + } else { + int idx = map[m].unit_count; + RECREATE(map[m].units, struct adjust_unit_duration*, ++map[m].unit_count); + CREATE(map[m].units[idx],struct adjust_unit_duration,1); + map[m].units[idx]->skill_id = skill_id; + map[m].units[idx]->modifier = (unsigned short)atoi(mod); + } + } else ShowError("npc_parse_mapflag: unrecognized mapflag '%s' (file '%s', line '%d').\n", w3, filepath, strline(buffer,start-buffer)); return strchr(start,'\n');// continue |