Histórico de Curtidas
-
Tokias deu reputação a Lurk em [0.4] Evento Click UpSalve pessoal, eu amo tibia e a comunidade já me deu muito, hoje finalmente sinto que posso dar algo de volta e vou estar disponibilizando esse código pra evento que eu fiz pro meu servidor. Esse código pode ser melhorado bastante mas é funcional e acredito ter pensando em todas as possibilidades de abuso e ter corrigido, ainda assim caso você faça alguma melhora por favor compartilhe aqui nos comentários :). Vou disponibilizar também a hotkey de elfbot no fim do tópico.
Durante o evento (duração de 15 min que você pode diminuir/aumentar), quando um player clica no item ele vai receber x leveis e a cada 2 clicks ele vai ganhar um item (no meu caso, uma event coin). Tem um exhaust de 2 secs a cada click pra evitar abuso com elfbot/auto click e eu não recomendo tirar, embora você possa diminuir/aumentar tranquilamente
Em globalevents.xml adicione
<globalevent name="clickupstart" time="19:00" event="script" value="clickupstart.lua"/> <globalevent name="clickupclose" time="19:15" event="script" value="clickupend.lua"/>
Em globalevents/scripts crie um novo arquivo e nomeie de clickupend.lua e cole isso dentro
local storage = 64242 -- storage function onTime() setGlobalStorageValue (storage, -1) doBroadcastMessage("THE CLICK UP EVENT HAS ENDED") return true end Ainda em globalevents/scripts crie um novo arquivo e nomeie de clickupstart.lua e cole isso dentro
local storage = 64242 -- storage que você quer zerar. function onTime() setGlobalStorageValue (storage, 1) doBroadcastMessage("THE CLICK UP EVENT HAS STARTED") return true end Agora em actions.xml adicione a tag
<action actionid="42113" script="clickup.lua"/> Em actions/scripts crie um arquivo chamado clickup.lua e cole isso dentro
local tempo = 2 -- segundos para usar novamente function onUse(cid, item, frompos, item2, topos) if getGlobalStorageValue(64242) == 1 then if getPlayerStorageValue(cid, 45890) > os.time() or getPlayerLevel(cid) >= 717217 then -- se estiver no cooldown ou se for level maximo return doPlayerSendCancel(cid, "Voce deve esperar "..(getPlayerStorageValue(cid, 45890) - os.time()).. " segundos para usar novamente e nao pode ser nivel maximo.") end if getPlayerStorageValue(cid, 45891) < 1 then doPlayerAddLevel(cid, 32) doCreatureSay(cid, "LEVEL UP", TALKTYPE_ORANGE_1, true, cid) setPlayerStorageValue(cid, 45890, 2 + os.time()) local bah = getPlayerStorageValue(cid, 45891) doPlayerSetStorageValue(cid, 45891, bah+1) return true else doPlayerAddLevel(cid, 32) doCreatureSay(cid, "LEVEL UP + EVENT COIN", TALKTYPE_ORANGE_1, true, cid) doPlayerAddItem(cid,10558,1) setPlayerStorageValue(cid, 45890, 2 + os.time()) doPlayerSetStorageValue(cid, 45891, -1) return true end else -- msg quando o evento não ta rolando return doPlayerSendCancel(cid, "The event haven't started yet.") end end Agora você abre seu mapa, cria uma area pro evento e você coloca a actions 42113 na statua/pedra/cristal que o player vai precisar dar use pra ganhar os leveis (eu uso o id 9779)
NÃO SE ESQUEÇA QUE A HOTKEY DE ELFBOT VAI MUDAR SE VOCÊ NÃO USAR O MESMO ID QUE EU
auto 200 listas 'Evento' | usegrounditem 8865
-
Tokias deu reputação a Fir3element em (Resolvido)[PEDIDO] Hp / Mp por porcentagem %%Troca toda a função AddPlayerStats por essa:
void ProtocolGame::AddPlayerStats(NetworkMessage_ptr msg) { msg->AddByte(0xA0); if (player->getPlayerInfo(PLAYERINFO_MAXHEALTH) > 0) { msg->AddU16(uint16_t(player->getHealth() * 100 / player->getPlayerInfo(PLAYERINFO_MAXHEALTH))); msg->AddU16(100); } else { msg->AddU16(0); msg->AddU16(0); } msg->AddU32(uint32_t(player->getFreeCapacity() * 100)); uint64_t experience = player->getExperience(); if(experience > 0x7FFFFFFF) // client debugs after 2,147,483,647 exp msg->AddU32(0x7FFFFFFF); else msg->AddU32(experience); msg->AddU16(player->getPlayerInfo(PLAYERINFO_LEVEL)); msg->AddByte(player->getPlayerInfo(PLAYERINFO_LEVELPERCENT)); if (player->getPlayerInfo(PLAYERINFO_MAXMANA) > 0) { msg->AddU16(player->getPlayerInfo(PLAYERINFO_MANA) * 100 / player->getPlayerInfo(PLAYERINFO_MAXMANA)); msg->AddU16(100); } else { msg->AddU16(0); msg->AddU16(0); } msg->AddByte(player->getPlayerInfo(PLAYERINFO_MAGICLEVEL)); msg->AddByte(player->getPlayerInfo(PLAYERINFO_MAGICLEVELPERCENT)); msg->AddByte(player->getPlayerInfo(PLAYERINFO_SOUL)); msg->AddU16(player->getStaminaMinutes()); } -
Tokias deu reputação a Mathias Kenfi em [Loot Channel] -- Tutorial como adicionar Loot Channel[TESTADO EM OTX 2.1+] 8.60
[TESTADO EM TFS 0.3.6] 8.54 ~ 8.60
Créditos: ~Mathias Kenfi
-
Tokias deu reputação a premii em Erro no script eggs de expOlá, como não informou a versão que utiliza seu servidor, deduzi ser 0.4 faça o teste com esse abaixo:
Script aqui
local potions = {
[6541] = {needLevel = 100, rate = 3.0, duration = 1800},
[6542] = {needLevel = 200, rate = 5.0, duration = 1800},
[6543] = {needLevel = 300, rate = 7.0, duration = 1800},
[6544] = {needLevel = 400, rate = 9.0, duration = 1800},
[6545] = {needLevel = 500, rate = 11.0, duration = 1800},
[2328] = {needLevel = 550, rate = 13.0, duration = 1800},
}
if not expPotions then
expPotions = {playerData = {}}
end
function expPotions:onUse(cid, item, fromPosition, itemEx, toPosition)
local itemId = item.itemid
local potion = potions[itemId]
if not potion then
return false
end
if getPlayerLevel(cid) < potion.needLevel then
doPlayerSendCancel(cid, ('Você precisa ser level %d+ para usar esta potion.'):format(potion.needLevel))
return true
end
local guid = getPlayerGUID(cid)
-- Verifica se o playerData do player existe
if not self.playerData[guid] then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'É necessário relogar para atualizar.')
return true
end
local expData = self.playerData[guid][itemId]
-- Verifica se a entrada para o item existe
if not expData then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'É necessário relogar para atualizar.')
return true
end
local now = os.time()
if expData.duration > now then
doCreatureSay(cid, 'Aguarde o bônus atual acabar para usar novamente.', TALKTYPE_ORANGE_1, false, cid)
return true
end
expData.rate = potion.rate -- aplica apenas o novo bônus
expData.duration = now + potion.duration
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, ('Agora você tem +%d%% de experiência por %s.'):format(
potion.rate * 100, string.diff(potion.duration, true)
))
doRemoveItem(item.uid, 1)
return true
end
function expPotions:onLogin(cid)
local guid = getPlayerGUID(cid)
self.playerData[guid] = {}
for itemId in pairs(potions) do
self.playerData[guid][itemId] = {rate = 0, duration = 0}
end
return true
end
function expPotions:getCombo(cid)
local playerData = self.playerData[getPlayerGUID(cid)]
local potionsCombo = 1
if playerData then
for _, expData in pairs(playerData) do
potionsCombo = potionsCombo + expData.rate
end
end
return potionsCombo
end
function expPotions:onSay(cid, words, param)
local str = 'Experience Potion Combos:\n'
local playerData = self.playerData[getPlayerGUID(cid)]
if playerData then
for itemId, expData in pairs(playerData) do
str = str .. ('\n%s - %d%%'):format(getItemInfo(itemId).name, expData.rate * 100)
end
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
return true
end
-
Tokias deu reputação a chaito.soft em [8.60] Exp Weekend EventOlá pessoal, este sistema já existe nas versões +9.86, porém para 8.60 ainda não existia então decidimos por faze-lo e distribuir ele para a comunidade.
Criticas construtivas são sempre bem vindas
Imagem da Página Web
A imagem da página web que acompanha o sistema já explica como o sistema funciona e como ele está pré-instalado.
Arquivos
Crie uma arquivo em data/lib chamado weekend_exp.lua e insira o código abaixo dentro:
config_weekend_exp = { dates = {"Tuesday", "Wednesday"}, -- Dias da semana que será ativo rates = { {1, 1.05}, -- {quantidade de jogador online, taxa de bonus} {200, 1.10}, {300, 1.15}, }, storage_bonus = 30303, } function get_bonus_weekend_exp() for _, rate in ipairs(config_weekend_exp.rates) do if #getPlayersOnline() >= rate[1] then if getGlobalStorageValue(config_weekend_exp.storage_bonus) ~= 1 then doBroadcastMessage("[Weekend Exp Event] The server reached "..rate[1].." players online! The bonus of exp is now "..((rate[2] - 1)*100).."%!") end setGlobalStorageValue(config_weekend_exp.storage_bonus, 1) --Bonus ativado return rate[2] --retornando a taxa de exp que deve ser adicionada else setGlobalStorageValue(config_weekend_exp.storage_bonus, -1) end end return 1 end function set_bonus_weekend_exp(cid, monster_name) local rate_bonus = get_bonus_weekend_exp() local monster = getMonsterInfo(monster_name) if getGlobalStorageValue(config_weekend_exp.storage_bonus) == 1 then if getConfigValue("experienceStages") == true then doPlayerAddExp(cid, (monster.experience * getExperienceStage(getPlayerLevel(cid))) * rate_bonus) doPlayerSendTextMessage(cid, 25, "[Weekend Exp Event] Voce esta com "..((rate_bonus - 1)*100).."% de bonus experiencia.") end end return true end Crie uma arquivo em data/creaturescripts chamado weekend_exp.lua e insira o código abaixo dentro:
function onKill(cid, target, lastHit) if lastHit and isMonster(target) then local master = getCreatureMaster(target) if not master or master == target then set_bonus_weekend_exp(cid, getCreatureName(target)) end end return true end
Crie uma arquivo em data/globalevents chamado weekend_exp.lua e insira o código abaixo dentro:
function onThink() if table.find(config_weekend_exp.dates, os.date("%A")) then get_bonus_weekend_exp() end return true end Siga até o diretório data/creaturescripts e adiciona a linha abaixo no arquivo login.lua:
registerCreatureEvent(cid, "weekend_exp")
Tags XML
Adicione cada tag em seu respectivo lugar.
creaturescripts.xml
<event type="kill" name="weekend_exp" event="script" value="weekend_exp.lua"/> globalevents.xml
<globalevent name="weekend_exp" interval="55000" event="script" value="weekend_exp.lua"/> Páǵina PHP
Compatível com versões gesior.
<?php $main_content .= ' <center> <h2>Weekend Experience Event</h2> </br> Este é um <b>evento automático</b> que é ativado todo final de semana, começando no sábado e terminando no final de domingo. Quando o server atingir uma determinada quantidade de jogadores online, irá ativar um bonus de exp específico, O mesmo vale para quando o servidor diminuir de players, o bonus irá diminuir de acordo com a tabela, confira a seguir. </center> </br> <table width="100%" border="0" cellpadding="4" cellspacing="1"> <tbody> <tr> <td colspan="3" bgcolor="#d4c0a1"> A partir de <b>50 jogadores online</b>, o bonus de exp será de <b>2%</b>. </td> </tr> <tr> <td colspan="3" bgcolor="#f1e0c6"> A partir de <b>100 jogadores online</b>, o bonus de exp será de <b>5%</b>. </td> </tr> <tr> <td colspan="3" bgcolor="#d4c0a1"> A partir de <b>150 jogadores online</b>, o bonus de exp será de <b>10%</b>. </td> </tr> <tr> <td colspan="3" bgcolor="#f1e0c6"> A partir de <b>200 jogadores online</b>, o bonus de exp será de <b>15%</b>. </td> </tr> <tr> <td colspan="3" bgcolor="#d4c0a1"> A partir de <b>300 jogadores online</b>, o bonus de exp será de <b>20%</b>. </td> </tr> </tbody> </table> </br> Quando atingir determinada quantidade de players online, uma mensagem automática será enviada, por exemplo quando atingir 1000:<br><br> <b>Weekend Event:</b> The server reached 1000 players online! The bonus of exp is now 2%!.<br><br> Se vocês forem calcular a porcentagem, podem ver que não é nada exagerado, por exemplo, bonus de 6%: Se ao matar um monstro você for ganhar 2000 de exp, com 6% de bonus você irá ganhar 2120.</font> </br> <center>Desenvolvido por <a href="http://chaitosoft.com/">ChaitoSoft.com</a>.</center> '; ?>
Acho que não tem créditos, se alguém souber o nome do idealizador do sistema deixe no comentário.