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(); } }
protected override void OnTick() { if (m_Mobile.AccessLevel > AccessLevel.Player) { m_Count = 0; m_Price = 0; } if (m_Count == 0) { if (m_Price == 0 || m_Mobile.Backpack.ConsumeTotal(typeof(Gold), m_Price, true) || Banker.Withdraw(m_Mobile, m_Price)) { BaseCreature.TeleportPets(m_Mobile, m_Location, Map.Felucca, false); m_Mobile.PlaySound(0x1FC); m_Mobile.MoveToWorld(m_Location, Map.Felucca); m_Mobile.PlaySound(0x1FC); } else { m_Mobile.SendMessage(String.Format(Locale.GetLocale(m_Mobile).TRAVEL_STONE_NO_GOLD, m_Price)); } Stop(); //m_Mobile.TravelTimer = null; m_Mobile.EndAction(this); } else { m_Mobile.PublicOverheadMessage(MessageType.Label, 0x481, true, m_Count.ToString(), true); m_Count--; } }
public override void OnTeamMemberRemoved(PvPTeam team, PlayerMobile pm) { base.OnTeamMemberRemoved(team, pm); if (IncognitoMode) { pm.SetHairMods(-1, -1); pm.BodyMod = 0; pm.HueMod = -1; pm.NameMod = null; pm.EndAction(typeof(IncognitoSpell)); BaseArmor.ValidateMobile(pm); BaseClothing.ValidateMobile(pm); } if (ThrowableMode) { if (_Axes != null && _Axes.ContainsKey(pm)) { ThrowableAxe axe = _Axes[pm]; if (axe != null) { _Axes.Remove(pm); axe.Delete(); } } } PvPTemplates.FetchProfile(pm).ClearDelta(); }
public static void RejectDelay_Callback(PlayerMobile state) { if (state != null) { state.EndAction(typeof(JusticeVirtue)); } }
public virtual void OnTeamMemberRemoved(PvPTeam team, PlayerMobile pm) { team.Broadcast("{0} has left the battle.", pm.RawName); pm.SolidHueOverride = -1; pm.EndAction(typeof(IncognitoSpell)); pm.NameMod = null; pm.BodyMod = 0; pm.HueMod = -1; pm.SetHairMods(-1, -1); }
protected override void OnEjected(PlayerMobile pm) { if (IncognitoMode) { pm.SetHairMods(-1, -1); pm.BodyMod = 0; pm.HueMod = -1; pm.NameMod = null; pm.EndAction(typeof(IncognitoSpell)); BaseArmor.ValidateMobile(pm); BaseClothing.ValidateMobile(pm); } base.OnEjected(pm); }
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); }); }
protected override void OnTarget(Mobile from, object target) { PlayerMobile player = from as PlayerMobile; if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } if (!player.IsUOACZHuman) { return; } if (m_OilFlask == null) { return; } if (m_OilFlask.Deleted) { return; } if (!m_OilFlask.IsChildOf(from.Backpack)) { from.SendMessage("The oil flask is no longer in your pack."); return; } IPoint3D location = target as IPoint3D; if (location == null) { return; } Map map = player.Map; if (map == null) { return; } SpellHelper.GetSurfaceTop(ref location); if (location is Mobile) { targetLocation = (Mobile)location; } else { targetLocation = new Entity(Serial.Zero, new Point3D(location), map); } if (Utility.GetDistance(player.Location, targetLocation.Location) > ThrowRange) { player.SendMessage("That location is too far away."); return; } if (!player.Map.InLOS(player.Location, targetLocation.Location)) { player.SendMessage("That is not within in your line of sight."); return; } player.RevealingAction(); SpecialAbilities.HinderSpecialAbility(1.0, null, player, 1.0, 1, true, 0, false, "", "", "-1"); m_OilFlask.Delete(); player.Animate(31, 7, 1, true, false, 0); Timer.DelayCall(usageCooldown, delegate { if (player != null) { player.EndAction(typeof(UOACZOilFlask)); } }); int throwSound = 0x5D3; int hitSound = Utility.RandomList(0x38E, 0x38F, 0x390); int effectSound = 0x5D8; int itemID = 7192; int itemHue = 0; int radius = 2; double additionalOilChance = .5; Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate { if (!UOACZSystem.IsUOACZValidMobile(player)) { return; } if (!player.IsUOACZHuman) { return; } 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, 10, 0, false, false, itemHue, 0); //5 double distance = player.GetDistanceToSqrt(endLocation.Location); double destinationDelay = (double)distance * .06; //.08 Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate { if (!UOACZPersistance.Active) { return; } Effects.PlaySound(endLocation.Location, endLocation.Map, hitSound); for (int a = -1 * radius; a < radius + 1; a++) { for (int b = -1 * radius; b < radius + 1; b++) { Point3D newPoint = new Point3D(endLocation.Location.X + a, endLocation.Location.Y + b, endLocation.Location.Z); SpellHelper.AdjustField(ref newPoint, map, 12, false); if (!map.InLOS(endLocation.Location, newPoint)) { continue; } double distanceFromCenter = Utility.GetDistanceToSqrt(endLocation.Location, newPoint); bool validLocation = true; double extraOilChance = 1; if (distanceFromCenter >= 1) { extraOilChance = (1 / (distanceFromCenter)) * additionalOilChance; } if (Utility.RandomDouble() <= extraOilChance) { Timer.DelayCall(TimeSpan.FromSeconds(distanceFromCenter * .1), delegate { if (!UOACZPersistance.Active) { return; } bool foundAnother = false; IPooledEnumerable nearbyItems = map.GetItemsInRange(newPoint, 0); foreach (Item item in nearbyItems) { if (item is UOACZOilLocation) { foundAnother = true; break; } } nearbyItems.Free(); if (!foundAnother) { Effects.PlaySound(newPoint, map, effectSound); new UOACZOilLocation().MoveToWorld(newPoint, map); } }); } } } }); }); }
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 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 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)); } }); }); }
/// <summary> /// Fully refreshes the targetted player. /// Prevents any type of pre-casting or other advantages. /// </summary> /// <param name="targ"> The target to be refreshed</param> public static void RefreshPlayer(PlayerMobile targ) { try { if (!targ.Alive) { Mobile m = (Mobile)targ; m.Resurrect(); } targ.Mana = targ.ManaMax; targ.Hits = targ.HitsMax; targ.Stam = targ.StamMax; targ.Poison = null; targ.Say("*Refreshed!*"); targ.Say("*Debuffed!*"); if (targ.Target != null) { targ.Say("I have pre-casted..."); } Server.Targeting.Target.Cancel(targ); if (targ.MeleeDamageAbsorb > 0) { targ.MeleeDamageAbsorb = 0; targ.EndAction(typeof(RechargeSpell)); targ.SendMessage("Reactive armor has been nullified."); } if (targ.MagicDamageAbsorb > 0) { targ.MagicDamageAbsorb = 0; targ.SendMessage("Magic Reflection has been nullified."); } StatMod mod; mod = targ.GetStatMod("[Magic] Str Offset"); if (mod != null) { targ.RemoveStatMod("[Magic] Str Offset"); } mod = targ.GetStatMod("[Magic] Dex Offset"); if (mod != null) { targ.RemoveStatMod("[Magic] Dex Offset"); } mod = targ.GetStatMod("[Magic] Int Offset"); if (mod != null) { targ.RemoveStatMod("[Magic] Int Offset"); } targ.Paralyzed = false; BuffInfo.RemoveBuff(targ, BuffIcon.Clumsy); BuffInfo.RemoveBuff(targ, BuffIcon.FeebleMind); BuffInfo.RemoveBuff(targ, BuffIcon.Weaken); BuffInfo.RemoveBuff(targ, BuffIcon.MassCurse); BuffInfo.RemoveBuff(targ, BuffIcon.Agility); BuffInfo.RemoveBuff(targ, BuffIcon.Cunning); BuffInfo.RemoveBuff(targ, BuffIcon.Strength); BuffInfo.RemoveBuff(targ, BuffIcon.Bless); } catch (Exception e) { Console.WriteLine("Error : " + e.Message); Console.WriteLine("Location : refresh() in Manager.cs"); } }
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 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); }); }); }
protected override void OnTick() { m_Owner.EndAction(this); base.OnTick(); }
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 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; } } }
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(); } }
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); } }); }); }