Пример #1
0
        /// <summary>
        /// 敵視リスト情報を取得
        /// </summary>
        public unsafe List<AggroEntry> GetAggroList()
        {
            int num = 0;
            List<AggroEntry> result = new List<AggroEntry>();
            List<Combatant> combatantList = Combatants;

            /// 一度に全部読む
            byte[] buffer = GetByteArray(aggroAddress, 32 * 72 + 2);

            fixed (byte* p = buffer) num = (short)p[0x900];
            if (num <= 0)
            {
                return result;
            }
            if (num > 32) num = 32;

            ///
            for (int i = 0; i < num; i++)
            {
                int p = i * 72;
                uint _id;
                short _enmity;

                fixed (byte* bp = buffer)
                {
                        _id = *(uint*)&bp[p+64];
                        _enmity = (short)bp[p + 68];
                }

                var entry = new AggroEntry()
                {
                    ID = _id,
                    HateRate = _enmity,
                    Name = "Unknown",
                };
                if (entry.ID > 0)
                {
                    Combatant c = combatantList.Find(x => x.ID == entry.ID);
                    if (c != null)
                    {
                        entry.Name = c.Name;
                        entry.MaxHP = c.MaxHP;
                        entry.CurrentHP = c.CurrentHP;
                    }
                    result.Add(entry);
                }
            }
            return result;
        }
Пример #2
0
        /// <summary>
        /// 敵視リスト情報を取得
        /// </summary>
        public unsafe List <AggroEntry> GetAggroList()
        {
            int  num                        = 0;
            uint currentTargetID            = 0;
            List <AggroEntry> result        = new List <AggroEntry>();
            List <Combatant>  combatantList = Combatants;
            Combatant         mychar        = GetSelfCombatant();

            // 一度に全部読む
            byte[] buffer = GetByteArray(aggroAddress, 32 * 72 + 2);

            fixed(byte *p = buffer) num = (short)p[2296];

            if (num <= 0)
            {
                return(result);
            }
            if (num > 31)
            {
                num = 31;           // max changed??? 32->31
            }
            // current target
            //currentTargetID = GetUInt32(aggroAddress, -4);
            //if (currentTargetID == 3758096384u) currentTargetID = 0;
            var targetCombatant = GetTargetCombatant();

            if (targetCombatant != null)
            {
                currentTargetID = targetCombatant.ID;
            }
            else
            {
                currentTargetID = 0;
            }
            //
            for (int i = 0; i < num; i++)
            {
                int   p = i * 72;
                uint  _id;
                short _enmity;

                fixed(byte *bp = buffer)
                {
                    _id     = *(uint *)&bp[p + 56];
                    _enmity = (short)bp[p + 60];
                }

                var entry = new AggroEntry()
                {
                    ID       = _id,
                    HateRate = _enmity,
                    Name     = "Unknown",
                };
                if (entry.ID <= 0)
                {
                    continue;
                }
                Combatant c = combatantList.Find(x => x.ID == entry.ID);
                if (c != null)
                {
                    entry.ID              = c.ID;
                    entry.Order           = c.Order;
                    entry.isCurrentTarget = (c.ID == currentTargetID);
                    entry.Name            = c.Name;
                    entry.MaxHP           = c.MaxHP;
                    entry.CurrentHP       = c.CurrentHP;
                    entry.Statuses        = c.Statuses;
                    if (c.TargetID > 0)
                    {
                        Combatant t = combatantList.Find(x => x.ID == c.TargetID);
                        if (t != null)
                        {
                            entry.Target = new EnmityEntry()
                            {
                                ID       = t.ID,
                                Name     = t.Name,
                                Job      = t.Job,
                                OwnerID  = t.OwnerID,
                                isMe     = mychar.ID == t.ID ? true : false,
                                Enmity   = 0,
                                HateRate = 0
                            };
                        }
                    }
                }
                result.Add(entry);
            }
            return(result);
        }
Пример #3
0
        /// <summary>
        /// 敵視リスト情報を取得
        /// </summary>
        public unsafe List<AggroEntry> GetAggroList()
        {
            int num = 0;
            uint currentTargetID = 0;
            List<AggroEntry> result = new List<AggroEntry>();
            List<Combatant> combatantList = Combatants;
            Combatant mychar = GetSelfCombatant();

            // 一度に全部読む
            byte[] buffer = GetByteArray(aggroAddress, 32 * 72 + 2);

            fixed (byte* p = buffer) num = (short)p[0x900];
            if (num <= 0)
            {
                return result;
            }
            if (num > 32) num = 32;

            // current target
            currentTargetID = GetUInt32(aggroAddress, -4);
            if (currentTargetID == 3758096384u) currentTargetID = 0;
            //
            for (int i = 0; i < num; i++)
            {
                int p = i * 72;
                uint _id;
                short _enmity;

                fixed (byte* bp = buffer)
                {
                        _id = *(uint*)&bp[p + 64];
                        _enmity = (short)bp[p + 68];
                }

                var entry = new AggroEntry()
                {
                    ID = _id,
                    HateRate = _enmity,
                    Name = "Unknown",
                };
                if (entry.ID <= 0) continue;
                Combatant c = combatantList.Find(x => x.ID == entry.ID);
                if (c != null)
                {
                    entry.ID = c.ID;
                    entry.Order = c.Order;
                    entry.isCurrentTarget = (c.ID == currentTargetID);
                    entry.Name = c.Name;
                    entry.MaxHP = c.MaxHP;
                    entry.CurrentHP = c.CurrentHP;
                    if (c.TargetID > 0)
                    {
                        Combatant t = combatantList.Find(x => x.ID == c.TargetID);
                        if (t != null)
                        {
                            entry.Target = new EnmityEntry()
                            {
                                ID = t.ID,
                                Name = t.Name,
                                Job = t.Job,
                                OwnerID = t.OwnerID,
                                isMe = mychar.ID == t.ID ? true : false,
                                Enmity = 0,
                                HateRate = 0
                            };
                        }
                    }

                }
                result.Add(entry);
            }
            return result;
        }