Package marauroa.common.game

Examples of marauroa.common.game.RPObject


  }

  private void reownOldEntry(PlayerEntry oldEntry, PlayerEntry entry) {
    // remove character from world
    playerContainer.getLock().requestWriteLock();
    RPObject object = oldEntry.object; // (RPObject) oldEntry.object.clone();
    rpMan.onTimeout(oldEntry.object);

    // Disconnect player of server.
    logger.debug("Disconnecting PREVIOUS " + oldEntry.channel + " with " + oldEntry);
    netMan.disconnectClient(oldEntry.channel);
View Full Code Here


   * @param rpMan RPServerManager
   * @param data LoadCharacterCommand
   */
  public void handleDelayedEvent(RPServerManager rpMan, Object data) {
    LoadCharacterCommand cmd = (LoadCharacterCommand) data;
    RPObject object = cmd.getObject();
    int clientid = cmd.getClientid();

    PlayerEntry entry = playerContainer.get(clientid);
    if (entry == null) {
      return;
View Full Code Here

   * @throws SQLException in case of an database error
   */
  public RPObject loadRPObject(int objectid) throws SQLException, IOException {
    DBTransaction transaction = TransactionPool.get().beginWork();
    try {
      RPObject res = loadRPObject(transaction, objectid, true);
      return res;
    } finally {
      TransactionPool.get().commit(transaction);
    }
  }
View Full Code Here

       */
      if(character.length()<4) {
        return new CharacterResult(Result.FAILED_STRING_SIZE, character, template);
      }
     
      RPObject player = new RPObject(template);

      player.put("name", character);
      player.put("version", "0.00");

      if (DAORegister.get().get(CharacterDAO.class).hasCharacter(transaction, character)) {
        logger.warn("Character already exist: " + character);
        return new CharacterResult(Result.FAILED_PLAYER_EXISTS, character, player);
      }
View Full Code Here

  public boolean onActionAdd(RPObject object, RPAction action, List<RPAction> actionList) {
    return true;
  }

  public boolean onExit(RPObject object) throws RPObjectNotFoundException {
    RPObject result = world.remove(object.getID());
    TestHelper.assertNotNull(result);

    players.remove(object);
    return true;
  }
View Full Code Here

  private void applyPerceptionModifiedRPObjects(MessageS2CPerception message,
          Map<RPObject.ID, RPObject> world) throws RPObjectNotFoundException {
    try {
      /* First we remove the deleted attributes */
      for (RPObject object : message.getModifiedDeletedRPObjects()) {
        RPObject w_object = world.get(object.getID());
        if (!listener.onModifiedDeleted(w_object, object)) {
          w_object.applyDifferences(null, object);
        }
      }

      /* And then we add the new and modified attributes */
      for (RPObject object : message.getModifiedAddedRPObjects()) {
        RPObject w_object = world.get(object.getID());
        if (w_object == null) {
          logger.warn("Missing base object for modified added RPObject with id " + object.getID());
          continue;
        }
        if (!listener.onModifiedAdded(w_object, object)) {
          w_object.applyDifferences(object, null);
        }
      }
    } catch (RPObjectNotFoundException e) {
      logger.error("error in applyModifiedRPObjects", e);
      logger.error("world is [" + world.toString() + "]");
View Full Code Here

   *            the container of objects
   */
  private void applyPerceptionMyRPObject(MessageS2CPerception message,
          Map<RPObject.ID, RPObject> world) throws RPObjectNotFoundException {
    try {
      RPObject added = message.getMyRPObjectAdded();
      RPObject deleted = message.getMyRPObjectDeleted();

      addMyRPObjectToWorldIfPrivate(added, world);

      if (!listener.onMyRPObject(added, deleted)) {
        RPObject.ID id = null;

        if (added != null) {
          id = added.getID();
        }

        if (deleted != null) {
          id = deleted.getID();
        }

        if (id == null) {
          return;
        }

        RPObject object = world.get(id);

        object.applyDifferences(added, deleted);
      }
    } catch (Exception e) {
      logger.error("error in applyPerceptionMyRPObject", e);
      throw new RPObjectNotFoundException(RPObject.INVALID_ID);
    }
View Full Code Here

      return;
    }
    if (world.get(added.getID()) != null) {
      return;
    }
    RPObject object = (RPObject) added.clone();
    if (!listener.onAdded(object)) {
      world.put(object.getID(), object);
    }
  }
View Full Code Here

      params.put("player_id", Integer.valueOf(id));
      params.put("character", character);
     
      ResultSet result = transaction.query(query, params);

      RPObject player = null;
      if (result.next()) {
        int objectid = result.getInt("object_id");
        player = DAORegister.get().get(RPObjectDAO.class).loadRPObject(transaction, objectid);
        logger.debug("Character: " + player);
      } else {
View Full Code Here

      Map<String, Object> params = new HashMap<String, Object>();
      params.put("player_id", Integer.valueOf(id));
     
      ResultSet result = transaction.query(query, params);

      RPObject player = null;
      while (result.next()) {
        int objectid = result.getInt("object_id");
        String name = result.getString("charname");
        Blob data = result.getBlob("data");
        int protocolVersion = NetConst.FIRST_VERSION_WITH_MULTI_VERSION_SUPPORT - 1;
        Object temp = result.getObject("protocol_version");
        if (temp != null) {
          protocolVersion = ((Integer) temp).intValue();
        }
        RPObject rpobject = DAORegister.get().get(RPObjectDAO.class).readRPObject(objectid, data, protocolVersion, false);
        logger.debug("Character: " + player);
        res.put(name, rpobject);
      }

      result.close();
View Full Code Here

TOP

Related Classes of marauroa.common.game.RPObject

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.