コード例 #1
0
ファイル: UseItem.java プロジェクト: H-a-z-e/Project-Insanity
  public static void ItemonObject(Client c, int objectID, int objectX, int objectY, int itemId) {
    if (!c.getItems().playerHasItem(itemId, 1)) return;
    switch (objectID) {
      case 15621:
        Server.getWarriorsGuild().handleArmor(c, itemId, objectX, objectY);
        break;
      case 2783:
        c.getSmithingInt().showSmithInterface(itemId);
        break;
      case 8151:
      case 8389:
        c.getFarming().checkItemOnObject(itemId);
        break;
      case 2644:
        c.getFlaxStringer().itemOnObject(itemId);
        break;

      case 409:
        if (c.getPrayer().IsABone(itemId)) c.getPrayer().bonesOnAltar(itemId);
        break;
      default:
        if (c.playerRights == 3)
          Misc.println("Player At Object id: " + objectID + " with Item id: " + itemId);
        break;
    }
  }
コード例 #2
0
 public boolean newPlayerClient(Client client1) {
   int slot = -1;
   for (int i = 1; i < Config.MAX_PLAYERS; i++) {
     if (players[i] == null || players[i].disconnected) {
       slot = i;
       break;
     }
   }
   if (slot == -1) return false;
   client1.handler = this;
   client1.playerId = slot;
   players[slot] = client1;
   players[slot].isActive = true;
   players[slot].connectedFrom =
       ((InetSocketAddress) client1.getSession().getRemoteAddress()).getAddress().getHostAddress();
   if (Config.SERVER_DEBUG)
     Misc.println(
         "Player Slot "
             + slot
             + " slot 0 "
             + players[0]
             + " Player Hit "
             + players[
                 slot]); // does nothing.... ;;players dont give the right amount of playesr? i am
   // getting the right amount why not me? logout log inand u wont get the
   // right
   return true;
 }
コード例 #3
0
ファイル: UseItem.java プロジェクト: Bryan17/updated1
 public static void ItemonObject(Client c, int objectID, int objectX, int objectY, int itemId) {
   if (!c.getItems().playerHasItem(itemId, 1)) return;
   switch (objectID) {
     case 2783:
       c.getSmithingInt().showSmithInterface(itemId);
       break;
     case 7965:
     case 8389:
       c.getFarming().checkItemOnObject(itemId);
       break;
     case 2728:
     case 12269:
       c.getCooking().itemOnObject(itemId);
       break;
     case 15621:
       if (c.absX == 2857 && c.absY == 3537 || c.absX == 2851 && c.absY == 3537) {
         c.getWarriorsGuild().handleArmor(c, itemId, objectX, objectY);
       }
       break;
     case 409:
       if (c.getPrayer().isBone(itemId)) c.getPrayer().bonesOnAltar(itemId);
       break;
     default:
       if (c.playerRights == 3)
         Misc.println("Player At Object id: " + objectID + " with Item id: " + itemId);
       break;
   }
 }
コード例 #4
0
ファイル: UseItem.java プロジェクト: H-a-z-e/Project-Insanity
 public static void ItemonNpc(Client c, int itemId, int npcId, int slot) {
   switch (itemId) {
     default:
       if (c.playerRights == 3)
         Misc.println(
             "Player used Item id: " + itemId + " with Npc id: " + npcId + " With Slot : " + slot);
       break;
   }
 }
コード例 #5
0
 public boolean newPlayerClient(Client client1) {
   int slot = -1;
   for (int i = 1; i < Config.MAX_PLAYERS; i++) {
     if ((players[i] == null) || players[i].disconnected) {
       slot = i;
       break;
     }
   }
   if (slot == -1) return false;
   client1.handler = this;
   client1.playerId = slot;
   players[slot] = client1;
   players[slot].isActive = true;
   players[slot].connectedFrom =
       ((InetSocketAddress) client1.getSession().getRemoteAddress()).getAddress().getHostAddress();
   if (Config.SERVER_DEBUG)
     Misc.println(
         "Player Slot " + slot + " slot 0 " + players[0] + " Player Hit " + players[slot]);
   return true;
 }
コード例 #6
0
ファイル: UseItem.java プロジェクト: H-a-z-e/Project-Insanity
  public static void ItemonItem(Client c, int itemUsed, int useWith) {
    if (itemUsed == 227 || useWith == 227) c.getHerblore().handlePotMaking(itemUsed, useWith);
    if (c.getItems().getItemName(itemUsed).contains("(")
        && c.getItems().getItemName(useWith).contains("("))
      c.getPotMixing().mixPotion2(itemUsed, useWith);
    if (itemUsed == 1733 || useWith == 1733) c.getCrafting().handleLeather(itemUsed, useWith);
    if (itemUsed == 1755 || useWith == 1755) c.getCrafting().handleChisel(itemUsed, useWith);
    /*if (itemUsed == 946 || useWith == 946)
    	c.getFletching().handleLog(itemUsed,useWith);
    if (itemUsed == 53 || useWith == 53 || itemUsed == 52 || useWith == 52)
    	c.getFletching().makeArrows(itemUsed, useWith);*/
    if ((itemUsed == 1540 && useWith == 11286) || (itemUsed == 11286 && useWith == 1540)) {
      if (c.playerLevel[c.playerSmithing] >= 95) {
        c.getItems().deleteItem(1540, c.getItems().getItemSlot(1540), 1);
        c.getItems().deleteItem(11286, c.getItems().getItemSlot(11286), 1);
        c.getItems().addItem(11284, 1);
        c.sendMessage("You combine the two materials to create a dragonfire shield.");
        c.getPA().addSkillXP(500 * Config.SMITHING_EXPERIENCE, c.playerSmithing);
      } else {
        c.sendMessage("You need a smithing level of 95 to create a dragonfire shield.");
      }
    }
    if (itemUsed == 9142 && useWith == 9190 || itemUsed == 9190 && useWith == 9142) {
      if (c.playerLevel[c.playerFletching] >= 58) {
        int boltsMade =
            c.getItems().getItemAmount(itemUsed) > c.getItems().getItemAmount(useWith)
                ? c.getItems().getItemAmount(useWith)
                : c.getItems().getItemAmount(itemUsed);
        c.getItems().deleteItem(useWith, c.getItems().getItemSlot(useWith), boltsMade);
        c.getItems().deleteItem(itemUsed, c.getItems().getItemSlot(itemUsed), boltsMade);
        c.getItems().addItem(9241, boltsMade);
        c.getPA().addSkillXP(boltsMade * 6 * Config.FLETCHING_EXPERIENCE, c.playerFletching);
      } else {
        c.sendMessage("You need a fletching level of 58 to fletch this item.");
      }
    }
    if (itemUsed == 9143 && useWith == 9191 || itemUsed == 9191 && useWith == 9143) {
      if (c.playerLevel[c.playerFletching] >= 63) {
        int boltsMade =
            c.getItems().getItemAmount(itemUsed) > c.getItems().getItemAmount(useWith)
                ? c.getItems().getItemAmount(useWith)
                : c.getItems().getItemAmount(itemUsed);
        c.getItems().deleteItem(useWith, c.getItems().getItemSlot(useWith), boltsMade);
        c.getItems().deleteItem(itemUsed, c.getItems().getItemSlot(itemUsed), boltsMade);
        c.getItems().addItem(9242, boltsMade);
        c.getPA().addSkillXP(boltsMade * 7 * Config.FLETCHING_EXPERIENCE, c.playerFletching);
      } else {
        c.sendMessage("You need a fletching level of 63 to fletch this item.");
      }
    }
    if (itemUsed == 9143 && useWith == 9192 || itemUsed == 9192 && useWith == 9143) {
      if (c.playerLevel[c.playerFletching] >= 65) {
        int boltsMade =
            c.getItems().getItemAmount(itemUsed) > c.getItems().getItemAmount(useWith)
                ? c.getItems().getItemAmount(useWith)
                : c.getItems().getItemAmount(itemUsed);
        c.getItems().deleteItem(useWith, c.getItems().getItemSlot(useWith), boltsMade);
        c.getItems().deleteItem(itemUsed, c.getItems().getItemSlot(itemUsed), boltsMade);
        c.getItems().addItem(9243, boltsMade);
        c.getPA().addSkillXP(boltsMade * 7 * Config.FLETCHING_EXPERIENCE, c.playerFletching);
      } else {
        c.sendMessage("You need a fletching level of 65 to fletch this item.");
      }
    }
    if (itemUsed == 9144 && useWith == 9193 || itemUsed == 9193 && useWith == 9144) {
      if (c.playerLevel[c.playerFletching] >= 71) {
        int boltsMade =
            c.getItems().getItemAmount(itemUsed) > c.getItems().getItemAmount(useWith)
                ? c.getItems().getItemAmount(useWith)
                : c.getItems().getItemAmount(itemUsed);
        c.getItems().deleteItem(useWith, c.getItems().getItemSlot(useWith), boltsMade);
        c.getItems().deleteItem(itemUsed, c.getItems().getItemSlot(itemUsed), boltsMade);
        c.getItems().addItem(9244, boltsMade);
        c.getPA().addSkillXP(boltsMade * 10 * Config.FLETCHING_EXPERIENCE, c.playerFletching);
      } else {
        c.sendMessage("You need a fletching level of 71 to fletch this item.");
      }
    }
    if (itemUsed == 9144 && useWith == 9194 || itemUsed == 9194 && useWith == 9144) {
      if (c.playerLevel[c.playerFletching] >= 58) {
        int boltsMade =
            c.getItems().getItemAmount(itemUsed) > c.getItems().getItemAmount(useWith)
                ? c.getItems().getItemAmount(useWith)
                : c.getItems().getItemAmount(itemUsed);
        c.getItems().deleteItem(useWith, c.getItems().getItemSlot(useWith), boltsMade);
        c.getItems().deleteItem(itemUsed, c.getItems().getItemSlot(itemUsed), boltsMade);
        c.getItems().addItem(9245, boltsMade);
        c.getPA().addSkillXP(boltsMade * 13 * Config.FLETCHING_EXPERIENCE, c.playerFletching);
      } else {
        c.sendMessage("You need a fletching level of 58 to fletch this item.");
      }
    }
    if (itemUsed == 1601 && useWith == 1755 || itemUsed == 1755 && useWith == 1601) {
      if (c.playerLevel[c.playerFletching] >= 63) {
        c.getItems().deleteItem(1601, c.getItems().getItemSlot(1601), 1);
        c.getItems().addItem(9192, 15);
        c.getPA().addSkillXP(8 * Config.FLETCHING_EXPERIENCE, c.playerFletching);
      } else {
        c.sendMessage("You need a fletching level of 63 to fletch this item.");
      }
    }
    if (itemUsed == 1607 && useWith == 1755 || itemUsed == 1755 && useWith == 1607) {
      if (c.playerLevel[c.playerFletching] >= 65) {
        c.getItems().deleteItem(1607, c.getItems().getItemSlot(1607), 1);
        c.getItems().addItem(9189, 15);
        c.getPA().addSkillXP(8 * Config.FLETCHING_EXPERIENCE, c.playerFletching);
      } else {
        c.sendMessage("You need a fletching level of 65 to fletch this item.");
      }
    }
    if (itemUsed == 1605 && useWith == 1755 || itemUsed == 1755 && useWith == 1605) {
      if (c.playerLevel[c.playerFletching] >= 71) {
        c.getItems().deleteItem(1605, c.getItems().getItemSlot(1605), 1);
        c.getItems().addItem(9190, 15);
        c.getPA().addSkillXP(8 * Config.FLETCHING_EXPERIENCE, c.playerFletching);
      } else {
        c.sendMessage("You need a fletching level of 71 to fletch this item.");
      }
    }
    if (itemUsed == 1603 && useWith == 1755 || itemUsed == 1755 && useWith == 1603) {
      if (c.playerLevel[c.playerFletching] >= 73) {
        c.getItems().deleteItem(1603, c.getItems().getItemSlot(1603), 1);
        c.getItems().addItem(9191, 15);
        c.getPA().addSkillXP(8 * Config.FLETCHING_EXPERIENCE, c.playerFletching);
      } else {
        c.sendMessage("You need a fletching level of 73 to fletch this item.");
      }
    }
    if (itemUsed == 1615 && useWith == 1755 || itemUsed == 1755 && useWith == 1615) {
      if (c.playerLevel[c.playerFletching] >= 73) {
        c.getItems().deleteItem(1615, c.getItems().getItemSlot(1615), 1);
        c.getItems().addItem(9193, 15);
        c.getPA().addSkillXP(8 * Config.FLETCHING_EXPERIENCE, c.playerFletching);
      } else {
        c.sendMessage("You need a fletching level of 73 to fletch this item.");
      }
    }
    if (itemUsed >= 11710 && itemUsed <= 11714 && useWith >= 11710 && useWith <= 11714) {
      if (c.getItems().hasAllShards()) {
        c.getItems().makeBlade();
      }
    }
    if (itemUsed == 2368 && useWith == 2366 || itemUsed == 2366 && useWith == 2368) {
      c.getItems().deleteItem(2368, c.getItems().getItemSlot(2368), 1);
      c.getItems().deleteItem(2366, c.getItems().getItemSlot(2366), 1);
      c.getItems().addItem(1187, 1);
    }

    if (c.getItems().isHilt(itemUsed) || c.getItems().isHilt(useWith)) {
      int hilt = c.getItems().isHilt(itemUsed) ? itemUsed : useWith;
      int blade = c.getItems().isHilt(itemUsed) ? useWith : itemUsed;
      if (blade == 11690) {
        c.getItems().makeGodsword(hilt);
      }
    }

    switch (itemUsed) {
      case 1511:
      case 1521:
      case 1519:
      case 1517:
      case 1515:
      case 1513:
      case 590:
        // c.getFiremaking().checkLogType(itemUsed, useWith);
        // c.sendMessage("Firemaking is disabled.");
        break;

      default:
        if (c.playerRights == 3)
          Misc.println("Player used Item id: " + itemUsed + " with Item id: " + useWith);
        break;
    }
  }
コード例 #7
0
ファイル: ObjectHandler.java プロジェクト: MilboWca/Area59
 public boolean loadDoorConfig(String fileName) {
   String line = "";
   String token = "";
   String token2 = "";
   String token2_2 = "";
   String[] token3 = new String[10];
   boolean EndOfFile = false;
   int ReadMode = 0;
   BufferedReader objectFile = null;
   try {
     objectFile = new BufferedReader(new FileReader("./" + fileName));
   } catch (FileNotFoundException fileex) {
     Misc.println(fileName + ": file not found.");
     return false;
   }
   try {
     line = objectFile.readLine();
   } catch (IOException ioexception) {
     Misc.println(fileName + ": error loading file.");
     return false;
   }
   int door = 0;
   while (EndOfFile == false && line != null) {
     line = line.trim();
     int spot = line.indexOf("=");
     if (spot > -1) {
       token = line.substring(0, spot);
       token = token.trim();
       token2 = line.substring(spot + 1);
       token2 = token2.trim();
       token2_2 = token2.replaceAll("\t\t", "\t");
       token2_2 = token2_2.replaceAll("\t\t", "\t");
       token2_2 = token2_2.replaceAll("\t\t", "\t");
       token2_2 = token2_2.replaceAll("\t\t", "\t");
       token2_2 = token2_2.replaceAll("\t\t", "\t");
       token3 = token2_2.split("\t");
       if (token.equals("door")) {
         doors[door][0] = Integer.parseInt(token3[0]);
         doors[door][1] = Integer.parseInt(token3[1]);
         doors[door][2] = Integer.parseInt(token3[2]);
         doors[door][3] = Integer.parseInt(token3[3]);
         doors[door][4] = Integer.parseInt(token3[4]);
         door++;
       }
     } else {
       if (line.equals("[ENDOFDOORLIST]")) {
         try {
           objectFile.close();
         } catch (IOException ioexception) {
         }
         return true;
       }
     }
     try {
       line = objectFile.readLine();
     } catch (IOException ioexception1) {
       EndOfFile = true;
     }
   }
   try {
     objectFile.close();
   } catch (IOException ioexception) {
   }
   return false;
 }