fellypeerick20 4 Postado 1 de Outubro Compartilhar Postado 1 de Outubro peguei uma interface de autoloot de um client para adaptar no server que eu costumo brincar offline, porém estou com um problema. esse script foi feito para adicionar item atraves do id Ex: /aloot add: 12205, e eu queria que fosse feito através do nome do item Ex: /aloot add: onix tail. mas não to conseguindo mudar isso. alguem sabe como faço isso? Spoiler local lootWindow = nil local lootButton = nil local itemList = nil local myList = nil local items_ = { ['Mighty Token'] = {15644, 14813}, ['Devoted Token'] = {15645, 14814}, ['Air Tank'] = {17655, 17154}, ['Diving Mask'] = {17656, 17155}, ['Fins'] = {17657, 17156}, ['Bag Of Pollem'] = {12153, 11220}, ['Band Aid'] = {17346, 16500}, ['Bird Beak'] = {12172, 11239}, ['Bitten Apple'] = {12173, 11240}, ['Bottle Of Poison'] = {12165, 11232}, ['Bug Gosme'] = {13783, 12730}, ['Comb'] = {12179, 11246}, ['Dark Gem'] = {17348, 16502}, ['Dragon Scale'] = {17349, 16503}, ['Dragon Tooth'] = {12159, 11226}, ['Earth Ball'] = {17352, 16506}, ['Electric Box'] = {12176, 11243}, ['Enchanted Gem'] = {13785, 12731}, ['Essence Of Fire'] = {12162, 11229}, ['Feather'] = {12200, 11267}, ['Fur'] = {12181, 11248}, ['Future Orb'] = {12194, 11261}, ['Ghost Essence'] = {17350, 16504}, ['Horn'] = {12178, 11245}, ['Ice Orb'] = {12201, 11268}, ['Leaves'] = {12155, 11222}, ['Magikarp Fin'] = {12334, 11401}, ['Nail'] = {12157, 11224}, ['Piece of Steel'] = {17347, 16501}, ['Pot of Lava'] = {12152, 11219}, ['Pot of Moss Bug'] = {12171, 11238}, ['Rubber Ball'] = {2147, 3030}, ['Ruby'] = {12188, 11255}, ['Sandbag'] = {12177, 11244}, ['Screw'] = {12164, 11231}, ['Seed'] = {12163, 11230}, ['Small Stone'] = {12337, 11404}, ['Snowball'] = {2111, 2992}, ['Stone Orb'] = {12196, 11263}, ['Straw'] = {2694, 3605}, ['Tooth'] = {12175, 11242}, ['Water Gem'] = {12161, 11228}, ['Water Pendant'] = {12170, 11237}, ['Armadillo Claw'] = {17321, 16472}, ['Bat Wing'] = {12182, 11249}, ['Bear Paw'] = {17292, 16443}, ['Bee Sting'] = {17315, 16466}, ['Belt Of Champion'] = {12195, 11262}, ['Blue Ball'] = {17274, 16425}, ['Blue Vines'] = {12341, 11408}, ['Bone'] = {12208, 11275}, ['Branch Of Stone'] = {17275, 16426}, ['Brush'] = {17304, 16455}, ['Bug Antenna'] = {12184, 11251}, ['Bug Venom'] = {12185, 11252}, ['Bulb'] = {12154, 11221}, ['Bull Tail'] = {17338, 16489}, ['Butterfly Wing'] = {17314, 16465}, ['Cat Ear'] = {17291, 16442}, ['Chansey Egg'] = {12211, 11278}, ['Colored Feather'] = {17316, 16467}, ['Cow Tail'] = {17306, 16457}, ['Crab Claw'] = {12207, 11274}, ['Dark Beak'] = {17344, 16495}, ['Dodrio Feather'] = {17328, 16479}, ['Dog Ear'] = {17285, 16436}, ['Dome Fossil'] = {12579, 11910}, ['Dragon Tail'] = {17340, 16491}, ['Egg Shell'] = {17270, 16421}, ['Electric Tail'] = {12169, 11236}, ['Elephant Foot'] = {17302, 16453}, ["Farfetch'd Stick"] = {12199, 11266}, ['Female Ear'] = {17320, 16471}, ['Fire Ear'] = {17293, 16444}, ['Fire Horse Foot'] = {17327, 16478}, ['Fire Tail'] = {13892, 12771}, ['Fish Fin'] = {17335, 16486}, ['Fox Tail'] = {12180, 11247}, ['Gaint Bat Wing'] = {17267, 16418}, ['Gaint Fin'] = {17339, 16490}, ['Gem Star'] = {13870, 12749}, ['Gem Star'] = {17336, 16487}, ['Giant Piece Of Fur'] = {17323, 16474}, ['Giant Ruby'] = {17341, 16492}, ['Gift Bag'] = {17297, 16448}, ['Gligar Claw'] = {17284, 16435}, ['Gosme'] = {12202, 11269}, ['Great Petal'] = {17260, 16411}, ['Gyarados Tail'] = {12148, 11215}, ['Helicopter Leaves'] = {17279, 16430}, ['Helix Fossil'] = {12580, 11911}, ['Horn Drill'] = {17333, 16484}, ['Hot Fur'] = {17261, 16412}, ['Ice Bra'] = {12168, 11235}, ['Insect Claw'] = {17290, 16441}, ['Insect Tail'] = {17342, 16493}, ['Iron Bracelet'] = {12192, 11259}, ['Kanga Ear'] = {17334, 16485}, ['Karate Duck'] = {12190, 11257}, ['Ladybug Wing'] = {17265, 16416}, ['Linearly Guided Hypnose'] = {17357, 16511}, ['Lizard Tail'] = {17310, 16461}, ['Locksmith Of Shell'] = {12203, 11270}, ['Luck Medallion'] = {17356, 16510}, ['Magikarp Fin'] = {12334, 11401}, ['Magma Foot'] = {17337, 16488}, ['Magnet'] = {12198, 11265}, ['Male Ear'] = {17319, 16470}, ['Microphone'] = {12160, 11227}, ['Mimic Clothes'] = {12166, 11233}, --['Miss Traces'] = {12775, 10918}, ['Monkey Paw'] = {17278, 16429}, ['Mushroom'] = {12183, 11250}, ['Old Amber'] = {12581, 11912}, ['Onix Tail'] = {12205, 11272}, ['Owl Feather'] = {17264, 16415}, ['Piece Of Coral'] = {17295, 16446}, ['Piece Of Diglett'] = {17322, 16473}, ['Piece Of Shell'] = {17282, 16433}, ['Pinsir Horn'] = {12141, 11213}, ['Plant Foot'] = {17332, 16483}, ['Plant Tail'] = {13897, 12776}, ['Point Of Light'] = {17268, 16419}, ['Psychic Spoon'] = {12193, 11260}, ['Psyduck Mug'] = {12189, 11256}, ['Punch Machine'] = {12191, 11258}, ['Rat Tail'] = {12647, 11967}, ['Red Scale'] = {17262, 16413}, ['Red Wing'] = {17317, 16468}, ['Reindeer Horn'] = {17303, 16454}, ['Scizor Claw'] = {13869, 12748}, ['Scythe'] = {12167, 11234}, ['Seahorse Tail'] = {17301, 16452}, ['Seal Tail'] = {17329, 16480}, ['Sheep Wool'] = {17272, 16423}, ['Slow Tail'] = {12197, 11264}, ['Small Shell'] = {17289, 16440}, ['Small Tail'] = {17286, 16437}, ['Small Wing'] = {17283, 16434}, ['Snake Tail'] = {17326, 16477}, ['Spider Legs'] = {17266, 16417}, ['Spin Machine'] = {17305, 16456}, ['Squirrel Tail'] = {17263, 16414}, ['Squirtle Hull'] = {12158, 11225}, ['Steel Wing'] = {17299, 16450}, ['Steelix Tail'] = {17288, 16439}, ['Sticky Hand'] = {17330, 16481}, ['Strange Tail'] = {17280, 16431}, ['Strange Antenna'] = {17281, 16432}, ['Strange Bone'] = {17300, 16451}, ['Strange Feather'] = {17271, 16422}, ['Strange Flower'] = {17273, 16424}, ['Strange Rock'] = {13867, 12746}, ['Strange Spike'] = {17331, 16482}, ['Strange Thing'] = {17276, 16427}, ['Streak Tail'] = {17298, 16449}, ['Tentacle'] = {13866, 12745}, ['Tongue'] = {12209, 11276}, ['Topknot'] = {13901, 12780}, ['Traces Of Ghost'] = {12204, 11271}, ['Tusk'] = {17294, 16445}, ['Venom Flute'] = {12210, 11277}, ['Wool Ball'] = {12187, 11254}, ['Wooper Horn'] = {17343, 16494}, ['Yellow Flower'] = {17277, 16428}, ['Cocoon Stone'] = {11448, 10537}, ['Venom Stone'] = {11443, 10532}, ['Heart Stone'] = {11453, 10542}, ['Leaf Stone'] = {11441, 10530}, ['Rock Stone'] = {11445, 10534}, ['Earth Stone'] = {11451, 10540}, ['Thunder Stone'] = {11444, 10533}, ['Water Stone'] = {11442, 10531}, ['Ice Stone'] = {11454, 10543}, ['Fire Stone'] = {11447, 10536}, ['Punch Stone'] = {11446, 10535}, ['Enigma Stone'] = {11452, 10541}, ['Darkness Stone'] = {11450, 10539}, ['Crystal Stone'] = {11449, 10538}, ['Sun Stone'] = {12242, 11309}, ['Metal Stone'] = {12232, 11299}, ['Ancient Stone'] = {12244, 11311}, ['Dragon Scale'] = {12417, 11484}, ['Up-grade'] = {12419, 11486}, ['Shiny Stone'] = {12401, 16233}, ['Boost Stone'] = {12618, 11941} } function init() lootWindow = g_ui.displayUI('loot', modules.game_interface.getRightPanel()) lootWindow:hide() itemList = lootWindow:getChildById('itemList') myList = lootWindow:getChildById('myList') lootButton = modules.client_topmenu.addRightGameToggleButton('lootButton', tr('Auto loot'), '/images/topbuttons/aloot', toggle) lootButton:setOn(false) connect(g_game, { onGameStart = listItems }) connect(g_game, { onGameStart = listMyItem }) ProtocolGame.registerExtendedOpcode(140, getMyItens) end function terminate() lootWindow:destroy() lootButton:destroy() ProtocolGame.unregisterExtendedOpcode(140) end function toggle() if lootButton:isOn() then lootButton:setOn(false) lootWindow:hide() else lootButton:setOn(true) lootWindow:show() end end function listItems() if not lootWindow then return end itemList:destroyChildren() for key,value in pairs(items_) do local label = g_ui.createWidget('ItemLoot', itemList) label:setId(value[1]) label:setText(key) label:setOn(true) local itemWidget = label:getChildById('itemlabel') itemWidget:setItemId(value[2]) end end function listMyItem() if not lootWindow then return end myList:destroyChildren() g_game.talk("/aloot list") end function addItemLoot() local item_selected = itemList:getFocusedChild() if item_selected then local id = item_selected:getId() g_game.talk("/aloot add: "..id) end listMyItem() end function removeItemLoot() local item_selected = myList:getFocusedChild() if item_selected then local id = item_selected:getId() g_game.talk("/aloot remove: "..id) end listMyItem() end function hide() lootWindow:hide() end function search() if not lootWindow then return end itemList:destroyChildren() local text = lootWindow:recursiveGetChildById('valueSearch'):getText() if text == nil or text == "" then listItems() else for key,value in pairs(items_) do if string.find(doCorrectString(key), doCorrectString(text)) then local label = g_ui.createWidget('ItemLoot', itemList) label:setId(value[1]) label:setText(key) label:setOn(true) local itemWidget = label:getChildById('itemlabel') itemWidget:setItemId(value[2]) end end end end function addItemMyList(id, key, itemid) local label = g_ui.createWidget('ItemLoot', myList) label:setId(id) label:setText(key) label:setOn(true) local itemWidget = label:getChildById('itemlabel') itemWidget:setItemId(itemid) end function getMyItens(protocol, opcode, buffer) local _items = string.explode(buffer, ",") for i = 1, #_items do local key = doCorrectString(_items[i]) if items_[key] then local id = items_[key][1] local itemid = items_[key][2] addItemMyList(id, key, itemid) end end end Citar Link para o comentário Compartilhar em outros sites Mais opções de compartilhamento...
Posts Recomendados
Participe da Conversa
Você pode postar agora e se cadastrar mais tarde. Cadastre-se Agora para publicar com Sua Conta.