Skip to content

Commit

Permalink
fix: some scripts (#1821)
Browse files Browse the repository at this point in the history
Continues fixing of #1784 and #1847 

• Improved message on exercise_training.
• Fixes reward charges.
• Created flag in prison bosses' scripts to enable minus players and removed already created functions.
• Removed create torch when player login.
• Fixes in 'clearBossRoom' function usage on bosses teleports.
• Fixed count days and time on ferumbras_lever and fixed mechanic of Ascending Ferumbras boss.
• Fixed xp boost storage resetter (on very ss, the storage was being presented, and the player always buy it with 30 tc).
• Added 13.21 new mounts, reordered and fixed typos, changed the word moveable to movable.
• Removed unnecessary spaces.
  • Loading branch information
elsongabriel authored Nov 28, 2023
1 parent f43ebd8 commit 83a823f
Show file tree
Hide file tree
Showing 57 changed files with 259 additions and 186 deletions.
1 change: 0 additions & 1 deletion config.lua.dist
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ pvpRateDamageTakenPerLevel = 0.0 -- recommended to start with 0.1
pvpRateDamageReductionPerLevel = 0.0 -- recommended to start with 0.1
pvpMaxLevelDifference = 0


-- Wheel of destiny system
-- NOTE: set wheelSystemEnabled = false to disable the wheel of destiny
-- NOTE: only the wheel points are modified, all other data is on the client executable and cannot be modified
Expand Down
2 changes: 0 additions & 2 deletions data-canary/scripts/globalevents/global_server_save.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ local function ServerSave()
end
-- Updating daily reward next server save
UpdateDailyRewardGlobalStorage(DailyReward.storages.lastServerSave, os.time())
-- Reset gamestore exp boost count.
db.query("UPDATE `player_storage` SET `value` = 0 WHERE `player_storage`.`key` = 51052")
end

local function ServerSaveWarning(time)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ monster.flags = {
hostile = true,
convinceable = false,
pushable = false,
rewardBoss = true,
rewardBoss = false,
illusionable = false,
canPushItems = true,
canPushCreatures = true,
Expand All @@ -53,7 +53,7 @@ monster.flags = {
}

monster.events = {
"FerumbrasSoulSplinter",
"FerumbrasSoulSplinterDeath",
}

monster.light = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local mType = Game.createMonsterType("Ferumbras Essence")
local monster = {}

monster.description = " ferumbras essence"
monster.description = "ferumbras essence"
monster.experience = 0
monster.outfit = {
lookType = 294,
Expand All @@ -13,8 +13,12 @@ monster.outfit = {
lookMount = 0,
}

monster.health = 115
monster.maxHealth = 115
monster.events = {
"FerumbrasEssenceImmortal",
}

monster.health = 35000
monster.maxHealth = 35000
monster.race = "undead"
monster.corpse = 9591
monster.speed = 100
Expand All @@ -38,7 +42,7 @@ monster.flags = {
hostile = true,
convinceable = false,
pushable = false,
rewardBoss = true,
rewardBoss = false,
illusionable = false,
canPushItems = true,
canPushCreatures = false,
Expand Down
2 changes: 1 addition & 1 deletion data-otservbr-global/scripts/actions/other/enchanting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function enchanting.onUse(player, item, fromPosition, target, toPosition, isHotk
return true
end

if item.itemid == 676 and table.contains({ 9020 }, target.itemid) then
if item.itemid == 676 and target.itemid == 9020 then
target:transform(9019)
item:remove(1)
toPosition:sendMagicEffect(CONST_ME_MAGIC_RED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ local config = {
5917,
3273,
10302,
3123,
9019,
5928,
5926,
5927,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ local config = {
position = Position(32619, 32493, 12),
},
requiredLevel = 250,

playerPositions = {
{ pos = Position(32578, 32500, 12), teleport = Position(32619, 32498, 12) },
{ pos = Position(32578, 32501, 12), teleport = Position(32619, 32498, 12) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ local config = {
position = Position(33712, 31503, 14),
},
requiredLevel = 250,

playerPositions = {
{ pos = Position(33739, 31506, 14), teleport = Position(33712, 31509, 14), effect = CONST_ME_TELEPORT },
{ pos = Position(33740, 31506, 14), teleport = Position(33712, 31509, 14), effect = CONST_ME_TELEPORT },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ local config = {
position = Position(33711, 31469, 14),
},
requiredLevel = 250,

playerPositions = {
{ pos = Position(33734, 31471, 14), teleport = Position(33711, 31474, 14), effect = CONST_ME_TELEPORT },
{ pos = Position(33735, 31471, 14), teleport = Position(33711, 31474, 14), effect = CONST_ME_TELEPORT },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ local config = {
position = Position(33805, 31504, 14),
},
requiredLevel = 250,

timeToDefeat = 25 * 60,
playerPositions = {
{ pos = Position(33772, 31504, 14), teleport = Position(33808, 31513, 14), effect = CONST_ME_TELEPORT },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ local config = {
position = Position(33708, 31539, 14),
},
requiredLevel = 250,

playerPositions = {
{ pos = Position(33736, 31537, 14), teleport = Position(33707, 31545, 14), effect = CONST_ME_TELEPORT },
{ pos = Position(33737, 31537, 14), teleport = Position(33707, 31545, 14), effect = CONST_ME_TELEPORT },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,5 @@
local config = {
bossName = "Ascending Ferumbras",
summonName = "Rift Invader",
bossPos = Position(33392, 31473, 14),
centerRoom = Position(33392, 31473, 14), -- Center Room
exitPosition = Position(33266, 31479, 14), -- Exit Position
newPos = Position(33392, 31479, 14), -- Player Position on room
playerPositions = {
Position(33269, 31477, 14),
Position(33269, 31478, 14),
Position(33269, 31479, 14),
Position(33269, 31480, 14),
Position(33269, 31481, 14),
Position(33270, 31477, 14),
Position(33270, 31478, 14),
Position(33270, 31479, 14),
Position(33270, 31480, 14),
Position(33270, 31481, 14),
Position(33271, 31477, 14),
Position(33271, 31478, 14),
Position(33271, 31479, 14),
Position(33271, 31480, 14),
Position(33271, 31481, 14),
},
range = 20,
time = 30, -- time in minutes to remove the player
}
local config = AscendingFerumbrasConfig

local function clearFerumbrasRoom()
local spectators = Game.getSpectators(config.bossPos, false, false, 20, 20, 20, 20)
for i = 1, #spectators do
Expand All @@ -42,7 +17,7 @@ end
local ferumbrasAscendantLever = Action()
function ferumbrasAscendantLever.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid == 8911 then
if player:getPosition() ~= Position(33270, 31477, 14) then
if player:getPosition() ~= config.leverPos then
return true
end

Expand All @@ -51,7 +26,7 @@ function ferumbrasAscendantLever.onUse(player, item, fromPosition, target, toPos
local playerTile = Tile(Position(x, y, 14)):getTopCreature()
if playerTile and playerTile:isPlayer() then
if not playerTile:canFightBoss("Ferumbras Mortal Shell") then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You or a member in your team have to wait 5 days to face Ferumbras again!")
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format("You or a member in your team have to wait %d days to face Ferumbras again!", config.days))
item:transform(8912)
return true
end
Expand Down Expand Up @@ -83,15 +58,16 @@ function ferumbrasAscendantLever.onUse(player, item, fromPosition, target, toPos
playerTile:getPosition():sendMagicEffect(CONST_ME_POFF)
playerTile:teleportTo(config.newPos)
playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
playerTile:setBossCooldown("Ferumbras Mortal Shell", os.time() + 280 * 60 * 3600) -- 14 days
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have 30 minutes to kill and loot this boss. Otherwise you will lose that chance and will be kicked out.")
addEvent(clearFerumbrasRoom, 60 * config.time * 1000, player:getId(), config.centerRoom, config.range, config.range, config.exitPosition)
playerTile:setBossCooldown("Ferumbras Mortal Shell", os.time() + config.days * 24 * 3600)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format("You have %d minutes to kill and loot this boss. Otherwise you will lose that chance and will be kicked out.", config.time))
addEvent(clearFerumbrasRoom, config.time * 60 * 1000, player:getId(), config.centerRoom, config.range, config.range, config.exitPosition)

for b = 1, 10 do
for b = 1, config.maxSummon do
local xrand = math.random(-10, 10)
local yrand = math.random(-10, 10)
local position = Position(33392 + xrand, 31473 + yrand, 14)
if Game.createMonster("rift invader", position) then
if not Game.createMonster(config.summonName, position) then
logger.error("[ferumbrasAscendantLever.onUse] can't create monster {}, on position {}", config.summonName, position:toString())
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ local config = {
position = Position(33456, 31434, 13),
},
requiredLevel = 250,

playerPositions = {
{ pos = Position(33455, 31413, 13), teleport = Position(33454, 31445, 13), effect = CONST_ME_TELEPORT },
{ pos = Position(33456, 31413, 13), teleport = Position(33454, 31445, 13), effect = CONST_ME_TELEPORT },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ local config = {
position = Position(33456, 31473, 13),
},
requiredLevel = 250,

playerPositions = {
{ pos = Position(33455, 31493, 13), teleport = Position(33455, 31464, 13), effect = CONST_ME_TELEPORT },
{ pos = Position(33456, 31493, 13), teleport = Position(33455, 31464, 13), effect = CONST_ME_TELEPORT },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ local config = {
position = Position(33488, 31441, 13),
},
requiredLevel = 250,

playerPositions = {
{ pos = Position(33516, 31444, 13), teleport = Position(33488, 31430, 13), effect = CONST_ME_TELEPORT },
{ pos = Position(33517, 31444, 13), teleport = Position(33488, 31430, 13), effect = CONST_ME_TELEPORT },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ local config = {
position = Position(33443, 31545, 13),
},
requiredLevel = 250,

playerPositions = {
{ pos = Position(33485, 31546, 13), teleport = Position(33443, 31554, 13), effect = CONST_ME_TELEPORT },
{ pos = Position(33485, 31547, 13), teleport = Position(33443, 31554, 13), effect = CONST_ME_TELEPORT },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ local config = {
position = Position(33424, 31473, 13),
},
requiredLevel = 250,

playerPositions = {
{ pos = Position(33422, 31493, 13), teleport = Position(33423, 31465, 13), effect = CONST_ME_TELEPORT },
{ pos = Position(33423, 31493, 13), teleport = Position(33423, 31465, 13), effect = CONST_ME_TELEPORT },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ local config = {
position = Position(32756, 32720, 10),
},
requiredLevel = 250,

playerPositions = {
{ pos = Position(32747, 32773, 10), teleport = Position(32757, 32727, 10), effect = CONST_ME_TELEPORT },
{ pos = Position(32748, 32773, 10), teleport = Position(32757, 32727, 10), effect = CONST_ME_TELEPORT },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ local config = {
position = Position(32687, 32715, 10),
},
requiredLevel = 250,

playerPositions = {
{ pos = Position(32747, 32749, 10), teleport = Position(32686, 32721, 10), effect = CONST_ME_TELEPORT },
{ pos = Position(32748, 32749, 10), teleport = Position(32686, 32721, 10), effect = CONST_ME_TELEPORT },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ local config = {
position = Position(32751, 32689, 10),
},
requiredLevel = 250,

playerPositions = {
{ pos = Position(32721, 32749, 10), teleport = Position(32751, 32685, 10), effect = CONST_ME_TELEPORT },
{ pos = Position(32722, 32749, 10), teleport = Position(32751, 32685, 10), effect = CONST_ME_TELEPORT },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ local config = {
position = Position(32725, 32719, 10),
},
requiredLevel = 250,

playerPositions = {
{ pos = Position(32721, 32773, 10), teleport = Position(32726, 32726, 10), effect = CONST_ME_TELEPORT },
{ pos = Position(32722, 32773, 10), teleport = Position(32726, 32726, 10), effect = CONST_ME_TELEPORT },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ local config = {
position = Position(32726, 32727, 11),
},
requiredLevel = 250,

playerPositions = {
{ pos = Position(32676, 32743, 11), teleport = Position(32726, 32733, 11), effect = CONST_ME_TELEPORT },
{ pos = Position(32676, 32744, 11), teleport = Position(32726, 32733, 11), effect = CONST_ME_TELEPORT },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ local config = {
position = Position(33856, 31866, 7),
},
requiredLevel = 250,

playerPositions = {
{ pos = Position(33854, 31854, 6), teleport = Position(33856, 31872, 7), effect = CONST_ME_TELEPORT },
{ pos = Position(33855, 31854, 6), teleport = Position(33856, 31872, 7), effect = CONST_ME_TELEPORT },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ local config = {
position = Position(33746, 31666, 14),
},
requiredLevel = 250,

playerPositions = {
{ pos = Position(33776, 31665, 14), teleport = Position(33747, 31671, 14), effect = CONST_ME_TELEPORT },
{ pos = Position(33777, 31665, 14), teleport = Position(33747, 31671, 14), effect = CONST_ME_TELEPORT },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ local config = {
position = Position(33744, 31599, 14),
},
requiredLevel = 250,

playerPositions = {
{ pos = Position(33773, 31601, 14), teleport = Position(33743, 31604, 14), effect = CONST_ME_TELEPORT },
{ pos = Position(33774, 31601, 14), teleport = Position(33743, 31604, 14), effect = CONST_ME_TELEPORT },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ local config = {
position = Position(33710, 31599, 14),
},
requiredLevel = 250,

playerPositions = {
{ pos = Position(33679, 31599, 14), teleport = Position(33710, 31605, 14), effect = CONST_ME_TELEPORT },
{ pos = Position(33680, 31599, 14), teleport = Position(33710, 31605, 14), effect = CONST_ME_TELEPORT },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ local config = {
position = Position(33710, 31634, 14),
},
requiredLevel = 250,

playerPositions = {
{ pos = Position(33676, 31634, 14), teleport = Position(33710, 31639, 14), effect = CONST_ME_TELEPORT },
{ pos = Position(33677, 31634, 14), teleport = Position(33710, 31639, 14), effect = CONST_ME_TELEPORT },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ local config = {
position = Position(33743, 31632, 14),
},
requiredLevel = 250,

playerPositions = {
{ pos = Position(33774, 31634, 14), teleport = Position(33742, 31639, 14), effect = CONST_ME_TELEPORT },
{ pos = Position(33775, 31634, 14), teleport = Position(33742, 31639, 14), effect = CONST_ME_TELEPORT },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,38 @@ end

rewardSoulWar:position({ x = 33620, y = 31400, z = 10 })
rewardSoulWar:register()

-----------------------------
-- Phantasmal Jade Mount function

local phantasmalJadeMount = Action()
function phantasmalJadeMount.onUse(player, item, fromPosition, target, toPosition, isHotkey)
local storage = Storage.Quest.U12_40.SoulWar.MountReward
if player:getStorageValue(storage) == 1 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You already have Phantasmal Jade mount!")
return false
end

if table.contains({ 34072, 34073, 34074 }, item.itemid) then
-- check items
if player:getItemCount(34072) >= 4 and player:getItemCount(34073) == 1 and player:getItemCount(34074) == 1 then
player:removeItem(34072, 4)
player:removeItem(34073, 1)
player:removeItem(34074, 1)
player:addMount(167)
player:setStorageValue(storage, 1)
player:addAchievement("You got Horse Power")
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Congratulations! You won Phantasmal Jade mount.")
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Congratulations! You won You got Horse Power achievement.")
player:getPosition():sendMagicEffect(CONST_ME_HOLYDAMAGE)
return true
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You don't have the necessary items!")
player:getPosition():sendMagicEffect(CONST_ME_POFF)
return false
end
end
end

phantasmalJadeMount:id(34072, 34073, 34074)
phantasmalJadeMount:register()
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ local config = {
position = Position(33617, 32561, 13),
},
requiredLevel = 250,

timeToDefeat = 15 * 60,
playerPositions = {
{ pos = Position(33638, 32562, 13), teleport = Position(33617, 32567, 13), effect = CONST_ME_TELEPORT },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ local config = {
position = Position(32208, 32046, 15),
},
requiredLevel = 250,

playerPositions = {
{ pos = Position(32212, 32070, 15), teleport = Position(32208, 32052, 15), effect = CONST_ME_TELEPORT },
{ pos = Position(32210, 32070, 15), teleport = Position(32208, 32052, 15), effect = CONST_ME_TELEPORT },
Expand Down
Loading

0 comments on commit 83a823f

Please sign in to comment.