Global Chat V2 System

Metin2Hub Bot
M2Hub Bot
Feb
Threads
65
2,066
2
903
113
HubMoney
1,274

M2 Download Center

( Internal )


Hello,

global chat + color empire with chat is by Denis. thx.

1) Enable global chat

Open input_p2p.cpp
Search :



Quote



if (!d->GetCharacter() || (d->GetCharacter()->GetGMLevel() == GM_PLAYER && d->GetEmpire() != m_bEmpire))

Replace with it:


Quote



if (!d->GetCharacter())

If you use novaline, search:


Quote





// ADDED GLOBAL SHOUT OPTION
if (!d->GetCharacter())
return;

if(!g_bGlobalShoutEnable && (d->GetCharacter()->GetGMLevel() == GM_PLAYER && d->GetEmpire() != m_bEmpire))
return;

And replace with it:


Quote





if (!d->GetCharacter())
return;


2) Add chat functions

Open input_main.cpp
Search:


Quote





if (pinfo->type == CHAT_TYPE_SHOUT)
{
const int SHOUT_LIMIT_LEVEL = 15;

if (ch->GetLevel() < SHOUT_LIMIT_LEVEL)
{
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("외치기는 레벨 %d 이상만 사용 가능 합니다."), SHOUT_LIMIT_LEVEL);
return (iExtraLen);
}

if (thecore_heart->pulse - (int) ch->GetLastShoutPulse() < passes_per_sec * 15)
return (iExtraLen);

ch->SetLastShoutPulse(thecore_heart->pulse);

TPacketGGShout p;

p.bHeader = HEADER_GG_SHOUT;
p.bEmpire = ch->GetEmpire();
strlcpy(p.szText, chatbuf, sizeof(p.szText));

P2P_MANAGER::instance().Send(&p, sizeof(TPacketGGShout));

SendShout(chatbuf, ch->GetEmpire());

return (iExtraLen);
}

Replace with it:


Quote





if (pinfo->type == CHAT_TYPE_SHOUT)
{
const int SHOUT_LIMIT_LEVEL = 15;

if (ch->GetLevel() < SHOUT_LIMIT_LEVEL)
{
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("외치기는 레벨 %d 이상만 사용 가능 합니다."), SHOUT_LIMIT_LEVEL);
return (iExtraLen);
}

if (thecore_heart->pulse - (int) ch->GetLastShoutPulse() < passes_per_sec * 15)
return (iExtraLen);

ch->SetLastShoutPulse(thecore_heart->pulse);

const char* kingdoms[4] = {"|cFF47DA00|H|h[GameMaster]|cFFA7FFD4|H|h","|cFFff0000|H|h[shinsoo]|cFFA7FFD4|H|h","|cFFFFFF00|H|h[Chunjo]|cFFA7FFD4|H|h","|cFF0080FF|H|h[Jinno]|cFFA7FFD4|H|h"};
char chatbuf_global[CHAT_MAX_LEN + 1];
int my_level = ch->GetLevel();
if (gSpecialShout == 1)
{
if (ch->GetGMLevel() != GM_PLAYER)
{
if (MasterGhostChat == 1)
{
int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s : %s",kingdoms[0], buf);
}
else
{
if ((MasterColorEmpire == 1) and (MasterLevelChat == 0))
{
int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s %s : %s",ch->GetName(), kingdoms[ch->GetEmpire()], buf);
}
else if ((MasterColorEmpire == 1) and (MasterLevelChat == 1))
{
int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s %s [%d] : %s",ch->GetName(), kingdoms[ch->GetEmpire()], my_level, buf);
}
else if ((MasterColorEmpire == 0) and (MasterLevelChat == 1))
{
int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s [%d] : %s",ch->GetName(), my_level, buf);
}
else
{
int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s : %s",ch->GetName(), buf);
}
}
}
else
{
if ((PlayerColorEmpire == 1) and (PlayerLevelChat == 0))
{
int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s %s : %s",ch->GetName(), kingdoms[ch->GetEmpire()], buf);
}
else if ((PlayerColorEmpire == 1) and (PlayerLevelChat == 1))
{
int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s %s [%d] : %s",ch->GetName(), kingdoms[ch->GetEmpire()], my_level, buf);
}
else if ((PlayerColorEmpire == 0) and (PlayerLevelChat == 1))
{
int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s [%d] : %s",ch->GetName(), my_level, buf);
}
else
{
int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s : %s",ch->GetName(), buf);
}
}
}
else
{
int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s : %s",ch->GetName(), buf);
}

TPacketGGShout p;

p.bHeader = HEADER_GG_SHOUT;
p.bEmpire = ch->GetEmpire();
strlcpy(p.szText, chatbuf_global, sizeof(p.szText));
P2P_MANAGER::instance().Send(&p, sizeof(TPacketGGShout));

SendShout(chatbuf_global, ch->GetEmpire());

return (iExtraLen);
}


3) Add config function

Open config.cpp
Search:



Quote



int gShutdownEnable = 0;



Add after:


Quote





int gSpecialShout = 0;
int MasterGhostChat = 0;
int MasterColorEmpire = 0;
int MasterLevelChat = 0;
int PlayerColorEmpire = 0;
int PlayerLevelChat = 0;



Next search:


Quote





TOKEN("empire_whisper")
{
bool b_value = 0;
str_to_number(b_value, value_string);
g_bEmpireWhisper = !!b_value;
continue;
}

Add after:


Quote





TOKEN("special_shout")
{
str_to_number(gSpecialShout, value_string);
continue;
}

TOKEN("gm_ghost_shout")
{
str_to_number(MasterGhostChat, value_string);
continue;
}

TOKEN("gm_empire_shout")
{
str_to_number(MasterColorEmpire, value_string);
continue;
}

TOKEN("gm_level_shout")
{
str_to_number(MasterLevelChat, value_string);
continue;
}

TOKEN("player_empire_shout")
{
str_to_number(PlayerColorEmpire, value_string);
continue;
}

TOKEN("player_level_shout")
{
str_to_number(PlayerLevelChat, value_string);
continue;
}

Now open config.h
Search:


Quote



extern int gPlayerMaxLevel;

And add before:


Quote





extern int gSpecialShout;
extern int MasterGhostChat;
extern int MasterColorEmpire;
extern int MasterLevelChat;
extern int PlayerColorEmpire;
extern int PlayerLevelChat;


4) Game CONFIG

Open your CONFIG game and add:



Quote





special_shout: 1
gm_ghost_shout: 1
gm_empire_shout: 1
gm_level_shout: 1
player_empire_shout: 1
player_level_shout: 1

=


Quote





special_shout - (0/1 Enable special chat functions) - default 0
gm_ghost_shout - (0/1 Enable GM Ghost chat [GM chat is only [GameMaster] : text]) - default 0
gm_empire_shout - (0/1 Enable GM empire with chat - only if gm_ghost_shout = 0) - default 0
gm_level_shout - (0/1 Enable GM level with chat - only if gm_ghost_shout = 0) - default 0
player_empire_shout - (0/1 Enable empire with player chat) - default 0
player_level_shout - (0/1 Enable level with player chat) - default 0

10645171_752331338157650_556482299165462


That's all, sorry for my bad english
🙂

Thx : Denis, Domco
 
Metin2Hub Bot
M2Hub Bot
Feb
Threads
65
2,066
2
903
113
HubMoney
1,274

M2 Download Center

( Internal )


Hello,

global chat + color empire with chat is by Denis. thx.

1) Enable global chat

Open input_p2p.cpp
Search :



Quote



if (!d->GetCharacter() || (d->GetCharacter()->GetGMLevel() == GM_PLAYER && d->GetEmpire() != m_bEmpire))

Replace with it:


Quote



if (!d->GetCharacter())

If you use novaline, search:


Quote





// ADDED GLOBAL SHOUT OPTION
if (!d->GetCharacter())
return;

if(!g_bGlobalShoutEnable && (d->GetCharacter()->GetGMLevel() == GM_PLAYER && d->GetEmpire() != m_bEmpire))
return;

And replace with it:


Quote





if (!d->GetCharacter())
return;


2) Add chat functions

Open input_main.cpp
Search:


Quote





if (pinfo->type == CHAT_TYPE_SHOUT)
{
const int SHOUT_LIMIT_LEVEL = 15;

if (ch->GetLevel() < SHOUT_LIMIT_LEVEL)
{
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("외치기는 레벨 %d 이상만 사용 가능 합니다."), SHOUT_LIMIT_LEVEL);
return (iExtraLen);
}

if (thecore_heart->pulse - (int) ch->GetLastShoutPulse() < passes_per_sec * 15)
return (iExtraLen);

ch->SetLastShoutPulse(thecore_heart->pulse);

TPacketGGShout p;

p.bHeader = HEADER_GG_SHOUT;
p.bEmpire = ch->GetEmpire();
strlcpy(p.szText, chatbuf, sizeof(p.szText));

P2P_MANAGER::instance().Send(&p, sizeof(TPacketGGShout));

SendShout(chatbuf, ch->GetEmpire());

return (iExtraLen);
}

Replace with it:


Quote





if (pinfo->type == CHAT_TYPE_SHOUT)
{
const int SHOUT_LIMIT_LEVEL = 15;

if (ch->GetLevel() < SHOUT_LIMIT_LEVEL)
{
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("외치기는 레벨 %d 이상만 사용 가능 합니다."), SHOUT_LIMIT_LEVEL);
return (iExtraLen);
}

if (thecore_heart->pulse - (int) ch->GetLastShoutPulse() < passes_per_sec * 15)
return (iExtraLen);

ch->SetLastShoutPulse(thecore_heart->pulse);

const char* kingdoms[4] = {"|cFF47DA00|H|h[GameMaster]|cFFA7FFD4|H|h","|cFFff0000|H|h[shinsoo]|cFFA7FFD4|H|h","|cFFFFFF00|H|h[Chunjo]|cFFA7FFD4|H|h","|cFF0080FF|H|h[Jinno]|cFFA7FFD4|H|h"};
char chatbuf_global[CHAT_MAX_LEN + 1];
int my_level = ch->GetLevel();
if (gSpecialShout == 1)
{
if (ch->GetGMLevel() != GM_PLAYER)
{
if (MasterGhostChat == 1)
{
int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s : %s",kingdoms[0], buf);
}
else
{
if ((MasterColorEmpire == 1) and (MasterLevelChat == 0))
{
int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s %s : %s",ch->GetName(), kingdoms[ch->GetEmpire()], buf);
}
else if ((MasterColorEmpire == 1) and (MasterLevelChat == 1))
{
int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s %s [%d] : %s",ch->GetName(), kingdoms[ch->GetEmpire()], my_level, buf);
}
else if ((MasterColorEmpire == 0) and (MasterLevelChat == 1))
{
int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s [%d] : %s",ch->GetName(), my_level, buf);
}
else
{
int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s : %s",ch->GetName(), buf);
}
}
}
else
{
if ((PlayerColorEmpire == 1) and (PlayerLevelChat == 0))
{
int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s %s : %s",ch->GetName(), kingdoms[ch->GetEmpire()], buf);
}
else if ((PlayerColorEmpire == 1) and (PlayerLevelChat == 1))
{
int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s %s [%d] : %s",ch->GetName(), kingdoms[ch->GetEmpire()], my_level, buf);
}
else if ((PlayerColorEmpire == 0) and (PlayerLevelChat == 1))
{
int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s [%d] : %s",ch->GetName(), my_level, buf);
}
else
{
int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s : %s",ch->GetName(), buf);
}
}
}
else
{
int len_global = snprintf(chatbuf_global, sizeof(chatbuf_global), "%s : %s",ch->GetName(), buf);
}

TPacketGGShout p;

p.bHeader = HEADER_GG_SHOUT;
p.bEmpire = ch->GetEmpire();
strlcpy(p.szText, chatbuf_global, sizeof(p.szText));
P2P_MANAGER::instance().Send(&p, sizeof(TPacketGGShout));

SendShout(chatbuf_global, ch->GetEmpire());

return (iExtraLen);
}


3) Add config function

Open config.cpp
Search:



Quote



int gShutdownEnable = 0;



Add after:


Quote





int gSpecialShout = 0;
int MasterGhostChat = 0;
int MasterColorEmpire = 0;
int MasterLevelChat = 0;
int PlayerColorEmpire = 0;
int PlayerLevelChat = 0;



Next search:


Quote





TOKEN("empire_whisper")
{
bool b_value = 0;
str_to_number(b_value, value_string);
g_bEmpireWhisper = !!b_value;
continue;
}

Add after:


Quote





TOKEN("special_shout")
{
str_to_number(gSpecialShout, value_string);
continue;
}

TOKEN("gm_ghost_shout")
{
str_to_number(MasterGhostChat, value_string);
continue;
}

TOKEN("gm_empire_shout")
{
str_to_number(MasterColorEmpire, value_string);
continue;
}

TOKEN("gm_level_shout")
{
str_to_number(MasterLevelChat, value_string);
continue;
}

TOKEN("player_empire_shout")
{
str_to_number(PlayerColorEmpire, value_string);
continue;
}

TOKEN("player_level_shout")
{
str_to_number(PlayerLevelChat, value_string);
continue;
}

Now open config.h
Search:


Quote



extern int gPlayerMaxLevel;

And add before:


Quote





extern int gSpecialShout;
extern int MasterGhostChat;
extern int MasterColorEmpire;
extern int MasterLevelChat;
extern int PlayerColorEmpire;
extern int PlayerLevelChat;


4) Game CONFIG

Open your CONFIG game and add:



Quote





special_shout: 1
gm_ghost_shout: 1
gm_empire_shout: 1
gm_level_shout: 1
player_empire_shout: 1
player_level_shout: 1

=


Quote





special_shout - (0/1 Enable special chat functions) - default 0
gm_ghost_shout - (0/1 Enable GM Ghost chat [GM chat is only [GameMaster] : text]) - default 0
gm_empire_shout - (0/1 Enable GM empire with chat - only if gm_ghost_shout = 0) - default 0
gm_level_shout - (0/1 Enable GM level with chat - only if gm_ghost_shout = 0) - default 0
player_empire_shout - (0/1 Enable empire with player chat) - default 0
player_level_shout - (0/1 Enable level with player chat) - default 0

10645171_752331338157650_556482299165462


That's all, sorry for my bad english
🙂

Thx : Denis, Domco

Hello dear user,

Your post will be under surveillance by bots for the next few hours.

Forum description : Metin2 private server, Metin2 download, Metin2 support, Metin2 Forum, Metin2 Pvp Servers, Errors, Bugs, Requests, Metin2 Pvp Forum, Everything About Metin2.
 
Top