public void Start() { _sequenceManager = SequenceManager.Instance; bool shouldStayActive = SequenceRanges.Any(s => _sequenceManager.EvaluateRange(s)); if(! shouldStayActive) gameObject.SetActive(false); }
public void CreateNormalSequence() { var sequenceManager = new SequenceManager(Session.Transaction); var sequenceName = ObjectName.Parse("APP.test_sequence"); var seqInfo = new SequenceInfo(sequenceName, new SqlNumber(0), new SqlNumber(1), new SqlNumber(0), new SqlNumber(Int64.MaxValue), 126); ISequence sequence =null; Assert.DoesNotThrow(() => sequence = sequenceManager.CreateSequence(seqInfo)); Assert.IsNotNull(sequence); }
public void CreateNativeSequence() { var sequenceManager = new SequenceManager(Session.Transaction); var tableName = ObjectName.Parse("APP.test_table"); var seqInfo = SequenceInfo.Native(tableName); ISequence sequence = null; Assert.DoesNotThrow(() => sequence = sequenceManager.CreateSequence(seqInfo)); Assert.IsNotNull(sequence); }
public void IncremementSequenceValue() { var sequenceManager = new SequenceManager(Session.Transaction); ISequence sequence = null; Assert.DoesNotThrow(() => sequence = sequenceManager.GetSequence(testSequenceName)); Assert.IsNotNull(sequence); SqlNumber currentValue = SqlNumber.Null; Assert.DoesNotThrow(() => currentValue = sequence.NextValue()); Assert.IsNotNull(currentValue); Assert.AreEqual(new SqlNumber(1), currentValue); }
void populateReferences() { GameObject foundObject; foundObject = GameObject.Find( "MainCamera" ); if( foundObject != null ) m_MainCamera = foundObject.GetComponent<Camera>(); foundObject = GameObject.Find( "MainLoop" ); if( foundObject != null ) m_MainLoop = foundObject.GetComponent<MainLoop>(); foundObject = GameObject.Find( "TitleScreen" ); if( foundObject != null ) m_EntryScreen = foundObject.GetComponent<EntryScreen>(); foundObject = GameObject.Find( "Environment" ); if( foundObject != null ) m_Environment = foundObject.GetComponent<EnvironmentManager>(); foundObject = GameObject.Find( "Obstacles" ); if( foundObject != null ) m_Obstacles = foundObject.GetComponent<ObstacleManager>(); foundObject = GameObject.Find( "Sequencer" ); if( foundObject != null ) m_Sequencer = foundObject.GetComponent<SequenceManager>(); foundObject = GameObject.Find( "Prototype" ); if( foundObject != null ) m_Prototype = foundObject.GetComponent<PrototypeConfiguration>(); foundObject = GameObject.Find( "Player" ); if( foundObject != null ) m_Player = foundObject.GetComponent<Player>(); foundObject = GameObject.FindWithTag( "SoundController" ); if( foundObject != null ) { m_SoundController = foundObject.GetComponent<EPSoundController>(); m_MusicPlayer = foundObject.GetComponent<EPMusicPlayer>(); } }
protected WorldObject(ObjectType type, ObjectGuid guid) { Type = type; Guid = guid; GameData = new GameData(); ModelData = new ModelData(); Sequences = new SequenceManager(); Sequences.AddOrSetSequence(SequenceType.ObjectPosition, new UShortSequence()); Sequences.AddOrSetSequence(SequenceType.ObjectMovement, new UShortSequence()); Sequences.AddOrSetSequence(SequenceType.ObjectState, new UShortSequence()); Sequences.AddOrSetSequence(SequenceType.ObjectVector, new UShortSequence()); Sequences.AddOrSetSequence(SequenceType.ObjectTeleport, new UShortSequence()); Sequences.AddOrSetSequence(SequenceType.ObjectServerControl, new UShortSequence()); Sequences.AddOrSetSequence(SequenceType.ObjectForcePosition, new UShortSequence()); Sequences.AddOrSetSequence(SequenceType.ObjectVisualDesc, new UShortSequence()); Sequences.AddOrSetSequence(SequenceType.ObjectInstance, new UShortSequence()); Sequences.AddOrSetSequence(SequenceType.Motion, new UShortSequence(1)); PhysicsData = new PhysicsData(Sequences); }
/// <summary> /// Update()後にフレームごとに一度呼び出されます /// </summary> void LateUpdate() { // TaskDataの整理 if (Telegram_HaveDestroyTask) { int[] keycoll = new int[m_TaskDataList.Keys.Count]; m_TaskDataList.Keys.CopyTo(keycoll, 0); foreach (int key in keycoll) { if (m_TaskDataList[key].IsDestroyOK) { m_TaskDataList[key].ReqDestroy(); m_TaskDataList.Remove(key); } } Telegram_HaveDestroyTask = false; } // SQMの更新 SequenceManager.ManualUpdate(); }
public bool overideOnIntersectionExit; //Using when resetting route manually // Start is called before the first frame update private void Awake() { // Initialise GameObjects and components player = GameObject.FindGameObjectWithTag("Player"); playerController = player.GetComponent <PlayerController>(); intersectionManager = GetComponent <IntersectionManager>(); routeManager = GetComponent <RouteManager>(); sequenceManager = GetComponent <SequenceManager>(); uiManager = GetComponent <UIManager>(); checkpointManager = GetComponent <CheckpointManager>(); saveSessionData = GetComponent <SaveSessionData>(); overideOnIntersectionExit = false; sessionData = GlobalControl.instance.sessionData; // Import data session from GlobalControl Debug.Log("GAME MANAGER (pause): " + sessionData.sessionPaused); SetPaths(); // Set paths for importing and exporting data InitialiseSession(); // Initialise variables for session start //Debug.Log("(gamemanager) Distance: " + sessionDistance); }
protected bool OnDragDropTable(int TransferX, int TransferY) { bool IsOK = true; if (GridHelper.IsOnGrid(TransferX, TransferY) == false) { IsOK = false; // Grid外 } if (GridHelper.IsPlyDragEntryOK(TransferX, TransferY) == false) { IsOK = false; } // 許可できない位置 if (IsOK == false) { SequenceManager.SendMessage(MessageType.TablePeaceDDCancel, Index); return(false); } // Data更新 X = TransferX; Y = TransferY; State = MagiPeaceState.Peace; // Peaceを配置 Ready_Peace(); // UI切替要求 UIData.VisiblePeaceState(TableNo); // SQMへ完了通知 SequenceManager.SendMessage(MessageType.TablePeaceDDEnd, Index); return(true); }
public override void Initialize() { this.LogService = new LogService(); this.DataMaintainer = new DataMaintainer.DataMaintainer(); this.EngineController = new EngineHandle(); this.SequenceManager = new SequenceManager.SequenceManager(); this.ComInterfaceManager = new InterfaceManager(); ModuleConfigData configData = new ModuleConfigData(); configData.InitExtendProperties(); LogService.ApplyConfig(configData); ComInterfaceManager.ApplyConfig(configData); SequenceManager.ApplyConfig(configData); DataMaintainer.ApplyConfig(configData); EngineController.ApplyConfig(configData); LogService.RuntimeInitialize(); ComInterfaceManager.DesigntimeInitialize(); SequenceManager.DesigntimeInitialize(); DataMaintainer.RuntimeInitialize(); EngineController.RuntimeInitialize(); }
/// <summary> /// 伏せ終わった通知 /// </summary> void OnTurnDownEnd() { State = PanelState.Close; SequenceManager.SendMessage(MessageType.PanelCloseEnd, Index); }
/// <summary> /// 最初のフレームのアップデート前 /// </summary> void Start() { // SQM初期化 SequenceManager.Initialize(); if (SequenceManager.NowSQID.Value == SQID.新規開始) { m_TaskDataList = new Dictionary <int, TaskData>(); m_NewTID = 0; int index; // 初期化処理 // !!hoge:Test!! for (var y = 0; y < 4; y++) { for (var x = 0; x < 4; x++) { index = GetNewTID(); m_TaskDataList.Add(index, new GridData(index, x, y)); } } for (var y = 0; y < 4; y++) { for (var x = 0; x < 4; x++) { index = GetNewTID(); m_TaskDataList.Add(index, new PanelData(index, x, y, (x == 0 && y == 0) ? PanelState.Open : PanelState.Close));//Plyの初期位置だけ空ける } } index = GetNewTID(); m_TaskDataList.Add(index, new NanatoData(index, 0, 0)); index = GetNewTID(); m_TaskDataList.Add(index, new MagiPeaceData(index, 0, 0, MagiPeaceData.MagiPeaceType.MagiPeace01, 0)); index = GetNewTID(); m_TaskDataList.Add(index, new EnmData(index, 3, 3, 0, EnmType.Enm01, true));//Hide index = GetNewTID(); m_TaskDataList.Add(index, new EnmData(index, 3, 2, 0, EnmType.Enm01, false));//Active // 演出家 index = GetNewTID(); m_TaskDataList.Add(index, new ProducerData(index)); index = GetNewTID(); m_TaskDataList.Add(index, new UIData(index)); // 各Taskの準備 foreach (TaskData tData in m_TaskDataList.Values) { tData.Ready(); } SequenceManager.SendMessage(MessageType.FloorInitEnd, -1); } else { // 復元処理 } }
public void Start() { _sequenceManager = SequenceManager.Instance; }
public PhysicsData(SequenceManager sequences) { this.sequences = sequences; }
void Awake() { Instance = this; _userSequence = ""; }
// Called when the player goes to main menu. public void MainMenu() { #if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN SequenceManager.Save(); #endif }
public BTTimerNode(float interval) : base() { mTimerLimit = SequenceManager.CreateMultiple(); mTimerLimit.PrependInterval(interval); }
private void Awake() { instance = this; }
public GameMessageUpdateMotion(ObjectGuid animationTargetGuid, byte[] instance_timestamp, SequenceManager sequence, MotionState newState) : base(GameMessageOpcode.Motion, GameMessageGroup.Group0A) { Writer.WriteGuid(animationTargetGuid); // who is getting the message - the rest of the sequences are the target objects sequences -may be the same Writer.Write(instance_timestamp); Writer.Write(sequence.GetNextSequence(SequenceType.ObjectMovement)); if (!newState.IsAutonomous) { Writer.Write(sequence.GetNextSequence(SequenceType.ObjectServerControl)); } else { Writer.Write(sequence.GetCurrentSequence(SequenceType.ObjectServerControl)); } ushort autonomous; if (newState.IsAutonomous) { autonomous = 1; } else { autonomous = 0; } Writer.Write(autonomous); var movementData = newState.GetPayload(animationTargetGuid, sequence); Writer.Write(movementData); Writer.Align(); }
public virtual byte[] GetPayload(ObjectGuid animationTargetGuid, SequenceManager sequence) { return(null); }
void Awake() { Instance = this; }
/// <summary> /// Process next message from the queue /// </summary> /// <param name="conn">database connection (open)</param> /// <param name="pauseMs"> /// returns number of milliseconds to pause before handling next message. /// This is used for message throttling. /// </param> /// <returns> /// true if there are more messages to process /// false if there are no more messages to process and the receiving thread /// should pause for some time. /// </returns> protected virtual bool ProcessNextMessage(DbConnection conn) { var sw = Stopwatch.StartNew(); string mtype = null; DateTime?retryTime = null; string id = null; string lbl = ""; MessageFailureDisposition doRetry = MessageFailureDisposition.RetryIncrementRetryCount; DateTime? nextRetry = null; int retryCount = 0; bool messageFailed = false; bool abort = true; //by default, abort Exception handlingError = null; try { TransactionOptions to = new TransactionOptions { IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted, Timeout = DefaultTransactionTimeout }; using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, to)) { conn.EnlistTransaction(Transaction.Current); try { bool moreMessages = false; //var mc = UseSqlOutputClause ? SelectNextMessageForProcessing2008(conn, out retryTime) : SelectNextMessageForProcessing(conn, out retryTime, out moreMessages); var mc = GetQueueOps(conn).SelectAndLockNextInputMessage(conn, _queueTable, () => _nowProcessing.Keys, out retryTime, out moreMessages); if (mc == null) { return(moreMessages); } id = mc.BusMessageId; _nowProcessing[id] = DateTime.Now; NLog.MappedDiagnosticsContext.Set("nmbrecvmsg", id); log.Debug("Selected message {0} for processing", id); _frequency.Enqueue(_freqSw.ElapsedTicks); long tmp; while (_frequency.Count > MaxConcurrentMessages && _frequency.TryDequeue(out tmp)) { } ; retryCount = mc.RetryCount; mc.IsFinalRetry = retryCount >= _retryTimes.Length; doRetry = mc.IsFinalRetry ? MessageFailureDisposition.Fail : MessageFailureDisposition.RetryIncrementRetryCount; nextRetry = doRetry == MessageFailureDisposition.RetryIncrementRetryCount ? DateTime.Now + _retryTimes[retryCount] : (DateTime?)null; _curMsg = new CurMsgInfo(mc); if (retryTime.HasValue) { TimeSpan latency = DateTime.Now - retryTime.Value; statLog.Info("LATENCY:{0}", (long)latency.TotalMilliseconds); } try { if (mc.HasHeader(MessageContainer.HDR_TTL)) { var ttl = mc.GetDateTimeHeader(MessageContainer.HDR_TTL, DateTime.MaxValue); if (ttl < DateTime.Now) { log.Info("Message #{0} TTL expired", id); abort = false; return(true); } } if (!IsLocalEndpoint(mc.To)) { ForwardMessageToRemoteEndpoint(mc); abort = false; return(true); } if (mc.HasHeader(MessageContainer.HDR_SeqId) && SequenceManager != null) { var seqn = mc.SequenceNumber; if (seqn < 0) { throw new Exception("Invalid sequence ordinal number"); } var md = SequenceManager.SequenceMessageArrived(mc.SequenceId, seqn, mc.SequenceLength, conn, id); if (md.MessageDispositon == SequenceMessageDisposition.ProcessingDisposition.RetryImmediately) { return(true); } else if (md.MessageDispositon == SequenceMessageDisposition.ProcessingDisposition.Postpone) { GetQueueOps(conn).MarkMessageForProcessingLater(conn, _queueTable, id, md.EstimatedRetry.HasValue ? md.EstimatedRetry.Value : DateTime.Now.AddMinutes(1)); abort = false; //save the transaction return(true); } else if (md.MessageDispositon == SequenceMessageDisposition.ProcessingDisposition.HandleMessage) { if (!string.IsNullOrEmpty(md.NextMessageId)) { GetQueueOps(conn).MoveMessageFromRetryToInput(conn, _queueTable, md.NextMessageId); } } else { throw new Exception(); } } //log.Trace("Processing message {0} locally", mc.BusMessageId); if (OnMessageArrived != null) { OnMessageArrived(mc, this); if (mc.Body != null) { mtype = mc.Body.GetType().Name; } } else { throw new Exception("OnMessageArrived not configured for Sql transport " + Endpoint); } abort = false; if (_curMsg.ProcessLater.HasValue) { if (_curMsg.ProcessLater.Value <= DateTime.Now) { abort = true; } else { GetQueueOps(conn).MarkMessageForProcessingLater(conn, _queueTable, id, _curMsg.ProcessLater.Value); //MarkMessageForProcessingLater(id, _curMsg.ProcessLater.Value, null, conn); } } if (Transaction.Current.TransactionInformation.Status == TransactionStatus.Aborted) { throw new Exception("Current transaction has aborted without an exception (probably because inner TransactionScope has aborted)"); } return(true); } catch (ThreadAbortException) { log.Warn("ThreadAbort when processing message"); abort = true; throw; } catch (RetryMessageProcessingException ex) { log.Info("Retry message processing at {1}: {0}", ex.Message, ex.RetryTime); abort = true; doRetry = MessageFailureDisposition.RetryDontIncrementRetryCount; nextRetry = ex.RetryTime; } catch (Exception ex) { abort = true; messageFailed = true; log.Warn("Error processing message {0}: {1}", id, ex); handlingError = ex; if (ex is System.Reflection.TargetInvocationException) { handlingError = ex.InnerException; } else if (ex is PermanentMessageProcessingException) { if (ex.InnerException != null) { handlingError = ex.InnerException; } doRetry = MessageFailureDisposition.Fail; } if (MessageFailed != null) { MessageFailed(mc, handlingError); } if (doRetry == MessageFailureDisposition.Fail) { if (MessageFailedAllRetries != null) { MessageFailedAllRetries(mc, handlingError); } } } finally { _curMsg = null; } } catch (Exception ex) { log.Error("Unexpected error processing message {0}: {1}", id, ex.ToString()); abort = true; throw new Exception("Unexpected error", ex); } finally { if (!abort) { ts.Complete(); } } } //end transaction 1 if (abort && messageFailed) { ///here we have a race condition - previous transaction was rolled back ///and new transaction hasn't started yet so we don't hold a lock on the ///message record and someone may snatch it in the meantime ///But we shouldn't worry too much, if someone steals the message he ///will be responsible for updating its status using (var ts = new TransactionScope(TransactionScopeOption.Required, to)) { conn.EnlistTransaction(Transaction.Current); if (GetQueueOps(conn).MarkMessageFailed(conn, _queueTable, id, handlingError.ToString(), doRetry, nextRetry.HasValue ? nextRetry.Value : DateTime.Now)) { log.Info("Message {0} marked {1} because of failure. Retry number: {2}", id, doRetry, retryCount); } ts.Complete(); } } return(false); } finally { if (!string.IsNullOrEmpty(id)) { DateTime tm1; _nowProcessing.TryRemove(id, out tm1); sw.Stop(); log.Log(sw.ElapsedMilliseconds > 2000 ? LogLevel.Warn : LogLevel.Info, "ProcessNextMessage {0} took {1} ms", id, sw.ElapsedMilliseconds); statLog.Info("ProcessNextMessage:{0}", sw.ElapsedMilliseconds); if (!string.IsNullOrEmpty(mtype)) { statLog.Info("ProcessMessage_{0}:{1}", mtype, sw.ElapsedMilliseconds); } } NLog.MappedDiagnosticsContext.Remove("nmbrecvmsg"); } }
public override byte[] GetPayload(ObjectGuid animationTargetGuid, SequenceManager sequence) { MemoryStream stream = new MemoryStream(); BinaryWriter writer = new BinaryWriter(stream); writer.Write((byte)MovementTypes); MotionFlags flags = MotionFlags.None; if (HasTarget) { flags |= MotionFlags.HasTarget; } if (Jumping) { flags |= MotionFlags.Jumping; } writer.Write((byte)flags); // these can be or and has sticky object | is long jump mode | writer.Write((ushort)Stance); // called command in the client switch (MovementTypes) { case MovementTypes.General: { MovementData.SetMovementStateFlag(); MovementStateFlag generalFlags = MovementData.MovementStateFlag; generalFlags += (uint)Commands.Count << 7; writer.Write((uint)generalFlags); MovementData.Serialize(writer); // Must be aligned for correct alignment. - sigh Og II writer.Align(); foreach (var item in Commands) { writer.Write((ushort)item.Motion); writer.Write(sequence.GetNextSequence(SequenceType.Motion)); writer.Write(item.Speed); } break; } case MovementTypes.MoveToPosition: case MovementTypes.MoveToObject: { try { if (MovementTypes == MovementTypes.MoveToObject) { writer.Write(TargetGuid.Full); } Position.Serialize(writer, false); writer.Write(Flag); writer.Write(DistanceFrom); writer.Write(MinimumDistance); writer.Write(FailDistance); writer.Write(Speed); writer.Write(WalkRunThreshold); writer.Write(Heading); writer.Write(RunRate); } catch (Exception) { // Do nothing // TODO: This prevents a crash in Kryst and possibly other locations, Please investigate and fix if possible. } break; } case MovementTypes.TurnToObject: { // This had the wrong value being passed. We had never used this // movement type yet - coded it up but had not used or tested. writer.Write(TargetGuid.Full); writer.Write(Heading); writer.Write(Flag); writer.Write(Speed); writer.Write(DesiredHeading); // always 0.0 in every pcap of this type. break; } case MovementTypes.TurnToHeading: { writer.Write(Flag); writer.Write(Speed); writer.Write(Heading); break; } } return(stream.ToArray()); }
/// <summary> /// Run the test. /// </summary> public void RunTest(ITest test) { Type fixtureType = test.Fixture.Instance.GetType(); MethodInfo method = test.TestMethod; DynamicMethod testMethod = GetTestMethod(fixtureType, method); TestTimer timer = new TestTimer(); Dictionary <int, Exception> exceptionsThrown; TestDelegate testDelegate = testMethod.CreateDelegate(typeof(TestDelegate), test.Fixture.Instance) as TestDelegate; try { timer.Start(test); exceptionsThrown = testDelegate(); timer.Stop(); } catch (InvalidProgramException exp) { timer.Stop(); throw new InvalidOperationException("Unable to catch thrown exceptions in test method.", exp); } finally { timer.Stop(); } SequenceManager sm = new SequenceManager(test.TestMethod); int expectedExceptionCount = 0; int unexpectedExpectedCount = 0; int i = 0; foreach (KeyValuePair <int, Exception> exception in exceptionsThrown) { if (exception.Value != null) { Type thrownExceptionType = exception.Value.GetType(); test.Result.Output.AppendFormat("[{0}] Expected Exception: {1}", i + 1, ExceptionType.FullName); if (thrownExceptionType.Equals(ExceptionType)) { expectedExceptionCount++; test.Result.Output.AppendLine(" was thrown."); } else { // Get line offset from il instruction offset. unexpectedExpectedCount++; test.Result.Output.AppendLine(" was NOT thrown."); test.Result.Output.Append("\tThrown Exception Was: "); if (sm.IsSourceAvailable()) { int sequenceOffset = Math.Abs(Array.BinarySearch <int>(sm.Offsets, exception.Key)); string dynamicLine = String.Format(" at {0}_TestMethod({1} )", test.TestMethod.Name, test.Fixture.FixtureType.Name); string sourceLine = sm.GetStackTrace(sequenceOffset); test.Result.Output.AppendLine( exception.Value.ToString().Replace(dynamicLine, sourceLine)); if (test.Result.StackTrace == null) { test.Result.SetFilteredStackTrace( exception.Value.StackTrace.Replace(dynamicLine, sourceLine)); } } else { test.Result.Output.AppendLine(exception.Value.ToString()); if (test.Result.StackTrace == null) { test.Result.SetFilteredStackTrace(exception.Value.StackTrace); } } } } else { test.Result.Output.AppendFormat("[{0}] No exception was thrown.\n", i + 1); } i++; } if (test.Result.StackTrace == null && sm.IsSourceAvailable()) { test.Result.StackTrace = sm.GetStackTrace(0); } int expectedNumberOfExceptions = (ExceptionCount == UseTestCount ? exceptionsThrown.Count : ExceptionCount); test.Result.Message.AppendFormat(ExpectedExceptionCountMessage, ExceptionType.FullName, expectedExceptionCount, exceptionsThrown.Count, expectedNumberOfExceptions, unexpectedExpectedCount, (unexpectedExpectedCount != 1 ? " was" : "s were")); if (expectedExceptionCount != expectedNumberOfExceptions || (FailOnOtherExceptions && unexpectedExpectedCount > 0)) { test.Result.Status = TestStatus.Fail; } else { test.Result.Status = TestStatus.Pass; } }
public override void Pulse() { try { crashFix(); //Release spirit override while (MeCheck && !Me.IsAlive && Me.IsInInstance) { DiedInInstance = true; List <WoWPlayer> rezzerList = Me.PartyMembers.FindAll(player => (player.Class == WoWClass.Shaman || player.Class == WoWClass.Paladin || player.Class == WoWClass.Priest || player.Class == WoWClass.Druid) && player.IsAlive && player.Distance < 60); if (rezzerList.Count == 0) { Log("No rezzers around. Releasing corpse"); Lua.DoString("RepopMe()", "lfg.lua"); //Crash fix while (MeCheck) { Thread.Sleep(100); } crashFix(); break; } Lua.DoString("AcceptResurrect()", "lfg.lua"); Thread.Sleep(100); } //Retrieve corpse override while (MeCheck && Me.Auras.ContainsKey("Ghost") && DiedInInstance) { tickCount = Environment.TickCount; while (MeCheck) { safeMoveTo(Me.CorpsePoint); Thread.Sleep(100); if (Environment.TickCount - tickCount > 120000) { warningSound(); Log("Corpse run failed !"); return; } crashFix(); } } //Changing profile if (MeCheck && Me.IsInInstance && Logic.Profiles.ProfileManager.XmlLocation != emptyProfile) { Log("Entered to the dungeon. Loading emtpy profile"); LevelbotSettings.Instance.LastUsedPath = Logic.Profiles.ProfileManager.XmlLocation; Logic.Profiles.ProfileManager.LoadNew(emptyProfile, false); } else if (MeCheck && !Me.IsInInstance && Logic.Profiles.ProfileManager.XmlLocation == emptyProfile) { Log("Loading previous profile"); Logic.Profiles.ProfileManager.LoadNew(LevelbotSettings.Instance.LastUsedPath, true); } //Variable checks if (MeCheck && !Me.IsInInstance) { if (UseMountWasOn) { LevelbotSettings.Instance.UseMount = true; } if (LootWasOn) { LevelbotSettings.Instance.LootMobs = true; } RaFHelper.SetLeader(Me); LastTarget = null; tank = null; _tank = null; } else { if (LevelbotSettings.Instance.UseMount) { UseMountWasOn = true; } else { UseMountWasOn = false; } if (LevelbotSettings.Instance.LootMobs) { LootWasOn = true; } else { LootWasOn = false; } LevelbotSettings.Instance.UseMount = false; LevelbotSettings.Instance.LootMobs = false; Queued = false; } if (MeCheck && Me.IsAlive) { DiedInInstance = false; } // //Get current LFG mode List <string> GetLFGMode = Lua.LuaGetReturnValue("return select(1, select(1, GetLFGMode()))", "lfg.lua"); List <string> SubModeLUA = Lua.LuaGetReturnValue("return select(2, select(1, GetLFGMode()))", "lfg.lua"); if (GetLFGMode != null) { LFGStatus = GetLFGMode[0]; } else { LFGStatus = null; Queued = false; roleChecked = false; } if (SubModeLUA != null) { SubMode = SubModeLUA[0]; } else { SubMode = null; } //Dungeon over detection if (MeCheck && Me.PartyMembers.Count < 4 && Me.IsInInstance && LFGStatus == "lfgparty") { if (!partyTimer.IsRunning) { partyTimer.Start(); } if (partyTimer.ElapsedMilliseconds >= 60000) { ShouldLeave = true; } } else if (partyTimer.IsRunning) { partyTimer.Reset(); ShouldLeave = false; } //Not in queue if (MeCheck && LFGStatus == null && !Queued && !Me.Auras.ContainsKey("Dungeon Deserter") && !Me.Auras.ContainsKey("Dungeon Cooldown")) { roleChecked = false; if ((MeCheck && Me.IsInParty && Me.IsGroupLeader) || !Me.IsInParty) { Queued = true; Log("Queueing up for random dungeon"); Lua.DoString("LFDQueueFrame_Join()"); Thread.Sleep(2000); return; } } //Dungeon finished else if (LFGStatus == "abandonedInDungeon" || ShouldLeave) { roleChecked = false; Log("Dungeon run is over. Waiting 5 seconds before teleporting out."); Thread.Sleep(5000); if (MeCheck && Me.IsInParty) { Lua.DoString("LeaveParty()"); } else { Lua.DoString("LFGTeleport(true)"); } while (MeCheck) { Thread.Sleep(100); } crashFix(); return; } //Dungeon invite up else if (MeCheck && LFGStatus == "proposal" && SubMode == "unaccepted" && !Me.Combat) { roleChecked = false; Log("Waiting for 5 seconds before accepting dungeon invite"); Thread.Sleep(5000); Log("Accepting dungeon invite"); Lua.DoString("AcceptProposal()"); Thread.Sleep(2000); while (MeCheck) { SubModeLUA = Lua.LuaGetReturnValue("return select(2, select(1, GetLFGMode()))", "lfg.lua"); if (SubModeLUA != null) { SubMode = SubModeLUA[0]; } if (SubMode != null && SubMode == "empowered") { break; } Thread.Sleep(100); } crashFix(); return; } //Leader queued for lfd else if (MeCheck && LFGStatus == "rolecheck" && !Me.Combat && !roleChecked) { roleChecked = true; Log("Waiting for 5 seconds before accepting role check"); Thread.Sleep(5000); Log("Role Check is in progress"); Lua.DoString("LFDRoleCheckPopupAcceptButton:Click()"); Thread.Sleep(2000); return; } //In dungeon and running else if (MeCheck && LFGStatus == "lfgparty" && Me.IsInInstance) { roleChecked = false; if (MeCheck && Me.PartyMembers.Count > 0 && Me.IsGroupLeader) { Log("You are the dungeon guide. Switching it to someone else"); Lua.DoString("PromoteToLeader('party1')"); return; } // Tank Assign if (MeCheck && Me.IsInParty && Me.IsInInstance) { string partyMember = Lua.LuaGetReturnValue("if select(1, UnitGroupRolesAssigned(\"party1\")) then return 1 elseif select(1, UnitGroupRolesAssigned(\"party2\")) then return 2 elseif select(1, UnitGroupRolesAssigned(\"party3\")) then return 3 elseif select(1, UnitGroupRolesAssigned(\"party4\")) then return 4 else return 0 end", "lfg.lua")[0]; switch (partyMember) { case "1": _tank = Me.PartyMember1; break; case "2": _tank = Me.PartyMember2; break; case "3": _tank = Me.PartyMember3; break; case "4": _tank = Me.PartyMember4; break; default: _tank = null; break; } if (tank != _tank) { if (_tank == null) { //To make sure we are following someone after corpse run etc. WoWPlayer randomMember = Me.PartyMembers.Find(player => player.IsAlive && player.Distance < 100); if (randomMember != null && tank != randomMember) { tank = randomMember; RaFHelper.SetLeader(tank); soundPlayed = false; Log("There is no tank in party. Following random party member"); } else { Log("There is nobody to follow. You need to move manually !"); warningSound(); return; } } else { tank = _tank; RaFHelper.SetLeader(tank); Log("Tank is set to: {0} with MaxHP: {1}", tank.Class, tank.MaxHealth); } } } //Target best target and execute pull sequence Dictionary <WoWUnit, int> targetList = new Dictionary <WoWUnit, int>(); List <KeyValuePair <WoWUnit, int> > sortedList = new List <KeyValuePair <WoWUnit, int> >(); foreach (WoWPlayer player in Me.PartyMembers) { if (player.CurrentTarget != null && !player.CurrentTarget.IsFriendly && player.CurrentTarget.IsTargetingMyPartyMember && player.CurrentTarget.HealthPercent < 100) { if (targetList.Count > 0 && targetList.ContainsKey(player.CurrentTarget)) { foreach (KeyValuePair <WoWUnit, int> pair in targetList) { if (pair.Key == player.CurrentTarget) { targetCount = pair.Value + 1; targetList.Remove(player.CurrentTarget); targetList.Add(player.CurrentTarget, targetCount); break; } } } else { targetList.Add(player.CurrentTarget, 1); } } } if (targetList.Count > 0) { sortedList = new List <KeyValuePair <WoWUnit, int> >(targetList); } if (sortedList.Count > 1) { sortedList.Sort(delegate(KeyValuePair <WoWUnit, int> firstPair, KeyValuePair <WoWUnit, int> nextPair) { return(nextPair.Value.CompareTo(firstPair.Value)); }); } if (sortedList.Count > 0 && LastTarget != sortedList[0].Key) { LastTarget = sortedList[0].Key; LastTarget.Target(); Thread.Sleep(100); while (MeCheck && Me.CurrentTarget != null && Me.CurrentTarget.IsAlive && (!Me.CurrentTarget.InLineOfSight || Me.CurrentTarget.Distance > 30)) { safeMoveTo(Me.CurrentTarget); } SequenceManager.CallSequenceExecutor(Sequence.Pull); } // Following tank if (MeCheck && tank != null && tank.IsValid && tank.IsAlive) { if (tank.Distance > 15 && !Me.Combat && !Me.IsResting) { safeMoveTo(tank, 15.0f); } else if (!tank.InLineOfSight && !Me.Combat && !Me.IsResting) { safeMoveTo(tank); } else if (Me.Combat && tank.Distance > 35 && !Me.IsCasting) { safeMoveTo(tank, 30.0f); } } } } catch (System.Threading.ThreadAbortException) { throw; } catch (Exception c) { Log("An Exception occured. Check debug log for details."); dLog("{0}", c); } }
/// <summary> /// 捲り終わった通知 /// </summary> void OnTurnOverEnd() { State = PanelState.Open; SequenceManager.SendMessage(MessageType.PanelOpenEnd, Index); }
// Use this for initialization void Start() { manage = GameObject.Find("Sequence Controller").GetComponent <SequenceManager>(); }
private void Start() { sequenceManager = GetComponent <SequenceManager>(); }
void Start() { seqManager = FindObjectOfType <SequenceManager> (); }
void OnDestroy() { Instance = null; }
private void Awake() { _sequenceManager = FindObjectOfType <SequenceManager>(); }
void OnViewFloorNameEnd() { SequenceManager.SendMessage(MessageType.ViewFloorNameEnd, Index); }