[Python] Management graphic mode

01/04/2017 02:38 VegaS ♆#1
[Only registered and activated users can see links. Click Here To Register...]

One guy asked in one forum if it possible to do this (already he have in settings to disable/enable via shift+f12 but is shit for player ^^, so i was think is nice to post and here my shit code what i was make for him free.

Graphic mode you can find here (already is public from long years ago and you can find him in a lot a forums): [You need to extract all files from archive in directory where is launcher]

Code:
#root/uiSystem.py:
#1.) Search:
	def OnPressExitKey(self):
		self.Close()
		return TRUE
#2.) Add after function:
	if app.ENABLE_GRAPHIC_MODE:
###################################################################
# title_name        : Features for graphic mode
# date_created      : 2017.01.04
# author            : VegaS
###################################################################
		def IsActiveModeGraphic(self):
			idx = open("enbconvertor.ini", "r").readlines()

			if int(idx[1][-2]) > 0:
				return TRUE

			return FALSE

		def __ClickSystemModeButton(self):
			import dbg, os, app, localeInfo

			if self.IsActiveModeGraphic():
				dam = 0
			else:
				dam = 1

			idxCurMode = "EnableProxyLibrary=%d" % (dam)
			f = []
			getLine = 2

			if os.path.exists("enbconvertor.ini"):
				idx = open("enbconvertor.ini", "r")

				for it in idx:
					f.append(it)
				idx.close()

			while len(f) < int(getLine):
				f.append("")

			f[int(getLine)-1] = str(idxCurMode)
			idx = open("enbconvertor.ini", "w")

			for it in f:
				idx.write(it)
				if (len(it) > 0 and it[-1:] != "\n") or len(it) == 0:
					idx.write("\n")

			idx.close()
			self.Close()

			if dam > 0:
				dbg.LogBox(localeInfo.GRAPHIC_MODE_ENABLE)
			else:
				dbg.LogBox(localeInfo.GRAPHIC_MODE_DISABLE)

			dbg.LogBox(localeInfo.GRAPHIC_MODE_RESTART)
			os.system('start metin2client.exe') ### Change with your name of application.
			app.Exit()
			
#1.) Search:
		self.GetChild("exit_button").SAFE_SetEvent(self.__ClickExitButton)
#2.) Add bellow:
		if app.ENABLE_GRAPHIC_MODE:
			self.GetChild("system_mode_button").SAFE_SetEvent(self.__ClickSystemModeButton)

#locale/en/locale_game.txt:
GRAPHIC_MODE_ENABLE	[i] The graphic mode was enabled.
GRAPHIC_MODE_DISABLE	[i] The graphic mode was disabled.
GRAPHIC_MODE_RESTART	[i] Client will restart.

#locale/en/ui/systemdialog.py
				{
					"name" : "system_mode_button",
					"type" : "button",
					"x" : 10, # Position X
					"y" : 5, # Position Y
					"text" : "Graphic Mode (Enable/Disable)",
					"default_image" : ROOT + "XLarge_Button_01.sub",
					"over_image" : ROOT + "XLarge_Button_02.sub",
					"down_image" : ROOT + "XLarge_Button_03.sub",
				},
				
//@Src/Client/UserInterface/Locale_inc.h
#define ENABLE_GRAPHIC_MODE

//@Src/Client/UserInterface/PythonApplicationModule.cpp
//1.) Search:
#ifdef ENABLE_COSTUME_SYSTEM
	PyModule_AddIntConstant(poModule, "ENABLE_COSTUME_SYSTEM",	1);
#else
	PyModule_AddIntConstant(poModule, "ENABLE_COSTUME_SYSTEM",	0);
#endif
//2.) Add bellow:
#ifdef ENABLE_GRAPHIC_MODE
	PyModule_AddIntConstant(poModule, "ENABLE_GRAPHIC_MODE",	1);
#else
	PyModule_AddIntConstant(poModule, "ENABLE_GRAPHIC_MODE",	0);
#endif
01/04/2017 11:18 Bekir Akdemir#2
how can i edit enb effect ?
01/05/2017 01:41 悪地城#3
The Code looks good, and definitely helpfull :)

Thanks for the RLS
01/14/2017 07:12 Sanielito32#4
Thanks for the release, very nice.
01/14/2017 17:45 FCPorto15#5
on my i have this error ??

0114 17:41:13775 :: KeyError
0114 17:41:13775 :: :
0114 17:41:13775 :: 'system_mode_button'
0114 17:41:13775 ::