Jump to content
Madeon

Cambiar objeto de Compra en Telma

Recommended Posts

Buenas, Alguien podria guiarme/ayudarme con esto
 

-	shop	bg_shop1	-1,512:-1
-	shop	bg_shop2	-1,512:-1
-	shop	bg_shop3	-1,512:-1
-	shop	bg_shop4	-1,512:-1

bat_room,160,148,3	script	Telma	701,{
	function  i_Shop;
	mes "Bienvenid" + (Sex?"o caballero ":"a querida dama ") + ",¿qué desea comprar?";
	set [email protected]$ , "";
	for ( set [email protected] , 1; [email protected] < getarraysize(.Menu$); set [email protected] , [email protected] + 1 ) 
		set [email protected]$ , [email protected]$ + " ^10B2D2 > ^000000 " + .Menu$[[email protected]] + ":";
	set [email protected] , select([email protected]$);

	dispbottom "[Servidor]: Recuerda, sólo se puede comprar 1 item a la vez.";
	close2;
		callshop "bg_shop"[email protected],1;
		npcshopattach "bg_shop"[email protected];
		set @opt , [email protected];
	end;
end;
	

function i_Shop {
	
	if ( getitemname( getarg(0) ) == "null" ) 
	{ 
		debugmes " Item " + getarg(0) + ", desconocido"; 
		return; 
	}
	
	for ( set [email protected] , 0; [email protected] < 4; set [email protected] , [email protected] + 1 )
		set getd(".item_"+getarg(0)+getarg(3)+"["[email protected]+"]"),getarg([email protected]);
		
	npcshopadditem "bg_shop"+getarg(3),getarg(0),getarg(1);
	sleep 1;
	return; 
}

OnWhisperGlobal:
	if ( getgmlevel() <= 60 ) end;
 		if (@whispervar0$ != "activar") end;
OnInit:

		setarray .Menu$[1],"^FF0000Battleground Points^000000","Battleground Exclusivo","Universal Items";
		//    item,cant,precio,tienda;
		//[email protected][1],id_item,[2]cantidad,[3]precio;
		i_Shop (5000,1,10,1);
		i_Shop (30212,3,2,1);
		i_Shop (7291,30,150,1);
		i_Shop (7295,30,150,1);
		i_Shop (7292,30,150,1);
		i_Shop (4354,1,200,1);
		i_Shop (5453,1,100,1);
		i_Shop (4429,1,350,1);
		i_Shop (547,150,1,2);
		i_Shop (11501,100,1,2);
		i_Shop (11502,100,1,2);
		i_Shop (522,70,1,2);
		i_Shop (526,70,1,2);
		i_Shop (14536,15,1,2);
		i_Shop (678,10,1,2);
		i_Shop (7135,40,1,2);
		i_Shop (7136,40,1,2);
		i_Shop (7137,30,1,2);
		i_Shop (7138,30,1,2);
		i_Shop (7139,25,1,2);
		i_Shop (671,25,1,2);
		i_Shop (715,50,1,2);
		i_Shop (716,100,1,2);
		i_Shop (717,200,1,2);
		i_Shop (12016,20,1,2);
		i_Shop (1025,40,1,2);
		i_Shop (7321,25,1,2);
		i_Shop (662,10,1,2);
		i_Shop (12031,20,1,2);
		i_Shop (12030,20,1,2);
		i_Shop (12029,20,1,2);
		i_Shop (12072,3,1,2);
		i_Shop (12077,3,1,2);
		i_Shop (12082,3,1,2);
		i_Shop (12087,3,1,2);
		i_Shop (12092,3,1,2);
		i_Shop (12097,3,1,2);
		i_Shop (12114,15,1,2);
		i_Shop (12115,15,1,2);
		i_Shop (12116,15,1,2);
		i_Shop (12117,15,1,2);
		i_Shop (12319,10,1,2);
		i_Shop (12320,10,1,2);
		i_Shop (12321,10,1,2);
		i_Shop (12299,5,3,2);
		i_Shop (522,70,3,3);
		i_Shop (7137,30,3,3);
		i_Shop (7138,30,3,3);
		i_Shop (662,10,3,3);
		i_Shop (14536,15,3,3);
		i_Shop (12119,10,3,3);
		i_Shop (12120,10,3,3);
		i_Shop (12118,10,3,3);
		i_Shop (12121,10,3,3);
		i_Shop (12114,15,3,3);
		i_Shop (12115,15,3,3);
		i_Shop (12116,15,3,3);
		i_Shop (12117,15,3,3);
		i_Shop (12031,20,3,3);
		i_Shop (12030,20,3,3);
		i_Shop (12029,20,3,3);
		i_Shop (14287,5,3,3);
		i_Shop (14288,5,3,3);
		i_Shop (12319,10,3,3);
		i_Shop (12320,10,3,3);
		i_Shop (12321,10,3,3);
		i_Shop (606,10,3,3);
		i_Shop (7524,10,3,3);
		i_Shop (14510,10,3,3);
		i_Shop (14509,10,3,3);
		i_Shop (657,10,3,4);


	for( set [email protected] , 1; [email protected] <  4; set [email protected] , [email protected] + 1 )
		npcshopdelitem "bg_shop"[email protected],512;

end;

OnBuyItem:

	if ( getarraysize( @bought_nameid ) > 1 ) 
		mes "Sólo se puede comprar 1 item a la vez.";

	switch ( @opt ) 
	{
		case 1:
			set		[email protected][0],@bought_nameid;
			copyarray	[email protected][1],getd(".item_"[email protected][email protected]+"[0]"),getarraysize(getd(".item_"[email protected][email protected]+"[0]"));
			if ( [email protected][1] ) 
			{
				mes strcharinfo(0) + " Un error ocurrio.";
				close;
			}	

			mes "Deseas comprar el item " + getitemname([email protected][1]) + " al precio de ^DF0101" + [email protected][3] * @bought_quantity + " BG's jugados?^000000";
			if ( select ( " - Sí : - Mejor no " ) == 2 ) 
				close;
	
			if ( #BGPOINTS < [email protected][3] * @bought_quantity ) {
				next;
				mes "No tienes la cantidad de bg's jugados";
				mes "Actualmente tienes : " + #BGPOINTS + " BG's jugados";
			} else {
				getitem @bought_nameid , [email protected][2] * @bought_quantity;
				set #BGPOINTS , #BGPOINTS - [email protected][3] * @bought_quantity;
			}
			close;
		//no-break;
		case 3:
		case 4:
		case 2:
			set		[email protected][0],@bought_nameid;
			copyarray	[email protected][1],getd(".item_"[email protected][email protected]+"[0]"),getarraysize(getd(".item_"[email protected][email protected]+"[0]"));
			if ( [email protected][1] || [email protected][4] == 1 ) 
			{
				mes strcharinfo(0) + " Un error ocurrio.";
				close;
			}

			set [email protected]_medallas , [email protected][3] * @bought_quantity;
			set [email protected]_items    , [email protected][2] * @bought_quantity;

			if ( @bought_quantity > 200 ) 
				mes "El límite máximo es 200.";
		
			mes " ^10B2D2 > ^000000 Item a comprar : " + substr(getitemname([email protected][1]),0,8)+"...";
			mes " ^10B2D2 > ^000000 Total medallas : " + [email protected]_medallas;
			mes " ^10B2D2 > ^000000 Total comprar  : " + [email protected]_items;	
			set [email protected]$, " [ ^10B2D2 Medallas a gastar : " + [email protected]_medallas + " medalla(s)^000000 ]"; 
			
			next;

			if ( countitem( 7773 ) + countitem( 7829 ) + countitem( 7828 ) < [email protected]_medallas ) 
				mes "No tienes la cantidad de medallas necesitadas";
			
			mes " ^10B2D2 > ^000000 Valor Badges a gastar : ";
			input [email protected];
			
			if ( [email protected] >= [email protected]_medallas ) 
			{
				if ( countitem(7829) > [email protected] ) 
				{
					if ( [email protected]_medallas < [email protected] )
						set [email protected] , [email protected]_medallas;
					set [email protected] , 1;
					break;
				} else
					mes "No tienes suficientes medallas valor";
			}
		
			mes " ^10B2D2 > ^000000 Bravery Badges a gastar : ";
			input [email protected];
			
			if ( [email protected] >= [email protected]_medallas || [email protected] + [email protected] >= [email protected]_medallas ) 
			{
				if ( countitem(7828) >= [email protected] ) 
				{
					if ( ( [email protected]_medallas - [email protected] ) < [email protected]  )
						set [email protected] , ( [email protected]_medallas - [email protected] );
					set [email protected] , 1;
					break;
				} else
					mes "No tienes suficientes medallas bravery";
			}
			
			mes " ^10B2D2 > ^000000 Battle Badges a gastar : ";
			input [email protected];
			
			if ( [email protected] >= [email protected]_medallas ||  [email protected] + [email protected] + [email protected] >= [email protected]_medallas  ) 
			{
				if ( countitem(7773) >= [email protected] ) 
				{
					if ( ( [email protected]_medallas - [email protected] - [email protected] ) < [email protected]  )
						set [email protected] , ( [email protected]_medallas - [email protected] - [email protected] );
					set [email protected] , 1;
					break;
				} else
					mes "No tienes suficientes medallas Battle.";
			}
		
			next;
			mes "No tienes la cantidad de medallas requeridas.";
		//no-break;
	}
	
	if ( [email protected] ) 
		close;

	next;
	
	mes "¿Dónde quieres los consumibles?";
	if ( select(" - Inventario") == 1 ) 
	{
		if( checkweight(@bought_nameid,[email protected]_items ) == 0 ) 
		{
			mes "Se ve que no puede llevar las cosas que quieres comprar.";
			mes "Debes almacenar algunos artículos en su almacenamiento Kafra.";
			close;
		}
		
		delitem 7829    ,   [email protected];
		delitem 7828    , [email protected];
		delitem 7773    ,  [email protected];
		
		if ( @opt == 2 ) 
		{
			set [email protected], getbattleflag("bg_reserved_char_id");
			set [email protected]$, "Battleground";
			getitem2 @bought_nameid,[email protected]_items,1,0,0,254,0,[email protected]&0xffff,([email protected]>>16)&0xffff;
		} else
			getitem @bought_nameid,[email protected]_items;
		mes "Gracias por comprar";
	}
	
	if ( @opt == 2 ) 
	{
		set [email protected], getbattleflag("bg_reserved_char_id");
		set [email protected]$, "Battleground";
		{
		mes "He visto que su Storage no puede aceptar más artículos.";
			mes "Vaya a su Storage y comprobar el espacio libre.";
			close;
		}
	} else {
		{
			mes "He visto su inventory no puede aceptar más artículos.";
			mes "Vaya a inventory compruebe el espacio libre.";
			close;
		}
	}
	
	close2;
		delitem 7829    ,   [email protected];
		delitem 7828    , [email protected];
		delitem 7773    ,  [email protected];
	end;
    }

 

Quiero cambiar el objeto con el que se compra en esta parte que se muestra abajo.

de #BGPOINTS

Item ID: 32025

		case 1:
			set		[email protected][0],@bought_nameid;
			copyarray	[email protected][1],getd(".item_"[email protected][email protected]+"[0]"),getarraysize(getd(".item_"[email protected][email protected]+"[0]"));
			if ( [email protected][1] ) 
			{
				mes strcharinfo(0) + " Un error ocurrio.";
				close;
			}	

			mes "Deseas comprar el item " + getitemname([email protected][1]) + " al precio de ^DF0101" + [email protected][3] * @bought_quantity + " BG's jugados?^000000";
			if ( select ( " - Sí : - Mejor no " ) == 2 ) 
				close;
	
			if ( #BGPOINTS < [email protected][3] * @bought_quantity ) {
				next;
				mes "No tienes la cantidad de bg's jugados";
				mes "Actualmente tienes : " + #BGPOINTS + " BG's jugados";
			} else {
				getitem @bought_nameid , [email protected][2] * @bought_quantity;
				set #BGPOINTS , #BGPOINTS - [email protected][3] * @bought_quantity;
			}
			close;
		//no-break;

 

o cambiar la interfaz de compra de este script que pase de comprar en el menu a tipo shop, gracias de antemano.
 

telma.txt

Edited by Madeon
Link to comment
Share on other sites

case 1:
			set		[email protected][0],@bought_nameid;
			copyarray	[email protected][1],getd(".item_"[email protected][email protected]+"[0]"),getarraysize(getd(".item_"[email protected][email protected]+"[0]"));
			if ( [email protected][1] ) 
			{
				mes strcharinfo(0) + " Un error ocurrio.";
				close;
			}	

			mes "Deseas comprar el item " + getitemname([email protected][1]) + " al precio de ^DF0101" + [email protected][3] * @bought_quantity + " BG's jugados?^000000";
			if ( select ( " - Sí : - Mejor no " ) == 2 ) 
				close;
			if ( countitem( 32025 ) < [email protected][3] * @bought_quantity ) {
				next;
				mes "No tienes la cantidad de bg's jugados";
				mes "Actualmente tienes : " + countitem( 32025 ) + " BG's jugados";
			} else {
				getitem @bought_nameid , [email protected][2] * @bought_quantity;
				delitem 32025, [email protected][3] * @bought_quantity;
			}
			close;
		//no-break;

 

  • Upvote 1
Link to comment
Share on other sites

On 1/16/2020 at 7:35 AM, dev LOOLP said:
case 1:
			set		[email protected][0],@bought_nameid;
			copyarray	[email protected][1],getd(".item_"[email protected][email protected]+"[0]"),getarraysize(getd(".item_"[email protected][email protected]+"[0]"));
			if ( [email protected][1] ) 
			{
				mes strcharinfo(0) + " Un error ocurrio.";
				close;
			}	

			mes "Deseas comprar el item " + getitemname([email protected][1]) + " al precio de ^DF0101" + [email protected][3] * @bought_quantity + " BG's jugados?^000000";
			if ( select ( " - Sí : - Mejor no " ) == 2 ) 
				close;
			if ( countitem( 32025 ) < [email protected][3] * @bought_quantity ) {
				next;
				mes "No tienes la cantidad de bg's jugados";
				mes "Actualmente tienes : " + countitem( 32025 ) + " BG's jugados";
			} else {
				getitem @bought_nameid , [email protected][2] * @bought_quantity;
				delitem 32025, [email protected][3] * @bought_quantity;
			}
			close;
		//no-break;

 

 

Gracias

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
Reply to this topic...

×   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.