public override void OnDoubleClick(Mobile from) { PlayerMobile player = from as PlayerMobile; if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } if (player.IsUOACZUndead) { return; } if (player.IsUOACZHuman) { if (!from.InRange(GetWorldLocation(), InteractionRange)) { from.SendMessage("That is too far away."); return; } base.OnDoubleClick(from); return; } }
public override bool OnBeforeDeath() { foreach (Mobile mobile in m_EngulfedMobiles) { if (mobile == null) { continue; } if (mobile.Deleted) { continue; } mobile.Squelched = false; mobile.Hidden = false; if (!UOACZSystem.IsUOACZValidMobile(mobile)) { continue; } TimedStatic ichor = new TimedStatic(Utility.RandomList(4650, 4651, 4652, 4653, 4654, 4655), 5); ichor.Hue = 2051; ichor.Name = "ichor"; ichor.MoveToWorld(mobile.Location, mobile.Map); Effects.PlaySound(mobile.Location, mobile.Map, Utility.RandomList(0x101)); } return(base.OnBeforeDeath()); }
public override void OnSingleClick(Mobile from) { LabelTo(from, Name); if (from.AccessLevel > AccessLevel.Player) { LabelTo(from, "(" + YieldsRemaining.ToString() + " items remaining)"); } PlayerMobile player = from as PlayerMobile; if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } int interactionCount = GetInteractions(player); if (from.AccessLevel == AccessLevel.Player) { if (YieldsRemaining == 0 || interactionCount >= MaxPlayerInteractions) { LabelTo(from, NoYieldRemainingSingleClickText); } } if (Locked) { LabelTo(from, LockedSingleClickText); } }
public override void OnSingleClick(Mobile from) { LabelTo(from, DisplayName + " Stockpile"); LabelTo(from, "[Durability: " + HitPoints.ToString() + "/" + MaxHitPoints.ToString() + "]"); PlayerMobile player = from as PlayerMobile; if (player == null) { return; } if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } if (!player.IsUOACZHuman) { return; } if (player.m_UOACZAccountEntry.HumanProfile.Stockpile == null) { return; } LabelTo(from, "Your Items: " + player.m_UOACZAccountEntry.HumanProfile.Stockpile.TotalItems.ToString() + " / " + player.m_UOACZAccountEntry.HumanProfile.Stockpile.MaxItems.ToString() + ""); }
public override void OnDoubleClick(Mobile from) { PlayerMobile player = from as PlayerMobile; if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } if (!player.IsUOACZHuman) { return; } Item item = from.FindItemOnLayer(Server.Layer.TwoHanded); if (item != this) { from.SendMessage("You must equip this fishing pole in order to use it."); return; } if (!player.CanBeginAction(typeof(UOACZBaseScavengeObject))) { player.SendMessage("You must wait a moment before using that."); return; } from.SendMessage("Target the fishing location to fish from."); from.Target = new UOACZFishingTarget(this); }
public override void OnDoubleClick(Mobile from) { PlayerMobile player = from as PlayerMobile; if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } if (!player.IsUOACZHuman) { return; } Item oneHand = from.FindItemOnLayer(Layer.OneHanded); Item firstValid = from.FindItemOnLayer(Layer.FirstValid); if (!(oneHand == this || firstValid == this)) { from.SendMessage("You must equip this pickaxe in order to use it."); return; } if (!player.CanBeginAction(typeof(UOACZBaseScavengeObject))) { player.SendMessage("You must wait a moment before using that."); return; } from.SendMessage("Target the rock formation to mine."); from.Target = new UOACZMiningTarget(this); }
public override void OnDoubleClick(Mobile from) { base.OnDoubleClick(from); PlayerMobile player = from as PlayerMobile; if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } if (!player.IsUOACZHuman) { return; } if (!IsChildOf(from.Backpack)) { from.SendMessage("That item must be in your pack in order to use it."); return; } if (!from.CanBeginAction(typeof(UOACZOilFlask))) { from.SendMessage("You must wait a few moments before using another oil flask."); return; } player.SendMessage("Target a location to create an oil surface at."); player.Target = new OilFlaskTarget(this); }
public virtual bool CanInteract(PlayerMobile player) { bool canInteract = true; if (!UOACZSystem.IsUOACZValidMobile(player)) { return(false); } return(canInteract); }
public override void DoAction(PlayerMobile player) { if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } player.Animate(32, 5, 1, true, false, 0); player.RevealingAction(); Effects.PlaySound(player.Location, player.Map, 0x3E3); }
public override void DoAction(PlayerMobile player) { if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } player.Animate(12, 7, 1, true, false, 0); player.PlaySound(Utility.RandomList(0x125, 0x126)); player.RevealingAction(); }
protected override void OnTarget(Mobile from, object target) { PlayerMobile player = from as PlayerMobile; if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } if (!player.IsUOACZHuman) { return; } if (m_ConstructionDeed == null) { return; } if (m_ConstructionDeed.Deleted) { return; } if (!m_ConstructionDeed.IsChildOf(from.Backpack)) { player.SendMessage("That item must be in your pack in order to use it."); return; } if (target is UOACZConstructionTile) { UOACZConstructionTile constructionTile = target as UOACZConstructionTile; if (Utility.GetDistance(player.Location, constructionTile.Location) > 1 || (Math.Abs(player.Location.Z - constructionTile.Location.Z) > 20)) { player.SendMessage("You are too far away from that construction location."); return; } if (constructionTile.Constructable != null) { player.SendMessage("That construction location already has something under construction."); return; } constructionTile.PlaceObject(player, m_ConstructionDeed); } else { player.SendMessage("That is not a valid construction location."); return; } }
public override void OnDoubleClick(Mobile from) { base.OnDoubleClick(from); PlayerMobile player = from as PlayerMobile; if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } if (!player.IsUOACZHuman) { return; } if (!IsChildOf(player.Backpack)) { player.SendMessage("That item must be in your pack in order to use it."); return; } if (!player.CanBeginAction(typeof(UOACZRepairHammer))) { player.SendMessage("You are already using a repair hammer."); return; } if (m_Owner != null && m_Owner != player) { player.SendMessage("Someone else is using that repair hammer."); return; } if (!player.CanBeginAction(typeof(BreakableStatic))) { player.SendMessage("You must wait a few moments before attempting another action."); return; } if (GetNearbyBreakableStatics(player).Count == 0) { player.SendMessage("There are no nearby objects in need of repairs."); return; } m_Timer = null; m_Timer = new InternalTimer(this, player); m_Timer.Start(); player.SendMessage("You begin making repairs."); }
public override void OnDoubleClick(Mobile from) { PlayerMobile player = from as PlayerMobile; if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } if (player.IsUOACZUndead) { base.OnDoubleClick(player); return; } else if (player.IsUOACZHuman) { if (!from.InRange(GetWorldLocation(), InteractionRange)) { from.SendMessage("That is too far away."); return; } bool needStockpile = false; if (player.m_UOACZAccountEntry.HumanProfile.Stockpile == null) { needStockpile = true; } if (player.m_UOACZAccountEntry.HumanProfile.Deleted == null) { needStockpile = true; } if (needStockpile) { player.m_UOACZAccountEntry.HumanProfile.Stockpile = new UOACZStockpileContainer(player.m_UOACZAccountEntry.m_AccountUsername); } player.m_UOACZAccountEntry.HumanProfile.Stockpile.AccountEntry = player.m_UOACZAccountEntry; Point3D newLocation = new Point3D(Location.X, Location.Y, Location.Z); player.m_UOACZAccountEntry.HumanProfile.Stockpile.MoveToWorld(newLocation, from.Map); player.m_UOACZAccountEntry.HumanProfile.Stockpile.Z -= 1; player.m_UOACZAccountEntry.HumanProfile.Stockpile.Open(from); } }
public override bool CanInteract(PlayerMobile player) { if (!UOACZSystem.IsUOACZValidMobile(player)) { return(false); } if (!player.IsUOACZHuman) { return(false); } Item oneHand = player.FindItemOnLayer(Layer.OneHanded); Item firstValid = player.FindItemOnLayer(Layer.FirstValid); if (!(oneHand is UOACZPickaxe || firstValid is UOACZPickaxe)) { player.SendMessage("You must equip this pickaxe in order to use it."); return(false); } UOACZPickaxe pickaxe = null; if (oneHand is UOACZPickaxe) { pickaxe = oneHand as UOACZPickaxe; } if (firstValid is UOACZPickaxe) { pickaxe = firstValid as UOACZPickaxe; } if (pickaxe == null) { return(false); } if (pickaxe.UsesRemaining > 1) { pickaxe.UsesRemaining--; } else { pickaxe.Delete(); } return(base.CanInteract(player)); }
public override bool OnMoveOver(Mobile mobile) { if (!UOACZSystem.IsUOACZValidMobile(mobile)) { return(true); } mobile.FixedParticles(0x374A, 10, 20, 5021, 0x110, 0, EffectLayer.Head); mobile.PlaySound(m_HitSound); Poison poison = Poison.GetPoison(Utility.RandomMinMax(0, 1)); mobile.ApplyPoison(m_Owner, poison); return(true); }
public override void OnMiss(Mobile attacker, Mobile defender) { double arrowChance = 0.4; if (UOACZSystem.IsUOACZValidMobile(attacker)) { arrowChance = .66; } if (attacker.Player && arrowChance >= Utility.RandomDouble() && !DuelContext.IsFreeConsume(attacker)) { Ammo.MoveToWorld(new Point3D(defender.X + Utility.RandomMinMax(-1, 1), defender.Y + Utility.RandomMinMax(-1, 1), defender.Z), defender.Map); } base.OnMiss(attacker, defender); }
public bool CanRepair(Mobile from, Item item, double value, bool message) { bool canRepair = true; PlayerMobile player = from as PlayerMobile; if (!UOACZSystem.IsUOACZValidMobile(player)) { return(false); } if (!player.IsUOACZHuman) { return(false); } if (!AllowRepair) { if (message) { player.SendMessage("That is not repairable."); } return(false); } if (!player.InRange(GetWorldLocation(), InteractionRange)) { if (message) { player.SendMessage("That is too far away."); } return(false); } if (HitPoints == MaxHitPoints) { if (message) { player.SendMessage("That is not damaged."); } return(false); } return(canRepair); }
protected override bool OnMove(Direction d) { foreach (Mobile mobile in m_EngulfedMobiles) { if (mobile == null) { continue; } if (mobile.Deleted) { continue; } if (!UOACZSystem.IsUOACZValidMobile(mobile)) { continue; } if (Utility.GetDistance(mobile.Location, Location) >= 12) { continue; } PlayerMobile player = mobile as PlayerMobile; if (player != null) { if (!player.IsUOACZHuman) { continue; } } mobile.Location = Location; } if (Utility.RandomDouble() <= .33) { TimedStatic ichor = new TimedStatic(Utility.RandomList(4650, 4651, 4652, 4653, 4654, 4655), 5); ichor.Hue = 2051; ichor.Name = "ichor"; ichor.MoveToWorld(Location, Map); Effects.PlaySound(Location, Map, Utility.RandomList(0x101)); } return(base.OnMove(d)); }
public override void ResolveTrap(Mobile from) { PublicOverheadMessage(MessageType.Regular, UOACZSystem.yellowTextHue, false, ScavengeUndeadTrapText); int creatures = (int)(Math.Ceiling((double)TrapDifficulty / 50)); for (int a = 0; a < creatures; a++) { Point3D spawnLocation = new Point3D(Location.X + Utility.RandomList(-1, 1), Location.Y + Utility.RandomList(-1, 1), Location.Z); SpellHelper.AdjustField(ref spawnLocation, Map, 12, false); int threatLevel = UOACZPersistance.m_ThreatLevel - 30; UOACZBaseUndead bc_Creature = (UOACZBaseUndead)Activator.CreateInstance(UOACZBaseUndead.GetRandomUndeadType(0, threatLevel)); if (bc_Creature != null) { if (Map.CanSpawnMobile(spawnLocation)) { bc_Creature.MoveToWorld(spawnLocation, Map); } else { if (UOACZSystem.IsUOACZValidMobile(from)) { spawnLocation = new Point3D(from.Location.X + Utility.RandomList(-1, 1), from.Location.Y + Utility.RandomList(-1, 1), from.Location.Z); SpellHelper.AdjustField(ref spawnLocation, Map, 12, false); if (Map.CanSpawnMobile(spawnLocation)) { bc_Creature.MoveToWorld(spawnLocation, Map); } else { bc_Creature.MoveToWorld(from.Location, Map); } } } } } TrapType = ScavengeTrapType.None; }
public override void OnHit(Mobile attacker, Mobile defender, double damageBonus) { double arrowChance = 0.4; if (UOACZSystem.IsUOACZValidMobile(attacker)) { arrowChance = .66; } if (attacker.Player && !defender.Player && (defender.Body.IsAnimal || defender.Body.IsMonster) && arrowChance >= Utility.RandomDouble()) { defender.AddToBackpack(Ammo); } base.OnHit(attacker, defender, damageBonus); if (!(attacker is PlayerMobile && defender is PlayerMobile)) { AttemptWeaponPoison(attacker, defender); } }
public override void OnDoubleClick(Mobile from) { PlayerMobile player = from as PlayerMobile; if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } if (!player.IsUOACZHuman) { return; } if (!IsChildOf(from.Backpack)) { from.SendMessage("That item must be in your pack in order to use it."); return; } player.SendMessage("Target the construction site for this item."); player.Target = new ConstructionTileTarget(this); }
public override void OnDoubleClick(Mobile from) { PlayerMobile player = from as PlayerMobile; if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } if (!player.IsUOACZHuman) { return; } if (!player.CanBeginAction(typeof(UOACZTorch))) { player.SendMessage("You may only use a torch once every " + CooldownSeconds.ToString() + " seconds."); return; } player.SendMessage("Target a creature or location to throw the torch at."); player.Target = new TorchThrowTarget(this); }
public override void DoAction(PlayerMobile player) { if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } player.Animate(11, 5, 1, true, false, 0); player.RevealingAction(); Point3D location = Location; Map map = Map; Effects.PlaySound(player.Location, player.Map, 0x33C); IEntity startLocation = new Entity(Serial.Zero, new Point3D(player.X, player.Y, player.Z + 10), player.Map); IEntity endLocation = new Entity(Serial.Zero, new Point3D(location.X, location.Y, location.Z), map); Effects.SendMovingEffect(startLocation, endLocation, 574, 5, 0, false, false, 0, 0); double distance = Utility.GetDistanceToSqrt(startLocation.Location, endLocation.Location); double destinationDelay = (double)distance * .12; Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate { if (!UOACZPersistance.Active) { return; } Effects.SendLocationEffect(location, map, 0x352D, 16, 4); Effects.PlaySound(location, map, 0x364); TimedStatic bobber = new TimedStatic(574, ScavengeDuration.TotalSeconds - .5); bobber.Name = "fishing bobber"; bobber.MoveToWorld(location, map); }); }
public override void OnDoubleClick(Mobile from) { PlayerMobile player = from as PlayerMobile; if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } if (!player.IsUOACZHuman) { return; } if (DamageState == DamageStateType.Broken || DamageState == DamageStateType.HeavilyDamaged) { player.SendMessage("This must be repaired before it may be used."); return; } if (m_NextTimeUsable > DateTime.UtcNow) { string cooldownRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, m_NextTimeUsable, false, true, true, true, true); player.SendMessage("You must wait " + cooldownRemaining + " before that may be used again."); return; } if (Utility.GetDistance(player.Location, Location) > 1 || (Math.Abs(player.Location.Z - Location.Z) > 20)) { player.SendMessage("You are too far away from that to use it."); return; } player.SendMessage("Target the location you wish to pour the cauldron onto."); player.Target = new CauldronTarget(this); }
public virtual void Interact(Mobile from, InteractionType interactionType) { if (from == null) { return; } if (!from.CanBeginAction(typeof(BreakableStatic))) { from.SendMessage("You must wait a few moments before attempting to use that again."); return; } if (interactionType == InteractionType.None) { from.SendMessage("That cannot be interacted with in that way."); return; } PlayerMobile player = from as PlayerMobile; BaseCreature bc_Creature = from as BaseCreature; from.RevealingAction(); BeforeInteract(from, interactionType); TimeSpan usageDelay = GetInteractCooldown(from, interactionType); BaseWeapon weapon; from.BeginAction(typeof(BreakableStatic)); Timer.DelayCall(usageDelay, delegate { if (from != null) { from.EndAction(typeof(BreakableStatic)); } }); if (interactionType == InteractionType.Lumberjacking || interactionType == InteractionType.Mining || interactionType == InteractionType.Normal || interactionType == InteractionType.Weapon) { Timer.DelayCall(usageDelay + TimeSpan.FromSeconds(1), delegate { if (player != null && !Deleted) { OnDoubleClick(player); } }); } int damage = 0; double randomScalar = (double)(Utility.RandomMinMax(75, 125)) / 100; Direction direction; switch (interactionType) { case InteractionType.None: return; break; case InteractionType.Normal: damage = (int)(Math.Round((double)(Utility.RandomMinMax(m_MinInteractDamage, m_MaxInteractDamage)) * InteractDamageScalar)); direction = from.GetDirectionTo(Location); if (direction != from.Direction) { from.Direction = direction; } Timer.DelayCall(TimeSpan.FromSeconds(.25), delegate { if (from == null) { return; } if (!from.Alive) { return; } from.Animate(12, 5, 1, true, false, 0); from.RevealingAction(); Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate { if (from == null) { return; } if (!from.Alive) { return; } Effects.PlaySound(from.Location, from.Map, m_HitSound); }); }); break; case InteractionType.Weapon: weapon = from.Weapon as BaseWeapon; if (weapon != null) { int minDamage = weapon.MinDamage; int maxDamage = weapon.MaxDamage; if (bc_Creature != null) { minDamage = bc_Creature.DamageMin; maxDamage = bc_Creature.DamageMax; } if ((weapon is Pickaxe || weapon is Hatchet)) { minDamage = 10; maxDamage = 20; } if (UOACZSystem.IsUOACZValidMobile(player)) { if (player.IsUOACZUndead) { minDamage = player.m_UOACZAccountEntry.UndeadProfile.DamageMin; maxDamage = player.m_UOACZAccountEntry.UndeadProfile.DamageMax; } } if (minDamage < m_MinInteractDamage) { minDamage = m_MinInteractDamage; } if (maxDamage < m_MaxInteractDamage) { maxDamage = m_MaxInteractDamage; } damage = (int)(Math.Round((double)(Utility.RandomMinMax(minDamage, maxDamage)) * WeaponDamageScalar)); } direction = from.GetDirectionTo(Location); if (direction != from.Direction) { from.Direction = direction; } Timer.DelayCall(TimeSpan.FromSeconds(.25), delegate { if (from == null) { return; } if (!from.Alive) { return; } if (bc_Creature != null) { UOACZBaseUndead undeadCreature = bc_Creature as UOACZBaseUndead; if (undeadCreature != null) { undeadCreature.m_LastActivity = DateTime.UtcNow; } if (weapon != null) { weapon.PlaySwingAnimation(bc_Creature); } } else { from.Animate(12, 5, 1, true, false, 0); } from.RevealingAction(); Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate { if (from == null) { return; } if (!from.Alive) { return; } Effects.PlaySound(from.Location, from.Map, m_HitSound); }); }); break; case InteractionType.Lockpick: damage = (int)(Math.Round(from.Skills.Lockpicking.Value * LockpickDamageScalar * randomScalar)); if (damage < 20) { damage = 20; } direction = from.GetDirectionTo(Location); if (direction != from.Direction) { from.Direction = direction; } Timer.DelayCall(TimeSpan.FromSeconds(.25), delegate { if (from == null) { return; } if (!from.Alive) { return; } from.Animate(32, 5, 1, true, false, 0); from.RevealingAction(); Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate { if (from == null) { return; } if (!from.Alive) { return; } Effects.PlaySound(from.Location, from.Map, 0x241); }); }); break; case InteractionType.Mining: bool validMiningItem = false; Item equippedItem = from.FindItemOnLayer(Layer.FirstValid); if (equippedItem is Pickaxe || equippedItem is SturdyPickaxe || equippedItem is DiamondPickaxe) { validMiningItem = true; } if (validMiningItem) { damage = (int)(Math.Round(from.Skills.Mining.Value * MiningDamageScalar * randomScalar)); if (damage < 20) { damage = 20; } } direction = from.GetDirectionTo(Location); if (direction != from.Direction) { from.Direction = direction; } Timer.DelayCall(TimeSpan.FromSeconds(.25), delegate { if (from == null) { return; } if (!from.Alive) { return; } from.Animate(Utility.RandomList(11, 12), 5, 1, true, false, 0); from.RevealingAction(); Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate { if (from == null) { return; } if (!from.Alive) { return; } Effects.PlaySound(from.Location, from.Map, m_HitSound); }); }); break; case InteractionType.Lumberjacking: weapon = from.Weapon as BaseWeapon; if (weapon != null && (weapon is BaseAxe)) { damage = (int)(Math.Round(from.Skills.Lumberjacking.Value * LumberjackingDamageScalar * randomScalar)); if (damage < 20) { damage = 20; } } direction = from.GetDirectionTo(Location); if (direction != from.Direction) { from.Direction = direction; } Timer.DelayCall(TimeSpan.FromSeconds(.25), delegate { if (from == null) { return; } if (!from.Alive) { return; } from.Animate(12, 5, 1, true, false, 0); from.RevealingAction(); Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate { if (from == null) { return; } if (!from.Alive) { return; } Effects.PlaySound(from.Location, from.Map, m_HitSound); }); }); break; } if (damage < 1) { damage = 1; } ReceiveDamage(from, damage, interactionType); AfterInteract(from, interactionType); }
public virtual void ForceLock(PlayerMobile player) { if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } BaseWeapon weapon = player.Weapon as BaseWeapon; double usageDelay = ScavengeDuration.TotalSeconds; int damage = 5; if (weapon != null) { int minDamage = weapon.MinDamage; int maxDamage = weapon.MaxDamage; double strScalar = (double)player.Str / 100; double tacticsScalar = player.Skills.Tactics.Value / 100; if (weapon is Pickaxe || weapon is Hatchet) { minDamage = 10; maxDamage = 20; } damage = (int)(Math.Round(strScalar * tacticsScalar * (double)(Utility.RandomMinMax(weapon.MinDamage, weapon.MaxDamage)))); if (damage < 1) { damage = 1; } usageDelay = weapon.GetDelay(player, false).TotalSeconds; } Direction direction = player.GetDirectionTo(Location); if (direction != player.Direction) { player.Direction = direction; } TimeSpan startDelay = TimeSpan.FromSeconds(.25); TimeSpan endDelay = TimeSpan.FromSeconds(.5); double totalActionTime = startDelay.TotalSeconds + usageDelay; player.BeginAction(typeof(UOACZBaseScavengeObject)); Timer.DelayCall(TimeSpan.FromSeconds(totalActionTime) + ScavengeCooldown, delegate { if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } player.EndAction(typeof(UOACZBaseScavengeObject)); }); Timer.DelayCall(startDelay, delegate { if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } player.Animate(12, 5, 1, true, false, 0); player.RevealingAction(); Timer.DelayCall(endDelay, delegate { if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } if (Utility.GetDistance(player.Location, Location) > InteractionRange) { player.SendMessage("You are too far away to continue using that."); return; } Effects.PlaySound(player.Location, player.Map, m_HitSound); ReceiveDamage(player, damage); }); }); }
public virtual void ScavengeResult(PlayerMobile player, bool lockpickAttempt) { if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } double searcherChance = player.GetSpecialAbilityEntryValue(SpecialAbilityEffect.Searcher); if (!lockpickAttempt) { if (Utility.RandomDouble() > searcherChance) { if (m_Interactors.ContainsKey(player)) { m_Interactors[player]++; } else { m_Interactors.Add(player, 1); } } } bool success = false; bool trapped = false; if (TrapType != ScavengeTrapType.None) { trapped = true; } bool scavengeResult = GetScavengeResult(player, lockpickAttempt); bool ignoreTrap = false; if (YieldsRemaining == 0) { scavengeResult = false; ignoreTrap = true; } if (m_TrapImmunePlayers.ContainsKey(player)) { ignoreTrap = true; } bool resolveTrap = false; if (TrapType != ScavengeTrapType.None && !ignoreTrap) { if (Utility.RandomDouble() <= m_TrapResolveChance) { resolveTrap = true; } double removeTrapSkill = player.Skills.RemoveTrap.Value / 100; if (Utility.RandomDouble() <= removeTrapSkill) { resolveTrap = false; if (player.NetState != null) { player.PrivateOverheadMessage(MessageType.Regular, 0, false, "*there is something amiss here*", player.NetState); } } } if (scavengeResult) { Item item = ResolveLoot(player); if (item != null) { if (trapped && resolveTrap && !ignoreTrap) { player.SendMessage(ScavengeResultSuccessWithTrapText); } else { player.SendMessage(ScavengeResultSuccessText); } } string itemName = item.Name; if (itemName == "" || itemName == null) { if (item is BaseWeapon) { itemName = "a weapon"; } if (item is BaseArmor) { itemName = "some armor"; } if (item is BaseShield) { itemName = "a shield"; } } if (item.Amount > 1) { player.SendMessage(UOACZSystem.lightGreenTextHue, "You find: " + itemName + " (" + item.Amount.ToString() + ")"); } else { player.SendMessage(UOACZSystem.lightGreenTextHue, "You find: " + itemName); } } else { if (trapped && resolveTrap && !ignoreTrap) { player.SendMessage(ScavengeResultFailWithTrapText); } else { player.SendMessage(ScavengeResultFailText); } } if (resolveTrap) { ResolveTrap(player); } }
public virtual void RemoveTrap(Mobile from) { PlayerMobile player = from as PlayerMobile; if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } if (m_TrapImmunePlayers.ContainsKey(player)) { player.SendMessage("You are confident you will not suffer any ill effects from whatever lies within."); player.SendSound(0x5AA); return; } Direction direction = player.GetDirectionTo(Location); if (direction != player.Direction) { player.Direction = direction; } TimeSpan startDelay = TimeSpan.FromSeconds(.25); double totalInteractTime = startDelay.TotalSeconds + ScavengeDuration.TotalSeconds; SpecialAbilities.HinderSpecialAbility(1.0, null, player, 1.0, totalInteractTime, true, 0, false, "", "You begin to examine the object.", "-1"); player.BeginAction(typeof(UOACZBaseScavengeObject)); Timer.DelayCall(TimeSpan.FromSeconds(totalInteractTime) + ScavengeCooldown, delegate { if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } player.EndAction(typeof(UOACZBaseScavengeObject)); }); Timer.DelayCall(startDelay, delegate { if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } player.Animate(32, 5, 1, true, false, 0); player.RevealingAction(); double removeTrapSkill = player.Skills.RemoveTrap.Value / 100; if (Utility.RandomDouble() <= removeTrapSkill || TrapType == ScavengeTrapType.None) { m_TrapImmunePlayers.Add(player, 500); player.SendMessage("You are confident you will not suffer any ill effects from whatever lies within."); player.SendSound(0x5AA); } else { player.SendMessage("You are unsure of what lies within the object."); return; } }); }
public virtual void LockpickInteract(PlayerMobile player, UOACZLockpickKit lockpickKit) { if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } Direction direction = player.GetDirectionTo(Location); if (direction != player.Direction) { player.Direction = direction; } TimeSpan startDelay = TimeSpan.FromSeconds(.25); double totalInteractTime = startDelay.TotalSeconds + ScavengeDuration.TotalSeconds; lockpickKit.Charges--; if (lockpickKit.Charges <= 0) { lockpickKit.Delete(); } SpecialAbilities.HinderSpecialAbility(1.0, null, player, 1.0, totalInteractTime, true, 0, false, "", InteractText, "-1"); player.BeginAction(typeof(UOACZBaseScavengeObject)); Timer.DelayCall(TimeSpan.FromSeconds(totalInteractTime) + ScavengeCooldown, delegate { if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } player.EndAction(typeof(UOACZBaseScavengeObject)); }); Timer.DelayCall(startDelay, delegate { if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } player.Animate(32, 5, 1, true, false, 0); player.RevealingAction(); Effects.PlaySound(player.Location, player.Map, 0x241); Timer.DelayCall(ScavengeDuration, delegate { if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } if (Utility.GetDistance(player.Location, Location) > InteractionRange) { player.SendMessage("You are too far away to continue using that."); return; } if (YieldsRemaining == 0) { player.SendMessage(NoYieldRemainingText); return; } ScavengeResult(player, true); }); }); }
public override void OnDoubleClick(Mobile from) { if (from.AccessLevel > AccessLevel.Player) { Open(from); return; } PlayerMobile player = from as PlayerMobile; if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } if (!player.IsUOACZHuman) { return; } if (Utility.GetDistance(player.Location, Location) > InteractionRange) { from.SendMessage("You are too far away to use that."); return; } if (!Map.InLOS(player.Location, Location)) { from.SendMessage("That is not within your line of sight."); return; } if (Locked) { if (!player.CanBeginAction(typeof(UOACZBaseScavengeObject))) { player.SendMessage("You must wait a moment before using that."); return; } ForceLock(player); return; } int searchCount = GetInteractions(player); if (YieldsRemaining == 0 || searchCount >= MaxPlayerInteractions) { player.SendMessage(NoYieldRemainingText); return; } else { if (!player.CanBeginAction(typeof(UOACZBaseScavengeObject))) { player.SendMessage("You must wait a moment before using that."); return; } if (!CanInteract(player)) { return; } Interact(player); return; } }