Package org.jruby

Examples of org.jruby.RubyObject


   * @see de.yaams.extensions.genericLoader.GTab#getInternContent(int)
   */
  @Override
  public void buildForm(FormBuilder form, int id) {
    // prepare
    RubyObject act = elements.get(id).getObject();

    // build basics
    form.addHeader("basic", new FormHeader(I18N.t("Grundlegenes"), getIcon() + "_info").setColumn(4));
    form.addElement("basic.name", RubyForm.getString(I18N.t("Name"), "@name", act));
    form.addElement("basic.position", RubyForm.getComboBoxNum("Position", new String[] { "0", "1", "2" }, new String[] { "Front",
        "Middle", "Rear" }, act, "@position"));

    form.addHeader("supported", new FormHeader(I18N.t("Auswirkungen"), "class").setColumn(6));
    form.addElement(
        "supported.weapon",
        new FormDBList(project, Type.WEAPON, act.getInstanceVariable("@weapon_set"), I18N
            .t("Angabe der Waffen mit denen sich die Klasse ausrüsten kann.")));
    form.addElement(
        "supported.armor",
        new FormDBList(project, Type.ARMOR, act.getInstanceVariable("@armor_set"), I18N
            .t("Angabe der Rüstungen mit denen sich die Klasse ausrüsten kann.")));
    form.addElement("supported.learn", new FormLearningList(project, act.getInstanceVariable("@learnings")).setSorting(1));

    // elements
    form.addHeader("ele", new FormHeader(RGSS1Helper.getName(Type.ELEMENT), RGSS1Helper.getIcon(Type.ELEMENT)).setCollapsed(true)
        .setColumn(4).setSorting(4));

    form.addElement("ele.0ele", new FormInfo("", I18N.t("Elemental effectiveness")));
    form.addElement("ele.0stat", new FormInfo("", I18N.t("Status effectiveness")));

    int e = RGSS1Helper.get(getProject(), Type.ELEMENT).size();
    IRubyObject eTable = act.getInstanceVariable("@element_ranks");
    int s = RGSS1Helper.get(getProject(), Type.STATUS).size();
    IRubyObject sTable = act.getInstanceVariable("@state_ranks");
    int l = e > s ? e : s;

    // run over all
    for (int i = 1; i < l; i++) {
      // add elements
View Full Code Here


   * @param name
   * @return
   */
  private static String getString(String name, Project p) {
    // build it
    RubyObject words = (RubyObject) RGSS1Helper.get(p, Type.SYSTEM).get(0).getObject().getInstanceVariable("@words");
    return RubyHelper.toString(words, name);
  }
View Full Code Here

    }

    // special objects?
    if (type == Type.VARIABLE || type == Type.SWITCH || type == Type.ELEMENT) {
      // load system
      RubyObject system = get(project, Type.SYSTEM).get(0).getObject();

      // create list
      ArrayList<SystemGObject> list = new ArrayList<SystemGObject>();
      list.add(null);
      // load vars
      IRubyObject[] ary = ((RubyArray) system.getInstanceVariable(type == Type.VARIABLE ? "@variables"
          : type == Type.ELEMENT ? "@elements" : "@switches")).toJavaArray();

      boolean first = true;

      // add vars
      for (IRubyObject i : ary) {
        // skip first
        if (first) {
          first = false;
          continue;
        }

        // build Object
        RubyObject o = new RubyObject(RubyClass.newClass(system.getRuntime(), system.getMetaClass().getSuperClass()));
        o.setInstanceVariable("@id", RubyFixnum.newFixnum(system.getRuntime(), list.size()));
        o.setInstanceVariable("@name", i);
        list.add(new SystemGObject(o));
      }

      // save
      project.getCache().put(id, list);

      return list;
    } else if (type == Type.MAP) {
      final RubyHash r = (RubyHash) RGSS1Load.loadFile(project, new File(RGSS1Load.getDataFile(project), "MapInfos.rxdata"));
      Set<?> set = r.keySet();

      int max = 0;

      HashMap<Integer, RubyObject> o = new HashMap<Integer, RubyObject>();
      o.put(0, null);

      // build the list
      for (Object i : set) {
        int roid = Integer.valueOf(i.toString());
        o.put(roid, (RubyObject) RGSS1Load.loadFile(project, RGSS1Load.getMapFile(project, roid)));
        o.get(roid).setInstanceVariable("@id", RubyFixnum.newFixnum(o.get(roid).getRuntime(), roid));
        o.get(roid).setInstanceVariable("@name", ((RubyObject) r.get(roid)).getInstanceVariable("@name"));

        // search for the hightes id
        if (roid > max) {
          max = roid;
        }
      }

      // build the list
      ArrayList<SystemGObject> ro = new ArrayList<SystemGObject>();
      for (int i = 0; i <= max; i++) {
        // add it
        if (o.containsKey(i)) {
          ro.add(new SystemGObject(o.get(i)));
        } else {
          // build filler
          RubyObject no = (RubyObject) RGSSProjectHelper.getInterpreter(project).runScriptlet("return RPG::Map.new(20,15)");
          no.setInstanceVariable("@name", RubyString.newString(r.getRuntime(), "Fill " + i));
          no.setInstanceVariable("@id", RubyFixnum.newFixnum(o.get(i).getRuntime(), i));

          // add filler
          ro.add(new SystemGObject(no));
        }

      }

      // save
      project.getCache().put(id, ro);

      return ro;

    } else if (type == Type.SYSTEM) {
      // load
      RubyObject o = (RubyObject) RGSS1Load.loadFile(project, new File(RGSS1Load.getDataFile(project), "System.rxdata"));

      // put in array
      ArrayList<SystemGObject> objs = new ArrayList<SystemGObject>();
      objs.add(new SystemGObject(o));
      project.getCache().put(id, objs);
View Full Code Here

   * @see de.yaams.packandgo.helper.gui.list.YSimpleList#add()
   */
  @Override
  public void add() {
    // ask the tab
    RubyObject o = tab.createObject();

    // set id
    o.setInstanceVariable("@id", new RubyFixnum(o.getRuntime(), tab.getElements().size()));

    // add it
    tab.getElements().add(new SystemGObject(o));
    tab.getElements().get(tab.getElements().size() - 1).setModified(true);
    add(tab.getElements().size() - 1);
View Full Code Here

   * @see de.yaams.extensions.genericLoader.GTab#getInternContent(int)
   */
  @Override
  public void buildForm(FormBuilder form, int id) {
    // prepare
    RubyObject act = elements.get(id).getObject();

    // build basics
    form.getHeader("basic").setColumn(6);
    form.addElement("basic.name", RubyForm.getString("Name", "@name", act));

    FormComboBox tg = RubyForm.getComboBoxNum("Trigger", new String[] { "0", "1", "2" },
        new String[] { "None", "Autorun", "Parallel" }, act, "@trigger");

    form.addElement("basic.strigger", tg);
    form.addElement("basic.switch", FormHelper.setEnabeldWhenNotRightElementSelect(tg,
        new FormSwitchVarSelector(project, I18N.t("Switch"), act, "@switch_id", Type.SWITCH), "0"));

    // add commands
    form.setCenter(new YEventCommandList(act.getInstanceVariable("@list"), getProject(), null));

    // set en/disabeld
    tg.informListeners();
  }
View Full Code Here

   * @see de.yaams.extensions.genericLoader.GTab#getInternContent(int)
   */
  @Override
  public void buildForm(FormBuilder form, int id) {
    // prepare
    RubyObject act = elements.get(id).getObject();

    // build basics
    form.addHeader("basic", new FormHeader(I18N.t("Grundlegenes"), getIcon() + "_info").setColumn(4));
    form.addElement("basic.name", RubyForm.getString("Name", "@name", act));
    form.addElement("basic.desc", RubyForm.getString(I18N.t("Beschreibung"), "@description", act));
    form.addElement("basic.image", new FormGraphEle(I18N.t("Bild"), project, RTP.ICON, act, "@icon_name", null));

    // sonst
    form.addHeader("usa", new FormHeader(I18N.t("Benutzung"), "info").setColumn(4));
    form.addElement("usa.price", RubyForm.getNumber(I18N.t("Preis"), act, "@price"));
    form.addElement("usa.type", RubyForm.getComboBoxNum("Type", new String[] { "0", "1", "2", "3" },
        new String[] { RGSS1Voc.shield(project), RGSS1Voc.helm(project), RGSS1Voc.armor(project), RGSS1Voc.acc(project) }, act,
        "@kind"));

    // values
    form.addHeader("value", new FormHeader(I18N.t("Werte"), "systemmonitor").setColumn(8));
    form.addElement("value.pdef", RubyForm.getNumber(RGSS1Voc.pdef(project), act, "@pdef"));
    form.addElement("value.mdef", RubyForm.getNumber(RGSS1Voc.mdef(project), act, "@mdef"));
    form.addElement("value.eva", RubyForm.getNumber("Evasion", act, "@eva"));
    form.addElement("value.str", RubyForm.getNumber(RGSS1Voc.str(project), act, "@str_plus"));
    form.addElement("value.dex", RubyForm.getNumber(RGSS1Voc.dex(project), act, "@dex_plus"));
    form.addElement("value.agi", RubyForm.getNumber(RGSS1Voc.agi(project), act, "@agi_plus"));
    form.addElement("value.int", RubyForm.getNumber(RGSS1Voc.inte(project), act, "@int_plus"));
    form.addElement("value.state", new FormDBComboBox("Auto State ID", project, Type.STATUS, act, "@auto_state_id", true));

    // build panel
    form.addHeader("resistance", new FormHeader(I18N.t("Resistenz gegen"), "armor").setColumn(4).setSorting(4));

    form.addElement("resistance.element",
        new FormDBList(project, Type.ELEMENT, act.getInstanceVariable("@guard_element_set"), I18N.t("Element Verteidigung.")));
    form.addElement("resistance.status",
        new FormDBList(project, Type.STATUS, act.getInstanceVariable("@guard_state_set"), I18N.t("Status Verteidigung.")));

  }
View Full Code Here

   * @see de.yaams.extensions.genericLoader.GTab#getInternContent(int)
   */
  @Override
  public void buildForm(FormBuilder form, int id) {
    // prepare
    RubyObject act = elements.get(id).getObject();

    // build basics
    form.addHeader("basic", new FormHeader(I18N.t("Grundlegenes"), getIcon() + "_info"));
    form.addElement("basic.name", RubyForm.getString(I18N.t("Name"), "@name", act));

    form.addHeader("enemy", new FormHeader(RGSS1Helper.getName(Type.ENEMY), RGSS1Helper.getIcon(Type.ENEMY)));
    form.addElement("enemy.enemy", new FormMemberList(project, act.getInstanceVariable("@members")));

    // build panel
    form.setCenter(new TroopEventPanel(getProject(), act.getInstanceVariable("@pages")));

  }
View Full Code Here

   * @see de.yaams.extensions.genericLoader.GTab#getInternContent(int)
   */
  @Override
  public void buildForm(FormBuilder form, int id) {
    // prepare
    RubyObject act = elements.get(id).getObject();

    // build
    form.addHeader("basic", new FormHeader(I18N.t("Grundlegenes"), getIcon() + "_info").setColumn(4));
    form.addElement("basic.name", RubyForm.getString("Name", "@name", act));
    form.addElement("basic.desc", RubyForm.getString(I18N.t("Beschreibung"), "@description", act));
    form.addElement("basic.image", new FormGraphEle(I18N.t("Bild"), project, RTP.ICON, act, "@icon_name", null));

    // sonst
    form.addHeader("usa", new FormHeader(I18N.t("Benutzung"), "info").setColumn(6));
    form.addElement("usa.price", RubyForm.getNumber(I18N.t("Preis"), act, "@price"));
    form.addElement("usa.priceuse", RubyForm.getBoolean("Useable", act, "@consumable"));

    form.addElement(
        "usa.target",
        RubyForm.getComboBoxNum("Target", JavaHelper.numAry(7), new String[] { "None", "one enemy", "all enemies", "one ally",
            "all allies", "1 ally--HP 0", "all allies--HP 0", "the user" }, act, "@scope"));
    form.addElement(
        "usa.ergo",
        RubyForm.getComboBoxNum("Usability", JavaHelper.numAry(3), new String[] { "always", "only in battle", "only from the menu",
            "never" }, act, "@occasion"));

    form.addElement(
        "usa.base",
        RubyForm.getComboBoxNum("Base Statistic", JavaHelper.numAry(6), new String[] { "None", "maxHP", "maxSP", "strength",
            "dexterity", "agility", RGSS1Voc.inte(project) }, act, "@parameter_type"));
    form.addElement("usa.basepoints", RubyForm.getNumber("Points", act, "@parameter_points"));

    // values
    form.addHeader("value", new FormHeader(I18N.t("Werte"), "systemmonitor").setColumn(8));
    form.addElement("value.hp", RubyForm.getNumber("HP Recover", act, "@recover_hp"));
    form.addElement("value.hpr", RubyForm.getNumber("HP Recover %", act, "@recover_hp_rate"));
    form.addElement("value.sp", RubyForm.getNumber("SP Recoder", act, "@recover_sp"));
    form.addElement("value.spr", RubyForm.getNumber("SP Recover %", act, "@recover_sp_rate"));
    form.addElement("value.hit", RubyForm.getNumber("Accurary", act, "@hit"));
    form.addElement("value.pdef", RubyForm.getNumber(RGSS1Voc.pdef(project), act, "@pdef_f"));
    form.addElement("value.mdef", RubyForm.getNumber(RGSS1Voc.mdef(project), act, "@mdef_f"));
    form.addElement("value.var", RubyForm.getNumber("Variance", act, "@variance"));

    // animation
    form.addHeader("other", new FormHeader(I18N.t("Sonstiges"), "animation").setColumn(4));
    form.addElement("other.user", new FormDBComboBox("User Animation", project, Type.ANIMATION, act, "@animation1_id", true));
    form.addElement("other.target", new FormDBComboBox("Target Animation", project, Type.ANIMATION, act, "@animation2_id", true));
    form.addElement("other.se", new FormMusicEle("Menu Use SE", project, RTP.SE, act.getInstanceVariable("@menu_se")));
    form.addElement("other.event", new FormDBComboBox("Common Event", project, RGSS1Helper.Type.COMMONEVENT, act, "@common_event_id",
        true));

    // build panel
    form.addHeader("result", new FormHeader(I18N.t("Setzen von Auswirkungen"), "skill").setColumn(6).setSorting(4));

    form.addElement("result.element",
        new FormDBList(project, Type.ELEMENT, act.getInstanceVariable("@element_set"), I18N.t("Setzen von Elementen")));
    form.addElement("result.statusAdd",
        new FormDBList(project, Type.STATUS, act.getInstanceVariable("@plus_state_set"), I18N.t("Hinzufügen des Status.")));
    form.addElement("result.statusRemove",
        new FormDBList(project, Type.STATUS, act.getInstanceVariable("@minus_state_set"), I18N.t("Entfernen des Status.")));

  }
View Full Code Here

   * @see de.yaams.extensions.genericLoader.GTab#getInternContent(int)
   */
  @Override
  public void buildForm(FormBuilder form, int id) {
    // prepare
    RubyObject act = elements.get(id).getObject();

    // build basics
    form.addHeader("basic", new FormHeader(I18N.t("Grundlegenes"), getIcon() + "_info").setColumn(4));
    form.addElement("basic.name", RubyForm.getString("Name", "@name", act));
    form.addElement("basic.desc", RubyForm.getString(I18N.t("Beschreibung"), "@description", act));
    form.addElement("basic.image", new FormGraphEle(I18N.t("Image"), project, RTP.ICON, act, "@icon_name", null));

    // sonst
    form.addHeader("usa", new FormHeader(I18N.t("Benutzung"), "info").setColumn(6));
    form.addElement("usa.sp", RubyForm.getNumber("SP Cost", act, "@sp_cost"));

    form.addElement("usa.target", RubyForm
        .getComboBoxNum("Target", new String[] { "0", "1", "2", "3", "4", "5", "6", "7" }, new String[] { "None", "one enemy",
            "all enemies", "one ally", "all allies", "1 ally--HP 0", "all allies--HP 0", "the user" }, act, "@scope"));
    form.addElement(
        "usa.usa",
        RubyForm.getComboBoxNum("Usability", new String[] { "0", "1", "2", "3" }, new String[] { "always", "only in battle",
            "only from the menu", "never" }, act, "@occasion"));

    // values
    form.addHeader("value", new FormHeader(I18N.t("Werte"), "systemmonitor").setColumn(8));
    form.addElement("value.pow", RubyForm.getNumber("Power", act, "@power"));
    form.addElement("value.atk", RubyForm.getNumber("Attack", act, "@atk_f"));
    form.addElement("value.eva", RubyForm.getNumber("Evasion", act, "@eva_f"));
    form.addElement("value.str", RubyForm.getNumber("Strength", act, "@str_f"));
    form.addElement("value.dex", RubyForm.getNumber("Dexterity", act, "@dex_f"));
    form.addElement("value.agi", RubyForm.getNumber("Agility", act, "@agi_f"));
    form.addElement("value.mag", RubyForm.getNumber("Magic", act, "@int_f"));
    form.addElement("value.acc", RubyForm.getNumber("Accurary", act, "@hit"));
    form.addElement("value.phy", RubyForm.getNumber("Phys Def", act, "@pdef_f"));
    form.addElement("value.mdef", RubyForm.getNumber("Mag Def", act, "@mdef_f"));
    form.addElement("value.var", RubyForm.getNumber("Variance", act, "@variance"));

    // animation
    form.addHeader("other", new FormHeader(I18N.t("Sonstiges"), "animation").setColumn(4));
    form.addElement("other.user", new FormDBComboBox("User Animation", project, Type.ANIMATION, act, "@animation1_id", true));
    form.addElement("other.target", new FormDBComboBox("Target Animation", project, Type.ANIMATION, act, "@animation2_id", true));
    form.addElement("other.se", new FormMusicEle("Menu Use SE", project, RTP.SE, act.getInstanceVariable("@menu_se")));
    form.addElement("other.ce",
        new FormDBComboBox("Common Event", project, RGSS1Helper.Type.COMMONEVENT, act, "@common_event_id", true));

    // build panel
    form.addHeader("result", new FormHeader(I18N.t("Setzen von Auswirkungen"), "skill").setColumn(6).setSorting(4));

    form.addElement("result.element",
        new FormDBList(project, Type.ELEMENT, act.getInstanceVariable("@element_set"), I18N.t("Setzen von Elementen")));
    form.addElement("result.statusAdd",
        new FormDBList(project, Type.STATUS, act.getInstanceVariable("@plus_state_set"), I18N.t("Hinzufügen des Status.")));
    form.addElement("result.statusRemove",
        new FormDBList(project, Type.STATUS, act.getInstanceVariable("@minus_state_set"), I18N.t("Entfernen des Status.")));

  }
View Full Code Here

   * @see de.yaams.extensions.genericLoader.GTab#getInternContent(int)
   */
  @Override
  public void buildForm(FormBuilder form, int id) {
    // prepare
    RubyObject act = elements.get(id).getObject();

    // build basics
    form.addHeader("basic", new FormHeader(I18N.t("Grundlegenes"), getIcon() + "_info").setColumn(4));
    form.addElement("basic.name", RubyForm.getString("Name", "@name", act));
    form.addElement("basic.battler", new FormGraphEle(I18N.t("Battler"), project, RTP.BATTLERS, act, "@battler_name", "@battler_hue"));

    // set skills
    form.addHeader("skill", new FormHeader(I18N.t("Skills"), "skill").setColumn(4));
    form.addElement("skill.hp", RubyForm.getNumber(I18N.t("Max HP"), act, "@maxhp"));
    form.addElement("skill.sp", RubyForm.getNumber(I18N.t("Max SP"), act, "@maxsp"));

    // add level

    // values
    form.addHeader("value", new FormHeader(I18N.t("Werte"), "systemmonitor").setColumn(8));
    form.addElement("value.str", RubyForm.getNumber(RGSS1Voc.str(project), act, "@str"));
    form.addElement("value.dex", RubyForm.getNumber(RGSS1Voc.dex(project), act, "@dex"));
    form.addElement("value.agi", RubyForm.getNumber(RGSS1Voc.agi(project), act, "@agi"));
    form.addElement("value.int", RubyForm.getNumber(RGSS1Voc.inte(project), act, "@int"));
    form.addElement("value.atk", RubyForm.getNumber("Attack Power", act, "@atk"));
    form.addElement("value.pdef", RubyForm.getNumber("Phys Def", act, "@pdef"));
    form.addElement("value.mdef", RubyForm.getNumber("Mag Def", act, "@mdef"));
    form.addElement("value.eva", RubyForm.getNumber("Evasion", act, "@eva"));

    // animation
    form.addHeader("other", new FormHeader(I18N.t("Sonstiges"), "animation").setColumn(4));
    form.addElement("other.user", new FormDBComboBox("User Animation", project, Type.ANIMATION, act, "@animation1_id", true));
    form.addElement("other.target", new FormDBComboBox("Target Animation", project, Type.ANIMATION, act, "@animation2_id", true));

    // drops
    form.addHeader("treasure", new FormHeader(I18N.t("Belohnung"), "armor_weapon").setColumn(8));
    form.addElement("treasure.gexp", RubyForm.getNumber("EXP", act, "@exp"));
    form.addElement("treasure.gold", RubyForm.getNumber("Gold", act, "@gold"));
    form.addElement("treasure.prob",
        RubyForm.getNumber("Chance(%)", act, "@treasure_prob").setMinMax(0, 100, 1).setInfoTxt("Chance to get this item"));

    form.addElement("treasure.get", new FormInfo("", I18N.t("Select of the 3 foldings, only once!")));
    form.addElement("treasure.geti", new FormDBComboBox("Item", project, Type.ITEM, act, "@item_id", true));
    form.addElement("treasure.getw", new FormDBComboBox("Weapon", project, Type.WEAPON, act, "@weapon_id", true));
    form.addElement("treasure.geta", new FormDBComboBox("Armor", project, Type.ARMOR, act, "@armor_id", true));

    // elements
    form.addHeader("ele", new FormHeader(RGSS1Helper.getName(Type.ELEMENT), RGSS1Helper.getIcon(Type.ELEMENT)).setCollapsed(true)
        .setColumn(4).setSorting(4));

    form.addElement("ele.0ele", new FormInfo("", I18N.t("Attribut Resistance")));
    form.addElement("ele.0stat", new FormInfo("", I18N.t("Status Resistance")));

    int e = RGSS1Helper.get(getProject(), Type.ELEMENT).size();
    IRubyObject eTable = act.getInstanceVariable("@element_ranks");
    int s = RGSS1Helper.get(getProject(), Type.STATUS).size();
    IRubyObject sTable = act.getInstanceVariable("@state_ranks");
    int l = e > s ? e : s;

    // run over all
    for (int i = 1; i < l; i++) {
      // add elements
      if (e > i) {
        form.addElement("ele." + i + "ele", new FormTable(RGSS1Helper.get(getProject(), Type.ELEMENT).get(i).getName(), eTable, i,
            0).setMinMax(0, 6, 1));
      } else {
        form.addElement("ele." + i + "ele", new FormEmpty());
      }

      // add status
      if (s > i) {
        form.addElement("ele." + i + "stat", new FormTable(RGSS1Helper.get(getProject(), Type.STATUS).get(i).getName(), sTable, i,
            0).setMinMax(0, 6, 1));
      } else {
        form.addElement("ele." + i + "stat", new FormEmpty());
      }
    }

    // build panel
    form.setCenter(new EnemyActionPanel(project, act.getInstanceVariable("@actions")));

  }
View Full Code Here

TOP

Related Classes of org.jruby.RubyObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.