@Override
  public void execute(WorldObject performer, WorldObject target, int[] args, World world) {
    int x = (Integer) target.getProperty(Constants.X);
    int y = (Integer) target.getProperty(Constants.Y);

    int workbenchId = BuildingGenerator.generateWorkbench(x, y, world, performer);
    SkillUtils.useSkill(
        performer, Constants.CARPENTRY_SKILL, world.getWorldStateChangedListeners());

    performer.getProperty(Constants.INVENTORY).removeQuantity(Constants.STONE, REQUIRED_STONE);
    performer.getProperty(Constants.BUILDINGS).add(workbenchId, BuildingType.WORKBENCH);
  }
Beispiel #2
0
 public void addToInventory(
     WorldObject performer,
     WorldObject target,
     SkillProperty skillProperty,
     IntProperty qualityProperty,
     World world) {
   double skillBonus =
       SkillUtils.useSkill(performer, skillProperty, world.getWorldStateChangedListeners());
   int quantity = target.getProperty(qualityProperty);
   WorldObjectContainer inventory = performer.getProperty(Constants.INVENTORY);
   inventory.addQuantity(generate(skillBonus), quantity);
 }
  @Override
  public void execute(WorldObject performer, WorldObject target, int[] args, World world) {
    WorldObjectContainer inventory = performer.getProperty(Constants.INVENTORY);

    double skillBonus =
        SkillUtils.useSkill(
            performer, Constants.ALCHEMY_SKILL, world.getWorldStateChangedListeners());
    int quantity = target.getProperty(Constants.APOTHECARY_QUALITY);
    inventory.addQuantity(Item.POISON.generate(skillBonus), quantity);

    inventory.removeQuantity(Constants.NIGHT_SHADE, NIGHT_SHADE_REQUIRED);
  }
  @Override
  public void execute(WorldObject performer, WorldObject target, int[] args, World world) {
    WorldObjectContainer inventory = performer.getProperty(Constants.INVENTORY);

    double skillBonus =
        SkillUtils.useSkill(
            performer, Constants.SMITHING_SKILL, world.getWorldStateChangedListeners());
    int quantity = SmithPropertyUtils.calculateSmithingQuantity(performer, target);
    inventory.addQuantity(Item.IRON_HELMET.generate(skillBonus), quantity);

    inventory.removeQuantity(Constants.WOOD, WOOD_REQUIRED);
    inventory.removeQuantity(Constants.ORE, ORE_REQUIRED);
  }