Minor translation fixes, added all map translationsfor party updates, translated all mob names for Flame and Snow dungeon to all locales, fixed realtime countdowns and tooltip element centering, applied use of toolTip for affect icons

This commit is contained in:
Mind Rapist
2026-02-09 04:08:53 +02:00
parent 659e0e2dde
commit 90c18b81b7
40 changed files with 1977 additions and 109 deletions

View File

@@ -11,16 +11,16 @@ FOG_LEVEL0 = 4800.0
FOG_LEVEL1 = 9600.0
FOG_LEVEL2 = 12800.0
FOG_LEVEL = FOG_LEVEL0
FOG_LEVEL_LIST=[FOG_LEVEL0, FOG_LEVEL1, FOG_LEVEL2]
FOG_LEVEL_LIST = [FOG_LEVEL0, FOG_LEVEL1, FOG_LEVEL2]
CAMERA_MAX_DISTANCE_SHORT = 2500.0
CAMERA_MAX_DISTANCE_LONG = 3500.0
CAMERA_MAX_DISTANCE_LIST=[CAMERA_MAX_DISTANCE_SHORT, CAMERA_MAX_DISTANCE_LONG]
CAMERA_MAX_DISTANCE_LIST = [CAMERA_MAX_DISTANCE_SHORT, CAMERA_MAX_DISTANCE_LONG]
CAMERA_MAX_DISTANCE = CAMERA_MAX_DISTANCE_SHORT
CHRNAME_COLOR_INDEX = 0
ENVIRONMENT_NIGHT="d:/ymir work/environment/moonlight04.msenv"
ENVIRONMENT_NIGHT = "d:/ymir work/environment/moonlight04.msenv"
# constant
HIGH_PRICE = 500000
@@ -69,6 +69,13 @@ def SET_ITEM_QUESTION_DIALOG_STATUS(flag):
import app
import net
# MR-10: Add accessorySocketTimeCache for real-time remaining time display of accessory sockets.
# Cache for accessory/belt socket timers so they persist across UI reloads.
if not hasattr(app, "_accessorySocketTimeCache"):
app._accessorySocketTimeCache = {}
ACCESSORY_SOCKET_TIME_CACHE = app._accessorySocketTimeCache
# MR-10: -- END OF -- Add accessorySocketTimeCache for real-time remaining time display of accessory sockets.
########################
def SET_DEFAULT_FOG_LEVEL():
@@ -194,11 +201,12 @@ def GET_ACCESSORY_MATERIAL_VNUM(vnum, subType):
EAR_ITEM_VNUM_BASE = 17000
ret -= EAR_ITEM_VNUM_BASE
type = ret//20
type = ret // 20
if type<0 or type>=len(ACCESSORY_MATERIAL_LIST):
type = (ret-170) // 20
if type<0 or type>=len(ACCESSORY_MATERIAL_LIST):
if type < 0 or type >= len(ACCESSORY_MATERIAL_LIST):
type = (ret - 170) // 20
if type < 0 or type >= len(ACCESSORY_MATERIAL_LIST):
return 0
return ACCESSORY_MATERIAL_LIST[type]

View File

@@ -26,9 +26,14 @@ class CursorImage(object):
self.handle = 0
self.LoadImage(imageName)
# MR-10: Fix mouse destruction
def __del__(self):
if grpImage and self.handle:
grpImage.Delete(self.handle)
try:
if grpImage and self.handle and hasattr(grpImage, "Delete"):
grpImage.Delete(self.handle)
except:
pass
# MR-10: -- END OF -- Fix mouse destruction
def LoadImage(self, imageName):
try:

View File

@@ -231,19 +231,32 @@ class AutoPotionImage(ui.ExpandedImageBox):
self.LoadImage(fileName)
except:
import dbg
dbg.TraceError("AutoPotionImage.__Refresh(potionType=%d) - LoadError %s" % (self.potionType, fileName))
dbg.TraceError("AutoPotionImage.__Refresh(potionType = %d) - LoadError %s" % (self.potionType, fileName))
self.SetScale(0.7, 0.7)
self.toolTip.ClearToolTip()
if player.AUTO_POTION_TYPE_HP == type:
# MR-10: Add toolTip support and real-time countdown for affects
itemName = None
if slotIndex >= 0:
itemVnum = player.GetItemIndex(slotIndex)
if itemVnum:
item.SelectItem(itemVnum)
itemName = item.GetItemName()
if itemName:
self.toolTip.SetTitle(itemName)
elif player.AUTO_POTION_TYPE_HP == self.potionType:
self.toolTip.SetTitle(localeInfo.TOOLTIP_AUTO_POTION_HP)
else:
self.toolTip.SetTitle(localeInfo.TOOLTIP_AUTO_POTION_SP)
self.toolTip.AppendTextLine(localeInfo.TOOLTIP_AUTO_POTION_REST % (amountPercent))
self.toolTip.AppendTextLine(localeInfo.TOOLTIP_AUTO_POTION_REST % (amountPercent))
self.toolTip.ResizeToolTip()
# MR-10: -- END OF -- Add toolTip support and real-time countdown for affects
def OnMouseOverIn(self):
self.toolTip.ShowToolTip()
@@ -259,11 +272,18 @@ class AffectImage(ui.ExpandedImageBox):
ui.ExpandedImageBox.__init__(self)
self.toolTipText = None
self.isSkillAffect = TRUE
# MR-10: Add toolTip support and real-time countdown for affects
self.toolTip = None
self.dsTimeCache = {}
self.isHover = False
# MR-10: -- END OF -- Add toolTip support and real-time countdown for affects
self.isSkillAffect = True
self.description = None
self.endTime = 0
self.affect = None
self.isClocked = TRUE
self.isClocked = True
self.autoPotionToolTipTitle = None
self.autoPotionToolTipLine = None
def SetAffect(self, affect):
self.affect = affect
@@ -275,10 +295,12 @@ class AffectImage(ui.ExpandedImageBox):
if not self.toolTipText:
textLine = ui.TextLine()
textLine.SetParent(self)
textLine.SetSize(0, 0)
textLine.SetOutline()
textLine.Hide()
self.toolTipText = textLine
self.toolTipText.SetText(text)
@@ -290,15 +312,16 @@ class AffectImage(ui.ExpandedImageBox):
def SetDuration(self, duration):
self.endTime = 0
# MR-10: Add toolTip support and real-time countdown for affects
if duration > 0:
self.endTime = app.GetGlobalTimeStamp() + duration
leftTime = localeInfo.RTSecondToDHMS(self.endTime - app.GetGlobalTimeStamp())
self.toolTip.AppendTextLine("(%s : %s)" % (localeInfo.LEFT_TIME, leftTime))
self.toolTip.ResizeToolTip()
# MR-10: -- END OF -- Add toolTip support and real-time countdown for affects
def UpdateAutoPotionDescription(self):
potionType = 0
if self.affect == chr.NEW_AFFECT_AUTO_HP_RECOVERY:
potionType = player.AUTO_POTION_TYPE_HP
else:
@@ -315,21 +338,164 @@ class AffectImage(ui.ExpandedImageBox):
except:
amountPercent = 100.0
self.SetToolTipText(self.description % amountPercent, 0, 40)
# MR-10: Add toolTip support and real-time countdown for affects
if not self.isHover:
return
self.__EnsureToolTip()
itemName = None
if slotIndex >= 0:
itemVnum = player.GetItemIndex(slotIndex)
if itemVnum:
item.SelectItem(itemVnum)
itemName = item.GetItemName()
if itemName:
title = itemName
elif player.AUTO_POTION_TYPE_HP == potionType:
title = localeInfo.TOOLTIP_AUTO_POTION_HP
else:
title = localeInfo.TOOLTIP_AUTO_POTION_SP
line = self.description % amountPercent
if self.autoPotionToolTipTitle == title and self.autoPotionToolTipLine == line:
return
self.toolTip.ClearToolTip()
self.toolTip.SetTitle(title)
self.toolTip.AppendTextLine(line)
self.toolTip.ResizeToolTip()
self.autoPotionToolTipTitle = title
self.autoPotionToolTipLine = line
# MR-10: -- END OF -- Add toolTip support and real-time countdown for affects
def SetClock(self, isClocked):
self.isClocked = isClocked
# MR-10: Add toolTip support and real-time countdown for affects
def UpdateDescription(self):
if self.__IsDragonSoulAffect():
if self.isHover:
self.__UpdateDragonSoulDescription()
if self.toolTip:
self.toolTip.ShowToolTip()
return
if not self.isClocked:
self.__UpdateDescription2()
return
if not self.description:
return
if self.endTime > 0:
leftTime = localeInfo.RTSecondToDHMS(self.endTime - app.GetGlobalTimeStamp())
self.toolTip.childrenList[-1].SetText("(%s : %s)" % (localeInfo.LEFT_TIME, leftTime))
if self.__ShouldShowTimedToolTip():
if self.isHover:
remainSec = max(0, self.endTime - app.GetGlobalTimeStamp())
self.__UpdateTimedDescription(remainSec)
if self.toolTip:
self.toolTip.ShowToolTip()
return
self.SetToolTipText(self.description, 0, 40)
#독일버전에서 시간을 제거하기 위해서 사용
def __UpdateDescription2(self):
if not self.description:
return
toolTip = self.description
self.SetToolTipText(toolTip, 0, 40)
def __EnsureToolTip(self):
if not self.toolTip:
self.toolTip = uiToolTip.ToolTip(100)
self.toolTip.HideToolTip()
def __IsAutoPotionAffect(self):
return self.affect in (chr.NEW_AFFECT_AUTO_HP_RECOVERY, chr.NEW_AFFECT_AUTO_SP_RECOVERY)
def __ShouldShowTimedToolTip(self):
return self.isClocked and self.endTime > 0 and not self.__IsAutoPotionAffect()
def __UpdateTimedDescription(self, remainSec):
if not self.description:
return
self.__EnsureToolTip()
self.toolTip.ClearToolTip()
self.toolTip.SetTitle(self.description)
self.toolTip.AppendTextLine("(%s : %s)" % (localeInfo.LEFT_TIME, localeInfo.RTSecondToDHMS(remainSec)))
self.toolTip.ResizeToolTip()
def __IsDragonSoulAffect(self):
return self.affect in (chr.NEW_AFFECT_DRAGON_SOUL_DECK1, chr.NEW_AFFECT_DRAGON_SOUL_DECK2)
def __GetDragonSoulMinRemainSec(self):
deckIndex = 0 if self.affect == chr.NEW_AFFECT_DRAGON_SOUL_DECK1 else 1
now = app.GetGlobalTimeStamp()
minRemain = None
for i in range(6):
slotNumber = deckIndex * player.DRAGON_SOUL_EQUIPMENT_FIRST_SIZE + (player.DRAGON_SOUL_EQUIPMENT_SLOT_START + i)
itemVnum = player.GetItemIndex(slotNumber)
if itemVnum == 0:
continue
item.SelectItem(itemVnum)
remainSec = None
for j in range(item.LIMIT_MAX_NUM):
(limitType, limitValue) = item.GetLimit(j)
if item.LIMIT_REAL_TIME == limitType or item.LIMIT_REAL_TIME_START_FIRST_USE == limitType:
endTime = player.GetItemMetinSocket(player.INVENTORY, slotNumber, 0)
remainSec = endTime - now
break
if item.LIMIT_TIMER_BASED_ON_WEAR == limitType:
rawRemain = player.GetItemMetinSocket(player.INVENTORY, slotNumber, 0)
cacheKey = (slotNumber, itemVnum)
cache = self.dsTimeCache.get(cacheKey)
if cache and cache["remainSec"] == rawRemain:
remainSec = cache["endTime"] - now
else:
endTime = now + rawRemain
self.dsTimeCache[cacheKey] = {"remainSec": rawRemain, "endTime": endTime}
remainSec = endTime - now
break
if remainSec is None or remainSec <= 0:
continue
if minRemain is None or remainSec < minRemain:
minRemain = remainSec
return minRemain
def __UpdateDragonSoulDescription(self):
if not self.description:
return
minRemain = self.__GetDragonSoulMinRemainSec()
self.__EnsureToolTip()
self.toolTip.ClearToolTip()
self.toolTip.SetTitle(self.description)
if minRemain is not None:
self.toolTip.AppendTextLine("(%s : %s)" % (localeInfo.LEFT_TIME, localeInfo.RTSecondToDHMS(minRemain)))
self.toolTip.ResizeToolTip()
# MR-10: -- END OF -- Add toolTip support and real-time countdown for affects
def SetSkillAffectFlag(self, flag):
self.isSkillAffect = flag
@@ -338,12 +504,40 @@ class AffectImage(ui.ExpandedImageBox):
return self.isSkillAffect
def OnMouseOverIn(self):
# MR-10: Add toolTip support and real-time countdown for affects
self.isHover = True
if self.__IsAutoPotionAffect():
self.UpdateAutoPotionDescription()
if self.toolTip:
self.toolTip.ShowToolTip()
return
if self.__IsDragonSoulAffect():
self.__UpdateDragonSoulDescription()
if self.toolTip:
self.toolTip.ShowToolTip()
return
if self.__ShouldShowTimedToolTip():
remainSec = max(0, self.endTime - app.GetGlobalTimeStamp())
self.__UpdateTimedDescription(remainSec)
if self.toolTip:
self.toolTip.ShowToolTip()
return
if self.toolTipText:
self.toolTipText.Show()
def OnMouseOverOut(self):
self.isHover = False
if self.toolTip:
self.toolTip.HideToolTip()
if self.toolTipText:
self.toolTipText.Hide()
# MR-10: -- END OF -- Add toolTip support and real-time countdown for affects
class AffectShower(ui.Window):
@@ -526,7 +720,7 @@ class AffectShower(ui.Window):
if affect == chr.NEW_AFFECT_EXP_BONUS_EURO_FREE or\
affect == chr.NEW_AFFECT_EXP_BONUS_EURO_FREE_UNDER_15 or\
self.INFINITE_AFFECT_DURATION < duration:
image.SetClock(FALSE)
image.SetClock(False)
image.UpdateDescription()
elif affect == chr.NEW_AFFECT_AUTO_SP_RECOVERY or affect == chr.NEW_AFFECT_AUTO_HP_RECOVERY:
image.UpdateAutoPotionDescription()
@@ -537,7 +731,7 @@ class AffectShower(ui.Window):
image.SetScale(1, 1)
else:
image.SetScale(0.7, 0.7)
image.SetSkillAffectFlag(FALSE)
image.SetSkillAffectFlag(False)
image.Show()
self.affectImageDict[affect] = image
self.__ArrangeImageList()
@@ -618,12 +812,13 @@ class AffectShower(ui.Window):
filename = affectData[1]
skillIndex = player.AffectIndexToSkillIndex(affect)
if 0 != skillIndex:
name = skill.GetSkillName(skillIndex)
image = AffectImage()
image.SetParent(self)
image.SetSkillAffectFlag(TRUE)
image.SetSkillAffectFlag(True)
try:
image.LoadImage(filename)
@@ -680,9 +875,16 @@ class AffectShower(ui.Window):
def OnUpdate(self):
try:
if app.GetGlobalTime() - self.lastUpdateTime > 500:
# MR-10: Add toolTip support and real-time countdown for affects
curTime = app.GetGlobalTime()
if curTime < self.lastUpdateTime:
self.lastUpdateTime = 0
if curTime - self.lastUpdateTime > 500:
#if 0 < app.GetGlobalTime():
self.lastUpdateTime = app.GetGlobalTime()
self.lastUpdateTime = curTime
# MR-10: -- END OF -- Add toolTip support and real-time countdown for affects
for image in list(self.affectImageDict.values()):
if image.GetAffect() == chr.NEW_AFFECT_AUTO_HP_RECOVERY or image.GetAffect() == chr.NEW_AFFECT_AUTO_SP_RECOVERY:

View File

@@ -123,7 +123,7 @@ class BeltInventoryWindow(ui.ScriptWindow):
def __del__(self):
ui.ScriptWindow.__del__(self)
def Show(self, openBeltSlot = FALSE):
def Show(self, openBeltSlot = False):
self.__LoadWindow()
self.RefreshSlot()
@@ -201,9 +201,9 @@ class BeltInventoryWindow(ui.ScriptWindow):
for i in range(item.BELT_INVENTORY_SLOT_COUNT):
slotNumber = item.BELT_INVENTORY_SLOT_START + i
wndBeltInventorySlot.SetCoverButton(slotNumber, "d:/ymir work/ui/game/quest/slot_button_01.sub",\
"d:/ymir work/ui/game/quest/slot_button_01.sub",\
"d:/ymir work/ui/game/quest/slot_button_01.sub",\
"d:/ymir work/ui/game/belt_inventory/slot_disabled.tga", FALSE, FALSE)
"d:/ymir work/ui/game/quest/slot_button_01.sub",\
"d:/ymir work/ui/game/quest/slot_button_01.sub",\
"d:/ymir work/ui/game/belt_inventory/slot_disabled.tga", False, False)
except:
import exception
@@ -225,7 +225,7 @@ class BeltInventoryWindow(ui.ScriptWindow):
for i in range(item.BELT_INVENTORY_SLOT_COUNT):
slotNumber = item.BELT_INVENTORY_SLOT_START + i
self.wndBeltInventorySlot.SetItemSlot(slotNumber, getItemVNum(slotNumber), player.GetItemCount(slotNumber))
self.wndBeltInventorySlot.SetAlwaysRenderCoverButton(slotNumber, TRUE)
self.wndBeltInventorySlot.SetAlwaysRenderCoverButton(slotNumber, True)
avail = "0"
@@ -986,19 +986,18 @@ class InventoryWindow(ui.ScriptWindow):
if self.__CanAddItemAttr(dstSlotPos):
return True
elif "USE_ADD_ACCESSORY_SOCKET" == useType:
if self.__CanAddAccessorySocket(dstSlotPos):
# MR-10: Add belt support for accessory sockets
if self.__CanAddAccessorySocket(dstSlotPos) or self.__CanAddBeltSocket(dstSlotPos):
return True
# MR-10: -- END OF -- Add belt support for accessory sockets
elif "USE_PUT_INTO_ACCESSORY_SOCKET" == useType:
if self.__CanPutAccessorySocket(dstSlotPos, srcItemVNum):
return TRUE
elif "USE_PUT_INTO_BELT_SOCKET" == useType:
dstItemVNum = player.GetItemIndex(dstSlotPos)
print(("USE_PUT_INTO_BELT_SOCKET", srcItemVNum, dstItemVNum))
item.SelectItem(dstItemVNum)
if item.ITEM_TYPE_BELT == item.GetItemType():
return True
elif "USE_PUT_INTO_BELT_SOCKET" == useType:
# MR-10: Add belt support for accessory sockets
if self.__CanPutBeltSocket(dstSlotPos, srcItemVNum):
return True
# MR-10: -- END OF -- Add belt support for accessory sockets
return False
@@ -1034,6 +1033,32 @@ class InventoryWindow(ui.ScriptWindow):
return False
# MR-10: Add belt support for accessory sockets
def __CanPutBeltSocket(self, dstSlotPos, mtrlVnum):
dstItemVNum = player.GetItemIndex(dstSlotPos)
if dstItemVNum == 0:
return False
item.SelectItem(dstItemVNum)
if item.ITEM_TYPE_BELT != item.GetItemType():
return False
if mtrlVnum != constInfo.GET_BELT_MATERIAL_VNUM(dstItemVNum):
return False
curCount = player.GetItemMetinSocket(dstSlotPos, 0)
maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
if maxCount <= 0:
return False
if curCount >= maxCount:
return False
return True
# MR-10: -- END OF -- Add belt support for accessory sockets
def __CanPutAccessorySocket(self, dstSlotPos, mtrlVnum):
dstItemVNum = player.GetItemIndex(dstSlotPos)
if dstItemVNum == 0:
@@ -1080,6 +1105,29 @@ class InventoryWindow(ui.ScriptWindow):
return True
# MR-10: Add belt support for accessory sockets
def __CanAddBeltSocket(self, dstSlotPos):
dstItemVNum = player.GetItemIndex(dstSlotPos)
if dstItemVNum == 0:
return False
item.SelectItem(dstItemVNum)
if item.ITEM_TYPE_BELT != item.GetItemType():
return False
curCount = player.GetItemMetinSocket(dstSlotPos, 0)
maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
ACCESSORY_SOCKET_MAX_SIZE = 3
if maxCount >= ACCESSORY_SOCKET_MAX_SIZE:
return False
return True
# MR-10: -- END OF -- Add belt support for accessory sockets
def __CanAddItemAttr(self, dstSlotPos):
dstItemVNum = player.GetItemIndex(dstSlotPos)
if dstItemVNum == 0:

View File

@@ -174,9 +174,11 @@ class ToolTip(ui.ThinBoard):
def AlignTextLineHorizonalCenter(self):
for child in self.childrenList:
if type(child).__name__ == "TextLine":
# MR-10: Fix element centering in tooltips
if type(child).__name__ == "TextLine" and getattr(child, "_centerAlign", False):
(x, y) = child.GetLocalPosition()
child.SetPosition(self.toolTipWidth / 2, y)
# MR-10: -- END OF -- Fix element centering in tooltips
self.ResizeToolTip()
@@ -190,6 +192,10 @@ class ToolTip(ui.ThinBoard):
textLine.SetFeather(False)
textLine.Show()
# MR-10: Fix element centering in tooltips
textLine._centerAlign = centerAlign
# MR-10: -- END OF -- Fix element centering in tooltips
if centerAlign:
textLine.SetPosition(self.toolTipWidth/2, self.toolTipHeight)
textLine.SetHorizontalAlignCenter()
@@ -222,6 +228,10 @@ class ToolTip(ui.ThinBoard):
if show:
textLine.Show()
# MR-10: Fix element centering in tooltips
textLine._centerAlign = centerAlign
# MR-10: -- END OF -- Fix element centering in tooltips
textWidth, _ = textLine.GetTextSize()
textWidth += 20
@@ -503,6 +513,18 @@ class ItemToolTip(ToolTip):
self.itemSlotIndex = -1
self.wndDragonSoul = None
self.dsActivatedTimeCache = {}
# MR-10: Add accessorySocketTimeCache for real-time remaining time display of accessory sockets.
cache = getattr(app, "_accessorySocketTimeCache", None)
if cache is None:
cache = getattr(player, "_accessorySocketTimeCache", None)
if cache is None:
cache = constInfo.ACCESSORY_SOCKET_TIME_CACHE
app._accessorySocketTimeCache = cache
player._accessorySocketTimeCache = cache
constInfo.ACCESSORY_SOCKET_TIME_CACHE = cache
self.accessorySocketTimeCache = cache
# MR-10: -- END OF -- Add accessorySocketTimeCache for real-time remaining time display of accessory sockets.
self.hairIcon = None
def __del__(self):
ToolTip.__del__(self)
@@ -577,6 +599,14 @@ class ItemToolTip(ToolTip):
return ToolTip.AppendTextLineTime(self, endTime, getLimit, color)
def ClearToolTip(self):
# MR-10: Fix element centering in tooltips
hairIcon = getattr(self, "hairIcon", None)
if hairIcon:
hairIcon.Hide()
self.hairIcon = None
# MR-10: -- END OF -- Fix element centering in tooltips
self.isShopItem = False
self.toolTipWidth = self.TOOL_TIP_WIDTH
self.itemWindowType = None
@@ -1357,11 +1387,30 @@ class ItemToolTip(ToolTip):
elif self.__IsCostumeHair(itemVnum):
itemImage.LoadImage("icon/hair/%d.sub" % (itemVnum - 100000))
itemImage.SetPosition(itemImage.GetWidth()/2, self.toolTipHeight)
# MR-10: Fix element centering in tooltips
self.hairIcon = itemImage
xPos = max(0, (self.toolTipWidth - itemImage.GetWidth()) / 2)
itemImage.SetPosition(xPos, self.toolTipHeight)
# MR-10: -- END OF -- Fix element centering in tooltips
self.toolTipHeight += itemImage.GetHeight()
#self.toolTipWidth += itemImage.GetWidth()/2
self.childrenList.append(itemImage)
self.ResizeToolTip()
# MR-10: Fix element centering in tooltips
self.__CenterHairIcon()
# MR-10: -- END OF -- Fix element centering in tooltips
# MR-10: Fix element centering in tooltips
def __CenterHairIcon(self):
if not self.hairIcon:
return
(xPos, yPos) = self.hairIcon.GetLocalPosition()
xPos = max(0, (self.toolTipWidth - self.hairIcon.GetWidth()) / 2)
self.hairIcon.SetPosition(xPos, yPos)
# MR-10: -- END OF -- Fix element centering in tooltips
## If the Description is large, adjust the tooltip size.
def __AdjustMaxWidth(self, attrSlot, desc):
@@ -1371,6 +1420,10 @@ class ItemToolTip(ToolTip):
if newToolTipWidth > self.toolTipWidth:
self.toolTipWidth = newToolTipWidth
self.ResizeToolTip()
# MR-10: Fix element centering in tooltips
self.AlignTextLineHorizonalCenter()
self.__CenterHairIcon()
# MR-10: -- END OF -- Fix element centering in tooltips
def __AdjustAttrMaxWidth(self, attrSlot):
if 0 == attrSlot:
@@ -1406,6 +1459,11 @@ class ItemToolTip(ToolTip):
def ResizeToolTipWidth(self, width):
self.toolTipWidth = width
# MR-10: Fix element centering in tooltips
self.AlignTextLineHorizonalCenter()
self.__CenterHairIcon()
# MR-10: -- END OF -- Fix element centering in tooltips
def __CalculateToolTipWidth(self):
affectTextLineLenList = []
@@ -1430,6 +1488,10 @@ class ItemToolTip(ToolTip):
self.AlignTextLineHorizonalCenter()
# MR-10: Fix element centering in tooltips
self.__CenterHairIcon()
# MR-10: -- END OF -- Fix element centering in tooltips
def __SetSkillBookToolTip(self, skillIndex, bookName, skillGrade):
skillName = skill.GetSkillName(skillIndex)
@@ -1854,8 +1916,21 @@ class ItemToolTip(ToolTip):
self.childrenList.append(affectTextLine)
self.toolTipHeight += 16 + 2
# MR-10: Add real-time remaining time display for accessory sockets.
if 0 != leftTime:
timeText = (localeInfo.LEFT_TIME + " : " + localeInfo.RTSecondToDHMS(leftTime))
isEquipped = False
if self.itemWindowType == player.INVENTORY and self.itemSlotIndex >= 0:
isEquipped = player.IsEquipmentSlot(self.itemSlotIndex)
if isEquipped:
endTime = self.__GetAccessorySocketEndTime(leftTime, index)
leftSec = max(0, endTime - app.GetGlobalTimeStamp())
timeText = localeInfo.LEFT_TIME + " : " + localeInfo.RTSecondToDHMS(leftSec)
else:
endTime = None
timeText = localeInfo.LEFT_TIME + " : " + localeInfo.RTSecondToDHMS(leftTime)
# MR-10: -- END OF -- Add real-time remaining time display for accessory sockets.
timeTextLine = ui.TextLine()
timeTextLine.SetParent(self)
@@ -1867,6 +1942,12 @@ class ItemToolTip(ToolTip):
timeTextLine.Show()
timeTextLine.SetText(timeText)
self.childrenList.append(timeTextLine)
# MR-10: Add real-time remaining time display for accessory sockets.
if isEquipped and endTime is not None:
self.timeInfoList.append({"line": timeTextLine, "value": endTime, "limit": None})
# MR-10: -- END OF -- Add real-time remaining time display for accessory sockets.
self.toolTipHeight += 16 + 2
else:
@@ -1955,6 +2036,26 @@ class ItemToolTip(ToolTip):
self.dsActivatedTimeCache[key] = {"remainSec": remainSec, "endTime": endTime}
return endTime
# MR-10: Add real-time remaining time display for accessory sockets.
def __GetAccessorySocketEndTime(self, remainSec, socketIndex):
key = (self.itemWindowType, self.itemSlotIndex, socketIndex, self.itemVnum)
cache = self.accessorySocketTimeCache.get(key)
now = app.GetGlobalTimeStamp()
if cache:
cachedEnd = cache.get("endTime", 0)
cachedRemain = cache.get("remainSec", remainSec)
if cachedEnd > now and remainSec >= cachedRemain:
return cachedEnd
endTime = now + remainSec
self.accessorySocketTimeCache[key] = {"remainSec": remainSec, "endTime": endTime}
return endTime
# MR-10: -- END OF -- Add real-time remaining time display for accessory sockets.
def AppendRealTimeStartFirstUseLastTime(self, item, metinSlot, limitIndex, getLimit):
useCount = metinSlot[1]
endTime = metinSlot[0]