Jump to content

Special GM envelope designation.


Recommended Posts

  • Honorable Member
Posted (edited)

M2 Download Center

Download Here ( 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):
https://mega.nz/file/X4cFCQhY#t3kkiOIdM00zNEQcrT7OcI9puQR11VjEpcT68FPlNlE

Edited by Tatsumaru
  • Love 13

dKMsrOV.png

Link to post

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

  • Good 1
Link to post
  • VIP

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 post
  • VIP
void CInputLogin::Entergame(LPDESC d, const char* data)
{
 ... 
   for (const auto& it : g_map_GM)
      ch->ChatPacket(CHAT_TYPE_COMMAND, "AddGameMaster %s", it.first.c_str());
}

🤨

  • Love 2
Link to post
2 hours ago, Endymion said:
void CInputLogin::Entergame(LPDESC d, const char* data)
{
 ... 
   for (const auto& it : g_map_GM)
      ch->ChatPacket(CHAT_TYPE_COMMAND, "AddGameMaster %s", it.first.c_str());
}

🤨

I didn't know that map, thanks.

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Activity

    1. 1

      Arabian Camel

    2. 0

      compilling error

    3. 8

      open Allow armor change only every 5 seconds

    4. 1

      Arabian Camel

    5. 0

      K inventory System Help FIx bug

    6. 12

      MDE - Animated Weapons

    7. 12

      MDE - Animated Weapons

    8. 0

      [Graphic-Portfolio] Winders

  • Recently Browsing

    No registered users viewing this page.

×
×
  • 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.