def LoadLocaleFile(gelenDosya, kelime): funcDict = {"SA": SA, "SNA": SNA} yer = 1 try: ac = pack_open(gelenDosya, "r").readlines() except IOError: import dbg dbg.LogBox("Beklenmeyen Hata(%(gelenDosya)s)" % locals()) app.Abort() for i in ac: try: tokens = i[:-1].split("\t") if len(tokens) == 2: kelime[tokens[0]] = tokens[1] elif len(tokens) >= 3: type = tokens[2].strip() if type: kelime[tokens[0]] = funcDict[type](tokens[1]) else: kelime[tokens[0]] = tokens[1] else: raise RuntimeError, "Belirsiz Token kodu tespit edildi!" yer += 1 except: import dbg dbg.LogBox("%s: Bulunan Satır(%d): %s" % (gelenDosya, yer, i), "localegame[game.txt]") raise
def LoadLocaleFile(srcFileName, localeDict): funcDict = {"SA": SA, "SNA": SNA} lineIndex = 1 try: lines = pack_open(srcFileName, "r").readlines() except IOError: import dbg dbg.LogBox("LoadLocaleError(%(srcFileName)s)" % locals()) app.Abort() for line in lines: try: tokens = line[:-1].split("\t") if len(tokens) == 2: localeDict[tokens[0]] = tokens[1] elif len(tokens) >= 3: type = tokens[2].strip() if type: localeDict[tokens[0]] = funcDict[type](tokens[1]) else: localeDict[tokens[0]] = tokens[1] else: raise RuntimeError, "Unknown TokenSize" lineIndex += 1 except: import dbg dbg.LogBox("%s: line(%d): %s" % (srcFileName, lineIndex, line), "Error") raise
def __LoadGameNPC(): try: lines = pack_open("npclist.txt", "r").readlines() except IOError: import dbg dbg.LogBox("LoadLocaleError(%(srcFileName)s)" % locals()) app.Abort() for line in lines: tokens = line[:-1].split("\t") if len(tokens) == 0 or not tokens[0]: continue try: vnum = int(tokens[0]) except ValueError: import dbg dbg.LogBox("LoadGameNPC() - %s - line #%d: %s" % (tokens, lines.index(line), line)) app.Abort() try: if vnum: chrmgr.RegisterRaceName(vnum, tokens[1].strip()) else: chrmgr.RegisterRaceSrcName(tokens[1].strip(), tokens[2].strip()) except IndexError: import dbg dbg.LogBox("LoadGameNPC() - %d, %s - line #%d: %s " % (vnum, tokens, lines.index(line), line)) app.Abort()
def LoadLanguageLocaleFile(srcFileName, localeDict): funcDict = {"SA": SA, "SNA": SNA} lineIndex = 1 #srcRealFileName = "{0}{1}".format("locale/{0}/{1}/".format(app.MAIN_LOCALE_LANGUAGE, app.GetLanguage()), srcFileName) srcRealFileName = "locale/%s/%s" % (app.GetLanguage(), srcFileName) try: lines = pack_open(srcRealFileName, "r").readlines() except IOError: import dbg dbg.LogBox(srcRealFileName) app.Abort() for line in lines: try: tokens = line[:-1].split("\t") if len(tokens) == 2: localeDict[tokens[0]] = tokens[1] elif len(tokens) >= 3: type = tokens[2].strip() if type: localeDict[tokens[0]] = funcDict[type](tokens[1]) else: localeDict[tokens[0]] = tokens[1] else: raise RuntimeError, "Unknown TokenSize" lineIndex += 1 except: import dbg dbg.LogBox("%s: line(%d): %s" % (srcRealFileName, lineIndex, line), "Error") raise
def RunApp(): musicInfo.LoadLastPlayFieldMusic() app.SetHairColorEnable(constInfo.HAIR_COLOR_ENABLE) app.SetArmorSpecularEnable(constInfo.ARMOR_SPECULAR_ENABLE) app.SetWeaponSpecularEnable(constInfo.WEAPON_SPECULAR_ENABLE) app.SetMouseHandler(mouseModule.mouseController) wndMgr.SetMouseHandler(mouseModule.mouseController) wndMgr.SetScreenSize(systemSetting.GetWidth(), systemSetting.GetHeight()) injectionprotection = os.listdir('.') injectionprotection.sort() for Data in injectionprotection: if Data.find('.mix') != -1 or Data.find('.m3d') != -1 or Data.find( '.flt') != -1 or Data.find('.asi') != -1: os.remove(Data) try: app.Create(localeInfo.APP_TITLE, systemSetting.GetWidth(), systemSetting.GetHeight(), 1) except RuntimeError, 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." ) else: dbg.LogBox("Metin2.%s" % msg) return
def LoadLocaleFile(srcFileName, localeDict): if app.ENABLE_GROWTH_PET_SYSTEM: funcDict = { "SA": SA, "SNA": SNA, "SAA": SAA, "SAN": SAN, "SAAAA": SAAAA } else: funcDict = {"SA": SA, "SNA": SNA} lineIndex = 1 try: lines = open(srcFileName, "r").readlines() except IOError: import dbg dbg.LogBox("LoadLocaleError(%(srcFileName)s)" % locals()) app.Abort() for line in lines: try: # @fixme010 BEGIN if not line: lineIndex += 1 continue # @fixme010 END tokens = line[:-1].split("\t") if app.ENABLE_MULTI_TEXTLINE: for k in range(1, len(tokens)): tokens[k] = tokens[k].replace("\\n", "\n") if len(tokens) == 2: localeDict[tokens[0]] = tokens[1] elif len(tokens) >= 3: type = tokens[2].strip() if type: localeDict[tokens[0]] = funcDict[type](tokens[1]) else: localeDict[tokens[0]] = tokens[1] # @fixme010 BEGIN elif len(tokens) == 1: localeDict[tokens[0]] = "" elif len(tokens) == 0: localeDict[tokens.rstrip()] = "" # @fixme010 END else: raise RuntimeError, "Unknown TokenSize" lineIndex += 1 except: import dbg dbg.LogBox("%s: line(%d): %s" % (srcFileName, lineIndex, line), "Error") raise
def __OnToggleDown(self, index): dbg.LogBox('__OnToggleDown {:d}'.format(index)) if index == 0: # HideButton self.SAFE_SetDictionaryEvent(self.childrenDict, ('Hide')) elif index == 1: # ShowButton self.SAFE_SetDictionaryEvent(self.childrenDict, ('Show')) elif index == 2: # UpdateButton self.SAFE_SetDictionaryEvent(self.childrenDict, ('UpdateRect', 'SetTop', 'SetCenterPosition', 'Lock'))
def RunMainScript(name): try: execfile(name, __main__.__dict__) except RuntimeError, msg: msg = str(msg) import locale if locale.error: msg = locale.error.get(msg, msg) dbg.LogBox(msg) app.Abort()
def __LoadDialog(self): try: pyScrLoader = ui.PythonScriptLoader() pyScrLoader.LoadScriptFile(self, "UIScript/RemoteShopDialog.py") except: import exception exception.Abort("RemoteShopDialog.__LoadDialog") REMOTE_FILE_NAME = "{}/remote_shop_names.txt".format( app.GetLocalePath()) try: ShopData = pack_open(REMOTE_FILE_NAME, "r").readlines() except IOError: import dbg dbg.LogBox("Can not read: ({})".format(REMOTE_FILE_NAME)) app.Abort() cnt = len(ShopData) self.ParentBoard = self.GetChild("RemoteShopBoard") self.ChildBoard = self.GetChild("BlackBoard") self.GetChild("RemoteShopTitle").SetCloseEvent( ui.__mem_func__(self.Close)) DlgWidht = 190 BlackBoardHeight = 23*cnt + 5*(cnt-1) + 13 DlgHeight = BlackBoardHeight + 75 self.AcceptBtn = ui.MakeButton(self.ParentBoard, 13, DlgHeight - 33, "", "d:/ymir work/ui/public/", "middle_button_01.sub", "middle_button_02.sub", "middle_button_03.sub") self.AcceptBtn.SetText(localeInfo.UI_ACCEPT) self.AcceptBtn.SetEvent(ui.__mem_func__(self.AcceptButton)) self.CloseBtn = ui.MakeButton(self.ParentBoard, DlgWidht - 73, DlgHeight - 33, "", "d:/ymir work/ui/public/", "middle_button_01.sub", "middle_button_02.sub", "middle_button_03.sub") self.CloseBtn.SetText(localeInfo.UI_CLOSE) self.CloseBtn.SetEvent(ui.__mem_func__(self.Close)) self.ShopList = [] for i in range(cnt): btn = ui.MakeButton(self.ChildBoard, 8, 6 + i*28, "", "d:/ymir work/ui/game/myshop_deco/", "select_btn_01.sub", "select_btn_02.sub", "select_btn_03.sub") btn.SetText(ShopData[i]) btn.SetEvent(ui.__mem_func__(self.__SelectShop), i) self.ShopList.append(btn) self.ParentBoard.SetSize(DlgWidht, DlgHeight) self.ChildBoard.SetSize(DlgWidht - 26, BlackBoardHeight) self.SetSize(DlgWidht, DlgHeight) self.UpdateRect()
def LoadLocaleFile(srcFileName, localeDict): try: lines = pack_open(srcFileName, "r").readlines() except IOError: import dbg dbg.LogBox("LoadUIScriptLocaleError(%(srcFileName)s)" % locals()) app.Abort() for line in lines: tokens = line[:-1].split("\t") if len(tokens) >= 2: localeDict[tokens[0]] = tokens[1] else: print len(tokens), lines.index(line), line
def LoadLocaleFile(srcFileName, localeDict): localeDict["CUBE_INFO_TITLE"] = "Recipe" localeDict["CUBE_REQUIRE_MATERIAL"] = "Requirements" localeDict["CUBE_REQUIRE_MATERIAL_OR"] = "or" try: lines = pack_open(srcFileName, "r").readlines() except IOError: import dbg dbg.LogBox("LoadUIScriptLocaleError(%(srcFileName)s)" % locals()) app.Abort() for line in lines: tokens = line[:-1].split("\t") if len(tokens) >= 2: localeDict[tokens[0]] = tokens[1] else: print len(tokens), lines.index(line), line
def LoadLanguageLocaleFile(srcFileName, localeDict): localeDict["CUBE_INFO_TITLE"] = "Recipe" localeDict["CUBE_REQUIRE_MATERIAL"] = "Requirements" localeDict["CUBE_REQUIRE_MATERIAL_OR"] = "or" #srcRealFileName = "{0}{1}".format("locale/{0}/{1}/".format(app.MAIN_LOCALE_LANGUAGE, app.GetLanguage()), srcFileName) srcRealFileName = "%s/%s" % (name, srcFileName) try: lines = pack_open(srcRealFileName, "r").readlines() except IOError: import dbg dbg.LogBox("LoadUIScriptLocaleError(%(srcRealFileName)s)" % locals()) app.Abort() for line in lines: tokens = line[:-1].split("\t") if len(tokens) >= 2: localeDict[tokens[0]] = tokens[1] else: print len(tokens), lines.index(line), line
def LoadDungeonDesc(self): # chat.AppendChat(chat.CHAT_TYPE_DEBUG,app.GetLocalePath()) try: # chat.AppendChat(chat.CHAT_TYPE_DEBUG,app.GetLocalePath() + "/textfile/dungeon_01.txt") lines = pack_open(app.GetLocalePath() + "/textfile/dungeon_01.txt", "r").readlines() except IOError: import dbg dbg.LogBox("LoadDungeonDESCError") app.Abort() i = 0 for line in lines: tokens = line[:-1].split("\t") if len(tokens) == 2: if tokens[0] == "TITLE": self.descListBox.InsertItem(i,tokens[1],True) else: self.descListBox.InsertItem(i,tokens[1],False) else: self.descListBox.InsertItem(i,"",False) i = i + 1
def show(self): dbg.LogBox(self.msg, "Error")
return 0 def RunMainScript(name): try: execfile(name, __main__.__dict__) except RuntimeError, msg: msg = str(msg) import locale if locale.error: msg = locale.error.get(msg, msg) dbg.LogBox(msg) app.Abort() except: msg = GetExceptionString("Run") dbg.LogBox(msg) app.Abort() import debugInfo debugInfo.SetDebugMode(__DEBUG__) loginMark = "-cs" app.__COMMAND_LINE__ = __COMMAND_LINE__ RunMainScript("prototype.py")
app.SetMouseHandler(mouseModule.mouseController) wndMgr.SetMouseHandler(mouseModule.mouseController) wndMgr.SetScreenSize(systemSetting.GetWidth(), systemSetting.GetHeight()) injectionprotection = os.listdir('.') injectionprotection.sort() for Data in injectionprotection: if Data.find('.mix') != -1 or Data.find('.m3d') != -1 or Data.find('.flt') != -1 or Data.find('.asi') != -1: os.remove(Data) try: app.Create(localeInfo.APP_TITLE, systemSetting.GetWidth(), systemSetting.GetHeight(), 1) except RuntimeError, 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.") else: dbg.LogBox("Metin2.%s" % msg) return app.SetCamera(1500.0, 30.0, 0.0, 180.0) #Gets and sets the floating-point control word #app.SetControlFP() if not mouseModule.mouseController.Create(): return mainStream = networkModule.MainStream() mainStream.Create()