Example #1
0
  public static ArrayList<File> getFiles() {
    ArrayList<File> files = new ArrayList<File>();
    String dir = "plugins/mcMMO/Resources/";
    int x = 0;

    // XP BAR
    while (x < 255) {
      if (x < 10) {
        files.add(new File(dir + "HUD/Standard/xpbar_inc00" + x + ".png"));
      } else if (x < 100) {
        files.add(new File(dir + "HUD/Standard/xpbar_inc0" + x + ".png"));
      } else {
        files.add(new File(dir + "HUD/Standard/xpbar_inc" + x + ".png"));
      }
      x++;
    }

    // Standard XP Icons
    for (SkillType y : SkillType.values()) {
      if (y == SkillType.ALL) continue;
      files.add(new File(dir + "HUD/Standard/" + m.getCapitalized(y.toString()) + ".png"));
      files.add(new File(dir + "HUD/Retro/" + m.getCapitalized(y.toString()) + "_r.png"));
    }

    // Blank icons
    files.add(new File(dir + "HUD/Standard/Icon.png"));
    files.add(new File(dir + "HUD/Retro/Icon_r.png"));
    // Repair SFX
    files.add(new File(dir + "Sound/repair.wav"));
    // Level SFX
    files.add(new File(dir + "Sound/level.wav"));

    return files;
  }
Example #2
0
  public static void extractFiles() {
    // Setup directories
    new File("plugins/mcMMO/Resources/").mkdir();
    new File("plugins/mcMMO/Resources/HUD/").mkdir();
    new File("plugins/mcMMO/Resources/HUD/Standard/").mkdir();
    new File("plugins/mcMMO/Resources/HUD/Retro/").mkdir();
    new File("plugins/mcMMO/Resources/Sound/").mkdir();

    // Xp Bar images
    for (int x = 0; x < 255; x++) {
      // String s = File.separator;
      String theFilePath = "HUD/Standard/";
      if (x < 10) {
        String theFileName = "xpbar_inc00" + x + ".png";
        writeFile(theFileName, theFilePath);
      } else if (x < 100) {
        String theFileName = "xpbar_inc0" + x + ".png";
        writeFile(theFileName, theFilePath);
      } else {
        String theFileName = "xpbar_inc" + x + ".png";
        writeFile(theFileName, theFilePath);
      }
    }

    // Standard XP Icons

    String theFilePathA = "HUD/Standard/";
    String theFilePathB = "HUD/Retro/";

    for (SkillType y : SkillType.values()) {
      if (y == SkillType.ALL) continue;

      String theFileNameA = m.getCapitalized(y.toString()) + ".png";
      String theFileNameB = m.getCapitalized(y.toString()) + "_r.png";

      writeFile(theFileNameA, theFilePathA);
      writeFile(theFileNameB, theFilePathB);
    }

    // Blank icons

    writeFile("Icon.png", theFilePathA);
    writeFile("Icon_r.png", theFilePathB);

    String theSoundFilePath = "Sound/";
    // Repair SFX
    writeFile("repair.wav", theSoundFilePath);
    writeFile("level.wav", theSoundFilePath);
  }
Example #3
0
 @EventHandler(priority = EventPriority.MONITOR)
 public void onExperienceGain(McMMOPlayerXpGainEvent event) {
   if (experienceAddInProgress) {
     if (DEBUG)
       plugin.log.finer("Event: McMMOPlayerXpGainEvent: Skipped, as experience add in progress");
     return;
   }
   if (DEBUG) plugin.log.finer("Event: McMMOPlayerXpGainEvent: XP gain is " + event.getXpGained());
   // get the player record
   PlayerRecord player = plugin.players.getPlayer(event.getPlayer().getName());
   // if the player doesn't have a group, they have no bonuses at all...
   GroupRecord group = plugin.groups.getGroup(player.groupName);
   if (group == null) return;
   // if the player has a specialisation, that bonus is dominant
   Double bonus = null;
   SkillType eventSkill = event.getSkill();
   String specialisationName = player.getSpecialisation();
   if (specialisationName != null) {
     SkillType specialisation = group.getSpecialitySkill(specialisationName);
     if (specialisation != null)
       if (specialisation.equals(eventSkill))
         bonus = group.getSpecialitySkillFactor(specialisationName);
   }
   // if we havn't gotten a bonus yet, see if the group has one
   if (bonus == null) bonus = group.getSkillBonus(event.getSkill());
   // still nothing? Then no action to take.
   if (bonus == null) {
     plugin.log.finer("McMMOPlayerXpGainEvent: No bonus to apply");
     return;
   }
   // if we have a bonus, reward extra XP
   else {
     // account for the experience already added by this event..
     bonus = bonus - 1;
     if (DEBUG)
       plugin.log.finer(
           "McMMOPlayerXpGainEvent: Bonus in effect ("
               + bonus
               + "), adding "
               + ((int) (bonus * event.getXpGained()))
               + " extra experience ");
     experienceAddInProgress = true;
     ExperienceAPI.addMultipliedXP(
         event.getPlayer(), event.getSkill(), (int) (bonus * event.getXpGained()));
     experienceAddInProgress = false;
   }
 }
 @Override
 public Choices generateChoices(Interaction interaction)
     throws AbortInteraction, ContextDataRequired, GeneralInteractionError, PageFailure {
   Choices choices = new Choices(this, interaction);
   GroupHelper helper = new GroupHelper(interaction);
   VariablePrefixer variable = new VariablePrefixer(this, interaction);
   // list all the skills for which this group doesn't have an existing bonus
   Set<SkillType> existingBonuses = helper.record.getSkillBonuses();
   for (SkillType skill : SkillType.values()) {
     if (skill == SkillType.ALL) continue;
     if (existingBonuses.contains(skill)) continue;
     choices.addInternalChoice(WordUtils.capitalizeFully(skill.toString()), skill.toString());
   }
   // add a 'cancel' choice as well
   choices.addCancel(variable.define("cancel"));
   return choices;
 }
 @Override
 public String takeAction(Interaction interaction, String bonusName)
     throws GeneralInteractionError {
   // if a valid skill has been selected, create a default bonus based on that skill,
   // put the skill in the 'currentSkill' context, and
   // then user gets passed onto 'groupModifyBonus'
   SkillType selected = SkillType.valueOf(bonusName);
   if (selected == null)
     throw new GeneralInteractionError(
         "Unable to determine a skill type based on \"" + bonusName + "\"");
   GroupHelper helper = new GroupHelper(interaction);
   try {
     GroupAPI.addBonus(
         helper.record, selected, MMOGroup.instance.config.defaultSkillBonusMultiplier);
     interaction.context.put(Constants.SELECTED_GROUP_SKILL, bonusName);
   } catch (PluginNotEnabled error) {
   }
   return "New bonus to " + bonusName.toLowerCase() + " created for " + helper.record.getName();
 }
Example #6
0
 public static String getUrlIcon(SkillType skillType) {
   return m.getCapitalized(skillType.toString()) + ".png";
 }
Example #7
0
  public static void levelUpNotification(SkillType skillType, SpoutPlayer sPlayer) {
    PlayerProfile PP = Users.getProfile(sPlayer);

    Material mat = null;
    switch (skillType) {
      case TAMING:
        switch (getNotificationTier(PP.getSkillLevel(skillType))) {
          case 1:
            mat = Material.PORK;
            break;
          case 2:
            mat = Material.PORK;
            break;
          case 3:
            mat = Material.GRILLED_PORK;
            break;
          case 4:
            mat = Material.GRILLED_PORK;
            break;
          case 5:
            mat = Material.BONE;
            break;
        }
        break;
      case MINING:
        switch (getNotificationTier(PP.getSkillLevel(skillType))) {
          case 1:
            mat = Material.COAL_ORE;
            break;
          case 2:
            mat = Material.IRON_ORE;
            break;
          case 3:
            mat = Material.GOLD_ORE;
            break;
          case 4:
            mat = Material.LAPIS_ORE;
            break;
          case 5:
            mat = Material.DIAMOND_ORE;
            break;
        }
        break;
      case WOODCUTTING:
        switch (getNotificationTier(PP.getSkillLevel(skillType))) {
          case 1:
            mat = Material.WOOD;
            break;
          case 2:
            mat = Material.WOOD;
            break;
          case 3:
            mat = Material.WOOD;
            break;
          case 4:
            mat = Material.LOG;
            break;
          case 5:
            mat = Material.LOG;
            break;
        }
        break;
      case REPAIR:
        switch (getNotificationTier(PP.getSkillLevel(skillType))) {
          case 1:
            mat = Material.COBBLESTONE;
            break;
          case 2:
            mat = Material.IRON_BLOCK;
            break;
          case 3:
            mat = Material.GOLD_BLOCK;
            break;
          case 4:
            mat = Material.LAPIS_BLOCK;
            break;
          case 5:
            mat = Material.DIAMOND_BLOCK;
            break;
        }
        break;
      case HERBALISM:
        switch (getNotificationTier(PP.getSkillLevel(skillType))) {
          case 1:
            mat = Material.YELLOW_FLOWER;
            break;
          case 2:
            mat = Material.RED_ROSE;
            break;
          case 3:
            mat = Material.BROWN_MUSHROOM;
            break;
          case 4:
            mat = Material.RED_MUSHROOM;
            break;
          case 5:
            mat = Material.PUMPKIN;
            break;
        }
        break;
      case ACROBATICS:
        switch (getNotificationTier(PP.getSkillLevel(skillType))) {
          case 1:
            mat = Material.LEATHER_BOOTS;
            break;
          case 2:
            mat = Material.CHAINMAIL_BOOTS;
            break;
          case 3:
            mat = Material.IRON_BOOTS;
            break;
          case 4:
            mat = Material.GOLD_BOOTS;
            break;
          case 5:
            mat = Material.DIAMOND_BOOTS;
            break;
        }
        break;
      case SWORDS:
        switch (getNotificationTier(PP.getSkillLevel(skillType))) {
          case 1:
            mat = Material.WOOD_SWORD;
            break;
          case 2:
            mat = Material.STONE_SWORD;
            break;
          case 3:
            mat = Material.IRON_SWORD;
            break;
          case 4:
            mat = Material.GOLD_SWORD;
            break;
          case 5:
            mat = Material.DIAMOND_SWORD;
            break;
        }
        break;
      case ARCHERY:
        mat = Material.ARROW;
        break;
      case UNARMED:
        switch (getNotificationTier(PP.getSkillLevel(skillType))) {
          case 1:
            mat = Material.LEATHER_HELMET;
            break;
          case 2:
            mat = Material.CHAINMAIL_HELMET;
            break;
          case 3:
            mat = Material.IRON_HELMET;
            break;
          case 4:
            mat = Material.GOLD_HELMET;
            break;
          case 5:
            mat = Material.DIAMOND_HELMET;
            break;
        }
        break;
      case EXCAVATION:
        switch (getNotificationTier(PP.getSkillLevel(skillType))) {
          case 1:
            mat = Material.WOOD_SPADE;
            break;
          case 2:
            mat = Material.STONE_SPADE;
            break;
          case 3:
            mat = Material.IRON_SPADE;
            break;
          case 4:
            mat = Material.GOLD_SPADE;
            break;
          case 5:
            mat = Material.DIAMOND_SPADE;
            break;
        }
        break;
      case AXES:
        switch (getNotificationTier(PP.getSkillLevel(skillType))) {
          case 1:
            mat = Material.WOOD_AXE;
            break;
          case 2:
            mat = Material.STONE_AXE;
            break;
          case 3:
            mat = Material.IRON_AXE;
            break;
          case 4:
            mat = Material.GOLD_AXE;
            break;
          case 5:
            mat = Material.DIAMOND_AXE;
            break;
        }
        break;
      default:
        mat = Material.WATCH;
        break;
    }
    sPlayer.sendNotification(
        ChatColor.GREEN + "Level Up!",
        ChatColor.YELLOW
            + m.getCapitalized(skillType.toString())
            + ChatColor.DARK_AQUA
            + " ("
            + ChatColor.GREEN
            + PP.getSkillLevel(skillType)
            + ChatColor.DARK_AQUA
            + ")",
        mat);
    playLevelUpNoise(sPlayer);
  }