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)