72 lines
2.4 KiB
C#
72 lines
2.4 KiB
C#
using System;
|
|
using System.Collections;
|
|
using Server;
|
|
using Knives.Utils;
|
|
|
|
namespace Knives.Chat3
|
|
{
|
|
public class Alliance : Channel
|
|
{
|
|
public static void Initialize()
|
|
{
|
|
new Alliance();
|
|
}
|
|
|
|
public Alliance() : base("Alliance")
|
|
{
|
|
Commands.Add("ally");
|
|
Commands.Add("a");
|
|
DefaultC = 0x9E;
|
|
|
|
Register(this);
|
|
}
|
|
|
|
public override bool CanChat(Mobile m, bool say)
|
|
{
|
|
if (m.Guild == null)
|
|
{
|
|
if (say) m.SendMessage(Data.GetData(m).SystemC, General.Local(36));
|
|
return false;
|
|
}
|
|
|
|
return base.CanChat(m, say);
|
|
}
|
|
|
|
protected override void Broadcast(Mobile m, string msg)
|
|
{
|
|
foreach (Data data in Data.Datas.Values)
|
|
{
|
|
if (data.Mobile.AccessLevel >= m.AccessLevel && ((data.GlobalG && !data.GIgnores.Contains(m)) || data.GListens.Contains(m)))
|
|
data.Mobile.SendMessage(data.GlobalGC, String.Format("(Alliance) <{0}> {1}: {2}", NameFor(m), m.Name, msg ));
|
|
else if (data.Channels.Contains(Name) && !data.Ignores.Contains(m))
|
|
{
|
|
if (data.Mobile.Guild == null || m.Guild == null)
|
|
continue;
|
|
|
|
if (data.Mobile.Guild != m.Guild && !((Server.Guilds.Guild)data.Mobile.Guild).Allies.Contains((Server.Guilds.Guild)m.Guild))
|
|
continue;
|
|
|
|
data.Mobile.SendMessage(m.AccessLevel == AccessLevel.Player ? data.ColorFor(this) : Data.GetData(m).StaffC, String.Format("<{0}{1}> {2}: {3}", NameFor(m), (Style == ChatStyle.Regional && m.Region != null ? "-" + m.Region.Name : ""), m.Name, msg));
|
|
}
|
|
}
|
|
}
|
|
|
|
public override void GumpOptions(GumpPlus g, int x, int y)
|
|
{
|
|
// Options like guild menu access, guildmaster options
|
|
|
|
base.GumpOptions(g, x, y);
|
|
}
|
|
|
|
public override ArrayList BuildList(Mobile m)
|
|
{
|
|
ArrayList list = base.BuildList(m);
|
|
|
|
foreach (Mobile mob in new ArrayList(list))
|
|
if (mob.Guild == null || m.Guild == null || (mob.Guild != m.Guild && !((Server.Guilds.Guild)mob.Guild).Allies.Contains((Server.Guilds.Guild)m.Guild)))
|
|
list.Remove(mob);
|
|
|
|
return list;
|
|
}
|
|
}
|
|
} |