- 0
Modificar sistema de reward system
-
Quem Está Navegando 0 membros estão online
- Nenhum usuário registrado visualizando esta página.
-
Conteúdo Similar
-
- 0 respostas
- 314 visualizações
-
- 6 respostas
- 364 visualizações
-
- 0 respostas
- 1331 visualizações
-
- 1 resposta
- 1349 visualizações
-
- 0 respostas
- 1798 visualizações
-
Pergunta
brendoonh 15
Boa noite comunidade!
Encontrei um sistema de reward system que ao matar um monstro ele tem niveis de loot, sendo ele comum, raro, semi raro, muito raro e uma opção SEMPRE, esse sempre so dropa para uma pessoa, porem, eu queria colocar que esse sempre fosse apenas para o jogador que da o ultimo hit no monstro, isso seria possivel?
data/sistemas/rewardchest
-- Sistema de recompensa criado por luanluciano93 REWARDCHEST = { rewardBagId = 2595, formula = {hit = 3, block = 3, suport = 7}, storageExaust = 60000, town_id = 1, bosses = { ["king of baiak"] = -- todo o nome do boss em letras minúsculas. { comum = { {8302, 1, 100}, -- dodge {8303, 1, 100}, -- critical {8301, 1, 100}, -- ppoint {2160, 100, 100}, -- crystal coin {9971, 10, 100}, -- diamond coin {2798, 10, 100}, -- blood herb {12609, 1, 100}, -- linx wand {12362, 1, 100}, -- linx rp {7959, 1, 100}, -- linx sword {7434, 1, 100}, -- linx axe {12631, 1, 100}, -- linx club }, semi_raro = { {9971, 15, 100}, -- diamond coin {7140, 1, 100}, -- mead horn {7488, 1, 100}, -- stamina potion {8310, 2, 100}, -- roullet coin {2366, 1, 100}, -- removedor de frags }, raro = { {8929, 1, 100}, -- dragon elite club {8293, 1, 100}, -- dragon elite axe {8932, 1, 100}, -- dragon elite sword {7958, 1, 100}, -- dragon mage staff {8858, 1, 100}, -- dragon archer crossbow {2662, 1, 100}, -- dragon mage {8866, 1, 100}, -- dragon mage {7730, 1, 100}, -- dragon mage {11113, 1, 100}, -- dragon mage {3972, 1, 100}, -- dragon ek {2505, 1, 100}, -- dragon ek {2507, 1, 100}, -- dragon ek {2644, 1, 100}, -- dragon ek {7458, 1, 100}, -- dragon rp {7463, 1, 100}, -- dragon rp {7464, 1, 100}, -- dragon rp {9931, 1, 100}, -- dragon rp }, muito_raro = { {5015, 1, 100}, -- mandrake {5804, 1, 100}, -- nose ring {5919, 1, 100}, -- dragon claw {5809, 1, 100}, -- soul stone {12621, 1, 100}, -- exp potion {12634, 1, 100}, -- bag you mysterious {12635, 1, 100}, -- bag you dragon {12636, 1, 100}, -- bag you legend }, sempre = { {5805, 1, 100}, -- goldne goblt }, storage = 65479, }, ["astaroth"] = -- nome do boss em todo em letras minísculas { comum = { {8302, 1, 100}, -- dodge {8303, 1, 100}, -- critical {8301, 1, 100}, -- ppoint {2160, 100, 100}, -- crystal coin {9971, 10, 100}, -- diamond coin {2798, 10, 100}, -- blood herb {12609, 1, 100}, -- linx wand {12362, 1, 100}, -- linx rp {7959, 1, 100}, -- linx sword {7434, 1, 100}, -- linx axe {12631, 1, 100}, -- linx club }, semi_raro = { {9971, 15, 100}, -- diamond coin {7140, 1, 100}, -- mead horn {7488, 1, 100}, -- stamina potion {8310, 2, 100}, -- roullet coin {2366, 1, 100}, -- removedor de frags }, raro = { {8929, 1, 100}, -- dragon elite club {8293, 1, 100}, -- dragon elite axe {8932, 1, 100}, -- dragon elite sword {7958, 1, 100}, -- dragon mage staff {8858, 1, 100}, -- dragon archer crossbow {2662, 1, 100}, -- dragon mage {8866, 1, 100}, -- dragon mage {7730, 1, 100}, -- dragon mage {11113, 1, 100}, -- dragon mage {3972, 1, 100}, -- dragon ek {2505, 1, 100}, -- dragon ek {2507, 1, 100}, -- dragon ek {2644, 1, 100}, -- dragon ek {7458, 1, 100}, -- dragon rp {7463, 1, 100}, -- dragon rp {7464, 1, 100}, -- dragon rp {9931, 1, 100}, -- dragon rp }, muito_raro = { {5015, 1, 100}, -- mandrake {5804, 1, 100}, -- nose ring {5919, 1, 100}, -- dragon claw {5809, 1, 100}, -- soul stone {12621, 1, 100}, -- exp potion {12634, 1, 100}, -- bag you mysterious {12635, 1, 100}, -- bag you dragon {12636, 1, 100}, -- bag you legend }, sempre = { {5805, 1, 100}, -- goldne goblt }, storage = 65480, }, ["legendary ferumbras"] = -- todo o nome do boss em letras minúsculas. { comum = { {8302, 1, 100}, -- dodge {8303, 1, 100}, -- critical {8301, 1, 100}, -- ppoint {2160, 100, 100}, -- crystal coin {9971, 10, 100}, -- diamond coin {2798, 10, 100}, -- blood herb {12609, 1, 100}, -- linx wand {12362, 1, 100}, -- linx rp {7959, 1, 100}, -- linx sword {7434, 1, 100}, -- linx axe {12631, 1, 100}, -- linx club }, semi_raro = { {9971, 15, 100}, -- diamond coin {7140, 1, 100}, -- mead horn {7488, 1, 100}, -- stamina potion {8310, 2, 100}, -- roullet coin {2366, 1, 100}, -- removedor de frags }, raro = { {8929, 1, 100}, -- dragon elite club {8293, 1, 100}, -- dragon elite axe {8932, 1, 100}, -- dragon elite sword {7958, 1, 100}, -- dragon mage staff {8858, 1, 100}, -- dragon archer crossbow {2662, 1, 100}, -- dragon mage {8866, 1, 100}, -- dragon mage {7730, 1, 100}, -- dragon mage {11113, 1, 100}, -- dragon mage {3972, 1, 100}, -- dragon ek {2505, 1, 100}, -- dragon ek {2507, 1, 100}, -- dragon ek {2644, 1, 100}, -- dragon ek {7458, 1, 100}, -- dragon rp {7463, 1, 100}, -- dragon rp {7464, 1, 100}, -- dragon rp {9931, 1, 100}, -- dragon rp }, muito_raro = { {5015, 1, 100}, -- mandrake {5804, 1, 100}, -- nose ring {5919, 1, 100}, -- dragon claw {5809, 1, 100}, -- soul stone {12621, 1, 100}, -- exp potion {12634, 1, 100}, -- bag you mysterious {12635, 1, 100}, -- bag you dragon {12636, 1, 100}, -- bag you legend }, sempre = { {5903, 1, 100}, -- ferumbras'hat }, storage = 65481, }, ["azazel"] = -- todo o nome do boss em letras minúsculas. { comum = { {2158, 1, 100}, -- blue gem {2156, 1, 100}, -- red gem {2155, 1, 100}, -- green gem {2154, 1, 100}, -- yellow gem {2153, 1, 100}, -- violet gem }, semi_raro = { {5944, 5, 100}, -- soul orb }, raro = { {2514, 1, 100}, -- mastermind shield }, muito_raro = { {11114, 1, 100}, -- dragon scale boots {8882, 1, 100}, -- earthborn titan armor }, sempre = { {2152, 90, 100}, -- platinum coin {9971, 5, 100}, -- gold ingot }, storage = 65482, }, ["verminor"] = -- todo o nome do boss em letras minúsculas. { comum = { {2143, 10, 100}, -- white pearl {2146, 10, 100}, -- small sapphire {2145, 10, 100}, -- small diamond {2144, 10, 100}, -- black pearl {2149, 10, 100}, -- small emeralds {5954, 3, 100}, -- demon horn {7896, 1, 100}, -- glacier kilt {2432, 1, 100}, -- fire axe {2462, 1, 100}, -- devil helmet {7590, 1, 100}, -- great mana potion {2179, 1, 100}, -- gold ring {2151, 1, 100}, -- talon }, semi_raro = { {2195, 1, 100}, -- boots of haste {2393, 1, 100}, -- giant sword {5954, 5, 100}, -- demon horn {2123, 1, 100}, -- ring of the sky }, raro = { {8886, 1, 100}, -- molten plate {2472, 1, 100}, -- magic plate armor {8867, 1, 100}, -- dragon robe {2514, 1, 100}, -- mastermind shield {2520, 1, 100}, -- demon shield {1982, 1, 100}, -- purple tome {8851, 1, 100}, -- Royal Crossbow }, muito_raro = { {2421, 1, 100}, -- thunder hammer {2522, 1, 100}, -- great shield {8850, 1, 100}, -- chain bolter }, sempre = { {5943, 1, 100}, -- morgaroths brain {2171, 1, 100}, -- platinum amulet {2148, 90, 100}, -- gold coin {2146, 10, 100}, -- small sapphire }, storage = 65483, }, } }
rewardchest_boss
dofile('data/sistemas/rewardchest.lua') local function addRewardLoot(uid, bossName, tabela_reward) local money = math.random(10, 100) local msg = "Um parcel foi enviado para o seu depot com os seguintes itens:" local chest = doCreateItemEx(REWARDCHEST.rewardBagId) doItemSetAttribute(chest, "description", "Recompensa por ajudar na batalha contra: ".. bossName ..".") if table.maxn(tabela_reward) > 0 then for x = 1, table.maxn(tabela_reward) do local rand = math.random(100) if rand <= tabela_reward[x][3] then local count = math.random(1, tabela_reward[x][2]) doAddContainerItem(chest, tabela_reward[x][1], count) msg = msg .. " ".. (count > 1 and count or "") .." "..getItemNameById(tabela_reward[x][1]).."," end end doPlayerSendTextMessage(uid, MESSAGE_INFO_DESCR, msg .. " and ".. money .." platinum coins.") else doPlayerSendTextMessage(uid, MESSAGE_INFO_DESCR, msg .. " ".. money .." platinum coins.") end doAddContainerItem(chest, 2160, money) doPlayerSendMailByName(getPlayerName(uid), chest, REWARDCHEST.town_id) local boss = REWARDCHEST.bosses[bossName] setPlayerStorageValue(uid, boss.storage, 0) doSendMagicEffect(getPlayerPosition(uid), CONST_ME_MAGIC_BLUE) end local function addLoot(tabela_loot, tabela_reward, all_loot) if table.maxn(tabela_loot) > 0 then if all_loot then for x = 1, table.maxn(tabela_loot) do table.insert(tabela_reward, tabela_loot[x]) end else table.insert(tabela_reward, tabela_loot[math.random(table.maxn(tabela_loot))]) end end return tabela_reward end local function rewardChestSystem(bossName) local players = {} local boss = REWARDCHEST.bosses[bossName] for _, uid in ipairs(getPlayersOnline()) do if getPlayerStorageValue(uid, boss.storage) > 0 then table.insert(players, uid) end end table.sort(players, function(a, b) return getPlayerStorageValue(a, boss.storage) > getPlayerStorageValue(b, boss.storage) end) local porcentagem = math.ceil(getPlayerStorageValue(players[1], boss.storage)) for i = 1, table.maxn(players) do local tabela_reward = {} local pontos = getPlayerStorageValue(players[i], boss.storage) if i == 1 then addLoot(boss.comum, tabela_reward, false) addLoot(boss.semi_raro, tabela_reward, false) addLoot(boss.raro, tabela_reward, false) addLoot(boss.sempre, tabela_reward, true) elseif i >= 2 and pontos >= math.ceil((porcentagem * 0.8)) then addLoot(boss.comum, tabela_reward, false) addLoot(boss.semi_raro, tabela_reward, false) addLoot(boss.raro, tabela_reward, false) addLoot(boss.muito_raro, tabela_reward, false) elseif pontos < math.ceil((porcentagem * 0.8)) and pontos >= math.ceil((porcentagem * 0.6)) then addLoot(boss.comum, tabela_reward, false) addLoot(boss.semi_raro, tabela_reward, false) addLoot(boss.raro, tabela_reward, false) elseif pontos < math.ceil((porcentagem * 0.6)) and pontos >= math.ceil((porcentagem * 0.4)) then addLoot(boss.comum, tabela_reward, false) addLoot(boss.semi_raro, tabela_reward, false) elseif pontos < math.ceil((porcentagem * 0.4)) and pontos >= math.ceil((porcentagem * 0.1)) then addLoot(boss.comum, tabela_reward, false) end addRewardLoot(players[i], bossName, tabela_reward) end end function onDeath(cid, corpse, killer) local boss = REWARDCHEST.bosses[getCreatureName(cid):lower()] if boss then addEvent(rewardChestSystem, 1000, getCreatureName(cid):lower()) end return true end function onStatsChange(cid, attacker, type, combat, value) if isMonster(cid) and type == STATSCHANGE_HEALTHLOSS and isPlayer(attacker) then local boss = REWARDCHEST.bosses[getCreatureName(cid):lower()] if boss and attacker then setPlayerStorageValue(attacker, boss.storage, getPlayerStorageValue(attacker, boss.storage) + math.ceil((value / REWARDCHEST.formula.hit))) end end return true end
rechardchest_pontos
dofile('data/sistemas/rewardchest.lua') function onLogin(cid) for key, value in pairs(REWARDCHEST.bosses) do if getPlayerStorageValue(cid, value.storage) > 0 then setPlayerStorageValue(cid, value.storage, 0) end end registerCreatureEvent(cid, "RewardChestStats") return true end function onStatsChange(cid, attacker, type, combat, value) if isMonster(attacker) and (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS) then local boss = REWARDCHEST.bosses[getCreatureName(attacker):lower()] if boss then setPlayerStorageValue(cid, boss.storage, getPlayerStorageValue(cid, boss.storage) + math.ceil((value / REWARDCHEST.formula.block))) setPlayerStorageValue(cid, REWARDCHEST.storageExaust, os.time() + 5) end elseif (isPlayer(attacker) and (type == STATSCHANGE_HEALTHGAIN or type == STATSCHANGE_MANAGAIN) and (getCreatureHealth(cid) < getCreatureMaxHealth(cid)) and (getPlayerStorageValue(cid, REWARDCHEST.storageExaust) >= os.time())) then for key, valor in pairs(REWARDCHEST.bosses) do if getPlayerStorageValue(cid, valor.storage) > 0 then if getCreatureHealth(cid) + value > getCreatureMaxHealth(cid) then local add = getCreatureMaxHealth(cid) - getCreatureHealth(cid) setPlayerStorageValue(attacker, valor.storage, getPlayerStorageValue(attacker, valor.storage) + math.ceil((add / REWARDCHEST.formula.suport))) else setPlayerStorageValue(attacker, valor.storage, getPlayerStorageValue(attacker, valor.storage) + math.ceil((value / REWARDCHEST.formula.suport))) end end end end return true end
Link para o comentário
https://xtibia.com/forum/topic/259986-modificar-sistema-de-reward-system/Compartilhar em outros sites
0 respostass a esta questão
Posts Recomendados