/// <summary> /// Switches the player to attack mode on the current unit /// </summary> public static void Engage(FFACE fface) { if (!fface.Player.Status.Equals(Status.Fighting)) { fface.Windower.SendString(Constants.AttackTarget); } }
/// <summary> /// Checks whether a spell or ability can be recasted. /// </summary> /// <param name="fface"></param> /// <param name="ability"></param> /// <returns></returns> public static bool IsRecastable(FFACE fface, Ability ability) { var recast = -1; /* * Fix: If the action is a ranged attack, * it will return something even when it's recastable. * * This if statement must be above process abilities since * AbilityType.Range is in AbilityType.IsAbility */ if (AbilityType.Range.HasFlag(ability.AbilityType)) { return true; } // If a spell get spell recast if (CompositeAbilityTypes.IsSpell.HasFlag(ability.AbilityType)) { recast = fface.Timer.GetSpellRecast(ToSpellList(ability)); } // if ability get ability recast. if (CompositeAbilityTypes.IsAbility.HasFlag(ability.AbilityType)) { recast = fface.Timer.GetAbilityRecast(ToAbilityList(ability)); } /* * Fixed bug: recast for weaponskills returns -1 not zero. * Check for <= to zero instead of strictly == zero. */ return recast <= 0; }
/// <summary> /// Stop the character from fight the target /// </summary> public static void Disengage(FFACE fface) { if (fface.Player.Status.Equals(Status.Fighting)) { fface.Windower.SendString(Constants.AttackOff); } }
public TravelComponent(FFACE fface) { _fface = fface; // Create unit object for parsing of npc array. _units = new UnitService(fface); }
public DebugSpellCasting(FFACE fface) { InitializeComponent(); this._fface = fface; this._XITools = XITools.GetInstance(fface); this.DataContext = new CastingViewModel(fface); }
public EndComponent(FFACE fface) : base(fface) { _fface = fface; _executor = new Executor(fface); _units = new UnitService(fface); }
public FormAdditionalSettings(FFACE session, RichTextBox debuglog) { InitializeComponent(); Session = session; DebugLog = debuglog; InitializeFormValues(); }
/// <summary> /// Makes the character stop resting /// </summary> public static void Stand(FFACE fface) { if (fface.Player.Status.Equals(Status.Healing)) { fface.Windower.SendString(Constants.RestingOff); Thread.Sleep(50); } }
public ChatLog(FFACE fface) { this._fface = fface; this._timer.Interval = 100; this._timer.Tick += ChatLog_Tick; this.ChatLines = new ObservableCollection<ChatLine>(); this._timer.Enabled = true; }
public UnitService(FFACE fface) { _fface = fface; // Create the UnitArray _units = Enumerable.Range(0, UnitArrayMax) .Select(x => new Unit(_fface, x)); }
/// <summary> /// A single point of access method that returns a FarmingTools object. /// The object returned will be based on the FFACE instance provided or /// if no object was previously created, it will create one for you. /// </summary> /// <param name="fface"></param> /// <returns></returns> public static FarmingTools GetInstance(FFACE fface) { if (_farmingTools == null || !_fface.Equals(fface)) { _farmingTools = new FarmingTools(fface); } return _farmingTools; }
public Caster(FFACE fface) { _fface = fface; if (_player == null) { _player = new MovingUnit(_fface, _fface.Player.ID); } }
/// <summary> /// Contructor to start navigation system /// </summary> /// <param name="player">Current player</param> public NavigatorTools(FFACE fface) { _FFACE = fface; _InstanceID = fface._InstanceID; _HeadingTolerance = 40; _DistanceTolerance = 3f; SpeedDelay = 40; GotoDelay = 40; }
public static void SetSession(FFACE fface) { if (fface == null) return; // Save FFACE Instance FFACE = fface; // Create a new game engine to control our character. App.GameEngine = new GameEngine(FFACE); }
public Unit(FFACE fface, int id) { // Set this unit's session data. _fface = fface; // Set the internal id. Id = id; // Set the NPC information. _npc = _fface.NPC; }
public GameEngine(FFACE fface) { this._fface = fface; this._zone = fface.Player.Zone; StateMachine = new FiniteStateEngine(fface); ZoneTimer.Tick += ZoneTimer_Tick; ZoneTimer.Enabled = true; ZoneTimer.Interval = 100; Worker.DoWork += Worker_DoWork; }
public DebugCreatures(FFACE fface, UnitService units) { InitializeComponent(); this._fface = fface; this._units = units; _timer.Tick += new EventHandler(Timer_Tick); _timer.Interval = new TimeSpan(0, 0, 0, 1); _timer.Start(); this.Show(); }
/// <summary> /// コンストラクタ /// </summary> public FFACEControl(PolTool iPOL, ChatTool iChat, LoggerTool iLogger) { this.pol = iPOL; this.fface = iPOL.FFACE; this.chat = iChat; this.logger = iLogger; this.MaxLoopCount = DEFAULT_MAX_LOOP_COUNT; this.UseEnternity = DEFAULT_USE_ENTERNITY; this.BaseWait = DEFAULT_BASE_WAIT; this.ChatWait = DEFAULT_CHAT_WAIT; }
public MovingUnit(FFACE fface, int id) : base(fface, id) { _mutex = new object(); _timer = new Timer { AutoReset = true, Interval = 30 }; _timer.Elapsed += TimerTick; _timer.Start(); }
public void BackgroundProcess() { do { Thread.Sleep(500); ffximain = (from ProcessModule m in pol.Modules where m.ModuleName.ToLower() == "ffximain.dll" select m).FirstOrDefault(); } while (ffximain == null); _FFACE = new FFACE(pol.Id); while (_FFACE.Player.Name == "") Thread.Sleep(500); _FFACE.Windower.SendString("/vanatunes hold on"); sCharName = _FFACE.Player.Name; profile = "(none)"; //TODO: Check player name and set default profile byte[] mobPtrTmp = new byte[4]; IntPtr mobPtrArraySize = new IntPtr(); ReadProcessMemory(pol.Handle, new IntPtr(ffximain.BaseAddress.ToInt32() + 0x8020c), mobPtrTmp, 4, ref mobPtrArraySize); IntPtr mobPtr = new IntPtr(BitConverter.ToInt32(mobPtrTmp, 0)); ReadProcessMemory(pol.Handle, mobPtr, mobFlags, 4096*4, ref mobPtrArraySize); m_Zone = _FFACE.Player.Zone; uVanaHour = _FFACE.Timer.GetVanaTime().Hour; m_Status = _FFACE.Player.Status; m_Buffs = _FFACE.Player.StatusEffects; if (_FFACE.Party.Party0Count == 1 && _FFACE.Party.Party1Count == 0 && _FFACE.Party.Party2Count == 0) bPartyMember = false; else bPartyMember = true; bFighting = false; bInBattlefield = false; do{ if (CheckConditions()) { UInt16 thisTrack = ExecScript(); if (thisTrack != currentTrack) { currentTrack = thisTrack; _FFACE.Windower.SendString("/vanatunes playOverride " + currentTrack); } } Thread.Sleep(500); } while(Program.runCharThreads); if(ffximain != null) _FFACE.Windower.SendString("/vanatunes hold off"); }
/// <summary> /// polにアタッチする /// </summary> /// <param name="id">polプロセスID</param> private void AttachPol(int id) { if (id > 0) { lockControl(true, true); _FFACE = new FFACE(id); Process pol = Process.GetProcessById(id); SetMessage(pol.MainWindowTitle + "(" + id + ")に接続しました"); lockControl(false, true); } }
public ChatTool(FFACE iFFACE) { fface = iFFACE; //過去のチャットをクリア FFACE.ChatTools.ChatLine cl = fface.Chat.GetNextLine(); while (cl != null) { cl = fface.Chat.GetNextLine(); } Start(); }
public GameEngine(FFACE fface) { _fface = fface; _zoneMonitor = new ZoneMonitor(fface); _deadMonitor = new DeadMonitor(fface); _stateMachine = new FiniteStateEngine(fface); _zoneMonitor.Changed += ZoneMonitorZoneChanged; _zoneMonitor.Start(); _deadMonitor.Changed += DeadMonitorStatusChanged; _deadMonitor.Start(); }
/// <summary> /// Attempts to target by tabbing and on failure will target by memory. /// </summary> /// <param name="fface"></param> /// <param name="unit"></param> /// <param name="attemptCount"></param> /// <returns></returns> public static bool TargetByTabAndMemory(FFACE fface, Unit unit, int attemptCount) { if (fface == null) throw new ArgumentNullException("fface"); if (unit == null) throw new ArgumentNullException("unit"); // Attempt to target by tabbing first. if (TargetByTab(fface, unit, attemptCount)) return true; // Attempt to target by setting target in memory. // Note: always succeeds since target.ID will be overriden. if (TargetByMemory(fface, unit)) return true; return fface.Target.ID == unit.Id; }
public AttackContainer(FFACE fface) { FFACE = fface; // Add components. AddComponent(new ApproachComponent(fface) {Priority = 0}); AddComponent(new BattleComponent(fface) {Priority = 3}); AddComponent(new WeaponSkillComponent(fface) {Priority = 2}); AddComponent(new PullComponent(fface) {Priority = 4}); AddComponent(new StartComponent(fface) {Priority = 5}); // Enable all attack components. Components.ForEach(x => x.Enabled = true); }
private FarmingTools(FFACE fface) { _fface = fface; this.AbilityExecutor = new AbilityExecutor(fface); this.AbilityService = new AbilityService(); this.CombatService = new CombatService(fface); this.RestingService = new RestingService(fface); this.UnitService = new UnitService(fface); this.PlayerData = new PlayerData(fface); this.TargetData = new TargetData(fface); this.PlayerActions = new PlayerActions(fface); this.ActionBlocked = new ActionBlocked(fface); this.UserSettings = new Config(); }
public ChatLine(FFACE.ChatTools.ChatLine line) { if (line == null) { IsEmptyOrNull = true; return; } this.Line = line; var argb = System.Windows.Media.Color.FromArgb(line.Color.A, line.Color.R, line.Color.G, line.Color.B); this.Color = new SolidColorBrush(argb); this.Text = line.Text; }
public CastingViewModel(FFACE fface) { this._fface = fface; this._castingModel = new CastingModel(fface); this.CastSpellCommand = new RelayCommand( (x) => { var success = _castingModel.CastSpell(); Success = success; }); timer.Tick += timer_Tick; timer.Interval = 50; timer.Enabled = true; }
// Constructor. public FiniteStateEngine(FFACE fface) { //Create the states AddComponent(new RestComponent(fface) {Priority = 2}); AddComponent(new AttackContainer(fface) {Priority = 1}); AddComponent(new TravelComponent(fface) {Priority = 1}); AddComponent(new HealingComponent(fface) {Priority = 2}); AddComponent(new EndComponent(fface) {Priority = 3}); Components.ForEach(x => x.Enabled = true); // Threaded timer to run the main loop on. _taskTimer = new TaskTimer(); _taskTimer.OnElapsed += Run; _taskTimer.Interval = 100; _taskTimer.AutoReset = true; }
/// <summary> /// Targets unit by our target in memory. /// !!! Note !!! /// once you override your target in memory it will be almost impossible /// to determine if you are targeting the wrong target. /// </summary> /// <param name="fface"></param> /// <param name="unit"></param> /// <returns></returns> public static bool TargetByMemory(FFACE fface, Unit unit) { if (fface == null) throw new ArgumentNullException("fface"); if (unit == null) throw new ArgumentNullException("unit"); // Set target in memory. fface.Target.SetNPCTarget(unit.Id); // Face the target. fface.Navigator.FaceHeading(unit.Id); // Place cursor upon target. fface.Windower.SendString("/ta <t>"); return fface.Target.ID == unit.Id; }
///Set Items in npc trade window ///<param name="sTinfo">NPCTRADEINFO structure</param> ///</summary> public bool SetNPCTradeInformation(NPCTRADEINFO sTinfo) { bool result = false; if (sTinfo.items == null) { result = FFACE.SetNPCTradeInfo(_InstanceID, 0, 0, 0, 0, 0, sTinfo.Gil); } else { for (int i = 0; i < sTinfo.items.Length; i++) { result = FFACE.SetNPCTradeInfo(_InstanceID, 0, sTinfo.items[i].ItemID, sTinfo.items[i].Index, sTinfo.items[i].Count, (byte)i, sTinfo.Gil); if (!result) { break; } } } return(result); } // @ public bool SetNPCTradeInformation
} // @ public bool SetNPCTradeInformation /// <summary> /// Set items in craft window /// </summary> /// <param name="sTinfo">NPCTRADEINFO structure</param> public bool SetCraftItems(NPCTRADEINFO sTinfo) { bool result = false; if (sTinfo.items == null) { return(false); } else { for (byte i = 0; i < sTinfo.items.Length; i++) { result = FFACE.SetCraftItem(_InstanceID, 0, sTinfo.items[i].ItemID, sTinfo.items[i].Index, sTinfo.items[i].Count, i); if (!result) { break; } } } return(result); } // @ public bool SetCraftItems
} // @ public void GotoXYZ(dPoint x, dPoint y, dPoint z, bool KeepRunning) /// <summary> /// Will move the player to the passed destination or stop within a specified time. /// </summary> /// <param name="x">Function returning X coordinate of the destination</param> /// <param name="y">Function returning Y coordinate of the destination</param> /// <param name="z">Function returning Z coordinate of the destination</param> /// <param name="KeepRunning">Whether to keep moving after reaching the destination</param> /// <param name="timeOut">Time out in milliseconds</param> public void Goto(dPoint x, dPoint y, dPoint z, bool KeepRunning, int timeOut) { float X = x(); float Y = y(); float Z = z(); // if passed values are all 0's we won't even bother. // because a target we're running to shouldn't be the player WHILE HE'S ZONING if (X == 0.0f && Y == 0.0f && Z == 0.0f) { return; } double Heading = 0.0f; // = HeadingTo(X, Y, Z, HeadingType.Degrees); double PlayerHeading = 0.0f; // = GetPlayerPosHInDegrees(); double Herror = 0.0f; // = HeadingError(PlayerHeading, Heading); DateTime Start = DateTime.Now; // while we're not within our distance tolerance // and // either timeOut is <= 0 (unlimited) or timeOut > 0 and Time since Goto called < timeOut while ((DistanceTo(X, Y, Z) > DistanceTolerance) && ((timeOut <= 0) || ((timeOut > 0) && ((DateTime.Now - Start).TotalMilliseconds) < timeOut))) { // Update X, Y, and Z values X = x(); Y = y(); Z = z(); // if ANY of the values are NOT zero, then we aren't zoning, do something if (X != 0.0f || Y != 0.0f || Z != 0.0f) { if (UseNewMovement) { FFACE.StartRunning(_InstanceID, X, Z); } else { // Force ViewMode to first person otherwise this doesn't make sense SetViewMode(ViewMode.FirstPerson); // Check Heading Error Heading = HeadingTo(X, Y, Z, HeadingType.Degrees); PlayerHeading = GetPlayerPosHInDegrees(); Herror = HeadingError(PlayerHeading, Heading); // if we're out of our heading tolerance if (Math.Abs(Herror) > HeadingTolerance) { // Face proper direction FaceHeading(X, Y, Z); } else if (UseArrowKeysForTurning && (Herror < -(HeadingTolerance / 2.0f))) { _FFACE.Windower.SendKeyPress(KeyCode.NP_Number4); } else if (UseArrowKeysForTurning && (Herror > (HeadingTolerance / 2.0f))) { _FFACE.Windower.SendKeyPress(KeyCode.NP_Number6); } // Moved StartRunning to AFTER the Distance check // to avoid tap-tap-tapping when we're already within distance if (!IsRunning()) { StartRunning(); } } } // Sleep(GotoDelay) milliseconds before next loop System.Threading.Thread.Sleep(GotoDelay); } // @ while (DistanceToPosXZ(X, Z) > DistanceTolerance) if (!KeepRunning) { StopRunning(); } } // @ public void GotoXYZ(dPoint x, dPoint y, dPoint z, bool KeepRunning, int timeOut)
/// <summary> /// Constructor /// </summary> /// <param name="instanceID">Instance ID generated by FFACE</param> public MenuTools (FFACE fface) { _FFACE = fface; _InstanceID = fface._InstanceID; } // @ public MenuTools(int instanceID)
public bool SetTradeGil (uint Gil) { return FFACE.SetNPCTradeInfo(_InstanceID, 0, 0, 0, 0, 0, Gil); }
} // @ public FishID ID #endregion #region Methods /// <summary> /// Return value of FightFish success. /// </summary> public bool FightFish() { return(FFACE.FightFish(_InstanceID)); } // @ public bool Fight