コード例 #1
0
ファイル: JewelleryTeleport.cs プロジェクト: Rut0/RSPS-CSharp
        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);
        }
コード例 #2
0
ファイル: JewelleryTeleport.cs プロジェクト: ramatronics/rsps
 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;
 }