コード例 #1
0
        public Entity GetActorEntity(EntityId entityId)
        {
            var entity = NetworkController.Instance.EntityTracker.GetOrPlaceholder(entityId);
            if (entity is NpcEntity || entity is UserEntity)
            {
                return entity;
            }

            return null;
        }
コード例 #2
0
 public Entity GetEntity(EntityId entityId)
 {
     var entity = NetworkController.Instance.EntityTracker.GetOrPlaceholder(entityId);
     var entity2 = GetActorEntity(entityId);
     if (entity2 != null)
     {
         return entity2;
     }
     if (!(entity is ProjectileEntity)) return null;
     var source = (ProjectileEntity) entity;
     if (!(source.Owner is NpcEntity) && !(source.Owner is UserEntity)) return null;
     return source.Owner;
 }
コード例 #3
0
ファイル: UserEntity.cs プロジェクト: bonekid/TeraDamageMeter
 public UserEntity(EntityId id)
     : base(id)
 {
 }
コード例 #4
0
 public PlaceHolderEntity(EntityId id)
     : base(id)
 {
 }
コード例 #5
0
ファイル: Database.cs プロジェクト: neowutran/ShinraMeter
        public Skills GetSkills(long beginTime, long endTime)
        {
            var sql =
                "SELECT amount, type, target, targetServerIdPlayerId , source, sourceServerIdPlayerId, pet_zone, pet_id, skill_id, hotdot, critic, time, direction FROM skills WHERE time BETWEEN $begin AND $end ;";

            var command = new SQLiteCommand(sql, Connexion);
            command.Parameters.AddWithValue("$begin", beginTime);
            command.Parameters.AddWithValue("$end", endTime);

            var targetSourceSkills = new Dictionary<Entity, Dictionary<Entity, List<Skill>>>();
            var sourceTargetSkills = new Dictionary<Entity, Dictionary<Entity, List<Skill>>>();
            var sourceTargetIdSkill = new Dictionary<Entity, Dictionary<Entity, Dictionary<int, List<Skill>>>>();
            var sourceIdSkill = new Dictionary<Entity, Dictionary<int, List<Skill>>>();
            var rdr = command.ExecuteReader();
            command.Dispose();

            while (rdr.Read())
            {
                var amount = rdr.GetFieldValue<long>(rdr.GetOrdinal("amount"));
                var type = (Type) rdr.GetFieldValue<long>(rdr.GetOrdinal("type"));
                var target = new EntityId((ulong) rdr.GetFieldValue<long>(rdr.GetOrdinal("target")));
                var targetServerIdPlayerId = rdr.IsDBNull(rdr.GetOrdinal("targetServerIdPlayerId")) ? 0 :  (ulong)rdr.GetFieldValue<long>(rdr.GetOrdinal("targetServerIdPlayerId"));
                var source = new EntityId((ulong) rdr.GetFieldValue<long>(rdr.GetOrdinal("source")));
                var sourceServerIdPlayerId = rdr.IsDBNull(rdr.GetOrdinal("sourceServerIdPlayerId")) ? 0 : (ulong)rdr.GetFieldValue<long>(rdr.GetOrdinal("sourceServerIdPlayerId"));

                var skillid = rdr.GetFieldValue<long>(rdr.GetOrdinal("skill_id"));
                var direction =  (HitDirection)rdr.GetFieldValue<long>(rdr.GetOrdinal("direction"));
                var critic = rdr.GetFieldValue<long>(rdr.GetOrdinal("critic")) == 1;
                var hotdot = rdr.GetFieldValue<long>(rdr.GetOrdinal("hotdot")) == 1;
                var time = rdr.GetFieldValue<long>(rdr.GetOrdinal("time"));
                var petZone = rdr.IsDBNull(rdr.GetOrdinal("pet_zone"))
                    ? 0
                    : rdr.GetFieldValue<long>(rdr.GetOrdinal("pet_zone"));
                var petId = rdr.IsDBNull(rdr.GetOrdinal("pet_id"))
                ? 0
                : rdr.GetFieldValue<long>(rdr.GetOrdinal("pet_id"));
                var pet = BasicTeraData.Instance.MonsterDatabase.GetOrNull((ushort)petZone, (uint)petId);

                Player sourcePlayer = null;
                if (sourceServerIdPlayerId != 0) {
                   sourcePlayer = NetworkController.Instance.PlayerTracker.Get((uint)(sourceServerIdPlayerId >> 32), (uint)(sourceServerIdPlayerId << 32 >> 32));
                }
                Player targetPlayer = null;
                if (targetServerIdPlayerId != 0)
                {
                    targetPlayer = NetworkController.Instance.PlayerTracker.Get((uint)(targetServerIdPlayerId >> 32), (uint)(targetServerIdPlayerId << 32 >> 32));
                }
                var entityTarget = NetworkController.Instance.EntityTracker.GetOrNull(target);
                var entitySource = NetworkController.Instance.EntityTracker.GetOrNull(source);
                var skill = new Skill(amount, type, entityTarget, targetPlayer, entitySource, sourcePlayer, (int) skillid, hotdot, critic, time, pet, direction);

                if (!targetSourceSkills.ContainsKey(skill.Target))
                {
                    targetSourceSkills.Add(skill.Target, new Dictionary<Entity, List<Skill>>());
                }

                if (!targetSourceSkills[skill.Target].ContainsKey(skill.Source))
                {
                    targetSourceSkills[skill.Target].Add(skill.Source, new List<Skill>());
                }

                if (!sourceTargetSkills.ContainsKey(skill.Source))
                {
                    sourceTargetIdSkill.Add(skill.Source, new Dictionary<Entity, Dictionary<int, List<Skill>>>());
                    sourceIdSkill.Add(skill.Source, new Dictionary<int, List<Skill>>());
                    sourceTargetSkills.Add(skill.Source, new Dictionary<Entity, List<Skill>>());
                }

                if (!sourceTargetSkills[skill.Source].ContainsKey(skill.Target))
                {
                    sourceTargetSkills[skill.Source].Add(skill.Target, new List<Skill>());
                    sourceTargetIdSkill[skill.Source].Add(skill.Target, new Dictionary<int, List<Skill>>());
                }

                if (!sourceTargetIdSkill[skill.Source][skill.Target].ContainsKey(skill.SkillId))
                {
                    sourceTargetIdSkill[skill.Source][skill.Target].Add(skill.SkillId, new List<Skill>());
                }

                if (!sourceIdSkill[skill.Source].ContainsKey(skill.SkillId))
                {
                    sourceIdSkill[skill.Source].Add(skill.SkillId, new List<Skill>());
                }

                targetSourceSkills[skill.Target][skill.Source].Add(skill);
                sourceTargetSkills[skill.Source][skill.Target].Add(skill);
                sourceTargetIdSkill[skill.Source][skill.Target][skill.SkillId].Add(skill);
                sourceIdSkill[skill.Source][skill.SkillId].Add(skill);
            }

            var skills = new Skills(sourceTargetSkills, targetSourceSkills, sourceTargetIdSkill, sourceIdSkill);
            return skills;
        }
コード例 #6
0
ファイル: NpcEntity.cs プロジェクト: kuko0411/TeraDamageMeter
 public NpcEntity(EntityId id, EntityId ownerId, Entity owner)
     : base(id)
 {
     OwnerId = ownerId;
     Owner = owner;
 }
コード例 #7
0
ファイル: UserEntity.cs プロジェクト: s2021369/ShinraMeter
 public UserEntity(EntityId id)
     : base(id)
 {
 }
コード例 #8
0
 protected virtual void OnPlayerIdChangedAction(EntityId oldid, EntityId newid)
 {
     PlayerIdChangedAction?.Invoke(oldid, newid);
 }
コード例 #9
0
ファイル: SkillResult.cs プロジェクト: Roukanken42/Tera
        public SkillResult(long amount, bool isCritical, bool isHp, bool isHeal, HotDot hotdot, EntityId source,
                           EntityId target, DateTime time,
                           EntityTracker entityRegistry, PlayerTracker playerTracker)
        {
            Time        = time;
            Amount      = isHp ? Math.Abs(amount) : amount;
            IsCritical  = isCritical;
            IsHp        = isHp;
            IsHeal      = isHeal;
            SkillId     = hotdot.Id;
            Abnormality = true;

            Source = entityRegistry.GetOrPlaceholder(source);
            Target = entityRegistry.GetOrPlaceholder(target);
            var userNpc    = UserEntity.ForEntity(Source);
            var sourceUser = userNpc["root_source"] as UserEntity; // Attribute damage dealt by owned entities to the owner
            var targetUser = Target as UserEntity;                 // But don't attribute damage received by owned entities to the owner

            var pclass = PlayerClass.Common;

            if (sourceUser != null)
            {
                SourcePlayer = playerTracker.Get(sourceUser.ServerId, sourceUser.PlayerId);
                pclass       = SourcePlayer.RaceGenderClass.Class;
            }
            Skill = new UserSkill(hotdot.Id, pclass,
                                  hotdot.Name, "DOT", null, hotdot.IconName);

            if (targetUser != null)
            {
                TargetPlayer = playerTracker.Get(targetUser.ServerId, targetUser.PlayerId);
            }
            HitDirection = HitDirection.Dot;
        }