Package marauroa.common.game

Examples of marauroa.common.game.RPClass


    serializer.write(contents);
    int size = RPClass.size();

    // sort out the default rp class if it is there
    for (Iterator<RPClass> it = RPClass.iterator(); it.hasNext();) {
      RPClass rp_class = it.next();
      if ("".equals(rp_class.getName())) {
        size--;
        break;
      }
    }

    serializer.write(size);
    for (Iterator<RPClass> it = RPClass.iterator(); it.hasNext();) {
      RPClass rp_class = it.next();
      if (!"".equals(rp_class.getName())) // sort out default class if it
      // is there
      {
        serializer.write(rp_class);
      }
    }
View Full Code Here


    contents = serializer.readStringArray();

    int size = serializer.readInt();
    for (int i = 0; i < size; ++i) {
      serializer.readObject(new RPClass());
    }

    if (type != MessageType.S2C_SERVERINFO) {
      throw new IOException();
    }
View Full Code Here

public class GateTest {
  @BeforeClass
  public static void setUpBeforeClass() throws Exception {
    if (!RPClass.hasRPClass("test_rpclass")) {
      new RPClass("test_rpclass");
    }
  }
View Full Code Here

public class EntityTest {
  @BeforeClass
  public static void init() {
    if (!RPClass.hasRPClass("test_rpclass")) {
      new RPClass("test_rpclass");
    }
  }
View Full Code Here

public class TestRPClass {

  @Test
  public void subclass() {
    final RPClass rpsuper = new RPClass("super");
    assertTrue(rpsuper.subclassOf("super"));
    final RPClass sub = new RPClass("sub");
    assertFalse(sub.subclassOf(("super")));
    sub.isA("super");
    assertTrue(sub.subclassOf(("super")));
  }
View Full Code Here

   * Define the RPClass.
   *
   * @return The configured RPClass.
   */
  private static RPClass createRPClass() {
    final RPClass rpclass = new RPClass("active_entity");

    rpclass.isA("entity");
    rpclass.addAttribute("dir", Type.BYTE, Definition.VOLATILE);
    rpclass.addAttribute("speed", Type.FLOAT, Definition.VOLATILE);

    return rpclass;
  }
View Full Code Here

  }

  public static void generateRPClass() {
    try {
      stats = Statistics.getStatistics();
      final RPClass entity = new RPClass("rpentity");
      entity.isA("active_entity");
      entity.addAttribute("name", Type.STRING);
      entity.addAttribute(ATTR_TITLE, Type.STRING);
      entity.addAttribute("level", Type.SHORT);
      entity.addAttribute("xp", Type.INT);
      entity.addAttribute("mana", Type.INT);
      entity.addAttribute("base_mana", Type.INT);

      entity.addAttribute("base_hp", Type.SHORT);
      entity.addAttribute("hp", Type.SHORT);

      entity.addAttribute("atk", Type.SHORT, Definition.PRIVATE);
      entity.addAttribute("atk_xp", Type.INT, Definition.PRIVATE);
      entity.addAttribute("def", Type.SHORT, Definition.PRIVATE);
      entity.addAttribute("def_xp", Type.INT, Definition.PRIVATE);
      entity.addAttribute("atk_item", Type.INT,
          (byte) (Definition.PRIVATE | Definition.VOLATILE));
      entity.addAttribute("def_item", Type.INT,
          (byte) (Definition.PRIVATE | Definition.VOLATILE));

      entity.addAttribute("risk", Type.BYTE, Definition.VOLATILE); // obsolete, do not use
      entity.addAttribute("damage", Type.INT, Definition.VOLATILE); // obsolete, do not use
      entity.addAttribute("heal", Type.INT, Definition.VOLATILE);
      // TODO: check that the binary representation of old saved players is compatible when this is changed into a list.
      entity.addAttribute("target", Type.INT, Definition.VOLATILE);
      entity.addAttribute("title_type", Type.STRING, Definition.VOLATILE);

      entity.addRPSlot("head", 1, Definition.PRIVATE);
      entity.addRPSlot("rhand", 1, Definition.PRIVATE);
      entity.addRPSlot("lhand", 1, Definition.PRIVATE);
      entity.addRPSlot("armor", 1, Definition.PRIVATE);
      entity.addRPSlot("finger", 1, Definition.PRIVATE);
      entity.addRPSlot("cloak", 1, Definition.PRIVATE);
      entity.addRPSlot("legs", 1, Definition.PRIVATE);
      entity.addRPSlot("feet", 1, Definition.PRIVATE);
      entity.addRPSlot("bag", 12, Definition.PRIVATE);
      entity.addRPSlot("keyring", 8, Definition.PRIVATE);

      entity.addRPEvent("attack", Definition.VOLATILE);
    } catch (final SyntaxException e) {
      logger.error("cannot generateRPClass", e);
    }
  }
View Full Code Here

      if (rpobject.has("persistent")
          && (rpobject.getInt("persistent") == 1)) {
        /*
         * Keep [new] rpclass
         */
        final RPClass rpclass = item.getRPClass();
        item.fill(rpobject);
        item.setRPClass(rpclass);

        // If we've updated the item name we don't want persistent reverting it
        item.put("name", name);
View Full Code Here

  /**
   * Generate the RPClass for spells
   */
  public static void generateRPClass() {
    final RPClass entity = new RPClass(RPCLASS_SPELL);
    entity.isA("entity");
    entity.addAttribute(ATTR_NAME, Type.STRING);
    entity.addAttribute(ATTR_AMOUNT, Type.INT);
    entity.addAttribute(ATTR_ATK, Type.INT);
    entity.addAttribute(ATTR_COOLDOWN, Type.INT);
    entity.addAttribute(ATTR_DEF, Type.INT);
    entity.addAttribute(ATTR_LIFESTEAL, Type.FLOAT);
    entity.addAttribute(ATTR_MANA, Type.INT);
    entity.addAttribute(ATTR_MINIMUMLEVEL, Type.INT);
    entity.addAttribute(ATTR_NATURE, Type.STRING);
    entity.addAttribute(ATTR_RANGE, Type.INT);
    entity.addAttribute(ATTR_RATE, Type.INT);
    entity.addAttribute(ATTR_REGEN, Type.INT);
    entity.addAttribute(ATTR_TIMESTAMP, Type.STRING);
    // class = nature
    entity.addAttribute("class", Type.STRING);
    entity.addAttribute("subclass", Type.STRING);
  }
View Full Code Here

    setResistance(100);
    setVisibility(100);
  }

  public static void generateRPClass() {
    final RPClass entity = new RPClass("entity");

    // Some things may have a textual description
    entity.addAttribute("description", Type.LONG_STRING, Definition.HIDDEN);

    // TODO: Try to remove this attribute later (at DB reset?)
    entity.addAttribute("type", Type.STRING);

    /**
     * Resistance to other entities (0-100). 0=Phantom, 100=Obstacle.
     */
    entity.addAttribute("resistance", Type.BYTE, Definition.VOLATILE);

    entity.addAttribute("x", Type.SHORT);
    entity.addAttribute("y", Type.SHORT);

    /*
     * The size of the entity (in world units).
     */
    entity.addAttribute("width", Type.SHORT, Definition.VOLATILE);
    entity.addAttribute("height", Type.SHORT, Definition.VOLATILE);

    /*
     * Obsolete and ignored by the client. Do not use.
     */
    entity.addAttribute("server-only", Type.FLAG, Definition.VOLATILE);

    /*
     * The current overlayed client effect.
     */
    entity.addAttribute("effect", Type.STRING, Definition.VOLATILE);

    /*
     * The visibility of the entity drawn on client (0-100). 0=Invisible,
     * 100=Solid. Useful when mixed with effect.
     */
    entity.addAttribute("visibility", Type.INT, Definition.VOLATILE);

    // cursor
    entity.addAttribute("cursor", Type.STRING);

    // sound events
    entity.addRPEvent(Events.SOUND, Definition.VOLATILE);
  }
View Full Code Here

TOP

Related Classes of marauroa.common.game.RPClass

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.