private void BtnToggleClick(object sender, EventArgs e) { if (Worker != null) { try { WorkerAbort.Cancel(); Worker.Wait(100); } catch (Exception exc) { MessageBox.Show(exc.Message); } ReflectDisconnection(); return; } if (!CommonBehavior.VerifyEndpoint(TbIp, TbPort, out IPEndPoint addr)) { return; } WorkerAbort = new CancellationTokenSource(); Worker = new Task(new Action(() => TcpWorker(addr)), WorkerAbort.Token); Worker.Start(); BtnToggle.Text = "Connecting..."; }
public static Composite OpenDeliriumMirror() { return(new Decorator(x => DoOpenDeliriumMirror(), CommonBehavior.MoveTo(x => Me.DeliriumMirror?.GridPos, x => Me.DeliriumMirror?.Pos, CommonBehavior.ActivateProximityMovementSpec) )); }
public static Composite SellCrItemsToVendor() { return(new Decorator(delegate { if (GetNumberOfCrRecipeSetsInInventory() == 1 && chaosRecipeSetsSoldThisCycle < 10) { return true; } return false; }, new Sequence( CommonBehavior.CloseOpenPanels(), SellBehavior.FindVendor(), SellBehavior.MoveToAndOpenVendor(), SellBehavior.OpenVendorSellScreen(), new Action(delegate { Input.KeyDown(Keys.LControlKey); Thread.Sleep(10); foreach (var item in GameController.Game.IngameState.IngameUi.InventoryPanel[InventoryIndex.PlayerInventory].VisibleInventoryItems) { if (IsCrItem(item)) { Mouse.SetCursorPosAndLeftOrRightClick(item.GetClientRectCache, Latency, randomClick: true); Thread.Sleep(Latency); } } Input.KeyUp(Keys.LControlKey); Thread.Sleep(Latency + 100); if (IsNpcOfferValid()) { // click accept button Console.WriteLine("Offer correct"); chaosRecipeSetsSoldThisCycle += 1; hasInitializedSets = false; var acceptButton = WillBot.gameController.IngameState.IngameUi.VendorAcceptButton; Mouse.SetCursorPosAndLeftOrRightClick(acceptButton.GetClientRectCache, Latency, randomClick: true); return RunStatus.Success; } else { Console.WriteLine("Offer incorrect"); // need to fail gracefully somehow.. return RunStatus.Failure; } }), // Testing purposes.. Create a loop. // Close panels. // Run stashie // CommonBehavior.CloseOpenPanels(), CommonBehavior.CloseOpenPanels(), CommonBehavior.CloseOpenPanels() //new Action(delegate { WillBot.Me.HasStashedItemsThisTownCycle = false; return RunStatus.Success; }), //TownBehavior.Stashie() ) )); }
private IActionResult ExecutePrivate(OperationResult operationResult) { try { if (ActionResultRewrite != null && ActionResultRewrite.TryGetValue(operationResult.ActionStatus, out var rewriteResult)) { return(rewriteResult); } IActionResult result = new OkResult(); CheckActionStatus( ref result, operationResult, IsInternal, GetCustomMessage, GetCustomStatus, GetCustomErrorCode, false); return(result); } catch (Exception e) { Logger.Error(e); return(CommonBehavior.GetActionResult(ActionStatus.InternalServerError, IsInternal, e.Message)); } }
public static Composite OpenStash() { // Do a minimum sleep of x seconds here // due to some issues with memory loading stash return(new PrioritySelector( new Action(delegate { if (GameController.IngameState.IngameUi.StashElement?.IsVisible == false) { WillBot.LogMessageCombo($"Stash element is not visible"); return RunStatus.Failure; } WillBot.LogMessageCombo($"Stash element is visible"); Thread.Sleep(1000); return RunStatus.Success; }), new Decorator(x => WillBot.Me.StashLabel.ItemOnGround.DistancePlayer > 60, CommonBehavior.MoveTo(x => WillBot.Me.StashLabel.ItemOnGround.GridPos, spec: CommonBehavior.DefaultMovementSpec)), ClickStash(), new Action(delegate { Thread.Sleep(2000); return RunStatus.Success; }) )); }
private static (ErrorResponse, List <ErrorResponse>) GetOperationResultResponse( OperationResult operationResult, bool isInternal, Func <ActionStatus, string> beautifulMessageFunc = null, Func <ActionStatus, string> customErrorCodeFunc = null) { var mainError = new ErrorResponse { Error = CommonBehavior.GetError(operationResult.ActionStatus, customErrorCodeFunc), Reason = CommonBehavior.GetMessage( beautifulMessageFunc, operationResult.ActionStatus, operationResult.DumpAllErrors(), operationResult.DumpPublicErrors(), CommonBehavior.GetDefaultMessage(operationResult.ActionStatus), isInternal) }; var errorList = new List <ErrorResponse>(operationResult.Errors.Count); if (operationResult.Errors.Count > 1) { errorList = operationResult.Errors.Select(res => new ErrorResponse { Error = CommonBehavior.GetError(res.ActionStatus, customErrorCodeFunc), Reason = CommonBehavior.GetMessage( beautifulMessageFunc, res.ActionStatus, res.ErrorMessage, res.IsInternal ? null : res.ErrorMessage, CommonBehavior.GetDefaultMessage(res.ActionStatus), isInternal) }).ToList(); } return(mainError, errorList); }
public override void OnActionExecuting(ActionExecutingContext actionContext) { if (!actionContext.ModelState.IsValid) { actionContext.Result = CommonBehavior.GetActionResult(ActionStatus.BadRequest, actionContext.ModelState); base.OnActionExecuting(actionContext); } }
public static Composite MoveToAndOpenVendor() { return(new PrioritySelector( new Decorator(x => vendorLabelOnGround.ItemOnGround.DistancePlayer < 70, ClickVendorLabelAction()), CommonBehavior.MoveTo(x => vendorLabelOnGround.ItemOnGround.GridPos, spec: CommonBehavior.DefaultMovementSpec), ClickVendorLabelAction() )); }
private async Task ProcessServerMessage(NetworkStream stream) { switch (await stream.ReadObjAsync(ReportProgress)) { case TrackMetadata[] metas: var items = metas.Select(x => new ListViewItem(x.ListItem)).ToArray(); Dispatcher.Post(() => { lvRemoteList.Items.Clear(); lvRemoteList.Items.AddRange(items); }); break; case FileBlob file: var repo = await Dispatcher.Send(() => TbPath.Text); var path = Path.Combine(repo, file.Name); var preExists = File.Exists(path); try { using (FileStream fs = File.Create(path)) { await fs.WriteAsync(file.Body, 0, file.Body.Length).ContinueWith(async t => { await t; fs.Close(); if (!preExists) { Dispatcher.Post(() => { var meta = CommonBehavior.GetMetadata(Wmp, path); Playlist.Add(new ListViewItem(meta.ListItem) { Tag = meta }); }); } }).ConfigureAwait(false); } } catch (Exception e) { MessageBox.Show(e.Message); } ServerMessage = null; Dispatcher.Post(() => { Text = "Music Player Client"; }); break; case Announcement msg: ServerMessage = msg.Message; ReportProgress(0); break; } }
// Use this for initialization void Start() { _trans = gameObject.GetComponent <Transform>(); _rigid = gameObject.GetComponent <Rigidbody>(); _rend = gameObject.GetComponent <Renderer>(); _common = this.GetComponent <CommonBehavior>(); gameManager = GameObject.Find("GameManager"); teamController = transform.parent.gameObject; tmp_stunDuration = stunDuration; }
public ServerForm() { InitializeComponent(); UIDispatcher = new MyDispatcher(); AppDomain.CurrentDomain.UnhandledException += CommonBehavior.OnUnhandledException; TbIp.Text = CommonBehavior.GetLocalIPAddress().ToString(); BtnBrowse.Click += (s, e) => { CommonBehavior.BrowseHandler(TbPath, LvTracks.Items); Dispatcher.Set(); Dispatcher.Reset(); }; }
public static Composite InteractWithLabelOnGroundOpenable(Func <LabelOnGround> labelToOpenDel) { return(new Decorator(delegate { var labelOnGround = labelToOpenDel(); if (labelOnGround != null && !CommonBehavior.DoCombat() && !CommonBehavior.DoLooting()) { return true; } return false; }, new PrioritySelector( CommonBehavior.MoveTo(x => labelToOpenDel()?.ItemOnGround?.GridPos, x => labelToOpenDel()?.ItemOnGround?.Pos, CommonBehavior.OpenablesMovementSpec), new Action(delegate { var label = labelToOpenDel(); var chestComponent = label?.ItemOnGround.GetComponent <Chest>(); if (chestComponent != null && chestComponent.IsStrongbox == true && chestComponent.IsLocked == true) { ControlTimer.Restart(); while (ControlTimer.ElapsedMilliseconds < 3500 && chestComponent?.IsLocked == true) { Thread.Sleep(150); Mouse.SetCursorPosAndLeftOrRightClick(label, Latency); } return RunStatus.Failure; } else if (chestComponent != null && chestComponent.IsStrongbox == false && chestComponent.DestroyingAfterOpen == true) { ControlTimer.Restart(); while (ControlTimer.ElapsedMilliseconds < 3500 && label != null) { Thread.Sleep(150); Mouse.SetCursorPosAndLeftOrRightClick(label, Latency); } return RunStatus.Failure; } else { ControlTimer.Restart(); while (ControlTimer.ElapsedMilliseconds < 3500 && label != null) { Thread.Sleep(150); Mouse.SetCursorPosAndLeftOrRightClick(label, Latency); } return RunStatus.Failure; } })))); }
public static Composite EnterBloodAquaducts() { // Find waypoint -> navigate to waypoint-> return(new Sequence( CommonBehavior.CloseOpenPanels(), new Action(delegate { WillBot.Mover.RemoveNavigationDataForCurrentZone(); TestEnterBloodAqua(); Thread.Sleep(4000); return RunStatus.Success; }) )); }
private void StartServer() { if (!CommonBehavior.VerifyPath(TbPath)) { return; } if (!CommonBehavior.VerifyEndpoint(TbIp, TbPort, out IPEndPoint addr)) { return; } TbIp.ReadOnly = TbPort.ReadOnly = TbPath.ReadOnly = true; WorkerAbort = new CancellationTokenSource(); Worker = new Task(new Action(() => TcpWorker(addr)), WorkerAbort.Token); Worker.Start(); BtnToggle.Text = "Stop"; }
public static Composite OpenMapDevice() { return(new PrioritySelector( new Action(delegate { if (GameController.IngameState.IngameUi.MapDevice.IsVisible == false) { WillBot.LogMessageCombo($"Map device is not visible"); return RunStatus.Failure; } WillBot.LogMessageCombo($"Map device is visible"); return RunStatus.Success; }), new Decorator(x => WillBot.Me.MapDeviceLabelOnGround.ItemOnGround.DistancePlayer > 60, CommonBehavior.MoveTo(x => WillBot.Me.MapDeviceLabelOnGround.ItemOnGround.GridPos, spec: CommonBehavior.DefaultMovementSpec)), ClickMapDevice() )); }
public ClientForm() { Dispatcher = new MyDispatcher(); AppDomain.CurrentDomain.UnhandledException += CommonBehavior.OnUnhandledException; InitializeComponent(); BtnBrowse.Click += (s, e) => RefreshLocalTracks(); TbIp.Text = CommonBehavior.GetLocalIPAddress().ToString(); Playlist = new PlayListViewItemCollection(LvLocalList, Wmp); CbRepeat.SelectedIndex = 0; InitializeRepeatTypeCombobox(); Wmp.currentPlaylist = Wmp.newPlaylist("no title", ""); Wmp.CurrentItemChange += OnWmpMediaChange; Wmp.PlayStateChange += OnWmpPlayStateChange; Wmp.MediaError += OnWmpMediaError; TrackBarTimer.Tick += TrackBarUpdateTick; }
public static Composite DoOpenNearbyChest() { return(new Decorator(delegate { LoadChestWhiteListIfNotLoaded(); var chestToOpen = Me?.ClosestChest; if (chestToOpen == null) { return false; } var whitelisted = chestWhitelist != null && chestWhitelist.Contains(chestToOpen?.Path) == true; if (whitelisted) { return true; } return false; //var playerPos = GameController.Player.Pos; //var entityDistanceToPlayer = // Math.Sqrt(Math.Pow(playerPos.X - entityPos.X, 2) + Math.Pow(playerPos.Y - entityPos.Y, 2)); //var isTargetable = chestToOpen.GetComponent<Targetable>().isTargetable; //var isTargeted = chestToOpen.GetComponent<Targetable>().isTargeted; //return false; }, new PrioritySelector( CommonBehavior.MoveTo(x => Me.ClosestChest?.GridPos, xyzPositionDelegate: x => Me.ClosestChest?.Pos, spec: CommonBehavior.OpenablesMovementSpec), new Action(delegate { var chestToOpen = Me.ClosestChest; var chestComponent = chestToOpen.GetComponent <Chest>(); ControlTimer.Restart(); while (ControlTimer.ElapsedMilliseconds < 3500 && chestComponent?.IsOpened == false) { var entityPos = chestToOpen.Pos; var entityScreenPos = Camera.WorldToScreen(entityPos.Translate(0, 0, 0)); Mouse.SetCursorPosAndLeftOrRightClick(entityScreenPos, 80); Thread.Sleep(100); } return RunStatus.Failure; }) ))); }
public void FixAnimationTimings(CommonBehavior behavior, int slideIndex) { String intValue = behavior.TargetElement.ShapeTarget.ShapeId.Value; ObjectId = intValue == null ? "" + 0 : intValue; int spd = behavior.CommonTimeNode.Speed == null ? 100 : behavior.CommonTimeNode.Speed.Value; intValue = behavior.CommonTimeNode.Duration; Length = intValue == null || intValue == "indefinite"? 0 : int.Parse(intValue) * spd / 100; int delay = 0; if (behavior.CommonTimeNode.StartConditionList != null && behavior.CommonTimeNode.StartConditionList.Any()) { foreach (Condition cond in behavior.CommonTimeNode.StartConditionList) { if (cond.Delay != null && cond.Delay.HasValue) { delay = delay + int.Parse(cond.Delay.Value); } } } if (behavior.TargetElement.ShapeTarget.TextElement != null && behavior.TargetElement.ShapeTarget.TextElement.ParagraphIndexRange != null) { int res = 0; bool isTextWithEffect = int.TryParse(ObjectId, out res) && PPTShape.effectShapes.Contains(slideIndex + "_" + res); if (!isTextWithEffect) { ObjectId = ObjectId + "p" + behavior.TargetElement.ShapeTarget.TextElement.ParagraphIndexRange.Start; } //TODO: add support for paragraph start-end index range } intValue = behavior.CommonTimeNode.RepeatDuration; Repetitions = intValue == null ? 1 : int.Parse(intValue); InnerAnimations = new List <IAnimation>(); Start = delay; }
// Use this for initialization void Start() { _trans = gameObject.GetComponent <Transform>(); _rigid = gameObject.GetComponent <Rigidbody>(); _rend = gameObject.GetComponent <Renderer>(); _common = this.GetComponent <CommonBehavior>(); movingMode = MovingMode.control; // Initialize tmp variables tmp_sprintDuration = sprintDuration; tmp_sprintCoolDownTime = sprintCoolDownTime; tmp_kickCoolDownTime = kickCoolDownTime; tmp_stunDuration = stunDuration; // Initialize input names horizontalInputName = "Horizontal_P" + ((int)team).ToString(); verticalInputName = "Vertical_P" + ((int)team).ToString(); sprintInputName = "Sprint_P" + ((int)team).ToString(); kickInputName = "Kick_P" + ((int)team).ToString(); }
private static IActionResult GetActionResult(ActionStatus status, ErrorResponse mainError, List <ErrorResponse> errorList, Dictionary <string, object> details, Func <ActionStatus, HttpStatusCode?> customStatusFunc) { var errorResponse = new FullErrorResponse { Error = mainError.Error, Reason = mainError.Reason }; if (errorList?.Count > 0) { errorResponse.ErrorList = errorList; } if (details?.Count > 0) { errorResponse.Details = details; } return(new JsonResult(errorResponse) { StatusCode = (int)CommonBehavior.GetStatusCode(status, customStatusFunc) }); }
public SimpleAnimation getSimpleAnimationFromCommonTimeNodePreset(CommonTimeNode commonTimeNode, SlideSize SlideSizes) { SimpleAnimation result = new SimpleAnimation(); if (AnimationTypes.TypePath.Equals(commonTimeNode.PresetClass)) { return(new MotionPathAnimation(commonTimeNode, Slide.slideIndex, SlideSizes)); } else if (AnimationTypes.TypeEntrance.Equals(commonTimeNode.PresetClass)) { result.InitialState = 1; } else if (AnimationTypes.TypeExit.Equals(commonTimeNode.PresetClass)) { result.InitialState = 2; } else if (AnimationTypes.TypeEmphasis.Equals(commonTimeNode.PresetClass)) { result.InitialState = 3; } else { return(null); } if (commonTimeNode.PresetId == null) { return(null); } result.timingType = commonTimeNode.NodeType; //Get the speed from one of the nodes common behavior. Hopefully all nodes have the same speed (since the animation is the same). foreach (Object xmlEl in commonTimeNode.Descendants()) { if (xmlEl.GetType().Equals(typeof(CommonBehavior))) { CommonBehavior bhvr = ((CommonBehavior)xmlEl); if (bhvr.CommonTimeNode != null) { result.FixAnimationTimings(bhvr, Slide.slideIndex); if (result.Length <= 1) { continue; } if (result.Start == 0) { Condition condition = commonTimeNode.StartConditionList.FirstChild as Condition; if (!condition.Delay.Equals("indefinite")) { result.Start = int.Parse(condition.Delay); } } break; } } } if (result.Length <= 1) { result.Length = 100; //Default value?? } if (AnimationTypes.TypeEmphasis.Equals(commonTimeNode.PresetClass)) { result = handleEmphasisAnimation(commonTimeNode, result); } else { result = handleEntranceAnimation(commonTimeNode, result); } if (result.AdditionalData == null || result.AdditionalData == "0") //There are default values. Horizontal In = horizontal + in ;) { switch (commonTimeNode.PresetSubtype.Value) { case 0: result.AdditionalData = "0"; break; case 4: result.AdditionalData = "3"; break; //From bottom case 2: result.AdditionalData = "2"; break; //From right case 1: result.AdditionalData = "1"; break; //From top case 8: result.AdditionalData = "4"; break; //From left case 6: result.AdditionalData = "8"; break; //Bottom right case 3: result.AdditionalData = "7"; break; //Top right case 9: result.AdditionalData = "6"; break; //Top right case 12: result.AdditionalData = "9"; break; //Bottom left case 10: result.AdditionalData = "16"; break; //Horizontal case 5: result.AdditionalData = "17"; break; //Vertical case 26: result.AdditionalData = "23"; break; //Horizontal in case 42: result.AdditionalData = "24"; break; //Horizontal out case 21: result.AdditionalData = "25"; break; //Vertical in case 37: result.AdditionalData = "26"; break; //Vertical out case 16: result.AdditionalData = "19"; break; //in case 32: result.AdditionalData = "20"; break; //out } } checkIsText(result); return(result); }
public static void InitTiming(Slide slide) { Timing timing1 = new Timing(); TimeNodeList timeNodeList1 = new TimeNodeList(); ParallelTimeNode parallelTimeNode1 = new ParallelTimeNode(); CommonTimeNode commonTimeNode1 = new CommonTimeNode() { Id = (UInt32Value)1U, Duration = "indefinite", Restart = TimeNodeRestartValues.Never, NodeType = TimeNodeValues.TmingRoot }; ChildTimeNodeList childTimeNodeList1 = new ChildTimeNodeList(); SequenceTimeNode sequenceTimeNode1 = new SequenceTimeNode() { Concurrent = true, NextAction = NextActionValues.Seek }; CommonTimeNode commonTimeNode2 = new CommonTimeNode() { Id = (UInt32Value)2U, Restart = TimeNodeRestartValues.WhenNotActive, Fill = TimeNodeFillValues.Hold, EventFilter = "cancelBubble", NodeType = TimeNodeValues.InteractiveSequence }; StartConditionList startConditionList1 = new StartConditionList(); Condition condition1 = new Condition() { Event = TriggerEventValues.OnClick, Delay = "0" }; TargetElement targetElement1 = new TargetElement(); ShapeTarget shapeTarget1 = new ShapeTarget() { ShapeId = "3" }; targetElement1.Append(shapeTarget1); condition1.Append(targetElement1); startConditionList1.Append(condition1); EndSync endSync1 = new EndSync() { Event = TriggerEventValues.End, Delay = "0" }; RuntimeNodeTrigger runtimeNodeTrigger1 = new RuntimeNodeTrigger() { Val = TriggerRuntimeNodeValues.All }; endSync1.Append(runtimeNodeTrigger1); ChildTimeNodeList childTimeNodeList2 = new ChildTimeNodeList(); ParallelTimeNode parallelTimeNode2 = new ParallelTimeNode(); CommonTimeNode commonTimeNode3 = new CommonTimeNode() { Id = (UInt32Value)3U, Fill = TimeNodeFillValues.Hold }; StartConditionList startConditionList2 = new StartConditionList(); Condition condition2 = new Condition() { Delay = "0" }; startConditionList2.Append(condition2); ChildTimeNodeList childTimeNodeList3 = new ChildTimeNodeList(); ParallelTimeNode parallelTimeNode3 = new ParallelTimeNode(); CommonTimeNode commonTimeNode4 = new CommonTimeNode() { Id = (UInt32Value)4U, Fill = TimeNodeFillValues.Hold }; StartConditionList startConditionList3 = new StartConditionList(); Condition condition3 = new Condition() { Delay = "0" }; startConditionList3.Append(condition3); ChildTimeNodeList childTimeNodeList4 = new ChildTimeNodeList(); ParallelTimeNode parallelTimeNode4 = new ParallelTimeNode(); CommonTimeNode commonTimeNode5 = new CommonTimeNode() { Id = (UInt32Value)5U, PresetId = 2, PresetClass = TimeNodePresetClassValues.MediaCall, PresetSubtype = 0, Fill = TimeNodeFillValues.Hold, NodeType = TimeNodeValues.ClickEffect }; StartConditionList startConditionList4 = new StartConditionList(); Condition condition4 = new Condition() { Delay = "0" }; startConditionList4.Append(condition4); ChildTimeNodeList childTimeNodeList5 = new ChildTimeNodeList(); Command command1 = new Command() { Type = CommandValues.Call, CommandName = "togglePause" }; CommonBehavior commonBehavior1 = new CommonBehavior(); CommonTimeNode commonTimeNode6 = new CommonTimeNode() { Id = (UInt32Value)6U, Duration = "1", Fill = TimeNodeFillValues.Hold }; TargetElement targetElement2 = new TargetElement(); ShapeTarget shapeTarget2 = new ShapeTarget() { ShapeId = "3" }; targetElement2.Append(shapeTarget2); commonBehavior1.Append(commonTimeNode6); commonBehavior1.Append(targetElement2); command1.Append(commonBehavior1); childTimeNodeList5.Append(command1); commonTimeNode5.Append(startConditionList4); commonTimeNode5.Append(childTimeNodeList5); parallelTimeNode4.Append(commonTimeNode5); childTimeNodeList4.Append(parallelTimeNode4); commonTimeNode4.Append(startConditionList3); commonTimeNode4.Append(childTimeNodeList4); parallelTimeNode3.Append(commonTimeNode4); childTimeNodeList3.Append(parallelTimeNode3); commonTimeNode3.Append(startConditionList2); commonTimeNode3.Append(childTimeNodeList3); parallelTimeNode2.Append(commonTimeNode3); childTimeNodeList2.Append(parallelTimeNode2); commonTimeNode2.Append(startConditionList1); commonTimeNode2.Append(endSync1); commonTimeNode2.Append(childTimeNodeList2); NextConditionList nextConditionList1 = new NextConditionList(); Condition condition5 = new Condition() { Event = TriggerEventValues.OnClick, Delay = "0" }; TargetElement targetElement3 = new TargetElement(); ShapeTarget shapeTarget3 = new ShapeTarget() { ShapeId = "3" }; targetElement3.Append(shapeTarget3); condition5.Append(targetElement3); nextConditionList1.Append(condition5); sequenceTimeNode1.Append(commonTimeNode2); sequenceTimeNode1.Append(nextConditionList1); Video video1 = new Video(); CommonMediaNode commonMediaNode1 = new CommonMediaNode() { Volume = 80000 }; CommonTimeNode commonTimeNode7 = new CommonTimeNode() { Id = (UInt32Value)7U, Fill = TimeNodeFillValues.Hold, Display = false }; StartConditionList startConditionList5 = new StartConditionList(); Condition condition6 = new Condition() { Delay = "indefinite" }; startConditionList5.Append(condition6); commonTimeNode7.Append(startConditionList5); TargetElement targetElement4 = new TargetElement(); ShapeTarget shapeTarget4 = new ShapeTarget() { ShapeId = "3" }; targetElement4.Append(shapeTarget4); commonMediaNode1.Append(commonTimeNode7); commonMediaNode1.Append(targetElement4); video1.Append(commonMediaNode1); childTimeNodeList1.Append(sequenceTimeNode1); childTimeNodeList1.Append(video1); commonTimeNode1.Append(childTimeNodeList1); parallelTimeNode1.Append(commonTimeNode1); timeNodeList1.Append(parallelTimeNode1); timing1.Append(timeNodeList1); slide.Append(timing1); }
public static Composite DoCorruptedZoneTransition() { return(new Sequence( new Inverter(CommonBehavior.MoveTo(x => areaTransitionBeforeTransition.areaTransitionGridPosition, spec: CommonBehavior.OpenablesMovementSpec)), new Action(delegate { // Test if were actually close to the area transition if (GameController.Player.GridPos.Distance(areaTransitionBeforeTransition.areaTransitionGridPosition) > 35) { WillBot.LogMessageCombo($"In trying to complete area transition. Movement to area transition must have been canceled"); return RunStatus.Failure; } areaHashBeforeTransition = GameController.Area.CurrentArea.Hash; islandIdBeforeTransition = areaTransitionBeforeTransition.locatedInIslandWithId; var closestAreaTransitionLabel = Me.ClosestAreaTransitionLabel; if (closestAreaTransitionLabel == null) { WillBot.LogMessageCombo($"No area transition nearby"); return RunStatus.Failure; } labelTextOfAreaTransition = closestAreaTransitionLabel.Label.Text; ControlTimer.Restart(); Vector2 prevGridPos = GameController.Player.GridPos; while (ControlTimer.ElapsedMilliseconds < 4000) { Mouse.SetCursorPosAndLeftOrRightClick(closestAreaTransitionLabel.Label.GetClientRect(), Latency); // Try to detect a jump in player gridpos var currentGridPos = GameController.Player.GridPos; if (currentGridPos.Distance(prevGridPos) > 20) { WillBot.LogMessageCombo($"detected large enough jump in grid pos. success"); Thread.Sleep(400); lock (MyLocks.UpdateTerrainDataLock) { //Issue is that AreaChange function run on another thread and will updateterraindata too.. // Just wait until this can be aquired since that should mean its done updating terrain data } var zoneMapAfterTransition = WillBot.Mover.GetZoneMap(); var subMapAfterTransition = zoneMapAfterTransition.GetSubMap(GameController.Player.GridPos); int islandIdAfterTransition = subMapAfterTransition.IslandId; areaTransitionBeforeTransition.leadsToIslandWithId = islandIdAfterTransition; areaTransitionBeforeTransition.hasBeenEntered = true; if (Me.ClosestAreaTransitionLabel != null) { // verify that this is another area transition var newKeyTuple = Me.ClosestAreaTransitionLabel.ItemOnGround.GridPos.ToIntTuple(); if (zoneMapAfterTransition.FoundAreaTransitions.ContainsKey(newKeyTuple)) { //Already registered this area transition WillBot.LogMessageCombo($"already have this area transition"); } else { var transition = new AreaTransitionInfo(Me.ClosestAreaTransitionLabel.Label.Text, Me.ClosestAreaTransitionLabel.ItemOnGround.GridPos, islandIdAfterTransition); transition.leadsToIslandWithId = islandIdBeforeTransition; transition.leadsToZoneWithAreaHash = areaHashBeforeTransition; transition.transitionType = Me.ClosestAreaTransitionLabel.ItemOnGround.GetComponent <AreaTransition>().TransitionType; zoneMapAfterTransition.FoundAreaTransitions.Add(newKeyTuple, transition); } } return RunStatus.Success; } prevGridPos = currentGridPos; Thread.Sleep(100); } // time out can mean area transition that disappears + no movement during the transition // if it timed out but the area transition is gone return RunStatus.Failure; }))); }
public static Composite DoLocalAreaTransition() { //sepearte between local, to corrupted etc. Handle accordingly. return(new Sequence( new Inverter(CommonBehavior.MoveTo(x => areaTransitionBeforeTransition.areaTransitionGridPosition, spec: CommonBehavior.OpenablesMovementSpec)), new Action(delegate { // Test if were actually close to the area transition if (GameController.Player.GridPos.Distance(areaTransitionBeforeTransition.areaTransitionGridPosition) > 35) { WillBot.LogMessageCombo($"In trying to complete area transition. Movement to area transition must have been canceled"); return RunStatus.Failure; } areaHashBeforeTransition = GameController.Area.CurrentArea.Hash; islandIdBeforeTransition = areaTransitionBeforeTransition.locatedInIslandWithId; var closestAreaTransitionLabel = Me.ClosestAreaTransitionLabel; if (closestAreaTransitionLabel == null) { WillBot.LogMessageCombo($"No area transition nearby"); return RunStatus.Failure; } labelTextOfAreaTransition = closestAreaTransitionLabel.Label.Text; ControlTimer.Restart(); Vector2 prevGridPos = GameController.Player.GridPos; while (ControlTimer.ElapsedMilliseconds < 4000) { Mouse.SetCursorPosAndLeftOrRightClick(closestAreaTransitionLabel.Label.GetClientRect(), Latency); // Try to detect a jump in player gridpos var currentGridPos = GameController.Player.GridPos; if (currentGridPos.Distance(prevGridPos) > 20) { WillBot.LogMessageCombo($"detected large enough jump in grid pos. success"); Thread.Sleep(400); // if local get zone map // else initialize zone.. and add areatransition. var zoneMapAfterTransition = WillBot.Mover.GetZoneMap(); var subMapAfterTransition = zoneMapAfterTransition.GetSubMap(GameController.Player.GridPos); int islandIdAfterTransition = subMapAfterTransition.IslandId; areaTransitionBeforeTransition.leadsToIslandWithId = islandIdAfterTransition; areaTransitionBeforeTransition.hasBeenEntered = true; if (Me.ClosestAreaTransitionLabel != null) { // verify that this is another area transition var newKeyTuple = Me.ClosestAreaTransitionLabel.ItemOnGround.GridPos.ToIntTuple(); if (zoneMapAfterTransition.FoundAreaTransitions.ContainsKey(newKeyTuple)) { //Already registered this area transition WillBot.LogMessageCombo($"already have this area transition"); } else { var transition = new AreaTransitionInfo(Me.ClosestAreaTransitionLabel.Label.Text, Me.ClosestAreaTransitionLabel.ItemOnGround.GridPos, islandIdAfterTransition); transition.leadsToIslandWithId = islandIdBeforeTransition; zoneMapAfterTransition.FoundAreaTransitions.Add(newKeyTuple, transition); } } return RunStatus.Success; } prevGridPos = currentGridPos; Thread.Sleep(100); } // time out can mean area transition that disappears + no movement during the transition // if it timed out but the area transition is gone return RunStatus.Failure; }) //new Action(delegate //{ // if (areaHashBeforeTransition != GameController.Area.CurrentArea.Hash) // { // areaTransitionBeforeTransition.isZoneTransition = true; // return RunStatus.Success; // } // else // { // var zoneMapAfterTransition = WillBot.Mover.GetZoneMap(); // var subMapAfterTransition = zoneMapAfterTransition.GetSubMap(GameController.Player.GridPos); // int islandIdAfterTransition = subMapAfterTransition.IslandId; // areaTransitionBeforeTransition.leadsToIslandWithId = islandIdAfterTransition; // areaTransitionBeforeTransition.hasBeenEntered = true; // // Wait and try to add the area transition // ControlTimer.Restart(); // while (ControlTimer.ElapsedMilliseconds < 6000) // { // areaTransitionAfterTransition = zoneMapAfterTransition.TryGetAreaTransition(Me.ClosestAreaTransitionLabel); // if (areaTransitionAfterTransition != null) // { // break; // } // Thread.Sleep(200); // } // if (areaTransitionAfterTransition == null) return RunStatus.Failure; // areaTransitionAfterTransition.hasBeenEntered = true; // areaTransitionAfterTransition.leadsToIslandWithId = islandIdBeforeTransition; // return RunStatus.Success; // } //}) )); }
private void RefreshLocalTracks() { CommonBehavior.BrowseHandler(TbPath, Playlist); }
/* * Metamorph. Check for existence of spawn thane button ( this should only have isVisible == true if its a metamorph map) * if map is done, do metamorph. Check for "Construct metamorph" label * * * * Chosen body parts window: Metamorphwindow 0 -> 3 * 0 = eyes, 1 = liver, 2 = lung, 3= heart, 4 = brain (Body part boxes) * Bodypart box: * 0 -> 1 ( There is a body part chosen for this box IF isVisible == true * Metamorphwindow -> 1 = create button * * * Methamorph stash side of things * * MetamorphBodyPartStashWindowElement * BodyPartName can be : Eyes, livers, lungs, brains, hearts * * Metamorph body part element * 0 -> 0 ( if isVisible == false then there is no body part in the stash for this * */ public static bool DoOpenDeliriumMirror() { if (Me.DeliriumMirror != null && (Me.DeliriumMirror?.DistancePlayer < 25 || !CommonBehavior.DoCombat())) { return(true); } return(false); }