Exemple #1
0
        public Character(int index)
        {
            this.index        = index;
            this.gameLocation = GameLocation.Starter;

            GUICard   ownerGUIDCard = new GUICard((uint)index, CardView.GUI, "", 0, "", 0, "", "GUI/Slots/" + ((GUICard)Catalogue.FetchCard(WorldCardGUID, CardView.GUI)).Key, "", new string[0]);
            OwnerCard ownerCard     = new OwnerCard((uint)index, CardView.Owner, false, 0, 1);

            Catalogue.AddCard(ownerGUIDCard);
            Catalogue.AddCard(ownerCard);

            Characters character = Database.Database.GetCharacterById(Server.GetClientByIndex(index).playerId.ToString());

            if (character == null)
            {
                return;
            }

            this.name         = character.Name;
            this.Faction      = (Faction)character.Faction;
            this.gameLocation = (GameLocation)character.GameLocation;

            foreach (KeyValuePair <string, string> item in character.AvatarItems)
            {
                items.Add((AvatarItem)Enum.Parse(typeof(AvatarItem), item.Key), item.Value);
            }
        }
        public Character(int index)
        {
            this.index   = index;
            PlayerShip   = new PlayerShip(index);
            gameLocation = GameLocation.Starter;

            GUICard   ownerGUIDCard = new GUICard((uint)index, CardView.GUI, "", 0, "", 0, "", ((GUICard)Catalogue.FetchCard(22131170u, CardView.GUI)).GUIAvatarSlotTexturePath, "", new string[0]);
            OwnerCard ownerCard     = new OwnerCard((uint)index, CardView.Owner, false, 0, 1);

            Catalogue.AddCard(ownerGUIDCard);
            Catalogue.AddCard(ownerCard);

            Characters character = Database.Database.GetCharacterById(Server.GetClientByIndex(index).playerId.ToString());

            if (character is null)
            {
                return;
            }

            name                = character.Name;
            Faction             = (Faction)character.Faction;
            gameLocation        = (GameLocation)character.GameLocation;
            PlayerShip.sectorId = (uint)character.SectorId;

            foreach (KeyValuePair <string, string> item in character.AvatarItems)
            {
                items.Add((AvatarItem)Enum.Parse(typeof(AvatarItem), item.Key), item.Value);
            }
        }