Jump to content
  • 0

Multi currency shop


jaynard09

Question


  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  80
  • Reputation:   0
  • Joined:  07/03/12
  • Last Seen:  

// Settings :
//	-	Only required to edit the ShopSetting() Function
//			Notes : You may also add / remove Menu ( If any ) 
//	-	Shop Currency can be either ItemID or Variable Name, but must write within Quotation Marks ( "" )
//			Ex. of Variable.	->	Zeny , #CASHPOINTS , #KAFRAPOINTS , CustomVariable , #CustomVariable
//	-	ERROR Message are used to show Invalid Settings in your NPC.


// Leave this alone...
-	shop	Emistry_Shop	-1,512:100


itemmall,166,71,6	script	Rental	871,{
function ShopSettings;
function ValidateCost;
function CurrencyInfo;
function ClearData;
function ValueConvert;
function ErrorNotice;

mes "This is a rental shop containing all different Currencies.";
mes "Please do not skip the note before do a transaction -Akai";
mes "^00FF00____________________________^000000";
mes "1.^FF0000All items has 7 days of duration^000000.";
mes "2.^FF0000All items has different currencies. Quest are included^000000.";
next;
mes "3.^FF0000All items may not show the expiration date, better to note your own!.^000000.";
mes "4.^FF0000After buying remember the GM can't do any action of suspending your items. They don't have any power to do that.^000000.";
mes "5.^FF0000and Last GM can't help you for any concern regarding of this items.^000000.";
next;
mes "Please choose what currency would you like to use.";
next;
// Menu Selection
select("Cash Points","TCG Card","Proof of donation","Zeny","Quest");

ClearData();
ShopSettings( @menu );
npcshopitem "Emistry_Shop",512,100;
npcshopdelitem "Emistry_Shop",512;
for(set .@i,0; .@i < getarraysize( @ItemLists ); set .@i,.@i+1)
	npcshopadditem "Emistry_Shop",@ItemLists[.@i],@ItemCost[.@i];
mes "Okay...wait awhile";
mes "^00FF00____________________________^000000";
CurrencyInfo( @Currency$ );
mes "^00FF00____________________________^000000";
callshop "Emistry_Shop",1;
npcshopattach "Emistry_Shop";
end;


function	ShopSettings	{
	switch( getarg(0) ){
		Case 1:
			// Currency [ Item ID / Variable Name ]
			set @Currency$,"#CASHPOINTS";
			// Item ID Lists
			setarray @ItemLists[0],5374,5518,5013,5389,5377,5564,20072,29299,29300,5353,5495;
			// Item Price
			setarray @ItemCost[0],45,47,35,30,25,30,70,25,25,32,36;
			break;
		Case 2:
			// Currency [ Item ID / Variable Name ]
			set @Currency$,"7179";
			// Item ID Lists
			setarray @ItemLists[0],2375,2433,2537,2729,2374,2357,2524,2421,2115;
			// Item Price
			setarray @ItemCost[0],27,30,32,15,25,25,28,25,30;
			break;
		Case 3:
			// Currency [ Item ID / Variable Name ]
			set @Currency$,"7179";
			// Item ID Lists
			setarray @ItemLists[0],1723;
			// Item Price
			setarray @ItemCost[0],12;
			break;
		Case 4:
			// Currency [ Item ID / Variable Name ]
			set @Currency$,"7179";
			// Item ID Lists
			setarray @ItemLists[0],2630;
			// Item Price
			setarray @ItemCost[0],35;
			break;
		Case 5:
			// Currency [ Item ID / Variable Name ]
			set @Currency$,"7227";
			// Item ID Lists
			setarray @ItemLists[0],2289,18507,5137,5132,5170,5377,5383;
			// Item Price
			setarray @ItemCost[0],28,30,33,15,51,40,15;
			break;
		// Case 4,5,6.....etc...
		default:
			ErrorNotice( "Invalid Menu Selection for Menu "+@menu+"." );
			close;
	}
	
	
if( @Currency$ == "" )
	ErrorNotice( "Invalid Currency Setting in Menu "+@menu+" ." );
if( getarraysize( @ItemCost ) != getarraysize( @ItemLists ) || getarraysize( @ItemLists ) != getarraysize( @ItemCost ) )
	ErrorNotice( "Missing or Extra Value of Item or Cost Settings in Menu "+@menu+" ." );
return;
}

function	ErrorNotice	{
	mes "^FF0000ERROR^000000 - "+getarg(0);
	mes "^00FF00____________________________^000000";
	mes "Inform this Message to ^0000FFGame Staffs^000000 immediately !";
	close;
}

function	CurrencyInfo	{
	if( getitemname( atoi( getarg(0) ) ) != "null" ){
		mes "Item Currency : ^FF0000"+getitemname( atoi( getarg(0) ) )+"^000000";
		mes "Available Amount : ^0000FF"+ValueConvert( countitem( atoi( getarg(0) ) ) )+"^000000";
	}else if( getitemname( atoi( getarg(0) ) ) == "null" ){
		mes "Variable Currency : ^FF0000"+getarg(0)+"^000000";
		mes "Available Amount : ^0000FF"+ValueConvert( getd( getarg(0) ) )+"^000000";
	}
return;
}

function	ValidateCost	{
	if( getitemname( atoi( getarg(0) ) ) != "null" ){
		if( countitem( atoi( getarg(0) ) ) < getarg(1) ) return 1;
	}else{
		if( getd( getarg(0) ) < getarg(1) ) return 1;
	}
return 0;
}

function ClearData	{
	set @Currency$,"";
	set @TotalCost,0;
	deletearray @bought_nameid[0],getarraysize( @bought_nameid );
	deletearray @bought_quantity[0],getarraysize( @bought_quantity );
	deletearray @ItemLists[0],getarraysize( @ItemLists );
	deletearray @ItemCost[0],getarraysize( @ItemCost );
return;
}

function	ValueConvert	{
	set .@num, atoi(""+getarg(0));
	if ( .@num == 0 || .@num >= 2147483647 ) return getarg(0);
	set .@l, getstrlen(""+.@num);
	for ( set .@i,0; .@i < .@l; set .@i, .@i + 1 ) {
		set .@num$, .@num % pow(10,.@i+1) / pow(10,.@i) + .@num$;
			if ( (.@i+1) % 3 == 0 && .@i+1 != .@l ) set .@num$, ","+ .@num$;
	}
	return .@num$;
}

OnBuyItem:
	ShopSettings( @menu );
	for(set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1)
		for(set @j,0; @j < getarraysize( @ItemLists ); set @j,@j+1)
			if( @ItemLists[@j] == @bought_nameid[@i] )
			set @TotalCost,@TotalCost + ( @ItemCost[@j] * @bought_quantity[@i] );
	mes "^FF0000       BILLING LIST^000000";
	mes "^00FF00____________________________^000000";
	for( set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1 )
			mes "^FF0000"+@bought_quantity[@i]+" x ^0000FF"+getitemname( @bought_nameid[@i] )+"^000000";
	mes "^00FF00____________________________^000000";

	if( getitemname( atoi( @Currency$ ) ) != "null" )
		mes "Total Cost : ^0000FF"+ValueConvert( @TotalCost )+" x "+getitemname( atoi( @Currency$ ) )+"^000000";
	else if( getitemname( atoi( @Currency$ ) ) == "null" ){
		mes "Total Cost : ^0000FF"+ValueConvert( @TotalCost )+" "+@Currency$+"^000000";
	}
	
	mes "^00FF00____________________________^000000";
	if( ValidateCost( @Currency$,@TotalCost ) ){
		if( getitemname( atoi( @Currency$ ) ) != "null" )
			mes "[ ^FF0000X^000000 ] Insufficient ^0000FF"+getitemname( atoi( @Currency$ ) )+"^000000";
		else{
			mes "[ ^FF0000X^000000 ] Insufficient ^0000FF"+@Currency$+"^000000";
		}
	}else{
		if( select( "^0000FFPurchase^000000:Cancel" ) == 1 ){
			if( getitemname( atoi( @Currency$ ) ) != "null" )
				delitem atoi( @Currency$ ),@TotalCost;
			else{
				set getd( @Currency$ ),getd( @Currency$ ) - @TotalCost;
			}
			for(set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1)
				getitem @bought_nameid[@i],@bought_quantity[@i];
			message strcharinfo(0),"Purchased "+getarraysize( @bought_nameid )+" Items.";
			mes "Thank you for shopping.";
		}
	}
ClearData();
close;

}

is it possible to make this rent item?

 

forget this solved!

 

I don't want to add one more topic so  i hope it i can use this thread.

 

 

 

i have problem with description. i can't change

 

ro\System

 

i finished to changed my item description but it doens't change in-game.

 

 

itemInfo.lub

	[20068] = {
		unidentifiedDisplayName = "White Gangster Scarf",
		unidentifiedResourceName  = "_gscarfwhite",
		unidentifiedDescriptionName = {
			"Custom effect from TanayRO",
			"Add Mdef+2 MATK+2% ^0000FF Decreases damage from Demi Human monster by 2%.^000000",
			"Class :^777777 Headgear^000000",
			"Defense :^777777 0^000000",
			"Equipped on :^777777 Low^000000",
			"Weight :^777777 1^000000",
			"Required Level :^777777 1^000000",
			"Applicable Job :^777777 Every Job^000000",
		},

itemInfo_RE.lub

[20068] = {
		unidentifiedDisplayName = "White Gangster Scarf",
		unidentifiedResourceName  = "_gscarfwhite",
		unidentifiedDescriptionName = {
			"Custom effect from TanayRO",
			"Add Mdef+2 MATK+2% ^0000FF Decreases damage from Demi Human monster by 2%.^000000",
			"Class :^777777 Headgear^000000",
			"Defense :^777777 0^000000",
			"Equipped on :^777777 Low^000000",
			"Weight :^777777 1^000000",
			"Required Level :^777777 1^000000",
			"Applicable Job :^777777 Every Job^000000",
		},
		identifiedDisplayName = "White Gangster Scarf",
		identifiedResourceName = "_gscarfwhite",
		identifiedDescriptionName = {
			"Vit + 10",
			"Int + 10",
			"Class :^777777 Headgear^000000",
			"Defense :^777777 0^000000",
			"Equipped on :^777777 Low^000000",
			"Weight :^777777 1^000000",
			"Required Level :^777777 1^000000",
			"Applicable Job :^777777 Every Job^000000",
		},
		slotCount = 0,
		ClassNum = 0
	},

client 20131223

Edited by jaynard09
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  1535
  • Reputation:   237
  • Joined:  08/03/12
  • Last Seen:  

u are changing for unidentified. u should change for identified

identifiedDisplayName = "White Gangster Scarf",                         //start here. Unidentified is for item that still not identified/magnify
		identifiedResourceName = "_gscarfwhite",
		identifiedDescriptionName = {
			"Vit + 10",
			"Int + 10",
			"Class :^777777 Headgear^000000",
			"Defense :^777777 0^000000",
			"Equipped on :^777777 Low^000000",
			"Weight :^777777 1^000000",
			"Required Level :^777777 1^000000",
			"Applicable Job :^777777 Every Job^000000",
		},
		slotCount = 0,
		ClassNum = 0
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  80
  • Reputation:   0
  • Joined:  07/03/12
  • Last Seen:  

yes sir, i did.. also the identified.. but still didn't change..

 

do i have to do something?

 

i restart the server but still no luck

 

I just restart again my computer that's weird.. Solved /pif

Edited by jaynard09
Link to comment
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.

×
×
  • Create New...