Skip to content

Commit

Permalink
Do not inform players about expired Troll's Haven Bulletin messages
Browse files Browse the repository at this point in the history
  • Loading branch information
brightrim committed Oct 2, 2023
1 parent d539b8c commit e18a2f5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions item/bookrests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ local messenger = require("content.messenger")
local M = {}

local BULLETIN_MAX_SLOTS = 10
M.BULLETIN_MAX_SLOTS = BULLETIN_MAX_SLOTS
local BULLETIN_EXPRIATION_TIME = 604800 -- seven RL days
--local BULLETIN_EXPRIATION_TIME = 5*60 --
local BULLETIN_COST = 2000
Expand Down
22 changes: 21 additions & 1 deletion server/login.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ local keys = require("item.keys")
local ceilingtrowel = require("gm.items.id_382_ceilingtrowel")
local utility = require("housing.utility")
local messenger = require("content.messenger")
local bookrests = require("item.bookrests")

-- Called after every player login

Expand Down Expand Up @@ -660,10 +661,29 @@ end

local function checkTrollsHavenBulletin(user)

local messageExists = false

for i = 1, bookrests.BULLETIN_MAX_SLOTS do

local expirationFound, expirationContent = ScriptVars:find("messageExpiration"..tostring(i))

if expirationFound and not common.IsNilOrEmpty(expirationContent) then
expirationContent = tonumber(expirationContent)
if expirationContent > world:getTime("unix") then
messageExists = true
end
end
end

local lastSeen = user:getQuestProgress(255)

local foundLatest, latest = ScriptVars:find("latestBulletinMessage")

if not messageExists and foundLatest then --The message expired before the user got the chance to read it and there are no current messages
lastSeen = tonumber(latest)
user:setQuestProgress(255, lastSeen)
end

if foundLatest and lastSeen ~= tonumber(latest) then
return true
end
Expand All @@ -677,7 +697,7 @@ local function checkRealmBulletin(user)
local town = factions.getMembershipByName(user)

if town == "None" then
return
return false
end

local townBoardQuestIds = {Runewick = 256, Cadomyr = 257, Galmair = 258}
Expand Down

0 comments on commit e18a2f5

Please sign in to comment.