• 0
Sign in to follow this  
spawnn

Euphy's Quest Shop

Question

Script:

//===== rAthena Script =======================================
//= Euphy's Quest Shop
//===== By: ==================================================
//= Euphy
//===== Current Version: =====================================
//= 1.6b
//===== Compatible With: =====================================
//= rAthena SVN r16862+
//===== Description: =========================================
//= A dynamic quest shop based on Lunar's, with easier config.
//= Includes support for multiple shops & cashpoints.
//= Item Preview script by ToastOfDoom.
//===== Additional Comments: =================================
//= 1.0 Initial script.
//= 1.2 Added category support.
//= 1.3 More options and fixes.
//= 1.4 Added debug settings.
//= 1.5 Replaced categories with shop IDs.
//= 1.6 Added support for purchasing stackables.
//= 1.6a Added support for previewing costumes and robes.
//= 1.6b Added 'disable_items' command.
//============================================================

// Shop NPCs -- supplying no argument displays entire menu.
//	callfunc "qshop"{,<shop ID>{,<shop ID>{,...}}};
//============================================================
prontera,164,171,3	script	Quest Shop#1	998,{ callfunc "qshop",1,2; }
//prontera,147,174,5	script	Visual Shop#2	617,{ callfunc "qshop",2; }

// Script Core
//============================================================
-	script	quest_shop	-1,{ 
function Add; function Chk; function Slot; function A_An;
OnInit:


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

	set .Announce,1;	// 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,0;	// Show Zeny cost, if any? (1: yes / 0: no)
	set .MaxStack,100;	// 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","Cash Points";

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

	setarray .Shops$[1],"Quest","Quest 2";

// -----------------------------------------------------------
//  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>{,...});
// -----------------------------------------------------------
	//quest
	Add(1,5137,1,10000000,0,4523,10,7047,50,5141,1,1060,100);
	Add(1,5170,1,10000000,0,5172,1,7063,100,982,1);
	Add(1,5360,1,10000000,0,919,100,1096,100,7171,50,2213,1);
	Add(1,5480,1,10000000,0,2233,1,916,100,983,10,982,10,976,10,975,10,978,10);
	Add(1,18550,1,10000000,0,5170,1,7297,10,7291,10,7292,10);
	Add(1,18561,1,10000000,0,5170,1,7297,5,7291,5,7292,5);
	Add(1,5376,1,10000000,0,2255,1,983,10,7511,35,7340,35,923,25,1039,25);
	Add(1,5361,1,10000000,0,5096,1,2218,1,911,10,507,75,7216,75,7563,150);
	Add(1,5325,1,10000000,0,2263,5,2296,5,719,100,640,125);
	Add(1,5463,1,10000000,0,975,5,976,5,978,5,979,5,981,5,983,5,982,5,980,5,1045,125);
	Add(1,2589,1,10000000,0,7063,200,7441,200,1039,100,983,10);
	Add(1,2576,1,10000000,0,16010,5,16001,3,976,25,975,25);
	Add(1,18603,1,10000000,0,18507,1,1038,200,1039,200);
	Add(1,2899,1,10000000,0,2701,2,4064,2,982,25);
	Add(1,18536,1,10000000,0,7206,100,905,100,7263,100,976,10);
	Add(1,5548,1,10000000,0,748,200,990,100,975,20);
	Add(1,2855,1,10000000,0,7206,100,983,25,975,25,7263,100);
	Add(1,19263,1,10000000,0,1168,1,7069,50,1527,1,6223,100,1413,1,616,25);
	Add(1,15041,1,10000000,0,2347,1,7444,100,995,250,962,200);
	Add(1,19118,1,10000000,0,2202,1,19117,1,713,250,4001,25,7297,25);
	Add(1,19020,1,10000000,0,5480,1,996,200,4141,25,7292,25,7022,3);
	Add(1,19021,1,10000000,0,1387,1,1490,1,2160,1,526,200,7053,250,4271,10,4270,10);
	Add(1,28507,1,10000000,0,7169,3,2701,2,27122,10,4577,10,27161,10,914,200);
	Add(1,28430,1,10000000,0,2729,2,4053,10,993,200);
	Add(1,5907,1,10000000,0,1377,5,7022,5,7024,25,999,200);
	Add(1,5933,1,10000000,0,2274,1,7205,200,983,25,975,25,7159,250);
	Add(1,19112,1,10000000,0,2274,1,7159,150,7205,100,713,100);
	//Add(2,5208,1,10000000,0,1006,150,4115,5,2254);
	//Add(2,20859,1,10000000,0,1015,100,13047,3,4362,5,1059,200);
	//Add(2,28433,1,10000000,0,4172,10,7297,25,991,200,7291,5);
	//Add(2,2202,1,10000000,0,7717,1,2201,5);
	//Add(2,2204,1,10000000,0,7717,1,2203,5);
	
	//Visual

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

	freeloop(0);
	set .menu$,"";
	for(set .@i,1; .@i<=getarraysize(.Shops$); set .@i,.@i+1) {
		set .menu$, .menu$+.Shops$[.@i]+":";
		npcshopdelitem "qshop"+.@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$+.Shops$[@i[.@j]]+":";
		set .@i, @i[select(.@menu$)-1];
	}
	deletearray @i[0],getarraysize(@i);
	if (.Shops$[.@i] == "") {
		message strcharinfo(0),"An error has occurred.";
		end;
	}
	dispbottom "Select one item at a time.";
	callshop "qshop"+.@i,1;
	npcshopattach "qshop"+.@i;
	end;

OnBuyItem:
	// [email protected][] : 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(0),"You can't purchase that many "+getitemname(.@q[0])+".";
		end;
	}
	mes "[Quest Shop]";
	mes "Reward: ^0055FF"+((.@q[2] > 1)?.@q[2]+"x ":"")+Slot(.@q[0])+"^000000";
	mes "Requirements:";
	disable_items;
	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[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],5), getiteminfo(.@q[0],11);
	if (@qe[2] > 0 && ((@qe[1] & 1) || (@qe[1] & 256) || (@qe[1] & 512) || (@qe[1] & 1024) || (@qe[1] & 2048) || (@qe[1] & 4096) || (@qe[1] & 4) || (@qe[1] & 8192)))
		set .@preview,1;
	addtimer 1000, strnpcinfo(0)+"::OnEnd";
	while(1) {
		switch(select(" ~ Purchase ^0055FF"+getitemname(.@q[0])+"^000000:"+((.@preview && !@qe[7])?" ~ Preview...":"")+": ~ ^777777Cancel^000000")) {
		case 1:
			if (@qe[0]) { 
				mes "[Quest Shop]";
				mes "You're missing one or more quest requirements.";
				close;
			}
			if (!checkweight(.@q[0],.@q[2])) {
				mes "[Quest Shop]";
				mes "^FF0000You need "+(((.@q[2]*getiteminfo(.@q[0],6))+Weight-MaxWeight)/10)+" additional weight capacity to complete this trade.^000000";
				close;
			}
			if (.@q[4]) set Zeny, Zeny-(.@q[4]*.@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) announce strcharinfo(0)+" has created "+((.@q[2] > 1)?.@q[2]+"x "+getitemname(.@q[0]):A_An(getitemname(.@q[0])))+"!",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 "qshop"+getarg(0),getarg(1),((.ShowZeny)?getarg(3):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	qshop	{
	deletearray @i[0],getarraysize(@i);
	for(set .@i,0; .@i<getargcount(); set .@i,.@i+1)
		set @i[.@i],getarg(.@i);
	doevent "quest_shop::OnMenu";
	end;
}

// Dummy shop data -- copy as needed.
//============================================================
-	shop	qshop1	-1,909:-1
-	shop	qshop2	-1,909:-1
-	shop	qshop3	-1,909:-1
-	shop	qshop4	-1,909:-1
-	shop	qshop5	-1,909:-1

Error:

 

quest.png

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0
a sample complete SCRIPT on my country,
If you will continue to do it

SCOCKET_ENCHANT

-    shop    Q_WC    -1,13105:-1,1912:-1,1959:-1
-    shop    Q_WB    -1,1808:-1,13166:-1,1538:-1,1955:-1
-    shop    Q_WA    -1,1568:-1,1571:-1,1569:-1,1570:-1,1727:-1,1816:-1,1172:-1,13030:-1,1149:-1,1480:-1,1539:-1,1726:-1,1922:-1,1976:-1,1479:-1,1178:-1,1532:-1,1171:-1,1309:-1
-    shop    Q_WS    -1,13033:-1,13400:-1,1476:-1,1180:-1,1179:-1,13019:-1,1540:-1,1418:-1,13032:-1,13016:-1,13018:-1,13031:-1,1481:-1,1266:-1,1275:-1,1278:-1,1276:-1,1277:-1
-    shop    Q_WSS    -1,13017:-1,13033:-1
//=========================================================================================================================================================
-    shop    Q_AC    -1,2118:-1,5270:-1,5348:-1,5168:-1,5349:-1,12120:-1,2120:-1,5347:-1,5351:-1
-    shop    Q_AB    -1,5298:-1,2432:-1,5299:-1,2715:-1
-    shop    Q_AA    -1,2525:-1,2434:-1,5159:-1,2121:-1,5158:-1,5167:-1,2359:-1,5157:-1,5350:-1
-    shop    Q_AS    -1,2349:-1,5162:-1,2671:-1,2351:-1,5163:-1,5165:-1,2373:-1,2345:-1,2372:-1,5160:-1,5375:-1,2371:-1,2360:-1,2128:-1,2347:-1,5297:-1,5166:-1,5161:-1,5164:-1,2523:-1
-    shop    Q_ASS    -1,2204:-1,2202:-1

// =============================================== Item List ===============================================
function    script    QS_Buy    {
// Weapon C Rank
if(@bought_nameid == 13105) {    setarray @itemuse[0], 13104, 984, 999;                setarray @itemusemany[0], 1, 1, 3;    set @broken,40;    set @zenyuse, 200000;    }
else if(@bought_nameid == 1912) {    setarray @itemuse[0], 1911, 984, 999;                setarray @itemusemany[0], 1, 1, 3;    set @broken,40;    set @zenyuse, 200000;    }
else if(@bought_nameid == 1959) {    setarray @itemuse[0], 1958, 984, 999;                setarray @itemusemany[0], 1, 1, 3;    set @broken,40;    set @zenyuse, 200000;    }

// Weapon B Rank
else if(@bought_nameid == 1808) {    setarray @itemuse[0], 1807, 984, 999;                setarray @itemusemany[0], 1, 3, 5;    set @broken,30;    set @zenyuse, 300000;    }
else if(@bought_nameid == 13166) {    setarray @itemuse[0], 13165, 984, 999;                setarray @itemusemany[0], 1, 3, 5;    set @broken,30;    set @zenyuse, 300000;    }
else if(@bought_nameid == 1955) {    setarray @itemuse[0], 1954, 984, 999;                setarray @itemusemany[0], 1, 3, 5;    set @broken,30;    set @zenyuse, 300000;    }
else if(@bought_nameid == 1538) {    setarray @itemuse[0], 1523, 984, 999;                    setarray @itemusemany[0], 1, 3, 5;        set @broken,30;    set @zenyuse, 300000;    }

// Weapon A Rank
else if(@bought_nameid == 1568) {    setarray @itemuse[0], 1553, 984, 999;                setarray @itemusemany[0], 1, 5, 10;    set @broken,20;    set @zenyuse, 500000;    }
else if(@bought_nameid == 1571) {    setarray @itemuse[0], 1556, 984, 999;                setarray @itemusemany[0], 1, 5, 10;    set @broken,20;    set @zenyuse, 500000;    }
else if(@bought_nameid == 1569) {    setarray @itemuse[0], 1554, 984, 999;                setarray @itemusemany[0], 1, 5, 10;    set @broken,20;    set @zenyuse, 500000;    }
else if(@bought_nameid == 1570) {    setarray @itemuse[0], 1555, 984, 999;                setarray @itemusemany[0], 1, 5, 10;    set @broken,20;    set @zenyuse, 500000;    }
else if(@bought_nameid == 1727) {    setarray @itemuse[0], 1722, 984, 999;                setarray @itemusemany[0], 1, 5, 10;    set @broken,20;    set @zenyuse, 500000;    }
else if(@bought_nameid == 1816) {    setarray @itemuse[0], 1814, 984, 999;                setarray @itemusemany[0], 1, 5, 10;    set @broken,20;    set @zenyuse, 500000;    }
else if(@bought_nameid == 1172) {    setarray @itemuse[0], 1163, 984, 999;                setarray @itemusemany[0], 1, 5, 10;    set @broken,20;    set @zenyuse, 500000;    }
else if(@bought_nameid == 13030) {    setarray @itemuse[0], 13001, 984, 999;                setarray @itemusemany[0], 1, 5, 10;    set @broken,20;    set @zenyuse, 500000;    }
else if(@bought_nameid == 1149) {    setarray @itemuse[0], 1129, 984, 999;                setarray @itemusemany[0], 1, 5, 10;    set @broken,20;    set @zenyuse, 500000;    }
else if(@bought_nameid == 1480) {    setarray @itemuse[0], 1474, 984, 999;                setarray @itemusemany[0], 1, 5, 10;    set @broken,20;    set @zenyuse, 500000;    }
else if(@bought_nameid == 1539) {    setarray @itemuse[0], 1524, 984, 999;                setarray @itemusemany[0], 1, 5, 10;    set @broken,20;    set @zenyuse, 500000;    }
else if(@bought_nameid == 1726) {    setarray @itemuse[0], 1718, 984, 999;                setarray @itemusemany[0], 1, 5, 10;    set @broken,20;    set @zenyuse, 500000;    }
else if(@bought_nameid == 1922) {    setarray @itemuse[0], 1918, 984, 999;                setarray @itemusemany[0], 1, 5, 10;    set @broken,20;    set @zenyuse, 500000;    }
else if(@bought_nameid == 1976) {    setarray @itemuse[0], 1970, 984, 999;                setarray @itemusemany[0], 1, 5, 10;    set @broken,20;    set @zenyuse, 500000;    }
else if(@bought_nameid == 1479) {    setarray @itemuse[0], 1477, 984, 999;                setarray @itemusemany[0], 1, 5, 10;    set @broken,20;    set @zenyuse, 500000;    }
else if(@bought_nameid == 1178) {    setarray @itemuse[0], 1167, 984, 999;                setarray @itemusemany[0], 1, 5, 10;    set @broken,20;    set @zenyuse, 500000;    }
else if(@bought_nameid == 1532) {    setarray @itemuse[0], 1522, 984, 999;                setarray @itemusemany[0], 1, 5, 10;    set @broken,20;    set @zenyuse, 500000;    }
else if(@bought_nameid == 1171) {    setarray @itemuse[0], 1168, 984, 999;                setarray @itemusemany[0], 1, 5, 10;    set @broken,20;    set @zenyuse, 500000;    }
else if(@bought_nameid == 1309) {    setarray @itemuse[0], 1304, 1010, 999;                setarray @itemusemany[0], 1, 5, 10;    set @broken,20;    set @zenyuse, 500000;    }

// Weapon S Rank
else if(@bought_nameid == 13400) {    setarray @itemuse[0], 1135, 984, 999;                setarray @itemusemany[0], 1, 5, 30;    set @broken,10;    set @zenyuse, 1000000;    }
else if(@bought_nameid == 1476) {    setarray @itemuse[0], 1466, 984, 999;                setarray @itemusemany[0], 1, 5, 30;    set @broken,10;    set @zenyuse, 1000000;    }
else if(@bought_nameid == 1180) {    setarray @itemuse[0], 1166, 984, 999;                setarray @itemusemany[0], 1, 5, 30;    set @broken,10;    set @zenyuse, 1000000;    }
else if(@bought_nameid == 1179) {    setarray @itemuse[0], 1169, 984, 999;                setarray @itemusemany[0], 1, 5, 30;    set @broken,10;    set @zenyuse, 1000000;    }
else if(@bought_nameid == 13019) {    setarray @itemuse[0], 13002, 984, 999;                setarray @itemusemany[0], 1, 5, 30;    set @broken,10;    set @zenyuse, 1000000;    }
else if(@bought_nameid == 1540) {    setarray @itemuse[0], 1528, 984, 999;                setarray @itemusemany[0], 1, 5, 30;    set @broken,10;    set @zenyuse, 1000000;    }
else if(@bought_nameid == 1418) {    setarray @itemuse[0], 1413, 984, 999;                setarray @itemusemany[0], 1, 5, 30;    set @broken,10;    set @zenyuse, 1000000;    }
else if(@bought_nameid == 13032) {    setarray @itemuse[0], 1225, 984, 999;                setarray @itemusemany[0], 1, 5, 30;    set @broken,10;    set @zenyuse, 1000000;    }
else if(@bought_nameid == 13016) {    setarray @itemuse[0], 1239, 984, 999;                setarray @itemusemany[0], 1, 5, 30;    set @broken,10;    set @zenyuse, 1000000;    }
else if(@bought_nameid == 13018) {    setarray @itemuse[0], 1236, 984, 999;                setarray @itemusemany[0], 1, 5, 30;    set @broken,10;    set @zenyuse, 1000000;    }
else if(@bought_nameid == 13031) {    setarray @itemuse[0], 1224, 984, 999;                setarray @itemusemany[0], 1, 5, 30;    set @broken,10;    set @zenyuse, 1000000;    }
else if(@bought_nameid == 1481) {    setarray @itemuse[0], 1468, 984, 999;                setarray @itemusemany[0], 1, 5, 30;    set @broken,10;    set @zenyuse, 1000000;    }
else if(@bought_nameid == 1275) {    setarray @itemuse[0], 1256, 984, 999;                setarray @itemusemany[0], 1, 5, 30;    set @broken,10;    set @zenyuse, 1000000;    }
else if(@bought_nameid == 1278) {    setarray @itemuse[0], 1259, 984, 999;                setarray @itemusemany[0], 1, 5, 30;    set @broken,10;    set @zenyuse, 1000000;    }
else if(@bought_nameid == 1276) {    setarray @itemuse[0], 1257, 984, 999;                setarray @itemusemany[0], 1, 5, 30;    set @broken,10;    set @zenyuse, 1000000;    }
else if(@bought_nameid == 1277) {    setarray @itemuse[0], 1258, 984, 999;                setarray @itemusemany[0], 1, 5, 30;    set @broken,10;    set @zenyuse, 1000000;    }
else if(@bought_nameid == 1266) {    setarray @itemuse[0], 1261, 984, 999;                setarray @itemusemany[0], 1, 5, 30;        set @broken,10;    set @zenyuse, 1000000;    }

// Weapon SS Rank
else if(@bought_nameid == 13017) {    setarray @itemuse[0], 1230, 984, 999;                setarray @itemusemany[0], 1, 10, 50;        set @broken,5;    set @zenyuse, 2000000;    }
else if(@bought_nameid == 13033) {    setarray @itemuse[0], 1232, 984, 999;                setarray @itemusemany[0], 1, 10, 50;    set @broken,5;    set @zenyuse, 2000000;    }

//=================================================================================================================================================================================================================================

// Armor C Rank
else if(@bought_nameid == 2118) {    setarray @itemuse[0], 2118, 985, 999;                    setarray @itemusemany[0], 1, 5, 5;        set @broken,40;    set @zenyuse, 300000;    }
else if(@bought_nameid == 5348) {    setarray @itemuse[0], 2244, 985, 999;                    setarray @itemusemany[0], 1, 5, 5;        set @broken,40;    set @zenyuse, 300000;    }
else if(@bought_nameid == 5168) {    setarray @itemuse[0], 5046, 985, 999;                    setarray @itemusemany[0], 1, 5, 5;        set @broken,40;    set @zenyuse, 300000;    }
else if(@bought_nameid == 5349) {    setarray @itemuse[0], 5016, 985, 999;                    setarray @itemusemany[0], 1, 5, 5;        set @broken,40;    set @zenyuse, 300000;    }
else if(@bought_nameid == 5270) {    setarray @itemuse[0], 5189, 985, 999;                    setarray @itemusemany[0], 1, 5, 5;        set @broken,40;    set @zenyuse, 300000;    }
else if(@bought_nameid == 2120) {    setarray @itemuse[0], 2120, 985, 999;                    setarray @itemusemany[0], 1, 5, 5;        set @broken,40;    set @zenyuse, 300000;    }
else if(@bought_nameid == 5347) {    setarray @itemuse[0], 5012, 985, 999;                    setarray @itemusemany[0], 1, 5, 5;        set @broken,40;    set @zenyuse, 300000;    }
else if(@bought_nameid == 5351) {    setarray @itemuse[0], 2253, 985, 999;                    setarray @itemusemany[0], 1, 5, 5;        set @broken,40;    set @zenyuse, 300000;    }

// Armor B Rank
else if(@bought_nameid == 2432) {    setarray @itemuse[0], 2409, 985, 999;                    setarray @itemusemany[0], 1, 5, 5;        set @broken,30;    set @zenyuse, 500000;    }
else if(@bought_nameid == 2715) {    setarray @itemuse[0], 2609, 985, 999;                    setarray @itemusemany[0], 1, 5, 5;        set @broken,30;    set @zenyuse, 500000;    }
else if(@bought_nameid == 5298) {    setarray @itemuse[0], 5258, 985, 999;                    setarray @itemusemany[0], 1, 5, 5;    set @broken,30;    set @zenyuse, 500000;    }
else if(@bought_nameid == 5299) {    setarray @itemuse[0], 5263, 985, 999;                    setarray @itemusemany[0], 1, 5, 5;    set @broken,30;    set @zenyuse, 500000;    }

// Armor A Rank
else if(@bought_nameid == 5167) {    setarray @itemuse[0], 2264, 985, 999;                    setarray @itemusemany[0], 1, 5, 10;        set @broken,20;    set @zenyuse, 1000000;    }
else if(@bought_nameid == 2434) {    setarray @itemuse[0], 2425, 985, 999;                    setarray @itemusemany[0], 1, 5, 10;        set @broken,20;    set @zenyuse, 1000000;    }
else if(@bought_nameid == 5350) {    setarray @itemuse[0], 2287, 985, 999;                    setarray @itemusemany[0], 1, 5, 10;        set @broken,20;    set @zenyuse, 1000000;    }
else if(@bought_nameid == 2525) {    setarray @itemuse[0], 2507, 985, 999;                    setarray @itemusemany[0], 1, 5, 10;        set @broken,20;    set @zenyuse, 1000000;    }
else if(@bought_nameid == 5159) {    setarray @itemuse[0], 2246, 985, 999;                    setarray @itemusemany[0], 1, 5, 10;        set @broken,20;    set @zenyuse, 1000000;    }
else if(@bought_nameid == 2121) {    setarray @itemuse[0], 2109, 985, 999;                    setarray @itemusemany[0], 1, 5, 10;        set @broken,20;    set @zenyuse, 1000000;    }
else if(@bought_nameid == 5158) {    setarray @itemuse[0], 2251, 985, 999;                    setarray @itemusemany[0], 1, 5, 10;        set @broken,20;    set @zenyuse, 1000000;    }
else if(@bought_nameid == 2359) {    setarray @itemuse[0], 2337, 985, 999;                    setarray @itemusemany[0], 1, 5, 10;        set @broken,20;    set @zenyuse, 1000000;    }
else if(@bought_nameid == 5157) {    setarray @itemuse[0], 2299, 985, 999;                    setarray @itemusemany[0], 1, 5, 10;        set @broken,20;    set @zenyuse, 1000000;    }
else if(@bought_nameid == 5271) {    setarray @itemuse[0], 5152, 985, 999;                    setarray @itemusemany[0], 1, 5, 10;        set @broken,20;    set @zenyuse, 1000000;    }

// Armor S Rank
else if(@bought_nameid == 2373) {    setarray @itemuse[0], 2327, 985, 999;                    setarray @itemusemany[0], 1, 10, 30;        set @broken,10;    set @zenyuse, 5000000;    }
else if(@bought_nameid == 2372) {    setarray @itemuse[0], 2334, 985, 999;                    setarray @itemusemany[0], 1, 10, 30;        set @broken,10;    set @zenyuse, 5000000;    }
else if(@bought_nameid == 2371) {    setarray @itemuse[0], 2339, 985, 999;                    setarray @itemusemany[0], 1, 10, 30;        set @broken,10;    set @zenyuse, 5000000;    }
else if(@bought_nameid == 2128) {    setarray @itemuse[0], 2111, 985, 999;                    setarray @itemusemany[0], 1, 10, 30;        set @broken,10;    set @zenyuse, 5000000;    }
else if(@bought_nameid == 2523) {    setarray @itemuse[0], 2522, 985, 999;                    setarray @itemusemany[0], 1, 10, 30;        set @broken,10;    set @zenyuse, 5000000;    }
else if(@bought_nameid == 2671) {    setarray @itemuse[0], 2619, 985, 999;                    setarray @itemusemany[0], 1, 10, 30;        set @broken,10;    set @zenyuse, 5000000;    }
else if(@bought_nameid == 2360) {    setarray @itemuse[0], 2343, 985, 999;                    setarray @itemusemany[0], 1, 10, 30;        set @broken,10;    set @zenyuse, 5000000;    }
else if(@bought_nameid == 5166) {    setarray @itemuse[0], 5053, 985, 999;                    setarray @itemusemany[0], 1, 10, 30;        set @broken,10;    set @zenyuse, 5000000;    }
else if(@bought_nameid == 2349) {    setarray @itemuse[0], 2348, 985, 999;                    setarray @itemusemany[0], 1, 10, 30;        set @broken,10;    set @zenyuse, 5000000;    }
else if(@bought_nameid == 5162) {    setarray @itemuse[0], 5017, 985, 999;                    setarray @itemusemany[0], 1, 10, 30;        set @broken,10;    set @zenyuse, 5000000;    }
else if(@bought_nameid == 2351) {    setarray @itemuse[0], 2350, 985, 999;                    setarray @itemusemany[0], 1, 10, 30;        set @broken,10;    set @zenyuse, 5000000;    }
else if(@bought_nameid == 5163) {    setarray @itemuse[0], 5019, 985, 999;                    setarray @itemusemany[0], 1, 10, 30;        set @broken,10;    set @zenyuse, 5000000;    }
else if(@bought_nameid == 5165) {    setarray @itemuse[0], 2235, 985, 999;                    setarray @itemusemany[0], 1, 10, 30;        set @broken,10;    set @zenyuse, 5000000;    }
else if(@bought_nameid == 2345) {    setarray @itemuse[0], 2344, 985, 999;                    setarray @itemusemany[0], 1, 10, 30;        set @broken,10;    set @zenyuse, 5000000;    }
else if(@bought_nameid == 5160) {    setarray @itemuse[0], 2256, 985, 999;                    setarray @itemusemany[0], 1, 10, 30;        set @broken,10;    set @zenyuse, 5000000;    }
else if(@bought_nameid == 2375) {    setarray @itemuse[0], 5094, 985, 999;                    setarray @itemusemany[0], 1, 10, 30;        set @broken,10;    set @zenyuse, 5000000;    }
else if(@bought_nameid == 2347) {    setarray @itemuse[0], 2343, 985, 999;                    setarray @itemusemany[0], 1, 10, 30;        set @broken,10;    set @zenyuse, 5000000;    }
else if(@bought_nameid == 5297) {    setarray @itemuse[0], 5257, 985, 999;                    setarray @itemusemany[0], 1, 10, 30;        set @broken,10;    set @zenyuse, 5000000;    }
else if(@bought_nameid == 5161) {    setarray @itemuse[0], 2258, 985, 999;                    setarray @itemusemany[0], 1, 10, 30;        set @broken,10;    set @zenyuse, 5000000;    }
else if(@bought_nameid == 5164) {    setarray @itemuse[0], 2234, 985, 999;                    setarray @itemusemany[0], 1, 10, 30;        set @broken,10;    set @zenyuse, 5000000;    }

// Armor SS Rank
else if(@bought_nameid == 2204) {    setarray @itemuse[0], 2203, 985, 999;                setarray @itemusemany[0], 1, 20, 50;    set @broken,5;    set @zenyuse, 10000000;    }
else if(@bought_nameid == 2202) {    setarray @itemuse[0], 2201, 985, 999;                setarray @itemusemany[0], 1, 20, 50;    set @broken,5;    set @zenyuse, 10000000;    }

return;
}


// =============== Slot Item ====================
-    script    SlotsChanges    -1,{
set [email protected]$,"^000080[ Slot Enchant ]^000000";
mes [email protected]$;
mes "สวัสดี :^FF0000 "+strcharinfo(0)+" ^000000 ";
mes "ท่านต้องการเจาะรู Item ประเภทใด ?";
next;
switch(select("^FF0000-^000000 Weapons:^FF0000-^000000 Armors")) {
case 1:    
next;
mes [email protected]$;
mes "เชิญเลือกได้เลย ";
next;
switch(select("^FF0000-^000000 C Rank:^FF0000-^000000 B Rank:^FF0000-^000000 A Rank:^FF0000-^000000 S Rank:^FF0000-^000000 SS Rank")) {
case 1:    callfunc "Shop_QS","Q_WC",1;
case 2:    callfunc "Shop_QS","Q_WB",1;
case 3:    callfunc "Shop_QS","Q_WA",1;
case 4:    callfunc "Shop_QS","Q_WS",1;
case 5:    callfunc "Shop_QS","Q_WSS",1;
}
case 2:
next;
mes [email protected]$;
mes "เชิญเลือกได้เลย ";
next;
switch(select("^FF0000-^000000 C Rank:^FF0000-^000000 B Rank:^FF0000-^000000 A Rank:^FF0000-^000000 S Rank:^FF0000-^000000 SS Rank")) {
case 1:    callfunc "Shop_QS","Q_AC",1;
case 2:    callfunc "Shop_QS","Q_AB",1;
case 3:    callfunc "Shop_QS","Q_AA",1;
case 4:    callfunc "Shop_QS","Q_AS",1;
case 5:    callfunc "Shop_QS","Q_ASS",1;
}
}
OnBuyItem:
callfunc "QS_ItemBuy";
end;
}

// ============================================ Function Run Shop ===========================================

function    script    Shop_QS    {    npcshopattach getarg(0),1;    close2;    callshop getarg(0),getarg(1);    end;    }

// ============================================ Function Check Item ==========================================
function    script    QS_ItemBuy    {
for (set .@g,0; .@g < getarraysize(@bought_nameid); set .@g,.@g+1) {
    sleep2 1;
    set @bought_nameid,@bought_nameid[.@g];
    deletearray @itemuse[0],getarraysize(@itemuse);
    deletearray @itemusemany[0],getarraysize(@itemusemany);
    set @broken,0;    set @zenyuse, 0;
    callfunc "QS_Buy";
        if(@itemuse[0] <= 0)    goto check;    
            set .@r,0;    set .@up,0;    set @itemgetmany,0;
            for( set .@r,0; .@r < getarraysize(@itemuse); set .@r,.@r+1 ) {
                if(.@up >= getarraysize(@itemuse)) break;
                set .@itemup[.@up], countitem(@itemuse[.@up])/@itemusemany[.@up];
                if(.@up == 0) set @itemgetmany,.@itemup[.@up];
                if(@itemgetmany > .@itemup[.@up]) set @itemgetmany,.@itemup[.@up];
                set .@up,.@up+1;
                continue;
            }
check:    
    dispbottom "=============================================";
        if(@itemuse[0] <= 0){
            if (0 == getitemslots( @bought_nameid[.@g])){    dispbottom "ในขณะนี้ "+getitemname(@bought_nameid[.@g])+" ไม่มี Quest ให้แลก";    }
            if (1 <= getitemslots( @bought_nameid[.@g])){    dispbottom "ในขณะนี้ "+getitemname(@bought_nameid[.@g])+" ["+getitemslots( @bought_nameid[.@g])+"] ไม่มี Quest ให้แลก";    }
        }
        else if (@itemgetmany == 0){
            if (0 == getitemslots( @bought_nameid[.@g])){    dispbottom "Item ที่ต้องการแลกกับ "+getitemname(@bought_nameid[.@g])+" จำนวน 1 ea";    }
            if (1 <= getitemslots( @bought_nameid[.@g])){    dispbottom "Item ที่ต้องการแลกกับ "+getitemname(@bought_nameid[.@g])+" ["+getitemslots( @bought_nameid[.@g])+"] จำนวน 1 ea";    }
            set .@d,0;
            for( set .@i,0; .@i < getarraysize(@itemuse); set .@i,.@i+1 ) {
                if(.@d >= getarraysize(@itemuse)) break;
                if (0 == getitemslots( @itemuse[.@d])){    dispbottom " "+(.@d+1)+"> "+getitemname(@itemuse[.@d])+" จำนวน "+@itemusemany[.@d]+" ea";    }
                if (1 <= getitemslots( @itemuse[.@d])){    dispbottom " "+(.@d+1)+"> "+getitemname(@itemuse[.@d])+" ["+getitemslots( @itemuse[.@d])+"] จำนวน "+@itemusemany[.@d]+" ea";    }
                set .@d,.@d+1;
                continue;
            }
            if(@broken != 0) {    set .@failmake,100-@broken;    dispbottom " --> มีโอกาสเสียหาย  "+.@failmake+" % ";    }
            if(@zenyuse != 0) {    dispbottom    "และใช้เงินจำนวน  "+ @zenyuse +" Zeny";    }
        }
        else if (@bought_quantity[.@g] > @itemgetmany){
            dispbottom "จาก Item ที่ท่านมี ท่านสามารถแลก "+getitemname(@bought_nameid[.@g])+" ได้ไม่เกิน  "+@itemgetmany+" ea ";
        }
        else if (Zeny < (@zenyuse*@bought_quantity[.@g])){    
            if (@bought_quantity[.@g] == 1)    dispbottom "เงินที่ท่านเตรียมมามีไม่พอ ต้องใช้เงินจำนวน  "+@zenyuse+" Zeny ในการแลก "+getitemname(@bought_nameid[.@g])+"";
            else if (@bought_quantity[.@g] >= 2)    dispbottom "เงินที่ท่านเตรียมมามีไม่พอ ต้องใช้เงินจำนวน  "+(@zenyuse*@bought_quantity[.@g])+" Zeny ในการแลก "+getitemname(@bought_nameid[.@g])+" จำนวน "+@bought_quantity[.@g]+" ea";
        }
        else if ((@bought_quantity[.@g] <= @itemgetmany) && (Zeny >= (@zenyuse*@bought_quantity[.@g]))){
            set .@r,0;    set .@up,0;
            for( set .@r,0; .@r < getarraysize(@itemuse); set .@r,.@r+1 ) {
                if(.@up >= getarraysize(@itemuse)) break;
                delitem @itemuse[.@up],@itemusemany[.@up]*@bought_quantity[.@g];
                dispbottom "-> "+getitemname(@itemuse[.@up])+" ได้ถูกนำไปใช้จำนวน "+(@itemusemany[.@up]*@bought_quantity[.@g])+" ea";
                set .@up,.@up+1;
                continue;
            }
            if(@zenyuse != 0) {    
                set Zeny,(Zeny-@zenyuse*@bought_quantity[.@g]);
                dispbottom "-> เงินได้ถูกนำไปใช้จำนวน "+(@zenyuse*@bought_quantity[.@g])+" zeny";
            }
            if(@broken != 0) {    
                set .@RTget,rand(1,100);
                if(@broken < .@RTget) {
                    emotion 23;
                    specialeffect2 155;
                    dispbottom "ก๊อง ก๊อง ก๊อง ... !!";
                    dispbottom "การเจาะรู "+getitemname(@bought_nameid[.@g])+" ["+getitemslots( @bought_nameid[.@g])+"] ล้มเหลว เสียใจด้วย ... !!";
                    set @bought_quantity[.@g],0;
                }
                if(@broken >= .@RTget) {
                    emotion 21;
                    specialeffect2 154;
                    dispbottom "ก๊อง ก๊อง ก๊อง ... !!";
                    dispbottom "การเจาะรู "+getitemname(@bought_nameid[.@g])+" ["+getitemslots( @bought_nameid[.@g])+"] เสร็จสมบูรณ์ ... !!";
                }
            } 
            if(@broken == 0) {
                emotion 33;
                specialeffect2 488;
            }
            getitem @bought_nameid[.@g],@bought_quantity[.@g];
        }
}
dispbottom "=============================================";
deletearray @bought_nameid[0],getarraysize(@bought_nameid);
deletearray @bought_quantity[0],getarraysize(@bought_quantity);
deletearray @itemuse[0],getarraysize(@itemuse);
deletearray @itemusemany[0],getarraysize(@itemusemany);
set @broken,0;    set @zenyuse, 0;
end;
}

morocc,191,144,6    duplicate(SlotsChanges)    Slot Enchant#moc    475

 

 

 

QUEST ITEM SHOP

 

Quote

 

-    script    Wing Craft::wingcraft    2004,{
callfunc "Shop_QA","QA_Wing_A",1;
end;

OnBuyItem:
callfunc "QA_ItemBuy";

OnSellItem:
callfunc "QA_ItemSell";

}

-    shop    QA_Wing_A    -1,7079:10,20500:10,20764:10,20746:10

function    script    QA_Buy    {
if(@bought_nameid == 7079) {        setarray @itemuse[0], 7063, 7510, 7083;        setarray @itemusemany[0], 100, 1, 1;                }
else if(@bought_nameid == 20500) {    setarray @itemuse[0], 7845, 61004, 7079;                setarray @itemusemany[0], 1, 5, 20;                        }
else if(@bought_nameid == 20764) {    setarray @itemuse[0], 7846, 61004, 7079;                setarray @itemusemany[0], 1, 5, 20;                        }
else if(@bought_nameid == 20746) {    setarray @itemuse[0], 7847, 61004, 7079;                setarray @itemusemany[0], 1, 5, 20;                        }
return;
}

//========================[NPC-POSITION]============================
morocc,139,140,8    duplicate(wingcraft)     #mor    844
//==========================[FUNCTION]==============================

function    script    Shop_QA_2    {
    npcshopattach getarg(0),1;        
    callshop getarg(0),getarg(1);
    end;    
}

function    script    Shop_QA    {
    npcshopattach getarg(0),1;
    cutin "",255;
    callshop getarg(0),getarg(1);
    end;
}

function    script    QA_ItemBuy    {
for (set [email protected],0; [email protected] < getarraysize(@bought_nameid); set [email protected],[email protected]+1) {
    sleep2 1;
    set @bought_nameid,@bought_nameid[[email protected]];
    deletearray @itemuse[0],getarraysize(@itemuse);
    deletearray @itemusemany[0],getarraysize(@itemusemany);
    set @broken,0;    set @zenyuse, 0;
    callfunc "QA_Buy";
        if(@itemuse[0] <= 0)    goto check;    
            set [email protected],0;    set [email protected],0;    set @itemgetmany,0;
            for( set [email protected],0; [email protected] < getarraysize(@itemuse); set [email protected],[email protected]+1 ) {
                if([email protected] >= getarraysize(@itemuse)) break;
                set [email protected][[email protected]], countitem(@itemuse[[email protected]])/@itemusemany[[email protected]];
                if([email protected] == 0) set @itemgetmany,[email protected][[email protected]];
                if(@itemgetmany > [email protected][[email protected]]) set @itemgetmany,[email protected][[email protected]];
                set [email protected],[email protected]+1;
                continue;
            }
check:    
    dispbottom "=============================================";
        if(@itemuse[0] <= 0){
            if (0 == getitemslots( @bought_nameid[[email protected]])){    dispbottom "ในขณะนี้ "+getitemname(@bought_nameid[[email protected]])+" ไม่มี Quest ให้แลก";    }
            if (1 <= getitemslots( @bought_nameid[[email protected]])){    dispbottom "ในขณะนี้ "+getitemname(@bought_nameid[[email protected]])+" ["+getitemslots( @bought_nameid[[email protected]])+"] ไม่มี Quest ให้แลก";    }
        }
        else if (@itemgetmany == 0){
            if (0 == getitemslots( @bought_nameid[[email protected]])){    dispbottom "Item ที่ต้องการแลกกับ "+getitemname(@bought_nameid[[email protected]])+" จำนวน 1 ea";    }
            if (1 <= getitemslots( @bought_nameid[[email protected]])){    dispbottom "Item ที่ต้องการแลกกับ "+getitemname(@bought_nameid[[email protected]])+" ["+getitemslots( @bought_nameid[[email protected]])+"] จำนวน 1 ea";    }
            set [email protected],0;
            for( set [email protected],0; [email protected] < getarraysize(@itemuse); set [email protected],[email protected]+1 ) {
                if([email protected] >= getarraysize(@itemuse)) break;
                if (0 == getitemslots( @itemuse[[email protected]])){    dispbottom " "+([email protected]+1)+"> "+getitemname(@itemuse[[email protected]])+" จำนวน "[email protected][[email protected]]+" ea";    }
                if (1 <= getitemslots( @itemuse[[email protected]])){    dispbottom " "+([email protected]+1)+"> "+getitemname(@itemuse[[email protected]])+" ["+getitemslots( @itemuse[[email protected]])+"] จำนวน "[email protected][[email protected]]+" ea";    }
                set [email protected],[email protected]+1;
                continue;
            }
            if(@broken != 0) {    set [email protected],[email protected];    dispbottom " --> มีโอกาสเสียหาย  "[email protected]+" % ";    }
            if(@zenyuse != 0) {    dispbottom    "และใช้เงินจำนวน  "+ @zenyuse +" Zeny";    }
        }
        else if (@bought_quantity[[email protected]] > @itemgetmany){
            dispbottom "จาก Item ที่ท่านมี ท่านสามารถแลก "+getitemname(@bought_nameid[[email protected]])+" ได้ไม่เกิน  "[email protected]+" ea ";
        }
        else if (Zeny < (@zenyuse*@bought_quantity[[email protected]])){    
            if (@bought_quantity[[email protected]] == 1)    dispbottom "เงินที่ท่านเตรียมมามีไม่พอ ต้องใช้เงินจำนวน  "[email protected]+" Zeny ในการแลก "+getitemname(@bought_nameid[[email protected]])+"";
            else if (@bought_quantity[[email protected]] >= 2)    dispbottom "เงินที่ท่านเตรียมมามีไม่พอ ต้องใช้เงินจำนวน  "+(@zenyuse*@bought_quantity[[email protected]])+" Zeny ในการแลก "+getitemname(@bought_nameid[[email protected]])+" จำนวน "[email protected]_quantity[[email protected]]+" ea";
        }
        else if ((@bought_quantity[[email protected]] <= @itemgetmany) && (Zeny >= (@zenyuse*@bought_quantity[[email protected]]))){
            set [email protected],0;    set [email protected],0;
            for( set [email protected],0; [email protected] < getarraysize(@itemuse); set [email protected],[email protected]+1 ) {
                if([email protected] >= getarraysize(@itemuse)) break;
                delitem @itemuse[[email protected]],@itemusemany[[email protected]]*@bought_quantity[[email protected]];
                dispbottom "-> "+getitemname(@itemuse[[email protected]])+" ได้ถูกนำไปใช้จำนวน "+(@itemusemany[[email protected]]*@bought_quantity[[email protected]])+" ea";
                set [email protected],[email protected]+1;
                continue;
            }
            if(@zenyuse != 0) {    
                set Zeny,([email protected]*@bought_quantity[[email protected]]);
                dispbottom "-> เงินได้ถูกนำไปใช้จำนวน "+(@zenyuse*@bought_quantity[[email protected]])+" zeny";
            }
            if(@broken != 0) {    
                set [email protected],rand(1,100);
                if(@broken < [email protected]) {
                    emotion 23;
                    specialeffect2 155;
                    dispbottom "Gang Gang Gang  Boommmm !!";
                    dispbottom "การเจาะรู "+getitemname(@bought_nameid[[email protected]])+" ["+getitemslots( @bought_nameid[[email protected]])+"] ล้มเหลว เสียใจด้วย !!";
                    set @bought_quantity[[email protected]],0;
                }
                if(@broken >= [email protected]) {
                    emotion 21;
                    specialeffect2 154;
                    dispbottom "Gang Gang Gang  Gang !!";
                    dispbottom "การเจาะรู "+getitemname(@bought_nameid[[email protected]])+" ["+getitemslots( @bought_nameid[[email protected]])+"] เสร็จสมบูรณ์  !!";
                }
            } 
            if(@broken == 0) {
                emotion 33;
                specialeffect2 488;
            }
            getitem @bought_nameid[[email protected]],@bought_quantity[[email protected]];
        }
}
dispbottom "=============================================";
deletearray @bought_nameid[0],getarraysize(@bought_nameid);
deletearray @bought_quantity[0],getarraysize(@bought_quantity);
deletearray @itemuse[0],getarraysize(@itemuse);
deletearray @itemusemany[0],getarraysize(@itemusemany);
set @broken,0;    set @zenyuse, 0;
end;
}

function    script    QA_ItemSell    {
set Zeny, @zenyold;
for (set [email protected],0; [email protected] < getarraysize(@sold_nameid); set [email protected],[email protected]+1) {
    sleep2 1;
    set @sold_nameid,@sold_nameid[[email protected]];
    set @itemuse,0;    set @itemget,0;    set @zenyuse, 0;
    callfunc "QA_Sell";
        if(@itemuse <= 0)    goto check;
            set @itemgetmany, @sold_quantity[[email protected]]/@itemuse;
check:    
    dispbottom "=============================================";
        if(@itemuse <= 0){    
            getitem @sold_nameid[[email protected]],@sold_quantity[[email protected]];
            dispbottom "สามารถรวม Elunium กับ Oridecon และทำ Quiver Milk กับ 17 Caratได้เท่านั้น";    
        }
        else if (@itemgetmany == 0){
            getitem @sold_nameid[[email protected]],@sold_quantity[[email protected]];
            dispbottom "ต้องใช้ "+getitemname(@sold_nameid[[email protected]])+" อย่างน้อย "[email protected]+" ea ในการแลก "+getitemname(@itemget)+"";
            if(@zenyuse != 0) {    dispbottom    "และใช้เงินจำนวน  "+ @zenyuse +" Zeny";    }
        }
        else if (Zeny < (@zenyuse*@itemgetmany)){
            getitem @sold_nameid[[email protected]],@sold_quantity[[email protected]];
            dispbottom "เงินที่ท่านเตรียมมามีไม่พอ ต้องใช้เงินจำนวน  "+(@zenyuse*@itemgetmany)+" Zeny ในการแลก "+getitemname(@itemget)+" จำนวน "[email protected]+" ea";
        }
        else if ((1 <= @itemgetmany) && (Zeny >= (@zenyuse*@itemgetmany))){
            delitem @sold_nameid[[email protected]],@itemuse*@itemgetmany;
            dispbottom "-> "+getitemname(@sold_nameid[[email protected]])+" ได้ถูกนำไปใช้จำนวน "+(@itemuse*@itemgetmany)+" ea";
            if(@zenyuse != 0){
                set Zeny,([email protected]*@itemgetmany);
                dispbottom "-> เงินได้ถูกนำไปใช้จำนวน "+(@zenyuse*@itemgetmany)+" zeny";            
            }
            getitem @sold_nameid[[email protected]],@sold_quantity[[email protected]][email protected]*@itemgetmany;
            getitem @itemget,@itemgetmany;
        }
}
dispbottom "=============================================";
deletearray @sold_nameid[0],getarraysize(@sold_nameid);
deletearray @sold_quantity[0],getarraysize(@sold_quantity);
set @itemuse,0;    set @itemget,0;    set @zenyuse, 0;
end;
}

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this