@@ -27,32 +27,6 @@ local function debugTickPrint(message)
2727 end
2828end
2929
30- ---- -------------------------------
31- -- Global Dynamis Variables --
32- ---- -------------------------------
33- -- Come back when I do tav
34- -- local function getDynamisTavWinParam(player)
35- -- local zmComplete = player:getCurrentMission(xi.mission.log_id.ZILART) >= xi.mission.id.zilart.AWAKENING
36- -- local copComplete = player:getCurrentMission(xi.mission.log_id.COP) >= xi.mission.id.cop.DAWN
37- -- local anComplete = player:hasCompletedQuest(xi.quest.log_id.JEUNO, xi.quest.id.jeuno.APOCALYPSE_NIGH)
38-
39- -- if anComplete then
40- -- -- AN requires ZM and CoP
41- -- return 3
42- -- elseif zmComplete then
43- -- if copComplete then
44- -- -- ZM and CoP
45- -- return 2
46- -- end
47-
48- -- -- ZM only
49- -- return 1
50- -- end
51-
52- -- -- Not ZM complete
53- -- return 0
54- -- end
55-
5630---- -------------------------------
5731-- onZoneTick Dynamis Functions --
5832---- -------------------------------
280254---- -------------------------------
281255-- Dynamis Zone Functions --
282256---- -------------------------------
283- -- Cleanup Done
284- -- Re-wrote the function to be used for everything not just GMs
285257xi .dynamis .addMinutesToDynamis = function (zone , minutes )
286258 local zoneId = zone :getID ()
287259 local varExpiration = string.format (' [DYNA]ExpirationTime_%s' , zoneId )
@@ -324,7 +296,6 @@ xi.dynamis.addMinutesToDynamis = function(zone, minutes)
324296 end
325297end
326298
327- -- Cleanup Done
328299xi .dynamis .addTimeToDynamis = function (zone , mob )
329300 local zoneId = zone :getID ()
330301 local mobID = mob :getID ()
@@ -342,7 +313,6 @@ xi.dynamis.addTimeToDynamis = function(zone, mob)
342313 end
343314end
344315
345- -- Cleanup Done
346316xi .dynamis .getDynaTimeRemaining = function (zoneExpiration )
347317 local timeRemaining = (zoneExpiration - GetSystemTime ()) -- Returns difference.
348318 -- xi.dynamis.debugPrint('Dynamis Time Remaining Check | Expiration: ' .. tostring(zoneExpiration) .. ' | CurrentTime: ' .. tostring(GetSystemTime()) .. ' | Result: ' .. tostring(timeRemaining))
@@ -415,6 +385,39 @@ xi.dynamis.dynamisTimeWarning = function(zone, zoneExpiration)
415385 end
416386end
417387
388+ xi .dynamis .zoneOnZoneInEra = function (player , prevZone )
389+ local zoneId = player :getZoneID ()
390+ local zoneExpiration = GetServerVariable (string.format (' [DYNA]ExpirationTime_%s' , zoneId ))
391+ local info = xi .dynamis .dynaInfoEra [zoneId ]
392+ local ID = zones [zoneId ]
393+
394+ xi .dynamis .debugPrint (string.format (' ------------xi.dynamis.zoneOnZoneInEra------------' ))
395+ -- usually happens when zoning in with !zone command
396+ -- If player is in void, move player to entry.
397+ if
398+ player :getXPos () == 0 and
399+ player :getYPos () == 0 and
400+ player :getZPos () == 0
401+ then
402+ player :setPos (unpack (info .entryPos ))
403+ end
404+
405+ local expirationTime = xi .dynamis .getDynaTimeRemaining (zoneExpiration )
406+ xi .dynamis .debugPrint (string.format (' expirationTime calculation: %s | zoneExpiration: %s | currentTime: %s' , tostring (expirationTime ), tostring (zoneExpiration ), tostring (GetSystemTime ())))
407+ -- Send message letting player know how long they have.
408+ player :timer (5000 , function (playerArg )
409+ playerArg :messageSpecial (ID .text .DYNAMIS_TIME_UPDATE_2 , math.floor (utils .clamp (expirationTime , 0 , expirationTime ) / 60 ), 1 )
410+ end )
411+
412+ -- Update hourglass if player has one - will only update endTime if it was extended (zoneExpiration > current endTime)
413+ xi .dynamis .debugPrint (string.format (' Updating hourglass for player' ))
414+ xi .dynamis .updatePlayerHourglass (player )
415+
416+ -- Check for dreamland SJ restriction and apply if necessary
417+ xi .dynamis .applyEntryRestrictions (player , zoneId )
418+ return - 1
419+ end
420+
418421---- -------------------------------
419422-- Dynamis Player Functions --
420423---- -------------------------------
@@ -497,52 +500,6 @@ xi.dynamis.registerPlayer = function(player)
497500 xi .dynamis .recordLockout (player )
498501end
499502
500- -- TODO Cleanup
501- xi .dynamis .ejectPlayer = function (player , forceEject )
502- xi .dynamis .debugPrint (' Ejecting player: ' .. tostring (player :getName ()) .. ' | forceEject: ' .. tostring (forceEject ))
503- local zoneId = player :getZoneID ()
504- if forceEject == nil then
505- forceEject = false
506- end
507-
508- if player :getCurrentRegion () == xi .region .DYNAMIS then
509- if player :getLocalVar (' Received_Eject_Warning' ) ~= 1 then
510- player :delStatusEffectSilent (xi .effect .BATTLEFIELD )
511- if not forceEject then
512- player :timer (2000 , function (playerArg )
513- playerArg :messageSpecial (xi .dynamis .getZoneMessageID (' NO_LONGER_HAVE_CLEARANCE' , zoneId ), 0 , 30 ) -- Wait 1 second, send no clearance message.
514- end )
515-
516- player :setLocalVar (' Received_Eject_Warning' , 1 )
517- player :timer (30000 , function (playerArgTwo )
518- playerArgTwo :setCharVar (string.format (' [DYNA]EjectPlayer_%s' , zoneId ), - 1 ) -- Reset player's eject timer.
519- playerArgTwo :disengage () -- Force disengage.
520- playerArgTwo :timer (2000 , function (playerArgThree )
521- playerArgThree :startCutscene (100 ) -- Wait 2 seconds then play exit CS.
522- end )
523- end )
524- else
525- player :timer (2000 , function (playerArgFour )
526- playerArgFour :messageSpecial (xi .dynamis .getZoneMessageID (' NO_LONGER_HAVE_CLEARANCE' , zoneId ), 0 , 0 )
527- playerArgFour :setCharVar (string.format (' [DYNA]EjectPlayer_%s' , zoneId ), - 1 ) -- Reset player's eject timer.
528- playerArgFour :disengage () -- Force disengage.
529- playerArgFour :timer (4000 , function (playerArgFive )
530- playerArgFive :startCutscene (100 ) -- Wait 2 seconds then play exit CS.
531- end )
532- end ) -- Wait 1 second, send no clearance message.
533- end
534- end
535- end
536- end
537-
538- xi .dynamis .ejectAllPlayers = function (zone )
539- print (' Ejecting all players from Dynamis zone: ' .. tostring (zone :getID ()))
540- local playersInZone = zone :getPlayers ()
541- for _ , player in pairs (playersInZone ) do
542- xi .dynamis .ejectPlayer (player ) -- Runs the ejectPlayer function per player.
543- end
544- end
545-
546503-- Reset all player-related dynamis charvars
547504-- GM Command Only
548505xi .dynamis .resetPlayerVars = function (playerEntity , dynaZone )
@@ -566,42 +523,6 @@ xi.dynamis.sjQMOnTrigger = function(npc)
566523 zone :setLocalVar (' SJUnlocked' , 1 )
567524end
568525
569- ---- -------------------------------
570- -- Dynamis Player/Zone Functions --
571- ---- -------------------------------
572- xi .dynamis .zoneOnZoneInEra = function (player , prevZone )
573- local zoneId = player :getZoneID ()
574- local zoneExpiration = GetServerVariable (string.format (' [DYNA]ExpirationTime_%s' , zoneId ))
575- local info = xi .dynamis .dynaInfoEra [zoneId ]
576- local ID = zones [zoneId ]
577-
578- xi .dynamis .debugPrint (string.format (' ------------xi.dynamis.zoneOnZoneInEra------------' ))
579- -- usually happens when zoning in with !zone command
580- -- If player is in void, move player to entry.
581- if
582- player :getXPos () == 0 and
583- player :getYPos () == 0 and
584- player :getZPos () == 0
585- then
586- player :setPos (unpack (info .entryPos ))
587- end
588-
589- local expirationTime = xi .dynamis .getDynaTimeRemaining (zoneExpiration )
590- xi .dynamis .debugPrint (string.format (' expirationTime calculation: %s | zoneExpiration: %s | currentTime: %s' , tostring (expirationTime ), tostring (zoneExpiration ), tostring (GetSystemTime ())))
591- -- Send message letting player know how long they have.
592- player :timer (5000 , function (playerArg )
593- playerArg :messageSpecial (ID .text .DYNAMIS_TIME_UPDATE_2 , math.floor (utils .clamp (expirationTime , 0 , expirationTime ) / 60 ), 1 )
594- end )
595-
596- -- Update hourglass if player has one - will only update endTime if it was extended (zoneExpiration > current endTime)
597- xi .dynamis .debugPrint (string.format (' Updating hourglass for player' ))
598- xi .dynamis .updatePlayerHourglass (player )
599-
600- -- Check for dreamland SJ restriction and apply if necessary
601- xi .dynamis .applyEntryRestrictions (player , zoneId )
602- return - 1
603- end
604-
605526---- -------------------------------
606527-- Dynamis Zone Validation --
607528---- -------------------------------
0 commit comments