public void RemoveMember(Character p) { if (Members.Count <= 2) { Disband(); return; } var members = new Character[Members.Count]; Members.CopyTo(members); Members.Remove(p); p.Group = new Group(GameServer, string.Empty, p); foreach (var m in members) { if (m is Player) { var client = (m as Player).Client; client.SendMessage("{0} is leaving this group.", p.Name); client.SendProfile(); } m.Display(); } if (p == Leader) { ChangeLeader(Members[0]); } }
public void ChangeLeader(Character p) { Leader = p; var members = new Player[Members.Count]; Members.CopyTo(members); foreach (Character m in Members) { if (m is Player) { var client = (m as Player).Client; client.SendMessage("{0} is the new leader of the group", p.Name); client.SendProfile(); } } }
public void AddMember(Character p) { Members.Add(p); p.Group = this; var members = new Character[Members.Count]; Members.CopyTo(members); foreach (Character m in members) { if (m is Player) { var client = (m as Player).Client; client.SendMessage("{0} is joining this group.", p.Name); client.SendProfile(); } m.Display(); } }
public void RemoveMember(Player p) { if (!Members.Contains(p.Name)) { return; } Members.Remove(p.Name); var members = new string[Members.Count]; Members.CopyTo(members); var com = Program.MySqlConnection.CreateCommand(); com.CommandText = "UPDATE guilds SET members=@members WHERE name=@name"; com.Parameters.AddWithValue("@members", string.Join(";", members)); com.Parameters.AddWithValue("@name", Name); com.ExecuteNonQuery(); }
public void Disband(bool soloGroup) { var members = new Character[Members.Count]; Members.CopyTo(members); foreach (var m in members) { if (soloGroup) { m.Group = new Group(GameServer, string.Empty, m); if (m is Player) { var client = (m as Player).Client; client.SendMessage("Your group has disbanded."); client.SendProfile(); } m.Display(); } Members.Remove(m); } GameServer.RemoveGameObject(this); }