Пример #1
0
        public void ResetSexe(string packet)
        {
            SpinWait.SpinUntil(() => !ServerManager.Instance.inFamilyRefreshMode);
            byte rank = 0;

            string[] packetsplit = packet.Split(' ');
            if (packetsplit.Length != 3)
            {
                return;
            }


            if (Session.Character.Family != null && Session.Character.FamilyCharacter != null && Session.Character.FamilyCharacter.Authority == FamilyAuthority.Head && byte.TryParse(packetsplit[2], out rank))
            {
                foreach (FamilyCharacterDTO fchar in Session.Character.Family.FamilyCharacters)
                {
                    FamilyCharacterDTO fchar2 = fchar;
                    fchar2.Rank = 0;
                    DAOFactory.FamilyCharacterDAO.InsertOrUpdate(ref fchar2);
                }
                FamilyDTO fam = Session.Character.Family;
                fam.FamilyHeadGender = (GenderType)rank;
                DAOFactory.FamilyDAO.InsertOrUpdate(ref fam);
                ServerManager.Instance.FamilyRefresh(Session.Character.Family.FamilyId);
                System.Reactive.Linq.Observable.Timer(TimeSpan.FromMilliseconds(100))
                .Subscribe(
                    o =>
                {
                    Session.SendPacket(Session.Character.GenerateGInfo());
                    Session.SendPacket(Session.Character.GenerateFamilyMember());
                    Session.SendPacket(Session.Character.GenerateFamilyMemberMessage());
                });
                int?sentChannelId = ServerCommunicationClient.Instance.HubProxy.Invoke <int?>("SendMessageToCharacter", Session.Character.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("FAMILY_HEAD_CHANGE_GENDER")), 0), ServerManager.Instance.ChannelId, MessageType.Family, fam.FamilyId.ToString(), null).Result;
            }
        }
Пример #2
0
        private void ExecuteHandler(ClientSession session)
        {
            if (session.Character.Family != null && session.Character.FamilyCharacter?.Authority == FamilyAuthority.Head)
            {
                FamilyCharacterDTO fchar =
                    session.Character.Family.FamilyCharacters.Find(s => s.Character.Name == CharacterName);
                if (fchar != null)
                {
                    fchar.Rank = (FamilyMemberRank)Rank;

                    GameLogger.Instance.LogGuildTitle(ServerManager.Instance.ChannelId, session.Character.Name,
                                                      session.Character.CharacterId, session.Character.Family.Name, session.Character.Family.FamilyId,
                                                      CharacterName, fchar.CharacterId, fchar.Rank);

                    DAOFactory.FamilyCharacterDAO.InsertOrUpdate(ref fchar);
                    ServerManager.Instance.FamilyRefresh(session.Character.Family.FamilyId);
                    CommunicationServiceClient.Instance.SendMessageToCharacter(new ScsCharacterMessage
                    {
                        DestinationCharacterId = session.Character.Family.FamilyId,
                        SourceCharacterId      = session.Character.CharacterId,
                        SourceWorldId          = ServerManager.Instance.WorldId,
                        Message = "fhis_stc",
                        Type    = MessageType.Family
                    });
                }
            }
        }
Пример #3
0
        public void TitleChange(string packet)
        {
            SpinWait.SpinUntil(() => !ServerManager.Instance.InFamilyRefreshMode);
            if (Session.Character.Family != null && Session.Character.FamilyCharacter != null && Session.Character.FamilyCharacter.Authority == FamilyAuthority.Head)
            {
                string[] packetsplit = packet.Split(' ');
                if (packetsplit.Length != 4)
                {
                    return;
                }

                FamilyCharacterDTO fchar = Session.Character.Family.FamilyCharacters.FirstOrDefault(s => s.Character.Name == packetsplit[2]);
                if (fchar != null && byte.TryParse(packetsplit[3], out byte rank))
                {
                    fchar.Rank = (FamilyMemberRank)rank;
                    DAOFactory.FamilyCharacterDAO.InsertOrUpdate(ref fchar);
                    ServerManager.Instance.FamilyRefresh(Session.Character.Family.FamilyId);
                    CommunicationServiceClient.Instance.SendMessageToCharacter(new SCSCharacterMessage()
                    {
                        DestinationCharacterId = Session.Character.Family.FamilyId,
                        SourceCharacterId      = Session.Character.CharacterId,
                        SourceWorldId          = ServerManager.Instance.WorldId,
                        Message = "fhis_stc",
                        Type    = MessageType.Family
                    }); Session.SendPacket(Session.Character.GenerateFamilyMember());
                    Session.SendPacket(Session.Character.GenerateFamilyMemberMessage());
                }
            }
        }
Пример #4
0
        public void ResetSex(string packet)
        {
            SpinWait.SpinUntil(() => !ServerManager.Instance.inFamilyRefreshMode);
            string[] packetsplit = packet.Split(' ');
            if (packetsplit.Length != 3)
            {
                return;
            }
            byte rank;

            if (Session.Character.Family != null && Session.Character.FamilyCharacter != null && Session.Character.FamilyCharacter.Authority == FamilyAuthority.Head && byte.TryParse(packetsplit[2], out rank))
            {
                foreach (FamilyCharacter familyCharacter in Session.Character.Family.FamilyCharacters)
                {
                    FamilyCharacterDTO familyCharacterDto = familyCharacter;
                    familyCharacterDto.Rank = 0;
                    DAOFactory.FamilyCharacterDAO.InsertOrUpdate(ref familyCharacterDto);
                }
                FamilyDTO fam = Session.Character.Family;
                fam.FamilyHeadGender = (GenderType)rank;
                DAOFactory.FamilyDAO.InsertOrUpdate(ref fam);
                ServerManager.Instance.FamilyRefresh(Session.Character.Family.FamilyId);
                int?sentChannelId2 = ServerCommunicationClient.Instance.HubProxy.Invoke <int?>("SendMessageToCharacter", ServerManager.Instance.ServerGroup, string.Empty, Session.Character.Family.FamilyId.ToString(), "fhis_stc", ServerManager.Instance.ChannelId, MessageType.Family).Result;
                Session.SendPacket(Session.Character.GenerateGInfo());
                Session.SendPacket(Session.Character.GenerateFamilyMember());
                Session.SendPacket(Session.Character.GenerateFamilyMemberMessage());

                int?sentChannelId = ServerCommunicationClient.Instance.HubProxy.Invoke <int?>("SendMessageToCharacter", ServerManager.Instance.ServerGroup, Session.Character.Name, fam.FamilyId.ToString(), UserInterfaceHelper.Instance.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("FAMILY_HEAD_CHANGE_GENDER")), 0), ServerManager.Instance.ChannelId, MessageType.Family).Result;
            }
        }
Пример #5
0
 public void TodayMessage(string packet)
 {
     SpinWait.SpinUntil(() => !ServerManager.Instance.InFamilyRefreshMode);
     if (Session.Character.Family != null && Session.Character.FamilyCharacter != null)
     {
         string msg = string.Empty;
         int    i   = 0;
         foreach (string str in packet.Split(' '))
         {
             if (i > 1)
             {
                 msg += str + " ";
             }
             i++;
         }
         bool islog = Session.Character.Family.FamilyLogs.Any(s => s.FamilyLogType == FamilyLogType.DailyMessage && s.FamilyLogData.StartsWith(Session.Character.Name) && s.Timestamp.AddDays(1) > DateTime.Now);
         if (!islog)
         {
             Session.Character.FamilyCharacter.DailyMessage = msg;
             FamilyCharacterDTO fchar = Session.Character.FamilyCharacter;
             DAOFactory.FamilyCharacterDAO.InsertOrUpdate(ref fchar);
             Session.SendPacket(Session.Character.GenerateFamilyMemberMessage());
             Session.Character.Family.InsertFamilyLog(FamilyLogType.DailyMessage, Session.Character.Name, message: msg);
         }
         else
         {
             Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("CANT_CHANGE_MESSAGE")));
         }
     }
 }
        public SaveResult InsertOrUpdate(ref FamilyCharacterDTO character)
        {
            try
            {
                using (OpenNosContext context = DataAccessHelper.CreateContext())
                {
                    long            familyCharacterId = character.FamilyCharacterId;
                    FamilyCharacter entity            = context.FamilyCharacter.FirstOrDefault(c => c.FamilyCharacterId.Equals(familyCharacterId));

                    if (entity == null)
                    {
                        character = Insert(character, context);
                        return(SaveResult.Inserted);
                    }

                    character = Update(entity, character, context);
                    return(SaveResult.Updated);
                }
            }
            catch (Exception e)
            {
                Logger.Error(string.Format(Language.Instance.GetMessageFromKey("INSERT_ERROR"), character, e.Message), e);
                return(SaveResult.Error);
            }
        }
Пример #7
0
        public void TitleChange(string packet)
        {
            SpinWait.SpinUntil(() => !ServerManager.Instance.inFamilyRefreshMode);
            if (Session.Character.Family != null && Session.Character.FamilyCharacter != null && Session.Character.FamilyCharacter.Authority == FamilyAuthority.Head)
            {
                string[] packetsplit = packet.Split(' ');
                byte     rank        = 0;
                if (packetsplit.Length != 4)
                {
                    return;
                }

                FamilyCharacterDTO fchar = Session.Character.Family.FamilyCharacters.FirstOrDefault(s => s.Character.Name == packetsplit[2]);
                if (fchar != null && byte.TryParse(packetsplit[3], out rank))
                {
                    fchar.Rank = (FamilyMemberRank)rank;
                    DAOFactory.FamilyCharacterDAO.InsertOrUpdate(ref fchar);
                    ServerManager.Instance.FamilyRefresh(Session.Character.Family.FamilyId);

                    System.Reactive.Linq.Observable.Timer(TimeSpan.FromMilliseconds(100))
                    .Subscribe(
                        o =>
                    {
                        Session.SendPacket(Session.Character.GenerateFamilyMember());
                        Session.SendPacket(Session.Character.GenerateFamilyMemberMessage());
                    });
                }
            }
        }
Пример #8
0
        private void ExecuteHandler(ClientSession session)
        {
            if (session.Character.Family != null && session.Character.FamilyCharacter != null)
            {
                GameLogger.Instance.LogGuildToday(ServerManager.Instance.ChannelId, session.Character.Name,
                                                  session.Character.CharacterId, session.Character.Family.Name, session.Character.Family.FamilyId,
                                                  Message);

                bool islog = session.Character.Family.FamilyLogs.Any(s =>
                                                                     s.FamilyLogType == FamilyLogType.DailyMessage &&
                                                                     s.FamilyLogData.StartsWith(session.Character.Name, StringComparison.CurrentCulture) &&
                                                                     s.Timestamp.AddDays(1) > DateTime.UtcNow);
                if (!islog)
                {
                    session.Character.FamilyCharacter.DailyMessage = Message;
                    FamilyCharacterDTO fchar = session.Character.FamilyCharacter;
                    DAOFactory.FamilyCharacterDAO.InsertOrUpdate(ref fchar);
                    session.Character.Family.InsertFamilyLog(FamilyLogType.DailyMessage, session.Character.Name,
                                                             message: Message);
                }
                else
                {
                    session.SendPacket(
                        UserInterfaceHelper.GenerateInfo(Language.Instance.GetMessageFromKey("CANT_CHANGE_MESSAGE")));
                }
            }
        }
 public FamilyCharacter(FamilyCharacterDTO input)
 {
     Authority         = input.Authority;
     CharacterId       = input.CharacterId;
     DailyMessage      = input.DailyMessage;
     Experience        = input.Experience;
     FamilyCharacterId = input.FamilyCharacterId;
     FamilyId          = input.FamilyId;
     Rank = input.Rank;
 }
Пример #10
0
        public void CreateFamily(string packet)
        {
            SpinWait.SpinUntil(() => !ServerManager.Instance.inFamilyRefreshMode);

            if (Session.Character.Group != null && Session.Character.Group.CharacterCount == 3)
            {
                foreach (ClientSession s in Session.Character.Group.Characters)
                {
                    if (s.Character.Family != null || s.Character.FamilyCharacter != null)
                    {
                        return;
                    }
                }
                if (Session.Character.Gold < 200000)
                {
                    Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("NOT_ENOUGH_MONEY")));
                    return;
                }
                string name = packet.Split(' ')[2];
                if (DAOFactory.FamilyDAO.LoadByName(name) != null)
                {
                    Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("FAMILY_NAME_ALREADY_USED")));
                    return;
                }
                Session.Character.Gold -= 200000;
                Session.SendPacket(Session.Character.GenerateGold());
                FamilyDTO family = new FamilyDTO
                {
                    Name             = name,
                    FamilyExperience = 0,
                    FamilyLevel      = 1,
                    FamilyMessage    = string.Empty,
                    MaxSize          = 50
                };
                DAOFactory.FamilyDAO.InsertOrUpdate(ref family);

                ServerManager.Instance.Broadcast(UserInterfaceHelper.Instance.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("FAMILY_FOUNDED"), name), 0));
                foreach (ClientSession c in Session.Character.Group.Characters)
                {
                    FamilyCharacterDTO familyCharacter = new FamilyCharacterDTO
                    {
                        CharacterId  = c.Character.CharacterId,
                        DailyMessage = string.Empty,
                        Experience   = 0,
                        Authority    = Session.Character.CharacterId == c.Character.CharacterId ? FamilyAuthority.Head : FamilyAuthority.Assistant,
                        FamilyId     = family.FamilyId,
                        Rank         = 0
                    };
                    DAOFactory.FamilyCharacterDAO.InsertOrUpdate(ref familyCharacter);
                }
                ServerManager.Instance.FamilyRefresh(family.FamilyId);
                int?sentChannelId2 = ServerCommunicationClient.Instance.HubProxy.Invoke <int?>("SendMessageToCharacter", ServerManager.Instance.ServerGroup, string.Empty, family.FamilyId.ToString(), "fhis_stc", ServerManager.Instance.ChannelId, MessageType.Family).Result;
                Session.Character.Group.Characters.ForEach(s => s.CurrentMapInstance.Broadcast(s.Character.GenerateGidx()));
            }
        }
Пример #11
0
        public void FamilyKick(string packet)
        {
            string[] packetsplit = packet.Split(' ');
            if (packetsplit.Length == 3)
            {
                if (Session.Character.Family == null || Session.Character.FamilyCharacter == null)
                {
                    return;
                }
                if (Session.Character.FamilyCharacter.Authority == FamilyAuthority.Member)
                {
                    Session.SendPacket(Session.Character.GenerateInfo(string.Format(Language.Instance.GetMessageFromKey("NOT_ALLOWED_KICK"))));
                    return;
                }
                ClientSession kickSession = ServerManager.Instance.GetSessionByCharacterName(packetsplit[2]);
                if (kickSession != null && kickSession.Character.Family?.FamilyId == Session.Character.Family.FamilyId)
                {
                    if (kickSession.Character.FamilyCharacter?.Authority == FamilyAuthority.Head)
                    {
                        Session.SendPacket(Session.Character.GenerateInfo(Language.Instance.GetMessageFromKey("CANT_KICK_HEAD")));
                        return;
                    }
                    if (kickSession.Character.CharacterId == Session.Character.CharacterId)
                    {
                        Session.SendPacket(Session.Character.GenerateInfo(Language.Instance.GetMessageFromKey("CANT_KICK_YOURSELF")));
                        return;
                    }
                    DAOFactory.FamilyCharacterDAO.Delete(packetsplit[2]);
                    Session.Character.Family.InsertFamilyLog(FamilyLogType.FamilyManage, kickSession.Character.Name, "", "", "", 0, 0, 0, 0, 0);

                    System.Reactive.Linq.Observable.Timer(TimeSpan.FromMilliseconds(100))
                    .Subscribe(
                        o =>
                    {
                        kickSession.CurrentMapInstance?.Broadcast(kickSession.Character.GenerateGidx());
                    });
                }
                else
                {
                    CharacterDTO dbCharacter = DAOFactory.CharacterDAO.LoadByName(packetsplit[2]);
                    if (dbCharacter != null)
                    {
                        FamilyCharacterDTO dbFamilyCharacter = DAOFactory.FamilyCharacterDAO.LoadByCharacterId(dbCharacter.CharacterId);
                        if (dbFamilyCharacter != null && dbFamilyCharacter.FamilyId == Session.Character.Family.FamilyId)
                        {
                            DAOFactory.FamilyCharacterDAO.Delete(packetsplit[2]);
                            Session.Character.Family.InsertFamilyLog(FamilyLogType.FamilyManage, dbCharacter.Name, "", "", "", 0, 0, 0, 0, 0);
                        }
                    }
                }
            }
        }
Пример #12
0
        public void FamilyKick(string packet)
        {
            string[] packetsplit = packet.Split(' ');
            if (packetsplit.Length == 3)
            {
                if (Session.Character.Family == null || Session.Character.FamilyCharacter == null)
                {
                    return;
                }
                if (Session.Character.FamilyCharacter.Authority == FamilyAuthority.Member)
                {
                    Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(string.Format(Language.Instance.GetMessageFromKey("NOT_ALLOWED_KICK"))));
                    return;
                }
                ClientSession kickSession = ServerManager.Instance.GetSessionByCharacterName(packetsplit[2]);
                if (kickSession != null && kickSession.Character.Family?.FamilyId == Session.Character.Family.FamilyId)
                {
                    if (kickSession.Character.FamilyCharacter?.Authority == FamilyAuthority.Head)
                    {
                        Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("CANT_KICK_HEAD")));
                        return;
                    }
                    if (kickSession.Character.CharacterId == Session.Character.CharacterId)
                    {
                        Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("CANT_KICK_YOURSELF")));
                        return;
                    }
                    DAOFactory.FamilyCharacterDAO.Delete(packetsplit[2]);
                    Session.Character.Family.InsertFamilyLog(FamilyLogType.FamilyManaged, kickSession.Character.Name);

                    kickSession.CurrentMapInstance?.Broadcast(kickSession.Character.GenerateGidx());
                }
                else
                {
                    CharacterDTO dbCharacter = DAOFactory.CharacterDAO.LoadByName(packetsplit[2]);
                    if (dbCharacter != null)
                    {
                        FamilyCharacterDTO dbFamilyCharacter = DAOFactory.FamilyCharacterDAO.LoadByCharacterId(dbCharacter.CharacterId);
                        if (dbFamilyCharacter != null && dbFamilyCharacter.FamilyId == Session.Character.Family.FamilyId)
                        {
                            if (dbFamilyCharacter.Authority == FamilyAuthority.Head)
                            {
                                Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("CANT_KICK_HEAD")));
                                return;
                            }
                            DAOFactory.FamilyCharacterDAO.Delete(packetsplit[2]);
                            Session.Character.Family.InsertFamilyLog(FamilyLogType.FamilyManaged, dbCharacter.Name);
                        }
                    }
                }
            }
        }
        private static FamilyCharacterDTO Insert(FamilyCharacterDTO character, OpenNosContext context)
        {
            FamilyCharacter entity = new FamilyCharacter();

            Mapper.Mappers.FamilyCharacterMapper.ToFamilyCharacter(character, entity);
            context.FamilyCharacter.Add(entity);
            context.SaveChanges();
            if (Mapper.Mappers.FamilyCharacterMapper.ToFamilyCharacterDTO(entity, character))
            {
                return(character);
            }

            return(null);
        }
 public IList <FamilyCharacterDTO> LoadByFamilyId(long familyId)
 {
     using (OpenNosContext context = DataAccessHelper.CreateContext())
     {
         List <FamilyCharacterDTO> result = new List <FamilyCharacterDTO>();
         foreach (FamilyCharacter entity in context.FamilyCharacter.AsNoTracking().Where(fc => fc.FamilyId.Equals(familyId)))
         {
             FamilyCharacterDTO dto = new FamilyCharacterDTO();
             Mapper.Mappers.FamilyCharacterMapper.ToFamilyCharacterDTO(entity, dto);
             result.Add(dto);
         }
         return(result);
     }
 }
        private static FamilyCharacterDTO Update(FamilyCharacter entity, FamilyCharacterDTO character, OpenNosContext context)
        {
            if (entity != null)
            {
                Mapper.Mappers.FamilyCharacterMapper.ToFamilyCharacter(character, entity);
                context.SaveChanges();
            }
            if (Mapper.Mappers.FamilyCharacterMapper.ToFamilyCharacterDTO(entity, character))
            {
                return(character);
            }

            return(null);
        }
Пример #16
0
        public static FamilyCharacter FromDTO(FamilyCharacterDTO familyCharacterDTO)
        {
            FamilyCharacter familyCharacter = new FamilyCharacter();

            familyCharacter.Authority         = familyCharacterDTO.Authority;
            familyCharacter.CharacterId       = familyCharacterDTO.CharacterId;
            familyCharacter.DailyMessage      = familyCharacterDTO.DailyMessage;
            familyCharacter.Experience        = familyCharacterDTO.Experience;
            familyCharacter.FamilyCharacterId = familyCharacterDTO.FamilyCharacterId;
            familyCharacter.FamilyId          = familyCharacterDTO.FamilyId;
            familyCharacter.Rank = familyCharacterDTO.Rank;

            return(familyCharacter);
        }
Пример #17
0
 public static bool ToFamilyCharacterDTO(FamilyCharacter input, FamilyCharacterDTO output)
 {
     if (input == null)
     {
         return(false);
     }
     output.Authority         = input.Authority;
     output.CharacterId       = input.CharacterId;
     output.DailyMessage      = input.DailyMessage;
     output.Experience        = input.Experience;
     output.FamilyCharacterId = input.FamilyCharacterId;
     output.FamilyId          = input.FamilyId;
     output.Rank = input.Rank;
     return(true);
 }
        private void ExecuteHandler(ClientSession session)
        {
            if (Type == 1)
            {
                ClientSession inviteSession = ServerManager.Instance.GetSessionByCharacterId(CharacterId);
                if (inviteSession?.Character.FamilyInviteCharacters.GetAllItems()
                    .Contains(session.Character.CharacterId) == true && inviteSession.Character.Family?.FamilyCharacters != null)
                {
                    if (inviteSession.Character.Family.FamilyCharacters.Count + 1
                        > inviteSession.Character.Family.MaxSize || session.Character.Family != null)
                    {
                        return;
                    }

                    FamilyCharacterDTO familyCharacter = new FamilyCharacterDTO
                    {
                        CharacterId  = session.Character.CharacterId,
                        DailyMessage = string.Empty,
                        Experience   = 0,
                        Authority    = FamilyAuthority.Member,
                        FamilyId     = inviteSession.Character.Family.FamilyId,
                        Rank         = 0
                    };
                    DAOFactory.FamilyCharacterDAO.InsertOrUpdate(ref familyCharacter);
                    inviteSession.Character.Family.InsertFamilyLog(FamilyLogType.UserManaged,
                                                                   inviteSession.Character.Name, session.Character.Name);

                    GameLogger.Instance.LogGuildJoin(ServerManager.Instance.ChannelId, session.Character.Name,
                                                     session.Character.CharacterId, inviteSession.Character.Family.Name,
                                                     inviteSession.Character.Family.FamilyId);

                    CommunicationServiceClient.Instance.SendMessageToCharacter(new ScsCharacterMessage
                    {
                        DestinationCharacterId = inviteSession.Character.Family.FamilyId,
                        SourceCharacterId      = session.Character.CharacterId,
                        SourceWorldId          = ServerManager.Instance.WorldId,
                        Message = UserInterfaceHelper.GenerateMsg(
                            string.Format(Language.Instance.GetMessageFromKey("FAMILY_JOINED"), session.Character.Name,
                                          inviteSession.Character.Family.Name), 0),
                        Type = MessageType.Family
                    });
                }
            }
        }
Пример #19
0
        public void JoinFamily(string packet)
        {
            SpinWait.SpinUntil(() => !ServerManager.Instance.inFamilyRefreshMode);
            string[] packetsplit = packet.Split(' ');
            long     characterId;

            if (packetsplit.Length == 4 && long.TryParse(packetsplit[3], out characterId) && packetsplit[2] == "1")
            {
                ClientSession inviteSession = ServerManager.Instance.GetSessionByCharacterId(characterId);
                if (inviteSession != null &&
                    inviteSession.Character.FamilyInviteCharacters.Contains(Session.Character.CharacterId) && inviteSession.Character.Family != null && inviteSession.Character.Family.FamilyCharacters != null)
                {
                    if (inviteSession.Character.Family.FamilyCharacters.Count() + 1 > inviteSession.Character.Family.MaxSize)
                    {
                        return;
                    }
                    FamilyCharacterDTO familyCharacter = new FamilyCharacterDTO
                    {
                        CharacterId  = Session.Character.CharacterId,
                        DailyMessage = string.Empty,
                        Experience   = 0,
                        Authority    = FamilyAuthority.Member,
                        FamilyId     = inviteSession.Character.Family.FamilyId,
                        Rank         = 0
                    };
                    DAOFactory.FamilyCharacterDAO.InsertOrUpdate(ref familyCharacter);
                    inviteSession.Character.Family.InsertFamilyLog(FamilyLogType.UserManaged,
                                                                   inviteSession.Character.Name, Session.Character.Name);
                    int?sentChannelId =
                        ServerCommunicationClient.Instance.HubProxy.Invoke <int?>("SendMessageToCharacter", ServerManager.Instance.ServerGroup, Session.Character.Name,
                                                                                  inviteSession.Character.Family.FamilyId.ToString(),
                                                                                  UserInterfaceHelper.Instance.GenerateMsg(
                                                                                      string.Format(Language.Instance.GetMessageFromKey("FAMILY_JOINED"),
                                                                                                    Session.Character.Name, inviteSession.Character.Family.Name), 0),
                                                                                  ServerManager.Instance.ChannelId, MessageType.Family).Result;

                    Session.CurrentMapInstance?.Broadcast(Session.Character.GenerateGidx());
                    Session.SendPacket(Session.Character.GenerateFamilyMember());
                    Session.SendPacket(Session.Character.GenerateFamilyMemberMessage());
                    Session.SendPacket(Session.Character.GenerateFamilyMemberExp());
                }
            }
        }
Пример #20
0
        public void ResetSex(string packet)
        {
            SpinWait.SpinUntil(() => !ServerManager.Instance.InFamilyRefreshMode);
            string[] packetsplit = packet.Split(' ');
            if (packetsplit.Length != 3)
            {
                return;
            }
            if (Session.Character.Family != null && Session.Character.FamilyCharacter != null && Session.Character.FamilyCharacter.Authority == FamilyAuthority.Head && byte.TryParse(packetsplit[2], out byte rank))
            {
                foreach (FamilyCharacter familyCharacter in Session.Character.Family.FamilyCharacters)
                {
                    FamilyCharacterDTO familyCharacterDto = familyCharacter;
                    familyCharacterDto.Rank = 0;
                    DAOFactory.FamilyCharacterDAO.InsertOrUpdate(ref familyCharacterDto);
                }
                FamilyDTO fam = Session.Character.Family;
                fam.FamilyHeadGender = (GenderType)rank;
                DAOFactory.FamilyDAO.InsertOrUpdate(ref fam);
                ServerManager.Instance.FamilyRefresh(Session.Character.Family.FamilyId);
                CommunicationServiceClient.Instance.SendMessageToCharacter(new SCSCharacterMessage()
                {
                    DestinationCharacterId = fam.FamilyId,
                    SourceCharacterId      = Session.Character.CharacterId,
                    SourceWorldId          = ServerManager.Instance.WorldId,
                    Message = "fhis_stc",
                    Type    = MessageType.Family
                });
                Session.SendPacket(Session.Character.GenerateFamilyMember());
                Session.SendPacket(Session.Character.GenerateFamilyMemberMessage());

                CommunicationServiceClient.Instance.SendMessageToCharacter(new SCSCharacterMessage()
                {
                    DestinationCharacterId = fam.FamilyId,
                    SourceCharacterId      = Session.Character.CharacterId,
                    SourceWorldId          = ServerManager.Instance.WorldId,
                    Message = UserInterfaceHelper.Instance.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("FAMILY_HEAD_CHANGE_GENDER")), 0),
                    Type    = MessageType.Family
                });
            }
        }
Пример #21
0
        /// <summary>
        /// gjoin packet
        /// </summary>
        /// <param name="joinFamilyPacket"></param>
        public void JoinFamily(JoinFamilyPacket joinFamilyPacket)
        {
            SpinWait.SpinUntil(() => !ServerManager.Instance.InFamilyRefreshMode);
            long characterId = joinFamilyPacket.CharacterId;

            if (joinFamilyPacket.Type == 1)
            {
                ClientSession inviteSession = ServerManager.Instance.GetSessionByCharacterId(characterId);
                if (inviteSession != null && inviteSession.Character.FamilyInviteCharacters.Contains(Session.Character.CharacterId) && inviteSession.Character.Family != null && inviteSession.Character.Family.FamilyCharacters != null)
                {
                    if (inviteSession.Character.Family.FamilyCharacters.Count() + 1 > inviteSession.Character.Family.MaxSize)
                    {
                        return;
                    }
                    FamilyCharacterDTO familyCharacter = new FamilyCharacterDTO
                    {
                        CharacterId  = Session.Character.CharacterId,
                        DailyMessage = string.Empty,
                        Experience   = 0,
                        Authority    = FamilyAuthority.Member,
                        FamilyId     = inviteSession.Character.Family.FamilyId,
                        Rank         = 0
                    };
                    DAOFactory.FamilyCharacterDAO.InsertOrUpdate(ref familyCharacter);
                    inviteSession.Character.Family.InsertFamilyLog(FamilyLogType.UserManaged, inviteSession.Character.Name, Session.Character.Name);
                    CommunicationServiceClient.Instance.SendMessageToCharacter(new SCSCharacterMessage()
                    {
                        DestinationCharacterId = inviteSession.Character.Family.FamilyId,
                        SourceCharacterId      = Session.Character.CharacterId,
                        SourceWorldId          = ServerManager.Instance.WorldId,
                        Message = UserInterfaceHelper.Instance.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("FAMILY_JOINED"), Session.Character.Name, inviteSession.Character.Family.Name), 0),
                        Type    = MessageType.Family
                    });

                    Session.CurrentMapInstance?.Broadcast(Session.Character.GenerateGidx());
                    Session.SendPacket(Session.Character.GenerateFamilyMember());
                    Session.SendPacket(Session.Character.GenerateFamilyMemberMessage());
                    Session.SendPacket(Session.Character.GenerateFamilyMemberExp());
                }
            }
        }
Пример #22
0
        public FamilyCharacterDTO LoadById(long familyCharacterId)
        {
            try
            {
                using (OpenNosContext context = DataAccessHelper.CreateContext())
                {
                    FamilyCharacterDTO dto = new FamilyCharacterDTO();
                    if (Mapper.Mapper.Instance.FamilyCharacterMapper.ToFamilyCharacterDTO(context.FamilyCharacter.FirstOrDefault(c => c.FamilyCharacterId.Equals(familyCharacterId)), dto))
                    {
                        return(dto);
                    }

                    return(null);
                }
            }
            catch (Exception e)
            {
                Logger.Error(e);
                return(null);
            }
        }
        public FamilyCharacterDTO LoadByCharacterId(long characterId)
        {
            try
            {
                using (OpenNosContext context = DataAccessHelper.CreateContext())
                {
                    FamilyCharacterDTO dto = new FamilyCharacterDTO();
                    if (Mapper.Mappers.FamilyCharacterMapper.ToFamilyCharacterDTO(context.FamilyCharacter.AsNoTracking().FirstOrDefault(c => c.CharacterId == characterId), dto))
                    {
                        return(dto);
                    }

                    return(null);
                }
            }
            catch (Exception e)
            {
                Logger.Error(e);
                return(null);
            }
        }
        /// <summary>
        /// Char_DEL packet
        /// </summary>
        /// <param name="characterDeletePacket"></param>
        public void DeleteCharacter(CharacterDeletePacket characterDeletePacket)
        {
            if (Session.HasCurrentMapInstance)
            {
                return;
            }
            AccountDTO account = DaoFactory.AccountDao.LoadById(Session.Account.AccountId);

            if (account == null)
            {
                return;
            }

            if (account.Password.ToLower() == EncryptionBase.Sha512(characterDeletePacket.Password))
            {
                CharacterDTO character = DaoFactory.CharacterDao.LoadBySlot(account.AccountId, characterDeletePacket.Slot);
                if (character == null)
                {
                    return;
                }
                DaoFactory.GeneralLogDao.SetCharIdNull(Convert.ToInt64(character.CharacterId));
                DaoFactory.CharacterDao.DeleteByPrimaryKey(account.AccountId, characterDeletePacket.Slot);

                FamilyCharacterDTO familyCharacter = DaoFactory.FamilyCharacterDao.LoadByCharacterId(character.CharacterId);
                if (familyCharacter == null)
                {
                    LoadCharacters(string.Empty);
                    return;
                }
                // REMOVE FROM FAMILY
                DaoFactory.FamilyCharacterDao.Delete(character.Name);
                ServerManager.Instance.FamilyRefresh(familyCharacter.FamilyId);
            }
            else
            {
                Session.SendPacket($"info {Language.Instance.GetMessageFromKey("BAD_PASSWORD")}");
            }
        }
Пример #25
0
        private void ExecuteHandler(ClientSession session)
        {
            if (session.Character.Family != null && session.Character.FamilyCharacter?.Authority == FamilyAuthority.Head)
            {
                foreach (FamilyCharacter familyCharacter in session.Character.Family.FamilyCharacters)
                {
                    FamilyCharacterDTO familyCharacterDto = familyCharacter;
                    familyCharacterDto.Rank = 0;
                    DAOFactory.FamilyCharacterDAO.InsertOrUpdate(ref familyCharacterDto);
                }

                GameLogger.Instance.LogGuildResetSex(ServerManager.Instance.ChannelId, session.Character.Name,
                                                     session.Character.CharacterId, session.Character.Family.Name, session.Character.Family.FamilyId);

                FamilyDTO fam = session.Character.Family;
                fam.FamilyHeadGender = (GenderType)Rank;
                DAOFactory.FamilyDAO.InsertOrUpdate(ref fam);
                ServerManager.Instance.FamilyRefresh(session.Character.Family.FamilyId);
                CommunicationServiceClient.Instance.SendMessageToCharacter(new ScsCharacterMessage
                {
                    DestinationCharacterId = fam.FamilyId,
                    SourceCharacterId      = session.Character.CharacterId,
                    SourceWorldId          = ServerManager.Instance.WorldId,
                    Message = "fhis_stc",
                    Type    = MessageType.Family
                });

                CommunicationServiceClient.Instance.SendMessageToCharacter(new ScsCharacterMessage
                {
                    DestinationCharacterId = fam.FamilyId,
                    SourceCharacterId      = session.Character.CharacterId,
                    SourceWorldId          = ServerManager.Instance.WorldId,
                    Message = UserInterfaceHelper.GenerateMsg(
                        string.Format(Language.Instance.GetMessageFromKey("FAMILY_HEAD_CHANGE_GENDER")), 0),
                    Type = MessageType.Family
                });
            }
        }
Пример #26
0
        public void JoinFamily(string packet)
        {
            SpinWait.SpinUntil(() => !ServerManager.Instance.inFamilyRefreshMode);
            string[] packetsplit = packet.Split('^');
            long     characterId;

            if (packetsplit.Length == 3 && long.TryParse(packetsplit[2], out characterId) && packetsplit[1] == "1")
            {
                ClientSession inviteSession = ServerManager.Instance.GetSessionByCharacterId(characterId);
                if (inviteSession != null && inviteSession.Character.FamilyInviteCharacters.Contains(Session.Character.CharacterId))
                {
                    FamilyCharacterDTO familyCharacter = new FamilyCharacterDTO
                    {
                        CharacterId  = Session.Character.CharacterId,
                        DailyMessage = string.Empty,
                        Experience   = 0,
                        Authority    = FamilyAuthority.Member,
                        FamilyId     = inviteSession.Character.Family.FamilyId,
                        Rank         = 0,
                    };
                    DAOFactory.FamilyCharacterDAO.InsertOrUpdate(ref familyCharacter);
                    inviteSession.Character.Family.InsertFamilyLog(FamilyLogType.UserManage, inviteSession.Character.Name, Session.Character.Name, "", "", 0, 0, 0, 0, 0);
                    int?sentChannelId = ServerCommunicationClient.Instance.HubProxy.Invoke <int?>("SendMessageToCharacter", Session.Character.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("FAMILY_JOINED"), Session.Character.Name, inviteSession.Character.Family.Name), 0), ServerManager.Instance.ChannelId, MessageType.Family, inviteSession.Character.Family.FamilyId.ToString(), null).Result;

                    System.Reactive.Linq.Observable.Timer(TimeSpan.FromMilliseconds(100))
                    .Subscribe(
                        o =>
                    {
                        Session.CurrentMapInstance?.Broadcast(Session.Character.GenerateGidx());
                        Session.SendPacket(Session.Character.GenerateFamilyMember());
                        Session.SendPacket(Session.Character.GenerateFamilyMemberMessage());
                        Session.SendPacket(Session.Character.GenerateFamilyMemberExp());
                    });
                }
            }
        }
Пример #27
0
        public void TitleChange(string packet)
        {
            SpinWait.SpinUntil(() => !ServerManager.Instance.inFamilyRefreshMode);
            if (Session.Character.Family != null && Session.Character.FamilyCharacter != null && Session.Character.FamilyCharacter.Authority == FamilyAuthority.Head)
            {
                string[] packetsplit = packet.Split(' ');
                if (packetsplit.Length != 4)
                {
                    return;
                }

                FamilyCharacterDTO fchar = Session.Character.Family.FamilyCharacters.FirstOrDefault(s => s.Character.Name == packetsplit[2]);
                byte rank;
                if (fchar != null && byte.TryParse(packetsplit[3], out rank))
                {
                    fchar.Rank = (FamilyMemberRank)rank;
                    DAOFactory.FamilyCharacterDAO.InsertOrUpdate(ref fchar);
                    ServerManager.Instance.FamilyRefresh(Session.Character.Family.FamilyId);
                    int?sentChannelId2 = ServerCommunicationClient.Instance.HubProxy.Invoke <int?>("SendMessageToCharacter", ServerManager.Instance.ServerGroup, string.Empty, Session.Character.Family.FamilyId.ToString(), "fhis_stc", ServerManager.Instance.ChannelId, MessageType.Family).Result;
                    Session.SendPacket(Session.Character.GenerateFamilyMember());
                    Session.SendPacket(Session.Character.GenerateFamilyMemberMessage());
                }
            }
        }
Пример #28
0
        /// <summary>
        /// glmk packet
        /// </summary>
        /// <param name="createFamilyPacket"></param>
        public void CreateFamily(CreateFamilyPacket createFamilyPacket)
        {
            SpinWait.SpinUntil(() => !ServerManager.Instance.InFamilyRefreshMode);

            if (Session.Character.Group != null && Session.Character.Group.GroupType == GroupType.Group && Session.Character.Group.CharacterCount == 3)
            {
                foreach (ClientSession session in Session.Character.Group.Characters)
                {
                    if (session.Character.Family != null || session.Character.FamilyCharacter != null)
                    {
                        return;
                    }
                }
                if (Session.Character.Gold < 200000)
                {
                    Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("NOT_ENOUGH_MONEY")));
                    return;
                }
                string name = createFamilyPacket.CharacterName;
                if (DAOFactory.FamilyDAO.LoadByName(name) != null)
                {
                    Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("FAMILY_NAME_ALREADY_USED")));
                    return;
                }
                Session.Character.Gold -= 200000;
                Session.SendPacket(Session.Character.GenerateGold());
                FamilyDTO family = new FamilyDTO
                {
                    Name             = name,
                    FamilyExperience = 0,
                    FamilyLevel      = 1,
                    FamilyMessage    = string.Empty,
                    MaxSize          = 50
                };
                DAOFactory.FamilyDAO.InsertOrUpdate(ref family);

                ServerManager.Instance.Broadcast(UserInterfaceHelper.Instance.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("FAMILY_FOUNDED"), name), 0));
                foreach (ClientSession session in Session.Character.Group.Characters)
                {
                    FamilyCharacterDTO familyCharacter = new FamilyCharacterDTO
                    {
                        CharacterId  = session.Character.CharacterId,
                        DailyMessage = string.Empty,
                        Experience   = 0,
                        Authority    = Session.Character.CharacterId == session.Character.CharacterId ? FamilyAuthority.Head : FamilyAuthority.Assistant,
                        FamilyId     = family.FamilyId,
                        Rank         = 0
                    };
                    DAOFactory.FamilyCharacterDAO.InsertOrUpdate(ref familyCharacter);
                }
                ServerManager.Instance.FamilyRefresh(family.FamilyId);
                CommunicationServiceClient.Instance.SendMessageToCharacter(new SCSCharacterMessage()
                {
                    DestinationCharacterId = family.FamilyId,
                    SourceCharacterId      = Session.Character.CharacterId,
                    SourceWorldId          = ServerManager.Instance.WorldId,
                    Message = "fhis_stc",
                    Type    = MessageType.Family
                }); Session.Character.Group.Characters.ForEach(s => s.CurrentMapInstance.Broadcast(s.Character.GenerateGidx()));
            }
        }
Пример #29
0
        /// <summary>
        /// fmg packet
        /// </summary>
        /// <param name="familyManagementPacket"></param>
        public void FamilyManagement(FamilyManagementPacket familyManagementPacket)
        {
            SpinWait.SpinUntil(() => !ServerManager.Instance.InFamilyRefreshMode);
            if (Session.Character.Family == null)
            {
                return;
            }
            if (Session.Character.FamilyCharacter.Authority == FamilyAuthority.Member || Session.Character.FamilyCharacter.Authority == FamilyAuthority.Manager)
            {
                return;
            }
            long targetId = familyManagementPacket.TargetId;

            if (DAOFactory.FamilyCharacterDAO.LoadByCharacterId(targetId)?.FamilyId != Session.Character.FamilyCharacter.FamilyId)
            {
                return;
            }
            ClientSession targetSession = ServerManager.Instance.GetSessionByCharacterId(targetId);

            switch (familyManagementPacket.FamilyAuthorityType)
            {
            case FamilyAuthority.Head:
                if (targetSession == null)
                {
                    Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("PLAYER_OFFLINE")));
                    return;
                }
                if (Session.Character.FamilyCharacter.Authority != FamilyAuthority.Head)
                {
                    Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("NOT_FAMILY_HEAD")));
                    return;
                }
                if (targetSession.Character.FamilyCharacter.Authority != FamilyAuthority.Assistant)
                {
                    Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("ONLY_PROMOTE_ASSISTANT")));
                    return;
                }
                targetSession.Character.FamilyCharacter.Authority = FamilyAuthority.Head;
                FamilyCharacterDTO chara = targetSession.Character.FamilyCharacter;
                DAOFactory.FamilyCharacterDAO.InsertOrUpdate(ref chara);

                Session.Character.Family.Warehouse.GetAllItems().ForEach(s => { s.CharacterId = targetSession.Character.CharacterId; DAOFactory.IteminstanceDAO.InsertOrUpdate(s); });
                Session.Character.FamilyCharacter.Authority = FamilyAuthority.Assistant;
                FamilyCharacterDTO chara2 = Session.Character.FamilyCharacter;
                DAOFactory.FamilyCharacterDAO.InsertOrUpdate(ref chara2);

                Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("DONE")));

                break;

            case FamilyAuthority.Assistant:
                if (targetSession == null)
                {
                    Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("PLAYER_OFFLINE")));
                    return;
                }
                if (Session.Character.FamilyCharacter.Authority != FamilyAuthority.Head)
                {
                    Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("NOT_FAMILY_HEAD")));
                    return;
                }
                if (targetSession.Character.FamilyCharacter.Authority == FamilyAuthority.Head)
                {
                    Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("HEAD_UNDEMOTABLE")));
                    return;
                }
                if (DAOFactory.FamilyCharacterDAO.LoadByFamilyId(Session.Character.Family.FamilyId).Count(s => s.Authority == FamilyAuthority.Assistant) == 2)
                {
                    Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("ALREADY_TWO_ASSISTANT")));
                    return;
                }
                targetSession.Character.FamilyCharacter.Authority = FamilyAuthority.Assistant;
                Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("DONE")));

                chara = targetSession.Character.FamilyCharacter;
                DAOFactory.FamilyCharacterDAO.InsertOrUpdate(ref chara);

                break;

            case FamilyAuthority.Manager:
                if (targetSession == null)
                {
                    Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("PLAYER_OFFLINE")));
                    return;
                }
                if (targetSession.Character.FamilyCharacter.Authority == FamilyAuthority.Head)
                {
                    Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("HEAD_UNDEMOTABLE")));
                    return;
                }
                if (targetSession.Character.FamilyCharacter.Authority == FamilyAuthority.Assistant && Session.Character.FamilyCharacter.Authority != FamilyAuthority.Head)
                {
                    Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("ASSISTANT_UNDEMOTABLE")));
                    return;
                }
                targetSession.Character.FamilyCharacter.Authority = FamilyAuthority.Manager;
                Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("DONE")));

                chara = targetSession.Character.FamilyCharacter;
                DAOFactory.FamilyCharacterDAO.InsertOrUpdate(ref chara);

                break;

            case FamilyAuthority.Member:
                if (targetSession == null)
                {
                    Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("PLAYER_OFFLINE")));
                    return;
                }
                if (targetSession.Character.FamilyCharacter.Authority == FamilyAuthority.Head)
                {
                    Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("HEAD_UNDEMOTABLE")));
                    return;
                }
                if (targetSession.Character.FamilyCharacter.Authority == FamilyAuthority.Assistant && Session.Character.FamilyCharacter.Authority != FamilyAuthority.Head)
                {
                    Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("ASSISTANT_UNDEMOTABLE")));
                    return;
                }
                targetSession.Character.FamilyCharacter.Authority = FamilyAuthority.Member;
                Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(Language.Instance.GetMessageFromKey("DONE")));

                chara = targetSession.Character.FamilyCharacter;
                DAOFactory.FamilyCharacterDAO.InsertOrUpdate(ref chara);
                break;
            }
            Session.Character.Family.InsertFamilyLog(FamilyLogType.AuthorityChanged, Session.Character.Name, targetSession.Character.Name, authority: familyManagementPacket.FamilyAuthorityType);
            targetSession.CurrentMapInstance?.Broadcast(targetSession.Character.GenerateGidx());
            if (familyManagementPacket.FamilyAuthorityType == FamilyAuthority.Head)
            {
                Session.CurrentMapInstance?.Broadcast(Session.Character.GenerateGidx());
            }
        }
        private void ExecuteHandler(ClientSession session)
        {
            if (session.Character.Family == null || session.Character.FamilyCharacter == null)
            {
                return;
            }

            if (session.Character.FamilyCharacter.Authority == FamilyAuthority.Member ||
                session.Character.FamilyCharacter.Authority == FamilyAuthority.Manager)
            {
                session.SendPacket(
                    UserInterfaceHelper.GenerateInfo(
                        string.Format(Language.Instance.GetMessageFromKey("NOT_ALLOWED_KICK"))));
                return;
            }

            ClientSession kickSession = ServerManager.Instance.GetSessionByCharacterName(Name);

            if (kickSession != null && kickSession.Character.Family?.FamilyId == session.Character.Family.FamilyId)
            {
                if (kickSession.Character.FamilyCharacter?.Authority == FamilyAuthority.Head)
                {
                    session.SendPacket(
                        UserInterfaceHelper.GenerateInfo(Language.Instance.GetMessageFromKey("CANT_KICK_HEAD")));
                    return;
                }

                if (kickSession.Character.CharacterId == session.Character.CharacterId)
                {
                    session.SendPacket(
                        UserInterfaceHelper.GenerateInfo(
                            Language.Instance.GetMessageFromKey("CANT_KICK_YOURSELF")));
                    return;
                }

                GameLogger.Instance.LogGuildKick(ServerManager.Instance.ChannelId, session.Character.Name,
                                                 session.Character.CharacterId, session.Character.Family.Name, session.Character.Family.FamilyId,
                                                 kickSession.Character.Name, kickSession.Character.CharacterId);

                DAOFactory.FamilyCharacterDAO.Delete(Name);
                session.Character.Family.InsertFamilyLog(FamilyLogType.FamilyManaged, kickSession.Character.Name);
                kickSession.Character.Family          = null;
                kickSession.Character.LastFamilyLeave = DateTime.UtcNow.Ticks;
            }
            else
            {
                CharacterDTO dbCharacter = DAOFactory.CharacterDAO.LoadByName(Name);
                if (dbCharacter != null)
                {
                    if (CommunicationServiceClient.Instance.IsCharacterConnected(ServerManager.Instance.ServerGroup,
                                                                                 dbCharacter.CharacterId))
                    {
                        session.SendPacket(UserInterfaceHelper.GenerateInfo(
                                               Language.Instance.GetMessageFromKey("CANT_KICK_PLAYER_ONLINE_OTHER_CHANNEL")));
                        return;
                    }

                    FamilyCharacterDTO dbFamilyCharacter =
                        DAOFactory.FamilyCharacterDAO.LoadByCharacterId(dbCharacter.CharacterId);
                    if (dbFamilyCharacter != null &&
                        dbFamilyCharacter.FamilyId == session.Character.Family.FamilyId)
                    {
                        if (dbFamilyCharacter.Authority == FamilyAuthority.Head)
                        {
                            session.SendPacket(
                                UserInterfaceHelper.GenerateInfo(
                                    Language.Instance.GetMessageFromKey("CANT_KICK_HEAD")));
                            return;
                        }

                        GameLogger.Instance.LogGuildKick(ServerManager.Instance.ChannelId, session.Character.Name,
                                                         session.Character.CharacterId, session.Character.Family.Name,
                                                         session.Character.Family.FamilyId, dbCharacter.Name, dbCharacter.CharacterId);

                        DAOFactory.FamilyCharacterDAO.Delete(Name);
                        session.Character.Family.InsertFamilyLog(FamilyLogType.FamilyManaged, dbCharacter.Name);
                        dbCharacter.LastFamilyLeave = DateTime.UtcNow.Ticks;
                        DAOFactory.CharacterDAO.InsertOrUpdate(ref dbCharacter);
                    }
                }
            }
        }