Package games.stendhal.server.entity

Examples of games.stendhal.server.entity.Outfit


* Is the player naked? (e. g. not wearing anything on his/her body)
*/
public class NakedCondition implements ChatCondition {

  public boolean fire(final Player player, final Sentence sentence, final Entity entity) {
    final Outfit outfit = player.getOutfit();
    return outfit.isNaked();
  }
View Full Code Here


  }

 
 
  public boolean fire(final Player player, final Sentence sentence, final Entity npc) {
    final Outfit players_outfit = player.getOutfit();
    return this.outfit_to_check.isPartOf(players_outfit);
  }
View Full Code Here

    return santa;
  }

  private void addHat(final Player player) {
    // fetch old outfit as we want to know the current hair
    final Outfit oldoutfit = player.getOutfit();
    // all santa hat sprites are at 50 + current hair
    if (oldoutfit.getHair() < 50) {
      final int hatnumber = oldoutfit.getHair() + 50;
      // the new outfit only changes the hair, rest is null
      final Outfit newOutfit = new Outfit(null, hatnumber, null, null, null);
      //put it on, and store old outfit.
      player.setOutfit(newOutfit.putOver(oldoutfit), true);
    }
  }
View Full Code Here

  }


  public void onLoggedIn(final Player player) {
    // is it Christmas?
    final Outfit outfit = player.getOutfit();
    final int hairnumber = outfit.getHair();
    if ((hairnumber >= 50) && (hairnumber < 94)) {
      final Date now = new Date();
      final Date dateNotXmas = notXmas.getTime();
      if (now.after(dateNotXmas)) {
        final int newhair = hairnumber - 50;
        final Outfit newOutfit = new Outfit(null, newhair, null, null, null);
        player.setOutfit(newOutfit.putOver(outfit), false);
      }
    }
  }
View Full Code Here

   *            The player.
   * @param outfitType the outfit to wear
   */
  public void putOnOutfit(final Player player, final String outfitType) {
    final List<Outfit> possibleNewOutfits = outfitTypes.get(outfitType);
    final Outfit newOutfit = Rand.rand(possibleNewOutfits);
    player.setOutfit(newOutfit.putOver(player.getOutfit()), true);

    if (endurance != NEVER_WEARS_OFF) {
      // restart the wear-off timer if the player was still wearing
      // another temporary outfit.
      SingletonRepository.getTurnNotifier().dontNotify(new OutwearClothes(player));
View Full Code Here

   * @param player
   *            The player.
   * @return true iff the player wears an outfit from here.
   */
  public boolean wearsOutfitFromHere(final Player player) {
    final Outfit currentOutfit = player.getOutfit();

    for (final String outfitType : priceCalculator.dealtItems()) {
      final List<Outfit> possibleOutfits = outfitTypes.get(outfitType);
      for (final Outfit possibleOutfit : possibleOutfits) {
        if (possibleOutfit.isPartOf(currentOutfit)) {
View Full Code Here

  }

  public static Player createPlayerWithOutFit(final String name) {
    final Player player = createPlayer(name);

    player.setOutfit(new Outfit(0, 1, 1, 1, 1));

    return player;
  }
View Full Code Here

   * @param player whose outfit is to be changed. Must not be <code>null</code>.
   * @param action the action containing the outfit info in the attribute 'value'. Must not be <code>null</code>.
   */
  public void onAction(final Player player, final RPAction action) {
    if (action.has(VALUE)) {
      final Outfit outfit = new Outfit(action.getInt(VALUE));
      if (outfit.isChoosableByPlayers()) {
        new GameEvent(player.getName(), OUTFIT, action.get(VALUE)).raise();
        player.setOutfit(outfit, false);
      }
    }
  }
View Full Code Here

        object.put("hp", "100");
      }

      // Port from 0.13 to 0.20
      if (!object.has("outfit")) {
        object.put("outfit", new Outfit().getCode());
      }

      // create slots if they do not exist yet:

      // Port from 0.20 to 0.30: bag, rhand, lhand, armor, head, legs, feet
View Full Code Here

   * Tests for fire.
   */
  @Test
  public final void testFire() {
    final Player bob = PlayerTestHelper.createPlayer("player");
    bob.setOutfit(new Outfit(0));
    assertTrue(bob.getOutfit().isNaked());
    assertTrue(new NakedCondition().fire(bob, null, null));
    bob.setOutfit(new Outfit(100));
    assertFalse("finally dressed", bob.getOutfit().isNaked());
    assertFalse("should be false when dressed", new NakedCondition().fire(
        bob, null, null));

  }
View Full Code Here

TOP

Related Classes of games.stendhal.server.entity.Outfit

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.