コード例 #1
0
        public float GetHorizontalDistanceTo(ActorEntity compare)
        {
            var distanceX = (float)Math.Abs(X - compare.X);
            var distanceY = (float)Math.Abs(Y - compare.Y);

            return((float)Math.Sqrt((distanceX * distanceX) + (distanceY * distanceY)));
        }
コード例 #2
0
 public static void AddNPCEntity(ActorEntity entity)
 {
     lock (_npcEntities)
     {
         _npcEntities.Add(entity);
     }
 }
コード例 #3
0
 public static void AddUniqueNPCEntity(ActorEntity entity)
 {
     lock (_uniqueNPCEntities)
     {
         _uniqueNPCEntities.Add(entity);
     }
 }
コード例 #4
0
        public float GetDistanceTo(ActorEntity compare)
        {
            var distanceX = (float)Math.Abs(X - compare.X);
            var distanceY = (float)Math.Abs(Y - compare.Y);
            var distanceZ = (float)Math.Abs(Z - compare.Z);

            return((float)Math.Sqrt((distanceX * distanceX) + (distanceY * distanceY) + (distanceZ * distanceZ)));
        }
コード例 #5
0
        public static void handleRemove(ActorEntity cachedEntity, ActorEntity currentEntity)
        {
            try
            {
                //debug("Removed Mob: " + currentEntity.Name + " (" + handleRemoveEntry + ", " + (currentEntity.IsValid ? "valid" : "not valid") + ", " + (currentEntity.IsClaimed ? "claimed" : "not claimed") + ", by id: " + currentEntity.ClaimedByID + ")", DBMErrorLevel.Trace);

                ActorEntity tmp = null;

                _mobCached.TryRemove(cachedEntity.ID, out tmp);

                if (learningHelperClass != null)
                {
                    try
                    {
                        learningHelperClass.onMobRemoved(cachedEntity);
                    }
                    catch (Exception e2)
                    {
                        debug("learningHelper onMobRemoved", getEngineVsEncounter(learningHelperClass), e2);
                    }
                }

                if (implementationClass != null)
                {
                    try
                    {
                        if (currentEntity == null)
                        {
                            debug("Removed Mob: " + cachedEntity.Name + " ID: " + cachedEntity.ID + " NPCID1: " + cachedEntity.NPCID1 + " NPCID2: " + cachedEntity.NPCID2 + " (" + handleRemoveEntry + ", null)", DBMErrorLevel.Trace);
                        }
                        else
                        {
                            debug("Removed Mob: " + currentEntity.Name + " ID: " + currentEntity.ID + " NPCID1: " + currentEntity.NPCID1 + " NPCID2: " + currentEntity.NPCID2 + " (" + handleRemoveEntry + ", " + (currentEntity.IsValid ? "valid" : "not valid") + ")", DBMErrorLevel.Trace);
                        }
                        inController = false;
                        implementationClass.onMobRemoved(cachedEntity);
                        inController = true;
                    }
                    catch (Exception e2)
                    {
                        debug("onMobRemoved", getEngineVsEncounter(implementationClass), e2);
                    }
                }
            }
            catch (Exception ex2)
            {
                debug("handleRemove error: ", DBMErrorLevel.EngineErrors, ex2);
            }
        }
コード例 #6
0
 private static void CleanXPValue(ref ActorEntity entity)
 {
     if (entity.HPCurrent < 0 || entity.HPMax < 0)
     {
         entity.HPCurrent = 1;
         entity.HPMax = 1;
     }
     if (entity.HPCurrent > entity.HPMax)
     {
         if (entity.HPMax == 0)
         {
             entity.HPCurrent = 1;
             entity.HPMax = 1;
         }
         else
         {
             entity.HPCurrent = entity.HPMax;
         }
     }
     if (entity.MPCurrent < 0 || entity.MPMax < 0)
     {
         entity.MPCurrent = 1;
         entity.MPMax = 1;
     }
     if (entity.MPCurrent > entity.MPMax)
     {
         if (entity.MPMax == 0)
         {
             entity.MPCurrent = 1;
             entity.MPMax = 1;
         }
         else
         {
             entity.MPCurrent = entity.MPMax;
         }
     }
     if (entity.GPCurrent < 0 || entity.GPMax < 0)
     {
         entity.GPCurrent = 1;
         entity.GPMax = 1;
     }
     if (entity.GPCurrent > entity.GPMax)
     {
         if (entity.GPMax == 0)
         {
             entity.GPCurrent = 1;
             entity.GPMax = 1;
         }
         else
         {
             entity.GPCurrent = entity.GPMax;
         }
     }
     if (entity.CPCurrent < 0 || entity.CPMax < 0)
     {
         entity.CPCurrent = 1;
         entity.CPMax = 1;
     }
     if (entity.CPCurrent > entity.CPMax)
     {
         if (entity.CPMax == 0)
         {
             entity.CPCurrent = 1;
             entity.CPMax = 1;
         }
         else
         {
             entity.CPCurrent = entity.CPMax;
         }
     }
 }
コード例 #7
0
 public float GetDistanceTo(ActorEntity compare)
 {
     var distanceX = (float) Math.Abs(X - compare.X);
     var distanceY = (float) Math.Abs(Y - compare.Y);
     var distanceZ = (float) Math.Abs(Z - compare.Z);
     return (float) Math.Sqrt((distanceX * distanceX) + (distanceY * distanceY) + (distanceZ * distanceZ));
 }
コード例 #8
0
        public void onAgroRemoved(ActorEntity mob)
        {

        }
コード例 #9
0
        public void onMobRemoved(ActorEntity mob)
        {

        }
コード例 #10
0
        public static ActorEntity cloneActorEntity(ActorEntity toClone)
        {
            ActorEntity newEntity = new ActorEntity();

            copyActorEntity(toClone, newEntity);

            return newEntity;
        }
コード例 #11
0
        public float GetCastingDistanceTo(ActorEntity compare)
        {
            var distance = GetHorizontalDistanceTo(compare) - compare.HitBoxRadius;

            return(distance > 0 ? distance : 0);
        }
コード例 #12
0
 public void onAgroRemoved(ActorEntity mob)
 {
     // PartyList seems to be broken currently in FFXIV-APP, so disabling this until it's fixed
     return;
     if (mob.Name.Contains("The Ghost Of Meracydia"))
     {
         bool found = false;
         foreach (PartyEntity player in partyList)
         {
             try
             {
                 debug("player: " + player.Name);
                 foreach (StatusEntry status in player.StatusEntries)
                 {
                     try
                     {
                         debug("player: " + player.Name + " - " + status.StatusName);
                         if (status.StatusName.Contains("Garrote Twist"))
                         {
                             found = true;
                             tts(player.Name);
                         }
                     }
                     catch { }
                 }
             }
             catch { }
         }
         if (found)
         {
             tts("to white circles");
         }
     }
     
 }
コード例 #13
0
 public void onMobAdded(ActorEntity mob)
 {
     if (mob.Name.Contains("The Ghost Of Meracydia"))
     {
         tts("Add");
     }
 }
コード例 #14
0
 private static PartyEntity GetPartyEntity(uint address, Structures.PartyMember partyMember, ActorEntity currentUser = null)
 {
     var actor = currentUser ?? (dynamic) partyMember;
     try
     {
         var entry = new PartyEntity
         {
             ID = actor.ID,
             X = actor.X,
             Z = actor.Z,
             Y = actor.Y,
             Level = actor.Level,
             HPCurrent = actor.HPCurrent,
             HPMax = actor.HPMax,
             MPCurrent = actor.MPCurrent,
             MPMax = actor.MPMax,
             Job = actor.Job
         };
         if (entry.HPMax == 0)
         {
             entry.HPMax = 1;
         }
         if (currentUser == null)
         {
             entry.Name = MemoryHandler.Instance.GetString(address, 32);
             entry.Coordinate = new Coordinate(actor.X, actor.Z, actor.Y);
             foreach (var status in actor.Statuses)
             {
                 var statusEntry = new StatusEntry
                 {
                     TargetName = entry.Name,
                     StatusID = status.StatusID,
                     Duration = status.Duration,
                     CasterID = status.CasterID
                 };
                 try
                 {
                     var statusInfo = StatusEffectHelper.StatusInfo(statusEntry.StatusID);
                     statusEntry.IsCompanyAction = statusInfo.CompanyAction;
                     var statusKey = statusInfo.Name.English;
                     switch (Settings.Default.GameLanguage)
                     {
                         case "French":
                             statusKey = statusInfo.Name.French;
                             break;
                         case "Japanese":
                             statusKey = statusInfo.Name.Japanese;
                             break;
                         case "German":
                             statusKey = statusInfo.Name.German;
                             break;
                         case "Chinese":
                             statusKey = statusInfo.Name.Chinese;
                             break;
                     }
                     statusEntry.StatusName = statusKey;
                 }
                 catch (Exception ex)
                 {
                     statusEntry.StatusName = "UNKNOWN";
                 }
                 if (statusEntry.IsValid())
                 {
                     entry.StatusEntries.Add(statusEntry);
                 }
             }
         }
         else
         {
             entry.Name = actor.Name;
             entry.Coordinate = actor.Coordinate;
             entry.StatusEntries = actor.StatusEntries;
         }
         return entry;
     }
     catch (Exception ex)
     {
     }
     return new PartyEntity();
 }
コード例 #15
0
        static void handleNewMob(ActorEntity currentEntity)
        {
            if (currentEntity != null && currentEntity.IsValid && currentEntity.HPCurrent > 0 && (currentEntity.OwnerID == 0 || currentEntity.OwnerID >= 0xE0000000))
            {
                // make sure it's our own copy so it won't mysteriously disappear or change without our knowledge
                currentEntity = cloneActorEntity(currentEntity);

                _mobCached[currentEntity.ID] = currentEntity;


                if (learningHelperClass != null)
                {
                    // send the new mobs to the learning helper
                    try
                    {
                        learningHelperClass.onMobAdded(currentEntity);
                    }
                    catch (Exception e2)
                    {
                        debug("learningHelper onMobAdded", getEngineVsEncounter(learningHelperClass), e2);
                    }
                }

                if (implementationClass != null)
                {
                    // send the new mobs to the encounter script
                    try
                    {
                        inController = false;
                        debug("Added Mob: " + currentEntity.Name + " ID: " + currentEntity.ID + " NPCID1: " + currentEntity.NPCID1 + " NPCID2: " + currentEntity.NPCID2, DBMErrorLevel.Trace);
                        implementationClass.onMobAdded(currentEntity);
                        inController = true;
                    }
                    catch (Exception e2)
                    {
                        debug("onMobAdded", getEngineVsEncounter(implementationClass), e2);
                        inController = true;
                    }

                }
            }
        }
コード例 #16
0
        public static void copyActorEntity(ActorEntity fromEntity, ActorEntity toEntity)
        {
            try
            {
                ActorEntity tmpEnt = fromEntity;
                ActorEntity tmpActor = toEntity;

                tmpActor.ActionStatus = tmpEnt.ActionStatus;
                tmpActor.CastingID = tmpEnt.CastingID;
                tmpActor.CastingProgress = tmpEnt.CastingProgress;
                tmpActor.CastingTargetID = tmpEnt.CastingTargetID;
                tmpActor.CastingTime = tmpEnt.CastingTime;
                tmpActor.ClaimedByID = tmpEnt.ClaimedByID;
                tmpActor.Coordinate = tmpEnt.Coordinate;
                tmpActor.CPCurrent = tmpEnt.CPCurrent;
                tmpActor.CPMax = tmpEnt.CPMax;
                tmpActor.Distance = tmpEnt.Distance;
                tmpActor.Fate = tmpEnt.Fate;
                tmpActor.GatheringInvisible = tmpEnt.GatheringInvisible;
                tmpActor.GatheringStatus = tmpEnt.GatheringStatus;
                tmpActor.GPCurrent = tmpEnt.GPCurrent;
                tmpActor.GPMax = tmpEnt.GPMax;
                tmpActor.GrandCompany = tmpEnt.GrandCompany;
                tmpActor.GrandCompanyRank = tmpEnt.GrandCompanyRank;
                tmpActor.Heading = tmpEnt.Heading;
                tmpActor.HitBoxRadius = tmpEnt.HitBoxRadius;
                tmpActor.HPCurrent = tmpEnt.HPCurrent;
                tmpActor.HPMax = tmpEnt.HPMax;
                tmpActor.Icon = tmpEnt.Icon;
                tmpActor.ID = tmpEnt.ID;
                tmpActor.IsCasting = tmpEnt.IsCasting;
                tmpActor.IsGM = tmpEnt.IsGM;
                tmpActor.Job = tmpEnt.Job;
                tmpActor.Level = tmpEnt.Level;
                tmpActor.MapIndex = tmpEnt.MapIndex;
                tmpActor.ModelID = tmpEnt.ModelID;
                tmpActor.MPCurrent = tmpEnt.MPCurrent;
                tmpActor.MPMax = tmpEnt.MPMax;
                tmpActor.Name = tmpEnt.Name;
                tmpActor.NPCID1 = tmpEnt.NPCID1;
                tmpActor.NPCID2 = tmpEnt.NPCID2;
                tmpActor.OwnerID = tmpEnt.OwnerID;
                tmpActor.Race = tmpEnt.Race;
                tmpActor.Sex = tmpEnt.Sex;
                tmpActor.Status = tmpEnt.Status;
                tmpActor.TargetID = tmpEnt.TargetID;
                tmpActor.TargetType = tmpEnt.TargetType;
                tmpActor.Title = tmpEnt.Title;
                tmpActor.TPCurrent = tmpEnt.TPCurrent;
                tmpActor.TPMax = tmpEnt.TPMax;
                tmpActor.Type = tmpEnt.Type;
                tmpActor.X = tmpEnt.X;
                tmpActor.Y = tmpEnt.Y;
                tmpActor.Z = tmpEnt.Z;


                tmpActor.StatusEntries.Clear();

                foreach (StatusEntry se in tmpEnt.StatusEntries)
                {
                    tmpActor.StatusEntries.Add(se);
                }
            }
            catch (Exception ex)
            {
                debug("Error copyActorEntity", DBMErrorLevel.EngineErrors, ex);
            }

        }
コード例 #17
0
        public bool bossCheck(ActorEntity mob)
        {
            _inController = true;

            if (mob.Name.Trim() == bossName.Trim())
            {
                bossEntity = mob;

                _inController = false;
                return true;
            }

            _inController = false;
            return false;
        }
コード例 #18
0
        public void TestModeStart()
        {
            if (TestMode)
            {
                TestModeStop();
            }
            LogHelper.Log(Logger, "Test Mode Started", LogLevel.Trace);

            Widgets.Instance.ShowTwintaniaWidget();
            ForceTop = true;

            TestMode = true;

            TwintaniaEntity = new ActorEntity
            {
                Name = "Twintania",
                HPMax = 514596,
                HPCurrent = 514596
            };
            TwintaniaEngaged = true;
            TwintaniaIsValid = true;
            TwintaniaHPPercent = 1;

            EnrageTimerStart();

            TwintaniaDivebombCount = 1;
            TwintaniaDivebombTimeToNextCur = 0;
            TwintaniaDivebombTimeToNextMax = 0;

            DreadknightEntity = new ActorEntity
            {
                Name = "Dreadknight",
                HPMax = 11250,
                HPCurrent = 11250
            };
            DreadknightIsValid = true;
            DreadknightHPPercent = 1;

            TwintaniaTestTimeToNextCur = 0.3;

            TwintaniaTestList.Enqueue(Tuple.Create("Divebomb", Settings.Default.TwintaniaWidgetDivebombTimeFast + 0.5));

            TwintaniaTestList.Enqueue(Tuple.Create("Divebomb", Settings.Default.TwintaniaWidgetDivebombTimeFast + 0.5));

            TwintaniaTestList.Enqueue(Tuple.Create("Divebomb", Settings.Default.TwintaniaWidgetDivebombTimeSlow + 0.5));

            TwintaniaTestList.Enqueue(Tuple.Create("Divebomb", Settings.Default.TwintaniaWidgetDivebombTimeFast + 0.5));

            TwintaniaTestList.Enqueue(Tuple.Create("Divebomb", Settings.Default.TwintaniaWidgetDivebombTimeFast + 0.5));

            TwintaniaTestList.Enqueue(Tuple.Create("Twister", 1.0));

            TwintaniaTestList.Enqueue(Tuple.Create("End", (double) 0));

            TwintaniaTestTimer.Start();
        }
コード例 #19
0
        public static void handleRemoveAgro(ActorEntity cachedEntity, ActorEntity currentEntity)
        {
            try
            {
                if (currentEntity == null)
                {
                    debug("Removed Agro: " + cachedEntity.Name + " (" + handleRemoveEntry + ", null)", DBMErrorLevel.Trace);
                }
                else
                {
                    debug("Removed Agro: " + currentEntity.Name + " (" + handleRemoveEntry + ", " + (currentEntity.IsValid ? "valid" : "not valid") + ", " + (currentEntity.IsClaimed ? "claimed" : "not claimed") + ", by id: " + currentEntity.ClaimedByID + ")", DBMErrorLevel.Trace);
                }
                _agroList.Remove(cachedEntity);

                if (learningHelperClass != null)
                {
                    try
                    {
                        learningHelperClass.onAgroRemoved(cachedEntity);
                    }
                    catch (Exception e2)
                    {
                        debug("learningHelper onAgroRemoved", getEngineVsEncounter(learningHelperClass), e2);
                    }
                }

                if (implementationClass != null)
                {
                    try
                    {
                        inController = false;
                        implementationClass.onAgroRemoved(cachedEntity);
                        inController = true;
                    }
                    catch (Exception e2)
                    {
                        debug("onAgroRemoved", getEngineVsEncounter(implementationClass), e2);
                        inController = true;
                    }
                }


                if (encounterStarted && !_agroList.Any())
                {
                    endEncounterAt = DateTime.Now + TimeSpan.FromSeconds(1);
                    //endEncounter();
                }
            }
            catch (Exception ex2)
            {
                debug("handleRemoveAgro error: ", DBMErrorLevel.EngineErrors, ex2);
            }
        }
コード例 #20
0
ファイル: Imdugud.cs プロジェクト: Yaguar666/FFXIVDBM.Plugin
        public void onMobAdded(ActorEntity mob)
        {

        }
コード例 #21
0
ファイル: PartyEntityHelper.cs プロジェクト: agoln/ffxivapp
 public static PartyEntity ResolvePartyMemberFromBytes(byte[] source, ActorEntity actorEntity = null)
 {
     if (actorEntity != null)
     {
         var entry = new PartyEntity
         {
             X = actorEntity.X,
             Y = actorEntity.Y,
             Z = actorEntity.Z,
             Coordinate = actorEntity.Coordinate,
             ID = actorEntity.ID,
             Name = actorEntity.Name,
             Job = actorEntity.Job,
             Level = actorEntity.Level,
             HPCurrent = actorEntity.HPCurrent,
             HPMax = actorEntity.HPMax,
             MPCurrent = actorEntity.MPCurrent,
             MPMax = actorEntity.MPMax,
             StatusEntries = actorEntity.StatusEntries,
         };
         CleanXPValue(ref entry);
         return entry;
     }
     else
     {
         var entry = new PartyEntity();
         try
         {
             switch (Settings.Default.GameLanguage)
             {
                 case "Chinese":
                 default:
                     entry.X = BitConverter.ToSingle(source, 0x0);
                     entry.Z = BitConverter.ToSingle(source, 0x4);
                     entry.Y = BitConverter.ToSingle(source, 0x8);
                     entry.Coordinate = new Coordinate(entry.X, entry.Z, entry.Z);
                     entry.ID = BitConverter.ToUInt32(source, 0x10);
                     entry.Name = MemoryHandler.Instance.GetStringFromBytes(source, 0x20);
                     entry.Job = (Actor.Job) source[0x61];
                     entry.Level = source[0x63];
                     entry.HPCurrent = BitConverter.ToInt32(source, 0x68);
                     entry.HPMax = BitConverter.ToInt32(source, 0x6C);
                     entry.MPCurrent = BitConverter.ToInt16(source, 0x70);
                     entry.MPMax = BitConverter.ToInt16(source, 0x72);
                     break;
             }
             const int limit = 15;
             entry.StatusEntries = new List<StatusEntry>();
             const int statusSize = 12;
             var statusesSource = new byte[limit * statusSize];
             switch (Settings.Default.GameLanguage)
             {
                 case "Chinese":
                 default:
                     var defaultStatusEffectOffset = MemoryHandler.Instance.ProcessModel.IsWin64 ? 0x88 : 0x80;
                     Buffer.BlockCopy(source, defaultStatusEffectOffset, statusesSource, 0, limit * 12);
                     break;
             }
             for (var i = 0; i < limit; i++)
             {
                 var statusSource = new byte[statusSize];
                 Buffer.BlockCopy(statusesSource, i * statusSize, statusSource, 0, statusSize);
                 var statusEntry = new StatusEntry
                 {
                     TargetName = entry.Name,
                     StatusID = BitConverter.ToInt16(statusSource, 0x0),
                     Stacks = statusSource[0x2],
                     Duration = BitConverter.ToSingle(statusSource, 0x4),
                     CasterID = BitConverter.ToUInt32(statusSource, 0x8)
                 };
                 try
                 {
                     var pc = PCWorkerDelegate.GetNPCEntity(statusEntry.CasterID);
                     var npc = NPCWorkerDelegate.GetNPCEntity(statusEntry.CasterID);
                     var monster = MonsterWorkerDelegate.GetNPCEntity(statusEntry.CasterID);
                     statusEntry.SourceEntity = (pc ?? npc) ?? monster;
                 }
                 catch (Exception ex)
                 {
                 }
                 try
                 {
                     if (statusEntry.StatusID > 0)
                     {
                         var statusInfo = StatusEffectHelper.StatusInfo(statusEntry.StatusID);
                         statusEntry.IsCompanyAction = statusInfo.CompanyAction;
                         var statusKey = statusInfo.Name.English;
                         switch (Settings.Default.GameLanguage)
                         {
                             case "French":
                                 statusKey = statusInfo.Name.French;
                                 break;
                             case "Japanese":
                                 statusKey = statusInfo.Name.Japanese;
                                 break;
                             case "German":
                                 statusKey = statusInfo.Name.German;
                                 break;
                             case "Chinese":
                                 statusKey = statusInfo.Name.Chinese;
                                 break;
                         }
                         statusEntry.StatusName = statusKey;
                     }
                 }
                 catch (Exception ex)
                 {
                     statusEntry.StatusName = "UNKNOWN";
                 }
                 if (statusEntry.IsValid())
                 {
                     entry.StatusEntries.Add(statusEntry);
                 }
             }
         }
         catch (Exception ex)
         {
         }
         CleanXPValue(ref entry);
         return entry;
     }
 }
コード例 #22
0
 public void onMobAdded(ActorEntity mob)
 {
     if (mob.Name.Contains("Dark Matter Bulb"))
     {
         if (mob.Coordinate.DistanceTo(bossEntity.Coordinate) <= 7)
         {
             tts("Bulb under boss");
         }
     }
 }
コード例 #23
0
        public void onMobAgro(ActorEntity mob)
        {
            if (mob.HPMax > bossHealth && !EncounterController.ignoreMobs.Contains(mob.Name))
            {
                bossName = mob.Name;
                bossHealth = mob.HPMax;
            }

            allEnemies[mob.Name] = mob;

        }
コード例 #24
0
        public void onMobAgro(ActorEntity mob)
        {

        }
コード例 #25
0
ファイル: Kaliya.cs プロジェクト: Yaguar666/FFXIVDBM.Plugin
 public void onMobAdded(ActorEntity mob)
 {
     if (mob.Name.Contains("Weapons"))
     {
         setPhase(3);
     }
 }
コード例 #26
0
ファイル: Phoenix.cs プロジェクト: Yaguar666/FFXIVDBM.Plugin
        public void onMobAdded(ActorEntity mob)
        {
            if (phase < 3 && mob.Name.Contains("Bennu"))
            {

                Bennu.start();

                //bennuCount++;

                //tts("Add " + bennuCount);
            }
        }
コード例 #27
0
ファイル: PCWorkerDelegate.cs プロジェクト: agoln/ffxivapp
 public static void EnsureNPCEntity(UInt32 key, ActorEntity entity)
 {
     NPCEntities.AddOrUpdate(key, entity, (k, v) => entity);
 }
コード例 #28
0
 public float GetCastingDistanceTo(ActorEntity compare)
 {
     var distance = GetHorizontalDistanceTo(compare) - compare.HitBoxRadius;
     return distance > 0 ? distance : 0;
 }
コード例 #29
0
 private string ResolveHeightVariance(ActorEntity user, ActorEntity actorEntity)
 {
     var modifier = "";
     if (user.Z < actorEntity.Z)
     {
         modifier = "+";
     }
     if (user.Z > actorEntity.Z)
     {
         modifier = "-";
     }
     return String.Format("{0}{1:N2}", modifier, Math.Abs(ResolveHeightVarianceDecimal(user, actorEntity)));
 }
コード例 #30
0
 public float GetHorizontalDistanceTo(ActorEntity compare)
 {
     var distanceX = (float) Math.Abs(X - compare.X);
     var distanceY = (float) Math.Abs(Y - compare.Y);
     return (float) Math.Sqrt((distanceX * distanceX) + (distanceY * distanceY));
 }
コード例 #31
0
 private decimal ResolveHeightVarianceDecimal(ActorEntity user, ActorEntity actorEntity)
 {
     double variance = 0;
     if (user.Z < actorEntity.Z)
     {
         variance = user.Z - actorEntity.Z;
     }
     if (user.Z > actorEntity.Z)
     {
         variance = actorEntity.Z - user.Z;
     }
     return (decimal) variance;
 }
コード例 #32
0
 public static ActorEntity ResolveActorFromBytes(byte[] source)
 {
     var entry = new ActorEntity();
     try
     {
         entry.MapIndex = 0;
         entry.TargetID = 0;
         entry.Name = MemoryHandler.Instance.GetStringFromBytes(source, 48);
         entry.ID = BitConverter.ToUInt32(source, 0x74);
         entry.NPCID1 = BitConverter.ToUInt32(source, 0x78);
         entry.NPCID2 = BitConverter.ToUInt32(source, 0x80);
         entry.OwnerID = BitConverter.ToUInt32(source, 0x84);
         entry.Type = (Actor.Type) source[0x8A];
         entry.TargetType = (Actor.TargetType) source[0x8C];
         entry.Distance = source[0x8D];
         entry.GatheringStatus = source[0x8E];
         entry.X = BitConverter.ToSingle(source, 0xA0);
         entry.Z = BitConverter.ToSingle(source, 0xA4);
         entry.Y = BitConverter.ToSingle(source, 0xA8);
         entry.Heading = BitConverter.ToSingle(source, 0xB0);
         entry.Fate = BitConverter.ToUInt32(source, 0xE4); // ??
         entry.GatheringInvisible = source[0x11C]; // ??
         entry.ModelID = BitConverter.ToUInt32(source, 0x184);
         entry.ActionStatus = (Actor.ActionStatus) source[0x18C];
         entry.IsGM = BitConverter.ToBoolean(source, 0x193); // ?
         entry.Icon = (Actor.Icon) source[0x19C];
         entry.Status = (Actor.Status) source[0x19E];
         entry.ClaimedByID = BitConverter.ToUInt32(source, 0x1A0);
         var targetID = BitConverter.ToUInt32(source, 0x1A8);
         var pcTargetID = BitConverter.ToUInt32(source, 0xAA8);
         entry.Job = (Actor.Job) source[0x17C0];
         entry.Level = source[0x17C1];
         entry.GrandCompany = source[0x17C3];
         entry.GrandCompanyRank = source[0x17C4];
         entry.Title = source[0x17C6];
         entry.HPCurrent = BitConverter.ToInt32(source, 0x17C8);
         entry.HPMax = BitConverter.ToInt32(source, 0x17CC);
         entry.MPCurrent = BitConverter.ToInt32(source, 0x17D0);
         entry.MPMax = BitConverter.ToInt32(source, 0x17D4);
         entry.TPCurrent = BitConverter.ToInt16(source, 0x17D8);
         entry.TPMax = 1000;
         entry.GPCurrent = BitConverter.ToInt16(source, 0x17DA);
         entry.GPMax = BitConverter.ToInt16(source, 0x17DC);
         entry.CPCurrent = BitConverter.ToInt16(source, 0x17DE);
         entry.CPMax = BitConverter.ToInt16(source, 0x17E0);
         entry.Race = source[0x2E58]; // ??
         entry.Sex = (Actor.Sex) source[0x2E59]; //?
         entry.IsCasting = BitConverter.ToBoolean(source, 0x32C0);
         entry.CastingID = BitConverter.ToInt16(source, 0x32C4);
         entry.CastingTargetID = BitConverter.ToUInt32(source, 0x32D0);
         entry.CastingProgress = BitConverter.ToSingle(source, 0x32F4);
         entry.CastingTime = BitConverter.ToSingle(source, 0x33D8);
         entry.Coordinate = new Coordinate(entry.X, entry.Z, entry.Y);
         if (targetID > 0)
         {
             entry.TargetID = (int) targetID;
         }
         else
         {
             if (pcTargetID > 0)
             {
                 entry.TargetID = (int) pcTargetID;
             }
         }
         if (entry.CastingTargetID == 3758096384)
         {
             entry.CastingTargetID = 0;
         }
         entry.MapIndex = 0;
         var limit = 60;
         switch (entry.Type)
         {
             case Actor.Type.PC:
                 limit = 30;
                 break;
         }
         entry.StatusEntries = new List<StatusEntry>();
         const int statusSize = 12;
         var statusesSource = new byte[limit * statusSize];
         Buffer.BlockCopy(source, 0x3148, statusesSource, 0, limit * 12);
         for (var i = 0; i < limit; i++)
         {
             var statusSource = new byte[statusSize];
             Buffer.BlockCopy(statusesSource, i * statusSize, statusSource, 0, statusSize);
             var statusEntry = new StatusEntry
             {
                 TargetName = entry.Name,
                 StatusID = BitConverter.ToInt16(statusSource, 0x0),
                 Duration = BitConverter.ToSingle(statusSource, 0x4),
                 CasterID = BitConverter.ToUInt32(statusSource, 0x8)
             };
             try
             {
                 var statusInfo = StatusEffectHelper.StatusInfo(statusEntry.StatusID);
                 statusEntry.IsCompanyAction = statusInfo.CompanyAction;
                 var statusKey = "";
                 switch (Settings.Default.GameLanguage)
                 {
                     case "English":
                         statusKey = statusInfo.Name.English;
                         break;
                     case "French":
                         statusKey = statusInfo.Name.French;
                         break;
                     case "German":
                         statusKey = statusInfo.Name.German;
                         break;
                     case "Japanese":
                         statusKey = statusInfo.Name.Japanese;
                         break;
                 }
                 statusEntry.StatusName = statusKey;
             }
             catch (Exception ex)
             {
                 statusEntry.StatusName = "UNKNOWN";
             }
             if (statusEntry.IsValid())
             {
                 entry.StatusEntries.Add(statusEntry);
             }
         }
     }
     catch (Exception ex)
     {
     }
     CleanXPValue(ref entry);
     return entry;
 }
コード例 #33
0
ファイル: Melusine.cs プロジェクト: Yaguar666/FFXIVDBM.Plugin
 public void onMobRemoved(ActorEntity mob)
 {
     if (mob.Name.Contains("Renaud"))
     {
         renaudCount--;
     }
 }