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(Server.Network.NetState sender, RelayInfo info) { if (m_Selection == null) { int v = info.ButtonID - 1; if (v >= 0 && v < m_List.Count) { m_From.SendGump(new ViewHousesGump(m_From, m_List, m_List[v])); } } else if (!m_Selection.Deleted) { switch (info.ButtonID) { case 0: { m_From.SendGump(new ViewHousesGump(m_From, m_List, null)); break; } case 1: { Map map = m_Selection.Map; if (map != null && map != Map.Internal) { m_From.MoveToWorld(m_Selection.BanLocation, map); } m_From.SendGump(new ViewHousesGump(m_From, m_List, m_Selection)); break; } case 2: { m_From.SendGump(new ViewHousesGump(m_From, m_List, m_Selection)); HouseSign sign = m_Selection.Sign; if (sign != null && !sign.Deleted) { sign.OnDoubleClick(m_From); } break; } case 3: { m_From.SendGump(new ViewHousesGump(m_From, m_List, m_Selection)); // m_From.SendGump( new HouseDemolishGump( m_From, m_Selection ) ); break; } case 4: { m_Selection.RefreshDecay(); m_From.SendGump(new ViewHousesGump(m_From, m_List, m_Selection)); break; } } } }
public override void OnResponse(Server.Network.NetState sender, RelayInfo info) { if (m_Selection == null) { int v = info.ButtonID - 1; if (v >= 0 && v < m_List.Count) { m_From.SendGump(new MyHousesGump(m_From, m_List, m_List[v])); } } else if (!m_Selection.Deleted) { switch (info.ButtonID) { case 0: { m_From.SendGump(new MyHousesGump(m_From, m_List, null)); break; } case 1: { Map map = m_Selection.Map; if (m_From.Region is Regions.Jail) { m_From.SendMessage("You cannot escape jail so easily foolish one."); m_From.SendGump(new MyHousesGump(m_From, m_List, m_Selection)); return; } if (Server.Spells.SpellHelper.CheckCombat(m_From) || m_From.Combatant != null) { m_From.SendMessage("Wouldst thou flee during the heat of battle?"); m_From.SendGump(new MyHousesGump(m_From, m_List, m_Selection)); return; } if (Server.Factions.Sigil.ExistsOn(m_From)) { m_From.SendMessage("You cannot use this function while carrying a sigil."); m_From.SendGump(new MyHousesGump(m_From, m_List, m_Selection)); return; } if (m_From.Criminal) { m_From.SendMessage("A criminal may not escape so easily."); m_From.SendGump(new MyHousesGump(m_From, m_List, m_Selection)); return; } BaseCreature.TeleportPets(m_From, m_Selection.BanLocation, map, true); m_From.MoveToWorld(m_Selection.BanLocation, map); m_From.SendGump(new MyHousesGump(m_From, m_List, m_Selection)); break; } case 2: { m_From.SendGump(new MyHousesGump(m_From, m_List, m_Selection)); HouseSign sign = m_Selection.Sign; if (sign != null && !sign.Deleted) { sign.OnDoubleClick(m_From); } break; } case 3: { m_From.SendGump(new MyHousesGump(m_From, m_List, m_Selection)); m_From.SendGump(new HouseDemolishGump(m_From, m_Selection)); break; } case 4: { m_Selection.RefreshDecay(); m_From.SendGump(new MyHousesGump(m_From, m_List, m_Selection)); break; } } } }
public void Mark(Mobile m) { m_Marked = true; bool setDesc = false; if (Core.AOS) { m_House = BaseHouse.FindHouseAt(m); if (m_House == null) { m_Target = m.Location; m_TargetMap = m.Map; } else { HouseSign sign = m_House.Sign; if (sign != null) { m_Description = sign.Name; } else { m_Description = null; } if (m_Description == null || (m_Description = m_Description.Trim()).Length == 0) { m_Description = "an unnamed house"; } setDesc = true; int x = m_House.BanLocation.X; int y = m_House.BanLocation.Y + 2; int z = m_House.BanLocation.Z; Map map = m_House.Map; if (map != null && !map.CanFit(x, y, z, 16, false, false)) { z = map.GetAverageZ(x, y); } m_Target = new Point3D(x, y, z); m_TargetMap = map; } } else { m_House = null; m_Target = m.Location; m_TargetMap = m.Map; } if (!setDesc) { m_Description = BaseRegion.GetRuneNameFor(Region.Find(m_Target, m_TargetMap)); } CalculateHue(); InvalidateProperties(); }
public void OnTarget(Mobile from, object target) { object root = this.RootParent; if (root != from && root != null) { return; } bool used = false; if (target == this) { Container parent = this.Parent as Container; if (parent == null) { return; } ArrayList list = new ArrayList(this.Items); for (int i = 0; i < list.Count; i++) { if (!parent.TryDropItem(from, (Item)list[i], false)) { ((Item)list[i]).MoveToWorld(from.Location, from.Map); } } UpdateItemID(); //TotalItems = TotalWeight = 0; used = true; } else if (target is HouseSign) { HouseSign sign = (HouseSign)target; if (sign.Owner != null) { foreach (Key k in this.Items) { if (k.KeyValue == sign.Owner.KeyValue) { used = true; if (from.InRange(sign, k.MaxRange)) { from.Prompt = new Prompts.HouseRenamePrompt(sign.Owner); from.SendLocalizedMessage(1060767); // Enter the new name of your house. } else { from.LocalOverheadMessage(Network.MessageType.Label, 0x3b2, true, "That is too far away."); } break; } } } } else if (target is ILockable && target is Item) { ILockable able = (ILockable)target; foreach (Key k in this.Items) { if (k.KeyValue == able.KeyValue) { new Key.UnlockTarget(k).Invoke(from, able); used = true; break; } } } if (!used) { from.SendAsciiMessage("None of these keys seem to unlock that."); } }
public AgelessHouseTimer(HouseSign h) : base(TimeSpan.FromDays(60)) { sign = h; Priority = TimerPriority.OneSecond; }
protected override void OnTarget(Mobile from, object targeted) { int number = -1; if (targeted == m_Key) { number = 501665; // Enter a description for this key. from.Prompt = new RenamePrompt(m_Key); } else if (targeted is StrongBox) { StrongBox sb = (StrongBox)targeted; if (sb.Owner == null || sb.Owner.Deleted) { from.SendAsciiMessage("You can not recover that strong box."); return; } if (sb.Owner == from || sb.Owner.Account == from.Account) { while (sb.Items.Count > 0) { ((Item)sb.Items[0]).MoveToWorld(sb.Location, sb.Map); } sb.Delete(); from.AddToBackpack(new StrongBoxDeed()); } else { from.SendAsciiMessage("You do not own that strong box."); } } else if (targeted is ILockable) { ILockable o = (ILockable)targeted; if (o.KeyValue == m_Key.KeyValue) { if (o is BaseDoor && !((BaseDoor)o).UseLocks()) { number = 501668; // This key doesn't seem to unlock that. } else { o.Locked = !o.Locked; if (targeted is Item) { Item item = (Item)targeted; if (o.Locked) { item.SendLocalizedMessageTo(from, 1048000); } else { item.SendLocalizedMessageTo(from, 1048001); } } } } else { number = 501668; // This key doesn't seem to unlock that. } } else if (targeted is HouseSign) { HouseSign sign = (HouseSign)targeted; if (sign.Owner != null && sign.Owner.KeyValue == m_Key.KeyValue) { from.Prompt = new Prompts.HouseRenamePrompt(sign.Owner); number = 1060767; // Enter the new name of your house. } } else { number = 501666; // You can't unlock that! } if (number != -1) { from.SendLocalizedMessage(number); } }
public static object Format(object o) { if (o is Mobile) { Mobile m = (Mobile)o; if (m.Account == null) { return(String.Format("{0} (no account) at {1} ({1})", m, m.Location, m.Map)); } else { return(String.Format("{0} ('{1}') at {2} ({3})", m, m.Account.Username, m.Location, m.Map)); } } else if (o is BaseHouse) { BaseHouse house = (BaseHouse)o; if (house.Owner != null) { Mobile m = house.Owner; if (m.Account == null) { return(String.Format("0x{0:X} ({1}) owned by {2} (no account) at {3} ({4})", house.Serial.Value, house.GetType().Name, m.Name, house.Location, house.Map)); } else { return(String.Format("0x{0:X} ({1}) owned by {2} ('{3}') at {4} ({5})", house.Serial.Value, house.GetType().Name, m.Name, m.Account.Username, house.Location, house.Map)); } } else { return(String.Format("0x{0:X} ({1}) at {2} ({3})", house.Serial.Value, house.GetType().Name, house.Location, house.Map)); } } else if (o is HouseSign) { HouseSign item = (HouseSign)o; if (item.Owner != null) { BaseHouse house = item.Owner; if (house.Owner != null) { Mobile m = house.Owner; if (m.Account == null) { return(String.Format("0x{0:X} (HouseSign) -> ({1}) owned by {2} (no account) at {3} ({4})", item.Serial.Value, house.GetType().Name, m.Name, item.Location, item.Map)); } else { return(String.Format("0x{0:X} (HouseSign) -> ({1}) owned by {2} ('{3}') at {4} ({5})", item.Serial.Value, house.GetType().Name, m.Name, m.Account.Username, item.Location, item.Map)); } } else { return(String.Format("0x{0:X} (HouseSign) -> ({1}) at {2} ({3})", item.Serial.Value, house.GetType().Name, item.Location, item.Map)); } } else { return(String.Format("0x{0:X} (null) at {1} ({2})", item.Serial.Value, item.Location, item.Map)); } } else if (o is Item) { Item item = (Item)o; Mobile m = item.RootParent as Mobile; if (m != null) { if (m.Account == null) { return(String.Format("0x{0:X} ({1}) owned by {2} (no account) at {3} ({4})", item.Serial.Value, item.GetType().Name, m.Name, item.GetWorldLocation(), item.Map)); } else { return(String.Format("0x{0:X} ({1}) owned by {2} ('{3}') at {4} ({5})", item.Serial.Value, item.GetType().Name, m.Name, m.Account.Username, item.GetWorldLocation(), item.Map)); } } else { return(String.Format("0x{0:X} ({1}) at {2} ({3})", item.Serial.Value, item.GetType().Name, item.GetWorldLocation(), item.Map)); } } return(o); }
protected override void OnTarget(Mobile from, object targ) { int converted = 0; int deleted = 0; if (targ is HouseSign) { HouseSign sign = (HouseSign)targ; if (sign.Structure != null) { if (sign.Structure is BaseHouse) { // don't let staff convert original custom houses to static .. force them to make a copy first if (sign.Structure is HouseFoundation == true && sign.Structure is StaticHouse == false) { from.SendMessage(0x22, "Please make a COPY of this house before converting it to static."); from.SendMessage(0x22, "[housegen"); } else { //ok, we got what we want :) BaseHouse house = sign.Structure as BaseHouse; //get a copy of the location Point3D location = new Point3D(house.Location.X, house.Location.Y, house.Location.Z); // make a copy of the doors - see comments below // ArrayList Doors = new ArrayList(house.Doors); //Now we need to iterate through the components and place their static equivalent while skipping doors and other fixtures for (int i = 0; i < house.Components.List.Length; i++) { string sz = location.X + house.Components.List[i].GetType().ToString(); if (!IsFixture(house.Components.List[i].m_ItemID)) { Point3D itemloc = new Point3D( location.X + house.Components.List[i].m_OffsetX, location.Y + house.Components.List[i].m_OffsetY, location.Z + house.Components.List[i].m_OffsetZ ); Static item = new Static((int)(house.Components.List[i].m_ItemID & 0x3FFF)); item.MoveToWorld(itemloc, from.Map); converted++; } else { deleted++; } } // not adding the doors back because we want players to have to purchase them /*foreach (BaseDoor bd in Doors) * { * if (bd == null) * continue; * * BaseDoor replacement = GetFixtureItem(bd.ItemID) as BaseDoor; * if (replacement != null && replacement.Deleted == false) * { * Point3D itemloc = new Point3D( * location.X + bd.Offset.X, * location.Y + bd.Offset.Y, * location.Z + bd.Offset.Z * ); * * replacement.MoveToWorld(itemloc, from.Map); * } * }*/ //delete the house house.Delete(); } } } else { from.SendMessage(0x22, "That house sign does not point to a house"); } } else if (targ is AddonComponent) { //ok, we got what we want :) AddonComponent addon = targ as AddonComponent; // use the players location as the addon's location is whacky Point3D location = new Point3D(from.Location.X, from.Location.Y, from.Location.Z); from.SendMessage("Using your location for the static location."); //Now we need to iterate through the components and place their static equivalent while skipping doors and other fixtures foreach (Item item in addon.Addon.Components) { if (item == null || item is AddonComponent == false) { continue; } AddonComponent ac = item as AddonComponent; if (!IsFixture((short)ac.ItemID)) { Point3D itemloc = new Point3D( location.X + ac.Offset.X, location.Y + ac.Offset.Y, location.Z + ac.Offset.Z ); Static sitem = new Static((int)(ac.ItemID & 0x3FFF)); sitem.MoveToWorld(itemloc, from.Map); converted++; } else { deleted++; } } //delete the addon addon.Delete(); } else { from.SendMessage(0x22, "That is neither a house sign nor an addon"); } from.SendMessage("Conversion complete with {0} tiles converted and {1} deleted.", converted, deleted); }