if getPlayerStorageValue(target, 637500) >= 1 then -- sherdder team
doRemoveCreature(target)
return true
end
local nameDeath = doCorrectString(getCreatureName(target))
local pos = getThingPos(target)
local corpseID = getPokemonCorpse(nameDeath)
local corpse = doCreateItem(corpseID, 1, pos)
if isSummon(cid) then
checkDirias(cid, nameDeath)
end
doItemSetAttribute(corpse, "pokeName", "fainted " .. nameDeath:lower())
doDecayItem(corpse)
local name = getCreatureName(getCreatureMaster(cid))
doCorpseAddLoot(getCreatureName(target), corpse, getCreatureMaster(cid), target)
doRemoveCreature(target)
function doCorpseAddLoot(name, item, cid, target) -- essa func jรก vai ajudar em um held, luck.
if cid == target then
doItemSetAttribute(item, "corpseowner", "asçdlkasçldkaçslkdçaskdçaslkdçlsakdçkaslç")
return true
end -- selfdestruct
local lootList = getMonsterLootList(name)
local isStoneDroped = false
name = doCorrectString(name)
local pokeName = name
local str, vir = "Loot from " .. name .. ": ", 0
local megaID, megaName = "", ""
local lootListNow = {}
if isMega(target) then
if name == "Charizard" then
megaID = getPlayerStorageValue(target, storages.isMegaID)
end
megaName = "Mega " .. name .. (megaID ~= "" and " " .. megaID or "")
str = "Loot from " .. megaName .. ": "
pokeName = megaName
local t = {id = megasConf[megaName].itemToDrop, count = 1, chance = 0.1}
table.insert(lootList, t)
end
local countVirg = 0
for i, _ in pairs(lootList) do
countVirg = countVirg + 1
local id, count, chance = lootList.id, lootList.count, lootList.chance * 2
---- X-Lucky
local heldx = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "xHeldItem")
if heldx then
local heldName, heldTier = string.explode(heldx, "|")[1], string.explode(heldx, "|")[2]
if heldName == "X-Lucky" then -- dar mais loot
chance = chance * heldLucky[tonumber(heldTier)]
end
end
---- X-Lucky
local percent, lootCount = math.random(0.1, 100.9), math.random(1, count)
if (percent <= chance) then
if isStone(id) then
isStoneDroped = true
local posCorpse = getThingPos(item)
posCorpse.x = posCorpse.x +1
doSendMagicEffect(posCorpse, stoneEffect[getItemNameById(id):lower()])
posCorpse.y = posCorpse.y +1
addEvent(doSendMagicEffect, 2000, posCorpse, 285)
end
doAddContainerItem(item, id, lootCount)
table.insert(lootListNow, getItemNameById(id) .. " (" .. lootCount .. ")")
end
end
for i = 1, #lootListNow do
str = str .. lootListNow .. (tonumber(i) == tonumber(#lootListNow) and "." or ", ")
end
if getExpByMoreDano(target) == true then
return true
end
local players = string.explode(getExpByMoreDano(target), "|")
local xp, newXP = getPokemonExperienceD(name), xp
local maiorPercent = 0
local playerWinner = ""
if players ~= nil then
for i = 1, #players do
local name = string.explode(players, "/")[1]
local percent = tonumber(string.explode(players, "/")[2])
if percent > maiorPercent then
playerWinner = name
maiorPercent = percent
end
if #players == 1 then -- caso so um player matou o bixo
percent = 100
end
local heldExp = 1
local player = getPlayerByName(name)
local heldx = getItemAttribute(getPlayerSlotItem(player, 8).uid, "xHeldItem")
if heldx then
local heldName, heldTier = string.explode(heldx, "|")[1], string.explode(heldx, "|")[2]
if heldName == "X-Experience" then -- dar mais experiencia
heldExp = heldExperience[tonumber(heldTier)]
end
end
playerAddExp(player, math.ceil(percent * xp / 100) * heldExp)
end
end
local pWinnerLoot = getPlayerByName(playerWinner)
if isCreature(pWinnerLoot) then
doItemSetAttribute(item, "corpseowner", playerWinner)
local loot = str .. (str == "Loot from ".. name .. ": " and "Nothing." or "")
doPlayerSendTextMessage(pWinnerLoot, MESSAGE_INFO_DESCR, loot)
doSendMsgInParty(cid, loot)
if isStoneDroped then
doSendMagicEffect(getThingPos(pWinnerLoot), 173, pWinnerLoot)
doSendMsg(pWinnerLoot, "Parabéns! O pokemon " .. pokeName .. " dropou uma stone!!!")
--- adicionar efeito em cima do loot
end
end
end
function playerAddExp(cid, exp)
if not isCreature(cid) then return true end
if isInPartyAndSharedExperience(cid) then
local partyPlayers = getPartyMembers(getPlayerParty(cid))
local partyExp = math.ceil(exp / #partyPlayers)
for i = 1, #partyPlayers do
if isPlayer(partyPlayers) then
if getPlayerLevel(partyPlayers) <= 50 then
doplayerAddExp(partyPlayers, math.floor(25 * exp))
doSendAnimatedText(getThingPos(partyPlayers), exp * 25, 215)
elseif getPlayerLevel(partyPlayers) >= 51 and getPlayerLevel(partyPlayers) <= 75 then
doPlayerAddExp(partyPlayers, math.floor(22 * exp))
doSendAnimatedText(getThingPos(partyPlayers), exp * 22, 215)
elseif getPlayerLevel(partyPlayers) >= 76 and getPlayerLevel(partyPlayers) <= 100 then
doPlayerAddExp(partyPlayers, math.floor(22 * exp))
doSendAnimatedText(getThingPos(partyPlayers), exp * 20, 215)
elseif getPlayerLevel(partyPlayers) >= 101 and getPlayerLevel(partyPlayers) <= 150 then
doPlayerAddExp(partyPlayers, math.floor(20 * exp))
doSendAnimatedText(getThingPos(partyPlayers), exp * 15, 215)
elseif getPlayerLevel(partyPlayers) >= 151 and getPlayerLevel(partyPlayers) <= 250 then
doPlayerAddExp(partyPlayers, math.floor(10 * exp))
doSendAnimatedText(getThingPos(partyPlayers), exp * 10, 215)
elseif getPlayerLevel(partyPlayers) >= 251 and getPlayerLevel(partyPlayers) <= 350 then
doPlayerAddExp(partyPlayers, math.floor(5 * exp))
doSendAnimatedText(getThingPos(partyPlayers), exp * 5, 215)
elseif getPlayerLevel(partyPlayers) >= 351 then
doPlayerAddExp(partyPlayers, math.floor(2.5 *exp))
doSendAnimatedText(getThingPos(partyPlayers), exp * 2.5, 215)
end
end
end
return true
end
if getPlayerLevel(cid) <= 50 then
doPlayerAddExp(cid, math.floor(25 * exp))
doSendAnimatedText(getThingPos(cid), exp * 25, 215)
elseif getPlayerLevel(cid) >= 51 and getPlayerLevel(cid) <= 75 then
doPlayerAddExp(cid, math.floor(20 * exp))
doSendAnimatedText(getThingPos(cid), exp * 20, 215)
elseif getPlayerLevel(cid) >= 76 and getPlayerLevel(cid) <= 100 then
doPlayerAddExp(cid, math.floor(15 * exp))
doSendAnimatedText(getThingPos(cid), exp * 15, 215)
elseif getPlayerLevel(cid) >= 101 and getPlayerLevel(cid) <= 250 then
doPlayerAddExp(cid, math.floor(10 * exp))
doSendAnimatedText(getThingPos(cid), exp * 10, 215)
elseif getPlayerLevel(cid) >= 251 and getPlayerLevel(cid) <= 350 then
doPlayerAddExp(cid, math.floor(5 * exp))
doSendAnimatedText(getThingPos(cid), exp * 5, 215)
elseif getPlayerLevel(cid) >= 351 and getPlayerLevel(cid) <= 450 then
doPlayerAddExp(cid, math.floor(4 *exp))
doSendAnimatedText(getThingPos(cid), exp * 4, 215)
elseif getPlayerLevel(cid) >= 451 and getPlayerLevel(cid) <= 550 then
doPlayerAddExp(cid, math.floor(3 *exp))
doSendAnimatedText(getThingPos(cid), exp * 3, 215)
elseif getPlayerLevel(cid) >= 551 then
doPlayerAddExp(cid, math.floor(2 *exp))
doSendAnimatedText(getThingPos(cid), exp * 2, 215)
end
end
function doSendMsgInParty(cid, loot)
if isInPartyAndSharedExperience(cid) then
local partyPlayers = getPartyMembers(getPlayerParty(cid))
for i = 1, #partyPlayers do
if isPlayer(partyPlayers) then
doSendMsgToPartyChannel(partyPlayers, loot)
end
end
return true
end
end
function checkDirias(cid, nameDeath)
local master = getCreatureMaster(cid)
local getNpcTaskName = getPlayerStorageValue(master, storages.miniQuests.storNpcTaskName)
local pokeTask1 = getPlayerStorageValue(master, storages.miniQuests.storPokeNameTask1)
local pokeCountTask1 = tonumber(getPlayerStorageValue(master, storages.miniQuests.storPokeCountTask1))
if pokeTask1 ~= -1 and pokeTask1 == nameDeath then
setPlayerStorageValue(master, storages.miniQuests.storPokeCountTask1, pokeCountTask1 -1)
local getCountNow = tonumber(getPlayerStorageValue(master, storages.miniQuests.storPokeCountTask1))
if getCountNow >= 1 then
doSendMsg(master, getNpcTaskName .. ": Faltam " .. getCountNow .. " " .. nameDeath .. (getCountNow > 1 and "s" or "") .. ".")
else
doSendMsg(master, getNpcTaskName .. ": Vocꡪᡣoncluiu minha task venha pegar sua recompensa.")
end
end
local getNpcTaskName2 = getPlayerStorageValue(master, storages.miniQuests.storNpcTaskName2)
local pokeTask2 = getPlayerStorageValue(master, storages.miniQuests.storPokeNameTask2)
local pokeCountTask2 = tonumber(getPlayerStorageValue(master, storages.miniQuests.storPokeCountTask2))
if pokeTask2 ~= -1 and pokeTask2 == nameDeath then
setPlayerStorageValue(master, storages.miniQuests.storPokeCountTask2, pokeCountTask2 -1)
local getCountNow2 = tonumber(getPlayerStorageValue(master, storages.miniQuests.storPokeCountTask2))
if getCountNow2 >= 1 then
doSendMsg(master, getNpcTaskName2 .. ": Faltam " .. getCountNow2 .. " " .. nameDeath .. (getCountNow2 > 1 and "s" or "") .. ".")
else
doSendMsg(master, getNpcTaskName2 .. ": Vocꡪᡣoncluiu minha task venha pegar sua recompensa.")
end
end
local getNpcTaskName3 = getPlayerStorageValue(master, storages.miniQuests.storNpcTaskName3)
local pokeTask3 = getPlayerStorageValue(master, storages.miniQuests.storPokeNameTask3)
local pokeCountTask3 = tonumber(getPlayerStorageValue(master, storages.miniQuests.storPokeCountTask3))
if pokeTask3 ~= -1 and pokeTask3 == nameDeath then
setPlayerStorageValue(master, storages.miniQuests.storPokeCountTask3, pokeCountTask3 -1)
local getCountNow3 = tonumber(getPlayerStorageValue(master, storages.miniQuests.storPokeCountTask3))
if getCountNow3 >= 1 then
doSendMsg(master, getNpcTaskName3 .. ": Faltam " .. getCountNow3 .. " " .. nameDeath .. (getCountNow3 > 1 and "s" or "") .. ".")
else
doSendMsg(master, getNpcTaskName3 .. ": Vocꡪᡣoncluiu minha task venha pegar sua recompensa.")
end
end
local getNpcTaskName4 = getPlayerStorageValue(master, storages.miniQuests.storNpcTaskName4)
local pokeTask4 = getPlayerStorageValue(master, storages.miniQuests.storPokeNameTask4)
local pokeCountTask4 = tonumber(getPlayerStorageValue(master, storages.miniQuests.storPokeCountTask4))
if pokeTask4 ~= -1 and pokeTask4 == nameDeath then
setPlayerStorageValue(master, storages.miniQuests.storPokeCountTask4, pokeCountTask4 -1)
local getCountNow4 = tonumber(getPlayerStorageValue(master, storages.miniQuests.storPokeCountTask4))
if getCountNow4 >= 1 then
doSendMsg(master, getNpcTaskName4 .. ": Faltam " .. getCountNow4 .. " " .. nameDeath .. (getCountNow4 > 1 and "s" or "") .. ".")
else
doSendMsg(master, getNpcTaskName4 .. ": Vocꡪᡣoncluiu minha task venha pegar sua recompensa.")
end
end
end
info
Grupo: Campones
Registrado: 06/10/12
Posts: 80
Reputação: 0
Char no Tibia: Lian Colbert
O servidor é Base [DxP] Evolution Server
Sempre que eu mato algum pokemon no servidor aparece essa mensagem :
Meu pokeDeath.lua está assim :
Se alguem poder ajudar ... REP +++