internal override void Handle() { Alliance alliance = Alliances.Get(this.AllianceID); if (alliance != null) { if (!alliance.Members.Contains(alliance.Members.Find(member => member.Identifier == this.Connection.Avatar.Identifier))) { AllianceMember member = new AllianceMember(this.Connection.Avatar, Alliance.Role.Member); alliance.Members.Add(member); this.Connection.Avatar.ClanHighID = alliance.HighID; this.Connection.Avatar.ClanLowID = alliance.LowID; this.Connection.Avatar.Save(); Alliances.Save(alliance); new AvailableServerCommandMessage(this.Connection, new LogicChangeAllianceRoleCommand(this.Connection) { Role = Alliance.Role.Member }).Send(); new AvailableServerCommandMessage(this.Connection, new LogicJoinAllianceCommand(this.Connection)).Send(); new AllianceStreamMessage(this.Connection).Send(); alliance.AddEntry(new StreamEntry(member, member, StreamEntry.StreamEvent.Joined)); this.Connection.Avatar.Save(); } } }
internal override void Handle() { Alliance alliance = Alliances.Get(this.Connection.Avatar.Alliance.Identifier); if (alliance != null) { AllianceMember member = alliance.Members.Find(m => m.Identifier == this.MemberID); AllianceMember sender = alliance.Members.Find(m => m.Identifier == this.Connection.Avatar.Identifier); alliance.AddEntry(new StreamEntry(member, sender, ChangeAllianceMemberRoleMessage.IsHigherRoleThan(this.Role, member.Role) ? StreamEntry.StreamEvent.Promoted : StreamEntry.StreamEvent.Demoted)); member.Role = this.Role; if (this.Role == (int)Alliance.Role.Leader) { sender.Role = (int)Alliance.Role.CoLeader; alliance.AddEntry(new StreamEntry(sender, sender, StreamEntry.StreamEvent.Demoted)); } Alliances.Save(alliance); new AvailableServerCommandMessage(this.Connection, new LogicChangeAllianceRoleCommand(this.Connection) { Role = (Alliance.Role) this.Role }).Send(); } }
internal override void Handle() { Alliance alliance = Alliances.Get(this.AllianceId); if (alliance != null) { new AllianceDataMessage(this.Connection, alliance).Send(); } }
internal override void Handle() { if (this.Connection.Avatar.IsInAlliance) { Alliance alliance = Alliances.Get(this.Connection.Avatar.Alliance.Identifier); if (alliance != null) { this.CheckValues(alliance); Alliances.Save(alliance); foreach (LogicClientAvatar avatar in alliance.Members.Select(member => Avatars.Get(member.Identifier)).Where(avatar => avatar.Connection != null)) { new AvailableServerCommandMessage(avatar.Connection, new LogicAllianceSettingsChangedCommand(this.Connection) { Badge = this.BadgeData }).Send(); } } } }