public override void OnDoubleClick( Mobile from ) { if ( !from.InRange( GetWorldLocation(), 2 ) || !from.InLOS( this ) ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that } else if ( Visible && ( ItemID == 4656 || ItemID == 4702 ) && DateTime.Now >= m_NextUse ) { Point3D p = GetWorldLocation(); if ( 1 > Utility.Random( Math.Max( Math.Abs( from.X - p.X ), Math.Abs( from.Y - p.Y ) ) ) ) { Effects.PlaySound( from.Location, from.Map, from.GetHurtSound() ); from.PublicOverheadMessage( MessageType.Regular, from.SpeechHue, true, "Ouch!" ); SpellHelper.Damage( TimeSpan.FromSeconds( 0.5 ), from, Utility.Dice( 2, 10, 5 ) ); } Effects.PlaySound( GetWorldLocation(), Map, 0x387 ); Timer.DelayCall( TimeSpan.FromSeconds( 0.25 ), new TimerCallback( Down1 ) ); Timer.DelayCall( TimeSpan.FromSeconds( 0.50 ), new TimerCallback( Down2 ) ); Timer.DelayCall( TimeSpan.FromSeconds( 5.00 ), new TimerCallback( BackUp ) ); m_NextUse = DateTime.Now + TimeSpan.FromSeconds( 10.0 ); } }
public override void OnDoubleClick( Mobile from ) { if (! from.InRange( this.GetWorldLocation(), 1 )) { from.LocalOverheadMessage( MessageType.Regular, 906, 1019045 ); // I can't reach that. } }
public void OnTarget(Mobile from, object obj) { if (!from.InRange(GetWorldLocation(), 5) || !from.InLOS(this)) from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. else if (obj is Corpse) { Corpse c = obj as Corpse; if (c.Carved) return; if (c.Owner is PlayerMobile) { ((ICarvable)obj).Carve(from, this); c.PublicOverheadMessage(MessageType.Emote, 33, true, string.Format("*You see {0} steal the soul of {1}*", from.Name, c.Owner.Name)); from.PlaySound(0x19c); from.PlaySound(20); from.PlaySound(230); Effects.SendLocationEffect(c.Location, c.Map, 0x37c4, 18, 15, 1); } else ((ICarvable) obj).Carve(from, this); } else from.SendAsciiMessage("You cannot use this on that"); }
public void Target( Mobile m ) { if ( !Caster.CanSee( m ) ) { Caster.SendLocalizedMessage( 500237 ); // Target can not be seen. } else if ( CheckHSequence( m ) ) { SpellHelper.Turn( Caster, m ); SpellHelper.CheckReflect( (int) this.Circle, Caster, ref m ); double damage = GetNewAosDamage( 17, 1, 5, m ); if ( !m.InRange( Caster, 2 ) ) damage *= 0.25; // 1/4 damage at > 2 tile range else if ( !m.InRange( Caster, 1 ) ) damage *= 0.50; // 1/2 damage at 2 tile range m.FixedParticles( 0x374A, 10, 30, 5013, 1153, 2, EffectLayer.Waist ); m.PlaySound( 0x0FC ); SpellHelper.Damage( this, m, damage, 0, 0, 100, 0, 0 ); } FinishSequence(); }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is Item) { var item = (Item) targeted; if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1)) { from.SendLocalizedMessage(500446); // That is too far away. } else if (!item.Deleted && (item.Dyable || (m_Tub.UsesRemaining >= 0 && m_Tub.Redyable && item is BaseDyeTub && ((BaseDyeTub) item).Redyable && ((BaseDyeTub) item).UsesRemaining >= 0)) && m_Tub.IsDyable(item) && item is RecallRune) { m_Tub.Dye(from, item); } else { from.SendMessage("You cannot dye that."); } } else { from.SendMessage("You cannot dye that."); } }
public void Target( Mobile m ) { if ( !Caster.CanSee( m ) ) { Caster.SendLocalizedMessage( 500237 ); // Target can not be seen. } else if ( CheckHSequence( m ) ) { SpellHelper.Turn( Caster, m ); Mobile source = Caster, target = m; SpellHelper.CheckReflect( (int)this.Circle, source, ref target ); double damage; if (Caster.IsT2A) { damage = Utility.RandomMinMax(SpellDamageControllerT2A._HarmDamageMin, SpellDamageControllerT2A._HarmDamageMax); } else { damage = Utility.RandomMinMax(SpellDamageController._HarmDamageMin, SpellDamageController._HarmDamageMax); } if (CheckResisted(target)) { if (Caster.IsT2A) damage *= SpellDamageControllerT2A._HarmResistMultiplier; else damage *= SpellDamageController._HarmResistMultiplier; target.SendLocalizedMessage(501783); // You feel yourself resisting magical energy. } damage *= GetDamageScalar( m ); if (!Caster.IsT2A) { //We get our damage numbers from non-reflect if (!m.InRange(Caster, 2)) damage *= SpellDamageController._HarmFarDistanceMultiplier; // > 2 tile range else if (!m.InRange(Caster, 1)) damage *= SpellDamageController._HarmFarDistanceMultiplier; // 2 tile range } target.FixedParticles( 0x374A, 10, 15, 5013, EffectLayer.Waist ); target.PlaySound( 0x1F1 ); SpellHelper.Damage(this, target, damage); } FinishSequence(); }
public override void OnDoubleClick(Mobile from) { if ((from.InRange(this, 12)) && !(from.InRange(this, 1))) { this.Say(Strings.Dialog("comeCloser")); return; } BarberCanHandle(from); }
public override void OnDoubleClick(Mobile from) { if (from.InRange(GetWorldLocation(), 1)) { from.SendMessage("You try to examine the strange wall but the vines get in your way."); } else if (!from.InRange(GetWorldLocation(), 1)) { from.SendMessage("I can't reach that."); } base.OnDoubleClick(from); }
public void Target(Mobile m) { if (!this.Caster.CanSee(m)) { this.Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (this.CheckHSequence(m)) { SpellHelper.Turn(this.Caster, m); SpellHelper.CheckReflect((int)this.Circle, this.Caster, ref m); double damage; if (Core.AOS) { damage = this.GetNewAosDamage(17, 1, 5, m); } else { damage = Utility.Random(1, 15); if (this.CheckResisted(m)) { damage *= 0.75; m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy. } damage *= this.GetDamageScalar(m); } if (!m.InRange(this.Caster, 2)) damage *= 0.25; // 1/4 damage at > 2 tile range else if (!m.InRange(this.Caster, 1)) damage *= 0.50; // 1/2 damage at 2 tile range if (Core.AOS) { m.FixedParticles(0x374A, 10, 30, 5013, 1153, 2, EffectLayer.Waist); m.PlaySound(0x0FC); } else { m.FixedParticles(0x374A, 10, 15, 5013, EffectLayer.Waist); m.PlaySound(0x1F1); } SpellHelper.Damage(this, m, damage, 0, 0, 100, 0, 0); } this.FinishSequence(); }
public override void OnMovement(Mobile from, Point3D oldLocation) { if (from.InRange(this, 3) && from is PlayerMobile) { if (!from.HasGump(typeof(PopUpGump))) from.SendGump(new PopUpGump(Name)); } if (!from.InRange(this, 3) && from is PlayerMobile) { if (from.HasGump(typeof(PopUpGump))) from.CloseGump(typeof(PopUpGump)); } }
public override void OnDoubleClick(Mobile from) { // check the range between the player and projectiles if ((this.Parent == null && !from.InRange(this.Location, 2)) || (this.RootParent is Mobile && !from.InRange(((Mobile)this.RootParent).Location, 2)) || (this.RootParent is Container && !from.InRange(((Container)this.RootParent).Location, 2)) ) { from.SendLocalizedMessage(500446); // That is too far away. return; } from.SendMessage(61, "Which cannon would you like to use this type of projectile?"); from.Target = new ShipWeaponTarget(this); }
public override bool HandlesOnSpeech(Mobile from) { if (from.InRange(this.Location, 8)) return true; return base.HandlesOnSpeech(from); }
public override void OnDoubleClick( Mobile from ) { if ( !from.InRange( GetWorldLocation(), 2 ) ) return; PublicOverheadMessage( MessageType.Regular, 0, false, string.Format( "*{0} rolls {1}*", from.Name, Utility.Random( 1, 20 ) ) ); }
public override void OnDoubleClick(Mobile from) { if (!this.VerifyMove(from)) return; if (!from.InRange(this.GetWorldLocation(), 2)) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. return; } Point3D fireLocation = this.GetFireLocation(from); if (fireLocation == Point3D.Zero) { from.SendLocalizedMessage(501695); // There is not a spot nearby to place your campfire. } else if (!from.CheckSkill(SkillName.Camping, 0.0, 100.0)) { from.SendLocalizedMessage(501696); // You fail to ignite the campfire. } else { this.Consume(); if (!this.Deleted && this.Parent == null) from.PlaceInBackpack(this); new Campfire().MoveToWorld(fireLocation, from.Map); } }
public override void OnDoubleClick( Mobile from ) { if ( !from.InRange( GetWorldLocation(), 2 ) ) from.SendLocalizedMessage( 500446 ); // That is too far away. else from.SendGump( new SkillStoneGump( this, from, 0 ) ); }
protected override void OnTargetFinish( Mobile from ) { if ( !m_Plant.Deleted && m_Plant.PlantStatus < PlantStatus.DecorativePlant && m_Plant.PlantStatus != PlantStatus.BowlOfDirt && from.InRange( m_Plant.GetWorldLocation(), 3 ) && m_Plant.IsUsableBy( from ) ) { from.SendGump( new ReproductionGump( m_Plant ) ); } }
public override void OnDoubleClick( Mobile from ) { if ( !from.InRange( this.GetWorldLocation(), 3 )) from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that. else from.SendAsciiMessage( "This looks like part of a larger contraption." ); }
public override void OnDoubleClickSecureTrade( Mobile from ) { if ( !from.InRange( GetWorldLocation(), 2 ) ) { from.SendLocalizedMessage( 500446 ); // That is too far away. } else if ( m_Entries.Count == 0 ) { from.SendLocalizedMessage( 1062381 ); // The book is empty. } else { from.SendGump( new BOBGump( (PlayerMobile)from, this ) ); SecureTradeContainer cont = GetSecureTradeCont(); if ( cont != null ) { SecureTrade trade = cont.Trade; if ( trade != null && trade.From.Mobile == from ) trade.To.Mobile.SendGump( new BOBGump( (PlayerMobile)(trade.To.Mobile), this ) ); else if ( trade != null && trade.To.Mobile == from ) trade.From.Mobile.SendGump( new BOBGump( (PlayerMobile)(trade.From.Mobile), this ) ); } } }
public override void OnDoubleClick( Mobile from ) { if (from.InRange(GetWorldLocation(), 2) && from.InLOS(this)) Roll(from); else from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. }
public virtual bool Dye(Mobile from, DyeTub sender) { if (this.Deleted) return false; BaseHouse house = BaseHouse.FindHouseAt(this); if (house != null && house.IsCoOwner(from)) { if (from.InRange(this.GetWorldLocation(), 1)) { this.Hue = sender.DyedHue; return true; } else { from.SendLocalizedMessage(500295); // You are too far away to do that. return false; } } else { return false; } }
public override void OnDoubleClick( Mobile from ) { if ( IsDeadPet ) return; if ( from.IsBodyMod && !from.Body.IsHuman ) { from.SendLocalizedMessage( 1061628 ); // You can't do that while polymorphed. return; } if ( from.Mounted ) { from.SendLocalizedMessage( 1005583 ); // Please dismount first. return; } if ( from.InRange( this, 1 ) ) { Rider = from; } else { from.SendLocalizedMessage( 500206 ); // That is too far away to ride. } }
public override void OnDoubleClick(Mobile from) { if ( from == null || !from.Alive ) return; // lumbervalue = 100; will give 100% sucsess in picking lumberValue = from.Skills[SkillName.Lumberjacking].Value / 5; if ( DateTime.Now > lastpicked.AddSeconds(3) ) // 3 seconds between picking { lastpicked = DateTime.Now; if ( from.InRange( this.GetWorldLocation(), 2 ) ) { if ( lumberValue > Utility.Random( 100 ) ) { from.Direction = from.GetDirectionTo( this ); from.Animate( 32, 5, 1, true, false, 0 ); // Bow from.SendMessage(AgriTxt.PullRoot); this.Delete(); from.AddToBackpack( new NightshadeUprooted() ); } else from.SendMessage(AgriTxt.HardPull); } else { from.SendMessage(AgriTxt.HardPull); } } }
public override void OnDoubleClick(Mobile from) { if ( from == null || !from.Alive ) return; // lumbervalue = 100; will give 100% sucsess in picking mageValue = from.Skills[SkillName.Magery].Value + 20; if ( DateTime.Now > lastpicked.AddSeconds(1) ) // 3 seconds between picking changed to 1 sec { lastpicked = DateTime.Now; if ( from.InRange( this.GetWorldLocation(), 1 ) ) { if ( mageValue > Utility.Random( 100 ) ) { from.Direction = from.GetDirectionTo( this ); from.Animate( 32, 5, 1, true, false, 0 ); // Bow from.SendMessage("You pull the plant up by the root."); this.Delete(); from.AddToBackpack( new MandrakeUprooted() ); } else from.SendMessage("The plant is hard to pull up."); } else { from.SendMessage( "You are too far away to harvest anything." ); } } }
protected override void OnTarget( Mobile from, object targeted ) { if ( !m_Plant.Deleted && from.InRange( m_Plant.GetWorldLocation(), 3 ) && targeted is Item ) { m_Plant.Pour( from, (Item)targeted ); } }
public override void OnDoubleClick( Mobile m ) { if ( !m_Active ) return; Map map = m_MapDest; if ( map == null || map == Map.Internal ) map = m.Map; Point3D p = m_PointDest; if ( p == Point3D.Zero ) p = m.Location; if ( m.InRange( this, 3 ) ) { Server.Mobiles.BaseCreature.TeleportPets( m, m_PointDest, m_MapDest ); m.MoveToWorld( m_PointDest, m_MapDest ); } else { m.SendLocalizedMessage( 1019045 ); // I can't reach that. } }
public override void OnDoubleClick(Mobile from) { if (!from.InRange(this.GetWorldLocation(), 2)) return; this.Roll(from); }
public bool ValidatePlacement(Mobile from, Point3D loc) { if (from.AccessLevel >= AccessLevel.GameMaster) return true; if (!from.InRange(this.GetWorldLocation(), 1)) { from.SendLocalizedMessage(500446); // That is too far away. return false; } Map map = from.Map; if (map == null) return false; BaseHouse house = BaseHouse.FindHouseAt(loc, map, 20); if (house != null && !house.IsFriend(from)) { from.SendLocalizedMessage(500269); // You cannot build that there. return false; } if (!map.CanFit(loc, 20)) { from.SendLocalizedMessage(500269); // You cannot build that there. return false; } return true; }
public override void OnComponentUsed(AddonComponent c, Mobile from) { if (from.InRange(c.Location, 2)) { if (this.m_Fruits > 0) { Item fruit = this.Fruit; if (fruit == null) return; if (!from.PlaceInBackpack(fruit)) { fruit.Delete(); from.SendLocalizedMessage(501015); // There is no room in your backpack for the fruit. } else { if (--this.m_Fruits == 0) Timer.DelayCall(TimeSpan.FromMinutes(30), new TimerCallback(Respawn)); from.SendLocalizedMessage(501016); // You pick some fruit and put it in your backpack. } } else from.SendLocalizedMessage(501017); // There is no more fruit on this tree } else from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. }
public override void OnDoubleClick(Mobile from) { if (from.InRange(this.GetWorldLocation(), 1)) this.UseGate(from); else from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that }
public override void OnDoubleClick( Mobile from ) { if ( (m_Arrows > 0 || m_Bolts > 0) && from.InRange( GetWorldLocation(), 1 ) ) Gather( from ); else Fire( from ); }
private void DoCounter(Mobile attacker) { if (Map == null) { return; } if (!(Utility.RandomDouble() < 0.2)) { return; } Mobile target = null; if (attacker is BaseCreature bcAttacker) { if (bcAttacker.BardProvoked) { return; } target = bcAttacker.GetMaster(); } /* Counterattack with Hit Poison Area * 20-25 damage, unresistable * Lethal poison, 100% of the time * Particle effect: Type: "2" From: "0x4061A107" To: "0x0" ItemId: "0x36BD" ItemIdName: "explosion" FromLocation: "(296 615, 17)" ToLocation: "(296 615, 17)" Speed: "1" Duration: "10" FixedDirection: "True" Explode: "False" Hue: "0xA6" RenderMode: "0x0" Effect: "0x1F78" ExplodeEffect: "0x1" ExplodeSound: "0x0" Serial: "0x4061A107" Layer: "255" Unknown: "0x0" * Doesn't work on provoked monsters */ if (target?.InRange(this, 25) != true) { target = attacker; } Animate(10, 4, 1, true, false, 0); IPooledEnumerable <Mobile> eable = target.GetMobilesInRange <Mobile>(8); foreach (Mobile m in eable) { if (m == this || !(CanBeHarmful(m) || (m.Player && m.Alive))) { continue; } if (!(m is BaseCreature bc) || !(bc.Controlled || bc.Summoned || bc.Team != Team)) { continue; } DoHarmful(m); AOS.Damage(m, this, Utility.RandomMinMax(20, 25), true, 0, 0, 0, 100, 0); m.FixedParticles(0x36BD, 1, 10, 0x1F78, 0xA6, 0, (EffectLayer)255); m.ApplyPoison(this, Poison.Lethal); } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Ore.Deleted) { return; } if (!from.InRange(m_Ore.GetWorldLocation(), 2)) { from.SendLocalizedMessage(501976); // The ore is too far away. return; } if (IsForge(targeted)) { double difficulty; switch (m_Ore.Resource) { default: difficulty = 50.0; break; case CraftResource.DullCopper: difficulty = 40.0; break; case CraftResource.ShadowIron: difficulty = 45.0; break; case CraftResource.Copper: difficulty = 50.0; break; case CraftResource.Bronze: difficulty = 55.0; break; case CraftResource.Gold: difficulty = 60.0; break; case CraftResource.Agapite: difficulty = 65.0; break; case CraftResource.Verite: difficulty = 70.0; break; case CraftResource.Valorite: difficulty = 75.0; break; case CraftResource.Silver: difficulty = 80.0; break; case CraftResource.Platinum: difficulty = 85.0; break; case CraftResource.Mythril: difficulty = 90.0; break; case CraftResource.Obsidian: difficulty = 95.0; break; case CraftResource.Jade: difficulty = 100.0; break; case CraftResource.Moonstone: difficulty = 105.0; break; case CraftResource.Sunstone: difficulty = 110.0; break; case CraftResource.Bloodstone: difficulty = 115.0; break; } double minSkill = difficulty - 25.0; double maxSkill = difficulty + 25.0; if (difficulty > 50.0 && difficulty > from.Skills[SkillName.Mining].Value) { from.SendLocalizedMessage(501986); // You have no idea how to smelt this strange ore! return; } if (from.CheckTargetSkill(SkillName.Mining, targeted, minSkill, maxSkill)) { int toConsume = m_Ore.Amount; if (toConsume <= 0) { from.SendLocalizedMessage(501987); // There is not enough metal-bearing ore in this pile to make an ingot. } else { if (toConsume > 30000) { toConsume = 30000; } BaseIngot ingot = m_Ore.GetIngot(); ingot.Amount = toConsume * 2; m_Ore.Consume(toConsume); from.AddToBackpack(ingot); //from.PlaySound( 0x57 ); from.SendLocalizedMessage(501988); // You smelt the ore removing the impurities and put the metal in your backpack. } } else if (m_Ore.Amount < 2) { from.SendLocalizedMessage(501989); // You burn away the impurities but are left with no useable metal. m_Ore.Delete(); } else { from.SendLocalizedMessage(501990); // You burn away the impurities but are left with less useable metal. m_Ore.Amount /= 2; } } }
public void EndHeal() { StopHeal(); int healerNumber, patientNumber; bool playSound = true; bool checkSkills = false; SkillName primarySkill = GetPrimarySkill(Patient); SkillName secondarySkill = GetSecondarySkill(Patient); BaseCreature petPatient = Patient as BaseCreature; if (!Healer.Alive) { healerNumber = 500962; // You were unable to finish your work before you died. patientNumber = -1; playSound = false; } else if (!Healer.InRange(Patient, Bandage.Range)) { healerNumber = 500963; // You did not stay close enough to heal your target. patientNumber = -1; playSound = false; } else if (!Patient.Alive || petPatient?.IsDeadPet == true) { double healing = Healer.Skills[primarySkill].Value; double anatomy = Healer.Skills[secondarySkill].Value; double chance = (healing - 68.0) / 50.0 - Slips * 0.02; if ((checkSkills = healing >= 80.0 && anatomy >= 80.0) && chance > Utility.RandomDouble() || Core.SE && petPatient is FactionWarHorse && petPatient.ControlMaster == Healer ) //TODO: Dbl check doesn't check for faction of the horse here? { if (Patient.Map?.CanFit(Patient.Location, 16, false, false) != true) { healerNumber = 501042; // Target can not be resurrected at that location. patientNumber = 502391; // Thou can not be resurrected there! } else if (Patient.Region?.IsPartOf("Khaldun") == true) { healerNumber = 1010395; // The veil of death in this area is too strong and resists thy efforts to restore life. patientNumber = -1; } else { healerNumber = 500965; // You are able to resurrect your patient. patientNumber = -1; Patient.PlaySound(0x214); Patient.FixedEffect(0x376A, 10, 16); if (petPatient?.IsDeadPet == true) { Mobile master = petPatient.ControlMaster; if (master != null && Healer == master) { petPatient.ResurrectPet(); for (int i = 0; i < petPatient.Skills.Length; ++i) { petPatient.Skills[i].Base -= 0.1; } } else if (master?.InRange(petPatient, 3) == true) { healerNumber = 503255; // You are able to resurrect the creature. master.CloseGump <PetResurrectGump>(); master.SendGump(new PetResurrectGump(Healer, petPatient)); } else { bool found = false; List <Mobile> friends = petPatient.Friends; for (int i = 0; friends != null && i < friends.Count; ++i) { Mobile friend = friends[i]; if (friend.InRange(petPatient, 3)) { healerNumber = 503255; // You are able to resurrect the creature. friend.CloseGump <PetResurrectGump>(); friend.SendGump(new PetResurrectGump(Healer, petPatient)); found = true; break; } } if (!found) { healerNumber = 1049670; // The pet's owner must be nearby to attempt resurrection. } } } else { Patient.CloseGump <ResurrectGump>(); Patient.SendGump(new ResurrectGump(Patient, Healer)); } } } else { if (petPatient?.IsDeadPet == true) { healerNumber = 503256; // You fail to resurrect the creature. } else { healerNumber = 500966; // You are unable to resurrect your patient. } patientNumber = -1; } } else if (Patient.Poisoned) { Healer.SendLocalizedMessage(500969); // You finish applying the bandages. double healing = Healer.Skills[primarySkill].Value; double anatomy = Healer.Skills[secondarySkill].Value; double chance = (healing - 30.0) / 50.0 - Patient.Poison.Level * 0.1 - Slips * 0.02; if ((checkSkills = healing >= 60.0 && anatomy >= 60.0) && chance > Utility.RandomDouble()) { if (Patient.CurePoison(Healer)) { healerNumber = Healer == Patient ? -1 : 1010058; // You have cured the target of all poisons. patientNumber = 1010059; // You have been cured of all poisons. } else { healerNumber = -1; patientNumber = -1; } } else { healerNumber = 1010060; // You have failed to cure your target! patientNumber = -1; } } else if (BleedAttack.IsBleeding(Patient)) { healerNumber = 1060088; // You bind the wound and stop the bleeding patientNumber = 1060167; // The bleeding wounds have healed, you are no longer bleeding! BleedAttack.EndBleed(Patient, false); } else if (MortalStrike.IsWounded(Patient)) { healerNumber = Healer == Patient ? 1005000 : 1010398; patientNumber = -1; playSound = false; } else if (Patient.Hits == Patient.HitsMax) { healerNumber = 500967; // You heal what little damage your patient had. patientNumber = -1; } else { checkSkills = true; patientNumber = -1; double healing = Healer.Skills[primarySkill].Value; double anatomy = Healer.Skills[secondarySkill].Value; double chance = (healing + 10.0) / 100.0 - Slips * 0.02; if (chance > Utility.RandomDouble()) { healerNumber = 500969; // You finish applying the bandages. double min, max; if (Core.AOS) { min = anatomy / 8.0 + healing / 5.0 + 4.0; max = anatomy / 6.0 + healing / 2.5 + 4.0; } else { min = anatomy / 5.0 + healing / 5.0 + 3.0; max = anatomy / 5.0 + healing / 2.0 + 10.0; } double toHeal = min + Utility.RandomDouble() * (max - min); if (Patient.Body.IsMonster || Patient.Body.IsAnimal) { toHeal += Patient.HitsMax / 100.0; } if (Core.AOS) { toHeal -= toHeal * Slips * 0.35; // TODO: Verify algorithm } else { toHeal -= Slips * 4; } if (toHeal < 1) { toHeal = 1; healerNumber = 500968; // You apply the bandages, but they barely help. } Patient.Heal((int)toHeal, Healer, false); } else { healerNumber = 500968; // You apply the bandages, but they barely help. playSound = false; } } if (healerNumber != -1) { Healer.SendLocalizedMessage(healerNumber); } if (patientNumber != -1) { Patient.SendLocalizedMessage(patientNumber); } if (playSound) { Patient.PlaySound(0x57); } if (checkSkills) { Healer.CheckSkill(secondarySkill, 0.0, 120.0); Healer.CheckSkill(primarySkill, 0.0, 120.0); } }
public override void OnResponse(NetState sender, RelayInfo info) { if (info.ButtonID == 0) { return; } Mobile from = sender.Mobile; HouseSign sign = m_House.Sign; if (m_House.Deleted || sign == null || sign.Deleted || !from.CheckAlive()) { return; } if (from.Map != sign.Map || !from.InRange(sign, 5)) { from.SendLocalizedMessage(1062429); // You must be within five paces of the house sign to use this option. return; } int index = info.ButtonID - 1; if (index < 0 || index >= m_Inventories.Count) { return; } VendorInventory inventory = (VendorInventory)m_Inventories[index]; if (inventory.Owner != from || !m_House.VendorInventories.Contains(inventory)) { return; } int totalItems = 0; int givenToBackpack = 0; int givenToBankBox = 0; for (int i = inventory.Items.Count - 1; i >= 0; i--) { Item item = inventory.Items[i]; if (item.Deleted) { inventory.Items.RemoveAt(i); continue; } totalItems += 1 + item.TotalItems; if (from.PlaceInBackpack(item)) { inventory.Items.RemoveAt(i); givenToBackpack += 1 + item.TotalItems; } else if (from.BankBox.TryDropItem(from, item, false)) { inventory.Items.RemoveAt(i); givenToBankBox += 1 + item.TotalItems; } } from.SendLocalizedMessage(1062436, totalItems.ToString() + "\t" + inventory.Gold.ToString()); // The vendor you selected had ~1_COUNT~ items in its inventory, and ~2_AMOUNT~ gold in its account. int givenGold = Banker.DepositUpTo(from, inventory.Gold); inventory.Gold -= givenGold; from.SendLocalizedMessage(1060397, givenGold.ToString()); // ~1_AMOUNT~ gold has been deposited into your bank box. from.SendLocalizedMessage(1062437, givenToBackpack.ToString() + "\t" + givenToBankBox.ToString()); // ~1_COUNT~ items have been removed from the shop inventory and placed in your backpack. ~2_BANKCOUNT~ items were removed from the shop inventory and placed in your bank box. if (inventory.Gold > 0 || inventory.Items.Count > 0) { from.SendLocalizedMessage(1062440); // Some of the shop inventory would not fit in your backpack or bank box. Please free up some room and try again. } else { inventory.Delete(); from.SendLocalizedMessage(1062438); // The shop is now empty of inventory and funds, so it has been deleted. } }
public override void OnResponse(NetState state, RelayInfo info) { if (info.ButtonID == 0) // Cancel { return; } else if (m_Mobile.Deleted || m_Moongate.Deleted || m_Mobile.Map == null) { return; } int[] switches = info.Switches; if (switches.Length == 0) { return; } int switchID = switches[0]; int listIndex = switchID / 100; int listEntry = switchID % 100; if (listIndex < 0 || listIndex >= m_Lists.Length) { return; } PMList list = m_Lists[listIndex]; if (listEntry < 0 || listEntry >= list.Entries.Length) { return; } PMEntry entry = list.Entries[listEntry]; if (m_Mobile.Map == list.Map && m_Mobile.InRange(entry.Location, 1)) { m_Mobile.SendLocalizedMessage(1019003); // You are already there. return; } else if (m_Mobile.IsStaff()) { //Staff can always use a gate! } else if (!m_Mobile.InRange(m_Moongate.GetWorldLocation(), 1) || m_Mobile.Map != m_Moongate.Map) { m_Mobile.SendLocalizedMessage(1019002); // You are too far away to use the gate. return; } else if (m_Mobile.Player && m_Mobile.Murderer && list.Map != Map.Felucca && !Siege.SiegeShard) { m_Mobile.SendLocalizedMessage(1019004); // You are not allowed to travel there. return; } else if (Factions.Sigil.ExistsOn(m_Mobile) && list.Map != Factions.Faction.Facet) { m_Mobile.SendLocalizedMessage(1019004); // You are not allowed to travel there. return; } else if (m_Mobile.Criminal) { m_Mobile.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily. return; } else if (SpellHelper.CheckCombat(m_Mobile)) { m_Mobile.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle?? return; } else if (m_Mobile.Spell != null) { m_Mobile.SendLocalizedMessage(1049616); // You are too busy to do that at the moment. return; } BaseCreature.TeleportPets(m_Mobile, entry.Location, list.Map); m_Mobile.Combatant = null; m_Mobile.Warmode = false; m_Mobile.Hidden = true; m_Mobile.MoveToWorld(entry.Location, list.Map); Effects.PlaySound(entry.Location, list.Map, 0x1FE); Server.Engines.CityLoyalty.CityTradeSystem.OnPublicMoongateUsed(m_Mobile); }
protected override void OnTarget(Mobile from, object targeted) { if (!m_Crystal.IsAccessibleTo(from)) { return; } if (from.Map != m_Crystal.Map || !from.InRange(m_Crystal.GetWorldLocation(), 2)) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. return; } if (targeted == m_Crystal) { if (m_Crystal.Active) { m_Crystal.Active = false; from.SendLocalizedMessage(500672); // You turn the crystal off. } else { if (m_Crystal.Charges > 0) { m_Crystal.Active = true; from.SendLocalizedMessage(500673); // You turn the crystal on. } else { from.SendLocalizedMessage(500676); // This crystal is out of charges. } } } else if (targeted is ReceiverCrystal) { ReceiverCrystal receiver = (ReceiverCrystal)targeted; if (m_Crystal.Receivers.Count >= 10) { from.SendLocalizedMessage(1010042); // This broadcast crystal is already linked to 10 receivers. } else if (receiver.Sender == m_Crystal) { from.SendLocalizedMessage(500674); // This crystal is already linked with that crystal. } else if (receiver.Sender != null) { from.SendLocalizedMessage(1010043); // That receiver crystal is already linked to another broadcast crystal. } else { receiver.Sender = m_Crystal; from.SendLocalizedMessage(500675); // That crystal has been linked to this crystal. } } else if (targeted == from) { foreach (ReceiverCrystal receiver in new List <ReceiverCrystal>(m_Crystal.Receivers)) { receiver.Sender = null; } from.SendLocalizedMessage(1010046); // You unlink the broadcast crystal from all of its receivers. } else { Item targItem = targeted as Item; if (targItem != null && targItem.VerifyMove(from)) { CrystalRechargeInfo info = CrystalRechargeInfo.Get(targItem.GetType()); if (info != null) { if (m_Crystal.Charges >= MaxCharges) { from.SendLocalizedMessage(500678); // This crystal is already fully charged. } else { targItem.Consume(); if (m_Crystal.Charges + info.Amount >= MaxCharges) { m_Crystal.Charges = MaxCharges; from.SendLocalizedMessage(500679); // You completely recharge the crystal. } else { m_Crystal.Charges += info.Amount; from.SendLocalizedMessage(500680); // You recharge the crystal. } } return; } } from.SendLocalizedMessage(500681); // You cannot use this crystal on that. } }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; if (from == null) { return; } if (info.ButtonID == 1) // Previous page { if (m_ListPage > 0) { from.SendGump(new PCMoongateGump(m_Gate, m_ListPage - 1, m_List, m_CountList)); } } if (info.ButtonID == 2) // Next page { if ((m_ListPage + 1) * 7 < m_List.Count) { from.SendGump(new PCMoongateGump(m_Gate, m_ListPage + 1, m_List, m_CountList)); } } if (info.ButtonID >= 100) // Travel { if (from.InRange(m_Gate.GetWorldLocation(), 3)) { CityManagementStone incomingCity = m_List[info.ButtonID - 100] as CityManagementStone; CityManagementStone outgoingCity = null; Region currentRegion = Region.Find(from.Location, from.Map); if (currentRegion != null) { if (currentRegion is PlayerCityRegion) { PlayerCityRegion pcr = (PlayerCityRegion)currentRegion; outgoingCity = pcr.Stone; } } if (incomingCity.MoongateLocation == m_Gate.Location) { from.SendMessage("You are already there."); } else if (incomingCity.TravelTax >= 1 && !IsCitizen(from, incomingCity)) { from.SendGump(new PCMoongateTollGump(m_Gate, incomingCity, outgoingCity)); } else if (outgoingCity != null && outgoingCity.TravelTax >= 1 && !IsCitizen(from, outgoingCity)) { from.SendGump(new PCMoongateTollGump(m_Gate, incomingCity, outgoingCity)); } else { BaseCreature.TeleportPets(from, incomingCity.MoongateLocation, incomingCity.Map); from.Combatant = null; from.Warmode = false; from.Hidden = true; from.MoveToWorld(incomingCity.MoongateLocation, incomingCity.Map); Effects.PlaySound(incomingCity.MoongateLocation, incomingCity.Map, 0x1FE); } } else { from.SendMessage("You are to far away from the moongate."); } } }
public void Fire(Mobile from) { BaseRanged bow = from.Weapon as BaseRanged; if (bow == null) { SendLocalizedMessageTo(from, 500593); // You must practice with ranged weapons on this. return; } if (DateTime.UtcNow < (m_LastUse + UseDelay)) { return; } Point3D worldLoc = GetWorldLocation(); if (FacingEast ? from.X <= worldLoc.X : from.Y <= worldLoc.Y) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500596); // You would do better to stand in front of the archery butte. return; } if (FacingEast ? from.Y != worldLoc.Y : from.X != worldLoc.X) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500597); // You aren't properly lined up with the archery butte to get an accurate shot. return; } if (!from.InRange(worldLoc, 6)) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500598); // You are too far away from the archery butte to get an accurate shot. return; } else if (from.InRange(worldLoc, 4)) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500599); // You are too close to the target. return; } Container pack = from.Backpack; Type ammoType = bow.AmmoType; bool isArrow = (ammoType == typeof(Arrow)); bool isBolt = (ammoType == typeof(Bolt)); bool isKnown = (isArrow || isBolt); if (pack == null || !pack.ConsumeTotal(ammoType, 1)) { if (isArrow) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500594); // You do not have any arrows with which to practice. } else if (isBolt) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500595); // You do not have any crossbow bolts with which to practice. } else { SendLocalizedMessageTo(from, 500593); // You must practice with ranged weapons on this. } return; } m_LastUse = DateTime.UtcNow; from.Direction = from.GetDirectionTo(GetWorldLocation()); bow.PlaySwingAnimation(from); from.MovingEffect(this, bow.EffectID, 18, 1, false, false); ScoreEntry se = GetEntryFor(from); if (!from.CheckSkill(bow.Skill, m_MinSkill, m_MaxSkill)) { from.PlaySound(bow.MissSound); PublicOverheadMessage(MessageType.Regular, 0x3B2, 500604, from.Name); // You miss the target altogether. se.Record(0); if (se.Count == 1) { PublicOverheadMessage(MessageType.Regular, 0x3B2, 1062719, se.Total.ToString()); } else { PublicOverheadMessage(MessageType.Regular, 0x3B2, 1042683, String.Format("{0}\t{1}", se.Total, se.Count)); } return; } Effects.PlaySound(Location, Map, 0x2B1); double rand = Utility.RandomDouble(); int area, score, splitScore; if (0.10 > rand) { area = 0; // bullseye score = 50; splitScore = 100; } else if (0.25 > rand) { area = 1; // inner ring score = 10; splitScore = 20; } else if (0.50 > rand) { area = 2; // middle ring score = 5; splitScore = 15; } else { area = 3; // outer ring score = 2; splitScore = 5; } bool split = (isKnown && ((m_Arrows + m_Bolts) * 0.02) > Utility.RandomDouble()); if (split) { PublicOverheadMessage(MessageType.Regular, 0x3B2, 1010027 + area, String.Format("{0}\t{1}", from.Name, isArrow ? "arrow" : "bolt")); } else { PublicOverheadMessage(MessageType.Regular, 0x3B2, 1010035 + area, from.Name); if (isArrow) { ++m_Arrows; } else if (isBolt) { ++m_Bolts; } } se.Record(split ? splitScore : score); if (se.Count == 1) { PublicOverheadMessage(MessageType.Regular, 0x3B2, 1062719, se.Total.ToString()); } else { PublicOverheadMessage(MessageType.Regular, 0x3B2, 1042683, String.Format("{0}\t{1}", se.Total, se.Count)); } }
public override void OnSpeech(SpeechEventArgs e) { base.OnSpeech(e); Mobile from = e.Mobile; Item sign = House.Sign; bool isOwner = House.IsOwner(from); bool isCoOwner = isOwner || House.IsCoOwner(from); bool isFriend = isCoOwner || House.IsFriend(from); if (!isFriend) { return; } if (!from.Alive) { return; } if (Insensitive.Equals(e.Speech, "I wish to resize my house")) { if (from.Map != sign.Map || !from.InRange(sign, 0)) { from.SendLocalizedMessage(500295); // you are too far away to do that. } else if (DateTime.UtcNow <= House.BuiltOn.AddHours(1)) { from.SendLocalizedMessage(1080178); // You must wait one hour between each house demolition. } else if (isOwner) { from.CloseGump(typeof(ConfirmHouseResize)); from.CloseGump(typeof(HouseGump)); from.SendGump(new ConfirmHouseResize(from, House)); } else { from.SendLocalizedMessage(501320); // Only the house owner may do } } if (!House.IsInside(from) || !House.IsActive) { return; } else if (e.HasKeyword(0x33)) // remove thyself { from.SendLocalizedMessage(501326); // Target the individual to eject from this house. from.Target = new HouseKickTarget(House); } else if (e.HasKeyword(0x34)) // I ban thee { if (!House.Public) { from.SendLocalizedMessage(1062521); // You cannot ban someone from a private house. Revoke their access instead. } else { from.SendLocalizedMessage(501325); // Target the individual to ban from this house. from.Target = new HouseBanTarget(true, House); } } else if (e.HasKeyword(0x23)) // I wish to lock this down { from.SendLocalizedMessage(502097); // Lock what down? from.Target = new LockdownTarget(false, House); } else if (e.HasKeyword(0x24)) // I wish to release this { from.SendLocalizedMessage(502100); // Choose the item you wish to release from.Target = new LockdownTarget(true, House); } else if (e.HasKeyword(0x25)) // I wish to secure this { if (isCoOwner) { from.SendLocalizedMessage(502103); // Choose the item you wish to secure from.Target = new SecureTarget(false, House); } else { from.SendLocalizedMessage(502094); // You must be in your house to do this. } } else if (e.HasKeyword(0x26)) // I wish to unsecure this { if (isOwner) { from.SendLocalizedMessage(502106); // Choose the item you wish to unsecure from.Target = new SecureTarget(true, House); } else { from.SendLocalizedMessage(502094); // You must be in your house to do this. } } else if (e.HasKeyword(0x27)) // I wish to place a strongbox { if (isOwner) { from.SendLocalizedMessage(502109); // Owners do not get a strongbox of their own. } else if (isCoOwner) { House.AddStrongBox(from); } else { from.SendLocalizedMessage(1010587); // You are not a co-owner of this house. } } else if (e.HasKeyword(0x28)) // trash barrel { if (isCoOwner) { House.AddTrashBarrel(from); } else { from.SendLocalizedMessage(1010587); // You are not a co-owner of this house. } } }
protected override void OnTarget(Mobile from, object targeted) { if (this.m_Item.Deleted) { return; } Item item = targeted as Item; if (null != item) { bool valid = (item is IDyable || item is BaseBook || item is BaseClothing || item is BaseJewel || item is BaseStatuette || item is BaseWeapon || item is Runebook || item is Spellbook); if (!valid && item is BaseArmor) { CraftResourceType restype = CraftResources.GetType(((BaseArmor)item).Resource); if ((CraftResourceType.Leather == restype || CraftResourceType.Metal == restype) && ArmorMaterialType.Bone != ((BaseArmor)item).MaterialType) { valid = true; } } if (!valid && FurnitureAttribute.Check(item)) { if (!from.InRange(this.m_Item.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1)) { from.SendLocalizedMessage(500446); // That is too far away. return; } else { BaseHouse house = BaseHouse.FindHouseAt(item); if (house == null || (!house.IsLockedDown(item) && !house.IsSecure(item))) { from.SendLocalizedMessage(501022); // Furniture must be locked down to paint it. return; } else if (!house.IsCoOwner(from)) { from.SendLocalizedMessage(501023); // You must be the owner to use this item. return; } else { valid = true; } } } // need to add any bags, chests, boxes, crates not IDyable but dyable by natural dyes if (valid) { item.Hue = PlantPigmentHueInfo.GetInfo(this.m_Item.PigmentHue).Hue; from.PlaySound(0x23E); if (--this.m_Item.UsesRemaining > 0) { this.m_Item.InvalidateProperties(); } else { this.m_Item.Delete(); } return; } } from.SendLocalizedMessage(1042083); // You cannot dye that. }
public override void OnDoubleClick(Mobile from) { if (!from.InRange(GetWorldLocation(), 2)) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. return; } Point2D[] banks; PMList moongates; /* * if ( from.Map == Map.Trammel ) * { * banks = m_TrammelBanks; * moongates = PMList.Trammel; * } * else*/ if (from.Map == Map.Felucca) { banks = m_FeluccaBanks; moongates = PMList.Felucca; } /* * else if ( from.Map == Map.Ilshenar ) * { #if false * banks = m_IlshenarBanks; * moongates = PMList.Ilshenar; #else * from.Send( new MessageLocalized( Serial, ItemID, MessageType.Label, 0x482, 3, 1061684, "", "" ) ); // The magic of the sextant fails... * return; #endif * } * else if ( from.Map == Map.Malas ) * { * banks = m_MalasBanks; * moongates = PMList.Malas; * } */ else { banks = null; moongates = null; } Point3D closestMoongate = Point3D.Zero; double moongateDistance = double.MaxValue; if (moongates != null) { foreach (PMEntry entry in moongates.Entries) { double dist = from.GetDistanceToSqrt(entry.Location); if (moongateDistance > dist) { closestMoongate = entry.Location; moongateDistance = dist; } } } Point2D closestBank = Point2D.Zero; double bankDistance = double.MaxValue; if (banks != null) { foreach (Point2D p in banks) { double dist = from.GetDistanceToSqrt(p); if (bankDistance > dist) { closestBank = p; bankDistance = dist; } } } int moonMsg; if (moongateDistance == double.MaxValue) { moonMsg = 1048021; // The sextant fails to find a Moongate nearby. } else if (moongateDistance > m_LongDistance) { moonMsg = 1046449 + (int)from.GetDirectionTo(closestMoongate); // A moongate is * from here } else if (moongateDistance > m_ShortDistance) { moonMsg = 1048010 + (int)from.GetDirectionTo(closestMoongate); // There is a Moongate * of here. } else { moonMsg = 1048018; // You are next to a Moongate at the moment. } from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, 0x482, 3, moonMsg, "", "")); int bankMsg; if (bankDistance == double.MaxValue) { bankMsg = 1048020; // The sextant fails to find a Bank nearby. } else if (bankDistance > m_LongDistance) { bankMsg = 1046462 + (int)from.GetDirectionTo(closestBank); // A town is * from here } else if (bankDistance > m_ShortDistance) { bankMsg = 1048002 + (int)from.GetDirectionTo(closestBank); // There is a city Bank * of here. } else { bankMsg = 1048019; // You are next to a Bank at the moment. } from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, 0x5AA, 3, bankMsg, "", "")); }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is Item) { Item item = (Item)targeted; if (item is IDyable && m_Tub.AllowDyables) { if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1)) { from.SendLocalizedMessage(500446); // That is too far away. } else if (item.Parent is Mobile) { from.SendLocalizedMessage(500861); // Can't Dye clothing that is being worn. } else if (((IDyable)item).Dye(from, m_Tub)) { from.PlaySound(0x23E); } } else if ((FurnitureAttribute.Check(item) || (item is PotionKeg)) && m_Tub.AllowFurniture) { if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1)) { from.SendLocalizedMessage(500446); // That is too far away. } else { bool okay = (item.IsChildOf(from.Backpack)); if (!okay) { if (item.Parent == null) { BaseHouse house = BaseHouse.FindHouseAt(item); if (house == null || !house.IsLockedDown(item)) { from.SendLocalizedMessage(501022); // Furniture must be locked down to paint it. } else if (!house.IsCoOwner(from)) { from.SendLocalizedMessage(501023); // You must be the owner to use this item. } else { okay = true; } } else { from.SendLocalizedMessage(1048135); // The furniture must be in your backpack to be painted. } } if (okay) { item.Hue = m_Tub.DyedHue; from.PlaySound(0x23E); } } } else if ((item is Runebook || item is RecallRune) && m_Tub.AllowRunebooks) { if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1)) { from.SendLocalizedMessage(500446); // That is too far away. } else if (!item.Movable) { from.SendLocalizedMessage(1049776); // You cannot dye runes or runebooks that are locked down. } else { item.Hue = m_Tub.DyedHue; from.PlaySound(0x23E); } } //Changed Line 209 for MongbatDartboard from Spring Decor else if ((item is MonsterStatuette || item is MongbatDartboard || item is BlessedStatue) && m_Tub.AllowStatuettes) { if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1)) { from.SendLocalizedMessage(500446); // That is too far away. } else if (!item.Movable) { from.SendLocalizedMessage(1049779); // You cannot dye statuettes that are locked down. } else { item.Hue = m_Tub.DyedHue; from.PlaySound(0x23E); } } else if ((item is BaseArmor && (((BaseArmor)item).MaterialType == ArmorMaterialType.Leather || ((BaseArmor)item).MaterialType == ArmorMaterialType.Studded)) && m_Tub.AllowLeather) { if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1)) { from.SendLocalizedMessage(500446); // That is too far away. } else if (!item.Movable) { from.SendLocalizedMessage(1042419); // You may not dye leather items which are locked down. } else if (item.Parent is Mobile) { from.SendLocalizedMessage(500861); // Can't Dye clothing that is being worn. } else { item.Hue = m_Tub.DyedHue; from.PlaySound(0x23E); } } else { from.SendLocalizedMessage(m_Tub.FailMessage); } } else { from.SendLocalizedMessage(m_Tub.FailMessage); } }
private Item TryStealItem(Item toSteal, ref bool caught) { Item stolen = null; object root = toSteal.RootParent; StealableArtifactsSpawner.StealableInstance si = null; if (toSteal.Parent == null || !toSteal.Movable) { si = toSteal is AddonComponent?StealableArtifactsSpawner.GetStealableInstance(((AddonComponent)toSteal).Addon) : StealableArtifactsSpawner.GetStealableInstance(toSteal); } if (!IsEmptyHanded(m_Thief)) { m_Thief.SendLocalizedMessage(1005584); // Both hands must be free to steal. } else if (root is Mobile && ((Mobile)root).Player && !IsInGuild(m_Thief)) { m_Thief.SendLocalizedMessage(1005596); // You must be in the thieves guild to steal from other players. } else if (SuspendOnMurder && root is Mobile && ((Mobile)root).Player && IsInGuild(m_Thief) && m_Thief.Kills > 0) { m_Thief.SendLocalizedMessage(502706); // You are currently suspended from the thieves guild. } else if (root is BaseVendor && ((BaseVendor)root).IsInvulnerable) { m_Thief.SendLocalizedMessage(1005598); // You can't steal from shopkeepers. } else if (root is PlayerVendor) { m_Thief.SendLocalizedMessage(502709); // You can't steal from vendors. } else if (!m_Thief.CanSee(toSteal)) { m_Thief.SendLocalizedMessage(500237); // Target can not be seen. } else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, toSteal, false, true)) { m_Thief.SendLocalizedMessage(1048147); // Your backpack can't hold anything else. } else if (toSteal is VvVSigil && ViceVsVirtueSystem.Instance != null) { VvVPlayerEntry entry = ViceVsVirtueSystem.Instance.GetPlayerEntry <VvVPlayerEntry>(m_Thief); VvVSigil sig = (VvVSigil)toSteal; if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1)) { m_Thief.SendLocalizedMessage(502703); // You must be standing next to an item to steal it. } else if (root != null) // not on the ground { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (entry != null) { if (!m_Thief.CanBeginAction(typeof(IncognitoSpell))) { m_Thief.SendLocalizedMessage(1010581); // You cannot steal the sigil when you are incognito } else if (DisguiseTimers.IsDisguised(m_Thief)) { m_Thief.SendLocalizedMessage(1010583); // You cannot steal the sigil while disguised } else if (!m_Thief.CanBeginAction(typeof(PolymorphSpell))) { m_Thief.SendLocalizedMessage(1010582); // You cannot steal the sigil while polymorphed } else if (TransformationSpellHelper.UnderTransformation(m_Thief)) { m_Thief.SendLocalizedMessage(1061622); // You cannot steal the sigil while in that form. } else if (AnimalForm.UnderTransformation(m_Thief)) { m_Thief.SendLocalizedMessage(1063222); // You cannot steal the sigil while mimicking an animal. } else if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, 100.0, 120.0)) { if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, sig, false, true)) { m_Thief.SendLocalizedMessage(1010259); // The sigil has gone home because your backpack is full } else { m_Thief.SendLocalizedMessage(1010586); // YOU STOLE THE SIGIL!!! (woah, calm down now) sig.OnStolen(entry); return(sig); } } else { m_Thief.SendLocalizedMessage(1005594); // You do not have enough skill to steal the sigil } } else { m_Thief.SendLocalizedMessage(1155415); // Only participants in Vice vs Virtue may use this item. } } else if (si == null && (toSteal.Parent == null || !toSteal.Movable) && !ItemFlags.GetStealable(toSteal)) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if ((toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(root)) && !ItemFlags.GetStealable(toSteal)) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (si == null && toSteal is Container && !ItemFlags.GetStealable(toSteal)) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1)) { m_Thief.SendLocalizedMessage(502703); // You must be standing next to an item to steal it. } else if (si != null && m_Thief.Skills[SkillName.Stealing].Value < 100.0) { m_Thief.SendLocalizedMessage(1060025, "", 0x66D); // You're not skilled enough to attempt the theft of this item. } else if (toSteal.Parent is Mobile) { m_Thief.SendLocalizedMessage(1005585); // You cannot steal items which are equiped. } else if (root == m_Thief) { m_Thief.SendLocalizedMessage(502704); // You catch yourself red-handed. } else if (root is Mobile && ((Mobile)root).IsStaff()) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (root is Mobile && !m_Thief.CanBeHarmful((Mobile)root)) { } else if (root is Corpse || !CheckHouse(toSteal, root)) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else { double w = toSteal.Weight + toSteal.TotalWeight; if (w > 10) { m_Thief.SendMessage("That is too heavy to steal."); } else { if (toSteal.Stackable && toSteal.Amount > 1) { int maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight); if (maxAmount < 1) { maxAmount = 1; } else if (maxAmount > toSteal.Amount) { maxAmount = toSteal.Amount; } int amount = Utility.RandomMinMax(1, maxAmount); if (amount >= toSteal.Amount) { int pileWeight = (int)Math.Ceiling(toSteal.Weight * toSteal.Amount); pileWeight *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5)) { stolen = toSteal; } } else { int pileWeight = (int)Math.Ceiling(toSteal.Weight * amount); pileWeight *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5)) { stolen = Mobile.LiftItemDupe(toSteal, toSteal.Amount - amount); if (stolen == null) { stolen = toSteal; } } } } else { int iw = (int)Math.Ceiling(w); iw *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5)) { stolen = toSteal; } } // Non-movable stealable (not in fillable container) items cannot result in the stealer getting caught if (stolen != null && (root is FillableContainer || stolen.Movable)) { double skillValue = m_Thief.Skills[SkillName.Stealing].Value; if (root is FillableContainer) { caught = (Utility.Random((int)(skillValue / 2.5)) == 0); // 1 of 48 chance at 120 } else { caught = (skillValue < Utility.Random(150)); } } else { caught = false; } if (stolen != null) { m_Thief.SendLocalizedMessage(502724); // You succesfully steal the item. ItemFlags.SetTaken(stolen, true); ItemFlags.SetStealable(stolen, false); stolen.Movable = true; InvokeItemStoken(new ItemStolenEventArgs(stolen, m_Thief)); if (si != null) { toSteal.Movable = true; si.Item = null; } } else { m_Thief.SendLocalizedMessage(502723); // You fail to steal the item. } } } return(stolen); }
public override void OnDoubleClick(Mobile from) { if (IsDeadPet) { return; } if (from.IsBodyMod && !from.Body.IsHuman) { if (Core.AOS) // You cannot ride a mount in your current form. { PrivateOverheadMessage(Network.MessageType.Regular, 0x3B2, 1062061, from.NetState); } else { from.SendLocalizedMessage(1061628); // You can't do that while polymorphed. } return; } if (!CheckMountAllowed(from, true)) { return; } if (from.Mounted) { from.SendLocalizedMessage(1005583); // Please dismount first. return; } if (from.Female ? !AllowFemaleRider : !AllowMaleRider) { OnDisallowedRider(from); return; } if (!Multis.DesignContext.Check(from)) { return; } if (from.HasTrade) { from.SendLocalizedMessage(1042317, "", 0x41); // You may not ride at this time return; } if (from.InRange(this, 1)) { bool canAccess = (from.AccessLevel >= AccessLevel.GameMaster) || (Controlled && ControlMaster == from) || (Summoned && SummonMaster == from); if (canAccess) { if (this.Poisoned) { PrivateOverheadMessage(Network.MessageType.Regular, 0x3B2, 1049692, from.NetState); // This mount is too ill to ride. } else { Rider = from; } } else if (!Controlled && !Summoned) { // That mount does not look broken! You would have to tame it to ride it. PrivateOverheadMessage(Network.MessageType.Regular, 0x3B2, 501263, from.NetState); } else { // This isn't your mount; it refuses to let you ride. PrivateOverheadMessage(Network.MessageType.Regular, 0x3B2, 501264, from.NetState); } } else { from.SendLocalizedMessage(500206); // That is too far away to ride. } }
public static TimeSpan OnUse(Mobile m) { if (m.Target != null || m.Spell != null) { m.SendLocalizedMessage(501238); // You are busy doing something else and cannot hide. return(TimeSpan.FromSeconds(1.0)); } double bonus = 0.0; BaseHouse house = BaseHouse.FindHouseAt(m); if (house != null && house.IsFriend(m)) { bonus = 100.0; } else if (!Core.AOS) { if (house == null) { house = BaseHouse.FindHouseAt(new Point3D(m.X - 1, m.Y, 127), m.Map, 16); } if (house == null) { house = BaseHouse.FindHouseAt(new Point3D(m.X + 1, m.Y, 127), m.Map, 16); } if (house == null) { house = BaseHouse.FindHouseAt(new Point3D(m.X, m.Y - 1, 127), m.Map, 16); } if (house == null) { house = BaseHouse.FindHouseAt(new Point3D(m.X, m.Y + 1, 127), m.Map, 16); } if (house != null) { bonus = 50.0; } } int range = 18 - (int)(m.Skills[SkillName.Hiding].Value / 10); bool badCombat = (m.Combatant != null && m.InRange(m.Combatant.Location, range) && m.Combatant.InLOS(m)); bool ok = (!badCombat /*&& m.CheckSkill( SkillName.Hiding, 0.0 - bonus, 100.0 - bonus )*/); if (ok) { IPooledEnumerable eable = m.GetMobilesInRange(range); foreach (Mobile check in eable) { if (check.InLOS(m) && check.Combatant == m) { badCombat = true; ok = false; break; } } eable.Free(); ok = (!badCombat && m.CheckSkill(SkillName.Hiding, 0.0 - bonus, 100.0 - bonus)); } if (badCombat) { m.RevealingAction(); m.LocalOverheadMessage(MessageType.Regular, 0x22, 501237); // You can't seem to hide right now. return(TimeSpan.FromSeconds(1.0)); } else { if (ok) { m.Hidden = true; m.LocalOverheadMessage(MessageType.Regular, 0x1F4, 501240); // You have hidden yourself well. } else { m.RevealingAction(); m.LocalOverheadMessage(MessageType.Regular, 0x22, 501241); // You can't seem to hide here. } return(TimeSpan.FromSeconds(10.0)); } }
public static void Gain(Mobile from, Skill skill) { if (from.Region.IsPartOf <Regions.Jail>()) { return; } if (from is BaseCreature && ((BaseCreature)from).IsDeadPet) { return; } if (skill.SkillName == SkillName.Focus && from is BaseCreature && (!PetTrainingHelper.Enabled || !((BaseCreature)from).Controlled)) { return; } if (skill.Base < skill.Cap && skill.Lock == SkillLock.Up) { int toGain = 1; Skills skills = from.Skills; if (from is PlayerMobile && Siege.SiegeShard) { int minsPerGain = Siege.MinutesPerGain(from, skill); if (minsPerGain > 0) { if (Siege.CheckSkillGain((PlayerMobile)from, minsPerGain, skill)) { if (from is PlayerMobile) { CheckReduceSkill((PlayerMobile)from, skills, toGain, skill); } if (skills.Total + toGain <= skills.Cap) { skill.BaseFixedPoint += toGain; } } return; } } if (skill.Base <= 10.0) { toGain = Utility.Random(4) + 1; } #region Mondain's Legacy if (from is PlayerMobile && Server.Engines.Quests.QuestHelper.EnhancedSkill((PlayerMobile)from, skill)) { toGain *= Utility.RandomMinMax(2, 4); } #endregion #region Scroll of Alacrity if (from is PlayerMobile && skill.SkillName == ((PlayerMobile)from).AcceleratedSkill && ((PlayerMobile)from).AcceleratedStart > DateTime.UtcNow) { ((PlayerMobile)from).SendLocalizedMessage(1077956); // You are infused with intense energy. You are under the effects of an accelerated skillgain scroll. toGain = Utility.RandomMinMax(2, 5); } #endregion #region Skill Masteries else if (from is BaseCreature && (((BaseCreature)from).Controlled || ((BaseCreature)from).Summoned)) { Mobile master = ((BaseCreature)from).GetMaster(); if (master != null) { WhisperingSpell spell = SkillMasterySpell.GetSpell(master, typeof(WhisperingSpell)) as WhisperingSpell; if (spell != null && master.InRange(from.Location, spell.PartyRange) && master.Map == from.Map && spell.EnhancedGainChance >= Utility.Random(100)) { toGain = Utility.RandomMinMax(2, 5); } } } #endregion if (from is PlayerMobile) { CheckReduceSkill((PlayerMobile)from, skills, toGain, skill); } if (!from.Player || (skills.Total + toGain <= skills.Cap)) { skill.BaseFixedPoint = Math.Min(skill.CapFixedPoint, skill.BaseFixedPoint + toGain); if (from is PlayerMobile) { UpdateGGS(from, skill); } } } #region Mondain's Legacy if (from is PlayerMobile) { Server.Engines.Quests.QuestHelper.CheckSkill((PlayerMobile)from, skill); } #endregion if (skill.Lock == SkillLock.Up && (!Siege.SiegeShard || !(from is PlayerMobile) || Siege.CanGainStat((PlayerMobile)from))) { SkillInfo info = skill.Info; // Old gain mechanic if (!Core.ML) { if (from.StrLock == StatLockType.Up && (info.StrGain / 33.3) > Utility.RandomDouble()) { GainStat(from, Stat.Str); } else if (from.DexLock == StatLockType.Up && (info.DexGain / 33.3) > Utility.RandomDouble()) { GainStat(from, Stat.Dex); } else if (from.IntLock == StatLockType.Up && (info.IntGain / 33.3) > Utility.RandomDouble()) { GainStat(from, Stat.Int); } } else { TryStatGain(info, from); } } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Ore.Deleted) { return; } if (!from.InRange(m_Ore.GetWorldLocation(), 2)) { from.SendLocalizedMessage(501976); // The ore is too far away. return; } #region Combine Ore if (targeted is BaseOre) { BaseOre ore = (BaseOre)targeted; if (!ore.Movable) { return; } else if (m_Ore == ore) { from.SendLocalizedMessage(501972); // Select another pile or ore with which to combine this. from.Target = new InternalTarget(ore); return; } else if (ore.Resource != m_Ore.Resource) { from.SendLocalizedMessage(501979); // You cannot combine ores of different metals. return; } int worth = ore.Amount; if (ore.ItemID == 0x19B9) { worth *= 8; } else if (ore.ItemID == 0x19B7) { worth *= 2; } else { worth *= 4; } int sourceWorth = m_Ore.Amount; if (m_Ore.ItemID == 0x19B9) { sourceWorth *= 8; } else if (m_Ore.ItemID == 0x19B7) { sourceWorth *= 2; } else { sourceWorth *= 4; } worth += sourceWorth; int plusWeight = 0; int newID = ore.ItemID; if (ore.DefaultWeight != m_Ore.DefaultWeight) { if (ore.ItemID == 0x19B7 || m_Ore.ItemID == 0x19B7) { newID = 0x19B7; } else if (ore.ItemID == 0x19B9) { newID = m_Ore.ItemID; plusWeight = ore.Amount * 2; } else { plusWeight = m_Ore.Amount * 2; } } if ((ore.ItemID == 0x19B9 && worth > 120000) || ((ore.ItemID == 0x19B8 || ore.ItemID == 0x19BA) && worth > 60000) || (ore.ItemID == 0x19B7 && worth > 30000)) { from.SendLocalizedMessage(1062844); // There is too much ore to combine. return; } else if (ore.RootParent is Mobile && (plusWeight + ((Mobile)ore.RootParent).Backpack.TotalWeight) > ((Mobile)ore.RootParent).Backpack.MaxWeight) { from.SendLocalizedMessage(501978); // The weight is too great to combine in a container. return; } ore.ItemID = newID; if (ore.ItemID == 0x19B9) { ore.Amount = worth / 8; } else if (ore.ItemID == 0x19B7) { ore.Amount = worth / 2; } else { ore.Amount = worth / 4; } m_Ore.Delete(); return; } #endregion if (IsForge(targeted)) { double difficulty; switch (m_Ore.Resource) { default: difficulty = 50.0; break; case CraftResource.DullCopper: difficulty = 65.0; break; case CraftResource.ShadowIron: difficulty = 70.0; break; case CraftResource.Copper: difficulty = 75.0; break; case CraftResource.Bronze: difficulty = 80.0; break; case CraftResource.Gold: difficulty = 85.0; break; case CraftResource.Agapite: difficulty = 90.0; break; case CraftResource.Verite: difficulty = 95.0; break; case CraftResource.Valorite: difficulty = 99.0; break; } double minSkill = difficulty - 25.0; double maxSkill = difficulty + 25.0; if (difficulty > 50.0 && difficulty > from.Skills[SkillName.Mining].Value) { from.SendLocalizedMessage(501986); // You have no idea how to smelt this strange ore! return; } if (m_Ore.ItemID == 0x19B7 && m_Ore.Amount < 2) { from.SendLocalizedMessage(501987); // There is not enough metal-bearing ore in this pile to make an ingot. return; } if (from.CheckTargetSkill(SkillName.Mining, targeted, minSkill, maxSkill)) { int toConsume = m_Ore.Amount; if (toConsume <= 0) { from.SendLocalizedMessage(501987); // There is not enough metal-bearing ore in this pile to make an ingot. } else { if (toConsume > 30000) { toConsume = 30000; } int ingotAmount; if (m_Ore.ItemID == 0x19B7) { ingotAmount = toConsume / 2; if (toConsume % 2 != 0) { --toConsume; } } else if (m_Ore.ItemID == 0x19B9) { ingotAmount = toConsume * 2; } else { ingotAmount = toConsume; } BaseIngot ingot = m_Ore.GetIngot(); ingot.Amount = ingotAmount; m_Ore.Consume(toConsume); from.AddToBackpack(ingot); //from.PlaySound( 0x57 ); from.SendLocalizedMessage(501988); // You smelt the ore removing the impurities and put the metal in your backpack. } } else { if (m_Ore.Amount < 2) { if (m_Ore.ItemID == 0x19B9) { m_Ore.ItemID = 0x19B8; } else { m_Ore.ItemID = 0x19B7; } } else { m_Ore.Amount /= 2; } from.SendLocalizedMessage(501990); // You burn away the impurities but are left with less useable metal. } } }
public override Item Construct(Type type, Mobile from) { if (type == typeof(TreasureMap)) { int level; if (from is PlayerMobile && ((PlayerMobile)from).Young && from.Map == Map.Trammel && TreasureMap.IsInHavenIsland(from)) { level = 0; } else { level = 1; } return(new TreasureMap(level, from.Map == Map.Felucca ? Map.Felucca : Map.Trammel)); } else if (type == typeof(MessageInABottle)) { return(new MessageInABottle(from.Map == Map.Felucca ? Map.Felucca : Map.Trammel)); } Container pack = from.Backpack; if (pack != null) { List <SOS> messages = pack.FindItemsByType <SOS>(); for (int i = 0; i < messages.Count; ++i) { SOS sos = messages[i]; if ((from.Map == Map.Felucca || from.Map == Map.Trammel) && from.InRange(sos.TargetLocation, 60)) { Item preLoot = null; switch (Utility.Random(8)) { case 0: // Body parts { int[] list = new int[] { 0x1CDD, 0x1CE5, // arm 0x1CE0, 0x1CE8, // torso 0x1CE1, 0x1CE9, // head 0x1CE2, 0x1CEC // leg }; preLoot = new ShipwreckedItem(Utility.RandomList(list)); break; } case 1: // Bone parts { int[] list = new int[] { 0x1AE0, 0x1AE1, 0x1AE2, 0x1AE3, 0x1AE4, // skulls 0x1B09, 0x1B0A, 0x1B0B, 0x1B0C, 0x1B0D, 0x1B0E, 0x1B0F, 0x1B10, // bone piles 0x1B15, 0x1B16 // pelvis bones }; preLoot = new ShipwreckedItem(Utility.RandomList(list)); break; } case 2: // Paintings and portraits { preLoot = new ShipwreckedItem(Utility.Random(0xE9F, 10)); break; } case 3: // Pillows { preLoot = new ShipwreckedItem(Utility.Random(0x13A4, 11)); break; } case 4: // Shells { preLoot = new ShipwreckedItem(Utility.Random(0xFC4, 9)); break; } case 5: //Hats { if (Utility.RandomBool()) { preLoot = new SkullCap(); } else { preLoot = new TricorneHat(); } break; } case 6: // Misc { int[] list = new int[] { 0x1EB5, // unfinished barrel 0xA2A, // stool 0xC1F, // broken clock 0x1047, 0x1048, // globe 0x1EB1, 0x1EB2, 0x1EB3, 0x1EB4 // barrel staves }; if (Utility.Random(list.Length + 1) == 0) { preLoot = new Candelabra(); } else { preLoot = new ShipwreckedItem(Utility.RandomList(list)); } break; } } if (preLoot != null) { if (preLoot is IShipwreckedItem) { ((IShipwreckedItem)preLoot).IsShipwreckedItem = true; } return(preLoot); } LockableContainer chest; if (Utility.RandomBool()) { chest = new MetalGoldenChest(); } else { chest = new WoodenChest(); } if (sos.IsAncient) { chest.Hue = 0x481; } TreasureMapChest.Fill(chest, Math.Max(1, Math.Min(4, sos.Level))); if (sos.IsAncient) { chest.DropItem(new FabledFishingNet()); } else { chest.DropItem(new SpecialFishingNet()); } if (0.02 >= Utility.RandomDouble()) //2% chance { switch (Utility.Random(3)) { case 0: chest.DropItem(new BronzedArmorValkyrie()); break; case 1: chest.DropItem(new EnchantedKelpWovenLeggings()); break; case 2: chest.DropItem(new RunedDriftwoodBow()); break; case 3: chest.DropItem(new AntiqueWeddingDress()); break; } } chest.Movable = true; chest.Locked = false; chest.TrapType = TrapType.None; chest.TrapPower = 0; chest.TrapLevel = 0; sos.Delete(); return(chest); } } } return(base.Construct(type, from)); }
public override void OnComponentUsed(AddonComponent c, Mobile from) { BaseHouse house = BaseHouse.FindHouseAt(this); /* * Unique problems have unique solutions. OSI does not have a problem with 1000s of mining carts * due to the fact that they have only a miniscule fraction of the number of 10 year vets that a * typical RunUO shard will have (RunUO's scaled down account aging system makes this a unique problem), * and the "freeness" of free accounts. We also dont have mitigating factors like inactive (unpaid) * accounts not gaining veteran time. * * The lack of high end vets and vet rewards on OSI has made testing the *exact* ranging/stacking * behavior of these things all but impossible, so either way its just an estimation. * * If youd like your shard's carts/stumps to work the way they did before, simply replace the check * below with this line of code: * * if (!from.InRange(GetWorldLocation(), 2) * * However, I am sure these checks are more accurate to OSI than the former version was. * */ if (!from.InRange(GetWorldLocation(), 2) || !from.InLOS(this) || !((from.Z - Z) > -3 && (from.Z - Z) < 3)) { from.LocalOverheadMessage(Network.MessageType.Regular, 0x3B2, 1019045); // I can't reach that. } else if (house != null && house.HasSecureAccess(from, SecureLevel.Friends)) { if (m_ResourceCount > 0) { Item res = null; switch (Utility.Random(5)) { case 0: res = new Wool(); break; case 1: res = new Leather(); break; case 2: res = new SpinedLeather(); break; case 3: res = new HornedLeather(); break; case 4: res = new BarbedLeather(); break; } int amount = Math.Min(10, m_ResourceCount); res.Amount = amount; if (!from.PlaceInBackpack(res)) { res.Delete(); from.SendLocalizedMessage(1078837); // Your backpack is full! Please make room and try again. } else { ResourceCount -= amount; PublicOverheadMessage(MessageType.Regular, 0, 1151834, m_ResourceCount.ToString()); // Resources: ~1_COUNT~ } } else { from.SendLocalizedMessage(1094725); // There are no more ResourceCounts available at this time. } } else { from.SendLocalizedMessage(1061637); // You are not allowed to access } }
public override void OnComponentUsed(AddonComponent c, Mobile from) { BaseHouse house = BaseHouse.FindHouseAt(this); /* * Unique problems have unique solutions. OSI does not have a problem with 1000s of mining carts * due to the fact that they have only a miniscule fraction of the number of 10 year vets that a * typical RunUO shard will have (RunUO's scaled down account aging system makes this a unique problem), * and the "freeness" of free accounts. We also dont have mitigating factors like inactive (unpaid) * accounts not gaining veteran time. * * The lack of high end vets and vet rewards on OSI has made testing the *exact* ranging/stacking * behavior of these things all but impossible, so either way its just an estimation. * * If youd like your shard's carts/stumps to work the way they did before, simply replace the check * below with this line of code: * * if (!from.InRange(GetWorldLocation(), 2) * * However, I am sure these checks are more accurate to OSI than the former version was. * */ if (!from.InRange(GetWorldLocation(), 2) || !from.InLOS(this) || !((from.Z - Z) > -3 && (from.Z - Z) < 3)) { from.LocalOverheadMessage(Network.MessageType.Regular, 0x3B2, 1019045); // I can't reach that. } else if (house != null && house.HasSecureAccess(from, SecureLevel.Friends)) { switch (m_CartType) { case MiningCartType.OreSouth: case MiningCartType.OreEast: if (m_Ore > 0) { Item ingots = null; switch (Utility.Random(9)) { case 0: ingots = new IronIngot(); break; case 1: ingots = new DullCopperIngot(); break; case 2: ingots = new ShadowIronIngot(); break; case 3: ingots = new CopperIngot(); break; case 4: ingots = new BronzeIngot(); break; case 5: ingots = new GoldIngot(); break; case 6: ingots = new AgapiteIngot(); break; case 7: ingots = new VeriteIngot(); break; case 8: ingots = new ValoriteIngot(); break; } int amount = Math.Min(10, m_Ore); ingots.Amount = amount; if (!from.PlaceInBackpack(ingots)) { ingots.Delete(); from.SendLocalizedMessage(1078837); // Your backpack is full! Please make room and try again. } else { PublicOverheadMessage(MessageType.Regular, 0, 1094724, amount.ToString()); // Ore: ~1_COUNT~ m_Ore -= amount; } } else { from.SendLocalizedMessage(1094725); // There are no more resources available at this time. } break; case MiningCartType.GemSouth: case MiningCartType.GemEast: if (m_Gems > 0) { Item gems = null; switch (Utility.Random(15)) { case 0: gems = new Amber(); break; case 1: gems = new Amethyst(); break; case 2: gems = new Citrine(); break; case 3: gems = new Diamond(); break; case 4: gems = new Emerald(); break; case 5: gems = new Ruby(); break; case 6: gems = new Sapphire(); break; case 7: gems = new StarSapphire(); break; case 8: gems = new Tourmaline(); break; // Mondain's Legacy gems case 9: gems = new PerfectEmerald(); break; case 10: gems = new DarkSapphire(); break; case 11: gems = new Turquoise(); break; case 12: gems = new EcruCitrine(); break; case 13: gems = new FireRuby(); break; case 14: gems = new BlueDiamond(); break; } int amount = Math.Min(5, m_Gems); gems.Amount = amount; if (!from.PlaceInBackpack(gems)) { gems.Delete(); from.SendLocalizedMessage(1078837); // Your backpack is full! Please make room and try again. } else { PublicOverheadMessage(MessageType.Regular, 0, 1094723, amount.ToString()); // Gems: ~1_COUNT~ m_Gems -= amount; } } else { from.SendLocalizedMessage(1094725); // There are no more resources available at this time. } break; } } else { from.SendLocalizedMessage(1061637); // You are not allowed to access this. } }
public virtual bool Validate(BaseCreature attacker, Mobile defender) { return(defender != null && defender.Alive && !defender.Deleted && !defender.IsDeadBondedPet && attacker.Alive && !attacker.IsDeadBondedPet && defender.InRange(attacker.Location, MaxRange) && defender.Map == attacker.Map && attacker.InLOS(defender) && !attacker.BardPacified); }
/* * public override void AlterSpellDamageFrom( Mobile from, ref int damage ) * { * damage = 0; * } */ /* * public override void AlterAbilityDamageFrom( Mobile from, ref int damage ) * { * AlterMeleeDamageFrom( from, ref damage ); * } */ public override void OnGotMeleeAttack(Mobile attacker) { FixedParticles(0x376A, 20, 10, 0x2530, EffectLayer.Waist); PlaySound(0x2F4); int discordanceEffect = 0; if (attacker is PlayerMobile && Discordance.GetEffect(this, ref discordanceEffect)) { attacker.SendAsciiMessage("The creature's magnetic field is weak."); } else if (attacker != null) { attacker.SendAsciiMessage("The creature's magnetic field repels your attack."); if (attacker.AccessLevel == AccessLevel.Player && attacker.InRange(Location, 2) && 0.15 > Utility.RandomDouble()) { var items = new List <Item>(); for (int i = 0; i < attacker.Items.Count; i++) { Item item = attacker.Items[i]; if (item.Movable && item.LootType != LootType.Blessed && item.LootType != LootType.Newbied && item.BlessedFor == null) { var resource = CraftResource.None; if (item is BaseWeapon) { resource = ((BaseWeapon)item).Resource; } else if (item is BaseArmor) { resource = ((BaseArmor)item).Resource; } else if (item is BaseJewel) { resource = CraftResource.Iron; } else if (item is BaseClothing) { resource = ((BaseClothing)item).Resource; } else { continue; } if (CraftResources.GetType(resource) == CraftResourceType.Metal) { items.Add(item); } } } if (items.Count > 0) { Item todrop = items[Utility.Random(items.Count)]; if (todrop is IDurability) { var dura = (IDurability)todrop; if (dura.MaxHitPoints > 0) //It is not invulnerable { int maxpts = dura.MaxHitPoints / 10; int points = Math.Min(maxpts, dura.HitPoints); dura.HitPoints -= points; if (dura.HitPoints == 0) { dura.MaxHitPoints -= maxpts - points; } if (dura.MaxHitPoints <= 0) { attacker.SendMessage("The creature's magnetic field destroyed your {0}.", todrop.GetDisplayName(attacker.NetState, false)); todrop.Delete(); } else { attacker.SendMessage( "The creature's magnetic field attracted your {0}, and damaged it in the process.", todrop.GetDisplayName(attacker.NetState, false)); todrop.MoveToWorld(Location, Map); } } } else { attacker.SendMessage("The creature's magnetic field attracted your {0}.", todrop.GetDisplayName(attacker.NetState, false)); todrop.MoveToWorld(Location, Map); } FixedParticles(0, 10, 0, 0x2530, EffectLayer.Waist); } } } base.OnGotMeleeAttack(attacker); }
public void Target(Mobile m) { if (CheckHSequence(m)) { SpellHelper.Turn(Caster, m); /* Creates a blast of poisonous energy centered on the target. * The main target is inflicted with a large amount of Poison damage, and all valid targets in a radius of 2 tiles around the main target are inflicted with a lesser effect. * One tile from main target receives 50% damage, two tiles from target receives 33% damage. */ //CheckResisted( m ); // Check magic resist for skill, but do not use return value //reports from OSI: Necro spells don't give Resist gain Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x36B0, 1, 14, 63, 7, 9915, 0); Effects.PlaySound(m.Location, m.Map, 0x229); double damage = Utility.RandomMinMax((Core.ML ? 32 : 36), 40) * ((300 + (GetDamageSkill(Caster) * 9)) / 1000); double sdiBonus = (double)AosAttributes.GetValue(Caster, AosAttribute.SpellDamage) / 100; double pvmDamage = damage * (1 + sdiBonus); if (Core.ML && sdiBonus > 0.15) { sdiBonus = 0.15; } double pvpDamage = damage * (1 + sdiBonus); Map map = m.Map; if (map != null) { List <Mobile> targets = new List <Mobile>(); if (Caster.CanBeHarmful(m, false)) { targets.Add(m); } foreach (Mobile targ in m.GetMobilesInRange(2)) { if (!(Caster is BaseCreature && targ is BaseCreature)) { if ((targ != Caster && m != targ) && (SpellHelper.ValidIndirectTarget(Caster, targ) && Caster.CanBeHarmful(targ, false))) { targets.Add(targ); } } } for (int i = 0; i < targets.Count; ++i) { Mobile targ = targets[i]; int num; if (targ.InRange(m.Location, 0)) { num = 1; } else if (targ.InRange(m.Location, 1)) { num = 2; } else { num = 3; } Caster.DoHarmful(targ); SpellHelper.Damage(this, targ, ((m.Player && Caster.Player) ? pvpDamage : pvmDamage) / num, 0, 0, 0, 100, 0); } } } FinishSequence(); }
public override void OnDoubleClick(Mobile from) { if (m_sower == null || m_sower.Deleted) { m_sower = from; } if (from != m_sower) { from.SendMessage("You do not own this plant !!!"); return; } if (from.Mounted && !CropHelper.CanWorkMounted) { from.SendMessage("You cannot harvest a crop while mounted."); return; } if (DateTime.UtcNow > lastpicked.AddSeconds(3)) { lastpicked = DateTime.UtcNow; int cookValue = (int)from.Skills[SkillName.Cooking].Value / 20; if (cookValue == 0) { from.SendMessage("You have no idea how to harvest this crop."); return; } if (from.InRange(this.GetWorldLocation(), 1)) { if (m_yield < 1) { from.SendMessage("There is nothing here to harvest."); } else { from.Direction = from.GetDirectionTo(this); from.Animate(from.Mounted ? 29:32, 5, 1, true, false, 0); m_lastvisit = DateTime.UtcNow; if (cookValue > m_yield) { cookValue = m_yield + 1; } int pick = Utility.RandomMinMax(cookValue - 4, cookValue); if (pick < 0) { pick = 0; } if (pick == 0) { from.SendMessage("You do not manage to harvest any crops."); return; } m_yield -= pick; from.SendMessage("You harvest {0} crop{1}!", pick, (pick == 1 ? "" : "s")); if (m_yield < 1) { ((Item)this).ItemID = pickedGraphic; } CoffeeBean crop = new CoffeeBean(pick); from.AddToBackpack(crop); if (!regrowTimer.Running) { regrowTimer.Start(); } } } else { from.SendMessage("You are too far away to harvest anything."); } } }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is Item) { from.SendMessage("You cannot dye items with this."); } else if (targeted is PlayerMobile) { from.SendMessage("You cannot dye players with this."); } else if (targeted is CuSidhe) { from.SendMessage("You cannot dye Cusidhe's."); } else if (targeted is RidablePolar) { from.SendMessage("You cannot dye this pet."); } else if (targeted is ChaosDragon) { from.SendMessage("You cannot dye this pet"); } else if (targeted is OrderDragon) { from.SendMessage("You cannot dye this pet."); } else if (targeted is FrostDragon) { from.SendMessage("You cannot dye this pet"); } else if (targeted is FireBird) { from.SendMessage("You cannot dye this pet"); } else if (targeted is AncientCuSidhe) { from.SendMessage("You cannot dye that pet."); } else if (targeted is BaseCreature) { BaseCreature targ = (BaseCreature)targeted; if (from.InRange(m_Tub.GetWorldLocation(), 3)) { if (targ.Controlled == false) { from.SendMessage("This animal is not tame."); } else if (targ.IsDeadPet) { from.SendMessage("You cannot dye a dead pet."); } else if (targ.ControlMaster != from) { from.SendMessage("This is not your pet."); } else { targ.Hue = m_Tub.DyedHue; from.PlaySound(0x23E); } } else { from.SendLocalizedMessage(500446); // That is too far away. } } else { from.SendMessage("You cannot dye this."); } }
protected override void OnTick() { m_Count++; var de = m_Creature.FindMostRecentDamageEntry(false); var alreadyOwned = m_Creature.Owners.Contains(m_Tamer); if (!m_Tamer.InRange(m_Creature, Core.AOS ? 7 : 6)) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 502795, m_Tamer.NetState ); // You are too far away to continue taming. Stop(); } else if (!m_Tamer.CheckAlive()) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 502796, m_Tamer.NetState ); // You are dead, and cannot continue taming. Stop(); } else if (!m_Tamer.CanSee(m_Creature) || !m_Tamer.InLOS(m_Creature) || !CanPath()) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = Core.TickCount; m_Tamer.SendLocalizedMessage( 1049654 ); // You do not have a clear path to the animal you are taming, and must cease your attempt. Stop(); } else if (!m_Creature.Tamable) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 1049655, m_Tamer.NetState ); // That creature cannot be tamed. Stop(); } else if (m_Creature.Controlled) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 502804, m_Tamer.NetState ); // That animal looks tame already. Stop(); } else if (m_Creature.Owners.Count >= BaseCreature.MaxOwners && !m_Creature.Owners.Contains(m_Tamer)) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 1005615, m_Tamer.NetState ); // This animal has had too many owners and is too upset for you to tame. Stop(); } else if (MustBeSubdued(m_Creature)) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 1054025, m_Tamer.NetState ); // You must subdue this creature before you can tame it! Stop(); } else if (de?.LastDamage > m_StartTime) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = Core.TickCount; m_Creature.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 502794, m_Tamer.NetState ); // The animal is too angry to continue taming. Stop(); } else if (m_Count < m_MaxCount) { m_Tamer.RevealingAction(); switch (Utility.Random(3)) { case 0: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(502790, 4)); break; case 1: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(1005608, 6)); break; case 2: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(1010593, 4)); break; } if (!alreadyOwned) // Passively check animal lore for gain { m_Tamer.CheckTargetSkill(SkillName.AnimalLore, m_Creature, 0.0, 120.0); } if (m_Creature.Paralyzed) { m_Paralyzed = true; } } else { m_Tamer.RevealingAction(); m_Tamer.NextSkillTime = Core.TickCount; m_BeingTamed.Remove(m_Creature); if (m_Creature.Paralyzed) { m_Paralyzed = true; } if (!alreadyOwned) // Passively check animal lore for gain { m_Tamer.CheckTargetSkill(SkillName.AnimalLore, m_Creature, 0.0, 120.0); } var minSkill = m_Creature.MinTameSkill + m_Creature.Owners.Count * 6.0; if (minSkill > -24.9 && CheckMastery(m_Tamer, m_Creature)) { minSkill = -24.9; // 50% at 0.0? } minSkill += 24.9; if (CheckMastery(m_Tamer, m_Creature) || alreadyOwned || m_Tamer.CheckTargetSkill(SkillName.AnimalTaming, m_Creature, minSkill - 25.0, minSkill + 25.0)) { if (m_Creature.Owners.Count == 0) // First tame { if (m_Creature is GreaterDragon) { ScaleSkills(m_Creature, 0.72, 0.90); // 72% of original skills trainable to 90% m_Creature.Skills.Magery.Base = m_Creature.Skills.Magery .Cap; // Greater dragons have a 90% cap reduction and 90% skill reduction on magery } else if (m_Paralyzed) { ScaleSkills( m_Creature, 0.86 ); // 86% of original skills if they were paralyzed during the taming } else { ScaleSkills(m_Creature, 0.90); // 90% of original skills } if (m_Creature.StatLossAfterTame) { ScaleStats(m_Creature, 0.50); } } if (alreadyOwned) { m_Tamer.SendLocalizedMessage(502797); // That wasn't even challenging. } else { m_Creature.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 502799, m_Tamer.NetState ); // It seems to accept you as master. m_Creature.Owners.Add(m_Tamer); } m_Creature.SetControlMaster(m_Tamer); m_Creature.IsBonded = false; } else { m_Creature.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 502798, m_Tamer.NetState ); // You fail to tame the creature. } } }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is BaseWeapon) { BaseWeapon Weapon = targeted as BaseWeapon; if (!from.InRange(m_Augmentation.GetWorldLocation(), 1) || !from.InRange(((Item)targeted).GetWorldLocation(), 1)) { from.SendLocalizedMessage(500446); // That is too far away. } else if ((((Item)targeted).Parent != null) && (((Item)targeted).Parent is Mobile)) { from.SendMessage(38, "You cannot enhance that in it's current location."); } else if (Weapon.Type == WeaponType.Ranged) { if (from.Skills[SkillName.Fletching].Base < 120.0) { from.SendMessage(38, "Only a Legendary Fletcher can enhance ranged weapons."); } else if (Weapon.UsedSockets >= Weapon.MaxSockets) { from.SendMessage(38, "That weapon is already enhanced to its limits!"); } else { int EnhanceChance = Utility.Random(20); if (EnhanceChance == 19) { EnhanceChance = 1; } else { EnhanceChance = 0; } int DestroyChance = Utility.Random(100); if (DestroyChance == 99) { DestroyChance = 1; } else { DestroyChance = 0; } if (EnhanceChance == 0) // Success { Weapon.UsedSockets += 1; Weapon.WeaponAttributes.HitFireArea += 25; Weapon.Hue = 36; Weapon.AugmentList = Weapon.AugmentList + "\n" + m_Augmentation.Name; from.PlaySound(0x2A); // Anvil from.SendMessage(55, "You have successfully enhanced the weapon!"); m_Augmentation.Delete(); } else // Fail { if (DestroyChance == 0) // Weapon not destroyed { from.SendMessage(38, "You have failed to enhance the weapon!"); from.SendMessage(38, "The augmentation crumbles in your hand,"); from.SendMessage(38, "you have damaged the weapon in the process!"); Weapon.MaxHitPoints -= 3; Weapon.HitPoints -= 3; } else // Weapon is destroyed { from.SendMessage(38, "You have failed to enhance the weapon!"); from.SendMessage(38, "You have damaged the weapon in the process,"); from.SendMessage(38, "the weapon is damaged beyond repair and crumbles in your hand!"); Weapon.Delete(); } m_Augmentation.Delete(); } } } else if (Weapon.Type == WeaponType.Polearm || Weapon.Type == WeaponType.Piercing || Weapon.Type == WeaponType.Staff || Weapon.Type == WeaponType.Slashing || Weapon.Type == WeaponType.Bashing || Weapon.Type == WeaponType.Axe) { if (from.Skills[SkillName.Blacksmith].Base < 120.0) { from.SendMessage(38, "Only a Legendary Blacksmith can enhance items."); } else if (Weapon.UsedSockets >= Weapon.MaxSockets) { from.SendMessage(38, "That weapon is already enhanced to its limits!"); } else { int EnhanceChance = Utility.Random(20); if (EnhanceChance == 19) { EnhanceChance = 1; } else { EnhanceChance = 0; } int DestroyChance = Utility.Random(100); if (DestroyChance == 99) { DestroyChance = 1; } else { DestroyChance = 0; } if (EnhanceChance == 0) // Success { Weapon.UsedSockets += 1; Weapon.WeaponAttributes.HitFireArea += 25; Weapon.Hue = 36; Weapon.AugmentList = Weapon.AugmentList + "\n" + m_Augmentation.Name; from.PlaySound(0x2A); // Anvil from.SendMessage(55, "You have successfully enhanced the weapon!"); m_Augmentation.Delete(); } else // Fail { if (DestroyChance == 0) // Weapon not destroyed { from.SendMessage(38, "You have failed to enhance the weapon!"); from.SendMessage(38, "The augmentation crumbles in your hand,"); from.SendMessage(38, "you have damaged the weapon in the process!"); Weapon.MaxHitPoints -= 3; Weapon.HitPoints -= 3; } else // Weapon is destroyed { from.SendMessage(38, "You have failed to enhance the weapon!"); from.SendMessage(38, "You have damaged the weapon in the process,"); from.SendMessage(38, "the weapon is damaged beyond repair and crumbles in your hand!"); Weapon.Delete(); } m_Augmentation.Delete(); } } } } if (targeted is BaseArmor) { BaseArmor Armor = targeted as BaseArmor; if (!from.InRange(m_Augmentation.GetWorldLocation(), 1) || !from.InRange(((Item)targeted).GetWorldLocation(), 1)) { from.SendLocalizedMessage(500446); // That is too far away. } else if ((((Item)targeted).Parent != null) && (((Item)targeted).Parent is Mobile)) { from.SendMessage(38, "You cannot enhance that in it's current location."); } else if (Armor.BodyPosition == ArmorBodyType.Gorget || Armor.BodyPosition == ArmorBodyType.Gloves || Armor.BodyPosition == ArmorBodyType.Helmet || Armor.BodyPosition == ArmorBodyType.Arms || Armor.BodyPosition == ArmorBodyType.Legs || Armor.BodyPosition == ArmorBodyType.Chest) { if (Armor.MaterialType == ArmorMaterialType.Plate || Armor.MaterialType == ArmorMaterialType.Chainmail || Armor.MaterialType == ArmorMaterialType.Ringmail) { if (from.Skills[SkillName.Blacksmith].Base < 120.0) { from.SendMessage(38, "Only a Legendary Blacksmith can enhance this type of armor."); } else if (Armor.UsedSockets >= Armor.MaxSockets) { from.SendMessage(38, "That armor is already enhanced to its limits!"); } else { int EnhanceChance = Utility.Random(20); if (EnhanceChance == 19) { EnhanceChance = 1; } else { EnhanceChance = 0; } int DestroyChance = Utility.Random(100); if (DestroyChance == 99) { DestroyChance = 1; } else { DestroyChance = 0; } if (EnhanceChance == 0) // Success { Armor.UsedSockets += 1; Armor.Attributes.BonusHits += 4; Armor.Hue = 36; Armor.AugmentList = Armor.AugmentList + "\n" + m_Augmentation.Name; from.PlaySound(0x2A); // Anvil from.SendMessage(55, "You have successfully enhanced the armor!"); m_Augmentation.Delete(); } else // Fail { if (DestroyChance == 0) // Armor not destroyed { from.SendMessage(38, "You have failed to enhance the armor!"); from.SendMessage(38, "The augmentation crumbles in your hand,"); from.SendMessage(38, "you have damaged the armor in the process!"); Armor.MaxHitPoints -= 3; Armor.HitPoints -= 3; } else // Armor is destroyed { from.SendMessage(38, "You have failed to enhance the armor!"); from.SendMessage(38, "You have damaged the armor in the process,"); from.SendMessage(38, "the armor is damaged beyond repair and crumbles in your hand!"); Armor.Delete(); } m_Augmentation.Delete(); } } } else { if (from.Skills[SkillName.Tailoring].Base < 120.0) { from.SendMessage(38, "Only a Legendary Tailor can enhance this type of Armor."); } else if (Armor.UsedSockets >= Armor.MaxSockets) { from.SendMessage(38, "That armor is already enhanced to its limits!"); } else { int EnhanceChance = Utility.Random(20); if (EnhanceChance == 19) { EnhanceChance = 1; } else { EnhanceChance = 0; } int DestroyChance = Utility.Random(100); if (DestroyChance == 99) { DestroyChance = 1; } else { DestroyChance = 0; } if (EnhanceChance == 0) // Success { Armor.UsedSockets += 1; Armor.Attributes.BonusHits += 4; Armor.Hue = 36; Armor.AugmentList = Armor.AugmentList + "\n" + m_Augmentation.Name; from.PlaySound(0x2A); // Anvil from.SendMessage(55, "You have successfully enhanced the armor!"); m_Augmentation.Delete(); } else // Fail { if (DestroyChance == 0) // Armor not destroyed { from.SendMessage(38, "You have failed to enhance the armor!"); from.SendMessage(38, "The augmentation crumbles in your hand,"); from.SendMessage(38, "you have damaged the armor in the process!"); Armor.MaxHitPoints -= 3; Armor.HitPoints -= 3; } else // Armor is destroyed { from.SendMessage(38, "You have failed to enhance the armor!"); from.SendMessage(38, "You have damaged the armor in the process,"); from.SendMessage(38, "the armor is damaged beyond repair and crumbles in your hand!"); Armor.Delete(); } m_Augmentation.Delete(); } } } } } if (targeted is BaseShield) { BaseShield Shield = targeted as BaseShield; if (!from.InRange(m_Augmentation.GetWorldLocation(), 1) || !from.InRange(((Item)targeted).GetWorldLocation(), 1)) { from.SendLocalizedMessage(500446); // That is too far away. } else if ((((Item)targeted).Parent != null) && (((Item)targeted).Parent is Mobile)) { from.SendMessage(38, "You cannot enhance that in it's current location."); } else if (Shield.MaterialType == ArmorMaterialType.Plate) { if (from.Skills[SkillName.Blacksmith].Base < 120.0) { from.SendMessage(38, "Only a Legendary Blacksmith can enhance items."); } else if (Shield.UsedSockets >= Shield.MaxSockets) { from.SendMessage(38, "That shield is already enhanced to its limits!"); } else { int EnhanceChance = Utility.Random(20); if (EnhanceChance == 19) { EnhanceChance = 1; } else { EnhanceChance = 0; } int DestroyChance = Utility.Random(100); if (DestroyChance == 99) { DestroyChance = 1; } else { DestroyChance = 0; } if (EnhanceChance == 0) // Success { Shield.UsedSockets += 1; Shield.FireBonus += 8; Shield.Hue = 36; Shield.AugmentList = Shield.AugmentList + "\n" + m_Augmentation.Name; from.PlaySound(0x2A); // Anvil from.SendMessage(55, "You have successfully enhanced the shield!"); m_Augmentation.Delete(); } else // Fail { if (DestroyChance == 0) // Shield not destroyed { from.SendMessage(38, "You have failed to enhance the shield!"); from.SendMessage(38, "The augmentation crumbles in your hand,"); from.SendMessage(38, "you have damaged the shield!"); Shield.MaxHitPoints -= 3; Shield.HitPoints -= 3; } else // Shield is destroyed { from.SendMessage(38, "You have failed to enhance the shield!"); from.SendMessage(38, "You have cracked the shield in the process,"); from.SendMessage(38, "the shield is damaged beyond repair and crumbles in your hand!"); Shield.Delete(); } m_Augmentation.Delete(); } } } } }
public override bool Think() { if (m_Mobile.Deleted) { return(false); } Mobile combatant = m_Guard.Combatant; if (combatant == null || combatant.Deleted || !combatant.Alive || combatant.IsDeadBondedPet || !m_Mobile.CanSee(combatant) || !m_Mobile.CanBeHarmful(combatant, false) || combatant.Map != m_Mobile.Map) { // Our combatant is deleted, dead, hidden, or we cannot hurt them // Try to find another combatant if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true)) { m_Mobile.Combatant = combatant = m_Mobile.FocusMob; m_Mobile.FocusMob = null; } else { m_Mobile.Combatant = combatant = null; } } if (combatant != null && (!m_Mobile.InLOS(combatant) || !m_Mobile.InRange(combatant, 12))) { if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true)) { m_Mobile.Combatant = combatant = m_Mobile.FocusMob; m_Mobile.FocusMob = null; } else if (!m_Mobile.InRange(combatant, 36)) { m_Mobile.Combatant = combatant = null; } } Mobile dispelTarget = FindDispelTarget(true); if (m_Guard.Target != null && m_ReleaseTarget == DateTime.MinValue) { m_ReleaseTarget = DateTime.UtcNow + TimeSpan.FromSeconds(10.0); } if (m_Guard.Target != null && DateTime.UtcNow > m_ReleaseTarget) { Target targ = m_Guard.Target; Mobile toHarm = (dispelTarget == null ? combatant : dispelTarget); if ((targ.Flags & TargetFlags.Harmful) != 0 && toHarm != null) { if (m_Guard.Map == toHarm.Map && (targ.Range < 0 || m_Guard.InRange(toHarm, targ.Range)) && m_Guard.CanSee(toHarm) && m_Guard.InLOS(toHarm)) { targ.Invoke(m_Guard, toHarm); } else if (targ is DispelSpell.InternalTarget) { targ.Cancel(m_Guard, TargetCancelType.Canceled); } } else if ((targ.Flags & TargetFlags.Beneficial) != 0) { targ.Invoke(m_Guard, m_Guard); } else { targ.Cancel(m_Guard, TargetCancelType.Canceled); } m_ReleaseTarget = DateTime.MinValue; } if (dispelTarget != null) { if (Action != ActionType.Combat) { Action = ActionType.Combat; } m_Guard.Warmode = true; RunFrom(dispelTarget); } else if (combatant != null) { if (Action != ActionType.Combat) { Action = ActionType.Combat; } m_Guard.Warmode = true; RunTo(combatant); } else if (m_Guard.Orders.Movement != MovementType.Stand) { Mobile toFollow = null; if (m_Guard.Town != null && m_Guard.Orders.Movement == MovementType.Follow) { toFollow = m_Guard.Orders.Follow; if (toFollow == null) { toFollow = m_Guard.Town.Sheriff; } } if (toFollow != null && toFollow.Map == m_Guard.Map && toFollow.InRange(m_Guard, m_Guard.RangePerception * 3) && Town.FromRegion(toFollow.Region) == m_Guard.Town) { if (Action != ActionType.Combat) { Action = ActionType.Combat; } if (m_Mobile.CurrentSpeed != m_Mobile.ActiveSpeed) { m_Mobile.CurrentSpeed = m_Mobile.ActiveSpeed; } m_Guard.Warmode = true; RunTo(toFollow); } else { if (Action != ActionType.Wander) { Action = ActionType.Wander; } if (m_Mobile.CurrentSpeed != m_Mobile.PassiveSpeed) { m_Mobile.CurrentSpeed = m_Mobile.PassiveSpeed; } m_Guard.Warmode = false; WalkRandomInHome(2, 2, 1); } } else { if (Action != ActionType.Wander) { Action = ActionType.Wander; } m_Guard.Warmode = false; } if ((IsDamaged || IsPoisoned) && m_Guard.Skills.Healing.Base > 20.0) { TimeSpan ts = TimeUntilBandage; if (ts == TimeSpan.MaxValue) { StartBandage(); } } if (m_Mobile.Spell == null && Core.TickCount - m_Mobile.NextSpellTime >= 0) { Spell spell = null; DateTime toRelease = DateTime.MinValue; if (IsPoisoned) { Poison p = m_Guard.Poison; TimeSpan ts = TimeUntilBandage; if (p != Poison.Lesser || ts == TimeSpan.MaxValue || TimeUntilBandage < TimeSpan.FromSeconds(1.5) || (m_Guard.HitsMax - m_Guard.Hits) > Utility.Random(250)) { if (IsAllowed(GuardAI.Bless)) { spell = new CureSpell(m_Guard, null); } else { UseItemByType(typeof(BaseCurePotion)); } } } else if (IsDamaged && (m_Guard.HitsMax - m_Guard.Hits) > Utility.Random(200)) { if (IsAllowed(GuardAI.Magic) && ((m_Guard.Hits * 100) / Math.Max(m_Guard.HitsMax, 1)) < 10 && m_Guard.Home != Point3D.Zero && !Utility.InRange(m_Guard.Location, m_Guard.Home, 15) && m_Guard.Mana >= 11) { spell = new RecallSpell(m_Guard, null, new RunebookEntry(m_Guard.Home, m_Guard.Map, "Guard's Home", null), null); } else if (IsAllowed(GuardAI.Bless)) { if (m_Guard.Mana >= 11 && (m_Guard.Hits + 30) < m_Guard.HitsMax) { spell = new GreaterHealSpell(m_Guard, null); } else if ((m_Guard.Hits + 10) < m_Guard.HitsMax && (m_Guard.Mana < 11 || (m_Guard.NextCombatTime - Core.TickCount) > 2000)) { spell = new HealSpell(m_Guard, null); } } else if (m_Guard.CanBeginAction(typeof(BaseHealPotion))) { UseItemByType(typeof(BaseHealPotion)); } } else if (dispelTarget != null && (IsAllowed(GuardAI.Magic) || IsAllowed(GuardAI.Bless) || IsAllowed(GuardAI.Curse))) { if (!dispelTarget.Paralyzed && m_Guard.Mana > (ManaReserve + 20) && 40 > Utility.Random(100)) { spell = new ParalyzeSpell(m_Guard, null); } else { spell = new DispelSpell(m_Guard, null); } } if (combatant != null) { if (m_Combo != null) { if (spell == null) { spell = SpellCombo.Process(m_Guard, combatant, ref m_Combo, ref m_ComboIndex, ref toRelease); } else { m_Combo = null; m_ComboIndex = -1; } } else if (20 > Utility.Random(100) && IsAllowed(GuardAI.Magic)) { if (80 > Utility.Random(100)) { m_Combo = (IsAllowed(GuardAI.Smart) ? SpellCombo.Simple : SpellCombo.Strong); m_ComboIndex = -1; if (m_Guard.Mana >= (ManaReserve + m_Combo.Mana)) { spell = SpellCombo.Process(m_Guard, combatant, ref m_Combo, ref m_ComboIndex, ref toRelease); } else { m_Combo = null; if (m_Guard.Mana >= (ManaReserve + 40)) { spell = RandomOffenseSpell(); } } } else if (m_Guard.Mana >= (ManaReserve + 40)) { spell = RandomOffenseSpell(); } } if (spell == null && 2 > Utility.Random(100) && m_Guard.Mana >= (ManaReserve + 10)) { int strMod = GetStatMod(m_Guard, StatType.Str); int dexMod = GetStatMod(m_Guard, StatType.Dex); int intMod = GetStatMod(m_Guard, StatType.Int); List <Type> types = new List <Type>(); if (strMod <= 0) { types.Add(typeof(StrengthSpell)); } if (dexMod <= 0 && IsAllowed(GuardAI.Melee)) { types.Add(typeof(AgilitySpell)); } if (intMod <= 0 && IsAllowed(GuardAI.Magic)) { types.Add(typeof(CunningSpell)); } if (IsAllowed(GuardAI.Bless)) { if (types.Count > 1) { spell = new BlessSpell(m_Guard, null); } else if (types.Count == 1) { spell = (Spell)Activator.CreateInstance(types[0], new object[] { m_Guard, null }); } } else if (types.Count > 0) { if (types[0] == typeof(StrengthSpell)) { UseItemByType(typeof(BaseStrengthPotion)); } else if (types[0] == typeof(AgilitySpell)) { UseItemByType(typeof(BaseAgilityPotion)); } } } if (spell == null && 2 > Utility.Random(100) && m_Guard.Mana >= (ManaReserve + 10) && IsAllowed(GuardAI.Curse)) { if (!combatant.Poisoned && 40 > Utility.Random(100)) { spell = new PoisonSpell(m_Guard, null); } else { int strMod = GetStatMod(combatant, StatType.Str); int dexMod = GetStatMod(combatant, StatType.Dex); int intMod = GetStatMod(combatant, StatType.Int); List <Type> types = new List <Type>(); if (strMod >= 0) { types.Add(typeof(WeakenSpell)); } if (dexMod >= 0 && IsAllowed(GuardAI.Melee)) { types.Add(typeof(ClumsySpell)); } if (intMod >= 0 && IsAllowed(GuardAI.Magic)) { types.Add(typeof(FeeblemindSpell)); } if (types.Count > 1) { spell = new CurseSpell(m_Guard, null); } else if (types.Count == 1) { spell = (Spell)Activator.CreateInstance(types[0], new object[] { m_Guard, null }); } } } } if (spell != null && (m_Guard.HitsMax - m_Guard.Hits + 10) > Utility.Random(100)) { Type type = null; if (spell is GreaterHealSpell) { type = typeof(BaseHealPotion); } else if (spell is CureSpell) { type = typeof(BaseCurePotion); } else if (spell is StrengthSpell) { type = typeof(BaseStrengthPotion); } else if (spell is AgilitySpell) { type = typeof(BaseAgilityPotion); } if (type == typeof(BaseHealPotion) && !m_Guard.CanBeginAction(type)) { type = null; } if (type != null && m_Guard.Target == null && UseItemByType(type)) { if (spell is GreaterHealSpell) { if ((m_Guard.Hits + 30) > m_Guard.HitsMax && (m_Guard.Hits + 10) < m_Guard.HitsMax) { spell = new HealSpell(m_Guard, null); } } else { spell = null; } } } else if (spell == null && m_Guard.Stam < (m_Guard.StamMax / 3) && IsAllowed(GuardAI.Melee)) { UseItemByType(typeof(BaseRefreshPotion)); } if (spell == null || !spell.Cast()) { EquipWeapon(); } } else if (m_Mobile.Spell is Spell && ((Spell)m_Mobile.Spell).State == SpellState.Sequencing) { EquipWeapon(); } return(true); }
public override void OnResponse(GameClient sender, RelayInfo info) { Mobile from = sender.Mobile; if (info.ButtonID == 0 || m_Plant.Deleted || m_Plant.PlantStatus >= PlantStatus.DecorativePlant || m_Plant.PlantStatus == PlantStatus.BowlOfDirt) { return; } if ((info.ButtonID >= 6 && info.ButtonID <= 8) && !from.InRange(m_Plant.GetWorldLocation(), 3)) { from.LocalOverheadMessage(MessageType.Regular, 0x3E9, 500446); // That is too far away. return; } if (!m_Plant.IsUsableBy(from)) { m_Plant.LabelTo(from, 1061856); // You must have the item in your backpack or locked down in order to use it. return; } switch (info.ButtonID) { case 1: // Main menu { from.SendGump(new MainPlantGump(m_Plant)); break; } case 2: // Set to decorative { if (m_Plant.PlantStatus == PlantStatus.Stage9) { from.SendGump(new SetToDecorativeGump(m_Plant)); } break; } case 3: // Pollination { from.Send(new DisplayHelpTopic(67, true)); // POLLINATION STATE from.SendGump(new ReproductionGump(m_Plant)); break; } case 4: // Resources { from.Send(new DisplayHelpTopic(69, true)); // RESOURCE PRODUCTION from.SendGump(new ReproductionGump(m_Plant)); break; } case 5: // Seeds { from.Send(new DisplayHelpTopic(68, true)); // SEED PRODUCTION from.SendGump(new ReproductionGump(m_Plant)); break; } case 6: // Gather pollen { if (!m_Plant.IsCrossable) { m_Plant.LabelTo(from, 1053050); // You cannot gather pollen from a mutated plant! } else if (!m_Plant.PlantSystem.PollenProducing) { m_Plant.LabelTo(from, 1053051); // You cannot gather pollen from a plant in this stage of development! } else if (m_Plant.PlantSystem.Health < PlantHealth.Healthy) { m_Plant.LabelTo(from, 1053052); // You cannot gather pollen from an unhealthy plant! } else if (m_Plant.IsCrossable && m_Plant.PlantType == PlantType.CocoaTree) { m_Plant.LabelTo(from, 1080537); // You cannot gather pollen from this type of plant! } else { from.Target = new PollinateTarget(m_Plant); from.SendLocalizedMessage(1053054); // Target the plant you wish to cross-pollinate to. break; } from.SendGump(new ReproductionGump(m_Plant)); break; } case 7: // Gather resources { PlantResourceInfo resInfo = PlantResourceInfo.GetInfo(m_Plant.PlantType, m_Plant.PlantHue); PlantSystem system = m_Plant.PlantSystem; if (resInfo == null) { if (m_Plant.IsCrossable) { m_Plant.LabelTo(from, 1053056); // This plant has no resources to gather! } else { m_Plant.LabelTo(from, 1053055); // Mutated plants do not produce resources! } } else if (system.AvailableResources == 0) { m_Plant.LabelTo(from, 1053056); // This plant has no resources to gather! } else { Item resource = resInfo.CreateResource(); if (from.PlaceInBackpack(resource)) { system.AvailableResources--; m_Plant.LabelTo(from, 1053059); // You gather resources from the plant. } else { resource.Delete(); m_Plant.LabelTo(from, 1053058); // You attempt to gather as many resources as you can hold, but your backpack is full. } } from.SendGump(new ReproductionGump(m_Plant)); break; } case 8: // Gather seeds { PlantSystem system = m_Plant.PlantSystem; if (!m_Plant.Reproduces) { m_Plant.LabelTo(from, 1053060); // Mutated plants do not produce seeds! } else if (system.AvailableSeeds == 0) { m_Plant.LabelTo(from, 1053061); // This plant has no seeds to gather! } else { Item seed = CreateSeed(system); if (from.PlaceInBackpack(seed)) { system.AvailableSeeds--; m_Plant.LabelTo(from, 1053063); // You gather seeds from the plant. } else { seed.Delete(); m_Plant.LabelTo(from, 1053062); // You attempt to gather as many seeds as you can hold, but your backpack is full. } } from.SendGump(new ReproductionGump(m_Plant)); break; } } }
public override void OnDoubleClick(Mobile from) { if (!this.VerifyMove(from)) { return; } if (!from.BeginAction(typeof(Kindling))) { from.SendMessage("You must wait a few moments before attempting to create another campfire."); return; } if (!from.InRange(this.GetWorldLocation(), 2)) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. return; } Point3D fireLocation = GetFireLocation(from); if (fireLocation == Point3D.Zero) { from.SendLocalizedMessage(501695); // There is not a spot nearby to place your campfire. return; } if (from.Region is UOACZRegion) { if (!from.CheckSkill(SkillName.Camping, 0.0, 25, 1.0)) { if (Utility.RandomDouble() <= .5) { from.SendMessage("You fail to ignite the campfire and consume the kindling in the process"); Consume(); } else { from.SendLocalizedMessage(501696); // You fail to ignite the campfire. } return; } } else { from.BeginAction(typeof(Kindling)); Timer.DelayCall(TimeSpan.FromSeconds(SkillCooldown.CampingCooldown), delegate { if (from != null) { from.EndAction(typeof(Kindling)); } }); if (!from.CheckSkill(SkillName.Camping, 0.0, 120.0, 1.0)) { from.SendLocalizedMessage(501696); // You fail to ignite the campfire. return; } } Effects.PlaySound(Location, Map, 0x4B9); Consume(); if (!this.Deleted && this.Parent == null) { from.PlaceInBackpack(this); } new Campfire(from).MoveToWorld(fireLocation, from.Map); }