various changed to chatchannel and using language / language skills derived from takp code.

This commit is contained in:
regneq 2019-07-14 20:03:30 -07:00
parent 6bdc9b6ba5
commit 460468224e
15 changed files with 116 additions and 88 deletions

View File

@ -523,4 +523,25 @@ static const uint8 SkillDamageTypes[EQEmu::skills::HIGHEST_SKILL + 1] = // chang
static const uint32 MAX_SPELL_DB_ID_VAL = 65535; static const uint32 MAX_SPELL_DB_ID_VAL = 65535;
enum ChatChannelNames : uint16
{
ChatChannel_Guild = 0,
ChatChannel_Group = 2,
ChatChannel_Shout = 3,
ChatChannel_Auction = 4,
ChatChannel_OOC = 5,
ChatChannel_Broadcast = 6,
ChatChannel_Tell = 7,
ChatChannel_Say = 8,
ChatChannel_Petition = 10,
ChatChannel_GMSAY = 11,
ChatChannel_TellEcho = 14,
ChatChannel_Raid = 15,
ChatChannel_UNKNOWN_Guild = 17,
ChatChannel_UNKNOWN_GMSAY = 18,
ChatChannel_UCSRelay = 20,
ChatChannel_Emotes = 22
};
#endif /*COMMON_EQ_CONSTANTS_H*/ #endif /*COMMON_EQ_CONSTANTS_H*/

View File

@ -352,7 +352,8 @@ struct ServerChannelMessage_Struct {
bool noreply; bool noreply;
uint16 chan_num; uint16 chan_num;
uint32 guilddbid; uint32 guilddbid;
uint16 language; uint8 language;
uint8 lang_skill;
uint8 queued; // 0 = not queued, 1 = queued, 2 = queue full, 3 = offline uint8 queued; // 0 = not queued, 1 = queued, 2 = queue full, 3 = offline
char message[0]; char message[0];
}; };
@ -865,6 +866,8 @@ struct ServerRaidGroupAction_Struct { //add / remove depends on opcode.
struct ServerRaidMessage_Struct { struct ServerRaidMessage_Struct {
uint32 rid; uint32 rid;
uint32 gid; uint32 gid;
uint8 language;
uint8 lang_skill;
char from[64]; char from[64];
char message[0]; char message[0];
}; };

View File

@ -409,12 +409,12 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
if (pack->size < sizeof(ServerChannelMessage_Struct)) if (pack->size < sizeof(ServerChannelMessage_Struct))
break; break;
ServerChannelMessage_Struct* scm = (ServerChannelMessage_Struct*)pack->pBuffer; ServerChannelMessage_Struct* scm = (ServerChannelMessage_Struct*)pack->pBuffer;
if (scm->chan_num == 20) if (scm->chan_num == ChatChannel_UCSRelay)
{ {
UCSLink.SendMessage(scm->from, scm->message); UCSLink.SendMessage(scm->from, scm->message);
break; break;
} }
if (scm->chan_num == 7 || scm->chan_num == 14) { if (scm->chan_num == ChatChannel_Tell || scm->chan_num == ChatChannel_TellEcho) {
if (scm->deliverto[0] == '*') { if (scm->deliverto[0] == '*') {
if (console) { if (console) {
@ -486,7 +486,8 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
cle->Server()->SendPacket(pack); cle->Server()->SendPacket(pack);
} }
else { else {
if (scm->chan_num == 5 || scm->chan_num == 6 || scm->chan_num == 11) { if (scm->chan_num == ChatChannel_OOC || scm->chan_num == ChatChannel_Broadcast
|| scm->chan_num == ChatChannel_GMSAY) {
if (console) { if (console) {
console->SendChannelMessage(scm, [&scm]() { console->SendChannelMessage(scm, [&scm]() {
auto pack = new ServerPacket(ServerOP_ChannelMessage, auto pack = new ServerPacket(ServerOP_ChannelMessage,

View File

@ -823,7 +823,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
{ {
if(strcmp(targetname, "discard") != 0) if(strcmp(targetname, "discard") != 0)
{ {
if(chan_num == 3 || chan_num == 4 || chan_num == 5 || chan_num == 7) if(chan_num == ChatChannel_Shout || chan_num == ChatChannel_Auction || chan_num == ChatChannel_OOC || chan_num == ChatChannel_Tell)
{ {
if(GlobalChatLimiterTimer) if(GlobalChatLimiterTimer)
{ {
@ -869,7 +869,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
auto pack = new ServerPacket(ServerOP_Speech, sizeof(Server_Speech_Struct) + strlen(message) + 1); auto pack = new ServerPacket(ServerOP_Speech, sizeof(Server_Speech_Struct) + strlen(message) + 1);
Server_Speech_Struct* sem = (Server_Speech_Struct*) pack->pBuffer; Server_Speech_Struct* sem = (Server_Speech_Struct*) pack->pBuffer;
if(chan_num == 0) if(chan_num == ChatChannel_Guild)
sem->guilddbid = GuildID(); sem->guilddbid = GuildID();
else else
sem->guilddbid = 0; sem->guilddbid = 0;
@ -892,30 +892,38 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
if(!mod_client_message(message, chan_num)) { return; } if(!mod_client_message(message, chan_num)) { return; }
// Garble the message based on drunkness // Garble the message based on drunkness
if (m_pp.intoxication > 0) { if (m_pp.intoxication > 0 && !(RuleB(Chat, ServerWideOOC) && chan_num == ChatChannel_OOC) && !GetGM()) {
GarbleMessage(message, (int)(m_pp.intoxication / 3)); GarbleMessage(message, (int)(m_pp.intoxication / 3));
language = 0; // No need for language when drunk language = 0; // No need for language when drunk
lang_skill = 100;
}
// some channels don't use languages
if (chan_num == ChatChannel_OOC || chan_num == ChatChannel_GMSAY || chan_num == ChatChannel_Broadcast || chan_num == ChatChannel_Petition)
{
language = 0;
lang_skill = 100;
} }
// Censor the message // Censor the message
if (EQEmu::ProfanityManager::IsCensorshipActive() && (chan_num != 8)) if (EQEmu::ProfanityManager::IsCensorshipActive() && (chan_num != ChatChannel_Say))
EQEmu::ProfanityManager::RedactMessage(message); EQEmu::ProfanityManager::RedactMessage(message);
switch(chan_num) switch(chan_num)
{ {
case 0: { /* Guild Chat */ case ChatChannel_Guild: { /* Guild Chat */
if (!IsInAGuild()) if (!IsInAGuild())
Message_StringID(MT_DefaultText, GUILD_NOT_MEMBER2); //You are not a member of any guild. Message_StringID(MT_DefaultText, GUILD_NOT_MEMBER2); //You are not a member of any guild.
else if (!guild_mgr.CheckPermission(GuildID(), GuildRank(), GUILD_SPEAK)) else if (!guild_mgr.CheckPermission(GuildID(), GuildRank(), GUILD_SPEAK))
Message(0, "Error: You dont have permission to speak to the guild."); Message(0, "Error: You dont have permission to speak to the guild.");
else if (!worldserver.SendChannelMessage(this, targetname, chan_num, GuildID(), language, message)) else if (!worldserver.SendChannelMessage(this, targetname, chan_num, GuildID(), language, lang_skill, message))
Message(0, "Error: World server disconnected"); Message(0, "Error: World server disconnected");
break; break;
} }
case 2: { /* Group Chat */ case ChatChannel_Group: { /* Group Chat */
Raid* raid = entity_list.GetRaidByClient(this); Raid* raid = entity_list.GetRaidByClient(this);
if(raid) { if(raid) {
raid->RaidGroupSay((const char*) message, this); raid->RaidGroupSay((const char*) message, this, language, lang_skill);
break; break;
} }
@ -925,14 +933,14 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
} }
break; break;
} }
case 15: { /* Raid Say */ case ChatChannel_Raid: { /* Raid Say */
Raid* raid = entity_list.GetRaidByClient(this); Raid* raid = entity_list.GetRaidByClient(this);
if(raid){ if(raid){
raid->RaidSay((const char*) message, this); raid->RaidSay((const char*) message, this, language, lang_skill);
} }
break; break;
} }
case 3: { /* Shout */ case ChatChannel_Shout: { /* Shout */
Mob *sender = this; Mob *sender = this;
if (GetPet() && GetTarget() == GetPet() && GetPet()->FindType(SE_VoiceGraft)) if (GetPet() && GetTarget() == GetPet() && GetPet()->FindType(SE_VoiceGraft))
sender = GetPet(); sender = GetPet();
@ -940,13 +948,13 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
entity_list.ChannelMessage(sender, chan_num, language, lang_skill, message); entity_list.ChannelMessage(sender, chan_num, language, lang_skill, message);
break; break;
} }
case 4: { /* Auction */ case ChatChannel_Auction: { /* Auction */
if(RuleB(Chat, ServerWideAuction)) if(RuleB(Chat, ServerWideAuction))
{ {
if(!global_channel_timer.Check()) if(!global_channel_timer.Check())
{ {
if(strlen(targetname) == 0) if(strlen(targetname) == 0)
ChannelMessageReceived(5, language, lang_skill, message, "discard"); //Fast typer or spammer?? ChannelMessageReceived(chan_num, language, lang_skill, message, "discard"); //Fast typer or spammer??
else else
return; return;
} }
@ -966,7 +974,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
} }
} }
if (!worldserver.SendChannelMessage(this, 0, 4, 0, language, message)) if (!worldserver.SendChannelMessage(this, 0, chan_num, 0, language, lang_skill, message))
Message(0, "Error: World server disconnected"); Message(0, "Error: World server disconnected");
} }
else if(!RuleB(Chat, ServerWideAuction)) { else if(!RuleB(Chat, ServerWideAuction)) {
@ -975,17 +983,17 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
if (GetPet() && GetTarget() == GetPet() && GetPet()->FindType(SE_VoiceGraft)) if (GetPet() && GetTarget() == GetPet() && GetPet()->FindType(SE_VoiceGraft))
sender = GetPet(); sender = GetPet();
entity_list.ChannelMessage(sender, chan_num, language, message); entity_list.ChannelMessage(sender, chan_num, language, lang_skill, message);
} }
break; break;
} }
case 5: { /* OOC */ case ChatChannel_OOC: { /* OOC */
if(RuleB(Chat, ServerWideOOC)) if(RuleB(Chat, ServerWideOOC))
{ {
if(!global_channel_timer.Check()) if(!global_channel_timer.Check())
{ {
if(strlen(targetname) == 0) if(strlen(targetname) == 0)
ChannelMessageReceived(5, language, lang_skill, message, "discard"); //Fast typer or spammer?? ChannelMessageReceived(chan_num, language, lang_skill, message, "discard"); //Fast typer or spammer??
else else
return; return;
} }
@ -1010,7 +1018,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
} }
} }
if (!worldserver.SendChannelMessage(this, 0, 5, 0, language, message)) if (!worldserver.SendChannelMessage(this, 0, chan_num, 0, language, lang_skill, message))
{ {
Message(0, "Error: World server disconnected"); Message(0, "Error: World server disconnected");
} }
@ -1022,19 +1030,19 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
if (GetPet() && GetTarget() == GetPet() && GetPet()->FindType(SE_VoiceGraft)) if (GetPet() && GetTarget() == GetPet() && GetPet()->FindType(SE_VoiceGraft))
sender = GetPet(); sender = GetPet();
entity_list.ChannelMessage(sender, chan_num, language, message); entity_list.ChannelMessage(sender, chan_num, language, lang_skill, message);
} }
break; break;
} }
case 6: /* Broadcast */ case ChatChannel_Broadcast: /* Broadcast */
case 11: { /* GM Say */ case ChatChannel_GMSAY: { /* GM Say */
if (!(admin >= 80)) if (!(admin >= 80))
Message(0, "Error: Only GMs can use this channel"); Message(0, "Error: Only GMs can use this channel");
else if (!worldserver.SendChannelMessage(this, targetname, chan_num, 0, language, message)) else if (!worldserver.SendChannelMessage(this, targetname, chan_num, 0, language, lang_skill, message))
Message(0, "Error: World server disconnected"); Message(0, "Error: World server disconnected");
break; break;
} }
case 7: { /* Tell */ case ChatChannel_Tell: { /* Tell */
if(!global_channel_timer.Check()) if(!global_channel_timer.Check())
{ {
if(strlen(targetname) == 0) if(strlen(targetname) == 0)
@ -1078,11 +1086,11 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
target_name[x] = '\0'; target_name[x] = '\0';
} }
if(!worldserver.SendChannelMessage(this, target_name, chan_num, 0, language, message)) if(!worldserver.SendChannelMessage(this, target_name, chan_num, 0, language, lang_skill, message))
Message(0, "Error: World server disconnected"); Message(0, "Error: World server disconnected");
break; break;
} }
case 8: { /* Say */ case ChatChannel_Say: { /* Say */
if(message[0] == COMMAND_CHAR) { if(message[0] == COMMAND_CHAR) {
if(command_dispatch(this, message) == -2) { if(command_dispatch(this, message) == -2) {
if(parse->PlayerHasQuestSub(EVENT_COMMAND)) { if(parse->PlayerHasQuestSub(EVENT_COMMAND)) {
@ -1158,14 +1166,14 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
} }
break; break;
} }
case 20: case ChatChannel_UCSRelay:
{ {
// UCS Relay for Underfoot and later. // UCS Relay for Underfoot and later.
if(!worldserver.SendChannelMessage(this, 0, chan_num, 0, language, message)) if(!worldserver.SendChannelMessage(this, 0, chan_num, 0, language, lang_skill, message))
Message(0, "Error: World server disconnected"); Message(0, "Error: World server disconnected");
break; break;
} }
case 22: case ChatChannel_Emotes:
{ {
// Emotes for Underfoot and later. // Emotes for Underfoot and later.
// crash protection -- cheater // crash protection -- cheater
@ -1189,11 +1197,6 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
} }
} }
// if no language skill is specified, call the function with a skill of 100.
void Client::ChannelMessageSend(const char* from, const char* to, uint8 chan_num, uint8 language, const char* message, ...) {
ChannelMessageSend(from, to, chan_num, language, 100, message);
}
void Client::ChannelMessageSend(const char* from, const char* to, uint8 chan_num, uint8 language, uint8 lang_skill, const char* message, ...) { void Client::ChannelMessageSend(const char* from, const char* to, uint8 chan_num, uint8 language, uint8 lang_skill, const char* message, ...) {
if ((chan_num==11 && !(this->GetGM())) || (chan_num==10 && this->Admin()<80)) // dont need to send /pr & /petition to everybody if ((chan_num==11 && !(this->GetGM())) || (chan_num==10 && this->Admin()<80)) // dont need to send /pr & /petition to everybody
return; return;
@ -1218,7 +1221,7 @@ void Client::ChannelMessageSend(const char* from, const char* to, uint8 chan_num
} }
if (to != 0) if (to != 0)
strcpy((char *) cm->targetname, to); strcpy((char *) cm->targetname, to);
else if (chan_num == 7) else if (chan_num == ChatChannel_Tell)
strcpy(cm->targetname, m_pp.name); strcpy(cm->targetname, m_pp.name);
else else
cm->targetname[0] = 0; cm->targetname[0] = 0;
@ -1227,7 +1230,7 @@ void Client::ChannelMessageSend(const char* from, const char* to, uint8 chan_num
if (language < MAX_PP_LANGUAGE) { if (language < MAX_PP_LANGUAGE) {
ListenerSkill = m_pp.languages[language]; ListenerSkill = m_pp.languages[language];
if (ListenerSkill == 0) { if (ListenerSkill < 24) {
cm->language = (MAX_PP_LANGUAGE - 1); // in an unknown tongue cm->language = (MAX_PP_LANGUAGE - 1); // in an unknown tongue
} }
else { else {
@ -1253,7 +1256,7 @@ void Client::ChannelMessageSend(const char* from, const char* to, uint8 chan_num
bool weAreNotSender = strcmp(this->GetCleanName(), cm->sender); bool weAreNotSender = strcmp(this->GetCleanName(), cm->sender);
if (senderCanTrainSelf || weAreNotSender) { if (senderCanTrainSelf || weAreNotSender) {
if ((chan_num == 2) && (ListenerSkill < 100)) { // group message in unmastered language, check for skill up if ((chan_num == ChatChannel_Group) && (ListenerSkill < 100)) { // group message in unmastered language, check for skill up
if (m_pp.languages[language] <= lang_skill) if (m_pp.languages[language] <= lang_skill)
CheckLanguageSkillIncrease(language, lang_skill); CheckLanguageSkillIncrease(language, lang_skill);
} }

View File

@ -338,7 +338,6 @@ public:
void QueuePacket(const EQApplicationPacket* app, bool ack_req = true, CLIENT_CONN_STATUS = CLIENT_CONNECTINGALL, eqFilterType filter=FilterNone); void QueuePacket(const EQApplicationPacket* app, bool ack_req = true, CLIENT_CONN_STATUS = CLIENT_CONNECTINGALL, eqFilterType filter=FilterNone);
void FastQueuePacket(EQApplicationPacket** app, bool ack_req = true, CLIENT_CONN_STATUS = CLIENT_CONNECTINGALL); void FastQueuePacket(EQApplicationPacket** app, bool ack_req = true, CLIENT_CONN_STATUS = CLIENT_CONNECTINGALL);
void ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_skill, const char* orig_message, const char* targetname=nullptr); void ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_skill, const char* orig_message, const char* targetname=nullptr);
void ChannelMessageSend(const char* from, const char* to, uint8 chan_num, uint8 language, const char* message, ...);
void ChannelMessageSend(const char* from, const char* to, uint8 chan_num, uint8 language, uint8 lang_skill, const char* message, ...); void ChannelMessageSend(const char* from, const char* to, uint8 chan_num, uint8 language, uint8 lang_skill, const char* message, ...);
void Message(uint32 type, const char* message, ...); void Message(uint32 type, const char* message, ...);
void FilteredMessage(Mob *sender, uint32 type, eqFilterType filter, const char* message, ...); void FilteredMessage(Mob *sender, uint32 type, eqFilterType filter, const char* message, ...);

View File

@ -4181,7 +4181,12 @@ void Client::Handle_OP_ChannelMessage(const EQApplicationPacket *app)
return; return;
} }
ChannelMessageReceived(cm->chan_num, cm->language, cm->skill_in_language, cm->message, cm->targetname); uint8 skill_in_language = 100;
if (cm->language < MAX_PP_LANGUAGE)
{
skill_in_language = m_pp.languages[cm->language];
}
ChannelMessageReceived(cm->chan_num, cm->language, skill_in_language, cm->message, cm->targetname);
return; return;
} }

View File

@ -887,7 +887,7 @@ void command_chat(Client *c, const Seperator *sep)
if (sep->arg[2][0] == 0) if (sep->arg[2][0] == 0)
c->Message(0, "Usage: #chat [channum] [message]"); c->Message(0, "Usage: #chat [channum] [message]");
else else
if (!worldserver.SendChannelMessage(0, 0, (uint8) atoi(sep->arg[1]), 0, 0, sep->argplus[2])) if (!worldserver.SendChannelMessage(0, 0, (uint8) atoi(sep->arg[1]), 0, 0, 100, sep->argplus[2]))
c->Message(0, "Error: World server disconnected"); c->Message(0, "Error: World server disconnected");
} }

View File

@ -1235,33 +1235,19 @@ void EntityList::ChannelMessage(Mob *from, uint8 chan_num, uint8 language,
while(it != client_list.end()) { while(it != client_list.end()) {
Client *client = it->second; Client *client = it->second;
eqFilterType filter = FilterNone; eqFilterType filter = FilterNone;
if (chan_num == 3) //shout if (chan_num == ChatChannel_Shout) //shout
filter = FilterShouts; filter = FilterShouts;
else if (chan_num == 4) //auction else if (chan_num == ChatChannel_Auction) //auction
filter = FilterAuctions; filter = FilterAuctions;
// //
// Only say is limited in range // Only say is limited in range
if (chan_num != 8 || Distance(client->GetPosition(), from->GetPosition()) < 200) if (chan_num != ChatChannel_Say || Distance(client->GetPosition(), from->GetPosition()) < 200)
if (filter == FilterNone || client->GetFilter(filter) != FilterHide) if (filter == FilterNone || client->GetFilter(filter) != FilterHide)
client->ChannelMessageSend(from->GetName(), 0, chan_num, language, lang_skill, buffer); client->ChannelMessageSend(from->GetName(), 0, chan_num, language, lang_skill, buffer);
++it; ++it;
} }
} }
void EntityList::ChannelMessageSend(Mob *to, uint8 chan_num, uint8 language, const char *message, ...)
{
if (!to->IsClient())
return;
va_list argptr;
char buffer[4096];
va_start(argptr, message);
vsnprintf(buffer, 4096, message, argptr);
va_end(argptr);
to->CastToClient()->ChannelMessageSend(0, 0, chan_num, language, buffer);
}
void EntityList::SendZoneSpawns(Client *client) void EntityList::SendZoneSpawns(Client *client)
{ {
EQApplicationPacket *app; EQApplicationPacket *app;
@ -1995,22 +1981,22 @@ Client *EntityList::GetClientByAccID(uint32 accid)
} }
void EntityList::ChannelMessageFromWorld(const char *from, const char *to, void EntityList::ChannelMessageFromWorld(const char *from, const char *to,
uint8 chan_num, uint32 guild_id, uint8 language, const char *message) uint8 chan_num, uint32 guild_id, uint8 language, uint8 lang_skill, const char *message)
{ {
for (auto it = client_list.begin(); it != client_list.end(); ++it) { for (auto it = client_list.begin(); it != client_list.end(); ++it) {
Client *client = it->second; Client *client = it->second;
if (chan_num == 0) { if (chan_num == ChatChannel_Guild) {
if (!client->IsInGuild(guild_id)) if (!client->IsInGuild(guild_id))
continue; continue;
if (!guild_mgr.CheckPermission(guild_id, client->GuildRank(), GUILD_HEAR)) if (!guild_mgr.CheckPermission(guild_id, client->GuildRank(), GUILD_HEAR))
continue; continue;
if (client->GetFilter(FilterGuildChat) == FilterHide) if (client->GetFilter(FilterGuildChat) == FilterHide)
continue; continue;
} else if (chan_num == 5) { } else if (chan_num == ChatChannel_OOC) {
if (client->GetFilter(FilterOOC) == FilterHide) if (client->GetFilter(FilterOOC) == FilterHide)
continue; continue;
} }
client->ChannelMessageSend(from, to, chan_num, language, message); client->ChannelMessageSend(from, to, chan_num, language, lang_skill, message);
} }
} }
@ -3880,7 +3866,7 @@ void EntityList::GroupMessage(uint32 gid, const char *from, const char *message)
g = it->second->GetGroup(); g = it->second->GetGroup();
if (g) { if (g) {
if (g->GetID() == gid) if (g->GetID() == gid)
it->second->ChannelMessageSend(from, it->second->GetName(), 2, 0, message); it->second->ChannelMessageSend(from, it->second->GetName(), ChatChannel_Group, 0, 100, message);
} }
} }
++it; ++it;

View File

@ -323,10 +323,9 @@ public:
void FilteredMessage_StringID(Mob *sender, bool skipsender, uint32 type, eqFilterType filter, uint32 string_id, const char* message1=0,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0); void FilteredMessage_StringID(Mob *sender, bool skipsender, uint32 type, eqFilterType filter, uint32 string_id, const char* message1=0,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0);
void MessageClose_StringID(Mob *sender, bool skipsender, float dist, uint32 type, uint32 string_id, const char* message1=0,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0); void MessageClose_StringID(Mob *sender, bool skipsender, float dist, uint32 type, uint32 string_id, const char* message1=0,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0);
void FilteredMessageClose_StringID(Mob *sender, bool skipsender, float dist, uint32 type, eqFilterType filter, uint32 string_id, const char* message1=0,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0); void FilteredMessageClose_StringID(Mob *sender, bool skipsender, float dist, uint32 type, eqFilterType filter, uint32 string_id, const char* message1=0,const char* message2=0,const char* message3=0,const char* message4=0,const char* message5=0,const char* message6=0,const char* message7=0,const char* message8=0,const char* message9=0);
void ChannelMessageFromWorld(const char* from, const char* to, uint8 chan_num, uint32 guilddbid, uint8 language, const char* message); void ChannelMessageFromWorld(const char* from, const char* to, uint8 chan_num, uint32 guilddbid, uint8 language, uint8 lang_skill, const char* message);
void ChannelMessage(Mob* from, uint8 chan_num, uint8 language, const char* message, ...); void ChannelMessage(Mob* from, uint8 chan_num, uint8 language, const char* message, ...);
void ChannelMessage(Mob* from, uint8 chan_num, uint8 language, uint8 lang_skill, const char* message, ...); void ChannelMessage(Mob* from, uint8 chan_num, uint8 language, uint8 lang_skill, const char* message, ...);
void ChannelMessageSend(Mob* to, uint8 chan_num, uint8 language, const char* message, ...);
void SendZoneSpawns(Client*); void SendZoneSpawns(Client*);
void SendZonePVPUpdates(Client *); void SendZonePVPUpdates(Client *);
void SendZoneSpawnsBulk(Client* client); void SendZoneSpawnsBulk(Client* client);

View File

@ -910,7 +910,7 @@ void Group::GroupMessage(Mob* sender, uint8 language, uint8 lang_skill, const ch
continue; continue;
if (members[i]->IsClient() && members[i]->CastToClient()->GetFilter(FilterGroupChat)!=0) if (members[i]->IsClient() && members[i]->CastToClient()->GetFilter(FilterGroupChat)!=0)
members[i]->CastToClient()->ChannelMessageSend(sender->GetName(),members[i]->GetName(),2,language,lang_skill,message); members[i]->CastToClient()->ChannelMessageSend(sender->GetName(),members[i]->GetName(),ChatChannel_Group,language,lang_skill,message);
} }
auto pack = auto pack =
@ -2493,4 +2493,4 @@ void Group::QueueClients(Mob *sender, const EQApplicationPacket *app, bool ack_r
} }
} }
} }
} }

View File

@ -514,7 +514,7 @@ int main(int argc, char** argv) {
} }
else { else {
if (worldwasconnected && is_zone_loaded) { if (worldwasconnected && is_zone_loaded) {
entity_list.ChannelMessageFromWorld(0, 0, 6, 0, 0, "WARNING: World server connection lost"); entity_list.ChannelMessageFromWorld(0, 0, ChatChannel_Broadcast, 0, 0, 100, "WARNING: World server connection lost");
worldwasconnected = false; worldwasconnected = false;
} }
} }

View File

@ -446,7 +446,7 @@ uint32 Raid::GetGroup(Client *c)
return 0xFFFFFFFF; return 0xFFFFFFFF;
} }
void Raid::RaidSay(const char *msg, Client *c) void Raid::RaidSay(const char *msg, Client *c, uint8 language, uint8 lang_skill)
{ {
if(!c) if(!c)
return; return;
@ -455,6 +455,8 @@ void Raid::RaidSay(const char *msg, Client *c)
ServerRaidMessage_Struct *rga = (ServerRaidMessage_Struct*)pack->pBuffer; ServerRaidMessage_Struct *rga = (ServerRaidMessage_Struct*)pack->pBuffer;
rga->rid = GetID(); rga->rid = GetID();
rga->gid = 0xFFFFFFFF; rga->gid = 0xFFFFFFFF;
rga->language = language;
rga->lang_skill = lang_skill;
strn0cpy(rga->from, c->GetName(), 64); strn0cpy(rga->from, c->GetName(), 64);
strcpy(rga->message, msg); // this is safe because we are allocating enough space for the entire msg above strcpy(rga->message, msg); // this is safe because we are allocating enough space for the entire msg above
@ -463,7 +465,7 @@ void Raid::RaidSay(const char *msg, Client *c)
safe_delete(pack); safe_delete(pack);
} }
void Raid::RaidGroupSay(const char *msg, Client *c) void Raid::RaidGroupSay(const char *msg, Client *c, uint8 language, uint8 lang_skill)
{ {
if(!c) if(!c)
return; return;
@ -477,6 +479,8 @@ void Raid::RaidGroupSay(const char *msg, Client *c)
ServerRaidMessage_Struct *rga = (ServerRaidMessage_Struct*)pack->pBuffer; ServerRaidMessage_Struct *rga = (ServerRaidMessage_Struct*)pack->pBuffer;
rga->rid = GetID(); rga->rid = GetID();
rga->gid = groupToUse; rga->gid = groupToUse;
rga->language = language;
rga->lang_skill = lang_skill;
strn0cpy(rga->from, c->GetName(), 64); strn0cpy(rga->from, c->GetName(), 64);
strcpy(rga->message, msg); // this is safe because we are allocating enough space for the entire msg above strcpy(rga->message, msg); // this is safe because we are allocating enough space for the entire msg above
@ -1821,4 +1825,4 @@ void Raid::QueueClients(Mob *sender, const EQApplicationPacket *app, bool ack_re
} }
} }
} }
} }

View File

@ -177,8 +177,8 @@ public:
void SendHPManaEndPacketsFrom(Mob *mob); void SendHPManaEndPacketsFrom(Mob *mob);
void SendManaPacketFrom(Mob *mob); void SendManaPacketFrom(Mob *mob);
void SendEndurancePacketFrom(Mob *mob); void SendEndurancePacketFrom(Mob *mob);
void RaidSay(const char *msg, Client *c); void RaidSay(const char *msg, Client *c, uint8 language, uint8 lang_skill);
void RaidGroupSay(const char *msg, Client *c); void RaidGroupSay(const char *msg, Client *c, uint8 language, uint8 lang_skill);
//Packet Functions //Packet Functions
void SendRaidCreate(Client *to); void SendRaidCreate(Client *to);

View File

@ -200,29 +200,35 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
break; break;
ServerChannelMessage_Struct* scm = (ServerChannelMessage_Struct*)pack->pBuffer; ServerChannelMessage_Struct* scm = (ServerChannelMessage_Struct*)pack->pBuffer;
if (scm->deliverto[0] == 0) { if (scm->deliverto[0] == 0) {
entity_list.ChannelMessageFromWorld(scm->from, scm->to, scm->chan_num, scm->guilddbid, scm->language, scm->message); entity_list.ChannelMessageFromWorld(scm->from, scm->to, scm->chan_num, scm->guilddbid, scm->language, scm->lang_skill, scm->message);
} }
else { else {
Client* client = entity_list.GetClientByName(scm->deliverto); Client* client = entity_list.GetClientByName(scm->deliverto);
if (client) { if (client && client->Connected()) {
if (client->Connected()) { if (scm->chan_num == ChatChannel_TellEcho) {
if (scm->queued == 1) // tell was queued if (scm->queued == 1) // tell was queued
client->Tell_StringID(QUEUED_TELL, scm->to, scm->message); client->Tell_StringID(QUEUED_TELL, scm->to, scm->message);
else if (scm->queued == 2) // tell queue was full else if (scm->queued == 2) // tell queue was full
client->Tell_StringID(QUEUE_TELL_FULL, scm->to, scm->message); client->Tell_StringID(QUEUE_TELL_FULL, scm->to, scm->message);
else if (scm->queued == 3) // person was offline else if (scm->queued == 3) // person was offline
client->Message_StringID(MT_TellEcho, TOLD_NOT_ONLINE, scm->to); client->Message_StringID(MT_TellEcho, TOLD_NOT_ONLINE, scm->to);
else // normal stuff else // normal tell echo "You told Soanso, 'something'"
client->ChannelMessageSend(scm->from, scm->to, scm->chan_num, scm->language, scm->message); // tell echo doesn't use language, so it looks normal to you even if nobody can understand your tells
if (!scm->noreply && scm->chan_num != 2) { //dont echo on group chat client->ChannelMessageSend(scm->from, scm->to, scm->chan_num, 0, 100, scm->message);
// if it's a tell, echo back so it shows up }
scm->noreply = true; else if (scm->chan_num == ChatChannel_Tell) {
scm->chan_num = 14; client->ChannelMessageSend(scm->from, scm->to, scm->chan_num, scm->language, scm->lang_skill, scm->message);
if (scm->queued == 0) { // this is not a queued tell
// if it's a tell, echo back to acknowledge it and make it show on the sender's client
scm->chan_num = ChatChannel_TellEcho;
memset(scm->deliverto, 0, sizeof(scm->deliverto)); memset(scm->deliverto, 0, sizeof(scm->deliverto));
strcpy(scm->deliverto, scm->from); strcpy(scm->deliverto, scm->from);
SendPacket(pack); SendPacket(pack);
} }
} }
else {
client->ChannelMessageSend(scm->from, scm->to, scm->chan_num, scm->language, scm->lang_skill, scm->message);
}
} }
} }
break; break;
@ -1352,7 +1358,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
if (r->members[x].GroupNumber == rmsg->gid) { if (r->members[x].GroupNumber == rmsg->gid) {
if (r->members[x].member->GetFilter(FilterGroupChat) != 0) if (r->members[x].member->GetFilter(FilterGroupChat) != 0)
{ {
r->members[x].member->ChannelMessageSend(rmsg->from, r->members[x].member->GetName(), 2, 0, rmsg->message); r->members[x].member->ChannelMessageSend(rmsg->from, r->members[x].member->GetName(), ChatChannel_Group, rmsg->language, rmsg->lang_skill, rmsg->message);
} }
} }
} }
@ -1377,7 +1383,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
{ {
if (r->members[x].member->GetFilter(FilterGroupChat) != 0) if (r->members[x].member->GetFilter(FilterGroupChat) != 0)
{ {
r->members[x].member->ChannelMessageSend(rmsg->from, r->members[x].member->GetName(), 15, 0, rmsg->message); r->members[x].member->ChannelMessageSend(rmsg->from, r->members[x].member->GetName(), ChatChannel_Raid, rmsg->language, rmsg->lang_skill, rmsg->message);
} }
} }
} }
@ -1950,7 +1956,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
} }
} }
bool WorldServer::SendChannelMessage(Client* from, const char* to, uint8 chan_num, uint32 guilddbid, uint8 language, const char* message, ...) { bool WorldServer::SendChannelMessage(Client* from, const char* to, uint8 chan_num, uint32 guilddbid, uint8 language, uint8 lang_skill, const char* message, ...) {
if (!worldserver.Connected()) if (!worldserver.Connected())
return false; return false;
va_list argptr; va_list argptr;
@ -1984,6 +1990,7 @@ bool WorldServer::SendChannelMessage(Client* from, const char* to, uint8 chan_nu
scm->chan_num = chan_num; scm->chan_num = chan_num;
scm->guilddbid = guilddbid; scm->guilddbid = guilddbid;
scm->language = language; scm->language = language;
scm->lang_skill = lang_skill;
scm->queued = 0; scm->queued = 0;
strcpy(scm->message, buffer); strcpy(scm->message, buffer);

View File

@ -38,7 +38,7 @@ public:
void HandleMessage(uint16 opcode, const EQ::Net::Packet &p); void HandleMessage(uint16 opcode, const EQ::Net::Packet &p);
bool SendChannelMessage(Client* from, const char* to, uint8 chan_num, uint32 guilddbid, uint8 language, const char* message, ...); bool SendChannelMessage(Client* from, const char* to, uint8 chan_num, uint32 guilddbid, uint8 language, uint8 lang_skill, const char* message, ...);
bool SendEmoteMessage(const char* to, uint32 to_guilddbid, uint32 type, const char* message, ...); bool SendEmoteMessage(const char* to, uint32 to_guilddbid, uint32 type, const char* message, ...);
bool SendEmoteMessage(const char* to, uint32 to_guilddbid, int16 to_minstatus, uint32 type, const char* message, ...); bool SendEmoteMessage(const char* to, uint32 to_guilddbid, int16 to_minstatus, uint32 type, const char* message, ...);
bool SendVoiceMacro(Client* From, uint32 Type, char* Target, uint32 MacroNumber, uint32 GroupOrRaidID = 0); bool SendVoiceMacro(Client* From, uint32 Type, char* Target, uint32 MacroNumber, uint32 GroupOrRaidID = 0);