public override void OnClick() { if (i_Cont.IsChildOf(m_From.Backpack) || i_Cont.IsChildOf(m_From.BankBox)) { m_From.SendMessage("What do you want to rename this to?"); m_From.SendMessage("(Esc to cancel)"); m_From.Prompt = new ContainerRenamePrompt(m_From, i_Cont); } else { m_From.SendMessage("That must be in your pack or bank box for you to rename it."); } }
public override void OnResponse(Mobile from, string text) { text = text.Trim(); if (text.Length > 40) { text = text.Substring(0, 40); } if (!i_Cont.IsChildOf(from.Backpack) && !i_Cont.IsChildOf(from.BankBox)) { from.SendMessage("That must be in your pack or bank box for you to rename it."); } else if (text.Length > 0) { i_Cont.Name = text; from.SendMessage("You rename the container to '{0}'.", text); } }
public override void OnClick() { if (m_From.CheckAlive() && m_Container.IsChildOf(m_From)) { m_From.Prompt = new ReagentStackPrompt(m_Container); m_From.SendMessage("How many reagents from each stack would you like to move?"); //m_From.Target = new MoveReagentsTarget( m_Container ); //m_From.SendMessage( "What reagents or container of reagents would you like to move?" ); } }
protected override void OnTarget(Mobile from, object target) // Override the protected OnTarget() for our feature { // Check targetted thing is a container if (target is BaseContainer) { // Is a container, so cast BaseContainer bc = (BaseContainer)target; // Check player crafted if (bc.PlayerCrafted == false) { from.SendMessage("This tool can only be used on crafted containers."); return; } // Make sure it's in backpack too if (!bc.IsChildOf(from.Backpack)) { from.SendMessage("The container you wish to engrave must be in your backpack."); return; } if (bc.Name != null) { // Already engraved from.SendMessage("This piece has already been engraved."); return; } from.SendMessage("Please enter the words you wish to engrave :"); from.Prompt = new RenamePrompt(from, bc, m_Graver); } else { // Not a container from.SendMessage("This tool can only be used on a container."); } }
protected override void OnTarget(Mobile from, object target) { PlayerMobile player = from as PlayerMobile; if (player == null) { return; } if (player.Deleted || !player.Alive) { return; } BaseContainer container = target as BaseContainer; if (container == null) { player.SendMessage("That is not a container."); return; } if (container is BaseAddonContainer || container == player.Backpack) { player.SendMessage("That cannot be renamed."); return; } bool validRename = false; //In Player's Backpack or Bank if (container.IsChildOf(player.Backpack) || container.IsChildOf(player.BankBox)) { validRename = true; } if (!validRename && (Utility.GetDistance(player.Location, container.Location) > 2)) { player.SendMessage("That container is too far away."); return; } if (!validRename && !player.Map.InLOS(player.Location, container.Location)) { player.SendMessage("That container is not within in your line of sight."); return; } //In Valid House if (container.IsLockedDown || container.IsSecure) { BaseHouse house = BaseHouse.FindHouseAt(container.Location, from.Map, 64); if (house == null) { return; } if (house.Owner != player) { from.SendMessage("Only the owner of this house may renamed a locked down or secure container within it."); return; } validRename = true; } if (!validRename) { player.SendMessage("You may only renamed containers in your pack, bank, or locked down in a house you own."); return; } player.SendMessage("Please enter a description for this container."); player.Prompt = new RenamePrompt(m_ContainerRenameDeed, container); }
public override void OnResponse(Mobile from, string text) { PlayerMobile player = from as PlayerMobile; if (player == null) { return; } if (player.Deleted || !player.Alive) { return; } if (m_RenameDeed == null) { return; } if (m_RenameDeed.Deleted) { return; } if (m_Container == null) { return; } if (m_Container.Deleted) { return; } bool validRename = false; //In Player's Backpack or Bank if (m_Container.IsChildOf(player.Backpack) || m_Container.IsChildOf(player.BankBox)) { validRename = true; } if (!validRename && (Utility.GetDistance(player.Location, m_Container.Location) > 2)) { player.SendMessage("That container is too far away."); return; } if (!validRename && !player.Map.InLOS(player.Location, m_Container.Location)) { player.SendMessage("That container is not within in your line of sight."); return; } //In Valid House if (m_Container.IsLockedDown || m_Container.IsSecure) { BaseHouse house = BaseHouse.FindHouseAt(m_Container.Location, from.Map, 64); if (house == null) { return; } if (house.Owner != player) { from.SendMessage("Only the owner of this house may renamed a locked down or secure container within it."); return; } validRename = true; } if (!validRename) { player.SendMessage("You may only renamed containers in your pack, bank, or locked down in a house you own."); return; } m_Container.Name = text; player.SendMessage("The name on the container has been changed."); m_RenameDeed.Charges--; if (m_RenameDeed.Charges <= 0) { player.SendMessage("You use the last charge on the deed."); m_RenameDeed.Delete(); } }