// este é o método que deve ser chamado quando o slider e' movido static bool slider_Move(object source, MoveEventArgs args) { if (args.FinalMove > 50) return false; else return true; }
void Document_BeforeMove(object sender, MoveEventArgs e) { #if !DEBUG try #endif { Document doc = sender as Document; #if !DEBUG try #endif { if (doc != null) { Node node = new Node(doc.Id); if (node != null && !string.IsNullOrEmpty(node.NiceUrl) && !doc.Path.StartsWith("-1,-20")) // -1,-20 == Recycle bin | Not moved to recycle bin UrlTrackerRepository.AddUrlMapping(doc, node.GetDomainRootNode().Id, node.NiceUrl, AutoTrackingTypes.Moved); } } #if !DEBUG catch (Exception ex) { ex.LogException(doc.Id); } #endif } #if !DEBUG catch (Exception ex) { ex.LogException(); } #endif }
void ContentServiceMoving(IContentService sender, MoveEventArgs<IContent> e) { Logger.Info("Received moved event"); var runtimeContentModel = RuntimeUmbracoContext.Instance.UmbracoContentSerialiser.Remove(e.Entity); foreach (var adapter in RuntimeUmbracoContext.Instance.DeploymentAdapters) { adapter.DeployContent(runtimeContentModel, DeploymentAction.Delete); } }
// este é o método que deve ser chamado quando o slider e' movido static bool slider_Move(object source, MoveEventArgs e) { if (e.FinalMove > 50) { Console.WriteLine("too much."); return false; } else return true; }
private static void OnDocumentMoved(object sender, MoveEventArgs e) { if (!(sender is Document)) return; var document = (Document)sender; global::umbraco.library.UpdateDocumentCache(document.Id); if (document.Published) { document.UnPublish(); library.UnPublishSingleNode(document.Id); document.PublishWithResult(document.User); } }
void OnAllPlayersBigMove_Normal(Player sender, MoveEventArgs args) { Vector3S v = sender.belowBlock; object msg = sender.Level.ExtraData["MessageBlock" + v]; if (msg != null && msg.GetType() == typeof(string) && ((string)msg).Length > 1) { if (((string)msg)[0] == 'm') { sender.SendMessage(((string)sender.Level.ExtraData["MessageBlock" + v]).Substring(1)); } else { if (((string)msg)[0] == 'c') { int perm = 0; string[] commands = new string[0]; try { perm = byte.Parse(((string)msg).Split(':')[1]); commands = ((string)msg).Split(':')[2].FromHexString().Split('/'); } catch { } if (perm >= sender.Group.Permission) { for (int i = 0; i < commands.Length; i++) { string cname = commands[i].Trim().Split(' ')[0]; if (!string.IsNullOrWhiteSpace(cname)) { if (cname.Length < commands[i].Length) { string[] cargs = commands[i].Substring(cname.Length + 1).Split(' '); ICommand c = Command.Find(cname); try { if (c != null) c.Use(sender, cargs); } catch (Exception e) { Logger.LogError(e); } } else { ICommand c = Command.Find(cname); try { if (c != null) c.Use(sender, new string[0]); } catch (Exception e) { Logger.LogError(e); } } } } } } } } }
private static void ContentService_Trashing(IContentService sender, MoveEventArgs<IContent> e) { // TODO - Stop Categories being deleted if they have topics still using them // TODO - Log it, notifications don't work foreach (var item in e.MoveInfoCollection) { if (item.Entity.ContentType.Alias == AppConstants.DocTypeForumCategory) { // This is a category attempting to be moved to the Recycle bin // See if any topics are currently using the category var topics = ServiceFactory.TopicService.GetPagedTopicsByCategory(1, Int32.MaxValue, Int32.MaxValue, item.Entity.Id); if (topics.Any()) { // We have topics using it, so stop the move e.Cancel = true; //TODO - Still can't create a notification so just log it AppHelpers.LogError(string.Format("Unable to delete Category, it's currently being used by {0} topic(s)", topics.Count)); } } } }
public void LatchContentTrashing(IContentService sender, MoveEventArgs <IContent> e) { if (!LatchesShouldBeChecked) { return; } var latches = latchOperationSvc.GetLatches(LatchOperationType.Content, LatchOperationAction.Delete); var contentItems = e.MoveInfoCollection.Select(x => x.Entity); var user = HttpContext.Current.GetCurrentBackofficeUser(); var parentItem = contentItems.First(); var lockedNode = GetLockedNodeRecursively(latches, contentItems, user.Id); if (lockedNode != null) { var errorMessage = lockedNode.Id.Equals(parentItem.Id) ? GetErrorMessage("contentDelete") : GetErrorMessage("contentDeleteChildren"); var eventMessage = new EventMessage(LatchConstants.SectionName, errorMessage, EventMessageType.Error); e.CancelOperation(eventMessage); } }
private static string GetNewSubfolder(MoveEventArgs args, ScriptRenamerVisitor visitor, IImportFolder olddestfolder) { if (visitor.Destination is not null && visitor.Subfolder is null) { throw new ArgumentException("Destination set without Subfolder"); } var oldsubfolder = olddestfolder is null ? null : $"{NormPath(Path.GetDirectoryName(args.FileInfo.FilePath))}/" .Replace($"{NormPath(olddestfolder.Location)}/", null, StringComparison.OrdinalIgnoreCase).TrimEnd('/'); var oldsubfoldersplit = olddestfolder is null?Array.Empty <string>() : oldsubfolder.Split('/'); var newsubfoldersplit = visitor.Subfolder.Trim((char)0x1F).Split((char)0x1F) .Select(f => f == "*" ? f : RemoveInvalidFilenameChars(f.ReplaceInvalidPathCharacters())).ToArray(); var subfolder = string.Empty; for (var i = 0; i < newsubfoldersplit.Length; i++) { if (newsubfoldersplit[i] == "*") { if (i < oldsubfoldersplit.Length) { subfolder += oldsubfoldersplit[i] + '/'; } else { throw new ArgumentException("Could not find subfolder from wildcard"); } } else { subfolder += newsubfoldersplit[i] + '/'; } } subfolder = NormPath(subfolder); return(subfolder == string.Empty ? throw new ArgumentException("Subfolder cannot be set to empty") : subfolder); }
/// <summary> /// Updates the pick data and state. /// </summary> public void Update() { float driveDelta = GetDriveDelta(); StateType oldState = State; switch (State) { case StateType.Idle: // Idle state if (driveDelta != 0f) { State = StateType.Moving; goto case StateType.Moving; } break; case StateType.Moving: // Moving state if (driveDelta == 0f) { State = StateType.Idle; break; } MoveEventArgs args = new MoveEventArgs { OldRotation = Rotation }; Rotation += driveDelta; Moved?.Invoke(this, args); break; case StateType.Breaking: // Breaking state Life -= Degradation * Time.deltaTime; if (Life <= 0f) { State = StateType.Broken; } break; } }
private static void ContentService_Trashing(IContentService sender, MoveEventArgs <IContent> e) { var topicService = ServiceResolver.Current.Instance <TopicService>(); // Stop Categories being deleted if they have topics still using them // Log it, notifications don't work foreach (var item in e.MoveInfoCollection) { if (item.Entity.ContentType.Alias == DialogueConfiguration.Instance.DocTypeForumCategory) { // This is a category attempting to be moved to the Recycle bin // See if any topics are currently using the category var topics = topicService.GetPagedTopicsByCategory(1, int.MaxValue, int.MaxValue, item.Entity.Id); if (topics.Any()) { // We have topics using it, so stop the move e.Cancel = true; // Log the issue AppHelpers.LogError($"Unable to delete Category, it's currently being used by {topics.Count} topic(s)"); } } } }
public void OnWalkOnTile(MoveEventArgs e) { // activate triggers var ev = Map.MapMeta.GetEventId(new Vector(e.NewPos.X, e.NewPos.Y)); if (ev == null) { return; } var eventId = ev.Id; var eventPage1 = _eventService.Get(eventId)?.Walk(true); var eventPage2 = _eventService.Get(eventId)?.Walk(false); // execute event if (eventPage1 != null) { Script.Execute(eventPage1, gamePlayer, this, _graphics, _dialogManager); } if (eventPage2 != null) { Script.Execute(eventPage2, gamePlayer, this, _graphics, _dialogManager); } }
private void model_Moved(object sender, MoveEventArgs e) { // no talking during loading if (isModelLoadingMoves) { return; } // say any change in game status switch (model.Status) { case GameStatus.Check: synth.SpeakAsync(checkSpeech); break; case GameStatus.Checkmate: synth.SpeakAsync(checkmateSpeech); break; case GameStatus.Draw50Move: synth.SpeakAsync(draw50MoveSpeech); break; case GameStatus.DrawInsufficientMaterial: synth.SpeakAsync(drawInsufficientMaterialSpeech); break; case GameStatus.DrawRepetition: synth.SpeakAsync(drawRepetitionSpeech); break; case GameStatus.Stalemate: synth.SpeakAsync(stalemateSpeech); break; } }
/// <summary> /// The Umbraco 7 version of ContentService_Moved. /// This version uses MoveEventArgs.MoveInfoCollection. /// </summary> void Specialized_ContentService_Moved(IContentService sender, MoveEventArgs<IContent> e) { var aliases = e.MoveInfoCollection.Select(x => x.Entity.ContentType.Alias) .Distinct().ToList(); HandleChangedContent(aliases); }
private void HandleIncomingPos(byte[] message) { if (!IsLoggedIn) return; byte thisid = message[0]; if (thisid != 0xFF && thisid != ID && thisid != 0) { //TODO Player.GlobalMessageOps("Player sent a malformed packet!"); Kick("Hacked Client!"); return; } ushort x = Packet.NTHO(message, 1); ushort y = Packet.NTHO(message, 3); ushort z = Packet.NTHO(message, 5); byte rotx = message[7]; byte roty = message[8]; oldPos = new Vector3S(Pos); Vector3S fromPosition = new Vector3S(oldPos.x, oldPos.z, oldPos.y); Pos.x = (short)x; Pos.y = (short)y; Pos.z = (short)z; oldRot = Rot; Rot = new byte[2] { rotx, roty }; bool needsOwnPos = false; if (!(fromPosition.x == Pos.x && fromPosition.y == Pos.y && fromPosition.z == Pos.z)) { MoveEventArgs eargs = new MoveEventArgs(new Vector3S(fromPosition), new Vector3S(Pos)); eargs = OnPlayerMove.Call(this, eargs, OnAllPlayersMove); if (eargs.Canceled) { Pos = fromPosition; oldPos = fromPosition; needsOwnPos = true; } else { if (eargs.ToPosition / 32 != eargs.FromPosition / 32) { eargs = OnPlayerBigMove.Call(this, eargs, OnAllPlayersBigMove); if (eargs.Canceled) { Pos = fromPosition; oldPos = fromPosition; needsOwnPos = true; } else { Pos = eargs.ToPosition; oldPos = eargs.FromPosition; } } else { Pos = eargs.ToPosition; oldPos = eargs.FromPosition; } } } if (oldRot[0] != Rot[0] || oldRot[1] != Rot[1]) { RotateEventArgs eargs = new RotateEventArgs(Rot[0], Rot[1]); eargs = OnPlayerRotate.Call(this, eargs, OnAllPlayersRotate); if (eargs.Canceled) { Rot = eargs.Rot; needsOwnPos = true; } else { Rot = eargs.Rot; } } if (needsOwnPos) SendThisPlayerTheirOwnPos(); UpdatePosition(false); }
void ContentService_Moving(IContentService sender, MoveEventArgs<IContent> e) { IContent content = e.Entity; #if !DEBUG try #endif { if (content != null) { Node node = new Node(content.Id); if (node != null && !string.IsNullOrEmpty(node.NiceUrl) && !content.Path.StartsWith("-1,-20")) // -1,-20 == Recycle bin | Not moved to recycle bin UrlTrackerRepository.AddUrlMapping(content, node.GetDomainRootNode().Id, node.NiceUrl, AutoTrackingTypes.Moved); } } #if !DEBUG catch (Exception ex) { ex.LogException(); } #endif }
void OnPlayerBigMove_Normal(Player sender, MoveEventArgs args) { MoveGlass(sender); }
/// <summary> /// The Umbraco 7 version of MediaService_Moved. /// This version uses MoveEventArgs.MoveInfoCollection. /// </summary> void Specialized_MediaService_Moved(IMediaService sender, MoveEventArgs<IMedia> e) { var ids = e.MoveInfoCollection.Select(x => x.Entity.Id).ToList(); HandleChangedMedia(ids); }
private void OnPlayerMoved(object sender, MoveEventArgs args) { EntityMoved?.Invoke(sender, args); }
private void model_GoneBack(object sender, MoveEventArgs e) { DrawGoneBack(e.Move); }
/// <summary> /// Overrides the moving of a <see cref="Document"/> object to a new location by changing its parent id. /// </summary> public override void Move(int newParentId) { MoveEventArgs e = new MoveEventArgs(); base.FireBeforeMove(e); if (!e.Cancel) { var current = User.GetCurrent(); int userId = current == null ? 0 : current.Id; ApplicationContext.Current.Services.ContentService.Move(Content, newParentId, userId); //We need to manually update this property as the above change is not directly reflected in //the current object unless its reloaded. base.ParentId = newParentId; } base.FireAfterMove(e); }
protected virtual void OnDragging(MoveEventArgs e) { if (Dragging != null) Dragging(this, e); }
protected virtual void OnMove(MoveEventArgs e) { if (Move != null) Move(this, e); }
void ContentService_Trashed(IContentService sender, MoveEventArgs<IContent> e) { try { foreach (var moveInfo in e.MoveInfoCollection) { var relations = ApplicationContext.Current.Services.RelationService.GetByChildId(moveInfo.Entity.Id).Where(r => r.RelationType.Alias == ContentExperimentPageRelationType.RelationTypeAlias); foreach (var relation in relations) { var contentExperimentPage = ApplicationContext.Current.Services.ContentService.GetById(relation.ParentId); ApplicationContext.Current.Services.ContentService.MoveToRecycleBin(contentExperimentPage); } } } catch (Exception ex) { ex.ToExceptionless().Submit(); } }
// este é o método que deve ser chamado quando o slider e' movido static void slider_Move(object source, MoveEventArgs e) { Slider slider = (Slider)source; slider.Position = e.X; }
/// <summary> /// The Umbraco 6 version of ContentService_Moved. /// This version can't use MoveEventArgs.MoveInfoCollection, so it uses /// MoveEventArgs.Entity instead. /// </summary> void Specialized_ContentService_Moved(IContentService sender, MoveEventArgs<IContent> e) { var aliases = new [] { e.Entity.ContentType.Alias }; HandleChangedContent(aliases); }
/// <summary> /// Raises the <see cref="E:BeforeMove"/> event. /// </summary> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected virtual void FireBeforeMove(MoveEventArgs e) { FireCancelableEvent(BeforeMove, this, e); }
static void DocumentAfterMove(object sender, MoveEventArgs e) { #region Forum Topic Move Events var sid = (CMSNode)sender; var s = new Document(sid.Id); if (s.ContentType.Alias == "ForumTopic" && s.ParentId != -20) { if (s.Parent != null) //If top of tree, something is wrong. Skip. { try { var postDate = DateTime.Now; string[] strArray = { postDate.Year.ToString(), postDate.Month.ToString(), postDate.Day.ToString() }; if (strArray.Length == 3) { var topPostLevel = new Node(s.Parent.Id); //Traverse up the tree to find a forum category since we are likely in a Date Folder path while (topPostLevel != null && topPostLevel.NodeTypeAlias != "ForumCategory") { topPostLevel = topPostLevel.Parent != null ? new Node(topPostLevel.Parent.Id) : null; } if (topPostLevel != null) { Document document; Node folderNode = null; foreach (Node ni in topPostLevel.Children) { if (ni.Name == strArray[0]) { folderNode = new Node(ni.Id); document = new Document(ni.Id); break; } } if (folderNode == null) { document = Document.MakeNew(strArray[0], DocumentType.GetByAlias("ForumDateFolder"), s.User, topPostLevel.Id); document.Publish(s.User); library.UpdateDocumentCache(document.Id); folderNode = new Node(document.Id); } Node folderNode2 = null; foreach (Node ni in folderNode.Children) { if (ni.Name == strArray[1]) { folderNode2 = new Node(ni.Id); break; } } if (folderNode2 == null) { var document2 = Document.MakeNew(strArray[1], DocumentType.GetByAlias("ForumDateFolder"), s.User, folderNode.Id); document2.Publish(s.User); library.UpdateDocumentCache(document2.Id); folderNode2 = new Node(document2.Id); } if (s.Parent.Id != folderNode2.Id) { s.Move(folderNode2.Id); } } else { Log.Add(LogTypes.Debug, s.User, s.Id, string.Format("Unable to determine top category for forum topic {0} while attempting to move to new Topic", s.Id)); } } } catch (Exception exp) { Log.Add(LogTypes.Debug, s.User, s.Id, string.Format("Error while Finding Forum Folders for Forum Topic {0} while trying to move to new Topic. Error: {1}", s.Id, exp.Message)); } library.RefreshContent(); } } #endregion #region Category if (s.ContentType.Alias == "ForumCategory" && s.ParentId != -20) { s.getProperty("forumCategoryParentID").Value = s.ParentId; } #endregion }
protected bool OnMovingCancelled(IScope scope, MoveEventArgs <TItem> args) { return(scope.Events.DispatchCancelable(Moving, This, args)); }
private void loopDisplay1_MovePerformed(object sender, MoveEventArgs args) { Thread newThread = new Thread(SendMove); newThread.Start(new MoveMessage(args.Edge, args.Set)); }
public void OnMoved( MoveEventArgs e) { if (Moved != null) Moved(this, e); }
private void MediaService_Trashed(IMediaService sender, MoveEventArgs <IMedia> e) { }
void ContentService_Trashed(IContentService sender, MoveEventArgs <IContent> e) { var movedEntities = e.MoveInfoCollection.Select(eventInfo => eventInfo.Entity).ToList(); AzureSearchHelper.DeleteContentFromIndex(movedEntities); }
private void Api_MoveReceived(object sender, MoveEventArgs e) { Debug.WriteLine("VM: Api_MoveReceived"); TriggerMove(e.Move); }
void OnPlayerMove_Normal(Player sender, MoveEventArgs args) { Curse(sender); }
private static void ContentService_Moving(IContentService sender, MoveEventArgs <IContent> e) { //TODO: Use the new e.EventState to track state between Moving/Moved events! Moving = true; }
private void ShapeMoving(object sender, MoveEventArgs e) { Reroute(); OnRouteChanged(EventArgs.Empty); OnModified(EventArgs.Empty); }
private static void ContentService_Moved(IContentService sender, MoveEventArgs <IContent> e) { Moving = false; LockedEvents = false; }
static void MediaServiceMoving(IMediaService sender, MoveEventArgs<IMedia> e) { library.ClearLibraryCacheForMedia(e.Entity.Id); }
public void CallBack(Player sender, MoveEventArgs args) { MCForge.Utils.Logger.Log("Test: " + sender.Username + " moved!"); sender.SendMessage("Hi!"); sender.OnPlayerChat.All -= new ChatEvent.EventHandler(CallBack2); }
protected override void PanCanvas(MoveEventArgs args) { throw new NotImplementedException(); }
protected override void OnMove(MoveEventArgs e) { base.OnMove(e); HideEditor(); }
/// <summary> /// The Umbraco 6 version of MediaService_Moved. /// This version can't use MoveEventArgs.MoveInfoCollection, so it uses /// MoveEventArgs.Entity instead. /// </summary> void Specialized_MediaService_Moved(IMediaService sender, MoveEventArgs<IMedia> e) { var ids = new[] { e.Entity.Id }; HandleChangedMedia(ids); }
protected virtual void FireAfterMove(MoveEventArgs e) { if (AfterMove != null) AfterMove(this, e); }
private void Move(CMSNode newParent) { MoveEventArgs e = new MoveEventArgs(); FireBeforeMove(e); if (!e.Cancel) { //first we need to establish if the node already exists under the newParent node //var isNewParentInPath = (Path.Contains("," + newParent.Id + ",")); //if it's the same newParent, we can save some SQL calls since we know these wont change. //level and path might change even if it's the same newParent because the newParent could be moving somewhere. if (ParentId != newParent.Id) { int maxSortOrder = SqlHelper.ExecuteScalar <int>("select coalesce(max(sortOrder),0) from umbracoNode where parentid = @parentId", SqlHelper.CreateParameter("@parentId", newParent.Id)); this.Parent = newParent; this.sortOrder = maxSortOrder + 1; } //detect if we have moved, then update the level and path // issue: http://issues.umbraco.org/issue/U4-1579 if (this.Path != newParent.Path + "," + this.Id.ToString()) { this.Level = newParent.Level + 1; this.Path = newParent.Path + "," + this.Id.ToString(); } //this code block should not be here but since the class structure is very poor and doesn't use //overrides (instead using shadows/new) for the Children property, when iterating over the children //and calling Move(), the super classes overridden OnMove or Move methods never get fired, so //we now need to hard code this here :( if (Path.Contains("," + ((int)RecycleBin.RecycleBinType.Content).ToString() + ",") || Path.Contains("," + ((int)RecycleBin.RecycleBinType.Media).ToString() + ",")) { //if we've moved this to the recyle bin, we need to update the trashed property if (!IsTrashed) { IsTrashed = true; //don't update if it's not necessary } } else { if (IsTrashed) { IsTrashed = false; //don't update if it's not necessary } } //make sure the node type is a document/media, if it is a recycle bin then this will not be equal if (!IsTrashed && newParent.nodeObjectType == Document._objectType) { // regenerate the xml of the current document var movedDocument = new Document(this.Id); movedDocument.XmlGenerate(new XmlDocument()); //regenerate the xml for the newParent node var parentDocument = new Document(newParent.Id); parentDocument.XmlGenerate(new XmlDocument()); } else if (!IsTrashed && newParent.nodeObjectType == Media._objectType) { //regenerate the xml for the newParent node var m = new Media(newParent.Id); m.XmlGenerate(new XmlDocument()); } var children = this.Children; foreach (CMSNode c in children) { c.Move(this); } //TODO: Properly refactor this, we're just clearing the cache so the changes will also be visible in the backoffice InMemoryCacheProvider.Current.Clear(); FireAfterMove(e); } }
/// <summary> /// Handles cache refreshing for when content is trashed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <remarks> /// This is for the unpublished page refresher - the entity will be unpublished before being moved to the trash /// and the unpublished event will take care of remove it from any published caches /// </remarks> static void ContentService_Trashed(IContentService sender, MoveEventArgs <IContent> e) { DistributedCache.Instance.RefreshUnpublishedPageCache( e.MoveInfoCollection.Select(x => x.Entity).ToArray()); }
private void ContentService_Moved(IContentService sender, MoveEventArgs <IContent> args) { var oldRoutes = GetOldRoutes(args.EventState); CreateRedirects(oldRoutes); }
static void MediaService_Moved(IMediaService sender, MoveEventArgs <IMedia> e) { DistributedCache.Instance.RefreshMediaCacheAfterMoving(e.MoveInfoCollection.ToArray()); }
protected void OnMoved(IScope scope, MoveEventArgs <TItem> args) { scope.Events.Dispatch(Moved, This, args); }
protected virtual void ShapeMoving(object sender, MoveEventArgs e) { OnModified(EventArgs.Empty); }
public void OnMove(object sender, MoveEventArgs args) { MapID = args.NewPosition.MapID; }
public void Callback(object source , MoveEventArgs e) { Console.WriteLine("Slider position {0} is invalid", e.X); }
public void Move(int newForumId) { var moveEventArgs = new MoveEventArgs(); FireBeforeMove(moveEventArgs); if (moveEventArgs.Cancel) return; var newF = new Forum(newForumId); var oldF = new Forum(ParentId); if (newF.Exists == false) return; ParentId = newForumId; Save(true); newF.Save(); oldF.Save(); FireAfterMove(moveEventArgs); }
// este é o método que deve ser chamado quando o slider e' movido static void slider_Move(object source, MoveEventArgs e) { if (e.position <= 50) e.valid = true; }
protected virtual void FireBeforeMove(MoveEventArgs e) { _events.FireCancelableEvent(BeforeMove, this, e); }
public void OnMove(Player Player, MoveEventArgs args) { try { if (Player.Group.Permission < ServerSettings.GetSettingInt("WOMPermission") && !WomExempt.Contains(Player.Username.ToLower())) { if ((bool) (Player.ExtraData.GetIfExist("UsingWoM")) && !Player.IsBeingKicked) { Player.Kick("WoM is not allowed on this server!"); args.Cancel(); } } ExtraPlayerData temp = FindPlayer(Player); if (temp == null) return; if (!temp.SentUserType) { temp.SentUserType = true; ZombieHelper.SendUserType(temp); } #region Anti-Hack Vector3S delta = new Vector3S((short)Math.Abs(Player.Pos.x - Player.oldPos.x), (short)Math.Abs(Player.Pos.z - Player.oldPos.z), (short)Math.Abs(Player.Pos.y - Player.oldPos.y)); Vector3S delta32 = new Vector3S((short)(Math.Abs(Player.Pos.x - Player.oldPos.x) / 32), (short)(Math.Abs(Player.Pos.z - Player.oldPos.z) / 32), (short)(Math.Abs(Player.Pos.y - Player.oldPos.y) / 32)); bool posChanged = ( delta.x != 0 ) || ( delta.y != 0 ) || ( delta.z != 0 ); bool pos32Changed = (delta.x != 0) || (delta.y != 0) || (delta.z != 0); // skip everything if player hasn't moved if (!posChanged) return; if (!temp.Referee && !temp.Player.IsLoading && !temp.Player.IsBot) { if (delta.x >= 160) //Allows 5 blocks a second... more than enough with lag { if (temp.Spawning == false) { temp.Spawning = true; Player.SendToPos(Player.oldPos); return; } } else if (delta.z >= 160) //Allows 5 blocks a second... more than enough with lag { if (temp.Spawning == false) { temp.Spawning = true; Player.SendToPos(Player.oldPos); return; } } else if (temp.Spawning == true) { temp.Spawning = TriBool.Unknown; } else if (temp.Spawning == TriBool.Unknown) { temp.Spawning = false; } try { if (Player.Pos.y > 64 && !temp.Referee && (Player.Pos.y / 32) < Player.Level.CWMap.Size.y) { if (Block.CanWalkThrough(Player.Level.GetBlock((Player.Pos.x / 32), (Player.Pos.z / 32), (Player.Pos.y / 32) - 2)) && Block.CanWalkThrough(Player.Level.GetBlock((Player.Pos.x / 32), (Player.Pos.z / 32), (Player.Pos.y / 32) - 3)) && !Block.CanEscalate(Player.Level.GetBlock((Player.Pos.x / 32), (Player.Pos.z / 32), (Player.Pos.y / 32) - 2)) && !Block.CanEscalate(Player.Level.GetBlock((Player.Pos.x / 32), (Player.Pos.z / 32), (Player.Pos.y / 32) - 1)) && !Block.CanEscalate(Player.Level.GetBlock(Player.Pos / 32))) { if ((Player.Pos.y / 32) - (args.FromPosition.y / 32) == 0) { temp.AmountOfTimesInAir++; if (temp.AmountOfTimesInAir == AmountOfChecksInAir) { temp.Player.Kick("You are not allowed to fly on this server!"); args.Cancel(); return; } } if ((Player.Pos.y / 32) - (args.FromPosition.y / 32) == -1) { temp.AmountOfTimesInAir--; } } else { temp.AmountOfTimesInAir = 0; } } else { temp.AmountOfTimesInAir = 0; } } catch { } try { if ((Player.Pos.y / 32) < Player.Level.CWMap.Size.y) { if (!Block.CanWalkThrough(Player.Level.GetBlock((Player.Pos.x / 32), (Player.Pos.z / 32), (Player.Pos.y / 32))) && !temp.Referee && !temp.Player.IsLoggedIn && !temp.Player.IsLoading) { temp.AmountOfNoClips++; if (temp.AmountOfNoClips == AmountOfNoClips) { temp.Player.Kick("You are not allowed to no-clip on this server!"); args.Cancel(); return; } } } } catch { } } #endregion #region Tagging Code try //Positions error when loading, just incase the error code doesn't fix this already { if (ZombieRoundEnabled) { foreach (ExtraPlayerData Player1 in ExtraPlayerData.ToArray()) { Vector3S pos1 = Player1.Player.Pos; foreach (ExtraPlayerData Player2 in ExtraPlayerData.ToArray()) //Double ieterate { Vector3S pos2 = Player2.Player.Pos; if (!Player1.Player.IsLoading && !Player2.Player.IsLoading) { if (Math.Abs(pos1.x - pos2.x) <= 32 && Math.Abs(pos1.y - pos2.y) <= 64 && Math.Abs(pos1.z - pos2.z) <= 32 && Player1 != Player2 && !Player1.Referee && !Player2.Referee && ((Player1.Infected && !Player2.Infected && !CureOn) || (!Player1.Infected && Player2.Infected && CureOn))) //Check if intersecting within a 1 block radii { ZombieHelper.InfectPlayer(Player1, Player2); if (StreakPlayer == Player1.Player.Username) { StreakAmount++; if (StreakAmount % 3 == 0) { Player.UniversalChat("WHOA! " + Player1.Player.Username + " is on a " + StreakAmount + " streak!"); ZombieHelper.GiveMoney(Player1.Player, ZombieHelper.Random.Next(1, 15)); } } else { StreakAmount = 0; StreakPlayer = Player1.Player.Username; } EndGame(); } } } foreach (Bot Robot in Server.Bots.ToArray()) //Robot Iterate { if (!Player1.Player.IsLoading) { if (Math.Abs(pos1.x - Robot.Player.Pos.x) <= 32 && Math.Abs(pos1.y - Robot.Player.Pos.y) <= 64 && Math.Abs(pos1.z - Robot.Player.Pos.z) <= 32 && !Player1.Referee && !Player1.Infected && Robot.FollowPlayers) //Check if intersecting within a 1 block radii { ZombieHelper.InfectPlayer(Robot.Player, Player1); EndGame(); } } } } } } catch { } try { if (pos32Changed && ZombieRoundEnabled) { temp.AmountMoved++; } } catch{} #endregion } catch { } }
static void MediaService_Trashed(IMediaService sender, MoveEventArgs <IMedia> e) { DistributedCache.Instance.RemoveMediaCacheAfterRecycling(e.MoveInfoCollection.ToArray()); }
protected virtual void OnMove(MoveEventArgs e) { Move?.Invoke(this, e); }
void Input_OnMoveReceived(object sender, MoveEventArgs args) { MoveDirection move = (MoveDirection)sender; ProcessMove(move); }
private static void Cube_OnMoveDone(object sender, MoveEventArgs e) { pairs = from corner in FTLMoveCalculator.cube.Corners where corner.HasColor(WHITE) select FTLPair.GetPair(corner, FTLMoveCalculator.cube); }