public void ChangeMemberRole(AllianceMemberEntry allianceMemberEntry, LogicAvatarAllianceRole allianceRole, LogicLong eventAvatarId, string eventAvatarName)
        {
            if (allianceMemberEntry.GetAllianceRole() != allianceRole)
            {
                bool isPromoted = allianceMemberEntry.HasLowerRoleThan(allianceRole);

                allianceMemberEntry.SetAllianceRole(allianceRole);

                LogicChangeAllianceRoleCommand logicChangeAllianceRoleCommand = new LogicChangeAllianceRoleCommand();
                logicChangeAllianceRoleCommand.SetData(this.Id, allianceRole);
                ServerMessageManager.SendMessage(new GameAllowServerCommandMessage
                {
                    AccountId     = allianceMemberEntry.GetAvatarId(),
                    ServerCommand = logicChangeAllianceRoleCommand
                }, 9);

                AllianceEventStreamEntry allianceEventStreamEntry = new AllianceEventStreamEntry();
                AllianceStreamEntryUtil.SetSenderInfo(allianceEventStreamEntry, allianceMemberEntry);

                allianceEventStreamEntry.SetEventAvatarId(eventAvatarId);
                allianceEventStreamEntry.SetEventAvatarName(eventAvatarName);
                allianceEventStreamEntry.SetEventType(isPromoted ? AllianceEventStreamEntryType.PROMOTED : AllianceEventStreamEntryType.DEMOTED);

                StreamManager.Create(this.Id, allianceEventStreamEntry);

                this.AddStreamEntry(allianceEventStreamEntry);
            }
        }
        public void AddMember(AllianceMemberEntry member)
        {
            if (!this.Members.TryAdd(member.GetAvatarId(), member))
            {
                throw new Exception("Alliance.addMember: member already in this alliance!");
            }
            if (this.IsFull())
            {
                throw new Exception("Alliance.addMember: alliance is FULL!");
            }

            this.Header.SetNumberOfMembers(this.Members.Count);
            this.UpdateScoring();
            this.OnMemberAdded(member);

            this.KickedMembersTimes.Remove(member.GetAvatarId());
        }
Exemple #3
0
 public static void SetSenderInfo(StreamEntry entry, AllianceMemberEntry member)
 {
     entry.SetSenderAvatarId(member.GetAvatarId());
     entry.SetSenderHomeId(member.GetHomeId());
     entry.SetSenderName(member.GetName());
     entry.SetSenderLevel(member.GetExpLevel());
     entry.SetSenderLeagueType(member.GetLeagueType());
     entry.SetSenderRole(member.GetAllianceRole());
 }
        private void OnLeaveAllianceMessageReceived(LeaveAllianceMessage message)
        {
            if (this.m_session.Alliance != null)
            {
                Alliance            alliance    = this.m_session.Alliance;
                AllianceMemberEntry memberEntry = alliance.Members[this.m_session.AccountId];

                if (memberEntry.GetAllianceRole() == LogicAvatarAllianceRole.LEADER)
                {
                    AllianceMemberEntry     higherMemberEntry = null;
                    LogicAvatarAllianceRole higherMemberRole  = 0;

                    foreach (AllianceMemberEntry member in alliance.Members.Values)
                    {
                        if (member != memberEntry && (higherMemberEntry == null || !member.HasLowerRoleThan(higherMemberRole)))
                        {
                            higherMemberEntry = member;
                            higherMemberRole  = member.GetAllianceRole();
                        }
                    }

                    if (higherMemberEntry != null)
                    {
                        alliance.ChangeMemberRole(higherMemberEntry, LogicAvatarAllianceRole.LEADER, memberEntry.GetAvatarId(), memberEntry.GetName());
                    }
                }

                AllianceEventStreamEntry allianceEventStreamEntry = new AllianceEventStreamEntry();
                AllianceStreamEntryUtil.SetSenderInfo(allianceEventStreamEntry, memberEntry);

                allianceEventStreamEntry.SetEventType(AllianceEventStreamEntryType.LEFT);
                allianceEventStreamEntry.SetEventAvatarId(memberEntry.GetAvatarId());
                allianceEventStreamEntry.SetEventAvatarName(memberEntry.GetName());

                StreamManager.Create(alliance.Id, allianceEventStreamEntry);

                alliance.AddStreamEntry(allianceEventStreamEntry);
                alliance.RemoveMember(this.m_session.AccountId);

                ServerMessageManager.SendMessage(new AllianceLeavedMessage
                {
                    AccountId  = this.m_session.AccountId,
                    AllianceId = alliance.Id
                }, 9);

                AllianceManager.Save(alliance);
            }
        }
        private void OnChangeAllianceSettingsMessageReceived(ChangeAllianceSettingsMessage message)
        {
            if (this.m_session.Alliance != null)
            {
                this.m_session.Alliance.SetAllianceSettings(message.GetAllianceDescription(), (AllianceType)message.GetAllianceType(), message.GetAllianceBadgeId(), message.GetRequiredScore(),
                                                            message.GetRequiredDuelScore(), message.GetWarFrequency(), message.GetOriginData(), message.IsPublicWarLog(), message.IsAmicalWarEnabled());

                AllianceMemberEntry      memberEntry = this.m_session.Alliance.Members[this.m_session.AccountId];
                AllianceEventStreamEntry allianceEventStreamEntry = new AllianceEventStreamEntry();
                AllianceStreamEntryUtil.SetSenderInfo(allianceEventStreamEntry, memberEntry);

                allianceEventStreamEntry.SetEventType(AllianceEventStreamEntryType.CHANGED_SETTINGS);
                allianceEventStreamEntry.SetEventAvatarId(memberEntry.GetAvatarId());
                allianceEventStreamEntry.SetEventAvatarName(memberEntry.GetName());

                StreamManager.Create(this.m_session.Alliance.Id, allianceEventStreamEntry);

                this.m_session.Alliance.AddStreamEntry(allianceEventStreamEntry);

                AllianceManager.Save(this.m_session.Alliance);
            }
        }
        protected sealed override void Load(LogicJSONObject jsonObject)
        {
            this.Header.Load(jsonObject);
            this.Header.SetAllianceId(this.Id);
            this.Description = jsonObject.GetJSONString(AllianceDocument.JSON_ATTRIBUTE_DESCRIPTION).GetStringValue();

            LogicJSONArray memberArray = jsonObject.GetJSONArray(AllianceDocument.JSON_ATTRIBUTE_MEMBERS);

            for (int i = 0; i < memberArray.Size(); i++)
            {
                AllianceMemberEntry allianceMemberEntry = new AllianceMemberEntry();
                allianceMemberEntry.Load(memberArray.GetJSONObject(i));
                this.Members.Add(allianceMemberEntry.GetAvatarId(), allianceMemberEntry);
            }

            LogicJSONArray kickedMemberTimeArray = jsonObject.GetJSONArray(AllianceDocument.JSON_ATTRIBUTE_KICKED_MEMBER_TIMES);

            for (int i = 0; i < kickedMemberTimeArray.Size(); i++)
            {
                LogicJSONObject obj           = kickedMemberTimeArray.GetJSONObject(i);
                LogicJSONArray  avatarIdArray = obj.GetJSONArray(AllianceDocument.JSON_ATTRIBUTE_KICKED_MEMBER_TIMES_ID);
                LogicLong       avatarId      = new LogicLong(avatarIdArray.GetJSONNumber(0).GetIntValue(), avatarIdArray.GetJSONNumber(1).GetIntValue());
                DateTime        kickTime      = DateTime.Parse(obj.GetJSONString(AllianceDocument.JSON_ATTRIBUTE_KICKED_MEMBER_TIMES_TIME).GetStringValue());

                this.KickedMembersTimes.Add(avatarId, kickTime);
            }

            LogicJSONArray streamArray = jsonObject.GetJSONArray(AllianceDocument.JSON_ATTRIBUTE_STREAM_ENTRY_LIST);

            for (int i = 0; i < streamArray.Size(); i++)
            {
                LogicJSONArray avatarIdArray = streamArray.GetJSONArray(i);
                LogicLong      id            = new LogicLong(avatarIdArray.GetJSONNumber(0).GetIntValue(), avatarIdArray.GetJSONNumber(1).GetIntValue());

                this.StreamEntryList.Add(id);
            }
        }
Exemple #7
0
        private static void OnAllianceJoinRequestMessageReceived(AllianceJoinRequestMessage message)
        {
            AllianceJoinResponseMessage joinAllianceResponseMessage = new AllianceJoinResponseMessage();

            if (!AllianceManager.TryGet(message.AllianceId, out Alliance alliance))
            {
                joinAllianceResponseMessage.ErrorReason = AllianceJoinResponseMessage.Reason.GENERIC;
                ServerRequestManager.SendResponse(joinAllianceResponseMessage, message);
                return;
            }

            if (!message.Created)
            {
                if (alliance.IsFull())
                {
                    joinAllianceResponseMessage.ErrorReason = AllianceJoinResponseMessage.Reason.FULL;
                    ServerRequestManager.SendResponse(joinAllianceResponseMessage, message);
                    return;
                }

                if (!message.Invited)
                {
                    if (alliance.Header.GetAllianceType() != AllianceType.OPEN || alliance.Header.GetNumberOfMembers() == 0)
                    {
                        joinAllianceResponseMessage.ErrorReason =
                            alliance.Header.GetAllianceType() == AllianceType.CLOSED ? AllianceJoinResponseMessage.Reason.CLOSED : AllianceJoinResponseMessage.Reason.GENERIC;
                        ServerRequestManager.SendResponse(joinAllianceResponseMessage, message);
                        return;
                    }

                    if (alliance.IsBanned(message.Avatar.GetId()))
                    {
                        joinAllianceResponseMessage.ErrorReason = AllianceJoinResponseMessage.Reason.BANNED;
                        ServerRequestManager.SendResponse(joinAllianceResponseMessage, message);
                        return;
                    }

                    if (alliance.Header.GetRequiredScore() > message.Avatar.GetScore() || alliance.Header.GetRequiredDuelScore() > message.Avatar.GetDuelScore())
                    {
                        joinAllianceResponseMessage.ErrorReason = AllianceJoinResponseMessage.Reason.SCORE;
                        ServerRequestManager.SendResponse(joinAllianceResponseMessage, message);
                        return;
                    }
                }
            }
            else
            {
                if (alliance.Header.GetNumberOfMembers() != 0)
                {
                    throw new Exception("StreamMessageManager.joinAllianceRequestMessageReceived: A new alliance must be empty!");
                }
            }

            AllianceMemberEntry memberEntry = AllianceMemberUtil.GetAllianceMemberEntryFromAvatar(message.Avatar);

            memberEntry.SetAllianceRole(message.Created ? LogicAvatarAllianceRole.LEADER : LogicAvatarAllianceRole.MEMBER);
            alliance.AddMember(memberEntry);

            if (!message.Created)
            {
                AllianceEventStreamEntry allianceEventStreamEntry = new AllianceEventStreamEntry();
                AllianceStreamEntryUtil.SetSenderInfo(allianceEventStreamEntry, memberEntry);

                allianceEventStreamEntry.SetEventType(AllianceEventStreamEntryType.JOINED);
                allianceEventStreamEntry.SetEventAvatarId(memberEntry.GetAvatarId());
                allianceEventStreamEntry.SetEventAvatarName(memberEntry.GetName());

                StreamManager.Create(alliance.Id, allianceEventStreamEntry);

                alliance.AddStreamEntry(allianceEventStreamEntry);
            }

            joinAllianceResponseMessage.Success         = true;
            joinAllianceResponseMessage.AllianceId      = alliance.Id;
            joinAllianceResponseMessage.AllianceName    = alliance.Header.GetAllianceName();
            joinAllianceResponseMessage.AllianceBadgeId = alliance.Header.GetAllianceBadgeId();
            joinAllianceResponseMessage.AllianceLevel   = alliance.Header.GetAllianceLevel();
            joinAllianceResponseMessage.Created         = message.Created;

            AllianceManager.Save(alliance);
            ServerRequestManager.SendResponse(joinAllianceResponseMessage, message);
        }
        private void OnSendAllianceInvitationMessageReceived(SendAllianceInvitationMessage message)
        {
            if (this.m_session.Alliance != null)
            {
                Alliance            alliance    = this.m_session.Alliance;
                AllianceMemberEntry memberEntry = alliance.Members[this.m_session.AccountId];

                if (memberEntry.GetAllianceRole() == LogicAvatarAllianceRole.MEMBER)
                {
                    AllianceInvitationSendFailedMessage allianceInvitationSendFailedMessage = new AllianceInvitationSendFailedMessage();
                    allianceInvitationSendFailedMessage.SetReason(AllianceInvitationSendFailedMessage.Reason.NO_RIGHTS);
                    this.m_session.SendPiranhaMessage(allianceInvitationSendFailedMessage, 1);
                    return;
                }

                if (memberEntry.GetAllianceRole() == LogicAvatarAllianceRole.ELDER)
                {
                    AllianceInvitationSendFailedMessage allianceInvitationSendFailedMessage = new AllianceInvitationSendFailedMessage();
                    allianceInvitationSendFailedMessage.SetReason(AllianceInvitationSendFailedMessage.Reason.USER_BANNED);
                    this.m_session.SendPiranhaMessage(allianceInvitationSendFailedMessage, 1);
                    return;
                }

                AllianceInvitationAvatarStreamEntry allianceInvitationAvatarStreamEntry = new AllianceInvitationAvatarStreamEntry();

                allianceInvitationAvatarStreamEntry.SetSenderAvatarId(memberEntry.GetAvatarId());
                allianceInvitationAvatarStreamEntry.SetSenderHomeId(memberEntry.GetHomeId());
                allianceInvitationAvatarStreamEntry.SetSenderName(memberEntry.GetName());
                allianceInvitationAvatarStreamEntry.SetSenderLevel(memberEntry.GetExpLevel());
                allianceInvitationAvatarStreamEntry.SetSenderLeagueType(memberEntry.GetLeagueType());

                allianceInvitationAvatarStreamEntry.SetAllianceId(alliance.Id);
                allianceInvitationAvatarStreamEntry.SetAllianceName(alliance.Header.GetAllianceName());
                allianceInvitationAvatarStreamEntry.SetAllianceBadgeId(alliance.Header.GetAllianceBadgeId());
                allianceInvitationAvatarStreamEntry.SetAllianceLevel(alliance.Header.GetAllianceLevel());

                ServerRequestManager.Create(new GameCreateAllianceInvitationRequestMessage
                {
                    AccountId = message.GetAvatarId(),
                    Entry     = allianceInvitationAvatarStreamEntry
                }, ServerManager.GetDocumentSocket(9, message.GetAvatarId())).OnComplete = args =>
                {
                    if (this.m_session.IsDestructed())
                    {
                        return;
                    }

                    if (args.ErrorCode == ServerRequestError.Success)
                    {
                        GameCreateAllianceInvitationResponseMessage responseMessage = (GameCreateAllianceInvitationResponseMessage)args.ResponseMessage;

                        if (responseMessage.Success)
                        {
                            this.m_session.SendPiranhaMessage(new AllianceInvitationSentOkMessage(), 1);
                        }
                        else
                        {
                            AllianceInvitationSendFailedMessage allianceInvitationSendFailedMessage = new AllianceInvitationSendFailedMessage();

                            switch (responseMessage.ErrorReason)
                            {
                            case GameCreateAllianceInvitationResponseMessage.Reason.GENERIC:
                                allianceInvitationSendFailedMessage.SetReason(AllianceInvitationSendFailedMessage.Reason.GENERIC);
                                break;

                            case GameCreateAllianceInvitationResponseMessage.Reason.NO_CASTLE:
                                allianceInvitationSendFailedMessage.SetReason(AllianceInvitationSendFailedMessage.Reason.NO_CASTLE);
                                break;

                            case GameCreateAllianceInvitationResponseMessage.Reason.ALREADY_IN_ALLIANCE:
                                allianceInvitationSendFailedMessage.SetReason(AllianceInvitationSendFailedMessage.Reason.ALREADY_IN_ALLIANCE);
                                break;

                            case GameCreateAllianceInvitationResponseMessage.Reason.ALREADY_HAS_AN_INVITE:
                                allianceInvitationSendFailedMessage.SetReason(AllianceInvitationSendFailedMessage.Reason.ALREADY_HAS_AN_INVITE);
                                break;

                            case GameCreateAllianceInvitationResponseMessage.Reason.HAS_TOO_MANY_INVITES:
                                allianceInvitationSendFailedMessage.SetReason(AllianceInvitationSendFailedMessage.Reason.HAS_TOO_MANY_INVITES);
                                break;
                            }

                            this.m_session.SendPiranhaMessage(allianceInvitationSendFailedMessage, 1);
                        }
                    }
                    else
                    {
                        AllianceInvitationSendFailedMessage allianceInvitationSendFailedMessage = new AllianceInvitationSendFailedMessage();
                        allianceInvitationSendFailedMessage.SetReason(AllianceInvitationSendFailedMessage.Reason.GENERIC);
                        this.m_session.SendPiranhaMessage(allianceInvitationSendFailedMessage, 1);
                    }
                };
            }
        }
        private void OnRespondToAllianceJoinRequestMessageReceived(RespondToAllianceJoinRequestMessage message)
        {
            if (this.m_session.Alliance != null)
            {
                Alliance            alliance    = this.m_session.Alliance;
                AllianceMemberEntry memberEntry = alliance.Members[this.m_session.AccountId];

                if (memberEntry.GetAllianceRole() == LogicAvatarAllianceRole.MEMBER)
                {
                    AllianceInvitationSendFailedMessage allianceInvitationSendFailedMessage = new AllianceInvitationSendFailedMessage();
                    allianceInvitationSendFailedMessage.SetReason(AllianceInvitationSendFailedMessage.Reason.NO_RIGHTS);
                    this.m_session.SendPiranhaMessage(allianceInvitationSendFailedMessage, 1);
                    return;
                }

                LogicLong streamId = message.GetStreamEntryId();

                if (alliance.StreamEntryList.IndexOf(streamId) != -1)
                {
                    StreamEntry streamEntry = StreamManager.GetAllianceStream(message.GetStreamEntryId());

                    if (streamEntry.GetStreamEntryType() == StreamEntryType.JOIN_REQUEST)
                    {
                        JoinRequestAllianceStreamEntry joinRequestAllianceStreamEntry = (JoinRequestAllianceStreamEntry)streamEntry;

                        if (joinRequestAllianceStreamEntry.GetState() == 1)
                        {
                            if (message.IsAccepted())
                            {
                                ServerRequestManager.Create(new GameJoinAllianceRequestMessage
                                {
                                    AccountId  = joinRequestAllianceStreamEntry.GetSenderAvatarId(),
                                    AllianceId = alliance.Id,
                                    Invited    = true
                                }, ServerManager.GetDocumentSocket(9, joinRequestAllianceStreamEntry.GetSenderAvatarId())).OnComplete = args =>
                                {
                                    if (this.m_session.IsDestructed())
                                    {
                                        return;
                                    }

                                    if (args.ErrorCode == ServerRequestError.Success)
                                    {
                                        if (args.ResponseMessage.Success)
                                        {
                                            joinRequestAllianceStreamEntry.SetState(2);
                                            joinRequestAllianceStreamEntry.SetResponderName(memberEntry.GetName());
                                            alliance.UpdateStreamEntry(joinRequestAllianceStreamEntry);

                                            StreamManager.Save(joinRequestAllianceStreamEntry);
                                        }
                                        else
                                        {
                                            GameJoinAllianceResponseMessage     gameJoinAllianceResponseMessage     = (GameJoinAllianceResponseMessage)args.ResponseMessage;
                                            AllianceInvitationSendFailedMessage allianceInvitationSendFailedMessage = new AllianceInvitationSendFailedMessage();

                                            switch (gameJoinAllianceResponseMessage.ErrorReason)
                                            {
                                            case GameJoinAllianceResponseMessage.Reason.NO_CASTLE:
                                                allianceInvitationSendFailedMessage.SetReason(AllianceInvitationSendFailedMessage.Reason.NO_CASTLE);

                                                if (joinRequestAllianceStreamEntry.GetState() == 1)
                                                {
                                                    alliance.RemoveStreamEntry(joinRequestAllianceStreamEntry.GetId());
                                                    AllianceManager.Save(alliance);
                                                }

                                                break;

                                            case GameJoinAllianceResponseMessage.Reason.ALREADY_IN_ALLIANCE:
                                                allianceInvitationSendFailedMessage.SetReason(AllianceInvitationSendFailedMessage.Reason.ALREADY_IN_ALLIANCE);

                                                if (joinRequestAllianceStreamEntry.GetState() == 1)
                                                {
                                                    alliance.RemoveStreamEntry(joinRequestAllianceStreamEntry.GetId());
                                                    AllianceManager.Save(alliance);
                                                }

                                                break;

                                            default:
                                                allianceInvitationSendFailedMessage.SetReason(AllianceInvitationSendFailedMessage.Reason.GENERIC);
                                                break;
                                            }

                                            this.m_session.SendPiranhaMessage(allianceInvitationSendFailedMessage, 1);
                                        }
                                    }
                                    else
                                    {
                                        AllianceInvitationSendFailedMessage allianceInvitationSendFailedMessage = new AllianceInvitationSendFailedMessage();
                                        allianceInvitationSendFailedMessage.SetReason(AllianceInvitationSendFailedMessage.Reason.GENERIC);
                                        this.m_session.SendPiranhaMessage(allianceInvitationSendFailedMessage, 1);
                                    }
                                };
                            }
                            else
                            {
                                joinRequestAllianceStreamEntry.SetState(0);
                                joinRequestAllianceStreamEntry.SetResponderName(memberEntry.GetName());
                                alliance.UpdateStreamEntry(joinRequestAllianceStreamEntry);

                                StreamManager.Save(joinRequestAllianceStreamEntry);

                                JoinAllianceResponseAvatarStreamEntry joinAllianceResponseAvatarStreamEntry = new JoinAllianceResponseAvatarStreamEntry();

                                joinAllianceResponseAvatarStreamEntry.SetSenderAvatarId(memberEntry.GetAvatarId());
                                joinAllianceResponseAvatarStreamEntry.SetSenderHomeId(memberEntry.GetHomeId());
                                joinAllianceResponseAvatarStreamEntry.SetSenderName(memberEntry.GetName());
                                joinAllianceResponseAvatarStreamEntry.SetSenderLevel(memberEntry.GetExpLevel());
                                joinAllianceResponseAvatarStreamEntry.SetSenderLeagueType(memberEntry.GetLeagueType());

                                joinAllianceResponseAvatarStreamEntry.SetAllianceId(alliance.Id);
                                joinAllianceResponseAvatarStreamEntry.SetAllianceName(alliance.Header.GetAllianceName());
                                joinAllianceResponseAvatarStreamEntry.SetAllianceBadgeId(alliance.Header.GetAllianceBadgeId());

                                ServerMessageManager.SendMessage(new CreateAvatarStreamMessage
                                {
                                    AccountId = joinRequestAllianceStreamEntry.GetSenderAvatarId(),
                                    Entry     = joinAllianceResponseAvatarStreamEntry
                                }, 9);
                            }
                        }
                    }
                }
            }
        }
        private void OnCancelChallengeMessageReceived(CancelChallengeMessage message)
        {
            if (this.m_session.Alliance != null)
            {
                Alliance            alliance    = this.m_session.Alliance;
                AllianceMemberEntry memberEntry = alliance.Members[this.m_session.AccountId];

                for (int i = 0; i < alliance.StreamEntryList.Size(); i++)
                {
                    StreamEntry streamEntry = StreamManager.GetAllianceStream(alliance.StreamEntryList[i]);

                    if (streamEntry != null && streamEntry.GetStreamEntryType() == StreamEntryType.CHALLENGE && streamEntry.GetSenderAvatarId().Equals(memberEntry.GetAvatarId()))
                    {
                        ChallengeStreamEntry prevChallengeStreamEntry = (ChallengeStreamEntry)streamEntry;

                        if (prevChallengeStreamEntry.IsStarted())
                        {
                            return;
                        }

                        alliance.RemoveStreamEntry(streamEntry.GetId());
                    }
                }
            }
        }
        private void OnChangeAllianceMemberRoleMessageReceived(ChangeAllianceMemberRoleMessage message)
        {
            if (this.m_session.Alliance != null)
            {
                LogicLong memberId = message.RemoveMemberId();

                if (!this.m_session.Alliance.Members.TryGetValue(memberId, out AllianceMemberEntry memberEntry))
                {
                    return;
                }

                AllianceMemberEntry eventMemberEntry = this.m_session.Alliance.Members[this.m_session.AccountId];

                if (message.GetMemberRole() == LogicAvatarAllianceRole.MEMBER ||
                    message.GetMemberRole() == LogicAvatarAllianceRole.LEADER ||
                    message.GetMemberRole() == LogicAvatarAllianceRole.ELDER ||
                    message.GetMemberRole() == LogicAvatarAllianceRole.CO_LEADER)
                {
                    if (memberEntry.HasLowerRoleThan(eventMemberEntry.GetAllianceRole()) &&
                        !eventMemberEntry.HasLowerRoleThan(message.GetMemberRole()))
                    {
                        if (message.GetMemberRole() == LogicAvatarAllianceRole.LEADER)
                        {
                            this.m_session.Alliance.ChangeMemberRole(eventMemberEntry, LogicAvatarAllianceRole.CO_LEADER, eventMemberEntry.GetAvatarId(), eventMemberEntry.GetName());
                        }
                        this.m_session.Alliance.ChangeMemberRole(memberEntry, message.GetMemberRole(), memberEntry.GetAvatarId(), memberEntry.GetName());

                        AllianceManager.Save(this.m_session.Alliance);
                    }
                }
            }
        }