コード例 #1
0
ファイル: ElementalWorkshop.java プロジェクト: Ventuz/vscape
 public static boolean doObjectClicking(Player player, int object, int x, int y) {
   switch (object) {
     case 3389: // elemental workshop bookshelf
       if (x == 2716 && y == 3481 && !player.getInventory().ownsItem(2886)) {
         if (player.getQuestStage(12) < 1) {
           player.setQuestStage(12, 1);
           QuestHandler.getQuests()[12].startQuest(player);
         }
         player.getDialogue().sendStatement("You find an old, beaten book.");
         player.getInventory().addItem(new Item(2886));
         return true;
       }
       break;
     case 3390:
     case 3391: // elemental workshop wall
       if (player.getInventory().playerHasItem(2887)) {
         player.fadeTeleport(new Position(2716, 9888));
         if (player.getQuestStage(12) == 2) player.setQuestStage(12, 3);
         return true;
       }
       break;
     case 3397: // elemental workshop boxes
       if (player.getQuestStage(12) == 5 && !player.getInventory().playerHasItem(1741)) {
         player
             .getDialogue()
             .sendStatement("You find some leather after rummaging through the boxes.");
         player.getInventory().addItem(new Item(1741));
         return true;
       }
       break;
     case 3409: // elemental workshop bellows lever
       if (player.getQuestStage(12) == 6) {
         player
             .getDialogue()
             .sendStatement("You hear the whoosh of air as the bellows come to life.");
         // player.getActionSender().animateObject(2734, 9882, 0, 469);
         player.setQuestStage(12, 7);
         return true;
       }
       break;
     case 3398: // elemental workshop crate for stone bowl
       if (player.getQuestStage(12) == 7 && !player.getInventory().playerHasItem(2888)) {
         player.getDialogue().sendStatement("You find an empty stone bowl.");
         player.getInventory().addItem(new Item(2888));
         player.setQuestStage(12, 8);
         return true;
       }
       break;
     case 3410: // elemental workshop bellows
       if (player.getQuestStage(12) == 5) {
         if (player.getSkill().getLevel()[Skill.CRAFTING] < 20) {
           player
               .getDialogue()
               .sendStatement("You need a Crafting level of 20 to fix the bellows.");
           return true;
         } else if (player.getInventory().playerHasItem(1733)
             && player.getInventory().playerHasItem(1734)
             && player.getInventory().playerHasItem(1741)) {
           player.getInventory().removeItem(new Item(1734));
           player.getInventory().removeItem(new Item(1741));
           player
               .getDialogue()
               .sendStatement(
                   "You patch up the bellows.", "You should be able to pull the lever now.");
           player.setQuestStage(12, 6);
           return true;
         } else {
           player
               .getDialogue()
               .sendStatement(
                   "The hole looks rather large.",
                   "You will need needle, thread, and a piece of regular leather.");
           return true;
         }
       }
       break;
     case 3404:
     case 3405: // elemental workshop water valve
       if (x == 2726 && y == 9908 && player.getQuestStage(12) == 3) {
         player.getDialogue().sendStatement("You turned the valve on. You hear water flowing.");
         return true;
       } else if (x == 2713 && y == 9908 && player.getQuestStage(12) == 3) {
         player
             .getDialogue()
             .sendStatement("You turned the valve on. You hear lots of water flowing.");
         player.setQuestStage(12, 4);
         return true;
       }
       break;
     case 3406: // elemental workshop water wheel
       if (player.getQuestStage(12) == 4) {
         player.getDialogue().sendStatement("You hear a lurch and a squeel as the wheel turns.");
         player.getActionSender().animateObject(2719, 9907, 0, 472);
         player.setQuestStage(12, 5);
         return true;
       } else {
         player.getDialogue().sendStatement("The lever won't budge without flowing water.");
         return true;
       }
   }
   return false;
 }
コード例 #2
0
ファイル: Server.java プロジェクト: Ventuz/vscape
  @Override
  public void run() {
    try {
      Thread.currentThread().setName("ServerEngine");
      System.setOut(new Misc.TimestampLogger(System.out));
      System.setErr(new Misc.TimestampLogger(System.err, "./data/err.log"));

      address = new InetSocketAddress(host, port);
      System.out.println("Starting " + Constants.SERVER_NAME + " on " + address + "...");

      // load shutdown hook
      Thread shutdownhook = new ShutDownHook();
      Runtime.getRuntime().addShutdownHook(shutdownhook);

      PacketManager.loadPackets();

      Cache.load();

      // load scripts
      Misc.loadScripts(new File("./data/ruby/"));

      GlobalVariables.patchNotes = Misc.loadPatchNotes();
      GlobalVariables.info = Misc.loadInfo();
      GlobalVariables.npcDump = Misc.getNpcDump();
      GlobalVariables.itemDump = Misc.getItemDump();

      // load all xstream related files.
      XStreamUtil.loadAllFiles();

      // item weights
      ItemDefinition.loadWeight();

      // interfaces
      RSInterface.load();

      // Load plugins
      PluginManager.loadPlugins();

      // Load regions
      ObjectDef.loadConfig();
      Region.load();
      Rangable.load();

      // Load objects
      ObjectLoader objectLoader = new ObjectLoader();
      objectLoader.load();

      GameObjectData.init();

      // load combat manager
      CombatManager.init();

      // Load minute timer
      startMinutesCounter();

      // global drops
      GlobalGroundItem.initialize();

      // load npc ls
      Npc.loadNpcDrops();

      // mage arena timers
      AlchemistPlayground.loadAlchemistPlayGround();
      EnchantingChamber.loadEnchantingChamber();
      CreatureGraveyard.loadCreatureGraveyard();

      // spawning world fishing spots
      FishingSpots.spawnFishingSpots();

      QuestHandler.init();

      NpcLoader.loadAutoSpawn("./data/npcs/spawn-config.cfg");

      HighscoresManager.load();

      // Start up and get a'rollin!
      startup();
      System.out.println("Online!");
      while (!Thread.interrupted()) {
        try {
          cycle();
          sleep();
        } catch (Exception ex) {
          PlayerSave.saveAllPlayers();
          ex.printStackTrace();
        }
      }
      scheduler.schedule(
          new Task() {
            @Override
            protected void execute() {
              if (Thread.interrupted()) {
                PlayerSave.saveAllPlayers();
                stop();
                return;
              }
              try {
                cycle();
              } catch (Exception ex) {
                PlayerSave.saveAllPlayers();
                ex.printStackTrace();
                stop();
              }
            }
          });
    } catch (Exception ex) {
      ex.printStackTrace();
    }
    PluginManager.close();
  }
コード例 #3
0
ファイル: ElementalWorkshop.java プロジェクト: Ventuz/vscape
 public static boolean doItemOnObject(Player player, int object, int item) {
   switch (object) {
     case 3402: // elemental workshop workbench
       if (item == 2893
           && player.getQuestStage(12) >= 10
           && player.getSkill().getLevel()[Skill.SMITHING] >= 20) {
         if (player.getInventory().playerHasItem(2347)) {
           player.getInventory().removeItem(new Item(2893));
           player.getInventory().addItem(new Item(2890));
           if (player.getQuestStage(12) == 10) {
             player.setQuestStage(12, 11);
             QuestHandler.completeQuest(player, 12);
             return true;
           }
           return true;
         } else {
           player.getDialogue().sendStatement("You need a hammer to smith!");
           return true;
         }
       } else if (player.getSkill().getLevel()[Skill.SMITHING] < 20) {
         player.getDialogue().sendStatement("You need 20 smithing to smith and elemental shield.");
         return true;
       }
       break;
     case 3413: // elemental workshop furnace
       if (item == 2889 && player.getQuestStage(12) == 8) {
         player
             .getDialogue()
             .sendStatement("The furnace flares dramatically as you pour the lava in.");
         player.getInventory().replaceItemWithItem(new Item(2889), new Item(2888));
         player.setQuestStage(12, 9);
         return true;
       } else if (item == 2892 && player.getQuestStage(12) >= 9) {
         if (player.getInventory().playerHasItem(453, 4)) {
           player.getInventory().removeItem(new Item(2892));
           player.getInventory().removeItem(new Item(453, 4));
           player.getInventory().addItem(new Item(2893));
           player.getActionSender().sendMessage("You smelt the elemental ore in the furnace.");
           player.getActionSender().sendMessage("You retrieve elemental metal from the furnace.");
           player.getUpdateFlags().sendAnimation(899);
           player.getActionSender().sendSound(469, 0, 0);
           if (player.getQuestStage(12) == 9) {
             player.setQuestStage(12, 10);
           }
           return true;
         } else {
           player.getDialogue().sendStatement("You need 4 coal to smelt Elemental Ore.");
           return true;
         }
       } else if (player.getQuestStage(12) >= 7) {
         if (item == GlassMaking.BUCKET_OF_SAND) GlassMaking.makeMoltenGlass(player);
         else if (item == GemCrafting.GOLD_BAR) GemCrafting.openInterface(player);
         else if (item == SilverCrafting.SILVER_BAR) Menus.sendSkillMenu(player, "silverCrafting");
         else if (ItemManager.getInstance().getItemName(item).toLowerCase().endsWith("ore")
             && item != 668) Smelting.smeltInterface(player);
         else if (item == 668) Dialogues.startDialogue(player, 10200);
         return true;
       }
       break;
     case 3414: // elemental workshop lava trough
       if (item == 2888 && player.getQuestStage(12) == 8) {
         player.getDialogue().sendStatement("You carefully fill the bowl with lava.");
         player.getInventory().replaceItemWithItem(new Item(2888), new Item(2889));
         return true;
       }
       break;
   }
   return false;
 }