Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Oiiii Boa Noite !!! , Gostaria de pedir a ajuda de vocês em um poblemas que eu estou tendo,

 

Adicionei recentemente esse Script Abaixo e consegui instalar tudo direitinho, ta rodando liso.. Mas Gostaria de implementar bonus nesse script

Exemplo:

Player Vip: 20% a + de XP

Player Vip: 1%   a + de ATK SPEED

 

abaixo todo o Script

 

[Fonte]

 

Sistema Vip

 

1° execute dentro da sua db

ALTER TABLE `accounts`
        ADD COLUMN `viplastday` int(10) NOT NULL DEFAULT 0 AFTER `lastday`,
        ADD COLUMN `vipdays` int(11) NOT NULL DEFAULT 0 AFTER `lastday`;

 

 

 

2º na pasta data/creaturescripts/scripts procure pelo arquivo login.lua e adicione na segunda linha, logo após o function onLogin(player) isso

player:loadVipData()
player:updateVipTime()

3° na pasta data\ crie um arquivo chamado vipsystem.lua e adicione o seguinte

local config = {
    -- true = player will be teleported to this position if Vip runs out
    -- false = player will not be teleported
    useTeleport = true,
    expirationPosition = Position(95, 114, 7),

    -- true = player will received the message you set
    -- false = player will not receive a message
    useMessage = true,
    expirationMessage = 'Your vip days ran out.',
    expirationMessageType = MESSAGE_STATUS_WARNING
}

if not VipData then
    VipData = { }
end

function Player.onRemoveVip(self)
    if config.useTeleport then
        self:teleportTo(config.expirationPosition)
        config.expirationPosition:sendMagicEffect(CONST_ME_TELEPORT)
    end

    if config.useMessage then
        self:sendTextMessage(config.expirationMessageType, config.expirationMessage)
    end
end

function Player.getVipDays(self)
    return VipData[self:getId()].days
end

function Player.getLastVipDay(self)
    return VipData[self:getId()].lastDay
end

function Player.isVip(self)
    return self:getVipDays() > 0
end

function Player.addInfiniteVip(self)
    local data = VipData[self:getId()]
    data.days = 0xFFFF
    data.lastDay = 0

    db.query(string.format('UPDATE `accounts` SET `vipdays` = %i, `viplastday` = %i WHERE `id` = %i;', 0xFFFF, 0, self:getAccountId()))
end

function Player.addVipDays(self, amount)
    local data = VipData[self:getId()]
    local amount = math.min(0xFFFE - data.days, amount)
    if amount > 0 then
        if data.days == 0 then
            local time = os.time()
            db.query(string.format('UPDATE `accounts` SET `vipdays` = `vipdays` + %i, `viplastday` = %i WHERE `id` = %i;', amount, time, self:getAccountId()))
            data.lastDay = time
        else
            db.query(string.format('UPDATE `accounts` SET `vipdays` = `vipdays` + %i WHERE `id` = %i;', amount, self:getAccountId()))
        end
        data.days = data.days + amount
    end

    return true
end

function Player.removeVipDays(self, amount)
    local data = VipData[self:getId()]
    if data.days == 0xFFFF then
        return false
    end

    local amount = math.min(data.days, amount)
    if amount > 0 then
        db.query(string.format('UPDATE `accounts` SET `vipdays` = `vipdays` - %i WHERE `id` = %i;', amount, self:getAccountId()))
        data.days = data.days - amount

        if data.days == 0 then
            self:onRemoveVip()
        end
    end

    return true
end

function Player.removeVip(self)
    local data = VipData[self:getId()]
    if data.days == 0 then
        return
    end

    data.days = 0
    data.lastDay = 0

    self:onRemoveVip()

    db.query(string.format('UPDATE `accounts` SET `vipdays` = 0, `viplastday` = 0 WHERE `id` = %i;', self:getAccountId()))
end

function Player.loadVipData(self)
    local resultId = db.storeQuery(string.format('SELECT `vipdays`, `viplastday` FROM `accounts` WHERE `id` = %i;', self:getAccountId()))
    if resultId then
        VipData[self:getId()] = {
            days = result.getDataInt(resultId, 'vipdays'),
            lastDay = result.getDataInt(resultId, 'viplastday')
        }

        result.free(resultId)
        return true
    end

    VipData[self:getId()] = { days = 0, lastDay = 0 }
    return false
end

function Player.updateVipTime(self)
    local save = false

    local data = VipData[self:getId()]
    local days, lastDay = data.days, data.lastDay
    local daysBefore = days
    if days == 0 or days == 0xFFFF then
        if lastDay ~= 0 then
            lastDay = 0
            save = true
        end
    elseif lastDay == 0 then
        lastDay = os.time()
        save = true
    else
        local time = os.time()
        local elapsedDays = math.floor((time - lastDay) / 86400)
        if elapsedDays > 0 then
            if elapsedDays >= days then
                days = 0
                lastDay = 0
            else
                days = days - elapsedDays
                lastDay = time - ((time - lastDay) % 86400)
            end
            save = true
        end
    end

    if save then
        if daysBefore > 0 and days == 0 then
            self:onRemoveVip()
        end

        db.query(string.format('UPDATE `accounts` SET `vipdays` = %i, `viplastday` = %i WHERE `id` = %i;', days, lastDay, self:getAccountId()))
        data.days = days
        data.lastDay = lastDay
    end
end

 

4° no arquivo global.lua adicione a seguinte linha

dofile('data/vipsystem.lua')

 

Talkaction !checkvip para todos os players

 

1° vá na pasta data/talkactions/scripts e crie um arquivo chamando checkvip.lua e adicione o seguinte

function onSay(cid, words, param)
    local player = Player(cid)

    local days = player:getVipDays()
    if days == 0 then
        player:sendCancelMessage('You do not have any vip days.')
    else
        player:sendCancelMessage(string.format('You have %s vip day%s left.', (days == 0xFFFF and 'infinite amount of' or days), (days == 1 and '' or 's')))
    end
    return false
end

2° e em data/talkactions/talkactions.xml adicione

 

<talkaction words="!checkvip" script="checkvip.lua"/>

 

Talkaction /vip para membros da staff

- /vip adddays, NomedoPlayer, 5
--> Adiciona 5 dias vip para o Player.
- /vip removedays, NomedoPlayer, 5
--> Remove 5 dias vip do Player.
- /vip remove, PlayerName
--> Remove todos os dias vip do Player.
- /vip check, NomedoPlayer
--> Checa quantos dias vip o Player tem.
- /vip addinfinite, NomedoPlayer
--> Adiciona tempo vip infinito para o Player.

 

Tiles VIP

 

1° em data/movements/movements.xml e adicione

<movevent event="StepIn" actionid="1500" script="viptiles.lua"/>
<movevent event="StepIn" actionid="1501" script="viptiles.lua"/>

2° em data/movements/script crie o arquivo viptiles.lua e adicione o seguinte

local vipPosition = Position(101, 116, 7)

function onStepIn(cid, item, position, fromPosition)
    local player = Player(cid)
    if not player then
        return true
    end

    if item.actionid == 1500 then
        if not player:isVip() then
            player:teleportTo(fromPosition)
            fromPosition:sendMagicEffect(CONST_ME_POFF)
            player:sendCancelMessage('You do not have any vip days.')
        end
    elseif item.actionid == 1501 then
        if player:isVip() then
            player:teleportTo(vipPosition)
            player:say('!* VIP *!', TALKTYPE_MONSTER_SAY)
            vipPosition:sendMagicEffect(CONST_ME_STUN)
        else
            player:teleportTo(fromPosition)
            player:sendCancelMessage('You do not have any vip days.')
            fromPosition:sendMagicEffect(CONST_ME_POFF)
        end
    end
    return true
end

Items que adicionam dias VIP

 

ItemId 10135 adiciona 10 dias vip.
ItemId 10134 adiciona 30 dias vip.
ItemId 10133 adiciona 90 dias vip.

 

 

1° em data/actions/actions.xml adicione

<action fromid="10133" toid="10135" script="vipitems.lua"/>

2° e em data/actions/scripts crie um arquivo chamado vipitems.lua e adicione o seguinte

local vipItems = {
   -- [itemid] = amount of vip days
    [10135] = 10,
    [10134] = 30,
    [10133] = 90
}

function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
    local player = Player(cid)
    local days = vipItems[item.itemid]
    player:addVipDays(days)
    player:say('!* YAY VIP! *!', TALKTYPE_MONSTER_SAY)
    player:getPosition():sendMagicEffect(CONST_ME_STUN)
    player:sendTextMessage(MESSAGE_INFO_DESCR, string.format('You received %s vip days.', days))
    Item(item.uid):remove(1)
    return true
end
Link para o post
Compartilhar em outros sites
  • Moderador

Este tópico foi movido para a seção de Suporte Otserv.

Meu Curso sobre Programação para OTServer

Programando OTServer

 

Peça o seu script! Entre agora mesmo no grupo

Developing

 

Conteúdos:

 

Discord: Belmont#7352

Não esqueça do REP+ :)     

Link para o post
Compartilhar em outros sites
21 horas atrás, Akun disse:

Oiiii Boa Noite !!! , Gostaria de pedir a ajuda de vocês em um poblemas que eu estou tendo,

 

Adicionei recentemente esse Script Abaixo e consegui instalar tudo direitinho, ta rodando liso.. Mas Gostaria de implementar bonus nesse script

Exemplo:

Player Vip: 20% a + de XP

Player Vip: 1%   a + de ATK SPEED

 

abaixo todo o Script

 

[Fonte]

 

Sistema Vip

 

1° execute dentro da sua db


ALTER TABLE `accounts`
        ADD COLUMN `viplastday` int(10) NOT NULL DEFAULT 0 AFTER `lastday`,
        ADD COLUMN `vipdays` int(11) NOT NULL DEFAULT 0 AFTER `lastday`;

 

 

 

2º na pasta data/creaturescripts/scripts procure pelo arquivo login.lua e adicione na segunda linha, logo após o function onLogin(player) isso


player:loadVipData()
player:updateVipTime()

3° na pasta data\ crie um arquivo chamado vipsystem.lua e adicione o seguinte


local config = {
    -- true = player will be teleported to this position if Vip runs out
    -- false = player will not be teleported
    useTeleport = true,
    expirationPosition = Position(95, 114, 7),

    -- true = player will received the message you set
    -- false = player will not receive a message
    useMessage = true,
    expirationMessage = 'Your vip days ran out.',
    expirationMessageType = MESSAGE_STATUS_WARNING
}

if not VipData then
    VipData = { }
end

function Player.onRemoveVip(self)
    if config.useTeleport then
        self:teleportTo(config.expirationPosition)
        config.expirationPosition:sendMagicEffect(CONST_ME_TELEPORT)
    end

    if config.useMessage then
        self:sendTextMessage(config.expirationMessageType, config.expirationMessage)
    end
end

function Player.getVipDays(self)
    return VipData[self:getId()].days
end

function Player.getLastVipDay(self)
    return VipData[self:getId()].lastDay
end

function Player.isVip(self)
    return self:getVipDays() > 0
end

function Player.addInfiniteVip(self)
    local data = VipData[self:getId()]
    data.days = 0xFFFF
    data.lastDay = 0

    db.query(string.format('UPDATE `accounts` SET `vipdays` = %i, `viplastday` = %i WHERE `id` = %i;', 0xFFFF, 0, self:getAccountId()))
end

function Player.addVipDays(self, amount)
    local data = VipData[self:getId()]
    local amount = math.min(0xFFFE - data.days, amount)
    if amount > 0 then
        if data.days == 0 then
            local time = os.time()
            db.query(string.format('UPDATE `accounts` SET `vipdays` = `vipdays` + %i, `viplastday` = %i WHERE `id` = %i;', amount, time, self:getAccountId()))
            data.lastDay = time
        else
            db.query(string.format('UPDATE `accounts` SET `vipdays` = `vipdays` + %i WHERE `id` = %i;', amount, self:getAccountId()))
        end
        data.days = data.days + amount
    end

    return true
end

function Player.removeVipDays(self, amount)
    local data = VipData[self:getId()]
    if data.days == 0xFFFF then
        return false
    end

    local amount = math.min(data.days, amount)
    if amount > 0 then
        db.query(string.format('UPDATE `accounts` SET `vipdays` = `vipdays` - %i WHERE `id` = %i;', amount, self:getAccountId()))
        data.days = data.days - amount

        if data.days == 0 then
            self:onRemoveVip()
        end
    end

    return true
end

function Player.removeVip(self)
    local data = VipData[self:getId()]
    if data.days == 0 then
        return
    end

    data.days = 0
    data.lastDay = 0

    self:onRemoveVip()

    db.query(string.format('UPDATE `accounts` SET `vipdays` = 0, `viplastday` = 0 WHERE `id` = %i;', self:getAccountId()))
end

function Player.loadVipData(self)
    local resultId = db.storeQuery(string.format('SELECT `vipdays`, `viplastday` FROM `accounts` WHERE `id` = %i;', self:getAccountId()))
    if resultId then
        VipData[self:getId()] = {
            days = result.getDataInt(resultId, 'vipdays'),
            lastDay = result.getDataInt(resultId, 'viplastday')
        }

        result.free(resultId)
        return true
    end

    VipData[self:getId()] = { days = 0, lastDay = 0 }
    return false
end

function Player.updateVipTime(self)
    local save = false

    local data = VipData[self:getId()]
    local days, lastDay = data.days, data.lastDay
    local daysBefore = days
    if days == 0 or days == 0xFFFF then
        if lastDay ~= 0 then
            lastDay = 0
            save = true
        end
    elseif lastDay == 0 then
        lastDay = os.time()
        save = true
    else
        local time = os.time()
        local elapsedDays = math.floor((time - lastDay) / 86400)
        if elapsedDays > 0 then
            if elapsedDays >= days then
                days = 0
                lastDay = 0
            else
                days = days - elapsedDays
                lastDay = time - ((time - lastDay) % 86400)
            end
            save = true
        end
    end

    if save then
        if daysBefore > 0 and days == 0 then
            self:onRemoveVip()
        end

        db.query(string.format('UPDATE `accounts` SET `vipdays` = %i, `viplastday` = %i WHERE `id` = %i;', days, lastDay, self:getAccountId()))
        data.days = days
        data.lastDay = lastDay
    end
end

 

4° no arquivo global.lua adicione a seguinte linha


dofile('data/vipsystem.lua')

 

Talkaction !checkvip para todos os players

 

1° vá na pasta data/talkactions/scripts e crie um arquivo chamando checkvip.lua e adicione o seguinte


function onSay(cid, words, param)
    local player = Player(cid)

    local days = player:getVipDays()
    if days == 0 then
        player:sendCancelMessage('You do not have any vip days.')
    else
        player:sendCancelMessage(string.format('You have %s vip day%s left.', (days == 0xFFFF and 'infinite amount of' or days), (days == 1 and '' or 's')))
    end
    return false
end

2° e em data/talkactions/talkactions.xml adicione

 


<talkaction words="!checkvip" script="checkvip.lua"/>

 

Talkaction /vip para membros da staff


- /vip adddays, NomedoPlayer, 5
--> Adiciona 5 dias vip para o Player.
- /vip removedays, NomedoPlayer, 5
--> Remove 5 dias vip do Player.
- /vip remove, PlayerName
--> Remove todos os dias vip do Player.
- /vip check, NomedoPlayer
--> Checa quantos dias vip o Player tem.
- /vip addinfinite, NomedoPlayer
--> Adiciona tempo vip infinito para o Player.

 

Tiles VIP

 

1° em data/movements/movements.xml e adicione


<movevent event="StepIn" actionid="1500" script="viptiles.lua"/>
<movevent event="StepIn" actionid="1501" script="viptiles.lua"/>

2° em data/movements/script crie o arquivo viptiles.lua e adicione o seguinte


local vipPosition = Position(101, 116, 7)

function onStepIn(cid, item, position, fromPosition)
    local player = Player(cid)
    if not player then
        return true
    end

    if item.actionid == 1500 then
        if not player:isVip() then
            player:teleportTo(fromPosition)
            fromPosition:sendMagicEffect(CONST_ME_POFF)
            player:sendCancelMessage('You do not have any vip days.')
        end
    elseif item.actionid == 1501 then
        if player:isVip() then
            player:teleportTo(vipPosition)
            player:say('!* VIP *!', TALKTYPE_MONSTER_SAY)
            vipPosition:sendMagicEffect(CONST_ME_STUN)
        else
            player:teleportTo(fromPosition)
            player:sendCancelMessage('You do not have any vip days.')
            fromPosition:sendMagicEffect(CONST_ME_POFF)
        end
    end
    return true
end

Items que adicionam dias VIP

 


ItemId 10135 adiciona 10 dias vip.
ItemId 10134 adiciona 30 dias vip.
ItemId 10133 adiciona 90 dias vip.

 

 

1° em data/actions/actions.xml adicione


<action fromid="10133" toid="10135" script="vipitems.lua"/>

2° e em data/actions/scripts crie um arquivo chamado vipitems.lua e adicione o seguinte


local vipItems = {
   -- [itemid] = amount of vip days
    [10135] = 10,
    [10134] = 30,
    [10133] = 90
}

function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
    local player = Player(cid)
    local days = vipItems[item.itemid]
    player:addVipDays(days)
    player:say('!* YAY VIP! *!', TALKTYPE_MONSTER_SAY)
    player:getPosition():sendMagicEffect(CONST_ME_STUN)
    player:sendTextMessage(MESSAGE_INFO_DESCR, string.format('You received %s vip days.', days))
    Item(item.uid):remove(1)
    return true
end

T_T

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.


  • Conteúdo Similar

    • Por Underewar
      Tutorial: Criando um Sistema de Enviar efeito com OTClient.


       
      Neste tutorial, vamos criar um sistema simples de Enviar efeito no OTClient.
      Este sistema permitirá que os jogadores ativem um efeito especial e vejam uma janela ao clicar em um botão específico.
      Pré-requisitos:
      Ambiente de Desenvolvimento:
      Certifique-se de ter um ambiente de desenvolvimento configurado com OTClient Edubart. Conhecimento Básico em Lua:
      Familiaridade com a linguagem de script Lua.
       
      Passo 1: Estrutura do projeto
       
      Organize seu projeto conforme abaixo:

      OTC / MODS



      Passo 2: Criando a Interface Gráfica (OTUI)

      game_pass.otui
      Repare que em nossa interface nossos botões de ação entram no caminho do module e iniciam uma função que esta disponivel em nosso game_pass.lua (Client-Side)

       



      Passo 3: Criando funções Client-Side

      Agora com as funções criada podemos chamar elas de acordo com a necessidade em nosso arquivo de interface.
      Por exemplo a função effect() que foi chamada em nosso arquivo de interface.otui agora é criada aqui para mostrar o efeito ao jogador.

      game_pass.lua
       
       
      Passo 4: Registrando o novo Mod

      Agora podemos registrar e iniciar nosso modulo usando o arquivo de configuração

      game_pass.otmod
       

      Feito isso ja podemos ver nosso module no client e enviar opcodes através do gameprotocol e também receber o buffer para manipular os dados podemos utilizar :
      protocolGame:sendExtendedOpcode(14, "1")
      Basicamente oque estamos fazendo é armazenando o valor 1 na variaval 14 do ExtendedOpcode e futuramente podemos recuperar esse valor.

      Recuperamos esse valor em nosso server side data/creatuerscript/otc/game_pass.lua

      Verificando se o opcode é 14 se for 14 então fazemos x ação.

      Show, tendo isso em mente para que o nosso client-side consiga receber com sucesso o efeito enviado ao jogador então utilizamos 

      Passo 5: Criando o Server-side responsavel por enviar o efeito correto ao jogador dependendo do opcode selecionado no nosso cliente.

      data/creaturescripts/otc/game_pass.lua
       
      Passo 6: Registrando o evento para evitar erros futuros!
      Para que tudo funcione corretamente sem erros é  necessário registrar o evento no creaturescript.xml / login.lua

      creaturescript.xml
      <event type="extendedopcode" name="GamePass" script="otc/game_pass.lua" />
      login.lua
          player:registerEvent("GamePass")  


      Ótimo agora ao selecionar o menu recompensa o jogador recebera um efeito.

      Espero que tenha ficado claro como usar Opcodes/ExetendedOpcodes.

      Arquivos usados no tutorrial:
      OTC MODULE
      game_pass.rar
      Creaturescript
      game_pass.lua

      Vi muitos tutoriais desatualizado então resolvi trazer esse!
      Reparem que nesse caso passamos creature como parametro do buffer isso porque precisamos enviar um efeito no player.

      Melhorando a formatação com JSON Encoder

       
       
    • Por Qwizer
      GLOBAL 100% 7.40
      >> Information:
      -7.4 Features: No Protection zone nos barcos e  tapetes.
      - Spells, vocations e spells formuled baseada em Tibia 7.4. nao tem Hotkleys!
      -War System.
      -Cast System.
      -Anti Clone.
      -Task System (Mais de 50)
      -Party Sharing Experience. You can share experience in-party with your friends, and receive 10% bonus experience when actived (!share).
      -Nao tem runas no Shop. somente conjurada.
      -Editado, conjura runas 2x mais que real tibia (ex. Sd 2x).
      -Fast Soul Regen
      -Conjure Runes na backpack. !
      -Nao tem Wands/Rods, Burst Arrowns baseado em magic level.

      >> Vocation Features:
      -Paladins conjure mais ammunition. (ex. exevo con = 15 arrows)
      -Mages conjure mais runes. (ex. adori vita vis = 2 SDs)
      -Damage melhorado em 10% para Knights and Paladins.
      -Attack speed melhorado em 10% for all vocations.
       
      >> NPCs:
      -Nao vende runes.
      -Pode comprar bp de MF (pode remover se quizer): "buy bp mf"
      -Pode comprar bp de LF (pode remover se quizer): "buy bp lf"
      -Djinns in ankrahmun (Precisa de Quest)
      -Eremo sells amulet of loss.
       
      >> Game Features:
      -Bank system.
      -Auto-stack items
      -Full HP and MP at level up.
      -Stone Skin Amulet nao tem em NPCs, dropa somente de Warlock ou Hydra.
       
      >> Extra Information:
      -Real Tibia map: Full real Tibia map, incluindo todos os NPCs, Port Hope, monsters e quests 100% RL.
      - POI quest e todas as rooms(Custom feita por min).
      - Svarground 7.4.
      -Demon Oak Quest (Custom feita por min).
      -Uptime: Muito Estavel.
      -Cliente Próprio das 3 ultimas imagem, não acompanha o servidor (usei somente para tirar prints).

      DOWNLOAD
      OTSERV/SOURCES OTX 7.x/CLIENTE/WEBSITE/DATABASE  (Pra Editar o cliente basta abrir o Tibia.exe com notepad procurar o ip 167.114.111.25 e alterar pelo o seu ip caso tenha a mesma quantidade de numeros)
      Executavel + DLLs
      Scan Virus Total.
       

      Creditos
      Qwizer - OTX
    • Por Codex NG
      Sorry I don't speak spanish so you will have to bare with me.
       
      This is a new way for people to create npc's which use different types of currency, rather than a coming up with different items to trade with the npc or trying to edit the npc modules this method simplifies everything by providing the npc with a npc currency id.
       
      All this npc currency id is, is a storage value.. pretty simple eh?
      If the npc doesn't have a currency id then it will use the normal currency e.g. gold, plat, cc etc..
       
      I originally posted this on otland, but fuck them xD
       
      Using Lailene here you can see she has a currency attribute with id of 123456
      <?xml version="1.0" encoding="UTF-8"?> <npc name="Lailene" currency="123456" script="lailene.lua" walkinterval="2000" floorchange="0" speechbubble="2"> <health now="100" max="100"/> <look type="279" head="114" body="94" legs="113" feet="114" addons="0"/> </npc>  
      Now any player who has a storage value of 123456 can purchase things from her shop provided they have enough value stored within the storage, similar to having money in the bank.
      The money or in this case the storage value is added and removed from the player in real time.
       
      Lets get to the code
       
      game.cpp
      Find this
      bool Game::removeMoney(Cylinder* cylinder, uint64_t money, uint32_t flags /*= 0*/) Replace the whole function with this.
      bool Game::removeMoney(Cylinder* cylinder, uint64_t money, uint32_t flags /*= 0*/) { if (cylinder == nullptr) { return false; } if (money == 0) { return true; } uint32_t currencyId = 0; Player* player; if (Creature* creature = cylinder->getCreature()) { if (Player* p = creature->getPlayer()) { currencyId = p->getNpcCurrencyId(); player = p; } } if (!currencyId) { std::vector<Container*> containers; std::multimap<uint32_t, Item*> moneyMap; uint64_t moneyCount = 0; for (size_t i = cylinder->getFirstIndex(), j = cylinder->getLastIndex(); i < j; ++i) { Thing* thing = cylinder->getThing(i); if (!thing) { continue; } Item* item = thing->getItem(); if (!item) { continue; } Container* container = item->getContainer(); if (container) { containers.push_back(container); } else { const uint32_t worth = item->getWorth(); if (worth != 0) { moneyCount += worth; moneyMap.emplace(worth, item); } } } size_t i = 0; while (i < containers.size()) { Container* container = containers[i++]; for (Item* item : container->getItemList()) { Container* tmpContainer = item->getContainer(); if (tmpContainer) { containers.push_back(tmpContainer); } else { const uint32_t worth = item->getWorth(); if (worth != 0) { moneyCount += worth; moneyMap.emplace(worth, item); } } } } if (moneyCount < money) { return false; } for (const auto& moneyEntry : moneyMap) { Item* item = moneyEntry.second; if (moneyEntry.first < money) { internalRemoveItem(item); money -= moneyEntry.first; } else if (moneyEntry.first > money) { const uint32_t worth = moneyEntry.first / item->getItemCount(); const uint32_t removeCount = (money / worth) + 1; addMoney(cylinder, (worth * removeCount) - money, flags); internalRemoveItem(item, removeCount); break; } else { internalRemoveItem(item); break; } } } else { int32_t value; player->getStorageValue(currencyId, value); if (value < money) { return false; } player->addStorageValue(currencyId, value - money); } return true; } Next find this
      void Game::addMoney(Cylinder* cylinder, uint64_t money, uint32_t flags /*= 0*/) Replace the whole function with this
      void Game::addMoney(Cylinder* cylinder, uint64_t money, uint32_t flags /*= 0*/) { if (money == 0) { return; } if (Creature* creature = cylinder->getCreature()) { if (Player* player = creature->getPlayer()) { if(uint32_t currencyId = player->getNpcCurrencyId()){ int32_t value; player->getStorageValue(currencyId, value); player->addStorageValue(currencyId, value + money); return; } } } uint32_t crystalCoins = money / 10000; money -= crystalCoins * 10000; while (crystalCoins > 0) { const uint16_t count = std::min<uint32_t>(100, crystalCoins); Item* remaindItem = Item::CreateItem(ITEM_CRYSTAL_COIN, count); ReturnValue ret = internalAddItem(cylinder, remaindItem, INDEX_WHEREEVER, flags); if (ret != RETURNVALUE_NOERROR) { internalAddItem(cylinder->getTile(), remaindItem, INDEX_WHEREEVER, FLAG_NOLIMIT); } crystalCoins -= count; } uint16_t platinumCoins = money / 100; if (platinumCoins != 0) { Item* remaindItem = Item::CreateItem(ITEM_PLATINUM_COIN, platinumCoins); ReturnValue ret = internalAddItem(cylinder, remaindItem, INDEX_WHEREEVER, flags); if (ret != RETURNVALUE_NOERROR) { internalAddItem(cylinder->getTile(), remaindItem, INDEX_WHEREEVER, FLAG_NOLIMIT); } money -= platinumCoins * 100; } if (money != 0) { Item* remaindItem = Item::CreateItem(ITEM_GOLD_COIN, money); ReturnValue ret = internalAddItem(cylinder, remaindItem, INDEX_WHEREEVER, flags); if (ret != RETURNVALUE_NOERROR) { internalAddItem(cylinder->getTile(), remaindItem, INDEX_WHEREEVER, FLAG_NOLIMIT); } } }  
      npc.cpp
      Look for this
      pugi::xml_attribute attr; if ((attr = npcNode.attribute("speed"))) { baseSpeed = pugi::cast<uint32_t>(attr.value()); } else { baseSpeed = 100; } Right underneath that you are going to place this.
      if ((attr = npcNode.attribute("currency"))) { currency = pugi::cast<uint32_t>(attr.value()); }  
      npc.h
      Look for this
      bool isPushable() const final { return walkTicks > 0; } Place this right underneath
      uint32_t getCurrencyId() const { return currency; } Look for this
      uint32_t walkTicks; Place this right underneath
      uint32_t currency;  
      player.cpp
      Find this
      void Player::openShopWindow(Npc* npc, const std::list<ShopInfo>& shop) Replace that function with this
      void Player::openShopWindow(Npc* npc, const std::list<ShopInfo>& shop) { shopItemList = shop; sendShop(npc); sendSaleItemList(npc); } Next find this
      bool Player::updateSaleShopList(const Item* item) Replace that function with this
      bool Player::updateSaleShopList(const Item* item) { uint16_t itemId = item->getID(); if (itemId != ITEM_GOLD_COIN && itemId != ITEM_PLATINUM_COIN && itemId != ITEM_CRYSTAL_COIN) { auto it = std::find_if(shopItemList.begin(), shopItemList.end(), [itemId](const ShopInfo& shopInfo) { return shopInfo.itemId == itemId && shopInfo.sellPrice != 0; }); if (it == shopItemList.end()) { const Container* container = item->getContainer(); if (!container) { return false; } const auto& items = container->getItemList(); return std::any_of(items.begin(), items.end(), [this](const Item* containerItem) { return updateSaleShopList(containerItem); }); } } if (client) { client->sendSaleItemList(shopOwner, shopItemList); } return true; } Next you are going to look for
      uint64_t Player::getMoney() const Now right underneath that function you are going to place these.
      uint64_t Player::getMoney(Npc* npc) const { uint64_t cash; setNpcCurrencyId(npc); uint32_t currencyId = getNpcCurrencyId(); if (currencyId) { int32_t value; getStorageValue(currencyId, value); cash = (uint64_t)value; } else { cash = getMoney(); } return cash; } void Player::setNpcCurrencyId(Npc* npc) const{ currencyId = npc->getCurrencyId(); } uint32_t Player::getNpcCurrencyId() const { return currencyId; }  
      player.h
      Look for this
      uint64_t getMoney() const; Place this right underneath
      uint64_t getMoney(Npc*) const; void setNpcCurrencyId(Npc*) const; uint32_t getNpcCurrencyId() const; Find this
      void sendShop(Npc* npc) const { if (client) { client->sendShop(npc, shopItemList); } } Place this right underneath
      void sendSaleItemList(Npc* npc) const { if (client) { client->sendSaleItemList(npc, shopItemList); } } Find this
      uint32_t manaMax; Place this right underneath
      mutable uint32_t currencyId;  
      protocolgame.cpp
      Now find this function
      void ProtocolGame::sendSaleItemList(const std::list<ShopInfo>& shop) Place this right underneath
      void ProtocolGame::sendSaleItemList(Npc* npc, const std::list<ShopInfo>& shop) { NetworkMessage msg; msg.addByte(0x7B); msg.add<uint64_t>(player->getMoney(npc)); std::map<uint16_t, uint32_t> saleMap; if (shop.size() <= 5) { // For very small shops it's not worth it to create the complete map for (const ShopInfo& shopInfo : shop) { if (shopInfo.sellPrice == 0) { continue; } int8_t subtype = -1; const ItemType& itemType = Item::items[shopInfo.itemId]; if (itemType.hasSubType() && !itemType.stackable) { subtype = (shopInfo.subType == 0 ? -1 : shopInfo.subType); } uint32_t count = player->getItemTypeCount(shopInfo.itemId, subtype); if (count > 0) { saleMap[shopInfo.itemId] = count; } } } else { // Large shop, it's better to get a cached map of all item counts and use it // We need a temporary map since the finished map should only contain items // available in the shop std::map<uint32_t, uint32_t> tempSaleMap; player->getAllItemTypeCount(tempSaleMap); // We must still check manually for the special items that require subtype matches // (That is, fluids such as potions etc., actually these items are very few since // health potions now use their own ID) for (const ShopInfo& shopInfo : shop) { if (shopInfo.sellPrice == 0) { continue; } int8_t subtype = -1; const ItemType& itemType = Item::items[shopInfo.itemId]; if (itemType.hasSubType() && !itemType.stackable) { subtype = (shopInfo.subType == 0 ? -1 : shopInfo.subType); } if (subtype != -1) { uint32_t count; if (!itemType.isFluidContainer() && !itemType.isSplash()) { count = player->getItemTypeCount(shopInfo.itemId, subtype); // This shop item requires extra checks } else { count = subtype; } if (count > 0) { saleMap[shopInfo.itemId] = count; } } else { std::map<uint32_t, uint32_t>::const_iterator findIt = tempSaleMap.find(shopInfo.itemId); if (findIt != tempSaleMap.end() && findIt->second > 0) { saleMap[shopInfo.itemId] = findIt->second; } } } } uint8_t itemsToSend = std::min<size_t>(saleMap.size(), std::numeric_limits<uint8_t>::max()); msg.addByte(itemsToSend); uint8_t i = 0; for (std::map<uint16_t, uint32_t>::const_iterator it = saleMap.begin(); i < itemsToSend; ++it, ++i) { msg.addItemId(it->first); msg.addByte(std::min<uint32_t>(it->second, std::numeric_limits<uint8_t>::max())); } writeToOutputBuffer(msg); }  
      protocolgame.h
      Find this
      void sendSaleItemList(const std::list<ShopInfo>& shop); Place this right underneath
      void sendSaleItemList(Npc* npc, const std::list<ShopInfo>& shop);  
      luascript.cpp
      Find
      int LuaScriptInterface::luaPlayerAddMoney(lua_State* L) Replace that whole function with this
      int LuaScriptInterface::luaPlayerAddMoney(lua_State* L) { // player:addMoney(money[, currencyId]) uint64_t money = getNumber<uint64_t>(L, 2); uint32_t currencyId = getNumber<uint32_t>(L, 3); Player* player = getUserdata<Player>(L, 1); if (player) { if (currencyId) { int32_t value; player->getStorageValue(currencyId, value); player->addStorageValue(currencyId, value + money); } else { g_game.addMoney(player, money); } pushBoolean(L, true); } else { lua_pushnil(L); } return 1; } Next find this function which should be right below it.
      int LuaScriptInterface::luaPlayerRemoveMoney(lua_State* L) Replace that whole function with this
      int LuaScriptInterface::luaPlayerRemoveMoney(lua_State* L) { // player:removeMoney(money[, currencyId]) Player* player = getUserdata<Player>(L, 1); if (player) { uint64_t money = getNumber<uint64_t>(L, 2); uint32_t currencyId = getNumber<uint32_t>(L, 3); if (currencyId) { int32_t value; player->getStorageValue(currencyId, value); if (value < money) { pushBoolean(L, false); return 1; } player->addStorageValue(currencyId, value - money); pushBoolean(L, true); } else { pushBoolean(L, g_game.removeMoney(player, money)); } } else { lua_pushnil(L); } return 1; }  
    • Por Fearlet
      Tibia Infinity
       
      Olá Tibianos, é com grande satisfação e orgulho que apresento a vocês meu novo projeto consistente em diversas ideias para vários temas de servidores alternativos, com o propósito de ser a primeira equipe a desenvolver servidores, onde o servidor e o player tenham rendas num ciclo econômico a ideia principal é um servidor usando no momento apenas nosso dinheiro real BRL, porém futuramente com o capital em mãos criar nosso token TINF.
       
      No momento estamos a procura de colaboradores, desenvolvedores e patrocinadores corajosos afim de enfrentar aventuras e desafios em nossa equipe, procuramos pessoas que tenham disponibilidade de horário, disponibilidade de contato, prontos para trabalharem dedicadamente aos servidores, pessoas com facilidade de trabalho em equipe, trabalho com metas a serem cumpridas e entregues.
       
       
      Quais projetos iniciados está a caminho ?
      Temos três servidores, em desenvolvimento.

       
      TibiaLands – Este servidor é baseado na fazenda feliz para quem já jogou, ou para quem está no mundos dos NFTs uma das formas de farm é igual ao PVU (Plant vs Undead) que consiste também na plantação, mineração, gastronomia e agropecuária e até a caça de presas.
      Tibia Infinity - Servidor de Tibia alternativo baseado no Tibia 7.4. O jogo tem um verdadeiro mapa global 7.4, com todas as missões daquela época e muito mais. O RPG de Tibia Infity vai além. Na época em que Tibia 7.4 (2005) foi jogado, havia uma magia em torno de itens extremamente raros. Pessoas se reúnem ao redor do mapa tentando resolver mistérios que até hoje não foram resolvidos a nostalgia e o tempo gastos valerão a pena. Não há nenhum item intocável. Mas não será fácil, servidor está sendo 24hrs sendo pensado em como será a economia do jogo, pois sabemos que é dificil, dentro de impostos e má intenções de pessoas que existem hoje em dia.
      PokeInfinity – Servidor alternativo de pokémon onde os players entram para duelarem, com torneios diários, recompensas, tokens, porém com a principal ideia do player pagar para adquirir seu time principal e participar de torneios rankeados, para quem já jogo o torneio global (TG) da pokexgames, será basicamente aqui porém o player irá ter uma renda extra caso ele resolva investir em seu time e pense estrategicamente.

       

       
      Quer saber mais do projeto? entre no nosso Discord.
      Quer ser parte da equipe? Entre no nosso discord e chamem o ADM no pv.
      Lippe#7652
       
      https://discord.gg/53KWSBgYUc

      Alguns spoiler de uns dos projetos
       
       

      OBRIGADO A TODOS PELA ATENÇÃO !!!

       

       
    • Por DeCarvalho
      Bem procurei aqui na comunidade um VIP System mais informativo e nada, além de ter tido problema com os que estão aqui e acabei achando em outro lugar um que funcionou perfeitamente para mim.
       
      Usando tfs disponibilizado neste tópico http://www.tibiaking.com/forum/topic/53099-1078-tfs-12-cast-system-novos-outfits-mounts/
       
      Só estou trazendo o conteúdo e por não conhecer bem não posso dar suporte mas do jeito que está é só 'instalar' e vai funcionar.
       
      Creditos.: Summ
       
      Sistema Vip
       



       
      Talkaction !checkvip para todos os players
       



       
      Talkaction /vip para membros da staff
      - /vip adddays, NomedoPlayer, 5 --> Adiciona 5 dias vip para o Player. - /vip removedays, NomedoPlayer, 5 --> Remove 5 dias vip do Player. - /vip remove, PlayerName --> Remove todos os dias vip do Player. - /vip check, NomedoPlayer --> Checa quantos dias vip o Player tem. - /vip addinfinite, NomedoPlayer --> Adiciona tempo vip infinito para o Player.


       
      Tiles VIP



       
      Portas VIP / Actions



       
      Items que adicionam dias VIP
      ItemId 10135 adiciona 10 dias vip. ItemId 10134 adiciona 30 dias vip. ItemId 10133 adiciona 90 dias vip.


       
      Imagens
       
      Comando !checkvip mas sem ter vip



       
      Comando /vip adddays, dracoknight, 5



       
      Comando !checkvip após adicionar 5 dias



       
      Comando /vip addinfinite, dracoknight



       
      Comando !checkvip após usar infinite 



       
      Comando /vip remove, dracoknight



×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo