db/const.txt | 1 +
src/map/map.c | 1 +
src/map/map.h | 1 +
src/map/npc.c | 11 +++++++++++
src/map/script.c | 18 ++++++++++++++++++
src/map/script.h | 3 ++-
src/map/status.c | 5 ++++-
7 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/db/const.txt b/db/const.txt
index 577fbc2..72daca6 100644
--- a/db/const.txt
+++ b/db/const.txt
@@ -367,6 +367,7 @@ mf_battleground 51
mf_reset 52
mf_notomb 53
mf_nocashshop 54
+mf_maxbaspd 55
cell_walkable 0
cell_shootable 1
diff --git a/src/map/map.c b/src/map/map.c
index 96595ca..4845be7 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -3141,6 +3141,7 @@ void map_flags_init(void) {
map->list[i].nocommand = 0; // nocommand mapflag level
map->list[i].bexp = 100; // per map base exp multiplicator
map->list[i].jexp = 100; // per map job exp multiplicator
+ map->list[i].maxbaspd = 0;
if( map->list[i].drop_list != NULL )
aFree(map->list[i].drop_list);
map->list[i].drop_list = NULL;
diff --git a/src/map/map.h b/src/map/map.h
index a4e9499..f2f6113 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -661,6 +661,7 @@ struct map_data {
int jexp; // map experience multiplicator
int bexp; // map experience multiplicator
int nocommand; //Blocks @/# commands for non-gms. [Skotlex]
+ int maxbaspd;
/**
* Ice wall reference counter for bugreport:3574
* - since there are a thounsand mobs out there in a lot of maps checking on,
diff --git a/src/map/npc.c b/src/map/npc.c
index 36efc72..bf6e537 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -3913,6 +3913,17 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char
map->list[m].flag.src4instance = (state) ? 1 : 0;
} else if ( !strcmpi(w3,"nocashshop") ) {
map->list[m].flag.nocashshop = (state) ? 1 : 0;
+ } else if ( !strcmpi(w3,"maxbaspd") ) {
+ int maxbaspd = atoi(w4);
+ if ( maxbaspd > 0 ) {
+ if ( maxbaspd < 85 )
+ maxbaspd = 85;
+ else if ( maxbaspd > 199 )
+ maxbaspd = 199;
+ map->list[m].maxbaspd = 2000 - maxbaspd *10;
+ }
+ else
+ ShowWarning( "npc_parse_mapflag: Missing 4th param for 'maxbaspd' flag ! removing flag from %s in file '%s', line '%d'.\n", map->list[m].name, filepath, strline(buffer,start-buffer) );
} else
ShowError("npc_parse_mapflag: unrecognized mapflag '%s' in file '%s', line '%d'.\n", w3, filepath, strline(buffer,start-buffer));
diff --git a/src/map/script.c b/src/map/script.c
index be346cb..67c2afa 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -10756,6 +10756,12 @@ void script_detach_rid(struct script_state* st) {
case MF_RESET: script_pushint(st,map->list[m].flag.reset); break;
case MF_NOTOMB: script_pushint(st,map->list[m].flag.notomb); break;
case MF_NOCASHSHOP: script_pushint(st,map->list[m].flag.nocashshop); break;
+ case MF_MAXBASPD:
+ if ( map->list[m].maxbaspd > 0 )
+ script_pushint(st, 200 - ( map->list[m].maxbaspd / 10 ) );
+ else
+ script_pushint(st,0);
+ break;
}
}
@@ -10872,6 +10878,17 @@ int script_mapflag_pvp_sub(struct block_list *bl,va_list ap) {
case MF_RESET: map->list[m].flag.reset = 1; break;
case MF_NOTOMB: map->list[m].flag.notomb = 1; break;
case MF_NOCASHSHOP: map->list[m].flag.nocashshop = 1; break;
+ case MF_MAXBASPD:
+ if ( val <= 0 ) {
+ ShowError( "buildin_setmapflag: missing data type for argument 3 for 'maxbaspd'.\n");
+ return false;
+ }
+ else if ( val < 85 )
+ val = 85;
+ else if ( val > 199 )
+ val = 199;
+ map->list[m].maxbaspd = 2000 - val *10;
+ break;
}
}
@@ -10958,6 +10975,7 @@ int script_mapflag_pvp_sub(struct block_list *bl,va_list ap) {
case MF_RESET: map->list[m].flag.reset = 0; break;
case MF_NOTOMB: map->list[m].flag.notomb = 0; break;
case MF_NOCASHSHOP: map->list[m].flag.nocashshop = 0; break;
+ case MF_MAXBASPD: map->list[m].maxbaspd = 0; break;
}
}
diff --git a/src/map/script.h b/src/map/script.h
index 3835a13..30f39fe 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -304,7 +304,8 @@ enum {
MF_BATTLEGROUND,
MF_RESET,
MF_NOTOMB,
- MF_NOCASHSHOP
+ MF_NOCASHSHOP,
+ MF_MAXBASPD
};
/**
diff --git a/src/map/status.c b/src/map/status.c
index df79cee..7713dbc 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -3837,7 +3837,10 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) {
amotion = ( 200 - (200-amotion/10) * st->aspd_rate / 1000 ) * 10;
#endif
amotion = status->calc_fix_aspd(bl, sc, amotion);
- st->amotion = cap_value(amotion,((sd->class_&JOBL_THIRD) ? battle_config.max_third_aspd : battle_config.max_aspd),2000);
+ if ( map->list[sd->bl.m].maxbaspd > 0 )
+ st->amotion = cap_value(amotion, map->list[sd->bl.m].maxbaspd, 2000);
+ else
+ st->amotion = cap_value(amotion,((sd->class_&JOBL_THIRD) ? battle_config.max_third_aspd : battle_config.max_aspd),2000);
st->adelay = 2*st->amotion;
} else if( bl->type&BL_HOM ) {