Jump to content
  • 0
Myth

Only Cards can sell/see

Question

anyone can help me with this script? if i trade card all my items on my inventory shows up i want only cards on my inventory will be show

 

prontera,155,178,5	script	Card Trader	421,{
	mes "[Card Trader]";
	mes "Hi, "+strcharinfo(0)+"!";
	mes "What can I do for you?";
	next;
	switch(select(" > Information: > Trade in cards: > Point shop (^0055FF"+getd(.Points$)+"^000000): > Leave")) {
	case 1:
		mes "[Card Trader]";
		mes "Do you find that you've got";
		mes "useless cards lying around?";
		mes "I'll be glad to take them off";
		mes "your hands!";
		next;
		mes "[Card Trader]";
		mes "I'll give you ^0055FF"+.Points[0]+" Point"+((.Points[0] == 1)?"":"s")+"^000000 for normal card each"; 
		mes "card you give me, and";
		mes "^0055FF"+.Points[1]+" Points^000000 for MVP cards.";
		mes "You can trade those points";
		mes "for items later on.";
		mes "How does that sound?";
		emotion ET_MONEY;
		close;
	case 2:
		mes "[Card Trader]";
		mes "Select the cards you";
		mes "want to trade in.";
		if (.Level) {
			mes " ";
			mes "They must be dropped";
			mes "by monsters of level";
			mes .Level+" and above.";
		}
		deletearray @sold_nameid[0],getarraysize(@sold_nameid);
		callshop "card_shop",2;
		npcshopattach "card_shop";
		end;
	case 3:
		mes "[Card Trader]";
		mes "You have ^0055FF"+getd(.Points$)+"^000000 Point"+((getd(.Points$) == 1)?".":"s.");
		callshop "card_shop",1;
		npcshopattach "card_shop";
		end;
	case 4:
		mes "[Card Trader]";
		mes "*yawn*";
		mes "See you later!";
		emotion ET_SLEEPY;
		close;		
	}

OnSellItem:
	mes "Cards to sell:";
	mes "-----------------------------------";
	for(set [email protected],0; [email protected]<getarraysize(@sold_nameid); set [email protected]i,[email protected]i+1)
		if (@sold_nameid[[email protected]i] > 4000 && @sold_nameid[[email protected]] < 4700) {
			if (.Level) {
				query_sql("SELECT `LV` FROM `mob_db` WHERE `DropCardid` = "[email protected]_nameid[[email protected]],[email protected]);
				if ([email protected] < .Level) {
					dispbottom getitemname(@sold_nameid[[email protected]])+" is under the minimum level.";
					continue;
				}
			}
			set [email protected]_id[getarraysize([email protected]_id)], @sold_nameid[[email protected]];
			set [email protected]_amt[getarraysize([email protected]_amt)], @sold_quantity[[email protected]];
			set [email protected], compare(.MVP$,""[email protected]_nameid[[email protected]]);
			mes (([email protected])?"  ^FF0000":"  ^777777")[email protected]_quantity[[email protected]]+"x "+getitemname(@sold_nameid[[email protected]])+"^000000";
			set [email protected]_total, [email protected]_total+(@sold_quantity[[email protected]]*(([email protected])?.Points[1]:.Points[0]));
		}
	deletearray @sold_nameid[0], getarraysize(@sold_nameid);
	deletearray @sold_quantity[0], getarraysize(@sold_quantity);
	if ([email protected]_id) {
		mes "  ^777777(none)^000000";
		emotion ET_SWEAT;
		close;
	}
	mes " ";
	mes "---------- Total: ^0055FF"[email protected]_total+" pt.^000000 -------";
	next;
	if(select(" > ^0055FFComplete trade...^000000: > ^777777Cancel^000000") == 2) {
		mes "[Card Trader]";
		mes "Oh, okay...";
		emotion ET_SCRATCH;
		close;
	}
	for(set [email protected],0; [email protected]<getarraysize([email protected]_id); set [email protected],[email protected]+1)
		delitem [email protected]_id[[email protected]],[email protected]_amt[[email protected]];
	setd .Points$, getd(.Points$)[email protected]_total;
	mes "[Card Trader]";
	mes "All done!";
	emotion ET_DELIGHT;
	close;

OnBuyItem:
	for(set [email protected],0; [email protected]<getarraysize(@bought_nameid); set [email protected],[email protected]+1)
		for(set [email protected],0; [email protected]<getarraysize(.Shop); set [email protected]j,[email protected]j+2)
			if (@bought_nameid[[email protected]i] == .Shop[[email protected]j]) {
				set [email protected]cost, [email protected]cost+(.Shop[[email protected]j+1]*@bought_quantity[[email protected]i]);
				break;
			}
	if ([email protected]cost > getd(.Points$)) {
		mes "[Card Trader]";
		mes "You don't have enough Points.";
		emotion ET_HUK;
	}
	else {
		mes "Items purchased:";
		mes "-----------------------------------";
		for(set [email protected],0; [email protected]<getarraysize(@bought_nameid); set [email protected],[email protected]+1) {
			getitem @bought_nameid[[email protected]], @bought_quantity[[email protected]];
			mes "  ^777777"[email protected]_quantity[[email protected]]+"x "+getitemname(@bought_nameid[[email protected]])+"^000000";
		}
		mes " ";
		mes "---------- Total: ^0055FF"[email protected]+" pt.^000000 -------";
		setd .Points$, getd(.Points$)[email protected];
		emotion ET_MONEY;
	}
	deletearray @bought_nameid[0], getarraysize(@bought_nameid);
	deletearray @bought_quantity[0], getarraysize(@bought_quantity);
	close;

OnInit:
	//waitingroom "Card Trader",0;
	set .Level,0;   		// Minimum monster level to trade corresponding cards.  
	set .Points$,"#Card_Points";	// Variable to store points.
	setarray .Shop[0],		// Card Shop items: <ID>,<point cost>
	  616,3,20099,100;
	setarray .Points[0],1,0;	// Points per <normal card>,<MVP card> 
	set .MVP$,			// List of MVP cards.
	  "4123,4302,4236,4134,4121,4425,4376,4132,4131,4144,4137,4148,4324,4305,4146,4142,4352,4143,4330,4263,4374,4372"+
	  "4147,4168,4386,4276,4135,4342,4318,4128,4408,4430,4145,4441,4407,4403,4399";
	
	npcshopdelitem "card_shop",909;
	for(set [email protected],0; [email protected]<getarraysize(.Shop); set [email protected],[email protected]+2)
		npcshopadditem "card_shop",.Shop[[email protected]],.Shop[[email protected]+1];
	end;
}
-	shop	card_shop	-1,909:-1


 

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.