Several bug fixes

This commit is contained in:
Mind Rapist
2026-02-13 01:44:21 +02:00
parent 9def5d8f52
commit be309911d0
79 changed files with 579 additions and 215 deletions

View File

@@ -81,7 +81,7 @@ class GameWindow(ui.ScriptWindow):
self.affectShower = None
self.playerGauge = None
self.stream=stream
self.stream = stream
self.interface = interfaceModule.Interface()
self.interface.MakeInterface()
self.interface.ShowDefaultWindows()
@@ -226,7 +226,7 @@ class GameWindow(ui.ScriptWindow):
(cameraDistance, cameraPitch, cameraRotation, cameraHeight) = app.GetCamera()
if musicInfo.fieldMusic != "":
snd.FadeOutMusic("BGM/"+ musicInfo.fieldMusic)
snd.FadeOutMusic("BGM/" + musicInfo.fieldMusic)
self.onPressKeyDict = None
self.onClickKeyDict = None
@@ -306,43 +306,43 @@ class GameWindow(ui.ScriptWindow):
## Used for number shortcut quickslots (subsequent numbers also reserved for quickslots)
## F12 is client debug key, should not be used here.
onPressKeyDict[app.DIK_1] = lambda : self.__PressNumKey(1)
onPressKeyDict[app.DIK_2] = lambda : self.__PressNumKey(2)
onPressKeyDict[app.DIK_3] = lambda : self.__PressNumKey(3)
onPressKeyDict[app.DIK_4] = lambda : self.__PressNumKey(4)
onPressKeyDict[app.DIK_5] = lambda : self.__PressNumKey(5)
onPressKeyDict[app.DIK_6] = lambda : self.__PressNumKey(6)
onPressKeyDict[app.DIK_7] = lambda : self.__PressNumKey(7)
onPressKeyDict[app.DIK_8] = lambda : self.__PressNumKey(8)
onPressKeyDict[app.DIK_9] = lambda : self.__PressNumKey(9)
onPressKeyDict[app.DIK_F1] = lambda : self.__PressQuickSlot(4)
onPressKeyDict[app.DIK_F2] = lambda : self.__PressQuickSlot(5)
onPressKeyDict[app.DIK_F3] = lambda : self.__PressQuickSlot(6)
onPressKeyDict[app.DIK_F4] = lambda : self.__PressQuickSlot(7)
onPressKeyDict[app.DIK_1] = lambda: self.__PressNumKey(1)
onPressKeyDict[app.DIK_2] = lambda: self.__PressNumKey(2)
onPressKeyDict[app.DIK_3] = lambda: self.__PressNumKey(3)
onPressKeyDict[app.DIK_4] = lambda: self.__PressNumKey(4)
onPressKeyDict[app.DIK_5] = lambda: self.__PressNumKey(5)
onPressKeyDict[app.DIK_6] = lambda: self.__PressNumKey(6)
onPressKeyDict[app.DIK_7] = lambda: self.__PressNumKey(7)
onPressKeyDict[app.DIK_8] = lambda: self.__PressNumKey(8)
onPressKeyDict[app.DIK_9] = lambda: self.__PressNumKey(9)
onPressKeyDict[app.DIK_F1] = lambda: self.__PressQuickSlot(4)
onPressKeyDict[app.DIK_F2] = lambda: self.__PressQuickSlot(5)
onPressKeyDict[app.DIK_F3] = lambda: self.__PressQuickSlot(6)
onPressKeyDict[app.DIK_F4] = lambda: self.__PressQuickSlot(7)
onPressKeyDict[app.DIK_LALT] = lambda : self.ShowName()
onPressKeyDict[app.DIK_LCONTROL] = lambda : self.ShowMouseImage()
onPressKeyDict[app.DIK_SYSRQ] = lambda : self.SaveScreen()
onPressKeyDict[app.DIK_SPACE] = lambda : self.StartAttack()
onPressKeyDict[app.DIK_LALT] = lambda: self.ShowName()
onPressKeyDict[app.DIK_LCONTROL] = lambda: self.ShowMouseImage()
onPressKeyDict[app.DIK_SYSRQ] = lambda: self.SaveScreen()
onPressKeyDict[app.DIK_SPACE] = lambda: self.StartAttack()
#Character movement keys
onPressKeyDict[app.DIK_UP] = lambda : self.MoveUp()
onPressKeyDict[app.DIK_DOWN] = lambda : self.MoveDown()
onPressKeyDict[app.DIK_LEFT] = lambda : self.MoveLeft()
onPressKeyDict[app.DIK_RIGHT] = lambda : self.MoveRight()
onPressKeyDict[app.DIK_W] = lambda : self.MoveUp()
onPressKeyDict[app.DIK_S] = lambda : self.MoveDown()
onPressKeyDict[app.DIK_A] = lambda : self.MoveLeft()
onPressKeyDict[app.DIK_UP] = lambda: self.MoveUp()
onPressKeyDict[app.DIK_DOWN] = lambda: self.MoveDown()
onPressKeyDict[app.DIK_LEFT] = lambda: self.MoveLeft()
onPressKeyDict[app.DIK_RIGHT] = lambda: self.MoveRight()
onPressKeyDict[app.DIK_W] = lambda: self.MoveUp()
onPressKeyDict[app.DIK_S] = lambda: self.MoveDown()
onPressKeyDict[app.DIK_A] = lambda: self.MoveLeft()
# MR-3: Keyboard-enabled deck toggling
onPressKeyDict[app.DIK_D] = lambda : self.__PressDKey()
onPressKeyDict[app.DIK_D] = lambda: self.__PressDKey()
# MR-3: -- END OF -- Keyboard-enabled deck toggling
onPressKeyDict[app.DIK_E] = lambda: app.RotateCamera(app.CAMERA_TO_POSITIVE)
onPressKeyDict[app.DIK_R] = lambda: app.ZoomCamera(app.CAMERA_TO_NEGATIVE)
#onPressKeyDict[app.DIK_F] = lambda: app.ZoomCamera(app.CAMERA_TO_POSITIVE)
onPressKeyDict[app.DIK_T] = lambda: app.PitchCamera(app.CAMERA_TO_NEGATIVE)
onPressKeyDict[app.DIK_G] = self.__PressGKey
onPressKeyDict[app.DIK_Q] = self.__PressQKey
onPressKeyDict[app.DIK_G] = lambda: self.__PressGKey()
onPressKeyDict[app.DIK_Q] = lambda: self.__PressQKey()
onPressKeyDict[app.DIK_NUMPAD9] = lambda: app.MovieResetCamera()
onPressKeyDict[app.DIK_NUMPAD4] = lambda: app.MovieRotateCamera(app.CAMERA_TO_NEGATIVE)
@@ -351,28 +351,28 @@ class GameWindow(ui.ScriptWindow):
onPressKeyDict[app.DIK_PGDN] = lambda: app.MovieZoomCamera(app.CAMERA_TO_POSITIVE)
onPressKeyDict[app.DIK_NUMPAD8] = lambda: app.MoviePitchCamera(app.CAMERA_TO_NEGATIVE)
onPressKeyDict[app.DIK_NUMPAD2] = lambda: app.MoviePitchCamera(app.CAMERA_TO_POSITIVE)
onPressKeyDict[app.DIK_GRAVE] = lambda : self.PickUpItem()
onPressKeyDict[app.DIK_Z] = lambda : self.PickUpItem()
onPressKeyDict[app.DIK_GRAVE] = lambda: self.PickUpItem()
onPressKeyDict[app.DIK_Z] = lambda: self.PickUpItem()
# MR-3: Keyboard-enabled deck toggling
onPressKeyDict[app.DIK_C] = lambda : self.__PressCKey()
onPressKeyDict[app.DIK_C] = lambda: self.__PressCKey()
# MR-3: -- END OF -- Keyboard-enabled deck toggling
onPressKeyDict[app.DIK_V] = lambda state = "SKILL": self.interface.ToggleCharacterWindow(state)
#onPressKeyDict[app.DIK_B] = lambda state = "EMOTICON": self.interface.ToggleCharacterWindow(state)
onPressKeyDict[app.DIK_N] = lambda state = "QUEST": self.interface.ToggleCharacterWindow(state)
onPressKeyDict[app.DIK_I] = lambda : self.interface.ToggleInventoryWindow()
onPressKeyDict[app.DIK_O] = lambda : self.interface.ToggleDragonSoulWindowWithNoInfo()
onPressKeyDict[app.DIK_M] = lambda : self.interface.PressMKey()
#onPressKeyDict[app.DIK_H] = lambda : self.interface.OpenHelpWindow()
onPressKeyDict[app.DIK_ADD] = lambda : self.interface.MiniMapScaleUp()
onPressKeyDict[app.DIK_SUBTRACT] = lambda : self.interface.MiniMapScaleDown()
onPressKeyDict[app.DIK_L] = lambda : self.interface.ToggleChatLogWindow()
onPressKeyDict[app.DIK_COMMA] = lambda : self.ShowConsole() # "`" key
onPressKeyDict[app.DIK_LSHIFT] = lambda : self.__SetQuickPageMode()
onPressKeyDict[app.DIK_I] = lambda: self.interface.ToggleInventoryWindow()
onPressKeyDict[app.DIK_O] = lambda: self.interface.ToggleDragonSoulWindowWithNoInfo()
onPressKeyDict[app.DIK_M] = lambda: self.interface.PressMKey()
#onPressKeyDict[app.DIK_H] = lambda: self.interface.OpenHelpWindow()
onPressKeyDict[app.DIK_ADD] = lambda: self.interface.MiniMapScaleUp()
onPressKeyDict[app.DIK_SUBTRACT] = lambda: self.interface.MiniMapScaleDown()
onPressKeyDict[app.DIK_L] = lambda: self.interface.ToggleChatLogWindow()
onPressKeyDict[app.DIK_COMMA] = lambda: self.ShowConsole() # "`" key
onPressKeyDict[app.DIK_LSHIFT] = lambda: self.__SetQuickPageMode()
onPressKeyDict[app.DIK_J] = lambda : self.__PressJKey()
onPressKeyDict[app.DIK_H] = lambda : self.__PressHKey()
onPressKeyDict[app.DIK_B] = lambda : self.__PressBKey()
onPressKeyDict[app.DIK_F] = lambda : self.__PressFKey()
onPressKeyDict[app.DIK_J] = lambda: self.__PressJKey()
onPressKeyDict[app.DIK_H] = lambda: self.__PressHKey()
onPressKeyDict[app.DIK_B] = lambda: self.__PressBKey()
onPressKeyDict[app.DIK_F] = lambda: self.__PressFKey()
# CUBE_TEST
#onPressKeyDict[app.DIK_K] = lambda : self.interface.OpenCubeWindow()
@@ -1483,30 +1483,33 @@ class GameWindow(ui.ScriptWindow):
#
# Output character coordinates and FPS
(x, y, z) = player.GetMainCharacterPosition()
nUpdateTime = app.GetUpdateTime()
nUpdateFPS = app.GetUpdateFPS()
nRenderFPS = app.GetRenderFPS()
nFaceCount = app.GetFaceCount()
fFaceSpeed = app.GetFaceSpeed()
nST=background.GetRenderShadowTime()
nST = background.GetRenderShadowTime()
(fAveRT, nCurRT) = app.GetRenderTime()
(iNum, fFogStart, fFogEnd, fFarCilp) = background.GetDistanceSetInfo()
(iPatch, iSplat, fSplatRatio, sTextureNum) = background.GetRenderedSplatNum()
if iPatch == 0:
iPatch = 1
#(dwRenderedThing, dwRenderedCRC) = background.GetRenderedGraphicThingInstanceNum()
self.PrintCoord.SetText("Coordinate: %.2f %.2f %.2f ATM: %d" % (x, y, z, app.GetAvailableTextureMemory()/(1024*1024)))
self.PrintCoord.SetText("Coordinate: %.2f %.2f %.2f ATM: %d" % (x, y, z, app.GetAvailableTextureMemory() / (1024 * 1024)))
xMouse, yMouse = wndMgr.GetMousePosition()
self.PrintMousePos.SetText("MousePosition: %d %d" % (xMouse, yMouse))
self.FrameRate.SetText("UFPS: %3d UT: %3d FS %.2f" % (nUpdateFPS, nUpdateTime, fFaceSpeed))
if fAveRT>1.0:
self.Pitch.SetText("RFPS: %3d RT:%.2f(%3d) FC: %d(%.2f) " % (nRenderFPS, fAveRT, nCurRT, nFaceCount, nFaceCount/fAveRT))
if fAveRT > 1.0:
self.Pitch.SetText("RFPS: %3d RT: %.2f(%3d) FC: %d(%.2f) " % (nRenderFPS, fAveRT, nCurRT, nFaceCount, nFaceCount / fAveRT))
self.Splat.SetText("PATCH: %d SPLAT: %d BAD(%.2f)" % (iPatch, iSplat, fSplatRatio))
self.Splat.SetText("PATCH: %d SPLAT: %d BAD (%.2f)" % (iPatch, iSplat, fSplatRatio))
#self.Pitch.SetText("Pitch: %.2f" % (app.GetCameraPitch())
#self.TextureNum.SetText("TN : %s" % (sTextureNum))
#self.ObjectNum.SetText("GTI : %d, CRC : %d" % (dwRenderedThing, dwRenderedCRC))
@@ -1552,6 +1555,7 @@ class GameWindow(ui.ScriptWindow):
textTail.UpdateShowingTextTail()
textTail.ArrangeTextTail()
if -1 != self.PickingItemIndex:
textTail.SelectItemName(self.PickingItemIndex)
@@ -1669,7 +1673,7 @@ class GameWindow(ui.ScriptWindow):
try:
for eachInfoText in listText.split("/"):
eachInfo = eachInfoText.split(",")
eachInfo = eachInfoText.split(",")
itemVnum = int(eachInfo[0])
itemCount = int(eachInfo[1])
@@ -1679,7 +1683,8 @@ class GameWindow(ui.ScriptWindow):
resultCount = len(self.cubeInformation[npcVNUM])
requestCount = 7
modCount = resultCount % requestCount
splitCount = resultCount / requestCount
splitCount = resultCount // requestCount
for i in range(splitCount):
#print("/cube r_info %d %d" % (i * requestCount, requestCount))
net.SendChatPacket("/cube r_info %d %d" % (i * requestCount, requestCount))
@@ -2131,7 +2136,7 @@ class GameWindow(ui.ScriptWindow):
randX = app.GetRandom(-150, 150)
randY = app.GetRandom(-150, 150)
snd.PlaySound3D(x+randX, -y+randY, z, "sound/common/etc/salute.mp3")
snd.PlaySound3D(x + randX, -y + randY, z, "sound/common/etc/salute.mp3")
def __PartyRequestQuestion(self, vid):
vid = int(vid)

View File

@@ -57,6 +57,9 @@ class Interface(object):
self.inputDialog = None
self.tipBoard = None
self.bigBoard = None
# MR-11: Suppress quest button when quest dialog is open to prevent quest button flashing
self.questButtonSuppressed = False
# MR-11: -- END OF -- Suppress quest button when quest dialog is open to prevent quest button flashing
# ITEM_MALL
self.mallPageDlg = None
@@ -107,11 +110,10 @@ class Interface(object):
self.wndGuild = uiGuild.GuildWindow()
def __MakeChatWindow(self):
wndChat = uiChat.ChatWindow()
wndChat.SetSize(wndChat.CHAT_WINDOW_WIDTH, 0)
wndChat.SetPosition(wndMgr.GetScreenWidth()/2 - wndChat.CHAT_WINDOW_WIDTH/2, wndMgr.GetScreenHeight() - wndChat.EDIT_LINE_HEIGHT - 37)
wndChat.SetPosition(wndMgr.GetScreenWidth() // 2 - wndChat.CHAT_WINDOW_WIDTH // 2, wndMgr.GetScreenHeight() - wndChat.EDIT_LINE_HEIGHT - 37)
wndChat.SetHeight(200)
wndChat.Refresh()
wndChat.Show()
@@ -1155,9 +1157,15 @@ class Interface(object):
self.wndDragonSoulRefine,
hideWindows = [x for x in hideWindows if x.IsShow()]
list([x.Hide() for x in hideWindows])
import sys
# MR-11: Suppress quest button when quest dialog is open to prevent quest button flashing
self.questButtonSuppressed = True
# MR-11: -- END OF -- Suppress quest button when quest dialog is open to prevent quest button flashing
self.HideAllQuestButton()
self.HideAllWhisperButton()
@@ -1168,8 +1176,15 @@ class Interface(object):
def __ShowWindows(self, wnds):
import sys
list([x.Show() for x in wnds])
# MR-11: Suppress quest button when quest dialog is open to prevent quest button flashing
self.questButtonSuppressed = False
# MR-11: -- END OF -- Suppress quest button when quest dialog is open to prevent quest button flashing
global IsQBHide
if not IsQBHide:
self.ShowAllQuestButton()
else:
@@ -1273,6 +1288,7 @@ class Interface(object):
### Quest ###
def BINARY_ClearQuest(self, index):
btn = self.__FindQuestButton(index)
if 0 != btn:
self.__DestroyQuestButton(btn)
@@ -1321,7 +1337,13 @@ class Interface(object):
btn.ToolTipText.SetHorizontalAlignLeft()
btn.SetEvent(ui.__mem_func__(self.__StartQuest), btn)
btn.Show()
# MR-1: Hide quest button when quest dialog is open to prevent quest button flashing
if IsQBHide or self.questButtonSuppressed:
btn.Hide()
else:
btn.Show()
# MR-1: -- END OF -- Hide quest button when quest dialog is open to prevent quest button flashing
btn.index = index
btn.name = name
@@ -1332,7 +1354,6 @@ class Interface(object):
#chat.AppendChat(chat.CHAT_TYPE_NOTICE, localeInfo.QUEST_APPEND)
def __ArrangeQuestButton(self):
screenWidth = wndMgr.GetScreenWidth()
screenHeight = wndMgr.GetScreenHeight()
@@ -1345,19 +1366,23 @@ class Interface(object):
if app.IsRTL():
xPos = xPos + 15
yPos = 170 * screenHeight / 600
yCount = (screenHeight - 330) / 63
yPos = 170 * screenHeight // 600
yCount = (screenHeight - 330) // 63
count = 0
for btn in self.questButtonList:
btn.SetPosition(xPos + (int(count/yCount) * 100), yPos + (count%yCount * 63))
for btn in self.questButtonList:
btn.SetPosition(xPos + (int(count // yCount) * 100), yPos + (count % yCount * 63))
count += 1
global IsQBHide
if IsQBHide:
# MR-1: Hide quest button when quest dialog is open to prevent quest button flashing
if IsQBHide or self.questButtonSuppressed:
btn.Hide()
else:
btn.Show()
# MR-1: -- END OF -- Hide quest button when quest dialog is open to prevent quest button flashing
def __StartQuest(self, btn):
event.QuestButtonClick(btn.index)
@@ -1505,19 +1530,19 @@ class Interface(object):
## Rearranges buttons when button count changes
def __ArrangeWhisperButton(self):
screenWidth = wndMgr.GetScreenWidth()
screenHeight = wndMgr.GetScreenHeight()
xPos = screenWidth - 70
yPos = 170 * screenHeight / 600
yCount = (screenHeight - 330) / 63
#yCount = (screenHeight - 285) / 63
yPos = 170 * screenHeight // 600
yCount = (screenHeight - 330) // 63
#yCount = (screenHeight - 285) // 63
count = 0
for button in self.whisperButtonList:
button.SetPosition(xPos + (int(count/yCount) * -50), yPos + (count%yCount * 63))
for button in self.whisperButtonList:
button.SetPosition(xPos + (int(count // yCount) * -50), yPos + (count % yCount * 63))
count += 1
## Finds and returns Whisper button by name

View File

@@ -241,6 +241,7 @@ STAT_MINUS_DESCRIPTION = {
'DEX-': STAT_MINUS_DEX,
}
# MR-11: Complete map name list
# Map names
MINIMAP_ZONE_NAME_DICT = {
'metin2_map_a1': MAP_A1,
@@ -256,20 +257,42 @@ MINIMAP_ZONE_NAME_DICT = {
'metin2_map_n_flame_01': MAP_FLAME,
'metin2_map_n_desert_01': MAP_DESERT,
'metin2_map_milgyo': MAP_TEMPLE,
'metin2_map_monkeydungeon': MAP_MONKEY_DUNGEON,
'metin2_map_monkeydungeon_02': MAP_MONKEY_DUNGEON2,
'metin2_map_monkeydungeon_03': MAP_MONKEY_DUNGEON3,
'metin2_map_spiderdungeon': MAP_SPIDER,
'metin2_map_deviltower1': MAP_SKELTOWER,
'metin2_map_guild_01': MAP_AG,
'metin2_map_guild_02': MAP_BG,
'metin2_map_guild_03': MAP_CG,
'metin2_map_spiderdungeon_02': MAP_SPIDERDUNGEON_02,
'metin2_map_spiderdungeon_03': MAP_SPIDERDUNGEON_03,
'metin2_map_deviltower1': MAP_DEVILTOWER1,
'metin2_map_devilsCatacomb': MAP_DEVILCATACOMB,
'metin2_map_guild_01': MAP_GUILD_01,
'metin2_map_guild_02': MAP_GUILD_02,
'metin2_map_guild_03': MAP_GUILD_03,
'metin2_guild_village_01': GUILD_VILLAGE_01,
'metin2_guild_village_02': GUILD_VILLAGE_02,
'metin2_guild_village_03': GUILD_VILLAGE_03,
'metin2_map_trent': MAP_TREE,
'metin2_map_trent02': MAP_TREE2,
'season1/metin2_map_WL_01': MAP_WL,
'season1/metin2_map_nusluck01': MAP_NUSLUCK,
'season1/metin2_map_oxevent': MAP_OXEVENT,
'metin2_map_wedding_01': MAP_WEDDING_01,
'metin2_map_bf': MAP_BATTLE_FIELD,
'metin2_map_bf_02': MAP_BATTLE_FIELD,
'metin2_map_bf_03': MAP_BATTLE_FIELD,
'Metin2_map_CapeDragonHead': MAP_CAPE,
'metin2_map_Mt_Thunder': MAP_THUNDER,
'metin2_map_dawnmistwood': MAP_DAWN,
'metin2_map_BayBlackSand': MAP_BAY,
'metin2_map_n_flame_dungeon_01': MAP_N_FLAME_DUNGEON_01,
'metin2_map_n_snow_dungeon_01': MAP_N_SNOW_DUNGEON_01,
'metin2_map_duel': MAP_DUEL,
'season2/metin2_map_skipia_dungeon_01': MAP_SKIPIA_DUNGEON_01,
'metin2_map_skipia_dungeon_02': MAP_SKIPIA_DUNGEON_02,
'metin2_map_skipia_dungeon_boss': MAP_SKIPIA_DUNGEON_BOSS,
'metin2_map_skipia_dungeon_boss2': MAP_SKIPIA_DUNGEON_BOSS_2,
}
# MR-11: -- END OF -- Complete map name list
# Path of quest icon file
def GetLetterImageName():
@@ -351,6 +374,7 @@ def SecondToDHM(time):
day = ((time // 60) // 60) // 24
text = ''
if day > 0:
text += str(day) + DAY
text += ' '
@@ -394,18 +418,18 @@ def RTSecondToDHMS(time):
if d or not text:
if d:
text += "%dd " % d
text += str(d) + " " + DAY + (", " if h or m or s else "")
if h or not text:
if h:
text += "%dh " % h
text += str(h) + " " + HOUR + (", " if m or s else "")
if m or not text:
if m:
text += "%dm " % m
text += str(m) + " " + MINUTE + (", " if s else "")
if s or not text:
if s:
text += "%ds " % s
text += str(s) + " " + SECOND
return text.strip()

View File

@@ -49,7 +49,7 @@ class LovePointImage(ui.ExpandedImageBox):
if 0 == self.lovePoint:
loveGrade = 0
else:
loveGrade = self.lovePoint // 25 + 1
loveGrade = self.lovePoint / 25 + 1
fileName = self.FILE_DICT.get(loveGrade, self.FILE_PATH+"00.dds")
try:
@@ -79,9 +79,9 @@ class HorseImage(ui.ExpandedImageBox):
FILE_DICT = {
00 : FILE_PATH+"00.dds",
1 : FILE_PATH+"00.dds",
2 : FILE_PATH+"00.dds",
3 : FILE_PATH+"00.dds",
0o1 : FILE_PATH+"00.dds",
0o2 : FILE_PATH+"00.dds",
0o3 : FILE_PATH+"00.dds",
10 : FILE_PATH+"10.dds",
11 : FILE_PATH+"11.dds",
12 : FILE_PATH+"12.dds",
@@ -107,7 +107,7 @@ class HorseImage(ui.ExpandedImageBox):
if 0 == level:
return 0
return (level-1)//10 + 1
return (level-1)/10 + 1
def SetState(self, level, health, battery):
#self.textLineList=[]
@@ -305,7 +305,7 @@ class AffectImage(ui.ExpandedImageBox):
self.toolTipText.SetText(text)
w, h = self.toolTipText.GetTextSize()
self.toolTipText.SetPosition(max(0, x + self.GetWidth()//2 - w//2), y)
self.toolTipText.SetPosition(max(0, x + self.GetWidth()/2 - w/2), y)
def SetDescription(self, description):
self.description = description

View File

@@ -572,7 +572,7 @@ class CharacterWindow(ui.ScriptWindow):
self.toolTipAlignment.ClearToolTip()
self.toolTipAlignment.AutoAppendTextLine(localeInfo.TITLE_NAME_LIST[grade], gradeColor)
self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGNMENT_NAME + str(point))
self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGNMENT_NAME + ": " + str(point))
self.toolTipAlignment.AlignHorizonalCenter()
def __ShowStatusMinusButtonList(self):
@@ -695,21 +695,22 @@ class CharacterWindow(ui.ScriptWindow):
for i in range(min(quest.GetQuestCount(), quest.QUEST_MAX_NUM)):
# END_OF_QUEST_LIMIT_COUNT_BUG_FIX
(lastName, lastTime) = quest.GetQuestLastTime(i)
clockText = localeInfo.QUEST_UNLIMITED_TIME
if len(lastName) > 0:
if lastTime <= 0:
clockText = localeInfo.QUEST_TIMEOVER
else:
questLastMinute = lastTime / 60
questLastMinute = lastTime // 60
questLastSecond = lastTime % 60
clockText = lastName + " : "
if questLastMinute > 0:
clockText += str(questLastMinute) + localeInfo.QUEST_MIN
if questLastSecond > 0:
clockText += " "
@@ -1327,7 +1328,7 @@ class CharacterWindow(ui.ScriptWindow):
return realSkillSlot % skill.SKILL_GRADE_STEP_COUNT
def __GetSkillGradeFromSlot(self, skillSlot):
return int(skillSlot / skill.SKILL_GRADE_STEP_COUNT)
return int(skillSlot // skill.SKILL_GRADE_STEP_COUNT)
def SelectSkillGroup(self, index):
self.__SelectSkillGroup(index)

View File

@@ -192,6 +192,7 @@ class DragonSoulWindow(ui.ScriptWindow):
def Close(self):
if None != self.tooltipItem:
self.tooltipItem.HideToolTip()
self.Hide()
def __DeckButtonDown(self, deck):
@@ -200,18 +201,27 @@ class DragonSoulWindow(ui.ScriptWindow):
def SetInventoryPage(self, page):
if self.inventoryPageIndex != page:
self.__HighlightSlot_ClearCurrentPage()
self.inventoryPageIndex = page
self.inventoryTab[(page+1)%5].SetUp()
self.inventoryTab[(page+2)%5].SetUp()
self.inventoryTab[(page+3)%5].SetUp()
self.inventoryTab[(page+4)%5].SetUp()
self.inventoryTab[(page + 1) % 5].SetUp()
self.inventoryTab[(page + 2) % 5].SetUp()
self.inventoryTab[(page + 3) % 5].SetUp()
self.inventoryTab[(page + 4) % 5].SetUp()
self.RefreshBagSlotWindow()
def SetItemToolTip(self, tooltipItem):
self.tooltipItem = tooltipItem
if tooltipItem:
tooltipItem.SetDragonSoulWindow(self)
# MR-11: Fix Dragon stones timer auto-start
if self.isActivated:
self.__WarmDragonSoulTimeCache()
# MR-11: -- END OF -- Fix Dragon stones timer auto-start
def RefreshItemSlot(self):
self.RefreshBagSlotWindow()
self.RefreshEquipSlotWindow()
@@ -400,9 +410,9 @@ class DragonSoulWindow(ui.ScriptWindow):
itemPrice = item.GetISellItemPrice()
if item.Is1GoldItem():
itemPrice = itemCount / itemPrice / 5
itemPrice = itemCount // itemPrice // 5
else:
itemPrice = itemPrice * itemCount / 5
itemPrice = itemPrice * itemCount // 5
item.GetItemName(itemIndex)
itemName = item.GetItemName()
@@ -547,6 +557,7 @@ class DragonSoulWindow(ui.ScriptWindow):
if mouseModule.mouseController.isAttached():
attachedSlotType = mouseModule.mouseController.GetAttachedType()
attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
# Case of dragging item onto itself
if player.SLOT_TYPE_INVENTORY == attachedSlotType and itemSlotIndex == attachedSlotPos:
return
@@ -561,6 +572,7 @@ class DragonSoulWindow(ui.ScriptWindow):
else:
selectedItemVNum = player.GetItemIndex(player.INVENTORY, itemSlotIndex)
itemCount = player.GetItemCount(player.INVENTORY, itemSlotIndex)
mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
self.wndItem.SetUseMode(False)
snd.PlaySound("sound/ui/pick.wav")
@@ -581,10 +593,12 @@ class DragonSoulWindow(ui.ScriptWindow):
if 0 == player.GetItemMetinSocket(player.DRAGON_SOUL_INVENTORY, attachedSlotPos, 0):
self.wndPopupDialog.SetText(localeInfo.DRAGON_SOUL_EXPIRED)
self.wndPopupDialog.Open()
return
item.SelectItem(attachedItemIndex)
subType = item.GetItemSubType()
if subType != (selectedSlot - player.DRAGON_SOUL_EQUIPMENT_SLOT_START):
self.wndPopupDialog.SetText(localeInfo.DRAGON_SOUL_UNMATCHED_SLOT)
self.wndPopupDialog.Open()
@@ -618,11 +632,13 @@ class DragonSoulWindow(ui.ScriptWindow):
net.SendItemUsePacket(*self.srcItemPos)
else:
self.__SendMoveItemPacket(*(self.srcItemPos + self.dstItemPos + (0,)))
self.dlgQuestion.Close()
def __Cancel(self):
self.srcItemPos = (0, 0)
self.dstItemPos = (0, 0)
self.dlgQuestion.Close()
# Warning dialog related end
@@ -652,9 +668,11 @@ class DragonSoulWindow(ui.ScriptWindow):
if self.isActivated:
self.DeactivateDragonSoul()
net.SendChatPacket("/dragon_soul deactivate")
self.deckPageIndex = page
self.deckTab[page].Down()
self.deckTab[(page+1)%2].SetUp()
self.deckTab[(page + 1) % 2].SetUp()
self.RefreshEquipSlotWindow()
@@ -663,13 +681,17 @@ class DragonSoulWindow(ui.ScriptWindow):
self.isActivated = True
self.activateButton.Down()
self.deckPageIndex = deck
self.deckTab[deck].Down()
self.deckTab[(deck+1)%2].SetUp()
self.deckTab[(deck + 1) % 2].SetUp()
self.RefreshEquipSlotWindow()
self.__WarmDragonSoulTimeCache(deck)
def DeactivateDragonSoul(self):
self.isActivated = False
self.activateButton.SetUp()
if self.tooltipItem:
self.tooltipItem.ClearDragonSoulTimeCache()
@@ -682,8 +704,11 @@ class DragonSoulWindow(ui.ScriptWindow):
if not self.isActivated or self.deckPageIndex != deckIndex:
if self.__CanActivateDeck():
net.SendChatPacket("/dragon_soul activate " + str(deckIndex))
self.isActivated = True
self.activateButton.Down()
self.__WarmDragonSoulTimeCache(deckIndex)
else:
self.isActivated = False
self.activateButton.SetUp()
@@ -695,13 +720,16 @@ class DragonSoulWindow(ui.ScriptWindow):
def __CanActivateDeck(self):
canActiveNum = 0
for i in range(6):
slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(player.INVENTORY, player.DRAGON_SOUL_EQUIPMENT_SLOT_START + i)
itemVnum = player.GetItemIndex(slotNumber)
if itemVnum != 0:
item.SelectItem(itemVnum)
isNoLimit = True
for i in range(item.LIMIT_MAX_NUM):
(limitType, limitValue) = item.GetLimit(i)
@@ -711,14 +739,34 @@ class DragonSoulWindow(ui.ScriptWindow):
if item.LIMIT_TIMER_BASED_ON_WEAR == limitType:
isNoLimit = False
remain_time = player.GetItemMetinSocket(player.INVENTORY, slotNumber, 0)
if 0 != remain_time:
canActiveNum += 1
break
# Dragon soul can be activated if it has no timer
if isNoLimit:
canActiveNum += 1
return canActiveNum > 0
# MR-11: Fix Dragon stones timer auto-start
def __WarmDragonSoulTimeCache(self, deckIndex = None):
if not self.tooltipItem:
return
if not self.isActivated:
return
if deckIndex is None:
deckIndex = self.deckPageIndex
deckStart = deckIndex * player.DRAGON_SOUL_EQUIPMENT_FIRST_SIZE
deckStart += player.DRAGON_SOUL_EQUIPMENT_SLOT_START
slotNumbers = [deckStart + i for i in range(6)]
self.tooltipItem.WarmDragonSoulTimeCache(slotNumbers)
# MR-11: -- END OF -- Fix Dragon stones timer auto-start
# Activation related end
@@ -1136,10 +1184,10 @@ class DragonSoulRefineWindow(ui.ScriptWindow):
def __GetDragonSoulTypeInfo(self, vnum):
if not self.__IsDragonSoul(vnum):
return DragonSoulRefineWindow.INVALID_DRAGON_SOUL_INFO
ds_type = vnum / 10000
grade = vnum % 10000 /1000
step = vnum % 1000 / 100
strength = vnum % 100 / 10
ds_type = vnum // 10000
grade = vnum % 10000 //1000
step = vnum % 1000 // 100
strength = vnum % 100 // 10
return (ds_type, grade, step, strength)

View File

@@ -605,7 +605,7 @@ class ChangeGradeNameDialog(ui.ScriptWindow):
self.gradeNameSlot.SetText("")
self.gradeNameSlot.SetFocus()
xMouse, yMouse = wndMgr.GetMousePosition()
self.SetPosition(xMouse - self.GetWidth()/2, yMouse + 50)
self.SetPosition(xMouse - self.GetWidth() / 2, yMouse + 50)
self.SetTop()
self.Show()
def Close(self):
@@ -1194,7 +1194,7 @@ class GuildWindow(ui.ScriptWindow):
## Passive
"""
for i in xrange(len(playerSettingModule.PASSIVE_GUILD_SKILL_INDEX_LIST)):
for i in range(len(playerSettingModule.PASSIVE_GUILD_SKILL_INDEX_LIST)):
slotIndex = page.passiveSlot.GetStartIndex()+i
skillIndex = playerSettingModule.PASSIVE_GUILD_SKILL_INDEX_LIST[i]
@@ -1398,21 +1398,26 @@ class GuildWindow(ui.ScriptWindow):
return
global DISABLE_DECLARE_WAR
page = self.pageWindow["GUILD_INFO"]
page.nameSlot.SetText(guild.GetGuildName())
page.masterNameSlot.SetText(guild.GetGuildMasterName())
page.guildLevelSlot.SetText(str(guild.GetGuildLevel()))
if page.guildMoneySlot:
page.guildMoneySlot.SetText(str(guild.GetGuildMoney()))
curExp, lastExp = guild.GetGuildExperience()
curExp *= 100
lastExp *= 100
page.curExpSlot.SetText(str(curExp))
page.lastExpSlot.SetText(str(lastExp))
curMemberCount, maxMemberCount = guild.GetGuildMemberCount()
if maxMemberCount== 0xffff:
if maxMemberCount == 0xffff:
page.memberCountSlot.SetText("%d / %s " % (curMemberCount, localeInfo.GUILD_MEMBER_COUNT_INFINITY))
else:
page.memberCountSlot.SetText("%d / %d" % (curMemberCount, maxMemberCount))
@@ -2668,6 +2673,7 @@ if __name__ == "__main__":
material = tokens[TOKEN_MATERIAL]
folderName = ""
if "HEADQUARTER" == type:
folderName = "headquarter"
elif "FACILITY" == type:
@@ -2677,14 +2683,19 @@ if __name__ == "__main__":
##"BuildIn" Is made by exist instance.
materialList = ["0", "0", "0"]
if material[0] == "\"":
material = material[1:]
if material[-1] == "\"":
material = material[:-1]
for one in material.split("/"):
data = one.split(",")
if 2 != len(data):
continue
itemID = int(data[0])
count = data[1]
@@ -2717,7 +2728,7 @@ if __name__ == "__main__":
app.CloseTextFile(handle)
LoadGuildBuildingList(app.GetLocalePath()+"/GuildBuildingList.txt")
LoadGuildBuildingList(app.GetLocalePath() + "/GuildBuildingList.txt")
class TestGame(ui.Window):
def __init__(self):

View File

@@ -797,9 +797,9 @@ class InventoryWindow(ui.ScriptWindow):
itemPrice = item.GetISellItemPrice()
if item.Is1GoldItem():
itemPrice = itemCount / itemPrice / 5
itemPrice = itemCount // itemPrice // 5
else:
itemPrice = itemPrice * itemCount / 5
itemPrice = itemPrice * itemCount // 5
item.GetItemName(itemIndex)
itemName = item.GetItemName()
@@ -1036,6 +1036,7 @@ class InventoryWindow(ui.ScriptWindow):
# MR-10: Add belt support for accessory sockets
def __CanPutBeltSocket(self, dstSlotPos, mtrlVnum):
dstItemVNum = player.GetItemIndex(dstSlotPos)
if dstItemVNum == 0:
return False

View File

@@ -108,8 +108,9 @@ class MessengerItem(ui.Window):
def OnRender(self):
if self.isSelected:
x, y = self.GetGlobalPosition()
grp.SetColor(grp.GenerateColor(0.0, 0.0, 0.7, 0.7))
grp.RenderBar(x+16, y, self.GetWidth()-16, self.GetHeight())
grp.RenderBar(x + 16, y, self.GetWidth() - 16, self.GetHeight())
class MessengerMemberItem(MessengerItem):
@@ -444,12 +445,12 @@ class MessengerWindow(ui.ScriptWindow):
if self.isLoaded==0:
return
if self.showingPageSize/20 >= len(self.showingItemList):
if self.showingPageSize / 20 >= len(self.showingItemList):
self.scrollBar.Hide()
self.startLine = 0
else:
if self.showingItemList:
self.scrollBar.SetMiddleBarSize(float(self.showingPageSize/20) / float(len(self.showingItemList)))
self.scrollBar.SetMiddleBarSize(float(self.showingPageSize / 20) / float(len(self.showingItemList)))
self.scrollBar.Show()
#####
@@ -465,6 +466,7 @@ class MessengerWindow(ui.ScriptWindow):
item.Show()
yPos += 20
if yPos > heightLimit:
break
@@ -547,7 +549,7 @@ class MessengerWindow(ui.ScriptWindow):
self.OnCloseQuestionDialog()
def OnScroll(self):
scrollLineCount = len(self.showingItemList) - (self.showingPageSize/20)
scrollLineCount = len(self.showingItemList) - (self.showingPageSize / 20)
startLine = int(scrollLineCount * self.scrollBar.GetPos())
if startLine != self.startLine:

View File

@@ -177,7 +177,7 @@ class AtlasWindow(ui.ScriptWindow):
ui.ScriptWindow.Show(self)
def SetCenterPositionAdjust(self, x, y):
self.SetPosition((wndMgr.GetScreenWidth() - self.GetWidth()) / 2 + x, (wndMgr.GetScreenHeight() - self.GetHeight()) / 2 + y)
self.SetPosition((wndMgr.GetScreenWidth() - self.GetWidth()) // 2 + x, (wndMgr.GetScreenHeight() - self.GetHeight()) // 2 + y)
def OnPressEscapeKey(self):
self.Hide()
@@ -385,24 +385,26 @@ class MiniMap(ui.ScriptWindow):
(x, y, z) = player.GetMainCharacterPosition()
miniMap.Update(x, y)
self.positionInfo.SetText("(%.0f, %.0f)" % (x/100, y/100))
self.positionInfo.SetText("(%.0f, %.0f)" % (x // 100, y // 100))
if self.tooltipInfo:
if True == self.MiniMapWindow.IsIn():
(mouseX, mouseY) = wndMgr.GetMousePosition()
(bFind, sName, iPosX, iPosY, dwTextColor) = miniMap.GetInfo(mouseX, mouseY)
if bFind == 0:
self.tooltipInfo.Hide()
elif not self.canSeeInfo:
self.tooltipInfo.SetText("%s(%s)" % (sName, localeInfo.UI_POS_UNKNOWN))
self.tooltipInfo.SetText("%s (%s)" % (sName, localeInfo.UI_POS_UNKNOWN))
self.tooltipInfo.SetTooltipPosition(mouseX - 5, mouseY)
self.tooltipInfo.SetTextColor(dwTextColor)
self.tooltipInfo.Show()
else:
if app.IsRTL() and sName[-1].isalnum():
self.tooltipInfo.SetText("(%s)%d, %d" % (sName, iPosX, iPosY))
self.tooltipInfo.SetText("(%s) %d, %d" % (sName, iPosX, iPosY))
else:
self.tooltipInfo.SetText("%s(%d, %d)" % (sName, iPosX, iPosY))
self.tooltipInfo.SetText("%s (%d, %d)" % (sName, iPosX, iPosY))
self.tooltipInfo.SetTooltipPosition(mouseX - 5, mouseY)
self.tooltipInfo.SetTextColor(dwTextColor)
self.tooltipInfo.Show()

View File

@@ -4,7 +4,6 @@ import chr
import textTail
class PlayerGauge(ui.Gauge):
def __init__(self, parent):
ui.Gauge.__init__(self)
self.SetParent(parent)
@@ -29,7 +28,7 @@ class PlayerGauge(ui.Gauge):
(x, y, z)=textTail.GetPosition(playerIndex)
isChat = textTail.IsChat(playerIndex)
ui.Gauge.SetPosition(self, int(x - self.GetWidth()/2), int(y + 5) + isChat*17)
ui.Gauge.SetPosition(self, int(x - self.GetWidth() // 2), int(y + 5) + isChat * 17)
def RefreshGauge(self):
@@ -43,11 +42,11 @@ class PlayerGauge(ui.Gauge):
else:
if self.IsShow():
if self.curHP > self.maxHP / 2:
if self.curHP > self.maxHP // 2:
self.Hide()
else:
if self.curHP < self.maxHP / 2:
if self.curHP < self.maxHP // 2:
self.OnUpdate()
self.Show()

View File

@@ -312,9 +312,11 @@ class SafeboxWindow(ui.ScriptWindow):
self.pageButtonList = []
text = "I"
pos = -int(float(pageCount-1)/2 * 52)
pos = -int(float(pageCount-1) / 2 * 52)
for i in range(pageCount):
button = ui.RadioButton()
button.SetParent(self)
button.SetUpVisual("d:/ymir work/ui/game/windows/tab_button_middle_01.sub")
button.SetOverVisual("d:/ymir work/ui/game/windows/tab_button_middle_02.sub")
@@ -325,6 +327,7 @@ class SafeboxWindow(ui.ScriptWindow):
button.SetText(text)
button.SetEvent(lambda arg=i: self.SelectPage(arg))
button.Show()
self.pageButtonList.append(button)
pos += 52
@@ -343,11 +346,11 @@ class SafeboxWindow(ui.ScriptWindow):
self.RefreshSafebox()
def __LocalPosToGlobalPos(self, local):
return self.curPageIndex*safebox.SAFEBOX_PAGE_SIZE + local
return self.curPageIndex * safebox.SAFEBOX_PAGE_SIZE + local
def SetTableSize(self, size):
pageCount = max(1, size / safebox.SAFEBOX_SLOT_Y_COUNT)
pageCount = max(1, size // safebox.SAFEBOX_SLOT_Y_COUNT)
pageCount = min(3, pageCount)
size = safebox.SAFEBOX_SLOT_Y_COUNT
@@ -358,6 +361,7 @@ class SafeboxWindow(ui.ScriptWindow):
self.wndItem.SetSlotBaseImage("d:/ymir work/ui/public/Slot_Base.sub", 1.0, 1.0, 1.0, 1.0)
wnd_height = 130 + 32 * size
self.wndBoard.SetSize(self.BOX_WIDTH, wnd_height)
self.SetSize(self.BOX_WIDTH, wnd_height)
self.UpdateRect()
@@ -422,6 +426,7 @@ class SafeboxWindow(ui.ScriptWindow):
#snd.PlaySound("sound/ui/drop.wav")
else:
attachedInvenType = player.SlotTypeToInvenType(attachedSlotType)
if player.RESERVED_WINDOW == attachedInvenType:
return
@@ -429,18 +434,15 @@ class SafeboxWindow(ui.ScriptWindow):
net.SendSafeboxSaveMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
snd.PlaySound("sound/ui/money.wav")
else:
chat
net.SendSafeboxCheckinPacket(attachedInvenType, attachedSlotPos, selectedSlotPos)
#snd.PlaySound("sound/ui/drop.wav")
mouseModule.mouseController.DeattachObject()
def SelectItemSlot(self, selectedSlotPos):
selectedSlotPos = self.__LocalPosToGlobalPos(selectedSlotPos)
if mouseModule.mouseController.isAttached():
attachedSlotType = mouseModule.mouseController.GetAttachedType()
if player.SLOT_TYPE_INVENTORY == attachedSlotType:
@@ -459,6 +461,7 @@ class SafeboxWindow(ui.ScriptWindow):
else:
curCursorNum = app.GetCursor()
if app.SELL == curCursorNum:
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SAFEBOX_SELL_DISABLE_SAFEITEM)
@@ -580,7 +583,7 @@ class MallWindow(ui.ScriptWindow):
def SetTableSize(self, size):
pageCount = max(1, size / safebox.SAFEBOX_SLOT_Y_COUNT)
pageCount = max(1, size // safebox.SAFEBOX_SLOT_Y_COUNT)
pageCount = min(3, pageCount)
size = safebox.SAFEBOX_SLOT_Y_COUNT
@@ -588,20 +591,22 @@ class MallWindow(ui.ScriptWindow):
self.wndItem.RefreshSlot()
self.wndItem.SetSlotBaseImage("d:/ymir work/ui/public/Slot_Base.sub", 1.0, 1.0, 1.0, 1.0)
self.wndBoard.SetSize(self.BOX_WIDTH, 82 + 32*size)
self.SetSize(self.BOX_WIDTH, 85 + 32*size)
self.wndBoard.SetSize(self.BOX_WIDTH, 82 + 32 * size)
self.SetSize(self.BOX_WIDTH, 85 + 32 * size)
self.UpdateRect()
def RefreshMall(self):
getItemID=safebox.GetMallItemID
getItemCount=safebox.GetMallItemCount
setItemID=self.wndItem.SetItemSlot
getItemID = safebox.GetMallItemID
getItemCount = safebox.GetMallItemCount
setItemID = self.wndItem.SetItemSlot
for i in range(safebox.GetMallSize()):
itemID = getItemID(i)
itemCount = getItemCount(i)
if itemCount <= 1:
itemCount = 0
setItemID(i, itemID, itemCount)
self.wndItem.RefreshSlot()

View File

@@ -84,6 +84,7 @@ class SelectItemWindow(ui.ScriptWindow):
slotNumber = i
itemVNum = getItemVNum(slotNumber)
if 0 == itemVNum:
continue
@@ -91,6 +92,7 @@ class SelectItemWindow(ui.ScriptWindow):
continue
itemGrade = player.GetItemGrade(slotNumber)
if itemGrade > 2:
continue
@@ -102,14 +104,17 @@ class SelectItemWindow(ui.ScriptWindow):
break
itemCount = len(self.inventorySlotPosDict)
if itemCount < 15:
self.SetTableSize(3)
else:
lineCount = 3
lineCount += (itemCount - 15) / 5
lineCount += (itemCount - 15) // 5
if itemCount % 5:
lineCount += 1
self.SetTableSize(lineCount)
for selectWndPos, inventoryPos in list(self.inventorySlotPosDict.items()):

View File

@@ -310,9 +310,9 @@ class ShopDialog(ui.ScriptWindow):
itemPrice = item.GetISellItemPrice()
if item.Is1GoldItem():
itemPrice = attachedCount / itemPrice / 5
itemPrice = attachedCount // itemPrice // 5
else:
itemPrice = itemPrice * max(1, attachedCount) / 5
itemPrice = itemPrice * max(1, attachedCount) // 5
itemName = item.GetItemName()

View File

@@ -192,7 +192,7 @@ class OptionDialog(ui.ScriptWindow):
self.selectMusicFile.SetText(fileName[:MUSIC_FILENAME_MAX_LEN])
if musicInfo.fieldMusic != "":
snd.FadeOutMusic("BGM/"+ musicInfo.fieldMusic)
snd.FadeOutMusic("BGM/" + musicInfo.fieldMusic)
if fileName==uiSelectMusic.DEFAULT_THEMA:
musicInfo.fieldMusic=musicInfo.METIN2THEMA

View File

@@ -77,6 +77,7 @@ class TargetBoard(ui.ThinBoard):
self.buttonDict = {}
self.showingButtonList = []
for buttonName in self.BUTTON_NAME_LIST:
button = ui.Button()
button.SetParent(self)
@@ -223,7 +224,7 @@ class TargetBoard(ui.ThinBoard):
self.eventWhisper = event
def UpdatePosition(self):
self.SetPosition(wndMgr.GetScreenWidth()/2 - self.GetWidth()/2, 10)
self.SetPosition(wndMgr.GetScreenWidth() // 2 - self.GetWidth() // 2, 10)
def ResetTargetBoard(self):
@@ -270,7 +271,7 @@ class TargetBoard(ui.ThinBoard):
def SetHP(self, hpPercentage):
if not self.hpGauge.IsShow():
self.SetSize(200 + 7*self.nameLength, self.GetHeight())
self.SetSize(200 + 7 * self.nameLength, self.GetHeight())
if app.IsRTL():
self.name.SetPosition( self.GetWidth()-23, 13)
@@ -376,7 +377,6 @@ class TargetBoard(ui.ThinBoard):
return self.isShowButton
def RefreshButton(self):
self.HideAllButton()
if chr.INSTANCE_TYPE_BUILDING == chr.GetInstanceType(self.vid):
@@ -386,7 +386,7 @@ class TargetBoard(ui.ThinBoard):
if player.IsPVPInstance(self.vid) or player.IsObserverMode():
# PVP_INFO_SIZE_BUG_FIX
self.SetSize(200 + 7*self.nameLength, 40)
self.SetSize(200 + 7 * self.nameLength, 40)
self.UpdatePosition()
# END_OF_PVP_INFO_SIZE_BUG_FIX
return
@@ -444,7 +444,8 @@ class TargetBoard(ui.ThinBoard):
def __ArrangeButtonPosition(self):
showingButtonCount = len(self.showingButtonList)
pos = -(showingButtonCount / 2) * 68
pos = -(showingButtonCount // 2) * 68
if 0 == showingButtonCount % 2:
pos += 34

View File

@@ -173,7 +173,7 @@ class EnergyBar(ui.ScriptWindow):
if leftTime == 0:
self.energyEmpty.Show()
elif ((leftTime * 100) / maxTime) < 15:
elif ((leftTime * 100) // maxTime) < 15:
self.energyHungry.Show()
else:
self.energyFull.Show()
@@ -461,12 +461,14 @@ class TaskBar(ui.ScriptWindow):
if app.IsRTL():
systemButton = toggleButtonDict[TaskBar.BUTTON_SYSTEM]
if systemButton.ToolTipText:
tx, ty = systemButton.ToolTipText.GetLocalPosition()
tw = systemButton.ToolTipText.GetWidth()
systemButton.ToolTipText.SetPosition(-tw/2, ty)
systemButton.ToolTipText.SetPosition(-tw // 2, ty)
expGauge = []
expGauge.append(self.GetChild("EXPGauge_01"))
expGauge.append(self.GetChild("EXPGauge_02"))
expGauge.append(self.GetChild("EXPGauge_03"))
@@ -726,6 +728,7 @@ class TaskBar(ui.ScriptWindow):
def SetST(self, curPoint, maxPoint):
curPoint = min(curPoint, maxPoint)
if maxPoint > 0:
self.stGauge.SetPercentage(curPoint, maxPoint)
self.tooltipST.SetText("%s : %d / %d" % (localeInfo.TASKBAR_ST, curPoint, maxPoint))

View File

@@ -167,8 +167,9 @@ class ToolTip(ui.ThinBoard):
def AlignHorizonalCenter(self):
for child in self.childrenList:
(x, y)=child.GetLocalPosition()
child.SetPosition(self.toolTipWidth/2, y)
(x, y) = child.GetLocalPosition()
child.SetPosition(self.toolTipWidth // 2, y)
self.ResizeToolTip()
@@ -177,13 +178,15 @@ class ToolTip(ui.ThinBoard):
# 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)
child.SetPosition(self.toolTipWidth // 2, y)
# MR-10: -- END OF -- Fix element centering in tooltips
self.ResizeToolTip()
def AutoAppendTextLine(self, text, color = FONT_COLOR, centerAlign = True):
textLine = ui.TextLine()
textLine.SetParent(self)
textLine.SetFontName(self.defFontName)
textLine.SetPackedFontColor(color)
@@ -197,7 +200,7 @@ class ToolTip(ui.ThinBoard):
# MR-10: -- END OF -- Fix element centering in tooltips
if centerAlign:
textLine.SetPosition(self.toolTipWidth/2, self.toolTipHeight)
textLine.SetPosition(self.toolTipWidth // 2, self.toolTipHeight)
textLine.SetHorizontalAlignCenter()
else:
@@ -242,7 +245,7 @@ class ToolTip(ui.ThinBoard):
if centerAlign:
textLine.SetHorizontalAlignCenter()
textLine.SetPosition(self.toolTipWidth / 2, self.toolTipHeight)
textLine.SetPosition(self.toolTipWidth // 2, self.toolTipHeight)
else:
textLine.SetPosition(10, self.toolTipHeight)
@@ -335,16 +338,16 @@ class ToolTip(ui.ThinBoard):
else:
y = mouseY - height - 30
x = mouseX - width/2
x = mouseX - width // 2
else:
x = self.xPos - width/2
x = self.xPos - width // 2
y = self.yPos - height
x = max(x, 0)
y = max(y, 0)
x = min(x + width/2, wndMgr.GetScreenWidth() - width/2) - width/2
x = min(x + width // 2, wndMgr.GetScreenWidth() - width // 2) - width // 2
y = min(y + self.GetHeight(), wndMgr.GetScreenHeight()) - self.GetHeight()
parentWindow = self.GetParentProxy()
@@ -356,7 +359,6 @@ class ToolTip(ui.ThinBoard):
self.SetPosition(x, y)
class ItemToolTip(ToolTip):
CHARACTER_NAMES = (
localeInfo.TOOLTIP_WARRIOR,
localeInfo.TOOLTIP_ASSASSIN,
@@ -503,6 +505,7 @@ class ItemToolTip(ToolTip):
def __init__(self, *args, **kwargs):
ToolTip.__init__(self, *args, **kwargs)
self.itemVnum = 0
self.metinSlot = []
self.isShopItem = False
@@ -514,14 +517,19 @@ class ItemToolTip(ToolTip):
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
@@ -536,6 +544,38 @@ class ItemToolTip(ToolTip):
def ClearDragonSoulTimeCache(self):
self.dsActivatedTimeCache = {}
# MR-11: Fix Dragon stones timer auto-start
def WarmDragonSoulTimeCache(self, slotNumbers):
if not slotNumbers:
return
now = app.GetGlobalTimeStamp()
for slotNumber in slotNumbers:
itemVnum = player.GetItemIndex(slotNumber)
if itemVnum == 0:
continue
item.SelectItem(itemVnum)
remainSec = None
for i in range(item.LIMIT_MAX_NUM):
(limitType, limitValue) = item.GetLimit(i)
if item.LIMIT_TIMER_BASED_ON_WEAR == limitType:
remainSec = player.GetItemMetinSocket(player.INVENTORY, slotNumber, 0)
break
if remainSec is None or remainSec <= 0:
continue
key = (itemVnum, slotNumber)
self.dsActivatedTimeCache[key] = { "remainSec": remainSec, "endTime": now + remainSec }
# MR-11: -- END OF -- Fix Dragon stones timer auto-start
def SetCannotUseItemForceSetDisableColor(self, enable):
self.bCannotUseItemForceSetDisableColor = enable
@@ -593,6 +633,7 @@ class ItemToolTip(ToolTip):
def AppendTextLineTime(self, endTime, getLimit):
color = self.FONT_COLOR
if not self.CanEquip() and self.bCannotUseItemForceSetDisableColor:
color = self.DISABLE_COLOR
@@ -1075,7 +1116,7 @@ class ItemToolTip(ToolTip):
## Rod ##
elif item.ITEM_TYPE_ROD == itemType:
if 0 != metinSlot:
curLevel = item.GetValue(0) / 10
curLevel = item.GetValue(0) // 10
curEXP = metinSlot[0]
maxEXP = item.GetValue(2)
self.__AppendLimitInformation()
@@ -1085,7 +1126,7 @@ class ItemToolTip(ToolTip):
elif item.ITEM_TYPE_PICK == itemType:
if 0 != metinSlot:
curLevel = item.GetValue(0) / 10
curLevel = item.GetValue(0) // 10
curEXP = metinSlot[0]
maxEXP = item.GetValue(2)
self.__AppendLimitInformation()
@@ -1126,7 +1167,7 @@ class ItemToolTip(ToolTip):
self.AppendTextLine(affectText, self.NORMAL_COLOR)
if time > 0:
minute = (time / 60)
minute = (time // 60)
second = (time % 60)
timeString = localeInfo.TOOLTIP_POTION_TIME
@@ -1227,9 +1268,9 @@ class ItemToolTip(ToolTip):
self.AppendSpace(5)
if localeMapName!="":
self.AppendTextLine(localeInfo.TOOLTIP_MEMORIZED_POSITION % (localeMapName, int(xPos-xBase)/100, int(yPos-yBase)/100), self.NORMAL_COLOR)
self.AppendTextLine(localeInfo.TOOLTIP_MEMORIZED_POSITION % (localeMapName, int(xPos-xBase) // 100, int(yPos-yBase) // 100), self.NORMAL_COLOR)
else:
self.AppendTextLine(localeInfo.TOOLTIP_MEMORIZED_POSITION_ERROR % (int(xPos)/100, int(yPos)/100), self.NORMAL_COLOR)
self.AppendTextLine(localeInfo.TOOLTIP_MEMORIZED_POSITION_ERROR % (int(xPos) // 100, int(yPos) // 100), self.NORMAL_COLOR)
dbg.TraceError("NOT_EXIST_IN_MINIMAP_ZONE_NAME_DICT: %s" % mapName)
#####
@@ -1327,8 +1368,9 @@ class ItemToolTip(ToolTip):
self.ShowToolTip()
def __DragonSoulInfoString (self, dwVnum):
step = (dwVnum / 100) % 10
refine = (dwVnum / 10) % 10
step = (dwVnum // 100) % 10
refine = (dwVnum // 10) % 10
if 0 == step:
return localeInfo.DRAGON_SOUL_STEP_LEVEL1 + " " + localeInfo.DRAGON_SOUL_STRENGTH(refine)
elif 1 == step:
@@ -1377,11 +1419,11 @@ class ItemToolTip(ToolTip):
itemImage.Show()
if self.__IsOldHair(itemVnum):
itemImage.LoadImage("d:/ymir work/item/quest/"+str(itemVnum)+".tga")
itemImage.LoadImage("d:/ymir work/item/quest/" + str(itemVnum) + ".tga")
elif self.__IsNewHair3(itemVnum):
itemImage.LoadImage("icon/hair/%d.sub" % (itemVnum))
elif self.__IsNewHair(itemVnum): # Use by linking to existing hair numbers. New items have numbers increased by 1000.
itemImage.LoadImage("d:/ymir work/item/quest/"+str(itemVnum-1000)+".tga")
itemImage.LoadImage("d:/ymir work/item/quest/" + str(itemVnum - 1000) + ".tga")
elif self.__IsNewHair2(itemVnum):
itemImage.LoadImage("icon/hair/%d.sub" % (itemVnum))
elif self.__IsCostumeHair(itemVnum):
@@ -1389,7 +1431,7 @@ class ItemToolTip(ToolTip):
# MR-10: Fix element centering in tooltips
self.hairIcon = itemImage
xPos = max(0, (self.toolTipWidth - itemImage.GetWidth()) / 2)
xPos = max(0, (self.toolTipWidth - itemImage.GetWidth()) // 2)
itemImage.SetPosition(xPos, self.toolTipHeight)
# MR-10: -- END OF -- Fix element centering in tooltips
@@ -1407,7 +1449,7 @@ class ItemToolTip(ToolTip):
return
(xPos, yPos) = self.hairIcon.GetLocalPosition()
xPos = max(0, (self.toolTipWidth - self.hairIcon.GetWidth()) / 2)
xPos = max(0, (self.toolTipWidth - self.hairIcon.GetWidth()) // 2)
self.hairIcon.SetPosition(xPos, yPos)
# MR-10: -- END OF -- Fix element centering in tooltips
@@ -1658,21 +1700,22 @@ class ItemToolTip(ToolTip):
self.AppendTextLine(localeInfo.TOOLTIP_POTION_PLUS_MOVING_SPEED % point, self.GetChangeTextLineColor(point))
if time > 0:
minute = (time / 60)
minute = (time // 60)
second = (time % 60)
timeString = localeInfo.TOOLTIP_POTION_TIME
if minute > 0:
timeString += str(minute) + localeInfo.TOOLTIP_POTION_MIN
timeString += " " + str(minute) + localeInfo.TOOLTIP_POTION_MIN
if second > 0:
timeString += " " + str(second) + localeInfo.TOOLTIP_POTION_SEC
self.AppendTextLine(timeString)
def GetPriceColor(self, price):
if price>=constInfo.HIGH_PRICE:
if price >= constInfo.HIGH_PRICE:
return self.HIGH_PRICE_COLOR
if price>=constInfo.MIDDLE_PRICE:
if price >= constInfo.MIDDLE_PRICE:
return self.MIDDLE_PRICE_COLOR
else:
return self.LOW_PRICE_COLOR
@@ -1733,7 +1776,7 @@ class ItemToolTip(ToolTip):
textLine = ui.TextLine()
textLine.SetParent(self)
textLine.SetFontName(self.defFontName)
textLine.SetPosition(self.toolTipWidth/2, self.toolTipHeight)
textLine.SetPosition(self.toolTipWidth // 2, self.toolTipHeight)
textLine.SetHorizontalAlignCenter()
textLine.SetPackedFontColor(self.NORMAL_COLOR)
textLine.SetText(wearNames)
@@ -1776,27 +1819,30 @@ class ItemToolTip(ToolTip):
def __AppendAccessoryMetinSlotInfo(self, metinSlot, mtrlVnum):
ACCESSORY_SOCKET_MAX_SIZE = 3
cur=min(metinSlot[0], ACCESSORY_SOCKET_MAX_SIZE)
end=min(metinSlot[1], ACCESSORY_SOCKET_MAX_SIZE)
cur = min(metinSlot[0], ACCESSORY_SOCKET_MAX_SIZE)
end = min(metinSlot[1], ACCESSORY_SOCKET_MAX_SIZE)
affectType1, affectValue1 = item.GetAffect(0)
affectList1=[0, max(1, affectValue1*10/100), max(2, affectValue1*20/100), max(3, affectValue1*40/100)]
affectList1=[0, max(1, affectValue1 * 10 // 100), max(2, affectValue1 * 20 // 100), max(3, affectValue1 * 40 // 100)]
affectType2, affectValue2 = item.GetAffect(1)
affectList2=[0, max(1, affectValue2*10/100), max(2, affectValue2*20/100), max(3, affectValue2*40/100)]
affectList2 = [0, max(1, affectValue2 * 10 // 100), max(2, affectValue2 * 20 // 100), max(3, affectValue2 * 40 // 100)]
mtrlPos = 0
mtrlList = [mtrlVnum] * cur + [player.METIN_SOCKET_TYPE_SILVER] * (end-cur)
mtrlPos=0
mtrlList=[mtrlVnum]*cur+[player.METIN_SOCKET_TYPE_SILVER]*(end-cur)
for mtrl in mtrlList:
affectString1 = self.__GetAffectString(affectType1, affectList1[mtrlPos+1]-affectList1[mtrlPos])
affectString2 = self.__GetAffectString(affectType2, affectList2[mtrlPos+1]-affectList2[mtrlPos])
affectString1 = self.__GetAffectString(affectType1, affectList1[mtrlPos + 1] - affectList1[mtrlPos])
affectString2 = self.__GetAffectString(affectType2, affectList2[mtrlPos + 1] - affectList2[mtrlPos])
leftTime = 0
if cur == mtrlPos+1:
leftTime=metinSlot[2]
if cur == mtrlPos + 1:
leftTime = metinSlot[2]
self.__AppendMetinSlotInfo_AppendMetinSocketData(mtrlPos, mtrl, affectString1, affectString2, leftTime)
mtrlPos+=1
mtrlPos += 1
def __AppendMetinSlotInfo(self, metinSlot):
if self.__AppendMetinSlotInfo_IsEmptySlotList(metinSlot):
@@ -1964,6 +2010,7 @@ class ItemToolTip(ToolTip):
def AppendUniqueItemLastTime(self, restMin):
if restMin > 0:
restSecond = restMin * 60
self.AppendSpace(5)
self.AppendTextLine(localeInfo.LEFT_TIME + " : " + localeInfo.RTSecondToDHMS(restSecond), self.NORMAL_COLOR)
@@ -1972,7 +2019,7 @@ class ItemToolTip(ToolTip):
self.AppendSpace(5)
self.AppendTextLineTime(endTime, getLimit)
def AppendTextLineTime(self, endTime, getLimit, color=FONT_COLOR):
def AppendTextLineTime(self, endTime, getLimit, color = FONT_COLOR):
leftSec = max(0, endTime - app.GetGlobalTimeStamp())
timeTextLine = ui.TextLine()
@@ -1985,7 +2032,7 @@ class ItemToolTip(ToolTip):
timeTextLine.SetOutline()
timeTextLine.SetFeather(False)
timeTextLine.SetPosition(self.toolTipWidth / 2, self.toolTipHeight)
timeTextLine.SetPosition(self.toolTipWidth // 2, self.toolTipHeight)
timeTextLine.SetHorizontalAlignCenter()
timeTextLine.Show()
@@ -2002,6 +2049,7 @@ class ItemToolTip(ToolTip):
if remainSec <= 0:
self.AppendSpace(5)
self.AppendTextLine(localeInfo.CANNOT_USE, self.DISABLE_COLOR)
return
isTimerActive = self.__IsTimerBasedOnWearActive()
@@ -2009,9 +2057,11 @@ class ItemToolTip(ToolTip):
if not isTimerActive:
self.AppendSpace(5)
self.AppendTextLine(localeInfo.LEFT_TIME + ": " + localeInfo.RTSecondToDHMS(remainSec), self.NORMAL_COLOR)
return
endTime = self.__GetOrCreateCachedEndTime(remainSec)
self.AppendMallItemLastTime(endTime, getLimit)
def __IsTimerBasedOnWearActive(self):
@@ -2067,7 +2117,8 @@ class ItemToolTip(ToolTip):
(limitType, limitValue) = item.GetLimit(limitIndex)
endTime = limitValue
self.AppendUniqueItemLastTime(endTime / 60)
self.AppendUniqueItemLastTime(endTime // 60)
return
endTime += app.GetGlobalTimeStamp()
@@ -2334,17 +2385,20 @@ class SkillToolTip(ToolTip):
conditionDataCount = skill.GetSkillConditionDescriptionCount(skillIndex)
if conditionDataCount > 0:
self.AppendSpace(5)
for i in range(conditionDataCount):
self.AppendTextLine(skill.GetSkillConditionDescription(skillIndex, i), self.CONDITION_COLOR)
def AppendGuildSkillData(self, skillIndex, skillLevel):
skillMaxLevel = 7
skillCurrentPercentage = float(skillLevel) / float(skillMaxLevel)
skillNextPercentage = float(skillLevel+1) / float(skillMaxLevel)
skillNextPercentage = float(skillLevel + 1) / float(skillMaxLevel)
## Current Level
if skillLevel > 0:
if self.HasSkillLevelDescription(skillIndex, skillLevel):
self.AppendSpace(5)
if skillLevel == skillMaxLevel:
self.AppendTextLine(localeInfo.TOOLTIP_SKILL_LEVEL_MASTER % (skillLevel), self.NORMAL_COLOR)
else:
@@ -2357,6 +2411,7 @@ class SkillToolTip(ToolTip):
## Cooltime
coolTime = skill.GetSkillCoolTime(skillIndex, skillCurrentPercentage)
if coolTime > 0:
self.AppendTextLine(localeInfo.TOOLTIP_SKILL_COOL_TIME + str(coolTime), self.ENABLE_COLOR)
@@ -2569,23 +2624,24 @@ class SkillToolTip(ToolTip):
slotIndex = player.GetSkillSlotIndex(skillIndex)
skillPower = player.GetSkillCurrentEfficientPercentage(slotIndex)
k = player.GetSkillLevel(skillIndex) / 100.0
self.AppendSpace(5)
self.AutoAppendTextLine(localeInfo.TOOLTIP_PARTY_SKILL_LEVEL % skillLevel, self.NORMAL_COLOR)
if skillLevel>=10:
if skillLevel >= 10:
self.AutoAppendTextLine(localeInfo.PARTY_SKILL_ATTACKER % chop( 10 + 60 * k ))
if skillLevel>=20:
if skillLevel >= 20:
self.AutoAppendTextLine(localeInfo.PARTY_SKILL_BERSERKER % chop(1 + 5 * k))
self.AutoAppendTextLine(localeInfo.PARTY_SKILL_TANKER % chop(50 + 1450 * k))
if skillLevel>=25:
if skillLevel >= 25:
self.AutoAppendTextLine(localeInfo.PARTY_SKILL_BUFFER % chop(5 + 45 * k ))
if skillLevel>=35:
if skillLevel >= 35:
self.AutoAppendTextLine(localeInfo.PARTY_SKILL_SKILL_MASTER % chop(25 + 600 * k ))
if skillLevel>=40:
if skillLevel >= 40:
self.AutoAppendTextLine(localeInfo.PARTY_SKILL_DEFENDER % chop( 5 + 30 * k ))
self.AlignHorizonalCenter()