viewing paste topic/4455- maxbaspd | Diff

Posted on the | Last edited on
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
 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 ) {
 
Viewed 1588 times, submitted by AnnieRuru.