Package games.stendhal.server.entity.mapstuff.portal

Examples of games.stendhal.server.entity.mapstuff.portal.HousePortal


    destination.setIdentifier("dest");
    SingletonRepository.getRPWorld().getRPZone(ZONE_NAME).add(destination);
    chest = new StoredChest();
    SingletonRepository.getRPWorld().getRPZone(ZONE_NAME).add(chest);
   
    housePortal = new HousePortal("ados house 50");
    housePortal.setIdentifier("keep rpzone happy");
    housePortal.setDestination(ZONE_NAME, "dest");
    SingletonRepository.getRPWorld().getRPZone("0_ados_city").add(housePortal);
    HouseUtilities.clearCache();
View Full Code Here


      player.sendPrivateText("Hmm, that's not something you can knock on effectively.");
      return;
    }

    if (player.nextTo(entity)) {
      final HousePortal houseportal = (HousePortal) entity;
      knock(player, houseportal);
    } else {
      player.sendPrivateText("You can't reach to knock from here.");
    }
  }
View Full Code Here

import games.stendhal.server.entity.mapstuff.portal.HousePortal;
import marauroa.common.game.RPObject;

public class HousePortalTransformer implements Transformer {
  public RPObject transform(final RPObject object) {
    return new HousePortal(object);
  }
View Full Code Here

    chest = new StoredChest();
    SingletonRepository.getRPWorld().getRPZone(ZONE_NAME).add(chest);

    for (String zone : CITY_ZONES) {
      assertNotNull(zone);
      HousePortal portal = new HousePortal("athor apartment 101");
      portals.add(portal);
      portal.setDestination(ZONE_NAME, "dest");
      portal.setIdentifier("keep rpzone happy");
      SingletonRepository.getRPWorld().getRPZone(zone).add(portal);
    }

    en.step(player, "101");
    assertEquals("Congratulations, here is your key to athor apartment 101! Make sure you change the locks if you ever lose it. Do you want to buy a spare key, at a price of 1000 money?", getReply(npc));
View Full Code Here

   *
   * @param player the player to be checked
   * @return number of periods
   */
  protected int getUnpaidTaxPeriods(final Player player) {
    final HousePortal portal = HouseUtilities.getPlayersHouse(player);
    int payments = 0;

    if (portal != null) {
      payments = getUnpaidTaxPeriods(portal);
    }
View Full Code Here

    final int timeDiffSeconds = (int) ((System.currentTimeMillis() - portal.getExpireTime()) / 1000);
    return Math.max(0, timeDiffSeconds / TAX_PAYMENT_PERIOD);
  }

  private void setTaxesPaid(final Player player, final int periods) {
    final HousePortal portal = HouseUtilities.getPlayersHouse(player);
    logger.debug("set portal expire time to " + portal.getExpireTime() + " plus " + ((long) periods * (long) TAX_PAYMENT_PERIOD * 1000));
    portal.setExpireTime(portal.getExpireTime() ((long) periods * (long) TAX_PAYMENT_PERIOD * 1000));
  }
 
View Full Code Here

    final int number = sentence.getNumeral().getAmount();
    // now check if the house they said is free
    final String itemName = Integer.toString(number);

    final HousePortal houseportal = HouseUtilities.getHousePortal(number);

    if (houseportal == null) {
      // something bad happened
      raiser.say("Sorry I did not understand you, could you try saying the house number you want again please?");
      raiser.setCurrentState(ConversationStates.QUEST_OFFERED);
      return;
    }

    final String owner = houseportal.getOwner();
    if (owner.length() == 0) {
     
      // it's available, so take money
      if (player.isEquipped("money", cost)) {
        final Item key = SingletonRepository.getEntityManager().getItem(
                                        "house key");

        final String doorId = houseportal.getDoorId();

        final int locknumber = houseportal.getLockNumber();
        ((HouseKey) key).setup(doorId, locknumber, player.getName());
     
        if (player.equipToInventoryOnly(key)) {
          raiser.say("Congratulations, here is your key to " + doorId
                 + "! Make sure you change the locks if you ever lose it. Do you want to buy a spare key, at a price of "
                 + HouseChatAction.COST_OF_SPARE_KEY + " money?");
         
          player.drop("money", cost);
          // remember what house they own
          player.setQuest(questslot, itemName);

          // put nice things and a helpful note in the chest
          BuyHouseChatAction.fillChest(HouseUtilities.findChest(houseportal), houseportal.getDoorId());

          // set the time so that the taxman can start harassing the player
          final long time = System.currentTimeMillis();
          houseportal.setExpireTime(time);

          houseportal.setOwner(player.getName());
          raiser.setCurrentState(ConversationStates.QUESTION_1);
        } else {
          raiser.say("Sorry, you can't carry more keys!");
        }
     
View Full Code Here

      final String housenumber = player.getQuest(questslot);
      final Item key = SingletonRepository.getEntityManager().getItem(
                                      "house key");
      final int number = MathHelper.parseInt(housenumber);
      final HousePortal houseportal = HouseUtilities.getHousePortal(number);

      if (houseportal == null) {
        // something bad happened
        raiser.say("Sorry something bad happened. I'm terribly embarassed.");
        return;
      }
     
      final int locknumber = houseportal.getLockNumber();
      final String doorId = houseportal.getDoorId();
      ((HouseKey) key).setup(doorId, locknumber, player.getName());

      if (player.equipToInventoryOnly(key)) {
        player.drop("money", HouseChatAction.COST_OF_SPARE_KEY);
        raiser.say("Here you go, a spare key to your house. Please remember, only give spare keys to people you #really, #really, trust! Anyone with a spare key can access your chest, and tell anyone that you give a key to, to let you know if they lose it. If that happens, you should #change your locks.");
View Full Code Here

    if (player.hasQuest(HOUSE_QUEST_SLOT)) {
      final String claimedHouse = player.getQuest(HOUSE_QUEST_SLOT);
   
      try {
        final int id = Integer.parseInt(claimedHouse);
        final HousePortal portal = getHousePortal(id);
       
        if (portal != null) {
          if (player.getName().equals(portal.getOwner())) {
            return portal;
          }
        } else {
          logger.error("Player " + player.getName() + " claims to own a nonexistent house " + id);
        }
View Full Code Here

      // we need to find out which this houseportal is so we can change lock
      final String claimedHouse = player.getQuest(questslot);
     
      try {
        final int id = Integer.parseInt(claimedHouse);
        final HousePortal portal = HouseUtilities.getHousePortal(id);
        // change the lock
        portal.changeLock();
        // make a new key for the player, with the new locknumber
        final String doorId = portal.getDoorId();
        final Item key = SingletonRepository.getEntityManager().getItem("house key");
        final int locknumber = portal.getLockNumber();

        ((HouseKey) key).setup(doorId, locknumber, player.getName());
        if (player.equipToInventoryOnly(key)) {
          player.drop("money", HouseChatAction.COST_OF_SPARE_KEY);
          raiser.say("The locks have been changed for " + doorId + ", here is your new key. Do you want to buy a spare key, at a price of "
View Full Code Here

TOP

Related Classes of games.stendhal.server.entity.mapstuff.portal.HousePortal

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.