Jump to content

Recommended Posts

Posted (edited)

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 .@Menu$ , "";
	for ( set .@i , 1; .@i < getarraysize(.Menu$); set .@i , .@i + 1 ) 
		set .@Menu$ , .@Menu$ + " ^10B2D2 > ^000000 " + .Menu$[.@i] + ":";
	set .@Select , select(.@Menu$);

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

function i_Shop {
	
	if ( getitemname( getarg(0) ) == "null" ) 
	{ 
		debugmes " Item " + getarg(0) + ", desconocido"; 
		return; 
	}
	
	for ( set .@i , 0; .@i < 4; set .@i , .@i + 1 )
		set getd(".item_"+getarg(0)+getarg(3)+"["+.@i+"]"),getarg(.@i);
		
	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;
		//.@purchase[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 .@i , 1; .@i <  4; set .@i , .@i + 1 )
		npcshopdelitem "bg_shop"+.@i,512;

end;

OnBuyItem:

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

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

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

			set .@total_medallas , .@purchase[3] * @bought_quantity;
			set .@total_items    , .@purchase[2] * @bought_quantity;

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

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

	next;
	
	mes "¿Dónde quieres los consumibles?";
	if ( select(" - Inventario") == 1 ) 
	{
		if( checkweight(@bought_nameid,.@total_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    ,   .@valor;
		delitem 7828    , .@bravery;
		delitem 7773    ,  .@battle;
		
		if ( @opt == 2 ) 
		{
			set .@cID, getbattleflag("bg_reserved_char_id");
			set .@Tarjet$, "Battleground";
			getitem2 @bought_nameid,.@total_items,1,0,0,254,0,.@cID&0xffff,(.@cID>>16)&0xffff;
		} else
			getitem @bought_nameid,.@total_items;
		mes "Gracias por comprar";
	}
	
	if ( @opt == 2 ) 
	{
		set .@cID, getbattleflag("bg_reserved_char_id");
		set .@Tarjet$, "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    ,   .@valor;
		delitem 7828    , .@bravery;
		delitem 7773    ,  .@battle;
	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		.@purchase[0],@bought_nameid;
			copyarray	.@purchase[1],getd(".item_"+@bought_nameid+@opt+"[0]"),getarraysize(getd(".item_"+@bought_nameid+@opt+"[0]"));
			if ( !.@purchase[1] ) 
			{
				mes strcharinfo(0) + " Un error ocurrio.";
				close;
			}	

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

			mes "Deseas comprar el item " + getitemname(.@purchase[1]) + " al precio de ^DF0101" + .@purchase[3] * @bought_quantity + " BG's jugados?^000000";
			if ( select ( " - Sí : - Mejor no " ) == 2 ) 
				close;
			if ( countitem( 32025 ) < .@purchase[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 , .@purchase[2] * @bought_quantity;
				delitem 32025, .@purchase[3] * @bought_quantity;
			}
			close;
		//no-break;

 

  • Upvote 1
  • 2 weeks later...
Posted
On 1/16/2020 at 7:35 AM, dev LOOLP said:

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

			mes "Deseas comprar el item " + getitemname(.@purchase[1]) + " al precio de ^DF0101" + .@purchase[3] * @bought_quantity + " BG's jugados?^000000";
			if ( select ( " - Sí : - Mejor no " ) == 2 ) 
				close;
			if ( countitem( 32025 ) < .@purchase[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 , .@purchase[2] * @bought_quantity;
				delitem 32025, .@purchase[3] * @bought_quantity;
			}
			close;
		//no-break;

 

 

Gracias

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...