viewing paste Unknown #5852 | Diff

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 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409
Index: src/config/core.h
===================================================================
--- src/config/core.h   (revision 17325)
+++ src/config/core.h   (working copy)
@@ -29,7 +29,7 @@
 
 /// Uncomment to disable rAthena's anonymous stat report
 /// We kindly ask you to consider keeping it enabled, it helps us improve rAthena.
-//#define STATS_OPT_OUT
+#define STATS_OPT_OUT
 
 /// uncomment to enable query_sql script command and mysql logs to function on it's own thread
 /// be aware this feature is under tests and you should use at your own risk, we however
Index: src/login/login.c
===================================================================
--- src/login/login.c   (revision 17325)
+++ src/login/login.c   (working copy)
@@ -13,6 +13,7 @@
 #include "../common/msg_conf.h"
 #include "../common/cli.h"
 #include "../common/ers.h"
+#include "../common/conf.h"
 #include "account.h"
 #include "ipban.h"
 #include "login.h"
@@ -1949,6 +1950,7 @@
        add_timer_interval(gettick()+1000, parse_console_timer, 0, 0, 1000); //start in 1s each 1sec
    }
 
+   ShowDebug("Inter_Config.vip_sys : \n\tenable = %d\n\tgroudid=%d\n",Inter_Config.vip_sys.enable,Inter_Config.vip_sys.group);
    return 0;
 }
 
Index: src/login/account_sql.c
===================================================================
--- src/login/account_sql.c (revision 17325)
+++ src/login/account_sql.c (working copy)
@@ -7,6 +7,7 @@
 #include "../common/sql.h"
 #include "../common/strlib.h"
 #include "../common/timer.h"
+#include "../common/conf.h" //Inter_config
 #include "account.h"
 #include <stdlib.h>
 #include <string.h>
@@ -520,6 +521,28 @@
    char* data;
    int i = 0;
 
+   if( Inter_Config.vip_sys.enable ) {
+       // Check for VIP time and set if date has not been reached.
+       if( SQL_SUCCESS == Sql_Query(sql_handle,
+           "UPDATE `%s` SET `group_id` = %d WHERE `group_id`< %d and `account_id` = %d AND `vip_time` >= NOW()",
+           db->account_db, Inter_Config.vip_sys.group,Inter_Config.vip_sys.group,account_id) //only update if group_id lower
+       ) {
+           // Add premium character slots.
+           Sql_Query(sql_handle, "UPDATE `%s` SET `character_slots` = %d WHERE `character_slots`< %d `account_id` = '%d'", db->account_db, Inter_Config.vip_sys.char_increase,Inter_Config.vip_sys.char_increase,account_id);
+       }
+
+       // Check for VIP time and remove if date has been passed.
+       else if( SQL_SUCCESS == Sql_Query(sql_handle,
+           "UPDATE `%s` SET `group_id` = 0 WHERE `account_id` = %d AND `vip_time` != '0000-00-00 00:00:00' AND `vip_time` < NOW()",
+           db->account_db, account_id ) //@TODO return to previous group_id instead 0 ?
+       ) {
+           // Remove premium character slots.
+           // Setting to 0 will cause the char_server to force it to server default (char_athena.conf -> chars_per_account).
+           // Characters won't be deleted, they just won't be accessible.
+           Sql_Query(sql_handle, "UPDATE `%s` SET `character_slots` = 0 WHERE `account_id` = '%d'", db->account_db, account_id );
+       }
+   }
+
    // retrieve login entry for the specified account
    if( SQL_ERROR == Sql_Query(sql_handle,
        "SELECT `account_id`,`userid`,`user_pass`,`sex`,`email`,`group_id`,`state`,`unban_time`,`expiration_time`,`logincount`,`lastlogin`,`last_ip`,`birthdate`,`character_slots`,`pincode`, `pincode_change` FROM `%s` WHERE `account_id` = %d",
Index: src/map/pc.c
===================================================================
--- src/map/pc.c    (revision 17325)
+++ src/map/pc.c    (working copy)
@@ -12,6 +12,7 @@
 #include "../common/timer.h"
 #include "../common/utils.h"
 #include "../common/mmo.h" //NAME_LENGTH
+#include "../common/conf.h" //Inter_config
 
 #include "atcommand.h" // get_atcommand_level()
 #include "battle.h" // battle_config
@@ -38,6 +39,7 @@
 #include "script.h" // script_config
 #include "skill.h"
 #include "status.h" // struct status_data
+#include "storage.h"
 #include "pc.h"
 #include "pc_groups.h"
 #include "quest.h"
@@ -1159,6 +1161,10 @@
        sd->mission_count = pc_readglobalreg(sd,"TK_MISSION_COUNT");
    }
 
+   // Magic Stone requirement avoidance for VIP.
+   if(Inter_Config.vip_sys.magic_stone && pc_get_vip(sd))
+       sd->special_state.no_gemstone = 2;
+
    //SG map and mob read [Komurka]
    for(i=0;i<MAX_PC_FEELHATE;i++) //for now - someone need to make reading from txt/sql
    {
@@ -1219,6 +1225,8 @@
    if (!chrif_auth_finished(sd))
        ShowError("pc_reg_received: Failed to properly remove player %d:%d from logging db!\n", sd->status.account_id, sd->status.char_id);
 
+   pc_check_available_item(sd); // Check for invalid(ated) items in inventory/cart/storage.
+
    pc_load_combo(sd);
 
    status_calc_pc(sd,1);
@@ -1668,7 +1676,7 @@
        return 0;
 
    if(sd->sc.option&OPTION_INVISIBLE)
-   {   //Character is invisible. Stealth class-change. [Skotlex]
+   {   //Character is invisible. Stealth class-change. [Skotlex]
        sd->disguise = class_; //viewdata is set on uncloaking.
        return 2;
    }
@@ -2431,7 +2439,8 @@
            break;
        case SP_NO_GEMSTONE:
            if(sd->state.lr_flag != 2)
-               sd->special_state.no_gemstone = 1;
+               if( sd->special_state.no_gemstone != 2 )
+                   sd->special_state.no_gemstone = 1;
            break;
        case SP_INTRAVISION: // Maya Purple Card effect allowing to see Hiding/Cloaking people [DracoRPG]
            if(sd->state.lr_flag != 2) {
@@ -5745,8 +5754,13 @@
        (int)(status_get_lv(src) - sd->status.base_level) >= 20)
        bonus += 15; // pk_mode additional exp if monster >20 levels [Valaris]
 
-   if (sd->sc.data[SC_EXPBOOST])
-       bonus += sd->sc.data[SC_EXPBOOST]->val1;
+   if (sd->sc.data[SC_EXPBOOST]) {
+       // Increase Battle Manual EXP rate for VIP.
+       if(  Inter_Config.vip_sys.bm_increase && pc_get_vip(sd) )
+           bonus += sd->sc.data[SC_EXPBOOST]->val1 + ( sd->sc.data[SC_EXPBOOST]->val1 / Inter_Config.vip_sys.bm_increase );
+       else
+           bonus += sd->sc.data[SC_EXPBOOST]->val1;
+   }
 
    *base_exp = (unsigned int) cap_value(*base_exp + (double)*base_exp * bonus/100., 1, UINT_MAX);
 
@@ -6804,6 +6818,10 @@
        && !map[sd->bl.m].flag.noexppenalty && !map_flag_gvg(sd->bl.m)
        && !sd->sc.data[SC_BABY] && !sd->sc.data[SC_LIFEINSURANCE])
    {
+       if(Inter_Config.vip_sys.exp_penalty && pc_get_vip(sd) ) { // Decrease EXP penalty for VIP.
+           battle_config.death_penalty_base -= Inter_Config.vip_sys.exp_penalty;
+           battle_config.death_penalty_job  -= Inter_Config.vip_sys.exp_penalty;
+       }
        unsigned int base_penalty =0;
        if (battle_config.death_penalty_base > 0) {
            switch (battle_config.death_penalty_type) {
@@ -8878,54 +8896,86 @@
  *------------------------------------------*/
 int pc_checkitem(struct map_session_data *sd)
 {
-   int i,id,calc_flag = 0;
+   int i,calc_flag = 0;
 
    nullpo_ret(sd);
 
    if( sd->state.vending ) //Avoid reorganizing items when we are vending, as that leads to exploits (pointed out by End of Exam)
        return 0;
 
-   if( battle_config.item_check ) {// check for invalid(ated) items
+   for( i = 0; i < MAX_INVENTORY; i++) {
+
+       if( sd->status.inventory[i].nameid == 0 )
+           continue;
+
+       if( !sd->status.inventory[i].equip )
+           continue;
+
+       if( sd->status.inventory[i].equip&~pc_equippoint(sd,i) ) {
+           pc_unequipitem(sd, i, 2);
+           calc_flag = 1;
+           continue;
+       }
+
+   }
+
+   if( calc_flag && sd->state.active ) {
+       pc_checkallowskill(sd);
+       status_calc_pc(sd,0);
+   }
+
+   return 0;
+}
+
+/*==========================================
+ * Checks for unavailable items and removes them.
+ *------------------------------------------*/
+int pc_check_available_item(struct map_session_data *sd)
+{
+   int i, id;
+   char output[256];
+
+   nullpo_ret(sd);
+
+   if( battle_config.item_check&1 ) { // Check for invalid(ated) items in inventory.
        for( i = 0; i < MAX_INVENTORY; i++ ) {
            id = sd->status.inventory[i].nameid;
 
            if( id && !itemdb_available(id) ) {
+               sprintf(output, msg_txt(sd, 695), id); // Item %d has been removed from your inventory.
+               clif_displaymessage(sd->fd, output);
                ShowWarning("Removed invalid/disabled item id %d from inventory (amount=%d, char_id=%d).\n", id, sd->status.inventory[i].amount, sd->status.char_id);
                pc_delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_OTHER);
            }
        }
+   }
 
+   if( battle_config.item_check&2 ) { // Check for invalid(ated) items in cart.
        for( i = 0; i < MAX_CART; i++ ) {
            id = sd->status.cart[i].nameid;
 
            if( id && !itemdb_available(id) ) {
+               sprintf(output, msg_txt(sd, 696), id); // Item %d has been removed from your cart.
+               clif_displaymessage(sd->fd, output);
                ShowWarning("Removed invalid/disabled item id %d from cart (amount=%d, char_id=%d).\n", id, sd->status.cart[i].amount, sd->status.char_id);
                pc_cart_delitem(sd, i, sd->status.cart[i].amount, 0, LOG_TYPE_OTHER);
            }
        }
    }
 
-   for( i = 0; i < MAX_INVENTORY; i++) {
+   if( battle_config.item_check&4 ) { // Check for invalid(ated) items in storage.
+       for( i = 0; i < MAX_STORAGE; i++ ) {
+           id = sd->status.storage.items[i].nameid;
 
-       if( sd->status.inventory[i].nameid == 0 )
-           continue;
-
-       if( !sd->status.inventory[i].equip )
-           continue;
-
-       if( sd->status.inventory[i].equip&~pc_equippoint(sd,i) ) {
-           pc_unequipitem(sd, i, 2);
-           calc_flag = 1;
-           continue;
+           if( id && !itemdb_available(id) ) {
+               sprintf(output, msg_txt(sd, 697), id); // Item %d has been removed from your storage.
+               clif_displaymessage(sd->fd, output);
+               ShowWarning("Removed invalid/disabled item id %d from storage (amount=%d, char_id=%d).\n", id, sd->status.storage.items[i].amount, sd->status.char_id);
+               storage_delitem(sd, i, sd->status.storage.items[i].amount);
+           }
        }
-
    }
 
-   if( calc_flag && sd->state.active ) {
-       pc_checkallowskill(sd);
-       status_calc_pc(sd,0);
-   }
-
    return 0;
 }
 
Index: src/map/pc.h
===================================================================
--- src/map/pc.h    (revision 17325)
+++ src/map/pc.h    (working copy)
@@ -178,7 +178,7 @@
        unsigned int no_castcancel : 1;
        unsigned int no_castcancel2 : 1;
        unsigned int no_sizefix : 1;
-       unsigned int no_gemstone : 1;
+       unsigned int no_gemstone : 2; // 1: Mistress Card effect, 2: VIP effect
        unsigned int intravision : 1; // Maya Purple Card effect [DracoRPG]
        unsigned int perfect_hiding : 1; // [Valaris]
        unsigned int no_knockback : 1;
@@ -669,6 +669,8 @@
 )
 #define pcdb_checkid(class_) pcdb_checkid_sub((unsigned int)class_)
 
+#define pc_get_vip(sd) ( pc_get_group_id(sd) == Inter_Config.vip_sys.group ? 1 : 0 )
+
 // clientside display macros (values to the left/right of the "+")
 #ifdef RENEWAL
    #define pc_leftside_atk(sd) ((sd)->battle_status.batk)
@@ -813,6 +815,7 @@
 int pc_equipitem(struct map_session_data*,int,int);
 int pc_unequipitem(struct map_session_data*,int,int);
 int pc_checkitem(struct map_session_data*);
+int pc_check_available_item(struct map_session_data *sd);
 int pc_useitem(struct map_session_data*,int);
 
 int pc_skillatk_bonus(struct map_session_data *sd, uint16 skill_id);
Index: src/map/script.c
===================================================================
--- src/map/script.c    (revision 17325)
+++ src/map/script.c    (working copy)
@@ -6139,6 +6139,54 @@
    return 0;
 }
 
+/*
+ * return
+ *  0 : failure
+ *  1 : success
+ */
+int chekweight_sub(TBL_PC *sd,int nbargs,uint16 *eitemid, uint16 *eamount){
+   struct item_data* id = NULL;
+   uint16 nameid,amount,amount2=0,slots,weight,i;
+
+   slots = pc_inventoryblank(sd); //nb of empty slot
+
+   for(i=2; i<nbargs; i++){
+       id = itemdb_exists(eitemid[i]);
+       if( id == NULL ) {
+           ShowError("buildin_checkweight: Invalid item '%d'.\n", eitemid[i]);
+           return 0;
+       }
+       nameid = id->nameid;
+
+       amount = eamount[i];
+       if( amount < 1 ) {
+           ShowError("buildin_checkweight: Invalid amount '%d'.\n", eamount[i]);
+           return 0;
+       }
+
+       weight += (id->weight)*amount; //total weight for all chk
+       if( weight + sd->weight > sd->max_weight ){// too heavy
+           return 0;
+       }
+
+       switch( pc_checkadditem(sd, nameid, amount) ){
+       case CHKADDITEM_EXIST:
+           // item is already in inventory, but there is still space for the requested amount
+           break;
+       case CHKADDITEM_NEW:
+           if( itemdb_isstackable(nameid) ) amount2++; // stackable
+           else amount2 += amount; // non-stackable
+
+           if( slots < amount2)
+               return 0;
+           break;
+       case CHKADDITEM_OVERAMOUNT:
+           return 0;
+       }
+   }
+   return 1;
+}
+
 /*==========================================
  * Check if item with this amount can fit in inventory
  * Checking : weight, stack amount >32k, slots amount >(MAX_INVENTORY)
@@ -6146,13 +6194,11 @@
  * 0 : fail
  * 1 : success (npc side only)
  *------------------------------------------*/
-BUILDIN_FUNC(checkweight)
-{
-   int nameid, amount, slots, amount2=0;
-   unsigned int weight=0, i, nbargs;
-   struct item_data* id = NULL;
+BUILDIN_FUNC(checkweight){
    struct map_session_data* sd;
    struct script_data* data;
+   struct item_data* id = NULL;
+   uint16 nameid[128], amount[128], nbargs,i;
 
    if( ( sd = script_rid2sd(st) ) == NULL ){
        return 0;
@@ -6163,167 +6209,87 @@
        script_pushint(st,0);
        return 1;
    }
-   slots = pc_inventoryblank(sd); //nb of empty slot
 
    for(i=2; i<nbargs; i=i+2){
        data = script_getdata(st,i);
        get_val(st, data);  // convert into value in case of a variable
-       if( data_isstring(data) ){// item name
+       if( data_isstring(data) ) // item name
            id = itemdb_searchname(conv_str(st, data));
-       } else {// item id
+       else // item id
            id = itemdb_exists(conv_num(st, data));
-       }
        if( id == NULL ) {
            ShowError("buildin_checkweight: Invalid item '%s'.\n", script_getstr(st,i));  // returns string, regardless of what it was
            script_pushint(st,0);
            return 1;
        }
-       nameid = id->nameid;
-
-       amount = script_getnum(st,i+1);
-       if( amount < 1 ) {
-           ShowError("buildin_checkweight: Invalid amount '%d'.\n", amount);
-           script_pushint(st,0);
-           return 1;
-       }
-
-       weight += itemdb_weight(nameid)*amount; //total weight for all chk
-       if( weight + sd->weight > sd->max_weight )
-       {// too heavy
-           script_pushint(st,0);
-           return 0;
-       }
-
-       switch( pc_checkadditem(sd, nameid, amount) )
-       {
-           case CHKADDITEM_EXIST:
-               // item is already in inventory, but there is still space for the requested amount
-               break;
-           case CHKADDITEM_NEW:
-               if( itemdb_isstackable(nameid) ) {// stackable
-                   amount2++;
-                   if( slots < amount2 ) {
-                       script_pushint(st,0);
-                       return 0;
-                   }
-               }
-               else {// non-stackable
-                   amount2 += amount;
-                   if( slots < amount2){
-                       script_pushint(st,0);
-                       return 0;
-                   }
-               }
-               break;
-           case CHKADDITEM_OVERAMOUNT:
-               script_pushint(st,0);
-               return 0;
-       }
+       nameid[i] = id->nameid;
+       amount[i] = script_getnum(st,i+1);
    }
-   script_pushint(st,1);
+   script_pushint(st,chekweight_sub(sd,nbargs-2,nameid,amount));
    return 0;
 }
 
-BUILDIN_FUNC(checkweight2)
-{
-        //variable sub checkweight
-        int32 nameid=-1, amount=-1;
-        int i=0, amount2=0, slots=0, weight=0;
-   short fail=0;
+BUILDIN_FUNC(checkweight2){
+   //variable sub checkweight
+   uint16 nameid[128], amount[128];
+   int fail,i;
 
-        //variable for array parsing
-        struct script_data* data_it;
-        struct script_data* data_nb;
-        const char* name_it;
-        const char* name_nb;
-        int32 id_it, id_nb;
-        int32 idx_it, idx_nb;
-        int nb_it, nb_nb; //array size
+   //variable for array parsing
+   struct script_data* data_it;
+   struct script_data* data_nb;
+   const char* name_it;
+   const char* name_nb;
+   int32 id_it, id_nb;
+   int32 idx_it, idx_nb;
+   int nb_it, nb_nb; //array size
 
-        TBL_PC *sd = script_rid2sd(st);
-        nullpo_retr(1,sd);
+   TBL_PC *sd = script_rid2sd(st);
+   nullpo_retr(1,sd);
 
-        data_it = script_getdata(st, 2);
-        data_nb = script_getdata(st, 3);
+   data_it = script_getdata(st, 2);
+   data_nb = script_getdata(st, 3);
 
-        if( !data_isreference(data_it) || !data_isreference(data_nb))
-        {
-                ShowError("script:checkweight2: parameter not a variable\n");
-                script_pushint(st,0);
-                return 1;// not a variable
-        }
-        id_it = reference_getid(data_it);
-        id_nb = reference_getid(data_nb);
-        idx_it = reference_getindex(data_it);
-        idx_nb = reference_getindex(data_nb);
-        name_it = reference_getname(data_it);
-        name_nb = reference_getname(data_nb);
+   if( !data_isreference(data_it) || !data_isreference(data_nb))
+   {
+       ShowError("script:checkweight2: parameter not a variable\n");
+       script_pushint(st,0);
+       return 1;// not a variable
+   }
+   id_it = reference_getid(data_it);
+   id_nb = reference_getid(data_nb);
+   idx_it = reference_getindex(data_it);
+   idx_nb = reference_getindex(data_nb);
+   name_it = reference_getname(data_it);
+   name_nb = reference_getname(data_nb);
 
-        if( not_array_variable(*name_it) || not_array_variable(*name_nb))
-        {
-                ShowError("script:checkweight2: illegal scope\n");
-                script_pushint(st,0);
-                return 1;// not supported
-        }
-        if(is_string_variable(name_it) || is_string_variable(name_nb)){
-                ShowError("script:checkweight2: illegal type, need int\n");
-                script_pushint(st,0);
-                return 1;// not supported
-        }
-        nb_it = getarraysize(st, id_it, idx_it, 0, reference_getref(data_it));
-        nb_nb = getarraysize(st, id_nb, idx_nb, 0, reference_getref(data_nb));
-        if(nb_it != nb_nb){
-                ShowError("Size mistmatch: nb_it=%d, nb_nb=%d\n",nb_it,nb_nb);
+   if( not_array_variable(*name_it) || not_array_variable(*name_nb))
+   {
+       ShowError("script:checkweight2: illegal scope\n");
+       script_pushint(st,0);
+       return 1;// not supported
+   }
+   if(is_string_variable(name_it) || is_string_variable(name_nb)){
+       ShowError("script:checkweight2: illegal type, need int\n");
+       script_pushint(st,0);
+       return 1;// not supported
+   }
+   nb_it = getarraysize(st, id_it, idx_it, 0, reference_getref(data_it));
+   nb_nb = getarraysize(st, id_nb, idx_nb, 0, reference_getref(data_nb));
+   if(nb_it != nb_nb){
+       ShowError("Size mistmatch: nb_it=%d, nb_nb=%d\n",nb_it,nb_nb);
        fail = 1;
-        }
+   }
 
-        slots = pc_inventoryblank(sd);
-        for(i=0; i<nb_it; i++){
-            nameid = (int32)__64BPRTSIZE(get_val2(st,reference_uid(id_it,idx_it+i),reference_getref(data_it)));
+   for(i=0; i<nb_it; i++){
+       nameid[i] = (int32)__64BPRTSIZE(get_val2(st,reference_uid(id_it,idx_it+i),reference_getref(data_it)));
        script_removetop(st, -1, 0);
-       amount = (int32)__64BPRTSIZE(get_val2(st,reference_uid(id_nb,idx_nb+i),reference_getref(data_nb)));
+       amount[i] = (int32)__64BPRTSIZE(get_val2(st,reference_uid(id_nb,idx_nb+i),reference_getref(data_nb)));
        script_removetop(st, -1, 0);
-       if(fail) continue; //cpntonie to depop rest
-
-            if(itemdb_exists(nameid) == NULL ){
-       ShowError("buildin_checkweight2: Invalid item '%d'.\n", nameid);
-       fail=1;
-       continue;
-            }
-            if(amount < 0 ){
-                ShowError("buildin_checkweight2: Invalid amount '%d'.\n", amount);
-                fail = 1;
-       continue;
-            }
-       weight += itemdb_weight(nameid)*amount;
-       if( weight + sd->weight > sd->max_weight ){
-       fail = 1;
-       continue;
-       }
-       switch( pc_checkadditem(sd, nameid, amount) ) {
-           case CHKADDITEM_EXIST:
-           // item is already in inventory, but there is still space for the requested amount
-               break;
-           case CHKADDITEM_NEW:
-               if( itemdb_isstackable(nameid) ){// stackable
-                   amount2++;
-                   if( slots < amount2 )
-                       fail = 1;
-               }
-               else {// non-stackable
-                   amount2 += amount;
-                   if( slots < amount2 ){
-                       fail = 1;
-                   }
-               }
-               break;
-           case CHKADDITEM_OVERAMOUNT:
-               fail = 1;
-       } //end switch
    } //end loop DO NOT break it prematurly we need to depop all stack
 
-        fail?script_pushint(st,0):script_pushint(st,1);
-        return 0;
+   if(fail) script_pushint(st,0);
+   else script_pushint(st,chekweight_sub(sd,nb_it,nameid,amount)); //push result of sub to script
+   return 0;
 }
 
 /*==========================================
Index: src/map/battle.c
===================================================================
--- src/map/battle.c    (revision 17325)
+++ src/map/battle.c    (working copy)
@@ -5669,7 +5669,7 @@
    { "max_heal_lv",                        &battle_config.max_heal_lv,                     11,     1,      INT_MAX,        },
    { "max_heal",                           &battle_config.max_heal,                        9999,   0,      INT_MAX,        },
    { "combo_delay_rate",                   &battle_config.combo_delay_rate,                100,    0,      INT_MAX,        },
-   { "item_check",                         &battle_config.item_check,                      0,      0,      1,              },
+   { "item_check",                         &battle_config.item_check,                      0,      0,      7,              },
    { "item_use_interval",                  &battle_config.item_use_interval,               100,    0,      INT_MAX,        },
    { "cashfood_use_interval",              &battle_config.cashfood_use_interval,           60000,  0,      INT_MAX,        },
    { "wedding_modifydisplay",              &battle_config.wedding_modifydisplay,           0,      0,      1,              },
Index: src/map/atcommand.c
===================================================================
--- src/map/atcommand.c (revision 17325)
+++ src/map/atcommand.c (working copy)
@@ -3577,6 +3577,15 @@
 /*==========================================
  *
  *------------------------------------------*/
+ACMD_FUNC(reloadpacketdb){
+   nullpo_retr(-1, sd);
+   packetdb_readdb();
+   ShowInfo("Packetd database has been reloaded\n"); //just in case we have break clif message
+   clif_displaymessage(fd, "Packetd database has been reloaded\n"); // Item database has been reloaded.
+
+   return 0;
+}
+
 ACMD_FUNC(reloaditemdb)
 {
    nullpo_retr(-1, sd);
@@ -7388,6 +7397,11 @@
    nullpo_ret(sd);
    memset(buf, '\0', sizeof(buf));
 
+   if( Inter_Config.vip_sys.enable && pc_get_vip(sd) ) { // Display EXP rate increase for VIP.
+       battle_config.base_exp_rate += Inter_Config.vip_sys.exp_increase;
+       battle_config.job_exp_rate  += Inter_Config.vip_sys.exp_increase;
+   }
+
    snprintf(buf, CHAT_SIZE_MAX, msg_txt(sd,1298), // Experience rates: Base %.2fx / Job %.2fx
        battle_config.base_exp_rate/100., battle_config.job_exp_rate/100.);
    clif_displaymessage(fd, buf);
@@ -9096,6 +9110,7 @@
        ACMD_DEF(reloadbattleconf),
        ACMD_DEF(reloadstatusdb),
        ACMD_DEF(reloadpcdb),
+       ACMD_DEF(reloadpacketdb),
        ACMD_DEF(reloadmotd),
        ACMD_DEF(mapinfo),
        ACMD_DEF(dye),
Index: src/map/clif.c
===================================================================
--- src/map/clif.c  (revision 17325)
+++ src/map/clif.c  (working copy)
@@ -2440,6 +2440,7 @@
 
 void clif_storagelist(struct map_session_data* sd, struct item* items, int items_length)
 {
+   static const int client_buf = 0x5000;
    struct item_data *id;
    int i,n,ne;
    unsigned char *buf;
@@ -2480,31 +2481,37 @@
            n++;
        }
    }
-   if( n )
+   for (i = 0; i < n;)
    {
+       int nn = n - i < (client_buf - 4)/s ? n - i : (client_buf - 4)/s;
+       unsigned char *p = buf + i*s;
+       i += nn;
 #if PACKETVER < 5
-       WBUFW(buf,0)=0xa5;
+       WBUFW(p,0)=0xa5;
 #elif PACKETVER < 20080102
-       WBUFW(buf,0)=0x1f0;
+       WBUFW(p,0)=0x1f0;
 #elif PACKETVER < 20120925
        WBUFW(buf,0)=0x2ea;
 #else
        WBUFW(buf,0)=0x995;
 #endif
-       WBUFW(buf,2)=4+n*s;
-       clif_send(buf, WBUFW(buf,2), &sd->bl, SELF);
+       WBUFW(p,2)=4+nn*s;
+       clif_send(p, WBUFW(p,2), &sd->bl, SELF);
    }
-   if( ne )
+   for (i = 0; i < ne;)
    {
+       int nn = ne - i < (client_buf - 4)/cmd ? ne - i : (client_buf - 4)/cmd;
+       unsigned char *p = bufe + i*cmd;
+       i += nn;
 #if PACKETVER < 20071002
-       WBUFW(bufe,0)=0xa6;
+       WBUFW(p,0)=0xa6;
 #elif PACKETVER < 20120925
        WBUFW(bufe,0)=0x2d1;
 #else
        WBUFW(bufe,0)=0x996;
 #endif
-       WBUFW(bufe,2)=4+ne*cmd;
-       clif_send(bufe, WBUFW(bufe,2), &sd->bl, SELF);
+       WBUFW(p,2)=4+nn*cmd;
+       clif_send(p, WBUFW(p,2), &sd->bl, SELF);
    }
 
    if( buf ) aFree(buf);
@@ -14098,7 +14105,7 @@
        return;
    }
 
-   if( (item = itemdb_exists(sd->status.inventory[idx].nameid)) != NULL && !(item->type == IT_ARMOR || item->type == IT_PETARMOR || item->type == IT_WEAPON || item->type == IT_CARD || item->type == IT_ETC) )
+   if( (item = itemdb_exists(sd->status.inventory[idx].nameid)) != NULL && itemdb_available(sd->status.inventory[idx].nameid) && !(item->type == IT_ARMOR || item->type == IT_PETARMOR || item->type == IT_WEAPON || item->type == IT_CARD || item->type == IT_ETC) )
    { // Consumable or pets are not allowed
        clif_Auction_setitem(sd->fd, idx, true);
        return;
@@ -16554,7 +16561,7 @@
 /*==========================================
  * Reads packet_db.txt and setups its array reference
  *------------------------------------------*/
-static int packetdb_readdb(void)
+int packetdb_readdb(void)
 {
    FILE *fp;
    char line[1024];
Index: src/map/clif.h
===================================================================
--- src/map/clif.h  (revision 17325)
+++ src/map/clif.h  (working copy)
@@ -782,4 +782,6 @@
 
 #define clif_menuskill_clear(sd) (sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0;
 
+int packetdb_readdb(void);
+
 #endif /* _CLIF_H_ */
Index: src/map/mob.c
===================================================================
--- src/map/mob.c   (revision 17325)
+++ src/map/mob.c   (working copy)
@@ -12,6 +12,7 @@
 #include "../common/strlib.h"
 #include "../common/utils.h"
 #include "../common/socket.h"
+#include "../common/conf.h" //Inter_config
 
 #include "map.h"
 #include "path.h"
@@ -2243,6 +2244,10 @@
                    zeny*=rnd()%250;
            }
 
+       // Increase EXP rate for VIP.
+       if( Inter_Config.vip_sys.exp_increase && ( sd && pc_get_vip(sd) ) )
+           bonus += Inter_Config.vip_sys.exp_increase;
+
            if (map[m].flag.nobaseexp || !md->db->base_exp)
                base_exp = 0;
            else
@@ -2371,6 +2376,11 @@
                    drop_rate = 1;
            }
 #endif
+
+           // Increase item drop rate for VIP.
+           if( Inter_Config.vip_sys.drop_increase && ( sd && pc_get_vip(sd) ) )
+               drop_rate = max(drop_rate,cap_value((int)(0.5+drop_rate*Inter_Config.vip_sys.drop_increase/10000.),0,9000)); // now rig the drop rate to never be over 90% unless it is originally >90%.
+
            // attempt to drop the item
            if (rnd() % 10000 >= drop_rate)
                    continue;
Index: src/map/skill.c
===================================================================
--- src/map/skill.c (revision 17325)
+++ src/map/skill.c (working copy)
@@ -13136,7 +13136,7 @@
         * Warlock
         **/
        case WL_COMET:
-           if( skill_check_pc_partner(sd,skill_id,&skill_lv,1,0) <= 0
+           if( skill_check_pc_partner(sd,skill_id,&skill_lv,1,0) <= 0 && require.itemid[0]
                && sd->special_state.no_gemstone == 0
                && ((i = pc_search_inventory(sd,require.itemid[0])) < 0 || sd->status.inventory[i].amount < require.amount[0]) ) {
                //clif_skill_fail(sd,skill_id,USESKILL_FAIL_NEED_ITEM,require.amount[0],require.itemid[0]);
@@ -13857,11 +13857,11 @@
                    continue;
                break;
            case AB_ADORAMUS:
-               if( itemid_isgemstone(skill_db[idx].itemid[i]) && skill_check_pc_partner(sd,skill_id,&skill_lv, 1, 2) )
+               if( ( sd->special_state.no_gemstone != 2 ) && itemid_isgemstone(skill_db[idx].itemid[i]) && skill_check_pc_partner(sd,skill_id,&skill_lv, 1, 2) )
                    continue;
                break;
            case WL_COMET:
-               if( itemid_isgemstone(skill_db[idx].itemid[i]) && skill_check_pc_partner(sd,skill_id,&skill_lv, 1, 0) )
+               if( ( sd->special_state.no_gemstone != 2 ) && itemid_isgemstone(skill_db[idx].itemid[i]) && skill_check_pc_partner(sd,skill_id,&skill_lv, 1, 0) )
                    continue;
                break;
            case GN_FIRE_EXPANSION:
@@ -13884,8 +13884,11 @@
        req.itemid[i] = skill_db[idx].itemid[i];
        req.amount[i] = skill_db[idx].amount[i];
 
-       if( itemid_isgemstone(req.itemid[i]) && skill_id != HW_GANBANTEIN )
-       {
+       // Remove all Magic Stone required for all skills for VIP.
+       if( itemid_isgemstone(req.itemid[i]) && ( sd->special_state.no_gemstone == 2 ) ) {
+           req.itemid[i] = 0;
+           req.amount[i] = 0;
+       } else if( itemid_isgemstone(req.itemid[i]) && skill_id != HW_GANBANTEIN ) {
            if( sd->special_state.no_gemstone )
            {   // All gem skills except Hocus Pocus and Ganbantein can cast for free with Mistress card -helvetica
                if( skill_id != SA_ABRACADABRA )
Index: src/map/mail.c
===================================================================
--- src/map/mail.c  (revision 17325)
+++ src/map/mail.c  (working copy)
@@ -78,7 +78,7 @@
            return 1;
        if( amount < 0 || amount > sd->status.inventory[idx].amount )
            return 1;
-       if( !pc_can_give_items(sd) || sd->status.inventory[idx].expire_time ||
+       if( !pc_can_give_items(sd) || !itemdb_available(sd->status.inventory[idx].nameid) || sd->status.inventory[idx].expire_time ||
                !itemdb_canmail(&sd->status.inventory[idx],pc_get_group_level(sd)) )
            return 1;
 
Index: src/map/itemdb.c
===================================================================
--- src/map/itemdb.c    (revision 17325)
+++ src/map/itemdb.c    (working copy)
@@ -1448,6 +1448,7 @@
    for( sd = (struct map_session_data*)mapit_first(iter); mapit_exists(iter); sd = (struct map_session_data*)mapit_next(iter) ) {
        memset(sd->item_delay, 0, sizeof(sd->item_delay));  // reset item delays
        pc_setinventorydata(sd);
+       pc_check_available_item(sd); // Check for invalid(ated) items in inventory/cart/storage.
        /* clear combo bonuses */
        if( sd->combos.count ) {
            aFree(sd->combos.bonus);
Index: src/map/map.c
===================================================================
--- src/map/map.c   (revision 17325)
+++ src/map/map.c   (working copy)
@@ -3,6 +3,7 @@
 
 #include "../common/cbasetypes.h"
 #include "../common/core.h"
+#include "../common/conf.h"
 #include "../common/timer.h"
 #include "../common/grfio.h"
 #include "../common/malloc.h"
@@ -49,6 +50,7 @@
 #include "mail.h"
 #include "cashshop.h"
 #include "channel.h"
+#include "conf.h"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -3928,6 +3930,7 @@
        add_timer_interval(gettick()+1000, parse_console_timer, 0, 0, 1000); //start in 1s each 1sec
    }
 
+   ShowDebug("Inter_Config.vip_sys : \n\tenable = %d\n\tgroudid=%d\n",Inter_Config.vip_sys.enable,Inter_Config.vip_sys.group);
    return 0;
 }
 
Index: src/char/char.c
===================================================================
--- src/char/char.c (revision 17325)
+++ src/char/char.c (working copy)
@@ -3,6 +3,7 @@
 
 #include "../common/cbasetypes.h"
 #include "../common/core.h"
+#include "../common/conf.h" //interconf
 #include "../common/db.h"
 #include "../common/malloc.h"
 #include "../common/mapindex.h"
@@ -108,7 +109,7 @@
 #define TRIM_CHARS "\255\xA0\032\t\x0A\x0D " //The following characters are trimmed regardless because they cause confusion and problems on the servers. [Skotlex]
 char char_name_letters[1024] = ""; // list of letters/symbols allowed (or not) in a character name. by [Yor]
 
-int char_per_account = 0; //Maximum chars per account (default unlimited) [Sirius]
+int char_per_account = 0; //Maximum chars per account [Sirius]
 int char_del_level = 0; //From which level u can delete character [Lupus]
 int char_del_delay = 86400;
 
@@ -1563,12 +1564,10 @@
 
 
    // check the number of already existing chars in this account
-   if( char_per_account != 0 ) {
-       if( SQL_ERROR == Sql_Query(sql_handle, "SELECT 1 FROM `%s` WHERE `account_id` = '%d'", char_db, sd->account_id) )
-           Sql_ShowDebug(sql_handle);
-       if( Sql_NumRows(sql_handle) >= char_per_account )
-           return -2; // character account limit exceeded
-   }
+   if( SQL_ERROR == Sql_Query(sql_handle, "SELECT 1 FROM `%s` WHERE `account_id` = '%d'", char_db, sd->account_id) )
+       Sql_ShowDebug(sql_handle);
+   if( Sql_NumRows(sql_handle) >= char_per_account )
+       return -2; // character account limit exceeded
 
    // check char slot
    if( SQL_ERROR == Sql_Query(sql_handle, "SELECT 1 FROM `%s` WHERE `account_id` = '%d' AND `char_num` = '%d' LIMIT 1", char_db, sd->account_id, slot) )
@@ -2242,7 +2241,7 @@
                    ShowError("Account '%d' `character_slots` column is higher than supported MAX_CHARS (%d), update MAX_CHARS in mmo.h! capping to MAX_CHARS...\n",sd->account_id,sd->char_slots);
                    sd->char_slots = MAX_CHARS;/* cap to maximum */
                } else if ( !sd->char_slots )/* no value aka 0 in sql */
-                   sd->char_slots = MAX_CHARS;/* cap to maximum */
+                   sd->char_slots = char_per_account;/* cap to config */
                safestrncpy(sd->birthdate, (const char*)RFIFOP(fd,52), sizeof(sd->birthdate));
                safestrncpy(sd->pincode, (const char*)RFIFOP(fd,63), sizeof(sd->pincode));
                sd->pincode_change = (time_t)RFIFOL(fd,68);
@@ -5052,9 +5051,8 @@
            safestrncpy(char_name_letters, w2, sizeof(char_name_letters));
        } else if (strcmpi(w1, "chars_per_account") == 0) { //maxchars per account [Sirius]
            char_per_account = atoi(w2);
-           if( char_per_account == 0 || char_per_account > MAX_CHARS ) {
-               if( char_per_account > MAX_CHARS )
-                   ShowWarning("Max chars per account '%d' exceeded limit. Defaulting to '%d'.\n", char_per_account, MAX_CHARS);
+           if(char_per_account <= 0 || char_per_account > MAX_CHARS) {
+               ShowWarning("Max chars per account '%d' exceeded limit. Defaulting to '%d'.\n", char_per_account, MAX_CHARS);
                char_per_account = MAX_CHARS;
            }
        } else if (strcmpi(w1, "char_del_level") == 0) { //disable/enable char deletion by its level condition [Lupus]
@@ -5277,6 +5275,8 @@
        add_timer_func_list(parse_console_timer, "parse_console_timer");
        add_timer_interval(gettick()+1000, parse_console_timer, 0, 0, 1000); //start in 1s each 1sec
    }
+
+   ShowDebug("Inter_Config.vip_sys : \n\tenable = %d\n\tgroudid=%d\n",Inter_Config.vip_sys.enable,Inter_Config.vip_sys.group);
    return 0;
 }
 
Index: src/common/core.c
===================================================================
--- src/common/core.c   (revision 17325)
+++ src/common/core.c   (working copy)
@@ -5,6 +5,7 @@
 #include "showmsg.h"
 #include "malloc.h"
 #include "core.h"
+#include "conf.h"
 #ifndef MINICORE
 #include "db.h"
 #include "socket.h"
@@ -314,6 +315,7 @@
 #ifdef MINICORE // minimalist Core
    display_title();
    usercheck();
+   inter_conf_read();
    do_init(argc,argv);
    do_final();
 #else// not MINICORE
@@ -334,6 +336,7 @@
    timer_init();
    socket_init();
 
+   inter_conf_read();
    do_init(argc,argv);
 
    {// Main runtime cycle
@@ -355,5 +358,7 @@
 
    malloc_final();
 
+
+
    return 0;
 }
Index: src/common/conf.c
===================================================================
--- src/common/conf.c   (revision 17325)
+++ src/common/conf.c   (working copy)
@@ -3,6 +3,8 @@
 
 #include "conf.h"
 #include "libconfig.h"
+#include "utils.h"
+#include "mmo.h"
 
 #include "../common/showmsg.h" // ShowError
 
@@ -64,7 +66,7 @@
        config_setting_set_format(set, src->format);
    } else if (CONFIG_TYPE_INT64 == config_setting_type(src)) {
        set = config_setting_set_int64_elem(parent, -1, config_setting_get_int64(src));
-       config_setting_set_format(set, src->format);   
+       config_setting_set_format(set, src->format);
    } else if (CONFIG_TYPE_FLOAT == config_setting_type(src)) {
        config_setting_set_float_elem(parent, -1, config_setting_get_float(src));
    } else if (CONFIG_TYPE_STRING == config_setting_type(src)) {
@@ -85,10 +87,10 @@
        return;
 
    n = config_setting_length(src);
-   
+
    for (i = 0; i < n; i++) {
        if (config_setting_is_group(src)) {
-           config_setting_copy_simple(newAgg, config_setting_get_elem(src, i));            
+           config_setting_copy_simple(newAgg, config_setting_get_elem(src, i));
        } else {
            config_setting_copy_elem(newAgg, config_setting_get_elem(src, i));
        }
@@ -107,3 +109,75 @@
    }
    return CONFIG_TRUE;
 }
+
+//
+// Global configuration settings.
+//
+void inter_conf_read(void){
+   config_t inter_conf;
+   config_setting_t *sys = NULL;
+   const char *config_filename = "conf/inter_battle.conf";
+
+   if (conf_read_file(&inter_conf, config_filename))
+       return;
+
+   ShowDebug("were are reading %s\n",config_filename);
+   sys = config_lookup(&inter_conf, "vip_sys");
+   if (sys != NULL) { //reading vip_sys part
+       config_setting_t *settings = config_setting_get_elem(sys, 0);
+       unsigned int enable;
+       unsigned int group;
+       unsigned int magic_stone; //:1
+       unsigned int storage_increase;
+       unsigned int char_increase;
+       unsigned int exp_increase;
+       unsigned int exp_penalty;
+       unsigned int bm_increase;
+       unsigned int drop_increase;
+
+       config_setting_lookup_bool(settings, "enable", &enable);
+       ShowDebug("enable = %d\n",enable);
+       Inter_Config.vip_sys.enable = enable;
+
+       if (enable) {
+           config_setting_lookup_int(settings, "group", &group);
+           config_setting_lookup_int(settings, "storage_increase", &storage_increase);
+           config_setting_lookup_int(settings, "char_increase", &char_increase);
+           config_setting_lookup_int(settings, "exp_increase", &exp_increase);
+           config_setting_lookup_int(settings, "exp_penalty", &exp_penalty);
+           config_setting_lookup_int(settings, "bm_increase", &bm_increase);
+           config_setting_lookup_int(settings, "drop_increase", &drop_increase);
+           config_setting_lookup_bool(settings, "magic_stone", &magic_stone);
+       }
+
+       Inter_Config.vip_sys.group = cap_value(group,0,99);
+       Inter_Config.vip_sys.storage_increase = cap_value(storage_increase,0,1000);
+       Inter_Config.vip_sys.char_increase = cap_value(char_increase,0,MAX_CHARS);
+       Inter_Config.vip_sys.exp_increase = cap_value(exp_increase,0,INT_MAX);
+       Inter_Config.vip_sys.exp_penalty = cap_value(exp_penalty,0,INT_MAX);
+       Inter_Config.vip_sys.bm_increase = cap_value(bm_increase,0,INT_MAX);
+       Inter_Config.vip_sys.drop_increase = cap_value(drop_increase,0,INT_MAX);
+       Inter_Config.vip_sys.magic_stone = magic_stone;
+   }
+   printf("Inter_Config.vip_sys = {\n"
+       "\tenable => %d\n"
+       "\tgroup => %d\n"
+       "\tstorage_increase => %d\n"
+       "\tchar_increase => %d\n"
+       "\texp_increase => %d\n"
+       "\texp_penalty => %d\n"
+       "\tbm_increase => %d\n"
+       "\tdrop_increase => %d\n"
+       "\tmagic_stone => %d\n"
+       " }\n",
+       Inter_Config.vip_sys.enable,
+       Inter_Config.vip_sys.group,
+       Inter_Config.vip_sys.storage_increase,
+       Inter_Config.vip_sys.char_increase,
+       Inter_Config.vip_sys.exp_increase,
+       Inter_Config.vip_sys.exp_penalty,
+       Inter_Config.vip_sys.bm_increase,
+       Inter_Config.vip_sys.drop_increase,
+       Inter_Config.vip_sys.magic_stone
+       );
+}
Index: src/common/conf.h
===================================================================
--- src/common/conf.h   (revision 17325)
+++ src/common/conf.h   (working copy)
@@ -7,6 +7,22 @@
 #include "../common/cbasetypes.h"
 #include "libconfig.h"
 
+struct {
+   struct {
+       unsigned int enable : 1;
+       unsigned int group;
+       unsigned int storage_increase;
+       unsigned int char_increase;
+       unsigned int exp_increase;
+       unsigned int exp_penalty;
+       unsigned int bm_increase;
+       unsigned int drop_increase;
+       unsigned int magic_stone : 1;
+   } vip_sys;
+} Inter_Config;
+
+void inter_conf_read(void);
+
 int conf_read_file(config_t *config, const char *config_filename);
 int config_setting_copy(config_setting_t *parent, const config_setting_t *src);
 
Index: src/common/mmo.h
===================================================================
--- src/common/mmo.h    (revision 17325)
+++ src/common/mmo.h    (working copy)
@@ -72,7 +72,7 @@
 #define MAX_MAP_PER_SERVER 1500 // Increased to allow creation of Instance Maps
 #define MAX_INVENTORY 100
 //Max number of characters per account. Note that changing this setting alone is not enough if the client is not hexed to support more characters as well.
-#define MAX_CHARS 9
+#define MAX_CHARS 15
 //Number of slots carded equipment can have. Never set to less than 4 as they are also used to keep the data of forged items/equipment. [Skotlex]
 //Note: The client seems unable to receive data for more than 4 slots due to all related packets having a fixed size.
 #define MAX_SLOTS 4
Index: src/common/cbasetypes.h
===================================================================
--- src/common/cbasetypes.h (revision 17325)
+++ src/common/cbasetypes.h (working copy)
@@ -260,10 +260,11 @@
 #ifndef __cplusplus
 //////////////////////////////
 
+#include <stdbool.h>
 // boolean types for C
-typedef char bool;
-#define false  (1==0)
-#define true   (1==1)
+//typedef char bool;
+//#define false    (1==0)
+//#define true (1==1)
 
 //////////////////////////////
 #endif // not __cplusplus
@@ -276,7 +277,7 @@
 #undef swap
 #endif
 // hmm only ints?
-//#define swap(a,b) { int temp=a; a=b; b=temp;} 
+//#define swap(a,b) { int temp=a; a=b; b=temp;}
 // if using macros then something that is type independent
 //#define swap(a,b) ((a == b) || ((a ^= b), (b ^= a), (a ^= b)))
 // Avoid "value computed is not used" warning and generates the same assembly code
Index: conf/groups.conf
===================================================================
--- conf/groups.conf    (revision 17325)
+++ conf/groups.conf    (working copy)
@@ -97,6 +97,18 @@
 },
 {
    id: 1
+   name: "VIP"
+   inherit: ( "Player" ) /* can do everything Players can */
+   level: 0
+   commands: {
+       /* no commands by default */
+   }
+   permissions: {
+       /* no permissions by default */
+   }
+},
+{
+   id: 2
    name: "Super Player"
    inherit: ( "Player" ) /* can do everything Players can and more */
    level: 0
@@ -136,7 +148,7 @@
    }
 },
 {
-   id: 2
+   id: 3
    name: "Support"
    inherit: ( "Super Player" )
    level: 1
@@ -161,7 +173,7 @@
    }
 },
 {
-   id: 3
+   id: 4
    name: "Script Manager"
    inherit: ( "Support" )
    level: 1
@@ -180,7 +192,7 @@
    }
 },
 {
-   id: 4
+   id: 5
    name: "Event Manager"
    inherit: ( "Support" )
    level: 1
Index: conf/msg_conf/map_msg.conf
===================================================================
--- conf/msg_conf/map_msg.conf  (revision 17325)
+++ conf/msg_conf/map_msg.conf  (working copy)
@@ -635,7 +635,6 @@
 678: You are no longer the Guild Master.
 679: You have become the Guild Master!
 680: You have been recovered!
-//681-899 free
 
 681: Rune Knight T
 682: Warlock T
@@ -652,6 +651,10 @@
 693: Shadow Chaser T
 694: Hanbok
 
+695: Item %d has been removed from your inventory.
+696: Item %d has been removed from your cart.
+697: Item %d has been removed from your storage.
+//698-899 free
 
 //------------------------------------
 // More atcommands message
Index: conf/battle/exp.conf
===================================================================
--- conf/battle/exp.conf    (revision 17325)
+++ conf/battle/exp.conf    (working copy)
@@ -70,10 +70,10 @@
 death_penalty_type: 1
 
 // Base exp. penalty rate (Each 100 is 1% of their exp)
-death_penalty_base: 100
+death_penalty_base: 300
 
 // Job exp. penalty rate (Each 100 is 1% of their exp)
-death_penalty_job: 100
+death_penalty_job: 300
 
 // When a player dies (to another player), how much zeny should we penalize them with?
 // NOTE: It is a percentage of their zeny, so 100 = 1%
Index: conf/battle/items.conf
===================================================================
--- conf/battle/items.conf  (revision 17325)
+++ conf/battle/items.conf  (working copy)
@@ -51,12 +51,16 @@
 // NOTE: Wedding Rings and Whips/Musical Instruments will check gender regardless of setting.
 ignore_items_gender: yes
 
-// Item check? (Note 1)
+// Item check? (Note 3)
 // On map change it will check for items not tagged as "available" and 
-// auto-delete them from inventory/cart.
+// auto-delete them from inventory/cart. Items are auto-deleted from
+// storage when the character data is saved.
 // NOTE: An item is not available if it was not loaded from the item_db or you 
 // specify it as unavailable in db/item_avail.txt
-item_check: no
+// 1: Inventory
+// 2: Cart
+// 4: Storage
+item_check: 0
 
 // How much time must pass between item uses?
 // Only affects the delay between using items, prevents healing item abuse. Recommended ~500 ms
Index: conf/char_athena.conf
===================================================================
--- conf/char_athena.conf   (revision 17325)
+++ conf/char_athena.conf   (working copy)
@@ -143,7 +143,7 @@
 // How many Characters are allowed per Account ? (0 = disabled)
 // You can not exceed the limit of MAX_CHARS slots, defined in mmo.h
 // Doing that, chars_per_account will be default to MAX_CHARS.
-chars_per_account: 0
+chars_per_account: 9
 
 // Restrict character deletion by BaseLevel
 // 0: no restriction (players can delete characters of any level)
Index: sql-files/main.sql
===================================================================
--- sql-files/main.sql  (revision 17325)
+++ sql-files/main.sql  (working copy)
@@ -442,6 +442,7 @@
   `character_slots` tinyint(3) unsigned NOT NULL default '0',
   `pincode` varchar(4) NOT NULL DEFAULT '',
   `pincode_change` int(11) unsigned NOT NULL DEFAULT '0',
+  `vip_time` datetime NOT NULL default '0000-00-00 00:00:00',
   PRIMARY KEY  (`account_id`),
   KEY `name` (`userid`)
 ) ENGINE=MyISAM AUTO_INCREMENT=2000000; 
Index: doc/sample/npc_test_checkweight.txt
===================================================================
--- doc/sample/npc_test_checkweight.txt (revision 17325)
+++ doc/sample/npc_test_checkweight.txt (working copy)
@@ -4,7 +4,7 @@
 //= rAthena Dev Team
 //===== Current Version: =====================================
 //= 20121113
-//===== Description: ========================================= 
+//===== Description: =========================================
 //= Demonstrates 'checkweight' command.
 //============================================================
 
@@ -15,12 +15,12 @@
 
 L_RESET:
    resetlvl(1);
-   getinventorylist; 
-   for(set .@i,0; .@i < @inventorylist_count; set .@i,.@i+1){  
+   getinventorylist;
+   for(set .@i,0; .@i < @inventorylist_count; set .@i,.@i+1){
        delitem(@inventorylist_id[.@i],@inventorylist_amount[.@i]); //clear inventory
    }
-   
 
+
 L_TEST1: //basic backward chk
    .@testid = 0;
    .@succes = 0;
@@ -68,7 +68,7 @@
    .@ret = checkweight(717,500,716,500);
    set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure weight 3000/2030
    .@ret = checkweight(2794,95,2795,5);
-   set .@succes,.@succes+ChkResult(.@testid++,1,.@ret); //should be success 
+   set .@succes,.@succes+ChkResult(.@testid++,1,.@ret); //should be success
    .@ret = checkweight(2794,95,2795,10);
    set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure (with MAX_INVENTORY = 100)
    .@ret = checkweight(512,1,-1,1);
@@ -79,7 +79,7 @@
    set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure overamount inventory
    .@ret = checkweight(512,1,513,1,514,1,515,1);
    set .@succes,.@succes+ChkResult(.@testid++,1,.@ret); //should be sucess
-   
+
    debugmes "End update by list tests";
    FinalReport(.@testid,.@succes);
 
@@ -88,54 +88,54 @@
    .@succes = 0;
 
    setarray .@item[0], 512,513,514,515;
-        setarray .@count[0], 1,5,9,12;
+   setarray .@count[0], 1,5,9,12;
    .@ret = checkweight2(.@item,.@count);
    set .@succes,.@succes+ChkResult(.@testid++,1,.@ret); //should be sucess
    cleararray .@item[0], 0, 4;
    cleararray .@count[0], 0, 4;
    setarray .@item[0], 512,513,514,515;
-        setarray .@count[0], 1,5,-1,12;
+   setarray .@count[0], 1,5,-1,12;
    .@ret = checkweight2(.@item,.@count);
    set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure, invalide amout
    cleararray .@item[0], 0, 4;
    cleararray .@count[0], 0, 4;
    setarray .@item[0], 512,513,514,-1;
-        setarray .@count[0], 1,5,15,12;
+   setarray .@count[0], 1,5,15,12;
    .@ret = checkweight2(.@item,.@count);
    set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure, invalide id
    cleararray .@item[0], 0, 4;
    cleararray .@count[0], 0, 4;
    setarray .@item[0], 717,715,716,714;
-        setarray .@count[0], 300,300,300,300;
+   setarray .@count[0], 300,300,300,300;
    .@ret = checkweight2(.@item,.@count);
    set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure, total by weight
    cleararray .@item[0], 0, 4;
    cleararray .@count[0], 0, 4;
    setarray .@item[0], 6320,6320;
-        setarray .@count[0], 31000,2000;
+   setarray .@count[0], 31000,2000;
    .@ret = checkweight2(.@item,.@count);
    set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure, total by weight
    cleararray .@item[0], 0, 2;
    cleararray .@count[0], 0, 2;
    setarray .@item[0], 2794,2795;
-        setarray .@count[0], 95,5;
+   setarray .@count[0], 95,5;
    .@ret = checkweight2(.@item,.@count);
    set .@succes,.@succes+ChkResult(.@testid++,1,.@ret); //should be success
-        setarray .@count[0], 95,10;
+   setarray .@count[0], 95,10;
    .@ret = checkweight2(.@item,.@count);
    set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure overamount item
    cleararray .@item[0], 0, 2;
    cleararray .@count[0], 0, 2;
    setarray .@item[0], 6320,6320,512;
-        setarray .@count[0], 1,3;
+   setarray .@count[0], 1,3;
    .@ret = checkweight2(.@item,.@count);
    set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure, size mistmatch
    cleararray .@item[0], 0, 3;
    cleararray .@count[0], 0, 2;
    setarray .@item[0], 6320,6320;
-        setarray .@count[0], 1,3,5;
+   setarray .@count[0], 1,3,5;
    .@ret = checkweight2(.@item,.@count);
-   set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure, size mistmatch        
+   set .@succes,.@succes+ChkResult(.@testid++,0,.@ret); //should be failure, size mistmatch
 
 
    debugmes "End update by array tests";
@@ -143,8 +143,8 @@
 
 L_FINAL:
    end;
-   
 
+
    function ChkResult {
        .@tid = getarg(0);
        .@expected = getarg(1);
Viewed 1343 times, submitted by lighta.