You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: optimize time formatting function for better performance (opentibiabr#2904)
Refactors the getTimeInWords function to improve performance and
code readability. The new implementation adopts a more efficient
approach for calculating and formatting time in days, hours, minutes,
and seconds, reducing redundancy and simplifying the logical flow.
• Optimized the function for better execution speed.
• Simplified the conditions and formatting structure.
• Maintained the same functionality with clearer and more efficient
code.
player:sendTextMessage(MESSAGE_FAILURE, "You must wait " ..getTimeInWords(cooldownLeft) .." before using " ..item:getName() .." again.")
183
+
player:sendTextMessage(MESSAGE_FAILURE, "You must wait " ..Game.getTimeInWords(cooldownLeft) .." before using " ..item:getName() .." again.")
184
184
returntrue
185
185
end
186
186
self:timeLeft(player, self:totalDuration())
@@ -191,7 +191,7 @@ function Concoction:activate(player, item)
191
191
self.config.callback(player, self.config)
192
192
else
193
193
self:addCondition(player)
194
-
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have activated " ..item:getName() ..". It will last for " ..getTimeInWords(self:totalDuration()) ..consumptionString..".")
194
+
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have activated " ..item:getName() ..". It will last for " ..Game.getTimeInWords(self:totalDuration()) ..consumptionString..".")
descriptionText=string.format("%s (Master: %s). It will disappear in %s", descriptionText, monsterMaster:getName(), getTimeInWords(summonTimeRemaining-os.time()))
47
+
descriptionText=string.format("%s (Master: %s). It will disappear in %s", descriptionText, monsterMaster:getName(), Game.getTimeInWords(summonTimeRemaining-os.time()))
0 commit comments