Esempio n. 1
0
        public async Task CCharacterMapJoin2(GSSession session, CCharacterMapJoin2 Character)
        {
            var @charDto = session.Player.Account.Characters
                           .Select(x => x.Value)
                           .FirstOrDefault(x => x.Name == Character.Name.MakeString());

            using (var db = new GameContext())
            {
                @charDto.Spells = (from spell in db.Spells
                                   where spell.CharacterId == @charDto.CharacterId
                                   select spell).ToList();

                @charDto.Quests = (from quest in db.Quests
                                   where quest.CharacterId == @charDto.CharacterId
                                   select quest).ToList();

                charDto.SkillKey = (from config in db.Config
                                    where config.SkillKeyId == @charDto.CharacterId
                                    select config).FirstOrDefault();

                var friendList = from friend in db.Friends
                                 where (friend.FriendId == @charDto.CharacterId || friend.CharacterId == @charDto.CharacterId) && friend.State == 1
                                 select friend;
            }

            if (@charDto == null)
            {
                return;
            }

            await session.SendAsync(new SEventState(MapEvents.GoldenInvasion, false));

            await session.SendAsync(new SCheckSum { Key = session.Player.CheckSum.GetKey(), Padding = 0xff });

            await session.SendAsync(new SCashPoints { CashPoints = 0 });

            session.Player.Character = new Character(session.Player, @charDto);
            var @char = session.Player.Character;
            //FriendListRequest
            await session.SendAsync(new SFriends { MemoCount = 0, Friends = new Data.FriendDto[] { new Data.FriendDto {
                                                                                                       Name = "Yomalex2".GetBytes()
                                                                                                   } } });

            await session.SendAsync(new SKillCount { KillCount = 1 });

            GuildManager.Instance.AddPlayer(session.Player);

            if (charDto.SkillKey != null)
            {
                await session.SendAsync(new SSkillKey {
                    SkillKey   = charDto.SkillKey.SkillKey,
                    ChatWindow = charDto.SkillKey.ChatWindow,
                    E_Key      = charDto.SkillKey.EkeyDefine,
                    GameOption = charDto.SkillKey.GameOption,
                    Q_Key      = charDto.SkillKey.QkeyDefine,
                    R_Key      = charDto.SkillKey.RkeyDefine,
                    W_Key      = charDto.SkillKey.WkeyDefine,
                });
            }
            session.Player.Status = LoginStatus.Playing;
        }
Esempio n. 2
0
        public async Task CCharacterMapJoin2(GSSession session, CCharacterMapJoin2 Character)
        {
            var charDto = session.Player.Account.Characters
                          .Select(x => x.Value)
                          .FirstOrDefault(x => x.Name == Character.Name);

            if (!MapServerManager.CheckMapServerMove(session, (Maps)charDto.Map))
            {
                return;
            }

            using (var db = new GameContext())
            {
                charDto.Spells = (from spell in db.Spells
                                  where spell.CharacterId == charDto.CharacterId
                                  select spell).ToList();

                charDto.Quests = (from quest in db.Quests
                                  where quest.CharacterId == charDto.CharacterId
                                  select quest).ToList();

                charDto.SkillKey = (from config in db.Config
                                    where config.SkillKeyId == charDto.CharacterId
                                    select config).FirstOrDefault();

                charDto.Friends = (from friend in db.Friends
                                   where (friend.FriendId == charDto.CharacterId || friend.CharacterId == charDto.CharacterId) && friend.State == 1
                                   select friend).ToList();

                charDto.Memos = (from letter in db.Letters
                                 where letter.CharacterId == charDto.CharacterId
                                 select letter).ToList();

                charDto.MasterInfo = (from mi in db.MasterLevel
                                      where mi.MasterInfoId == charDto.CharacterId
                                      select mi).FirstOrDefault();
            }

            if (@charDto == null)
            {
                return;
            }

            await session.SendAsync(new SCheckSum { Key = session.Player.CheckSum.GetKey(), Padding = 0xff });

            await session.SendAsync(new SCashPoints { CashPoints = 0 });

            session.Player.Character = new Character(session.Player, @charDto);
            var @char = session.Player.Character;

            //GCSendAllItemInfo
            //#if (ENABLETEST_MUUN == 1)
            //g_CMuunSystem.GDReqLoadMuunInvenItem(*lpObj);
            //#endif
            await session.SendAsync(new SMuunInventory());



            //#if (ENABLETEST_RUMMY == 1)
            //g_CMuRummyMng.GDReqCardInfo(lpObj);
            //#endif
            //this->IsMuRummyEventOn()

            // packet for skill tree list
            //await session.Send(new byte[] { 0xC2, 0x00, 0x06, 0xF3, 0x53, 0x00 });

            await session.SendAsync(new SPeriodItemCount());

            await session.SendAsync(new SGensSendInfoS9());

            await session.SendAsync(new SKillCount { KillCount = 1 });

            if (charDto.SkillKey != null)
            {
                await session.SendAsync(new SSkillKey {
                    SkillKey   = charDto.SkillKey.SkillKey,
                    ChatWindow = charDto.SkillKey.ChatWindow,
                    E_Key      = charDto.SkillKey.EkeyDefine,
                    GameOption = charDto.SkillKey.GameOption,
                    Q_Key      = charDto.SkillKey.QkeyDefine,
                    R_Key      = charDto.SkillKey.RkeyDefine,
                    W_Key      = charDto.SkillKey.WkeyDefine,
                });
            }
            session.Player.Status = LoginStatus.Playing;

            GuildManager.Instance.AddPlayer(session.Player);

            await session.SendAsync(new SNewQuestInfo());

            await session.SendAsync(new SPentagramaJewelInfo
            {
                JewelCnt = 0,
                JewelPos = 0,
                List     = Array.Empty <PentagramaJewelDto>(),
                Result   = 0,
            });

            await session.SendAsync(new SPentagramaJewelInfo
            {
                JewelCnt = 0,
                JewelPos = 1,
                List     = Array.Empty <PentagramaJewelDto>(),
                Result   = 0,
            });

            await session.SendAsync(new SUBFInfo());

            await session.SendAsync(new SSendBanner { Type = 3 });

            await session.SendAsync(new SMapMoveCheckSum { key = 0x0010 });

            //ConnectServer dataSend
            Program.client.SendAsync(new SCAdd {
                Server = (byte)Program.ServerCode, btName = @charDto.Name.GetBytes()
            });

            if ((@char.CtlCode & ControlCode.GameMaster) == ControlCode.GameMaster)
            {
                @char.Spells.SetBuff(SkillStates.GameMaster, TimeSpan.FromDays(100));
            }
        }