Rafa23Alzira Posted March 25, 2015 Report Share Posted March 25, 2015 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í: 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 Raul Reina Ruiz, Sonic, mebe and 12 others 14 1 Quote Link to comment Share on other sites More sharing options...
MiGueLiT0 Posted March 25, 2015 Report Share Posted March 25, 2015 Gracias +1 Quote Link to comment Share on other sites More sharing options...
Jex Posted March 25, 2015 Report Share Posted March 25, 2015 muy útil me gusto Quote Link to comment Share on other sites More sharing options...
alex1995 Posted March 25, 2015 Report Share Posted March 25, 2015 No tienes foto de como es? Quote Link to comment Share on other sites More sharing options...
Rafa23Alzira Posted March 25, 2015 Author Report Share Posted March 25, 2015 MiGueLiT0 and mebe 2 Quote Link to comment Share on other sites More sharing options...
ZoneLife Posted March 25, 2015 Report Share Posted March 25, 2015 muy wapo Rafa lo mismo me da por usarlo más adelante. Rafa23Alzira 1 Quote Link to comment Share on other sites More sharing options...
Jeo Posted March 25, 2015 Report Share Posted March 25, 2015 Es una buena idea y un buen sistema, gracias Quote Link to comment Share on other sites More sharing options...
Dilong Posted March 25, 2015 Report Share Posted March 25, 2015 Se ve interesante xD Quote Link to comment Share on other sites More sharing options...
Ryen Posted March 25, 2015 Report Share Posted March 25, 2015 Vale perfecto, pero el caso es: Un usuario tiene por asi digamos 25 coins y quiere comerciar con ellos el usuario que lo va recibir como comprueba que efectivamente son 2 coins? sabeis como son los de emtin2 no se fian de nadie xD Quote Link to comment Share on other sites More sharing options...
PACI Posted March 25, 2015 Report Share Posted March 25, 2015 Vale perfecto, pero el caso es: Un usuario tiene por asi digamos 25 coins y quiere comerciar con ellos el usuario que lo va recibir como comprueba que efectivamente son 2 coins? sabeis como son los de emtin2 no se fian de nadie xD Pero si te lo dice en la descripción LOL Quote Link to comment Share on other sites More sharing options...
Ryen Posted March 25, 2015 Report Share Posted March 25, 2015 Pero si te lo dice en la descripción LOL XD no me habia fijado bien jajaja perfecto pues Quote Link to comment Share on other sites More sharing options...
metin2ventor Posted April 5, 2015 Report Share Posted April 5, 2015 Rafa, me tira core la quest, que podra ser? Quote Link to comment Share on other sites More sharing options...
Rafa23Alzira Posted April 6, 2015 Author Report Share Posted April 6, 2015 Rafa, me tira core la quest, que podra ser? A ver imagen Quote Link to comment Share on other sites More sharing options...
metin2ventor Posted April 6, 2015 Report Share Posted April 6, 2015 A ver imagen Debes iniciar sesión para ver el contenido del enlace en esta publicación.. Perdon que te la mande en link no encuentro otra forma. Lo unico que hize fue cambiar el when por el de otro item renssis, yankee360 and AdminP7 3 Quote Link to comment Share on other sites More sharing options...
JeS Posted April 6, 2015 Report Share Posted April 6, 2015 Función no declarada o no encontrada (Ingles), en la carpeta quest busca quest_functions y agrega las funciones que te dice allí: pc.change_coins y pc.get_coins Quote Link to comment Share on other sites More sharing options...
Rafa23Alzira Posted April 6, 2015 Author Report Share Posted April 6, 2015 Debes iniciar sesión para ver el contenido del enlace en esta publicación.. Perdon que te la mande en link no encuentro otra forma. Lo unico que hize fue cambiar el when por el de otro item metin2zone.net/index.php?/topic/14203-mini-funcionespcget-coins-y-pcchange-coins/ Quote Link to comment Share on other sites More sharing options...
metin2ventor Posted April 6, 2015 Report Share Posted April 6, 2015 metin2zone.net/index.php?/topic/14203-mini-funcionespcget-coins-y-pcchange-coins/ Rafa soy nuevo en esto me explicas lo de mysql que no lo tengo entendido? PD:Game 34k nose si cambia algo Quote Link to comment Share on other sites More sharing options...
Rafa23Alzira Posted April 6, 2015 Author Report Share Posted April 6, 2015 Rafa soy nuevo en esto me explicas lo de mysql que no lo tengo entendido? PD:Game 34k nose si cambia algo Busca si en questlib tienes una función llamada mysql_query Quote Link to comment Share on other sites More sharing options...
metin2ventor Posted April 6, 2015 Report Share Posted April 6, 2015 Busca si en questlib tienes una función llamada mysql_query Grande rafa, gracias por la rapida atencion es un placer tenerte en el foro Quote Link to comment Share on other sites More sharing options...
SergioT Posted April 7, 2015 Report Share Posted April 7, 2015 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 AdminP7 1 Quote Link to comment Share on other sites More sharing options...
Rafa23Alzira Posted April 7, 2015 Author Report Share Posted April 7, 2015 Que te dice el syserr SergioT 1 Quote Link to comment Share on other sites More sharing options...
SergioT Posted April 7, 2015 Report Share Posted April 7, 2015 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 Quote Link to comment Share on other sites More sharing options...
Rafa23Alzira Posted April 8, 2015 Author Report Share Posted April 8, 2015 No tienes puesta la función pc.get_coins() o tienes algo mal en ella Quote Link to comment Share on other sites More sharing options...
SergioT Posted April 8, 2015 Report Share Posted April 8, 2015 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) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.