Jump to content

[Mini-Release] Cupón de coins personalizado


Mensajes recomendados

Hola chicos, os traigo una cosilla que he hecho que creo que es bastante útil y hará que nos evitemos crear cupones distintos para cantidad de Coins - Md's

 

Este objeto te permite ingresarle o retirarle coins y comerciar el cupón con las coins guardadas.

 

- El título del objeto cambia según las coins ingresadas

- La descripción cambia según las coins ingresadas

- Título y descripción se ven perfectamente en comercio, tanto un jugador como el otro

 

Pasos a seguir:

Parte cliente

 

 

-  Descompilamos root y abrimos uitooltip.py, dentro de uitooltip.py buscamos 

if 50026 == itemVnum:

bajo de ese if añadimos el siguiente elif:

elif 80018 == itemVnum:
	if 0 != metinSlot[0]:
		name = item.GetItemName()
		cantidad = metinSlot[0]
		name += " ("
		name += str(metinSlot[0])
		name += ")"
		self.SetTitle(name)
		self.AppendDescription("Cupón por valor de "+str(cantidad)+" Coins. Este objeto es comerciable." , 26)
		self.ShowToolTip()
	else:
		name = item.GetItemName()
		self.SetTitle(name)
		self.AppendDescription("Puedes ingresar coins a este objeto para después comerciarlo." , 26)
		self.ShowToolTip()

Cuidado con las tabulaciones, debe quedar así:

 

 

a80ea5a755676b8ee99303ffc4fbf033.png

 

 

 

Ya tenemos la parte del root hecha. Ahora descompilamos locale.

 

Abrimos item_list.txt y buscáis el item 80018. Si lo tenéis dejadlo de esta manera, y si no lo tenéis agregadlo así:

80018	ETC	icon/item/90009.tga

Ahora en el item_proto.xml ponéis esta linea:

<ItemDef Vnum="80018" Name="Cupon de Coins" LocalizedName="Cupón de Coins" Type="18" SubType="0" Weight="0" Size="1" AntiFlags="0" Flags="8192" WearFlags="0" ImmuneFlags="0" Gold="0" ShopBuyPrice="0" LimitType0="0" LimitValue0="0" LimitType1="0" LimitValue1="0" ApplyType0="0" ApplyValue0="0" ApplyType1="0" ApplyValue1="0" ApplyType2="0" ApplyValue2="0" Value0="0" Value1="0" Value2="0" Value3="0" Value4="0" Value5="0" Socket0="0" Socket1="0" Socket2="0" RefinedVnum="0" RefineSet="0" AlterToMagicItemPercent="0" Specular="0" GainSocketPercent="0" AddonType="0"  />
 
Compilais el item_proto, el locale y el root y lo metéis en la carpeta pack.

 
Parte servidor

Para proto en txt

Abrimos item_names.txt y ponemos
80018	Cupón de Coins

después abrimos item_proto.txt y introducimos

80018	±³È¯±Ç	ITEM_QUEST	0	1	NONE	LOG	NONE	NONE	0	0	0	0	0	LIMIT_NONE	0	LIMIT_NONE	0	APPLY_NONE	0	APPLY_NONE	0	APPLY_NONE	0	0	0	0	0	0	0	0	0	0

Para proto en SQL (Navicat)

Introducimos la siguiente query (No testeada, uso txt):
INSERT INTO `player.item_proto` VALUES ('80018', 0xB1B3C8AFB1C7, 0x4375706F6E20646520436F696E73, '18', '0', '0', '1', '0', '8192', '0', '', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '-1', '-1', '-1', '-1', '-1', '-1', '0', '0', '0');

Ahora la quest (En LIMIT_COINS cambiáis el máximo de Coins que se pueden ingresar de golpe):
quest cupon_coins begin
	state start begin
		function ingresar()
			local LIMIT_COINS = 10000
			say_title("Cupón de Coins - Ingresar")
			say("¿Cuantas Coins deseas ingresarle?")
			say_reward("Dispones de "..pc.get_coins().." Coins")
			local coi = tonumber(input())
			if coi > LIMIT_COINS then say("El número máximo de coins a ingresar[ENTER]son "..LIMIT_COINS.."") return end
			if coi > 0 and coi < LIMIT_COINS then
				if pc.get_coins() < coi then
					say("No tienes suficientes coins.")
					return
				else
					pc.change_coins(-coi)
					item.set_socket(0,coi+item.get_socket(0))
					say("Has ingresado "..coi.." coins al cupón.")
					char_log(80018, "ITEM", "Ingreso de "..coi.." Coins")
					return
				end
			end
		end
			
		when 80018.use begin
			if item.get_socket(0) == 0 then
				say_title("Cupón de Coins")
				say("El cupón está vacío, ¿Deseas")
				say("ingresarle Coins?")
				local a = select("Ingresar coins","Cancelar")
				if a == 1 then
					cupon_coins.ingresar()
				end
			else
				say_title("Cupón de Coins")
				say("El cupón tiene "..item.get_socket(0).." Coins.")
				say("¿Que deseas hacer?")
				local b = select("Retirar","Poner más Coins","Cancelar")
				if b == 1 then
					say_title("Cupón de Coins - Retirar")
					say("Has retirado las "..item.get_socket(0).." Coins[ENTER]disponibles")
					pc.change_coins(item.get_socket(0))
					item.set_socket(0,0)
					char_log(80018, "ITEM", "Retiro de "..item.get_socket(0).." Coins")
				elseif b == 2 then
					cupon_coins.ingresar()
				end
			end
		end
	end
end	

 
 
Si surge algún problema no dudéis en decirlo ^^
 

 

Enlace para comentar
Compartir en otros sitios

  • 2 weeks later...

hola buenas tardes, acabo de hacer todo lo de la guia y al darle clic derecho al item para  ponerle coins al cupon me sale esto cuando quiero ingresar coins

 

Debes iniciar sesión para ver el contenido del enlace en esta publicación.

 

solo aparece asi y no me deja ingresar coins ni nada

Enlace para comentar
Compartir en otros sitios

Que te dice el syserr

0407 16:31:24981 :: CPythonPlayer::SetItemData(window_type : 1, dwSlotIndex=100, itemIndex=71702) - Failed to item data
 
0407 16:31:24982 :: CPythonPlayer::SetItemData(window_type : 1, dwSlotIndex=136, itemIndex=569) - Failed to item data
 
0407 16:32:40093 :: GRANNY: r:/granny/rt/granny_file_info.cpp(145): File has run-time type tag of 0x8000000f, which doesn't match this version of Granny (0x80000010).  Automatic conversion will be attempted.
0407 16:33:45486 :: Unknown Server Command HideKillGui | HideKillGui
0407 16:33:45488 :: Unknown Server Command usuario_id 1 | usuario_id
0407 17:04:44951 :: GRANNY: r:/granny/rt/granny_file.cpp(337): Unable to read magic value
0407 17:09:11513 :: GRANNY: r:/granny/rt/granny_file.cpp(337): Unable to read magic value
0407 17:22:32269 :: Unknown Server Command HideKillGui | HideKillGui
0407 17:22:32273 :: Unknown Server Command usuario_id 1 | usuario_id
 
y en el server
 
 
 
SYSERR: Apr  7 21:34:51 :: RunState: LUA_ERROR: locale/mexico/quest/object/state/cupon_coins:4: attempt to call field `get_coins' (a nil value) WITH ERRORCODE 1
SYSERR: Apr  7 21:34:51 :: RunState: LUA_STATE: index 0 ref 3
SYSERR: Apr  7 21:34:51 :: WriteRunningStateToSyserr: LUA_ERROR: quest cupon_coins.start letter
SYSERR: Apr  7 21:35:02 :: RunState: LUA_ERROR: locale/mexico/quest/object/state/cupon_coins:4: attempt to call field `get_coins' (a nil value) WITH ERRORCODE 1
SYSERR: Apr  7 21:35:02 :: RunState: LUA_STATE: index 0 ref 3
SYSERR: Apr  7 21:35:02 :: WriteRunningStateToSyserr: LUA_ERROR: quest cupon_coins.start letter
SYSERR: Apr  7 21:35:40 :: RunState: LUA_ERROR: locale/mexico/quest/object/state/cupon_coins:4: attempt to call field `get_coins' (a nil value) WITH ERRORCODE 1
SYSERR: Apr  7 21:35:40 :: RunState: LUA_STATE: index 0 ref 3
SYSERR: Apr  7 21:35:40 :: WriteRunningStateToSyserr: LUA_ERROR: quest cupon_coins.start letter
SYSERR: Apr  7 21:36:05 :: RunState: LUA_ERROR: locale/mexico/quest/object/state/cupon_coins:4: attempt to call field `get_coins' (a nil value) WITH ERRORCODE 1
SYSERR: Apr  7 21:36:05 :: RunState: LUA_STATE: index 0 ref 3
SYSERR: Apr  7 21:36:05 :: WriteRunningStateToSyserr: LUA_ERROR: quest cupon_coins.start letter
SYSERR: Apr  7 21:36:12 :: RunState: LUA_ERROR: locale/mexico/quest/object/state/cupon_coins:4: attempt to call field `get_coins' (a nil value) WITH ERRORCODE 1
SYSERR: Apr  7 21:36:12 :: RunState: LUA_STATE: index 0 ref 3
SYSERR: Apr  7 21:36:12 :: WriteRunningStateToSyserr: LUA_ERROR: quest cupon_coins.start letter
SYSERR: Apr  7 21:36:48 :: RunState: LUA_ERROR: locale/mexico/quest/object/state/cupon_coins:4: attempt to call field `get_coins' (a nil value) WITH ERRORCODE 1
SYSERR: Apr  7 21:36:48 :: RunState: LUA_STATE: index 0 ref 3
SYSERR: Apr  7 21:36:48 :: WriteRunningStateToSyserr: LUA_ERROR: quest cupon_coins.start letter
SYSERR: Apr  7 21:36:57 :: Analyze: login phase does not handle this packet! header 50
SYSERR: Apr  7 21:36:57 :: Process: UNKNOWN HEADER: 243, LAST HEADER: 0(1), REMAIN BYTES: 4, fd: 320
SYSERR: Apr  7 21:38:33 :: RunState: LUA_ERROR: locale/mexico/quest/object/state/cupon_coins:4: attempt to call field `get_coins' (a nil value) WITH ERRORCODE 1
SYSERR: Apr  7 21:38:33 :: RunState: LUA_STATE: index 0 ref 3
SYSERR: Apr  7 21:38:33 :: WriteRunningStateToSyserr: LUA_ERROR: quest cupon_coins.start letter
SYSERR: Apr  7 21:39:03 :: RunState: LUA_ERROR: locale/mexico/quest/object/state/cupon_coins:4: attempt to call field `get_coins' (a nil value) WITH ERRORCODE 1
SYSERR: Apr  7 21:39:03 :: RunState: LUA_STATE: index 0 ref 3
SYSERR: Apr  7 21:39:03 :: WriteRunningStateToSyserr: LUA_ERROR: quest cupon_coins.start letter
SYSERR: Apr  7 21:39:56 :: Process: UNKNOWN HEADER: 243, LAST HEADER: 0(0), REMAIN BYTES: 5, fd: 320
SYSERR: Apr  7 21:39:57 :: Process: UNKNOWN HEADER: 243, LAST HEADER: 0(0), REMAIN BYTES: 14, fd: 320
SYSERR: Apr  7 21:43:00 :: RunState: LUA_ERROR: locale/mexico/quest/object/state/cupon_coins:4: attempt to call field `get_coins' (a nil value) WITH ERRORCODE 1
SYSERR: Apr  7 21:43:00 :: RunState: LUA_STATE: index 0 ref 3
SYSERR: Apr  7 21:43:00 :: WriteRunningStateToSyserr: LUA_ERROR: quest cupon_coins.start letter
Enlace para comentar
Compartir en otros sitios

No tienes puesta la función pc.get_coins() o tienes algo mal en ella

tambien me sale esto

 

SYSERR: Apr  7 23:45:15 :: ChildLoop: AsyncSQL: query failed: Duplicate entry 'anti' for key 'PRIMARY' (query: INSERT INTO quest_reward_log VALUES('anti',1,105,2,0,0,NOW()) errno: 1062)
SYSERR: Apr  7 23:45:16 :: ChildLoop: AsyncSQL: query failed: Duplicate entry 'anti' for key 'PRIMARY' (query: INSERT INTO quest_reward_log VALUES('anti',1,105,2,0,0,NOW()) errno: 1062)
SYSERR: Apr  7 23:45:17 :: ChildLoop: AsyncSQL: query failed: Duplicate entry 'anti' for key 'PRIMARY' (query: INSERT INTO quest_reward_log VALUES('anti',1,105,2,0,0,NOW()) errno: 1062)
SYSERR: Apr  7 23:45:18 :: ChildLoop: AsyncSQL: query failed: Duplicate entry 'anti' for key 'PRIMARY' (query: INSERT INTO quest_reward_log VALUES('anti',1,105,2,0,0,NOW()) errno: 1062)
SYSERR: Apr  7 23:45:19 :: ChildLoop: AsyncSQL: query failed: Duplicate entry 'anti' for key 'PRIMARY' (query: INSERT INTO quest_reward_log VALUES('anti',1,105,2,0,0,NOW()) errno: 1062)
SYSERR: Apr  7 23:45:20 :: ChildLoop: AsyncSQL: query failed: Duplicate entry 'anti' for key 'PRIMARY' (query: INSERT INTO quest_reward_log VALUES('anti',1,105,2,0,0,NOW()) errno: 1062)
SYSERR: Apr  7 23:45:21 :: ChildLoop: AsyncSQL: query failed: Duplicate entry 'anti' for key 'PRIMARY' (query: INSERT INTO quest_reward_log VALUES('anti',1,105,2,0,0,NOW()) errno: 1062)
SYSERR: Apr  7 23:45:22 :: ChildLoop: AsyncSQL: query failed: Duplicate entry 'anti' for key 'PRIMARY' (query: INSERT INTO quest_reward_log VALUES('anti',1,105,2,0,0,NOW()) errno: 1062)
SYSERR: Apr  7 23:45:23 :: ChildLoop: AsyncSQL: query failed: Duplicate entry 'anti' for key 'PRIMARY' (query: INSERT INTO quest_reward_log VALUES('anti',1,105,2,0,0,NOW()) errno: 1062)
SYSERR: Apr  7 23:45:24 :: ChildLoop: AsyncSQL: query failed: Duplicate entry 'anti' for key 'PRIMARY' (query: INSERT INTO quest_reward_log VALUES('anti',1,105,2,0,0,NOW()) errno: 1062)
Enlace para comentar
Compartir en otros sitios

Unirse a la conversación

Puedes publicar ahora y registrarte más tarde. Si tienes una cuenta, regístrate para publicar con su cuenta.

Guest
Responder a este tema...

×   Has pegado contenido con formato .   Eliminar formato

  Only 75 emoji are allowed.

×   Tu enlace se ha incorporado automáticamente.   Mostrar un enlace en su lugar

×   Se ha restaurado el contenido anterior. .   Borrar editor

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

  • Recientemente navegando por este tema   0 miembros

    • No hay usuarios registrados visitando esta página.
×
×
  • Crear nuevo...