Beispiel #1
0
 private void initGUI() {
   Label label = new GenericLabel(ChatColor.RED + script.getName());
   scriptField = new GenericTextField();
   scriptField.setMinHeight(150);
   scriptField.setMinWidth(100);
   scriptField.setTabIndex(3);
   Container c = new GenericContainer();
   c.setLayout(ContainerType.VERTICAL);
   c.addChild(label);
   c.addChild(scriptField);
   attachWidget(lib, c);
 }
Beispiel #2
0
 public void update(Player player) {
   Container container = containers.get(player);
   if (container != null) {
     int index = 0;
     Widget[] bars = container.getChildren();
     if (members.size() > 1 || alwaysshow) {
       if (hplugin.getCharacterManager().getHero(player).hasParty()) {
         for (Hero h : hplugin.getCharacterManager().getHero(player).getParty().getMembers()) {
           String name = h.getPlayer().getName();
           GenericLivingEntity bar;
           if (index >= bars.length) {
             container.addChild(bar = new GenericLivingEntity());
           } else {
             bar = (GenericLivingEntity) bars[index];
           }
           bar.setEntity(
               name,
               (hplugin
                           .getCharacterManager()
                           .getHero(this.getServer().getPlayer(name))
                           .getParty()
                           .getLeader()
                       == hplugin.getCharacterManager().getHero(this.getServer().getPlayer(name)))
                   ? ChatColor.GREEN + "@"
                   : "");
           bar.setTargets(showpet ? getPets(this.getServer().getPlayer(name)) : null);
           index++;
         }
       } else {
         String name = player.getName();
         GenericLivingEntity bar;
         if (index >= bars.length) {
           container.addChild(bar = new GenericLivingEntity());
         } else {
           bar = (GenericLivingEntity) bars[index];
         }
         bar.setEntity(name, ChatColor.GREEN + "@");
         bar.setTargets(showpet ? getPets(this.getServer().getPlayer(name)) : null);
         index++;
       }
     }
     while (index < bars.length) {
       container.removeChild(bars[index++]);
     }
     container.updateLayout();
   }
 }
Beispiel #3
0
 @EventHandler
 public void onSpoutcraftEnable1(SpoutCraftEnableEvent event) {
   SpoutPlayer player = SpoutManager.getPlayer(event.getPlayer());
   Container container = this.getContainer(player, "TOP_CENTER", 0, Features.config_ui_top);
   perPlayer bar = new perPlayer(player, config_ui_maxwidth);
   container.addChild(bar).setLayout(ContainerType.VERTICAL);
   container.setVisible(false);
   data.put(player, bar);
 }
Beispiel #4
0
  public Tree(MMOSkillTree plugin, GenericPopup popup, SpoutPlayer sPlayer, SkillSet skillSet) {
    this.plugin = plugin;
    skillTreePopup = popup;
    Player p = (Player) sPlayer;
    // System.out.println("tree skillSet:"+skillSet);
    SkillsPlayer mmoPlayer = MMOSkillTree.mmoPlayerManager.get(p);
    Set set = mmoPlayer.getSet(skillSet);

    label = new GenericLabel("You probably wish this did something, but it doesn't yet.");
    label.setAnchor(WidgetAnchor.TOP_CENTER);
    label.setWidth(168).setHeight(10).setX(-90).setY(10);
    label.setScale(0.7F);
    skillTreePopup.attachWidget(plugin, label);

    infoBox = new GenericContainer();
    infoBox.setLayout(ContainerType.VERTICAL);
    infoBox.setWidth(50).setHeight(230);
    infoBox.setAnchor(WidgetAnchor.TOP_CENTER);
    infoBox.setAlign(WidgetAnchor.TOP_CENTER);
    infoBox.setX(-150).setY(11);
    skillTreePopup.attachWidget(plugin, infoBox);
    GenericLabel infoLabel =
        new GenericLabel(
            set.string
                + " Skills\n\n"
                + "Exp:"
                + set.getCurLvlXp()
                + "/"
                + set.getNextLvlXp()
                + "\n\n"
                + "Skill Points:"
                + set.skillPoints);
    infoLabel.setScale(0.5F);
    infoLabel.setMargin(5);
    infoBox.addChild(infoLabel);

    box = new GenericContainer();
    box.setLayout(ContainerType.VERTICAL);
    box.setAnchor(WidgetAnchor.TOP_CENTER);
    box.setWidth(168)
        .setHeight(
            210); // This is taller than it should be so the top skills align right to the top, and
                  // bottom ones to the bottom, instead of having a big gap
    box.setX(-84).setY(30);
    box.setPriority(RenderPriority.High);
    box.setAuto(true);

    swordSkills = new Sword();

    for (Entry<String, TreeSkill> entry : swordSkills.map.entrySet()) {
      // String key = entry.getKey();
      TreeSkill skill = entry.getValue();
      int row = skill.getRow();
      int col = skill.getCol();
      skills[row][col] = skill;
    }
    for (int row = 0; row < numRows; row++) {
      Container rowBox = new GenericContainer();
      rowBox.setLayout(ContainerType.HORIZONTAL);
      rowBox.setWidth(300).setHeight(38);
      for (int col = 0; col < numCols; col++) {
        if (skills[row][col] == null) {
          skills[row][col] = new TreeSkill();
        }
        TreeSkill skill = skills[row][col];
        skillSlots[row][col] =
            new SkillSlot(rowBox).setName(skill.getName()).setType(skill.getType());
      }
      box.addChild(rowBox);
    }
    for (int row = 0; row < numRows; row++) {
      for (int col = 0; col < numCols; col++) {
        SkillSlot skillSlot = skillSlots[row][col];
        TreeSkill skill = skills[row][col];
        String[] children = skill.getChildren();
        for (int i = 0; i < children.length; i++) {
          TreeSkill childSkill = swordSkills.getSkill(children[i]);
          // System.out.println(skill.getName() + " has child " + childSkill.getName());
          int childRow = childSkill.getRow();
          int childCol = childSkill.getCol();
          // System.out.println( "childRow:"+childRow + " row:"+row );
          // System.out.println( "childCol:"+childCol + " col:"+col );
          if (childCol == col && childRow == row + 1) {
            skillSlot.arrowToB();
          }
          if (childCol == col + 1 && childRow == row) {
            skillSlot.arrowToR();
          }
          if (childCol == col - 1 && childRow == row) {
            // System.out.println(skill.getName() +" to left to "+ childSkill.getName());
            skillSlot.arrowToL();
          }
          if (childCol == col + 1 && childRow == row + 1) {
            skillSlot.arrowToBR();
          }
          if (childCol == col - 1 && childRow == row + 1) {
            skillSlot.arrowToBL();
          }
          int botIterations = childRow - row;
          int rightIterations = childCol - col;
          if (botIterations > 1) {
            for (int ii = 0; ii <= botIterations; ii++) {
              // System.out.println("longL botIterations:"+botIterations + " ii:"+ii);
              SkillSlot lowerSkillSlot = skillSlots[ii][col];
              if (ii < botIterations) {
                lowerSkillSlot.arrowToLongB();
              } else {
                lowerSkillSlot.arrowToB();
              }
            }
          }
          if (rightIterations > 1) {
            for (int ii = 0; ii <= botIterations; ii++) {
              SkillSlot lowerSkillSlot = skillSlots[ii][col];
              if (ii < rightIterations) {
                lowerSkillSlot.arrowToLongR();
              } else {
                lowerSkillSlot.arrowToR();
              }
            }
          }
          if (rightIterations > -1) {
            for (int ii = 0; ii >= botIterations; ii--) {
              SkillSlot lowerSkillSlot = skillSlots[ii][col];
              if (ii > rightIterations) {
                lowerSkillSlot.arrowToLongL();
              } else {
                lowerSkillSlot.arrowToL();
              }
            }
          }
        }
      }
    }

    skillTreePopup.attachWidget(plugin, box);
  }