Ir para conteúdo
  • 0
Entre para seguir isso  
skyofdeus

OTClient [REP+] Ajudinha basica aqui !

Pergunta

skyofdeus    6
skyofdeus

Ola estou com um serio probleminha chato no meu OTCliente.

Estalei um mod de spellbar, mais não reconhece somente as spells da vocação do jogador, mais sim todas spells de todas vocações.

 

Imagem abaixo:

[ATTACH]5474[/ATTACH]

 

A mod que peguei foi esta aqui, [Draky's Codes] - Tibia Spell Bar

 

SpellBar.LUA

[spoiler=Clica Aqui]

local spelllist = {
 ['Death Strike'] =             {id = 87,  words = 'exori mort',            exhaustion = 2000,  premium = true,  type = 'Instant', icon = 'deathstrike',            mana = 20,     level = 16, soul = 0, group = {[1] = 2000},               vocations = {1, 5}},
 ['Flame Strike'] =             {id = 89,  words = 'exori flam',            exhaustion = 2000,  premium = true,  type = 'Instant', icon = 'flamestrike',            mana = 20,     level = 14, soul = 0, group = {[1] = 2000},               vocations = {1, 2, 5, 6}},
 ['Strong Flame Strike'] =      {id = 150, words = 'exori gran flam',       exhaustion = 8000,  premium = true,  type = 'Instant', icon = 'strongflamestrike',      mana = 60,     level = 70, soul = 0, group = {[1] = 2000, [4] = 8000},   vocations = {1, 5}},
 ['Ultimate Flame Strike'] =    {id = 154, words = 'exori max flam',        exhaustion = 30000, premium = true,  type = 'Instant', icon = 'ultimateflamestrike',    mana = 100,    level = 90, soul = 0, group = {[1] = 4000},               vocations = {1, 5}},
 ['Energy Strike'] =            {id = 88,  words = 'exori vis',             exhaustion = 2000,  premium = true,  type = 'Instant', icon = 'energystrike',           mana = 20,     level = 12, soul = 0, group = {[1] = 2000},               vocations = {1, 2, 5, 6}},
 ['Strong Energy Strike'] =     {id = 151, words = 'exori gran vis',        exhaustion = 8000,  premium = true,  type = 'Instant', icon = 'strongenergystrike',     mana = 60,     level = 80, soul = 0, group = {[1] = 2000, [4] = 8000},   vocations = {1, 5}},
 ['Ultimate Energy Strike'] =   {id = 155, words = 'exori max vis',         exhaustion = 30000, premium = true,  type = 'Instant', icon = 'ultimateenergystrike',   mana = 100,    level = 100,soul = 0, group = {[1] = 4000},               vocations = {1, 5}},
 ['Whirlwind Throw'] =          {id = 107, words = 'exori hur',             exhaustion = 6000,  premium = true,  type = 'Instant', icon = 'whirlwindthrow',         mana = 40,     level = 28, soul = 0, group = {[1] = 2000},               vocations = {4, 8}},
 ['Fire Wave'] =                {id = 19,  words = 'exevo flam hur',        exhaustion = 4000,  premium = false, type = 'Instant', icon = 'firewave',               mana = 25,     level = 18, soul = 0, group = {[1] = 2000},               vocations = {1, 5}},
 ['Ethereal Spear'] =           {id = 111, words = 'exori con',             exhaustion = 2000,  premium = true,  type = 'Instant', icon = 'etherealspear',          mana = 25,     level = 23, soul = 0, group = {[1] = 2000},               vocations = {3, 7}},
 ['Strong Ethereal Spear'] =    {id = 57,  words = 'exori gran con',        exhaustion = 8000,  premium = true,  type = 'Instant', icon = 'strongetherealspear',    mana = 55,     level = 90, soul = 0, group = {[1] = 2000},               vocations = {3, 7}},
 ['Energy Beam'] =              {id = 22,  words = 'exevo vis lux',         exhaustion = 4000,  premium = false, type = 'Instant', icon = 'energybeam',             mana = 40,     level = 23, soul = 0, group = {[1] = 2000},               vocations = {1, 5}},
 ['Great Energy Beam'] =        {id = 23,  words = 'exevo gran vis lux',    exhaustion = 6000,  premium = false, type = 'Instant', icon = 'greatenergybeam',        mana = 110,    level = 29, soul = 0, group = {[1] = 2000},               vocations = {1, 5}},
 ['Groundshaker'] =             {id = 106, words = 'exori mas',             exhaustion = 8000,  premium = true,  type = 'Instant', icon = 'groundshaker',           mana = 160,    level = 33, soul = 0, group = {[1] = 2000},               vocations = {4, 8}},
 ['Berserk'] =                  {id = 80,  words = 'exori',                 exhaustion = 4000,  premium = true,  type = 'Instant', icon = 'berserk',                mana = 115,    level = 35, soul = 0, group = {[1] = 2000},               vocations = {4, 8}},
 ['Annihilation'] =             {id = 62,  words = 'exori gran ico',        exhaustion = 30000, premium = true,  type = 'Instant', icon = 'annihilation',           mana = 300,    level = 110,soul = 0, group = {[1] = 4000},               vocations = {4, 8}},
 ['Brutal Strike'] =            {id = 61,  words = 'exori ico',             exhaustion = 6000,  premium = true,  type = 'Instant', icon = 'brutalstrike',           mana = 30,     level = 16, soul = 0, group = {[1] = 2000},               vocations = {4, 8}},
 ['Front Sweep'] =              {id = 59,  words = 'exori min',             exhaustion = 6000,  premium = true,  type = 'Instant', icon = 'frontsweep',             mana = 200,    level = 70, soul = 0, group = {[1] = 2000},               vocations = {4, 8}},
 ['Inflict Wound'] =            {id = 141, words = 'utori kor',             exhaustion = 30000, premium = true,  type = 'Instant', icon = 'inflictwound',           mana = 30,     level = 40, soul = 0, group = {[1] = 2000},               vocations = {4, 8}},
 ['Ignite'] =                   {id = 138, words = 'utori flam',            exhaustion = 30000, premium = true,  type = 'Instant', icon = 'ignite',                 mana = 30,     level = 26, soul = 0, group = {[1] = 2000},               vocations = {1, 5}},
 ['Lightning'] =                {id = 149, words = 'exori amp vis',         exhaustion = 8000,  premium = true,  type = 'Instant', icon = 'lightning',              mana = 60,     level = 55, soul = 0, group = {[1] = 2000, [4] = 8000},   vocations = {1, 5}},
 ['Curse'] =                    {id = 139, words = 'utori mort',            exhaustion = 50000, premium = true,  type = 'Instant', icon = 'curse',                  mana = 30,     level = 75, soul = 0, group = {[1] = 2000},               vocations = {1, 5}},
 ['Electrify'] =                {id = 140, words = 'utori vis',             exhaustion = 30000, premium = true,  type = 'Instant', icon = 'electrify',              mana = 30,     level = 34, soul = 0, group = {[1] = 2000},               vocations = {1, 5}},
 ['Energy Wave'] =              {id = 13,  words = 'exevo vis hur',         exhaustion = 8000,  premium = false, type = 'Instant', icon = 'energywave',             mana = 170,    level = 38, soul = 0, group = {[1] = 2000},               vocations = {1, 5}},
 ['Rage of the Skies'] =        {id = 119, words = 'exevo gran mas vis',    exhaustion = 40000, premium = true,  type = 'Instant', icon = 'rageoftheskies',         mana = 600,    level = 55, soul = 0, group = {[1] = 4000},               vocations = {1, 5}},
 ['Fierce Berserk'] =           {id = 105, words = 'exori gran',            exhaustion = 6000,  premium = true,  type = 'Instant', icon = 'fierceberserk',          mana = 340,    level = 90, soul = 0, group = {[1] = 2000},               vocations = {4, 8}},
 ['Hells Core'] =               {id = 24,  words = 'exevo gran mas flam',   exhaustion = 40000, premium = true,  type = 'Instant', icon = 'hellscore',              mana = 1100,   level = 60, soul = 0, group = {[1] = 4000},               vocations = {1, 5}},
 ['Holy Flash'] =               {id = 143, words = 'utori san',             exhaustion = 40000, premium = true,  type = 'Instant', icon = 'holyflash',              mana = 30,     level = 70, soul = 0, group = {[1] = 2000},               vocations = {3, 7}},
 ['Divine Missile'] =           {id = 122, words = 'exori san',             exhaustion = 2000,  premium = true,  type = 'Instant', icon = 'divinemissile',          mana = 20,     level = 40, soul = 0, group = {[1] = 2000},               vocations = {3, 7}},
 ['Divine Caldera'] =           {id = 124, words = 'exevo mas san',         exhaustion = 4000,  premium = true,  type = 'Instant', icon = 'divinecaldera',          mana = 160,    level = 50, soul = 0, group = {[1] = 2000},               vocations = {3, 7}},
 ['Physical Strike'] =          {id = 148, words = 'exori moe ico',         exhaustion = 2000,  premium = true,  type = 'Instant', icon = 'physicalstrike',         mana = 20,     level = 16, soul = 0, group = {[1] = 2000},               vocations = {2, 6}},
 ['Eternal Winter'] =           {id = 118, words = 'exevo gran mas frigo',  exhaustion = 40000, premium = true,  type = 'Instant', icon = 'eternalwinter',          mana = 1050,   level = 60, soul = 0, group = {[1] = 4000},               vocations = {2, 6}},
 ['Ice Strike'] =               {id = 112, words = 'exori frigo',           exhaustion = 2000,  premium = true,  type = 'Instant', icon = 'icestrike',              mana = 20,     level = 15, soul = 0, group = {[1] = 2000},               vocations = {1, 5, 2, 6}},
 ['Strong Ice Strike'] =        {id = 152, words = 'exori gran frigo',      exhaustion = 8000,  premium = true,  type = 'Instant', icon = 'strongicestrike',        mana = 60,     level = 80, soul = 0, group = {[1] = 2000, [4] = 8000},   vocations = {2, 6}},
 ['Ultimate Ice Strike'] =      {id = 156, words = 'exori max frigo',       exhaustion = 30000, premium = true,  type = 'Instant', icon = 'ultimateicestrike',      mana = 100,    level = 100,soul = 0, group = {[1] = 4000},               vocations = {2, 6}},
 ['Ice Wave'] =                 {id = 121, words = 'exevo frigo hur',       exhaustion = 4000,  premium = false, type = 'Instant', icon = 'icewave',                mana = 25,     level = 18, soul = 0, group = {[1] = 2000},               vocations = {2, 6}},
 ['Strong Ice Wave'] =          {id = 43,  words = 'exevo gran frigo hur',  exhaustion = 8000,  premium = true,  type = 'Instant', icon = 'strongicewave',          mana = 170,    level = 40, soul = 0, group = {[1] = 2000},               vocations = {2, 6}},
 ['Envenom'] =                  {id = 142, words = 'utori pox',             exhaustion = 40000, premium = true,  type = 'Instant', icon = 'envenom',                mana = 30,     level = 50, soul = 0, group = {[1] = 2000},               vocations = {2, 6}},
 ['Terra Strike'] =             {id = 113, words = 'exori tera',            exhaustion = 2000,  premium = true,  type = 'Instant', icon = 'terrastrike',            mana = 20,     level = 13, soul = 0, group = {[1] = 2000},               vocations = {1, 5, 2, 6}},
 ['Strong Terra Strike'] =      {id = 153, words = 'exori gran tera',       exhaustion = 8000,  premium = true,  type = 'Instant', icon = 'strongterrastrike',      mana = 60,     level = 70, soul = 0, group = {[1] = 2000, [4] = 8000},   vocations = {2, 6}},
 ['Ultimate Terra Strike'] =    {id = 157, words = 'exori max tera',        exhaustion = 30000, premium = true,  type = 'Instant', icon = 'ultimateterrastrike',    mana = 100,    level = 90, soul = 0, group = {[1] = 4000},               vocations = {2, 6}},
 ['Terra Wave'] =               {id = 120, words = 'exevo tera hur',        exhaustion = 4000,  premium = false, type = 'Instant', icon = 'terrawave',              mana = 210,    level = 38, soul = 0, group = {[1] = 2000},               vocations = {2, 6}},
 ['Wrath of Nature'] =          {id = 56,  words = 'exevo gran mas tera',   exhaustion = 40000, premium = true,  type = 'Instant', icon = 'wrathofnature',          mana = 700,    level = 55, soul = 0, group = {[1] = 4000},               vocations = {2, 6}},
 ['Light Healing'] =            {id = 1,   words = 'exura',                 exhaustion = 1000,  premium = false, type = 'Instant', icon = 'lighthealing',           mana = 20,     level = 9,  soul = 0, group = {[2] = 1000},               vocations = {1, 2, 3, 5, 6, 7}},
 ['Wound Cleansing'] =          {id = 123, words = 'exura ico',             exhaustion = 1000,  premium = false, type = 'Instant', icon = 'woundcleansing',         mana = 40,     level = 10, soul = 0, group = {[2] = 1000},               vocations = {4, 8}},
 ['Intense Wound Cleansing'] =  {id = 158, words = 'exura gran ico',        exhaustion = 600000,premium = true,  type = 'Instant', icon = 'intensewoundcleansing',  mana = 200,    level = 80, soul = 0, group = {[2] = 1000},               vocations = {4, 8}},
 ['Cure Bleeding'] =            {id = 144, words = 'exana kor',             exhaustion = 6000,  premium = true,  type = 'Instant', icon = 'curebleeding',           mana = 30,     level = 30, soul = 0, group = {[2] = 1000},               vocations = {4, 8}},
 ['Cure Electrification'] =     {id = 146, words = 'exana vis',             exhaustion = 6000,  premium = true,  type = 'Instant', icon = 'curseelectrification',   mana = 30,     level = 22, soul = 0, group = {[2] = 1000},               vocations = {2, 6}},
 ['Cure Poison'] =              {id = 29,  words = 'exana pox',             exhaustion = 6000,  premium = false, type = 'Instant', icon = 'curepoison',             mana = 30,     level = 10, soul = 0, group = {[2] = 1000},               vocations = {1, 2, 3, 4, 5, 6, 7, 8}},
 ['Cure Burning'] =             {id = 145, words = 'exana flam',            exhaustion = 6000,  premium = true,  type = 'Instant', icon = 'cureburning',            mana = 30,     level = 30, soul = 0, group = {[2] = 1000},               vocations = {2, 6}},
 ['Cure Curse'] =               {id = 147, words = 'exana mort',            exhaustion = 6000,  premium = true,  type = 'Instant', icon = 'curecurse',              mana = 40,     level = 80, soul = 0, group = {[2] = 1000},               vocations = {3, 7}},
 ['Recovery'] =                 {id = 159, words = 'utura',                 exhaustion = 60000, premium = true,  type = 'Instant', icon = 'recovery',               mana = 75,     level = 50, soul = 0, group = {[2] = 1000},               vocations = {4, 8, 3, 7}},
 ['Intense Recovery'] =         {id = 160, words = 'utura gran',            exhaustion = 60000, premium = true,  type = 'Instant', icon = 'intenserecovery',        mana = 165,    level = 100,soul = 0, group = {[2] = 1000},               vocations = {4, 8, 3, 7}},
 ['Salvation'] =                {id = 36,  words = 'exura gran san',        exhaustion = 1000,  premium = true,  type = 'Instant', icon = 'salvation',              mana = 210,    level = 60, soul = 0, group = {[2] = 1000},               vocations = {3, 7}},
 ['Intense Healing'] =          {id = 2,   words = 'exura gran',            exhaustion = 1000,  premium = false, type = 'Instant', icon = 'intensehealing',         mana = 70,     level = 20, soul = 0, group = {[2] = 1000},               vocations = {1, 2, 3, 5, 6, 7}},
 ['Heal Friend'] =              {id = 84,  words = 'exura sio',             exhaustion = 1000,  premium = true,  type = 'Instant', icon = 'healfriend',             mana = 140,    level = 18, soul = 0, group = {[2] = 1000},               vocations = {2, 6}},
 ['Ultimate Healing'] =         {id = 3,   words = 'exura vita',            exhaustion = 1000,  premium = false, type = 'Instant', icon = 'ultimatehealing',        mana = 160,    level = 30, soul = 0, group = {[2] = 1000},               vocations = {1, 2, 5, 6}},
 ['Mass Healing'] =             {id = 82,  words = 'exura gran mas res',    exhaustion = 2000,  premium = true,  type = 'Instant', icon = 'masshealing',            mana = 150,    level = 36, soul = 0, group = {[2] = 1000},               vocations = {2, 6}},
 ['Divine Healing'] =           {id = 125, words = 'exura san',             exhaustion = 1000,  premium = false, type = 'Instant', icon = 'divinehealing',          mana = 160,    level = 35, soul = 0, group = {[2] = 1000},               vocations = {3, 7}},
 ['Light'] =                    {id = 10,  words = 'utevo lux',             exhaustion = 2000,  premium = false, type = 'Instant', icon = 'light',                  mana = 20,     level = 8,  soul = 0, group = {[3] = 2000},               vocations = {1, 2, 3, 4, 5, 6, 7, 8}},
 ['Magic Rope'] =               {id = 76,  words = 'exani tera',            exhaustion = 2000,  premium = true,  type = 'Instant', icon = 'magicrope',              mana = 20,     level = 9,  soul = 0, group = {[3] = 2000},               vocations = {1, 2, 3, 4, 5, 6, 7, 8}},
 ['Levitate'] =                 {id = 81,  words = 'exani hur',             exhaustion = 2000,  premium = true,  type = 'Instant', icon = 'levitate',               mana = 50,     level = 12, soul = 0, group = {[3] = 2000},               vocations = {1, 2, 3, 4, 5, 6, 7, 8}},
 ['Great Light'] =              {id = 11,  words = 'utevo gran lux',        exhaustion = 2000,  premium = false, type = 'Instant', icon = 'greatlight',             mana = 60,     level = 13, soul = 0, group = {[3] = 2000},               vocations = {1, 2, 3, 4, 5, 6, 7, 8}},
 ['Magic Shield'] =             {id = 44,  words = 'utamo vita',            exhaustion = 2000,  premium = false, type = 'Instant', icon = 'magicshield',            mana = 50,     level = 14, soul = 0, group = {[3] = 2000},               vocations = {1, 2, 5, 6}},
 ['Haste'] =                    {id = 6,   words = 'utani hur',             exhaustion = 2000,  premium = true,  type = 'Instant', icon = 'haste',                  mana = 60,     level = 14, soul = 0, group = {[3] = 2000},               vocations = {1, 2, 3, 4, 5, 6, 7, 8}},
 ['Charge'] =                   {id = 131, words = 'utani tempo hur',       exhaustion = 2000,  premium = true,  type = 'Instant', icon = 'charge',                 mana = 100,    level = 25, soul = 0, group = {[3] = 2000},               vocations = {4, 8}},
 ['Swift Foot'] =               {id = 134, words = 'utamo tempo san',       exhaustion = 2000,  premium = true,  type = 'Instant', icon = 'swiftfoot',              mana = 400,    level = 55, soul = 0, group = {[1] = 10000, [3] = 2000},  vocations = {3, 7}},
 ['Challenge'] =                {id = 93,  words = 'exeta res',             exhaustion = 2000,  premium = true,  type = 'Instant', icon = 'challenge',              mana = 30,     level = 20, soul = 0, group = {[3] = 2000},               vocations = {8}},
 ['Strong Haste'] =             {id = 39,  words = 'utani gran hur',        exhaustion = 2000,  premium = true,  type = 'Instant', icon = 'stronghaste',            mana = 100,    level = 20, soul = 0, group = {[3] = 2000},               vocations = {1, 2, 5, 6}},
 ['Ultimate Light'] =           {id = 75,  words = 'utevo vis lux',         exhaustion = 2000,  premium = true,  type = 'Instant', icon = 'ultimatelight',          mana = 140,    level = 26, soul = 0, group = {[3] = 2000},               vocations = {1, 2, 5, 6}},
 ['Cancel Invisibility'] =      {id = 90,  words = 'exana ina',             exhaustion = 2000,  premium = true,  type = 'Instant', icon = 'cancelinvisibility',     mana = 200,    level = 26, soul = 0, group = {[3] = 2000},               vocations = {3, 7}},
 ['Invisibility'] =             {id = 45,  words = 'utana vid',             exhaustion = 2000,  premium = false, type = 'Instant', icon = 'invisible',              mana = 440,    level = 35, soul = 0, group = {[3] = 2000},               vocations = {1, 2, 5, 6}},
 ['Sharpshooter'] =             {id = 135, words = 'utito tempo san',       exhaustion = 2000,  premium = true,  type = 'Instant', icon = 'sharpshooter',           mana = 450,    level = 60, soul = 0, group = {[2] = 10000, [3] = 10000}, vocations = {3, 7}},
 ['Protector'] =                {id = 132, words = 'utamo tempo',           exhaustion = 2000,  premium = true,  type = 'Instant', icon = 'protector',              mana = 200,    level = 55, soul = 0, group = {[1] = 10000, [3] = 2000},  vocations = {4, 8}},
 ['Blood Rage'] =               {id = 133, words = 'utito tempo',           exhaustion = 2000,  premium = true,  type = 'Instant', icon = 'bloodrage',              mana = 290,    level = 60, soul = 0, group = {[3] = 2000},               vocations = {4, 8}},
 ['Train Party'] =              {id = 126, words = 'utito mas sio',         exhaustion = 2000,  premium = true,  type = 'Instant', icon = 'trainparty',             mana = 'Var.', level = 32, soul = 0, group = {[3] = 2000},               vocations = {8}},
 ['Protect Party'] =            {id = 127, words = 'utamo mas sio',         exhaustion = 2000,  premium = true,  type = 'Instant', icon = 'protectparty',           mana = 'Var.', level = 32, soul = 0, group = {[3] = 2000},               vocations = {7}},
 ['Heal Party'] =               {id = 128, words = 'utura mas sio',         exhaustion = 2000,  premium = true,  type = 'Instant', icon = 'healparty',              mana = 'Var.', level = 32, soul = 0, group = {[3] = 2000},               vocations = {6}},
 ['Enchant Party'] =            {id = 129, words = 'utori mas sio',         exhaustion = 2000,  premium = true,  type = 'Instant', icon = 'enchantparty',           mana = 'Var.', level = 32, soul = 0, group = {[3] = 2000},               vocations = {5}},
}
local spells = {}
local lado = 'vertical'
local sbw -- window widget
local sbb -- button ./\ widget
local spellBarWindow -- UIWindow
local exhsaustionTotal = 1100
local hideLevel = false -- os que nao tem level, vai mostrar? true = nao, false = sim
function init()
 sbb = modules.client_topmenu.addRightGameToggleButton('sbb', 'Spell Bar' , 'SpellBar.png', toggle)
 sbw = g_ui.displayUI('SpellBar')
 sbw:move(10,50)
 g_mouse.bindPress(sbw, function() createMenu() end, MouseRightButton)
 sbw:hide()
 connect(g_game, 'onTalk', mensagemEnviada)
 connect(g_game, { onGameEnd = function() sbw:hide() sbb:setOn(false) end })
 connect(LocalPlayer, {
   onLevelChange = onLevelChange
 })
 for inst,values in pairs(spelllist) do
   if values.type == 'Instant' then -- depois vou fazer mais tipos..
     if g_game.getProtocolVersion() >= 950 then -- Vocation is only send in newer clients
       if table.find(values.vocations, g_game.getLocalPlayer():getVocation()) then
         local inside = {instantName = inst, words = values.words, lvl = values.level, mana = values.mana, prem = values.premium, groups = values.group,icon = values.icon, vocations = values.vocations,exhaustion = values.exhaustion}
         table.insert(spells,inside)
       end
     else
       local inside = {instantName = inst, words = values.words, lvl = values.level, mana = values.mana, prem = values.premium, groups = values.group,icon = values.icon, vocations = values.vocations,exhaustion = values.exhaustion}
       table.insert(spells,inside)
     end
   end
 end
 table.sort(spells, function(a,  return (a.lvl < b.lvl) end)
end

function onLevelChange(localPlayer, value, percent)
 getSpells(spells)
end
function mensagemEnviada(name, level, mode, text, channelId, pos)
if not g_game.isOnline() then return end
if g_game.getLocalPlayer():getName() ~= name then return end
 for i = 1,#spells do
  if spells[i].words:lower() == text:lower() then 
    startDownDelay(i)
    break
  end
 end
end

function terminate()
 sbw:destroy()
 sbb:destroy()
 disconnect(g_game, { onGameEnd = function() sbw:hide() sbb:setOn(false) end })
 disconnect(g_game, 'onTalk', mensagemEnviada)
 disconnect(LocalPlayer, {
   onLevelChange = onLevelChange
 })
end

function toggle()
 if sbb:isOn() then
   sbw:hide()
   sbb:setOn(false)
 else
   sbw:show()
   getSpells(spells)
   sbb:setOn(true)
   level = g_game.getLocalPlayer():getLevel()
 end
end

function createMenu()
 local menu = g_ui.createWidget('PopupMenu')
 if lado == 'horizontal' then
   menu:addOption('Set Vertical', function() lado = 'vertical' getSpells(spells) end)
 else
   menu:addOption('Set Horizontal',function() lado = 'horizontal' getSpells(spells) end)
 end
 if hideLevel == false then
   menu:addOption('No Level Hide',function() hideLevel = true getSpells(spells) end)
 else
   menu:addOption('No Level Show',function() hideLevel = false getSpells(spells) end)
 end
 menu:display()
end

function destruirSpells()
 for i = 1,100 do
   if sbw:recursiveGetChildById('spell'..i) == nil then break end
   sbw:recursiveGetChildById('spell'..i):destroy()
   sbw:recursiveGetChildById('progress'..i):destroy()
 end
end

function getSpells(tabela)
 destruirSpells()
 spellBarWindow = sbw:recursiveGetChildById('mainWindow')
 local player = g_game.getLocalPlayer()
 local valor = #tabela
 local width = 38
 local height = 38
 if not player then return end
 for i = 1,#tabela do
   if (tabela[i].lvl > player:getLevel()) and hideLevel == true then
     valor = i - 1
     break
   end
   if i == #tabela then valor = i end
   icon = g_ui.createWidget('SpellButton',spellBarWindow)
   progress = g_ui.createWidget('SpellProgressSpell',spellBarWindow)
   --icon:
   icon:setId('spell'..i)
   local spicon = Spells.getClientId(tabela[i].instantName)
   icon:setImageSource('/images/game/spells/defaultspells')
   icon:setImageClip((((spicon -1)%12)*32) .. ' ' .. ((math.ceil(spicon/12)-1)*32) .. ' 32 32')
   icon:setVisible(true) 
   icon.words = tabela[i].words
   icon.instantName = tabela[i].instantName
   icon.lvl = tabela[i].lvl
   icon.mana = tabela[i].mana
   icon.exhaustion = tabela[i].exhaustion
   icon.exhaustionNeeded = 0
   icon:setTooltip(tabela[i].words)
   if lado == 'horizontal' then
       icon:setMarginTop(3)
       height = 38
       width = (i) * 32 + 2*(i)
       icon:setMarginLeft((i) * 32 + 2*(i) - 32)
   else
       icon:setMarginLeft(3)
       icon:setMarginTop((i) * 32 + 2*(i) - 32)
       width = 38
       height = (i) * 32 + 2*(i)
   end
   --progress:
   progress:setId('progress'..i)    
   progress:setVisible(true) 
   progress:setPercent(100)
   progress:setMarginLeft(icon:getMarginLeft())
   progress:setMarginTop(icon:getMarginTop())
   if player:getLevel() < icon.lvl then progress:setText('L'..icon.lvl) progress:setColor('red') progress:setPercent(0) end
   if progress:getPercent() == 100 then progress:setText('OK') elseif icon.lvl < player:getLevel() then progress:setText(progress:getPercent()) end
   progress:setPhantom(true)
   icon.onClick = function() useSpell(i) end
 end
 sbw:setHeight(height)
 sbw:setWidth(width)  
 spellBarWindow:setSize(sbw:getSize())
end

function useSpell(i)
 local spell = sbw:recursiveGetChildById('spell'..i)
 if not spell then return end
 local progress = sbw:recursiveGetChildById('progress'..i)
 local player = g_game.getLocalPlayer()
 if not player then return end
 if progress:getPercent() < 100 then return modules.game_textmessage.displayFailureMessage('Wait your delay!') end
 g_game.talk(spell.words)
end

function startDownDelay(i) -- aqui vai ficar on onTalk, pra descer só realmente quando a spell sair
 local spell = sbw:recursiveGetChildById('spell'..i)
 if not spell then return end
 local progress = sbw:recursiveGetChildById('progress'..i)
 progress:setPercent(0)
 progress:setText('0%')
 progress:setColor('red')
 spell.exhaustionNeeded = 0
 scheduleEvent(function() spellTimeleft(i) end,100) 
end

function spellTimeleft(i)
 local spell = sbw:recursiveGetChildById('spell'..i)
 if not spell then return end
 local progress = sbw:recursiveGetChildById('progress'..i)
 spell.exhaustionNeeded = spell.exhaustionNeeded + 100
 if spell.exhaustionNeeded < spell.exhaustion then
   progress:setPercent(math.ceil(((spell.exhaustionNeeded) * 100)/spell.exhaustion))
   progress:setText(progress:getPercent())
   progress:setColor('red')
 else
   progress:setPercent(100)
   progress:setText('OK')
   progress:setColor('green')
   spell.exhaustionNeeded = 0    
   return true
 end
 scheduleEvent(function() spellTimeleft(i) end,100) 
end

 

 

SpellBar.OTUI

[spoiler=Clica Aqui]

SpellButton < UIButton
 width: 32
 height: 32
 focusable: false
 image-color: white
 image-size: 32 32
 anchors.left: parent.left
 anchors.top: parent.top

 $!hover:
   image-border: 3
 $hover:
   image-border: 2
   image-color: #ffffff99
 $pressed:
   image-color: #999999
 $disabled:
   image-color: #ffffff66

SpellProgressSpell < UIProgressRect
 background: #585858AA
 percent: 100
 focusable: false
 font: verdana-11px-rounded
 color: green
 anchors.left: parent.left
 anchors.top: parent.top
 size: 32 32

UIWindow
 focusable: false
 Panel
   id: mainWindow
   size: 70 70
   focusable: false
   opacity: 0.95
   image-source: /images/ui/window
   anchors.fill: parent

 

 

Gostaria de saber como faço para reconhecer apenas as spells de acordo com a vocação do jogador, podem me ajudar?

Editado por xS0NYx

Compartilhar este post


Link para o post

3 respostass a esta questão

Recommended Posts

  • 0
xS0NYx    15
xS0NYx

Explique melhor, spellbar seria igual ao do pokemon ?

Compartilhar este post


Link para o post
  • 0
skyofdeus    6
skyofdeus

Sim e uma barra de spells, quando o jogador abre a tela da spellsbar aparece somente as magias da vocação dele.

Nessa spellsbar do Draky's aparece todas magias de todas vocação.

Eu quero que apareça somente as magias de da vocação do jogador.

Exemplo: Jogador Druid, abre a barra de spellsbar , e aparece somente as magias da vocacao dele.

Compartilhar este post


Link para o post
  • 0
xS0NYx    15
xS0NYx
Sim e uma barra de spells, quando o jogador abre a tela da spellsbar aparece somente as magias da vocação dele.

Nessa spellsbar do Draky's aparece todas magias de todas vocação.

Eu quero que apareça somente as magias de da vocação do jogador.

Exemplo: Jogador Druid, abre a barra de spellsbar , e aparece somente as magias da vocacao dele.

Já sei o que é, você tem opcode instalado no seu servidor? precisa também instalar a função getVocation(), tem um tópico aqui da seção criado por mim que ensina a adicionar o opcode e já tem essa função disponibilizada lá também.

Editado por xS0NYx

Compartilhar este post


Link para o post
Visitante
Este tópico está impedido de receber novos posts.
Entre para seguir isso  
  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×