static public IPuzzleAction Parse(string text) { if (string.IsNullOrEmpty(text)) { return(null); } string parseText = text.Trim(); if (!parseText.StartsWith("{") || !parseText.EndsWith("}")) { return(null); } parseText = parseText.Substring(1, parseText.Length - 2); string[] splits = parseText.Split(new[] { ',' }); if (splits.Length != 2) { return(null); } ActionTypes type = (ActionTypes)Enum.Parse(typeof(ActionTypes), splits[0].Trim(), true); DirectionTypes direction = (DirectionTypes)Enum.Parse(typeof(DirectionTypes), splits[1].Trim(), true); return(new PuzzleAction(type, direction));; }
public void SetCurrentDirection(DirectionTypes direction) { this.direction = direction; directionString = null; FireChange("Direction"); FireChange("DirectionString"); }
public SensationSnapshot(DirectionTypes directionType, FieldOfVisionTypes fieldOfVisionType, List <ISensoryPattern> sensoryPatterns, bool saveable = true) { Id = -1; Direction = directionType; FieldOfVision = fieldOfVisionType; SensoryPatterns.AddRange(sensoryPatterns); }
public MessageEntityEntryAttribute(string name, DirectionTypes direction, InteractionTypes interaction, string description) { Name = name; Direction = direction; Interaction = interaction; Description = description; }
//to upload public FtpFileInfo(string fileName, string destination, DirectionTypes direction, bool mkdirFlag) { this.completeFileName = fileName; this.destination = destination; this.direction = direction; this.mkdirFlag = mkdirFlag; }
public PartialSnapshotCompression(CompressionTypes compressionType, FieldOfVisionTypes fieldOfVision, DirectionTypes direction) { Id = -1; CompressionType = compressionType; FieldOfVision = fieldOfVision; Direction = direction; }
static public DirectionTypes Substraction(DirectionTypes first, DirectionTypes second) { var firstPoint = ConvertToPoint(first); var secondPoint = ConvertToPoint(second); var resultPoint = new Point(firstPoint.X - secondPoint.X, firstPoint.Y - secondPoint.Y); return(ConvertToDirectionType(resultPoint)); }
public void Experience(FieldOfVisionTypes fieldOfVisionType, PuzzleBoard partialBoard) { Point centerPos = new Point(); switch (fieldOfVisionType) { case FieldOfVisionTypes.Single: centerPos = new Point(0, 0); break; case FieldOfVisionTypes.ThreeByThree: centerPos = new Point(1, 1); break; case FieldOfVisionTypes.FiveByFive: centerPos = new Point(2, 2); break; } List <ISensoryPattern> sensoryPatterns = new List <ISensoryPattern>(); for (int y = 0; y < partialBoard.Rows; y++) { for (int x = 0; x < partialBoard.Columns; x++) { Point pos = new Point(x, y); DirectionTypes directionType = PuzzleReferee.ConvertToDirectionType(new Point(pos.X - centerPos.X, pos.Y - centerPos.Y)); PuzzleCellStateTypes state = partialBoard.GetState(pos); int value = partialBoard.GetValue(pos); string valueString = value >= 0 ? value.ToString() : " "; if (state != PuzzleCellStateTypes.Undefined) { ISensoryUnit sensoryUnitState = GetOrCreateSensoryUnit(SensoryTypes.FieldState, state.ToString()); ISensoryUnit sensoryUnitValue = GetOrCreateSensoryUnit(SensoryTypes.FieldValue, valueString); List <ISensoryUnit> sensoryUnits = new List <ISensoryUnit>(); sensoryUnits.Add(sensoryUnitState); sensoryUnits.Add(sensoryUnitValue); ISensoryPattern sensoryPattern = new SensoryPattern(directionType, sensoryUnits); if (_kownSensoryPatterns.Contains(sensoryPattern)) { sensoryPattern = _kownSensoryPatterns[_kownSensoryPatterns.IndexOf(sensoryPattern)]; } else { _kownSensoryPatterns.Add(sensoryPattern); _kownSensoryPatterns.Sort(); } sensoryPatterns.Add(sensoryPattern); } } } _lastSensationSnapshot = new SensationSnapshot(DirectionTypes.Center, fieldOfVisionType, sensoryPatterns, IS_SAVEABLE_SNAPSHOT); }
private void MoveRobot(DirectionTypes directionType) { if (_puzzleReferee.CheckAction(_robotBrain.Position, directionType, ActionTypes.Move)) { Point direction = PuzzleReferee.ConvertToPoint(directionType); Point actionPosition = new Point(_robotBrain.Position.X + direction.X, _robotBrain.Position.Y + direction.Y); _robotBrain.Position = actionPosition; } }
static public IPartialSnapshotCompression Parse(string text) { if (string.IsNullOrEmpty(text)) { return(null); } string parseText = text.Trim(); if (!parseText.StartsWith("{") || !parseText.EndsWith("}")) { return(null); } parseText = parseText.Substring(1, parseText.Length - 2); string[] splits = parseText.Split(new[] { ',' }); if (splits.Length <= 2) { return(null); } CompressionTypes compressionType = (CompressionTypes)Enum.Parse(typeof(CompressionTypes), splits[0].Trim(), true); FieldOfVisionTypes fieldOfVision = (FieldOfVisionTypes)Enum.Parse(typeof(FieldOfVisionTypes), splits[1].Trim(), true); DirectionTypes direction = DirectionTypes.Undefined; string childNodesText = splits[2].Trim(); if (!childNodesText.Contains("{")) { direction = (DirectionTypes)Enum.Parse(typeof(DirectionTypes), childNodesText, true); childNodesText = splits[3].Trim(); } var result = new PartialSnapshotCompression(compressionType, fieldOfVision, direction); if (!childNodesText.Contains("<Empty>")) { if (!childNodesText.StartsWith(IdentifierChildNodes)) { result.ChildNodes.Add(PartialSnapshotCompressionNode.Parse(childNodesText)); } else { // ======================================================================================================================= // ToDo: Check ChildNodeTree also!!! Up to now it's only one single child handled! (Think about regular expressions maybe) // ======================================================================================================================= childNodesText = childNodesText.Substring(IdentifierChildNodes.Length); childNodesText = IdentifierChildNodes.Substring(0, childNodesText.Length - 1); var splitedChildNodesText = childNodesText.Split(new[] { ';' }); foreach (var childNodeText in splitedChildNodesText) { result.ChildNodes.Add(PartialSnapshotCompressionNode.Parse(childNodeText)); } } } return(result); }
private void BtnMove_Click(object sender, EventArgs e) { if (_cbxDirectionTypes.SelectedIndex < 0) { return; } DirectionTypes directionType = (DirectionTypes)_cbxDirectionTypes.SelectedItem; MoveRobot(directionType); }
public void DirectionTypeTest() { Matrix target = new Matrix(new int[3, 3]); DirectionTypes expected = DirectionTypes.Northwest; DirectionTypes actual; target.DirectionType = expected; actual = target.DirectionType; Assert.AreEqual(expected, actual); }
public Robot(double top, double left, string image, string color, string name, DirectionTypes direction) : base() { ID = Guid.NewGuid().ToString(); Top = top; Left = left; Image = image; Color = color; Name = name; Direction = direction; }
public Message(agsXMPP.protocol.client.Message msg, DirectionTypes directionType, DateTime receivedTime) { this.InternalMessage = msg; this.DateTimeReceived = receivedTime; this.DirectionType = directionType; this.Unread = (directionType == DirectionTypes.Incoming); this.MessageID = Guid.NewGuid(); this.InternalMessage = msg; this.Replied = false; base.Path = MessageID.ToString(); UpdateItemInfo(); }
public IActionResult Test([FromJsonBody] string phoneNumber, [FromJsonBody] string test1, [FromJsonBody][Range(0, 100, ErrorMessage = "Age must be between 0 and 100")] int?age, [FromJsonBody] bool gender, [FromJsonBody] double salary, [FromJsonBody] DirectionTypes dir, [FromJsonBody][Required] string name) { if (ModelState.IsValid == false) { var errors = ModelState.SelectMany(e => e.Value.Errors).Select(e => e.ErrorMessage); return(Json("Invalid input!" + string.Join("\r\n", errors))); } return(Json($"phoneNumber={phoneNumber},test1={test1},age={age},gender={gender},salary={salary},dir={dir}")); }
private void RobotBrain_ActionWanted(object sender, ActionWantedEventArgs e) { DirectionTypes actionDirection = e.Action.Direction; ActionTypes actionType = e.Action.Type; if (_puzzleReferee.CheckAction(_robotBrain.Position, actionDirection, actionType)) { Point direction = PuzzleReferee.ConvertToPoint(actionDirection); Point actionPosition = new Point(_robotBrain.Position.X + direction.X, _robotBrain.Position.Y + direction.Y); int stateChangeCount = 0; switch (actionType) { case ActionTypes.Move: _robotBrain.Position = actionPosition; break; case ActionTypes.MarkAsEmpty: stateChangeCount = _puzzleBoard.SetState(actionPosition, PuzzleCellStateTypes.Empty).Count; break; case ActionTypes.MarkAsFilled: stateChangeCount = _puzzleBoard.SetState(actionPosition, PuzzleCellStateTypes.Filled).Count; break; case ActionTypes.RemoveMarker: stateChangeCount = _puzzleBoard.SetState(actionPosition, PuzzleCellStateTypes.NotMarked).Count; break; } if (_puzzleBoard.IsWrong()) { _robotBrain.ActionFeedback -= 1000; } else if (_puzzleBoard.IsComplete()) { _robotBrain.ActionFeedback += 100; } else if (stateChangeCount > 0) { _robotBrain.ActionFeedback += stateChangeCount; } } if (!_simulationRunsInBackground && _cbxAutoRefreshPlayground.Checked) { RefreshPlayGround(); RecreateCells(); } }
private void DoStateAction(PuzzleCellStateTypes markerState) { if (_cbxDirectionTypes.SelectedIndex < 0) { return; } DirectionTypes directionType = (DirectionTypes)_cbxDirectionTypes.SelectedItem; Point direction = PuzzleReferee.ConvertToPoint(directionType); Point markerPosition = new Point(_robotBrain.Position.X + direction.X, _robotBrain.Position.Y + direction.Y); _puzzleBoard.SetState(markerPosition, markerState); if (_cbxAutoRefreshPlayground.Checked) { RefreshPlayGround(); RecreateCells(); } }
Vector3 GetDirectionFromType(Transform _transform, DirectionTypes type) { switch (type) { case DirectionTypes.MarkerForward: return(_transform.forward); case DirectionTypes.MarkerRight: return(_transform.right); case DirectionTypes.MarkerLeft: return(-_transform.right); case DirectionTypes.MarkerBackward: return(-_transform.forward); case DirectionTypes.MarkerUp: return(_transform.up); case DirectionTypes.MarkerBottom: return(-_transform.up); case DirectionTypes.WorldForward: return(Vector3.forward); case DirectionTypes.WorldBackward: return(Vector3.back); case DirectionTypes.WorldRight: return(Vector3.right); case DirectionTypes.WorldLeft: return(Vector3.left); case DirectionTypes.WorldUp: return(Vector3.up); case DirectionTypes.WorldBottom: return(Vector3.down); default: return(Vector3.zero); } }
public void AddExit(string direction, long destination, string description) { DirectionTypes dir = Realm.Library.Common.Extensions.EnumerationExtensions.GetEnumIgnoreCase <DirectionTypes>(direction); if (Exits.Any(x => x.Direction == dir)) { return; } ExitData newExit = new ExitData((int)dir, direction) { Destination = destination, Description = description, Direction = dir, Keywords = direction }; Exits.Add(newExit); }
public bool CheckAction(Point position, DirectionTypes directionType, ActionTypes actionType) { bool result = false; Point direction = ConvertToPoint(directionType); Point actionPosition = new Point(position.X + direction.X, position.Y + direction.Y); switch (actionType) { case ActionTypes.Move: result = actionPosition.X >= 0 && actionPosition.X < _board.Columns && actionPosition.Y >= 0 && actionPosition.Y < _board.Rows; break; case ActionTypes.MarkAsEmpty: case ActionTypes.MarkAsFilled: result = _board.GetState(actionPosition) == PuzzleCellStateTypes.NotMarked; break; } return(result); }
static public ISensoryPattern Parse(string text) { if (string.IsNullOrEmpty(text)) { return(null); } string parseText = text.Trim(); if (!parseText.StartsWith("{") || !parseText.EndsWith("}")) { return(null); } parseText = parseText.Substring(1, parseText.Length - 2); string[] splits = parseText.Split(new[] { ',' }); if (splits.Length != 2) { return(null); } DirectionTypes direction = (DirectionTypes)Enum.Parse(typeof(DirectionTypes), splits[0].Trim(), true); string sensoryUnitsText = splits[1].Trim(); if (sensoryUnitsText.Length >= 2) { sensoryUnitsText = sensoryUnitsText.Substring(1, sensoryUnitsText.Length - 2); } else { sensoryUnitsText = string.Empty; } string[] sensoryUnitSplittedText = sensoryUnitsText.Split(new[] { ';' }); List <ISensoryUnit> sensoryUnits = new List <ISensoryUnit>(); foreach (string sensoryUnitText in sensoryUnitSplittedText) { sensoryUnits.Add(SensoryUnit.Parse(sensoryUnitText)); } return(new SensoryPattern(direction, sensoryUnits)); }
public void StartPrintStatistics(DirectionTypes directionType) { _directionType = directionType; switch (directionType) { case DirectionTypes.Sender: _log.Info(GetSenderSummaryHeader()); break; case DirectionTypes.Receiver: _log.Info(GetReceiverSummaryHeader()); break; default: throw new ArgumentOutOfRangeException("directionType"); } _printStatisticsTimer = new Timer(PrintStatisticsTask, this, 1000, 1000); }
public bool ClickGetDirection(DirectionTypes p_DirectionType) { try { if (!getDirectionsButton.Enabled || !getDirectionsButton.Displayed) { return(LogError("Get Directions button is disabled or invisible!")); } getDirectionsButton.Click(); // Wait for the response WebDriverWait wait = new WebDriverWait(driver, new TimeSpan(0, 0, 10)); switch (p_DirectionType) { case DirectionTypes.TRAFFIC_AWARE: wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//*[contains(text(),'Traffic Aware Route')]"))); break; case DirectionTypes.TOLL_AWARE: wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//*[contains(text(),'Toll aware')]"))); break; case DirectionTypes.FASTEST: wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//*[contains(text(),'Fastest')]"))); break; case DirectionTypes.SHORTEST: wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//*[contains(text(),'Shortest')]"))); break; } Thread.Sleep(1000); // hacky } catch (Exception ex) { return(LogError("Exception caught while performing ClickGetDirection(), error: " + ex.ToString())); } return(true); }
void KeyInputHandle() { if (Input.anyKeyDown) { m_activeInput = true; } if (m_activeInput) { if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow)) { m_directionType = DirectionTypes.Left; m_activeInput = false; } else if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow)) { m_directionType = DirectionTypes.Right; m_activeInput = false; } else if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.UpArrow)) { m_directionType = DirectionTypes.Up; m_activeInput = false; } else if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.DownArrow)) { m_directionType = DirectionTypes.Down; m_activeInput = false; } if (m_directionType != DirectionTypes.None && m_OnTouchEvent != null) { m_OnTouchEvent(m_directionType); } } else { m_directionType = DirectionTypes.None; } }
static private List <ISensoryPattern> Split(DirectionTypes directionType, int level, List <ISensoryUnit> sensoryUnits) { List <ISensoryPattern> result = new List <ISensoryPattern>(); if (level == 1) { foreach (ISensoryUnit leftUnit in sensoryUnits) { var splittedSensoryUnits = new List <ISensoryUnit>(); splittedSensoryUnits.Add(leftUnit); ISensoryPattern newEntry = new SensoryPattern(directionType, splittedSensoryUnits); result.Add(newEntry); } } else if (level >= 2) { var reducedSensoryUnits = new List <ISensoryUnit>(); reducedSensoryUnits.AddRange(sensoryUnits); foreach (ISensoryUnit leftUnit in sensoryUnits) { if (reducedSensoryUnits.Count < level) { break; } reducedSensoryUnits.RemoveAt(0); var testPattern = Split(directionType, level - 1, reducedSensoryUnits); foreach (var rightPattern in testPattern) { var splittedSensoryUnits = new List <ISensoryUnit>(); splittedSensoryUnits.Add(leftUnit); splittedSensoryUnits.AddRange(rightPattern.SensoryUnits); ISensoryPattern newEntry = new SensoryPattern(directionType, splittedSensoryUnits); result.Add(newEntry); } } } return(result); }
protected void CheckKeys() { if (Input.anyKeyDown) { m_activeInput = true; } if (m_activeInput) { if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow)) { m_directionType = DirectionTypes.Left; m_activeInput = false; } else if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow)) { m_directionType = DirectionTypes.Right; m_activeInput = false; } else if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.UpArrow)) { m_directionType = DirectionTypes.Up; m_activeInput = false; } else if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.DownArrow)) { m_directionType = DirectionTypes.Down; m_activeInput = false; } if (m_directionType != DirectionTypes.None && SwipeEvents != null) { SwipeEvents(m_directionType); } } else { m_directionType = DirectionTypes.None; } }
// Start is called before the first frame update void Start() { if (GameObject.FindGameObjectWithTag("Player") != null) { playerTransform = GameObject.FindGameObjectWithTag("Player").transform; } if (randomizeXStart) { if (Random.Range(0f, 1f) < 0.5f) // ~50% chance { var flipValues = false; if (StartPositionX == StartPositionsX.screen_left) { StartPositionX = StartPositionsX.screen_right; flipValues = true; } else if (StartPositionX == StartPositionsX.screen_right) { StartPositionX = StartPositionsX.screen_left; flipValues = true; } if (flipValues) { CustomShapeVector.x *= -1; CustomDirectionVector.x *= -1; offset_x *= -1; if (Direction == DirectionTypes.left) { Direction = DirectionTypes.right; } else if (Direction == DirectionTypes.left) { Direction = DirectionTypes.right; } } } } }
static public List <IPartialSnapshotCompression> NewInstances(ISensationSnapshot snapshot, FieldOfVisionTypes fieldOfVision, DirectionTypes direction, CompressionTypes maximumCompression) { var result = new List <IPartialSnapshotCompression>(); ISensationSnapshot partialSnapshot = SensationSnapshot.ExtractSnapshot(snapshot, fieldOfVision, direction); // Single units for fieldOfVision.Single and fieldOfVision.ThreeByThree allows to find 0 and 9 var unitCountDictonary = SensationSnapshot.CountUnits(partialSnapshot); result.AddRange(NewInstancesOfUnitCompression(unitCountDictonary, fieldOfVision)); if (maximumCompression >= CompressionTypes.UnitSimpleTree) { // Find 1 and 8 if a field around is marked as Filled or Empty (two pattern with single unit) --> fieldOfVision.ThreeByThree result.AddRange(NewInstancesOfUnitSimpleTreeCompression(unitCountDictonary, partialSnapshot, snapshot, fieldOfVision, direction)); } if (maximumCompression >= CompressionTypes.UnitCountTree) { // ToDo: Find 2-7 if 2-7 fields around are marked as Filled or Empty (two pattern with counted units) --> fieldOfVision.ThreeByThree result.AddRange(NewInstancesOfUnitCountTreeCompression(unitCountDictonary, partialSnapshot, snapshot, fieldOfVision, direction)); } if (maximumCompression >= CompressionTypes.MultiUnitCountTree) { // ToDo: Find 1-5 fields at the boarder with combination of Empty and Outside --> fieldOfVision.ThreeByThree result.AddRange(NewInstancesOfMultiUnitCountTreeCompression(unitCountDictonary, partialSnapshot, snapshot, fieldOfVision, direction)); } return(result); }
static public List <IPartialSnapshotCompression> NewInstancesOfMultiUnitCountTreeCompression(ISensationSnapshot snapshot, FieldOfVisionTypes fieldOfVision, DirectionTypes direction) { var result = new List <IPartialSnapshotCompression>(); ISensationSnapshot partialSnapshot = SensationSnapshot.ExtractSnapshot(snapshot, fieldOfVision, direction); var unitCountDictonary = SensationSnapshot.CountUnits(partialSnapshot); result.AddRange(NewInstancesOfMultiUnitCountTreeCompression(unitCountDictonary, partialSnapshot, snapshot, fieldOfVision, direction)); return(result); }
static public List <IPartialSnapshotCompression> NewInstancesOfMultiUnitCountTreeCompression(Dictionary <ISensoryUnit, int> unitCountDictonary, ISensationSnapshot partialSnapshot, ISensationSnapshot snapShot, FieldOfVisionTypes fieldOfVision, DirectionTypes direction) { var result = new List <IPartialSnapshotCompression>(); // Find 2-7 if 2-7 fields around are marked as Filled or Empty (two pattern with counted units) --> fieldOfVision.ThreeByThree foreach (KeyValuePair <ISensoryUnit, int> unitCountEntry in unitCountDictonary) { var patterns = partialSnapshot.SensoryPatterns.Where(p => p.SensoryUnits.Contains(unitCountEntry.Key)).ToList(); foreach (ISensoryPattern pattern in patterns) { ISensationSnapshot partialSnapshot2 = SensationSnapshot.ExtractSnapshot(snapShot, fieldOfVision, PuzzleReferee.Addition(direction, pattern.DirectionType)); var unitCountDictonary2 = SensationSnapshot.CountUnits(partialSnapshot2); List <ISensoryUnit> sortedUnits = new List <ISensoryUnit>(); sortedUnits.AddRange(unitCountDictonary2.Keys.ToList()); sortedUnits.Sort(); for (int i = 0; i < sortedUnits.Count - 1; i++) { var unitKey1 = sortedUnits[i]; int unitValue1 = unitCountDictonary2[unitKey1]; if (unitKey1.Equals(unitCountEntry.Key)) { unitValue1--; if (unitValue1 < 1) { // If the same unit found one time in the field of view, it must be the exact same one. continue; } } for (int j = i + 1; j < sortedUnits.Count; j++) { var unitKey2 = sortedUnits[j]; var unitValue2 = unitCountDictonary2[unitKey2]; if (unitKey2.Equals(unitCountEntry.Key)) { unitValue2--; if (unitValue2 < 1) { // If the same unit found one time in the field of view, it must be the exact same one. continue; } } var unitCompression = new PartialSnapshotCompression(CompressionTypes.MultiUnitCountTree, fieldOfVision, DirectionTypes.Undefined); var node = new PartialSnapshotCompressionNode(unitCountEntry.Key); for (int q = 0; q < unitValue1; q++) { node.ChildNodes.Add(new PartialSnapshotCompressionNode(unitKey1)); } for (int q = 0; q < unitValue2; q++) { node.ChildNodes.Add(new PartialSnapshotCompressionNode(unitKey2)); } unitCompression.ChildNodes.Add(node); if (!result.Contains(unitCompression)) { result.Add(unitCompression); } } } } } return(result); }
private RoomDirectionData GetExit(CharacterData character, DirectionTypes direction) { return _rooms[character.InRoom].DirectionOptions[(int)direction]; }
private bool PerformMove(CharacterData character, DirectionTypes direction, bool needSpecialsCheck) { int wasInRoom = 0; if (character == null || character.Fighting != null) return false; else if (GetExit(character, direction) == null || GetExit(character, direction).ToRoom == GlobalConstants.NOWHERE) SendToCharacter (character, "Alas, you cannot go that way...\r\n"); else if (GetExit(character, direction).ExitFlagged(DirectionOptionFlags.Closed)) { if (!String.IsNullOrEmpty(GetExit(character, direction).Keyword)) SendToCharacter (character, "The " + GlobalUtilities.FirstName(GetExit(character, direction).Keyword) + " seems to be closed.\r\n"); else SendToCharacter (character, "It seems to be closed.\r\n"); } else { if (!character.HasFollowers) return (DoSimpleMove (character, direction, needSpecialsCheck)); wasInRoom = character.InRoom; if (!DoSimpleMove (character, direction, needSpecialsCheck)) return false; foreach (CharacterData follower in character.Followers) { if ((follower.InRoom == wasInRoom) && follower.Position >= PositionTypes.Standing) { Act("You follow $N.\r\n", false, follower, null, character, GlobalConstants.TO_CHAR); PerformMove (follower, direction, true); } } return true; } return false; }
private bool DoSimpleMove(CharacterData character, DirectionTypes direction, bool needsSpecialsCheck) { int needMovement; if (needsSpecialsCheck && Special (character, (int)direction + 1, String.Empty)) return false; /* blocked by a leave trigger ? */ //if (!leave_mtrigger (ch, dir)) // return 0; //if (!leave_wtrigger (&world[IN_ROOM (ch)], ch, dir)) // return 0; if (character.AffectFlagged (AffectFlags.Charm) && character.Master != null && character.InRoom == character.Master.InRoom) { SendToCharacter (character, "The thought of leaving your master makes you weep.\r\n"); Act("$n bursts into tears.", false, character, null, null, GlobalConstants.TO_ROOM); return false; } if ((GetRoomSector (character.InRoom) == SectorTypes.WaterNoSwim) || GetRoomSector (GetExit (character, direction).ToRoom) == SectorTypes.WaterNoSwim) { if (!HasBoat (character)) { SendToCharacter (character, "You need a boat to go there.\r\n"); return false; } } needMovement = (MovementLoss[(int)GetRoomSector (character.InRoom)] + MovementLoss[(int)GetRoomSector (GetExit (character, direction).ToRoom)]) / 2; if (character.Points.Move < needMovement && !character.IsNPC) { if (needsSpecialsCheck && character.Master != null) SendToCharacter (character, "You are too exhausted to follow.\r\n"); else SendToCharacter (character, "You are too exhausted.\r\n"); return false; } if (_rooms[character.InRoom].RoomFlagged (RoomFlags.Atrium)) { if (!HouseCanEnter (character, GetRoomVirtualNumber (GetExit (character, direction).ToRoom))) { SendToCharacter (character, "That's private property -- no trespassing!\r\n"); return false; } } if (_rooms[GetExit (character, direction).ToRoom].RoomFlagged (RoomFlags.Tunnel) && NumberOfPCInRoom (_rooms[GetExit (character, direction).ToRoom]) >= GlobalSettings.TunnelSize) { if (GlobalSettings.TunnelSize > 1) SendToCharacter (character, "There isn't enough room for you to go there!\r\n"); else SendToCharacter (character, "There isn't enough room there for more than one person!\r\n"); return false; } if (_rooms[GetExit (character, direction).ToRoom].RoomFlagged (RoomFlags.GodRoom) && character.Level < GlobalConstants.LVL_GRGOD) { SendToCharacter (character, "You aren't godly enough to use that room!\r\n"); return false; } if (character.Level < GlobalConstants.LVL_IMMORT && !character.IsNPC) character.Points.Move -= needMovement; if (!character.AffectFlagged (AffectFlags.Sneak)) { Act("$n leaves "+GlobalConstants.Directions[(int)direction], true, character, null, null, GlobalConstants.TO_ROOM); } int wasInRoom = character.InRoom; CharacterFromRoom (character); CharacterToRoom (character, _rooms[wasInRoom].DirectionOptions[(int)direction].ToRoom); // Trigger Stuff /* move them first, then move them back if they aren't allowed to go. */ /* see if an entry trigger disallows the move */ //if (!entry_mtrigger(ch) || !enter_wtrigger(&world[IN_ROOM(ch)], ch, dir)) //{ //char_from_room(ch); //char_to_room(ch, was_in); //return 0; //} if (!character.AffectFlagged (AffectFlags.Sneak)) Act ("$n has arrived.", true, character, null, null, GlobalConstants.TO_ROOM); if (character.Descriptor != null) //LookAtRoom (character, 0); if (_rooms[character.InRoom].RoomFlagged (RoomFlags.Death) && character.Level < GlobalConstants.LVL_IMMORT) { //LogDeathTrap (character); //DeathCry (character); //ExtractCharacter (character); return false; } //entry_memory_mtrigger (ch); //if (!greet_mtrigger (ch, dir)) //{ // char_from_room (ch); // char_to_room (ch, was_in); // look_at_room (ch, 0); //} //else // greet_memory_mtrigger (ch); return true; }