public override bool AllowHarmful(Mobile from, Mobile target) { if (from.IsPlayer()) from.SendMessage("You may not do that in jail."); return (from.IsStaff()); }
public override void OnMovement(Mobile m, Point3D oldLocation) { if (this.TurnedOn && this.IsLockedDown && (!m.Hidden || m.IsPlayer()) && Utility.InRange(m.Location, this.Location, 2) && !Utility.InRange(oldLocation, this.Location, 2)) Effects.PlaySound(this.Location, this.Map, m_Sounds[Utility.Random(m_Sounds.Length)]); base.OnMovement(m, oldLocation); }
public override bool OnSkillUse(Mobile from, int Skill) { if (from.IsPlayer()) from.SendMessage("You may not use skills in jail."); return (from.IsStaff()); }
public override bool OnBeginSpellCast(Mobile from, ISpell s) { if (from.IsPlayer()) from.SendLocalizedMessage(502629); // You cannot cast spells here. return (from.IsStaff()); }
public override bool AllowHousing(Mobile from, Point3D p) { if (from.IsPlayer()) return false; else return base.AllowHousing(from, p); }
public override void OnDoubleClick(Mobile from) { if (from.IsPlayer()) { from.SendMessage("Your not a Staff member, you may not wear this Item..."); this.Delete(); } }
public override void OnLocationChanged(Mobile m, Point3D oldLocation) { base.OnLocationChanged(m, oldLocation); this.StopTimer(m); if (m.Player && m.Alive && m.IsPlayer()) this.StartTimer(m); }
public override void OnMovement(Mobile m, Point3D oldLocation) { if (this.m_TurnedOn && this.IsLockedDown && (!m.Hidden || m.IsPlayer()) && Utility.InRange(m.Location, this.Location, 2) && !Utility.InRange(oldLocation, this.Location, 2)) { this.PlaySound(m); } base.OnMovement(m, oldLocation); }
}// Bone couch public override bool OnMoveOver(Mobile m) { bool allow = base.OnMoveOver(m); if (allow && m.Alive && m.Player && (m.IsPlayer() || !m.Hidden)) Effects.PlaySound(this.Location, this.Map, Utility.RandomMinMax(0x547, 0x54A)); return allow; }
public override bool OnEquip(Mobile from) { if (from.IsPlayer()) { from.SendMessage("Your not a Staff member, you may not wear this Item..."); this.Delete(); } return true; }
public override bool OnTarget(Mobile m, Target t, object o) { if (m.Spell != null && m.Spell is MarkSpell && m.IsPlayer()) { m.SendLocalizedMessage(501800); // You cannot mark an object at that location. return false; } return base.OnTarget(m, t, o); }
public override void OnMovement(Mobile m, Point3D oldLocation) { if (this.TurnedOn && this.IsLockedDown && (!m.Hidden || m.IsPlayer()) && Utility.InRange(m.Location, this.Location, 2) && !Utility.InRange(oldLocation, this.Location, 2)) { this.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.RandomMinMax(1073207, 1073216)); Effects.PlaySound(this.Location, this.Map, Utility.RandomMinMax(0x5A, 0xE9)); } base.OnMovement(m, oldLocation); }
public override bool OnBeginSpellCast(Mobile m, ISpell s) { if ((s is GateTravelSpell || s is RecallSpell || s is MarkSpell || s is SacredJourneySpell) && m.IsPlayer()) { m.SendLocalizedMessage(501802); // Thy spell doth not appear to work... return false; } return base.OnBeginSpellCast(m, s); }
public override bool OnBeginSpellCast(Mobile m, ISpell s) { if ((s is GateTravelSpell || s is RecallSpell || s is MarkSpell || s is SacredJourneySpell) && m.IsPlayer()) { m.SendMessage("You cannot cast that spell here."); return false; } else { return base.OnBeginSpellCast(m, s); } }
public override void OnMovement(Mobile m, Point3D oldLocation) { if (this.TurnedOn && this.IsLockedDown && (!m.Hidden || m.IsPlayer()) && Utility.InRange(m.Location, this.Location, 2) && !Utility.InRange(oldLocation, this.Location, 2)) { this.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.RandomList(1073326, 1073328, 1073329, 1073330, 1073331)); if (Utility.RandomBool()) Effects.PlaySound(this.Location, this.Map, Utility.RandomMinMax(0x30A, 0x313)); else Effects.PlaySound(this.Location, this.Map, Utility.RandomMinMax(0x419, 0x422)); } base.OnMovement(m, oldLocation); }
public override string OnIdentify(Mobile from) { if (from == null || from.IsPlayer()) return null; if (this.Expiration > TimeSpan.Zero) { return String.Format("{2} = {0} : expires in {1} mins", this.Data, this.Expiration.TotalMinutes, this.Name); } else { return String.Format("{1} = {0}", this.Data, this.Name); } }
public override string OnIdentify(Mobile from) { if (from.IsPlayer()) return null; if (this.Expiration > TimeSpan.Zero) { return String.Format("Quest '{2}' Completed {0} expires in {1} mins", this.Date, this.Expiration.TotalMinutes, this.Name); } else { return String.Format("Quest '{1}' Completed {0}", this.Date, this.Name); } }
public override bool OnDoubleClick(Mobile m, object o) { if (o is Corpse) { // dont allow other players to loot corpses while a challenge game is present if ((this.ChallengeGame != null) && !this.ChallengeGame.Deleted && (m != null) && !(((Corpse)o).Owner is BaseCreature) && (((Corpse)o).Owner != m) && (m.IsPlayer())) { XmlPoints.SendText(m, 100105); // "You are not allowed to open that here." return false; } } return base.OnDoubleClick(m, o); }
public override void OnEnter(Mobile m) { base.OnEnter(m); if (m.Player && m.Alive && m.IsPlayer()) { if (this.EnterSound > 0) m.PlaySound(this.EnterSound); if (this.EnterMessage > 0) m.SendLocalizedMessage(this.EnterMessage); this.StartTimer(m); } }
public override void OnMovement(Mobile m, Point3D oldLocation) { if (this.TurnedOn && this.IsLockedDown && (!m.Hidden || m.IsPlayer()) && Utility.InRange(m.Location, this.Location, 2) && !Utility.InRange(oldLocation, this.Location, 2)) { int cliloc = Utility.RandomMinMax(1073266, 1073286); if (cliloc == 1073282) cliloc -= 1; this.PublicOverheadMessage(MessageType.Regular, 0x3B2, cliloc); Effects.PlaySound(this.Location, this.Map, Utility.Random(0x17)); } base.OnMovement(m, oldLocation); }
public override string OnIdentify(Mobile from) { base.OnIdentify(from); if (from == null || from.IsPlayer()) return null; if (this.Expiration > TimeSpan.Zero) { return String.Format("Freeze expires in {1} secs", this.Expiration.TotalSeconds); } else { return String.Format("Frozen"); } }
public override string OnIdentify(Mobile from) { base.OnIdentify(from); if (from == null || from.IsPlayer()) return null; if (this.Expiration > TimeSpan.Zero) { return String.Format("Hue {0} expires in {1} mins", this.m_Hue, this.Expiration.TotalMinutes); } else { return String.Format("Hue {0}", this.m_Hue); } }
public override bool OnMoveOver(Mobile m) { if (m.Alive && (m.IsPlayer() || !m.Hidden)) { if (m.Player) { if (m.Female) Effects.PlaySound(this.Location, this.Map, Utility.RandomMinMax(0x53B, 0x53D)); else Effects.PlaySound(this.Location, this.Map, Utility.RandomMinMax(0x53E, 0x540)); } if (this.m_Timer == null || !this.m_Timer.Running) (this.m_Timer = new InternalTimer(m)).Start(); } return true; }
public override bool OnMoveOver(Mobile m) { if (this.m_Target != null && !this.m_Target.Deleted) { if (this.CheckAccess(m)) { if (!m.Hidden || m.IsPlayer()) new EffectTimer(this.Location, this.Map, 2023, 0x1F0, TimeSpan.FromSeconds(0.4)).Start(); new DelayTimer(this, m).Start(); } else { m.SendLocalizedMessage(1061637); // You are not allowed to access this. } } return true; }
public override bool OnMoveOver(Mobile m) { if (m is PlayerMobile && m.Alive && m.IsPlayer()) { switch (Utility.Random(3)) { case 0: this.RunSequence(m, 1095160, false); break; //You steadily walk over the slippery surface. case 1: this.RunSequence(m, 1095161, true); break; //You skillfully manage to maintain your balance. default: this.RunSequence(m, 1095162, true); break; //You lose your footing and ungracefully splatter on the ground. } } return base.OnMoveOver(m); }
public override void OnMovement(Mobile m, Point3D old) { base.OnMovement(m, old); if (m.Alive && m.Player && (m.IsPlayer() || !m.Hidden)) { if (!Utility.InRange(old, this.Location, 2) && Utility.InRange(m.Location, this.Location, 2)) { if (this.ItemID == 0x2A7B || this.ItemID == 0x2A7D) { Effects.PlaySound(this.Location, this.Map, Utility.RandomMinMax(0x551, 0x553)); this.ItemID += 1; } } else if (Utility.InRange(old, this.Location, 2) && !Utility.InRange(m.Location, this.Location, 2)) { if (this.ItemID == 0x2A7C || this.ItemID == 0x2A7E) this.ItemID -= 1; } } }
public override void OnMovement(Mobile m, Point3D old) { if (m.Alive && m.Player && (m.IsPlayer() || !m.Hidden)) { if (!Utility.InRange(old, this.Location, 2) && Utility.InRange(m.Location, this.Location, 2)) { if (this.ItemID == 0x2A69 || this.ItemID == 0x2A6D) { this.Up(); Timer.DelayCall(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(0.5), 2, new TimerCallback(Up)); } } else if (Utility.InRange(old, this.Location, 2) && !Utility.InRange(m.Location, this.Location, 2)) { if (this.ItemID == 0x2A6C || this.ItemID == 0x2A70) { this.Down(); Timer.DelayCall(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(0.5), 2, new TimerCallback(Down)); } } } }
public bool UseGate(Mobile from) { if (DuelContext.CheckCombat(from)) { from.SendMessage(0x22, "You have recently been in combat with another player and cannot use this moongate."); return false; } else if (from.Spell != null) { from.SendLocalizedMessage(1049616); // You are too busy to do that at the moment. return false; } else { from.CloseGump(typeof(ArenaGump)); from.SendGump(new ArenaGump(from, this)); if (!from.Hidden || from.IsPlayer()) Effects.PlaySound(from.Location, from.Map, 0x20E); return true; } }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is Item) { Item item = (Item)targeted; if (item.Movable == false && from.IsPlayer()) return; Type type = targeted.GetType(); FlipableAttribute[] AttributeArray = (FlipableAttribute[])type.GetCustomAttributes(typeof(FlipableAttribute), false); if (AttributeArray.Length == 0) { return; } FlipableAttribute fa = AttributeArray[0]; fa.Flip((Item)targeted); } }
public override bool OnBeginSpellCast(Mobile m, ISpell s) { if ((s is GateTravelSpell || s is RecallSpell || s is MarkSpell || s is SacredJourneySpell) && m.IsPlayer()) { m.SendLocalizedMessage(501802); // Thy spell doth not appear to work... return(false); } return(base.OnBeginSpellCast(m, s)); }
public override string OnIdentify(Mobile from) { // dont let other people identify your faction standings if (this.AttachedTo is Mobile && (from != (Mobile)this.AttachedTo && from != null && from.IsPlayer())) { return(null); } // display the faction status in a gump StringBuilder gumpmsg = new StringBuilder(); gumpmsg.AppendFormat("\n{0,-15}{1,-15}{2,-10}\n", "Mob Faction", "Standing", "Level"); if (this.FactionList != null) { foreach (GroupStatus g in this.FactionList) { gumpmsg.AppendFormat("{0,-15}{1,-15}{2,-10}\n", g.GroupType, GetTitle(g.FactionLevel), g.FactionLevel); } } if (from != null) { from.CloseGump(typeof(MobFactionGump)); from.SendGump(new MobFactionGump(from, this, gumpmsg.ToString())); } string msg = null; if (this.Expiration > TimeSpan.Zero) { msg = String.Format("{0}expires in {0} mins ", msg, this.Expiration.TotalMinutes); } if (this.Refractory > TimeSpan.Zero) { return(String.Format("{0}with a minimum of {1} secs between gains", msg, this.Refractory.TotalSeconds)); } else { return(msg); } }
public void Invoke(Mobile from, object targeted) { this.CancelTimeout(); from.ClearTarget(); if (from.Deleted) { this.OnTargetCancel(from, TargetCancelType.Canceled); this.OnTargetFinish(from); return; } Point3D loc; Map map; if (targeted is LandTarget) { loc = ((LandTarget)targeted).Location; map = from.Map; } else if (targeted is StaticTarget) { loc = ((StaticTarget)targeted).Location; map = from.Map; } else if (targeted is Mobile) { if (((Mobile)targeted).Deleted) { this.OnTargetDeleted(from, targeted); this.OnTargetFinish(from); return; } else if (!((Mobile)targeted).CanTarget) { this.OnTargetUntargetable(from, targeted); this.OnTargetFinish(from); return; } loc = ((Mobile)targeted).Location; map = ((Mobile)targeted).Map; } else if (targeted is Item) { Item item = (Item)targeted; if (item.Deleted) { this.OnTargetDeleted(from, targeted); this.OnTargetFinish(from); return; } else if (!item.CanTarget) { this.OnTargetUntargetable(from, targeted); this.OnTargetFinish(from); return; } object root = item.RootParent; if (!this.m_AllowNonlocal && root is Mobile && root != from && from.IsPlayer()) { this.OnNonlocalTarget(from, targeted); this.OnTargetFinish(from); return; } loc = item.GetWorldLocation(); map = item.Map; } else { this.OnTargetCancel(from, TargetCancelType.Canceled); this.OnTargetFinish(from); return; } if (map == null || map != from.Map || (this.m_Range != -1 && !from.InRange(loc, this.m_Range))) { this.OnTargetOutOfRange(from, targeted); } else { if (!from.CanSee(targeted)) { this.OnCantSeeTarget(from, targeted); } else if (this.m_CheckLOS && !from.InLOS(targeted)) { this.OnTargetOutOfLOS(from, targeted); } else if (targeted is Item && ((Item)targeted).InSecureTrade) { this.OnTargetInSecureTrade(from, targeted); } else if (targeted is Item && !((Item)targeted).IsAccessibleTo(from)) { this.OnTargetNotAccessible(from, targeted); } else if (targeted is Item && !((Item)targeted).CheckTarget(from, this, targeted)) { this.OnTargetUntargetable(from, targeted); } else if (targeted is Mobile && !((Mobile)targeted).CheckTarget(from, this, targeted)) { this.OnTargetUntargetable(from, targeted); } else if (from.Region.OnTarget(from, this, targeted)) { this.OnTarget(from, targeted); } } this.OnTargetFinish(from); }
public override void OnMovement(Mobile m, Point3D oldLocation) { base.OnMovement(m, oldLocation); if (m_NextTerror < DateTime.UtcNow && m != null && InRange(m.Location, 3) && m.IsPlayer()) { m.Frozen = true; m.SendLocalizedMessage(1080342, Name, 33); // Terror slices into your very being, destroying any chance of resisting ~1_name~ you might have had Timer.DelayCall(TimeSpan.FromSeconds(5), new TimerStateCallback(Terrorize), m); } }
public override bool OnBeginSpellCast(Mobile m, ISpell s) { if ((s is GateTravelSpell || s is RecallSpell || s is MarkSpell || s is SacredJourneySpell) && m.IsPlayer()) { m.SendMessage("You cannot cast that spell here."); return(false); } return(base.OnBeginSpellCast(m, s)); }
public override void OnMovement(Mobile m, Point3D oldLocation) { base.OnMovement(m, oldLocation); if (this.m_NextTerror < DateTime.UtcNow && m != null && this.InRange(m.Location, 10) && m.IsPlayer()) { m.Frozen = true; m.SendLocalizedMessage(1080342, this.Name, 33); // Terror slices into your very being, destroying any chance of resisting ~1_name~ you might have had Timer.DelayCall(TimeSpan.FromSeconds(10), new TimerStateCallback(Terrorize), m); BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.TrueFear, 1153791, 1153827, TimeSpan.FromSeconds(10), m)); } }
public override bool CanEquip(Mobile from) { if (BlessedBy != null && BlessedBy != from) { from.SendLocalizedMessage(1075277); // That item is blessed by another player. return(false); } if (from.IsPlayer()) { if (_Owner != null && _Owner != from) { from.SendLocalizedMessage(501023); // You must be the owner to use this item. return(false); } if (this is IAccountRestricted && ((IAccountRestricted)this).Account != null) { Accounting.Account acct = from.Account as Accounting.Account; if (acct == null || acct.Username != ((IAccountRestricted)this).Account) { from.SendLocalizedMessage(1071296); // This item is Account Bound and your character is not bound to it. You cannot use this item. return(false); } } if (IsVvVItem && !Engines.VvV.ViceVsVirtueSystem.IsVvV(from)) { from.SendLocalizedMessage(1155496); // This item can only be used by VvV participants! return(false); } } if (from.AccessLevel < AccessLevel.GameMaster) { bool morph = from.FindItemOnLayer(Layer.Earrings) is MorphEarrings; if (from.Race == Race.Gargoyle && !CanBeWornByGargoyles) { from.SendLocalizedMessage(1111708); // Gargoyles can't wear return(false); } else if (RequiredRace != null && from.Race != RequiredRace && !morph) { if (RequiredRace == Race.Elf) { from.SendLocalizedMessage(1072203); // Only Elves may use } else if (RequiredRace == Race.Gargoyle) { from.SendLocalizedMessage(1111707); // Only gargoyles can wear } else { from.SendMessage("Only {0} may use ", RequiredRace.PluralName); } return(false); } } return(base.CanEquip(from)); }
public override bool CanTeleport(Mobile m) { if (!base.CanTeleport(m)) { return(false); } if (GetFlag(ConditionFlag.StaffOnly) && m.IsPlayer()) { return(false); } if (GetFlag(ConditionFlag.DenyMounted) && m.Mounted) { m.SendLocalizedMessage(1077252); // You must dismount before proceeding. return(false); } if (GetFlag(ConditionFlag.DenyFollowers) && (m.Followers != 0 || (m is PlayerMobile && ((PlayerMobile)m).AutoStabled.Count != 0))) { m.SendLocalizedMessage(1077250); // No pets permitted beyond this point. return(false); } Container pack = m.Backpack; if (pack != null) { if (GetFlag(ConditionFlag.DenyPackContents) && pack.TotalItems != 0) { if (!DisableMessage) { m.SendMessage("You must empty your backpack before proceeding."); } return(false); } if (GetFlag(ConditionFlag.DenyPackEthereals) && (pack.FindItemByType(typeof(EtherealMount)) != null || pack.FindItemByType(typeof(BaseImprisonedMobile)) != null)) { if (!DisableMessage) { m.SendMessage("You must empty your backpack of ethereal mounts before proceeding."); } return(false); } } if (GetFlag(ConditionFlag.DenyHolding) && m.Holding != null) { if (!DisableMessage) { m.SendMessage("You must let go of what you are holding before proceeding."); } return(false); } if (GetFlag(ConditionFlag.DenyEquipment)) { foreach (Item item in m.Items) { switch (item.Layer) { case Layer.Hair: case Layer.FacialHair: case Layer.Backpack: case Layer.Mount: case Layer.Bank: { continue; // ignore } default: { if (!DisableMessage) { m.SendMessage("You must remove all of your equipment before proceeding."); } return(false); } } } } if (GetFlag(ConditionFlag.DenyTransformed) && m.IsBodyMod) { if (!DisableMessage) { m.SendMessage("You cannot go there in this form."); } return(false); } if (GetFlag(ConditionFlag.DeadOnly) && m.Alive) { if (!DisableMessage) { m.SendLocalizedMessage(1060014); // Only the dead may pass. } return(false); } if (!DisableMessage && ClilocNumber != 0) { m.SendLocalizedMessage(ClilocNumber); } return(true); }
public static void Container_Snoop(Container cont, Mobile from) { if (from.IsStaff() || from.InRange(cont.GetWorldLocation(), 1)) { Mobile root = cont.RootParent as Mobile; if (root != null && !root.Alive) { return; } if (root != null && root.IsStaff() && from.IsPlayer()) { from.SendLocalizedMessage(500209); // You can not peek into the container. return; } if (root != null && from.IsPlayer() && !CheckSnoopAllowed(from, root)) { from.SendLocalizedMessage(1001018); // You cannot perform negative acts on your target. return; } if (root != null && from.IsPlayer() && from.Skills[SkillName.Snooping].Value < Utility.Random(100)) { Map map = from.Map; if (map != null) { string message = String.Format("You notice {0} attempting to peek into {1}'s belongings.", from.Name, root.Name); IPooledEnumerable eable = map.GetClientsInRange(from.Location, 8); foreach (NetState ns in eable) { if (ns.Mobile != from) { ns.Mobile.SendMessage(message); } } eable.Free(); } } if (from.IsPlayer()) { Titles.AwardKarma(from, -4, true); } if (from.IsStaff() || from.CheckTargetSkill(SkillName.Snooping, cont, 0.0, 100.0)) { if (cont is TrapableContainer && ((TrapableContainer)cont).ExecuteTrap(from)) { return; } cont.DisplayTo(from); } else { from.SendLocalizedMessage(500210); // You failed to peek into the container. if (from.Skills[SkillName.Hiding].Value / 2 < Utility.Random(100)) { from.RevealingAction(); } } } else { from.SendLocalizedMessage(500446); // That is too far away. } }
public static void Container_Snoop(Container cont, Mobile from) { if (from.IsStaff() || from.InRange(cont.GetWorldLocation(), 1)) { Mobile root = cont.RootParent as Mobile; if (root != null && !root.Alive) { return; } if (from.IsPlayer() && root is BaseCreature && !(cont is StrongBackpack)) { return; } if (root != null && root.IsStaff() && from.IsPlayer()) { from.SendLocalizedMessage(500209); // You can not peek into the container. return; } if (root != null && from.IsPlayer() && !CheckSnoopAllowed(from, root)) { from.SendLocalizedMessage(1001018); // You cannot perform negative acts on your target. return; } if (root != null && from.IsPlayer() && from.Skills[SkillName.Snooping].Value < Utility.Random(100)) { Map map = from.Map; if (map != null) { string message = String.Format("You notice {0} peeking into your belongings!", from.Name); root.Send(new AsciiMessage(-1, -1, MessageType.Label, 946, 3, "", message)); } } if (from.IsPlayer()) { Titles.AwardKarma(from, -4, true); } if (from.IsStaff() || from.CheckTargetSkill(SkillName.Snooping, cont, 0.0, 100.0)) { if (cont is TrapableContainer && ((TrapableContainer)cont).ExecuteTrap(from)) { return; } cont.DisplayTo(from); } else { from.SendLocalizedMessage(500210); // You failed to peek into the container. if (from.Skills[SkillName.Hiding].Value / 2 < Utility.Random(100)) { from.RevealingAction(); } } } else { from.SendLocalizedMessage(500446); // That is too far away. } }
public override void OnResponse(NetState sender, RelayInfo info) { if (m_Chest.Deleted || info.ButtonID == 0 || !m_From.CheckAlive()) { return; } if (m_From.IsPlayer() && (m_From.Map != m_Chest.Map || !m_From.InRange(m_Chest.GetWorldLocation(), 2))) { m_From.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500446); // That is too far away. return; } if (info.ButtonID == 1) { m_Chest.SubmitSolution(m_From, m_Solution); } else { if (info.Switches.Length == 0) { return; } int pedestal = info.Switches[0]; if (pedestal < 0 || pedestal >= m_Solution.Cylinders.Length) { return; } PuzzleChestCylinder cylinder; switch (info.ButtonID) { case 10: cylinder = PuzzleChestCylinder.LightBlue; break; case 11: cylinder = PuzzleChestCylinder.Blue; break; case 12: cylinder = PuzzleChestCylinder.Green; break; case 13: cylinder = PuzzleChestCylinder.Orange; break; case 14: cylinder = PuzzleChestCylinder.Purple; break; case 15: cylinder = PuzzleChestCylinder.Red; break; case 16: cylinder = PuzzleChestCylinder.DarkBlue; break; case 17: cylinder = PuzzleChestCylinder.Yellow; break; default: return; } m_Solution.Cylinders[pedestal] = cylinder; m_From.SendGump(new PuzzleGump(m_From, m_Chest, m_Solution, pedestal)); } }
public static void Run() { List <Item> items = new List <Item>(); List <Item> validItems = new List <Item>(); List <Mobile> hairCleanup = new List <Mobile>(); int boxes = 0; foreach (Item item in World.Items.Values) { if (item.Map == null) { items.Add(item); continue; } else if (item is CommodityDeed) { CommodityDeed deed = (CommodityDeed)item; if (deed.Commodity != null) { validItems.Add(deed.Commodity); } continue; } else if (item is BaseHouse) { BaseHouse house = (BaseHouse)item; foreach (RelocatedEntity relEntity in house.RelocatedEntities) { if (relEntity.Entity is Item) { validItems.Add((Item)relEntity.Entity); } } foreach (VendorInventory inventory in house.VendorInventories) { foreach (Item subItem in inventory.Items) { validItems.Add(subItem); } } } else if (item is BankBox) { BankBox box = (BankBox)item; Mobile owner = box.Owner; if (owner == null) { items.Add(box); ++boxes; } else if (box.Items.Count == 0) { items.Add(box); ++boxes; } continue; } else if ((item.Layer == Layer.Hair || item.Layer == Layer.FacialHair)) { object rootParent = item.RootParent; if (rootParent is Mobile) { Mobile rootMobile = (Mobile)rootParent; if (item.Parent != rootMobile && rootMobile.IsPlayer()) { items.Add(item); continue; } else if (item.Parent == rootMobile) { hairCleanup.Add(rootMobile); continue; } } } if (item.Parent != null || item.Map != Map.Internal || item.HeldBy != null) { continue; } if (item.Location != Point3D.Zero) { continue; } if (!IsBuggable(item)) { continue; } if (item is BaseBoat || item is BaseDockedBoat) { continue; } items.Add(item); } for (int i = 0; i < validItems.Count; ++i) { items.Remove(validItems[i]); } if (items.Count > 0) { if (boxes > 0) { Console.WriteLine("Cleanup: Detected {0} inaccessible items, including {1} bank boxes, removing..", items.Count, boxes); } else { Console.WriteLine("Cleanup: Detected {0} inaccessible items, removing..", items.Count); } for (int i = 0; i < items.Count; ++i) { Console.WriteLine(items[i].ToString()); items[i].Delete(); } } if (hairCleanup.Count > 0) { Console.WriteLine("Cleanup: Detected {0} hair and facial hair items being worn, converting to their virtual counterparts..", hairCleanup.Count); for (int i = 0; i < hairCleanup.Count; i++) { hairCleanup[i].ConvertHair(); } } }
public virtual bool Cast() { m_StartCastTime = Core.TickCount; if (m_Caster.Spell is Spell && ((Spell)m_Caster.Spell).State == SpellState.Sequencing) { ((Spell)m_Caster.Spell).Disturb(DisturbType.NewCast); } if (!m_Caster.CheckAlive()) { return(false); } else if (m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).Peaced) { m_Caster.SendLocalizedMessage(1072060); // You cannot cast a spell while calmed. } else if (m_Scroll is BaseWand && m_Caster.Spell != null && m_Caster.Spell.IsCasting) { m_Caster.SendLocalizedMessage(502643); // You can not cast a spell while frozen. } else if (SkillHandlers.SpiritSpeak.IsInSpiritSpeak(m_Caster) || (m_Caster.Spell != null && m_Caster.Spell.IsCasting)) { m_Caster.SendLocalizedMessage(502642); // You are already casting a spell. } else if (BlockedByHorrificBeast && TransformationSpellHelper.UnderTransformation(m_Caster, typeof(HorrificBeastSpell)) || (BlockedByAnimalForm && AnimalForm.UnderTransformation(m_Caster))) { m_Caster.SendLocalizedMessage(1061091); // You cannot cast that spell in this form. } else if (!(m_Scroll is BaseWand) && (m_Caster.Paralyzed || m_Caster.Frozen)) { m_Caster.SendLocalizedMessage(502643); // You can not cast a spell while frozen. } else if (CheckNextSpellTime && Core.TickCount - m_Caster.NextSpellTime < 0) { m_Caster.SendLocalizedMessage(502644); // You have not yet recovered from casting a spell. } else if (m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).PeacedUntil > DateTime.UtcNow) { m_Caster.SendLocalizedMessage(1072060); // You cannot cast a spell while calmed. } else if (!CheckManaBeforeCast || m_Caster.Mana >= ScaleMana(GetMana())) { #region Stygian Abyss if (m_Caster.Race == Race.Gargoyle && m_Caster.Flying) { if (BaseMount.OnFlightPath(m_Caster)) { if (m_Caster.IsPlayer()) { m_Caster.SendLocalizedMessage(1113750); // You may not cast spells while flying over such precarious terrain. return(false); } else { m_Caster.SendMessage("Your staff level allows you to cast while flying over precarious terrain."); } } } #endregion if (m_Caster.Spell == null && m_Caster.CheckSpellCast(this) && CheckCast() && m_Caster.Region.OnBeginSpellCast(m_Caster, this)) { m_State = SpellState.Casting; m_Caster.Spell = this; Caster.Delta(MobileDelta.Flags); if (!(m_Scroll is BaseWand) && RevealOnCast) { m_Caster.RevealingAction(); } SayMantra(); /* * EA seems to use some type of spell variation, of -100 ms + timer resolution. * Using the below millisecond dropoff with a 50ms timer resolution seems to be exact * to EA. */ TimeSpan castDelay = GetCastDelay().Subtract(TimeSpan.FromMilliseconds(100)); if (ShowHandMovement && !(m_Scroll is SpellStone) && (m_Caster.Body.IsHuman || (m_Caster.Player && m_Caster.Body.IsMonster))) { int count = (int)Math.Ceiling(castDelay.TotalSeconds / AnimateDelay.TotalSeconds); if (count != 0) { m_AnimTimer = new AnimTimer(this, count); m_AnimTimer.Start(); } if (m_Info.LeftHandEffect > 0) { Caster.FixedParticles(0, 10, 5, m_Info.LeftHandEffect, EffectLayer.LeftHand); } if (m_Info.RightHandEffect > 0) { Caster.FixedParticles(0, 10, 5, m_Info.RightHandEffect, EffectLayer.RightHand); } } if (ClearHandsOnCast) { m_Caster.ClearHands(); } WeaponAbility.ClearCurrentAbility(m_Caster); m_CastTimer = new CastTimer(this, castDelay); //m_CastTimer.Start(); OnBeginCast(); if (castDelay > TimeSpan.Zero) { m_CastTimer.Start(); } else { m_CastTimer.Tick(); } return(true); } else { return(false); } } else { m_Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502625, ScaleMana(GetMana()).ToString()); // Insufficient mana. You must have at least ~1_MANA_REQUIREMENT~ Mana to use this spell. } return(false); }
public override void OnDoubleClick(Mobile m) { if (IsChildOf(m.Backpack)) { m.SendLocalizedMessage(1114918); // Select a House Teleporter to link to. m.BeginTarget(-1, false, Server.Targeting.TargetFlags.None, (from, targeted) => { if (targeted is HouseTeleporterTile) { HouseTeleporterTile tile = targeted as HouseTeleporterTile; if (tile.IsChildOf(m.Backpack)) { tile.Link = this; Link = tile; if (UsesCharges && tile.UsesCharges) //TODO: Can you link non-charged with charged? { from.SendLocalizedMessage(1115119); // The two House Teleporters are now linked and the charges remaining have been rebalanced. if (!UsesCharges) { UsesCharges = true; } if (!tile.UsesCharges) { tile.UsesCharges = true; } int charges = _Charges + tile.Charges; Charges = charges / 2; tile.Charges = charges / 2; } else if (!UsesCharges && !tile.UsesCharges) { from.SendLocalizedMessage(1114919); // The two House Teleporters are now linked. } else { from.SendMessage("Those cannot be linked."); // TODO: Message? } } else { from.SendLocalizedMessage(1114917); // This must be in your backpack to link it. } } }); } else if (!IsMoveOver) { if (Target != null && !Target.Deleted && InRange(m, 1)) { if (CheckAccess(m)) { if (!m.Hidden || m.IsPlayer()) { new EffectTimer(m.Location, m.Map, 2023, 0x1F0, TimeSpan.FromSeconds(0.4)).Start(); } new DelayTimer(this, m).Start(); } } } else { m.SendLocalizedMessage(1114917); // This must be in your backpack to link it. } }
public override void OnDoubleClick(Mobile from) { if (IsDeadPet) { return; } if (from.IsBodyMod && !from.Body.IsHuman) { PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1062061, from.NetState); return; } if (!CheckMountAllowed(from, this, true, false)) { return; } if (from.Mount is BaseBoat) { return; } if (from.Mounted) { from.SendLocalizedMessage(1005583); // Please dismount first. return; } if (from.Race == Race.Gargoyle && from.IsPlayer()) { from.SendLocalizedMessage(1112281); OnDisallowedRider(from); return; } if (from.Female ? !AllowFemaleRider : !AllowMaleRider) { OnDisallowedRider(from); return; } if (!DesignContext.Check(from)) { return; } if (from.HasTrade) { from.SendLocalizedMessage(1042317); // 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 (Poisoned) { PrivateOverheadMessage(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(MessageType.Regular, 0x3B2, 501263, from.NetState); } else { // This isn't your mount; it refuses to let you ride. PrivateOverheadMessage(MessageType.Regular, 0x3B2, 501264, from.NetState); } } else { from.SendLocalizedMessage(500206); // That is too far away to ride. } }
public override void OnDoubleClick(Mobile from) { if (this.IsDeadPet) { return; } if (from.IsBodyMod && !from.Body.IsHuman) { if (Core.AOS) // You cannot ride a mount in your current form. { this.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.Race == Race.Gargoyle && from.IsPlayer()) { from.SendLocalizedMessage(1112281); this.OnDisallowedRider(from); return; } if (from.Female ? !this.AllowFemaleRider : !this.AllowMaleRider) { this.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) || (this.Controlled && this.ControlMaster == from) || (this.Summoned && this.SummonMaster == from); if (canAccess) { if (this.Poisoned) { this.PrivateOverheadMessage(Network.MessageType.Regular, 0x3B2, 1049692, from.NetState); // This mount is too ill to ride. } else { this.Rider = from; } } else if (!this.Controlled && !this.Summoned) { // That mount does not look broken! You would have to tame it to ride it. this.PrivateOverheadMessage(Network.MessageType.Regular, 0x3B2, 501263, from.NetState); } else { // This isn't your mount; it refuses to let you ride. this.PrivateOverheadMessage(Network.MessageType.Regular, 0x3B2, 501264, from.NetState); } } else { from.SendLocalizedMessage(500206); // That is too far away to ride. } }
private static void EventSink_Speech(SpeechEventArgs e) { Mobile from = e.Mobile; int[] keywords = e.Keywords; for (int i = 0; i < keywords.Length; ++i) { switch (keywords[i]) { case 0x00E4: // *i wish to access the city treasury* { Town town = Town.FromRegion(from.Region); if (town == null || !town.IsFinance(from) || !from.Alive) { break; } if (FactionGump.Exists(from)) { from.SendLocalizedMessage(1042160); // You already have a faction menu open. } else if (town.Owner != null && from is PlayerMobile) { from.SendGump(new FinanceGump((PlayerMobile)from, town.Owner, town)); } break; } case 0x0ED: // *i am sheriff* { Town town = Town.FromRegion(from.Region); if (town == null || !town.IsSheriff(from) || !from.Alive) { break; } if (FactionGump.Exists(from)) { from.SendLocalizedMessage(1042160); // You already have a faction menu open. } else if (town.Owner != null) { from.SendGump(new SheriffGump((PlayerMobile)from, town.Owner, town)); } break; } case 0x00EF: // *you are fired* { Town town = Town.FromRegion(from.Region); if (town == null) { break; } if (town.IsFinance(from) || town.IsSheriff(from)) { town.BeginOrderFiring(from); } break; } case 0x00E5: // *i wish to resign as finance minister* { PlayerState pl = PlayerState.Find(from); if (pl != null && pl.Finance != null) { pl.Finance.Finance = null; from.SendLocalizedMessage(1005081); // You have been fired as Finance Minister } break; } case 0x00EE: // *i wish to resign as sheriff* { PlayerState pl = PlayerState.Find(from); if (pl != null && pl.Sheriff != null) { pl.Sheriff.Sheriff = null; from.SendLocalizedMessage(1010270); // You have been fired as Sheriff } break; } case 0x00E9: // *what is my faction term status* { PlayerState pl = PlayerState.Find(from); if (pl != null && pl.IsLeaving) { if (Faction.CheckLeaveTimer(from)) { break; } TimeSpan remaining = (pl.Leaving + Faction.LeavePeriod) - DateTime.Now; if (remaining.TotalDays >= 1) { from.SendLocalizedMessage(1042743, remaining.TotalDays.ToString("N0")); // Your term of service will come to an end in ~1_DAYS~ days. } else if (remaining.TotalHours >= 1) { from.SendLocalizedMessage(1042741, remaining.TotalHours.ToString("N0")); // Your term of service will come to an end in ~1_HOURS~ hours. } else { from.SendLocalizedMessage(1042742); // Your term of service will come to an end in less than one hour. } } else if (pl != null) { from.SendLocalizedMessage(1042233); // You are not in the process of quitting the faction. } break; } case 0x00EA: // *message faction* { Faction faction = Faction.Find(from); if (faction == null || !faction.IsCommander(from)) { break; } if (from.IsPlayer() && !faction.FactionMessageReady) { from.SendLocalizedMessage(1010264); // The required time has not yet passed since the last message was sent } else { faction.BeginBroadcast(from); } break; } case 0x00EC: // *showscore* { PlayerState pl = PlayerState.Find(from); if (pl != null) { Timer.DelayCall(TimeSpan.Zero, new TimerStateCallback(ShowScore_Sandbox), pl); } break; } case 0x0178: // i honor your leadership { Faction faction = Faction.Find(from); if (faction != null) { faction.BeginHonorLeadership(from); } break; } } } }
public override bool OnBeginSpellCast(Mobile from, ISpell s) { if ((s is TeleportSpell || s is GateTravelSpell || s is RecallSpell || s is MarkSpell || s is SacredJourneySpell) && from.IsPlayer()) { from.SendLocalizedMessage(500015); // You do not have that spell! return(false); } else { return(base.OnBeginSpellCast(from, s)); } }
public bool UseGate(Mobile m) { if (m.Criminal) { m.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily. return false; } else if (SpellHelper.CheckCombat(m)) { m.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle?? return false; } else if (m.Spell != null) { m.SendLocalizedMessage(1049616); // You are too busy to do that at the moment. return false; } else if (m.Holding != null) { m.SendLocalizedMessage(1071955); // You cannot teleport while dragging an object. return false; } else { m.CloseGump(typeof(MoongateGump)); m.SendGump(new MoongateGump(m, this)); if (!m.Hidden || m.IsPlayer()) Effects.PlaySound(m.Location, m.Map, 0x20E); return true; } }
public Point3D RandomSpawnLocation(int spawnHeight, bool land, bool water, Point3D home, int range) { Map map = Map; if (map == Map.Internal) { return(Point3D.Zero); } InitRectangles(); if (m_TotalWeight <= 0) { return(Point3D.Zero); } for (int i = 0; i < 10; i++) // Try 10 times { int x, y, minZ, maxZ; if (home == Point3D.Zero) { int rand = Utility.Random(m_TotalWeight); x = int.MinValue; y = int.MinValue; minZ = int.MaxValue; maxZ = int.MinValue; for (int j = 0; j < m_RectangleWeights.Length; j++) { int curWeight = m_RectangleWeights[j]; if (rand < curWeight) { Rectangle3D rect = m_Rectangles[j]; x = rect.Start.X + rand % rect.Width; y = rect.Start.Y + rand / rect.Width; minZ = rect.Start.Z; maxZ = rect.End.Z; break; } rand -= curWeight; } } else { x = Utility.RandomMinMax(home.X - range, home.X + range); y = Utility.RandomMinMax(home.Y - range, home.Y + range); minZ = int.MaxValue; maxZ = int.MinValue; for (int j = 0; j < Area.Length; j++) { Rectangle3D rect = Area[j]; if (x >= rect.Start.X && x < rect.End.X && y >= rect.Start.Y && y < rect.End.Y) { minZ = rect.Start.Z; maxZ = rect.End.Z; break; } } if (minZ == int.MaxValue) { continue; } } if (x < 0 || y < 0 || x >= map.Width || y >= map.Height) { continue; } LandTile lt = map.Tiles.GetLandTile(x, y); int ltLowZ = 0, ltAvgZ = 0, ltTopZ = 0; map.GetAverageZ(x, y, ref ltLowZ, ref ltAvgZ, ref ltTopZ); TileFlag ltFlags = TileData.LandTable[lt.ID & TileData.MaxLandValue].Flags; bool ltImpassable = ((ltFlags & TileFlag.Impassable) != 0); if (!lt.Ignored && ltAvgZ >= minZ && ltAvgZ < maxZ) { if ((ltFlags & TileFlag.Wet) != 0) { if (water) { m_SpawnBuffer1.Add(ltAvgZ); } } else if (land && !ltImpassable) { m_SpawnBuffer1.Add(ltAvgZ); } } StaticTile[] staticTiles = map.Tiles.GetStaticTiles(x, y, true); for (int j = 0; j < staticTiles.Length; j++) { StaticTile tile = staticTiles[j]; ItemData id = TileData.ItemTable[tile.ID & TileData.MaxItemValue]; int tileZ = tile.Z + id.CalcHeight; if (tileZ >= minZ && tileZ < maxZ) { if ((id.Flags & TileFlag.Wet) != 0) { if (water) { m_SpawnBuffer1.Add(tileZ); } } else if (land && id.Surface && !id.Impassable) { m_SpawnBuffer1.Add(tileZ); } } } Sector sector = map.GetSector(x, y); for (int j = 0; j < sector.Items.Count; j++) { Item item = sector.Items[j]; if (!(item is BaseMulti) && item.ItemID <= TileData.MaxItemValue && item.AtWorldPoint(x, y)) { m_SpawnBuffer2.Add(item); if (!item.Movable) { ItemData id = item.ItemData; int itemZ = item.Z + id.CalcHeight; if (itemZ >= minZ && itemZ < maxZ) { if ((id.Flags & TileFlag.Wet) != 0) { if (water) { m_SpawnBuffer1.Add(itemZ); } } else if (land && id.Surface && !id.Impassable) { m_SpawnBuffer1.Add(itemZ); } } } } } if (m_SpawnBuffer1.Count == 0) { m_SpawnBuffer1.Clear(); m_SpawnBuffer2.Clear(); continue; } int z; switch (m_SpawnZLevel) { case SpawnZLevel.Lowest: { z = int.MaxValue; for (int j = 0; j < m_SpawnBuffer1.Count; j++) { int l = m_SpawnBuffer1[j]; if (l < z) { z = l; } } break; } case SpawnZLevel.Highest: { z = int.MinValue; for (int j = 0; j < m_SpawnBuffer1.Count; j++) { int l = m_SpawnBuffer1[j]; if (l > z) { z = l; } } break; } default: // SpawnZLevel.Random { int index = Utility.Random(m_SpawnBuffer1.Count); z = m_SpawnBuffer1[index]; break; } } m_SpawnBuffer1.Clear(); if (!Find(new Point3D(x, y, z), map).AcceptsSpawnsFrom(this)) { m_SpawnBuffer2.Clear(); continue; } int top = z + spawnHeight; bool ok = true; for (int j = 0; j < m_SpawnBuffer2.Count; j++) { Item item = m_SpawnBuffer2[j]; ItemData id = item.ItemData; if ((id.Surface || id.Impassable) && item.Z + id.CalcHeight > z && item.Z < top) { ok = false; break; } } m_SpawnBuffer2.Clear(); if (!ok) { continue; } if (ltImpassable && ltAvgZ > z && ltLowZ < top) { continue; } for (int j = 0; j < staticTiles.Length; j++) { StaticTile tile = staticTiles[j]; ItemData id = TileData.ItemTable[tile.ID & TileData.MaxItemValue]; if ((id.Surface || id.Impassable) && tile.Z + id.CalcHeight > z && tile.Z < top) { ok = false; break; } } if (!ok) { continue; } for (int j = 0; j < sector.Mobiles.Count; j++) { Mobile m = sector.Mobiles[j]; if (m.X == x && m.Y == y && (m.IsPlayer() || !m.Hidden)) { if (m.Z + 16 > z && m.Z < top) { ok = false; break; } } } if (ok) { return(new Point3D(x, y, z)); } } return(Point3D.Zero); }