Ir para conteúdo

Starliks

Campones
  • Total de itens

    66
  • Registro em

  • Última visita

Posts postados por Starliks

  1. 2 horas atrás, Yan18 disse:

    Eu estava dando uma olhada na fonte de onde você pegou esse script, e parece que estava faltando uma verificação.

     

    Substitui o código por esse:

     

    
    function Creature:onChangeOutfit(outfit)
    	return true
    end
    
    function Creature:onAreaCombat(tile, isAggressive)
    	return RETURNVALUE_NOERROR
    end
    
    function Creature:onTargetCombat(target)
        target:registerEvent("ItemSetsHealth")
        target:registerEvent("UpgradeSystemHealth")
        target:registerEvent("UpgradeSystemDeath")
    	
    	--[[if (self:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == nil) or (self:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == nil)  then
    		print("There was an error, please verify the value of the storage [STORAGEVALUE_WAR_GREENPLAYER_BOOL] or [STORAGEVALUE_WAR_REDPLAYER_BOOL] because it them are nil.")
    	return false
    	end]]--	
    	
    if self:isPlayer() then		
        if self:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 1 then
            if target:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 1 then
                return RETURNVALUE_NOERROR
    			
            elseif target:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 0 then
                self:sendCancelMessage("You cannot attack someone that is on your team.")
            return false
            end
        	
        elseif self:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 1 then
            if target:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 1 then
                return RETURNVALUE_NOERROR
            elseif target:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 0 then
                self:sendCancelMessage("You cannot attack someone that is on your team.")
                return false
            end
        end
    end	
    	
    end

    Testa e fala se deu problema.

    Muito obg , deu certo s2, me ajudou d+

  2. 19 minutos atrás, Yan18 disse:

    Isso exatamente, e o erro que deu ali é porque alguma ou as duas storages estão sem valor, ou seja, estão como nil, o que significa que os valores estão zerados. E como estão sem valores, vai dar erro no arquivo creature.lua, que é justamente o erro que aponta, o valor da storage está nil. Tem que ver onde e qual arquivo que seta o valor dessas storages globais e ver o porque não está setando, se tem alguma condição específica para isso.

     

    Mas, vamos fazer um tratamento para caso seja valor nil. Substitua o código por esse:

     

    
    function Creature:onChangeOutfit(outfit)
    	return true
    end
    
    function Creature:onAreaCombat(tile, isAggressive)
    	return RETURNVALUE_NOERROR
    end
    function Creature:onTargetCombat(target)
        target:registerEvent("ItemSetsHealth")
        target:registerEvent("UpgradeSystemHealth")
        target:registerEvent("UpgradeSystemDeath")
    	
    	if (Game.getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == nil) or (Game.getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == nil) then
    		print("There was an error, please verify the value of the storage [STORAGEVALUE_WAR_GREENPLAYER_BOOL] or [STORAGEVALUE_WAR_REDPLAYER_BOOL] because it them are nil.")
    	return false
    	end	
    	
        if self:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 1 then
            if target:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 1 then
                return RETURNVALUE_NOERROR
    			
            elseif target:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 0 then
                self:sendCancelMessage("You cannot attack someone that is on your team.")
            return false
            end
        	
    	elseif self:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 1 then
            if target:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 1 then
                return RETURNVALUE_NOERROR
            elseif target:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 0 then
                self:sendCancelMessage("You cannot attack someone that is on your team.")
                return false
            end
        end
    	
    end

     

    Fiz uma verificação que se alguma dessas storages forem estiverem nil, vai retornar falso e informar o erro para você na distro.

     

     

    Agora o personagem esta apanhando dos mobs, porém cada ataque q ele sofre acontece esse erro.

    image.thumb.png.7e6c53f77d17764bc9d45f4ac1dab5a6.png

  3. 23 horas atrás, Yan18 disse:

    Vamos fazer um teste e descobrir o valor dessa storage, pois parece ser global, então só fazendo testa para saber o valor dela.

     

    Para ficar mais rápido e simples o teste, vai em Data/Creaturescripts/Scripts e abre o arquivo login.lua, e embaixo de:

     

    
    function onLogin(player)

     

    Adicione a linha:

     

    
    print("Storage STORAGEVALUE_WAR_GREENPLAYER_BOOL = " .. Game.getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) .. "\n Storage STORAGEVALUE_WAR_REDPLAYER_BOOL = " .. Game.getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL))

     

    Após isso, inicie o servidor e me manda print da distro assim que fizer login com o player, pois essa linha que falei para adicionar vai mostrar os valores dessas duas storages na distro.

    Seria isso ?

     

    image.thumb.png.0e94125ce96b9403041ccc3d844710c2.png

  4. 18 horas atrás, nociam disse:

    como esta o seu código?

     

    Screenshot_1.png.7522666b56a8217d4e00d4d7036cf34e.png

    function Creature:onChangeOutfit(outfit)
    	return true
    end
    
    function Creature:onAreaCombat(tile, isAggressive)
    	return RETURNVALUE_NOERROR
    end
        function Creature:onTargetCombat(target)
        target:registerEvent("ItemSetsHealth")
        target:registerEvent("UpgradeSystemHealth")
        target:registerEvent("UpgradeSystemDeath")
        if self:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 1 then
            if target:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 1 then
                return RETURNVALUE_NOERROR
            elseif target:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 0 then
                self:sendCancelMessage("You cannot attack someone that is on your team.")
                return false
            end
        elseif self:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 1 then
            if target:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 1 then
                return RETURNVALUE_NOERROR
            elseif target:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 0 then
                self:sendCancelMessage("You cannot attack someone that is on your team.")
                return false
            end
        end
    end

     

  5. Em 17/05/2020 em 15:04, nociam disse:

    O self e da instancia da criatura e o método e do player, observe abaixo o exemplo da ideia.

     

    if isPlayer(self) then

      player = Player(self)

      if player :getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 1 then

    end

    end

    Deu certo, agora só tem 1 pequeno erro no console.

    image.thumb.png.7e6841f69b50694e37406c05163b5125.png

  6. Estou com esse erro no console, alguém pode ajudar?

     

    ngvei0.png

     

     

     esse e o script q uso

    --Config crit chance PS: Values are in % of skill level and using a range 0 to 1
        local critChance = {
            Sword   = 0.75,
            Axe     = 0.6,
            Club    = 0.5,
            Dist    = 0.75,
            Magic   = 0.75
        }
     
        --Config crit damage by weapon type
       
        local critDmg = {
            Sword   = 0.3,
            Axe     = 0.3,
            Club    = 0.3,
            Dist    = 0.3,
            Magic   = 0.5
        }
     
    function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
        --If its a field or damage over time
        if Tile(creature:getPosition()):hasFlag(TILESTATE_MAGICFIELD) == TRUE or attacker == nil then
            return primaryDamage, primaryType, secondaryDamage, secondaryType  
        end
     
        --If its not a player or monster attacking
        if not attacker:isPlayer() and not attacker:isMonster() then
            return primaryDamage, primaryType, secondaryDamage, secondaryType      
        end
     
        local pDam, pCap = 0, 0
        local dodge = false
       
        --Calculate Crit chance of monsters
        if attacker:isMonster() and not creature:isMonster() then      
            if attacker:getSpeed() * 0.08 > math.random(100) then
                pDam = primaryDamage * 0.5
            end    
        end
     
        --Calculate DODGE chance of monsters
        if creature:isMonster() and attacker:isPlayer() and primaryType ~= COMBAT_HEALING then
            if creature:getSpeed() * 0.08 > math.random(100) then
                dodge = true
                creature:say("DODGE".. pDam, TALKTYPE_MONSTER_SAY)
            end
        end
     
        --Calculate CRIT chance of players
        if attacker:isPlayer() then
            --The chance of critical is based on the weapon type, the same for crit damage
            if attacker:getWeaponType() == WEAPON_SWORD and math.random(100) <= attacker:getSkillLevel(SKILL_SWORD) * critChance.Sword then
                pDam = ((attacker:getSkillLevel(SKILL_SWORD) * critDmg.Sword)       / 100) * primaryDamage     
            elseif attacker:getWeaponType() == WEAPON_AXE and math.random(100) <= attacker:getSkillLevel(SKILL_AXE) * critChance.Axe then
                pDam = ((attacker:getSkillLevel(SKILL_AXE) * critDmg.Axe)           / 100) * primaryDamage     
            elseif attacker:getWeaponType() == WEAPON_CLUB and math.random(100) <= attacker:getSkillLevel(SKILL_CLUB) * critChance.Club then
                pDam = ((attacker:getSkillLevel(SKILL_CLUB) * critDmg.Club)         / 100) * primaryDamage     
            elseif attacker:getWeaponType() == WEAPON_DISTANCE and math.random(100) <= attacker:getSkillLevel(SKILL_DISTANCE) * critChance.Dist then
                pDam = ((attacker:getSkillLevel(SKILL_DISTANCE) * critDmg.Dist)     / 100) * primaryDamage     
            elseif attacker:getWeaponType() == WEAPON_WAND and math.random(100) <= attacker:getMagicLevel(SKILL_MAGLEVEL) * critChance.Magic then
                pDam = ((attacker:getMagicLevel(SKILL_MAGLEVEL) * critDmg.Magic)    / 100) * primaryDamage
            end
        end
     
        --Calculate DODGE chance of players
        if creature:isPlayer() and primaryType ~= COMBAT_HEALING then
            --Get's the free % of the capacity
            pCap = getPlayerFreeCap(creature) / (creature:getCapacity() / 100)
     
            --The calculation is based on speed and % of free capacity (cap)
            if ((creature:getSpeed() / 2) * 0.05) * (pCap * 1.5/1) > math.random(100)  then        
                dodge = true
                creature:say("DODGE", TALKTYPE_MONSTER_SAY)
            end
        end
     
        --If its a Critical show message
        if pDam ~= 0 then
            if origin == ORIGIN_RANGED then
                creature:say("HEADSHOT!", TALKTYPE_MONSTER_SAY)
                creature:getPosition():sendMagicEffect(CONST_ME_EXPLOSIONAREA)        
            elseif origin == ORIGIN_MELEE then
                attacker:say("CRITICAL!", TALKTYPE_MONSTER_SAY)
                creature:getPosition():sendMagicEffect(CONST_ME_HITAREA)
            elseif origin == ORIGIN_SPELL then
                if primaryType == 2 then
                        attacker:say("ELECTROCUTE!", TALKTYPE_MONSTER_SAY)
                    elseif primaryType == 512 then
                        attacker:say("FREEZE!", TALKTYPE_MONSTER_SAY)
                    elseif primaryType == 8 then
                        attacker:say("BURN!", TALKTYPE_MONSTER_SAY)
                    elseif primaryType == 2048 then
                        attacker:say("EMBRACE!", TALKTYPE_MONSTER_SAY)
                    elseif primaryType == 1024 then
                        attacker:say("PURIFY!", TALKTYPE_MONSTER_SAY)
                    elseif primaryType == 128 then
                        attacker:say("REVIVE!", TALKTYPE_MONSTER_SAY)
                    elseif primaryType == 1 then
                        attacker:say("CRITICAL!", TALKTYPE_MONSTER_SAY)
                    elseif primaryType == 4 then
                        attacker:say("THORN!", TALKTYPE_MONSTER_SAY)
                end
            end
        end
     
        --If dodged
        if dodge then
            return primaryDamage - primaryDamage, primaryType, secondaryDamage - secondaryDamage, secondaryType
        else
            --If critted
            if pDam ~= 0 then
                if attacker:isPlayer() then
                    attacker:sendTextMessage((MESSAGE_DAMAGE_DEALT), "Critical Hit: +".. pDam .." DMG")
                    return primaryDamage + pDam, primaryType, secondaryDamage, secondaryType
                else
                    attacker:say("Crit: ".. pDam, TALKTYPE_MONSTER_SAY)
                    return primaryDamage + pDam, primaryType, secondaryDamage, secondaryType
                end
            end
           
            --Normal damage
            return primaryDamage, primaryType, secondaryDamage, secondaryType      
        end
       
    end
  7. Vc n sabe compilar?

    Procura na otland tem muitos tutoriais de compilação bons.

     

    eu li sobre, porem tem que fazer downloads de muitos programas para compilar otclient , só daria pra fazer isso quando meu pc voltar do conserto " obs placa mãe queimada" , no momento estou usando 1 not velho da minha mãe, kk

  8. estava tentando adicionar o opcode e get vocation do banana porem não tive sucesso pois creio que a versão e antiga,.

     

    então vejo pedir ajudar de vcs se alguém tiver e puder adicionar nas sources e compilar para 32 bits,( obs: em ultimo caso)

     

     

     

     

    Eu preciso mesmo só das source compilada para 32 bits, pois fiz algumas mudanças nelas...

    pode ser em dx 9 ou open gl

     

    http://www.mediafire.com/download/7jigwfvvxj23v3h/source.rar

  9. Em qualquer modulo lá, essa linha faz o player falar algo. Coloca na função de abrir/fechar seu modulo de barra de ataque, por exemplo.

     

    tentei e não consegui utilizar.

     

    caso eu tenha que add alguma coisa na sources tanto do client quando do tfs o que seria? onde eu adicionaria ?

    se puder colocar passo a passo pois não entendo muito.

  10. Olá estou tentando utilizar uma barra de ataque para tibia, encontrei esse:

     

    http://www.xtibia.com/forum/topic/212973-drakys-codes-tibia-spell-bar/

     

     

    Porem ele não esta filtrando as spell pela vocação, estou utilizando o servidor 10.90 que seria automático o reconhecimento.

     

     

    Exemplo: Paladin com todas as spells , inclusive as que não são de sua classe.

     

    11hb57d.png

    
    
    [spoiler]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, b) 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[/spoiler]
    
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...