Package marauroa.common.game

Examples of marauroa.common.game.RPEvent


  }

  public void execute(RPObject object, RPAction action) {
    logger.info(object.get("name") + " running " + action);

    RPEvent chat = new RPEvent("chat");
    chat.put("text", action.get("text"));
    object.addEvent(chat);

    int eventCounter = 0;
    if (object.has("eventcounter")) {
      eventCounter = object.getInt("eventcounter");
View Full Code Here


    object.addSlot("lhand");
    object.addSlot("rhand");

    RPClassTestHelper.generateRPClasses();
    RPEvent chat = new RPEvent("chat");
    chat.put("text", "Hi there");
    object.addEvent(chat);

    chat = new RPEvent("chat");
    chat.put("text", "Does this work?");
    object.addEvent(chat);

    RPSlot lhand = object.getSlot("lhand");

    RPObject pocket = new RPObject();
View Full Code Here

  /**
   * Tests for AttackEvents without "hit" being missed.
   */
  @Test
  public void testEvaluateAttackNoHit() {
    RPEvent obj = new RPEvent();
    obj.put("type", 0);
   
    Event<RPEntity> ev = new AttackEvent();
    ev.init(attacker, obj);
   
    attacker.attackTarget = defender;
View Full Code Here

  /**
   * Tests for AttackEvents without "hit" being missed
   */
  @Test
  public void testEvaluateAttackNoHitdamage0() {
    RPEvent obj = new RPEvent();
    obj.put("type", 0);
    obj.put("damage", "0");
   
    Event<RPEntity> ev = new AttackEvent();
    ev.init(attacker, obj);
   
    attacker.attackTarget = defender;
View Full Code Here

  /**
   * Tests for a blocked attack.
   */
  @Test
  public void testEvaluateAttackHitDamage0() {
    RPEvent obj = new RPEvent();
    obj.put("type", 0);
    obj.put("hit", "");
    obj.put("damage", "0");
   
    Event<RPEntity> ev = new AttackEvent();
    ev.init(attacker, obj);
   
    attacker.attackTarget = defender;
View Full Code Here

  /**
   * Tests for a damaging attack
   */
  @Test
  public void testEvaluateAttackRisk1Damage1() {
    RPEvent obj = new RPEvent();
    obj.put("type", 0);
    obj.put("hit", "");
    obj.put("damage", "1");
   
    Event<RPEntity> ev = new AttackEvent();
    ev.init(attacker, obj);
   
    attacker.attackTarget = defender;
View Full Code Here

   * tell the clients about changes in the group
   */
  private void sendGroupChangeEvent() {
    StendhalRPRuleProcessor ruleProcessor = SingletonRepository.getRuleProcessor();
    List<String> members = new LinkedList<String>(membersAndLastSeen.keySet());
    RPEvent event = new GroupChangeEvent(leader, members, lootmode);
    for (String playerName : membersAndLastSeen.keySet()) {
      Player player = ruleProcessor.getPlayer(playerName);
      if (player != null) {
        player.addEvent(event);
      }
View Full Code Here

   *
   * @param player Player
   */
  public void sendGroupChangeEvent(Player player) {
    List<String> members = new LinkedList<String>(membersAndLastSeen.keySet());
    RPEvent event = new GroupChangeEvent(leader, members, lootmode);
    player.addEvent(event);
  }
View Full Code Here

   *
   * @param toRemove players to remove.
   */
  private void sendLeftGroupEvent(Set<String> toRemove) {
    StendhalRPRuleProcessor ruleProcessor = SingletonRepository.getRuleProcessor();
    RPEvent event = new GroupChangeEvent();
    for (String playerName : toRemove) {
      Player player = ruleProcessor.getPlayer(playerName);
      if (player != null) {
        player.addEvent(event);
      }
View Full Code Here

   * randomly picks a sound, sends a SoundEvent to the client
   * and sets the notifier up for the next sound.
   */
  public void onTurnReached(int currentTurn) {
    String sound = sounds[(int) (Math.random() * sounds.length)];
    RPEvent event = new SoundEvent(sound, radius, volume, SoundLayer.AMBIENT_SOUND);
    this.addEvent(event);
    this.notifyWorldAboutChanges();
    setupNotifier();
  }
View Full Code Here

TOP

Related Classes of marauroa.common.game.RPEvent

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.