Jump to content

Special GM envelope designation.


Recommended Posts

  • Honorable Member

M2 Download Center

This is the hidden content, please
( Internal )

231812Before.gif231831After.gif

By default, the GM mark in the envelope only appears when the GM writes to us or writes back. This modification will improve this and add a new special envelope.
The solution comes from KoYGeR, a user of this forum.

///SERVER
1.
Open cmd.cpp and add (intuitively, among other acmd lines):

ACMD(do_get_gmlist);

Find this:

	{ "\n",		NULL,			0,			POS_DEAD,	GM_IMPLEMENTOR	}

And add above:

	{ "get_gmlist",	do_get_gmlist,	0,	POS_DEAD,	GM_PLAYER	},

 2. Open cmd_gm.cpp and at the end of the file add:

ACMD(do_get_gmlist)
{
	std::auto_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery("SELECT `mName` FROM `common`.`gmlist`"));

	if (pmsg->Get()->uiNumRows > 0)
	{
		for (int i = 0; i < pmsg->Get()->uiNumRows; i++)
		{
			MYSQL_ROW row = mysql_fetch_row(pmsg->Get()->pSQLResult);
			ch->ChatPacket(CHAT_TYPE_COMMAND, "AddGameMaster %s", row[0]);
		}
	}
	else
	{
		ch->ChatPacket(CHAT_TYPE_INFO, "Nie znaleziono...");
	}
}

 

///CLIENT GAME
3. Open constinfo.py and add (intuitively, without much meaning where):

GM_LIST = []

4. Open game.py and find this:

		net.SendEnterGamePacket()

And add below:

		net.SendChatPacket("/get_gmlist")

Find this:

			"PlayMusic"				: self.__PlayMusic,
			# END_OF_WEDDING

And add below:

			"AddGameMaster"			: self.AddGameMaster,

At the end of the file add:

	def AddGameMaster(self, gmName):
		constInfo.GM_LIST.append(gmName)

5. Open interfacemodule.py and find this:

	def __MakeWhisperButton(self, name):
		whisperButton = uiWhisper.WhisperButton()
		whisperButton.SetUpVisual("d:/ymir work/ui/game/windows/btn_mail_up.sub")
		whisperButton.SetOverVisual("d:/ymir work/ui/game/windows/btn_mail_up.sub")
		whisperButton.SetDownVisual("d:/ymir work/ui/game/windows/btn_mail_up.sub")
		if self.IsGameMasterName(name):
			whisperButton.SetToolTipTextWithColor(name, 0xffffa200)
		else:
			whisperButton.SetToolTipText(name)

And change to this:

	def __MakeWhisperButton(self, name):
		whisperButton = uiWhisper.WhisperButton()
		if name in constInfo.GM_LIST:
			whisperButton.SetUpVisual("d:/ymir work/ui/mail_gm_closed.tga")
			whisperButton.SetOverVisual("d:/ymir work/ui/mail_gm_open.tga")
			whisperButton.SetDownVisual("d:/ymir work/ui/mail_gm_open.tga")
			whisperButton.SetToolTipTextWithColor(name, 0xffffa200)
		else:
			whisperButton.SetUpVisual("d:/ymir work/ui/mail_normal_closed.tga")
			whisperButton.SetOverVisual("d:/ymir work/ui/mail_normal_opend.tga")
			whisperButton.SetDownVisual("d:/ymir work/ui/mail_normal_opend.tga")
			whisperButton.SetToolTipText(name)

6. Open uiwhisper.py and add (intuitively, among other imports):

import constInfo

Find this:

	def AcceptTarget(self):

And at the end of the function add:

		if name in constInfo.GM_LIST:
			self.SetGameMasterLook()

Find this:

	def OpenWithTarget(self, targetName):

And at the end of the function add:

		if targetName in constInfo.GM_LIST:
			self.SetGameMasterLook()

7. Download the envelope and put in your game (etc\ymir work\ui):

This is the hidden content, please

Edited by Tatsumaru
  • Metin2 Dev 57
  • Eyes 1
  • Sad 1
  • Think 1
  • Scream 2
  • Good 14
  • Love 1
  • Love 44

GhwYizE.gif

Link to comment
Share on other sites

I don't think that's a good solution to do a mysql query based on player command, I suggest you to load the gm list at login/warp with quest that's better

 

int pc_register_gamemaster(lua_State * L)
{
	LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
	if (!ch)
		return 0;
	
	std::auto_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery("select `mname` from `common`.`gmlist`"));

	if (pmsg->Get()->uiNumRows > 0)
	{
		for (int i = 0; i < pmsg->Get()->uiNumRows; i++)
		{
			mysql_row row = mysql_fetch_row(pmsg->Get()->pSQLresult);
			ch->ChatPacket(chat_type_command, "addgamemaster %s", row[0]);
		}
	}
	
	return 0;
}
{ "register_gamemaster",		pc_register_gamemaster },

quest register_gamemaster begin
	state start begin
		when login begin
			pc.register_gamemaster()
		end
	end
end

Thanks for the design

 

PS: Why did you convert all to lowercase ? it's unusable like that

  • Metin2 Dev 1
  • Good 1
Link to comment
Share on other sites

Hi, i like the idea. Anyway, the way you tought the logic for it is not ideal. In my opinion you can do this by initializing the selection in LUA when Booting the server and then just refering to the specific memory on Login event.

  • Good 1

As long as I'll be a threat for you , i will always be your target :3

Link to comment
Share on other sites

  • 8 months later...
  • 3 months later...
  • 1 year later...
×
×
  • 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.