Ejemplo n.º 1
0
        public override GameFightFighterInformations GetGameFightFighterInformations()
        {
            GameFightFighterInformations gameFightFighterInformations = this.Caster.GetGameFightFighterInformations();

            gameFightFighterInformations.contextualId = this.Id;
            return(gameFightFighterInformations);
        }
Ejemplo n.º 2
0
 public GameFightShowFighterRandomStaticPoseMessage(
     GameFightFighterInformations informations
     ) : base(
         informations
         )
 {
 }
Ejemplo n.º 3
0
        public override void Deserialize(ICustomDataInput reader)
        {
            var informationsTypeId = reader.ReadShort();

            Informations = new GameFightFighterInformations();
            Informations.Deserialize(reader);
        }
Ejemplo n.º 4
0
        public void AddActor(GameFightFighterInformations fighter)
        {
            if (fighter == null)
            {
                throw new ArgumentNullException("fighter");
            }

            Bot bot = BotManager.Instance.GetCurrentBot();

            var existingFighter = GetFighter(fighter.contextualId);

            if (existingFighter != null)
            {
                existingFighter.Update(fighter);
            }
            else
            {
                // normally we don't know which is our team before being added to the fight
                if (fighter.contextualId == bot.Character.Id)
                {
                    bot.Character.Fighter.SetTeam(GetTeam(fighter.teamId));
                    AddActor(bot.Character.Fighter);
                }
                else
                {
                    AddActor(CreateFighter(fighter));
                }
            }
        }
Ejemplo n.º 5
0
 public void Deserialize(IDataReader reader)
 {
     Fighters = new GameFightFighterInformations[reader.ReadShort()];
     for (var i = 0; i < Fighters.Length; i++)
     {
         (Fighters[i] = new GameFightFighterInformations()).Deserialize(reader);
     }
 }
Ejemplo n.º 6
0
 public new void Deserialize(IDataReader reader)
 {
     base.Deserialize(reader);
     Summons = new GameFightFighterInformations[reader.ReadShort()];
     for (var i = 0; i < Summons.Length; i++)
     {
         (Summons[i] = new GameFightFighterInformations()).Deserialize(reader);
     }
 }
Ejemplo n.º 7
0
 public void AddFighter(GameFightFighterInformations msg)
 {
     if (msg.teamId == 0)
     {
         Challengers.Add(new FighterModel(msg.contextualId, msg.disposition.cellId, (TeamEnum)msg.teamId, this));
     }
     else if (msg.teamId == 1)
     {
         Defenders.Add(new FighterModel(msg.contextualId, msg.disposition.cellId, (TeamEnum)msg.teamId, this));
     }
 }
 public override void Serialize(IDataWriter writer)
 {
     writer.WriteShort((short)((int)this.fighters.Length));
     GameFightFighterInformations[] gameFightFighterInformationsArray = this.fighters;
     for (int i = 0; i < (int)gameFightFighterInformationsArray.Length; i++)
     {
         GameFightFighterInformations gameFightFighterInformation = gameFightFighterInformationsArray[i];
         writer.WriteShort(gameFightFighterInformation.TypeId);
         gameFightFighterInformation.Serialize(writer);
     }
 }
Ejemplo n.º 9
0
        public override void Deserialize(IDataReader reader)
        {
            uint num = (uint)reader.ReadUShort();

            for (int index = 0; (long)index < (long)num; ++index)
            {
                GameFightFighterInformations instance = ProtocolTypeManager.GetInstance <GameFightFighterInformations>((uint)reader.ReadUShort());
                instance.Deserialize(reader);
                this.fighters.Add(instance);
            }
        }
Ejemplo n.º 10
0
 public void Update(GameFightFighterInformations infos)
 {
     ContextualId   = infos.ContextualId;
     Alive          = infos.Alive;
     CellId         = (short)infos.Disposition.CellId;
     Team           = (TeamEnum)infos.TeamId;
     Stats          = infos.Stats;
     LifePoints     = (int)Stats.LifePoints;
     MaxLifePoints  = (int)Stats.MaxLifePoints;
     ActionPoints   = Stats.ActionPoints;
     MovementPoints = Stats.MovementPoints;
 }
Ejemplo n.º 11
0
        public override void Deserialize(IDataReader reader)
        {
            var FightersCount = reader.ReadShort();

            Fighters = new List <GameFightFighterInformations>();
            for (var i = 0; i < FightersCount; i++)
            {
                GameFightFighterInformations objectToAdd = ProtocolTypeManager.GetInstance(reader.ReadUShort());
                objectToAdd.Deserialize(reader);
                Fighters.Add(objectToAdd);
            }
        }
        public override void Deserialize(IDataReader reader)
        {
            var limit     = reader.ReadShort();
            var fighters_ = new GameFightFighterInformations[limit];

            for (int i = 0; i < limit; i++)
            {
                fighters_[i] = Types.ProtocolTypeManager.GetInstance <GameFightFighterInformations>(reader.ReadShort());
                fighters_[i].Deserialize(reader);
            }
            fighters = fighters_;
        }
Ejemplo n.º 13
0
        // Constructor
        public FightMonsterEntry(GameFightMonsterInformations infos1, GameFightFighterInformations infos2) : base(infos2)
        {
            CreatureGenericId = (int)infos1.CreatureGenericId;

            var m = DataManager.Get <Monsters>(CreatureGenericId);

            Name           = m.NameId;
            IsBoss         = m.IsBoss;
            IsMiniBoss     = m.IsMiniBoss;
            IsQuestMonster = m.IsQuestMonster;
            Level          = (short)m.Grades[(int)infos1.CreatureGrade - 1].level;
        }
Ejemplo n.º 14
0
        public override void Serialize(IDataWriter writer)
        {
            writer.WriteShort(((short)(m_fighters.Count)));
            int fightersIndex;

            for (fightersIndex = 0; (fightersIndex < m_fighters.Count); fightersIndex = (fightersIndex + 1))
            {
                GameFightFighterInformations objectToSend = m_fighters[fightersIndex];
                writer.WriteUShort(((ushort)(objectToSend.TypeID)));
                objectToSend.Serialize(writer);
            }
        }
Ejemplo n.º 15
0
 private void AddFighter(GameFightFighterInformations informations)
 {
     if (informations is GameFightCharacterInformations || informations is GameFightMutantInformations)
     {
         _fighters.TryAdd(informations.ContextualId, new FightPlayerEntry(informations));
     }
     else if (informations is GameFightMonsterInformations mInfos)
     {
         _fighters.TryAdd(mInfos.ContextualId, new FightMonsterEntry(mInfos, informations));
         //Console.WriteLine(mInfos.CreatureGenericId);
     }
 }
Ejemplo n.º 16
0
 // Constructor
 public FightPlayerEntry(GameFightFighterInformations infos) : base(infos)
 {
     if (infos is GameFightCharacterInformations a)
     {
         Name  = a.Name;
         Level = (byte)a.Level;
     }
     else if (infos is GameFightMutantInformations b)
     {
         Name  = b.Name;
         Level = 0; // Todo: Get the monster level
     }
 }
Ejemplo n.º 17
0
        public override void Deserialize(IDataReader reader)
        {
            int fightersCount = reader.ReadUShort();
            int fightersIndex;

            m_fighters = new System.Collections.Generic.List <GameFightFighterInformations>();
            for (fightersIndex = 0; (fightersIndex < fightersCount); fightersIndex = (fightersIndex + 1))
            {
                GameFightFighterInformations objectToAdd = ProtocolManager.GetTypeInstance <GameFightFighterInformations>(reader.ReadUShort());
                objectToAdd.Deserialize(reader);
                m_fighters.Add(objectToAdd);
            }
        }
Ejemplo n.º 18
0
        public override void Serialize(ICustomDataOutput writer)
        {
            base.Serialize(writer);
            writer.WriteShort(((short)(m_summons.Count)));
            int summonsIndex;

            for (summonsIndex = 0; (summonsIndex < m_summons.Count); summonsIndex = (summonsIndex + 1))
            {
                GameFightFighterInformations objectToSend = m_summons[summonsIndex];
                writer.WriteUShort(((ushort)(objectToSend.TypeID)));
                objectToSend.Serialize(writer);
            }
        }
Ejemplo n.º 19
0
        public override void Deserialize(ICustomDataInput reader)
        {
            var countFighters = reader.ReadShort();

            Fighters = new List <GameFightFighterInformations>();
            for (short i = 0; i < countFighters; i++)
            {
                var fighterstypeId = reader.ReadShort();
                GameFightFighterInformations type = new GameFightFighterInformations();
                type.Deserialize(reader);
                Fighters.Add(type);
            }
        }
Ejemplo n.º 20
0
        public override void Deserialize(ICustomDataInput reader)
        {
            base.Deserialize(reader);
            int summonsCount = reader.ReadUShort();
            int summonsIndex;

            m_summons = new System.Collections.Generic.List <GameFightFighterInformations>();
            for (summonsIndex = 0; (summonsIndex < summonsCount); summonsIndex = (summonsIndex + 1))
            {
                GameFightFighterInformations objectToAdd = ProtocolTypeManager.GetInstance <GameFightFighterInformations>((short)reader.ReadUShort());
                objectToAdd.Deserialize(reader);
                m_summons.Add(objectToAdd);
            }
        }
Ejemplo n.º 21
0
        public virtual void Update(GameContextActorInformations actorInformation)
        {
            GameFightFighterInformations fighterInformations = actorInformation as GameFightFighterInformations;

            if (fighterInformations != null)
            {
                IsAlive = fighterInformations.alive;
                Stats.Update(fighterInformations.stats);
            }
            Id   = actorInformation.contextualId;
            Look = actorInformation.look;
            Map  = Fight.Map;

            Update(actorInformation.disposition);
        }
Ejemplo n.º 22
0
 /// <summary>
 /// Add a fighter to the fighter's list.
 /// </summary>
 public void AddFighter(GameFightFighterInformations informations)
 {
     if (informations is GameFightMonsterInformations)
     {
         GameFightMonsterInformations infos = (GameFightMonsterInformations)informations;
         Fighters.Add(new BFighter(informations.contextualId, informations.disposition.cellId, informations.stats.actionPoints, informations.stats, informations.alive, informations.stats.lifePoints, informations.stats.maxLifePoints, informations.stats.movementPoints, (uint)informations.teamId, infos.creatureGenericId));
     }
     else
     {
         Fighters.Add(new BFighter(informations.contextualId, informations.disposition.cellId, informations.stats.actionPoints, informations.stats, informations.alive, informations.stats.lifePoints, informations.stats.maxLifePoints, informations.stats.movementPoints, (uint)informations.teamId, 0));
     }
     if (Fighter != null)
     {
         Fighter.Name = m_Account.CharacterBaseInformations.name;
     }
 }
Ejemplo n.º 23
0
 /// <summary>
 /// Add a fighter to the fighter's list.
 /// </summary>
 public void AddFighter(GameFightFighterInformations informations)
 {
     if (informations is GameFightMonsterInformations)
     {
         GameFightMonsterInformations infos = (GameFightMonsterInformations)informations;
         Fighters.Add(new BFighter(informations.ContextualId, informations.Disposition.CellId, informations.Stats.ActionPoints, informations.Stats, informations.Alive, (int)informations.Stats.LifePoints, (int)informations.Stats.MaxLifePoints, informations.Stats.MovementPoints, (uint)informations.TeamId, infos.CreatureGenericId));
     }
     else
     {
         Fighters.Add(new BFighter(informations.ContextualId, informations.Disposition.CellId, informations.Stats.ActionPoints, informations.Stats, informations.Alive, (int)informations.Stats.LifePoints, (int)informations.Stats.MaxLifePoints, informations.Stats.MovementPoints, (uint)informations.TeamId, 0));
     }
     if (Fighter != null)
     {
         Fighter.Name = m_Account.CharacterBaseInformations.Name;
     }
 }
Ejemplo n.º 24
0
        public void AddFighter(GameFightFighterInformations fighter)
        {
            if (fighter == null)
            {
                throw new ArgumentNullException("fighter");
            }

            Bot bot = BotManager.Instance.GetCurrentBot();

            // do not add character twice
            if (fighter.contextualId == bot.Character.Id)
            {
                return;
            }

            AddFighter(CreateFighter(fighter));
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Create a Fighter instance corresponding to the network given type
        /// </summary>
        /// <param name="fighter"></param>
        /// <returns></returns>
        public Fighter CreateFighter(GameFightFighterInformations fighter)
        {
            if (fighter == null)
            {
                throw new ArgumentNullException("fighter");
            }
            if (fighter is GameFightCharacterInformations)
            {
                return(new CharacterFighter(fighter as GameFightCharacterInformations, this));
            }
            if (fighter is GameFightMonsterInformations)
            {
                return(new MonsterFighter(fighter as GameFightMonsterInformations, this));
            }

            throw new Exception(string.Format("Fighter of type {0} not handled", fighter.GetType()));
        }
Ejemplo n.º 26
0
        public override void Update(GameFightFighterInformations informations)
        {
            if (informations == null)
            {
                throw new ArgumentNullException("informations");
            }

            if (informations is GameFightMonsterInformations)
            {
                Update(informations as GameFightMonsterInformations);
            }
            else
            {
                logger.Error("Cannot update a {0} with a {1} instance", GetType(), informations.GetType());
                base.Update(informations);
            }
        }
Ejemplo n.º 27
0
 protected void AddFighter(GameFightFighterInformations infos)
 {
     if (infos is GameFightMonsterInformations monsterInfo)
     {
         Monsters.Add(new Monster(monsterInfo.ContextualId, monsterInfo.Disposition.CellId, monsterInfo.Stats,
                                  monsterInfo.TeamId, monsterInfo.Alive, monsterInfo.CreatureGenericId, monsterInfo.CreatureGrade));
     }
     else if (infos is GameFightCompanionInformations companionInfo)
     {
         Companions.Add(new Companion(companionInfo.ContextualId, companionInfo.Disposition.CellId,
                                      companionInfo.Stats, companionInfo.TeamId, companionInfo.Alive, companionInfo.CompanionGenericId,
                                      companionInfo.Level, companionInfo.MasterId));
     }
     else
     {
         Fighters.Add(new Fighter(infos.ContextualId, infos.Disposition.CellId, infos.Stats, infos.TeamId,
                                  infos.Alive));
     }
 }
Ejemplo n.º 28
0
        public Fighter(GameFightFighterInformations msg, Fight fight) : this()
        {
            Id    = msg.contextualId;
            Fight = fight;
            Look  = msg.look;
            Map   = fight.Map;
            Update(msg.disposition);
            Team     = fight.GetTeam((FightTeamColor)msg.teamId);
            IsAlive  = msg.alive;
            Stats    = new MinimalStats(msg.stats);
            Summoned = msg.stats.summoned;
            if (Summoned)
            {
                Summoner = Fight.GetActor(msg.stats.summoner);

                if (Summoner == null)
                {
                    logger.Error("Summoner {0} of fighter {1} not found", msg.stats.summoner, this);
                }
            }
        }
Ejemplo n.º 29
0
 protected void AddFighter(GameFightFighterInformations infos)
 {
     lock (CheckLock)
     {
         if (infos is GameFightMonsterInformations monsterInfo)
         {
             Monsters.Add(new Monster(monsterInfo.ContextualId, monsterInfo.Disposition.CellId, monsterInfo.Stats,
                                      (uint)monsterInfo.TeamId, monsterInfo.Alive, monsterInfo.CreatureGenericId, (byte)monsterInfo.CreatureGrade));
         }
         //else if (infos is GameFightCompanion companionInfo)
         //    Companions.Add(new Companion(companionInfo.ContextualId, companionInfo.Disposition.CellId,
         //        companionInfo.Stats, companionInfo.TeamId, companionInfo.Alive, companionInfo.CompanionGenericId,
         //        companionInfo.Level, companionInfo.MasterId));
         else if (infos is GameFightCharacterInformations)
         {
             Fighters.Add(new Fighter(infos.ContextualId, infos.Disposition.CellId, infos.Stats, (uint)infos.TeamId,
                                      infos.Alive));
         }
         else
         {
             throw new Exception($"Typeof({infos.TypeID}) [{infos.GetType()}] type is missing on AddFighter()");
         }
     }
 }
Ejemplo n.º 30
0
 public override void Deserialize(IDataReader reader)
 {
     Informations = ProtocolTypeManager.GetInstance(reader.ReadUShort());
     Informations.Deserialize(reader);
 }
Ejemplo n.º 31
0
 /// <summary>
 /// Add a fighter to the fighter's list.
 /// </summary>
 public void AddFighter(GameFightFighterInformations informations)
 {
     if (informations is GameFightMonsterInformations)
     {
         GameFightMonsterInformations infos = (GameFightMonsterInformations)informations;
         Fighters.Add(new BFighter(informations.contextualId, informations.disposition.cellId, informations.stats.actionPoints, informations.stats, informations.alive, informations.stats.lifePoints, informations.stats.maxLifePoints, informations.stats.movementPoints, (uint)informations.teamId, infos.creatureGenericId));
     }
     else
     {
         Fighters.Add(new BFighter(informations.contextualId, informations.disposition.cellId, informations.stats.actionPoints, informations.stats, informations.alive, informations.stats.lifePoints, informations.stats.maxLifePoints, informations.stats.movementPoints, (uint)informations.teamId, 0));
     }
     if (Fighter != null)
         Fighter.Name = m_Account.CharacterBaseInformations.name;
 }