예제 #1
0
        public static bool useJewellery(Player p, int item, int slot, bool wearingItem)
        {
            if (item == 1704 || item == 10362)           // Blank amulets
            {
                p.getPackets().sendMessage("This amulet has no charges remaining.");
                return(true);
            }
            if (p.getTemporaryAttribute("unmovable") != null || p.getTemporaryAttribute("cantDoAnything") != null)
            {
                return(true);
            }
            int index = getItemIndex(item);

            if (index == -1)
            {
                return(false);
            }
            string s = index == 2 ? "ring" : "amulet";

            p.getPackets().sendMessage("You rub the " + s + "...");
            p.getPackets().closeInterfaces();
            int interfaceId = index == 2 ? 230 : 235;
            int j           = 2;

            p.getPackets().modifyText("Teleport to where?", interfaceId, 1);
            for (int i = 0; i < LOCATIONS[index].Length; i++)
            {
                p.getPackets().modifyText(LOCATIONS[index][i], interfaceId, (i + j));
            }
            if (index == 2)
            {
                p.getPackets().sendChatboxInterface2(interfaceId);
            }
            else
            {
                p.getPackets().sendChatboxInterface2(interfaceId);
            }
            JewellerySlot js = new JewelleryTeleport.JewellerySlot(index, slot, wearingItem);

            p.setTemporaryAttribute("jewelleryTeleport", js);
            return(true);
        }
	    public static bool useJewellery(Player p, int item, int slot, bool wearingItem) {
		    if (item == 1704 || item == 10362) { // Blank amulets
			    p.getPackets().sendMessage("This amulet has no charges remaining.");
			    return true;
		    }
		    if (p.getTemporaryAttribute("unmovable") != null || p.getTemporaryAttribute("cantDoAnything") != null) {
			    return true;
		    }
		    int index = getItemIndex(item);
		    if (index == -1) {
			    return false;
		    }
		    string s = index == 2 ? "ring" : "amulet";
		    p.getPackets().sendMessage("You rub the " + s + "...");
		    p.getPackets().closeInterfaces();
		    int interfaceId = index == 2 ? 230 : 235; 
		    int j = 2;
		    p.getPackets().modifyText("Teleport to where?", interfaceId, 1);
		    for (int i = 0; i < LOCATIONS[index].Length; i++) {
			    p.getPackets().modifyText(LOCATIONS[index][i], interfaceId, (i + j));
		    }
		    if (index == 2) {
			    p.getPackets().sendChatboxInterface2(interfaceId);
		    } else {
			    p.getPackets().sendChatboxInterface2(interfaceId);
		    }
		    JewellerySlot js = new JewelleryTeleport.JewellerySlot(index, slot, wearingItem);
		    p.setTemporaryAttribute("jewelleryTeleport", js);
		    return true;
	    }