public void Execute(Player player, string[] args)
{
if (player.Guild != "")
{
try
{
var saytext = string.Join(" ", args);
foreach (var w in RealmManager.Worlds)
{
var world = w.Value;
if (w.Key == 0)
continue;
foreach (var i in world.Players.Where(i => i.Value.Guild == player.Guild))
{
if (string.IsNullOrEmpty(saytext))
player.SendHelp("Usage: /g <text>");
else
{
var tp = new TextPacket
{
BubbleTime = 10,
Stars = player.Stars,
Name = player.ResolveGuildChatName(),
Recipient = "*Guild*",
Text = saytext
};
if (world.Id == player.Owner.Id) tp.ObjectId = player.Id;
i.Value.Client.SendPacket(tp);
}
}
}
}
catch
{
player.SendInfo("Cannot guild chat!");
}
}
else
player.SendInfo("You need to be in a guild to use guild chat!");
}