public static Combatant GetPlayerData() { Combatant player = new Combatant(); try { 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); } catch { } return player; }
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("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("CurrentTP", BindingFlags.Public | BindingFlags.Instance); combatant.CurrentTP = (int)fi.GetValue(temp); result.Add(combatant); } } } catch { } return result; }