예제 #1
0
  public BaseSWGCommand getCommandByName(String name) {
    Vector<BaseSWGCommand> commands = new Vector<BaseSWGCommand>(commandLookup);

    name = name.toLowerCase();

    for (BaseSWGCommand command : commands) {
      if (command.getCommandName().equalsIgnoreCase(name)) {
        return command;
      }
    }

    try {
      String[] tableArray =
          new String[] {
            "client_command_table",
            "command_table",
            "client_command_table_ground",
            "command_table_ground",
            "client_command_table_space",
            "command_table_space"
          };

      for (int n = 0; n < tableArray.length; n++) {
        DatatableVisitor visitor =
            ClientFileManager.loadFile(
                "datatables/command/" + tableArray[n] + ".iff", DatatableVisitor.class);

        for (int i = 0; i < visitor.getRowCount(); i++) {
          if (visitor.getObject(i, 0) != null) {
            String commandName = ((String) visitor.getObject(i, 0)).toLowerCase();

            if (commandName.equalsIgnoreCase(name)) {
              if (isCombatCommand(commandName)) {
                CombatCommand command = new CombatCommand(commandName);
                commandLookup.add(command);
                return command;
              } else {
                BaseSWGCommand command = new BaseSWGCommand(commandName);
                commandLookup.add(command);
                return command;
              }
            }
          }
        }
      }
    } catch (InstantiationException | IllegalAccessException e) {
      e.printStackTrace();
    }

    return null;
  }
예제 #2
0
  public boolean isCombatCommand(String commandName) {
    try {
      DatatableVisitor visitor =
          ClientFileManager.loadFile("datatables/combat/combat_data.iff", DatatableVisitor.class);

      for (int i = 0; i < visitor.getRowCount(); i++) {
        if (visitor.getObject(i, 0) != null
            && ((String) (visitor.getObject(i, 0))).equalsIgnoreCase(commandName)) {
          return true;
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }

    return false;
  }
예제 #3
0
파일: Buff.java 프로젝트: Jaqsin/NGECore2
  public Buff(String buffName, long ownerId) {

    this.buffName = buffName;
    this.ownerId = ownerId;

    DatatableVisitor visitor;

    try {

      visitor = ClientFileManager.loadFile("datatables/buff/buff.iff", DatatableVisitor.class);
      for (int i = 0; i < visitor.getRowCount(); i++) {

        if (visitor.getObject(i, 0) != null)
          if (((String) visitor.getObject(i, 0)).equalsIgnoreCase(buffName)) {

            group1 = (String) visitor.getObject(i, 1);
            priority = (int) visitor.getObject(i, 4);
            duration = (Float) visitor.getObject(i, 6);
            effect1Name = (String) visitor.getObject(i, 7);
            effect1Value = (Float) visitor.getObject(i, 8);
            effect2Name = (String) visitor.getObject(i, 9);
            effect2Value = (Float) visitor.getObject(i, 10);
            effect3Name = (String) visitor.getObject(i, 11);
            effect3Value = (Float) visitor.getObject(i, 12);
            effect4Name = (String) visitor.getObject(i, 13);
            effect4Value = (Float) visitor.getObject(i, 14);
            effect5Name = (String) visitor.getObject(i, 15);
            effect5Value = (Float) visitor.getObject(i, 16);
            particleEffect = (String) visitor.getObject(i, 19);
            isDebuff = (Boolean) visitor.getObject(i, 22);
            removeOnDeath = (Integer) visitor.getObject(i, 25) != 0;
            isRemovableByPlayer = (Integer) visitor.getObject(i, 26) != 0;
            maxStacks = (Integer) visitor.getObject(i, 28);
            isPersistent = (Integer) visitor.getObject(i, 29) != 0;
            removeOnRespec = (Integer) visitor.getObject(i, 31) != 0;
            aiRemoveOnEndCombat = (Integer) visitor.getObject(i, 32) != 0;
            decayOnPvPDeath = (Integer) visitor.getObject(i, 33) != 0;
          }
      }

    } catch (InstantiationException | IllegalAccessException e) {
      e.printStackTrace();
    }
  }