public static void ConsumePotion(PlayerMobile player, CustomAlchemyPotion potion) { if (player != null) { double cooldown = BaseCooldown; double alchemySkill = player.Skills.Alchemy.Value; cooldown -= (alchemySkill * AlchemySkillCooldownPerSkillPoint); TimeSpan cooldownDelay = TimeSpan.FromMinutes(cooldown); player.BeginAction(typeof(CustomAlchemyPotion)); Timer.DelayCall(cooldownDelay, delegate { if (player != null) { player.EndAction(typeof(CustomAlchemyPotion)); } }); } if (potion != null) { potion.Delete(); } }
public bool ApplyNightSight(PlayerMobile Wearer) { Spell spell = new NightSightSpell(Wearer, null); if (Wearer == null) { return(false); } if (Wearer.Region.OnBeginSpellCast(Wearer, spell) == false) { Wearer.SendMessage("The magic normally within this object seems absent."); return(false); } //Pix: this was borrowed from the NightSight spell... else if (Wearer.BeginAction(typeof(LightCycle))) { new LightCycle.NightSightTimer(Wearer).Start(); int level = 25; Wearer.LightLevel = level; Wearer.FixedParticles(0x376A, 9, 32, 5007, EffectLayer.Waist); Wearer.PlaySound(0x1E3); return(true); } return(false); }
public static void OnVirtueRejected(PlayerMobile protector, PlayerMobile protectee) { var args = $"{protector.Name}\t{protectee.Name}"; protectee.SendLocalizedMessage(1049453, args); // You have declined protection from ~1_NAME~. protector.SendLocalizedMessage(1049454, args); // ~2_NAME~ has declined your protection. if (protector.BeginAction <JusticeVirtue>()) { Timer.DelayCall(TimeSpan.FromMinutes(15.0), protector.EndAction <JusticeVirtue>); } }
public static void OnVirtueRejected(PlayerMobile protector, PlayerMobile protectee) { string args = string.Format("{0}\t{1}", protector.Name, protectee.Name); protectee.SendLocalizedMessage(1049453, args); // You have declined protection from ~1_NAME~. protector.SendLocalizedMessage(1049454, args); // ~2_NAME~ has declined your protection. if (protector.BeginAction(typeof(JusticeVirtue))) { Timer.DelayCall(TimeSpan.FromMinutes(15.0), new TimerStateCallback(RejectDelay_Callback), protector); } }
private static void EventSink_EquipLastWeaponMacroUsed(EquipLastWeaponMacroEventArgs e) { PlayerMobile pm = e.Mobile as PlayerMobile; if (!pm.CanBeginAction(typeof(EquipLastWeapon))) { pm.SendLocalizedMessage(500119); // You must wait to perform another action. return; } pm.BeginAction(typeof(EquipLastWeapon)); Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback(Expire_Callback), pm); if (pm != null && pm.Backpack != null) { BaseWeapon weapon = pm.LastEquipedWeapon; Item hand1 = pm.FindItemOnLayer(Layer.OneHanded); Item hand2 = pm.FindItemOnLayer(Layer.TwoHanded); if (weapon != null) { if (!weapon.IsChildOf(pm.Backpack)) { pm.SendLocalizedMessage(1063109); // Your last weapon must be in your backpack to be able to switch it quickly. return; } if (weapon.Layer == Layer.TwoHanded && hand2 is BaseShield) { pm.SendLocalizedMessage(1063114); // You cannot pick up your last weapon! return; } Item olditem = hand2 is BaseWeapon ? hand2 : hand1; if (olditem != null && !pm.AddToBackpack(olditem)) { pm.SendLocalizedMessage(1063110); // Your backpack cannot hold the weapon in your hand. } else if (pm.EquipItem(weapon)) { pm.SendLocalizedMessage(1063112); // You pick up your last weapon. pm.LastEquipedWeapon = olditem as BaseWeapon; } else { pm.SendLocalizedMessage(1063113); // You put your weapon into your backpack, but cannot pick up your last weapon! } } } }
public override void Invoke(ToolbarState state) { if (state == null) { return; } PlayerMobile user = state.User; if (user == null || user.Deleted || user.NetState == null) { return; } VitaNexCore.TryCatch( () => { if (!user.CanBeginAction(this)) { return; } switch (TextType) { case MessageType.Whisper: user.DoSpeech(FullValue, new int[0], TextType, user.WhisperHue); break; case MessageType.Yell: user.DoSpeech(FullValue, new int[0], TextType, user.YellHue); break; default: user.DoSpeech(FullValue, new int[0], TextType, user.SpeechHue); break; } user.BeginAction(this); Timer.DelayCall(SpamDelay, () => user.EndAction(this)); }, ex => { Console.WriteLine("{0} => {1} => ({2}) => {3}", user, GetType().Name, FullValue, ex); Toolbars.CMOptions.ToConsole(ex); }); }
public bool ApplyMagicReflectEffect(PlayerMobile Wearer) { if (Wearer == null) { return(false); } Spell spell = new MagicReflectSpell(Wearer, null); if (Wearer.MagicDamageAbsorb > 0) { Wearer.SendMessage("The magic of this item is already protecting you."); return(false); } else if (Wearer.Region.OnBeginSpellCast(Wearer, spell) == false) { Wearer.SendMessage("The magic normally within this object seems absent."); return(false); } else if (!Wearer.CanBeginAction(typeof(DefensiveSpell))) { Wearer.SendLocalizedMessage(1005385); // The spell will not adhere to you at this time. return(false); } else { if (Wearer.BeginAction(typeof(DefensiveSpell))) { int value = (int)((Utility.Random(51) + 50) + (Utility.Random(51) + 50)); // Random value of up to 100 for magery and up to 100 for scribing - lowest though is 50 magery/50 scribing equivalent strength value = (int)(8 + (value / 200) * 7.0); //absorb from 8 to 15 "circles" Wearer.MagicDamageAbsorb = value; Wearer.FixedParticles(0x375A, 10, 15, 5037, EffectLayer.Waist); Wearer.PlaySound(0x1E9); Wearer.SendMessage("You feel the magic of the item envelope you."); return(true); } else { Wearer.SendLocalizedMessage(1005385); // The spell will not adhere to you at this time. return(false); } } }
public virtual void OnTeamMemberAdded(PvPTeam team, PlayerMobile pm) { team.Broadcast("{0} has joined the battle.", pm.RawName); if (UseTeamColors) { pm.SolidHueOverride = team.Color; } if (UseIncognito) { pm.BeginAction(typeof(IncognitoSpell)); pm.NameMod = NameList.RandomName(pm.Female ? "female" : "male"); var race = pm.Race ?? Race.DefaultRace; pm.BodyMod = race.Body(pm); pm.HueMod = race.RandomSkinHue(); pm.SetHairMods(race.RandomHair(pm.Female), race.RandomFacialHair(pm.Female)); } }
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 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 static void Trick(BaseCreature creature, PlayerMobile player) { if (creature == null || player == null) { return; } int trickTextHue = 0x22; creature.PublicOverheadMessage(MessageType.Regular, trickTextHue, false, "Trick it is then!"); creature.PlaySound(0x246); double damageAmount = 0; int duration = 0; switch (Utility.RandomMinMax(1, 15)) { case 1: SpecialAbilities.BacklashSpecialAbility(1.0, null, player, .75, 60, -1, true, "", ""); if (player.NetState != null) { player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Ack! A curse! Causing your spellcasting proficiency to suffer!", player.NetState); } break; case 2: double bleedAmount = (double)player.HitsMax * .66; for (int a = 0; a < 5; a++) { Point3D newLocation = new Point3D(player.Location.X + Utility.RandomList(-1, 1), player.Location.Y + Utility.RandomList(-1, 1), player.Location.Z); new Blood().MoveToWorld(newLocation, player.Map); } SpecialAbilities.BleedSpecialAbility(1.0, null, player, bleedAmount, 8, -1, true, "", "", "-1"); if (player.NetState != null) { player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Curses! A dagger hidden in an apple!", player.NetState); } break; case 3: Point3D creatureLocation = creature.Location; Point3D playerLocation = player.Location; int projectiles = 15; int particleSpeed = 8; for (int a = 0; a < projectiles; a++) { Point3D newLocation = new Point3D(player.X + Utility.RandomList(-5, -4, -3, -2, -1, 1, 2, 3, 4, 5), player.Y + Utility.RandomList(-5, -4, -3, -2, -1, 1, 2, 3, 4, 5), player.Z); SpellHelper.AdjustField(ref newLocation, player.Map, 12, false); IEntity effectStartLocation = new Entity(Serial.Zero, new Point3D(newLocation.X, newLocation.Y, newLocation.Z + 10), player.Map); IEntity effectEndLocation = new Entity(Serial.Zero, new Point3D(player.X, player.Y, player.Z + 10), player.Map); Effects.SendMovingParticles(effectStartLocation, effectEndLocation, 0x3818, particleSpeed, 0, false, false, 2603, 0, 9501, 0, 0, 0x100); } player.FixedParticles(0x3967, 10, 40, 5036, 2603, 0, EffectLayer.CenterFeet); int damage = (int)(Math.Round((double)player.HitsMax * .33)); duration = 5; SpecialAbilities.HinderSpecialAbility(1.0, null, player, 1.0, duration, false, -1, false, "", "", "-1"); new Blood().MoveToWorld(player.Location, player.Map); AOS.Damage(player, damage, 0, 100, 0, 0, 0); if (player.NetState != null) { player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Electric candy! What an age we live in!", player.NetState); } break; case 4: SpecialAbilities.DiseaseSpecialAbility(1.0, null, player, 3, 60, -1, true, "", ""); if (player.NetState != null) { player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Blast! Expired candy!", player.NetState); } break; case 5: TimedStatic glue = new TimedStatic(4650, 30); glue.Name = "glue"; glue.Hue = 2067; glue.MoveToWorld(player.Location, player.Map); SpecialAbilities.EntangleSpecialAbility(1.0, null, player, 1.0, 30, -1, true, "", "", "-1"); if (player.NetState != null) { player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Your feet have been glued to the floor!", player.NetState); } break; case 6: damageAmount = (double)player.HitsMax * .5; SpecialAbilities.FlamestrikeSpecialAbility(1.0, null, player, damageAmount, 1, -1, true, "", "Spicy candy! So hot!"); if (player.NetState != null) { player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Spicy candy! So hot!", player.NetState); } break; case 7: damageAmount = (double)player.HitsMax * .5; Direction direction = Utility.GetDirection(creature.Location, player.Location); int windItemId = 8099; switch (direction) { case Direction.North: windItemId = 8099; break; case Direction.Right: windItemId = 8099; break; case Direction.West: windItemId = 8104; break; case Direction.Up: windItemId = 8104; break; case Direction.East: windItemId = 8109; break; case Direction.Down: windItemId = 8109; break; case Direction.South: windItemId = 8114; break; case Direction.Left: windItemId = 8114; break; } creature.MovingEffect(player, windItemId, 5, 1, false, false, 0, 0); player.PlaySound(0x64C); if (player.NetState != null) { player.PrivateOverheadMessage(MessageType.Regular, 0, false, "This candy totally blows...", player.NetState); } SpecialAbilities.KnockbackSpecialAbility(1.0, creature.Location, null, player, damageAmount, 20, -1, "", ""); break; case 8: SpecialAbilities.PetrifySpecialAbility(1.0, null, player, 1.0, 15, -1, true, "", "", "-1"); if (player.NetState != null) { player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Rock candy!", player.NetState); } break; case 9: if (player.Poison == null) { Poison poison = Poison.GetPoison(2); player.ApplyPoison(null, poison); } player.FixedEffect(0x372A, 10, 30, 2208, 0); Effects.PlaySound(player.Location, player.Map, 0x22F); int residueCount = Utility.RandomMinMax(3, 4); for (int a = 0; a < residueCount; a++) { Point3D poisonPoint = new Point3D(player.Location.X + Utility.RandomList(-1, 1), player.Location.Y + Utility.RandomList(-1, 1), player.Location.Z); SpellHelper.AdjustField(ref poisonPoint, player.Map, 12, false); TimedStatic poisonResidue = new TimedStatic(Utility.RandomList(0x1645, 0x122A, 0x122B, 0x122C, 0x122D, 0x122E, 0x122F), 5); poisonResidue.Hue = 2208; poisonResidue.Name = "poison residue"; poisonResidue.MoveToWorld(poisonPoint, player.Map); } if (player.NetState != null) { player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Poisoned candy! Who would do such a thing!", player.NetState); } break; case 10: bool canPolymorph = true; if (!player.CanBeginAction(typeof(PolymorphSpell))) { canPolymorph = false; } if (!player.CanBeginAction(typeof(PolymorphPotion))) { canPolymorph = false; } if (!player.CanBeginAction(typeof(IncognitoSpell)) || player.IsBodyMod) { canPolymorph = false; } if (DisguiseTimers.IsDisguised(player)) { canPolymorph = false; } if (KinPaint.IsWearingKinPaint(player)) { canPolymorph = false; } if (!canPolymorph) { player.SendMessage("Hmm...Nothing seems to have happened. Or did it?"); return; } player.FixedParticles(0x373A, 10, 15, 5036, EffectLayer.Head); List <int> m_PossibleBodyValues = new List <int>(); m_PossibleBodyValues.Add(3); //Zombie m_PossibleBodyValues.Add(50); //Skeleton m_PossibleBodyValues.Add(56); //Skeleton m_PossibleBodyValues.Add(153); //Ghoul m_PossibleBodyValues.Add(302); //Skeletal Critter m_PossibleBodyValues.Add(309); //Patchwork Skeleton m_PossibleBodyValues.Add(148); //Necromancer m_PossibleBodyValues.Add(793); //Skeletal Horse m_PossibleBodyValues.Add(317); //Giant Bat m_PossibleBodyValues.Add(252); //Corpse Bride m_PossibleBodyValues.Add(57); //Skeletal Knight m_PossibleBodyValues.Add(116); //Nightmare m_PossibleBodyValues.Add(24); //Lich m_PossibleBodyValues.Add(154); //Mummy m_PossibleBodyValues.Add(104); //Skeletal Drake m_PossibleBodyValues.Add(740); //Skeletal Drake m_PossibleBodyValues.Add(308); //Giant Skeleton player.BodyMod = m_PossibleBodyValues[Utility.RandomMinMax(0, m_PossibleBodyValues.Count - 1)]; player.HueMod = 0; player.PlaySound(0x3BD); BaseArmor.ValidateMobile(player); duration = 120; player.BeginAction(typeof(PolymorphPotion)); Timer.DelayCall(TimeSpan.FromSeconds(duration), delegate { if (player == null) { return; } player.EndAction(typeof(PolymorphPotion)); }); player.BeginAction(typeof(PolymorphSpell)); Timer.DelayCall(TimeSpan.FromSeconds(duration), delegate { if (player == null) { return; } player.BodyMod = 0; player.HueMod = -1; player.EndAction(typeof(PolymorphSpell)); BaseArmor.ValidateMobile(player); }); if (player.NetState != null) { player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Hmm, something tastes odd about this candy.", player.NetState); } break; case 11: Item innerLegs = player.FindItemOnLayer(Layer.InnerLegs); Item outerLegs = player.FindItemOnLayer(Layer.OuterLegs); Item pants = player.FindItemOnLayer(Layer.Pants); int layersFound = 0; if (innerLegs != null) { player.Backpack.DropItem(innerLegs); layersFound++; } if (outerLegs != null) { player.Backpack.DropItem(outerLegs); layersFound++; } if (pants != null) { player.Backpack.DropItem(pants); layersFound++; } if (layersFound > 0) { player.PlaySound(0x503); if (player.NetState != null) { player.PrivateOverheadMessage(MessageType.Regular, 0, false, "Your pants appear to have fallen down. How embarrassing!", player.NetState); } } else { player.SendMessage("Nothing seems to have happened. Or did it?..."); } break; case 12: player.FixedParticles(0x374A, 10, 15, 5028, 2604, 0, EffectLayer.Waist); player.PlaySound(0x5DA); player.Animate(22, 6, 1, true, false, 0); //Fall Forward player.Stam = 0; if (player.NetState != null) { player.PrivateOverheadMessage(MessageType.Regular, 0, false, "You feel drowsy and fall on your face!", player.NetState); } break; case 13: player.BAC = 60; player.PlaySound(0x5A9); BaseBeverage.CheckHeaveTimer(player); player.Animate(34, 5, 1, true, false, 0); if (player.NetState != null) { player.PrivateOverheadMessage(MessageType.Regular, 0, false, "What was in that candy??? *hic*", player.NetState); } break; case 14: Warp(creature, player); break; case 15: Warp(creature, player); break; } }
public override void OnDoubleClick(Mobile from) { base.OnDoubleClick(from); PlayerMobile player = from as PlayerMobile; if (player == null) { return; } if (!IsChildOf(player.Backpack)) { from.SendMessage("That item must be in your pack in order to use it."); return; } if (!player.Young) { player.SendMessage("Only Young players may use this."); return; } if (player.Region is NewbieDungeonRegion) { player.SendMessage("You are already inside the newbie dungeon."); return; } if (!from.CanBeginAction(typeof(NewbieDungeonRune))) { from.SendMessage("You may only teleport to the newbie dungeon once every 10 minutes."); return; } if (Server.Misc.WeightOverloading.IsOverloaded(from)) { from.SendMessage("Thou art too encumbered to use this item at the moment."); return; } if (from.Criminal) { from.SendMessage("You are currently a criminal and cannot use this item at the moment."); return; } if (!SpellHelper.CheckTravel(from, TravelCheckType.RecallFrom)) { from.SendMessage("Usage of that item is not allowed in this region."); return; } if (DateTime.UtcNow < player.LastPlayerCombatTime + TimeSpan.FromSeconds(30)) { string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, player.LastPlayerCombatTime + TimeSpan.FromSeconds(30), false, true, true, true, true); player.SendMessage("You have been in combat too recently and must wait another " + timeRemaining + " before you may use this again."); return; } if (DateTime.UtcNow < player.LastPlayerCombatTime + TimeSpan.FromSeconds(60)) { string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, player.LastPlayerCombatTime + TimeSpan.FromSeconds(60), false, true, true, true, true); player.SendMessage("You have been in player-versus-player combat too recently and must wait another " + timeRemaining + " before you may use this again."); return; } Point3D location = player.Location; Map map = player.Map; player.SendMessage("You begin the teleportation ritual."); player.RevealingAction(); player.BeginAction(typeof(NewbieDungeonRune)); SpecialAbilities.HinderSpecialAbility(1.0, null, player, 1.0, 5, true, 0, false, "", "", "-1"); for (int a = 0; a < 5; a++) { Timer.DelayCall(TimeSpan.FromSeconds(a * 1), delegate { if (player == null) { return; } if (player.Deleted || !player.Alive) { player.EndAction(typeof(NewbieDungeonRune)); return; } player.Animate(17, 7, 1, true, false, 0); }); } Timer.DelayCall(TimeSpan.FromSeconds(5.05), delegate { if (player == null) { return; } if (player.Deleted || !player.Alive) { player.EndAction(typeof(NewbieDungeonRune)); return; } if (DateTime.UtcNow < player.LastPlayerCombatTime + TimeSpan.FromSeconds(30)) { string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, player.LastPlayerCombatTime + TimeSpan.FromSeconds(30), false, true, true, true, true); player.SendMessage("You have been in combat too recently and must wait another " + timeRemaining + " before you may use this again."); player.EndAction(typeof(NewbieDungeonRune)); return; } if (DateTime.UtcNow < player.LastPlayerCombatTime + TimeSpan.FromSeconds(60)) { string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, player.LastPlayerCombatTime + TimeSpan.FromSeconds(60), false, true, true, true, true); player.SendMessage("You have been in player-versus-player combat too recently and must wait another " + timeRemaining + " before you may use this again."); player.EndAction(typeof(NewbieDungeonRune)); return; } player.Location = newbieDungeonTeleportLocation; player.Map = newbieDungeonMap; player.SendSound(0x652); player.SendMessage("You teleport to the newbie dungeon."); Timer.DelayCall(Cooldown, delegate { if (player != null) { player.EndAction(typeof(NewbieDungeonRune)); } }); }); }
protected override void OnTick() { if (m_RepairHammer == null || m_Player == null) { if (m_RepairHammer != null) { m_RepairHammer.m_Owner = null; } if (m_RepairHammer != null) { m_Player.EndAction(typeof(UOACZRepairHammer)); } Stop(); return; } if (m_RepairHammer.Deleted || m_Player.Deleted) { m_RepairHammer.m_Owner = null; m_Player.EndAction(typeof(UOACZRepairHammer)); Stop(); return; } List <UOACZBreakableStatic> m_NearbyBreakableStatics = GetNearbyBreakableStatics(m_Player); if (m_NearbyBreakableStatics.Count == 0) { m_RepairHammer.m_Owner = null; m_Player.EndAction(typeof(UOACZRepairHammer)); Stop(); return; } UOACZBreakableStatic randomBreakableStatic = m_NearbyBreakableStatics[Utility.RandomMinMax(0, m_NearbyBreakableStatics.Count - 1)]; int repairableCount = 0; foreach (UOACZBreakableStatic breakableStatic in m_NearbyBreakableStatics) { if (breakableStatic.CanRepair(m_Player, m_RepairHammer, 1.0, false)) { repairableCount++; } } if (repairableCount == 0) { m_RepairHammer.m_Owner = null; m_Player.EndAction(typeof(UOACZRepairHammer)); m_Player.SendMessage("You stop making repairs."); Stop(); return; } if (m_RepairTicks == 0) { m_Player.BeginAction(typeof(BreakableStatic)); TimeSpan repairCooldown = TimeSpan.FromSeconds(RepairActionTickDuration.TotalSeconds * (double)RepairActionTicksNeeded); Timer.DelayCall(repairCooldown, delegate { if (m_Player != null) { m_Player.EndAction(typeof(BreakableStatic)); } }); } m_RepairTicks++; if (randomBreakableStatic.RepairSound != -1) { Effects.PlaySound(m_Player.Location, m_Player.Map, randomBreakableStatic.RepairSound); } m_Player.Animate(12, 5, 1, true, false, 0); m_Player.RevealingAction(); if (m_RepairTicks >= UOACZRepairHammer.RepairActionTicksNeeded) { m_RepairTicks = 0; int minRepairAmount = 40; int maxRepairAmount = 60; double baseRepairScalarBonus = 1.0; double carpentryScalar = 1 + (baseRepairScalarBonus * m_Player.Skills.Carpentry.Value / 100); double blacksmithingScalar = 1 + (baseRepairScalarBonus * m_Player.Skills.Carpentry.Value / 100); double tinkeringScalar = 1 + (baseRepairScalarBonus * m_Player.Skills.Carpentry.Value / 100); double bestScalar = 1; if (carpentryScalar > bestScalar) { bestScalar = carpentryScalar; } if (blacksmithingScalar > bestScalar) { bestScalar = blacksmithingScalar; } if (tinkeringScalar > bestScalar) { bestScalar = tinkeringScalar; } double repairValue = m_Player.GetSpecialAbilityEntryValue(SpecialAbilityEffect.EmergencyRepairs); bestScalar += repairValue; bool outpostWasRepaired = false; foreach (UOACZBreakableStatic breakableStatic in m_NearbyBreakableStatics) { int repairAmount = Utility.RandomMinMax(minRepairAmount, maxRepairAmount); repairAmount = (int)(Math.Round(((double)repairAmount * bestScalar))); if (breakableStatic.RequiresFullRepair) { BreakableStatic.DamageStateType damageState = breakableStatic.DamageState; breakableStatic.HitPoints += repairAmount; breakableStatic.PublicOverheadMessage(MessageType.Regular, UOACZSystem.greenTextHue, false, "+" + repairAmount); if (breakableStatic.HitPoints < breakableStatic.MaxHitPoints) { breakableStatic.DamageState = damageState; } else { breakableStatic.DamageState = BreakableStatic.DamageStateType.Normal; } } else { breakableStatic.HitPoints += repairAmount; breakableStatic.PublicOverheadMessage(MessageType.Regular, UOACZSystem.greenTextHue, false, "+" + repairAmount); } UOACZPersistance.CheckAndCreateUOACZAccountEntry(m_Player); m_Player.m_UOACZAccountEntry.TotalRepairAmount += repairAmount; m_Player.SendMessage("You repair an object for " + repairAmount.ToString() + " hitpoints."); if (UOACZPersistance.m_OutpostComponents.Contains(breakableStatic)) { outpostWasRepaired = true; UOACZEvents.RepairOutpostComponent(); } } UOACZPersistance.CheckAndCreateUOACZAccountEntry(m_Player); m_Player.m_UOACZAccountEntry.TimesRepaired++; bool scored = false; double scoreChance = UOACZSystem.HumanRepairScoreChance; if (outpostWasRepaired) { scoreChance += UOACZSystem.HumanOutpostRepairScoreChance; } if (Utility.RandomDouble() <= UOACZSystem.HumanRepairScoreChance) { UOACZSystem.ChangeStat(m_Player, UOACZSystem.UOACZStatType.HumanScore, 1, true); scored = true; } if (m_Player.Backpack != null) { if (Utility.RandomDouble() <= UOACZSystem.HumanRepairSurvivalStoneChance * UOACZPersistance.HumanBalanceScalar) { m_Player.Backpack.DropItem(new UOACZSurvivalStone(m_Player)); m_Player.SendMessage(UOACZSystem.greenTextHue, "You have earned a survival stone for your repair efforts!"); } if (Utility.RandomDouble() <= UOACZSystem.HumanRepairUpgradeTokenChance * UOACZPersistance.HumanBalanceScalar) { m_Player.Backpack.DropItem(new UOACZHumanUpgradeToken(m_Player)); m_Player.SendMessage(UOACZSystem.greenTextHue, "You have earned an upgrade token for your repair efforts!"); } } m_RepairHammer.Charges--; if (m_RepairHammer.Charges <= 0) { m_RepairHammer.Delete(); } } }
public void StartSearch(PlayerMobile player, SearchModeType searchMode, SearchLengthType searchLength) { player.SendMessage("You begin searching."); int searchIntervals = 1; double intervalDuration = 5; player.BeginAction(typeof(Spyglass)); switch (searchLength) { case SearchLengthType.Short: NextUsageAllowed = DateTime.UtcNow + TimeSpan.FromSeconds(5); searchIntervals = 1; break; case SearchLengthType.Medium: NextUsageAllowed = DateTime.UtcNow + TimeSpan.FromSeconds(15); searchIntervals = 3; break; case SearchLengthType.Long: NextUsageAllowed = DateTime.UtcNow + TimeSpan.FromSeconds(30); searchIntervals = 6; break; } for (int a = 0; a < searchIntervals; a++) { if (a == 0) { if (player.NetState != null) { player.PrivateOverheadMessage(MessageType.Regular, player.SpeechHue, false, "*begins scanning the horizon*", player.NetState); } } else { Timer.DelayCall(TimeSpan.FromSeconds(a * intervalDuration), delegate { if (player != null) { if (player.NetState != null) { player.PrivateOverheadMessage(MessageType.Regular, player.SpeechHue, false, "*continues scanning*", player.NetState); } } }); } } Timer.DelayCall(TimeSpan.FromSeconds(searchIntervals * intervalDuration), delegate { if (player == null) { return; } player.EndAction(typeof(Spyglass)); switch (searchMode) { case SearchModeType.Ships: player.Say("Ships"); break; case SearchModeType.Shipwrecks: player.Say("Shipwrecks"); break; case SearchModeType.SchoolsOfFish: player.Say("SchoolsOfFish"); break; } }); Charges--; if (Charges <= 0) { Delete(); } }
public static void AttemptPurchase(PlayerMobile player, UOACZRewardType rewardType) { if (player == null) { return; } if (player.Deleted || !player.Alive) { return; } UOACZPersistance.CheckAndCreateUOACZAccountEntry(player); if (UOACZSystem.IsUOACZValidMobile(player)) { player.SendMessage("You may not purchase UOACZ Rewards while participating in a UOACZ session."); return; } UOACZRewardDetail rewardDetail = UOACZRewards.GetRewardDetail(rewardType); int rewardPointsAvailable = player.m_UOACZAccountEntry.RewardPoints; if (rewardDetail.RewardCost > rewardPointsAvailable && player.AccessLevel == AccessLevel.Player) { player.SendMessage("You don't have enough UOACZ Reward Points to purchase that."); return; } if (player.Backpack.Items.Count >= player.Backpack.MaxItems && player.AccessLevel == AccessLevel.Player) { player.SendMessage("You are carrying too many items to receive that item."); return; } bool madePurchase = false; switch (rewardType) { case UOACZRewardType.SurvivalTome: Item[] item = player.Backpack.FindItemsByType(typeof(UOACZSurvivalTome)); if (item.Length == 0) { if (player.Backpack.Items.Count < player.Backpack.MaxItems) { if (!player.CanBeginAction(typeof(UOACZSurvivalTome))) { player.SendMessage("You have acquired a Survival Tome too recently to acquire another one and must wait 10 minutes."); return; } player.Backpack.DropItem(new UOACZSurvivalTome()); player.SendMessage("You recieve a UOACZ Survival Tome."); madePurchase = true; player.BeginAction(typeof(UOACZSurvivalTome)); Timer.DelayCall(TimeSpan.FromMinutes(10), delegate { if (player != null) { player.EndAction(typeof(UOACZSurvivalTome)); } }); } else { player.SendMessage("You are carrying too many items to receive that item."); return; } } else { player.SendMessage("You already have a UOACZ Survival Tome in your backpack."); return; } break; case UOACZRewardType.CorruptionTome: item = player.Backpack.FindItemsByType(typeof(UOACZCorruptionTome)); if (item.Length == 0) { if (player.Backpack.Items.Count < player.Backpack.MaxItems) { if (!player.CanBeginAction(typeof(UOACZCorruptionTome))) { player.SendMessage("You have acquired a Corruption Tome too recently to acquire another one and must wait 10 minutes."); return; } player.Backpack.DropItem(new UOACZCorruptionTome()); player.SendMessage("You recieve a UOACZ Corruption Tome."); madePurchase = true; player.BeginAction(typeof(UOACZCorruptionTome)); Timer.DelayCall(TimeSpan.FromMinutes(10), delegate { if (player != null) { player.EndAction(typeof(UOACZCorruptionTome)); } }); } else { player.SendMessage("You are carrying too many items to receive that item."); return; } } else { player.SendMessage("You already have a UOACZ Corruption Tome in your backpack."); return; } break; case UOACZRewardType.SilverWeapon: BaseWeapon weapon = Loot.RandomWeapon(); if (weapon != null) { int accuracyLevel = 1; int damageLevel = 1; int durabilityLevel = 1; double accuracyResult = Utility.RandomDouble(); double damageResult = Utility.RandomDouble(); //Accuracy if (accuracyResult <= .50) { accuracyLevel = 1; } else if (accuracyResult <= .90) { accuracyLevel = 2; } else if (accuracyResult <= .97) { accuracyLevel = 3; } else if (accuracyResult <= .99) { accuracyLevel = 4; } else { accuracyLevel = 5; } //Damage if (damageResult <= .50) { damageLevel = 1; } else if (damageResult <= .90) { damageLevel = 2; } else if (damageResult <= .97) { damageLevel = 3; } else if (damageResult <= .99) { damageLevel = 4; } else { damageLevel = 5; } //Durability durabilityLevel = Utility.RandomMinMax(1, 5); weapon.AccuracyLevel = (WeaponAccuracyLevel)accuracyLevel; weapon.DamageLevel = (WeaponDamageLevel)damageLevel; weapon.DurabilityLevel = (WeaponDurabilityLevel)durabilityLevel; madePurchase = true; player.Backpack.DropItem(weapon); player.SendMessage("You receive a silver weapon."); } break; case UOACZRewardType.UOACZLotteryTicket: UOACZLotteryTicket lotteryTicket = new UOACZLotteryTicket(); if (lotteryTicket == null) { return; } madePurchase = true; player.Backpack.DropItem(lotteryTicket); player.SendMessage("You receive a UOACZ Lottery Ticket."); break; case UOACZRewardType.LargeDecoration: Item largeItem = null; switch (Utility.RandomMinMax(1, 5)) { case 1: largeItem = new UOACZDeadTree1RewardAddonDeed(); break; case 2: largeItem = new UOACZDeadTree2RewardAddonDeed(); break; case 3: largeItem = new UOACZDeadTree3RewardAddonDeed(); break; case 4: largeItem = new UOACZDeadTree4RewardAddonDeed(); break; case 5: largeItem = new UOACZDeadTree5RewardAddonDeed(); break; } if (largeItem == null) { return; } madePurchase = true; player.Backpack.DropItem(largeItem); player.SendMessage("You receive a large reward item."); break; case UOACZRewardType.EpicDecoration: Item epicItem = new UOACZSkullPileRewardAddonDeed(); if (epicItem == null) { return; } madePurchase = true; player.Backpack.DropItem(epicItem); player.SendMessage("You receive an epic reward item."); break; } if (madePurchase) { player.SendSound(UOACZSystem.purchaseUpgradeSound); if (player.AccessLevel == AccessLevel.Player) { player.m_UOACZAccountEntry.RewardPoints -= rewardDetail.RewardCost; } } }
protected override void OnTarget(Mobile from, object target) { PlayerMobile player = from as PlayerMobile; if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } if (!player.IsUOACZHuman) { return; } if (m_Torch == null) { return; } if (m_Torch.Deleted) { return; } IPoint3D location = target as IPoint3D; if (location == null) { return; } Map map = player.Map; if (map == null) { return; } SpellHelper.GetSurfaceTop(ref location); Mobile mobileTarget = null; targetLocation = new Entity(Serial.Zero, new Point3D(location), map); if (new Point3D(location) == from.Location) { return; } if (!player.CanBeginAction(typeof(UOACZTorch))) { player.SendMessage("You must wait a few moments before throwing another torch."); return; } if (Utility.GetDistance(player.Location, targetLocation.Location) > ThrowRange) { player.SendMessage("That location is too far away."); return; } player.RevealingAction(); SpecialAbilities.HinderSpecialAbility(1.0, null, player, 1.0, 1, true, 0, false, "", "", "-1"); m_Torch.Delete(); player.Animate(31, 7, 1, true, false, 0); int throwSound = 0x5D3; int hitSound = 0x5CF; int itemID = 2578; int itemHue = 0; Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate { if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } if (!player.IsUOACZHuman) { return; } player.BeginAction(typeof(UOACZTorch)); Timer.DelayCall(TimeSpan.FromSeconds(UOACZTorch.CooldownSeconds), delegate { if (player != null) { player.EndAction(typeof(UOACZTorch)); } }); Effects.PlaySound(player.Location, player.Map, throwSound); IEntity startLocation = new Entity(Serial.Zero, new Point3D(player.Location.X, player.Location.Y, player.Location.Z + 5), player.Map); IEntity endLocation = new Entity(Serial.Zero, new Point3D(targetLocation.Location.X, targetLocation.Location.Y, targetLocation.Location.Z + 5), targetLocation.Map); Effects.SendMovingEffect(startLocation, endLocation, itemID, 15, 0, false, false, itemHue, 0); double distance = player.GetDistanceToSqrt(endLocation.Location); double destinationDelay = (double)distance * .04; Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate { Effects.PlaySound(endLocation.Location, endLocation.Map, hitSound); Effects.SendLocationParticles(EffectItem.Create(endLocation.Location, endLocation.Map, TimeSpan.FromSeconds(1.0)), 0x3709, 10, 30, 0, 0, 5052, 0); //Mobiles Queue m_Queue = new Queue(); IPooledEnumerable nearbyMobiles = endLocation.Map.GetMobilesInRange(endLocation.Location, 0); int mobilesHit = 0; foreach (Mobile mobile in nearbyMobiles) { if (!UOACZSystem.IsUOACZValidMobile(mobile)) { continue; } m_Queue.Enqueue(mobile); mobilesHit++; } nearbyMobiles.Free(); while (m_Queue.Count > 0) { Mobile mobile = (Mobile)m_Queue.Dequeue(); BaseCreature bc_Target = mobile as BaseCreature; PlayerMobile pm_Target = mobile as PlayerMobile; int minDamage = 20; int maxDamage = 40; double damageScalar = 2; if (pm_Target != null) { if (pm_Target.IsUOACZHuman) { damageScalar = 0; } if (pm_Target.IsUOACZUndead) { damageScalar = .66; } } int damage = (int)(Math.Round(((double)Utility.RandomMinMax(minDamage, maxDamage)) * damageScalar)); bool humanSource = false; if (player != null) { if (player.IsUOACZHuman) { humanSource = true; } } if (damage > 0) { if (humanSource) { player.DoHarmful(mobile); new Blood().MoveToWorld(mobile.Location, mobile.Map); AOS.Damage(mobile, player, damage, 100, 0, 0, 0, 0); } else { new Blood().MoveToWorld(mobile.Location, mobile.Map); AOS.Damage(mobile, damage, 100, 0, 0, 0, 0); } } } if (mobilesHit > 0) { Effects.PlaySound(endLocation.Location, endLocation.Map, 0x054); Effects.SendLocationParticles(EffectItem.Create(endLocation.Location, endLocation.Map, TimeSpan.FromSeconds(1.0)), 0x3709, 10, 30, 0, 0, 5052, 0); } bool oilLocationHit = false; //Items IPooledEnumerable nearbyItems = endLocation.Map.GetItemsInRange(endLocation.Location, 1); foreach (Item item in nearbyItems) { if (item is UOACZOilLocation) { m_Queue.Enqueue(item); } } nearbyItems.Free(); while (m_Queue.Count > 0) { UOACZOilLocation oilLocation = (UOACZOilLocation)m_Queue.Dequeue(); if (oilLocation == null) { continue; } if (oilLocation.Deleted) { continue; } if (oilLocation.Burning) { continue; } oilLocation.Ignite(player); oilLocationHit = true; } if (!oilLocationHit) { Effects.PlaySound(endLocation.Location, endLocation.Map, 0x3BE); Effects.SendLocationParticles(EffectItem.Create(endLocation.Location, endLocation.Map, TimeSpan.FromSeconds(1.0)), 0x3735, 10, 30, 0, 0, 5052, 0); } }); }); }