Ir para conteúdo
  • Cadastre-se

joaovitorbk9

Membro
  • Total de itens

    145
  • Registro em

  • Última visita

  • Dias Ganhos

    1

Posts postados por joaovitorbk9

  1. SaLve galera do tibia king, estou tentando compilar a tfs 0.4 que o Yanliima disponibilizou aqui no tk, porém obtive esse erro

    estou usando linux 14.04

    segui todos os passos direitinho na hora da instalação de libs etc..

    alguem pode me dar uma luz??? valendo rp++
     

    Spoiler
    
    -Wall -Wextra -Wno-strict-aliasing -Wno-parentheses -Wno-unused-parameter -Werror=sign-compare -Wno-unused-but-set-variable -Wno-array-bounds -pthread -pipe -MT protocolhttp.o -MD -MP -MF .deps/protocolhttp.Tpo -c -o protocolhttp.o protocolhttp.cpp
    protocolgame.cpp:2258:6: error: prototype for 'void ProtocolGame::sendDistanceShoot(const Position&, const Position&, uint8_t)' does not match any in class 'ProtocolGame'
     void ProtocolGame::sendDistanceShoot(const Position& from, const Position& to, uint8_t type)
          ^
    In file included from protocolgame.cpp:21:0:
    protocolgame.h:204:8: error: candidate is: void ProtocolGame::sendDistanceShoot(const Position&, const Position&, uint16_t)
       void sendDistanceShoot(const Position& from, const Position& to, uint16_t type);
            ^
    protocolgame.cpp:2271:6: error: prototype for 'void ProtocolGame::sendMagicEffect(const Position&, uint8_t)' does not match any in class 'ProtocolGame'
     void ProtocolGame::sendMagicEffect(const Position& pos, uint8_t type)
          ^
    In file included from protocolgame.cpp:21:0:
    protocolgame.h:205:8: error: candidate is: void ProtocolGame::sendMagicEffect(const Position&, uint16_t)
       void sendMagicEffect(const Position& pos, uint16_t type);
            ^
    protocolgame.cpp:2871:6: error: prototype for 'void ProtocolGame::AddMagicEffect(NetworkMessage_ptr, const Position&, uint8_t)' does not match any in class 'ProtocolGame'
     void ProtocolGame::AddMagicEffect(NetworkMessage_ptr msg,const Position& pos, uint8_t type)
          ^
    In file included from protocolgame.cpp:21:0:
    protocolgame.h:294:8: error: candidate is: void ProtocolGame::AddMagicEffect(NetworkMessage_ptr, const Position&, uint16_t)
       void AddMagicEffect(NetworkMessage_ptr msg, const Position& pos, uint16_t type);
            ^
    protocolgame.cpp:2878:6: error: prototype for 'void ProtocolGame::AddDistanceShoot(NetworkMessage_ptr, const Position&, const Position&, uint8_t)' does not match any in class 'ProtocolGame'
     void ProtocolGame::AddDistanceShoot(NetworkMessage_ptr msg, const Position& from, const Position& to,
          ^
    In file included from protocolgame.cpp:21:0:
    protocolgame.h:295:8: error: candidate is: void ProtocolGame::AddDistanceShoot(NetworkMessage_ptr, const Position&, const Position&, uint16_t)
       void AddDistanceShoot(NetworkMessage_ptr msg, const Position& from, const Position& to, uint16_t type);
            ^
    make[1]: *** [protocolgame.o] Error 1
    make[1]: *** Waiting for unfinished jobs....
    mv -f .deps/protocolhttp.Tpo .deps/protocolhttp.Po
    make[1]: Leaving directory `/root/otserv/trunk'
    make: *** [all] Error 2

     

     

    protocolgame.cpp e protocolgame.h

    protocolgame.cpp protocolgame.h

  2. Galera, estou com o seguinte erro ao tentar compilar no ubutun 14.04... estou usando tfs 0.4 como disse no titulo.

     

    segue o erro que me retorna ao dar ./build.sh...

     

    pleaseee alguem me da uma luz!!

     

    Spoiler
    
    root@server:~/ntosv/src# g++: internal compiler error: Killed (program cc1plus)
    -su: syntax error near unexpected token `('
    root@server:~/ntosv/src# Please submit a full bug report,
    -su: Please: command not found
    root@server:~/ntosv/src# with preprocessed source if appropriate.
    -su: with: command not found
    root@server:~/ntosv/src# See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.-su: file:///usr/share/doc/gcc-4.8/README.Bugs: No such file or directory
    root@server:~/ntosv/src# make[1]: *** [creature.o] Error 4
    -su: make[1]:: command not found
    root@server:~/ntosv/src# g++: internal compiler error: Killed (program cc1plus)
    -su: syntax error near unexpected token `('
    root@server:~/ntosv/src# Please submit a full bug report,
    -su: Please: command not found
    root@server:~/ntosv/src# with preprocessed source if appropriate.
    -su: with: command not found
    root@server:~/ntosv/src# See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.-su: file:///usr/share/doc/gcc-4.8/README.Bugs: No such file or directory
    root@server:~/ntosv/src# make[1]: *** [chat.o] Error 4
    -su: make[1]:: command not found
    root@server:~/ntosv/src# g++: internal compiler error: Killed (program cc1plus)
    -su: syntax error near unexpected token `('
    root@server:~/ntosv/src# Please submit a full bug report,
    -su: Please: command not found
    root@server:~/ntosv/src# with preprocessed source if appropriate.
    -su: with: command not found
    root@server:~/ntosv/src# See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.-su: file:///usr/share/doc/gcc-4.8/README.Bugs: No such file or directory
    root@server:~/ntosv/src# make[1]: *** [depot.o] Error 4
    -su: make[1]:: command not found
    root@server:~/ntosv/src# mv -f .deps/database.Tpo .deps/database.Po
    mv: cannot stat '.deps/database.Tpo': No such file or directory
    root@server:~/ntosv/src# mv -f .deps/cylinder.Tpo .deps/cylinder.Po
    mv: cannot stat '.deps/cylinder.Tpo': No such file or directory
    root@server:~/ntosv/src# mv -f .deps/databasemanager.Tpo .deps/databasemanager.Po
    mv: cannot stat '.deps/databasemanager.Tpo': No such file or directory
    root@server:~/ntosv/src# mv -f .deps/databasemysql.Tpo .deps/databasemysql.Po
    mv: cannot stat '.deps/databasemysql.Tpo': No such file or directory
    root@server:~/ntosv/src# make[1]: Leaving directory `/root/ntosv/src'
    > make: *** [all] Error 2
    >

     

     

  3. Salve salve galera, estou tentando compilar meu servidor tfs 0.4 em linux ubutun 14.02 mas estou com alguns erros apos dar /build.sh

    Erros:

    Citar
    
    root@server:~/ntosv/src# g++: internal compiler error: Killed (program cc1plus)
    -su: syntax error near unexpected token `('
    root@server:~/ntosv/src# Please submit a full bug report,
    -su: Please: command not found
    root@server:~/ntosv/src# with preprocessed source if appropriate.
    -su: with: command not found
    root@server:~/ntosv/src# See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.-su: file:///usr/share/doc/gcc-4.8/README.Bugs: No such file or directory
    root@server:~/ntosv/src# make[1]: *** [creature.o] Error 4
    -su: make[1]:: command not found
    root@server:~/ntosv/src# g++: internal compiler error: Killed (program cc1plus)
    -su: syntax error near unexpected token `('
    root@server:~/ntosv/src# Please submit a full bug report,
    -su: Please: command not found
    root@server:~/ntosv/src# with preprocessed source if appropriate.
    -su: with: command not found
    root@server:~/ntosv/src# See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.-su: file:///usr/share/doc/gcc-4.8/README.Bugs: No such file or directory
    root@server:~/ntosv/src# make[1]: *** [chat.o] Error 4
    -su: make[1]:: command not found
    root@server:~/ntosv/src# g++: internal compiler error: Killed (program cc1plus)
    -su: syntax error near unexpected token `('
    root@server:~/ntosv/src# Please submit a full bug report,
    -su: Please: command not found
    root@server:~/ntosv/src# with preprocessed source if appropriate.
    -su: with: command not found
    root@server:~/ntosv/src# See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.-su: file:///usr/share/doc/gcc-4.8/README.Bugs: No such file or directory
    root@server:~/ntosv/src# make[1]: *** [depot.o] Error 4
    -su: make[1]:: command not found
    root@server:~/ntosv/src# mv -f .deps/database.Tpo .deps/database.Po
    mv: cannot stat '.deps/database.Tpo': No such file or directory
    root@server:~/ntosv/src# mv -f .deps/cylinder.Tpo .deps/cylinder.Po
    mv: cannot stat '.deps/cylinder.Tpo': No such file or directory
    root@server:~/ntosv/src# mv -f .deps/databasemanager.Tpo .deps/databasemanager.Po
    mv: cannot stat '.deps/databasemanager.Tpo': No such file or directory
    root@server:~/ntosv/src# mv -f .deps/databasemysql.Tpo .deps/databasemysql.Po
    mv: cannot stat '.deps/databasemysql.Tpo': No such file or directory
    root@server:~/ntosv/src# make[1]: Leaving directory `/root/ntosv/src'
    > make: *** [all] Error 2
    >

     

     

    alguem ja passou por isso ou pode dar uma luzz ??? obrigado desde ja

     

  4. Em 01/10/2020 em 17:49, Kevin Araujo disse:

    Salve galerinha, vim pedir ajuda de vocês, pois estou com um problema ao criar guilds, quem conseguir me ajudar a resolver essa questão, darei REP+++

     

    OBS: Uso My Aac

     

    image.thumb.png.f6e176b303d38af4918fa4e1d877ff8c.png

     

    cheque essas linhas notificadas no log, e procure a data base em que ela está registrando esses dados.

    ai checa seu banco de dados no phpmyadmin e veja se elas estao criadas

  5. 8 horas atrás, ashwese1 disse:

    @Jeff Delay vlw

    @joaovitorbk9 n sei criar spells senhor, de acordo com o id do obj, me ajude por favor)   essa pasta lib de formataçao de spells n existeoq eu faço??

    de acordo com a ide do obj??
    você quer dizer de acordo com a Sprite?

    -----

    Primeiro de uma estudada em como você cria spells, tenta entender a formula.

    Pq você vai precisar de uma base de conhecimento para editar e fazer a manutenção do seu servidor.

     

    ----

     

    Sugiro que ou você procure essa lib que você precisa para essa spell , Isso vai depender de que tipo de spell vc quer para esse nivel, e procurar aqui no forum.

    Ou caso voce detalhe aqui, posso te aulixiar na criação dessa magias que faltam.

    Mas preciso saber como elas precisam funcionar

  6. Em 29/09/2020 em 18:46, ashwese1 disse:

    .Qual servidor ou website você utiliza como base? 

     

    Qual o motivo deste tópico? 

     

    Está surgindo algum erro? Se sim coloque-o aqui. 

     

    Você tem o código disponível? Se tiver publique-o aqui: 

    
    
     

     

    Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 

     

    Screenshot_8.png

    Screenshot_7.png

    o primeiro erro do OBITO, ta faltando uma lib. que seria a formatação da spell

    olha na pasta que ele ta indicando ai no log

    data/spells/scripts/kabuto/ETC***
    data/spells/scripts/nagato/ETC***

    data/spells/scripts/chouji/ETC***

    ele está dizendo que nao tem esses arquivos....

    e também a voc 674 nao foi encontrada, o que vc pode fazer eh ou remover tudo isso e criar depois (para se livrar desses bugs, ou já criar essas spells faltado e essa voc tbm

     

     

  7. 29 minutos atrás, Kramer disse:

    Qual a versão da sua distro ?

    0,4

    @EDIT

    Salve galera, consegui resolver soozinho.
    Para quem tiver o mesmo problema faça o seguinte....


    1) mude para 'db.query' no lugar de db.executeQuery
    2) exclua seu z_ots_comutication e execute isso no Sql


     

    E Na Sua DATABABE exclua sua tabela z_ots_comunication
    
     
    
    e adicione esta
    -- phpMyAdmin SQL Dump
    -- version 4.2.11
    -- http://www.phpmyadmin.net
    --
    -- Host: 127.0.0.1
    -- Generation Time: 08-Jan-2015 às 02:48
    -- Versão do servidor: 5.6.21
    -- PHP Version: 5.5.19
    
    SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
    SET time_zone = "+00:00";
    
    
    /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
    /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
    /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
    /*!40101 SET NAMES utf8 */;
    
    --
    -- Database: `global`
    --
    
    -- --------------------------------------------------------
    
    --
    -- Estrutura da tabela `z_ots_comunication`
    --
    
    CREATE TABLE IF NOT EXISTS `z_ots_comunication` (
    `id` int(11) NOT NULL,
      `name` varchar(255) NOT NULL,
      `type` varchar(255) NOT NULL,
      `action` varchar(255) NOT NULL,
      `param1` varchar(255) NOT NULL,
      `param2` varchar(255) NOT NULL,
      `param3` varchar(255) NOT NULL,
      `param4` varchar(255) NOT NULL,
      `param5` varchar(255) NOT NULL,
      `param6` varchar(255) NOT NULL,
      `param7` varchar(255) NOT NULL,
      `delete_it` int(2) NOT NULL DEFAULT '1'
    ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
    
    --
    -- Indexes for dumped tables
    --
    
    --
    -- Indexes for table `z_ots_comunication`
    --
    ALTER TABLE `z_ots_comunication`
     ADD PRIMARY KEY (`id`);
    
    --
    -- AUTO_INCREMENT for dumped tables
    --
    
    --
    -- AUTO_INCREMENT for table `z_ots_comunication`
    --
    ALTER TABLE `z_ots_comunication`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
    /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
    /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
    /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
     



     

  8. Olá amigos do TK, estou com um problema no shop do meu Gesior...

    Quando coompro um item no site, fico recebendo ele infinitamente...

     

    Tenho esse erro no log

    Spoiler

    image.thumb.png.94f629598094f03bcf0d38049099cf7f.png

     

    No jogo:

    Spoiler

    image.png

     

    seguindo o rastro do erro, ele se encontra na Line 56:

    db.Query("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")


     


    antes estava 'db.executeQuery'..... garimpando uma solução nos forum, varios comentários diziam para por 'db.query', porém continua a mesma coisa....

     

    meu Shop.Lua

    Spoiler
    
    -- ### CONFIG ###
    -- message send to player by script "type" (types you can check in "global.lua")
    SHOP_MSG_TYPE = 19
    -- time (in seconds) between connections to SQL database by shop script
    SQL_interval = 30
    -- ### END OF CONFIG ###
    function onThink(interval, lastExecution)
    local result_plr = db.getResult("SELECT * FROM z_ots_comunication WHERE `type` = 'login';")
    if(result_plr:getID() ~= -1) then
    while(true) do
    id = tonumber(result_plr:getDataInt("id"))
    action = tostring(result_plr:getDataString("action"))
    delete = tonumber(result_plr:getDataInt("delete_it"))
    cid = getCreatureByName(tostring(result_plr:getDataString("name")))
    if isPlayer(cid) == TRUE then
    local itemtogive_id = tonumber(result_plr:getDataInt("param1"))
    local itemtogive_count = tonumber(result_plr:getDataInt("param2"))
    local container_id = tonumber(result_plr:getDataInt("param3"))
    local container_count = tonumber(result_plr:getDataInt("param4"))
    local add_item_type = tostring(result_plr:getDataString("param5"))
    local add_item_name = tostring(result_plr:getDataString("param6"))
    local received_item = 0
    local full_weight = 0
    if add_item_type == 'container' then
    container_weight = getItemWeightById(container_id, 1)
    if isItemRune(itemtogive_id) == TRUE then
    items_weight = container_count * getItemWeightById(itemtogive_id, 1)
    else
    items_weight = container_count * getItemWeightById(itemtogive_id, itemtogive_count)
    end
    full_weight = items_weight + container_weight
    else
    full_weight = getItemWeightById(itemtogive_id, itemtogive_count)
    if isItemRune(itemtogive_id) == TRUE then
    full_weight = getItemWeightById(itemtogive_id, 1)
    else
    full_weight = getItemWeightById(itemtogive_id, itemtogive_count)
    end
    end
    local free_cap = getPlayerFreeCap(cid)
    if full_weight <= free_cap then
    if add_item_type == 'container' then
    local new_container = doCreateItemEx(container_id, 1)
    local iter = 0
    while iter ~= container_count do
    doAddContainerItem(new_container, itemtogive_id, itemtogive_count)
    iter = iter + 1
    end
    received_item = doPlayerAddItemEx(cid, new_container)
    else
    local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
    received_item = doPlayerAddItemEx(cid, new_item)
    end
    if received_item == RETURNVALUE_NOERROR then
    doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received >> '.. add_item_name ..' << from OTS shop.')
    db.Query("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
    db.Query("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";")
    else
    doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. Please make place for this item in your backpack/hands and wait about '.. SQL_interval ..' seconds to get it.')
    end
    else
    doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. It weight is '.. full_weight ..' oz., you have only '.. free_cap ..' oz. free capacity. Put some items in depot and wait about '.. SQL_interval ..' seconds to get it.')
    end
    end
    if not(result_plr:next()) then
    break
    end
    end
    result_plr:free()
    end
    return TRUE
    end 

     

     

    PRINT** Database z_comunication

    Spoiler

    image.png

     

     

    5 rep+ pra quem me ajudar!!! fé!!

     

     

     

     

  9. @bump

    Em 01/08/2020 em 23:22, Celulose disse:

    @joaovitorbk9 

     

    
    function onSay(cid, words, param, channel)
    
    
    	local guild = getPlayerGuildId(cid)
    	if(not guild or getPlayerGuildLevel(cid) < GUILDLEVEL_LEADER) then
    		doPlayerSendChannelMessage(cid, "", "You cannot execute this talkaction.", TALKTYPE_CHANNEL_HIGHLIGHT, CHANNEL_GUILD)
    		return true
    	end
    
    	local t = string.explode(param, ",")
    	if(not t[2]) then
    		doPlayerSendChannelMessage(cid, "", "Not enough param(s).", TALKTYPE_CHANNEL_HIGHLIGHT, CHANNEL_GUILD)
    		return true
    	end
    
    	local enemy = getGuildId(t[2])
    	if(not enemy) then
    		doPlayerSendChannelMessage(cid, "", "Guild \"" .. t[2] .. "\" does not exists.", TALKTYPE_CHANNEL_HIGHLIGHT, CHANNEL_GUILD)
    		return true
    	end
    
    	if(enemy == guild) then
    		doPlayerSendChannelMessage(cid, "", "You cannot perform war action on your own guild.", TALKTYPE_CHANNEL_HIGHLIGHT, CHANNEL_GUILD)
    		return true
    	end
    
    	local enemyName, tmp = "", db.getResult("SELECT `name` FROM `guilds` WHERE `id` = " .. enemy)
    	if(tmp:getID() ~= -1) then
    		enemyName = tmp:getDataString("name")
    		tmp:free()
    	end
    
    	if(isInArray({"accept", "reject", "cancel"}, t[1])) then
    		local query = "`guild_id` = " .. enemy .. " AND `enemy_id` = " .. guild
    		if(t[1] == "cancel") then
    			query = "`guild_id` = " .. guild .. " AND `enemy_id` = " .. enemy
    		end
    
    		tmp = db.getResult("SELECT `id`, `begin`, `end`, `payment` FROM `guild_wars` WHERE " .. query .. " AND `status` = 0")
    		if(tmp:getID() == -1) then
    			doPlayerSendChannelMessage(cid, "", "Currently there's no pending invitation for a war with " .. enemyName .. ".", TALKTYPE_CHANNEL_HIGHLIGHT, CHANNEL_GUILD)
    			return true
    		end
    
    		if(t[1] == "accept") then
    			local _tmp = db.getResult("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild)
    			local state = _tmp:getID() < 0 or _tmp:getDataInt("balance") < tmp:getDataInt("payment")
    
    			_tmp:free()
    			if(state) then
    				doPlayerSendChannelMessage(cid, "", "Your guild balance is too low to accept this invitation.", TALKTYPE_CHANNEL_HIGHLIGHT, CHANNEL_GUILD)
    				return true
    			end
    
    			db.executeQuery("UPDATE `guilds` SET `balance` = `balance` - " .. tmp:getDataInt("payment") .. " WHERE `id` = " .. guild)
    		end
    
    		query = "UPDATE `guild_wars` SET "
    		local msg = "accepted " .. enemyName .. " invitation to war."
    		if(t[1] == "reject") then
    			query = query .. "`end` = " .. os.time() .. ", `status` = 2"
    			msg = "rejected " .. enemyName .. " invitation to war."
    		elseif(t[1] == "cancel") then
    			query = query .. "`end` = " .. os.time() .. ", `status` = 3"
    			msg = "canceled invitation to a war with " .. enemyName .. "."
    		else
    			query = query .. "`begin` = " .. os.time() .. ", `end` = " .. (tmp:getDataInt("end") > 0 and (os.time() + ((tmp:getDataInt("begin") - tmp:getDataInt("end")) / 86400)) or 0) .. ", `status` = 1"
    		end
    
    		query = query .. " WHERE `id` = " .. tmp:getDataInt("id")
    		if(t[1] == "accept") then
    			doGuildAddEnemy(guild, enemy, tmp:getDataInt("id"), WAR_GUILD)
    			doGuildAddEnemy(enemy, guild, tmp:getDataInt("id"), WAR_ENEMY)
    		end
    
    		tmp:free()
    		db.executeQuery(query)
    		doBroadcastMessage(getPlayerGuildName(cid) .. " has " .. msg, MESSAGE_EVENT_ADVANCE)
    		return true
    	end
    
    	if(t[1] == "invite") then
    		local str = ""
                    tmp = db.getResult("SELECT `guild_id`, `status` FROM `guild_wars` WHERE `guild_id` IN (" .. guild .. "," .. enemy .. ") AND `enemy_id` IN (" .. enemy .. "," .. guild .. ") AND `status` IN (0, 1)")
                    if(tmp:getID() ~= -1) then
                            if(tmp:getDataInt("status") == 0) then
                                    if(tmp:getDataInt("guild_id") == guild) then
                                            str = "You have already invited " .. enemyName .. " to war."
                                    else
                                            str = enemyName .. " have already invited you to war."
                                    end
    			else
    				str = "You are already on a war with " .. enemyName .. "."
    			end
    
    			tmp:free()
    		end
    
    		if(str ~= "") then
    			doPlayerSendChannelMessage(cid, "", str, TALKTYPE_CHANNEL_HIGHLIGHT, CHANNEL_GUILD)
    			return true
    		end
    
    		local frags = tonumber(t[3])
    		if(frags ~= nil) then
    			frags = math.max(10, math.min(1000, frags))
    		else
    			frags = 100
    		end
    
    		local payment = tonumber(t[4])
    		if(payment ~= nil) then
    			payment = math.max(100000, math.min(1000000000, payment))
    			tmp = db.getResult("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild)
    
    			local state = tmp:getID() < 0 or tmp:getDataInt("balance") < payment
    			tmp:free()
    			if(state) then
    				doPlayerSendChannelMessage(cid, "", "Your guild balance is too low for such payment.", TALKTYPE_CHANNEL_HIGHLIGHT, CHANNEL_GUILD)
    				return true
    			end
    
    			db.executeQuery("UPDATE `guilds` SET `balance` = `balance` - " .. payment .. " WHERE `id` = " .. guild)
    		else
    			payment = 0
    		end
    
    		local begining, ending = os.time(), tonumber(t[5])
    		if(ending ~= nil and ending ~= 0) then
    			ending = begining + (ending * 86400)
    		else
    			ending = 0
    		end
    
    		db.executeQuery("INSERT INTO `guild_wars` (`guild_id`, `enemy_id`, `begin`, `end`, `frags`, `payment`) VALUES (" .. guild .. ", " .. enemy .. ", " .. begining .. ", " .. ending .. ", " .. frags .. ", " .. payment .. ");")
    		doBroadcastMessage(getPlayerGuildName(cid) .. " has invited " .. enemyName .. " to war till " .. frags .. " frags.", MESSAGE_EVENT_ADVANCE)
    		return true
    	end
    
    	if(not isInArray({"end", "finish"}, t[1])) then
    		return false
    	end
    
    	local status = (t[1] == "end" and 1 or 4)
    	tmp = db.getResult("SELECT `id` FROM `guild_wars` WHERE `guild_id` = " .. guild .. " AND `enemy_id` = " .. enemy .. " AND `status` = " .. status)
    	if(tmp:getID() ~= -1) then
    		local query = "UPDATE `guild_wars` SET `end` = " .. os.time() .. ", `status` = 5 WHERE `id` = " .. tmp:getDataInt("id")
    		tmp:free()
    		doGuildRemoveEnemy(guild, enemy)
    		doGuildRemoveEnemy(enemy, guild)
    
    		db.executeQuery(query)
    		doBroadcastMessage(getPlayerGuildName(cid) .. " has " .. (status == 4 and "mend fences" or "ended up a war") .. " with " .. enemyName .. ".", MESSAGE_EVENT_ADVANCE)
    		return true
    	end
    
    	if(status == 4) then
    		doPlayerSendChannelMessage(cid, "", "Currently there's no pending war truce from " .. enemyName .. ".", TALKTYPE_CHANNEL_HIGHLIGHT, CHANNEL_GUILD)
    		return true
    	end
    
    	tmp = db.getResult("SELECT `id`, `end` FROM `guild_wars` WHERE `guild_id` = " .. enemy .. " AND `enemy_id` = " .. guild .. " AND `status` = 1")
    	if(tmp:getID() ~= -1) then
    		if(tmp:getDataInt("end") > 0) then
    			tmp:free()
    			doPlayerSendChannelMessage(cid, "", "You cannot request ending for war with " .. enemyName .. ".", TALKTYPE_CHANNEL_HIGHLIGHT, CHANNEL_GUILD)
    			return true
    		end
    
    		local query = "UPDATE `guild_wars` SET `status` = 4, `end` = " .. os.time() .. " WHERE `id` = " .. tmp:getDataInt("id")
    		tmp:free()
    
    		db.executeQuery(query)
    		doBroadcastMessage(getPlayerGuildName(cid) .. " has signed an armstice declaration on a war with " .. enemyName .. ".", MESSAGE_EVENT_ADVANCE)
    		return true
    	end
    
    	doPlayerSendChannelMessage(cid, "", "Currently there's no active war with " .. enemyName .. ".", TALKTYPE_CHANNEL_HIGHLIGHT, CHANNEL_GUILD)
    	return true
    end

     

    troquei por esse e nao funcionou tbm

  10. 6 minutos atrás, LeoTK disse:

    @joaovitorbk9 se fosse o caso seria melhor utilizar uma storage pra cada transformação tipo

     

    Transformação 1 de todas as voc é storage 1000, 1

    Transformação 2 de todas as voc é storage 1000, 2


    Tem também a expressão de fazer
     

    
    local storage = 1000
    
    if getPlayerStorageValue(cid, storage) <= 0 then
    
    setPlayerStorageValue(cid, storage, +1) --OBS: talvez essa expressão esteja errada
    setPlayerStorageValue(cid, storage) +1 -- ou
    end

    esse é apenas um exemplo

     

    Depois disso na formula você faz assim

     

    
    local storage = 1000
    local stor = getPlayerStorageValue(cid, storage)
    
    function onGetFormulaValues(cid, level, maglevel)
    min = -(level * 7.28 + maglevel * 7.48 + stor * 1.5) * 7.4
    max = -(level * 8.34 + maglevel * 8.34 + stor * 1.5) * 8.4
    return min, max
    end
    setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues"

    Não testei mas seria algo tipo assim

    uau, isso seria otimo, vou por em pratica e volto para avisar se funcionou

  11. 1 hora atrás, Mor3nao disse:

    isso é muito simples kk nao deve ter prestado atenção

    tem o dano min e max, se o player tem lvl 22 e ml 30, o dano minimo é:

    min = -(level * 7.28 + maglevel * 7.48) * 7.4 = -(22 * 7.28 + 30* 7.48) * 7.4 = -(160.16+224.4)*7.4 = - (384.56)*7.4 = -2845,7 = -2846

     

    e o dano max é :

    max = -(level * 8.34 + maglevel * 8.34) * 8.4 = -(22*8.34 + 30*8.34)*8.4 = -(183.48 + 250.2)*8.4 = -(433.68)*8.4 = -3642,912 = -3643

     

    Então a média de dano desse player com essa magia vai ser (-2846-3643)/2 = 6489/2 = 3244

     

    Basicamente, o level*8.34 significa que a cada lvl q vc tiver, vc aumenta o dano em 8,34.

    e o maglevel*7.48 significa que pra cada 1 de ml q vc iver vai aumentar o dano em 7.48

     

    Mas, se vc quer balancear, muda o *7.4 e o *8.4 do final, aument se vc quer mais dano, e diminui se quer menos xD

     

    @joaovitorbk9  Esse negocio do magmultiplier, multiplica TODO dano vindo de magias tudo tudo, nao é bom mexer por lá nao, fica mais facil de vc padroniazr pela propria spell

    Salve manin, obg pela explicacao...  é que tenho um servidor derivado e queria valorizar as trasnformações dando aumento de dano. então meio que será necessário aumentar 0.1, até 0.2 nesses atributos da promote porque serão como upgrades de dano/defesa

  12. 18 horas atrás, LeoTK disse:

    min = -(level * 7.28 + maglevel * 7.48) * 7.4

    level * 7.28 + magic level * 7.48 * 7.4

     

    Se level é igual a 100 e magic level igual a 100 fica

    100 * 7.28 = 728

    100 * 7.48 = 748

    Igual a 1476 * 7.4 = 10.922

    esse seria o dano minimo se o valor de level e magic level fossem 100

    oIa, boa tarde!

    isso leva em conta o dano que se poe na transform? tipo quando alterar aqui

    Spoiler

    <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

     

  13. Em 15/07/2020 em 06:14, Lurk disse:

    @VitorSubhi consegui sim, muito foda seu script man <3

    oi pode me ajuda? aqui deu tudo certo, exceto a parte de que quando o player recebe o papel com os pts, os pts nao vai pra conta dele nem remove do player...

    algguem pode me ajudar?

    Em 15/07/2020 em 05:08, VitorSubhi disse:

    @Gabrieldsadaxas faz algum tempo que fiz esse script, e não me recordava como ele funcionava. Verificando aqui, notei que estou comparando a string "You see (numero) Collapser Orbs" para capturar os pontos, caso você tenha alterado o texto para Points, ou algo do tipo, será necessário alterar na linha 12 para o texto novo:

     

    
    function CollapserOrbs(item)
    	return tonumber(string.match(getItemDescriptions(item.uid).special, "You see (%w+) Collapser Orbs."))
    end

     

    eu alterei aq para premium points, precisa alterar em mais algum lugar?

  14.  

    Em 06/08/2020 em 19:16, Onepiece disse:

    man, para tópico não ficar extenso peço que teste com essa  ultima modificação, ao meu ver era pra funcionar. Caso não funcione anoite quando chegar em casa eu monto do meu PC e te envio, por que fica montando do bloco de notas é complicado kkkkk

     

    aqui tbm n fucionou   D==

  15. To comm o mesmo problema ?

     

    2 horas atrás, Senju uchira disse:

    vou tentar fazer aki calma mente e aviso oque acontecer

    @Mathias Kenfi 

    2 horas atrás, Senju uchira disse:

    vou tentar fazer aki calma mente e aviso oque acontecer

    @Mathias Kenfi 

    image.thumb.png.084018f13948505bf1612e9df411c0e7.png

     

    Estou com o mesmo problema.... ajuda nós @Mathias Kenfi pelo amor de deus paeee
    só queria os novos atributos nas arma bolado meu rei!!!  ???

  16. Boa tarde amigos do TIBIA KING! Uso TFS 0.4 / VERS. 8.6

    Me deparo com um erro no meu War System ao tentar aceitar um war invite

     

    Spoiler
    
    [19:24:31.100] [Error - TalkAction Interface]
    [19:24:31.100] data/talkactions/scripts/war.lua:onSay
    [19:24:31.100] Description:
    [19:24:31.116] data/talkactions/scripts/war.lua:70: attempt to call global 'doGu
    ildAddEnemy' (a nil value)
    [19:24:31.116] stack traceback:
    [19:24:31.116]  data/talkactions/scripts/war.lua:70: in function <data/talkactio
    ns/scripts/war.lua:1>
    

     

    que me impossibilita de aceitar a war...

     

    (SCRIPT WAR.LUA)

     

    Spoiler
    
    function onSay(cid, words, param, channel)
            local guild = getPlayerGuildId(cid)
            if(not guild or getPlayerGuildLevel(cid) < GUILDLEVEL_LEADER) then
                    doPlayerSendChannelMessage(cid, "", "You cannot execute this talkaction.", TALKTYPE_CHANNEL_W, 0)
                    return true
            end
     
            local t = string.explode(param, ",")
            if(not t[2]) then
                    doPlayerSendChannelMessage(cid, "", "Not enough param(s).", TALKTYPE_CHANNEL_W, 0)
                    return true
            end
     
            local enemy = getGuildId(t[2])
            if(not enemy) then
                    doPlayerSendChannelMessage(cid, "", "Guild \"" .. t[2] .. "\" does not exists.", TALKTYPE_CHANNEL_W, 0)
                    return true
            end
     
            if(enemy == guild) then
                    doPlayerSendChannelMessage(cid, "", "You cannot perform war action on your own guild.", TALKTYPE_CHANNEL_W, 0)
                    return true
            end
     
            local enemyName, tmp = "", db.getResult("SELECT `name` FROM `guilds` WHERE `id` = " .. enemy)
            if(tmp:getID() ~= -1) then
                    enemyName = tmp:getDataString("name")
                    tmp:free()
            end
     
            if(isInArray({"accept", "reject", "cancel"}, t[1])) then
                    local query = "`guild_id` = " .. enemy .. " AND `enemy_id` = " .. guild
                    if(t[1] == "cancel") then
                            query = "`guild_id` = " .. guild .. " AND `enemy_id` = " .. enemy
                    end
     
                    tmp = db.getResult("SELECT `id`, `begin`, `end`, `payment` FROM `guild_wars` WHERE " .. query .. " AND `status` = 0")
                    if(tmp:getID() == -1) then
                            doPlayerSendChannelMessage(cid, "", "Currently there's no pending invitation for a war with " .. enemyName .. ".", TALKTYPE_CHANNEL_W, 0)
                            return true
                    end
     
                    if(t[1] == "accept") then
                            local _tmp = db.getResult("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild)
                            local state = _tmp:getID() < 0 or _tmp:getDataInt("balance") < tmp:getDataInt("payment")
     
                            _tmp:free()
                            if(state) then
                                    doPlayerSendChannelMessage(cid, "", "Your guild balance is too low to accept this invitation.", TALKTYPE_CHANNEL_W, 0)
                                    return true
                            end
     
                            db.query("UPDATE `guilds` SET `balance` = `balance` - " .. tmp:getDataInt("payment") .. " WHERE `id` = " .. guild)
                    end
     
                    query = "UPDATE `guild_wars` SET "
                    local msg = "accepted " .. enemyName .. " invitation to war."
                    if(t[1] == "reject") then
                            query = query .. "`end` = " .. os.time() .. ", `status` = 2"
                            msg = "rejected " .. enemyName .. " invitation to war."
                    elseif(t[1] == "cancel") then
                            query = query .. "`end` = " .. os.time() .. ", `status` = 3"
                            msg = "canceled invitation to a war with " .. enemyName .. "."
                    else
                            query = query .. "`begin` = " .. os.time() .. ", `end` = " .. (tmp:getDataInt("end") > 0 and (os.time() + ((tmp:getDataInt("begin") - tmp:getDataInt("end")) / 86400)) or 0) .. ", `status` = 1"
                    end
     
                    query = query .. " WHERE `id` = " .. tmp:getDataInt("id")
                    if(t[1] == "accept") then
                            doGuildAddEnemy(guild, enemy, tmp:getDataInt("id"), WAR_GUILD)
                            doGuildAddEnemy(enemy, guild, tmp:getDataInt("id"), WAR_ENEMY)
                    end
     
                    tmp:free()
                    db.query(query)
                    doBroadcastMessage(getPlayerGuildName(cid) .. " has " .. msg, MESSAGE_EVENT_ADVANCE)
                    return true
            end
     
            if(t[1] == "invite") then
                    local str = ""
                    tmp = db.getResult("SELECT `guild_id`, `status` FROM `guild_wars` WHERE `guild_id` IN (" .. guild .. "," .. enemy .. ") AND `enemy_id` IN (" .. enemy .. "," .. guild .. ") AND `status` IN (0, 1)")
                    if(tmp:getID() ~= -1) then
                            if(tmp:getDataInt("status") == 0) then
                                    if(tmp:getDataInt("guild_id") == guild) then
                                            str = "You have already invited " .. enemyName .. " to war."
                                    else
                                            str = enemyName .. " have already invited you to war."
                                    end
                            else
                                    str = "You are already on a war with " .. enemyName .. "."
                            end
     
                            tmp:free()
                    end
     
                    if(str ~= "") then
                            doPlayerSendChannelMessage(cid, "", str, TALKTYPE_CHANNEL_W, 0)
                            return true
                    end
     
                    local frags = tonumber(t[3])
                    if(frags ~= nil) then
                            frags = math.max(10, math.min(1000, frags))
                    else
                            frags = 100
                    end
     
                    local payment = tonumber(t[4])
                    if(payment ~= nil) then
                            payment = math.max(100000, math.min(1000000000, payment))
                            tmp = db.getResult("SELECT `balance` FROM `guilds` WHERE `id` = " .. guild)
     
                            local state = tmp:getID() < 0 or tmp:getDataInt("balance") < payment
                            tmp:free()
                            if(state) then
                                    doPlayerSendChannelMessage(cid, "", "Your guild balance is too low for such payment.", TALKTYPE_CHANNEL_W, 0)
                                    return true
                            end
     
                            db.query("UPDATE `guilds` SET `balance` = `balance` - " .. payment .. " WHERE `id` = " .. guild)
                    else
                            payment = 0
                    end
     
                    local begining, ending = os.time(), tonumber(t[5])
                    if(ending ~= nil and ending ~= 0) then
                            ending = begining + (ending * 86400)
                    else
                            ending = 0
                    end
     
                    db.query("INSERT INTO `guild_wars` (`guild_id`, `enemy_id`, `begin`, `end`, `frags`, `payment`) VALUES (" .. guild .. ", " .. enemy .. ", " .. begining .. ", " .. ending .. ", " .. frags .. ", " .. payment .. ");")
                    doBroadcastMessage(getPlayerGuildName(cid) .. " has invited " .. enemyName .. " to war till " .. frags .. " frags.", MESSAGE_EVENT_ADVANCE)
                    return true
            end
     
            if(not isInArray({"end", "finish"}, t[1])) then
                    return false
            end
     
            local status = (t[1] == "end" and 1 or 4)
            tmp = db.getResult("SELECT `id` FROM `guild_wars` WHERE `guild_id` = " .. guild .. " AND `enemy_id` = " .. enemy .. " AND `status` = " .. status)
            if(tmp:getID() ~= -1) then
                    local query = "UPDATE `guild_wars` SET `end` = " .. os.time() .. ", `status` = 5 WHERE `id` = " .. tmp:getDataInt("id")
                    tmp:free()
                    doGuildRemoveEnemy(guild, enemy)
                    doGuildRemoveEnemy(enemy, guild)
     
                    db.query(query)
                    doBroadcastMessage(getPlayerGuildName(cid) .. " has " .. (status == 4 and "mend fences" or "ended up a war") .. " with " .. enemyName .. ".", MESSAGE_EVENT_ADVANCE)
                    return true
            end
     
            if(status == 4) then
                    doPlayerSendChannelMessage(cid, "", "Currently there's no pending war truce from " .. enemyName .. ".", TALKTYPE_CHANNEL_W, 0)
                    return true
            end
     
            tmp = db.getResult("SELECT `id`, `end` FROM `guild_wars` WHERE `guild_id` = " .. enemy .. " AND `enemy_id` = " .. guild .. " AND `status` = 1")
            if(tmp:getID() ~= -1) then
                    if(tmp:getDataInt("end") > 0) then
                            tmp:free()
                            doPlayerSendChannelMessage(cid, "", "You cannot request ending for war with " .. enemyName .. ".", TALKTYPE_CHANNEL_W, 0)
                            return true
                    end
     
                    local query = "UPDATE `guild_wars` SET `status` = 4, `end` = " .. os.time() .. " WHERE `id` = " .. tmp:getDataInt("id")
                    tmp:free()
     
                    db.query(query)
                    doBroadcastMessage(getPlayerGuildName(cid) .. " has signed an armstice declaration on a war with " .. enemyName .. ".", MESSAGE_EVENT_ADVANCE)
                    return true
            end
     
            doPlayerSendChannelMessage(cid, "", "Currently there's no active war with " .. enemyName .. ".", TALKTYPE_CHANNEL_W, 0)
            return true
    end

     

     

     

    Ficaria lisongeado se alguem pudesse me ajudar!!!

    REP+++ Tambem

  17. 3 minutos atrás, Rogex Joyz disse:

    em creaturescripts/scripts crie um arquivo chamado weaponpar.lua e add dentro:

     

    
    -- <Script TK> --
    
    local weaponpar = {2377, 2378, 2379, 2380}  -- id dos items que darão paralize
    local chancepar = 5 -- chance de ocorrer o paralize (10 = 10%, 20 = 20%, 30 = 30%, 1 = 1%, 5 = 5%) e assim por diante
    
    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
    setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
    setCombatFormula(combat, COMBAT_FORMULA_SKILL, 1, 0, 1, 0) -- aqui edita os valores pro dano de paralize, vai mudando ae e testando até achar o desejado
    
    local condition = createConditionObject(CONDITION_PARALYZE)
    setConditionParam(condition, CONDITION_PARAM_TICKS, 10000) -- aqui vai o tempo de paralyze, 1000 = 1 segundo
    setConditionParam(condition, CONDITION_PARAM_SPEED, -400) -- velocidade que o monstro irá perder
    setConditionFormula(condition, 0, 0, 0, 0)
    setCombatCondition(combat, condition)
    
    function onAttack(cid, target)
    if ((getCreaturePosition(target).x == getCreaturePosition(cid).x or getCreaturePosition(target).x == getCreaturePosition(cid).x+1 or getCreaturePosition(target).x == getCreaturePosition(cid).x-1) and (getCreaturePosition(target).y == getCreaturePosition(cid).y or getCreaturePosition(target).y == getCreaturePosition(cid).y+1 or getCreaturePosition(target).y == getCreaturePosition(cid).y-1)) then
            for i=0, #weaponpar do
            if (getPlayerSlotItem(cid, 5).itemid == weaponpar[i] or getPlayerSlotItem(cid, 6).itemid == weaponpar[i]) then
                    if (math.random(1,100) > (100 - chancepar)) then
                            doPlayerSendTextMessage(cid, 23, getCreatureName(target).." has paralized.")
                            doAddCondition(target, condition)
                            return true
                    else
                    return true
                    end
            end
            end
    end
    return true
    end

     

     

    Obrigado!!! vou testar depois volto pra falar se funfou

  18. Olá amigos do tibia king, eu tenho um prooblema com o sistema de outfit para modern acc.

    esstou tentando adaptar o codigo para ler os gifs, ao invez do png... porém nao obtive sucesso. 

     

    codigo original

    Spoiler
    
    <?php
    
    class Outfiter {
    
    
    
        protected static $instance = null;
    
        protected static $_outfit_lookup_table = array(
    
            0xFFFFFF, 0xFFD4BF, 0xFFE9BF, 0xFFFFBF, 0xE9FFBF, 0xD4FFBF,
    
            0xBFFFBF, 0xBFFFD4, 0xBFFFE9, 0xBFFFFF, 0xBFE9FF, 0xBFD4FF,
    
            0xBFBFFF, 0xD4BFFF, 0xE9BFFF, 0xFFBFFF, 0xFFBFE9, 0xFFBFD4,
    
            0xFFBFBF, 0xDADADA, 0xBF9F8F, 0xBFAF8F, 0xBFBF8F, 0xAFBF8F,
    
            0x9FBF8F, 0x8FBF8F, 0x8FBF9F, 0x8FBFAF, 0x8FBFBF, 0x8FAFBF,
    
            0x8F9FBF, 0x8F8FBF, 0x9F8FBF, 0xAF8FBF, 0xBF8FBF, 0xBF8FAF,
    
            0xBF8F9F, 0xBF8F8F, 0xB6B6B6, 0xBF7F5F, 0xBFAF8F, 0xBFBF5F,
    
            0x9FBF5F, 0x7FBF5F, 0x5FBF5F, 0x5FBF7F, 0x5FBF9F, 0x5FBFBF,
    
            0x5F9FBF, 0x5F7FBF, 0x5F5FBF, 0x7F5FBF, 0x9F5FBF, 0xBF5FBF,
    
            0xBF5F9F, 0xBF5F7F, 0xBF5F5F, 0x919191, 0xBF6A3F, 0xBF943F,
    
            0xBFBF3F, 0x94BF3F, 0x6ABF3F, 0x3FBF3F, 0x3FBF6A, 0x3FBF94,
    
            0x3FBFBF, 0x3F94BF, 0x3F6ABF, 0x3F3FBF, 0x6A3FBF, 0x943FBF,
    
            0xBF3FBF, 0xBF3F94, 0xBF3F6A, 0xBF3F3F, 0x6D6D6D, 0xFF5500,
    
            0xFFAA00, 0xFFFF00, 0xAAFF00, 0x54FF00, 0x00FF00, 0x00FF54,
    
            0x00FFAA, 0x00FFFF, 0x00A9FF, 0x0055FF, 0x0000FF, 0x5500FF,
    
            0xA900FF, 0xFE00FF, 0xFF00AA, 0xFF0055, 0xFF0000, 0x484848,
    
            0xBF3F00, 0xBF7F00, 0xBFBF00, 0x7FBF00, 0x3FBF00, 0x00BF00,
    
            0x00BF3F, 0x00BF7F, 0x00BFBF, 0x007FBF, 0x003FBF, 0x0000BF,
    
            0x3F00BF, 0x7F00BF, 0xBF00BF, 0xBF007F, 0xBF003F, 0xBF0000,
    
            0x242424, 0x7F2A00, 0x7F5500, 0x7F7F00, 0x557F00, 0x2A7F00,
    
            0x007F00, 0x007F2A, 0x007F55, 0x007F7F, 0x00547F, 0x002A7F,
    
            0x00007F, 0x2A007F, 0x54007F, 0x7F007F, 0x7F0055, 0x7F002A,
    
            0x7F0000,
    
        );
    
    
    
        public static function instance() {
    
            if (!isset(self::$instance))
    
                self::$instance = new self();
    
            return self::$instance;
    
        }
    
    
    
        protected function prepareOutfit($_file1, $_file2, &$_image_template, &$_image_outfit) {
    
            $_image_template = imagecreatefrompng($_file1);
    
            $_image_outfit = imagecreatefrompng($_file2);
    
            imagealphablending($_image_outfit, false);
    
            imagesavealpha($_image_outfit, true);
    
        }
    
    
    
        protected function outfit($outfit, $addons, $head, $body, $legs, $feet) {
    
            if ($addons != 0 && (!file_exists('./outfits/template/' . $outfit . '_2_0_' . $addons . '.png') || !file_exists('./outfits/outfit/' . $outfit . '_2_0_' . $addons . '.png'))) {
    
                $addons = 0;
    
                if (!file_exists('./outfits/template/' . $outfit . '_2_0_' . $addons . '.png') || !file_exists('./outfits/outfit/' . $outfit . '_2_0_' . $addons . '.png'))
    
                    return; //error file not found
    
            } else if (!file_exists('./outfits/template/' . $outfit . '_2_0_' . $addons . '.png') || !file_exists('./outfits/outfit/' . $outfit . '_2_0_' . $addons . '.png')) {
    
                return; //error file not found
    
            }
    
            $image_template = null;
    
            $image_outfit = null;
    
            $this->prepareOutfit('./outfits/template/' . $outfit . '_2_0_' . $addons . '.png', './outfits/outfit/' . $outfit . '_2_0_' . $addons . '.png', $image_template, $image_outfit);
    
            $this->colorize($image_template, $image_outfit, $head, $body, $legs, $feet);
    
            $im = $image_outfit;
    
            imagedestroy($image_template);
    
            //imagedestroy($image_outfit);
    
            return $im;
    
        }
    
    
    
        public function render($outfit, $addons, $head, $body, $legs, $feet) {
    
            return imagepng($this->outfit($outfit, $addons, $head, $body, $legs, $feet));
    
        }
    
    
    
        public function save($outfit, $addons, $head, $body, $legs, $feet, $_file) {
    
            imagepng($this->outfit($outfit, $addons, $head, $body, $legs, $feet), $_file);
    
        }
    
    
    
        protected function colorizePixel($_color, &$_r, &$_g, &$_b) {
    
            if ($_color < count(self::$_outfit_lookup_table))
    
                $value = self::$_outfit_lookup_table[$_color];
    
            else
    
                $value = 0;
    
            $ro = ($value & 0xFF0000) >> 16; // rgb outfit
    
            $go = ($value & 0xFF00) >> 8;
    
            $bo = ($value & 0xFF);
    
            $_r = (int) ($_r * ($ro / 255));
    
            $_g = (int) ($_g * ($go / 255));
    
            $_b = (int) ($_b * ($bo / 255));
    
        }
    
    
    
        protected function colorize(&$_image_template, &$_image_outfit, $_head, $_body, $_legs, $_feet) {
    
            for ($i = 0; $i < imagesy($_image_template); $i++) {
    
                for ($j = 0; $j < imagesx($_image_template); $j++) {
    
                    $templatepixel = imagecolorat($_image_template, $j, $i);
    
                    $outfit = imagecolorat($_image_outfit, $j, $i);
    
    
    
                    if ($templatepixel == $outfit)
    
                        continue;
    
    
    
                    $rt = ($templatepixel >> 16) & 0xFF;
    
                    $gt = ($templatepixel >> 8) & 0xFF;
    
                    $bt = $templatepixel & 0xFF;
    
                    $ro = ($outfit >> 16) & 0xFF;
    
                    $go = ($outfit >> 8) & 0xFF;
    
                    $bo = $outfit & 0xFF;
    
    
    
                    if ($rt && $gt && !$bt) { // yellow == head
    
                        $this->colorizePixel($_head, $ro, $go, $bo);
    
                    } else if ($rt && !$gt && !$bt) { // red == body
    
                        $this->colorizePixel($_body, $ro, $go, $bo);
    
                    } else if (!$rt && $gt && !$bt) { // green == legs
    
                        $this->colorizePixel($_legs, $ro, $go, $bo);
    
                    } else if (!$rt && !$gt && $bt) { // blue == feet
    
                        $this->colorizePixel($_feet, $ro, $go, $bo);
    
                    } else {
    
                        continue; // if nothing changed, skip the change of pixel
    
                    }
    
    
    
                    imagesetpixel($_image_outfit, $j, $i, imagecolorallocate($_image_outfit, $ro, $go, $bo)); //do sprawdzenia
    
                }
    
            }
    
        }
    
    
    
    }
    
    
    
    header("Content-Type: image/png");
    
    Outfiter::instance()->render($_GET['id'], $_GET['addons'], $_GET['head'], $_GET['body'], $_GET['legs'], $_GET['feet']);
    
    ?>

     

     

     

    image.png.fde23091e737891d10c508d26fc1ee8c.png

     

    MINHA TENTATIVA COM ALTERAÇÕES PARA GIF

    Spoiler
    
    <?php
    
    class Outfiter {
    
    
    
        protected static $instance = null;
    
        protected static $_outfit_lookup_table = array(
    
            0xFFFFFF, 0xFFD4BF, 0xFFE9BF, 0xFFFFBF, 0xE9FFBF, 0xD4FFBF,
    
            0xBFFFBF, 0xBFFFD4, 0xBFFFE9, 0xBFFFFF, 0xBFE9FF, 0xBFD4FF,
    
            0xBFBFFF, 0xD4BFFF, 0xE9BFFF, 0xFFBFFF, 0xFFBFE9, 0xFFBFD4,
    
            0xFFBFBF, 0xDADADA, 0xBF9F8F, 0xBFAF8F, 0xBFBF8F, 0xAFBF8F,
    
            0x9FBF8F, 0x8FBF8F, 0x8FBF9F, 0x8FBFAF, 0x8FBFBF, 0x8FAFBF,
    
            0x8F9FBF, 0x8F8FBF, 0x9F8FBF, 0xAF8FBF, 0xBF8FBF, 0xBF8FAF,
    
            0xBF8F9F, 0xBF8F8F, 0xB6B6B6, 0xBF7F5F, 0xBFAF8F, 0xBFBF5F,
    
            0x9FBF5F, 0x7FBF5F, 0x5FBF5F, 0x5FBF7F, 0x5FBF9F, 0x5FBFBF,
    
            0x5F9FBF, 0x5F7FBF, 0x5F5FBF, 0x7F5FBF, 0x9F5FBF, 0xBF5FBF,
    
            0xBF5F9F, 0xBF5F7F, 0xBF5F5F, 0x919191, 0xBF6A3F, 0xBF943F,
    
            0xBFBF3F, 0x94BF3F, 0x6ABF3F, 0x3FBF3F, 0x3FBF6A, 0x3FBF94,
    
            0x3FBFBF, 0x3F94BF, 0x3F6ABF, 0x3F3FBF, 0x6A3FBF, 0x943FBF,
    
            0xBF3FBF, 0xBF3F94, 0xBF3F6A, 0xBF3F3F, 0x6D6D6D, 0xFF5500,
    
            0xFFAA00, 0xFFFF00, 0xAAFF00, 0x54FF00, 0x00FF00, 0x00FF54,
    
            0x00FFAA, 0x00FFFF, 0x00A9FF, 0x0055FF, 0x0000FF, 0x5500FF,
    
            0xA900FF, 0xFE00FF, 0xFF00AA, 0xFF0055, 0xFF0000, 0x484848,
    
            0xBF3F00, 0xBF7F00, 0xBFBF00, 0x7FBF00, 0x3FBF00, 0x00BF00,
    
            0x00BF3F, 0x00BF7F, 0x00BFBF, 0x007FBF, 0x003FBF, 0x0000BF,
    
            0x3F00BF, 0x7F00BF, 0xBF00BF, 0xBF007F, 0xBF003F, 0xBF0000,
    
            0x242424, 0x7F2A00, 0x7F5500, 0x7F7F00, 0x557F00, 0x2A7F00,
    
            0x007F00, 0x007F2A, 0x007F55, 0x007F7F, 0x00547F, 0x002A7F,
    
            0x00007F, 0x2A007F, 0x54007F, 0x7F007F, 0x7F0055, 0x7F002A,
    
            0x7F0000,
    
        );
    
    
    
        public static function instance() {
    
            if (!isset(self::$instance))
    
                self::$instance = new self();
    
            return self::$instance;
    
        }
    
    
    
        protected function prepareOutfit($_file1, $_file2, &$_image_template, &$_image_outfit) {
    
            $_image_template = imagecreatefrompng($_file1);
    
            $_image_outfit = imagecreatefrompng($_file2);
    
            imagealphablending($_image_outfit, false);
    
            imagesavealpha($_image_outfit, true);
    
        }
    
    
    
        protected function outfit($outfit, $addons, $head, $body, $legs, $feet) {
    
            if ($addons != 0 && (!file_exists('./outfits/template/' . $outfit . '_2_0_' . $addons . '.gif') || !file_exists('./outfits/outfit/' . $outfit . '_2_0_' . $addons . '.gif'))) {
    
                $addons = 0;
    
                if (!file_exists('./outfits/template/' . $outfit . '_2_0_' . $addons . '.gif') || !file_exists('./outfits/outfit/' . $outfit . '_2_0_' . $addons . '.gif'))
    
                    return; //error file not found
    
            } else if (!file_exists('./outfits/template/' . $outfit . '_2_0_' . $addons . '.gif') || !file_exists('./outfits/outfit/' . $outfit . '_2_0_' . $addons . '.gif')) {
    
                return; //error file not found
    
            }
    
            $image_template = null;
    
            $image_outfit = null;
    
            $this->prepareOutfit('./outfits/template/' . $outfit . '_2_0_' . $addons . '.gif', './outfits/outfit/' . $outfit . '_2_0_' . $addons . '.gif', $image_template, $image_outfit);
    
            $this->colorize($image_template, $image_outfit, $head, $body, $legs, $feet);
    
            $im = $image_outfit;
    
            imagedestroy($image_template);
    
            //imagedestroy($image_outfit);
    
            return $im;
    
        }
    
    
    
        public function render($outfit, $addons, $head, $body, $legs, $feet) {
    
            return imagepng($this->outfit($outfit, $addons, $head, $body, $legs, $feet));
    
        }
    
    
    
        public function save($outfit, $addons, $head, $body, $legs, $feet, $_file) {
    
            imagepng($this->outfit($outfit, $addons, $head, $body, $legs, $feet), $_file);
    
        }
    
    
    
        protected function colorizePixel($_color, &$_r, &$_g, &$_b) {
    
            if ($_color < count(self::$_outfit_lookup_table))
    
                $value = self::$_outfit_lookup_table[$_color];
    
            else
    
                $value = 0;
    
            $ro = ($value & 0xFF0000) >> 16; // rgb outfit
    
            $go = ($value & 0xFF00) >> 8;
    
            $bo = ($value & 0xFF);
    
            $_r = (int) ($_r * ($ro / 255));
    
            $_g = (int) ($_g * ($go / 255));
    
            $_b = (int) ($_b * ($bo / 255));
    
        }
    
    
    
        protected function colorize(&$_image_template, &$_image_outfit, $_head, $_body, $_legs, $_feet) {
    
            for ($i = 0; $i < imagesy($_image_template); $i++) {
    
                for ($j = 0; $j < imagesx($_image_template); $j++) {
    
                    $templatepixel = imagecolorat($_image_template, $j, $i);
    
                    $outfit = imagecolorat($_image_outfit, $j, $i);
    
    
    
                    if ($templatepixel == $outfit)
    
                        continue;
    
    
    
                    $rt = ($templatepixel >> 16) & 0xFF;
    
                    $gt = ($templatepixel >> 8) & 0xFF;
    
                    $bt = $templatepixel & 0xFF;
    
                    $ro = ($outfit >> 16) & 0xFF;
    
                    $go = ($outfit >> 8) & 0xFF;
    
                    $bo = $outfit & 0xFF;
    
    
    
                    if ($rt && $gt && !$bt) { // yellow == head
    
                        $this->colorizePixel($_head, $ro, $go, $bo);
    
                    } else if ($rt && !$gt && !$bt) { // red == body
    
                        $this->colorizePixel($_body, $ro, $go, $bo);
    
                    } else if (!$rt && $gt && !$bt) { // green == legs
    
                        $this->colorizePixel($_legs, $ro, $go, $bo);
    
                    } else if (!$rt && !$gt && $bt) { // blue == feet
    
                        $this->colorizePixel($_feet, $ro, $go, $bo);
    
                    } else {
    
                        continue; // if nothing changed, skip the change of pixel
    
                    }
    
    
    
                    imagesetpixel($_image_outfit, $j, $i, imagecolorallocate($_image_outfit, $ro, $go, $bo)); //do sprawdzenia
    
                }
    
            }
    
        }
    
    
    
    }
    
    
    
    header("Content-Type: image/gif");
    
    Outfiter::instance()->render($_GET['id'], $_GET['addons'], $_GET['head'], $_GET['body'], $_GET['legs'], $_GET['feet']);
    
    ?>

     

     

    image.png.8994db2308d74022f3b887087d538ab5.png

     

    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

     

    as imagens em gif ja estao na pasta correta

     

    Spoiler

    image.png.c73c16c3a587c9c43bd0bed9dcc98a9e.png

     

    Spoiler

     

    /TEMPLATE

     

    image.thumb.png.287f5e605cce14bde736b41a93956f0f.png

    OUTFIT

     

    image.png.52fe271d30b3e8bd7eafebb71fcdf8b8.png

     

     

     

    Alguma alma bondosa pdoe me ajudar nesse problema? obrigado desde ja

    #fé

     

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo