Exemplo n.º 1
0
        public static Combatant GetPlayerData()
        {
            Combatant player = new Combatant();

            var scanCombatants = GetScanCombatants();
            if (scanCombatants == null) return null;

            var item = scanCombatants.GetType().InvokeMember("GetPlayerData", BindingFlags.Public | BindingFlags.Instance | BindingFlags.InvokeMethod, null, scanCombatants, null);
            FieldInfo fi = item.GetType().GetField("JobID", BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetField);
            player.Job = (int)fi.GetValue(item);

            return player;
        }
Exemplo n.º 2
0
        public static List<Combatant> GetCombatantList()
        {
            List<Combatant> result = new List<Combatant>();
            try
            {
                var scanCombatants = GetScanCombatants();
                if (scanCombatants == null) return null;

                var item = scanCombatants.GetType().InvokeMember("GetCombatantList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.InvokeMethod, null, scanCombatants, null);
                FieldInfo fi = item.GetType().GetField("_items", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField);

                Type[] nestedType = item.GetType().GetNestedTypes(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public);
                object tmp = fi.GetValue(item);
                if (tmp.GetType().IsArray)
                {
                    foreach (object temp in (Array)tmp)
                    {
                        if (temp == null) break;

                        Combatant combatant = new Combatant();

                        fi = temp.GetType().GetField("ID", BindingFlags.Public | BindingFlags.Instance);
                        combatant.ID = (uint)fi.GetValue(temp);
                        fi = temp.GetType().GetField("OwnerID", BindingFlags.Public | BindingFlags.Instance);
                        combatant.OwnerID = (uint)fi.GetValue(temp);
                        fi = temp.GetType().GetField("Order", BindingFlags.Public | BindingFlags.Instance);
                        combatant.Order = (int)fi.GetValue(temp);
                        fi = temp.GetType().GetField("type", BindingFlags.Public | BindingFlags.Instance);
                        combatant.type = (byte)fi.GetValue(temp);
                        fi = temp.GetType().GetField("Level", BindingFlags.Public | BindingFlags.Instance);
                        combatant.Level = (int)fi.GetValue(temp);
                        fi = temp.GetType().GetField("Job", BindingFlags.Public | BindingFlags.Instance);
                        combatant.Job = (int)fi.GetValue(temp);
                        fi = temp.GetType().GetField("Name", BindingFlags.Public | BindingFlags.Instance);
                        combatant.Name = (string)fi.GetValue(temp);
                        fi = temp.GetType().GetField("CurrentHP", BindingFlags.Public | BindingFlags.Instance);
                        combatant.CurrentHP = (int)fi.GetValue(temp);
                        fi = temp.GetType().GetField("MaxHP", BindingFlags.Public | BindingFlags.Instance);
                        combatant.MaxHP = (int)fi.GetValue(temp);
                        fi = temp.GetType().GetField("CurrentMP", BindingFlags.Public | BindingFlags.Instance);
                        combatant.CurrentMP = (int)fi.GetValue(temp);
                        fi = temp.GetType().GetField("MaxMP", BindingFlags.Public | BindingFlags.Instance);
                        combatant.MaxMP = (int)fi.GetValue(temp);
                        fi = temp.GetType().GetField("CurrentTP", BindingFlags.Public | BindingFlags.Instance);
                        combatant.CurrentTP = (int)fi.GetValue(temp);

                        result.Add(combatant);
                    }
                }
            }
            catch { }
            return result;
        }