Exemple #1
0
        void ListAction(CharacterListActionPacket pkt)
        {
            switch (pkt.Action)
            {
            case CharacterListAction.RequestCharacterDB:
            {
                var m = server.NetServer.CreateMessage();
                m.Write(new NewCharacterDBPacket()
                    {
                        Factions = server.GameData.Ini.NewCharDB.Factions,
                        Packages = server.GameData.Ini.NewCharDB.Packages,
                        Pilots   = server.GameData.Ini.NewCharDB.Pilots
                    });
                server.NetServer.SendMessage(m, connection, NetDeliveryMethod.ReliableOrdered);
                break;
            }

            case CharacterListAction.SelectCharacter:
            {
                var m  = server.NetServer.CreateMessage();
                var sc = Account.Characters[pkt.IntArg];
                Character = NetCharacter.FromDb(sc, server.GameData);
                Base      = Character.Base;
                m.Write(new BaseEnterPacket()
                    {
                        Base = Character.Base,
                        Ship = Character.EncodeLoadout()
                    });
                server.NetServer.SendMessage(m, connection, NetDeliveryMethod.ReliableOrdered);
                break;
            }

            case CharacterListAction.CreateNewCharacter:
            {
                var m  = server.NetServer.CreateMessage();
                var ac = new ServerCharacter()
                {
                    Name    = pkt.StringArg,
                    Base    = "li01_01_base",
                    Credits = 2000,
                    ID      = 0,
                    Ship    = "ge_fighter"
                };
                Account.Characters.Add(ac);
                m.Write(new AddCharacterPacket()
                    {
                        Character = NetCharacter.FromDb(ac, server.GameData).ToSelectable()
                    });
                server.NetServer.SendMessage(m, connection, NetDeliveryMethod.ReliableOrdered);
                break;
            }
            }
        }
Exemple #2
0
        public static NetCharacter FromDb(ServerCharacter character, GameDataManager gameData)
        {
            var nc = new NetCharacter();

            nc.Name      = character.Name;
            nc.gData     = gameData;
            nc.Base      = character.Base;
            nc.Ship      = gameData.GetShip(character.Ship);
            nc.Credits   = character.Credits;
            nc.Equipment = new List <NetEquipment>(character.Equipment.Count);
            foreach (var equip in character.Equipment)
            {
                nc.Equipment.Add(new NetEquipment()
                {
                    Hardpoint = equip.Hardpoint,
                    Equipment = gameData.GetEquipment(equip.Equipment),
                    Health    = equip.Health
                });
            }
            return(nc);
        }
 public void AddCharacterToAccount(PlayerAccount account, ServerCharacter character)
 {
     account.Characters.Add(character);
 }
 public void AddCharacter(ServerCharacter character)
 {
 }