viewing paste Unknown #5840 | C

Posted on the
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 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344
Index: src/map/atcommand.c
===================================================================
--- src/map/atcommand.c (revision 17322)
+++ src/map/atcommand.c (working copy)
@@ -3577,174 +3577,130 @@
 /*==========================================
  *
  *------------------------------------------*/
-ACMD_FUNC(reloaditemdb)
+void atcommand_doload();
+ACMD_FUNC(reload)
 {
-       nullpo_retr(-1, sd);
-       itemdb_reload();
-       clif_displaymessage(fd, msg_txt(sd,97)); // Item database has been reloaded.
 
-       return 0;
-}
-
-/*==========================================
- *
- *------------------------------------------*/
-ACMD_FUNC(reloadmobdb)
-{
        nullpo_retr(-1, sd);
-       mob_reload();
-       read_petdb();
-       merc_reload();
-       read_mercenarydb();
-       read_mercenary_skilldb();
-       reload_elementaldb();
-       clif_displaymessage(fd, msg_txt(sd,98)); // Monster database has been reloaded.
 
-       return 0;
-}
-
-/*==========================================
- *
- *------------------------------------------*/
-ACMD_FUNC(reloadskilldb)
-{
-       nullpo_retr(-1, sd);
-       skill_reload();
-       merc_skill_reload();
-       reload_elemental_skilldb();
-       read_mercenary_skilldb();
-       clif_displaymessage(fd, msg_txt(sd,99)); // Skill database has been reloaded.
-
-       return 0;
-}
-
-/*==========================================
- * @reloadatcommand - reloads atcommand_athena.conf groups.conf
- *------------------------------------------*/
-void atcommand_doload();
-ACMD_FUNC(reloadatcommand) {
-       config_t run_test;
-
-       if (conf_read_file(&run_test, "conf/groups.conf")) {
-               clif_displaymessage(fd, msg_txt(sd,1036)); // Error reading groups.conf, reload failed.
+       if (!message || !*message) {
+               clif_displaymessage(fd, msg_txt(sd,1035)); // Enter a database to reload
                return -1;
        }
 
-       config_destroy(&run_test);
+       if (strncmp(message, "itemdb", 4) == 0) {
+               itemdb_reload();
+               clif_displaymessage(fd, msg_txt(sd,97)); // Item database has been reloaded.
+       } else if (strncmp(message, "mobdb", 3) == 0) {
+               mob_reload();
+               read_petdb();
+               merc_reload();
+               read_mercenarydb();
+               read_mercenary_skilldb();
+               reload_elementaldb();
+               clif_displaymessage(fd, msg_txt(sd,98)); // Monster database has been reloaded.
+       } else if (strncmp(message, "skilldb", 4) == 0) {
+               skill_reload();
+               merc_skill_reload();
+               reload_elemental_skilldb();
+               read_mercenary_skilldb();
+               clif_displaymessage(fd, msg_txt(sd,99)); // Skill database has been reloaded.
+       } else if (strncmp(message, "atcommand", 4) == 0) {
+               config_t run_test;
 
-       if (conf_read_file(&run_test, ATCOMMAND_CONF_FILENAME)) {
-               clif_displaymessage(fd, msg_txt(sd,1037)); // Error reading atcommand_athena.conf, reload failed.
-               return -1;
-       }
+               if (conf_read_file(&run_test, "conf/groups.conf")) {
+                       clif_displaymessage(fd, msg_txt(sd,1036)); // Error reading groups.conf, reload failed.
+                       return -1;
+               }
 
-       config_destroy(&run_test);
+               config_destroy(&run_test);
 
-       atcommand_doload();
-       pc_groups_reload();
-       clif_displaymessage(fd, msg_txt(sd,254));
-       return 0;
-}
-/*==========================================
- * @reloadbattleconf - reloads battle_athena.conf
- *------------------------------------------*/
-ACMD_FUNC(reloadbattleconf)
-{
-       struct Battle_Config prev_config;
-       memcpy(&prev_config, &battle_config, sizeof(prev_config));
+               if (conf_read_file(&run_test, ATCOMMAND_CONF_FILENAME)) {
+                       clif_displaymessage(fd, msg_txt(sd,1037)); // Error reading atcommand_athena.conf, reload failed.
+                       return -1;
+               }
 
-       battle_config_read(BATTLE_CONF_FILENAME);
+               config_destroy(&run_test);
 
-       if( prev_config.item_rate_mvp          != battle_config.item_rate_mvp
-       ||  prev_config.item_rate_common       != battle_config.item_rate_common
-       ||  prev_config.item_rate_common_boss  != battle_config.item_rate_common_boss
-       ||  prev_config.item_rate_card         != battle_config.item_rate_card
-       ||  prev_config.item_rate_card_boss    != battle_config.item_rate_card_boss
-       ||  prev_config.item_rate_equip        != battle_config.item_rate_equip
-       ||  prev_config.item_rate_equip_boss   != battle_config.item_rate_equip_boss
-       ||  prev_config.item_rate_heal         != battle_config.item_rate_heal
-       ||  prev_config.item_rate_heal_boss    != battle_config.item_rate_heal_boss
-       ||  prev_config.item_rate_use          != battle_config.item_rate_use
-       ||  prev_config.item_rate_use_boss     != battle_config.item_rate_use_boss
-       ||  prev_config.item_rate_treasure     != battle_config.item_rate_treasure
-       ||  prev_config.item_rate_adddrop      != battle_config.item_rate_adddrop
-       ||  prev_config.logarithmic_drops      != battle_config.logarithmic_drops
-       ||  prev_config.item_drop_common_min   != battle_config.item_drop_common_min
-       ||  prev_config.item_drop_common_max   != battle_config.item_drop_common_max
-       ||  prev_config.item_drop_card_min     != battle_config.item_drop_card_min
-       ||  prev_config.item_drop_card_max     != battle_config.item_drop_card_max
-       ||  prev_config.item_drop_equip_min    != battle_config.item_drop_equip_min
-       ||  prev_config.item_drop_equip_max    != battle_config.item_drop_equip_max
-       ||  prev_config.item_drop_mvp_min      != battle_config.item_drop_mvp_min
-       ||  prev_config.item_drop_mvp_max      != battle_config.item_drop_mvp_max
-       ||  prev_config.item_drop_heal_min     != battle_config.item_drop_heal_min
-       ||  prev_config.item_drop_heal_max     != battle_config.item_drop_heal_max
-       ||  prev_config.item_drop_use_min      != battle_config.item_drop_use_min
-       ||  prev_config.item_drop_use_max      != battle_config.item_drop_use_max
-       ||  prev_config.item_drop_treasure_min != battle_config.item_drop_treasure_min
-       ||  prev_config.item_drop_treasure_max != battle_config.item_drop_treasure_max
-       ||  prev_config.base_exp_rate          != battle_config.base_exp_rate
-       ||  prev_config.job_exp_rate           != battle_config.job_exp_rate
-       )
-       {       // Exp or Drop rates changed.
-               mob_reload(); //Needed as well so rate changes take effect.
-               chrif_ragsrvinfo(battle_config.base_exp_rate, battle_config.job_exp_rate, battle_config.item_rate_common);
-       }
-       clif_displaymessage(fd, msg_txt(sd,255));
-       return 0;
-}
-/*==========================================
- * @reloadstatusdb - reloads job_db1.txt job_db2.txt job_db2-2.txt refine_db.txt size_fix.txt
- *------------------------------------------*/
-ACMD_FUNC(reloadstatusdb)
-{
-       status_readdb();
-       clif_displaymessage(fd, msg_txt(sd,256));
-       return 0;
-}
-/*==========================================
- * @reloadpcdb - reloads exp.txt skill_tree.txt attr_fix.txt statpoint.txt
- *------------------------------------------*/
-ACMD_FUNC(reloadpcdb)
-{
-       pc_readdb();
-       clif_displaymessage(fd, msg_txt(sd,257));
-       return 0;
-}
+               atcommand_doload();
+               pc_groups_reload();
+               clif_displaymessage(fd, msg_txt(sd,254));
+       } else if (strncmp(message, "battleconf", 3) == 0) {
+               struct Battle_Config prev_config;
+               memcpy(&prev_config, &battle_config, sizeof(prev_config));
 
-/*==========================================
- * @reloadmotd - reloads motd.txt
- *------------------------------------------*/
-ACMD_FUNC(reloadmotd)
-{
-       pc_read_motd();
-       clif_displaymessage(fd, msg_txt(sd,268));
-       return 0;
-}
+               battle_config_read(BATTLE_CONF_FILENAME);
 
-/*==========================================
- * @reloadscript - reloads all scripts (npcs, warps, mob spawns, ...)
- *------------------------------------------*/
-ACMD_FUNC(reloadscript)
-{
-       struct s_mapiterator* iter;
-       struct map_session_data* pl_sd;
+               if( prev_config.item_rate_mvp          != battle_config.item_rate_mvp
+               ||  prev_config.item_rate_common       != battle_config.item_rate_common
+               ||  prev_config.item_rate_common_boss  != battle_config.item_rate_common_boss
+               ||  prev_config.item_rate_card         != battle_config.item_rate_card
+               ||  prev_config.item_rate_card_boss    != battle_config.item_rate_card_boss
+               ||  prev_config.item_rate_equip        != battle_config.item_rate_equip
+               ||  prev_config.item_rate_equip_boss   != battle_config.item_rate_equip_boss
+               ||  prev_config.item_rate_heal         != battle_config.item_rate_heal
+               ||  prev_config.item_rate_heal_boss    != battle_config.item_rate_heal_boss
+               ||  prev_config.item_rate_use          != battle_config.item_rate_use
+               ||  prev_config.item_rate_use_boss     != battle_config.item_rate_use_boss
+               ||  prev_config.item_rate_treasure     != battle_config.item_rate_treasure
+               ||  prev_config.item_rate_adddrop      != battle_config.item_rate_adddrop
+               ||  prev_config.logarithmic_drops      != battle_config.logarithmic_drops
+               ||  prev_config.item_drop_common_min   != battle_config.item_drop_common_min
+               ||  prev_config.item_drop_common_max   != battle_config.item_drop_common_max
+               ||  prev_config.item_drop_card_min     != battle_config.item_drop_card_min
+               ||  prev_config.item_drop_card_max     != battle_config.item_drop_card_max
+               ||  prev_config.item_drop_equip_min    != battle_config.item_drop_equip_min
+               ||  prev_config.item_drop_equip_max    != battle_config.item_drop_equip_max
+               ||  prev_config.item_drop_mvp_min      != battle_config.item_drop_mvp_min
+               ||  prev_config.item_drop_mvp_max      != battle_config.item_drop_mvp_max
+               ||  prev_config.item_drop_heal_min     != battle_config.item_drop_heal_min
+               ||  prev_config.item_drop_heal_max     != battle_config.item_drop_heal_max
+               ||  prev_config.item_drop_use_min      != battle_config.item_drop_use_min
+               ||  prev_config.item_drop_use_max      != battle_config.item_drop_use_max
+               ||  prev_config.item_drop_treasure_min != battle_config.item_drop_treasure_min
+               ||  prev_config.item_drop_treasure_max != battle_config.item_drop_treasure_max
+               ||  prev_config.base_exp_rate          != battle_config.base_exp_rate
+               ||  prev_config.job_exp_rate           != battle_config.job_exp_rate
+               )
+               {       // Exp or Drop rates changed.
+                       mob_reload(); //Needed as well so rate changes take effect.
+                       chrif_ragsrvinfo(battle_config.base_exp_rate, battle_config.job_exp_rate, battle_config.item_rate_common);
+               }
+               clif_displaymessage(fd, msg_txt(sd,255));
+       } else if (strncmp(message, "statusdb", 3) == 0) {
+               status_readdb();
+               clif_displaymessage(fd, msg_txt(sd,256));
+       } else if (strncmp(message, "pcdb", 2) == 0) {
+               pc_readdb();
+               clif_displaymessage(fd, msg_txt(sd,257));
+       } else if (strncmp(message, "motd", 4) == 0) {
+               pc_read_motd();
+               clif_displaymessage(fd, msg_txt(sd,268));
+       } else if (strncmp(message, "script", 3) == 0) {
+               struct s_mapiterator* iter;
+               struct map_session_data* pl_sd;
+               //atcommand_broadcast( fd, sd, "@broadcast", "Server is reloading scripts..." );
+               //atcommand_broadcast( fd, sd, "@broadcast", "You will feel a bit of lag at this point !" );
 
-       nullpo_retr(-1, sd);
-       //atcommand_broadcast( fd, sd, "@broadcast", "Server is reloading scripts..." );
-       //atcommand_broadcast( fd, sd, "@broadcast", "You will feel a bit of lag at this point !" );
+               iter = mapit_getallusers();
+               for( pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter) )
+                       pc_close_npc(pl_sd,2);
+               mapit_free(iter);
 
-       iter = mapit_getallusers();
-       for( pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter) )
-               pc_close_npc(pl_sd,2);
-       mapit_free(iter);
+               flush_fifos();
+               map_reloadnpc(true); // reload config files seeking for npcs
+               script_reload();
+               npc_reload();
 
-       flush_fifos();
-       map_reloadnpc(true); // reload config files seeking for npcs
-       script_reload();
-       npc_reload();
+               clif_displaymessage(fd, msg_txt(sd,100)); // Scripts have been reloaded.
+       } else if (strncmp(message, "msgconf", 3) == 0) {
+               map_msg_reload();
+               clif_displaymessage(fd, msg_txt(sd,463)); // Message configuration has been reloaded.
+       } else if (strncmp(message, "questdb", 3) == 0) {
+               do_reload_quest();
+               clif_displaymessage(fd, msg_txt(sd,1377)); // Quest database has been reloaded.
+       }
 
-       clif_displaymessage(fd, msg_txt(sd,100)); // Scripts have been reloaded.
-
        return 0;
 }
 
@@ -8652,11 +8608,6 @@
 
        return 0;
 }
-ACMD_FUNC(reloadquestdb) {
-       do_reload_quest();
-       clif_displaymessage(fd, msg_txt(sd,1377)); // Quest database has been reloaded.
-       return 0;
-}
 ACMD_FUNC(addperm) {
        int perm_size = ARRAYLENGTH(pc_g_permission_name);
        bool add = (strcmpi(command+1, "addperm") == 0) ? true : false;
@@ -8982,13 +8933,6 @@
        return -1;
 }
 
-ACMD_FUNC(reloadmsgconf)
-{
-       map_msg_reload();
-       clif_displaymessage(fd, msg_txt(sd,463)); // Message configuration has been reloaded.
-       return 0;
-}
-
 /**
  * Fills the reference of available commands in atcommand DBMap
  **/
@@ -9088,15 +9032,7 @@
                ACMD_DEF(broadcast), // + /b and /nb
                ACMD_DEF(localbroadcast), // + /lb and /nlb
                ACMD_DEF(recallall),
-               ACMD_DEF(reloaditemdb),
-               ACMD_DEF(reloadmobdb),
-               ACMD_DEF(reloadskilldb),
-               ACMD_DEF(reloadscript),
-               ACMD_DEF(reloadatcommand),
-               ACMD_DEF(reloadbattleconf),
-               ACMD_DEF(reloadstatusdb),
-               ACMD_DEF(reloadpcdb),
-               ACMD_DEF(reloadmotd),
+               ACMD_DEF(reload),
                ACMD_DEF(mapinfo),
                ACMD_DEF(dye),
                ACMD_DEF2("hairstyle", hair_style),
@@ -9239,7 +9175,6 @@
                ACMD_DEF(font),
                ACMD_DEF(accinfo),
                ACMD_DEF(set),
-               ACMD_DEF(reloadquestdb),
                ACMD_DEF(undisguiseguild),
                ACMD_DEF(disguiseguild),
                ACMD_DEF(sizeall),
@@ -9253,7 +9188,6 @@
                ACMD_DEF(channel),
                ACMD_DEF(fontcolor),
                ACMD_DEF(langtype),
-               ACMD_DEF(reloadmsgconf)
        };
        AtCommandInfo* atcommand;
        int i;
Viewed 279 times, submitted by unknown.