Beispiel #1
0
        internal override void Handle()
        {
            LogicClientAvatar avatar   = this.Connection.Avatar;
            Alliance          alliance = avatar.Alliance;

            if (alliance != null)
            {
                AllianceMember member = alliance.Members.Find(m => m.Identifier == avatar.Identifier);

                avatar.ClanHighID = 0;
                avatar.ClanLowID  = 0;

                avatar.Save();

                if (alliance.Members.Size == 0)
                {
                    Alliances.Delete(alliance);
                }
                else
                {
                    if (member.Role == (int)Alliance.Role.Leader)
                    {
                        LeaveAllianceMessage.FindNewLeader(alliance, member);
                    }
                }

                new AvailableServerCommandMessage(this.Connection, new LogicLeaveAllianceCommand(this.Connection, alliance.Identifier)).Send();
                alliance.AddEntry(new StreamEntry(member, member, StreamEntry.StreamEvent.Left));

                alliance.Members.Remove(member);

                Alliances.Save(alliance);
            }
        }