prontera,155,196,4	script	Item Mall	4_MAL_KAFRA,{
	if(questprogress(31006) == 1 && countitem(30110) > 0 ) {
		cutin "bu_maggi2",2;
		mes .npc$;
		mes "Greetings! Pleased to met you. I am the Item Mall Manager and it is my great pleasure to introduce to you a whole wonderful world of amazing gears, items and more!";
		next;
		mes .npc$;
		mes "Throughout the world of Midgard, there are many amazing and rare treasures.";
		mes "But I have gone about the task of collecting some of the most unique and wonderful in existence! I always keep my storage full of amazing things such as Headgears, Costumes, Supplies and more!";
		mes "But... I don't accept Zeny for them.";
		mes "Instead, I prefer to be paid in ^003366Donation Credits^000000.";
		next;
		mes .npc$;
		mes "How to get these points?";
		mes "Excellent question!  You can get them through ^003366Donating^000000 or joining Events that may reward ^003366"+getitemname(7179)+"^000000.  These Voucher when use can give your ^0033661,000 Donation Credits^000000.";
		next;
		mes .npc$;
		mes "Shhhhh... I will give you some tips..";
		next;
		mes .npc$;
		mes "You will be rewarded 1 to 3 ^003366"+getitemname(7179)+"^000000 if you belong to Top 10 Weekly MvP Hunters.  So remember that and make it as your goal along the way in your adventure.";
		next; 
		mes .npc$;
		mes "I nearly have all great Headgear Costumes, wonderful boxes of supplies and more!";
		mes "If you have Donation Credits be sure to pay me visit, or stop on by anytime and you can browse all that I have to offer.";
		nov_train3++;
		delitem 30110,countitem(30110);
		switch (BaseLevel){
			case 1: getexp 9,0; break;
			case 2: getexp 16,0; break;
			case 3: getexp 25,0; break;
			case 4: getexp 36,0; break;
			case 5: getexp 77,0; break;
			case 6: getexp 112,0; break;
			case 7: getexp 153,0; break;
			case 8: getexp 200,0; break;
			case 9: getexp 253,0; break;
			case 10: getexp 320,0; break;
			case 11: getexp 385,0; break;
			case 12: getexp 490,0; break;
			case 13: getexp 585,0; break;
			case 14: getexp 700,0; break;
			case 15: getexp 830,0; break;
			case 16: getexp 970,0; break;
			case 17: getexp 1120,0; break;
			case 18: getexp 1260,0; break;
			case 19: getexp 1420,0; break;
		}
		switch (JobLevel) {
			case 1: getexp 0,10; break;
			case 2: getexp 0,18; break;
			case 3: getexp 0,28; break;
			case 4: getexp 0,40; break;
			case 5: getexp 0,91; break;
			case 6: getexp 0,151; break;
			case 7: getexp 0,205; break;
			case 8: getexp 0,258; break;
			case 9: getexp 0,340; break;
		}	
		if(nov_train3 == 2){
			next;
			mes .npc$;
			mes "Well then, I think that you've completed your mission!";
			mes "Go back to ^ff0000Hannibal^000000 now to continue your training quest";
			completequest(31006);
			setquest(31007);
			cutin "",255;
			close;
		}
		cutin "",255;
		close;			
	}
	cutin "bu_maggi2",2;	
	mes .npc$;
	mes "All items here can avail through donation and patience.";
	mes "You currently have:";
	mes "Credit Points: ^FF0000"+F_InsertComma(callfunc("F_CheckCredit"))+"^000000";
	next;
	switch(select("^FF0000Shop Now^000000","Premium Services","^0000ffClaim Donation^000000")) {
	case 1:
		cutin "",255;
		callfunc "ishop";
		close(); 
	case 2:
		mes .npc$;
		mes "So, Which ^FF0000Premium Services^000000 you would like to look at it";
			switch(select(
			 "- Change Guild Leader:"+
			  ((#mobile)?":":"- Character Rename:")+
	 		 "- ^777777Close^000000"
			)) {
			next;	
			case 1:	// Change GM 24USD = 20000
				if (getcharid(0) != getguildmasterid(getcharid(2))) {
					mes .npc$;
					mes "You are not a guild master.";
					cutin "",255;
					close();
				}
				set .@gldid,getcharid(2);
				mes .npc$;
				query_sql("SELECT `name` , `master` , `guild_lv` FROM `guild` WHERE `guild_id` = '"+.@gldid+"'",.@gname$,.@char$,.@glvl);
				mes "^FF0000Change Guild Master^000000";
				/*
				mes "This service is FREE until 4/14";

				mes "This service will cost you";
				mes "^FF0000 20,000^000000 Credit Points";
				*/
				mes "Information:";
				mes "Guild Name: ^ff0000"+.@gname$+"^000000";
				mes "Guild Level: ^ff0000"+.@glvl+"^000000";
				mes "Guild Master: ^ff0000"+.@char$+"^000000";
				mes "Do you wish to continue changing guild master?";
				next;
				if( select("No", "Yes") == 1 ) {
					cutin "",255;
					close();
				}
				/*
				if(callfunc("F_CheckCredit") < 20000 ) {
					mes .npc$;
					mes "Im sorry, but you don't have enough ^FF0000Credit Points^000000 to process this request.";
					cutin "",255;
					close();
				}
				*/
				mes .npc$;
				mes "^FF0000NOTE^000000:";
				mes "^FF0000-^000000 Double check the spelling.";
				mes "^FF0000-^000000 The character name you";
				mes "  will be providing should";
				mes "  be the NEW guild leader.";
				mes "^FF0000-^000000 New Guild leader should be online.";
				mes "Enter the ^FF0000new^000000 guild leader's name.";
				input .@cgl$;
				next;
				mes .npc$;
				mes "Please ^FF0000re-enter^000000 the name again for confirmation.";
				input .@cgl2$;
				next;

				if (.@cgl$ != .@cgl2$) {
					mes .npc$;
					mes "The names you entered doesn't match.";
					cutin "",255;
					close();
				}
				.@check = query_sql("SELECT `account_id` FROM `char` WHERE `name`='"+escape_sql(.@cgl$)+"'",.@acid);
				if (!.@check){
					mes .npc$;
					mes "Character [ ^FF0000"+.@cgl$+"^000000 ] doesn't exist!";
					cutin "",255;
					close();
				}
				if (.@cgl$ == .@char$) {
					mes .npc$;
					mes "Character [ ^FF0000"+.@cgl$+"^000000 ] is already the leader of [ ^FF0000"+.@gname$+"^000000 ] Guild.";
					cutin "",255;
					close();
				}
				if (!isloggedin(getcharid(3,.@cgl$), getcharid(0,.@cgl$))){
					mes .npc$;
					mes "Character [ ^FF0000"+.@cgl$+"^000000 ] must be online to proceed!";
					cutin "",255;
					close();
				}
				if (getcharid(2,.@cgl$) != .@gldid){
					mes .npc$;
					mes "Character [ ^FF0000"+.@cgl$+"^000000 ] is not a member of [ ^FF0000"+.@gname$+"^000000 ] Guild.";
					cutin "",255;
					close();
				}

				mes .npc$;
				mes "Please confirm the following details before we proceed,";
				mes "Current Leader: ^FF0000"+strcharinfo(PC_NAME)+"^000000";
				mes "New Leader: ^FF0000"+.@cgl$+"^000000";
				mes "Would you like to proceed?";
				next;
				if (select("Close","^FF0000Confirmed^000000!") != 1) {
					close2;
					if (.gcdone == .@gldid){
						if ( .delay > gettimetick(2) ){
							message strcharinfo(0), "Transfer failed!";
							mes .npc$;
							mes "You must wait [^FF0000"+(.delay - gettimetick(2))+"^000000] seconds,";
							mes .@char$+"'s guild has been currently";
							mes "modified and changed their";
							mes "guild leader authority.";
							cutin "",255;
							close();
						}
					}
					
					/*
					callfunc("F_UpdateCredit",-20000);
					logmes "CREDIT: -20000 Change Guild Master";
					*/

					message strcharinfo(0), "You have succesfully transferred the guild!";
					announce strcharinfo(0)+" : The [ "+.@gname$+" ] Guild previously owned by "+.@char$+" succesfully transferred its ownership to "+.@cgl$+"!",bc_all,0xe57c00;
					guildchangegm(.@gldid,.@cgl$);
					.gcdone = .@gldid;
					if (.d)
					.delay = gettimetick(2) + .d;
					sleep2 1000;
					if (isloggedin(getcharid(3,.@cgl$), getcharid(0,.@cgl$))){
						atcommand "@kick "+.@cgl$;
					}
					if (isloggedin(getcharid(3,.@char$), getcharid(0,.@char$))){
						atcommand "@kick "+.@char$;
					}
					end;
				}
				cutin "",255;
				close();

			case 2:
				mes .npc$;
				mes "^FF0000Change Name^000000";
				mes "1. Process payment.";
				mes "2. Char Select.";
				mes "3. Click ^FF0000Rename^000000";
				mes "button.";
				mes "This service will cost you";
				mes "^FF0000 10,000^000000 Credit Points";
				mes "Do you wish to continue?";
				next;
				if( select("No", "Yes") == 1 )
					cutin "",255;
					close();

				if(callfunc("F_CheckCredit") < 10000 ) {
					mes .npc$;
					mes "Im sorry, but you don't have enough ^FF0000Credit Points^000000 to process this request.";
					cutin "",255;
					close();
				}

				callfunc("F_UpdateCredit",-10000);
				logmes "CREDIT: -10000 Change Name";

				CharRename += 1;
				mes .npc$;
				mes "Done";
				mes "You will need to character select and click ^FF0000Rename^000000 button.";
				mes "Thank you for using this service.";
				cutin "",255;
				close();
			case 3:
				mes .npc$;
				cutin "",255;
				close();

			default:
				mes .npc$;
				mes "Invalid Menu Selection for Menu. Inform this Message to ^0000FFGame Staffs^000000 immediately !";
				cutin "",255;
				close();	
		}
	case 3:	// Claim Donation
		.@balance = 0;
		query_sql("SELECT `balance` FROM `cp_credits` WHERE `account_id` = '"+getcharid(3)+"'",.@balance);
		mes .npc$;
		if (.@balance < 1) { mes "^FF0000You have no pending donation credits available for claim.^000000"; cutin "",255; close; }
		mes "^0000ffYou have:^000000 ";
		mes " Donation Credits: ^FF0000"+F_InsertComma(.@balance)+"^000000";
		mes "^FF0000Do you want to claim now?^000000";
		next;
		switch(select("No","Yes"))
		{
			case 1: 	
				cutin "",255;
				close;
			case 2: 
				mes .npc$;
				.@p = .@balance/1000;
				getitem 7179,.@balance/1000; logmes "CREDIT: -"+.@balance/1000+" CREDIT TO VOUCHER";
				query_sql "update `cp_credits` set `balance` = `balance` - "+ (.@balance) +" where `account_id` = '"+getcharid(3)+"'";
			/*
				if (.@p == 10) {
					getitem 7179,2; logmes "CREDIT: +2 CV BONUS";
				} else if ( .@p == 17) {
					getitem 7179,4; logmes "CREDIT: +4 CV BONUS";
				} else if ( .@p == 26) {
					getitem 7179,6; logmes "CREDIT: +6 CV BONUS";
				} else if ( .@p == 36) {
					getitem 7179,8; logmes "CREDIT: +8 CV BONUS";
				} else if ( .@p == 45) {
					getitem 30035,1; logmes "CREDIT: +1x Skill Reset Coupon";
				} else if ( .@p == 120) {
					getitem 30033,1; logmes "CREDIT: +1x Stat & Skill Reset Coupon";
				}
			*/
				mes "Thank you for using this service.";
				cutin "",255;
				close;
	
			default:
				cutin "",255;
				close;
		}
		cutin "",255;
		close;
		
		
	default:
		cutin "",255;
		close();
	}
OnInit:
	questinfo(QTYPE_JOB, 1);
	setquestinfo(QINFO_JOB, Job_Novice);
	setquestinfo(QINFO_QUEST, 31006, 1);
	setquestinfo(QINFO_ITEM, 30110, 1,1);
	.npc$ = "[ ^ff0000Item Mall^000000 ]";
	end;
}

// Script Core
//============================================================
-	script	i_shop	FAKE_NPC,{
function Add; function Chk; function Slot; function A_An;
OnInit:
	
	freeloop(1);

// -----------------------------------------------------------
//  Basic shop settings.
// -----------------------------------------------------------

	set .Announce,0;	// Announce quest completion? (1: yes / 0: no)
	set .ShowSlot,1;	// Show item slots? (2: all equipment / 1: if slots > 0 / 0: never)
	set .ShowID,1;  	// Show item IDs? (1: yes / 0: no)
	set .ShowZeny,1;	// Show Zeny cost, if any? (1: yes / 0: no)
	set .MaxStack,1;	// Max number of quest items purchased at one time.

// -----------------------------------------------------------
//  Points variable -- optional quest requirement.
//	setarray .points$[0],"<variable name>","<display name>";
// -----------------------------------------------------------

	setarray .points$[0],"#CASHPOINTS","Credit Points";

// -----------------------------------------------------------
//  Shop IDs -- to add shops, copy dummy data at bottom of file.
//	setarray .iShops$[1],"<Shop 1>","<Shop 2>"{,...};
// -----------------------------------------------------------

	setarray .iShops$[1],"What's New","Usables","Garment Costumes","Top Costumes","Mid Costumes","Lower Costumes","Rentals","Regular Headgears","Accessories";

// -----------------------------------------------------------
//  Quest items -- do NOT use a reward item more than once!
//	Add(<shop ID>,<reward ID>,<reward amount>,
//	    <Zeny cost>,<point cost>,
//	    <required item ID>,<required item amount>{,...});
// -----------------------------------------------------------

/* What's New */
Add(1,7619,1,0,2000);
Add(1,7620,1,0,1000);
Add(1,30113,1,0,4000);
Add(1,30114,1,0,12000);
Add(1,7776,1,0,2000);

// Usables
Add(2,7619,1,0,2000);
Add(2,7620,1,0,1000);
Add(2,30113,1,0,4000);
Add(2,30114,1,0,12000);
Add(2,7776,1,0,2000);
Add(2,13823,1,0,100);
Add(2,30021,1,0,100);
Add(2,30007,1,0,100);
Add(2,30008,1,0,150);
Add(2,12412,1,0,1000);
Add(2,12210,1,0,800);
Add(2,12211,1,0,100);
Add(2,12212,1,0,100);
Add(2,12216,1,0,100);
Add(2,12215,1,0,100);
Add(2,7621,1,0,100);
Add(2,14533,1,0,250);
Add(2,14545,1,0,800);
Add(2,12209,1,0,100);
Add(2,30009,1,0,9000);
Add(2,12902,1,0,7000);
Add(2,12909,1,0,900);
Add(2,12910,1,0,900);
Add(2,12911,1,0,12000);
Add(2,12914,1,0,900);
Add(2,14169,1,0,900);
Add(2,12922,1,0,900);
Add(2,13696,1,0,2000);
Add(2,13758,1,0,7000);
Add(2,14157,1,0,900);
Add(2,14289,1,0,15000);
Add(2,13870,1,0,15000);
Add(2,30022,1,0,15000);

// Wings
/* 2018-03-26 */
Add(3,20500,1,0,26000);
/* 2018-03-03 */
Add(3,20509,1,0,26000);
/* 2018-01-31 */
Add(3,20502,1,0,26000);
Add(3,20504,1,0,26000);
/* 2018-01-15 */
Add(3,20762,1,0,26000);
Add(3,20764,1,0,26000);
/* Initial Release */
Add(3,20737,1,0,26000);
Add(3,20746,1,0,26000);
Add(3,20761,1,0,26000);
/*
Add(3,20763,1,0,26000);
Add(3,20507,1,0,26000);
*/

// Top Costumes
/* 2018-06-12 */
Add(4,30038,1,0,10000); //up
Add(4,30039,1,0,10000); //up
Add(4,30040,1,0,10000); // up
Add(4,30042,1,0,10000); // up
Add(4,30043,1,0,10000); // up
Add(4,30048,1,0,10000); // up
Add(4,30049,1,0,10000); //up
Add(4,30050,1,0,10000); // up
Add(4,30052,1,0,10000); //up
Add(4,30055,1,0,10000);  // up

/* 2018-04-10 */
Add(4,20285,1,0,12000);
Add(4,19970,1,0,10000);
Add(4,19966,1,0,10000);
Add(4,20175,1,0,10000);
/* 2018-03-27 */
Add(4,20101,1,0,6000);
Add(4,20103,1,0,6000);
Add(4,5420,1,0,11000);
Add(4,20130,1,0,8000);
/* 2018-01-31 */
Add(4,18740,1,0,10000);
Add(4,20407,1,0,10000);
Add(4,20780,1,0,10000);
Add(4,20601,1,0,10000);

/* 2018-01-15 */
Add(4,20449,1,0,10000);
Add(4,20219,1,0,10000);
Add(4,20099,1,0,10000);
Add(4,20053,1,0,10000);
Add(4,19750,1,0,10000);
Add(4,18539,1,0,10000);
Add(4,18562,1,0,10000);
Add(4,18651,1,0,10000);
/* Initial Release */
Add(4,18741,1,0,10000);
Add(4,20204,1,0,10000);
Add(4,20227,1,0,10000);
Add(4,19968,1,0,10000);
Add(4,19836,1,0,10000);
Add(4,19729,1,0,10000);
Add(4,19707,1,0,10000);
Add(4,19706,1,0,10000);
Add(4,20284,1,0,10000);
Add(4,19677,1,0,10000);
Add(4,19914,1,0,10000);

// Middle Costumes
/* 2018-06-12 */
Add(5,30051,1,0,4000); //mid
Add(5,30056,1,0,4000);  // mid

/* 2018-03-27 */
Add(5,5102,1,0,4000);
/* 2018-01-15 */
Add(5,20318,1,0,10000);
Add(5,20399,1,0,10000);
Add(5,5985,1,0,9000);
Add(5,20270,1,0,9000);
Add(5,19742,1,0,9000);
/* Initial Release */
Add(5,19871,1,0,10000);
Add(5,20314,1,0,9000);
Add(5,20430,1,0,10000);
Add(5,20147,1,0,9000);
Add(5,19158,1,0,9000);

// Lower Costumes
/* 2018-06-12 */
Add(6,30036,1,0,2000); //low
Add(6,30037,1,0,2000); //low
Add(6,30041,1,0,2000); // low
Add(6,30046,1,0,2000); // low
Add(6,30047,1,0,2000); // low
Add(6,30054,1,0,2000); //low

/* 2018-01-31 */
Add(6,20289,1,0,2000);
Add(6,20290,1,0,2000);
Add(6,20291,1,0,2000);
Add(6,20292,1,0,2000);
Add(6,20293,1,0,2000);
Add(6,20294,1,0,2000);
Add(6,20752,1,0,2000);
Add(6,20753,1,0,2000);
Add(6,20754,1,0,2000);
Add(6,20755,1,0,2000);
Add(6,20756,1,0,2000);
Add(6,20757,1,0,2000);

/* 2018-01-15 */
Add(6,19566,1,0,4000);
Add(6,18746,1,0,5000);
Add(6,20448,1,0,5000);
Add(6,20440,1,0,5000);
/* Initial Release */
Add(6,20315,1,0,4000);
Add(6,20034,1,0,4000);
Add(6,20202,1,0,4000);
Add(6,20132,1,0,4000);
Add(6,20405,1,0,4000);

// Rental
Add(7,12947,1,0,2500);	// Apple Archer Box
Add(7,12948,1,0,2500);	// Bunny Band Box
Add(7,12949,1,0,2500);	// Sakkat Box
Add(7,12950,1,0,2500);	// Grand Circlet Box
Add(7,12951,1,0,2500);	// Elven Ears
Add(7,12952,1,0,2500);	// Steel Flower
Add(7,13502,1,0,2500);	// Drooping Ears
Add(7,13503,1,0,2500);	// Baphomet
Add(7,13504,1,0,2500);	// Deviruchi
Add(7,12953,1,0,1200);	// Critical Ring
Add(7,12954,1,0,1200);	// Earring
Add(7,12955,1,0,1200);	// Ring
Add(7,12956,1,0,1200);	// Neclace
Add(7,12957,1,0,1200);	// Gloves
Add(7,12958,1,0,1200);	// Brooch
Add(7,12959,1,0,1200);	// Rosary
Add(7,12960,1,0,1200);	// Safety Ring
Add(7,14017,1,0,1200);	// All in 1
/* Hair Extension */
Add(7,20626,1,0,500);
Add(7,20627,1,0,500);
Add(7,20628,1,0,500);
Add(7,20629,1,0,500);
Add(7,20630,1,0,500);
Add(7,20631,1,0,500);
Add(7,20632,1,0,500);
Add(7,20633,1,0,500);
Add(7,20634,1,0,500);
Add(7,20635,1,0,500);
Add(7,20636,1,0,500);
Add(7,20637,1,0,500);
Add(7,20638,1,0,500);
Add(7,20639,1,0,500);
Add(7,20640,1,0,500);
Add(7,20641,1,0,500);
Add(7,20642,1,0,500);
Add(7,20643,1,0,500);
Add(7,20644,1,0,500);
Add(7,20645,1,0,500);
Add(7,20646,1,0,500);
Add(7,20647,1,0,500);
Add(7,20648,1,0,500);
Add(7,20649,1,0,500);


// Regular Headgears
/* 2018-03-27 */
Add(8,5135,1,0,4000);
Add(8,5376,1,0,8000);
/* 25-02-2018 Release */
Add(8,5311,1,0,6000);	// Large Hisbiscus
Add(8,5372,1,0,4000);	// Koneko Hat
Add(8,5211,1,0,6000);	// Dress Hat
Add(8,5230,1,0,3000);	// Gray Drooping Cat
Add(8,5770,1,0,6000);	// Splash Hat
Add(8,5315,1,0,6000);	// Observer
Add(8,5789,1,0,6000);	// Thanatos Mal Mask
Add(8,5594,1,0,4000);	// Donut In Mouth
Add(8,18642,1,0,4000);	// Scissorhand Model
Add(8,18643,1,0,4000);	// Rockhand Model
Add(8,18644,1,0,4000);	// Paperhand Model
Add(8,18612,1,0,6000);	// White Musang Hat
Add(8,18613,1,0,6000);	// Black Musang Hat
Add(8,5767,1,0,10000);	// Samurai Mask
Add(8,5403,1,0,5000);	// Fish In Mouth

/* 31-01-2018 Release */
Add(8,5518,1,0,15000);	

/* 20-01-2018 Release */
Add(8,5137,1,0,12000);	
Add(8,5667,1,0,1200);
Add(8,5379,1,0,8000);
Add(8,5766,1,0,8000);
Add(8,5293,1,0,6000);
Add(8,5462,1,0,6000);
Add(8,5463,1,0,6000);
Add(8,5464,1,0,10000);
Add(8,5508,1,0,6000);
Add(8,5227,1,0,6000);

/* Initial Release */
Add(8,5388,1,0,4000);	// Snake Hat
Add(8,5254,1,0,6000);	// Devilling Hat
Add(8,5286,1,0,8000);	// Pecopeco Hairband
Add(8,5359,1,0,6000);	// Ship Captain Hat
Add(8,5389,1,0,6000);	// AngelSpirit
Add(8,5377,1,0,12000);	// Gentleman Pipe
Add(8,5325,1,0,8000);	// Robo Eye
Add(8,5151,1,0,4000);	// Note Headphone
Add(8,5800,1,0,12000);	// Blush of Gloom
Add(8,5362,1,0,6000);	// Ninja Scroll
Add(8,5322,1,0,4000);	// Kerchief
Add(8,5187,1,0,6000);	// Twin Ribbon
Add(8,5104,1,0,6000);	// Dark Blinder
Add(8,5393,1,0,8000);	// Love Vaentine Hat
Add(8,5410,1,0,6000);	// Brown Paper Bag
Add(8,5533,1,0,6000);	// Emperor Wraith
Add(8,5396,1,0,6000);	// Jasper Crest
Add(8,5401,1,0,4000);	// Black Framed Glass
Add(8,5288,1,0,4000);	// Red Glasses
Add(8,5152,1,0,6000);	// Chinese Crown
Add(8,5314,1,0,8000);	// Hockey Mask
Add(8,5342,1,0,12000);	// Sorin Doll Hat
Add(8,5815,1,0,6000);	// Purple Cowboy Hat

/* Accessories */
Add(9,2765,1,0,1200);
Add(9,2766,1,0,1200);
Add(9,2767,1,0,1200);
Add(9,2768,1,0,1200);
Add(9,2769,1,0,1200);
Add(9,2770,1,0,1200);
Add(9,2771,1,0,1200);


// -----------------------------------------------------------

	freeloop(0);
	set .menu$,"";
	for(set .@i,1; .@i<=getarraysize(.iShops$); set .@i,.@i+1) {
		set .menu$, .menu$+.iShops$[.@i]+":";
		npcshopdelitem "ishop"+.@i,909;
	}
	end;

OnMenu:
	set .@size, getarraysize(@i);
	if (!.@size) set .@i, select(.menu$);
	else if (.@size == 1) set .@i, @i[0];
	else {
		for(set .@j,0; .@j<.@size; set .@j,.@j+1)
			set .@menu$, .@menu$+.iShops$[@i[.@j]]+":";
		set .@i, @i[select(.@menu$)-1];
	}
	deletearray @i[0],getarraysize(@i);
	if (.iShops$[.@i] == "") {
		message strcharinfo(PC_NAME),"An error has occurred.";
		end;
	}
	dispbottom "Select one item at a time.";
	callshop "ishop"+.@i,1;
	npcshopattach "ishop"+.@i;
	end;

OnBuyItem:
	disable_items();
	// .@q[] : RewardID, BoughtAmt, RewardAmt, BaseAmt, ReqZeny, ReqPts, { ReqItem, ReqAmt, ... }
	setarray .@q[0],@bought_nameid[0],((@bought_quantity[0] > .MaxStack)?.MaxStack:@bought_quantity[0]);
	copyarray .@q[3],getd(".q_"+.@q[0]+"[0]"),getarraysize(getd(".q_"+.@q[0]));
	set .@q[2],.@q[1]*.@q[3];
	if (!.@q[2] || .@q[2] > 30000) {
		message strcharinfo(PC_NAME),"You can't purchase that many "+getitemname(.@q[0])+".";
		end;
	}
	mes "[Item Mall]";
	mes "Reward: ^0055FF"+((.@q[2] > 1)?.@q[2]+"x ":"")+Slot(.@q[0])+"^000000";
	mes "Requirements:";
	if (.@q[4]) mes " > "+Chk(Zeny,.@q[4]*.@q[1])+(.@q[4]*.@q[1])+" Zeny^000000";
	//if (.@q[5]) mes " > "+Chk(getd(.points$[0]),.@q[5]*.@q[1])+(.@q[5]*.@q[1])+" "+.points$[1]+" ("+getd(.points$[0])+"/"+(.@q[5]*.@q[1])+")^000000";
	if (.@q[5]) mes " > "+Chk(callfunc("F_CheckCredit"),.@q[5]*.@q[1])+(.@q[5]*.@q[1])+" "+.points$[1]+" ("+callfunc("F_CheckCredit")+"/"+(.@q[5]*.@q[1])+")^000000";
	if (.@q[6]) for(set .@i,6; .@i<getarraysize(.@q); set .@i,.@i+2)
		mes " > "+Chk(countitem(.@q[.@i]),.@q[.@i+1]*.@q[1])+((.ShowID)?"{"+.@q[.@i]+"} ":"")+Slot(.@q[.@i])+" ("+countitem(.@q[.@i])+"/"+(.@q[.@i+1]*.@q[1])+")^000000";
	next;
	setarray @qe[1], getiteminfo(.@q[0], ITEMINFO_LOC), getiteminfo(.@q[0], ITEMINFO_VIEWSPRITE);
	if (@qe[2] > 0 && ((@qe[1] & EQP_HEAD_LOW) || (@qe[1] & EQP_HEAD_TOP) || (@qe[1] & EQP_HEAD_MID) || (@qe[1] & EQP_COSTUME_HEAD_TOP) || (@qe[1] & EQP_COSTUME_HEAD_MID) || (@qe[1] & EQP_COSTUME_HEAD_LOW) || (@qe[1] & EQP_GARMENT) || (@qe[1] & EQP_COSTUME_GARMENT)))
		set .@preview,1;
	addtimer 1000, strnpcinfo(NPC_NAME)+"::OnEnd";

	while(1) {
		switch(select(" ~ Purchase ^0055FF"+ getitemname(.@q[0]) +"^000000", ((.@preview && !@qe[7])?" ~ Preview...": ""), " ~ ^777777Cancel^000000")) {
		case 1:
			if (@qe[0]) {
				mes "[Item Mall]";
				mes "You're Credit Points is not suffecient to purchase the item.";
				close();
			}
			if (!checkweight(.@q[0],.@q[2])) {
				mes "[Item Mall]";
				mes "^FF0000You need "+(((.@q[2]*getiteminfo(.@q[0],6))+Weight-MaxWeight)/10)+" additional weight capacity to complete this trade.^000000";
				close();
			}
			if (.@q[4]) Zeny -= (.@q[4]*.@q[1]);
			if (.@q[5]) callfunc "F_UpdateCredit",-(.@q[5]*.@q[1]);
			//if (.@q[5]) setd .points$[0], getd(.points$[0])-(.@q[5]*.@q[1]);
			if (.@q[6]) for(set .@i,6; .@i<getarraysize(.@q); set .@i,.@i+2)
				delitem .@q[.@i],.@q[.@i+1]*.@q[1];
			getitem .@q[0],.@q[2];
			if (.Announce) chanmsg("system",""+strcharinfo(PC_NAME)+" has created "+((.@q[2] > 1)?.@q[2]+"x "+getitemname(.@q[0]):A_An(getitemname(.@q[0])))+"!");
			//specialeffect2 EF_FLOWERLEAF;
			close();
		case 2:
			setarray @qe[3], getlook(LOOK_HEAD_BOTTOM), getlook(LOOK_HEAD_TOP), getlook(LOOK_HEAD_MID), getlook(LOOK_ROBE), 1;
			if ((@qe[1] & 1) || (@qe[1] & 4096)) changelook LOOK_HEAD_BOTTOM, @qe[2];
			else if ((@qe[1] & 256) || (@qe[1] & 1024)) changelook LOOK_HEAD_TOP, @qe[2];
			else if ((@qe[1] & 512) || (@qe[1] & 2048)) changelook LOOK_HEAD_MID, @qe[2];
			else if ((@qe[1] & 4) || (@qe[1] & 8192)) changelook LOOK_ROBE, @qe[2];
			break;
		case 3:
			close();
		}
	}

OnEnd:
	if (@qe[7]) {
		changelook LOOK_HEAD_BOTTOM, @qe[3];
		changelook LOOK_HEAD_TOP, @qe[4];
		changelook LOOK_HEAD_MID, @qe[5];
		changelook LOOK_ROBE, @qe[6];
	}
	deletearray @qe[0],8;
	end;

function Add {
	if (getitemname(getarg(1)) == "null") {
		debugmes "Quest reward #"+getarg(1)+" invalid (skipped).";
		return;
	}
	setarray .@j[0],getarg(2),getarg(3),getarg(4);
	for(set .@i,5; .@i<getargcount(); set .@i,.@i+2) {
		if (getitemname(getarg(.@i)) == "null") {
			debugmes "Quest requirement #"+getarg(.@i)+" invalid (skipped).";
			return;
		} else
			setarray .@j[.@i-2],getarg(.@i),getarg(.@i+1);
	}
	copyarray getd(".q_"+getarg(1)+"[0]"),.@j[0],getarraysize(.@j);
	npcshopadditem "ishop"+getarg(0),getarg(1),((.ShowZeny)?getarg(4):0);
	return;
}

function Chk {
	if (getarg(0) < getarg(1)) {
		set @qe[0],1;
		return "^FF0000";
	} else
		return "^00FF00";
}

function Slot {
	set .@s$,getitemname(getarg(0));
	switch(.ShowSlot) {
		case 1: if (!getitemslots(getarg(0))) return .@s$;
		case 2: if (getiteminfo(getarg(0),2) == 4 || getiteminfo(getarg(0),2) == 5) return .@s$+" ["+getitemslots(getarg(0))+"]";
		default: return .@s$;
	}
}

function A_An {
	setarray .@A$[0],"a","e","i","o","u";
	set .@B$, "_"+getarg(0);
	for(set .@i,0; .@i<5; set .@i,.@i+1)
		if (compare(.@B$,"_"+.@A$[.@i])) return "an "+getarg(0);
	return "a "+getarg(0);
}
}

function	script	ishop	{

	deletearray @i[0],getarraysize(@i);
	for(set .@i,0; .@i<getargcount(); set .@i,.@i+1)
		set @i[.@i],getarg(.@i);
	doevent "i_shop::OnMenu";
	end;
	
}


// Dummy shop data -- copy as needed.
//============================================================
-	shop	ishop1	FAKE_NPC,909:-1
-	shop	ishop2	FAKE_NPC,909:-1
-	shop	ishop3	FAKE_NPC,909:-1
-	shop	ishop4	FAKE_NPC,909:-1
-	shop	ishop5	FAKE_NPC,909:-1
-	shop	ishop6	FAKE_NPC,909:-1
-	shop	ishop7	FAKE_NPC,909:-1
-	shop	ishop8	FAKE_NPC,909:-1
-	shop	ishop9	FAKE_NPC,909:-1
-	shop	ishop10	FAKE_NPC,909:-1
-	shop	ishop11	FAKE_NPC,909:-1
-	shop	ishop12	FAKE_NPC,909:-1
-	shop	ishop13	FAKE_NPC,909:-1
-	shop	ishop14	FAKE_NPC,909:-1
-	shop	ishop15	FAKE_NPC,909:-1