From 36602f7ad99431a50a10592b624ecb649548dd95 Mon Sep 17 00:00:00 2001 From: d1str4ught <> Date: Sun, 8 Feb 2026 23:40:50 +0100 Subject: [PATCH] py2 -> py3 --- assets/root/consolemodule.py | 36 +++---- assets/root/emotion.py | 4 +- assets/root/game.py | 52 +++++----- assets/root/interfacemodule.py | 40 ++++---- assets/root/introcreate.py | 42 ++++---- assets/root/introempire.py | 20 ++-- assets/root/introloading.py | 15 +-- assets/root/intrologin.py | 56 +++++----- assets/root/introselect.py | 21 ++-- assets/root/localeinfo.py | 4 +- assets/root/mousemodule.py | 4 +- assets/root/networkmodule.py | 8 +- assets/root/playersettingmodule.py | 32 +++--- assets/root/prototype.py | 2 +- assets/root/rootlibcythonizer.py | 2 +- assets/root/servercommandparser.py | 7 +- assets/root/stringcommander.py | 8 +- assets/root/system.py | 14 +-- assets/root/test_affect.py | 2 +- assets/root/ui.py | 152 ++++++++++++++-------------- assets/root/uiaffectshower.py | 54 +++++----- assets/root/uiattachmetin.py | 6 +- assets/root/uiauction.py | 14 +-- assets/root/uicandidate.py | 6 +- assets/root/uicharacter.py | 81 +++++++-------- assets/root/uichat.py | 5 +- assets/root/uicube.py | 24 ++--- assets/root/uidragonsoul.py | 48 ++++----- assets/root/uiequipmentdialog.py | 8 +- assets/root/uiexchange.py | 8 +- assets/root/uigamebutton.py | 10 +- assets/root/uigameoption.py | 11 +- assets/root/uiguild.py | 74 +++++++------- assets/root/uihelp.py | 4 +- assets/root/uiinventory.py | 32 +++--- assets/root/uilocalerefresh.py | 6 +- assets/root/uimapnameshower.py | 8 +- assets/root/uimessenger.py | 16 +-- assets/root/uiminimap.py | 2 +- assets/root/uioption.py | 10 +- assets/root/uiparty.py | 34 +++---- assets/root/uiphasecurtain.py | 4 +- assets/root/uipointreset.py | 1 + assets/root/uiprivateshopbuilder.py | 14 +-- assets/root/uiquest.py | 12 +-- assets/root/uirefine.py | 12 +-- assets/root/uirestart.py | 2 +- assets/root/uisafebox.py | 8 +- assets/root/uiscriptlocale.py | 2 +- assets/root/uiselectitem.py | 4 +- assets/root/uiselectmusic.py | 8 +- assets/root/uishop.py | 3 +- assets/root/uisystemoption.py | 4 +- assets/root/uitarget.py | 10 +- assets/root/uitaskbar.py | 32 +++--- assets/root/uitip.py | 1 + assets/root/uitooltip.py | 96 +++++++++--------- assets/root/uiuploadmark.py | 12 +-- assets/root/uiweb.py | 4 +- assets/root/uiwhisper.py | 4 +- assets/root/utils.py | 12 +-- 61 files changed, 618 insertions(+), 609 deletions(-) diff --git a/assets/root/consolemodule.py b/assets/root/consolemodule.py index e7f0823f..d367da85 100644 --- a/assets/root/consolemodule.py +++ b/assets/root/consolemodule.py @@ -229,14 +229,14 @@ class Console(object): if (len(self.dirNameList)>iDir): return self.dirNameList[iDir] else: - print len(self.dirNameList) + print((len(self.dirNameList))) return "" def GetFileName(self, iFile): if (len(self.fileNameList)>iFile): return self.fileNameList[iFile] else: - print len(self.fileNameList) + print((len(self.fileNameList))) return "" def MoveParentPath(self): @@ -519,27 +519,27 @@ class Console(object): def SetCharacterRenderModeTypeAdd(self, color): vid = player.GetTargetVID() - print " -> SetCharacterRenderModeTypeAdd", vid, color + print((" -> SetCharacterRenderModeTypeAdd", vid, color)) chr.testSetAddRenderMode(vid, int(color,16)) def SetCharacterRenderModeTypeMod(self, color): vid = player.GetTargetVID() - print " -> SetCharacterRenderModeTypeMod", vid, color, int(color,16) + print((" -> SetCharacterRenderModeTypeMod", vid, color, int(color,16))) chr.testSetModulateRenderMode(vid, int(color,16)) def SetCharacterRenderModeTypeAddRGB(self, r, g, b): vid = player.GetTargetVID() - print " -> SetCharacterRenderModeTypeAddRGB", vid, r, g, b + print((" -> SetCharacterRenderModeTypeAddRGB", vid, r, g, b)) chr.testSetAddRenderModeRGB(vid, float(r)/255.0, float(g)/255.0, float(b)/255.0) def SetCharacterRenderModeTypeModRGB(self, r, g, b): vid = player.GetTargetVID() - print " -> SetCharacterRenderModeTypeModRGB", vid, r, g, b + print((" -> SetCharacterRenderModeTypeModRGB", vid, r, g, b)) chr.testSetModulateRenderModeRGB(vid, float(r)/255.0, float(g)/255.0, float(b)/255.0) def SetCharacterRenderModeSpecular(self, alpha): vid = player.GetTargetVID() - print " -> SetCharacterRenderModeSpecular", vid, alpha + print((" -> SetCharacterRenderModeSpecular", vid, alpha)) chr.testSetSpecularRenderMode(vid, float(alpha)) def RestoreCharacterRenderModeType(self): @@ -719,7 +719,7 @@ class ConsoleWindow(ui.Window): yPosition = (self.height-20) - self.LINE_STEP ItemCount = len(self.TextList) - for i in xrange(ItemCount): + for i in range(ItemCount): TextLine = self.TextList[ItemCount-i-1] TextLine.SetPosition(10, yPosition) @@ -756,10 +756,10 @@ class ConsoleWindow(ui.Window): sCmd=lstsArg[0] - if self.functionDict.has_key(sCmd): + if sCmd in self.functionDict: try: self.functionDict[sCmd](self.Console, *lstsArg[1:]) - except Exception, e: + except Exception as e: Console.Print(str(e)) #self.Console.Print(e) #self.Console.Print(self.functionDict[sCmd].__doc__) @@ -768,19 +768,19 @@ class ConsoleWindow(ui.Window): try: k = lstsArg[1] v = self.functionDict[k] - argcount = v.im_func.func_code.co_argcount - 1 # -1 for self - if v.im_func.func_code.co_flags & 4: + argcount = v.__func__.__code__.co_argcount - 1 # -1 for self + if v.__func__.__code__.co_flags & 4: argcount+=1 - argnames = v.im_func.func_code.co_varnames[1:argcount+1] + argnames = v.__func__.__code__.co_varnames[1:argcount+1] if argcount: Console.Print("%s(%s) : %s" % (k,argcount, v.__doc__)) Console.Print(" arg : %s" % argnames) else: Console.Print("%s : %s" % (k,v.__doc__)) except: - for k,v in self.functionDict.iteritems(): - argcount = v.im_func.func_code.co_argcount - 1 # -1 for self - if v.im_func.func_code.co_flags & 4: + for k,v in list(self.functionDict.items()): + argcount = v.__func__.__code__.co_argcount - 1 # -1 for self + if v.__func__.__code__.co_flags & 4: argcount+=1 if argcount: Console.Print("%s(%s) : %s" % (k,argcount, v.__doc__)) @@ -792,7 +792,7 @@ class ConsoleWindow(ui.Window): Console.Print("") elif sCmd == '?': - list = self.functionDict.keys() + list = list(self.functionDict.keys()) list.sort() Console.ShowNameList(list) pass @@ -897,7 +897,7 @@ class ConsoleWindow(ui.Window): count = len(self.TextList) if count > self.MAX_LINE_COUNT: - for i in xrange(count - self.MAX_LINE_COUNT): + for i in range(count - self.MAX_LINE_COUNT): del self.TextList[0] self.UpdatePosition() diff --git a/assets/root/emotion.py b/assets/root/emotion.py index 4f10e6af..596a6c49 100644 --- a/assets/root/emotion.py +++ b/assets/root/emotion.py @@ -229,7 +229,7 @@ def __RegisterSharedEmotionAnis(mode, path): chrmgr.SetPathName(path) chrmgr.RegisterMotionMode(mode) - for key, val in ANI_DICT.items(): + for key, val in list(ANI_DICT.items()): chrmgr.RegisterMotionData(mode, key, val) def RegisterEmotionAnis(path): @@ -246,6 +246,6 @@ def RegisterEmotionAnis(path): chrmgr.RegisterMotionData(chr.MOTION_MODE_WEDDING_DRESS, chr.MOTION_RUN, "walk.msa") def RegisterEmotionIcons(): - for key, val in ICON_DICT.items(): + for key, val in list(ICON_DICT.items()): player.RegisterEmotionIcon(key, val) diff --git a/assets/root/game.py b/assets/root/game.py index 5a86ce65..d286ccef 100644 --- a/assets/root/game.py +++ b/assets/root/game.py @@ -297,7 +297,7 @@ class GameWindow(ui.ScriptWindow): self.KillFocus() app.HideCursor() - print "---------------------------------------------------------------------------- CLOSE GAME WINDOW" + print("---------------------------------------------------------------------------- CLOSE GAME WINDOW") def __BuildKeyDict(self): onPressKeyDict = {} @@ -454,7 +454,7 @@ class GameWindow(ui.ScriptWindow): else: #net.SendChatPacket("/user_horse_ride") if not uiPrivateShopBuilder.IsBuildingPrivateShop(): - for i in xrange(player.INVENTORY_PAGE_SIZE): + for i in range(player.INVENTORY_PAGE_SIZE): if player.GetItemIndex(i) in (71114, 71116, 71118, 71120): net.SendItemUsePacket(i) break @@ -613,7 +613,7 @@ class GameWindow(ui.ScriptWindow): nextPKMode = 0 net.SendChatPacket("/PKMode " + str(nextPKMode)) - print "/PKMode " + str(nextPKMode) + print(("/PKMode " + str(nextPKMode))) def OnChangePKMode(self): @@ -622,7 +622,7 @@ class GameWindow(ui.ScriptWindow): try: self.__NotifyError(localeInfo.OPTION_PVPMODE_MESSAGE_DICT[player.GetPKMode()]) except KeyError: - print "UNKNOWN PVPMode[%d]" % (player.GetPKMode()) + print(("UNKNOWN PVPMode[%d]" % (player.GetPKMode()))) if constInfo.PVPMODE_TEST_ENABLE: curPKMode = player.GetPKMode() @@ -878,7 +878,7 @@ class GameWindow(ui.ScriptWindow): self.interface.RecvWhisper(name) def OnRecvWhisperError(self, mode, name, line): - if localeInfo.WHISPER_ERROR.has_key(mode): + if mode in localeInfo.WHISPER_ERROR: chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, localeInfo.WHISPER_ERROR[mode](name)) else: chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, "Whisper Unknown Error(mode=%d, name=%s)" % (mode, name)) @@ -925,10 +925,10 @@ class GameWindow(ui.ScriptWindow): # END_OF_MINING def OnCannotUseSkill(self, vid, type): - if localeInfo.USE_SKILL_ERROR_TAIL_DICT.has_key(type): + if type in localeInfo.USE_SKILL_ERROR_TAIL_DICT: textTail.RegisterInfoTail(vid, localeInfo.USE_SKILL_ERROR_TAIL_DICT[type]) - if localeInfo.USE_SKILL_ERROR_CHAT_DICT.has_key(type): + if type in localeInfo.USE_SKILL_ERROR_CHAT_DICT: chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_SKILL_ERROR_CHAT_DICT[type]) def OnCannotShotError(self, vid, type): @@ -1111,7 +1111,7 @@ class GameWindow(ui.ScriptWindow): self.SetFocus() def SaveScreen(self): - print "save screen" + print("save screen") # SCREENSHOT_CWDSAVE if SCREENSHOT_CWDSAVE: @@ -1305,7 +1305,7 @@ class GameWindow(ui.ScriptWindow): itemVnum = player.GetItemIndex(attachedInvenType, attachedItemSlotPos) if constInfo.IS_AUTO_POTION(itemVnum): - metinSocket = [player.GetItemMetinSocket(attachedInvenType, attachedItemSlotPos, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)] + metinSocket = [player.GetItemMetinSocket(attachedInvenType, attachedItemSlotPos, j) for j in range(player.METIN_SOCKET_MAX_NUM)] isActivated = (0 != int(metinSocket[0])) if isActivated: @@ -1649,12 +1649,12 @@ class GameWindow(ui.ScriptWindow): self.interface.UpdateCubeInfo(gold, itemVnum, count) def BINARY_Cube_Succeed(self, itemVnum, count): - print "Cube crafting successful" + print("Cube crafting successful") self.interface.SucceedCubeWork(itemVnum, count) pass def BINARY_Cube_Failed(self): - print "Cube crafting failed" + print("Cube crafting failed") self.interface.FailedCubeWork() pass @@ -1680,7 +1680,7 @@ class GameWindow(ui.ScriptWindow): requestCount = 7 modCount = resultCount % requestCount splitCount = resultCount / requestCount - for i in xrange(splitCount): + for i in range(splitCount): #print("/cube r_info %d %d" % (i * requestCount, requestCount)) net.SendChatPacket("/cube r_info %d %d" % (i * requestCount, requestCount)) @@ -1688,7 +1688,7 @@ class GameWindow(ui.ScriptWindow): #print("/cube r_info %d %d" % (splitCount * requestCount, modCount)) net.SendChatPacket("/cube r_info %d %d" % (splitCount * requestCount, modCount)) - except RuntimeError, msg: + except RuntimeError as msg: dbg.TraceError(msg) return 0 @@ -1752,7 +1752,7 @@ class GameWindow(ui.ScriptWindow): self.interface.wndCube.Refresh() - except RuntimeError, msg: + except RuntimeError as msg: dbg.TraceError(msg) return 0 @@ -1926,7 +1926,7 @@ class GameWindow(ui.ScriptWindow): } self.serverCommander=stringCommander.Analyzer() - for serverCommandItem in serverCommandList.items(): + for serverCommandItem in list(serverCommandList.items()): self.serverCommander.SAFE_RegisterCallBack( serverCommandItem[0], serverCommandItem[1] ) @@ -1936,7 +1936,7 @@ class GameWindow(ui.ScriptWindow): try: #print " BINARY_ServerCommand_Run", line return self.serverCommander.Run(line) - except RuntimeError, msg: + except RuntimeError as msg: dbg.TraceError(msg) return 0 @@ -1944,10 +1944,10 @@ class GameWindow(ui.ScriptWindow): try: command = net.GetPreservedServerCommand() while command: - print " __ProcessPreservedServerCommand", command + print((" __ProcessPreservedServerCommand", command)) self.serverCommander.Run(command) command = net.GetPreservedServerCommand() - except RuntimeError, msg: + except RuntimeError as msg: dbg.TraceError(msg) return 0 @@ -2010,11 +2010,11 @@ class GameWindow(ui.ScriptWindow): if not self.__IsXMasMap(): return - print "XMAS_SNOW ON" + print("XMAS_SNOW ON") background.EnableSnow(1) else: - print "XMAS_SNOW OFF" + print("XMAS_SNOW OFF") background.EnableSnow(0) def __XMasBoom_Enable(self, mode): @@ -2023,23 +2023,23 @@ class GameWindow(ui.ScriptWindow): if not self.__IsXMasMap(): return - print "XMAS_BOOM ON" + print("XMAS_BOOM ON") self.__DayMode_Update("dark") self.enableXMasBoom = True self.startTimeXMasBoom = app.GetTime() else: - print "XMAS_BOOM OFF" + print("XMAS_BOOM OFF") self.__DayMode_Update("light") self.enableXMasBoom = False def __XMasTree_Enable(self, grade): - print "XMAS_TREE ", grade + print(("XMAS_TREE ", grade)) background.SetXMasTree(int(grade)) def __XMasSong_Enable(self, mode): if "1"==mode: - print "XMAS_SONG ON" + print("XMAS_SONG ON") XMAS_BGM = "xmas.mp3" @@ -2051,7 +2051,7 @@ class GameWindow(ui.ScriptWindow): snd.FadeInMusic("BGM/" + musicInfo.fieldMusic) else: - print "XMAS_SONG OFF" + print("XMAS_SONG OFF") if musicInfo.fieldMusic != "": snd.FadeOutMusic("BGM/" + musicInfo.fieldMusic) @@ -2123,7 +2123,7 @@ class GameWindow(ui.ScriptWindow): self.indexXMasBoom += 1 - for i in xrange(boomCount): + for i in range(boomCount): self.__XMasBoom_Boom() def __XMasBoom_Boom(self): diff --git a/assets/root/interfacemodule.py b/assets/root/interfacemodule.py index 281e5d9a..839eccd3 100644 --- a/assets/root/interfacemodule.py +++ b/assets/root/interfacemodule.py @@ -351,11 +351,11 @@ class Interface(object): self.dlgWhisperWithoutTarget.Destroy() del self.dlgWhisperWithoutTarget - if uiQuest.QuestDialog.__dict__.has_key("QuestCurtain"): + if "QuestCurtain" in uiQuest.QuestDialog.__dict__: uiQuest.QuestDialog.QuestCurtain.Close() if self.wndQuestWindow: - for key, eachQuestWindow in self.wndQuestWindow.items(): + for key, eachQuestWindow in list(self.wndQuestWindow.items()): eachQuestWindow.nextCurtainMode = -1 eachQuestWindow.CloseSelf() eachQuestWindow = None @@ -461,11 +461,11 @@ class Interface(object): btn.SetEvent(0) for btn in self.whisperButtonList: btn.SetEvent(0) - for dlg in self.whisperDialogDict.itervalues(): + for dlg in list(self.whisperDialogDict.values()): dlg.Destroy() - for brd in self.guildScoreBoardDict.itervalues(): + for brd in list(self.guildScoreBoardDict.values()): brd.Destroy() - for dlg in self.equipmentDialogDict.itervalues(): + for dlg in list(self.equipmentDialogDict.values()): dlg.Destroy() # ITEM_MALL @@ -773,7 +773,7 @@ class Interface(object): key = uiGuild.GetGVGKey(guildSelf, guildOpp) - if not self.guildScoreBoardDict.has_key(key): + if key not in self.guildScoreBoardDict: return self.guildScoreBoardDict[key].Destroy() @@ -783,7 +783,7 @@ class Interface(object): def UpdateMemberCount(self, gulidID1, memberCount1, guildID2, memberCount2): key = uiGuild.GetGVGKey(gulidID1, guildID2) - if not self.guildScoreBoardDict.has_key(key): + if key not in self.guildScoreBoardDict: return self.guildScoreBoardDict[key].UpdateMemberCount(gulidID1, memberCount1, guildID2, memberCount2) @@ -791,7 +791,7 @@ class Interface(object): def OnRecvGuildWarPoint(self, gainGuildID, opponentGuildID, point): key = uiGuild.GetGVGKey(gainGuildID, opponentGuildID) - if not self.guildScoreBoardDict.has_key(key): + if key not in self.guildScoreBoardDict: return guildBoard = self.guildScoreBoardDict[key] @@ -1125,7 +1125,7 @@ class Interface(object): def SucceedCubeWork(self, itemVnum, count): self.wndCube.Clear() - print "Cube crafting successful! [%d:%d]" % (itemVnum, count) + print(("Cube crafting successful! [%d:%d]" % (itemVnum, count))) if 0: # Skip showing result message self.wndCubeResult.SetPosition(*self.wndCube.GetGlobalPosition()) @@ -1154,8 +1154,8 @@ class Interface(object): hideWindows += self.wndDragonSoul,\ self.wndDragonSoulRefine, - hideWindows = filter(lambda x:x.IsShow(), hideWindows) - map(lambda x:x.Hide(), hideWindows) + hideWindows = [x for x in hideWindows if x.IsShow()] + list([x.Hide() for x in hideWindows]) import sys self.HideAllQuestButton() @@ -1168,7 +1168,7 @@ class Interface(object): def __ShowWindows(self, wnds): import sys - map(lambda x:x.Show(), wnds) + list([x.Show() for x in wnds]) global IsQBHide if not IsQBHide: self.ShowAllQuestButton() @@ -1230,7 +1230,7 @@ class Interface(object): def DisappearPrivateShop(self, vid): - if not self.privateShopAdvertisementBoardDict.has_key(vid): + if vid not in self.privateShopAdvertisementBoardDict: return del self.privateShopAdvertisementBoardDict[vid] @@ -1417,7 +1417,7 @@ class Interface(object): if 0 != btn: self.__DestroyWhisperButton(btn) - elif self.whisperDialogDict.has_key(name): + elif name in self.whisperDialogDict: oldDialog = self.whisperDialogDict[name] oldDialog.Destroy() del self.whisperDialogDict[name] @@ -1429,7 +1429,7 @@ class Interface(object): ## Opens whisper window directly with name when "1:1 Chat" is clicked in character menu def OpenWhisperDialog(self, name): - if not self.whisperDialogDict.has_key(name): + if name not in self.whisperDialogDict: dlg = self.__MakeWhisperDialog(name) dlg.OpenWithTarget(name) dlg.chatLine.SetFocus() @@ -1442,7 +1442,7 @@ class Interface(object): ## Shows button when receiving message from another character def RecvWhisper(self, name): - if not self.whisperDialogDict.has_key(name): + if name not in self.whisperDialogDict: btn = self.__FindWhisperButton(name) if 0 == btn: btn = self.__MakeWhisperButton(name) @@ -1576,19 +1576,19 @@ class Interface(object): btn.Show() def __CheckGameMaster(self, name): - if not self.listGMName.has_key(name): + if name not in self.listGMName: return - if self.whisperDialogDict.has_key(name): + if name in self.whisperDialogDict: dlg = self.whisperDialogDict[name] dlg.SetGameMasterLook() def RegisterGameMasterName(self, name): - if self.listGMName.has_key(name): + if name in self.listGMName: return self.listGMName[name] = "GM" def IsGameMasterName(self, name): - if self.listGMName.has_key(name): + if name in self.listGMName: return True else: return False diff --git a/assets/root/introcreate.py b/assets/root/introcreate.py index d172efbe..4e4a45c0 100644 --- a/assets/root/introcreate.py +++ b/assets/root/introcreate.py @@ -102,20 +102,20 @@ class CreateCharacterWindow(ui.Window): grp.SetInterfaceRenderState() def __init__(self, stream): - print "NEW CREATE WINDOW ----------------------------------------------------------------------------" + print("NEW CREATE WINDOW ----------------------------------------------------------------------------") ui.Window.__init__(self) net.SetPhaseWindow(net.PHASE_WINDOW_CREATE, self) self.stream=stream def __del__(self): - print "---------------------------------------------------------------------------- DELETE CREATE WINDOW" + print("---------------------------------------------------------------------------- DELETE CREATE WINDOW") net.SetPhaseWindow(net.PHASE_WINDOW_CREATE, 0) ui.Window.__del__(self) def Open(self): - print "OPEN CREATE WINDOW ----------------------------------------------------------------------------" + print("OPEN CREATE WINDOW ----------------------------------------------------------------------------") playerSettingModule.LoadGameData("INIT") @@ -268,7 +268,7 @@ class CreateCharacterWindow(ui.Window): app.ShowCursor() def Close(self): - print "---------------------------------------------------------------------------- CLOSE CREATE WINDOW" + print("---------------------------------------------------------------------------- CLOSE CREATE WINDOW") self.editCharacterName.Enable() self.dlgBoard.ClearDictionary() @@ -288,7 +288,7 @@ class CreateCharacterWindow(ui.Window): if musicInfo.createMusic != "": snd.FadeOutMusic("BGM/"+musicInfo.createMusic) - for id in xrange(BASE_CHR_ID + SLOT_COUNT * PAGE_COUNT): + for id in range(BASE_CHR_ID + SLOT_COUNT * PAGE_COUNT): chr.DeleteInstance(id) self.dlgBoard.Hide() @@ -310,8 +310,8 @@ class CreateCharacterWindow(ui.Window): self.editCharacterName.SetFocus() self.editCharacterName.Enable() - for page in xrange(PAGE_COUNT): - for slot in xrange(SLOT_COUNT): + for page in range(PAGE_COUNT): + for slot in range(SLOT_COUNT): chr_id = self.__GetSlotChrID(page, slot) chr.SelectInstance(chr_id) chr.BlendLoopMotion(chr.MOTION_INTRO_WAIT, 0.1) @@ -359,17 +359,17 @@ class CreateCharacterWindow(ui.Window): self.gender = gender if gender == MAN: - for i in xrange(SLOT_COUNT): + for i in range(SLOT_COUNT): chr.SelectInstance(self.__GetSlotChrID(0, i)) chr.Show() - for i in xrange(SLOT_COUNT): + for i in range(SLOT_COUNT): chr.SelectInstance(self.__GetSlotChrID(1, i)) chr.Hide() else: - for i in xrange(SLOT_COUNT): + for i in range(SLOT_COUNT): chr.SelectInstance(self.__GetSlotChrID(0, i)) chr.Hide() - for i in xrange(SLOT_COUNT): + for i in range(SLOT_COUNT): chr.SelectInstance(self.__GetSlotChrID(1, i)) chr.Show() @@ -399,7 +399,7 @@ class CreateCharacterWindow(ui.Window): float(self.stat[3])/float(statSummary), ) - for i in xrange(4): + for i in range(4): self.statValue[i].SetText(str(self.stat[i])) def __SelectSlot(self, slot): @@ -416,12 +416,12 @@ class CreateCharacterWindow(ui.Window): self.slot = slot self.ResetStat() - for i in xrange(SLOT_COUNT): + for i in range(SLOT_COUNT): self.destNameAlpha[i] = 0.0 self.destNameAlpha[slot] = 1.0 - for i in xrange(SLOT_COUNT): + for i in range(SLOT_COUNT): self.destRotation[(i+self.slot)%SLOT_COUNT] = self.SLOT_ROTATION[i] if self.IsShow(): @@ -462,7 +462,7 @@ class CreateCharacterWindow(ui.Window): self.reservingShapeIndex = self.shapeList[self.gender][self.slot] self.reservingStartTime = app.GetTime() - for eachSlot in xrange(SLOT_COUNT): + for eachSlot in range(SLOT_COUNT): sel_id = self.__GetSlotChrID(self.gender, eachSlot) @@ -515,7 +515,7 @@ class CreateCharacterWindow(ui.Window): return True def ResetStat(self): - for i in xrange(4): + for i in range(4): self.stat[i] = self.START_STAT[self.slot][i] self.lastStatPoint = self.CREATE_STAT_POINT self.RefreshStat() @@ -560,18 +560,18 @@ class CreateCharacterWindow(ui.Window): event.UpdateEventSet(self.descIndex, xposEventSet+7, -(yposEventSet+7)) self.descriptionBox.SetIndex(self.descIndex) - for i in xrange(4): + for i in range(4): self.curNameAlpha[i] += (self.destNameAlpha[i] - self.curNameAlpha[i]) / 10.0 self.NameList[i].SetAlpha(self.curNameAlpha[i]) - for i in xrange(4): + for i in range(4): self.curGauge[i] += (self.destGauge[i] - self.curGauge[i]) / 10.0 if abs(self.curGauge[i] - self.destGauge[i]) < 0.005: self.curGauge[i] = self.destGauge[i] self.GaugeList[i].SetPercentage(self.curGauge[i], 1.0) - for page in xrange(PAGE_COUNT): - for i in xrange(SLOT_COUNT): + for page in range(PAGE_COUNT): + for i in range(SLOT_COUNT): chr.SelectInstance(self.__GetSlotChrID(page, i)) distance = 50.0 @@ -629,7 +629,7 @@ class CreateCharacterWindow(ui.Window): return True def OverInStatButton(self, stat): - if not self.STAT_DESCRIPTION.has_key(stat): + if stat not in self.STAT_DESCRIPTION: return self.toolTip.ClearToolTip() diff --git a/assets/root/introempire.py b/assets/root/introempire.py index f385548f..ed0b34ef 100644 --- a/assets/root/introempire.py +++ b/assets/root/introempire.py @@ -40,7 +40,7 @@ class SelectEmpireWindow(ui.ScriptWindow): event.RenderEventSet(self.descIndex) def __init__(self, stream): - print "NEW EMPIRE WINDOW ----------------------------------------------------------------------------" + print("NEW EMPIRE WINDOW ----------------------------------------------------------------------------") ui.ScriptWindow.__init__(self) net.SetPhaseWindow(net.PHASE_WINDOW_EMPIRE, self) @@ -61,10 +61,10 @@ class SelectEmpireWindow(ui.ScriptWindow): def __del__(self): ui.ScriptWindow.__del__(self) net.SetPhaseWindow(net.PHASE_WINDOW_EMPIRE, 0) - print "---------------------------------------------------------------------------- DELETE EMPIRE WINDOW" + print("---------------------------------------------------------------------------- DELETE EMPIRE WINDOW") def Close(self): - print "---------------------------------------------------------------------------- CLOSE EMPIRE WINDOW" + print("---------------------------------------------------------------------------- CLOSE EMPIRE WINDOW") self.ClearDictionary() self.leftButton = None @@ -83,7 +83,7 @@ class SelectEmpireWindow(ui.ScriptWindow): event.Destroy() def Open(self): - print "OPEN EMPIRE WINDOW ----------------------------------------------------------------------------" + print("OPEN EMPIRE WINDOW ----------------------------------------------------------------------------") self.SetSize(wndMgr.GetScreenWidth(), wndMgr.GetScreenHeight()) self.SetWindowName("SelectEmpireWindow") @@ -104,7 +104,7 @@ class SelectEmpireWindow(ui.ScriptWindow): app.ShowCursor() def __CreateButtons(self): - for key, img in self.empireArea.items(): + for key, img in list(self.empireArea.items()): img.SetAlpha(0.0) @@ -128,7 +128,7 @@ class SelectEmpireWindow(ui.ScriptWindow): self.empireAreaDestAlpha[arg] = 0.0 def OnSelectEmpire(self, arg): - for key in self.empireArea.keys(): + for key in list(self.empireArea.keys()): self.empireAreaDestAlpha[key] = 0.0 self.empireAreaFlagDestAlpha[key] = 0.0 self.empireFlagDestAlpha[key] = 0.0 @@ -138,7 +138,7 @@ class SelectEmpireWindow(ui.ScriptWindow): self.empireID = arg event.ClearEventSet(self.descIndex) - if self.EMPIRE_DESCRIPTION_TEXT_FILE_NAME.has_key(arg): + if arg in self.EMPIRE_DESCRIPTION_TEXT_FILE_NAME: self.descIndex = event.RegisterEventSet(self.EMPIRE_DESCRIPTION_TEXT_FILE_NAME[arg]) if app.IsRTL(): @@ -195,9 +195,9 @@ class SelectEmpireWindow(ui.ScriptWindow): self.exitButton.SetEvent(ui.__mem_func__(self.ClickExitButton)) self.leftButton.SetEvent(ui.__mem_func__(self.ClickLeftButton)) self.rightButton.SetEvent(ui.__mem_func__(self.ClickRightButton)) - for flag in self.empireAreaFlag.values(): + for flag in list(self.empireAreaFlag.values()): flag.SetAlpha(0.0) - for flag in self.empireFlag.values(): + for flag in list(self.empireFlag.values()): flag.SetAlpha(0.0) return 1 @@ -233,7 +233,7 @@ class SelectEmpireWindow(ui.ScriptWindow): self.__UpdateAlpha(self.empireFlag, self.empireFlagCurAlpha, self.empireFlagDestAlpha) def __UpdateAlpha(self, dict, curAlphaDict, destAlphaDict): - for key, img in dict.items(): + for key, img in list(dict.items()): curAlpha = curAlphaDict[key] destAlpha = destAlphaDict[key] diff --git a/assets/root/introloading.py b/assets/root/introloading.py index d7e40f35..97bd33ba 100644 --- a/assets/root/introloading.py +++ b/assets/root/introloading.py @@ -1,3 +1,4 @@ +# -*- coding: cp949 -*- import ui import uiScriptLocale import net @@ -37,7 +38,7 @@ import uiRestart class LoadingWindow(ui.ScriptWindow): def __init__(self, stream): - print "NEW LOADING WINDOW -------------------------------------------------------------------------------" + print("NEW LOADING WINDOW -------------------------------------------------------------------------------") ui.Window.__init__(self) net.SetPhaseWindow(net.PHASE_WINDOW_LOAD, self) @@ -51,12 +52,12 @@ class LoadingWindow(ui.ScriptWindow): self.loadStepList=[] def __del__(self): - print "---------------------------------------------------------------------------- DELETE LOADING WINDOW" + print("---------------------------------------------------------------------------- DELETE LOADING WINDOW") net.SetPhaseWindow(net.PHASE_WINDOW_LOAD, 0) ui.Window.__del__(self) def Open(self): - print "OPEN LOADING WINDOW -------------------------------------------------------------------------------" + print("OPEN LOADING WINDOW -------------------------------------------------------------------------------") #app.HideCursor() @@ -114,7 +115,7 @@ class LoadingWindow(ui.ScriptWindow): self.loadingImage.LoadImage(imgFileName) except: - print "LoadingWindow.Open.LoadImage - %s File Load Error" % (imgFileName) + print(("LoadingWindow.Open.LoadImage - %s File Load Error" % (imgFileName))) self.loadingImage.Hide() @@ -132,7 +133,7 @@ class LoadingWindow(ui.ScriptWindow): app.SetFrameSkip(0) def Close(self): - print "---------------------------------------------------------------------------- CLOSE LOADING WINDOW" + print("---------------------------------------------------------------------------- CLOSE LOADING WINDOW") app.SetFrameSkip(1) @@ -258,7 +259,7 @@ class LoadingWindow(ui.ScriptWindow): playerSettingModule.RegisterSkill(race, group, empire) def __RegisterTitleName(self): - for i in xrange(len(localeInfo.TITLE_NAME_LIST)): + for i in range(len(localeInfo.TITLE_NAME_LIST)): chrmgr.RegisterTitleName(i, localeInfo.TITLE_NAME_LIST[i]) def __RegisterColor(self): @@ -280,7 +281,7 @@ class LoadingWindow(ui.ScriptWindow): chrmgr.NAMECOLOR_EMPIRE_PC+2 : colorInfo.CHR_NAME_RGB_EMPIRE_PC_B, chrmgr.NAMECOLOR_EMPIRE_PC+3 : colorInfo.CHR_NAME_RGB_EMPIRE_PC_C, } - for name, rgb in NAME_COLOR_DICT.items(): + for name, rgb in list(NAME_COLOR_DICT.items()): chrmgr.RegisterNameColor(name, rgb[0], rgb[1], rgb[2]) ## Title diff --git a/assets/root/intrologin.py b/assets/root/intrologin.py index 6fb2867f..20e50ffe 100644 --- a/assets/root/intrologin.py +++ b/assets/root/intrologin.py @@ -33,7 +33,7 @@ def Suffle(src): items = [item for item in src] itemCount = len(items) - for oldPos in xrange(itemCount): + for oldPos in range(itemCount): newPos = app.GetRandom(0, itemCount-1) items[newPos], items[oldPos] = items[oldPos], items[newPos] @@ -128,7 +128,7 @@ class ConnectingDialog(ui.ScriptWindow): class LoginWindow(ui.ScriptWindow): def __init__(self, stream): - print "NEW LOGIN WINDOW ----------------------------------------------------------------------------" + print("NEW LOGIN WINDOW ----------------------------------------------------------------------------") ui.ScriptWindow.__init__(self) net.SetPhaseWindow(net.PHASE_WINDOW_LOGIN, self) net.SetAccountConnectorHandler(self) @@ -157,12 +157,12 @@ class LoginWindow(ui.ScriptWindow): net.ClearPhaseWindow(net.PHASE_WINDOW_LOGIN, self) net.SetAccountConnectorHandler(0) ui.ScriptWindow.__del__(self) - print "---------------------------------------------------------------------------- DELETE LOGIN WINDOW" + print("---------------------------------------------------------------------------- DELETE LOGIN WINDOW") def Open(self): ServerStateChecker.Create(self) - print "LOGIN WINDOW OPEN ----------------------------------------------------------------------------" + print("LOGIN WINDOW OPEN ----------------------------------------------------------------------------") self.loginFailureMsgDict={ #"DEFAULT" : localeInfo.LOGIN_FAILURE_UNKNOWN, @@ -253,7 +253,7 @@ class LoginWindow(ui.ScriptWindow): ServerStateChecker.Initialize(self) - print "---------------------------------------------------------------------------- CLOSE LOGIN WINDOW " + print("---------------------------------------------------------------------------- CLOSE LOGIN WINDOW ") # # Check both since BGM stops if selectMusic is not set. # @@ -290,7 +290,7 @@ class LoginWindow(ui.ScriptWindow): # VIRTUAL_KEYBOARD_BUG_FIX if self.virtualKeyboard: - for keyIndex in xrange(0, VIRTUAL_KEYBOARD_NUM_KEYS+1): + for keyIndex in range(0, VIRTUAL_KEYBOARD_NUM_KEYS+1): key = self.GetChild2("key_%d" % keyIndex) if key: key.SetEvent(None) @@ -320,7 +320,7 @@ class LoginWindow(ui.ScriptWindow): with open("channel.inf", "w") as file: file.write("%d %d %d" % (self.__GetServerID(), self.__GetChannelID(), self.__GetRegionID())) except: - print "LoginWindow.__SaveChannelInfo - SaveError" + print("LoginWindow.__SaveChannelInfo - SaveError") def __LoadChannelInfo(self): try: @@ -339,7 +339,7 @@ class LoginWindow(ui.ScriptWindow): return regionID, selServerID, selChannelID except: - print "LoginWindow.__LoadChannelInfo - OpenError" + print("LoginWindow.__LoadChannelInfo - OpenError") return -1, -1, -1 def __ExitGame(self): @@ -508,7 +508,7 @@ class LoginWindow(ui.ScriptWindow): key.ButtonText.SetFontColor(0, 0, 0) keyIndex += 1 - for keyIndex in xrange(keyIndex, VIRTUAL_KEYBOARD_NUM_KEYS+1): + for keyIndex in range(keyIndex, VIRTUAL_KEYBOARD_NUM_KEYS+1): key = self.GetChild2("key_%d" % keyIndex) if key: key.SetEvent(lambda x=' ': self.__VirtualKeyboard_PressKey(x)) @@ -683,9 +683,9 @@ class LoginWindow(ui.ScriptWindow): try: loginInfo={} - execfile(loginInfoFileName, loginInfo) + exec(compile(open(loginInfoFileName, "rb").read(), loginInfoFileName, 'exec'), loginInfo) except IOError: - print(\ + print((\ "For automatic login, please create" + loginInfoFileName + "file\n"\ "\n"\ "Contents:\n"\ @@ -698,7 +698,7 @@ class LoginWindow(ui.ScriptWindow): "autoLogin=enable auto login\n" "autoSelect=enable auto select\n" "locale=(ymir) works as ymir for LC_Ymir. Works as korea if not specified\n" - ); + )); id=loginInfo.get("id", "") pwd=loginInfo.get("pwd", "") @@ -740,9 +740,9 @@ class LoginWindow(ui.ScriptWindow): if isAutoLogin: self.Connect(id, pwd) - print "==================================================================================" - print "Auto login: %s - %s:%d %s" % (loginInfoFileName, addr, port, id) - print "==================================================================================" + print("==================================================================================") + print(("Auto login: %s - %s:%d %s" % (loginInfoFileName, addr, port, id))) + print("==================================================================================") def PopupDisplayMessage(self, msg): @@ -801,7 +801,7 @@ class LoginWindow(ui.ScriptWindow): return -1 retServerIndex = 0 - for eachServerID, regionDataDict in regionDict.items(): + for eachServerID, regionDataDict in list(regionDict.items()): if eachServerID == targetServerID: return retServerIndex @@ -888,7 +888,7 @@ class LoginWindow(ui.ScriptWindow): def __RefreshServerList(self): regionID = self.__GetRegionID() - if not serverInfo.REGION_DICT.has_key(regionID): + if regionID not in serverInfo.REGION_DICT: return self.serverList.ClearItem() @@ -897,7 +897,7 @@ class LoginWindow(ui.ScriptWindow): # SEVER_LIST_BUG_FIX visible_index = 1 - for id, regionDataDict in regionDict.items(): + for id, regionDataDict in list(regionDict.items()): name = regionDataDict.get("name", "noname") try: server_id = serverInfo.SERVER_ID_DICT[id] @@ -920,11 +920,11 @@ class LoginWindow(ui.ScriptWindow): try: channelDict = serverInfo.REGION_DICT[regionID][serverID]["channel"] except: - print " __RequestServerStateList - serverInfo.REGION_DICT(%d, %d)" % (regionID, serverID) + print((" __RequestServerStateList - serverInfo.REGION_DICT(%d, %d)" % (regionID, serverID))) return ServerStateChecker.Initialize(); - for id, channelDataDict in channelDict.items(): + for id, channelDataDict in list(channelDict.items()): key=channelDataDict["key"] ip=channelDataDict["ip"] udp_port=channelDataDict["udp_port"] @@ -943,10 +943,10 @@ class LoginWindow(ui.ScriptWindow): try: channelDict = serverInfo.REGION_DICT[regionID][serverID]["channel"] except: - print " __RequestServerStateList - serverInfo.REGION_DICT(%d, %d)" % (regionID, serverID) + print((" __RequestServerStateList - serverInfo.REGION_DICT(%d, %d)" % (regionID, serverID))) return - for channelID, channelDataDict in channelDict.items(): + for channelID, channelDataDict in list(channelDict.items()): channelName = channelDataDict["name"] channelState = channelDataDict["state"] self.channelList.InsertItem(channelID, " %s %s" % (channelName, channelState)) @@ -981,18 +981,18 @@ class LoginWindow(ui.ScriptWindow): exception.Abort(localeInfo.CHANNEL_NOT_FIND_INFO) def __OnClickExitServerButton(self): - print "exit server" + print("exit server") self.__OpenLoginBoard() def __OnClickSelectRegionButton(self): regionID = self.__GetRegionID() serverID = self.__GetServerID() - if (not serverInfo.REGION_DICT.has_key(regionID)): + if (regionID not in serverInfo.REGION_DICT): self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_REGION) return - if (not serverInfo.REGION_DICT[regionID].has_key(serverID)): + if (serverID not in serverInfo.REGION_DICT[regionID]): self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_SERVER) return @@ -1009,11 +1009,11 @@ class LoginWindow(ui.ScriptWindow): serverID = self.__GetServerID() channelID = self.__GetChannelID() - if (not serverInfo.REGION_DICT.has_key(regionID)): + if (regionID not in serverInfo.REGION_DICT): self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_REGION) return - if (not serverInfo.REGION_DICT[regionID].has_key(serverID)): + if (serverID not in serverInfo.REGION_DICT[regionID]): self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_SERVER) return @@ -1040,7 +1040,7 @@ class LoginWindow(ui.ScriptWindow): channelName = serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["name"] addrKey = serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["key"] except: - print " ERROR __OnClickSelectServerButton(%d, %d, %d)" % (regionID, serverID, channelID) + print((" ERROR __OnClickSelectServerButton(%d, %d, %d)" % (regionID, serverID, channelID))) serverName = localeInfo.CHANNEL_EMPTY_SERVER channelName = localeInfo.CHANNEL_NORMAL % channelID diff --git a/assets/root/introselect.py b/assets/root/introselect.py index 73c0efbb..0c916dec 100644 --- a/assets/root/introselect.py +++ b/assets/root/introselect.py @@ -1,3 +1,4 @@ +# -*- coding: cp949 -*- import chr import grp import app @@ -103,7 +104,7 @@ class SelectCharacterWindow(ui.Window): self.curNameAlpha = [] self.destNameAlpha = [] - for i in xrange(self.CHARACTER_TYPE_COUNT): + for i in range(self.CHARACTER_TYPE_COUNT): self.curNameAlpha.append(0.0) self.destNameAlpha.append(0.0) @@ -214,11 +215,11 @@ class SelectCharacterWindow(ui.Window): def SetEmpire(self, id): self.empireName.SetText(self.EMPIRE_NAME.get(id, "")) - if self.flagDict.has_key(id): + if id in self.flagDict: self.flagDict[id].Show() def HideAllFlag(self): - for flag in self.flagDict.values(): + for flag in list(self.flagDict.values()): flag.Hide() def Refresh(self): @@ -403,7 +404,7 @@ class SelectCharacterWindow(ui.Window): self.startIndex = self.slot self.startReservingTime = app.GetTime() - for i in xrange(self.SLOT_COUNT): + for i in range(self.SLOT_COUNT): if False == chr.HasInstance(i): continue @@ -475,7 +476,7 @@ class SelectCharacterWindow(ui.Window): self.stream.SetCreateCharacterPhase() def __AreAllSlotEmpty(self): - for iSlot in xrange(self.SLOT_COUNT): + for iSlot in range(self.SLOT_COUNT): if 0!=net.GetAccountCharacterSlotDataInteger(iSlot, net.ACCOUNT_CHARACTER_SLOT_ID): return 0 return 1 @@ -586,10 +587,10 @@ class SelectCharacterWindow(ui.Window): chr.SelectInstance(self.slot) - for i in xrange(self.CHARACTER_TYPE_COUNT): + for i in range(self.CHARACTER_TYPE_COUNT): self.destNameAlpha[i] = 0.0 - for i in xrange(self.SLOT_COUNT): + for i in range(self.SLOT_COUNT): self.destRotation[(i+self.slot)%self.SLOT_COUNT] = self.SLOT_ROTATION[i] self.destGauge = [0.0, 0.0, 0.0, 0.0] @@ -704,17 +705,17 @@ class SelectCharacterWindow(ui.Window): def OnUpdate(self): chr.Update() - for i in xrange(4): + for i in range(4): self.curGauge[i] += (self.destGauge[i] - self.curGauge[i]) / 10.0 if abs(self.curGauge[i] - self.destGauge[i]) < 0.005: self.curGauge[i] = self.destGauge[i] self.GaugeList[i].SetPercentage(self.curGauge[i], 1.0) - for i in xrange(self.CHARACTER_TYPE_COUNT): + for i in range(self.CHARACTER_TYPE_COUNT): self.curNameAlpha[i] += (self.destNameAlpha[i] - self.curNameAlpha[i]) / 10.0 self.NameList[i].SetAlpha(self.curNameAlpha[i]) - for i in xrange(self.SLOT_COUNT): + for i in range(self.SLOT_COUNT): if False == chr.HasInstance(i): continue diff --git a/assets/root/localeinfo.py b/assets/root/localeinfo.py index cdef2eb2..54cbb875 100644 --- a/assets/root/localeinfo.py +++ b/assets/root/localeinfo.py @@ -102,7 +102,7 @@ def LoadLocaleFile(srcFileName, localeDict): else: localeDict[tokens[0]] = tokens[1] else: - raise RuntimeError, "Unknown TokenSize" + raise RuntimeError("Unknown TokenSize") lineIndex += 1 except: @@ -115,7 +115,7 @@ try: currentLocalePath = app.GetLocalePath() if not app.LoadLocaleData(currentLocalePath): dbg.TraceError("localeInfo: Failed to load C++ locale data from %s" % currentLocalePath) -except Exception, e: +except Exception as e: dbg.TraceError("localeInfo: Error loading C++ locale data: %s" % str(e)) # Option pvp messages diff --git a/assets/root/mousemodule.py b/assets/root/mousemodule.py index 711febcb..3b0d046a 100644 --- a/assets/root/mousemodule.py +++ b/assets/root/mousemodule.py @@ -239,7 +239,7 @@ class CMouseController(object): self.AttachedIconHalfHeight = grpImage.GetHeight(self.AttachedIconHandle) / 2 wndMgr.AttachIcon(self.AttachedType, self.AttachedItemIndex, self.AttachedSlotNumber, width, height) - except Exception, e: + except Exception as e: dbg.TraceError("mouseModule.py: AttachObject : " + str(e)) self.AttachedIconHandle = 0 @@ -388,7 +388,7 @@ class CMouseController(object): def RunCallBack(self, type, *arg): - if not self.callbackDict.has_key(type): + if type not in self.callbackDict: self.DeattachObject() return diff --git a/assets/root/networkmodule.py b/assets/root/networkmodule.py index 1747f9e9..95d7227f 100644 --- a/assets/root/networkmodule.py +++ b/assets/root/networkmodule.py @@ -21,12 +21,12 @@ import localeInfo class PopupDialog(ui.ScriptWindow): def __init__(self): - print "NEW POPUP DIALOG ----------------------------------------------------------------------------" + print("NEW POPUP DIALOG ----------------------------------------------------------------------------") ui.ScriptWindow.__init__(self) self.CloseEvent = 0 def __del__(self): - print "---------------------------------------------------------------------------- DELETE POPUP DIALOG " + print("---------------------------------------------------------------------------- DELETE POPUP DIALOG ") ui.ScriptWindow.__del__(self) def LoadDialog(self): @@ -81,7 +81,7 @@ class MainStream(object): isChrData=0 def __init__(self): - print "NEWMAIN STREAM ----------------------------------------------------------------------------" + print("NEWMAIN STREAM ----------------------------------------------------------------------------") net.SetHandler(self) net.SetTCPRecvBufferSize(128*1024) net.SetTCPSendBufferSize(4096) @@ -101,7 +101,7 @@ class MainStream(object): self.newPhaseWindow = 0 def __del__(self): - print "---------------------------------------------------------------------------- DELETE MAIN STREAM " + print("---------------------------------------------------------------------------- DELETE MAIN STREAM ") def Destroy(self): if self.curPhaseWindow: diff --git a/assets/root/playersettingmodule.py b/assets/root/playersettingmodule.py index d17d57f4..d01c4da5 100644 --- a/assets/root/playersettingmodule.py +++ b/assets/root/playersettingmodule.py @@ -87,26 +87,26 @@ def RegisterSkill(race, group, empire=0): job = chr.RaceToJob(race) # Ensure group 0 exists (horse-only) when cooldown fix is on - if not SKILL_INDEX_DICT[job].has_key(0): + if 0 not in SKILL_INDEX_DICT[job]: # Assassin has 140 as well; others only 137-139 SKILL_INDEX_DICT[job][0] = (0, 0, 0, 0, 0, 0, 0, 0, 137, 0, 138, 0, 139, 0) + ((140,) if job == JOB_ASSASSIN else ()) ## Support Skills (Always register regardless of skill group) - if SKILL_INDEX_DICT.has_key(job): + if job in SKILL_INDEX_DICT: supportSkillList = SKILL_INDEX_DICT[job].get("SUPPORT", ()) - for i in xrange(len(supportSkillList)): + for i in range(len(supportSkillList)): player.SetSkill(i + 100 + 1, supportSkillList[i]) ## Character Skill - if SKILL_INDEX_DICT.has_key(job): + if job in SKILL_INDEX_DICT: - if SKILL_INDEX_DICT[job].has_key(group): + if group in SKILL_INDEX_DICT[job]: activeSkillList = SKILL_INDEX_DICT[job][group] - for i in xrange(len(activeSkillList)): + for i in range(len(activeSkillList)): skillIndex = activeSkillList[i] ## Skills 7 and 8 should not be set here @@ -115,23 +115,23 @@ def RegisterSkill(race, group, empire=0): supportSkillList = SKILL_INDEX_DICT[job]["SUPPORT"] - for i in xrange(len(supportSkillList)): + for i in range(len(supportSkillList)): player.SetSkill(i+100+1, supportSkillList[i]) ## Language Skill if 0 != empire: languageSkillList = [] - for i in xrange(3): + for i in range(3): if (i+1) != empire: languageSkillList.append(player.SKILL_INDEX_LANGUAGE1+i) - for i in xrange(len(languageSkillList)): + for i in range(len(languageSkillList)): player.SetSkill(107+i, languageSkillList[i]) ## Guild Skill - for i in xrange(len(PASSIVE_GUILD_SKILL_INDEX_LIST)): + for i in range(len(PASSIVE_GUILD_SKILL_INDEX_LIST)): player.SetSkill(200+i, PASSIVE_GUILD_SKILL_INDEX_LIST[i]) - for i in xrange(len(ACTIVE_GUILD_SKILL_INDEX_LIST)): + for i in range(len(ACTIVE_GUILD_SKILL_INDEX_LIST)): player.SetSkill(210+i, ACTIVE_GUILD_SKILL_INDEX_LIST[i]) def RegisterSkillAt(race, group, pos, num): @@ -492,7 +492,7 @@ def __LoadGameWarriorEx(race, path): ## SKILL chrmgr.SetPathName(path + "skill/") - for i in xrange(skill.SKILL_EFFECT_COUNT): + for i in range(skill.SKILL_EFFECT_COUNT): END_STRING = "" if i != 0: END_STRING = "_%d" % (i+1) chrmgr.RegisterCacheMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_SKILL+(i*skill.SKILL_GRADEGAP)+1, "samyeon" + END_STRING + ".msa") @@ -677,7 +677,7 @@ def __LoadGameAssassinEx(race, path): ## SKILL chrmgr.SetPathName(path + "skill/") - for i in xrange(skill.SKILL_EFFECT_COUNT): + for i in range(skill.SKILL_EFFECT_COUNT): END_STRING = "" if i != 0: END_STRING = "_%d" % (i+1) chrmgr.RegisterCacheMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_SKILL+(i*skill.SKILL_GRADEGAP)+1, "amseup" + END_STRING + ".msa") @@ -890,7 +890,7 @@ def __LoadGameSuraEx(race, path): chrmgr.SetPathName(path + "skill/") # chrmgr.RegisterCacheMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_SKILL+4, "geongon.msa") - for i in xrange(skill.SKILL_EFFECT_COUNT): + for i in range(skill.SKILL_EFFECT_COUNT): END_STRING = "" if i != 0: END_STRING = "_%d" % (i+1) chrmgr.RegisterCacheMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_SKILL+(i*skill.SKILL_GRADEGAP)+1, "swaeryeong" + END_STRING + ".msa") @@ -1240,7 +1240,7 @@ def LoadGuildBuildingList(filename): handle = app.OpenTextFile(filename) count = app.GetTextFileLineCount(handle) - for i in xrange(count): + for i in range(count): line = app.GetTextFileLine(handle, i) tokens = line.split("\t") @@ -1365,7 +1365,7 @@ def LoadGameData(name): try: load() except: - print name + print(name) import exception exception.Abort("LoadGameData") raise diff --git a/assets/root/prototype.py b/assets/root/prototype.py index 990b1812..0b7b5288 100644 --- a/assets/root/prototype.py +++ b/assets/root/prototype.py @@ -27,7 +27,7 @@ def RunApp(): try: app.Create(localeInfo.APP_TITLE, systemSetting.GetWidth(), systemSetting.GetHeight(), 1) - except RuntimeError, msg: + except RuntimeError as msg: msg = str(msg) if "CREATE_DEVICE" == msg: dbg.LogBox("Sorry, Your system does not support 3D graphics,\r\nplease check your hardware and system configeration\r\nthen try again.") diff --git a/assets/root/rootlibcythonizer.py b/assets/root/rootlibcythonizer.py index 22321a5f..d5da07cd 100644 --- a/assets/root/rootlibcythonizer.py +++ b/assets/root/rootlibcythonizer.py @@ -24,7 +24,7 @@ for m in moduleLst: import sourceWriter sourceFileName = sourceWriter.run(moduleNameLst, 'rootlib') -print "%s create successful." % sourceFileName +print(("%s create successful." % sourceFileName)) # not yet implemented. #from distutils.dist import Distribution diff --git a/assets/root/servercommandparser.py b/assets/root/servercommandparser.py index b46cd87b..def89884 100644 --- a/assets/root/servercommandparser.py +++ b/assets/root/servercommandparser.py @@ -1,3 +1,4 @@ +# -*- coding: cp949 -*- import net import background import stringCommander @@ -21,16 +22,16 @@ class ServerCommandParser(object): } self.serverCommander=stringCommander.Analyzer() - for serverCommandItem in serverCommandList.items(): + for serverCommandItem in list(serverCommandList.items()): self.serverCommander.SAFE_RegisterCallBack( serverCommandItem[0], serverCommandItem[1] ) def BINARY_ServerCommand_Run(self, line): try: - print " BINARY_ServerCommand_Reserve", line + print((" BINARY_ServerCommand_Reserve", line)) return self.serverCommander.Run(line) - except RuntimeError, msg: + except RuntimeError as msg: import dbg dbg.TraceError(msg) return 0 diff --git a/assets/root/stringcommander.py b/assets/root/stringcommander.py index ba493028..36d00b8b 100644 --- a/assets/root/stringcommander.py +++ b/assets/root/stringcommander.py @@ -20,12 +20,12 @@ class CallBackFunction: return self.func(self.obj, *arg) def __init__(self, mfunc): - self.argCount=mfunc.im_func.func_code.co_argcount + self.argCount=mfunc.__func__.__code__.co_argcount if self.argCount>1: - self.call=CallBackFunction.__arg_call__(mfunc.im_class, mfunc.im_self, mfunc.im_func) + self.call=CallBackFunction.__arg_call__(mfunc.__self__.__class__, mfunc.__self__, mfunc.__func__) else: - self.call=CallBackFunction.__noarg_call__(mfunc.im_class, mfunc.im_self, mfunc.im_func) + self.call=CallBackFunction.__noarg_call__(mfunc.__self__.__class__, mfunc.__self__, mfunc.__func__) def __call__(self, *arg): return self.call(*arg) @@ -56,7 +56,7 @@ class Analyzer: argCount=callBackFunc.GetArgumentCount()-1 if len(tokens)1: - self.call=__mem_func__.__arg_call__(mfunc.im_class, mfunc.im_self, mfunc.im_func) + if mfunc.__func__.__code__.co_argcount>1: + self.call=__mem_func__.__arg_call__(mfunc.__self__.__class__, mfunc.__self__, mfunc.__func__) else: - self.call=__mem_func__.__noarg_call__(mfunc.im_class, mfunc.im_self, mfunc.im_func) + self.call=__mem_func__.__noarg_call__(mfunc.__self__.__class__, mfunc.__self__, mfunc.__func__) def __call__(self, *arg): return self.call(*arg) @@ -822,14 +822,14 @@ class ImageBox(Window): wndMgr.LoadImage(self.hWnd, imageName) if len(self.eventDict)!=0: - print "LOAD IMAGE", self, self.eventDict + print(("LOAD IMAGE", self, self.eventDict)) def LoadImageFromFile(self, imageName): self.name=imageName wndMgr.LoadImageFromFile(self.hWnd, imageName) if len(self.eventDict)!=0: - print "LOAD IMAGE", self, self.eventDict + print(("LOAD IMAGE", self, self.eventDict)) def SetAlpha(self, alpha): wndMgr.SetDiffuseColor(self.hWnd, 1.0, 1.0, 1.0, alpha) @@ -1021,7 +1021,7 @@ class Button(Window): snd.PlaySound("sound/ui/click.wav") if self.eventFunc: - apply(self.eventFunc, self.eventArgs) + self.eventFunc(*self.eventArgs) def ShowToolTip(self): if self.ToolTipText: @@ -2333,7 +2333,7 @@ class ListBox(Window): self._LocateItem() def ChangeItem(self, number, text): - for key, value in self.keyDict.items(): + for key, value in list(self.keyDict.items()): if value == number: self.textDict[key] = text @@ -2385,7 +2385,7 @@ class ListBox(Window): def SelectItem(self, line): - if not self.keyDict.has_key(line): + if line not in self.keyDict: return if line == self.selectedLine: @@ -2705,7 +2705,7 @@ class ScriptWindow(Window): self.ElementDictionary[name] = child def IsChild(self, name): - return self.ElementDictionary.has_key(name) + return name in self.ElementDictionary def GetChild(self, name): return self.ElementDictionary[name] @@ -2755,7 +2755,7 @@ class PythonScriptLoader(object): import errno self.Clear() - print "===== Load Script File : %s" % (FileName) + print(("===== Load Script File : %s" % (FileName))) try: # chr, player ���� sandbox ������ import�� ������ �ʱ� ������,(���� �ǿ��� ������ �ſ� ŭ.) @@ -2767,14 +2767,14 @@ class PythonScriptLoader(object): self.ScriptDictionary["DRAGON_SOUL_EQUIPMENT_SLOT_START"] = player.DRAGON_SOUL_EQUIPMENT_SLOT_START self.ScriptDictionary["LOCALE_PATH"] = app.GetLocalePath() self.ScriptDictionary["LOCALE_PATH_COMMON"] = app.GetLocalePathCommon() - execfile(FileName, self.ScriptDictionary) - except IOError, err: + exec(compile(open(FileName, "rb").read(), FileName, 'exec'), self.ScriptDictionary) + except IOError as err: import sys import dbg dbg.TraceError("Failed to load script file : %s" % (FileName)) dbg.TraceError("error : %s" % (err)) exception.Abort("LoadScriptFile1") - except RuntimeError,err: + except RuntimeError as err: import sys import dbg dbg.TraceError("Failed to load script file : %s" % (FileName)) @@ -2799,15 +2799,15 @@ class PythonScriptLoader(object): if app.IsRTL(): w = wndMgr.GetScreenWidth() h = wndMgr.GetScreenHeight() - if Body.has_key("width"): + if "width" in Body: w = int(Body["width"]) - if Body.has_key("height"): + if "height" in Body: h = int(Body["height"]) window.SetSize(w, h) else: window.SetSize(int(Body["width"]), int(Body["height"])) - if True == Body.has_key("style"): + if True == ("style" in Body): for StyleList in Body["style"]: window.AddFlag(StyleList) @@ -2817,17 +2817,17 @@ class PythonScriptLoader(object): if app.IsRTL(): parent.AddFlag("rtl") - if True == dicChildren.has_key("style"): + if True == ("style" in dicChildren): for style in dicChildren["style"]: parent.AddFlag(style) - if False == dicChildren.has_key("children"): + if False == ("children" in dicChildren): return False Index = 0 ChildrenList = dicChildren["children"] - parent.Children = range(len(ChildrenList)) + parent.Children = list(range(len(ChildrenList))) for ElementValue in ChildrenList: try: Name = ElementValue["name"] @@ -3006,8 +3006,8 @@ class PythonScriptLoader(object): def CheckKeyList(self, name, value, key_list): for DataKey in key_list: - if False == value.has_key(DataKey): - print "Failed to find data key", "[" + name + "/" + DataKey + "]" + if False == (DataKey in value): + print(("Failed to find data key", "[" + name + "/" + DataKey + "]")) return False return True @@ -3015,7 +3015,7 @@ class PythonScriptLoader(object): def LoadDefaultData(self, window, value, parentWindow): loc_x = int(value["x"]) loc_y = int(value["y"]) - if value.has_key("vertical_align"): + if "vertical_align" in value: if "center" == value["vertical_align"]: window.SetWindowVerticalAlignCenter() elif "bottom" == value["vertical_align"]: @@ -3023,7 +3023,7 @@ class PythonScriptLoader(object): if parentWindow.IsRTL(): loc_x = int(value["x"]) + window.GetWidth() - if value.has_key("horizontal_align"): + if "horizontal_align" in value: if "center" == value["horizontal_align"]: window.SetWindowHorizontalAlignCenter() loc_x = - int(value["x"]) @@ -3034,12 +3034,12 @@ class PythonScriptLoader(object): else: window.SetWindowHorizontalAlignRight() - if value.has_key("all_align"): + if "all_align" in value: window.SetWindowVerticalAlignCenter() window.SetWindowHorizontalAlignCenter() loc_x = - int(value["x"]) else: - if value.has_key("horizontal_align"): + if "horizontal_align" in value: if "center" == value["horizontal_align"]: window.SetWindowHorizontalAlignCenter() elif "right" == value["horizontal_align"]: @@ -3062,29 +3062,29 @@ class PythonScriptLoader(object): ## Button def LoadElementButton(self, window, value, parentWindow): - if value.has_key("width") and value.has_key("height"): + if "width" in value and "height" in value: window.SetSize(int(value["width"]), int(value["height"])) - if True == value.has_key("default_image"): + if True == ("default_image" in value): window.SetUpVisual(value["default_image"]) - if True == value.has_key("over_image"): + if True == ("over_image" in value): window.SetOverVisual(value["over_image"]) - if True == value.has_key("down_image"): + if True == ("down_image" in value): window.SetDownVisual(value["down_image"]) - if True == value.has_key("disable_image"): + if True == ("disable_image" in value): window.SetDisableVisual(value["disable_image"]) - if True == value.has_key("text"): - if True == value.has_key("text_height"): + if True == ("text" in value): + if True == ("text_height" in value): window.SetText(value["text"], value["text_height"]) else: window.SetText(value["text"]) - if value.has_key("text_color"): + if "text_color" in value: window.SetTextColor(value["text_color"]) - if True == value.has_key("tooltip_text"): - if True == value.has_key("tooltip_x") and True == value.has_key("tooltip_y"): + if True == ("tooltip_text" in value): + if True == ("tooltip_x" in value) and True == ("tooltip_y" in value): window.SetToolTipText(value["tooltip_text"], int(value["tooltip_x"]), int(value["tooltip_y"])) else: window.SetToolTipText(value["tooltip_text"]) @@ -3120,13 +3120,13 @@ class PythonScriptLoader(object): if False == self.CheckKeyList(value["name"], value, self.ANI_IMAGE_KEY_LIST): return False - if True == value.has_key("delay"): + if True == ("delay" in value): window.SetDelay(value["delay"]) for image in value["images"]: window.AppendImage(image) - if value.has_key("width") and value.has_key("height"): + if "width" in value and "height" in value: window.SetSize(value["width"], value["height"]) self.LoadDefaultData(window, value, parentWindow) @@ -3141,17 +3141,17 @@ class PythonScriptLoader(object): window.LoadImage(value["image"]) - if True == value.has_key("x_origin") and True == value.has_key("y_origin"): + if True == ("x_origin" in value) and True == ("y_origin" in value): window.SetOrigin(float(value["x_origin"]), float(value["y_origin"])) - if True == value.has_key("x_scale") and True == value.has_key("y_scale"): + if True == ("x_scale" in value) and True == ("y_scale" in value): window.SetScale(float(value["x_scale"]), float(value["y_scale"])) - if True == value.has_key("rect"): + if True == ("rect" in value): RenderingRect = value["rect"] window.SetRenderingRect(RenderingRect[0], RenderingRect[1], RenderingRect[2], RenderingRect[3]) - if True == value.has_key("mode"): + if True == ("mode" in value): mode = value["mode"] if "MODULATE" == mode: window.SetRenderingMode(wndMgr.RENDERING_MODE_MODULATE) @@ -3180,10 +3180,10 @@ class PythonScriptLoader(object): b = 1.0 a = 1.0 - if True == value.has_key("image_r") and \ - True == value.has_key("image_g") and \ - True == value.has_key("image_b") and \ - True == value.has_key("image_a"): + if True == ("image_r" in value) and \ + True == ("image_g" in value) and \ + True == ("image_b" in value) and \ + True == ("image_a" in value): r = float(value["image_r"]) g = float(value["image_g"]) b = float(value["image_b"]) @@ -3200,7 +3200,7 @@ class PythonScriptLoader(object): int(slot["width"]), int(slot["height"])) - if True == value.has_key("image"): + if True == ("image" in value): wndMgr.SetSlotBaseImage(window.hWnd, value["image"], r, g, b, a) @@ -3226,9 +3226,9 @@ class PythonScriptLoader(object): xBlank = 0 yBlank = 0 - if True == value.has_key("x_blank"): + if True == ("x_blank" in value): xBlank = int(value["x_blank"]) - if True == value.has_key("y_blank"): + if True == ("y_blank" in value): yBlank = int(value["y_blank"]) if app.IsRTL(): @@ -3243,22 +3243,22 @@ class PythonScriptLoader(object): int(value["y_step"]), xBlank, yBlank) - if True == value.has_key("image"): + if True == ("image" in value): r = 1.0 g = 1.0 b = 1.0 a = 1.0 - if True == value.has_key("image_r") and \ - True == value.has_key("image_g") and \ - True == value.has_key("image_b") and \ - True == value.has_key("image_a"): + if True == ("image_r" in value) and \ + True == ("image_g" in value) and \ + True == ("image_b" in value) and \ + True == ("image_a" in value): r = float(value["image_r"]) g = float(value["image_g"]) b = float(value["image_b"]) a = float(value["image_a"]) wndMgr.SetSlotBaseImage(window.hWnd, value["image"], r, g, b, a) - if True == value.has_key("style"): + if True == ("style" in value): if "select" == value["style"]: wndMgr.SetSlotStyle(window.hWnd, wndMgr.SLOT_STYLE_SELECT) @@ -3272,17 +3272,17 @@ class PythonScriptLoader(object): ## Text def LoadElementText(self, window, value, parentWindow): - if value.has_key("fontsize"): + if "fontsize" in value: fontSize = value["fontsize"] if "LARGE" == fontSize: window.SetFontName(localeInfo.UI_DEF_FONT_LARGE) - elif value.has_key("fontname"): + elif "fontname" in value: fontName = value["fontname"] window.SetFontName(fontName) - if value.has_key("text_horizontal_align"): + if "text_horizontal_align" in value: if "left" == value["text_horizontal_align"]: window.SetHorizontalAlignLeft() elif "center" == value["text_horizontal_align"]: @@ -3290,7 +3290,7 @@ class PythonScriptLoader(object): elif "right" == value["text_horizontal_align"]: window.SetHorizontalAlignRight() - if value.has_key("text_vertical_align"): + if "text_vertical_align" in value: if "top" == value["text_vertical_align"]: window.SetVerticalAlignTop() elif "center" == value["text_vertical_align"]: @@ -3298,23 +3298,23 @@ class PythonScriptLoader(object): elif "bottom" == value["text_vertical_align"]: window.SetVerticalAlignBottom() - if value.has_key("all_align"): + if "all_align" in value: window.SetHorizontalAlignCenter() window.SetVerticalAlignCenter() window.SetWindowHorizontalAlignCenter() window.SetWindowVerticalAlignCenter() - if value.has_key("r") and value.has_key("g") and value.has_key("b"): + if "r" in value and "g" in value and "b" in value: window.SetFontColor(float(value["r"]), float(value["g"]), float(value["b"])) - elif value.has_key("color"): + elif "color" in value: window.SetPackedFontColor(value["color"]) else: window.SetFontColor(0.8549, 0.8549, 0.8549) - if value.has_key("outline"): + if "outline" in value: if value["outline"]: window.SetOutline() - if True == value.has_key("text"): + if True == ("text" in value): window.SetText(value["text"]) self.LoadDefaultData(window, value, parentWindow) @@ -3328,16 +3328,16 @@ class PythonScriptLoader(object): return False - if value.has_key("secret_flag"): + if "secret_flag" in value: window.SetSecret(value["secret_flag"]) - if value.has_key("only_number"): + if "only_number" in value: if value["only_number"]: window.SetNumberMode() - if value.has_key("enable_ime"): + if "enable_ime" in value: window.SetIMEFlag(value["enable_ime"]) - if value.has_key("limit_width"): + if "limit_width" in value: window.SetLimitWidth(value["limit_width"]) - if value.has_key("multi_line"): + if "multi_line" in value: if value["multi_line"]: window.SetMultiLine() @@ -3409,7 +3409,7 @@ class PythonScriptLoader(object): if False == self.CheckKeyList(value["name"], value, self.BOX_KEY_LIST): return False - if True == value.has_key("color"): + if True == ("color" in value): window.SetColor(value["color"]) window.SetSize(int(value["width"]), int(value["height"])) @@ -3423,7 +3423,7 @@ class PythonScriptLoader(object): if False == self.CheckKeyList(value["name"], value, self.BAR_KEY_LIST): return False - if True == value.has_key("color"): + if True == ("color" in value): window.SetColor(value["color"]) window.SetSize(int(value["width"]), int(value["height"])) @@ -3437,7 +3437,7 @@ class PythonScriptLoader(object): if False == self.CheckKeyList(value["name"], value, self.LINE_KEY_LIST): return False - if True == value.has_key("color"): + if True == ("color" in value): window.SetColor(value["color"]) window.SetSize(int(value["width"]), int(value["height"])) @@ -3491,7 +3491,7 @@ class PythonScriptLoader(object): if False == self.CheckKeyList(value["name"], value, self.LIST_BOX_KEY_LIST): return False - if value.has_key("item_align"): + if "item_align" in value: window.SetTextCenterAlign(value["item_align"]) window.SetSize(value["width"], value["height"]) @@ -3509,7 +3509,7 @@ class PythonScriptLoader(object): window.SetSize(value["width"], value["height"]) self.LoadDefaultData(window, value, parentWindow) - if value.has_key("item_align"): + if "item_align" in value: window.SetTextCenterAlign(value["item_align"]) return True @@ -3521,13 +3521,13 @@ class PythonScriptLoader(object): window.SetSize(value["width"], value["height"]) self.LoadDefaultData(window, value, parentWindow) - if value.has_key("itemsize_x") and value.has_key("itemsize_y"): + if "itemsize_x" in value and "itemsize_y" in value: window.SetItemSize(int(value["itemsize_x"]), int(value["itemsize_y"])) - if value.has_key("itemstep"): + if "itemstep" in value: window.SetItemStep(int(value["itemstep"])) - if value.has_key("viewcount"): + if "viewcount" in value: window.SetViewItemCount(int(value["viewcount"])) return True diff --git a/assets/root/uiaffectshower.py b/assets/root/uiaffectshower.py index 9db9d422..010dd5ae 100644 --- a/assets/root/uiaffectshower.py +++ b/assets/root/uiaffectshower.py @@ -79,9 +79,9 @@ class HorseImage(ui.ExpandedImageBox): FILE_DICT = { 00 : FILE_PATH+"00.dds", - 01 : FILE_PATH+"00.dds", - 02 : FILE_PATH+"00.dds", - 03 : 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", @@ -119,7 +119,7 @@ class HorseImage(ui.ExpandedImageBox): grade = self.__GetHorseGrade(level) self.__AppendText(localeInfo.LEVEL_LIST[grade]) except IndexError: - print "HorseImage.SetState(level=%d, health=%d, battery=%d) - Unknown Index" % (level, health, battery) + print(("HorseImage.SetState(level=%d, health=%d, battery=%d) - Unknown Index" % (level, health, battery))) return try: @@ -127,7 +127,7 @@ class HorseImage(ui.ExpandedImageBox): if len(healthName)>0: self.__AppendText(healthName) except IndexError: - print "HorseImage.SetState(level=%d, health=%d, battery=%d) - Unknown Index" % (level, health, battery) + print(("HorseImage.SetState(level=%d, health=%d, battery=%d) - Unknown Index" % (level, health, battery))) return if health>0: @@ -137,12 +137,12 @@ class HorseImage(ui.ExpandedImageBox): try: fileName=self.FILE_DICT[health*10+battery] except KeyError: - print "HorseImage.SetState(level=%d, health=%d, battery=%d) - KeyError" % (level, health, battery) + print(("HorseImage.SetState(level=%d, health=%d, battery=%d) - KeyError" % (level, health, battery))) try: self.LoadImage(fileName) except: - print "HorseImage.SetState(level=%d, health=%d, battery=%d) - LoadError %s" % (level, health, battery, fileName) + print(("HorseImage.SetState(level=%d, health=%d, battery=%d) - LoadError %s" % (level, health, battery, fileName))) self.SetScale(0.7, 0.7) @@ -207,7 +207,7 @@ class AutoPotionImage(ui.ExpandedImageBox): self.__Refresh() def __Refresh(self): - print "__Refresh" + print("__Refresh") isActivated, currentAmount, totalAmount, slotIndex = player.GetAutoPotionInfo(self.potionType) @@ -225,7 +225,7 @@ class AutoPotionImage(ui.ExpandedImageBox): fmt = self.filePath + "%.2d.dds" fileName = fmt % grade - print self.potionType, amountPercent, fileName + print((self.potionType, amountPercent, fileName)) try: self.LoadImage(fileName) @@ -443,7 +443,7 @@ class AffectShower(ui.Window): def ClearAffects(self): ## ��ų ����Ʈ�� ���۴ϴ�. self.living_affectImageDict={} - for key, image in self.affectImageDict.items(): + for key, image in list(self.affectImageDict.items()): if not image.IsSkillAffect(): self.living_affectImageDict[key] = image self.affectImageDict = self.living_affectImageDict @@ -451,7 +451,7 @@ class AffectShower(ui.Window): def BINARY_NEW_AddAffect(self, type, pointIdx, value, duration): - print "BINARY_NEW_AddAffect", type, pointIdx, value, duration + print(("BINARY_NEW_AddAffect", type, pointIdx, value, duration)) if type < 500: return @@ -461,10 +461,10 @@ class AffectShower(ui.Window): else: affect = type - if self.affectImageDict.has_key(affect): + if affect in self.affectImageDict: return - if not self.AFFECT_DATA_DICT.has_key(affect): + if affect not in self.AFFECT_DATA_DICT: return ## ����� ��ȣ, ������ ������ Duration �� 0 ���� �����Ѵ�. @@ -507,8 +507,8 @@ class AffectShower(ui.Window): self.affectImageDict[affect] = image self.__ArrangeImageList() - except Exception, e: - print "except Aff auto potion affect ", e + except Exception as e: + print(("except Aff auto potion affect ", e)) pass else: @@ -516,7 +516,7 @@ class AffectShower(ui.Window): description = description(float(value)) try: - print "Add affect %s" % affect + print(("Add affect %s" % affect)) image = AffectImage() image.SetParent(self) image.LoadImage(filename) @@ -541,8 +541,8 @@ class AffectShower(ui.Window): image.Show() self.affectImageDict[affect] = image self.__ArrangeImageList() - except Exception, e: - print "except Aff affect ", e + except Exception as e: + print(("except Aff affect ", e)) pass def BINARY_NEW_RemoveAffect(self, type, pointIdx): @@ -551,7 +551,7 @@ class AffectShower(ui.Window): else: affect = type - print "Remove Affect %s %s" % ( type , pointIdx ) + print(("Remove Affect %s %s" % ( type , pointIdx ))) self.__RemoveAffect(affect) self.__ArrangeImageList() @@ -606,7 +606,7 @@ class AffectShower(ui.Window): def __AppendAffect(self, affect): - if self.affectImageDict.has_key(affect): + if affect in self.affectImageDict: return try: @@ -644,11 +644,11 @@ class AffectShower(ui.Window): self.autoPotionImageHP.Hide() """ - if not self.affectImageDict.has_key(affect): - print "__RemoveAffect %s ( No Affect )" % affect + if affect not in self.affectImageDict: + print(("__RemoveAffect %s ( No Affect )" % affect)) return - print "__RemoveAffect %s ( Affect )" % affect + print(("__RemoveAffect %s ( Affect )" % affect)) del self.affectImageDict[affect] self.__ArrangeImageList() @@ -674,7 +674,7 @@ class AffectShower(ui.Window): self.horseImage.SetPosition(xPos, 0) xPos += self.IMAGE_STEP - for image in self.affectImageDict.values(): + for image in list(self.affectImageDict.values()): image.SetPosition(xPos, 0) xPos += self.IMAGE_STEP @@ -684,13 +684,13 @@ class AffectShower(ui.Window): #if 0 < app.GetGlobalTime(): self.lastUpdateTime = app.GetGlobalTime() - for image in self.affectImageDict.values(): + 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: image.UpdateAutoPotionDescription() continue if not image.IsSkillAffect(): image.UpdateDescription() - except Exception, e: - print "AffectShower::OnUpdate error : ", e + except Exception as e: + print(("AffectShower::OnUpdate error : ", e)) diff --git a/assets/root/uiattachmetin.py b/assets/root/uiattachmetin.py index 6f318b29..f1d29d37 100644 --- a/assets/root/uiattachmetin.py +++ b/assets/root/uiattachmetin.py @@ -89,9 +89,9 @@ class AttachMetinDialog(ui.ScriptWindow): dbg.TraceError("AttachMetinDialog.Open.LoadImage - Failed to find item data") metinSlot = [] - for i in xrange(player.METIN_SOCKET_MAX_NUM): + for i in range(player.METIN_SOCKET_MAX_NUM): metinSlot.append(player.GetItemMetinSocket(targetItemPos, i)) - for i in xrange(player.METIN_SOCKET_MAX_NUM): + for i in range(player.METIN_SOCKET_MAX_NUM): slotData = metinSlot[i] if self.CanAttachMetin(slotData, metinSubType): metinSlot[i] = metinIndex @@ -101,7 +101,7 @@ class AttachMetinDialog(ui.ScriptWindow): item.SelectItem(metinIndex) metinSlot = [] - for i in xrange(player.METIN_SOCKET_MAX_NUM): + for i in range(player.METIN_SOCKET_MAX_NUM): metinSlot.append(player.GetItemMetinSocket(targetItemPos, i)) self.oldToolTip.ResizeToolTipWidth(self.newToolTip.GetWidth()) diff --git a/assets/root/uiauction.py b/assets/root/uiauction.py index 27fff4cf..41e5b000 100644 --- a/assets/root/uiauction.py +++ b/assets/root/uiauction.py @@ -41,9 +41,9 @@ class AuctionWindow(ui.ScriptWindow): "REGISTER" : self.GetChild("Tab_Button_02"), "UNIQUE_AUCTION" : self.GetChild("Tab_Button_03"), } - for page in self.pageWindow.values(): + for page in list(self.pageWindow.values()): pyScrLoader.LoadScriptFile(page, page.GetScriptFileName()) - for key, button in self.tabButtonDict.items(): + for key, button in list(self.tabButtonDict.items()): button.SetEvent(self.SelectPage, key) self.__MakeListPage() @@ -61,7 +61,7 @@ class AuctionWindow(ui.ScriptWindow): AUCTION_LINE_COUNT = 10 - for i in xrange(AUCTION_LINE_COUNT): + for i in range(AUCTION_LINE_COUNT): numberSlotImage = ui.MakeImageBox(page, "d:/ymir work/ui/public/Parameter_Slot_00.sub", 11, yPos) numberSlot = ui.MakeTextLine(numberSlotImage) @@ -99,7 +99,7 @@ class AuctionWindow(ui.ScriptWindow): LINE_COUNT = 3 - for i in xrange(LINE_COUNT): + for i in range(LINE_COUNT): yPos = 5 + 99*i @@ -133,15 +133,15 @@ class AuctionWindow(ui.ScriptWindow): ## Temporary def SelectPage(self, arg): - for key, btn in self.tabButtonDict.items(): + for key, btn in list(self.tabButtonDict.items()): if arg != key: btn.SetUp() - for key, img in self.tabDict.items(): + for key, img in list(self.tabDict.items()): if arg == key: img.Show() else: img.Hide() - for key, page in self.pageWindow.items(): + for key, page in list(self.pageWindow.items()): if arg == key: page.Show() else: diff --git a/assets/root/uicandidate.py b/assets/root/uicandidate.py index 43430de3..e7493f18 100644 --- a/assets/root/uicandidate.py +++ b/assets/root/uicandidate.py @@ -30,7 +30,7 @@ class VerticalCandidateBoard(ui.Board): self.numberList = [] self.slotList = [] - for y in xrange(yCount): + for y in range(yCount): number = ui.ImageBox() number.SetParent(self.BaseBar) @@ -83,7 +83,7 @@ class VerticalCandidateBoard(ui.Board): maxTextLength = 0 yCount = ime.GetCandidateCount() - for i in xrange(yCount): + for i in range(yCount): text, length = ime.GetCandidate(i) self.Append(text) @@ -117,7 +117,7 @@ class KORCandidateWindow(ui.ScriptWindow): self.candidateListBox.AppendItem(ui.CandidateListBox.Item(text)) def Refresh(self): - for i in xrange(9): + for i in range(9): text, length = ime.GetCandidate(i) self.Append(text) diff --git a/assets/root/uicharacter.py b/assets/root/uicharacter.py index fddd0e0a..d6b0e5f0 100644 --- a/assets/root/uicharacter.py +++ b/assets/root/uicharacter.py @@ -31,7 +31,7 @@ FACE_IMAGE_DICT = { playerSettingModule.RACE_SHAMAN_W : "icon/face/shaman_w.tga", } def unsigned32(n): - return n & 0xFFFFFFFFL + return n & 0xFFFFFFFF class CharacterWindow(ui.ScriptWindow): @@ -246,7 +246,7 @@ class CharacterWindow(ui.ScriptWindow): self.questScrollBar.SetScrollEvent(ui.__mem_func__(self.OnQuestScroll)) self.questSlot = self.GetChild("Quest_Slot") - for i in xrange(quest.QUEST_MAX_NUM): + for i in range(quest.QUEST_MAX_NUM): self.questSlot.HideSlotBaseImage(i) self.questSlot.SetCoverButton(i,\ "d:/ymir work/ui/game/quest/slot_button_01.sub",\ @@ -258,13 +258,13 @@ class CharacterWindow(ui.ScriptWindow): self.questLastTimeList = [] self.questLastCountList = [] - for i in xrange(quest.QUEST_MAX_NUM): + for i in range(quest.QUEST_MAX_NUM): self.questNameList.append(self.GetChild("Quest_Name_0" + str(i))) self.questLastTimeList.append(self.GetChild("Quest_LastTime_0" + str(i))) self.questLastCountList.append(self.GetChild("Quest_LastCount_0" + str(i))) def __SetSkillSlotEvent(self): - for skillPageValue in self.skillPageDict.itervalues(): + for skillPageValue in list(self.skillPageDict.values()): skillPageValue.SetSlotStyle(wndMgr.SLOT_STYLE_NONE) skillPageValue.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectSkill)) skillPageValue.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot)) @@ -291,7 +291,7 @@ class CharacterWindow(ui.ScriptWindow): "d:/ymir work/ui/game/windows/btn_plus_over.sub",\ "d:/ymir work/ui/game/windows/btn_plus_down.sub") - for slotIdx, datadict in emotion.EMOTION_DICT.items(): + for slotIdx, datadict in list(emotion.EMOTION_DICT.items()): emotionIdx = slotIdx slot = self.soloEmotionSlot @@ -314,18 +314,18 @@ class CharacterWindow(ui.ScriptWindow): mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_EMOTION, slotIndex, slotIndex) def __ClickEmotionSlot(self, slotIndex): - print "click emotion" + print("click emotion") if not slotIndex in emotion.EMOTION_DICT: return - print "check acting" + print("check acting") if player.IsActingEmotion(): return command = emotion.EMOTION_DICT[slotIndex]["command"] - print "command", command + print(("command", command)) if slotIndex > 50: vid = player.GetTargetVID() @@ -337,7 +337,7 @@ class CharacterWindow(ui.ScriptWindow): command += " " + chr.GetNameByVID(vid) - print "send_command", command + print(("send_command", command)) net.SendChatPacket(command) def ActEmotion(self, emotionIndex): @@ -359,26 +359,26 @@ class CharacterWindow(ui.ScriptWindow): self.emotionToolTip.HideToolTip() def __BindEvent(self): - for i in xrange(len(self.skillGroupButton)): + for i in range(len(self.skillGroupButton)): self.skillGroupButton[i].SetEvent(lambda arg=i: self.__SelectSkillGroup(arg)) self.RefreshQuest() self.__HideJobToolTip() - for (tabKey, tabButton) in self.tabButtonDict.items(): + for (tabKey, tabButton) in list(self.tabButtonDict.items()): tabButton.SetEvent(ui.__mem_func__(self.__OnClickTabButton), tabKey) - for (statusPlusKey, statusPlusButton) in self.statusPlusButtonDict.items(): + for (statusPlusKey, statusPlusButton) in list(self.statusPlusButtonDict.items()): statusPlusButton.SAFE_SetEvent(self.__OnClickStatusPlusButton, statusPlusKey) statusPlusButton.ShowToolTip = lambda arg=statusPlusKey: self.__OverInStatButton(arg) statusPlusButton.HideToolTip = lambda arg=statusPlusKey: self.__OverOutStatButton() - for (statusMinusKey, statusMinusButton) in self.statusMinusButtonDict.items(): + for (statusMinusKey, statusMinusButton) in list(self.statusMinusButtonDict.items()): statusMinusButton.SAFE_SetEvent(self.__OnClickStatusMinusButton, statusMinusKey) statusMinusButton.ShowToolTip = lambda arg=statusMinusKey: self.__OverInStatMinusButton(arg) statusMinusButton.HideToolTip = lambda arg=statusMinusKey: self.__OverOutStatMinusButton() - for titleBarValue in self.titleBarDict.itervalues(): + for titleBarValue in list(self.titleBarDict.values()): titleBarValue.SetCloseEvent(ui.__mem_func__(self.Hide)) self.questSlot.SetSelectItemSlotEvent(ui.__mem_func__(self.__SelectQuest)) @@ -422,14 +422,14 @@ class CharacterWindow(ui.ScriptWindow): try: statusPlusCommand=self.statusPlusCommandDict[statusKey] net.SendChatPacket(statusPlusCommand) - except KeyError, msg: + except KeyError as msg: dbg.TraceError("CharacterWindow.__OnClickStatusPlusButton KeyError: %s", msg) def __OnClickStatusMinusButton(self, statusKey): try: statusMinusCommand=self.statusMinusCommandDict[statusKey] net.SendChatPacket(statusMinusCommand) - except KeyError, msg: + except KeyError as msg: dbg.TraceError("CharacterWindow.__OnClickStatusMinusButton KeyError: %s", msg) @@ -440,17 +440,17 @@ class CharacterWindow(ui.ScriptWindow): self.state = stateKey - for (tabKey, tabButton) in self.tabButtonDict.items(): + for (tabKey, tabButton) in list(self.tabButtonDict.items()): if stateKey!=tabKey: tabButton.SetUp() - for tabValue in self.tabDict.itervalues(): + for tabValue in list(self.tabDict.values()): tabValue.Hide() - for pageValue in self.pageDict.itervalues(): + for pageValue in list(self.pageDict.values()): pageValue.Hide() - for titleBarValue in self.titleBarDict.itervalues(): + for titleBarValue in list(self.titleBarDict.values()): titleBarValue.Hide() self.titleBarDict[stateKey].Show() @@ -576,19 +576,19 @@ class CharacterWindow(ui.ScriptWindow): self.toolTipAlignment.AlignHorizonalCenter() def __ShowStatusMinusButtonList(self): - for (stateMinusKey, statusMinusButton) in self.statusMinusButtonDict.items(): + for (stateMinusKey, statusMinusButton) in list(self.statusMinusButtonDict.items()): statusMinusButton.Show() def __HideStatusMinusButtonList(self): - for (stateMinusKey, statusMinusButton) in self.statusMinusButtonDict.items(): + for (stateMinusKey, statusMinusButton) in list(self.statusMinusButtonDict.items()): statusMinusButton.Hide() def ShowStatusPlusButtonList(self): - for (statePlusKey, statusPlusButton) in self.statusPlusButtonDict.items(): + for (statePlusKey, statusPlusButton) in list(self.statusPlusButtonDict.items()): statusPlusButton.Show() def HideStatusPlusButtonList(self): - for (statePlusKey, statusPlusButton) in self.statusPlusButtonDict.items(): + for (statePlusKey, statusPlusButton) in list(self.statusPlusButtonDict.items()): statusPlusButton.Hide() def SelectSkill(self, skillSlotIndex): @@ -657,7 +657,7 @@ class CharacterWindow(ui.ScriptWindow): return questCount = quest.GetQuestCount() - questRange = range(quest.QUEST_MAX_NUM) + questRange = list(range(quest.QUEST_MAX_NUM)) if questCount > quest.QUEST_MAX_NUM: self.questScrollBar.Show() @@ -692,7 +692,7 @@ class CharacterWindow(ui.ScriptWindow): def __UpdateQuestClock(self): if "QUEST" == self.state: # QUEST_LIMIT_COUNT_BUG_FIX - for i in xrange(min(quest.GetQuestCount(), quest.QUEST_MAX_NUM)): + for i in range(min(quest.GetQuestCount(), quest.QUEST_MAX_NUM)): # END_OF_QUEST_LIMIT_COUNT_BUG_FIX (lastName, lastTime) = quest.GetQuestLastTime(i) @@ -778,11 +778,11 @@ class CharacterWindow(ui.ScriptWindow): getSkillLevelUpPoint = skill.GetSkillLevelUpPoint getSkillMaxLevel = skill.GetSkillMaxLevel - for i in xrange(slotCount + 1): + for i in range(slotCount + 1): slotIndex = i + startSlotIndex skillIndex = getSkillIndex(slotIndex) - for j in xrange(skill.SKILL_GRADE_COUNT): + for j in range(skill.SKILL_GRADE_COUNT): skillPage.ClearSlot(self.__GetRealSkillSlot(j, i)) if 0 == skillIndex: @@ -806,7 +806,7 @@ class CharacterWindow(ui.ScriptWindow): ## ACTIVE elif skill.SKILL_TYPE_ACTIVE == skillType: - for j in xrange(skill.SKILL_GRADE_COUNT): + for j in range(skill.SKILL_GRADE_COUNT): realSlotIndex = self.__GetRealSkillSlot(j, slotIndex) skillPage.SetSkillSlotNew(realSlotIndex, skillIndex, j, skillLevel) @@ -877,10 +877,10 @@ class CharacterWindow(ui.ScriptWindow): quick_page_count = 4 # matches QUICKPAGE_NUMBER_FILENAME current_page = player.GetQuickPage() - for page in xrange(quick_page_count): + for page in range(quick_page_count): player.SetQuickPage(page) - for local_slot in xrange(quick_slot_per_page): + for local_slot in range(quick_slot_per_page): slotType, position = player.GetLocalQuickSlot(local_slot) if slotType != player.SLOT_TYPE_SKILL: @@ -951,7 +951,7 @@ class CharacterWindow(ui.ScriptWindow): startSlotIndex += self.ACTIVE_PAGE_SLOT_COUNT if statPoint > 0: - for i in xrange(self.PAGE_SLOT_COUNT): + for i in range(self.PAGE_SLOT_COUNT): slotIndex = i + startSlotIndex skillIndex = player.GetSkillIndex(slotIndex) skillGrade = player.GetSkillGrade(slotIndex) @@ -1035,7 +1035,7 @@ class CharacterWindow(ui.ScriptWindow): if skill.SKILL_TYPE_ACTIVE == skillType: return - for slotWindow in self.skillPageDict.values(): + for slotWindow in list(self.skillPageDict.values()): if slotWindow.HasSlot(slotIndex): if skill.CanUseSkill(skillIndex): player.ClickSkillSlot(srcSlotIndex) @@ -1057,7 +1057,7 @@ class CharacterWindow(ui.ScriptWindow): else: slotIndex = self.__GetETCSkillRealSlotIndex(slotIndex) - for slotWindow in self.skillPageDict.values(): + for slotWindow in list(self.skillPageDict.values()): if slotWindow.HasSlot(slotIndex): slotWindow.StoreSlotCoolTime(skillType, slotIndex, coolTime) self.__RestoreSlotCoolTime(slotWindow) @@ -1076,7 +1076,7 @@ class CharacterWindow(ui.ScriptWindow): else: slotIndex = self.__GetETCSkillRealSlotIndex(slotIndex) - for slotWindow in self.skillPageDict.values(): + for slotWindow in list(self.skillPageDict.values()): if slotWindow.HasSlot(slotIndex): slotWindow.ActivateSlot(slotIndex) @@ -1094,7 +1094,7 @@ class CharacterWindow(ui.ScriptWindow): else: slotIndex = self.__GetETCSkillRealSlotIndex(slotIndex) - for slotWindow in self.skillPageDict.values(): + for slotWindow in list(self.skillPageDict.values()): if slotWindow.HasSlot(slotIndex): slotWindow.DeactivateSlot(slotIndex) @@ -1118,7 +1118,7 @@ class CharacterWindow(ui.ScriptWindow): else: slotIndex = self.__GetETCSkillRealSlotIndex(slotIndex) - for slotWindow in self.skillPageDict.values(): + for slotWindow in list(self.skillPageDict.values()): if slotWindow.HasSlot(slotIndex): slotWindow.SetSlotCoolTime(slotIndex, 0) @@ -1175,7 +1175,7 @@ class CharacterWindow(ui.ScriptWindow): try: self.faceImage.LoadImage(faceImageName) except: - print "CharacterWindow.RefreshCharacter(race=%d, faceImageName=%s)" % (race, faceImageName) + print(("CharacterWindow.RefreshCharacter(race=%d, faceImageName=%s)" % (race, faceImageName))) self.faceImage.Hide() except KeyError: @@ -1196,7 +1196,7 @@ class CharacterWindow(ui.ScriptWindow): def __SetSkillGroupName(self, race, group): job = chr.RaceToJob(race) - if not self.SKILL_GROUP_NAME_DICT.has_key(job): + if job not in self.SKILL_GROUP_NAME_DICT: return nameList = self.SKILL_GROUP_NAME_DICT[job] @@ -1241,7 +1241,8 @@ class CharacterWindow(ui.ScriptWindow): ## Refresh self.RefreshSkill() - def __SelectSkillGroup(self, pageIndex, (PAGE_SKILL_1, PAGE_SKILL_2, PAGE_SKILL_HORSE) = range(3)): + def __SelectSkillGroup(self, pageIndex, xxx_todo_changeme = list(range(3))): + (PAGE_SKILL_1, PAGE_SKILL_2, PAGE_SKILL_HORSE) = xxx_todo_changeme for pageButton in self.skillGroupButton: pageButton.SetUp() diff --git a/assets/root/uichat.py b/assets/root/uichat.py index dc8bde62..586b3497 100644 --- a/assets/root/uichat.py +++ b/assets/root/uichat.py @@ -1,3 +1,4 @@ +# -*- coding: cp949 -*- import ui import grp import chat @@ -20,7 +21,7 @@ def InsertChatInputSetWindow(wnd): chatInputSetList.append(wnd) def RefreshChatMode(): global chatInputSetList - map(lambda wnd:wnd.OnRefreshChatMode(), chatInputSetList) + list([wnd.OnRefreshChatMode() for wnd in chatInputSetList]) def DestroyChatInputSetWindow(): global chatInputSetList chatInputSetList = [] @@ -620,7 +621,7 @@ class ChatWindow(ui.Window): chat.CHAT_TYPE_WHISPER : colorInfo.CHAT_RGB_WHISPER, } - for colorItem in CHAT_COLOR_DICT.items(): + for colorItem in list(CHAT_COLOR_DICT.items()): type=colorItem[0] rgb=colorItem[1] chat.SetChatColor(type, rgb[0], rgb[1], rgb[2]) diff --git a/assets/root/uicube.py b/assets/root/uicube.py index a63240d0..c42c3572 100644 --- a/assets/root/uicube.py +++ b/assets/root/uicube.py @@ -220,10 +220,10 @@ class CubeWindow(ui.ScriptWindow): self.tooltipItem.SetCannotUseItemForceSetDisableColor(True) metinSlot = [] - for i in xrange(player.METIN_SOCKET_MAX_NUM): + for i in range(player.METIN_SOCKET_MAX_NUM): metinSlot.append(0) attrSlot = [] - for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM): + for i in range(player.ATTRIBUTE_SLOT_MAX_NUM): attrSlot.append((0, 0)) #print "resultIndex, firstSlotIndex", resultIndex, self.firstSlotIndex @@ -253,14 +253,14 @@ class CubeWindow(ui.ScriptWindow): # Do you have enough materials for crafting? if player.GetItemCountByVnum(itemVnum) >= itemCount: - for i in xrange(player.INVENTORY_SLOT_COUNT): + for i in range(player.INVENTORY_SLOT_COUNT): vnum = player.GetItemIndex(i) count= player.GetItemCount(i) if vnum == itemVnum and count >= itemCount: # Check if same item already registered, add if not bAlreadyExists = False - for slotPos, invenPos in self.cubeItemInfo.items(): + for slotPos, invenPos in list(self.cubeItemInfo.items()): if invenPos == i: bAlreadyExists = True @@ -271,7 +271,7 @@ class CubeWindow(ui.ScriptWindow): # If entered here, item not registered in cube, so add to empty cube slot bCanAddSlot = False - for slotPos in xrange(self.cubeSlot.GetSlotCount()): + for slotPos in range(self.cubeSlot.GetSlotCount()): # Is this cube slot empty? if not slotPos in self.cubeItemInfo: upperColumnItemSizeY = -1 @@ -397,7 +397,7 @@ class CubeWindow(ui.ScriptWindow): self.Refresh() def Refresh(self): - for slotPos in xrange(self.cubeSlot.GetSlotCount()): + for slotPos in range(self.cubeSlot.GetSlotCount()): if not slotPos in self.cubeItemInfo: self.cubeSlot.ClearSlot(slotPos) @@ -439,7 +439,7 @@ class CubeWindow(ui.ScriptWindow): #print "self.cubeMaterialInfos : ", self.cubeMaterialInfos if self.firstSlotIndex in self.cubeMaterialInfos: - for i in xrange(self.RESULT_SLOT_COUNT): + for i in range(self.RESULT_SLOT_COUNT): materialList = self.cubeMaterialInfos[self.firstSlotIndex + i] #print "Refresh ::: ", materialList j = 0 @@ -463,7 +463,7 @@ class CubeWindow(ui.ScriptWindow): currentSlot.SetPosition(localX, 0 + adjustLocalY) - for k in xrange(5): + for k in range(5): if k >= j: self.materialSlots[i][k].ClearSlot(0) @@ -476,7 +476,7 @@ class CubeWindow(ui.ScriptWindow): if self.isUsable: self.isUsable = False - print "Close cube" + print("Close cube") net.SendChatPacket("/cube close") self.Close() @@ -486,7 +486,7 @@ class CubeWindow(ui.ScriptWindow): "Empty cube" return - print "Start cube crafting" + print("Start cube crafting") #for invenPos in self.cubeItemInfo.values(): # net.SendChatPacket("/cube add " + str(invenPos)) net.SendChatPacket("/cube make") @@ -502,7 +502,7 @@ class CubeWindow(ui.ScriptWindow): if player.SLOT_TYPE_INVENTORY != attachedSlotType: return - for slotPos, invenPos in self.cubeItemInfo.items(): + for slotPos, invenPos in list(self.cubeItemInfo.items()): if invenPos == attachedSlotPos: del self.cubeItemInfo[slotPos] @@ -531,7 +531,7 @@ class CubeWindow(ui.ScriptWindow): def __OnOverInItem(self, slotIndex): if self.tooltipItem: - if self.cubeItemInfo.has_key(slotIndex): + if slotIndex in self.cubeItemInfo: self.tooltipItem.SetInventoryItem(self.cubeItemInfo[slotIndex]) def __OnOverOutItem(self): diff --git a/assets/root/uidragonsoul.py b/assets/root/uidragonsoul.py index 0308d568..c1099677 100644 --- a/assets/root/uidragonsoul.py +++ b/assets/root/uidragonsoul.py @@ -120,7 +120,7 @@ class DragonSoulWindow(ui.ScriptWindow): import exception exception.Abort("InventoryWindow.LoadWindow.BindObject") ## DragonSoul Kind Tap - for (tabKey, tabButton) in self.tabButtonDict.items(): + for (tabKey, tabButton) in list(self.tabButtonDict.items()): tabButton.SetEvent(ui.__mem_func__(self.SetDSKindIndex), tabKey) ## Item wndItem.SetOverInItemEvent(ui.__mem_func__(self.OverInItem)) @@ -217,7 +217,7 @@ class DragonSoulWindow(ui.ScriptWindow): self.RefreshEquipSlotWindow() def RefreshEquipSlotWindow(self): - for i in xrange(6): + for i in range(6): slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(player.INVENTORY, player.DRAGON_SOUL_EQUIPMENT_SLOT_START + i) itemVnum = player.GetItemIndex(slotNumber) self.wndEquip.SetItemSlot(player.DRAGON_SOUL_EQUIPMENT_SLOT_START + i, itemVnum, 0) @@ -225,7 +225,7 @@ class DragonSoulWindow(ui.ScriptWindow): if itemVnum != 0: item.SelectItem(itemVnum) - for j in xrange(item.LIMIT_MAX_NUM): + for j in range(item.LIMIT_MAX_NUM): (limitType, limitValue) = item.GetLimit(j) # Initialize to arbitrary positive number since we check if remain_time <= 0 below @@ -257,7 +257,7 @@ class DragonSoulWindow(ui.ScriptWindow): getItemVNum=player.GetItemIndex getItemCount=player.GetItemCount setItemVnum=self.wndItem.SetItemSlot - for i in xrange(player.DRAGON_SOUL_PAGE_SIZE): + for i in range(player.DRAGON_SOUL_PAGE_SIZE): self.wndItem.EnableSlot(i) #<- dragon soul kind slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(player.DRAGON_SOUL_INVENTORY, i) @@ -274,7 +274,7 @@ class DragonSoulWindow(ui.ScriptWindow): if itemVnum != 0: item.SelectItem(itemVnum) - for j in xrange(item.LIMIT_MAX_NUM): + for j in range(item.LIMIT_MAX_NUM): (limitType, limitValue) = item.GetLimit(j) # Initialize to arbitrary positive number since we check if remain_time < 0 below @@ -633,11 +633,11 @@ class DragonSoulWindow(ui.ScriptWindow): self.DSKindIndex = kindIndex - for (tabKey, tabButton) in self.tabButtonDict.items(): + for (tabKey, tabButton) in list(self.tabButtonDict.items()): if kindIndex!=tabKey: tabButton.SetUp() - for tabValue in self.tabDict.itervalues(): + for tabValue in list(self.tabDict.values()): tabValue.Hide() self.tabDict[kindIndex].Show() @@ -695,14 +695,14 @@ class DragonSoulWindow(ui.ScriptWindow): def __CanActivateDeck(self): canActiveNum = 0 - for i in xrange(6): + 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 xrange(item.LIMIT_MAX_NUM): + for i in range(item.LIMIT_MAX_NUM): (limitType, limitValue) = item.GetLimit(i) # LIMIT_TIMER_BASED_ON_WEAR stores remaining time in socket0 @@ -724,14 +724,14 @@ class DragonSoulWindow(ui.ScriptWindow): # Slot highlight related def __HighlightSlot_ClearCurrentPage(self): - for i in xrange(self.wndItem.GetSlotCount()): + for i in range(self.wndItem.GetSlotCount()): slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(player.DRAGON_SOUL_INVENTORY, i) if slotNumber in self.listHighlightedSlot: self.wndItem.DeactivateSlot(i) self.listHighlightedSlot.remove(slotNumber) def __HighlightSlot_RefreshCurrentPage(self): - for i in xrange(self.wndItem.GetSlotCount()): + for i in range(self.wndItem.GetSlotCount()): slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(player.DRAGON_SOUL_INVENTORY, i) if slotNumber in self.listHighlightedSlot: self.wndItem.ActivateSlot(i) @@ -751,13 +751,13 @@ class DragonSoulWindow(ui.ScriptWindow): #pass class DragonSoulRefineWindow(ui.ScriptWindow): - REFINE_TYPE_GRADE, REFINE_TYPE_STEP, REFINE_TYPE_STRENGTH = xrange(3) + REFINE_TYPE_GRADE, REFINE_TYPE_STEP, REFINE_TYPE_STRENGTH = list(range(3)) DS_SUB_HEADER_DIC = { REFINE_TYPE_GRADE : player.DS_SUB_HEADER_DO_UPGRADE, REFINE_TYPE_STEP : player.DS_SUB_HEADER_DO_IMPROVEMENT, REFINE_TYPE_STRENGTH : player.DS_SUB_HEADER_DO_REFINE } - REFINE_STONE_SLOT, DRAGON_SOUL_SLOT = xrange(2) + REFINE_STONE_SLOT, DRAGON_SOUL_SLOT = list(range(2)) INVALID_DRAGON_SOUL_INFO = -1 @@ -894,7 +894,7 @@ class DragonSoulRefineWindow(ui.ScriptWindow): else: self.refineSlotLockStartIndex = 1 - for i in xrange(self.refineSlotLockStartIndex): + for i in range(self.refineSlotLockStartIndex): self.wndRefineSlot.HideSlotBaseImage(i) self.wndMoney.SetText(localeInfo.NumberToMoneyString(0)) @@ -902,7 +902,7 @@ class DragonSoulRefineWindow(ui.ScriptWindow): def __FlushRefineItemSlot(self): ## Item slot settings # Restore original inventory item count - for invenType, invenPos, itemCount in self.refineItemInfo.values(): + for invenType, invenPos, itemCount in list(self.refineItemInfo.values()): remainCount = player.GetItemCount(invenType, invenPos) player.SetItemCount(invenType, invenPos, remainCount + itemCount) self.__Initialize() @@ -949,7 +949,7 @@ class DragonSoulRefineWindow(ui.ScriptWindow): maxCount = player.GetItemCount(invenType, invenPos) if itemCount > maxCount: - raise Exception, ("Invalid attachedItemCount(%d). (base pos (%d, %d), base itemCount(%d))" % (itemCount, invenType, invenPos, maxCount)) + raise Exception("Invalid attachedItemCount(%d). (base pos (%d, %d), base itemCount(%d))" % (itemCount, invenType, invenPos, maxCount)) #return False # For strength refining, force slot 0 for refine stone and slot 1 for dragon soul @@ -1177,7 +1177,7 @@ class DragonSoulRefineWindow(ui.ScriptWindow): if True == self.__SetItem((attachedInvenType, attachedSlotPos), selectedSlotPos, attachedItemCount): self.Refresh() - except Exception, e: + except Exception as e: import dbg dbg.TraceError("Exception : __SelectRefineEmptySlot, %s" % e) @@ -1238,19 +1238,19 @@ class DragonSoulRefineWindow(ui.ScriptWindow): else: pass - except Exception, e: + except Exception as e: import dbg dbg.TraceError("Exception : __SelectRefineItemSlot, %s" % e) self.Refresh() def __OverInRefineItem(self, slotIndex): - if self.refineItemInfo.has_key(slotIndex): + if slotIndex in self.refineItemInfo: inven_type, inven_pos, item_count = self.refineItemInfo[slotIndex] self.tooltipItem.SetInventoryItem(inven_pos, inven_type) def __OverInResultItem(self, slotIndex): - if self.resultItemInfo.has_key(slotIndex): + if slotIndex in self.resultItemInfo: inven_type, inven_pos, item_count = self.resultItemInfo[slotIndex] self.tooltipItem.SetInventoryItem(inven_pos, inven_type) @@ -1259,7 +1259,7 @@ class DragonSoulRefineWindow(ui.ScriptWindow): self.tooltipItem.HideToolTip() def __PressDoRefineButton(self): - for i in xrange(self.refineSlotLockStartIndex): + for i in range(self.refineSlotLockStartIndex): if not i in self.refineItemInfo: self.wndPopupDialog.SetText(localeInfo.DRAGON_SOUL_NOT_ENOUGH_MATERIAL) self.wndPopupDialog.Open() @@ -1278,7 +1278,7 @@ class DragonSoulRefineWindow(ui.ScriptWindow): def __RefreshRefineItemSlot(self): try: - for slotPos in xrange(self.wndRefineSlot.GetSlotCount()): + for slotPos in range(self.wndRefineSlot.GetSlotCount()): self.wndRefineSlot.ClearSlot(slotPos) if slotPos < self.refineSlotLockStartIndex: # Check self.refineItemInfo[slotPos] information @@ -1336,7 +1336,7 @@ class DragonSoulRefineWindow(ui.ScriptWindow): self.__Initialize() self.wndRefineSlot.RefreshSlot() - except Exception, e: + except Exception as e: import dbg dbg.TraceError("Exception : __RefreshRefineItemSlot, %s" % e) @@ -1354,7 +1354,7 @@ class DragonSoulRefineWindow(ui.ScriptWindow): if not DragonSoulRefineWindow.REFINE_STONE_SLOT in self.refineItemInfo: return DragonSoulRefineWindow.REFINE_STONE_SLOT else: - for slotPos in xrange(self.wndRefineSlot.GetSlotCount()): + for slotPos in range(self.wndRefineSlot.GetSlotCount()): if not slotPos in self.refineItemInfo: return slotPos diff --git a/assets/root/uiequipmentdialog.py b/assets/root/uiequipmentdialog.py index 8ff04dfb..856cc1d5 100644 --- a/assets/root/uiequipmentdialog.py +++ b/assets/root/uiequipmentdialog.py @@ -5,7 +5,7 @@ import player class EquipmentDialog(ui.ScriptWindow): def __init__(self): - print "NEW EQUIPMENT DIALOG ----------------------------------------------------------------------------" + print("NEW EQUIPMENT DIALOG ----------------------------------------------------------------------------") ui.ScriptWindow.__init__(self) self.__LoadDialog() @@ -15,7 +15,7 @@ class EquipmentDialog(ui.ScriptWindow): self.tooltipItem = None def __del__(self): - print "---------------------------------------------------------------------------- DELETE EQUIPMENT DIALOG " + print("---------------------------------------------------------------------------- DELETE EQUIPMENT DIALOG ") ui.ScriptWindow.__del__(self) def __LoadDialog(self): @@ -71,9 +71,9 @@ class EquipmentDialog(ui.ScriptWindow): emptySocketList = [] emptyAttrList = [] - for i in xrange(player.METIN_SOCKET_MAX_NUM): + for i in range(player.METIN_SOCKET_MAX_NUM): emptySocketList.append(0) - for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM): + for i in range(player.ATTRIBUTE_SLOT_MAX_NUM): emptyAttrList.append((0, 0)) self.itemDataDict[slotIndex] = (vnum, count, emptySocketList, emptyAttrList) diff --git a/assets/root/uiexchange.py b/assets/root/uiexchange.py index 852a57b9..90dce3e1 100644 --- a/assets/root/uiexchange.py +++ b/assets/root/uiexchange.py @@ -66,7 +66,7 @@ class ExchangeDialog(ui.ScriptWindow): self.GetChild("TitleBar").SetCloseEvent(net.SendExchangeExitPacket) def Destroy(self): - print "---------------------------------------------------------------------------- DESTROY EXCHANGE" + print("---------------------------------------------------------------------------- DESTROY EXCHANGE") self.ClearDictionary() self.dlgPickMoney.Destroy() self.dlgPickMoney = 0 @@ -139,7 +139,7 @@ class ExchangeDialog(ui.ScriptWindow): itemVnum = player.GetItemIndex(attachedInvenType, SrcSlotNumber) if constInfo.IS_AUTO_POTION(itemVnum): - metinSocket = [player.GetItemMetinSocket(attachedInvenType, SrcSlotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)] + metinSocket = [player.GetItemMetinSocket(attachedInvenType, SrcSlotNumber, j) for j in range(player.METIN_SOCKET_MAX_NUM)] isActivated = (0 != int(metinSocket[0])) if isActivated: @@ -164,7 +164,7 @@ class ExchangeDialog(ui.ScriptWindow): net.SendExchangeElkAddPacket(money) def RefreshOwnerSlot(self): - for i in xrange(exchange.EXCHANGE_ITEM_MAX_NUM): + for i in range(exchange.EXCHANGE_ITEM_MAX_NUM): itemIndex = exchange.GetItemVnumFromSelf(i) itemCount = exchange.GetItemCountFromSelf(i) if 1 == itemCount: @@ -173,7 +173,7 @@ class ExchangeDialog(ui.ScriptWindow): self.OwnerSlot.RefreshSlot() def RefreshTargetSlot(self): - for i in xrange(exchange.EXCHANGE_ITEM_MAX_NUM): + for i in range(exchange.EXCHANGE_ITEM_MAX_NUM): itemIndex = exchange.GetItemVnumFromTarget(i) itemCount = exchange.GetItemCountFromTarget(i) if 1 == itemCount: diff --git a/assets/root/uigamebutton.py b/assets/root/uigamebutton.py index 655f1ce7..605c4760 100644 --- a/assets/root/uigamebutton.py +++ b/assets/root/uigamebutton.py @@ -15,7 +15,7 @@ class GameButtonWindow(ui.ScriptWindow): try: pyScrLoader = ui.PythonScriptLoader() pyScrLoader.LoadScriptFile(self, filename) - except Exception, msg: + except Exception as msg: import dbg dbg.TraceError("GameButtonWindow.LoadScript - %s" % (msg)) app.Abort() @@ -33,7 +33,7 @@ class GameButtonWindow(ui.ScriptWindow): self.gameButtonDict["EXIT_OBSERVER"].SetEvent(ui.__mem_func__(self.__OnClickExitObserver)) - except Exception, msg: + except Exception as msg: import dbg dbg.TraceError("GameButtonWindow.LoadScript - %s" % (msg)) app.Abort() @@ -52,8 +52,8 @@ class GameButtonWindow(ui.ScriptWindow): def SetButtonEvent(self, name, event): try: self.gameButtonDict[name].SetEvent(event) - except Exception, msg: - print "GameButtonWindow.LoadScript - %s" % (msg) + except Exception as msg: + print(("GameButtonWindow.LoadScript - %s" % (msg))) app.Abort() return @@ -97,7 +97,7 @@ class GameButtonWindow(ui.ScriptWindow): net.SendChatPacket("/observer_exit") def __HideAllGameButton(self): - for btn in self.gameButtonDict.values(): + for btn in list(self.gameButtonDict.values()): btn.Hide() def SetObserverMode(self, isEnable): diff --git a/assets/root/uigameoption.py b/assets/root/uigameoption.py index 20f701d1..939aa813 100644 --- a/assets/root/uigameoption.py +++ b/assets/root/uigameoption.py @@ -1,3 +1,4 @@ +# -*- coding: cp949 -*- import ui import snd import systemSetting @@ -27,7 +28,7 @@ class OptionDialog(ui.ScriptWindow): def __del__(self): ui.ScriptWindow.__del__(self) - print " -------------------------------------- DELETE GAME OPTION DIALOG" + print(" -------------------------------------- DELETE GAME OPTION DIALOG") def __Initialize(self): self.titleBar = 0 @@ -44,7 +45,7 @@ class OptionDialog(ui.ScriptWindow): self.ClearDictionary() self.__Initialize() - print " -------------------------------------- DESTROY GAME OPTION DIALOG" + print(" -------------------------------------- DESTROY GAME OPTION DIALOG") def __Load_LoadScript(self, fileName): try: @@ -251,9 +252,9 @@ class OptionDialog(ui.ScriptWindow): return 0 def __SetPKMode(self, mode): - for btn in self.pvpModeButtonDict.values(): + for btn in list(self.pvpModeButtonDict.values()): btn.SetUp() - if self.pvpModeButtonDict.has_key(mode): + if mode in self.pvpModeButtonDict: self.pvpModeButtonDict[mode].Down() def __SetPeacePKMode(self): @@ -319,7 +320,7 @@ class OptionDialog(ui.ScriptWindow): def RefreshBlock(self): global blockMode - for i in xrange(len(self.blockButtonList)): + for i in range(len(self.blockButtonList)): if 0 != (blockMode & (1 << i)): self.blockButtonList[i].Down() else: diff --git a/assets/root/uiguild.py b/assets/root/uiguild.py index 8969ba01..573a498c 100644 --- a/assets/root/uiguild.py +++ b/assets/root/uiguild.py @@ -42,7 +42,7 @@ def GetGVGKey(srcGuildID, dstGuildID): maxID = max(srcGuildID, dstGuildID) return minID*1000 + maxID def unsigned32(n): - return n & 0xFFFFFFFFL + return n & 0xFFFFFFFF class DeclareGuildWarDialog(ui.ScriptWindow): @@ -219,7 +219,7 @@ class AcceptGuildWarDialog(ui.ScriptWindow): self.__CreateDialog() def __del__(self): - print "---------------------------------------------------------------------------- DELETE AcceptGuildWarDialog" + print("---------------------------------------------------------------------------- DELETE AcceptGuildWarDialog") ui.ScriptWindow.__del__(self) def Open(self, guildName, warType): @@ -716,7 +716,7 @@ class GuildWindow(ui.ScriptWindow): def __del__(self): ui.ScriptWindow.__del__(self) - print " ==================================== DESTROIED GUILD WINDOW" + print(" ==================================== DESTROIED GUILD WINDOW") def __Initialize(self): @@ -775,7 +775,7 @@ class GuildWindow(ui.ScriptWindow): self.changeGradeNameDialog.ClearDictionary() if self.pageWindow: - for window in self.pageWindow.values(): + for window in list(self.pageWindow.values()): window.ClearDictionary() self.__Initialize() @@ -829,7 +829,7 @@ class GuildWindow(ui.ScriptWindow): "GRADE" : self.PageWindow(self, "uiscript/guildwindow_gradepage.py"), } - for window in self.pageWindow.values(): + for window in list(self.pageWindow.values()): pyScrLoader.LoadScriptFile(window, window.GetScriptFileName()) except: @@ -903,10 +903,10 @@ class GuildWindow(ui.ScriptWindow): self.__MakeSkillPage() self.__MakeGradePage() - for page in self.pageWindow.values(): + for page in list(self.pageWindow.values()): page.UpdateRect() - for key, btn in self.tabButtonDict.items(): + for key, btn in list(self.tabButtonDict.items()): btn.SetEvent(self.SelectPage, key) self.tabButtonDict["BASE_INFO"].Disable() @@ -990,7 +990,7 @@ class GuildWindow(ui.ScriptWindow): page.boardDict = {} - for i in xrange(12): + for i in range(12): yPos = 25 + i * lineStep @@ -1050,7 +1050,7 @@ class GuildWindow(ui.ScriptWindow): lineStep = 20 page.memberDict = {} - for i in xrange(self.MEMBER_LINE_COUNT): + for i in range(self.MEMBER_LINE_COUNT): inverseLineIndex = self.MEMBER_LINE_COUNT - i - 1 yPos = 28 + inverseLineIndex*lineStep @@ -1104,7 +1104,7 @@ class GuildWindow(ui.ScriptWindow): page.Children.append(offerSlot) ## General Enable - event = lambda argSelf=proxy(self), argIndex=inverseLineIndex: apply(argSelf.OnEnableGeneral, (argIndex,)) + event = lambda argSelf=proxy(self), argIndex=inverseLineIndex: argSelf.OnEnableGeneral(*(argIndex,)) if app.IsRTL(): generalEnableCheckBox = CheckBox(page, 22, yPos, event, "d:/ymir work/ui/public/Parameter_Slot_00.sub") else: @@ -1131,7 +1131,7 @@ class GuildWindow(ui.ScriptWindow): yPos = 95 + 35 - for i in xrange(GUILD_BUILDING_MAX_NUM): + for i in range(GUILD_BUILDING_MAX_NUM): nameSlotImage = ui.MakeSlotBar(page, 15, yPos, 78, 17) nameSlot = ui.MakeTextLine(nameSlotImage) @@ -1146,7 +1146,7 @@ class GuildWindow(ui.ScriptWindow): gradeSlot.SetText(localeInfo.GUILD_BUILDING_GRADE) RESOURCE_MAX_NUM = 6 - for j in xrange(RESOURCE_MAX_NUM): + for j in range(RESOURCE_MAX_NUM): resourceSlotImage = ui.MakeSlotBar(page, 131 + 29*j, yPos, 26, 17) resourceSlot = ui.MakeTextLine(resourceSlotImage) page.Children.append(resourceSlotImage) @@ -1205,7 +1205,7 @@ class GuildWindow(ui.ScriptWindow): """ ## Active - for i in xrange(len(playerSettingModule.ACTIVE_GUILD_SKILL_INDEX_LIST)): + for i in range(len(playerSettingModule.ACTIVE_GUILD_SKILL_INDEX_LIST)): slotIndex = page.activeSlot.GetStartIndex()+i skillIndex = playerSettingModule.ACTIVE_GUILD_SKILL_INDEX_LIST[i] @@ -1222,7 +1222,7 @@ class GuildWindow(ui.ScriptWindow): page.gradeDict = {} - for i in xrange(15): + for i in range(15): yPos = 22 + i*lineStep index = i+1 @@ -1246,7 +1246,7 @@ class GuildWindow(ui.ScriptWindow): page.Children.append(gradeNameSlot) ## Invite Authority - event = lambda argSelf=proxy(self), argIndex=index, argAuthority=1<<0: apply(argSelf.OnCheckAuthority, (argIndex,argAuthority)) + event = lambda argSelf=proxy(self), argIndex=index, argAuthority=1<<0: argSelf.OnCheckAuthority(*(argIndex,argAuthority)) if app.IsRTL(): inviteAuthorityCheckBox = CheckBox(page, 185, yPos, event) else: @@ -1254,7 +1254,7 @@ class GuildWindow(ui.ScriptWindow): page.Children.append(inviteAuthorityCheckBox) ## DriveOut Authority - event = lambda argSelf=proxy(self), argIndex=index, argAuthority=1<<1: apply(argSelf.OnCheckAuthority, (argIndex,argAuthority)) + event = lambda argSelf=proxy(self), argIndex=index, argAuthority=1<<1: argSelf.OnCheckAuthority(*(argIndex,argAuthority)) if app.IsRTL(): driveoutAuthorityCheckBox = CheckBox(page, 128, yPos, event) else: @@ -1262,7 +1262,7 @@ class GuildWindow(ui.ScriptWindow): page.Children.append(driveoutAuthorityCheckBox) ## Notice Authority - event = lambda argSelf=proxy(self), argIndex=index, argAuthority=1<<2: apply(argSelf.OnCheckAuthority, (argIndex,argAuthority)) + event = lambda argSelf=proxy(self), argIndex=index, argAuthority=1<<2: argSelf.OnCheckAuthority(*(argIndex,argAuthority)) if app.IsRTL(): noticeAuthorityCheckBox = CheckBox(page, 71, yPos, event) else: @@ -1270,7 +1270,7 @@ class GuildWindow(ui.ScriptWindow): page.Children.append(noticeAuthorityCheckBox) ## Skill Authority - event = lambda argSelf=proxy(self), argIndex=index, argAuthority=1<<3: apply(argSelf.OnCheckAuthority, (argIndex,argAuthority)) + event = lambda argSelf=proxy(self), argIndex=index, argAuthority=1<<3: argSelf.OnCheckAuthority(*(argIndex,argAuthority)) if app.IsRTL(): skillAuthorityCheckBox = CheckBox(page, 14, yPos, event) else: @@ -1345,7 +1345,7 @@ class GuildWindow(ui.ScriptWindow): self.commentSlot = None if self.pageWindow: - for window in self.pageWindow.values(): + for window in list(self.pageWindow.values()): window.ClearDictionary() self.pageWindow = None @@ -1370,15 +1370,15 @@ class GuildWindow(ui.ScriptWindow): if "BOARD" == arg: self.OnRefreshComments() - for key, btn in self.tabButtonDict.items(): + for key, btn in list(self.tabButtonDict.items()): if arg != key: btn.SetUp() - for key, img in self.tabDict.items(): + for key, img in list(self.tabDict.items()): if arg == key: img.Show() else: img.Hide() - for key, page in self.pageWindow.items(): + for key, page in list(self.pageWindow.items()): if arg == key: page.Show() else: @@ -1389,7 +1389,7 @@ class GuildWindow(ui.ScriptWindow): def __CloseAllGuildMemberPageGradeComboBox(self): page = self.pageWindow["MEMBER"] - for key, slotList in page.memberDict.items(): + for key, slotList in list(page.memberDict.items()): slotList[1].CloseListBox() def RefreshGuildInfoPage(self): @@ -1441,7 +1441,7 @@ class GuildWindow(ui.ScriptWindow): page.uploadSymbolButton.Hide() ## Update guild war information on refresh - for i in xrange(guild.ENEMY_GUILD_SLOT_MAX_COUNT): + for i in range(guild.ENEMY_GUILD_SLOT_MAX_COUNT): name = guild.GetEnemyGuildName(i) nameTextLine = self.enemyGuildNameList[i] if name: @@ -1470,7 +1470,7 @@ class GuildWindow(ui.ScriptWindow): lineIndex = 0 commentCount = guild.GetGuildBoardCommentCount() - for i in xrange(commentCount): + for i in range(commentCount): commentID, chrName, comment = self.__GetGuildBoardCommentData(i) @@ -1491,7 +1491,7 @@ class GuildWindow(ui.ScriptWindow): lineIndex += 1 - for i in xrange(self.BOARD_LINE_MAX_NUM - lineIndex): + for i in range(self.BOARD_LINE_MAX_NUM - lineIndex): slotList = page.boardDict[lineIndex+i] slotList[0].Hide() slotList[1].SetText("") @@ -1521,7 +1521,7 @@ class GuildWindow(ui.ScriptWindow): page = self.pageWindow["MEMBER"] - for line, slotList in page.memberDict.items(): + for line, slotList in list(page.memberDict.items()): gradeComboBox = slotList[1] gradeComboBox.Disable() @@ -1563,7 +1563,7 @@ class GuildWindow(ui.ScriptWindow): page = self.pageWindow["MEMBER"] self.CAN_CHANGE_GRADE_COUNT = 15 - 1 - for key, slotList in page.memberDict.items(): + for key, slotList in list(page.memberDict.items()): gradeComboBox = slotList[1] gradeComboBox.Disable() @@ -1576,7 +1576,7 @@ class GuildWindow(ui.ScriptWindow): continue gradeComboBox.ClearItem() - for i in xrange(self.CAN_CHANGE_GRADE_COUNT): + for i in range(self.CAN_CHANGE_GRADE_COUNT): gradeComboBox.InsertItem(i+2, guild.GetGradeName(i+2)) gradeComboBox.SetCurrentItem(guild.GetGradeName(grade)) if 1 != grade: @@ -1618,7 +1618,7 @@ class GuildWindow(ui.ScriptWindow): """ ## Active - for i in xrange(len(playerSettingModule.ACTIVE_GUILD_SKILL_INDEX_LIST)): + for i in range(len(playerSettingModule.ACTIVE_GUILD_SKILL_INDEX_LIST)): slotIndex = page.activeSlot.GetStartIndex()+i skillIndex = playerSettingModule.ACTIVE_GUILD_SKILL_INDEX_LIST[i] @@ -1643,7 +1643,7 @@ class GuildWindow(ui.ScriptWindow): page = self.pageWindow["GRADE"] - for key, slotList in page.gradeDict.items(): + for key, slotList in list(page.gradeDict.items()): name, authority = guild.GetGradeData(int(key)) slotList[self.GRADE_SLOT_NAME].SetText(name) @@ -2140,12 +2140,12 @@ class BuildGuildBuildingWindow(ui.ScriptWindow): self.__CreateWallBlock(lineBlock, line_startX+line_width*1, eyPos) self.__CreateWallBlock(lineBlock, line_startX+line_width*2, eyPos) self.__CreateWallBlock(lineBlock, line_startX+line_width*3, eyPos) - for i in xrange(X_SIZE_STEP): + for i in range(X_SIZE_STEP): self.__CreateWallBlock(lineBlock, line_startX+line_width*(3+i+1), eyPos) - for i in xrange(X_SIZE_STEP/2): + for i in range(X_SIZE_STEP/2): self.__CreateWallBlock(lineBlock, door_minX - line_maxX - line_width*i, syPos) self.__CreateWallBlock(lineBlock, door_maxX - line_minX + line_width*i, syPos) - for i in xrange(Y_SIZE_STEP): + for i in range(Y_SIZE_STEP): self.__CreateWallBlock(lineBlock, sxPos, line_minX + corner_minX - line_width*i, 90.0) self.__CreateWallBlock(lineBlock, exPos, line_minX + corner_minX - line_width*i, 90.0) @@ -2208,7 +2208,7 @@ class BuildGuildBuildingWindow(ui.ScriptWindow): ## /build c vnum x y x_rot y_rot z_rot ## /build d vnum if "BUILDIN" == self.type: - for i in xrange(len(self.raceList)): + for i in range(len(self.raceList)): race = self.raceList[i] xPos, yPos = self.posList[i] rot = self.rotList[i] @@ -2518,7 +2518,7 @@ class BuildGuildBuildingWindow(ui.ScriptWindow): self.posValueX.SetText(str(int(x))) self.posValueY.SetText(str(int(y))) - for i in xrange(len(self.indexList)): + for i in range(len(self.indexList)): idx = self.indexList[i] xPos, yPos = self.posList[i] @@ -2616,7 +2616,7 @@ if __name__ == "__main__": def LoadGuildBuildingList(filename): handle = app.OpenTextFile(filename) count = app.GetTextFileLineCount(handle) - for i in xrange(count): + for i in range(count): line = app.GetTextFileLine(handle, i) tokens = line.split("\t") diff --git a/assets/root/uihelp.py b/assets/root/uihelp.py index fcbbed74..ca4c5040 100644 --- a/assets/root/uihelp.py +++ b/assets/root/uihelp.py @@ -104,9 +104,9 @@ class HelpWindow(ui.ScriptWindow): return True def __SelectPage(self, pageIndex): - for page in self.pages.values(): + for page in list(self.pages.values()): page.Hide() - for btn in self.btnPages.values(): + for btn in list(self.btnPages.values()): btn.SetUp() self.pages[pageIndex].Show() diff --git a/assets/root/uiinventory.py b/assets/root/uiinventory.py index a5629287..eafcbaf6 100644 --- a/assets/root/uiinventory.py +++ b/assets/root/uiinventory.py @@ -87,7 +87,7 @@ class CostumeWindow(ui.ScriptWindow): def RefreshCostumeSlot(self): getItemVNum=player.GetItemIndex - for i in xrange(item.COSTUME_SLOT_COUNT): + for i in range(item.COSTUME_SLOT_COUNT): slotNumber = item.COSTUME_SLOT_START + i self.wndEquip.SetItemSlot(slotNumber, getItemVNum(slotNumber), 0) @@ -198,7 +198,7 @@ class BeltInventoryWindow(ui.ScriptWindow): self.wndBeltInventoryLayer.SetPosition(self.wndBeltInventoryLayer.GetWidth() - 5, 0) self.minBtn.SetPosition(self.minBtn.GetWidth() + 3, 15) - for i in xrange(item.BELT_INVENTORY_SLOT_COUNT): + 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",\ @@ -222,7 +222,7 @@ class BeltInventoryWindow(ui.ScriptWindow): def RefreshSlot(self): getItemVNum=player.GetItemIndex - for i in xrange(item.BELT_INVENTORY_SLOT_COUNT): + 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) @@ -442,7 +442,7 @@ class InventoryWindow(ui.ScriptWindow): if self.wndBelt: self.isOpenedBeltWindowWhenClosingInventory = self.wndBelt.IsOpeningInventory() # Was belt inventory open when inventory was closed? - print "Is Opening Belt Inven?? ", self.isOpenedBeltWindowWhenClosingInventory + print(("Is Opening Belt Inven?? ", self.isOpenedBeltWindowWhenClosingInventory)) self.wndBelt.Close() if self.dlgPickMoney: @@ -465,16 +465,16 @@ class InventoryWindow(ui.ScriptWindow): self.RefreshEquipSlotWindow() def ClickMallButton(self): - print "click_mall_button" + print("click_mall_button") net.SendChatPacket("/click_mall") # DSSButton def ClickDSSButton(self): - print "click_dss_button" + print("click_dss_button") self.interface.ToggleDragonSoulWindow() def ClickCostumeButton(self): - print "Click Costume Button" + print("Click Costume Button") if self.wndCostume: if self.wndCostume.IsShow(): self.wndCostume.Hide() @@ -527,7 +527,7 @@ class InventoryWindow(ui.ScriptWindow): getItemCount=player.GetItemCount setItemVNum=self.wndItem.SetItemSlot - for i in xrange(player.INVENTORY_PAGE_SIZE): + for i in range(player.INVENTORY_PAGE_SIZE): slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i) itemCount = getItemCount(slotNumber) @@ -544,7 +544,7 @@ class InventoryWindow(ui.ScriptWindow): ## Auto-potion special handling (HP: #72723~#72726, SP: #72727~#72730) - Display activation/deactivation in slot even though it's an item - [hyo] if constInfo.IS_AUTO_POTION(itemVnum): # metinSocket - [0]: Activation status, [1]: Amount used, [2]: Maximum capacity - metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)] + metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in range(player.METIN_SOCKET_MAX_NUM)] if slotNumber >= player.INVENTORY_PAGE_SIZE * self.inventoryPageIndex: slotNumber -= player.INVENTORY_PAGE_SIZE * self.inventoryPageIndex @@ -575,7 +575,7 @@ class InventoryWindow(ui.ScriptWindow): getItemVNum=player.GetItemIndex getItemCount=player.GetItemCount setItemVNum=self.wndEquip.SetItemSlot - for i in xrange(player.EQUIPMENT_PAGE_COUNT): + for i in range(player.EQUIPMENT_PAGE_COUNT): slotNumber = player.EQUIPMENT_SLOT_START + i itemCount = getItemCount(slotNumber) if itemCount <= 1: @@ -583,13 +583,13 @@ class InventoryWindow(ui.ScriptWindow): setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount) if app.ENABLE_NEW_EQUIPMENT_SYSTEM: - for i in xrange(player.NEW_EQUIPMENT_SLOT_COUNT): + for i in range(player.NEW_EQUIPMENT_SLOT_COUNT): slotNumber = player.NEW_EQUIPMENT_SLOT_START + i itemCount = getItemCount(slotNumber) if itemCount <= 1: itemCount = 0 setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount) - print "ENABLE_NEW_EQUIPMENT_SYSTEM", slotNumber, itemCount, getItemVNum(slotNumber) + print(("ENABLE_NEW_EQUIPMENT_SYSTEM", slotNumber, itemCount, getItemVNum(slotNumber))) @@ -993,7 +993,7 @@ class InventoryWindow(ui.ScriptWindow): return TRUE elif "USE_PUT_INTO_BELT_SOCKET" == useType: dstItemVNum = player.GetItemIndex(dstSlotPos) - print "USE_PUT_INTO_BELT_SOCKET", srcItemVNum, dstItemVNum + print(("USE_PUT_INTO_BELT_SOCKET", srcItemVNum, dstItemVNum)) item.SelectItem(dstItemVNum) @@ -1012,7 +1012,7 @@ class InventoryWindow(ui.ScriptWindow): if item.ITEM_TYPE_WEAPON != item.GetItemType(): return False - for i in xrange(player.METIN_SOCKET_MAX_NUM): + for i in range(player.METIN_SOCKET_MAX_NUM): if player.GetItemMetinSocket(dstSlotPos, i) == constInfo.ERROR_METIN_STONE: return True @@ -1028,7 +1028,7 @@ class InventoryWindow(ui.ScriptWindow): if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR): return False - for i in xrange(player.METIN_SOCKET_MAX_NUM): + for i in range(player.METIN_SOCKET_MAX_NUM): if player.GetItemAttribute(dstSlotPos, i) != 0: return True @@ -1091,7 +1091,7 @@ class InventoryWindow(ui.ScriptWindow): return False attrCount = 0 - for i in xrange(player.METIN_SOCKET_MAX_NUM): + for i in range(player.METIN_SOCKET_MAX_NUM): if player.GetItemAttribute(dstSlotPos, i) != 0: attrCount += 1 diff --git a/assets/root/uilocalerefresh.py b/assets/root/uilocalerefresh.py index fb012509..5632d16d 100644 --- a/assets/root/uilocalerefresh.py +++ b/assets/root/uilocalerefresh.py @@ -63,7 +63,7 @@ class LocaleRefreshHelper: import localeInfo refreshCount = 0 - for element, localeKey in elementMap.items(): + for element, localeKey in list(elementMap.items()): try: # Try uiScriptLocale first, then localeInfo if hasattr(uiScriptLocale, localeKey): @@ -108,7 +108,7 @@ class LocaleRefreshHelper: module = localeInfo if localeModule == "localeInfo" else uiScriptLocale newDict = {} - for key, localeKey in targetDict.items(): + for key, localeKey in list(targetDict.items()): if hasattr(module, localeKey): newDict[key] = getattr(module, localeKey) else: @@ -124,7 +124,7 @@ class LocaleRefreshHelper: # Execute the UI script to get its data scriptData = {} try: - execfile(scriptPath, scriptData) + exec(compile(open(scriptPath, "rb").read(), scriptPath, 'exec'), scriptData) self.scriptCache[scriptPath] = scriptData except Exception as e: dbg.TraceError("LocaleRefreshHelper: Failed to execute script %s: %s" % (scriptPath, str(e))) diff --git a/assets/root/uimapnameshower.py b/assets/root/uimapnameshower.py index a0937018..cb49a93b 100644 --- a/assets/root/uimapnameshower.py +++ b/assets/root/uimapnameshower.py @@ -115,8 +115,8 @@ class MapNameShower(ui.ExpandedImageBox): return 7 return 0 def ShowMapName(self, mapName, x, y): - if not self.MAP_NAME_IMAGE.has_key(mapName): - print " [ERROR] - There is no map name image", mapName + if mapName not in self.MAP_NAME_IMAGE: + print((" [ERROR] - There is no map name image", mapName)) return try: @@ -138,7 +138,7 @@ class MapNameShower(ui.ExpandedImageBox): try: floor = self.__GetDevilTowerFloor(x, y) - print x, y, floor + print((x, y, floor)) self.floorImage.LoadImage(LOCALE_PATH+"devil1_%df.tga" % floor) except RuntimeError: self.SetPosition(0, 80) @@ -157,7 +157,7 @@ class MapNameShower(ui.ExpandedImageBox): try: floor = self.__GetDevilBase(x, y) - print x, y, floor + print((x, y, floor)) self.floorImage.LoadImage(LOCALE_PATH+"devil1_%df.tga" % floor) except RuntimeError: self.SetPosition(0, 80) diff --git a/assets/root/uimessenger.py b/assets/root/uimessenger.py index 954ee23c..e03d9ee6 100644 --- a/assets/root/uimessenger.py +++ b/assets/root/uimessenger.py @@ -179,7 +179,7 @@ class MessengerGroupItem(MessengerItem): return member def RemoveMember(self, item): - for i in xrange(len(self.memberList)): + for i in range(len(self.memberList)): if item == self.memberList[i]: del self.memberList[i] return @@ -188,17 +188,17 @@ class MessengerGroupItem(MessengerItem): self.memberList = [] def FindMember(self, key): - list = filter(lambda argMember, argKey=key: argMember.IsSameKey(argKey), self.memberList) + list = list(filter(lambda argMember, argKey=key: argMember.IsSameKey(argKey), self.memberList)) if list: return list[0] return None def GetLoginMemberList(self): - return filter(MessengerMemberItem.IsOnline, self.memberList) + return list(filter(MessengerMemberItem.IsOnline, self.memberList)) def GetLogoutMemberList(self): - return filter(lambda arg: not arg.IsOnline(), self.memberList) + return [arg for arg in self.memberList if not arg.IsOnline()] def IsOpen(self): return self.isOpen @@ -211,7 +211,7 @@ class MessengerGroupItem(MessengerItem): self.image.LoadImage(self.IMAGE_FILE_NAME["CLOSE"]) self.isOpen = False - map(ui.Window.Hide, self.memberList) + list(map(ui.Window.Hide, self.memberList)) def Select(self): @@ -250,7 +250,7 @@ class MessengerGuildItem(MessengerMemberItem): net.SendGuildUseSkillPacket(155, self.key) def CanRemove(self): - for i in xrange(guild.ENEMY_GUILD_SLOT_MAX_COUNT): + for i in range(guild.ENEMY_GUILD_SLOT_MAX_COUNT): if guild.GetEnemyGuildName(i) != "": return False @@ -461,7 +461,7 @@ class MessengerWindow(ui.ScriptWindow): yPos = self.START_POSITION heightLimit = self.GetHeight() - (self.START_POSITION + 13) - map(ui.Window.Hide, self.showingItemList) + list(map(ui.Window.Hide, self.showingItemList)) for item in self.showingItemList[self.startLine:]: item.SetPosition(20 + item.GetStepWidth(), yPos) @@ -539,7 +539,7 @@ class MessengerWindow(ui.ScriptWindow): def OnRemove(self): if self.selectedItem: if self.selectedItem.CanRemove(): - map(lambda arg, argDeletingItem=self.selectedItem: arg.RemoveMember(argDeletingItem), self.groupList) + list(map(lambda arg, argDeletingItem=self.selectedItem: arg.RemoveMember(argDeletingItem), self.groupList)) self.selectedItem.OnRemove() self.selectedItem.UnSelect() self.selectedItem = None diff --git a/assets/root/uiminimap.py b/assets/root/uiminimap.py index f75d0e7a..bb5a7910 100644 --- a/assets/root/uiminimap.py +++ b/assets/root/uiminimap.py @@ -272,7 +272,7 @@ class MiniMap(ui.ScriptWindow): self.mapName=mapName self.AtlasWindow.SetMapName(mapName) - if self.CANNOT_SEE_INFO_MAP_DICT.has_key(mapName): + if mapName in self.CANNOT_SEE_INFO_MAP_DICT: self.canSeeInfo = False self.HideMiniMap() self.tooltipMiniMapOpen.SetText(localeInfo.MINIMAP_CANNOT_SEE) diff --git a/assets/root/uioption.py b/assets/root/uioption.py index 1453481e..c9749bb5 100644 --- a/assets/root/uioption.py +++ b/assets/root/uioption.py @@ -20,7 +20,7 @@ class OptionDialog(ui.ScriptWindow): def __del__(self): ui.ScriptWindow.__del__(self) - print " -------------------------------------- DELETE OPTION DIALOG" + print(" -------------------------------------- DELETE OPTION DIALOG") def __Initialize(self): self.titleBar = 0 @@ -37,7 +37,7 @@ class OptionDialog(ui.ScriptWindow): self.ClearDictionary() self.__Initialize() - print " -------------------------------------- DESTROY OPTION DIALOG" + print(" -------------------------------------- DESTROY OPTION DIALOG") def __LoadDialog(self): try: @@ -201,9 +201,9 @@ class OptionDialog(ui.ScriptWindow): return 0 def __SetPKMode(self, mode): - for btn in self.pvpModeButtonDict.values(): + for btn in list(self.pvpModeButtonDict.values()): btn.SetUp() - if self.pvpModeButtonDict.has_key(mode): + if mode in self.pvpModeButtonDict: self.pvpModeButtonDict[mode].Down() def __SetPeacePKMode(self): @@ -279,7 +279,7 @@ class OptionDialog(ui.ScriptWindow): def RefreshBlock(self): global blockMode - for i in xrange(len(self.blockButtonList)): + for i in range(len(self.blockButtonList)): if 0 != (blockMode & (1 << i)): self.blockButtonList[i].Down() else: diff --git a/assets/root/uiparty.py b/assets/root/uiparty.py index eacdd3b0..ca2fdc47 100644 --- a/assets/root/uiparty.py +++ b/assets/root/uiparty.py @@ -81,7 +81,7 @@ class PartyMemberInfoBoard(ui.ScriptWindow): def __del__(self): ui.ScriptWindow.__del__(self) - print " =============================== DESTROIED PartyMemberInfoBoard" + print(" =============================== DESTROIED PartyMemberInfoBoard") def __LoadBoard(self): try: @@ -127,9 +127,9 @@ class PartyMemberInfoBoard(ui.ScriptWindow): self.Hide() def __SetAffectsMouseEvent(self): - for i in xrange(len(self.partyAffectImageList)): + for i in range(len(self.partyAffectImageList)): self.partyAffectImageList[i].OnMouseOverIn = lambda selfArg = self, index = i: selfArg.OnAffectOverIn(index) - for i in xrange(len(self.partyAffectImageList)): + for i in range(len(self.partyAffectImageList)): self.partyAffectImageList[i].OnMouseOverOut = lambda selfArg = self, index = i: selfArg.OnAffectOverOut(index) def __HideAllAffects(self): @@ -142,7 +142,7 @@ class PartyMemberInfoBoard(ui.ScriptWindow): self.affectToolTip = affectToolTip def __CreateStateButton(self): - for key, name in self.MEMBER_BUTTON_IMAGE_FILE_NAME_DICT.items(): + for key, name in list(self.MEMBER_BUTTON_IMAGE_FILE_NAME_DICT.items()): if key == player.PARTY_STATE_LEADER: continue button = ui.Button() @@ -152,7 +152,7 @@ class PartyMemberInfoBoard(ui.ScriptWindow): button.Hide() self.stateButtonDict[key] = button - for state, name in self.STATE_NAME_DICT.items(): + for state, name in list(self.STATE_NAME_DICT.items()): button = self.stateButtonDict[state] button.SetToolTipText(name) button.SetEvent(ui.__mem_func__(self.OnSelectState), state) @@ -226,7 +226,7 @@ class PartyMemberInfoBoard(ui.ScriptWindow): # xPos += 23 ## Expel - if self.stateButtonDict.has_key(self.MEMBER_BUTTON_EXPEL): + if self.MEMBER_BUTTON_EXPEL in self.stateButtonDict: button = self.stateButtonDict[self.MEMBER_BUTTON_EXPEL] button.SetPosition(xPos, y) button.Show() @@ -234,11 +234,11 @@ class PartyMemberInfoBoard(ui.ScriptWindow): def __HideStateButton(self): self.isShowStateButton = False - for button in self.stateButtonDict.values(): + for button in list(self.stateButtonDict.values()): button.Hide() def __GetAffectNumber(self, img): - for i in xrange(self.partyAffectImageList): + for i in range(self.partyAffectImageList): if img == self.partyAffectImageList[i]: return i @@ -275,7 +275,7 @@ class PartyMemberInfoBoard(ui.ScriptWindow): self.stateButton.Show() name = self.MEMBER_BUTTON_IMAGE_FILE_NAME_DICT[self.MEMBER_BUTTON_NORMAL] - if self.MEMBER_BUTTON_IMAGE_FILE_NAME_DICT.has_key(state): + if state in self.MEMBER_BUTTON_IMAGE_FILE_NAME_DICT: name = self.MEMBER_BUTTON_IMAGE_FILE_NAME_DICT[state] self.stateButton.SetUpVisual(self.MEMBER_BUTTON_PATH + name + "_01.sub") @@ -371,9 +371,9 @@ class PartyMemberInfoBoard(ui.ScriptWindow): def OnAffectOverIn(self, index): - if not self.AFFECT_STRING_DICT.has_key(index): + if index not in self.AFFECT_STRING_DICT: return - if not self.affectValueDict.has_key(index): + if index not in self.affectValueDict: return (x, y) = self.GetGlobalPosition() @@ -479,21 +479,21 @@ class PartyMenu(ui.ThinBoard): xPos += 37 yPos = 85 - for button in self.modeButtonList.values(): + for button in list(self.modeButtonList.values()): button.SetPosition(0, yPos) yPos += 25 self.UpdateRect() def __ShowButton(self, name): - if not self.buttonDict.has_key(name): + if name not in self.buttonDict: return self.showingButtonList.append(self.buttonDict[name]) self.__ArrangeButtons() def __HideButton(self, name): - if not self.buttonDict.has_key(name): + if name not in self.buttonDict: return searchingButton = self.buttonDict[name] @@ -522,7 +522,7 @@ class PartyMenu(ui.ThinBoard): self.__ShowButton(localeInfo.PARTY_HEAL_ALL_MEMBER) def __UpAllModeButtons(self): - for button in self.modeButtonList.values(): + for button in list(self.modeButtonList.values()): button.SetUp() def __SetModeButton(self, mode): @@ -560,7 +560,7 @@ class PartyWindow(ui.Window): def __del__(self): ui.Window.__del__(self) - print " =============================== DESTROIED PartyWindow" + print(" =============================== DESTROIED PartyWindow") def Destroy(self): self.DestroyPartyMemberInfoBoard() @@ -650,7 +650,7 @@ class PartyWindow(ui.Window): board.SetCharacterState(state) board.SetCharacterHP(hpPercentage) - for i in xrange(len(affectsList)): + for i in range(len(affectsList)): board.SetAffect(i, affectsList[i]) vid = board.GetCharacterVID() diff --git a/assets/root/uiphasecurtain.py b/assets/root/uiphasecurtain.py index e0501a19..d3e62546 100644 --- a/assets/root/uiphasecurtain.py +++ b/assets/root/uiphasecurtain.py @@ -6,7 +6,7 @@ import app class PhaseCurtain(ui.Bar): def __init__(self): - print "NEW CURTAIN ----------------------------------------------------------------------------" + print("NEW CURTAIN ----------------------------------------------------------------------------") ui.Bar.__init__(self, "CURTAIN") self.speed = 0.1 self.curAlpha = 0.0 @@ -17,7 +17,7 @@ class PhaseCurtain(ui.Bar): self.AddFlag("float") def __del__(self): - print "---------------------------------------------------------------------------- DELETE CURTAIN" + print("---------------------------------------------------------------------------- DELETE CURTAIN") ui.Bar.__del__(self) def SAFE_FadeOut(self, event, args = -1): diff --git a/assets/root/uipointreset.py b/assets/root/uipointreset.py index 6ab160ab..2d901220 100644 --- a/assets/root/uipointreset.py +++ b/assets/root/uipointreset.py @@ -1,3 +1,4 @@ +# -*- coding: cp949 -*- import net import ui diff --git a/assets/root/uiprivateshopbuilder.py b/assets/root/uiprivateshopbuilder.py index ac7cdf11..60569d25 100644 --- a/assets/root/uiprivateshopbuilder.py +++ b/assets/root/uiprivateshopbuilder.py @@ -50,11 +50,11 @@ def GetPrivateShopItemPrice(itemVNum): return 0 def UpdateADBoard(): - for key in g_privateShopAdvertisementBoardDict.keys(): + for key in list(g_privateShopAdvertisementBoardDict.keys()): g_privateShopAdvertisementBoardDict[key].Show() def DeleteADBoard(vid): - if not g_privateShopAdvertisementBoardDict.has_key(vid): + if vid not in g_privateShopAdvertisementBoardDict: return del g_privateShopAdvertisementBoardDict[vid] @@ -105,7 +105,7 @@ class PrivateShopAdvertisementBoard(ui.ThinBoard): self.SetPosition(x - self.GetWidth()/2, y - self.GetHeight()/2) else: - for key in g_privateShopAdvertisementBoardDict.keys(): + for key in list(g_privateShopAdvertisementBoardDict.keys()): if player.GetMainCharacterIndex() == key: # When the private shop is visible and closed, the player's own shop ID changes. g_privateShopAdvertisementBoardDict[key].Show() x, y = chr.GetProjectPosition(player.GetMainCharacterIndex(), 220) @@ -202,9 +202,9 @@ class PrivateShopBuilder(ui.ScriptWindow): setitemVNum=self.itemSlot.SetItemSlot delItem=self.itemSlot.ClearSlot - for i in xrange(shop.SHOP_SLOT_COUNT): + for i in range(shop.SHOP_SLOT_COUNT): - if not self.itemStock.has_key(i): + if i not in self.itemStock: delItem(i) continue @@ -292,7 +292,7 @@ class PrivateShopBuilder(ui.ScriptWindow): sourceSlotPos = self.priceInputBoard.sourceSlotPos targetSlotPos = self.priceInputBoard.targetSlotPos - for privatePos, (itemWindowType, itemSlotIndex) in self.itemStock.items(): + for privatePos, (itemWindowType, itemSlotIndex) in list(self.itemStock.items()): if itemWindowType == attachedInvenType and itemSlotIndex == sourceSlotPos: shop.DelPrivateShopItemStock(itemWindowType, itemSlotIndex) del self.itemStock[privatePos] @@ -338,7 +338,7 @@ class PrivateShopBuilder(ui.ScriptWindow): def OnOverInItem(self, slotIndex): if self.tooltipItem: - if self.itemStock.has_key(slotIndex): + if slotIndex in self.itemStock: self.tooltipItem.SetPrivateShopBuilderItem(*self.itemStock[slotIndex] + (slotIndex,)) def OnOverOutItem(self): diff --git a/assets/root/uiquest.py b/assets/root/uiquest.py index f916e277..16fe3a62 100644 --- a/assets/root/uiquest.py +++ b/assets/root/uiquest.py @@ -83,7 +83,7 @@ class QuestCurtain(ui.Window): self.TopBar.SetPosition(0, -self.BarHeight-1) self.BottomBar.SetPosition(0, wndMgr.GetScreenHeight()+1) for OnDoneEvent in QuestCurtain.OnDoneEventList: - apply(OnDoneEvent,(self,)) + OnDoneEvent(*(self,)) QuestCurtain.OnDoneEventList = [] def OnUpdate(self): @@ -118,7 +118,7 @@ class EventCurtain(ui.Bar): STATE_IN = 2 def __init__(self, index): - print "NEW EVENT CURTAIN ----------------------------------------------------------------------------" + print("NEW EVENT CURTAIN ----------------------------------------------------------------------------") ui.Bar.__init__(self, "CURTAIN") self.SetWindowName("EventCurtain") self.AddFlag("float") @@ -133,7 +133,7 @@ class EventCurtain(ui.Bar): self.eventIndex = index def __del__(self): - print "---------------------------------------------------------------------------- DELETE EVENT CURTAIN" + print("---------------------------------------------------------------------------- DELETE EVENT CURTAIN") ui.Bar.__del__(self) def SetAlpha(self, alpha): @@ -416,7 +416,7 @@ class QuestDialog(ui.ScriptWindow): def AddOnCloseEvent(self,f): if self.OnCloseEvent: - self.OnCloseEvent = lambda z=[self.OnCloseEvent, f]:map(apply,z) + self.OnCloseEvent = lambda z=[self.OnCloseEvent, f]:list(map(apply,z)) else: self.OnCloseEvent = f @@ -476,7 +476,7 @@ class QuestDialog(ui.ScriptWindow): if not self.board: return - self.btnAnswer = [self.MakeEachButton(i) for i in xrange (n)] + self.btnAnswer = [self.MakeEachButton(i) for i in range (n)] import localeInfo self.prevbutton = self.MakeNextPrevPageButton() @@ -747,7 +747,7 @@ class QuestDialog(ui.ScriptWindow): import grpText lineCount = grpText.GetSplitingTextLineCount(tempDesc, 25) - for i in xrange(lineCount): + for i in range(lineCount): desc += grpText.GetSplitingTextLine(tempDesc, 25, i) + "/" desc = desc[:-1] diff --git a/assets/root/uirefine.py b/assets/root/uirefine.py index 86e130e9..8d6ea2af 100644 --- a/assets/root/uirefine.py +++ b/assets/root/uirefine.py @@ -122,7 +122,7 @@ class RefineDialog(ui.ScriptWindow): return 0 return self.upgradeSuccessPercentage[curGrade] - for i in xrange(player.METIN_SOCKET_MAX_NUM+1): + for i in range(player.METIN_SOCKET_MAX_NUM+1): if 0 == player.GetItemMetinSocket(itemSlotIndex, i): break @@ -140,7 +140,7 @@ class RefineDialog(ui.ScriptWindow): itemIndex = player.GetItemIndex(targetItemPos) self.toolTip.ClearToolTip() metinSlot = [] - for i in xrange(player.METIN_SOCKET_MAX_NUM): + for i in range(player.METIN_SOCKET_MAX_NUM): metinSlot.append(player.GetItemMetinSocket(targetItemPos, i)) self.toolTip.AddItemData(itemIndex, metinSlot) @@ -228,7 +228,7 @@ class RefineDialogNew(ui.ScriptWindow): self.toolTip = toolTip self.slotList = [] - for i in xrange(3): + for i in range(3): slot = self.__MakeSlot() slot.SetParent(toolTip) slot.SetWindowVerticalAlignCenter() @@ -296,11 +296,11 @@ class RefineDialogNew(ui.ScriptWindow): self.toolTip.ClearToolTip() metinSlot = [] - for i in xrange(player.METIN_SOCKET_MAX_NUM): + for i in range(player.METIN_SOCKET_MAX_NUM): metinSlot.append(player.GetItemMetinSocket(targetItemPos, i)) attrSlot = [] - for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM): + for i in range(player.ATTRIBUTE_SLOT_MAX_NUM): attrSlot.append(player.GetItemAttribute(targetItemPos, i)) self.toolTip.AddRefineItemData(nextGradeItemVnum, metinSlot, attrSlot) @@ -309,7 +309,7 @@ class RefineDialogNew(ui.ScriptWindow): xSlotCount, ySlotCount = item.GetItemSize() for slot in self.slotList: slot.Hide() - for i in xrange(min(3, ySlotCount)): + for i in range(min(3, ySlotCount)): self.slotList[i].SetPosition(-35, i*32 - (ySlotCount-1)*16) self.slotList[i].Show() diff --git a/assets/root/uirestart.py b/assets/root/uirestart.py index da658081..23730df1 100644 --- a/assets/root/uirestart.py +++ b/assets/root/uirestart.py @@ -18,7 +18,7 @@ class RestartDialog(ui.ScriptWindow): try: pyScrLoader = ui.PythonScriptLoader() pyScrLoader.LoadScriptFile(self, "uiscript/restartdialog.py") - except Exception, msg: + except Exception as msg: import sys (type, msg, tb)=sys.exc_info() dbg.TraceError("RestartDialog.LoadDialog - %s:%s" % (type, msg)) diff --git a/assets/root/uisafebox.py b/assets/root/uisafebox.py index a0db7e38..d9e4fb0b 100644 --- a/assets/root/uisafebox.py +++ b/assets/root/uisafebox.py @@ -313,7 +313,7 @@ class SafeboxWindow(ui.ScriptWindow): text = "I" pos = -int(float(pageCount-1)/2 * 52) - for i in xrange(pageCount): + for i in range(pageCount): button = ui.RadioButton() button.SetParent(self) button.SetUpVisual("d:/ymir work/ui/game/windows/tab_button_middle_01.sub") @@ -367,7 +367,7 @@ class SafeboxWindow(ui.ScriptWindow): getItemCount=safebox.GetItemCount setItemID=self.wndItem.SetItemSlot - for i in xrange(safebox.SAFEBOX_PAGE_SIZE): + for i in range(safebox.SAFEBOX_PAGE_SIZE): slotIndex = self.__LocalPosToGlobalPos(i) itemCount = getItemCount(slotIndex) if itemCount <= 1: @@ -410,7 +410,7 @@ class SafeboxWindow(ui.ScriptWindow): itemVnum = player.GetItemIndex(attachedSlotPos) if constInfo.IS_AUTO_POTION(itemVnum): - metinSocket = [player.GetItemMetinSocket(attachedSlotPos, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)] + metinSocket = [player.GetItemMetinSocket(attachedSlotPos, j) for j in range(player.METIN_SOCKET_MAX_NUM)] isActivated = (0 != int(metinSocket[0])) if isActivated: @@ -597,7 +597,7 @@ class MallWindow(ui.ScriptWindow): getItemCount=safebox.GetMallItemCount setItemID=self.wndItem.SetItemSlot - for i in xrange(safebox.GetMallSize()): + for i in range(safebox.GetMallSize()): itemID = getItemID(i) itemCount = getItemCount(i) if itemCount <= 1: diff --git a/assets/root/uiscriptlocale.py b/assets/root/uiscriptlocale.py index f7fee936..77d76c45 100644 --- a/assets/root/uiscriptlocale.py +++ b/assets/root/uiscriptlocale.py @@ -26,7 +26,7 @@ def LoadLocaleFile(srcFileName, localeDict): if len(tokens) >= 2: localeDict[tokens[0]] = tokens[1] else: - print len(tokens), lines.index(line), line + print((len(tokens), lines.index(line), line)) name = app.GetLocalePath() LOCALE_UISCRIPT_PATH = "%s/ui/" % (name) diff --git a/assets/root/uiselectitem.py b/assets/root/uiselectitem.py index cfebb628..85aa1c47 100644 --- a/assets/root/uiselectitem.py +++ b/assets/root/uiselectitem.py @@ -80,7 +80,7 @@ class SelectItemWindow(ui.ScriptWindow): getItemCount=player.GetItemCount setItemVNum=self.itemSlot.SetItemSlot - for i in xrange(player.INVENTORY_PAGE_SIZE*2): + for i in range(player.INVENTORY_PAGE_SIZE*2): slotNumber = i itemVNum = getItemVNum(slotNumber) @@ -112,7 +112,7 @@ class SelectItemWindow(ui.ScriptWindow): lineCount += 1 self.SetTableSize(lineCount) - for selectWndPos, inventoryPos in self.inventorySlotPosDict.items(): + for selectWndPos, inventoryPos in list(self.inventorySlotPosDict.items()): itemVNum = getItemVNum(inventoryPos) itemCount = getItemCount(inventoryPos) diff --git a/assets/root/uiselectmusic.py b/assets/root/uiselectmusic.py index 45526a84..56263cc5 100644 --- a/assets/root/uiselectmusic.py +++ b/assets/root/uiselectmusic.py @@ -37,7 +37,7 @@ class Item(ui.ListBoxEx.Item): class PopupDialog(ui.ScriptWindow): def __init__(self, parent): - print "NEW POPUP WINDOW ----------------------------------------------------------------------------" + print("NEW POPUP WINDOW ----------------------------------------------------------------------------") ui.ScriptWindow.__init__(self) self.__Load() @@ -45,7 +45,7 @@ class PopupDialog(ui.ScriptWindow): def __del__(self): ui.ScriptWindow.__del__(self) - print "---------------------------------------------------------------------------- DELETE POPUP WINDOW" + print("---------------------------------------------------------------------------- DELETE POPUP WINDOW") def __Load(self): try: @@ -76,7 +76,7 @@ class PopupDialog(ui.ScriptWindow): class FileListDialog(ui.ScriptWindow): def __init__(self): - print "NEW LIST DIALOG ----------------------------------------------------------------------------" + print("NEW LIST DIALOG ----------------------------------------------------------------------------") ui.ScriptWindow.__init__(self) self.isLoaded=0 @@ -85,7 +85,7 @@ class FileListDialog(ui.ScriptWindow): def __del__(self): ui.ScriptWindow.__del__(self) - print "---------------------------------------------------------------------------- DELETE LIST DIALOG" + print("---------------------------------------------------------------------------- DELETE LIST DIALOG") def Show(self): if self.isLoaded==0: diff --git a/assets/root/uishop.py b/assets/root/uishop.py index d9fa5c3a..2bcdfe0c 100644 --- a/assets/root/uishop.py +++ b/assets/root/uishop.py @@ -1,3 +1,4 @@ +# -*- coding: cp949 -*- import net import player import item @@ -37,7 +38,7 @@ class ShopDialog(ui.ScriptWindow): getItemID=shop.GetItemID getItemCount=shop.GetItemCount setItemID=self.itemSlotWindow.SetItemSlot - for i in xrange(shop.SHOP_SLOT_COUNT): + for i in range(shop.SHOP_SLOT_COUNT): idx = self.__GetRealIndex(i) itemCount = getItemCount(idx) if itemCount <= 1: diff --git a/assets/root/uisystemoption.py b/assets/root/uisystemoption.py index ca9ca001..2e76e380 100644 --- a/assets/root/uisystemoption.py +++ b/assets/root/uisystemoption.py @@ -27,7 +27,7 @@ class OptionDialog(ui.ScriptWindow): def __del__(self): ui.ScriptWindow.__del__(self) - print " -------------------------------------- DELETE SYSTEM OPTION DIALOG" + print(" -------------------------------------- DELETE SYSTEM OPTION DIALOG") def __Initialize(self): self.tilingMode = 0 @@ -47,7 +47,7 @@ class OptionDialog(ui.ScriptWindow): self.ClearDictionary() self.__Initialize() - print " -------------------------------------- DESTROY SYSTEM OPTION DIALOG" + print(" -------------------------------------- DESTROY SYSTEM OPTION DIALOG") def __Load_LoadScript(self, fileName): try: diff --git a/assets/root/uitarget.py b/assets/root/uitarget.py index 31da1d1d..a6627906 100644 --- a/assets/root/uitarget.py +++ b/assets/root/uitarget.py @@ -132,7 +132,7 @@ class TargetBoard(ui.ThinBoard): def __del__(self): ui.ThinBoard.__del__(self) - print "===================================================== DESTROYED TARGET BOARD" + print("===================================================== DESTROYED TARGET BOARD") def __Initialize(self): self.nameString = "" @@ -227,7 +227,7 @@ class TargetBoard(ui.ThinBoard): def ResetTargetBoard(self): - for btn in self.buttonDict.values(): + for btn in list(self.buttonDict.values()): btn.Hide() self.__Initialize() @@ -251,7 +251,7 @@ class TargetBoard(ui.ThinBoard): nameFront = "" if -1 != level: nameFront += "Lv." + str(level) + " " - if self.GRADE_NAME.has_key(grade): + if grade in self.GRADE_NAME: nameFront += "(" + self.GRADE_NAME[grade] + ") " self.SetTargetName(nameFront + name) @@ -302,7 +302,7 @@ class TargetBoard(ui.ThinBoard): def __ShowButton(self, name): - if not self.buttonDict.has_key(name): + if name not in self.buttonDict: return self.buttonDict[name].Show() @@ -310,7 +310,7 @@ class TargetBoard(ui.ThinBoard): def __HideButton(self, name): - if not self.buttonDict.has_key(name): + if name not in self.buttonDict: return button = self.buttonDict[name] diff --git a/assets/root/uitaskbar.py b/assets/root/uitaskbar.py index d0b2f644..d0cb7686 100644 --- a/assets/root/uitaskbar.py +++ b/assets/root/uitaskbar.py @@ -35,13 +35,13 @@ def LoadMouseButtonSettings(): tokens = f.read().split() if len(tokens) != 2: - raise RuntimeError, "MOUSE_SETTINGS_FILE_ERROR" + raise RuntimeError("MOUSE_SETTINGS_FILE_ERROR") MOUSE_SETTINGS[0] = int(tokens[0]) MOUSE_SETTINGS[1] = int(tokens[1]) def unsigned32(n): - return n & 0xFFFFFFFFL + return n & 0xFFFFFFFF #-------------------Giftbox Begin------------------------------ @@ -214,7 +214,7 @@ class ExpandedTaskBar(ui.ScriptWindow): def SetTop(self): super(ExpandedTaskBar, self).SetTop() - for button in self.toggleButtonDict.values(): + for button in list(self.toggleButtonDict.values()): button.SetTop() def Show(self): @@ -551,17 +551,17 @@ class TaskBar(ui.ScriptWindow): self.RefreshQuickSlot() def __RampageGauge_OverIn(self): - print "rampage_over_in" + print("rampage_over_in") self.rampageGauge2.Show() self.rampageGauge1.Hide() def __RampageGauge_OverOut(self): - print "rampage_over_out" + print("rampage_over_out") self.rampageGauge2.Hide() self.rampageGauge1.Show() def __RampageGauge_Click(self): - print "rampage_up" + print("rampage_up") net.SendChatPacket("/in_game_mall") # gift icon hide when click mall icon self.wndGiftBox.Hide() @@ -571,7 +571,7 @@ class TaskBar(ui.ScriptWindow): LoadMouseButtonSettings() (mouseLeftButtonEvent, mouseRightButtonEvent) = GetMouseButtonSettings() if not self.__IsInSafeMouseButtonSettingRange(mouseLeftButtonEvent) or not self.__IsInSafeMouseButtonSettingRange(mouseRightButtonEvent): - raise RuntimeError, "INVALID_MOUSE_BUTTON_SETTINGS" + raise RuntimeError("INVALID_MOUSE_BUTTON_SETTINGS") except: InitMouseButtonSettings(self.EVENT_MOVE_AND_ATTACK, self.EVENT_CAMERA) (mouseLeftButtonEvent, mouseRightButtonEvent) = GetMouseButtonSettings() @@ -685,7 +685,7 @@ class TaskBar(ui.ScriptWindow): slotIndex = 0 for slotWindow in self.quickslot: - for i in xrange(QUICK_SLOT_SLOT_COUNT): + for i in range(QUICK_SLOT_SLOT_COUNT): (Type, Position) = player.GetLocalQuickSlot(slotIndex) if Type == player.SLOT_TYPE_SKILL: @@ -742,10 +742,10 @@ class TaskBar(ui.ScriptWindow): if 0 != quarterPoint: FullCount = min(4, curPoint / quarterPoint) - for i in xrange(4): + for i in range(4): self.expGauge[i].Hide() - for i in xrange(FullCount): + for i in range(FullCount): self.expGauge[i].SetRenderingRect(0.0, 0.0, 0.0, 0.0) self.expGauge[i].Show() @@ -772,7 +772,7 @@ class TaskBar(ui.ScriptWindow): startNumber = 0 for slot in self.quickslot: - for i in xrange(4): + for i in range(4): slotNumber = i + startNumber (Type, Position) = player.GetLocalQuickSlot(slotNumber) @@ -793,7 +793,7 @@ class TaskBar(ui.ScriptWindow): ## 자동물약 (#72723, #72724) 특수처리 - 아이템인데도 슬롯에 활성화/비활성화 표시를 위한 작업임 - [hyo] if constInfo.IS_AUTO_POTION(itemIndex): # metinSocket - [0] : 활성화 여부, [1] : 사용한 양, [2] : 최대 용량 - metinSocket = [player.GetItemMetinSocket(Position, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)] + metinSocket = [player.GetItemMetinSocket(Position, j) for j in range(player.METIN_SOCKET_MAX_NUM)] if 0 != int(metinSocket[0]): slot.ActivateSlot(slotNumber) @@ -927,7 +927,7 @@ class TaskBar(ui.ScriptWindow): ## Quick Slot for slotWindow in self.quickslot: - for i in xrange(QUICK_SLOT_SLOT_COUNT): + for i in range(QUICK_SLOT_SLOT_COUNT): (Type, Position) = player.GetLocalQuickSlot(slotIndex) @@ -948,7 +948,7 @@ class TaskBar(ui.ScriptWindow): ## Quick Slot for slotWindow in self.quickslot: - for i in xrange(4): + for i in range(4): (Type, Position) = player.GetLocalQuickSlot(slotIndex) @@ -969,7 +969,7 @@ class TaskBar(ui.ScriptWindow): ## Quick Slot for slotWindow in self.quickslot: - for i in xrange(4): + for i in range(4): (Type, Position) = player.GetLocalQuickSlot(slotIndex) @@ -1079,7 +1079,7 @@ class TaskBar(ui.ScriptWindow): getSkillIndex=player.GetSkillIndex getSkillLevel=player.GetSkillLevel - for i in xrange(PAGE_SLOT_COUNT): + for i in range(PAGE_SLOT_COUNT): skillIndex = getSkillIndex(startNumber+i) skillLevel = getSkillLevel(startNumber+i) diff --git a/assets/root/uitip.py b/assets/root/uitip.py index e0aea0fc..0a70523a 100644 --- a/assets/root/uitip.py +++ b/assets/root/uitip.py @@ -1,3 +1,4 @@ +# -*- coding: cp949 -*- import ui import grp import app diff --git a/assets/root/uitooltip.py b/assets/root/uitooltip.py index 9f633b16..79b31204 100644 --- a/assets/root/uitooltip.py +++ b/assets/root/uitooltip.py @@ -147,7 +147,7 @@ class ToolTip(ui.ThinBoard): def AppendHorizontalLine(self): - for i in xrange(2): + for i in range(2): horizontalLine = ui.Line() horizontalLine.SetParent(self) horizontalLine.SetPosition(0, self.toolTipHeight + 3 + i) @@ -523,7 +523,7 @@ class ItemToolTip(ToolTip): race = player.GetRace() job = chr.RaceToJob(race) - if not self.ANTI_FLAG_DICT.has_key(job): + if job not in self.ANTI_FLAG_DICT: return False if item.IsAntiFlag(self.ANTI_FLAG_DICT[job]): @@ -540,7 +540,7 @@ class ItemToolTip(ToolTip): if item.IsAntiFlag(item.ITEM_ANTIFLAG_FEMALE) and sex == FEMALE: return False - for i in xrange(item.LIMIT_MAX_NUM): + for i in range(item.LIMIT_MAX_NUM): (limitType, limitValue) = item.GetLimit(i) if item.LIMIT_LEVEL == limitType: @@ -594,8 +594,8 @@ class ItemToolTip(ToolTip): item.SelectItem(itemVnum) self.AppendSellingPrice(player.GetISellItemPrice(window_type, slotIndex)) - metinSlot = [player.GetItemMetinSocket(window_type, slotIndex, i) for i in xrange(player.METIN_SOCKET_MAX_NUM)] - attrSlot = [player.GetItemAttribute(window_type, slotIndex, i) for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM)] + metinSlot = [player.GetItemMetinSocket(window_type, slotIndex, i) for i in range(player.METIN_SOCKET_MAX_NUM)] + attrSlot = [player.GetItemAttribute(window_type, slotIndex, i) for i in range(player.ATTRIBUTE_SLOT_MAX_NUM)] self.itemWindowType = window_type self.itemSlotIndex = slotIndex @@ -613,10 +613,10 @@ class ItemToolTip(ToolTip): self.isShopItem = True metinSlot = [] - for i in xrange(player.METIN_SOCKET_MAX_NUM): + for i in range(player.METIN_SOCKET_MAX_NUM): metinSlot.append(shop.GetItemMetinSocket(slotIndex, i)) attrSlot = [] - for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM): + for i in range(player.ATTRIBUTE_SLOT_MAX_NUM): attrSlot.append(shop.GetItemAttribute(slotIndex, i)) self.AddItemData(itemVnum, metinSlot, attrSlot) @@ -634,10 +634,10 @@ class ItemToolTip(ToolTip): self.isShopItem = True metinSlot = [] - for i in xrange(player.METIN_SOCKET_MAX_NUM): + for i in range(player.METIN_SOCKET_MAX_NUM): metinSlot.append(shop.GetItemMetinSocket(slotIndex, i)) attrSlot = [] - for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM): + for i in range(player.ATTRIBUTE_SLOT_MAX_NUM): attrSlot.append(shop.GetItemAttribute(slotIndex, i)) self.AddItemData(itemVnum, metinSlot, attrSlot) @@ -653,10 +653,10 @@ class ItemToolTip(ToolTip): self.itemSlotIndex = slotIndex metinSlot = [] - for i in xrange(player.METIN_SOCKET_MAX_NUM): + for i in range(player.METIN_SOCKET_MAX_NUM): metinSlot.append(exchange.GetItemMetinSocketFromSelf(slotIndex, i)) attrSlot = [] - for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM): + for i in range(player.ATTRIBUTE_SLOT_MAX_NUM): attrSlot.append(exchange.GetItemAttributeFromSelf(slotIndex, i)) self.AddItemData(itemVnum, metinSlot, attrSlot) @@ -670,10 +670,10 @@ class ItemToolTip(ToolTip): self.itemSlotIndex = slotIndex metinSlot = [] - for i in xrange(player.METIN_SOCKET_MAX_NUM): + for i in range(player.METIN_SOCKET_MAX_NUM): metinSlot.append(exchange.GetItemMetinSocketFromTarget(slotIndex, i)) attrSlot = [] - for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM): + for i in range(player.ATTRIBUTE_SLOT_MAX_NUM): attrSlot.append(exchange.GetItemAttributeFromTarget(slotIndex, i)) self.AddItemData(itemVnum, metinSlot, attrSlot) @@ -689,10 +689,10 @@ class ItemToolTip(ToolTip): self.AppendSellingPrice(shop.GetPrivateShopItemPrice(invenType, invenPos)) metinSlot = [] - for i in xrange(player.METIN_SOCKET_MAX_NUM): + for i in range(player.METIN_SOCKET_MAX_NUM): metinSlot.append(player.GetItemMetinSocket(invenPos, i)) attrSlot = [] - for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM): + for i in range(player.ATTRIBUTE_SLOT_MAX_NUM): attrSlot.append(player.GetItemAttribute(invenPos, i)) self.AddItemData(itemVnum, metinSlot, attrSlot) @@ -706,10 +706,10 @@ class ItemToolTip(ToolTip): self.itemWindowType = None self.itemSlotIndex = slotIndex metinSlot = [] - for i in xrange(player.METIN_SOCKET_MAX_NUM): + for i in range(player.METIN_SOCKET_MAX_NUM): metinSlot.append(safebox.GetItemMetinSocket(slotIndex, i)) attrSlot = [] - for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM): + for i in range(player.ATTRIBUTE_SLOT_MAX_NUM): attrSlot.append(safebox.GetItemAttribute(slotIndex, i)) self.AddItemData(itemVnum, metinSlot, attrSlot, safebox.GetItemFlags(slotIndex)) @@ -723,10 +723,10 @@ class ItemToolTip(ToolTip): self.itemWindowType = None self.itemSlotIndex = slotIndex metinSlot = [] - for i in xrange(player.METIN_SOCKET_MAX_NUM): + for i in range(player.METIN_SOCKET_MAX_NUM): metinSlot.append(safebox.GetMallItemMetinSocket(slotIndex, i)) attrSlot = [] - for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM): + for i in range(player.ATTRIBUTE_SLOT_MAX_NUM): attrSlot.append(safebox.GetMallItemAttribute(slotIndex, i)) self.AddItemData(itemVnum, metinSlot, attrSlot) @@ -734,10 +734,10 @@ class ItemToolTip(ToolTip): def SetItemToolTip(self, itemVnum): self.ClearToolTip() metinSlot = [] - for i in xrange(player.METIN_SOCKET_MAX_NUM): + for i in range(player.METIN_SOCKET_MAX_NUM): metinSlot.append(0) attrSlot = [] - for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM): + for i in range(player.ATTRIBUTE_SLOT_MAX_NUM): attrSlot.append((0, 0)) self.AddItemData(itemVnum, metinSlot, attrSlot) @@ -791,7 +791,7 @@ class ItemToolTip(ToolTip): def __AppendAttributeInformation(self, attrSlot): if 0 != attrSlot: - for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM): + for i in range(player.ATTRIBUTE_SLOT_MAX_NUM): type = attrSlot[i][0] value = attrSlot[i][1] @@ -845,7 +845,7 @@ class ItemToolTip(ToolTip): if not attrSlot: return False - for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM): + for i in range(player.ATTRIBUTE_SLOT_MAX_NUM): type = attrSlot[i][0] if 0 != type: return True @@ -853,7 +853,7 @@ class ItemToolTip(ToolTip): return False def AddRefineItemData(self, itemVnum, metinSlot, attrSlot = 0): - for i in xrange(player.METIN_SOCKET_MAX_NUM): + for i in range(player.METIN_SOCKET_MAX_NUM): metinSlotData=metinSlot[i] if self.GetMetinItemIndex(metinSlotData) == constInfo.ERROR_METIN_STONE: metinSlot[i]=player.METIN_SOCKET_TYPE_SILVER @@ -999,7 +999,7 @@ class ItemToolTip(ToolTip): #self.__AppendAccessoryMetinSlotInfo(metinSlot, 99001) bHasRealtimeFlag = 0 - for i in xrange(item.LIMIT_MAX_NUM): + for i in range(item.LIMIT_MAX_NUM): (limitType, limitValue) = item.GetLimit(i) if item.LIMIT_REAL_TIME == limitType: @@ -1030,7 +1030,7 @@ class ItemToolTip(ToolTip): self.AppendWearableInformation() bHasRealtimeFlag = 0 - for i in xrange(item.LIMIT_MAX_NUM): + for i in range(item.LIMIT_MAX_NUM): (limitType, limitValue) = item.GetLimit(i) if item.LIMIT_REAL_TIME == limitType: @@ -1114,7 +1114,7 @@ class ItemToolTip(ToolTip): elif item.ITEM_TYPE_UNIQUE == itemType: if 0 != metinSlot: bHasRealtimeFlag = 0 - for i in xrange(item.LIMIT_MAX_NUM): + for i in range(item.LIMIT_MAX_NUM): (limitType, limitValue) = item.GetLimit(i) if item.LIMIT_REAL_TIME == limitType: @@ -1205,7 +1205,7 @@ class ItemToolTip(ToolTip): ##### if item.USE_SPECIAL == itemSubType: bHasRealtimeFlag = 0 - for i in xrange(item.LIMIT_MAX_NUM): + for i in range(item.LIMIT_MAX_NUM): (limitType, limitValue) = item.GetLimit(i) if item.LIMIT_REAL_TIME == limitType: @@ -1228,7 +1228,7 @@ class ItemToolTip(ToolTip): elif item.USE_TIME_CHARGE_PER == itemSubType: bHasRealtimeFlag = 0 - for i in xrange(item.LIMIT_MAX_NUM): + for i in range(item.LIMIT_MAX_NUM): (limitType, limitValue) = item.GetLimit(i) if item.LIMIT_REAL_TIME == limitType: @@ -1247,7 +1247,7 @@ class ItemToolTip(ToolTip): elif item.USE_TIME_CHARGE_FIX == itemSubType: bHasRealtimeFlag = 0 - for i in xrange(item.LIMIT_MAX_NUM): + for i in range(item.LIMIT_MAX_NUM): (limitType, limitValue) = item.GetLimit(i) if item.LIMIT_REAL_TIME == limitType: @@ -1266,7 +1266,7 @@ class ItemToolTip(ToolTip): elif item.ITEM_TYPE_QUEST == itemType: bHasRealtimeFlag = 0 - for i in xrange(item.LIMIT_MAX_NUM): + for i in range(item.LIMIT_MAX_NUM): (limitType, limitValue) = item.GetLimit(i) if item.LIMIT_REAL_TIME == limitType: @@ -1284,7 +1284,7 @@ class ItemToolTip(ToolTip): else: self.__AppendLimitInformation() - for i in xrange(item.LIMIT_MAX_NUM): + for i in range(item.LIMIT_MAX_NUM): (limitType, limitValue) = item.GetLimit(i) limitValue2 = item.GetLimitValue(i) @@ -1377,7 +1377,7 @@ class ItemToolTip(ToolTip): return self.toolTipWidth maxWidth = self.toolTipWidth - for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM): + for i in range(player.ATTRIBUTE_SLOT_MAX_NUM): type = attrSlot[i][0] value = attrSlot[i][1] @@ -1466,7 +1466,7 @@ class ItemToolTip(ToolTip): appendSpace = False - for i in xrange(item.LIMIT_MAX_NUM): + for i in range(item.LIMIT_MAX_NUM): (limitType, limitValue) = item.GetLimit(i) @@ -1522,7 +1522,7 @@ class ItemToolTip(ToolTip): return "UNKNOWN_TYPE[%s] %s" % (affectType, affectValue) def __AppendAffectInformation(self): - for i in xrange(item.ITEM_APPLY_MAX_NUM): + for i in range(item.ITEM_APPLY_MAX_NUM): (affectType, affectValue) = item.GetAffect(i) @@ -1542,7 +1542,7 @@ class ItemToolTip(ToolTip): not item.IsAntiFlag(item.ITEM_ANTIFLAG_SHAMAN)) characterNames = "" - for i in xrange(self.CHARACTER_COUNT): + for i in range(self.CHARACTER_COUNT): name = self.CHARACTER_NAMES[i] flag = flagList[i] @@ -1659,7 +1659,7 @@ class ItemToolTip(ToolTip): item.IsWearableFlag(item.WEARABLE_ARROW)) wearNames = "" - for i in xrange(self.WEAR_COUNT): + for i in range(self.WEAR_COUNT): name = self.WEAR_NAMES[i] flag = flagList[i] @@ -1740,14 +1740,14 @@ class ItemToolTip(ToolTip): if self.__AppendMetinSlotInfo_IsEmptySlotList(metinSlot): return - for i in xrange(player.METIN_SOCKET_MAX_NUM): + for i in range(player.METIN_SOCKET_MAX_NUM): self.__AppendMetinSlotInfo_AppendMetinSocketData(i, metinSlot[i]) def __AppendMetinSlotInfo_IsEmptySlotList(self, metinSlot): if 0 == metinSlot: return 1 - for i in xrange(player.METIN_SOCKET_MAX_NUM): + for i in range(player.METIN_SOCKET_MAX_NUM): metinSlotData=metinSlot[i] if 0 != self.GetMetinSocketType(metinSlotData): if 0 != self.GetMetinItemIndex(metinSlotData): @@ -2173,7 +2173,7 @@ class SkillToolTip(ToolTip): self.__AppendSkillGradeName(skillIndex, skillGrade) def __AppendSkillGradeName(self, skillIndex, skillGrade): - if self.SKILL_GRADE_NAME.has_key(skillGrade): + if skillGrade in self.SKILL_GRADE_NAME: self.AppendSpace(5) self.AppendTextLine(self.SKILL_GRADE_NAME[skillGrade] % (skill.GetSkillName(skillIndex, 0)), self.CAN_LEVEL_UP_COLOR) @@ -2233,7 +2233,7 @@ class SkillToolTip(ToolTip): conditionDataCount = skill.GetSkillConditionDescriptionCount(skillIndex) if conditionDataCount > 0: self.AppendSpace(5) - for i in xrange(conditionDataCount): + for i in range(conditionDataCount): self.AppendTextLine(skill.GetSkillConditionDescription(skillIndex, i), self.CONDITION_COLOR) def AppendGuildSkillData(self, skillIndex, skillLevel): @@ -2251,7 +2251,7 @@ class SkillToolTip(ToolTip): ##### - for i in xrange(skill.GetSkillAffectDescriptionCount(skillIndex)): + for i in range(skill.GetSkillAffectDescriptionCount(skillIndex)): self.AppendTextLine(skill.GetSkillAffectDescription(skillIndex, i, skillCurrentPercentage), self.ENABLE_COLOR) ## Cooltime @@ -2272,7 +2272,7 @@ class SkillToolTip(ToolTip): ##### - for i in xrange(skill.GetSkillAffectDescriptionCount(skillIndex)): + for i in range(skill.GetSkillAffectDescriptionCount(skillIndex)): self.AppendTextLine(skill.GetSkillAffectDescription(skillIndex, i, skillNextPercentage), self.DISABLE_COLOR) ## Cooltime @@ -2323,10 +2323,10 @@ class SkillToolTip(ToolTip): affectDataCount = skill.GetNewAffectDataCount(skillIndex) if affectDataCount > 0: - for i in xrange(affectDataCount): + for i in range(affectDataCount): type, minValue, maxValue = skill.GetNewAffectData(skillIndex, i, skillPercentage) - if not self.AFFECT_NAME_DICT.has_key(type): + if type not in self.AFFECT_NAME_DICT: continue minValue = int(minValue) @@ -2353,7 +2353,7 @@ class SkillToolTip(ToolTip): self.AppendTextLine(affectText, color) else: - for i in xrange(skill.GetSkillAffectDescriptionCount(skillIndex)): + for i in range(skill.GetSkillAffectDescriptionCount(skillIndex)): self.AppendTextLine(skill.GetSkillAffectDescription(skillIndex, i, skillPercentage), color) @@ -2404,9 +2404,9 @@ class SkillToolTip(ToolTip): requireStatCount = skill.GetSkillRequireStatCount(skillIndex) if requireStatCount > 0: - for i in xrange(requireStatCount): + for i in range(requireStatCount): type, level = skill.GetSkillRequireStatData(skillIndex, i) - if self.POINT_NAME_DICT.has_key(type): + if type in self.POINT_NAME_DICT: if not isAppendHorizontalLine: isAppendHorizontalLine = True diff --git a/assets/root/uiuploadmark.py b/assets/root/uiuploadmark.py index cfcaa962..8c1d3d99 100644 --- a/assets/root/uiuploadmark.py +++ b/assets/root/uiuploadmark.py @@ -101,7 +101,7 @@ class SymbolItem(ui.ListBoxEx.Item): class PopupDialog(ui.ScriptWindow): def __init__(self, parent): - print "NEW POPUP WINDOW ----------------------------------------------------------------------------" + print("NEW POPUP WINDOW ----------------------------------------------------------------------------") ui.ScriptWindow.__init__(self) self.__Load() @@ -109,7 +109,7 @@ class PopupDialog(ui.ScriptWindow): def __del__(self): ui.ScriptWindow.__del__(self) - print "---------------------------------------------------------------------------- DELETE POPUP WINDOW" + print("---------------------------------------------------------------------------- DELETE POPUP WINDOW") def __Load(self): try: @@ -140,7 +140,7 @@ class PopupDialog(ui.ScriptWindow): class MarkSelectDialog(ui.ScriptWindow): def __init__(self): - print "NEW MARK LIST WINDOW ----------------------------------------------------------------------------" + print("NEW MARK LIST WINDOW ----------------------------------------------------------------------------") ui.ScriptWindow.__init__(self) self.selectEvent=None @@ -148,7 +148,7 @@ class MarkSelectDialog(ui.ScriptWindow): def __del__(self): ui.ScriptWindow.__del__(self) - print "---------------------------------------------------------------------------- DELETE MARK LIST WINDOW" + print("---------------------------------------------------------------------------- DELETE MARK LIST WINDOW") def Show(self): if self.isLoaded==0: @@ -269,7 +269,7 @@ class MarkSelectDialog(ui.ScriptWindow): class SymbolSelectDialog(ui.ScriptWindow): def __init__(self): - print "NEW SYMBOL LIST WINDOW ----------------------------------------------------------------------------" + print("NEW SYMBOL LIST WINDOW ----------------------------------------------------------------------------") ui.ScriptWindow.__init__(self) self.selectEvent=None @@ -277,7 +277,7 @@ class SymbolSelectDialog(ui.ScriptWindow): def __del__(self): ui.ScriptWindow.__del__(self) - print "---------------------------------------------------------------------------- DELETE SYMBOL LIST WINDOW" + print("---------------------------------------------------------------------------- DELETE SYMBOL LIST WINDOW") def Show(self): if self.isLoaded==0: diff --git a/assets/root/uiweb.py b/assets/root/uiweb.py index 34bfe64c..adf2f4dd 100644 --- a/assets/root/uiweb.py +++ b/assets/root/uiweb.py @@ -61,11 +61,11 @@ class WebWindow(ui.ScriptWindow): pass def __OnCloseButtonClick(self): - print "close_web:click_close_button" + print("close_web:click_close_button") self.Close() def OnPressEscapeKey(self): - print "close_web:esc_key" + print("close_web:esc_key") self.Close() return True diff --git a/assets/root/uiwhisper.py b/assets/root/uiwhisper.py index 6cf0737a..6cfe6f32 100644 --- a/assets/root/uiwhisper.py +++ b/assets/root/uiwhisper.py @@ -56,14 +56,14 @@ class WhisperDialog(ui.ScriptWindow): app.SetCursor(app.NORMAL) def __init__(self, eventMinimize, eventClose): - print "NEW WHISPER DIALOG ----------------------------------------------------------------------------" + print("NEW WHISPER DIALOG ----------------------------------------------------------------------------") ui.ScriptWindow.__init__(self) self.targetName = "" self.eventMinimize = eventMinimize self.eventClose = eventClose self.eventAcceptTarget = None def __del__(self): - print "---------------------------------------------------------------------------- DELETE WHISPER DIALOG" + print("---------------------------------------------------------------------------- DELETE WHISPER DIALOG") ui.ScriptWindow.__del__(self) def LoadDialog(self): diff --git a/assets/root/utils.py b/assets/root/utils.py index 90c0b2e3..51d0d734 100644 --- a/assets/root/utils.py +++ b/assets/root/utils.py @@ -21,7 +21,7 @@ class Sandbox(object): for allowed_module_name in self.allowed_modules: try: - exec 'import {0}'.format(allowed_module_name) + exec('import {0}'.format(allowed_module_name)) except: # Just now, pass the exception. # (filename could not use this module) @@ -36,7 +36,7 @@ class Sandbox(object): # set current imported modules None if self.prevent_imported_modules: import types - for k, v in old_modules.items(): + for k, v in list(old_modules.items()): if type(v) == types.ModuleType: if not (k in self.WHITE_LIST or k in self.allowed_modules): sys.modules[k] = None @@ -49,16 +49,16 @@ class Sandbox(object): with open(filename, 'rb') as f: data = f.read() code = compile(data, filename, 'exec') - exec code in dic - except Exception, e: + exec(code, dic) + except Exception as e: sys.stderr.write(e) finally: # Restore original settings. #sys.modules = old_modules# <- This is not effective. I don't know why, but I guess some where got old sys.modules reference and access old one. - for k, v in sys.modules.items(): + for k, v in list(sys.modules.items()): if not k in old_modules: del sys.modules[k] - for k, v in old_modules.items(): + for k, v in list(old_modules.items()): sys.modules[k] = v sys.path = old_path