Package games.stendhal.server.entity.player

Examples of games.stendhal.server.entity.player.Player


   * Tests for name.
   */
  @Test
  public void testname() throws Exception {
    ListRaids script = new ListRaids();
    Player player = PlayerTestHelper.createPlayer("george");
    script.execute(player, null);
    assertThat(player.events().get(0).toString(), containsString("CreateRaid"));
  }
View Full Code Here


        player.put("success", "true");
      }
    };
    final RPAction action = new RPAction();
    action.put("type", "action");
    final Player caster = PlayerTestHelper.createPlayer("player");
    CommandCenter.register("action", listener);
    assertFalse(caster.has("success"));
    CommandCenter.execute(caster, action);
    assertTrue(caster.has("success"));
  }
View Full Code Here

  @Test
  public void testExecuteUnknown() {
    final RPAction action = new RPAction();

    action.put("type", "");
    final Player caster = PlayerTestHelper.createPlayer("bob");
    CommandCenter.execute(caster, action);
    assertEquals("Unknown command . Please type /help to get a list.", caster.events().get(0).get("text"));
  }
View Full Code Here

  @Test
  public void testAddPlayer() {
    final MockStendhalRPRuleProcessor processor = MockStendhalRPRuleProcessor.get();
    assertThat(StendhalRPRuleProcessor.getAmountOfOnlinePlayers(), is(0));

    final Player bob = PlayerTestHelper.createPlayer("bob");
    processor.addPlayer(bob);
    assertThat(StendhalRPRuleProcessor.getAmountOfOnlinePlayers(), is(1));
    assertSame(bob, processor.getPlayer("bob"));
    final Player bob2 = PlayerTestHelper.createPlayer("bob");
    processor.addPlayer(bob2);
    assertThat(StendhalRPRuleProcessor.getAmountOfOnlinePlayers(), is(1));
    assertSame(bob2, processor.getPlayer("bob"));
    assertNotSame(bob, processor.getPlayer("bob"));
  }
View Full Code Here

    AlterQuestAction.register();
  }

  @Test
  public void alterQuestActionPerform() throws Exception {
    final Player bob = PlayerTestHelper.createPlayer("bob");
    final MockStendhalRPRuleProcessor rules = MockStendhalRPRuleProcessor.get();
    rules.addPlayer(bob);
    final RPAction action = new RPAction();
    action.put("type", "alterquest");
    action.put("target", "bob");
    action.put("name", "questname");
    action.put("state", "queststate");
    final AlterQuestAction aq = new AlterQuestAction();
    aq.perform(bob, action);
    assertTrue(bob.hasQuest("questname"));
    assertEquals("queststate", bob.getQuest("questname"));

  }
View Full Code Here

  }

  @Test
  public void alterQuestActionPerformTarget() throws Exception {

    final Player bob = PlayerTestHelper.createPlayer("bob");
    final Player james = PlayerTestHelper.createPlayer("james");
    final MockStendhalRPRuleProcessor rules = MockStendhalRPRuleProcessor.get();
    rules.addPlayer(james);
    final RPAction action = new RPAction();
    action.put("type", "alterquest");
    action.put("target", "james");
    action.put("name", "questname");
    action.put("state", "queststate");
    final AlterQuestAction aq = new AlterQuestAction();
    aq.perform(bob, action);
    assertTrue(james.hasQuest("questname"));
    assertEquals("queststate", james.getQuest("questname"));
  }
View Full Code Here

    assertEquals("queststate", james.getQuest("questname"));
  }

  @Test
  public void alterQuestActionPerformthroughCommandcenter() throws Exception {
    final Player pl = PlayerTestHelper.createPlayer("player");
    final Player bob = PlayerTestHelper.createPlayer("bob");
    MockStendhalRPRuleProcessor.get().addPlayer(pl);
    MockStendhalRPRuleProcessor.get().addPlayer(bob);

    pl.put("adminlevel", 5000);

    RPAction action = new RPAction();
    action.put("type", "alterquest");
    action.put("target", "bob");
    action.put("name", "questname");
    action.put("state", "queststate");
    CommandCenter.execute(pl, action);
    assertTrue(bob.hasQuest("questname"));
    assertEquals("queststate", bob.getQuest("questname"));
    action = new RPAction();
    action.put("type", "alterquest");
    action.put("target", "bob");
    action.put("name", "questname");
   
    CommandCenter.execute(pl, action);
    assertFalse(bob.hasQuest("questname"));
 
  }
View Full Code Here

    assertFalse(bob.hasQuest("questname"));
 
  }
  @Test
  public void alterQuestActionCastersLeveltoLow() throws Exception {
    final Player pl = PlayerTestHelper.createPlayer("player");
    final Player bob = PlayerTestHelper.createPlayer("bob");
    MockStendhalRPRuleProcessor.get().addPlayer(pl);
    MockStendhalRPRuleProcessor.get().addPlayer(bob);

    pl.put("adminlevel", 0);

    final RPAction action = new RPAction();
    action.put("type", "alterquest");
    action.put("target", "bob");
    action.put("name", "questname");
    action.put("state", "queststate");
    CommandCenter.execute(pl, action);
    assertFalse(bob.hasQuest("questname"));
  }
View Full Code Here

  /**
   * Tests for getHintGetHistory.
   */
  @Test
  public final void testGetHintGetHistory() {
    final Player pl = PlayerTestHelper.createPlayer("player");
    pl.setQuest(QUESTSlotSTRING, null);
    final AbstractQuest quest = new Mockquest();
    assertTrue(quest.getHint(pl).isEmpty());
    assertTrue(quest.getHistory(pl).isEmpty());
  }
View Full Code Here

  /**
   * Tests for getLevel.
   */
  @Test
  public final void testGetMinLevel() {
    final Player pl = PlayerTestHelper.createPlayer("player");
    pl.setQuest(QUESTSlotSTRING, null);
    final AbstractQuest quest = new Mockquest();
    assertTrue(quest.getMinLevel()==0);
  }
View Full Code Here

TOP

Related Classes of games.stendhal.server.entity.player.Player

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.