public void applyInventory(final BattlePlayer p) { Inventory i = p.getInventory(); ItemStack HEALTH_POTION = new ItemStack(Material.POTION, 1, (short) 16373); ItemStack IRON_SWORD = new ItemStack(Material.IRON_SWORD, 1); ItemStack BOW = new ItemStack(Material.BOW, 1); ItemStack IRON_PICKAXE = new ItemStack(Material.IRON_PICKAXE, 1); ItemStack STONE_AXE = new ItemStack(Material.STONE_AXE, 1); ItemStack LEATHER_CHESTPLATE = new ItemStack(Material.LEATHER_CHESTPLATE, 1); ItemStack LEATHER_BOOTS = new ItemStack(Material.LEATHER_BOOTS, 1); ItemStack LEATHER_HELMET = new ItemStack(Material.LEATHER_HELMET, 1); ItemStack LEATHER_PANTS = new ItemStack(Material.LEATHER_LEGGINGS, 1); ItemStack COOKED_PORKCHOP = new ItemStack(Material.COOKED_BEEF, 4); ItemStack BIRCH_LOG = new ItemStack(Material.LOG, 64); ItemStack ARROW = new ItemStack(Material.ARROW, 64); InvUtils.colourArmourAccordingToTeam( p, new ItemStack[] {LEATHER_HELMET, LEATHER_CHESTPLATE, LEATHER_BOOTS, LEATHER_PANTS}); p.getInventory().setBoots(LEATHER_BOOTS); p.getInventory().setLeggings(LEATHER_PANTS); p.getInventory().setChestplate(LEATHER_CHESTPLATE); p.getInventory().setHelmet(LEATHER_HELMET); i.setItem(0, IRON_SWORD); i.setItem(1, BOW); i.setItem(5, HEALTH_POTION); i.setItem(2, IRON_PICKAXE); i.setItem(3, STONE_AXE); i.setItem(5, COOKED_PORKCHOP); i.setItem(6, BIRCH_LOG); i.setItem(11, ARROW); }
public static int addLootToInv(int x, int y) { int i = 1; String temp; temp = lootLayer[x][y][MadSand.curxwpos][MadSand.curywpos]; String[] block = temp.split(":"); String[] attr = {}; while (i < block.length) { attr = block[i].split("/"); InvUtils.putItem(Integer.parseInt(attr[0]), Integer.parseInt(attr[1])); i++; } return Integer.parseInt(attr[0]); }
public static boolean ifExist(String sequence) { int i = 1; String temp; temp = sequence; String[] block = temp.split(":"); String[] attr = {}; int id = 0; int q = 0; while (i < block.length) { attr = block[i].split("/"); id = Integer.parseInt(attr[0]); q = Integer.parseInt(attr[1]); if (InvUtils.getSameCell(id, q) == -1) { return false; } i++; } return true; }
public static boolean interact(int x, int y, String direction) { boolean ret = false; if (isCollision(x, y, direction)) { MadSand.turn++; MadSand.exp += 3; if (getBlock(x, y, direction) == 5) { QuestUtils.invokeQuest(0); } if (getBlock(x, y, direction) == 2) { Random random = new Random(); if (MadSand.hand == 3) { MadSand.print("You hit a tree with the axe"); InvUtils.putItem(1, random.nextInt(3) + 1); } else { MadSand.print("You got some sticks from tree"); InvUtils.putItem(8, random.nextInt(4) + 1); } dmgObj(x, y, direction); } if (getBlock(x, y, direction) == 3) { MadSand.print("Cake is a lie... or not"); InvUtils.putItem(4, 1); delObject(MadSand.x, MadSand.y, MadSand.look); } if (getBlock(x, y, direction) == 1) { Random random = new Random(); MadSand.print("You tried to pick up a small rock"); if (random.nextInt(2) == 1) { int picked = random.nextInt(3) + 1; InvUtils.putItem(2, picked); MadSand.print("You picked up " + picked + " rocks"); } else { MadSand.print("You failed to pick up a rock."); } dmgObj(x, y, direction); } if (getBlock(x, y, direction) == 4) { Random random = new Random(); MadSand.print("You picked some berries from a bush"); InvUtils.putItem(7, 1); InvUtils.putItem(8, random.nextInt(2) + 1); dmgObj(x, y, direction); } } return ret; }