Postado Dezembro 17, 2017 7 anos Woodcutting System Decidi fazer esse sistema pra tentar fazer com que o jogador sempre possa ter coisas diferentes dentro do jogo para fazer, fortalecendo o RPG. Recomendo que você edite os itens de acordo com o seu gosto (sprites e atributos). Ainda tenho algumas coisas que vou fazer para complementar o sistema: *- Tasks diárias. *- Quests com requisito de corte de lenha em determinado nível. *- Crafting com as lenhas pegas. *- Habilidade de queimar as lenhas pegas. Demonstrações Spoiler Spoiler Spoiler Spoiler Spoiler Spoiler Spoiler Spoiler Para implementar o sistema siga os passados abaixo: Vá em data/lib/lib.lua e adicione o seguinte código Spoiler --- Functions function capitalize(str) return string.gsub(" " .. str, "%W%l", string.upper):sub(2) end --- WC FUNCS function wcGetLevelByXP(constant, xp) return tonumber(constant + math.sqrt(constant * constant + (4 * constant) * xp)) / (2 * constant) end function wcGetXPByLevel(constant, level) return constant * level * level - constant * level end function wcStart(player, stlevel, stxp) if player:getStorageValue(stlevel) == -1 then player:setStorageValue(stlevel, 1) end if player:getStorageValue(stxp) == -1 then player:setStorageValue(stxp, 0) end end Crie uma pasta chamada woodcutting em data/lib E então crie estes arquivos dentro da mesma axes.lua Spoiler WCAXES = { [2559] = {name = 'Iron Axe', description = 'Used to cut trees of level 1.', level = 1, price = 1000}, [2441] = {name = 'Steel Axe', description = 'Used to cut trees of level 15 or less.', level = 15, price = 5000}, [2388] = {name = 'Great Axe', description = 'Used to cut trees of level 30 or less.', level = 30, price = 20000}, [2380] = {name = 'Dwarven Axe', description = 'Used to cut trees of level 50 or less.', level = 50, price = 50000}, [8601] = {name = 'Old Axe', description = 'Used to cut trees of level 65 or less.', level = 65, price = 100000}, [2386] = {name = 'Noble Axe', description = 'Used to cut trees of level 75 or less.', level = 75, price = 200000}, [2428] = {name = 'Mythril Axe', description = 'Used to cut trees of level 85 or less.', level = 85, price = 500000}, [8293] = {name = 'Hallowed Axe', description = 'Used to cut trees of level 95 or less.', level = 95, price = 1000000} } config.lua Spoiler WCCONFIG = { constant = 100, stlevel = 300697, stxp = 300698, aid = 8989, upeffect = CONST_ME_SOUND_PURPLE, xpcolor = TEXTCOLOR_YELLOW, treedestroy = CONST_ME_POFF, destroyfail = CONST_ME_BLOCKHIT } rewards.lua Spoiler WCREWARDS = { [3] = { msg = { text = 'Congratulations!', effect = MESSAGE_STATUS_CONSOLE_BLUE, }, items = { {id = 10137, count = 1, description = "Reward for reaching level 99 in woodcutting."} } } } trees.lua Spoiler WCTREES = { ----- WILLOW ----- [2702] = { decay = 8786, level = 60, vip = false, cd = {min = 120, max = 120}, xp = {min = 170, max = 175}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'willow log', pluralname = 'willow logs', aid = 7465, weight = 2 } } }, ----- WHISPERING WILLOW ----- [18657] = { decay = 8786, level = 60, vip = true, cd = {min = 90, max = 110}, xp = {min = 170, max = 175}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'whispering willow log', pluralname = 'whispering willow logs', aid = 7465, weight = 2 } } }, ----- WHISPERING WILLOW ----- [18658] = { decay = 8786, level = 60, vip = true, cd = {min = 90, max = 110}, xp = {min = 170, max = 175}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'whispering willow log', pluralname = 'whispering willow logs', aid = 7465, weight = 2 } } }, ----- POPLAR TREE ----- [2708] = { decay = 8786, level = 1, vip = false, cd = {min = 15, max = 25}, xp = {min = 25, max = 28}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'poplar log', pluralname = 'poplar logs', aid = 7465, weight = 2 } } }, ----- ORANGE TREE ----- [4006] = { decay = 8786, level = 50, vip = false, cd = {min = 110, max = 120}, xp = {min = 122, max = 124}, dp = { { id = 5901, min = 1, max = 1, chance = 100, description = 'You can burn it.', name = 'orange log', pluralname = 'orange logs', aid = 7465 }, {id = 2675, min = 50, max = 90, chance = 100} } }, ----- MANGO TREE ----- [5156] = { decay = 8786, level = 45, vip = false, cd = {min = 120, max = 120}, xp = {min = 85, max = 87}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'mango log', pluralname = 'mango logs', aid = 7465 } } }, ----- MANGO TREE ----- [5157] = { decay = 8786, level = 45, vip = false, cd = {min = 120, max = 120}, xp = {min = 85, max = 87}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'mango log', pluralname = 'mango logs', aid = 7465 }, {id = 5097, min = 30, max = 50, chance = 100} } }, ----- HOLY TREE ----- [2699] = { decay = 8786, level = 80, vip = false, cd = {min = 480, max = 480}, xp = {min = 800, max = 800}, dp = { { id = 12503, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'holy log', pluralname = 'holy logs', aid = 7465 }, {id = 7590, min = 100, max = 100, chance = 100} } }, ----- BEECH TREE ----- [2707] = { decay = 8786, level = 15, vip = false, cd = {min = 30, max = 40}, xp = {min = 37, max = 39}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'beech log', pluralname = 'beech logs', aid = 7465 } } }, ----- RED MAPLE ----- [2704] = { decay = 8786, level = 70, vip = true, cd = {min = 140, max = 140}, xp = {min = 218, max = 219}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'red maple log', pluralname = 'red maple logs', aid = 7465 } } }, ----- ORANGE MAPLE ----- [20762] = { decay = 8786, level = 90, vip = false, cd = {min = 210, max = 220}, xp = {min = 450, max = 500}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'orange maple log', pluralname = 'orange maple logs', aid = 7465 } } }, ----- FIR TREE ----- [2700] = { decay = 8786, level = 35, vip = false, cd = {min = 60, max = 70}, xp = {min = 80, max = 83}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'fir log', pluralname = 'fir logs', aid = 7465 } } }, ----- SYCAMORE TREE ----- [2701] = { decay = 8786, level = 1, vip = true, cd = {min = 5, max = 10}, xp = {min = 28, max = 30}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'sycamore log', pluralname = 'sycamore logs', aid = 7465 } } }, ----- DEAD TREE ----- [2710] = { decay = 8786, level = 1, vip = false, cd = {min = 15, max = 25}, xp = {min = 25, max = 28}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'dead tree log', pluralname = 'dead tree logs', aid = 7465 } } }, ----- DEAD TREE ----- [2717] = { decay = 8786, level = 1, vip = false, cd = {min = 15, max = 25}, xp = {min = 25, max = 28}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'dead tree log', pluralname = 'dead tree logs', aid = 7465 } } }, ----- DEAD TREE ----- [2718] = { decay = 8786, level = 1, vip = false, cd = {min = 15, max = 25}, xp = {min = 25, max = 28}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'dead tree log', pluralname = 'dead tree logs', aid = 7465 } } }, ----- DEAD TREE ----- [2719] = { decay = 8786, level = 1, vip = false, cd = {min = 15, max = 25}, xp = {min = 25, max = 28}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'dead tree log', pluralname = 'dead tree logs', aid = 7465 } } }, ----- DEAD TREE ----- [2720] = { decay = 8786, level = 1, vip = false, cd = {min = 15, max = 25}, xp = {min = 25, max = 28}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'dead tree log', pluralname = 'dead tree logs', aid = 7465 } } }, ----- DEAD TREE ----- [7020] = { decay = 8786, level = 1, vip = false, cd = {min = 15, max = 25}, xp = {min = 25, max = 28}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'dead tree log', pluralname = 'dead tree logs', aid = 7465 } } }, ----- DEAD TREE ----- [7021] = { decay = 8786, level = 1, vip = false, cd = {min = 15, max = 25}, xp = {min = 25, max = 28}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'dead tree log', pluralname = 'dead tree logs', aid = 7465 } } }, ----- DEAD TREE ----- [7022] = { decay = 8786, level = 1, vip = false, cd = {min = 15, max = 25}, xp = {min = 25, max = 28}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'dead tree log', pluralname = 'dead tree logs', aid = 7465 } } }, ----- DEAD TREE ----- [8314] = { decay = 8786, level = 1, vip = false, cd = {min = 15, max = 25}, xp = {min = 25, max = 28}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'dead tree log', pluralname = 'dead tree logs', aid = 7465 } } }, ----- DEAD TREE ----- [8583] = { decay = 8786, level = 1, vip = false, cd = {min = 15, max = 25}, xp = {min = 25, max = 28}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'dead tree log', pluralname = 'dead tree logs', aid = 7465 } } }, ----- DEAD TREE ----- [8864] = { decay = 8786, level = 1, vip = false, cd = {min = 15, max = 25}, xp = {min = 25, max = 28}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'dead tree log', pluralname = 'dead tree logs', aid = 7465 } } }, ----- DEAD TREE ----- [10501] = { decay = 8786, level = 1, vip = false, cd = {min = 15, max = 25}, xp = {min = 25, max = 28}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'dead tree log', pluralname = 'dead tree logs', aid = 7465 } } }, ----- DEAD TREE ----- [10501] = { decay = 8786, level = 1, vip = false, cd = {min = 15, max = 25}, xp = {min = 25, max = 28}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'dead tree log', pluralname = 'dead tree logs', aid = 7465 } } }, ----- DEAD TREE ----- [10505] = { decay = 8786, level = 1, vip = false, cd = {min = 15, max = 25}, xp = {min = 25, max = 28}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'dead tree log', pluralname = 'dead tree logs', aid = 7465 } } }, ----- DEAD TREE ----- [10505] = { decay = 8786, level = 1, vip = false, cd = {min = 15, max = 25}, xp = {min = 25, max = 28}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'dead tree log', pluralname = 'dead tree logs', aid = 7465 } } }, ----- DEAD TREE ----- [2697] = { decay = 8786, level = 1, vip = false, cd = {min = 15, max = 25}, xp = {min = 25, max = 28}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'dead tree log', pluralname = 'dead tree logs', aid = 7465 } } }, ----- DEAD TREE ----- [2709] = { decay = 8786, level = 1, vip = false, cd = {min = 15, max = 25}, xp = {min = 25, max = 28}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'dead tree log', pluralname = 'dead tree logs', aid = 7465 } } }, ----- YELLOW MAPLE TREE ----- [2706] = { decay = 8786, level = 53, vip = false, cd = {min = 125, max = 120}, xp = {min = 140, max = 141}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'yellow maple log', pluralname = 'yellow maple logs', aid = 7465, effect = CONST_ME_BUBBLES, msg = { text = 'You are so gaaay!', effect = MESSAGE_STATUS_CONSOLE_RED } } } }, ----- PLUM TREE ----- [2703] = { decay = 8786, level = 1, vip = false, cd = {min = 15, max = 25}, xp = {min = 25, max = 28}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'plum log', pluralname = 'plum logs', aid = 7465 } } }, ----- CHERRY BLOSSOM TREE ----- [10143] = { decay = 8786, level = 45, vip = true, cd = {min = 120, max = 120}, xp = {min = 85, max = 87}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'cherry blossom log', pluralname = 'cherry blossom logs', aid = 7465 }, {id = 2679, min = 20, max = 35, chance = 100} } }, ----- SOLSTICE TREE ----- [10917] = { decay = 8786, level = 53, vip = true, cd = {min = 125, max = 130}, xp = {min = 140, max = 141}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'solstice tree log', pluralname = 'solstice tree logs', aid = 7465 } } }, ----- SOLSTICE TREE ----- [10912] = { decay = 8786, level = 53, vip = true, cd = {min = 125, max = 130}, xp = {min = 140, max = 141}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'solstice tree log', pluralname = 'solstice tree logs', aid = 7465 } } }, ----- SOLSTICE TREE ----- [10913] = { decay = 8786, level = 53, vip = true, cd = {min = 125, max = 130}, xp = {min = 140, max = 141}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'solstice tree log', pluralname = 'solstice tree logs', aid = 7465 } } }, ----- PAWPAW TREE ----- [5390] = { decay = 8786, level = 35, vip = false, cd = {min = 60, max = 70}, xp = {min = 80, max = 83}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'pawpaw log', pluralname = 'pawpaw logs', aid = 7465 } } }, ----- BANANA TREE ----- [5391] = { decay = 8786, level = 35, vip = true, cd = {min = 60, max = 60}, xp = {min = 85, max = 87}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'pawpaw log', pluralname = 'pawpaw logs', aid = 7465 } } }, ----- BANANA TREE ----- [5092] = { decay = 8786, level = 35, vip = true, cd = {min = 60, max = 60}, xp = {min = 85, max = 87}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'banana log', pluralname = 'banana logs', aid = 7465 }, {id = 2676, min = 5, max = 10, chance = 100} } }, ----- BANANA TREE ----- [5093] = { decay = 8786, level = 35, vip = true, cd = {min = 60, max = 60}, xp = {min = 85, max = 87}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'banana log', pluralname = 'banana logs', aid = 7465 }, {id = 2676, min = 5, max = 10, chance = 100} } }, ----- BANANA TREE ----- [5094] = { decay = 8786, level = 35, vip = true, cd = {min = 60, max = 60}, xp = {min = 85, max = 87}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'banana log', pluralname = 'banana logs', aid = 7465 }, {id = 2676, min = 5, max = 10, chance = 100} } }, ----- BANANA TREE ----- [5095] = { decay = 8786, level = 35, vip = true, cd = {min = 60, max = 60}, xp = {min = 85, max = 87}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'banana log', pluralname = 'banana logs', aid = 7465 }, {id = 2676, min = 5, max = 10, chance = 100} } }, ----- PEAR TREE ----- [2705] = { decay = 8786, level = 83, vip = false, cd = {min = 120, max = 150}, xp = {min = 370, max = 380}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'pear log', pluralname = 'pear logs', aid = 7465 }, {id = 2673, min = 10, max = 25, chance = 100} } }, ----- DWARF TREE ----- [2711] = { decay = 8786, level = 15, vip = false, cd = {min = 30, max = 40}, xp = {min = 37, max = 39}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'dwarf tree log', pluralname = 'dwarf tree logs', aid = 7465 } } }, ----- PINE TREE ----- [2712] = { decay = 8786, level = 87, vip = false, cd = {min = 180, max = 210}, xp = {min = 380, max = 400}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'pine log', pluralname = 'pines logs', aid = 7465 } } }, ----- PINE TREE ----- [7024] = { decay = 8786, level = 87, vip = false, cd = {min = 180, max = 210}, xp = {min = 380, max = 400}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'pine log', pluralname = 'pine logs', aid = 7465 } } }, ----- OLD TREE ----- [2722] = { decay = 8786, level = 50, vip = false, cd = {min = 130, max = 130}, xp = {min = 125, max = 127}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'old tree log', pluralname = 'old tree logs', aid = 7465 } } }, ----- SNOWY PINE TREE ----- [7023] = { decay = 8786, level = 87, vip = false, cd = {min = 180, max = 210}, xp = {min = 380, max = 400}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'pine log', pluralname = 'pine logs', aid = 7465 } } },----- PALM TREE ----- [2725] = { decay = 8786, level = 15, vip = true, cd = {min = 30, max = 40}, xp = {min = 38, max = 40}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'palm log', pluralname = 'palm logs', aid = 7465 } } }, ----- BIRCH TREE ----- [8313] = { decay = 8786, level = 45, vip = false, cd = {min = 90, max = 90}, xp = {min = 92, max = 94}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'birch log', pluralname = 'birch logs', aid = 7465 } } }, ----- BIRCH TREE ----- [8139] = { decay = 8786, level = 45, vip = false, cd = {min = 90, max = 90}, xp = {min = 92, max = 94}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'birch log', pluralname = 'birch logs', aid = 7465 } } }, ----- SWAMP GNARL TREE ----- [18662] = { decay = 8786, level = 1, vip = false, cd = {min = 15, max = 25}, xp = {min = 25, max = 28}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'swamp gnarl log', pluralname = 'swamp gnarl logs', aid = 7465 } } }, ----- SWAMP GNARL TREE ----- [18660] = { decay = 8786, level = 1, vip = false, cd = {min = 15, max = 25}, xp = {min = 25, max = 28}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'swamp gnarl log', pluralname = 'swamp gnarl logs', aid = 7465 } } }, ----- SWAMP GNARL TREE ----- [18659] = { decay = 8786, level = 1, vip = false, cd = {min = 15, max = 25}, xp = {min = 25, max = 28}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'swamp gnarl log', pluralname = 'swamp gnarl logs', aid = 7465 } } }, ----- SWAMP GNARL TREE ----- [18661] = { decay = 8786, level = 1, vip = false, cd = {min = 15, max = 25}, xp = {min = 25, max = 28}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'swamp gnarl log', pluralname = 'swamp gnarl logs', aid = 7465 } } }, ----- COCONUT PALM ----- [5096] = { decay = 8786, level = 1, vip = false, cd = {min = 35, max = 50}, xp = {min = 25, max = 26}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'coconut palm log', pluralname = 'coconut palm logs', aid = 7465 }, {id = 2678, min = 1, max = 3, chance = 100} } }, ----- COCONUT PALM ----- [2726] = { decay = 8786, level = 1, vip = false, cd = {min = 35, max = 50}, xp = {min = 25, max = 26}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'coconut palm log', pluralname = 'coconut palm logs', aid = 7465 } } }, ----- DRAGONBONE TREE ----- [10728] = { decay = 8786, level = 50, vip = false, cd = {min = 130, max = 130}, xp = {min = 125, max = 127}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'dragonbone log', pluralname = 'dragonbone logs', aid = 7465 } } }, ----- MANGROVE ----- [5392] = { decay = 8786, level = 15, vip = false, cd = {min = 30, max = 40}, xp = {min = 38, max = 39}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'mangrove log', pluralname = 'mangrove logs', aid = 7465 } } }, ----- MANGROVE ----- [5393] = { decay = 8786, level = 15, vip = false, cd = {min = 30, max = 40}, xp = {min = 38, max = 39}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'mangrove log', pluralname = 'mangrove logs', aid = 7465 } } }, ----- JADE SPIKE TREE ----- [10732] = { decay = 8786, level = 70, vip = false, cd = {min = 155, max = 165}, xp = {min = 216, max = 218}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'jade spike log', pluralname = 'jade spike logs', aid = 7465 } } }, ----- JADE PLANT ----- [10733] = { decay = 8786, level = 60, vip = false, cd = {min = 150, max = 160}, xp = {min = 170, max = 175}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'jade log', pluralname = 'jade logs', aid = 7465 } } }, ----- LURKING TREE ----- [20759] = { decay = 8786, level = 35, vip = true, cd = {min = 60, max = 60}, xp = {min = 80, max = 82}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'lurking tree log', pluralname = 'lurking tree logs', aid = 7465 } } }, ----- TWISTED ROOTS ----- [20875] = { decay = 8786, level = 70, vip = false, cd = {min = 160, max = 160}, xp = {min = 217, max = 219}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'twisted roots log', pluralname = 'twisted roots tree logs', aid = 7465 } } }, ----- TWISTED ROOTS ----- [20876] = { decay = 8786, level = 70, vip = false, cd = {min = 160, max = 160}, xp = {min = 217, max = 219}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'twisted roots log', pluralname = 'twisted roots logs', aid = 7465 } } }, ----- THREAD TREE ----- [4007] = { decay = 8786, level = 99, vip = false, cd = {min = 240, max = 240}, xp = {min = 1000, max = 1200}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'thread tree log', pluralname = 'thread tree logs', aid = 7465 } } }, ----- THREAD TREE ----- [6094] = { decay = 8786, level = 99, vip = false, cd = {min = 240, max = 240}, xp = {min = 1000, max = 1200}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'thread tree log', pluralname = 'thread tree logs', aid = 7465 } } }, ----- THROATSLITTER ----- [10876] = { decay = 8786, level = 94, vip = true, cd = {min = 230, max = 230}, xp = {min = 700, max = 800}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'throatslitter log', pluralname = 'throatslitter logs', aid = 7465 } } }, ----- TWINES ----- [6220] = { decay = 8200, level = 75, vip = true, cd = {min = 150, max = 180}, xp = {min = 250, max = 260}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'twine log', pluralname = 'twine logs', aid = 7465 } } }, ----- TWINES ----- [6221] = { decay = 8200, level = 75, vip = true, cd = {min = 150, max = 180}, xp = {min = 250, max = 260}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'twine log', pluralname = 'twine logs', aid = 7465 } } }, ----- BUSH ----- [2767] = { decay = 8786, level = 1, vip = false, cd = {min = 5, max = 15}, xp = {min = 28, max = 30}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'bush log', pluralname = 'bush logs', aid = 7465 } } }, ----- BUSH ----- [2786] = { decay = 8786, level = 1, vip = false, cd = {min = 5, max = 15}, xp = {min = 28, max = 30}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'bush log', pluralname = 'bush logs', aid = 7465 } } }, ----- BUSH ----- [2785] = { decay = 8786, level = 1, vip = false, cd = {min = 5, max = 15}, xp = {min = 28, max = 30}, dp = { { id = 5901, min = 1, max = 5, chance = 100, description = 'You can burn it.', name = 'bush log', pluralname = 'bush logs', aid = 7465 }, {id = 2677, min = 1, max = 15, chance = 100} } } } Após fazer isso vá em data/actions/actions.xml e adicione a seguinte linha Spoiler <action actionid="8989" script="other/woodcutting.lua" /> Agora dentro da pasta data/actions/others crie um arquivo chamado woodcutting.lua e coloque o seguinte conteúdo Spoiler dofile('data/lib/woodcutting/trees.lua') dofile('data/lib/woodcutting/config.lua') dofile('data/lib/woodcutting/rewards.lua') dofile('data/lib/woodcutting/axes.lua') local trees = WCTREES local config = WCCONFIG local rewards = WCREWARDS local axes = WCAXES function onUse(player, item, fromPosition, target, toPosition, isHotkey) if not target:isItem() then return false end if not trees[target.itemid] then return false end if not axes[item.itemid] then error('Axe not found. Add the axe in \'data/lib/woodcutting/axes.lua\'') end local treeId = target.itemid local tree = trees[treeId] local axe = axes[item.itemid] wcStart(player, config.stlevel, config.stxp) --- Premium Check if (player:getPremiumDays() == 0) and (tree.vip == true) then player:sendTextMessage(MESSAGE_STATUS_WARNING, 'You need to be premium.') return false end local playerlevel = player:getStorageValue(config.stlevel) --- Level Check if playerlevel< tree.level then player:sendTextMessage(MESSAGE_STATUS_WARNING, 'You need level ' .. tree.level .. ' to cut ' .. getItemName(treeId) .. '.') return false end --- Chance to Cut if axe.level < tree.level then local cutchance = (axe.level * 100) / tree.level if math.random(1, 100) > tonumber(cutchance) then target:getPosition():sendMagicEffect(config.destroyfail) return true end end local items = '' local i = 1 local xp = math.random(tree.xp.min, tree.xp.max) local playerxp = player:getStorageValue(config.stxp) local xpnextlevel = wcGetXPByLevel(config.constant, playerlevel + 1) --- Tree Destroy and Show XP target:transform(tree.decay) target:getPosition():sendMagicEffect(config.treedestroy) player:setStorageValue(config.stxp, playerxp + xp) player:sendTextMessage(MESSAGE_EXPERIENCE, '', player:getPosition(), xp, config.xpcolor, 0) --- UP Level if (playerxp + xp) >= xpnextlevel then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You advanced to woodcutting ' .. playerlevel + 1 .. '.') player:setStorageValue(config.stlevel, playerlevel + 1) player:getPosition():sendMagicEffect(config.upeffect) xpnextlevel = wcGetXPByLevel(config.constant, playerlevel + 2) --- Rewards if rewards[playerlevel + 1] then player:sendTextMessage(rewards[playerlevel + 1].msg.effect, rewards[playerlevel + 1].msg.text) for j = 1, #rewards[playerlevel + 1].items do local item = Game.createItem(rewards[playerlevel + 1].items[j].id, rewards[playerlevel + 1].items[j].count) --- Reward Custom Weight if rewards[playerlevel + 1].items[j].weight then item:setAttribute('weight', rewards[playerlevel + 1].items[j].weight) end --- Reward Custom Description if rewards[playerlevel + 1].items[j].description then item:setAttribute('description', rewards[playerlevel + 1].items[j].description) end --- Reward Custom Name if rewards[playerlevel + 1].items[j].name then item:setAttribute('name', rewards[playerlevel + 1].items[j].name) end --- Reward Custom Plural Name if rewards[playerlevel + 1].items[j].pluralname then item:setAttribute('pluralname', rewards[playerlevel + 1].items[j].pluralname) end --- Reward Custom Action ID if rewards[playerlevel + 1].items[j].aid then item:setAttribute('aid', rewards[playerlevel + 1].items[j].aid) end player:addItemEx(item, true) end end end --- Remain XP Message player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'You need more ' .. xpnextlevel - (playerxp + xp) .. ' xp to advance in woodcutting.') ---- Item Drop for _, config in pairs(tree.dp) do if config.chance >= math.random(1, 100) then local count = math.random(config.min, config.max) local item = Game.createItem(config.id, count) --- Drop Custom Weight if config.weight then item:setAttribute('weight', config.weight * 100) end --- Drop Custom Description if config.description then item:setAttribute('description', config.description) end --- Drop Custom Name if config.name then item:setAttribute('name', config.name) end --- Drop Custom Plural Name if config.pluralname then item:setAttribute('pluralname', config.pluralname) end --- Drop Custom Action ID if config.aid then item:setAttribute('aid', config.aid) end --- Drop Custom Player Effect if config.effect then player:getPosition():sendMagicEffect(config.effect) end --- Drop Custom Player Message if config.msg then player:sendTextMessage(config.msg.effect, config.msg.text) end player:addItemEx(item, true) if #tree.dp == 1 then items = items .. count .. ' ' .. (count > 1 and item:getPluralName() or item:getName()) .. '.' elseif #tree.dp == i then items = items .. 'and ' .. count .. ' ' .. (count > 1 and item:getPluralName() or item:getName()) .. '.' else items = items .. count .. ' ' .. (count > 1 and item:getPluralName() or item:getName()) .. ' ' end i = i + 1 end end --- Loot msg player:sendTextMessage(MESSAGE_INFO_DESCR, 'You got ' .. items) --- Grow up tree event addEvent(function() target:transform(treeId) end, math.random(tree.cd.min, tree.cd.max) * 1000) return true end Vá em data/talkactions/talkactions.xml e adicione a seguinte linha Spoiler <talkaction words="!wccheck" separator=" " script="wccheck.lua" hidden="yes" /> Dentro da pasta data/talkactions/scripts crie um arquivo chamado wccheck.lua e coloque o seguinte conteúdo Spoiler dofile('data/lib/woodcutting/config.lua') function onSay(player, words, param) if param == 'level' then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Your current level in woodcutting is ' .. player:getStorageValue(300697)) return false elseif param == 'xp' then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Your current experience in woodcutting is ' .. player:getStorageValue(300698)) return false elseif param =='nextlevel' then local nextlevel = player:getStorageValue(300697) + 1 local currentxp = player:getStorageValue(300697) player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'You need more ' .. xpnextlevel - (playerxp + xp) .. ' xp to advance in Woodcutting.') end player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, param .. ' does not exist.') return false end Após tudo isso só falta criar o NPC para a compra dos axes Para isso vá em data/npc e crie o arquivo Yume.xml e preencha com o código Spoiler <?xml version="1.0" encoding="UTF-8"?> <npc name="Yume" script="buyaxe.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100" /> <look type="136" head="114" body="126" legs="90" feet="114" addons="3" /> </npc> Agora em data/npc/scripts crie um arquivo chamado buyaxe.lua e coloque este código Spoiler dofile('data/lib/woodcutting/axes.lua') dofile('data/lib/woodcutting/config.lua') local axes = WCAXES local wcconfig = WCCONFIG local nodes = {} local axesname = {} local axesnames = '' local i = 1 local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end for id, config in pairs(axes) do axename = config.name:lower() axesname[i] = '{' .. capitalize(axename) .. '}' nodes[i] = keywordHandler:addKeyword({axename}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy {' .. capitalize(config.name) .. '} by {' .. config.price .. '} gold coins?'} ) nodes[i]:addChildKeyword({'yes'}, StdModule.buyaxe, {npcHandler = npcHandler, axe = {id = id, config = config, aid = wcconfig.aid}}) nodes[i]:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Ok!'}) i = i + 1 end for i = 1, #axesname do if (i == 1 and i == #axesname) or i == 1 then axesnames = axesnames .. axesname[i] elseif i == #axesname then axesnames = axesnames .. ' and ' .. axesname[i] else axesnames = axesnames .. ', ' .. axesname[i] end end nodes[1] = keywordHandler:addKeyword({'axes'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell these axes for woodcutting: ' .. axesnames .. '.'} ) npcHandler:addModule(FocusModule:new()) Agora em data/npc/lib/modules.lua adicione o seguinte código antes do último end Spoiler function StdModule.buyaxe(cid, message, keywords, parameters, node) local npcHandler = parameters.npcHandler local player = Player(cid) local axe = parameters.axe if npcHandler == nil then error("StdModule.buyaxe called without any npcHandler instance.") end if not npcHandler:isFocused(cid) then return false end if not player:removeMoney(axe.config.price) then npcHandler:say("You do not have enough money.", cid) return false end item = Game.createItem(axe.id, 1) if axe.config.name then item:setAttribute('name', axe.config.name) end if axe.config.description then item:setAttribute('description', axe.config.description) end item:setAttribute('aid', axe.aid) item:setAttribute(ITEM_ATTRIBUTE_ATTACK, 0) item:setAttribute(ITEM_ATTRIBUTE_EXTRADEFENSE, 0) item:setAttribute(ITEM_ATTRIBUTE_DEFENSE, 0) player:addItemEx(item) npcHandler:say("Here's your " .. getItemName(axe.id) .. "!.", cid) npcHandler:resetNpc(cid) return true end Com isso o sistema já está implementado em seu servidor, agora para configurar você pode ir em data/lib/woodcutting/axes.lua para configurar os machados, adicionar novos ou remover. Spoiler [ID DO ITEM AQUI] = {name = 'NOME DESEJADO', description = 'DESCRIÇÃO AQUI', level = 'LEVEL DAS ARVORES QUE IRA CORTAR', price = 'PREÇO EM GOLD COINS'} data/lib/woodcutting/config.lua para alterar as configurações de efeito, constante do sistema de nível, action id, e as storages. Spoiler WCCONFIG = { constant = 100, -- Constante que define a xp em cada level. stlevel = 300697, -- Storage que armazena o level. stxp = 300698, -- Storage que armazena a xp. aid = 8989, -- Action id na qual o script foi registrado. upeffect = CONST_ME_SOUND_PURPLE, -- Efeito no player ao upar de level. xpcolor = TEXTCOLOR_YELLOW, -- Cor da xp ao receber. treedestroy = CONST_ME_POFF, -- Efeito exibido ao destruir uma árvore. destroyfail = CONST_ME_BLOCKHIT -- Efeito exbido ao falhar ao destruir uma árvore. } data/lib/woodcutting/rewards.lua para configurar as recompensas por nível. Spoiler WCREWARDS = { [3] = { -- Level para receber a recompensa msg = { text = 'Congratulations!', -- Mesangem ao receber a recompensa effect = MESSAGE_STATUS_CONSOLE_BLUE, -- Tipo da mensagem }, items = { -- Itens a serem entregues { id = 10137, -- ID do item count = 1, -- Quantidade description = "Reward for reaching level 99 in woodcutting." -- Descrição personalizada } } } } data/lib/woodcutting/trees.lua para adicionar/remover arvores e altera-las. Spoiler [2785] = { -- ID da árvore decay = 8786, -- Item que apareceça no lugar ao ser destruida level = 1, -- Nivel para cortar a árvore vip = false, -- Árvore vip? cd = {min = 5, max = 15}, -- CD minimo e máximo xp = {min = 28, max = 30}, -- XP minima e máxima dp = { -- Itens dropados ao cortar a árvore { id = 5901, -- Id do Item min = 1, -- Quantidade Minima max = 5, -- Quantidade Máxima chance = 100, -- Chance de dropar description = 'You can burn it.', -- Descrição do item name = 'bush log', -- Nome do item pluralname = 'bush logs', --Nome em plural do item aid = 7465 -- Action ID do item } } } Tabela de experiência das árvores Spoiler Editado Dezembro 17, 2017 7 anos por Leohige (veja o histórico de edições)
Postado Dezembro 17, 2017 7 anos Parabéns, seu tópico de conteúdo foi aprovado! Muito obrigado pela sua contribuição, nós do Tibia King agradecemos. Seu conteúdo com certeza ajudará à muitos outros, você recebeu +1 REP. Spoiler Congratulations, your content has been approved! Thank you for your contribution, we of Tibia King we are grateful. Your content will help many other users, you received +1 REP.
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.