Guild Chat using \
I've programmed guild chat using \ for my personal shard, and thought it might be a good idea to share.
The code really does need cleaning up, and I'm planning to do that in a day or two. I have not implemented Alliance chat. At the moment, this is just changed to Guild chat, as the functions necessary for checking alliances are not in the core (as far as I can see, if anyone knows otherwise, please tell me).
There are two files to modify.
File 1: Network\PacketHandlers.cs
Find:
Replace with:
File 2: Network\Mobile.cs
Find:
Replace with:
Find:
Replace with:
This should provide working guild chat. It has been rigously tested on my server, but I make no guarantees that it won't eat your world save, or something (even though it doesn't touch it ).
If you find any bugs or have any ideas for improvements, please inform me.
Remember that using a modified core means that you may not recieve script support!
I've programmed guild chat using \ for my personal shard, and thought it might be a good idea to share.
The code really does need cleaning up, and I'm planning to do that in a day or two. I have not implemented Alliance chat. At the moment, this is just changed to Guild chat, as the functions necessary for checking alliances are not in the core (as far as I can see, if anyone knows otherwise, please tell me).
There are two files to modify.
File 1: Network\PacketHandlers.cs
Find:
Code:
public enum MessageType
{
Regular = 0x00,
System = 0x01,
Emote = 0x02,
Label = 0x06,
Focus = 0x07,
Whisper = 0x08,
Yell = 0x09,
Spell = 0x0A,
Encoded = 0xC0
}
Code:
public enum MessageType
{
Regular = 0x00,
System = 0x01,
Emote = 0x02,
Label = 0x06,
Focus = 0x07,
Whisper = 0x08,
Yell = 0x09,
Spell = 0x0A,
Guild = 0x0D,
Alliance = 0x0E,
Encoded = 0xC0
}
File 2: Network\Mobile.cs
Find:
Code:
switch ( type )
{
case MessageType.Regular: m_SpeechHue = hue; break;
case MessageType.Emote: m_EmoteHue = hue; break;
case MessageType.Whisper: m_WhisperHue = hue; range = 1; break;
case MessageType.Yell: m_YellHue = hue; range = 18; break;
default: type = MessageType.Regular; break;
}
Code:
switch ( type )
{
case MessageType.Regular: m_SpeechHue = hue; break;
case MessageType.Emote: m_EmoteHue = hue; break;
case MessageType.Whisper: m_WhisperHue = hue; range = 1; break;
case MessageType.Yell: m_YellHue = hue; range = 18; break;
case MessageType.Guild: break;
case MessageType.Alliance: type = MessageType.Guild; break;
default: type = MessageType.Regular; break;
}
Find:
Code:
SpeechEventArgs regArgs = new SpeechEventArgs( this, text, type, hue, keywords );
EventSink.InvokeSpeech( regArgs );
m_Region.OnSpeech( regArgs );
OnSaid( regArgs );
Code:
SpeechEventArgs regArgs = new SpeechEventArgs( this, text, type, hue, keywords );
if ( type == MessageType.Guild )
{
if ( this.Guild != null )
{
BaseGuild guild = this.Guild;
foreach ( Mobile m in World.Mobiles.Values )
{
if ( m.Player )
{
if ( m.Guild == guild )
{
m.OnSpeech( regArgs );
NetState ns = m.NetState;
Packet regp = null;
if ( ns != null )
{
if ( regp == null )
regp = new UnicodeMessage( m_Serial, Body, type, hue, 3, m_Language, Name, text );
ns.Send( regp );
}
}
}
}
}
return;
}
EventSink.InvokeSpeech( regArgs );
m_Region.OnSpeech( regArgs );
OnSaid( regArgs );
This should provide working guild chat. It has been rigously tested on my server, but I make no guarantees that it won't eat your world save, or something (even though it doesn't touch it ).
If you find any bugs or have any ideas for improvements, please inform me.
Remember that using a modified core means that you may not recieve script support!