예제 #1
0
		private void RecallTimeout_Tick(object sender, EventArgs e)
		{
			try
			{
				mRecallTimeout.Stop();
				mRecallingToBindstone = RecallStep.NotRecalling;
				mRecallingToLSBind = RecallStep.NotRecalling;
				mRecallingToLSTie = RecallStep.NotRecalling;
				mRecallingToPrimaryPortal = RecallStep.NotRecalling;
				mRecallingToSecondaryPortal = RecallStep.NotRecalling;

				mIdPrimaryTie = IdStep.Idle;
				mIdSecondaryTie = IdStep.Idle;
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
예제 #2
0
		protected override void Startup()
		{
			try
			{
				Util.Initialize("GoArrow", Host, Core, base.Path);
				System.Threading.Thread.CurrentThread.CurrentCulture
					= new System.Globalization.CultureInfo("en-US", false);

				mSettingsLoaded = false;
				mLoggedIn = false;
				mLoginCompleted = false;

				FileInfo locationsFile = new FileInfo(Util.FullPath("locations.xml"));
				if (locationsFile.Exists)
				{
					mLocDb = new LocationDatabase(locationsFile.FullName);
				}
				else
				{
					// Load from resource
					XmlDocument locDoc = new XmlDocument();
					locDoc.LoadXml(RouteFinding.Data.LocationsDatabase);
					mLocDb = new LocationDatabase(locDoc);
				}

				mLastSpellId = 0;
				mLastSpellTarget = 0;
				mRecallingToLSBind = RecallStep.NotRecalling;
				mRecallingToLSTie = RecallStep.NotRecalling;
				mRecallingToBindstone = RecallStep.NotRecalling;

				mHudManager = new HudManager(Host, Core, DefaultView, delegate() { return mDefaultViewActive; }, false);
				mHudManager.ExceptionHandler += new EventHandler<ExceptionEventArgs>(HudManager_ExceptionHandler);
				GraphicsReset += new EventHandler(mHudManager.GraphicsReset);
				WindowMessage += new EventHandler<WindowMessageEventArgs>(mHudManager.DispatchWindowMessage);
				RegionChange3D += new EventHandler<RegionChange3DEventArgs>(mHudManager.DispatchRegionChange3D);

				mDungeonHud = new DungeonHud(mHudManager);

				mMapHud = new MapHud(mHudManager, this, mLocDb);

				mArrowHud = new ArrowHud(mHudManager);
				mArrowHud.AsyncLoadComplete += new RunWorkerCompletedEventHandler(ArrowHud_AsyncLoadComplete);
				mArrowHud.DestinationChanged += new EventHandler<DestinationChangedEventArgs>(mMapHud.ArrowHud_DestinationChanged);

				mToolbar = new ToolbarHud(mHudManager);
				mMainViewToolButton = mToolbar.AddButton(new ToolbarButton(Icons.Toolbar.Settings, "Settings"));
				mArrowToolButton = mToolbar.AddButton(new ToolbarButton(Icons.Toolbar.GoArrow, "Arrow"));
				mDerethToolButton = mToolbar.AddButton(new ToolbarButton(Icons.Toolbar.Dereth, "Dereth"));
				mDungeonToolButton = mToolbar.AddButton(new ToolbarButton(Icons.Toolbar.Dungeon, "Dungeon"));
				mMainViewToolButton.Click += new EventHandler(MainViewToolButton_Click);
				mArrowToolButton.Click += new EventHandler(ArrowToolButton_Click);
				mDerethToolButton.Click += new EventHandler(DerethToolButton_Click);
				mDungeonToolButton.Click += new EventHandler(DungeonToolButton_Click);

				mStartLocations = new SortedDictionary<string, RouteStart>(StringComparer.OrdinalIgnoreCase);

				// Load portal devices
				// Try to load from file. If that fails, load from resource
				XmlDocument portalDevicesDoc = new XmlDocument();
				string portalDevicesPath = Util.FullPath("PortalDevices.xml");
				if (File.Exists(portalDevicesPath))
				{
					portalDevicesDoc.Load(portalDevicesPath);
				}
				else
				{
					portalDevicesDoc.LoadXml(RouteFinding.Data.PortalDevices);
				}

				mPortalDevices = new SortedDictionary<string, PortalDevice>(StringComparer.OrdinalIgnoreCase);
				foreach (XmlElement portalDeviceEle in portalDevicesDoc.DocumentElement.GetElementsByTagName("device"))
				{
					PortalDevice device;
					if (PortalDevice.TryLoadXmlDefinition(portalDeviceEle, out device))
					{
						mPortalDevices[device.Name] = device;
					}
				}

				InitMainViewBeforeSettings();

				mRecallTimeout = new WindowsTimer();
				mRecallTimeout.Tick += new EventHandler(RecallTimeout_Tick);

				mLoginTime = DateTime.Now;

#if USING_D3D_CONTAINER
				RouteStart.Initialize(110011, "Digero", 220022, "DaBug", "DebugAccount");
				LoadSettings();
				InitMainViewAfterSettings();

				mHudManager.StartHeartbeat();
#endif
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
예제 #3
0
		private void CharacterFilter_ChangePortalMode(object sender, ChangePortalModeEventArgs e)
		{
			try
			{
				if (mLoggedIn && chkAutoUpdateRecalls.Checked)
				{
					if (e.Type == PortalEventType.EnterPortal)
					{
						if (mRecallingToBindstone == RecallStep.RecallStarted)
							mRecallingToBindstone = RecallStep.EnteredPortal;

						if (mRecallingToLSBind == RecallStep.RecallStarted)
							mRecallingToLSBind = RecallStep.EnteredPortal;

						if (mRecallingToLSTie == RecallStep.RecallStarted)
							mRecallingToLSTie = RecallStep.EnteredPortal;

						if (mRecallingToPrimaryPortal == RecallStep.RecallStarted)
							mRecallingToPrimaryPortal = RecallStep.EnteredPortal;

						if (mRecallingToSecondaryPortal == RecallStep.RecallStarted)
							mRecallingToSecondaryPortal = RecallStep.EnteredPortal;
					}
					else if (e.Type == PortalEventType.ExitPortal)
					{
						RouteStartType type = RouteStartType.Regular;

						if (mRecallingToPrimaryPortal == RecallStep.EnteredPortal)
						{
							type = RouteStartType.PrimaryPortalTie;
						}
						else if (mRecallingToSecondaryPortal == RecallStep.EnteredPortal)
						{
							type = RouteStartType.SecondaryPortalTie;
						}

						if (type != RouteStartType.Regular && !mDungeonHud.IsDungeon(Host.Actions.Landcell))
						{
							RouteStart startLoc = GetStartLocationByType(type);
							Coordinates coords = Coordinates.Round(PlayerCoords, 1);
							if (startLoc.Coords != coords)
							{
								startLoc.Coords = coords;
								RefreshStartLocationListCoords();
								if (startLoc.Enabled)
									Util.Message(startLoc.Name + " start location set to " + startLoc.Coords);
							}
						}

						mRecallingToPrimaryPortal = RecallStep.NotRecalling;
						mRecallingToSecondaryPortal = RecallStep.NotRecalling;
					}
				}
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
예제 #4
0
		private void RecallChatTextHandler(object sender, ChatTextInterceptEventArgs e)
		{
			try
			{
				if (chkAutoUpdateRecalls.Checked)
				{
					string text = e.Text.Trim();

					// Spell Casting
					if (e.Color == 7)
					{
						if (text == "You successfully link with the portal!" || text == "You successfully link with the lifestone!")
						{
							WorldObject spellTarget = Core.WorldFilter[mLastSpellTarget];
							if (spellTarget != null)
							{
								if (mLastSpellId == Spells.PrimaryPortalTie)
								{
									if (spellTarget.HasIdData)
									{
										ProcessPortalTie(spellTarget, RouteStartType.PrimaryPortalTie);
									}
									else
									{
										Host.Actions.RequestId(mLastSpellTarget);
										mIdPrimaryTie = IdStep.Requested;
										if (mRecallTimeout.Enabled)
											RecallTimeout_Tick(null, null);
										mRecallTimeout.Interval = 10000; // 10 seconds
										mRecallTimeout.Start();
									}
								}
								else if (mLastSpellId == Spells.SecondaryPortalTie)
								{
									if (spellTarget.HasIdData)
									{
										ProcessPortalTie(spellTarget, RouteStartType.SecondaryPortalTie);
									}
									else
									{
										Host.Actions.RequestId(mLastSpellTarget);
										mIdSecondaryTie = IdStep.Requested;
										if (mRecallTimeout.Enabled)
											RecallTimeout_Tick(null, null);
										mRecallTimeout.Interval = 10000; // 10 seconds
										mRecallTimeout.Start();
									}
								}
								else if (mLastSpellId == Spells.LifestoneTie)
								{
									UpdateStartLocation(spellTarget, RouteStartType.LifestoneTie);
								}
							}
						}
						else if (e.Text.StartsWith("You have attuned your spirit to this Lifestone."))
						{
							WorldObject lifestone = Core.WorldFilter[Host.Actions.CurrentSelection];
							Coordinates coords;
							RouteStart startLoc = GetStartLocationByType(RouteStartType.LifestoneBind);
							if (lifestone == null || lifestone.ObjectClass != ObjectClass.Lifestone)
							{
								coords = PlayerCoords;
							}
							else
							{
								coords = new Coordinates(lifestone.Coordinates(), 1);
							}
							if (startLoc.Coords != coords)
							{
								startLoc.Coords = coords;
								RefreshStartLocationListCoords();
								if (startLoc.Enabled)
									Util.Message(startLoc.Name + " start location set to " + startLoc.Coords);
							}
						}
					}

					// Recall Text
					else if (e.Color == 23)
					{
						string name = Core.CharacterFilter.Name;
						if (text == name + " is going to the Allegiance hometown.")
						{
							mRecallingToBindstone = RecallStep.RecallStarted;
							if (mRecallTimeout.Enabled)
								RecallTimeout_Tick(null, null);
							mRecallTimeout.Interval = 40000; // 40 seconds
							mRecallTimeout.Start();
						}
						else if (text == name + " is recalling to the lifestone.")
						{
							mRecallingToLSBind = RecallStep.RecallStarted;
							if (mRecallTimeout.Enabled)
								RecallTimeout_Tick(null, null);
							mRecallTimeout.Interval = 40000; // 40 seconds
							mRecallTimeout.Start();
						}
					}
				}
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
예제 #5
0
		private void RecallChatCommandHandler(object sender, ChatParserInterceptEventArgs e)
		{
			try
			{
				if (chkAutoUpdateRecalls.Checked)
				{
					string text = e.Text.ToLower().TrimEnd();
					if (text == "/allegiance hometown")
					{
						mRecallingToBindstone = RecallStep.RecallStarted;
						if (mRecallTimeout.Enabled)
							RecallTimeout_Tick(null, null);
						mRecallTimeout.Interval = 40000; // 40 seconds
						mRecallTimeout.Start();
					}
					else if (text == "/lifestone")
					{
						mRecallingToLSBind = RecallStep.RecallStarted;
						if (mRecallTimeout.Enabled)
							RecallTimeout_Tick(null, null);
						mRecallTimeout.Interval = 40000; // 40 seconds
						mRecallTimeout.Start();
					}
				}
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
예제 #6
0
		private void CharacterFilter_Death(object sender, DeathEventArgs e)
		{
			try
			{
				if (chkAutoUpdateRecalls.Checked)
				{
					mRecallingToLSBind = RecallStep.RecallStarted;
					if (mRecallTimeout.Enabled)
						RecallTimeout_Tick(null, null);
					mRecallTimeout.Interval = 30000; // 30 seconds
					mRecallTimeout.Start();
				}

				if (chkTrackCorpses.Checked)
				{
					string name = "Corpse of " + Core.CharacterFilter.Name + " [" + DateTime.Now.ToShortTimeString() + "]";
					string descr = "Corpse of " + Core.CharacterFilter.Name + "\n" + DateTime.Now.ToShortDateString() + " "
							+ DateTime.Now.ToShortTimeString() + "\n" + e.Text;

					string dungeonName = mDungeonHud.GetDungeonNameByLandblock(Host.Actions.Landcell);
					if (dungeonName != "")
					{
						name += " in " + dungeonName;
						descr += "\nIn Dungeon: " + dungeonName;
					}

					Location corpse = new Location(Location.GetNextInternalId(), name, LocationType.Custom, PlayerCoords, descr);
					corpse.Icon = AcIcons.Corpse;
					mArrowHud.DestinationLocation = corpse;
				}
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}
예제 #7
0
		private void CharacterFilter_SpellCast(object sender, SpellCastEventArgs e)
		{
			try
			{
				mLastSpellId = e.SpellId;
				mLastSpellTarget = e.TargetId;
				if (e.SpellId == Spells.PrimaryPortalRecall)
				{
					mRecallingToPrimaryPortal = RecallStep.RecallStarted;
					if (mRecallTimeout.Enabled)
						RecallTimeout_Tick(null, null);
					mRecallTimeout.Interval = 30000; // 30 seconds
					mRecallTimeout.Start();
				}
				else if (e.SpellId == Spells.SecondaryPortalRecall)
				{
					mRecallingToSecondaryPortal = RecallStep.RecallStarted;
					if (mRecallTimeout.Enabled)
						RecallTimeout_Tick(null, null);
					mRecallTimeout.Interval = 30000; // 30 seconds
					mRecallTimeout.Start();
				}
				else if (e.SpellId == Spells.LifestoneRecall)
				{
					mRecallingToLSTie = RecallStep.RecallStarted;
					if (mRecallTimeout.Enabled)
						RecallTimeout_Tick(null, null);
					mRecallTimeout.Interval = 30000; // 30 seconds
					mRecallTimeout.Start();
				}
			}
			catch (Exception ex) { Util.HandleException(ex); }
		}