viewing paste Unknown #5870 | 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
Index: map/pc.h
===================================================================
--- map/pc.h    (revision 17327)
+++ map/pc.h    (working copy)
@@ -515,6 +515,12 @@
    const char* delunit_prevfile;
    int delunit_prevline;
 
+   /**
+    * Extended Vending system [Lilith]
+    **/
+   int vend_loot;
+   int vend_lvl;
+
 };
 
 //Update this max as necessary. 55 is the value needed for Super Baby currently
Index: map/clif.c
===================================================================
--- map/clif.c  (revision 17327)
+++ map/clif.c  (working copy)
@@ -5478,6 +5478,7 @@
        aFree(buf);
 }
 
+
 /*==========================================
  * Displays a message on a 'bl' to all it's nearby clients
  * 008d <PacketLength>.W <GID> L (ZC_NOTIFY_CHAT)
@@ -8790,7 +8791,6 @@
    WFIFOSET(fd, WFIFOW(fd, 2));
 }
 
-
 /// Display msgstringtable.txt string (ZC_MSG).
 /// 0291 <message>.W
 void clif_msg(struct map_session_data* sd, unsigned short id)
@@ -11246,6 +11246,9 @@
        case GC_POISONINGWEAPON:
            skill_poisoningweapon(sd,RFIFOW(fd,2));
            break;
+       case MC_VENDING: // Extended Vending system [Lilith]
+           skill_vending(sd,RFIFOW(fd,2));
+           break;
        case NC_MAGICDECOY:
            skill_magicdecoy(sd,RFIFOW(fd,2));
            break;
@@ -11902,13 +11905,20 @@
 ///     1 = open
 void clif_parse_OpenVending(int fd, struct map_session_data* sd)
 {
+   struct item_data *item = itemdb_exists(sd->vend_loot);
    short len = (short)RFIFOW(fd,2) - 85;
    const char* message = (char*)RFIFOP(fd,4);
    bool flag = (bool)RFIFOB(fd,84);
    const uint8* data = (uint8*)RFIFOP(fd,85);
+   char out_msg[1024];
 
    if( !flag )
        sd->state.prevend = 0;
+       
+   if(battle_config.extended_vending && battle_config.show_item_vending && sd->vend_loot){
+       memset(out_msg, '\0', sizeof(out_msg));
+       strcat(strcat(strcat(strcat(out_msg,"["),item->jname),"] "),message);
+   }
 
    if( sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOROOM )
        return;
@@ -11924,7 +11934,10 @@
    if( message[0] == '\0' ) // invalid input
        return;
 
-   vending_openvending(sd, message, data, len/8);
+   if(battle_config.extended_vending && battle_config.show_item_vending && sd->vend_loot)
+       vending_openvending(sd, out_msg, data, len/8);
+   else
+       vending_openvending(sd, message, data, len/8);
 }
 
 
@@ -16203,6 +16216,50 @@
    WFIFOSET(fd, packet_len(0x7e2));
 #endif
 }
+
+
+/**
+ * Extended Vending system [Lilith] 
+ **/
+int clif_vend(struct map_session_data *sd, int skill_lv) {
+
+   struct item_data *item;
+   int c, i, d = 0;
+   int fd;
+
+   nullpo_ret(sd);
+   
+   fd = sd->fd;
+   WFIFOHEAD(fd, 8 * 8 + 8);
+   WFIFOW(fd,0) = 0x1ad;
+   if(battle_config.item_zeny){
+       WFIFOW(fd, d * 2 + 4) = ITEMID_ZENY;
+       d++;
+   }
+   if(battle_config.item_cash){
+       WFIFOW(fd, d * 2 + 4) = ITEMID_CASH;
+       d++;
+   }
+   for( c = d, i = 0; i < ARRAYLENGTH(item_vend); i ++ ) {
+       if((item = itemdb_exists(item_vend[i].itemid)) != NULL && 
+           item->nameid != ITEMID_ZENY && item->nameid != ITEMID_CASH){
+           WFIFOW(fd, c * 2 + 4) = item->nameid;
+           c++;
+       }
+   }
+   if( c > 0 ) {
+       sd->menuskill_id = MC_VENDING;
+       sd->menuskill_val = skill_lv;
+       WFIFOW(fd,2) = c * 2 + 4;
+       WFIFOSET(fd, WFIFOW(fd, 2));
+   } else {
+       clif_skill_fail(sd,MC_VENDING,USESKILL_FAIL_LEVEL,0);
+       return 0;
+   }
+
+   return 1;
+}
+
 /*==========================================
  * used by SC_AUTOSHADOWSPELL
  * RFIFOL(fd,2) - flag (currently not used)
Index: map/clif.h
===================================================================
--- map/clif.h  (revision 17327)
+++ map/clif.h  (working copy)
@@ -783,4 +783,11 @@
 
 #define clif_menuskill_clear(sd) (sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0;
 
+/**
+ * Extended Vending system [Lilith]
+ **/
+int clif_vend(struct map_session_data *sd, int skill_lv);
+#define VEND_COLOR 0x00FFFF // Cyan
+
+
 #endif /* _CLIF_H_ */
Index: map/itemdb.c
===================================================================
--- map/itemdb.c    (revision 17327)
+++ map/itemdb.c    (working copy)
@@ -927,8 +927,33 @@
    return;
 }
 
+/**
+ * Extended Vending system [Lilith]
+ **/
+static bool itemdb_read_vending(char* fields[], int columns, int current)
+{
+   struct item_data* id;
+   int nameid;
+ 
+   nameid = atoi(fields[0]);
 
+   if( ( id = itemdb_exists(nameid) ) == NULL )
+   {
+       ShowWarning("itemdb_read_vending: Invalid item id %d.\n", nameid);
+       return false;
+   }
 
+   if( id->type == IT_ARMOR || id->type == IT_WEAPON )
+   {
+       ShowWarning("itemdb_read_vending: item id %d cannot be equipment or weapon.\n", nameid);
+       return false;
+   }
+
+   item_vend[current].itemid = nameid;
+
+   return true;
+}
+
 /*======================================
  * Applies gender restrictions according to settings. [Skotlex]
  *======================================*/
@@ -1341,6 +1366,7 @@
    sv_readdb(db_path, "item_delay.txt",         ',', 2, 2, -1, &itemdb_read_itemdelay);
    sv_readdb(db_path, "item_stack.txt",         ',', 3, 3, -1, &itemdb_read_stack);
    sv_readdb(db_path, DBPATH"item_buyingstore.txt",   ',', 1, 1, -1, &itemdb_read_buyingstore);
+   sv_readdb(db_path, "item_vending.txt", ',', 1, 1, ARRAYLENGTH(item_vend), &itemdb_read_vending); // Extended Vending system [Lilith]
    sv_readdb(db_path, "item_nouse.txt",         ',', 3, 3, -1, &itemdb_read_nouse);
 
    itemdb_uid_load();
@@ -1410,6 +1436,7 @@
    itemdb_other->clear(itemdb_other, itemdb_final_sub);
 
    memset(itemdb_array, 0, sizeof(itemdb_array));
+   memset(item_vend,0,sizeof(item_vend)); // Extended Vending system [Lilith]
        
    // read new data
    itemdb_read();
Index: map/itemdb.h
===================================================================
--- map/itemdb.h    (revision 17327)
+++ map/itemdb.h    (working copy)
@@ -165,6 +165,11 @@
    bool isRef;/* whether this struct is a reference or the master */
 };
 
+struct s_item_vend{
+   int itemid;
+};
+struct s_item_vend item_vend[MAX_INVENTORY];
+
 struct item_data* itemdb_searchname(const char *name);
 int itemdb_searchname_array(struct item_data** data, int size, const char *str);
 struct item_data* itemdb_load(int nameid);
@@ -236,4 +241,10 @@
 void do_final_itemdb(void);
 int do_init_itemdb(void);
 
+/**
+ * Extended Vending system [Lilith]
+ **/
+#define ITEMID_ZENY battle_config.item_zeny
+#define ITEMID_CASH battle_config.item_cash
+
 #endif /* _ITEMDB_H_ */
Index: map/skill.c
===================================================================
--- map/skill.c (revision 17327)
+++ map/skill.c (working copy)
@@ -6219,12 +6219,46 @@
 
    case MC_VENDING:
        if(sd)
-       {   //Prevent vending of GMs with unnecessary Level to trade/drop. [Skotlex]
-           if ( !pc_can_give_items(sd) )
-               clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
-           else {
-               sd->state.prevend = 1;
-               clif_openvendingreq(sd,2+skill_lv);
+       {   
+           if ( !pc_can_give_items(sd) ) //Prevent vending of GMs with unnecessary Level to trade/drop. [Skotlex]
+               clif_skill_fail(sd,MC_VENDING,USESKILL_FAIL_LEVEL,0);
+           else { // Extended Vending system [Lilith]
+               if(battle_config.extended_vending){
+                   struct item_data *item;
+                   char output[1024];
+                   int c = 0, i, d = 0;
+                   
+                   sd->vend_lvl = skill_lv;
+                   if(battle_config.item_zeny)
+                       d++;
+                   if(battle_config.item_cash)
+                       d++;
+                   for( c = d, i = 0; i < ARRAYLENGTH(item_vend); i ++ ) {
+                       if((item = itemdb_exists(item_vend[i].itemid)) != NULL && 
+                           item->nameid != ITEMID_ZENY && item->nameid != ITEMID_CASH)
+                           c++;
+                   }
+                   
+                   if(c > 1)
+                       clif_vend(sd,sd->vend_lvl);
+                   else { 
+                       sd->state.prevend = 1;
+                       if(c) {
+                           item = itemdb_exists(battle_config.item_zeny?battle_config.item_zeny:battle_config.item_cash?battle_config.item_cash:item_vend[0].itemid);
+                           sd->vend_loot = item->nameid;
+                           sprintf(output,msg_txt(sd,706),itemdb_jname(sd->vend_loot));
+                           clif_colormes(sd,VEND_COLOR,output);
+                           clif_openvendingreq(sd,2+sd->vend_lvl);
+                       } else {
+                           sd->vend_loot = 0;
+                           clif_openvendingreq(sd,2+sd->vend_lvl);
+                       }
+                   }
+               } else {
+                   sd->vend_loot = 0;
+                   sd->state.prevend = 1;
+                   clif_openvendingreq(sd,2+skill_lv);
+               }
            }
        }
        break;
@@ -15732,6 +15766,40 @@
 }
 
 /**
+ * Extended Vending system [Lilith]
+ **/
+int skill_vending( struct map_session_data *sd, int nameid) {
+
+   struct item_data *item;
+   char output[1024];
+   
+   nullpo_ret(sd);
+
+   if( nameid <= 0) {
+       clif_skill_fail(sd,MC_VENDING,USESKILL_FAIL_LEVEL,0);
+       return 0;
+   }
+   
+   if( nameid > MAX_ITEMDB )
+       return 0;
+       
+   sd->vend_loot = nameid;
+   item = itemdb_exists(nameid);
+   
+   sprintf(output,msg_txt(sd,704),item->jname);
+   clif_colormes(sd,VEND_COLOR,output);
+
+   if ( !pc_can_give_items(sd) )
+       clif_skill_fail(sd,MC_VENDING,USESKILL_FAIL_LEVEL,0);
+   else {
+       sd->state.prevend = 1;
+       clif_openvendingreq(sd,2+sd->vend_lvl);
+   }
+   
+   return 0;
+}
+
+/**
  * @see DBApply
  */
 static int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap)
Index: map/skill.h
===================================================================
--- map/skill.h (revision 17327)
+++ map/skill.h (working copy)
@@ -66,7 +66,7 @@
    INF2_GUILD_ONLY     = 0x0800,
    INF2_NO_ENEMY       = 0x1000,
    INF2_NOLP           = 0x2000, // Spells that can ignore Land Protector
-   INF2_CHORUS_SKILL   = 0x4000, // Chorus skill
+   INF2_CHORUS_SKILL   = 0x4000, // Chorus skill
 };
 
 //Walk intervals at which chase-skills are attempted to be triggered.
@@ -1900,4 +1900,9 @@
 void skill_combo_toogle_inf(struct block_list* bl, uint16 skill_id, int inf);
 void skill_combo(struct block_list* src,struct block_list *dsrc, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int tick);
 
+/**
+ * Extended Vending system [Lilith]
+ **/
+int skill_vending( struct map_session_data *sd, int nameid);
+
 #endif /* _SKILL_H_ */
Index: map/vending.c
===================================================================
--- map/vending.c   (revision 17327)
+++ map/vending.c   (working copy)
@@ -48,6 +48,7 @@
 void vending_vendinglistreq(struct map_session_data* sd, int id)
 {
    struct map_session_data* vsd;
+   char output[1024]; // Extended Vending system [Lilith]
    nullpo_retv(sd);
 
    if( (vsd = map_id2sd(id)) == NULL )
@@ -61,6 +62,14 @@
        return;
    }
 
+   /**
+    * Extended Vending system [Lilith]
+    **/
+   if(battle_config.extended_vending && vsd->vend_loot){
+       sprintf(output,msg_txt(sd,705),vsd->status.name, itemdb_jname(vsd->vend_loot));
+       clif_colormes(sd,VEND_COLOR,output);
+   }
+
    sd->vended_id = vsd->vender_id;  // register vending uid
 
    clif_vendinglist(sd, id, vsd->vending);
@@ -122,15 +131,62 @@
            vend_list[i] = j;
 
        z += ((double)vsd->vending[j].value * (double)amount);
-       if( z > (double)sd->status.zeny || z < 0. || z > (double)MAX_ZENY )
-       {
-           clif_buyvending(sd, idx, amount, 1); // you don't have enough zeny
-           return;
-       }
-       if( z + (double)vsd->status.zeny > (double)MAX_ZENY && !battle_config.vending_over_max )
-       {
-           clif_buyvending(sd, idx, vsd->vending[j].amount, 4); // too much zeny = overflow
-           return;
+       /**
+        * Extended Vending system [Lilith]
+        **/
+       if(battle_config.extended_vending){
+           if(vsd->vend_loot == ITEMID_ZENY || !vsd->vend_loot) {
+               if( z > (double)sd->status.zeny || z < 0. || z > (double)MAX_ZENY )
+               {
+                   //clif_buyvending(sd, idx, amount, 1); // you don't have enough zeny
+                   return;
+               }
+               if( z + (double)vsd->status.zeny > (double)MAX_ZENY && !battle_config.vending_over_max )
+               {
+                   clif_buyvending(sd, idx, vsd->vending[j].amount, 4); // too much zeny = overflow
+                   return;
+       
+               }
+           } else if(vsd->vend_loot == ITEMID_CASH){
+               if(z > sd->cashPoints || z < 0. || z > (double)MAX_ZENY ) {
+                   clif_colormes(sd,VEND_COLOR,msg_txt(sd,700));
+                   return;
+               }
+           } else {
+               int k, loot_count = 0, vsd_w = 0;
+               for(k = 0; k < MAX_INVENTORY; k++)
+                   if(sd->status.inventory[k].nameid == vsd->vend_loot)
+                       loot_count += sd->status.inventory[k].amount;
+                       
+               if( z > loot_count || z < 0)
+               {
+                   clif_colormes(sd,VEND_COLOR,msg_txt(sd,701));
+                   return;
+               }
+               if(pc_inventoryblank(vsd) <= 0)
+               {
+                   clif_colormes(sd,VEND_COLOR,msg_txt(sd,702));
+                   return;
+               }
+               vsd_w += itemdb_weight(vsd->vend_loot) * (int)z;
+               if(vsd_w + vsd->weight > vsd->max_weight)
+               {
+                   clif_colormes(sd,VEND_COLOR,msg_txt(sd,703));
+                   return;
+               }
+ 
+           }
+       } else {
+           if( z > (double)sd->status.zeny || z < 0. || z > (double)MAX_ZENY )
+           {
+               clif_buyvending(sd, idx, amount, 1); // you don't have enough zeny
+               return;
+           }
+           if( z + (double)vsd->status.zeny > (double)MAX_ZENY && !battle_config.vending_over_max )
+           {
+               clif_buyvending(sd, idx, vsd->vending[j].amount, 4); // too much zeny = overflow
+               return;
+           }
 
        }
        w += itemdb_weight(vsd->status.cart[idx].nameid) * amount;
@@ -167,18 +223,55 @@
            return; //too many items
        }
    }
+   
+   /**
+    * Extended Vending system [Lilith]
+    **/
+   if(battle_config.extended_vending){
+       if(vsd->vend_loot == ITEMID_ZENY || !vsd->vend_loot) {
+       
+           //Logs (V)ending Zeny [Lupus]
+       
+           pc_payzeny(sd, (int)z, LOG_TYPE_VENDING, vsd);
+           if( battle_config.vending_tax )
+           z -= z * (battle_config.vending_tax/10000.);
+           pc_getzeny(vsd, (int)z, LOG_TYPE_VENDING, sd);
+           
+       } else if(vsd->vend_loot == ITEMID_CASH) {
+           pc_paycash(sd,(int)z,0,LOG_TYPE_COMMAND);
+           pc_getcash(vsd,(int)z,0,LOG_TYPE_COMMAND);
+       } else {
+           for( i = 0; i < MAX_INVENTORY; i++)
+               if(sd->status.inventory[i].nameid == vsd->vend_loot)
+               {
+                   struct item *item;
+                   item = &sd->status.inventory[i];
+                   pc_additem(vsd,item,(int)z, LOG_TYPE_VENDING);
+               }
+           pc_delitem(sd,pc_search_inventory(sd, vsd->vend_loot),(int)z,0,6, LOG_TYPE_VENDING);
+           
+       }
+   } else {
+       //Logs (V)ending Zeny [Lupus]
+           pc_payzeny(sd, (int)z, LOG_TYPE_VENDING, vsd);
+       if( battle_config.vending_tax )
+           z -= z * (battle_config.vending_tax/10000.);
+       pc_getzeny(vsd, (int)z, LOG_TYPE_VENDING, sd);
+   }
 
-   pc_payzeny(sd, (int)z, LOG_TYPE_VENDING, vsd);
-   if( battle_config.vending_tax )
-       z -= z * (battle_config.vending_tax/10000.);
-   pc_getzeny(vsd, (int)z, LOG_TYPE_VENDING, sd);
-
    for( i = 0; i < count; i++ )
    {
        short amount = *(uint16*)(data + 4*i + 0);
        short idx    = *(uint16*)(data + 4*i + 2);
+       const char *item_name;
+       double rev = 0.;
        idx -= 2;
 
+       if(battle_config.ex_vending_info){ // Extended Vending system [Lilith]
+           item_name = itemdb_jname(vsd->status.cart[idx].nameid);
+           rev = ((double)vsd->vending[vend_list[i]].value * (double)amount);
+       }
+
        // vending item
        pc_additem(sd, &vsd->status.cart[idx], amount, LOG_TYPE_VENDING);
        vsd->vending[vend_list[i]].amount -= amount;
@@ -189,11 +282,20 @@
        if( battle_config.buyer_name )
        {
            char temp[256];
-           sprintf(temp, msg_txt(sd,265), sd->status.name);
+           if(battle_config.ex_vending_info) // Extended Vending system [Lilith]
+               sprintf(temp, msg_txt(sd,707), sd->status.name, item_name, amount, (int)(rev -= rev * (battle_config.vending_tax/10000.)), vsd->vend_loot?itemdb_jname(vsd->vend_loot):"Zeny");
+           else
+               sprintf(temp, msg_txt(sd,265), sd->status.name);            
            clif_disp_onlyself(vsd,temp,strlen(temp));
        }
    }
 
+   if(battle_config.ex_vending_info){ // Extended Vending system [Lilith]
+       char temp[256];
+       sprintf(temp, msg_txt(sd,708), sd->status.name, (int)z, vsd->vend_loot?itemdb_jname(vsd->vend_loot):"Zeny");
+       clif_disp_onlyself(vsd,temp,strlen(temp));
+   }
+
    // compact the vending list
    for( i = 0, cursor = 0; i < vsd->vend_num; i++ )
    {
Index: map/battleground.h
===================================================================
--- map/battleground.h  (revision 17327)
+++ map/battleground.h  (working copy)
@@ -7,7 +7,7 @@
 #include "../common/mmo.h" // struct party
 #include "guild.h"
 
-#define MAX_BG_MEMBERS 30
+#define MAX_BG_MEMBERS 200
 
 struct battleground_member_data {
    unsigned short x, y;
Index: map/mob.h
===================================================================
--- map/mob.h   (revision 17327)
+++ map/mob.h   (working copy)
@@ -16,7 +16,7 @@
 // Change this to increase the table size in your mob_db to accomodate a larger mob database.
 // Be sure to note that IDs 4001 to 4048 are reserved for advanced/baby/expanded classes.
 // Notice that the last 1000 entries are used for player clones, so always set this to desired value +1000
-#define MAX_MOB_DB 5000
+#define MAX_MOB_DB 10000
 
 //The number of drops all mobs have and the max drop-slot that the steal skill will attempt to steal from.
 #define MAX_MOB_DROP 10
Index: map/script.c
===================================================================
--- map/script.c    (revision 17327)
+++ map/script.c    (working copy)
@@ -17678,6 +17678,81 @@
    return 0;
 }
 
+// createbgid <respawn map>, <respawn x>, <respawn y>, <On Quit event>, <On Death event>;
+BUILDIN_FUNC(createbgid) {
+   unsigned int bg_id;
+   if ( ( bg_id = bg_create( mapindex_name2id( script_getstr(st,2) ), script_getnum(st,3), script_getnum(st,4), script_getstr(st,5), script_getstr(st,6) ) ) > 0 )
+       script_pushint( st, bg_id );
+   else
+       script_pushint( st, 0 );
+   return 0;
+}
+
+// setbgid <battleground ID> {, <player name> };
+// setbgid <battleground ID> {, <player account ID> };
+BUILDIN_FUNC(setbgid) {
+   unsigned int bg_id = script_getnum(st,2);
+   struct battleground_data *bg = bg_team_search( bg_id );
+   struct map_session_data *sd;
+   if ( script_hasdata( st, 3 ) ) {
+       if ( data_isstring( script_getdata(st,3) ) )
+           sd = map_nick2sd( script_getstr(st,3) );
+       else
+           sd = map_id2sd( script_getnum(st,3) );
+   } else
+       sd = script_rid2sd(st);
+   if ( !sd ) {
+       script_pushint( st, -3 ); // player no attach
+       return 0;
+   }
+   if ( !bg && bg_id > 0 ) {
+       script_pushint( st, -1 ); // battleground team haven't created
+       return 0;
+   }
+   if ( bg_id && sd->bg_id == bg_id ) {
+       script_pushint( st, -5 ); // the player has already join this battleground team
+       return 0;
+   }
+   if ( sd->bg_id )
+       bg_team_leave( sd, 0 );
+   if ( bg_id == 0 ) {
+       script_pushint( st, 0 );
+       return 0;
+   }
+   if ( !bg_team_join( bg_id, sd ) )
+       script_pushint( st, -2 ); // cannot join anymore, because has reached MAX_BG_MEMBERS
+   else
+       script_pushint( st, bg_id );
+   return 0;
+}
+
+// getbgusers <battleground ID>;
+BUILDIN_FUNC(getbgusers) {
+   struct battleground_data *bg = bg_team_search( script_getnum(st,2) );
+   int i;
+   if ( !bg ) {
+       script_pushint( st, -1 );
+       return 0;
+   }
+   for ( i = 0; bg->members[i].sd; i++ )
+       mapreg_setreg( reference_uid( add_str("$@arenamembers"), i ), bg->members[i].sd->bl.id );
+   mapreg_setreg( add_str("$@arenamembersnum"), i );
+   script_pushint( st, i );
+   return 0;
+}
+
+// bg_kickall <battleground ID>;
+BUILDIN_FUNC(bg_kickall) {
+   struct battleground_data *bg = bg_team_search( script_getnum(st,2) );
+   int i;
+   if ( bg ) {
+       for ( i = 0; bg->members[i].sd; i++ )
+           bg_team_leave( bg->members[i].sd , 0 );
+   }
+   return 0;
+}
+
+
 // declarations that were supposed to be exported from npc_chat.c
 #ifdef PCRE_SUPPORT
 BUILDIN_FUNC(defpattern);
@@ -18144,5 +18219,9 @@
    BUILDIN_DEF(checkquest, "i?"),
    BUILDIN_DEF(changequest, "ii"),
    BUILDIN_DEF(showevent, "ii"),
+   BUILDIN_DEF(createbgid,"siiss"),
+   BUILDIN_DEF(setbgid,"i?"),
+   BUILDIN_DEF(getbgusers,"i"),
+   BUILDIN_DEF(bg_kickall,"i"),
    {NULL,NULL,NULL},
-};
+};
\ No newline at end of file
Index: map/battle.c
===================================================================
--- map/battle.c    (revision 17327)
+++ map/battle.c    (working copy)
@@ -5931,6 +5931,11 @@
    { "atcommand_max_stat_bypass",          &battle_config.atcommand_max_stat_bypass,       0,      0,      100,            },
    { "skill_amotion_leniency",             &battle_config.skill_amotion_leniency,          90,     0,      300             },
    { "mvp_tomb_enabled",                   &battle_config.mvp_tomb_enabled,                1,      0,      1               },
+   { "extended_vending",                   &battle_config.extended_vending,                1,      0,      1,              },
+   { "show_item_vending",                  &battle_config.show_item_vending,               1,      0,      1,              },
+   { "ex_vending_info",                    &battle_config.ex_vending_info,                 1,      0,      1,              },
+   { "item_zeny",                          &battle_config.item_zeny,                       0,      0,      MAX_ITEMDB,  },
+   { "item_cash",                          &battle_config.item_cash,                       0,      0,      MAX_ITEMDB,  },
    { "feature.atcommand_suggestions",      &battle_config.atcommand_suggestions_enabled,   0,      0,      1               },
    { "min_npc_vendchat_distance",          &battle_config.min_npc_vendchat_distance,       3,      0,      100             },
    { "atcommand_mobinfo_type",             &battle_config.atcommand_mobinfo_type,          0,      0,      1               },
Index: map/battle.h
===================================================================
--- map/battle.h    (revision 17327)
+++ map/battle.h    (working copy)
@@ -488,6 +488,12 @@
    int item_enabled_npc;
    int item_onfloor; // Whether to drop an undroppable item on the map or destroy it if inventory is full.
    int bowling_bash_area;
+   int extended_vending;
+   int show_item_vending;
+   int ex_vending_info;
+   int item_zeny;
+   int item_cash;
+
    } battle_config;
 
 void do_init_battle(void);
Index: map/map.h
===================================================================
--- map/map.h   (revision 17327)
+++ map/map.h   (working copy)
@@ -44,7 +44,7 @@
 #define NATURAL_HEAL_INTERVAL 500
 #define MIN_FLOORITEM 2
 #define MAX_FLOORITEM START_ACCOUNT_NUM
-#define MAX_LEVEL 160
+#define MAX_LEVEL 175
 #define MAX_DROP_PER_MAP 48
 #define MAX_IGNORE_LIST 20 // official is 14
 #define MAX_VENDING 12
Index: common/mmo.h
===================================================================
--- common/mmo.h    (revision 17327)
+++ common/mmo.h    (working copy)
@@ -47,7 +47,7 @@
 // 20120307 - 2012-03-07aRagexeRE+ - 0x970
 
 #ifndef PACKETVER
-   #define PACKETVER 20120410
+   #define PACKETVER 20130320
    //#define PACKETVER 20130320
    //#define PACKETVER 20111116
 #endif
@@ -81,9 +81,9 @@
 #define MAX_ZENY 1000000000
 #define MAX_FAME 1000000000
 #define MAX_CART 100
-#define MAX_SKILL 3100
+#define MAX_SKILL 5100
 #define GLOBAL_REG_NUM 256   // max permanent character variables per char
-#define ACCOUNT_REG_NUM 64   // max permanent local account variables per account
+#define ACCOUNT_REG_NUM 256   // max permanent local account variables per account
 #define ACCOUNT_REG2_NUM 16  // max permanent global account variables per account
 //Should hold the max of GLOBAL/ACCOUNT/ACCOUNT2 (needed for some arrays that hold all three)
 #define MAX_REG_NUM 256
@@ -100,7 +100,7 @@
 #define MAX_GUILDSKILL 15 // increased max guild skills because of new skills [Sara-chan]
 #define MAX_GUILDLEVEL 50
 #define MAX_GUARDIANS 8    //Local max per castle. [Skotlex]
-#define MAX_QUEST_DB 2400 //Max quests that the server will load
+#define MAX_QUEST_DB 10000 //Max quests that the server will load
 #define MAX_QUEST_OBJECTIVES 3 //Max quest objectives for a quest
 
 // for produce
Index: common/msg_conf.h
===================================================================
--- common/msg_conf.h   (revision 17327)
+++ common/msg_conf.h   (working copy)
@@ -22,7 +22,7 @@
 // Multilanguage System.
 // Define which languages to enable (bitmask).
 // 0xFF will enable all, while 0x00 will enable English only.
-#define LANG_ENABLE 0x00
+#define LANG_ENABLE 0x40
 
 //read msg in table
 const char* _msg_txt(int msg_number,int size, char ** msg_table);
Index: config/core.h
===================================================================
--- config/core.h   (revision 17327)
+++ 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: config/renewal.h
===================================================================
--- config/renewal.h    (revision 17327)
+++ config/renewal.h    (working copy)
@@ -34,7 +34,7 @@
 /// leave this line to enable renewal item drop rate algorithms
 /// while enabled a special modified based on the difference between the player and monster level is applied
 /// based on the http://irowiki.org/wiki/Drop_System#Level_Factor table
-#define RENEWAL_DROP
+/// #define RENEWAL_DROP
 
 /// renewal exp rate algorithms
 /// (disable by commenting the line)
Viewed 1001 times, submitted by Guest.