public void Release()
 {
     if (ActivePlayer != null)
     {
         ActivePlayer.Dispose();
         ActivePlayer = null;
     }
 }
Example #2
0
        public void Process(ClientConnection connection, string[] message)
        {
            var player = new Player(connection, connection.ActivePlayer.DatabaseCharacterData)
            {
                GameSessionId = 1135620,
                Position =
                    new Position(new Vector3(connection.ActivePlayer.Position.Point.X,
                        connection.ActivePlayer.Position.Point.Y, connection.ActivePlayer.Position.Point.Z))
            };

            new SBpPlayerSpawn.SpSpawnPlayer(player).Send(connection);
            new SBpPlayerSpawn.SpSetPlayerName(player).Send(connection);
            new SBpPlayerSpawn.SpSetPlayerFamilyName(player, connection.Account).Send(connection);
            new SBpPlayerSpawn.SpSetPlayerEquipment(player).Send(connection);
            new SpCharacterCustimozationData(player).Send(connection);
            new SpCharacterCustomizationResponse(player).Send(connection);            
        }
Example #3
0
 public SpInventory(Player player)
 {
     _player = player;
 }
 public SpSpawnCharacter(Player character)
 {
     _character = character;
 }
 public SpSetPlayerFamilyName(Player player, AccountData accountInfo)
 {
     _player = player;
     _accountInfo = accountInfo;
 }
 public SpSetPlayerName(Player player)
 {
     _player = player;
 }
 public SBpPlayerSpawn(ClientConnection spawnedConnection, ClientConnection connection)
 {
     _player = _spawnedConnection.ActivePlayer;
     _spawnedConnection = spawnedConnection;
     _connection = connection;
 }
 public SpSpawnPlayer(Player player)
 {
     _player = player;
 }
 public SpSetPlayerEquipment(Player player)
 {
     _player = player;
 }
Example #10
0
        public void PrepareForEnterOnWorld(ClientConnection connection, long characterId)
        {
            var player = new Player(connection, connection.Characters.First(s => s.CharacterId == characterId))
            {
                GameSessionId = _gameSessionFactory.Next(),
            };

            using (var db = _gsDbFactory.OpenSession())
            {
                var daoItems = db.QueryOver<CharacterItem>().Where(i => i.CharacterId == characterId).List();
                var items = new List<CharacterItem>();
                var equipItems = new List<CharacterItem>();

                foreach (var it in daoItems)
                {
                    if (it.StorageType == (int) StorageType.Equipment)
                        equipItems.Add(it);
                    if (it.StorageType == (int) StorageType.Inventory)
                        items.Add(it);
                }
                
                player.Inventory = new InventoryStorage(items.ToDictionary<CharacterItem, short, AStorageItem>(e => (short)(e.Slot + 1), e => new InventoryItem(e.ItemId, e.Count) {StorageType = (StorageType) e.StorageType}), 48);
                player.Equipment = new EquipmentStorage(equipItems.ToDictionary<CharacterItem, short, AStorageItem>(e => (short)(e.Slot + 1), e => new InventoryItem(e.ItemId, e.Count) {StorageType = (StorageType) e.StorageType}), 48);
            }

            connection.ActivePlayer = player;
            connection.ActivePlayer.PlayerActions += (action, parameters) =>
            {
                switch (action)
                {
                    case Player.PlayerAction.Logout:
                        if (connection.ActivePlayer != null)
                        {
                            UpdateCharacter(connection);
                            _gameSessionFactory.ReleaseUniqueInt(connection.ActivePlayer.GameSessionId);
                        }
                        break;                       
                }
            };

            var sessionId = BitConverter.GetBytes(connection.ActivePlayer.GameSessionId).ToHex();

            new SpRaw("000000000000000000000000", 0x0cf1).SendRaw(connection);
            new SpRaw("3401620010FC266F38020100000000000000630010FC266F38020100000000000000680010FC266F380201000000000000006E0010FC266F38020100000000000000720010FC266F38020100000000000000850010FC266F38020100000001000000960010FC266F380201000000000000009E0010FC266F38020100000000000000AD0010FC266F38020100000000000000AE0010FC266F38020100000000000000AF0010FC266F38020100000000000000B00010FC266F38020100000000000000B20010FC266F38020100000000000000B30010FC266F38020400000001000000BA0010FC266F38020100000000000000C30010FC266F38020100000000000000C80010FC266F38020100000000000000CA0010FC266F38020100000000000000CF0010FC266F38020100000000000000D70010FC266F38020100000000000000DB0010FC266F38020100000001000000DD0010FC266F38020100000001000000E20010FC266F38020100000000000000E30010FC266F38020100000001000000E50010FC266F38020100000000000000E70010FC266F38020100000000000000E80010FC266F38020100000000000000EA0010FC266F38020100000000000000EC0010FC266F38020100000000000000EE0010FC266F38020100000000000000F80010FC266F38020100000001000000FB0010FC266F38020100000000000000100110FC266F38020100000000000000160110FC266F38020100000000000000180110FC266F38020100000001000000190110FC266F380201000000000000001A0110FC266F380201000000000000001E0110FC266F38020100000000000000250110FC266F38020100000001000000280110FC266F380201000000000000002D0110FC266F38020100000000000000330110FC266F38020100000000000000340110FC266F38020100000000000000350110FC266F38020100000000000000370110FC266F38020100000000000000390110FC266F380201000000000000003B0110FC266F380201000000000000003D0110FC266F38020100000000000000440110FC266F380201000000000000004F0110FC266F38020100000000000000560110FC266F380201000000000000005B0110FC266F380201000000010000005C0110FC266F380201000000000000005E0110FC266F38020100000001000000600110FC266F38020100000001000000640110FC266F38020100000000000000650110FC266F38020100000000000000680110FC266F380201000000000000006B0110FC266F380201000000000000006C0110FC266F38020100000001000000710110FC266F38020100000000000000730110FC266F38020100000000000000740110FC266F38020100000000000000770110FC266F38020100000000000000790110FC266F38020100000000000000800110FC266F38020200000001000000840110FC266F38020100000000000000900110FC266F38020100000000000000950110FC266F38020100000000000000960110FC266F380201000000000000009D0110FC266F38020100000001000000A00110FC266F38020100000000000000AC0110FC266F38020100000000000000AE0110FC266F38020100000000000000AF0110FC266F38020100000000000000C00110FC266F38020100000000000000C30110FC266F38020100000000000000C40110FC266F38020100000000000000C70110FC266F38020E00000001000000C90110FC266F38022600000004000000CD0110FC266F38020300000000000000D00110FC266F38020100000000000000D10110FC266F38020100000000000000DA0110FC266F38020100000000000000E60110FC266F38020100000001000000F00110FC266F38020100000000000000F60110FC266F38020100000000000000FC0110FC266F38020100000000000000FD0110FC266F38020100000000000000010210FC266F380201000000000000000D0210FC266F38020100000000000000140210FC266F38020600000000000000190210FC266F380201000000000000001A0210FC266F380201000000000000001B0210FC266F380201000000000000001C0210FC266F380201000000000000001E0210FC266F38020100000000000000200210FC266F38020100000000000000230210FC266F38020100000000000000250210FC266F38021A00000015000000260210FC266F380205000000000000002C0210FC266F38020100000001000000350210FC266F38020100000000000000470210FC266F3802D704000006000000490210FC266F380201000000000000004A0210FC266F380201000000000000004B0210FC266F380201000000000000004D0210FC266F38020100000000000000520210FC266F38020100000000000000580210FC266F38020100000001000000590210FC266F380201000000000000005D0210FC266F38020100000001000000620210FC266F38020100000000000000640210FC266F38020100000000000000650210FC266F38020100000000000000670210FC266F38020100000001000000680210FC266F380201000000000000006A0210FC266F380201000000000000006F0210FC266F38020100000000000000770210FC266F38020D000000010000007B0210FC266F380201000000000000007E0210FC266F38020200000001000000820210FC266F38020100000001000000870210FC266F38020100000000000000880210FC266F38020100000000000000960210FC266F38021B00000002000000970210FC266F38020100000000000000A20210FC266F38020100000000000000A30210FC266F38020100000000000000AA0210FC266F38020100000000000000B60210FC266F38020100000000000000BD0210FC266F38020100000000000000BE0210FC266F38020100000000000000C40210FC266F38020100000000000000C50210FC266F38020100000001000000C70210FC266F38020100000000000000D00210FC266F38020100000001000000D40210FC266F38020100000001000000D60210FC266F38020100000000000000DA0210FC266F38020100000000000000ED0210FC266F38020100000000000000EF0210FC266F38020100000001000000F00210FC266F38020100000000000000F30210FC266F38020100000000000000000310FC266F38020100000000000000010310FC266F38020100000000000000020310FC266F38020100000000000000060310FC266F38020100000000000000080310FC266F380201000000000000000B0310FC266F380211000000010000000C0310FC266F380235000000010000000D0310FC266F380201000000000000000E0310FC266F380201000000010000001C0310FC266F38020100000001000000200310FC266F38020100000000000000250310FC266F38020100000000000000260310FC266F380201000000000000002D0310FC266F38020100000000000000310310FC266F38020100000000000000390310FC266F380201000000000000003B0310FC266F38020100000000000000420310FC266F38020500000001000000430310FC266F38020100000000000000460310FC266F38020100000000000000470310FC266F38020100000000000000490310FC266F380201000000000000004B0310FC266F38020100000000000000520310FC266F38020600000000000000530310FC266F38020100000000000000560310FC266F380201000000000000005D0310FC266F38020100000000000000600310FC266F38020100000000000000630310FC266F38020100000000000000660310FC266F38020100000000000000670310FC266F380201000000000000006B0310FC266F380201000000000000006D0310FC266F380201000000010000006E0310FC266F380201000000000000006F0310FC266F38020100000000000000720310FC266F38020100000000000000730310FC266F38020100000000000000740310FC266F38020100000000000000770310FC266F38020100000000000000780310FC266F38020200000001000000790310FC266F380201000000000000007A0310FC266F38020300000000000000810310FC266F38020100000000000000840310FC266F380201000000000000008A0310FC266F380201000000000000008E0310FC266F38020100000000000000A20310FC266F38020100000000000000A70310FC266F38020200000000000000AE0310FC266F38020200000001000000AF0310FC266F38020100000000000000B00310FC266F38020100000000000000B20310FC266F38020100000001000000BC0310FC266F38020100000000000000C10310FC266F38020100000000000000C30310FC266F38020100000000000000C70310FC266F38020100000000000000C90310FC266F38020100000000000000D00310FC266F38020100000000000000D10310FC266F38020200000001000000D50310FC266F38020100000000000000D90310FC266F38020100000000000000E10310FC266F38020100000000000000E40310FC266F38020100000000000000E60310FC266F38020100000000000000EC0310FC266F38020100000000000000EE0310FC266F38020100000000000000F20310FC266F38020100000000000000F30310FC266F38020100000000000000F40310FC266F38020100000000000000F60310FC266F38020100000000000000F80310FC266F38020100000000000000010410FC266F380201000000000000000E0410FC266F38020100000001000000130410FC266F38020100000001000000150410FC266F38020100000000000000180410FC266F380224000000040000001D0410FC266F380201000000000000001F0410FC266F38020100000000000000210410FC266F38020100000000000000280410FC266F38020100000000000000320410FC266F38020100000000000000350410FC266F38020100000000000000380410FC266F38028C000000050000003D0410FC266F380201000000000000003E0410FC266F38020100000000000000400410FC266F38020100000000000000981BC9ED85BE3F0101000000000000009A1BC9ED85BE3F0108000000030000009B1BC9ED85BE3F010100000000000000A21BC9ED85BE3F010100000000000000AC1BC9ED85BE3F010100000000000000AD1BC9ED85BE3F010400000000000000AE1BC9ED85BE3F010100000000000000B11BC9ED85BE3F010100000000000000B61BC9ED85BE3F010100000000000000BA1BC9ED85BE3F010700000000000000C51BC9ED85BE3F010100000000000000C61BC9ED85BE3F010100000003000000C71BC9ED85BE3F010100000000000000C81BC9ED85BE3F010100000000000000CA1BC9ED85BE3F010200000000000000D81BC9ED85BE3F010100000000000000DB1BC9ED85BE3F010100000000000000E21BC9ED85BE3F011200000000000000E71BC9ED85BE3F010300000000000000ED1BC9ED85BE3F010400000000000000EE1BC9ED85BE3F010100000000000000F01BC9ED85BE3F010100000000000000F31BC9ED85BE3F010100000000000000F41BC9ED85BE3F010400000000000000F91BC9ED85BE3F010300000000000000051CC9ED85BE3F010200000000000000081CC9ED85BE3F010100000000000000091CC9ED85BE3F010C000000000000000D1CC9ED85BE3F0101000000000000000E1CC9ED85BE3F010400000000000000121CC9ED85BE3F0103000000000000001B1CC9ED85BE3F0102000000000000001C1CC9ED85BE3F0101000000000000001D1CC9ED85BE3F0102000000000000001E1CC9ED85BE3F010100000000000000261CC9ED85BE3F010100000000000000291CC9ED85BE3F010100000000000000331CC9ED85BE3F010200000000000000361CC9ED85BE3F010200000000000000381CC9ED85BE3F0102000000000000003A1CC9ED85BE3F0102000000000000003B1CC9ED85BE3F0105000000000000003C1CC9ED85BE3F010200000000000000411CC9ED85BE3F010100000000000000451CC9ED85BE3F0101000000000000004A1CC9ED85BE3F0102000000000000004B1CC9ED85BE3F0104000000000000004F1CC9ED85BE3F010100000000000000521CC9ED85BE3F010100000000000000531CC9ED85BE3F010100000000000000551CC9ED85BE3F010200000000000000561CC9ED85BE3F010100000000000000581CC9ED85BE3F0101000000000000005B1CC9ED85BE3F0101000000000000005C1CC9ED85BE3F0101000000000000005F1CC9ED85BE3F010100000000000000601CC9ED85BE3F010100000000000000651CC9ED85BE3F010100000000000000681CC9ED85BE3F013E000000000000006A1CC9ED85BE3F0104000000000000006C1CC9ED85BE3F010100000000000000751CC9ED85BE3F010100000000000000761CC9ED85BE3F0101000000000000007C1CC9ED85BE3F0101000000000000007E1CC9ED85BE3F010300000000000000801CC9ED85BE3F010200000000000000811CC9ED85BE3F010200000000000000831CC9ED85BE3F010500000000000000851CC9ED85BE3F010100000000000000891CC9ED85BE3F0101000000000000008A1CC9ED85BE3F0105000000000000008C1CC9ED85BE3F0101000000000000008D1CC9ED85BE3F0101000000000000008F1CC9ED85BE3F010100000000000000911CC9ED85BE3F010100000000000000951CC9ED85BE3F010100000000000000981CC9ED85BE3F0101000000000000009A1CC9ED85BE3F010100000000000000", 0x10ab).SendRaw(connection);
            new SpRaw("DE5A89560000000000000000E02DC0C700000000000000000000000000", 0x0d4e).SendRaw(connection);

            new SpSpawnCharacter(connection.ActivePlayer).Send(connection);

            new SpRaw("", 0x0cfb).SendRaw(connection);
            new SpRaw("010000", 0x115a).SendRaw(connection);
            new SpRaw("011825000100D905000100890600010008030001008806000100BA050001008A020001008A0600010087060001007E02000100BE04000100C4050001008C02000100CC05000100B1020001000D030001008D02000100CF000001008F02000100CE020001008E02000100CB000001008B020001008602000100810200010080020001009002000100D3020001009302000100EB02000100E002000100D7020001007F02000100DD000001005C00000100DC00000100DE00000100580000", 0x0d12).SendRaw(connection);
            new SpRaw("0000", 0x1134).SendRaw(connection);
            new SpRaw("12", 0x0c46).SendRaw(connection);

            new SpInventory(connection.ActivePlayer).Send(connection);

            new SpRaw("0101" +
                      sessionId + //game session
                      "0000000000000000000000000000", 0x0bf1).SendRaw(connection);

            new SpCharacterEquipment(connection.ActivePlayer).Send(connection);

            new SpRaw("00010000000000000000000000", 0x1082).SendRaw(connection);
            new SpRaw("01010000000000000000000000", 0x1082).SendRaw(connection);
            new SpRaw("02010000000000000000000000", 0x1082).SendRaw(connection);
            new SpRaw("03010000000000000000000000", 0x1082).SendRaw(connection);
            new SpRaw("04010000000000000000000000", 0x1082).SendRaw(connection);
            new SpRaw("05010000000000000000000000", 0x1082).SendRaw(connection);
            new SpRaw("06010000000000000000000000", 0x1082).SendRaw(connection);
            new SpRaw("07010000000000000000000000", 0x1082).SendRaw(connection);
            new SpRaw("08010000000000000000000000", 0x1082).SendRaw(connection);
            new SpRaw("01DE5A8956000000000E169110DA01000000FA91E2EF01000000BFF1B3AF000000005EFCB343020000009A8ECBC1010000005721E3C301000000B9B43E6E000000007795A06D00000000E580AAC100000000696C543F00000000A97850BF0100000026309223000000001DE008A200000000BF0248CE00000000A132F53000000000614D6B6601000000B89CABD1000000002CF9D01D01000000ECE8F4CE00000000898179FF00000000", 0x0cdc).SendRaw(connection);
            new SpRaw("00000000010000000000000000000000010000000100000000000000000000000200000001000000000000000000000000000000000000000000000000000000", 0x1084).SendRaw(connection);
        }
 public SpCharacterCustimozationData(Player character)
 {
     _character = character;
 }
 public SpCharacterCustomizationResponse(Player character)
 {
     _character = character;
 }
 public SpCharacterEquipment(Player player)
 {
     _player = player;
 }
Example #14
0
 public SpUpdateLevel(Player player)
 {
     _player = player;
 }