Jump to content

Recommended Posts

Dnia 20.11.2018 o 02:58, VegaS™ napisał:

You can do it in a simple way.

  • root/interfaceModule.py
  Odkryj ukrytą treść


#1.1) Search for:
		self.bigBoard = None
#1.2) Add after:
		if app.ENABLE_12ZI:
			self.missionBoard = None

#2.1) Search for:
		self.bigBoard = uiTip.BigBoard()
		self.bigBoard.Hide()
#2.2) Add after:
		if app.ENABLE_12ZI:
			self.missionBoard = uiTip.MissionBoard()
			self.missionBoard.Hide()

#3.1) Search and delete:
		self.__MakeTipBoard()

#4.1) Search for:
		self.__MakeMessengerWindow()
#4.2) Add before:
		self.__MakeTipBoard()	# ENABLE_12ZI Display it below the others ui.

#5.1) Search for:
		del self.wndItemSelect
#5.2) Add after:
		if app.ENABLE_12ZI:
			del self.missionBoard

 

  • root/game.py
  Odkryj ukrytą treść


#1.1) Search for:
	def BINARY_SetBigMessage(self, message):
		self.interface.bigBoard.SetTip(message)
#1.2) Add after:
	if app.ENABLE_12ZI:
		def BINARY_SetMissionMessage(self, message):
			if self.interface:
				self.interface.missionBoard.SetMission(message)
			
		def BINARY_SetSubMissionMessage(self, message):
			if self.interface:
				self.interface.missionBoard.SetSubMission(message)
			
		def BINARY_CleanMissionMessage(self):
			if self.interface:
				self.interface.missionBoard.CleanMission()

 

  • root/uiTip.py
  Odkryj ukrytą treść


#1.1) Search for:
class BigTextBar(TextBar):
	def __init__(self, width, height, fontSize):
		ui.Window.__init__(self)
		self.handle = grp.CreateBigTextBar(width, height, fontSize)

	def __del__(self):
		ui.Window.__del__(self)
		grp.DestroyTextBar(self.handle)
#1.2) Add after:
if app.ENABLE_12ZI:
	class MissionBoard(ui.Bar):
		FONT_HEIGHT	= 15
		LINE_HEIGHT	= FONT_HEIGHT + 5
		STEP_HEIGHT	= LINE_HEIGHT + 5
		LONG_TEXT_START_X	= 300
		SCREEN_WIDTH = wndMgr.GetScreenWidth()
		
		def __init__(self):
			ui.Bar.__init__(self)

			self.AddFlag("not_pick")
			self.missionText = None
			self.missionFullText = None
			self.curPos = 0
			self.dstPos = -5
			self.nextScrollTime = 0
			self.flowMode = False
			self.ScrollStartTime = 0.0

			self.SetPosition(0, 100)
			self.SetSize(self.SCREEN_WIDTH, 35)
			self.SetColor(grp.GenerateColor(0.0, 0.0, 0.0, 0.5))
			self.SetWindowHorizontalAlignCenter()

			self.__CreateTextBar()
			
		def __del__(self):
			ui.Bar.__del__(self)

		def __CreateTextBar(self):
			x, y = self.GetGlobalPosition()

			self.textBar = BigTextBar(self.SCREEN_WIDTH * 2, 300, self.FONT_HEIGHT)
			self.textBar.SetParent(self)
			self.textBar.SetPosition(6, 8)
			self.textBar.SetTextColor(242, 231, 193)
			self.textBar.SetClipRect(0, y, self.SCREEN_WIDTH, y + 8 + self.STEP_HEIGHT)
			self.textBar.Show()

		def CleanMission(self):
			self.missionText = None
			self.missionFullText = None
			self.textBar.ClearBar()
			self.Hide()

		def __RefreshBoard(self):
			self.textBar.ClearBar()

			if self.missionFullText:
				(text_width, text_height) = self.textBar.GetTextExtent(self.missionFullText)
				
				if text_width>self.SCREEN_WIDTH:
					self.textBar.TextOut(0, (self.STEP_HEIGHT - 8 - text_height) / 2, self.missionFullText)
					self.flowMode = True
				else:
					self.textBar.TextOut((wndMgr.GetScreenWidth() - text_width) / 2, (self.STEP_HEIGHT - 8 - text_height) / 2, self.missionFullText)
					self.flowMode = False

		def SetMission(self, text):
			self.__AppendText(text)
			self.__RefreshBoard()

			if self.flowMode:
				self.dstPos = -text_width
				self.curPos = self.LONG_TEXT_START_X
				self.textBar.SetPosition(3 + self.curPos, 8)
			else:
				self.dstPos = 0
				self.curPos = self.STEP_HEIGHT
				self.textBar.SetPosition(3, 8 + self.curPos)
			
			if not self.IsShow():
				self.Show()
				
		def SetSubMission(self, text):
			self.missionFullText = self.missionText + text
			preflowMode = self.flowMode
			
			self.__RefreshBoard()
			
			if preflowMode != self.flowMode:
				if self.flowMode:
					self.dstPos = -text_width
					self.curPos = self.LONG_TEXT_START_X
					self.textBar.SetPosition(3 + self.curPos, 8)
				else:
					self.dstPos = 0
					self.curPos = self.STEP_HEIGHT
					self.textBar.SetPosition(3, 8 + self.curPos)

		def __AppendText(self, text):
			if text == "":
				self.CleanMission()
				return
				
			self.missionText = text
			self.missionFullText = text
			
		def OnUpdate(self):
			if self.missionFullText == None:
				self.Hide()
				return

			if self.dstPos < self.curPos:
				self.curPos -= 1
				if self.flowMode:
					self.textBar.SetPosition(3 + self.curPos, 8)
				else:
					self.textBar.SetPosition(3, 8 + self.curPos)
			else:
				if self.flowMode:
					self.curPos = self.SCREEN_WIDTH

 

Now all what you need is to call them from server > client how you want.


PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_SetMissionMessage", Py_BuildValue("(s)", "#MissionMessage"));	
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_SetSubMissionMessage", Py_BuildValue("(s)", "#SubMissionMessage"));
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_CleanMissionMessage", Py_BuildValue("()"));

You can do a new CHAT_TYPE_UNKNOWN_NAME or like a command, depends of how you want to use it.

  • game/src/unknown_file.cpp
  Odkryj ukrytą treść


ChatPacket(CHAT_TYPE_COMMAND, "SetMissionMessage %s", "VS. Ending Soon");
ChatPacket(CHAT_TYPE_COMMAND, "SetSubMission %s", "VS. is over. The world begins again under...");
ChatPacket(CHAT_TYPE_COMMAND, "CleanMission");

 

  • UserInterface/PythonNetworkStreamCommand.cpp
  Odkryj ukrytą treść


#ifdef ENABLE_12ZI
	else if (!strcmpi(szCmd, "SetMissionMessage"))
	{
		if (2 != TokenVector.size())
		{
			TraceError("CPythonNetworkStream::ServerCommand(c_szCommand=%s) - Strange Parameter Count : %s", c_szCommand);
			return;
		}

		const std::string & c_rstrMessage = TokenVector[1].c_str();
		PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_SetMissionMessage", Py_BuildValue("(s)", c_rstrMessage.c_str()));	
	}
	
	else if (!strcmpi(szCmd, "SetSubMissionMessage"))
	{
		if (2 != TokenVector.size())
		{
			TraceError("CPythonNetworkStream::ServerCommand(c_szCommand=%s) - Strange Parameter Count : %s", c_szCommand);
			return;
		}

		const std::string & c_rstrMessage = TokenVector[1].c_str();
		PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_SetSubMissionMessage", Py_BuildValue("(s)", c_rstrMessage.c_str()));	
	}
	
	else if (!strcmpi(szCmd, "CleanMissionMessage"))
	{
		PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_CleanMissionMessage", Py_BuildValue("()"));	
	}
#endif

 

 

How can i use spacerbar in cmdchat?

cmdchat("SetMissionMessage You_should_kill_Azreael") -- it works

cmdchat("SetMissionMessage You should kill Azreael") -- doesn't work

Link to comment
Share on other sites

  • Forum Moderator
3 hours ago, avertuss said:

How can i use spacerbar in cmdchat?

For this you need extra-shit work without sense in python to split strings, you can use a new CHAT_TYPE as i said in my first post.

If you want for quest, then you have to do a new function like: (This is local function, just for you as player, if you want to send it for all players, let me know and i will post it)

  • notice_mission('Kill all the monsters without dying.")
  • notice_sub_mission("Kill all the monsters")

 

  • Just in source:
Spoiler

	ch->ChatPacket(CHAT_TYPE_MISSION, "Kill all the monsters without dying.");
	ch->ChatPacket(CHAT_TYPE_SUB_MISSION, "Kill all the monsters.");
	ch->ChatPacket(CHAT_TYPE_MISSION, "");

 

  • Src/game/game/src/questlua_global.cpp
Spoiler

//1.1) Search for:
			{	"cmdchat",					_cmdchat				},
//1.2) Add after:
			{	"notice_mission",			_notice_mission			},
			{	"notice_sub_mission",		_notice_sub_mission		},
			
//1.1) Search for:		
	int _get_locale(lua_State* L)
	{
		lua_pushstring(L, g_stLocale.c_str());
		return 1;
	}
//1.2) Add after:
	int _notice_mission(lua_State* L)
	{
		ostringstream s;
		combine_lua_string(L, s);
		CQuestManager::Instance().GetCurrentCharacterPtr()->ChatPacket(CHAT_TYPE_MISSION, "%s", s.str().c_str());
		return 0;
	}

	int _notice_sub_mission(lua_State* L)
	{
		ostringstream s;
		combine_lua_string(L, s);
		CQuestManager::Instance().GetCurrentCharacterPtr()->ChatPacket(CHAT_TYPE_SUB_MISSION, "%s", s.str().c_str());
		return 0;
	}

 

  • Src/game/common/length.h
Spoiler

//1.) Search for:
	CHAT_TYPE_MONARCH_NOTICE,
//1.2) Add after:
#ifdef ENABLE_12ZI
	CHAT_TYPE_MISSION,
	CHAT_TYPE_SUB_MISSION,
#endif

 

  • Src/Client/UserInterface/Packet.h
Spoiler

//1.) Search for:
	CHAT_TYPE_MONARCH_NOTICE,
//1.2) Add after:
#ifdef ENABLE_12ZI
	CHAT_TYPE_MISSION,
	CHAT_TYPE_SUB_MISSION,
#endif

 

  • Src/Client/UserInterface/PythonNetworkStreamPhaseGame.cpp
Spoiler

#ifdef ENABLE_12ZI
		else if (CHAT_TYPE_MISSION == kChat.type)
		{
			if (uChatSize)
				PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_SetMissionMessage", Py_BuildValue("(s)", buf));
			else
				PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_CleanMissionMessage", Py_BuildValue("()"));

		}
		else if (CHAT_TYPE_SUB_MISSION == kChat.type)
		{
			PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_SetSubMissionMessage", Py_BuildValue("(s)", buf));
		}
#endif

 

@avertuss BTW, please stop to quote all of messages, looks very bad, you can use @tagname instead this.

4 minutes ago, Masakra said:

Hi, I'm search this function and c++ part:


	def Over(self):
		wndMgr.Over(self.hWnd)

 

@Masakra This isn't a request topic for official functions, you can do it in this section Questions and Answers.

  • Love 3
Link to comment
Share on other sites

  • 2 years later...

this system breaks root. imgct.py import it into game.py

After import imgct package root and try to open the game and it won't open. You will get a Runmain Error. Undo what you did and the game opens.

All py open NullNullNullNullNullNullNullNullNullNullNullNullNullNullNullNullNullNullNullNullNullNullNull

  • Metin2 Dev 1
Link to comment
Share on other sites

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.