Ir para conteúdo
Banner com Efeitos

Mathias Kenfi

Membro
  • Registro em

  • Última visita

  1. Gabrielx17 reagiu a uma resposta no tópico: Spell com storage
  2. Mathias Kenfi reagiu a uma resposta no tópico: Sistema de roleta ( Tfs 1.x )
  3. Mathias Kenfi reagiu a uma resposta no tópico: Aura Sistem ( Tfs 1.x )
  4. Kramer começou a seguir Mathias Kenfi
  5. felipepalmas reagiu a uma resposta no tópico: Alavanca Issavi
  6. Cat reagiu a uma resposta no tópico: Alavanca Issavi
  7. Você está equivocado, a função getSpectators faz uma checagem em uma area de acordo com os parâmetros fornecido e depois retorna um array com todas as criaturas encontradas. local t = { players = { -- posições que os players devem ficar ao puxar a alavanca [1] = Position(33918,31626,8), [2] = Position(33919,31626,8), [3] = Position(33920,31626,8), [4] = Position(33921,31626,8), [5] = Position(33922,31626,8) }, boss = {name = "Urmahlullu the Weakened", create_pos = Position(33919,31648,8)}, destination = Position(33919,31657,8), -- posição para qual os players serão teleportados cooldown = {4, "hour"}, -- tempo para ser teleportado novamente. Ex.: {2, "sec"}, {5, "min"}, {10, "hour"}, {3, "day"} storage = 56482 -- storage não utilizado no seu servidor } -- Game.getSpectators(position[, multifloor = false[, onlyPlayer = false[, minRangeX = 0[, maxRangeX = 0[, minRangeY = 0[, maxRangeY = 0]]]]]]) function onUse(player, item, fromPosition, target, toPosition, isHotkey) local countPlayers = #Game.getSpectators(t.destination, false, true, 10, 10, 10, 10) -- Irá verificar se há players em um alcance de 10 por 10 com base na pos indicada no primeiro parâmetro if countPlayers > 0 then player:sendCancelMessage("Existem player emfrentando o boss, espere sua vez") return end local players, tab = {}, t.players for i = 1, #tab do local tile = Tile(tab[i]) if tile then local p = Player(tile:getTopCreature()) if p then if p:getStorageValue(t.storage) <= os.time() then players[#players + 1] = p:getId() end end end end if #players == 0 then player:sendCancelMessage("Um ou mais players devem esperar " .. getStrTime(t.cooldown) .. " para fazer novamente.") return true end for i = 1, #tab do local playerTile = Tile(tab[i]) local playerToGo = Player(playerTile:getTopCreature()) if playerToGo then if isInArray(players, playerToGo:getId()) then playerToGo:setStorageValue(t.storage, mathtime(t.cooldown) + os.time()) playerTile:relocateTo(t.destination) tab[i]:sendMagicEffect(CONST_ME_POFF) end end end t.destination:sendMagicEffect(CONST_ME_TELEPORT) Game.createMonster(t.boss.name, t.boss.create_pos) item:transform(item.itemid == 1945 and 1946 or 1945) return true end function mathtime(table) -- by dwarfer local unit = {"sec", "min", "hour", "day"} for i, v in pairs(unit) do if v == table[2] then return table[1]*(60^(v == unit[4] and 2 or i-1))*(v == unit[4] and 24 or 1) end end return error("Bad declaration in mathtime function.") end function getStrTime(table) -- by dwarfer local unit = {["sec"] = "second",["min"] = "minute",["hour"] = "hour",["day"] = "day"} return tostring(table[1].." "..unit[table[2]]..(table[1] > 1 and "s" or "")) end Essa função não verifica se tem players em uma area, ela verifica se a 'pos' está entre 'fromPos' e 'toPos'
  8. Mathias Kenfi reagiu a uma resposta no tópico: (AJUDA) EGG System
  9. @wevertonvrb Aqui vai o script. OBS: Para utilizar na versão TFS 0.3, 0.4 ou OTX2. Siga os passos para instalação dessa lib ->https://github.com/kenfi2/KenfiLib local config = { aid = 23000, items = {7425,7429,7414}, createItems = { 2160, -- Item acima do itemEx. 1515, -- Item do andar de baixo } } function onUse(player, item, fromPosition, itemEx, toPosition) --Se você não usa TFS 0.3, 0.4 ou OTX 2.x pode apagar essa parte abaixo até o comentário de referência local player = Player(player) local item = Item(item.uid) local fromPosition = Position(fromPosition) local toPosition = Position(toPosition) local itemEx = Item(itemEx.uid) -- Aqui. if itemEx.actionid ~= config.aid then return false end local items = {} for i, v in ipairs(config.items) do if player:getItemCount(v) > 0 then table.insert(items, v) end end if #items < #config.items then player:sendTextMessage(27,"Você não tem os itens necessários") return false end for i, v in ipairs(config.items) do if not player:removeItem(v, 1) then player:sendTextMessage(27,"Erro ao concluir.") return false end end Game.createItem(config.createItems[1],1,toPosition) local toPosition = toPosition + 1 Game.createItem(config.createItems[2],1,toPosition) player:sendTextMessage(27,"Mensagem final") return true end XML <action itemid="IDDOITEM" script="NOMEDOARQUIVO.lua" /> IDDOITEM é o item que vai ser usado na alavanca.
  10. yuriowns começou a seguir Mathias Kenfi
  11. Mathias Kenfi reagiu a uma resposta no tópico: Metamétodos
  12. Mathias Kenfi reagiu a uma resposta no tópico: Implementação PicPay-Didático
  13. Essa parte não tem na TFS 0.4 porque essa é a parte que você precisa implementar. Sugiro que preste atenção nas modificações que você precisa fazer, está tudo certo o passo a passo que foi testado na TFS 0.4 e na OTX 2.X que é, inclusive, baseado na TFS 0.4 As linhas que não existem em algumas TFS 0.4, como attackSpeed, foram alteradas. Recomendo que para aqueles que não conseguiram, refaçam as alterações que fizeram e comecem novamente.
  14. Storage armazena apenas números inteiros e strings Se você tentar armazenar um valor decimal solo, como por exemplo setPlayerStorageValue(cid, 1251, 0.5) Ele vai enviar o 0.5 e interpretar como uma string, no caso salvaria como 0.5. Porém se vc tentar de forma aritmética, como por exemplo: 0.5 + 0.8 ou 0.5 + 152783278. Ele vai arredondar pro valor inteiro mais próximo. Os valores numéricos são salvos em valores inteiros de -2147483647 a 2147483647
  15. O tópico foi atualizado com correções de pequenos erros em game.cpp
  16. Apenas troque player->getManaAsborb() por player->getManaAbsorb()
  17. @Gabrieldsadaxas @leozincorsair O tutorial foi feito a partir da OTX 2.xx séries na qual já existe, por padrão, atributos como dualwield e attackspeed Vocês devem, no entanto, adaptar para a source de vocês. Não tem que colocar especificamente depois de ATTR_DUALWIELD = 43; Vocês devem colocar ele depois do PENÚLTIMO ATTR e antes do ÚLTIMO A mesma coisa no item.cpp em relação ao attackspeed if(it.attackSpeed || (item && item->getAttackSpeed())) Se não tem na source vocês podem olhar em uma source que tenha (OTX 2.XX séries de preferência) e ver em qual posição deve ser colocada else if(it.weaponType != WEAPON_AMMO && it.weaponType != WEAPON_WAND) { if(it.attack || it.extraAttack || (item && (item->getAttack() || item->getExtraAttack()))) { begin = false; s << " (Atk:"; if(it.hasAbilities() && it.abilities->elementType != COMBAT_NONE) { s << std::max((int32_t)0, int32_t((item ? item->getAttack() : it.attack) - it.abilities->elementDamage)); if(it.extraAttack || (item && item->getExtraAttack())) s << " " << std::showpos << int32_t(item ? item->getExtraAttack() : it.extraAttack) << std::noshowpos; s << " physical + " << it.abilities->elementDamage << " " << getCombatName(it.abilities->elementType); } else { s << int32_t(item ? item->getAttack() : it.attack); if(it.extraAttack || (item && item->getExtraAttack())) s << " " << std::showpos << int32_t(item ? item->getExtraAttack() : it.extraAttack) << std::noshowpos; } } if(it.defense || it.extraDefense || (item && (item->getDefense() || item->getExtraDefense()))) { if(begin) { begin = false; s << " ("; } else s << ", "; s << "Def:" << int32_t(item ? item->getDefense() : it.defense); if(it.extraDefense || (item && item->getExtraDefense())) s << " " << std::showpos << int32_t(item ? item->getExtraDefense() : it.extraDefense) << std::noshowpos; } } if(it.attackSpeed || (item && item->getAttackSpeed())) { if(begin) { begin = false; s << " ("; } else s << ", "; s << "AS: " << (item ? item->getAttackSpeed() : it.attackSpeed); } Claramente você perecebe que o attackspeed está depois de else if(it.weaponType != WEAPON_AMMO && it.weaponType != WEAPON_WAND) { if(it.attack || it.extraAttack || (item && (item->getAttack() || item->getExtraAttack()))) { begin = false; s << " (Atk:"; if(it.hasAbilities() && it.abilities->elementType != COMBAT_NONE) { s << std::max((int32_t)0, int32_t((item ? item->getAttack() : it.attack) - it.abilities->elementDamage)); if(it.extraAttack || (item && item->getExtraAttack())) s << " " << std::showpos << int32_t(item ? item->getExtraAttack() : it.extraAttack) << std::noshowpos; s << " physical + " << it.abilities->elementDamage << " " << getCombatName(it.abilities->elementType); } else { s << int32_t(item ? item->getAttack() : it.attack); if(it.extraAttack || (item && item->getExtraAttack())) s << " " << std::showpos << int32_t(item ? item->getExtraAttack() : it.extraAttack) << std::noshowpos; } } if(it.defense || it.extraDefense || (item && (item->getDefense() || item->getExtraDefense()))) { if(begin) { begin = false; s << " ("; } else s << ", "; s << "Def:" << int32_t(item ? item->getDefense() : it.defense); if(it.extraDefense || (item && item->getExtraDefense())) s << " " << std::showpos << int32_t(item ? item->getExtraDefense() : it.extraDefense) << std::noshowpos; } } Então se não tiver esse atributo na sua source é só adicionar depois do código citado acima
  18. Todos os arquivos estão citados. items.cpp items.h item.cpp item.h player.cpp player.h game.cpp
  19. Esse sistema foi feito utilizando a source disponibilizada neste link Pode funcionar em TFS 0.4, OTX 2.X e, talvez, em TFS 0.4 só que a probabilidade erros é maior por ter diferentes nomes de funções e variáveis. Fiz um vídeo seguindo o passo a passo abaixo para facilitar o processo de instalação do sistema. Hoje estarei ensinando a instalar os seguintes novos atributos/sistemas em sua source CriticalHitChance e DodgeChance -- (Funciona da mesma maneira que o critical básico de script, porém sem bugs de callstack) Life e Mana Absorb -- (Regenera, de acordo com a % atribuida, a partir de dano recebido) Life e Mana Leech -- (Regenera, de acordo com a % atribuida, a partir do dano causado) Exemplo de como vai ficar Primeiro e antes de tudo, você terá de desativar o critical padrão do Tibia (Você pode pular essa parte se quiser) Vamos lá! Vá em items.cpp e procure por: attackSpeed = 0; Abaixo coloque: criticalHitChance = dodgeChance = lifeAbsorb = manaAbsorb = lifeLeech = manaLeech = 0; Depois, ainda em items.cpp, procure por: else if(tmpStrValue == "extradefense" || tmpStrValue == "extradef") { if(readXMLInteger(itemAttributesNode, "chance", intValue)) it.extraDefenseChance = intValue; if(readXMLInteger(itemAttributesNode, "value", intValue)) it.extraDefense = intValue; if(readXMLInteger(itemAttributesNode, "random_min", intValue)) it.extraDefenseRndMin = intValue; if(readXMLInteger(itemAttributesNode, "random_max", intValue)) it.extraDefenseRndMax = intValue; } Abaixo coloque: else if(tmpStrValue == "criticalhitchance") { if(readXMLInteger(itemAttributesNode, "value", intValue)) it.criticalHitChance = intValue; } else if(tmpStrValue == "dodgechance") { if(readXMLInteger(itemAttributesNode, "value", intValue)) it.dodgeChance = intValue; } else if(tmpStrValue == "lifeabsorb") { if(readXMLInteger(itemAttributesNode, "value", intValue)) it.lifeAbsorb = intValue; } else if(tmpStrValue == "manaabsorb") { if(readXMLInteger(itemAttributesNode, "value", intValue)) it.manaAbsorb = intValue; } else if(tmpStrValue == "lifeleech") { if(readXMLInteger(itemAttributesNode, "value", intValue)) it.lifeLeech = intValue; } else if(tmpStrValue == "manaleech") { if(readXMLInteger(itemAttributesNode, "value", intValue)) it.manaLeech = intValue; } Agora vá em items.h e procure por: int32_t attack, extraAttack, defense, extraDefense, armor, breakChance, hitChance, maxHitChance, runeLevel, runeMagLevel, lightLevel, lightColor, decayTo, rotateTo, alwaysOnTopOrder; Abaixo coloque: int32_t criticalHitChance, dodgeChance, lifeAbsorb, manaAbsorb, lifeLeech, manaLeech; Agora vá em item.cpp e procure por: case ATTR_ATTACK: { int32_t attack; if(!propStream.getLong((uint32_t&)attack)) return ATTR_READ_ERROR; setAttribute("attack", attack); break; } Acima coloque: case ATTR_CRITICALHITCHANCE: { int32_t criticalHitChance; if(!propStream.getLong((uint32_t&)criticalHitChance)) return ATTR_READ_ERROR; setAttribute("criticalhitchance", criticalHitChance); break; } case ATTR_DODGECHANCE: { int32_t dodgeChance; if(!propStream.getLong((uint32_t&)dodgeChance)) return ATTR_READ_ERROR; setAttribute("dodgechance", dodgeChance); break; } case ATTR_LIFEABSORB: { int32_t lifeAbsorb; if(!propStream.getLong((uint32_t&)lifeAbsorb)) return ATTR_READ_ERROR; setAttribute("lifeabsorb", lifeAbsorb); break; } case ATTR_MANAABSORB: { int32_t manaAbsorb; if(!propStream.getLong((uint32_t&)manaAbsorb)) return ATTR_READ_ERROR; setAttribute("manaabsorb", manaAbsorb); break; } case ATTR_LIFELEECH: { int32_t lifeLeech; if(!propStream.getLong((uint32_t&)lifeLeech)) return ATTR_READ_ERROR; setAttribute("lifeleech", lifeLeech); break; } case ATTR_MANALEECH: { int32_t manaLeech; if(!propStream.getLong((uint32_t&)manaLeech)) return ATTR_READ_ERROR; setAttribute("manaleech", manaLeech); break; } Procure por: if(it.weaponType == WEAPON_DIST && it.ammoType != AMMO_NONE) { begin = false; s << " (Range:" << int32_t(item ? item->getShootRange() : it.shootRange); if(it.attack || it.extraAttack || (item && (item->getAttack() || item->getExtraAttack()))) { s << ", Atk " << std::showpos << int32_t(item ? item->getAttack() : it.attack); if(it.extraAttack || (item && item->getExtraAttack())) s << " " << std::showpos << int32_t(item ? item->getExtraAttack() : it.extraAttack) << std::noshowpos; } if(it.hitChance != -1 || (item && item->getHitChance() != -1)) s << ", Hit% " << std::showpos << (item ? item->getHitChance() : it.hitChance) << std::noshowpos; } else if(it.weaponType != WEAPON_AMMO && it.weaponType != WEAPON_WAND) { if(it.attack || it.extraAttack || (item && (item->getAttack() || item->getExtraAttack()))) { begin = false; s << " (Atk:"; if(it.abilities.elementType != COMBAT_NONE && it.decayTo < 1) { s << std::max((int32_t)0, int32_t((item ? item->getAttack() : it.attack) - it.abilities.elementDamage)); if(it.extraAttack || (item && item->getExtraAttack())) s << " " << std::showpos << int32_t(item ? item->getExtraAttack() : it.extraAttack) << std::noshowpos; s << " physical + " << it.abilities.elementDamage << " " << getCombatName(it.abilities.elementType); } else { s << int32_t(item ? item->getAttack() : it.attack); if(it.extraAttack || (item && item->getExtraAttack())) s << " " << std::showpos << int32_t(item ? item->getExtraAttack() : it.extraAttack) << std::noshowpos; } } if(it.defense || it.extraDefense || (item && (item->getDefense() || item->getExtraDefense()))) { if(begin) { begin = false; s << " ("; } else s << ", "; s << "Def:" << int32_t(item ? item->getDefense() : it.defense); if(it.extraDefense || (item && item->getExtraDefense())) s << " " << std::showpos << int32_t(item ? item->getExtraDefense() : it.extraDefense) << std::noshowpos; } } Abaixo coloque: if(it.criticalHitChance || (item && item->getCriticalHitChance())) { if(begin) { begin = false; s << " ("; } else s << ", "; s << "Crit Chance:" << std::showpos << int32_t(item ? item->getCriticalHitChance() : it.criticalHitChance) << "%"<< std::noshowpos; } if(it.dodgeChance || (item && item->getDodgeChance())) { if(begin) { begin = false; s << " ("; } else s << ", "; s << "Dodge Chance:" << std::showpos << int32_t(item ? item->getDodgeChance() : it.dodgeChance) << "%"<< std::noshowpos; } if(it.lifeAbsorb || (item && item->getLifeAbsorb())) { if(begin) { begin = false; s << " ("; } else s << ", "; s << "Life Absorb:" << std::showpos << int32_t(item ? item->getLifeAbsorb() : it.lifeAbsorb) << "%"<< std::noshowpos; } if(it.manaAbsorb || (item && item->getManaAbsorb())) { if(begin) { begin = false; s << " ("; } else s << ", "; s << "Mana Absorb:" << std::showpos << int32_t(item ? item->getManaAbsorb() : it.manaAbsorb) << "%"<< std::noshowpos; } if(it.lifeLeech || (item && item->getLifeLeech())) { if(begin) { begin = false; s << " ("; } else s << ", "; s << "Life Leech:" << std::showpos << int32_t(item ? item->getLifeLeech() : it.lifeLeech) << "%"<< std::noshowpos; } if(it.manaLeech || (item && item->getManaLeech())) { if(begin) { begin = false; s << " ("; } else s << ", "; s << "Mana Leech:" << std::showpos << int32_t(item ? item->getManaLeech() : it.manaLeech) << "%"<< std::noshowpos; } Procure por: int32_t tmp = it.armor; if(item) tmp = item->getArmor(); bool begin = true; if(tmp) { s << " (Arm:" << tmp; begin = false; } Abaixo coloque: if(it.criticalHitChance || (item && item->getCriticalHitChance())) { if(begin) { begin = false; s << " ("; } else s << ", "; s << "Crit Chance:" << std::showpos << int32_t(item ? item->getCriticalHitChance() : it.criticalHitChance) << "%"<< std::noshowpos; } if(it.dodgeChance || (item && item->getDodgeChance())) { if(begin) { begin = false; s << " ("; } else s << ", "; s << "Dodge Chance:" << std::showpos << int32_t(item ? item->getDodgeChance() : it.dodgeChance) << "%"<< std::noshowpos; } if(it.lifeAbsorb || (item && item->getLifeAbsorb())) { if(begin) { begin = false; s << " ("; } else s << ", "; s << "Life Absorb:" << std::showpos << int32_t(item ? item->getLifeAbsorb() : it.lifeAbsorb) << "%"<< std::noshowpos; } if(it.manaAbsorb || (item && item->getManaAbsorb())) { if(begin) { begin = false; s << " ("; } else s << ", "; s << "Mana Absorb:" << std::showpos << int32_t(item ? item->getManaAbsorb() : it.manaAbsorb) << "%"<< std::noshowpos; } if(it.lifeLeech || (item && item->getLifeLeech())) { if(begin) { begin = false; s << " ("; } else s << ", "; s << "Life Leech:" << std::showpos << int32_t(item ? item->getLifeLeech() : it.lifeLeech) << "%"<< std::noshowpos; } if(it.manaLeech || (item && item->getManaLeech())) { if(begin) { begin = false; s << " ("; } else s << ", "; s << "Mana Leech:" << std::showpos << int32_t(item ? item->getManaLeech() : it.manaLeech) << "%"<< std::noshowpos; } Agora vá em item.h e procure por: ATTR_DUALWIELD = 43, Abaixo coloque: ATTR_CRITICALHITCHANCE = 44, ATTR_DODGECHANCE = 45, ATTR_LIFEABSORB = 46, ATTR_MANAABSORB = 47, ATTR_LIFELEECH = 48, ATTR_MANALEECH = 49, Procure por: int32_t getExtraDefense() const; Abaixo coloque: int32_t getCriticalHitChance() const; int32_t getDodgeChance() const; int32_t getLifeAbsorb() const; int32_t getManaAbsorb() const; int32_t getLifeLeech() const; int32_t getManaLeech() const; Procure por: inline int32_t Item::getExtraDefense() const { bool ok; int32_t v = getIntegerAttribute("extradefense", ok); if(ok) return v; return items[id].extraDefense; } Abaixo coloque: inline int32_t Item::getCriticalHitChance() const { bool ok; int32_t v = getIntegerAttribute("criticalhitchance", ok); if(ok) return v; return items[id].criticalHitChance; } inline int32_t Item::getDodgeChance() const { bool ok; int32_t v = getIntegerAttribute("dodgechance", ok); if(ok) return v; return items[id].dodgeChance; } inline int32_t Item::getLifeAbsorb() const { bool ok; int32_t v = getIntegerAttribute("lifeabsorb", ok); if(ok) return v; return items[id].lifeAbsorb; } inline int32_t Item::getManaAbsorb() const { bool ok; int32_t v = getIntegerAttribute("manaabsorb", ok); if(ok) return v; return items[id].manaAbsorb; } inline int32_t Item::getLifeLeech() const { bool ok; int32_t v = getIntegerAttribute("lifeleech", ok); if(ok) return v; return items[id].lifeLeech; } inline int32_t Item::getManaLeech() const { bool ok; int32_t v = getIntegerAttribute("manaleech", ok); if(ok) return v; return items[id].manaLeech; } Agora vá em player.cpp e procure por: int32_t Player::getArmor() const { int32_t i = SLOT_FIRST, armor = 0; for(; i < SLOT_LAST; ++i) { if(Item* item = getInventoryItem((slots_t)i)) armor += item->getArmor(); } if(vocation->getMultiplier(MULTIPLIER_ARMOR) != 1.0) return int32_t(armor * vocation->getMultiplier(MULTIPLIER_ARMOR)); return armor; } Abaixo coloque: int32_t Player::getCriticalHitChance() const { int32_t i = SLOT_FIRST, crit = 0; for(; i < SLOT_LAST; ++i) { if(Item* item = getInventoryItem((slots_t)i)) crit += item->getCriticalHitChance(); } return crit; } int32_t Player::getDodgeChance() const { int32_t i = SLOT_FIRST, dodge = 0; for(; i < SLOT_LAST; ++i) { if(Item* item = getInventoryItem((slots_t)i)) dodge += item->getDodgeChance(); } return dodge; } int32_t Player::getLifeAbsorb() const { int32_t i = SLOT_FIRST, life = 0; for(; i < SLOT_LAST; ++i) { if(Item* item = getInventoryItem((slots_t)i)) life += item->getLifeAbsorb(); } return life; } int32_t Player::getManaAbsorb() const { int32_t i = SLOT_FIRST, mana = 0; for(; i < SLOT_LAST; ++i) { if(Item* item = getInventoryItem((slots_t)i)) mana += item->getManaAbsorb(); } return mana; } int32_t Player::getLifeLeech() const { int32_t i = SLOT_FIRST, life = 0; for(; i < SLOT_LAST; ++i) { if(Item* item = getInventoryItem((slots_t)i)) life += item->getLifeLeech(); } return life; } int32_t Player::getManaLeech() const { int32_t i = SLOT_FIRST, mana = 0; for(; i < SLOT_LAST; ++i) { if(Item* item = getInventoryItem((slots_t)i)) mana += item->getManaLeech(); } return mana; } Agora vá em player.h e procure por: virtual int32_t getDefense() const; Abaixo coloque: virtual int32_t getCriticalHitChance() const; virtual int32_t getDodgeChance() const; virtual int32_t getLifeAbsorb() const; virtual int32_t getManaAbsorb() const; virtual int32_t getLifeLeech() const; virtual int32_t getManaLeech() const; Agora vá em luascript.cpp e procure por: //getCreatureHealth(cid) lua_register(m_luaState, "getCreatureHealth", LuaInterface::luaGetCreatureHealth); Abaixo coloque: //getPlayerCriticalHitChance(cid) lua_register(m_luaState, "getPlayerCriticalHitChance", LuaInterface::luaGetPlayerCriticalHitChance); //getPlayerDodgeChance(cid) lua_register(m_luaState, "getPlayerDodgeChance", LuaInterface::luaGetPlayerDodgeChance); //getPlayerLifeAbsorb(cid) lua_register(m_luaState, "getPlayerLifeAbsorb", LuaInterface::luaGetPlayerLifeAbsorb); //getPlayerManaAbsorb(cid) lua_register(m_luaState, "getPlayerManaAbsorb", LuaInterface::luaGetPlayerManaAbsorb); //getPlayerLifeLeech(cid) lua_register(m_luaState, "getPlayerLifeLeech", LuaInterface::luaGetPlayerLifeLeech); //getPlayerManaLeech(cid) lua_register(m_luaState, "getPlayerManaLeech", LuaInterface::luaGetPlayerManaLeech); Procure por: int32_t LuaInterface::luaGetCreatureMaxHealth(lua_State* L) { //getCreatureMaxHealth(cid[, ignoreModifiers = false]) bool ignoreModifiers = false; if(lua_gettop(L) > 1) ignoreModifiers = popBoolean(L); ScriptEnviroment* env = getEnv(); if(Creature* creature = env->getCreatureByUID(popNumber(L))) lua_pushnumber(L, creature->getPlayer() && ignoreModifiers ? creature->healthMax : creature->getMaxHealth()); else { errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND)); lua_pushboolean(L, false); } return 1; } Abaixo coloque: int32_t LuaInterface::luaGetPlayerCriticalHitChance(lua_State* L) { //getPlayerCriticalHitChance(cid) ScriptEnviroment* env = getEnv(); if(Player* player = env->getPlayerByUID(popNumber(L))) lua_pushnumber(L, player->getCriticalHitChance()); else { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); } return 1; } int32_t LuaInterface::luaGetPlayerDodgeChance(lua_State* L) { //getPlayerDodgeChance(cid) ScriptEnviroment* env = getEnv(); if(Player* player = env->getPlayerByUID(popNumber(L))) lua_pushnumber(L, player->getDodgeChance()); else { errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND)); lua_pushboolean(L, false); } return 1; } int32_t LuaInterface::luaGetPlayerLifeAbsorb(lua_State* L) { //getPlayerLifeAbsorb(cid) ScriptEnviroment* env = getEnv(); if(Player* player = env->getPlayerByUID(popNumber(L))) lua_pushnumber(L, player->getLifeAbsorb()); else { errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND)); lua_pushboolean(L, false); } return 1; } int32_t LuaInterface::luaGetPlayerManaAbsorb(lua_State* L) { //getPlayerManaAbsorb(cid) ScriptEnviroment* env = getEnv(); if(Player* player = env->getPlayerByUID(popNumber(L))) lua_pushnumber(L, player->getManaAbsorb()); else { errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND)); lua_pushboolean(L, false); } return 1; } int32_t LuaInterface::luaGetPlayerLifeLeech(lua_State* L) { //getPlayerLifeLeech(cid) ScriptEnviroment* env = getEnv(); if(Player* player = env->getPlayerByUID(popNumber(L))) lua_pushnumber(L, player->getLifeLeech()); else { errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND)); lua_pushboolean(L, false); } return 1; } int32_t LuaInterface::luaGetPlayerManaLeech(lua_State* L) { //getPlayerManaLeech(cid) ScriptEnviroment* env = getEnv(); if(Player* player = env->getPlayerByUID(popNumber(L))) lua_pushnumber(L, player->getManaLeech()); else { errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND)); lua_pushboolean(L, false); } return 1; } Agora vá em luascript.h e procure por: static int32_t luaGetPlayerSpentMana(lua_State* L); Abaixo coloque: static int32_t luaGetPlayerCriticalHitChance(lua_State* L); static int32_t luaGetPlayerDodgeChance(lua_State* L); static int32_t luaGetPlayerLifeAbsorb(lua_State* L); static int32_t luaGetPlayerManaAbsorb(lua_State* L); static int32_t luaGetPlayerLifeLeech(lua_State* L); static int32_t luaGetPlayerManaLeech(lua_State* L); As funções Lua adicionadas foram getPlayerCriticalHitChance(cid) getPlayerDodgeChance(cid) getPlayerLifeAbsorb(cid) getPlayerManaAbsorb(cid) getPlayerLifeLeech(cid) getPlayerManaLeech(cid) Agora a parte do game.cpp. (Esta é uma parte opcional, você pode optar por não adicioná-la) Créditos: ~Mathias Kenfi
  20. Melhor verificar se salvou os arquivos e se o channel Loot é o mesmo channel do config.lua <channel id="11" name="Loot" logged="yes" active="0" enable="0"/> Config.lua lootChannelId = 11
  21. [TESTADO EM OTX 2.x.x SERIES] 8.60 Primeiramente vá em game.cpp e procure por: bool Game::broadcastMessage(const std::string& text, MessageClasses type) { std::clog << "> Broadcasted message: \"" << text << "\"." << std::endl; for(AutoList<Player>::iterator it = Player::autoList.begin(); it != Player::autoList.end(); ++it) it->second->sendTextMessage(type, text); return true; } Abaixo adicione: bool Game::globalSendChannelMessage(std::string author, std::string text, MessageClasses type, uint16_t channel) { std::clog << "> Channel message: \"" << text << "\"." << std::endl; for(AutoList<Player>::iterator it = Player::autoList.begin(); it != Player::autoList.end(); ++it) it->second->sendChannelMessage(author, text, type, channel); return true; } Depois vá em game.h e procure por: bool broadcastMessage(const std::string& text, MessageClasses type); Abaixo adicione: bool globalSendChannelMessage(std::string author, std::string text, MessageClasses type, uint16_t channel); Agora vá em raids.cpp e procure por: bool AnnounceEvent::configureRaidEvent(xmlNodePtr eventNode) { if(!RaidEvent::configureRaidEvent(eventNode)) return false; std::string strValue; if(!readXMLString(eventNode, "message", strValue)) { std::clog << "[Error - AnnounceEvent::configureRaidEvent] Message tag missing for announce event." << std::endl; return false; } m_message = strValue; if(readXMLString(eventNode, "type", strValue)) { std::string tmpStrValue = asLowerCaseString(strValue); if(tmpStrValue == "warning") m_messageType = MSG_STATUS_WARNING; else if(tmpStrValue == "event") m_messageType = MSG_EVENT_ADVANCE; else if(tmpStrValue == "default") m_messageType = MSG_EVENT_DEFAULT; else if(tmpStrValue == "description") m_messageType = MSG_INFO_DESCR; else if(tmpStrValue == "status") m_messageType = MSG_STATUS_SMALL; else if(tmpStrValue == "blue") m_messageType = MSG_STATUS_CONSOLE_BLUE; else if(tmpStrValue == "red") m_messageType = MSG_STATUS_CONSOLE_RED; else std::clog << "[Notice - AnnounceEvent::configureRaidEvent] Unknown type tag for announce event, using default: " << (int32_t)m_messageType << std::endl; } else std::clog << "[Notice - AnnounceEvent::configureRaidEvent] Missing type tag for announce event. Using default: " << (int32_t)m_messageType << std::endl; return true; } Altere para: bool AnnounceEvent::configureRaidEvent(xmlNodePtr eventNode) { if(!RaidEvent::configureRaidEvent(eventNode)) return false; std::string strName; if(!readXMLString(eventNode, "name", strName)) { std::clog << "[Error - AnnounceEvent::configureRaidEvent] Name tag missing for announce event." << std::endl; return false; } m_messageAuthor = strName; std::string strValue; if(!readXMLString(eventNode, "message", strValue)) { std::clog << "[Error - AnnounceEvent::configureRaidEvent] Message tag missing for announce event." << std::endl; return false; } m_message = strValue; if(readXMLString(eventNode, "type", strValue)) { std::string tmpStrValue = asLowerCaseString(strValue); if(tmpStrValue == "warning") m_messageType = MSG_STATUS_WARNING; else if(tmpStrValue == "event") m_messageType = MSG_EVENT_ADVANCE; else if(tmpStrValue == "default") m_messageType = MSG_EVENT_DEFAULT; else if(tmpStrValue == "description") m_messageType = MSG_INFO_DESCR; else if(tmpStrValue == "status") m_messageType = MSG_STATUS_SMALL; else if(tmpStrValue == "blue") m_messageType = MSG_STATUS_CONSOLE_BLUE; else if(tmpStrValue == "red") m_messageType = MSG_STATUS_CONSOLE_RED; else if(tmpStrValue == "channel") m_messageType = MSG_CHANNEL; else if(tmpStrValue == "channel-management") m_messageType = MSG_CHANNEL_MANAGEMENT; else if(tmpStrValue == "channel-highlight") m_messageType = MSG_CHANNEL_HIGHLIGHT; else if(tmpStrValue == "channel-gamemaster") m_messageType = MSG_GAMEMASTER_CHANNEL; else std::clog << "[Notice - AnnounceEvent::configureRaidEvent] Unknown type tag for announce event, using default: " << (int32_t)m_messageType << std::endl; } else std::clog << "[Notice - AnnounceEvent::configureRaidEvent] Missing type tag for announce event. Using default: " << (int32_t)m_messageType << std::endl; return true; } Logo abaixo você verá: bool AnnounceEvent::executeEvent(const std::string&) const { g_game.broadcastMessage(m_message, m_messageType); return true; } Substitua por: bool AnnounceEvent::executeEvent(const std::string&) const { if(m_messageType == MSG_CHANNEL_HIGHLIGHT || m_messageType == MSG_CHANNEL || m_messageType == MSG_CHANNEL_MANAGEMENT || m_messageType == MSG_GAMEMASTER_CHANNEL) g_game.globalSendChannelMessage(m_messageAuthor, m_message, (MessageClasses)m_messageType, 12); else g_game.broadcastMessage(m_message, m_messageType); return true; } Agora em raids.h procure por: class AnnounceEvent : public RaidEvent { public: AnnounceEvent(Raid* raid, bool ref): RaidEvent(raid, ref), m_messageType(MSG_EVENT_ADVANCE) {} virtual ~AnnounceEvent() {} virtual bool configureRaidEvent(xmlNodePtr eventNode); virtual bool executeEvent(const std::string& name) const; private: std::string m_message; MessageClasses m_messageType; }; Substitua por: class AnnounceEvent : public RaidEvent { public: AnnounceEvent(Raid* raid, bool ref): RaidEvent(raid, ref), m_messageType(MSG_EVENT_ADVANCE) {} virtual ~AnnounceEvent() {} virtual bool configureRaidEvent(xmlNodePtr eventNode); virtual bool executeEvent(const std::string& name) const; private: std::string m_messageAuthor; std::string m_message; MessageClasses m_messageType; }; Agora em data/XML/channels.xml crie um novo canal de ID 12 para seu Raids channel: <channel id="12" name="Raids" logged="yes" active="0" enable="0"/> Agora sempre que você for criar um raids de anuncio deve colocar as tags como mostrado abaixo: <announce delay="1000" name="Tower" type="channel" message="Mensagem" /> Você pode optar por 4 tipo de mensagens em channel: type="channel" <!-- cor padrão --> type="channel-highlight" <!-- cor laranja escuro --> type="channel-management" <!-- cor branca --> type="channel-gamemaster" <!-- cor vermelha --> Além de que pode optar por utilizar o broadcastMessage apenas definindo as cores padrão do mesmo: type="warning" <!-- msg aviso --> type="event" <!-- msg branca/advance --> type="default" type="description" <!-- msg verde --> type="status" <!-- msg small --> type="blue" <!-- msg azul --> type="red" <!-- msg red -->
  22. Ackerzin começou a seguir Mathias Kenfi
  23. Mateus Robeerto começou a seguir Mathias Kenfi
  24. [TESTADO EM OTX 2.1+] 8.60 [TESTADO EM TFS 0.3.6] 8.54 ~ 8.60 Créditos: ~Mathias Kenfi

Informação Importante

Confirmação de Termo