Skip to content

Commit

Permalink
Merge branch 'main' into Nyedson-patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyedson authored Feb 20, 2024
2 parents 53c87e9 + af88e2b commit 60be738
Show file tree
Hide file tree
Showing 71 changed files with 221 additions and 251 deletions.
4 changes: 2 additions & 2 deletions config.lua.dist
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ onlyPremiumAccount = false
-- Customs
-- NOTE: weatherRain = true, activates weather raining effects
-- NOTE: thunderEffect = true, activates thunder effects
-- NOTE: allConsoleLog = true, show all message logs
-- NOTE: stashMoving = true, stow an container inside your stash
-- NOTE: depotChest, the non-stackable items will be moved to the selected depot chest(I - XVIII).
-- NOTE: autoBank = true, the dropped coins from monsters will be automatically deposited to your bank account.
Expand All @@ -239,9 +238,9 @@ onlyPremiumAccount = false
-- NOTE: teleportPlayerToVocationRoom will enable oressa to teleport player to his/her room vocation
-- NOTE: toggleReceiveReward = true, will enable players to choose one of reward exercise weapon by command !reward
-- NOTE: randomMonsterSpawn = true, will enable monsters from the same spawn to be randomized between them, thus making a variable hunt
-- NOTE: enablePlayerPutItemInAmmoSlot = true, will enable players to put any items on ammo slot, more used in custom shopping system
weatherRain = false
thunderEffect = false
allConsoleLog = false
stashMoving = false
depotChest = 4
autoLoot = false
Expand All @@ -257,6 +256,7 @@ toggleReceiveReward = false
randomMonsterSpawn = false
lootPouchMaxLimit = 2000
storeInboxMaxLimit = 2000
enablePlayerPutItemInAmmoSlot = false

-- Teleport summon
-- Set to true will never remove the summon
Expand Down
2 changes: 1 addition & 1 deletion data-otservbr-global/lib/core/storages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3084,12 +3084,12 @@ GlobalStorage = {
NaginataStone = 65003,
ExpBoost = 65004,
SwordOfFury = 65005,
GloothFairyTimer = 65006,
LionsRockFields = 65007,
TheMummysCurse = 65008,
OberonEventTime = 65009,
PrinceDrazzakEventTime = 65010,
ScarlettEtzelEventTime = 65011,
CobraBastionFlask = 65012,
Inquisition = 65013,
Yasir = 65014,
IceCrack = 65016,
Expand Down
19 changes: 0 additions & 19 deletions data-otservbr-global/scripts/actions/other/cobra_flask.lua

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,69 +1,73 @@
local function removeBosst(fromArea1, fromArea2, bossName)
for x = fromArea1.x, fromArea2.x do
for y = fromArea1.y, fromArea2.y do
for z = fromArea1.z, fromArea2.z do
if getTopCreature({ x = x, y = y, z = z, stackpos = 255 }).uid > 0 then
if isMonster(getTopCreature({ x = x, y = y, z = z, stackpos = 255 }).uid) then
if string.lower(getCreatureName(getTopCreature({ x = x, y = y, z = z, stackpos = 255 }).uid)) == bossName then
doRemoveCreature(getTopCreature({ x = x, y = y, z = z, stackpos = 255 }).uid)
end
local function clearMonstersAndTeleportPlayers()
local leverRoomFromPos = Position(33658, 31934, 9)
local leverRoomToPos = Position(33670, 31940, 9)
local bossRoomFromPos = Position(33678, 31922, 9)
local bossRoomToPos = Position(33699, 31943, 9)
local exitPos = Position(33657, 31943, 9)
local destinationPos = Position(33684, 31932, 9)

for x = leverRoomFromPos.x, leverRoomToPos.x do
for y = leverRoomFromPos.y, leverRoomToPos.y do
for z = leverRoomFromPos.z, leverRoomToPos.z do
local currentTile = Tile(Position({ x = x, y = y, z = z }))
if currentTile then
local topCreature = currentTile:getTopCreature()
if topCreature and topCreature:isPlayer() then
topCreature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
topCreature:teleportTo(exitPos)
topCreature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
end
end
end
end
end
return true
end

local function teleportAllPlayersFromAreat(fromArea1, fromArea2, toPos)
for x = fromArea1.x, fromArea2.x do
for y = fromArea1.y, fromArea2.y do
for z = fromArea1.z, fromArea2.z do
local tile = Tile(Position({ x = x, y = y, z = z }))
if tile then
local player = tile:getTopCreature()
if player and player:isPlayer() then
player:teleportTo(toPos)
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
for x = bossRoomFromPos.x, bossRoomToPos.x do
for y = bossRoomFromPos.y, bossRoomToPos.y do
for z = bossRoomFromPos.z, bossRoomToPos.z do
local currentTile = Tile(Position({ x = x, y = y, z = z }))
if currentTile then
local topCreature = currentTile:getTopCreature()
if topCreature and topCreature:isMonster() then
topCreature:remove()
end
end
end
end
end

for x = bossRoomFromPos.x, bossRoomToPos.x do
for y = bossRoomFromPos.y, bossRoomToPos.y do
for z = bossRoomFromPos.z, bossRoomToPos.z do
local currentTile = Tile(Position({ x = x, y = y, z = z }))
if currentTile then
local topCreature = currentTile:getTopCreature()
if topCreature and topCreature:isPlayer() then
topCreature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
topCreature:teleportTo(destinationPos)
topCreature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
end
end
end
end
end
return true
end

local function PrepareEnter()
removeBosst({ x = 33679, y = 31919, z = 9 }, { x = 33701, y = 31941, z = 9 }, "glooth fairy")
teleportAllPlayersFromAreat({ x = 33659, y = 31935, z = 9 }, { x = 33668, y = 31939, z = 9 }, { x = 33684, y = 31935, z = 9 })
Game.createMonster("Glooth Fairy", { x = 33688, y = 31937, z = 9 })
Game.createMonster("Glooth Fairy", Position(33688, 31937, 9), false, true)
end

local oramondGloothLever = Action()
function oramondGloothLever.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid == 8913 then
if getGlobalStorageValue(15560) >= os.time() then
doPlayerSendTextMessage(player, 19, "You need to wait 15 minutes to use again.")
return true
end
local gloothFairyLever = Action()

local specs, spec = Game.getSpectators({ x = 33688, y = 31932, z = 9 }, false, false, 13, 13, 13, 13)
for i = 1, #specs do
spec = specs[i]
if spec:isPlayer() then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "A team is already inside the quest room.")
return true
end
spec:remove()
end
setGlobalStorageValue(18081, os.time() + 15 * 60)
player:say("Everyone in this place will be teleported into Glooth Fairy's hideout in one minute. No way back!!!", TALKTYPE_MONSTER_SAY)
addEvent(PrepareEnter, 60 * 1000)
function gloothFairyLever.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if Game.getStorageValue(GlobalStorage.GloothFairyTimer) >= os.time() then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to wait 15 minutes to use again.")
return true
end

item:transform(item.itemid == 8913 and 8914 or 8913)
player:say("Everyone in this place will be teleported into Glooth Fairy's hideout in one minute. No way back!!!", TALKTYPE_MONSTER_SAY)
Game.setStorageValue(GlobalStorage.GloothFairyTimer, os.time() + 15 * 60)
addEvent(clearMonstersAndTeleportPlayers, 60 * 1000)
return true
end

oramondGloothLever:uid(1020)
oramondGloothLever:register()
gloothFairyLever:uid(1020)
gloothFairyLever:register()
14 changes: 0 additions & 14 deletions data-otservbr-global/scripts/globalevents/cobra_flask.lua

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
local isVipStorage = 150001

local function migrateIsVipSystem(player)
local isVipValue = player:getStorageValue(isVipStorage)
if isVipValue > 0 then
player:kv():scoped("account"):set("vip-system", true)
player:setStorageValue(isVipStorage, -1)
end
end

local migration = Migration("20241708362079_move_vip_system_to_kv")

function migration:onExecute()
self:forEachPlayer(migrateIsVipSystem)
end

migration:register()

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,76 +1,59 @@
local ThreatenedDreams = Storage.Quest.U11_40.ThreatenedDreams
local periods = {
[LIGHT_STATE_NIGHT] = "Night",
[LIGHT_STATE_DAY] = "Day",
[LIGHT_STATE_SUNRISE] = "Sunrise",
[LIGHT_STATE_SUNSET] = "Sunset",
}
local config = {
-- createByType day / night
[1] = { -- create in night
bushId = 25783,
createItem = LIGHT_STATE_NIGHT,
removeItem = LIGHT_STATE_SUNRISE,
pos = Position(33497, 32196, 7),
herbId = 5953,
herbWeight = 1,
storage = ThreatenedDreams.Mission03.RavenHerbTimer,
},
bushId = 25783,
createItem = LIGHT_STATE_NIGHT,
removeItem = LIGHT_STATE_SUNRISE,
pos = Position(33497, 32196, 7),
herbId = 5953,
herbWeight = 1,
storage = Storage.Quest.U11_40.ThreatenedDreams.Mission03.RavenHerbTimer,
}

local createRavenHerb = GlobalEvent("createRavenHerb")

function createRavenHerb.onPeriodChange(period, light)
local time = getWorldTime()

if configManager.getBoolean(configKeys.ALL_CONSOLE_LOG) then
logger.info("Starting {} Current light is {} and it's {} Tibian Time", periods[period], light, getFormattedWorldTime(time))
end
for index, item in pairs(config) do
if item.createItem == period then -- Adding
local createItem = Game.createItem(item.bushId, 1, item.pos)
createItem:setActionId(item.storage)
if createItem then
item.pos:sendMagicEffect(CONST_ME_BIGPLANTS)
end
elseif item.removeItem == period then -- Removing
local target = Tile(item.pos):getItemById(item.bushId)
if target then
item.pos:removeItem(item.bushId, CONST_ME_BIGPLANTS)
end
local pos = config.pos
if config.createItem == period then
local createItem = Game.createItem(config.bushId, 1, pos)
if createItem then
pos:sendMagicEffect(CONST_ME_BIGPLANTS)
end
elseif config.removeItem == period then
local target = Tile(pos):getItemById(config.bushId)
if target then
pos:removeItem(config.bushId, CONST_ME_BIGPLANTS)
end
end

return true
end

createRavenHerb:register()

local ravenHerb = Action()

function ravenHerb.onUse(player, item, fromPosition, target, toPosition, isHotkey)
local herbConfig = config[1]
local message = "You have found a " .. getItemName(herbConfig.herbId) .. "."
local message = "You have found a " .. getItemName(config.herbId) .. "."
local backpack = player:getSlotItem(CONST_SLOT_BACKPACK)

if not backpack or backpack:getEmptySlots(true) < 1 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, message .. " But you have no room to take it.")
return true
end
if (player:getFreeCapacity() / 100) < herbConfig.herbWeight then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, message .. ". Weighing " .. herbConfig.herbWeight .. " oz, it is too heavy for you to carry.")

if (player:getFreeCapacity() / 100) < config.herbWeight then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, message .. ". Weighing " .. config.herbWeight .. " oz, it is too heavy for you to carry.")
return true
end

if player:getStorageValue(herbConfig.storage) > os.time() then
if player:getStorageValue(config.storage) > os.time() then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The raven herb cannot be collected right now.")
return true
end

player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a " .. getItemName(herbConfig.herbId) .. ".")
player:setStorageValue(herbConfig.storage, os.time() + 60 * 30 * 1000) -- Can be collected on next cycle
player:addItem(herbConfig.herbId, 1)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, message)
player:setStorageValue(config.storage, os.time() + 60 * 30 * 1000)
player:addItem(config.herbId, 1)
return true
end

ravenHerb:aid(ThreatenedDreams.Mission03.RavenHerbTimer)
ravenHerb:id(25783)
ravenHerb:register()
Loading

0 comments on commit 60be738

Please sign in to comment.