public void AddMember( long id, string Nickname, int Experience, int ClanPoints = 0, Clan.CLAN_ROLE role = Clan.CLAN_ROLE.DEFAULT) { XmlAttribute attribute1 = this.ClanInfo.CreateAttribute("profile_id"); XmlAttribute attribute2 = this.ClanInfo.CreateAttribute("clan_points"); XmlAttribute attribute3 = this.ClanInfo.CreateAttribute("nickname"); XmlAttribute attribute4 = this.ClanInfo.CreateAttribute("experience"); XmlAttribute attribute5 = this.ClanInfo.CreateAttribute("invite_date"); XmlAttribute attribute6 = this.ClanInfo.CreateAttribute("clan_role"); attribute1.Value = id.ToString(); attribute2.Value = ClanPoints.ToString(); attribute3.Value = Nickname; attribute4.Value = Experience.ToString(); attribute5.Value = DateTimeOffset.Now.ToUnixTimeSeconds().ToString(); attribute6.Value = ((int)role).ToString(); XmlElement element = this.ClanInfo.CreateElement("clan_member_info"); element.Attributes.Append(attribute1); element.Attributes.Append(attribute3); element.Attributes.Append(attribute4); element.Attributes.Append(attribute2); element.Attributes.Append(attribute5); element.Attributes.Append(attribute6); if (this.ClanInfo["clan_members"] == null) { this.ClanInfo.AppendChild(this.ClanInfo.ImportNode((XmlNode)this.ClanInfo.CreateElement("clan_members"), true)); } this.ClanInfo["clan_members"].AppendChild(this.ClanInfo.ImportNode((XmlNode)element, true)); this.Save(); }
public ClanSetMemberRole(Client User, XmlDocument Packet) : base(User, Packet) { if (this.Type == "result") { return; } long TargetID = long.Parse(this.Query.Attributes["profile_id"].InnerText); Clan.CLAN_ROLE clanRole = (Clan.CLAN_ROLE) byte.Parse(this.Query.Attributes["role"].InnerText); if (!Enum.IsDefined(typeof(Clan.CLAN_ROLE), (object)clanRole) || User.Player.Clan == null || User.Player.ClanPlayer.ClanRole != Clan.CLAN_ROLE.LEADER) { throw new StanzaException(User, Packet, 7); } Client client = ArrayList.OnlineUsers.Find((Predicate <Client>)(Attribute => Attribute.Player.UserID == TargetID)); client.Player.ClanPlayer.ClanRole = clanRole; switch (clanRole - 1) { case Clan.CLAN_ROLE.NOT_IN_CLAN: client.ShowMessage("@clans_you_are_promoted_to_master", false); break; case Clan.CLAN_ROLE.LEADER: client.ShowMessage("@clans_you_are_promoted_to_officer", false); break; case Clan.CLAN_ROLE.CO_LEADER: client.ShowMessage("@clans_you_are_demoted_to_regular", false); break; } if (clanRole == Clan.CLAN_ROLE.LEADER) { User.Player.ClanPlayer.ClanRole = Clan.CLAN_ROLE.CO_LEADER; User.Player.Clan.UpdatePlayer(User.Player); } User.Player.Clan.UpdatePlayer(client.Player); foreach (XElement xelement in User.Player.Clan.ClanMembers.Elements((XName)"clan_member_info").ToList <XElement>()) { XElement clanMember = xelement; Client User1 = ArrayList.OnlineUsers.Find((Predicate <Client>)(x => x.Player.UserID == long.Parse(clanMember.Attribute((XName)"profile_id").Value))); if (User1 != null) { ClanInfo clanInfo = new ClanInfo(User1, (XmlDocument)null); } } this.Process(); }
public ClanSetRole(Client User, XmlDocument Packet = null) : base(User, Packet) { bool flag = !(this.Type == "result"); if (flag) { long Pid = long.Parse(this.Query.Attributes["profile_id"].InnerText); Clan.CLAN_ROLE cLAN_ROLE = (Clan.CLAN_ROLE) byte.Parse(this.Query.Attributes["role"].InnerText); bool flag2 = !Enum.IsDefined(typeof(Clan.CLAN_ROLE), cLAN_ROLE) || User.Player.ClanPlayer.Clan == null || User.Player.ClanPlayer.ClanRole != Clan.CLAN_ROLE.LEADER; if (flag2) { throw new StanzaException(User, Packet, 7); } Client client = ArrayList.OnlineUsers.Find((Client Attribute) => Attribute.Player.UserID == Pid); client.Player.ClanPlayer.ClanRole = cLAN_ROLE; bool flag3 = cLAN_ROLE == Clan.CLAN_ROLE.LEADER; if (flag3) { User.Player.ClanPlayer.ClanRole = Clan.CLAN_ROLE.CO_LEADER; User.Player.ClanPlayer.Clan.MasterBadge = client.Player.BannerBadge; User.Player.ClanPlayer.Clan.MasterMark = client.Player.BannerMark; User.Player.ClanPlayer.Clan.MasterStripe = client.Player.BannerStripe; User.Player.ClanPlayer.Clan.MasterNick = client.Player.Nickname; } new ClanMemberUpdated(client); new ClanMemberUpdated(User); switch (cLAN_ROLE) { case Clan.CLAN_ROLE.LEADER: client.ShowMessage("@clans_you_are_promoted_to_master", false); break; case Clan.CLAN_ROLE.CO_LEADER: client.ShowMessage("@clans_you_are_promoted_to_officer", false); break; case Clan.CLAN_ROLE.DEFAULT: client.ShowMessage("@clans_you_are_demoted_to_regular", false); break; } Process(); } }