@@ -970,11 +970,11 @@ end
970970
971971TaintTeleportCooldown = {}
972972
973- function Player :getTaintNameByNumber (taintNumber )
973+ function Player :getTaintNameByNumber (taintNumber , skipKvCheck )
974974 local haveTaintName = nil
975975 local soulWarQuest = self :soulWarQuestKV ()
976976 local taintName = soulWarTaints [taintNumber ]
977- if taintName and soulWarQuest :get (taintName ) then
977+ if skipKvCheck or taintName and soulWarQuest :get (taintName ) then
978978 haveTaintName = taintName
979979 end
980980
@@ -983,15 +983,29 @@ end
983983
984984function Player :addNextTaint ()
985985 local soulWarQuest = self :soulWarQuestKV ()
986- for _ , taint in ipairs (soulWarTaints ) do
987- if not soulWarQuest :get (taint ) then
988- soulWarQuest :set (taint , true )
989- self :sendTextMessage (MESSAGE_EVENT_ADVANCE , " You have gained the " .. taint .. " ." )
986+ for _ , taintName in ipairs (soulWarTaints ) do
987+ if not soulWarQuest :get (taintName ) then
988+ soulWarQuest :set (taintName , true )
989+ self :sendTextMessage (MESSAGE_EVENT_ADVANCE , " You have gained the " .. taintName .. " ." )
990+ self :setTaintIcon ()
990991 break
991992 end
992993 end
993994end
994995
996+ function Player :setTaintIcon (taintId )
997+ self :resetTaintConditions ()
998+ local condition = Condition (CONDITION_GOSHNARTAINT , CONDITIONID_DEFAULT , taintId or self :getTaintLevel ())
999+ condition :setTicks (14 * 24 * 60 * 60 * 1000 )
1000+ self :addCondition (condition )
1001+ end
1002+
1003+ function Player :resetTaintConditions ()
1004+ for i = 1 , 5 do
1005+ self :removeCondition (CONDITION_GOSHNARTAINT , CONDITIONID_DEFAULT , i )
1006+ end
1007+ end
1008+
9951009function Player :getTaintLevel ()
9961010 local taintLevel = nil
9971011 local soulWarQuest = self :soulWarQuestKV ()
@@ -1004,17 +1018,17 @@ function Player:getTaintLevel()
10041018 return taintLevel
10051019end
10061020
1007- function Player :resetTaints ()
1021+ function Player :resetTaints (skipCheckTime )
10081022 local soulWarQuest = self :soulWarQuestKV ()
10091023 local firstTaintTime = soulWarQuest :get (" firstTaintTime" )
1010- if firstTaintTime and os.time () >= (firstTaintTime + TaintDurationSeconds ) then
1011- -- Reset all taints
1012- for _ , taint in ipairs (soulWarTaints ) do
1013- if soulWarQuest :get (taint ) then
1014- soulWarQuest :remove (taint )
1024+ if skipCheckTime or firstTaintTime and os.time () >= (firstTaintTime + TaintDurationSeconds ) then
1025+ -- Reset all taints and remove condition
1026+ for _ , taintName in ipairs (soulWarTaints ) do
1027+ if soulWarQuest :get (taintName ) then
1028+ soulWarQuest :remove (taintName )
10151029 end
10161030 end
1017-
1031+ self : resetTaintConditions ()
10181032 soulWarQuest :remove (" firstTaintTime" )
10191033 self :sendTextMessage (MESSAGE_EVENT_ADVANCE , " Your goshnar's taints have been reset. You didn't finish the quest in 14 days" )
10201034 end
@@ -1028,7 +1042,7 @@ function Monster:tryTeleportToPlayer(sayMessage)
10281042 for i , spectator in ipairs (spectators ) do
10291043 if spectator :isPlayer () then
10301044 local player = spectator :getPlayer ()
1031- if player :getTaintNameByNumber (1 ) then
1045+ if player :getTaintNameByNumber (1 , true ) then
10321046 local distance = self :getPosition ():getDistance (player :getPosition ())
10331047 if distance > maxDistance then
10341048 maxDistance = distance
0 commit comments