public void PlayerUnSelected(object sender, MovementEventArgs e) { ProceedCount--; switch (e.JoyStickID) { case 1: InputManager.GetComponent <InputManagerScript>().P1jumpInitiated += this.PlayerChosen; // InputManager.GetComponent<InputManagerScript>().P1movementChanged -= this.PlayerUnSelected; break; case 2: InputManager.GetComponent <InputManagerScript>().P2jumpInitiated += this.PlayerChosen; // InputManager.GetComponent<InputManagerScript>().P2movementChanged -= this.PlayerUnSelected; break; case 3: InputManager.GetComponent <InputManagerScript>().P3jumpInitiated += this.PlayerChosen; // InputManager.GetComponent<InputManagerScript>().P3movementChanged -= this.PlayerUnSelected; break; case 4: InputManager.GetComponent <InputManagerScript>().P4jumpInitiated += this.PlayerChosen; // InputManager.GetComponent<InputManagerScript>().P4movementChanged -= this.PlayerUnSelected; break; default: break; } }
public void Switch(object sender, MovementEventArgs e) { //this.transform.GetChild(0).GetComponent<Text>().text = "ID: " + e.JoyStickID.ToString() + "Value: " + e.XAxis.ToString(); this.transform.GetChild(1).GetComponent <Text>().text = "UnSelected"; GameManager.Current.players.Remove(e.JoyStickID);
//private void _locationService_LocationChanged(object sender, LocationEventArgs e) //{ // //this.LatitudeString = "Latitude: " + e.Latitude.ToString(); // //this.LongitudeString = "Longitude: " + e.Longitude.ToString(); // var updated = DateTime.Now; // this.LastUpdatedString = "Updated: " + updated.ToString() + "(" + (updated - _lastUpdated).Seconds + ")"; // _lastUpdated = updated; //} private void _movementService_CurrentPointChanged(object sender, MovementEventArgs e) { Task.Run(() => _scavengerService.Move(_scavengerId, e.CurrentPosition)); this.CurrentPointString = e.CurrentPosition.ToString(); this.HomeLocationString = $"Home: {_movementService.HomePositionLatitude},{_movementService.HomePositionLongitude}"; }
private void ActorUnitMoved(object sender, MovementEventArgs e) { var floor = Cell.GetComponent<FloorTile>(); if (floor != null) { //Item pickup if (floor.HasItem && !HasItem) { this.item = floor.RemoveItem(); FindObjectOfType<GameManager>().AcquiredTarget(this.item.Target); } //Win condition if(floor.Rune.HasValue && FindObjectOfType<GameManager>().HasAcquiredTarget(floor.Rune.Value)) { FindObjectOfType<GameManager>().playerEscaped++; RemoveLater(); return; } } //Move camera along with the player if (Camera.current != null) { var cameraController = Camera.current.GetComponent<CameraController>(); if (cameraController != null) { cameraController.target = e.DestinationCell.transform; } } }
public void PlayerChosen(object sender, MovementEventArgs e) { sfxSelect.Play(); ProceedCount++; switch (e.JoyStickID) { case 1: InputManager.GetComponent <InputManagerScript>().P1jumpInitiated -= this.PlayerChosen; //InputManager.GetComponent<InputManagerScript>().P1_X_Initiated += this.PlayerUnSelected; break; case 2: InputManager.GetComponent <InputManagerScript>().P2jumpInitiated -= this.PlayerChosen; //InputManager.GetComponent<InputManagerScript>().P2_X_Initiated += this.PlayerUnSelected; break; case 3: InputManager.GetComponent <InputManagerScript>().P3jumpInitiated -= this.PlayerChosen; //InputManager.GetComponent<InputManagerScript>().P3_X_Initiated += this.PlayerUnSelected; break; case 4: InputManager.GetComponent <InputManagerScript>().P4jumpInitiated -= this.PlayerChosen; //InputManager.GetComponent<InputManagerScript>().P4_X_Initiated += this.PlayerUnSelected; break; default: break; } }
void OnMove(IEventArgs eventArgs) { MovementEventArgs movementArgs = (MovementEventArgs)eventArgs; horizontalAxis = movementArgs.HorizonalAxis; verticalAxis = movementArgs.VerticalAxis; }
public static void EventSink_Movement(MovementEventArgs e) { Mobile from = e.Mobile; if (!from.Alive || from.AccessLevel > AccessLevel.Player) { return; } if (!from.Player) { // Else it won't work on monsters. Spells.Ninjitsu.DeathStrike.AddStep(from); return; } int maxWeight = GetMaxWeight(from) + OverloadAllowance; int overWeight = (Mobile.BodyWeight + from.TotalWeight) - maxWeight; if (overWeight > 0) { from.Stam -= GetStamLoss(from, overWeight, (e.Direction & Direction.Running) != 0); if (from.Stam == 0) { from.SendLocalizedMessage(500109); // You are too fatigued to move, because you are carrying too much weight! e.Blocked = true; return; } } Felladrin.Automations.RunningFatigue.Apply(from); Spells.Ninjitsu.DeathStrike.AddStep(from); }
protected virtual void P2_On_O_Pressed(MovementEventArgs e) { if (P2_O_Initiated != null) { P2_O_Initiated(this, e); } }
public static void EventSink_Movement(MovementEventArgs e) { Mobile from = e.Mobile; if (!from.Alive || from.AccessLevel > AccessLevel.Player) { return; } int maxWeight = GetMaxWeight(from) + OverloadAllowance; int overWeight = (Mobile.BodyWeight + from.TotalWeight) - maxWeight; if (overWeight > 0) { from.Stam -= GetStamLoss(from, overWeight, (e.Direction & Direction.Running) != 0); if (from.Stam == 0) { from.SendLocalizedMessage(500109); // You are too fatigued to move, because you are carrying too much weight! e.Blocked = true; return; } } if (from is PlayerMobile) { int amt = (from.Mounted ? 48 : 21); // IPY PlayerMobile pm = (PlayerMobile)from; if ((++pm.StepsTaken % amt) == 0) { --from.Stam; } } }
protected virtual void P3_On_Select_Pressed(MovementEventArgs e) { if (P3_Select_Initiated != null) { P3_Select_Initiated(this, e); } }
/// <summary> /// Raises an event associated with the move in the given direction. /// </summary> /// <param name="direction">The direction of the move.</param> protected virtual void RaiseMovementEvents(Direction direction) { RoutedEvent routedEvent; switch (direction) { case Direction.Left: routedEvent = MoveLeftEvent; break; case Direction.Right: routedEvent = MoveRightEvent; break; case Direction.Up: routedEvent = MoveUpEvent; break; case Direction.Down: routedEvent = MoveDownEvent; break; default: return; } MovementEventArgs e = new MovementEventArgs(direction, MovedEvent, this); MovementEventArgs e1 = new MovementEventArgs(direction, routedEvent, this); RaiseEvent(e); RaiseEvent(e1); }
private static void TrackPlayer(MovementEventArgs e, bool Penalty) { Mobile from = e.Mobile; // Look to see if we are already tracking this player if (m_doissier.ContainsKey(from.Serial) == false) { // add it m_doissier.Add(from.Serial, new Dossier()); } // okay process this player's Dossier Dossier dx = m_doissier[from.Serial]; // check the timeout if (dx.Timeout == true) { // start over with this guy. m_doissier.Remove(from.Serial); return; } // Mark the current time dx.MarkTime(); // handle the exploit 3 strikes and you're out // You get a Penalty point if you stepped off a porch onto a stack of > 3 items to begin with if ((++dx.InfractionCount + ((Penalty == true) ? 1 : 0)) >= 3) { BlockAndReport(e); } }
protected virtual void P4_On_START_Pressed(MovementEventArgs e) { if (P4_START_Initiated != null) { P4_START_Initiated(this, e); } }
protected virtual void P4_OnJumpInitiated(MovementEventArgs e) { if (P4jumpInitiated != null) { P4jumpInitiated(this, e); } }
void Navigate(object sender, MovementEventArgs e) { if (Mathf.Abs(e.YAxis) > 0.2f) { NavigateBetweenItemsInList(((e.YAxis > 0) ? 1 : ((e.YAxis == 0) ? 0 : -1))); } }
protected virtual void OnMovement(MovementEventArgs e) { if (BlockMovement && !IsDisposed && IsOpen && !Hidden && !e.Blocked && User.AccessLevel < AccessLevel.Counselor) { e.Blocked = true; } }
public static void OnMovementImpl(MovementEventArgs e) { var user = e.Mobile; if (user == null) { return; } lock (_InstanceLock) { if (!Instances.ContainsKey(user)) { return; } } VitaNexCore.TryCatch( () => { foreach (var g in EnumerateInstances <SuperGump>(user, true)) { g.OnMovement(e); } }, x => x.ToConsole(true)); }
public static void EventSink_Movement(MovementEventArgs e) { Mobile from = e.Mobile; if (!from.Alive || from.AccessLevel > AccessLevel.Player) { return; } if (!from.Player) { // Else it won't work on monsters. Spells.Ninjitsu.DeathStrike.AddStep(from); return; } int maxWeight = GetMaxWeight(from) + OverloadAllowance; int overWeight = (Mobile.BodyWeight + from.TotalWeight) - maxWeight; if (overWeight > 0) { from.Stam -= GetStamLoss(from, overWeight, (e.Direction & Direction.Running) != 0); if (from.Stam == 0) { from.SendLocalizedMessage(500109); // You are too fatigued to move, because you are carrying too much weight! e.Blocked = true; return; } } if (((from.Stam * 100) / Math.Max(from.StamMax, 1)) < 10) { --from.Stam; } if (from.Stam == 0) { from.SendLocalizedMessage(500110); // You are too fatigued to move. e.Blocked = true; return; } /* * if ( from is PlayerMobile & from.Running ) * { * PlayerMobile pm = (PlayerMobile)from; * * int hits = ( from.Hits * 100 ) / from.HitsMax; * * from.Stam -= Math.Max( (20 - hits) / 5, 0 ); //1 point per step for every 5% health below 20% * * int amt = (int)( ( from.Mounted ? ( m_MountSteps + ((from.Mount is FactionWarHorse) ? 10 : 0) ) : m_UnmountSteps ) * ( Math.Min( from.Dex, 90 ) / 90.0 ) ); * * if ( amt == 0 || (++pm.StepsTaken % amt) == 0 ) * --from.Stam; * } */ Spells.Ninjitsu.DeathStrike.AddStep(from); }
public static void EventSink_Movement( MovementEventArgs e ) { Mobile from = e.Mobile; if ( !from.Alive || from.AccessLevel > AccessLevel.Player ) return; if ( !from.Player ) { // Else it won't work on monsters. Spells.Ninjitsu.DeathStrike.AddStep( from ); return; } int maxWeight = GetMaxWeight( from ) + OverloadAllowance; int overWeight = (Mobile.BodyWeight + from.TotalWeight) - maxWeight; if ( overWeight > 0 ) { from.Stam -= GetStamLoss( from, overWeight, (e.Direction & Direction.Running) != 0 ); if ( from.Stam == 0 ) { from.SendLocalizedMessage( 500109 ); // You are too fatigued to move, because you are carrying too much weight! e.Blocked = true; return; } } Felladrin.Automations.RunningFatigue.Apply(from); Spells.Ninjitsu.DeathStrike.AddStep( from ); }
public static void EventSink_Movement(MovementEventArgs e) { if (!(e.Mobile is PlayerMobile) || e.Mobile.AccessLevel > AccessLevel.Player || e.Mobile.Mount != null || !e.Mobile.Alive) return; if ((e.Direction & Direction.Running) != 0) { PlayerMobile pm = e.Mobile as PlayerMobile; int steps; if (pm.Skills.Focus.Value < 20) steps = 8; else if (pm.Skills.Focus.Value < 40) steps = 7; else if (pm.Skills.Focus.Value < 60) steps = 6; else if (pm.Skills.Focus.Value < 80) steps = 4; else steps = 3; if ((pm.StepsTaken % steps) == 0) { --pm.Stam; if (pm.Stam == 1) pm.PlaySound(pm.Female ? 816 : 1090); } } }
private void AiUnitMoved(object sender, MovementEventArgs e) { var camera = FindObjectOfType<CameraController>(); if (sender is ShadowWorldUnit) { camera.target = (sender as ShadowWorldUnit).transform; } }
// Newly Added public void OnUnitMoved(object sender, MovementEventArgs args) { Debug.Log("Move from " + args.OriginCell.Location + " to " + args.DestinationCell.Location); if (UnitMoved != null) { UnitMoved.Invoke(this, args); } }
// TODO: Depracate // public bool CanMakeMoves() { // return gameRule.CanMakeMoves (gameState, _session.Id); // } private void OnUnitMoved(object sender, MovementEventArgs args) { TBSUnitGameMove move = new TBSUnitGameMove(); move.fromCell = args.OriginCell.Location; move.toCell = args.DestinationCell.Location; CommitMove(move); }
public static void EventSink_Movement(MovementEventArgs e) { Mobile from = e.Mobile; if (!from.Alive || from.AccessLevel > AccessLevel.Player) { return; } if (!from.Player) { // Else it won't work on monsters. Spells.Ninjitsu.DeathStrike.AddStep(from); return; } int maxWeight = GetMaxWeight(from) + OverloadAllowance; int overWeight = (Mobile.BodyWeight + from.TotalWeight) - maxWeight; if (overWeight > 0) { from.Stam -= GetStamLoss(from, overWeight, (e.Direction & Direction.Running) != 0); if (from.Stam == 0) { from.SendAsciiMessage("You are too fatigued to move."); // You are too fatigued to move, because you are carrying too much weight! e.Blocked = true; return; } } if (((from.Stam * 100) / Math.Max(from.StamMax, 1)) < 10) { --from.Stam; } if (from.Stam == 0) { from.SendAsciiMessage("You are too fatigued to move."); // You are too fatigued to move. e.Blocked = true; return; } double myrate = 1 / (0.043972 * Math.Pow(Math.E, 3.131 * (double)((double)(Mobile.BodyWeight + from.TotalWeight) / (double)GetMaxWeight(from)))); if (from is PlayerMobile) { int amt = (from.Mounted ? (int)(myrate * 48) : (int)(myrate * 16));//(int)((double)myrate * 16)); PlayerMobile pm = (PlayerMobile)from; if (amt != 0 && (++pm.StepsTaken % amt) == 0) { --from.Stam; } } Spells.Ninjitsu.DeathStrike.AddStep(from); }
protected override void OnMovement(MovementEventArgs e) { base.OnMovement(e); if (!User.InRange(Altar, 3)) { Close(true); } }
public static void EventSink_Movement(MovementEventArgs e) { var from = e.Mobile; if (!from.Alive || from.AccessLevel > AccessLevel.Player) { return; } if (!from.Player) { // Else it won't work on monsters. DeathStrike.AddStep(from); return; } var maxWeight = GetMaxWeight(from) + OverloadAllowance; var overWeight = Mobile.BodyWeight + from.TotalWeight - maxWeight; if (overWeight > 0) { from.Stam -= GetStamLoss(from, overWeight, (e.Direction & Direction.Running) != 0); if (from.Stam == 0) { from.SendLocalizedMessage( 500109 ); // You are too fatigued to move, because you are carrying too much weight! e.Blocked = true; return; } } if (from.Stam * 100 / Math.Max(from.StamMax, 1) < 10) { --from.Stam; } if (from.Stam == 0) { from.SendLocalizedMessage(500110); // You are too fatigued to move. e.Blocked = true; return; } if (from is PlayerMobile pm) { var amt = pm.Mounted ? 48 : 16; if (++pm.StepsTaken % amt == 0) { --pm.Stam; } } DeathStrike.AddStep(from); }
public static void EventSink_Movement(MovementEventArgs e) { Mobile from = e.Mobile; if (!from.Alive || from.AccessLevel > AccessLevel.Player) { return; } if (!from.Player) { // Else it won't work on monsters. /*Spells.Ninjitsu.DeathStrike.AddStep( from );*/ return; } int maxWeight = GetMaxWeight(from) + OverloadAllowance; int overWeight = (Mobile.BodyWeight + from.TotalWeight) - maxWeight; if (overWeight > 0) { from.Stam -= GetStamLoss(from, overWeight, (e.Direction & Direction.Running) != 0); if (from.Stam == 0) { from.SendLocalizedMessage(500109); // You are too fatigued to move, because you are carrying too much weight! e.Blocked = true; return; } } if (((from.Stam * 100) / Math.Max(from.StamMax, 1)) < 10) { --from.Stam; } if (from.Stam == 0) { from.SendLocalizedMessage(500110); // You are too fatigued to move. e.Blocked = true; return; } if (from is PlayerMobile) { int amt = (from.Mounted ? 48 : 16); PlayerMobile pm = (PlayerMobile)from; if ((++pm.StepsTaken % amt) == 0) { --from.Stam; } } /*Spells.Ninjitsu.DeathStrike.AddStep( from );*/ }
public void OnRightMovement(object source, MovementEventArgs e) { if ((transform.position.x <= -13f && e.Direction.x < 0) || (transform.position.x > 13f && e.Direction.x > 0) || (transform.position.y < -7.5f && e.Direction.y < 0) || (transform.position.y > 7.5f && e.Direction.y > 0)) { } else { transform.Translate(e.Direction * MovementSpeed * Time.deltaTime); } }
private static void EventSink_MovementSwampCheck(MovementEventArgs args) { Mobile mobile = args.Mobile; PlayerMobile pm = mobile as PlayerMobile; if (pm != null) { SwampCheck(pm); } }
public static void EventSink_Movement(MovementEventArgs e) { Mobile from = e.Mobile; if (!from.Alive || from.AccessLevel > AccessLevel.Player) { return; } if (!from.Player) { // Else it won't work on monsters. Spells.Ninjitsu.DeathStrike.AddStep(from); return; } int overWeight = (Mobile.BodyWeight + from.TotalWeight) - (GetMaxWeight(from) + OverloadAllowance); if (overWeight > 0) { from.Stam -= GetStamLoss(from, overWeight, (e.Direction & Direction.Running) != 0); if (from.Stam == 0) { from.SendLocalizedMessage(500109); // You are too fatigued to move, because you are carrying too much weight! e.Blocked = true; return; } } //if ( ((from.Stam * 100) / Math.Max( from.StamMax, 1 )) < 10 ) // --from.Stam; /* * if ( from is PlayerMobile && from.Running ) * { * PlayerMobile pm = (PlayerMobile)from; * * bool penalty = ( from.Hits * 100 ) / from.HitsMax < 20 && CheckCombat( from ); * * int amt = (int)( ( from.Mounted ? ( m_MountSteps + ((from.Mount is FactionWarHorse) ? 5 : 0) ) : m_UnmountSteps ) * ( Math.Min( from.Dex, penalty ? 90 : 50 ) / ( penalty ? 200.0 : 50.0 ) ) ); * * if ( amt == 0 || (++pm.StepsTaken % amt) == 0 ) * --from.Stam; * * if ( from.Stam == 0 ) * { * from.SendLocalizedMessage( 500110 ); // You are too fatigued to move. * e.Blocked = true; * return; * } * } */ Spells.Ninjitsu.DeathStrike.AddStep(from); }
void OnMovementMeasurementValueChanged(object sender, MovementEventArgs e) { movement = e.Measurement; if (_timer == null) { var nowait = Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, new Windows.UI.Core.DispatchedHandler(() => { StartTimer(); })); } }
public static void EventSink_Movement(MovementEventArgs e) { Mobile from = e.Mobile; if (!from.Alive || from.IsStaff()) { return; } if (!from.Player) { return; } int maxWeight = from.MaxWeight + OverloadAllowance; int overWeight = (Mobile.BodyWeight + from.TotalWeight) - maxWeight; if (overWeight > 0) { from.Stam -= GetStamLoss(from, overWeight, (e.Direction & Direction.Running) != 0); if (from.Stam == 0) { from.SendLocalizedMessage(500109); // You are too fatigued to move, because you are carrying too much weight! e.Blocked = true; return; } } if (!Core.SA && ((from.Stam * 100) / Math.Max(from.StamMax, 1)) < 10) { --from.Stam; } if (from.Stam == 0) { from.SendLocalizedMessage(from.Mounted ? 500108 : 500110); // Your mount is too fatigued to move. : You are too fatigued to move. e.Blocked = true; return; } var pm = from as PlayerMobile; if (pm != null) { int amt = Core.SA ? 10 : (from.Mounted ? 48 : 16); if ((++pm.StepsTaken % amt) == 0) { --from.Stam; } } }
public static void EventSink_Movement(MovementEventArgs e) { if (!Core.UOSP) //we don't do this for SP. { Mobile from = e.Mobile; if (!from.Player) { return; } if (from is PlayerMobile) { Account acct = from.Account as Account; if (acct.m_STIntervalStart + TimeSpan.FromMinutes(20.0) > DateTime.Now) {//within 20 minutes from last step - count step acct.m_STSteps++; } else { //ok, we're outside of a 20-minute period, //so see if they've moved enough within the last 10 //minutes... if so, increment time if (acct.m_STSteps > 50) { //Add an house to the house's refresh time BaseHouse house = null; for (int i = 0; i < 5; i++) { Mobile m = acct[i]; if (m != null) { ArrayList list = BaseHouse.GetHouses(m); if (list.Count > 0) { house = (BaseHouse)list[0]; break; } } } if (house != null) { house.RefreshHouseOneDay(); } } acct.m_STIntervalStart = DateTime.Now; acct.m_STSteps = 1; } } } }
protected virtual void P4_OnMovementChanged(MovementEventArgs e) { if (P4movementChanged != null && JoyStick_4_Enabled) { JoyStick_4_Enabled = false; P4movementChanged(this, e); #if UNITY_WSA_10_0 StartCoroutine(EnableJoyStick(4, 2f)); #else StartCoroutine(EnableJoyStick(4, 0.2f)); #endif } }
public override void OnMovement(MovementEventArgs e ) { base.OnMovement(e); if(e.Mobile == null || e.Mobile.AccessLevel > AccessLevel.Player) return; if(AttachedTo is Item && (((Item)AttachedTo).Parent == null) && Utility.InRange( e.Mobile.Location, ((Item)AttachedTo).Location, proximityrange )) { OnTrigger(null, e.Mobile); } else return; }
public static void EventSink_Movement(MovementEventArgs e) { Mobile from = e.Mobile; if (!from.Alive || from.IsStaff()) return; if (!from.Player) { // Else it won't work on monsters. Spells.Ninjitsu.DeathStrike.AddStep(from); return; } int maxWeight = GetMaxWeight(from) + OverloadAllowance; int overWeight = (Mobile.BodyWeight + from.TotalWeight) - maxWeight; if (overWeight > 0) { from.Stam -= GetStamLoss(from, overWeight, (e.Direction & Direction.Running) != 0); if (from.Stam == 0) { from.SendLocalizedMessage(500109); // You are too fatigued to move, because you are carrying too much weight! e.Blocked = true; return; } } if (((from.Stam * 100) / Math.Max(from.StamMax, 1)) < 10) --from.Stam; if (from.Stam == 0) { from.SendLocalizedMessage(500110); // You are too fatigued to move. e.Blocked = true; return; } if (from is PlayerMobile) { int amt = (from.Mounted ? 48 : 16); PlayerMobile pm = (PlayerMobile)from; if ((++pm.StepsTaken % amt) == 0) --from.Stam; } Spells.Ninjitsu.DeathStrike.AddStep(from); }
public static void EventSink_Movement( MovementEventArgs e ) { Mobile from = e.Mobile; if ( !from.IsPlayer || !from.Alive || from.AccessLevel >= AccessLevel.GameMaster ) return; bool isRunning = ( e.Direction & Direction.Running ) != 0; int maxWeight = GetMaxWeight( from ) + OverloadAllowance; int overWeight = ( Mobile.BodyWeight + from.TotalWeight ) - maxWeight; if ( overWeight > 0 ) { from.Stam -= GetStamLoss( from, overWeight, isRunning ); if ( from.Stam == 0 ) { from.SendLocalizedMessage( 500109 ); // You are too fatigued to move, because you are carrying too much weight! e.Blocked = true; return; } } if ( isRunning && ( ( from.Stam * 100 ) / Math.Max( from.StamMax, 1 ) ) < 10 ) --from.Stam; if ( from.Stam == 0 ) { from.SendLocalizedMessage( 500110 ); // You are too fatigued to move. e.Blocked = true; return; } if ( from is PlayerMobile ) { int amt = ( from.Mounted ? 48 : 16 ); PlayerMobile pm = (PlayerMobile) from; if ( ( ++pm.StepsTaken % amt ) == 0 ) --from.Stam; } }
public override void OnMovement(MovementEventArgs e) { Mobile m = e.Mobile; if (m == null || m.AccessLevel > TriggerAccessLevel) { return; } Point3D loc = new Point3D(0, 0, 0); Map map; if (AttachedTo is Mobile) { Mobile mob = AttachedTo as Mobile; loc = mob.Location; map = mob.Map; } else if (AttachedTo is Item && ((Item)AttachedTo).Parent == null) { Item i = AttachedTo as Item; loc = i.Location; map = i.Map; } // if proximity sensing is off, a speech entry has been activated, or player is an admin then ignore if (m_Running && m_ProximityRange >= 0 && ValidMovementTrig(m) && !IsActive && !m_HoldProcessing) { // check to see if player is within range of the npc if (Utility.InRange(m.Location, loc, m_ProximityRange)) { TimeSpan pause = TimeSpan.FromSeconds(0); if (CurrentEntry != null && CurrentEntry.Pause > 0) { pause = TimeSpan.FromSeconds(CurrentEntry.Pause); } // check to see if the current pause interval has elapsed if (DateTime.UtcNow - pause > m_LastInteraction) { // process speech that is not keyword dependent CheckForReset(); ProcessSpeech(m, null); } // turn on the timer that will run until the speech list is reset // it will control paused speech and will allow the speech entry to be reset after ResetTime timeout DoTimer(TimeSpan.FromSeconds(1), m); } } else { CheckForReset(); } base.OnMovement(e); }
public static MovementEventArgs Create( Mobile mobile, Direction dir ) { MovementEventArgs args; if ( m_Pool.Count > 0 ) { args = m_Pool.Dequeue(); args.m_Mobile = mobile; args.m_Direction = dir; args.m_Blocked = false; } else { args = new MovementEventArgs( mobile, dir ); } return args; }
public static void StamSystem_Movement(MovementEventArgs e) { Mobile from = e.Mobile; PlayerMobile pm = from as PlayerMobile; if (pm == null || (pm.LastPVP == DateTime.MinValue && pvpersonly) || !from.Alive || from.AccessLevel >= AccessLevel.GameMaster) { #region debug if (debug) from.SendMessage("MinValue"); #endregion return; } if (active_for_player(pm)) { Item m_item = from.FindItemOnLayer(Layer.Mount); MountItem m_mountitem; int m_mountstam = 0; bool m_running = false; // Check if the palyer runs or walkes and write it to m_running if ((e.Direction & Direction.Running) != 0) m_running = true; pm.StepsTaken++; // prepare mount handling m_mountitem = m_item as MountItem; if (m_mountitem != null && m_mountitem.Mount != null) { m_mountstam = ((Mobile)m_mountitem.Mount).Stam; if (m_mountitem.Mount is Xanthos.Evo.EvoHiryu) mount_stam_regen(mountregenrate, pm, MountKind.lichsteed); else mount_stam_regen(mountregenrate, pm, MountKind.normalmount); #region debug if (StamSystem.debug) { if (m_mountitem.Mount is EvoHiryu) { from.SendMessage("Mounted: LichSteed | Stam: " + m_mountstam); } else { from.SendMessage("Mounted: BaseMount | Stam: " + m_mountstam); } } #endregion } // prepare ethereal handling else if (m_item is EtherealMount) { m_mountstam = pm.EtherealStam; mount_stam_regen(ethyregenrate, pm, MountKind.ethereal); #region debug if (StamSystem.debug) from.SendMessage("Mounted: EthrealMount | Stam: " + m_mountstam); #endregion } // Handling on mount if (m_item != null && from.Mounted && from is PlayerMobile && m_running) { // when horse has no stam left, block the rider if (m_mountstam == 0) { from.SendMessage("Your mount is too fatigued to move."); e.Blocked = true; return; } // extra stam loss with low hits On Mount if (StamSystem.lowhitslossOnMount != 0 && ((from.Hits * 100) / Math.Max(from.HitsMax, 1)) < StamSystem.lowhitslossOnMount) { int stamUnitOnMounted = (m_item is EtherealMount) ? stamUnitLichSteed : stamUnitMount; if ((stamUnitOnMounted % 2) != 0) stamUnitOnMounted++; if ((pm.StepsTaken % (stamUnitOnMounted / 2)) == 0) { if (m_item is EtherealMount) pm.EtherealStam--; else ((Mobile)m_mountitem.Mount).Stam--; } } // Normal stam decreasement to the mount when its ridden if (m_item is EtherealMount) { if ((pm.StepsTaken % StamSystem.stamUnitMount) == 0) pm.EtherealStam--; } else if (m_mountitem != null && m_mountitem.Mount is Mobile && ((pm.StepsTaken % (m_mountitem.Mount is EvoHiryu ? StamSystem.stamUnitLichSteed : StamSystem.stamUnitMount)) == 0)) { ((Mobile)m_mountitem.Mount).Stam--; } // warning message to the rider, when the mount has 30 & 15 stam left if (m_mountstam == 30) { from.LocalOverheadMessage(MessageType.Regular, 0x49, false, "Your mount is tiring from running."); } else if (m_mountstam == 15) { from.LocalOverheadMessage(MessageType.Regular, 0x49, false, "Your mount is extremly fatigued."); } } // Handling w/o mount else if (from is PlayerMobile && m_running) { // when player has 0 stam, block him if (from.Stam == 0) { from.SendLocalizedMessage(500110); // You are too fatigued to move. e.Blocked = true; return; } // extra stam loss with low hits if (StamSystem.lowhitsloss != 0 && ((from.Hits * 100) / Math.Max(from.HitsMax, 1)) < StamSystem.lowhitsloss) { int evenUnitFoot = StamSystem.stamUnitFoot; if ((evenUnitFoot % 2) != 0) evenUnitFoot++; if ((pm.StepsTaken % (evenUnitFoot / 2)) == 0) --from.Stam; } // Normal decreasement by foot if ((pm.StepsTaken % StamSystem.stamUnitFoot) == 0) --from.Stam; } #region debug if (StamSystem.debug) { //Console.WriteLine("WARNING: Stamina System Debug enabled."); if ((e.Direction & Direction.Running) != 0) from.SendMessage("running"); else from.SendMessage("walking"); from.SendMessage("Player Stam: " + from.Stam); from.SendMessage("---"); } #endregion // debug } else { pm.LastPVP = DateTime.MinValue; } }
public virtual void OnMovement(MovementEventArgs args) { }
public void Move(MovementEventArgs e) { var_Previous_Position = var_Position; if (e.Movement == 0) { MoveLeft(); } if (e.Movement == 1) { MoveRight(); } if (e.Movement == 2) { MoveDown(); } if (e.Movement == 3) { MoveUp(); } if (!WithinBoundry()) { UndoMovement(); } PublishStateEvent(1, 0, 0, 0); }
public static void EventSink_Movement(MovementEventArgs args) { Mobile from = args.Mobile; if (!from.Player /* || from.AccessLevel > AccessLevel.Player */) { return; } // check for any items in the same sector if (from.Map != null) { IPooledEnumerable itemlist = from.Map.GetItemsInRange(from.Location, Map.SectorSize); if (itemlist != null) { foreach (Item i in itemlist) { if (i == null || i.Deleted) { continue; } ArrayList alist = FindAttachments(i); if (alist != null) { foreach (XmlAttachment a in alist) { if (a != null && !a.Deleted && a.HandlesOnMovement) { a.OnMovement(args); } } } } itemlist.Free(); } // check for mobiles IPooledEnumerable moblist = from.Map.GetMobilesInRange(from.Location, Map.SectorSize); if (moblist != null) { foreach (Mobile i in moblist) { // dont respond to self motion if (i == null || i.Deleted || i == from) { continue; } ArrayList alist = FindAttachments(i); if (alist != null) { foreach (XmlAttachment a in alist) { if (a != null && !a.Deleted && a.HandlesOnMovement) { a.OnMovement(args); } } } } moblist.Free(); } } }
public override void OnMovement(MovementEventArgs e) { base.OnMovement(e); if (this.UseEffectsDamageIndicator) { this.NeedsEffectsUpdate = true; // if the effects timer is not running if (this.m_EffectsTimer == null || !this.m_EffectsTimer.Running) { // then update effects damage display this.AdjustDamageEffects(); } } }
public void InvokeMovement( MovementEventArgs e ) { if ( Movement != null ) Movement( e ); }
private static void EventSink_Movement(MovementEventArgs e) { Mobile m = e.Mobile; if (m == null) return; Duel duel; if (m_DuelTable.TryGetValue(m.Serial, out duel)) { if (duel.Started && duel.CheckDistance()) duel.EndDuel(); } }