Skip to content

Commit

Permalink
Update 29/10/2019
Browse files Browse the repository at this point in the history
• Adicionado daily quest (prêmios ainda não configurados).
• Ajustes nos eventos duca, battlefield e zombie.
• Adicionado a função splitTrimmed (TFS).
• Reajustado o save para cada 3 horas na função onTimer (retirado função onThink).
• Reajuste na função withdrawMoney.
• Reajstado vários scripts com funções antigas (compat.lua).
• Fixado vários monstros (TFS).
• Adicionado NPC que vende items por event coins.
• Ajustes na pasta das quests.
• Vários outros ajustes no mapa e no datapack.
  • Loading branch information
luanluciano93 committed Oct 29, 2019
1 parent 6399073 commit 2a58f31
Show file tree
Hide file tree
Showing 84 changed files with 343 additions and 281 deletions.
37 changes: 19 additions & 18 deletions data/actions/actions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,24 @@

<!-- Quests -->
<action actionid="2000" script="custom/system.lua" />
<action uniqueid="7000" script="quests/annihilator_lever.lua" />
<action uniqueid="2494" script="quests/annihilator_reward.lua" /> <!-- demon armor -->
<action uniqueid="2400" script="quests/annihilator_reward.lua" /> <!-- magic sword -->
<action uniqueid="2431" script="quests/annihilator_reward.lua" /> <!-- stonecutter axe -->
<action uniqueid="2421" script="quests/annihilator_reward.lua" /> <!-- thunder hammer -->
<action uniqueid="7001" script="quests/demonhelmet_lever.lua" />
<action uniqueid="2493" script="quests/demonhelmet_reward.lua" /> <!-- demon helmet -->
<action uniqueid="2520" script="quests/demonhelmet_reward.lua" /> <!-- demon shield -->
<action uniqueid="2645" script="quests/demonhelmet_reward.lua" /> <!-- steel boots -->
<action uniqueid="8883" script="quests/bigquest.lua" /> <!-- windborn colossus armor -->
<action uniqueid="8869" script="quests/bigquest.lua" /> <!-- greenwood coat -->
<action uniqueid="8867" script="quests/bigquest.lua" /> <!-- dragon robe -->
<action uniqueid="8853" script="quests/bigquest.lua" /> <!-- the ironworker -->
<action uniqueid="2453" script="quests/poi_reward.lua" /> <!-- arcane staff -->
<action uniqueid="6528" script="quests/poi_reward.lua" /> <!-- avenger -->
<action uniqueid="5803" script="quests/poi_reward.lua" /> <!-- arbalest -->
<action fromuid="7003" touid="7006" script="quests/poi_vocations_door.lua" />
<action fromuid="7011" touid="7013" script="quests/daily_quest.lua" />
<action uniqueid="7000" script="quests/annihilator/annihilator_lever.lua" />
<action uniqueid="2494" script="quests/annihilator/annihilator_reward.lua" /> <!-- demon armor -->
<action uniqueid="2400" script="quests/annihilator/annihilator_reward.lua" /> <!-- magic sword -->
<action uniqueid="2431" script="quests/annihilator/annihilator_reward.lua" /> <!-- stonecutter axe -->
<action uniqueid="2421" script="quests/annihilator/annihilator_reward.lua" /> <!-- thunder hammer -->
<action uniqueid="7001" script="quests/demon helmet/demonhelmet_lever.lua" />
<action uniqueid="2493" script="quests/demon helmet/demonhelmet_reward.lua" /> <!-- demon helmet -->
<action uniqueid="2520" script="quests/demon helmet/demonhelmet_reward.lua" /> <!-- demon shield -->
<action uniqueid="2645" script="quests/demon helmet/demonhelmet_reward.lua" /> <!-- steel boots -->
<action uniqueid="8883" script="quests/big_quest.lua" /> <!-- windborn colossus armor -->
<action uniqueid="8869" script="quests/big_quest.lua" /> <!-- greenwood coat -->
<action uniqueid="8867" script="quests/big_quest.lua" /> <!-- dragon robe -->
<action uniqueid="8853" script="quests/big_quest.lua" /> <!-- the ironworker -->
<action uniqueid="2453" script="quests/pits of inferno/poi_reward.lua" /> <!-- arcane staff -->
<action uniqueid="6528" script="quests/pits of inferno/poi_reward.lua" /> <!-- avenger -->
<action uniqueid="5803" script="quests/pits of inferno/poi_reward.lua" /> <!-- arbalest -->
<action fromuid="7003" touid="7006" script="quests/pits of inferno/poi_vocations_door.lua" />
<action uniqueid="8930" script="quests/inquisition_reward.lua" /> <!-- emerald sword -->
<action uniqueid="8918" script="quests/inquisition_reward.lua" /> <!-- spellbook of dark mysteriesd -->
<action uniqueid="8888" script="quests/inquisition_reward.lua" /> <!-- master archer's armor -->
Expand Down Expand Up @@ -129,7 +130,7 @@

<!-- Chests (Quests) -->
<action itemid="1740" script="quests/quests.lua" />
<action fromid="1746" toid="1749" script="quests/quests.lua" />
<action fromid="1747" toid="1749" script="quests/quests.lua" />

<!-- Enchanting -->
<action fromid="2146" toid="2147" script="other/enchanting.lua" />
Expand Down
5 changes: 2 additions & 3 deletions data/actions/scripts/custom/potions_lever.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if player:getFreeCapacity() >= itemWeight then
if not player:removeMoney(potion.value) then
player:sendCancelMessage("You don't have ".. potion.value .." gold coins to buy ".. potion.charges .." ".. potionId:getName() ..".")
elseif not player:addItem(potion.id, potion.charges) then
print("[ERROR] ACTION: potions_lever, FUNCTION: addItem, PLAYER: "..player:getName())
else
player:getPosition():sendMagicEffect(CONST_ME_DRAWBLOOD)
player:addItem(potion.id, potion.charges)
end

else
Expand All @@ -33,4 +32,4 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)

item:transform(item.itemid == 1945 and 1946 or 1945)
return true
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if table.contains(annihilatorReward, item.uid) then
if player:getStorageValue(Storage.annihilator) == -1 then
if playerCap >= itemWeight then
if not player:addItem(item.uid, 1) then
print("[ERROR] ACTION: annihi_reward, FUNCTION: addItem, PLAYER: "..player:getName())
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found a ' .. itemType:getName() .. '.')
player:setStorageValue(Storage.annihilator, 1)
end
player:addItem(item.uid, 1)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found a ' .. itemType:getName() .. '.')
player:setStorageValue(Storage.annihilator, 1)
else
player:sendCancelMessage("You don't have capacity.")
player:getPosition():sendMagicEffect(CONST_ME_POFF)
Expand All @@ -32,4 +29,4 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
print("[ERROR] ACTION: annihi_reward, FUNCTION: table.contains, PLAYER: "..player:getName())
end
return true
end
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local annihilatorReward = {8883, 8869, 8867, 8853}
local bigQuestReward = {8883, 8869, 8867, 8853}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.uid <= 1250 or item.uid >= 30000 then
return false
Expand All @@ -11,15 +11,12 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)

local itemWeight = itemType:getWeight()
local playerCap = player:getFreeCapacity()
if table.contains(annihilatorReward, item.uid) then
if table.contains(bigQuestReward, item.uid) then
if player:getStorageValue(Storage.bigQuest) == -1 then
if playerCap >= itemWeight then
if not player:addItem(item.uid, 1) then
print("[ERROR] ACTION: bigquest, FUNCTION: addItem, PLAYER: "..player:getName())
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found a ' .. itemType:getName() .. '.')
player:setStorageValue(Storage.bigQuest, 1)
end
player:addItem(item.uid, 1)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found a ' .. itemType:getName() .. '.')
player:setStorageValue(Storage.bigQuest, 1)
else
player:sendCancelMessage("You don't have capacity.")
player:getPosition():sendMagicEffect(CONST_ME_POFF)
Expand All @@ -32,4 +29,4 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
print("[ERROR] ACTION: bigquest, FUNCTION: table.contains, PLAYER: "..player:getName())
end
return true
end
end
46 changes: 46 additions & 0 deletions data/actions/scripts/quests/daily_quest.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
local days = {
[1] = {2160, 1, "first"},
[2] = {2160, 2, "second"},
[3] = {2160, 3, "third"},
[4] = {2160, 4, "fourth"},
[5] = {2160, 5, "fifth"},
[6] = {2160, 6, "sixth"},
[7] = {2160, 7, "seventh"}
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)

local timeQuest = player:getStorageValue(Storage.dailyQuestTime) > 0 and player:getStorageValue(Storage.dailyQuestTime) or 0
if (timeQuest + 86400) >= os.time() then
player:sendTextMessage(MESSAGE_STATUS_SMALL, "You still can't get the next reward.")
player:getPosition():sendMagicEffect(CONST_ME_POFF)
return true
elseif (timeQuest + 172800) <= os.time() then
player:setStorageValue(Storage.dailyQuest, 1)
end

local day = player:getStorageValue(Storage.dailyQuest) > 0 and player:getStorageValue(Storage.dailyQuest) or 1
local dayReward = days[day]
if dayReward then
local reward = ItemType(dayReward[1])
if reward:getId() ~= 0 then
if player:getFreeCapacity() < reward:getWeight() then
player:sendTextMessage(MESSAGE_STATUS_SMALL, "You don't have capacity.")
player:getPosition():sendMagicEffect(CONST_ME_POFF)
return true
end

player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You received ".. dayReward[2] .." ".. reward:getName() .. " as a reward for the ".. dayReward[3] .." day of daily quest.")
player:addItem(reward:getId(), dayReward[2])
player:setStorageValue(Storage.dailyQuestTime, os.time())

if day == 7 then
player:setStorageValue(Storage.dailyQuest, 1)
else
player:setStorageValue(Storage.dailyQuest, day + 1)
end
end
end

return true
end
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
Game.createItem(1355, 1, position[1])
end
return item:transform(item.itemid == 1945 and 1946 or 1945)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local playerCap = player:getFreeCapacity()
if player:getStorageValue(item.uid) == -1 then
if playerCap >= itemWeight then
if not player:addItem(item.uid, 1) then
print("[ERROR] ACTION: demonhelmet, FUNCTION: addItem, PLAYER: "..player:getName())
else
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. '.')
player:setStorageValue(item.uid, 1)
end
player:addItem(item.uid, 1)
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. '.')
player:setStorageValue(item.uid, 1)
else
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. ' weighing ' .. itemWeight .. ' oz it\'s too heavy.')
end
Expand All @@ -31,4 +28,4 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
print("[ERROR] ACTION: demonhelmet_reward, FUNCTION: table.contains, PLAYER: "..player:getName())
end
return true
end
end
11 changes: 4 additions & 7 deletions data/actions/scripts/quests/demon oak/demonOakChest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local itemWeight = itemType:getWeight()
local playerCap = player:getFreeCapacity()
if playerCap >= itemWeight then
if not player:addItem(itemUid, 1) then
print("[ERROR] ACTION: demonoak_reward, FUNCTION: addItem, PLAYER: "..player:getName())
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found a ' .. itemType:getName() .. '.')
player:setStorageValue(Storage.demonOak.progress, 3)
end
player:addItem(itemUid, 1)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found a ' .. itemType:getName() .. '.')
player:setStorageValue(Storage.demonOak.progress, 3)
else
player:sendCancelMessage("You don't have capacity.")
player:getPosition():sendMagicEffect(CONST_ME_POFF)
Expand All @@ -40,4 +37,4 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
end

return true
end
end
11 changes: 4 additions & 7 deletions data/actions/scripts/quests/inquisition_reward.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local playerCap = player:getFreeCapacity()
if player:getStorageValue(Storage.inquisition) < 3 then
if playerCap >= itemWeight then
if not player:addItem(item.uid, 1) then
print("[ERROR] ACTION: inquisition, FUNCTION: addItem, PLAYER: "..player:getName())
else
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. '.')
player:setStorageValue(item.uid, 3)
end
player:addItem(item.uid, 1)
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. '.')
player:setStorageValue(item.uid, 3)
else
player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. ' weighing ' .. itemWeight .. ' oz it\'s too heavy.')
end
Expand All @@ -31,4 +28,4 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
print("[ERROR] ACTION: inquisition_reward, FUNCTION: table.contains, PLAYER: "..player:getName())
end
return true
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local itemWeight = itemType:getWeight()
local playerCap = player:getFreeCapacity()
if playerCap >= itemWeight then
if not player:addItem(item.uid, 1) then
print("[ERROR] ACTION: poi_reward, FUNCTION: addItem, PLAYER: "..player:getName())
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found a ' .. itemType:getName() .. '.')
player:setStorageValue(Storage.pitsOfInferno.reward, 1)
end
player:addItem(item.uid, 1)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found a ' .. itemType:getName() .. '.')
player:setStorageValue(Storage.pitsOfInferno.reward, 1)
else
player:sendCancelMessage("You don't have capacity.")
player:getPosition():sendMagicEffect(CONST_ME_POFF)
Expand All @@ -32,4 +29,4 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
print("[ERROR] ACTION: poi_reward, FUNCTION: table.contains, PLAYER: "..player:getName())
end
return true
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
end
end
return true
end
end
11 changes: 4 additions & 7 deletions data/actions/scripts/quests/quests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,9 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local itemWeight = itemType:getWeight()
local playerCap = player:getFreeCapacity()
if playerCap >= itemWeight then
if not player:addItem(item.uid, 1) then
print("[ERROR] ACTION: quests, FUNCTION: addItem, PLAYER: "..player:getName())
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found a ' .. itemType:getName() .. '.')
player:setStorageValue(item.uid, 1)
end
player:addItem(item.uid, 1)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found a ' .. itemType:getName() .. '.')
player:setStorageValue(item.uid, 1)
else
player:sendCancelMessage("You don't have capacity.")
player:getPosition():sendMagicEffect(CONST_ME_POFF)
Expand All @@ -27,4 +24,4 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
player:getPosition():sendMagicEffect(CONST_ME_POFF)
end
return true
end
end
2 changes: 2 additions & 0 deletions data/creaturescripts/scripts/boss_achievements.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
dofile('data/lib/custom/achievements.lua')

local BOSSES = {
["thul"] = {storage = Storage.achievements.thul, achievement = 2}, -- Back into the Abyss
["the old widow"] = {storage = Storage.achievements.theOldWidow, achievement = 3}, -- Choking on Her Venom
Expand Down
4 changes: 1 addition & 3 deletions data/creaturescripts/scripts/events/duca.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
dofile('data/lib/custom/duca.lua')

function onPrepareDeath(player, killer)

if killer then
local team = player:getStorageValue(Storage.events)
local teamKiller = player:getStorageValue(Storage.events)
local teamKiller = killer:getStorageValue(Storage.events)
if team > 0 and teamKiller > 0 then
local points = {[1] = 1, [2] = 1, [3] = 10, [4] = 30}
local pointsPerKill = points[team]
Expand All @@ -15,6 +14,5 @@ function onPrepareDeath(player, killer)
ducaUpdateRank()
end
end

return false
end
59 changes: 28 additions & 31 deletions data/creaturescripts/scripts/events/zombie.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,44 +23,41 @@ local function clearEvent()
end

function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)

if attacker then
if attacker:getMonster() and attacker:getName() == "Zombie" then
if creature:isPlayer() then
local totalPlayers = zombieTotalPlayers()
if totalPlayers > 0 then
if totalPlayers == 1 then
creature:say("ZOMBIE EVENT WIN!", TALKTYPE_MONSTER_SAY)
Game.broadcastMessage("The player ".. creature:getName() .." is win zombie event.", MESSAGE_STATUS_WARNING)
if attacker:isMonster() and attacker:getName() == "Zombie" then
local totalPlayers = zombieTotalPlayers()
if totalPlayers > 0 then
if totalPlayers == 1 then
creature:say("ZOMBIE EVENT WIN!", TALKTYPE_MONSTER_SAY)
Game.broadcastMessage("The player ".. creature:getName() .." is win zombie event.", MESSAGE_STATUS_WARNING)

local itemType = ItemType(ZOMBIE.reward[1])
if itemType:getId() ~= 0 then
creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Congratulations, you won the zombie event and received ".. ZOMBIE.reward[2] .." ".. itemType:getName() .. " as a reward.")
creature:addItem(itemType:getId(), ZOMBIE.reward[2])
end
local itemType = ItemType(ZOMBIE.reward[1])
if itemType:getId() ~= 0 then
creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Congratulations, you won the zombie event and received ".. ZOMBIE.reward[2] .." ".. itemType:getName() .. " as a reward.")
creature:addItem(itemType:getId(), ZOMBIE.reward[2])
end

local trophy = creature:addItem(10129, 1)
if trophy then
trophy:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, 'Awarded to '.. creature:getName() ..'.')
end
local trophy = creature:addItem(10129, 1)
if trophy then
trophy:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, 'Awarded to '.. creature:getName() ..'.')
end

addEvent(checkFinishEvent, 3000)
addEvent(clearEvent, 4000)
addEvent(checkFinishEvent, 3000)
addEvent(clearEvent, 4000)

print("> Zombie event finish, winner: " .. creature:getName())
else
attacker:say("DEAD!", TALKTYPE_MONSTER_SAY)
attacker:getPosition():sendMagicEffect(CONST_ME_MORTAREA)
local summon_position = creature:getPosition()
Game.createMonster("Zombie Event", summon_position)
end
print("> Zombie event finish, winner: " .. creature:getName())
else
attacker:say("DEAD!", TALKTYPE_MONSTER_SAY)
attacker:getPosition():sendMagicEffect(CONST_ME_MORTAREA)
local summon_position = creature:getPosition()
Game.createMonster("Zombie Event", summon_position)
end

creature:unregisterEvent("Zombie")
creature:teleportTo(creature:getTown():getTemplePosition())
creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
creature:setStorageValue(Storage.events, 0)
end

creature:unregisterEvent("Zombie")
creature:teleportTo(creature:getTown():getTemplePosition())
creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
creature:setStorageValue(Storage.events, 0)
end
end

Expand Down
Loading

0 comments on commit 2a58f31

Please sign in to comment.