Пример #1
0
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()
Пример #2
0
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
Пример #3
0
 def SetButtonEvent(self, name, event):
     try:
         self.gameButtonDict[name].SetEvent(event)
     except Exception, msg:
         print "GameButtonWindow.LoadScript - %s" % (msg)
         app.Abort()
         return
Пример #4
0
class RestartDialog(ui.ScriptWindow):

	def __init__(self):
		ui.ScriptWindow.__init__(self)

	def __del__(self):
		ui.ScriptWindow.__del__(self)

	def LoadDialog(self):
		try:
			pyScrLoader = ui.PythonScriptLoader()
			pyScrLoader.LoadScriptFile(self, "uiscript/restartdialog.py")
		except Exception, msg:
			import sys
			(type, msg, tb)=sys.exc_info()
			dbg.TraceError("RestartDialog.LoadDialog - %s:%s" % (type, msg))
			app.Abort()
			return 0

		try:
			self.restartHereButton=self.GetChild("restart_here_button")
			self.restartTownButton=self.GetChild("restart_town_button")
		except:
			import sys
			(type, msg, tb)=sys.exc_info()
			dbg.TraceError("RestartDialog.LoadDialog - %s:%s" % (type, msg))
			app.Abort()
			return 0

		self.restartHereButton.SetEvent(ui.__mem_func__(self.RestartHere))
		self.restartTownButton.SetEvent(ui.__mem_func__(self.RestartTown))

		return 1
Пример #5
0
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
Пример #6
0
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
Пример #7
0
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
Пример #8
0
 def __LoadWindow(self, filename):
     try:
         pyScrLoader = ui.PythonScriptLoader()
         pyScrLoader.LoadScriptFile(self, filename)
     except Exception, msg:
         import dbg
         dbg.TraceError("GameButtonWindow.LoadScript - %s" % (msg))
         app.Abort()
         return FALSE
Пример #9
0
 def LoadDialog(self):
     try:
         pyScrLoader = ui.PythonScriptLoader()
         pyScrLoader.LoadScriptFile(self, "uiscript/restartdialog.py")
     except Exception, msg:
         (type, msg, tb) = sys.exc_info()
         dbg.TraceError("RestartDialog.LoadDialog - %s:%s" % (type, msg))
         app.Abort()
         return 0
Пример #10
0
 def LoadDialog(self):
     try:
         pyScrLoader = ui.PythonScriptLoader()
         pyScrLoader.LoadScriptFile(self, "interfececolor.py")
     except Exception, msg:
         (type, msg, tb) = sys.exc_info()
         dbg.TraceError("kolorDialog.LoadDialog - %s:%s" % (type, msg))
         app.Abort()
         return 0
Пример #11
0
class kolorDialog(ui.ScriptWindow):
    def __init__(self):
        ui.ScriptWindow.__init__(self)
        self.LoadDialog()

    def __del__(self):
        ui.ScriptWindow.__del__(self)

    def LoadDialog(self):
        try:
            pyScrLoader = ui.PythonScriptLoader()
            pyScrLoader.LoadScriptFile(self, "interfececolor.py")
        except Exception, msg:
            (type, msg, tb) = sys.exc_info()
            dbg.TraceError("kolorDialog.LoadDialog - %s:%s" % (type, msg))
            app.Abort()
            return 0

        try:
            self.zapiszn = self.GetChild("ok")
            self.domyslne = self.GetChild("no")
        except:
            import sys
            (type, msg, tb) = sys.exc_info()
            dbg.TraceError("RestartDialog.LoadDialog - %s:%s" % (type, msg))
            app.Abort()
            return 0

        self.interfacelist2 = (
            self.GetChild("board").Corners[0],
            self.GetChild("board").Corners[1],
            self.GetChild("board").Corners[2],
            self.GetChild("board").Corners[3],
            self.GetChild("board").Lines[0],
            self.GetChild("board").Lines[1],
            self.GetChild("board").Lines[2],
            self.GetChild("board").Lines[3],
            self.GetChild("board").Base,
            self.GetChild("board").titleBar.imgLeft,
            self.GetChild("board").titleBar.imgCenter,
            self.GetChild("board").titleBar.imgRight,
        )
        self.GetChild("board").SetCloseEvent(self.Close)
        self.zapiszn.SetEvent(ui.__mem_func__(self.ok))
        self.domyslne.SetEvent(ui.__mem_func__(self.Restart))
        z = open('lib/color').readlines()
        self.GetChild("r").SetSliderPos(float(z[0]))
        self.GetChild("g").SetSliderPos(float(z[1]))
        self.GetChild("b").SetSliderPos(float(z[2]))
        self.GetChild("a").SetSliderPos((float(z[3]) - 0.5) * 2)
        self.OnUpdate()

        return 1
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()
Пример #13
0
def Abort(excTitle):
    import dbg
    excText = GetExceptionString(excTitle)

    dbg.TraceError(excText)

    import app
    app.Abort()

    import sys
    sys.exit()

    return 0
Пример #14
0
    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
Пример #16
0
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
Пример #17
0
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
Пример #18
0
    def OnUpdate(self):
        if len(self.loadStepList) > 0:
            (progress, runFunc) = self.loadStepList[0]

            try:
                runFunc()
            except:
                self.errMsg.Show()
                self.loadStepList = []

                import dbg
                dbg.TraceError(" !!! Failed to load game data : STEP [%d]" %
                               (progress))
                app.Abort()

                return

            self.loadStepList.pop(0)

            self.__SetProgress(progress)
Пример #19
0
	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
class GameButtonWindow(ui.ScriptWindow):
    def __init__(self):
        ui.ScriptWindow.__init__(self)
        self.__LoadWindow("UIScript/gamewindow.py")
        self.interface = interfacemodule.Interface()

    def __del__(self):
        ui.ScriptWindow.__del__(self)

    def __LoadWindow(self, filename):
        try:
            pyScrLoader = ui.PythonScriptLoader()
            pyScrLoader.LoadScriptFile(self, filename)
        except Exception, msg:
            import dbg
            dbg.TraceError("GameButtonWindow.LoadScript - %s" % (msg))
            app.Abort()
            return False

        try:
            self.gameButtonDict = {
                "STATUS": self.GetChild("StatusPlusButton"),
                "SKILL": self.GetChild("SkillPlusButton"),
                "QUEST": self.GetChild("QuestButton"),
                "HELP": self.GetChild("HelpButton"),
                "BUILD": self.GetChild("BuildGuildBuilding"),
                "EXIT_OBSERVER": self.GetChild("ExitObserver"),
                "GIFT": self.GetChild("GiftIcon"),
            }

            self.gameButtonDict["EXIT_OBSERVER"].SetEvent(
                ui.__mem_func__(self.__OnClickExitObserver))
            self.GetChild("AchievementButton").SetEvent(
                ui.__mem_func__(self.__ClickOpenAchievementButton))

        except Exception, msg:
            import dbg
            dbg.TraceError("GameButtonWindow.LoadScript - %s" % (msg))
            app.Abort()
            return False
Пример #21
0
class GameButtonWindow(ui.ScriptWindow):
	def __init__(self):
		ui.ScriptWindow.__init__(self)
		self.__LoadWindow("UIScript/gamewindow.py")

	def __del__(self):
		ui.ScriptWindow.__del__(self)

	def __LoadWindow(self, filename):
		try:
			pyScrLoader = ui.PythonScriptLoader()
			pyScrLoader.LoadScriptFile(self, filename)
		except Exception, msg:
			import dbg
			dbg.TraceError("GameButtonWindow.LoadScript - %s" % (msg))
			app.Abort()
			return False

		try:
			self.gameButtonDict={
				"STATUS" : self.GetChild("StatusPlusButton"),
				"SKILL" : self.GetChild("SkillPlusButton"),
				"QUEST" : self.GetChild("QuestButton"),
				"HELP" : self.GetChild("HelpButton"),
				"BUILD" : self.GetChild("BuildGuildBuilding"),
				"EXIT_OBSERVER" : self.GetChild("ExitObserver"),
			}

			if app.ENABLE_OFFLINE_SHOP:
				self.gameButtonDict.update({"EXIT_MOVESHOP"	: self.GetChild("ExitMoveShop")})

			self.gameButtonDict["EXIT_OBSERVER"].SetEvent(ui.__mem_func__(self.__OnClickExitObserver))
			if app.ENABLE_OFFLINE_SHOP:
				self.gameButtonDict["EXIT_MOVESHOP"].SetEvent(ui.__mem_func__(self.__OnClickExitMoveShop))

		except Exception, msg:
			import dbg
			dbg.TraceError("GameButtonWindow.LoadScript - %s" % (msg))
			app.Abort()
			return False
Пример #22
0
        def __CreateDialog(self):
            try:
                pyScrLoader = ui.PythonScriptLoader()
                pyScrLoader.LoadScriptFile(self, "uiscript/shopinputdialog.py")

                getObject = self.GetChild
                self.board = getObject("Board")
                self.acceptButton = getObject("AcceptButton")
                self.cancelButton = getObject("CancelButton")
                self.inputSlot = getObject("InputSlot")
                self.inputValue = getObject("InputValue")

                self.colorDesc = getObject("ColorDesc")
                self.colorBG = getObject("ColorBG")
                for i in range(1, 7):
                    self.tabList["colorTab%d" % i] = getObject("ColorTab%d" %
                                                               i)
                    self.tabList["colorTab%d" % i].SetEvent(
                        ui.__mem_func__(self.CheckButtonStatus), i, "color")
                    self.tabList["colorTab%d" % i].Hide()

                    self.tabList["sizeTab%d" % i] = getObject("SizeTab%d" % i)
                    self.tabList["sizeTab%d" % i].SetEvent(
                        ui.__mem_func__(self.CheckButtonStatus), i, "size")

                    self.tabList["typeTab%d" % i] = getObject("TypeTab%d" % i)
                    self.tabList["typeTab%d" % i].SetEvent(
                        ui.__mem_func__(self.CheckButtonStatus), i, "type")
                self.colorDesc.Hide()
                self.colorBG.Hide()

            except:
                import sys
                (type, msg, tb) = sys.exc_info()
                dbg.TraceError("ShopInputDialog.__CreateDialog - %s:%s" %
                               (type, msg))
                app.Abort()
                return 0
Пример #23
0
 def Close(self):
     app.Abort()
def ShowException(excTitle):
    excText = GetExceptionString(excTitle)
    dbg.TraceError(excText)
    app.Abort()

    return 0
    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")