Ejemplo n.º 1
0
        //=============================================================================
        /// <summary></summary>
        private void parseLine(string line)
        {
            if (String.IsNullOrWhiteSpace(line))
            {
                return;                                                 // blank lines
            }
            // line should be like  "character - offset"
            string[] parts = line.Split('-');
            if (parts.Length != 2)
            {
                return;
            }

            // create and add character
            NameAndAddressInfo cInfo = new NameAndAddressInfo();

            cInfo.name = parts[0].Trim();
            Int64.TryParse(parts[1].Trim(), NumberStyles.HexNumber, CultureInfo.CurrentCulture, out cInfo.offset);

            Characters.Add(cInfo);

            // update offsets
            if (cInfo.offset < _minAddress || _minAddress == 0)
            {
                _minAddress = cInfo.offset;
            }
            if (cInfo.offset > _maxAddress || _maxAddress == 0)
            {
                _maxAddress = cInfo.offset;
            }
        }
Ejemplo n.º 2
0
        private async Task getCharacters(object parameter, NavigationMode mode, IDictionary <string, object> state)
        {
            var characterService = new CharacterService();
            var hasCharacters    = true;
            var index            = 1;

            while (hasCharacters)
            {
                var characters = await characterService.GetCharactersAsync(index);

                if (characters.Count > 0)
                {
                    foreach (var item in characters)
                    {
                        if (item.name != "")
                        {
                            Characters.Add(item);
                        }
                    }
                    await base.OnNavigatedToAsync(parameter, mode, state);

                    index++;
                }
                else
                {
                    hasCharacters = false;
                }
            }
        }
Ejemplo n.º 3
0
    public Starwars()
    {
        var hanSolo = new Human(this)
        {
            Id         = "humans/han",
            Name       = "Han",
            HomePlanet = null,
            AppearsIn  = { "JEDI", "EMPIRE", "NEWHOPE" }
        };
        var luke = new Human(this)
        {
            Id         = "humans/luke",
            Name       = "Luke",
            HomePlanet = "Tatooine",
            Friends    =
            {
                hanSolo.Id
            },
            AppearsIn = { "JEDI", "EMPIRE", "NEWHOPE" }
        };

        hanSolo.Friends.Add(luke.Id);

        Characters.Add(hanSolo);
        Characters.Add(luke);
    }
Ejemplo n.º 4
0
        public int ReadFrom(byte[] Buffer, int StartIndex = 0)
        {
            int cursor = StartIndex;

            ushort len = BitConverter.ToUInt16(Buffer, cursor);

            cursor += TypeSizes.SHORT;

            for (ushort i = 0; i < len; i++)
            {
                Characters.Add(new CharSelectItem(Buffer, cursor));
                cursor += Characters[i].ByteLength;
            }

            len     = BitConverter.ToUInt16(Buffer, cursor);
            cursor += TypeSizes.SHORT;

            MOTD    = Encoding.Default.GetString(Buffer, cursor, len);
            cursor += MOTD.Length;

            byte blen = Buffer[cursor];

            cursor++;

            for (byte i = 0; i < blen; i++)
            {
                Ads.Add(new CharSelectAd(Buffer, cursor));
                cursor += Ads[i].ByteLength;
            }

            return(cursor - StartIndex);
        }
Ejemplo n.º 5
0
        public void Add(WvsGameClient c)
        {
            var character = c.Character;

            if (c.SentCharData)
            {
                c.SendPacket(CPacket.SetField(character, false, c.ChannelId));
            }
            else
            {
                c.SentCharData = true;
#if DEBUG
                //So me myself and i all spawn close to eachother <3
                character.Stats.nPortal = 0;
#else
                character.Stats.nPortal = Portals.GetRandomSpawn();
#endif
                c.SendPacket(CPacket.SetField(character, true, c.ChannelId));
            }

            //Send client being added all the existing characters in the map
            Characters.ForEach(x => c.SendPacket(CPacket.UserEnterField(x)));

            SendSpawnMobs(c);
            SendSpawnNpcs(c);

            Characters.Add(c.Character);
            Sockets.Add(c.Character, c);

            //Broadcast everyone already in the map that you have arrived
            Broadcast(CPacket.UserEnterField(character), c);
        }
Ejemplo n.º 6
0
 public JsonSelector(JsonValue root) : base(JsonTokenType.End, JsonTokenType.String, JsonTokenType.Integer, JsonTokenType.Decimal, JsonTokenType.String)
 {
     Root = root ?? throw new ArgumentNullException(nameof(root));
     Characters.Add(JsonKeyword.Dot, JsonTokenType.Dot);
     Characters.Add(JsonKeyword.LeftBracket, JsonTokenType.LeftBracket);
     Characters.Add(JsonKeyword.RightBracket, JsonTokenType.RightBracket);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Reloads all characters belonging to this account from the database.
 /// Blocking call. Make sure to call this from outside the Map-Thread.
 /// </summary>
 private void LoadCharacters()
 {
     foreach (CharacterRecord characterRecord in CharacterRecord.FindAllOfAccount(this))
     {
         Characters.Add(characterRecord);
     }
 }
Ejemplo n.º 8
0
        public void SwitchTurn()
        {
            AbstractCharacter firstCharacter = Characters[0];

            Characters.Remove(firstCharacter);
            Characters.Add(firstCharacter);
        }
        protected async Task ScrollLoadCharacters(int offset)
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                var items = await apiComicsVine.GetAllCharacter(offset);

                var marvel = items.Where(e => e.Publisher.Name.Contains(PublisherName));
                foreach (var item in marvel)
                {
                    Characters.Add(item);
                }
                if (offset == 1000)
                {
                    ItemTreshold = -1;
                    return;
                }
            }
            catch (Exception ex)
            {
                await dialogService.DisplayAlertAsync("Error", $"{ex.Message}", "Ok");
            }
            finally
            {
                IsBusy = false;
            }
        }
Ejemplo n.º 10
0
    void SetupWorld(int width, int height)
    {
        estateJobManager = new EstateJobManager();

        Current = this;

        this.Fixtures      = new List <Fixture> ();
        this.Characters    = new List <Character> ();
        this.HaulableItems = new List <HaulableItem>();
        this.width         = width;
        this.height        = height;

        tiles = new Tile[width, height];

        for (int x = 0; x < width; x++)
        {
            for (int y = 0; y < height; y++)
            {
                tiles [x, y] = new Tile(this, x, y);
            }
        }

        Debug.Log("World created with " + (width * height) + " tiles!");

        CreateFixturePrototypes();
        CreateHaulableItemPrototypes();
        Character cha = new Character(Current.GetTileAt(50, 50), CharacterRole.BUILDER);

        Characters.Add(cha);

        //PlaceHaulableItem("boxofbooks", Current.GetTileAt(49, 50));
        //Current.onCharacterCreated(cha);
    }
Ejemplo n.º 11
0
        public override void Initialize()
        {
            FindModules <AnimationModule>().ForEach(a => Animations.Add(a, new AnimationController(services.Make <AnimationModule>(a), services)));
            FindModules <CharacterAnimationModule>().ForEach(a => CharacterAnimations.Add(a, new CharacterAnimationController(services.Make <CharacterAnimationModule>(a), services)));
            FindModules <CharacterModule>().ForEach(a => Characters.Add(a, new CharacterController(services.Make <CharacterModule>(a), services)));
            FindModules <ItemModule>().ForEach(a => Items.Add(a, new ItemController(services.Make <ItemModule>(a), services)));
            FindModules <InventoryItemModule>().ForEach(a => InventoryItems.Add(a, new InventoryItemController(services.Make <InventoryItemModule>(a), services)));
            FindModules <RoomModule>().ForEach(a => Rooms.Add(a, new RoomController(services.Make <RoomModule>(a), services)));

            PreInitialize();
            Animations.Values.ForEach(a => a.PreInitialize());
            CharacterAnimations.Values.ForEach(c => c.PreInitialize());
            Characters.Values.ForEach(c => c.PreInitialize());
            Items.Values.ForEach(i => i.PreInitialize());
            InventoryItems.Values.ForEach(i => i.PreInitialize());
            Rooms.Values.ForEach(r => r.PreInitialize());

            Animations.Values.ForEach(a => a.Initialize());
            CharacterAnimations.Values.ForEach(c => c.Initialize());
            Characters.Values.ForEach(c => c.Initialize());
            Items.Values.ForEach(i => i.Initialize());
            InventoryItems.Values.ForEach(i => i.Initialize());
            Rooms.Values.ForEach(r => r.Initialize());

            base.Initialize();
        }
        private void CreateCharacter(ControllerType type, Vector2Int position, string characterName, Material material)
        {
            if (type == ControllerType.None)
            {
                return;
            }

            ICharacterController controller = null;

            switch (type)
            {
            case ControllerType.PlayerZQSD:
                controller = new PlayerCharacterController();
                break;

            case ControllerType.PlayerKeypad:
                controller = new Player2CharacterController();
                break;

            case ControllerType.RandomAI:
                controller = new RandomCharacterController();
                break;

            case ControllerType.MCTSAI:
                controller = new MCTSCharacterController();
                break;
            }

            CharacterScript character = Instantiate(_characterPrefab, new Vector3(position.x, 0, position.y), Quaternion.identity, Map.transform).GetComponent <CharacterScript>();

            character.Initialize(controller, material, characterName);
            Characters.Add(character);
        }
Ejemplo n.º 13
0
        public void Add(BaseCharacter character)
        {
            if (!AllowHealing)
            {
                character.Healer = false;
            }

            //if (character.Group == Team.TeamOne)
            //    character.HasBless = true;

            currentId++;
            character.ID      = currentId;
            character.Context = this;
            Characters.Add(character);

            if (character.PreTurnNotify)
            {
                PreTurnChars.Add(character.ID);
            }

            if (character.PostTurnNotify)
            {
                PostTurnChars.Add(character.ID);
            }
        }
 protected override void CreateCharacterInstances()
 {
     Characters.Add(new Goblin());
     Characters.Add(new Troll());
     Characters.Add(new Warlock());
     Characters.Add(new Necromancer()); //ASSIGNMENT #3
 }
Ejemplo n.º 15
0
        public void Retrieve()
        {
            Load();
            if (Success)
            {
                var key = Result.Element("key");
                AccessMask = int.Parse(key.Attribute("accessMask").Value);
                Type       = key.Attribute("type").Value;

                var rowset = key.Element("rowset");
                var rows   = rowset.Elements("row");
                foreach (var row in rows)
                {
                    int    id       = int.Parse(row.Attribute("characterID").Value);
                    string name     = row.Attribute("characterName").Value;
                    int    corpid   = int.Parse(row.Attribute("corporationID").Value);
                    string corpname = row.Attribute("corporationName").Value;
                    Characters.Add(new Character {
                        ID = id, Name = name, CorporationID = corpid,
                        CorporationName = corpname
                    });
                }
            }
            else
            {
                throw new Exception(ErrorMessage);
            }
        }
Ejemplo n.º 16
0
        public void Parse(InputMessage message)
        {
            byte worlds = message.GetU8();

            for (int i = 0; i < worlds; i++)
            {
                var world = new World();
                world.ID       = message.GetU8();
                world.Name     = message.GetString();
                world.HostName = message.GetString();
                world.Port     = message.GetU16();
                world.Preview  = message.GetBool();
                Worlds.Add(world);
            }

            byte characters = message.GetU8();

            for (int i = 0; i < characters; i++)
            {
                Character character = new Character();
                character.World = message.GetU8();
                character.Name  = message.GetString();
                Characters.Add(character);
            }

            AccountState     = message.GetU8();
            IsPremium        = message.GetBool();
            PremiumTimeStamp = message.GetU32();

            InfinitePremium = (IsPremium && PremiumTimeStamp == 0);
        }
Ejemplo n.º 17
0
        private void _AddCharacter(object parameters)
        {
            if (parameters == null)
            {
                return;
            }

            var p = parameters as object[];

            var characterName = p[0].ToString();

            int.TryParse(p[1].ToString(), out int initiativeModifier); // iniline declaration

            if (Characters.Any(x => x.InitiativeModificator == initiativeModifier && x.Name == characterName))
            {
                return;
            }

            Random random = new Random();

            Characters.Add(new Character(characterName, initiativeModifier, random.Next(1, GetInitiativeRollDiceNumber())));
            Characters = new ObservableCollection <Character>(Characters
                                                              .OrderByDescending(x => x.InitiativeRoll)
                                                              .ThenByDescending(x => x.InitiativeModificator).ToList());
        }
 protected override void CreateCharacterInstances()
 {
     /*  var rand = new Random();
      * for (int i = 0; i < monsters; i++)
      * {
      *    int r = rand.Next(1, 3);
      *    switch (r)
      *    {
      *        case 1:
      *            Characters.Add(new Goblin());
      *            break;
      *        case 2:
      *            Characters.Add(new Troll());
      *            break;
      *        case 3:
      *            Characters.Add(new Warlock());
      *            break;
      *        default:
      *            break;
      *    }
      * }*/
     Characters.Add(new Goblin());
     Characters.Add(new Troll());
     Characters.Add(new Warlock());
 }
Ejemplo n.º 19
0
        protected internal override void ReadFromXml(System.Xml.XmlElement xel)
        {
            Name  = ReadText(xel);
            Notes = ReadCData(xel, "notes");
            SizeX = ReadIntAttribute(xel, "xsize");
            SizeY = ReadIntAttribute(xel, "ysize");
            ReadCollection <Door>(xel, "map.doors", "door", doors, null);
            ReadCollection <Wall>(xel, "map.walls", "wall", walls, null);
            ReadCollection <PointOfInterest>(xel, "map.pointofinterests", "pointofinterest", pois, null);
            ReadCollection <Block>(xel, "map.blocks", "block", blocks, null);
            ReadCollection <Effect>(xel, "map.effects", "effect", effects, null);

            XmlNodeList xnl = xel.SelectNodes("map.characters/character");

            foreach (XmlNode xn in xnl)
            {
                XmlElement x    = xn as XmlElement;
                string     code = ReadAttribute(x, "code");
                Character  chr  = SessionManager.Singleton.Characters.FirstOrDefault(f => f.Value == code);
                if (chr != null)
                {
                    Characters.Add(chr);
                }
            }
        }
Ejemplo n.º 20
0
        private async Task SearchCharacter(string text)
        {
            if (text.Length >= 3)
            {
                try
                {
                    IsBusy = true;

                    var a = await MarvelService.GetCharactersAsync(text);

                    Characters.Clear();
                    foreach (var item in a)
                    {
                        Characters.Add(item);
                    }
                }
                catch (Exception ex)
                {
                    await PageDialogService.DisplayAlertAsync("Error", "Error loading character post: " + ex.Message, "OK");
                }
                finally
                {
                    IsBusy = false;
                }
            }
            else
            {
                Characters.Clear();
            }
        }
Ejemplo n.º 21
0
        async Task ExecuteLoadStatsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Characters.Clear();
                var characters = await DataStore.GetCharactersAsync(true);

                foreach (var character in characters)
                {
                    Characters.Add(character);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Ejemplo n.º 22
0
        async Task LoadCharacters()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Characters.Clear();

                var characters = await _dataService.GetCharacters();

                foreach (var c in characters)
                {
                    Characters.Add(c);
                }
            }
            finally
            {
                IsBusy = false;
            }
        }
Ejemplo n.º 23
0
        public void EditActor(Actor oldActor, Actor newActor)
        {
            if (oldActor is PlayerActor)
            {
                var foundCharacter = Characters.Where(character => character == oldActor).FirstOrDefault();

                if (foundCharacter != null)
                {
                    Characters.Remove(oldActor as PlayerActor);
                    Characters.Add(newActor as PlayerActor);
                    Modified = true;
                }
            }
            else if (oldActor is Creature)
            {
                var foundEnemy = Enemies.Where(enemy => enemy == oldActor).FirstOrDefault();

                if (foundEnemy != null)
                {
                    Enemies.Remove(oldActor as Creature);
                    Enemies.Add(newActor as Creature);
                    Modified = true;
                }
            }
        }
Ejemplo n.º 24
0
 private void LoadDemoData()
 {
     Characters.Add(new Character()
     {
         Name      = "Gandalf",
         Hitpoints = 1000,
         Mana      = 5000,
         //IsAlive = true,
         Power          = 500,
         CharacterClass = "Wizard"
     });
     Characters.Add(new Character()
     {
         Name      = "Saroman",
         Hitpoints = 90,
         Mana      = 7000,
         //IsAlive = true,
         Power          = 450,
         CharacterClass = "Wizard"
     });
     Characters.Add(new Character()
     {
         Name           = "Boromir",
         Hitpoints      = 0,
         Mana           = 0,
         Power          = 600,
         CharacterClass = "Knight"
     });
     //Characters.Last().IsAlive = IsAliveCheck(Characters.Last().Hitpoints);
 }
Ejemplo n.º 25
0
 public void AddCharacter(Character character)
 {
     if (!Characters.Contains(character))
     {
         Characters.Add(character);
     }
 }
Ejemplo n.º 26
0
            public virtual void ReadChildData(BinaryReader reader)
            {
                int x = 0;

                for (x = 0; (x < _characterTables.Count); x = (x + 1))
                {
                    CharacterTables.Add(new FontCharacterTablesBlock());
                    CharacterTables[x].Read(reader);
                }
                for (x = 0; (x < _characterTables.Count); x = (x + 1))
                {
                    CharacterTables[x].ReadChildData(reader);
                }
                _bold.ReadString(reader);
                _italic.ReadString(reader);
                _condense.ReadString(reader);
                _underline.ReadString(reader);
                for (x = 0; (x < _characters.Count); x = (x + 1))
                {
                    Characters.Add(new CharacterBlock());
                    Characters[x].Read(reader);
                }
                for (x = 0; (x < _characters.Count); x = (x + 1))
                {
                    Characters[x].ReadChildData(reader);
                }
                _pixels.ReadBinary(reader);
            }
Ejemplo n.º 27
0
 protected override void CreateCharacterInstances()
 {
     {
         Characters.Add(new Barbarian());
         Characters.Add(new Ranger());
         Characters.Add(new Mage());
     }
 }
        private void btnNewCharacter_Click(object sender, RoutedEventArgs e)
        {
            Character character = new Character();

            Characters.Add(character);
            ActiveCharacter = character;
            tbxName.Focus();
        }
Ejemplo n.º 29
0
 public void AddCharacter(BaseCharacter baseCharacter)
 {
     Characters.Add(baseCharacter);
     if (!baseCharacter.IsHero)
     {
         Monsters.Add(baseCharacter as Monster);
     }
 }
 public void PopulateNameplates(DestinyPlayerData data)
 {
     Characters.Clear();
     foreach (var nameplate in data.CharacterNameplates)
     {
         Characters.Add(nameplate);
     }
 }