Jump to content

Recommended Posts

  • Honorable Member

M2 Download Center

This is the hidden content, please
( Internal )

Hello everyone.

I reversed something new from the official binary what I would like to share with you.

 

Edit.:

Spoiler

28.10.2021. Update

 

This is the hidden content, please

PS.: Let me know if you found any mistake in the guide.

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 57
  • Eyes 3
  • Confused 1
  • Good 17
  • Love 2
  • Love 48
Link to comment
Share on other sites

  • Honorable Member
24 minutes ago, xP3NG3Rx said:

Ups, I made a mistake :facepalm:.
I'm going to fix it now. I will edit the first post.
Fixxed.

Working flawlessly, good job.
 

so_shower.gif

  • Love 1
Link to comment
Share on other sites

  • Honorable Member

There is the ui12zi.py in the released root files from february, you can check it how it works and make it to yourself.
But in my opinion is: this release is good for developers, who know what they are doing.
If you are beginner of programming or whatever, ask or pay a dev(except me) to implement this resource into your dungeon.

  • Love 1
Link to comment
Share on other sites

  • 3 weeks later...
  • Premium
9 hours ago, notbugme said:

Do I have to press the button to work? How does it work without pressing the button?

Ok, let's say somebody will answer you to that question. But mine is: what the f* you gonna do with it once you know that? You gonna ask for more and more and more. This is not a "how to" topic as penger said above. 

  • Love 1
Link to comment
Share on other sites

15 godzin temu, Caramelito napisał:

Ok, let's say somebody will answer you to that question. But mine is: what the f* you gonna do with it once you know that? You gonna ask for more and more and more. This is not a "how to" topic as penger said above. 

No, I don't want any more. How you work without just pressing the button. Thanks you.

Link to comment
Share on other sites

  • Forum Moderator
On 11/18/2018 at 12:54 PM, Caramelito said:

Will you reverse the noticebar aswell

You can do it in a simple way.

  • root/interfaceModule.py
Spoiler

#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
Spoiler

#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
Spoiler

#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
Spoiler

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
Spoiler

#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

 

 

  • Love 5
Link to comment
Share on other sites

  • Bronze

Or you use the official code like this in CPythonNetworkStream::RecvChatPacket():

 

		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));
		}

Instead of the PythonNetworkStreamCommand  Part

Link to comment
Share on other sites

35 minutes ago, Alpha said:

Or you use the official code like this in CPythonNetworkStream::RecvChatPacket():

 


		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));
		}

Instead of the PythonNetworkStreamCommand  Part

I tried to replace in chat_type_notice your version but the message remain on screen forever...not disappear

 

On vegas version if i put cleanmission it's not work, if I deteled it, it's works but the same problem, message remain forever, not disapper alone

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.