Package games.stendhal.server.entity.item

Examples of games.stendhal.server.entity.item.StackableItem


            if (timeRemaining > 0L) {
              npc.say("Welcome. I'm still working on your request to fuse mithril thread"
                  + " for you. Come back in "
                  + TimeUtil.approxTimeUntil((int) (timeRemaining / 1000L)) + ".");
            } else {
              final StackableItem products = (StackableItem) SingletonRepository.
                    getEntityManager().getItem("mithril thread");
 
              products.setQuantity(40);
           
              products.setBoundTo(player.getName());
              player.equipOrPutOnGround(products);
              npc.say("Hello again. The magic is completed. Here you have your 40 spools of mithril thread. Now, you must go to #Whiggins to get the #fabric made.");
              player.setQuest(mithrilcloak.getQuestSlot(), "got_mithril_thread");
              // give some XP as a little bonus for industrious workers
              player.addXP(100);
View Full Code Here


    reward.add(new ChatAction() {
      public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
        // pick a random flower
        String rewardClass = Rand.rand(Arrays.asList("daisies","zantedeschia","pansy"));
       
        final StackableItem reward = (StackableItem) SingletonRepository.getEntityManager().getItem(rewardClass);
        reward.setQuantity(1);
        player.equipOrPutOnGround(reward);
        player.notifyWorldAboutChanges();
      }
    });
    reward.add(new IncreaseXPAction(500));
    reward.add(new SetQuestAction(QUEST_SLOT, "eating;"));
    reward.add(new SetQuestToTimeStampAction(QUEST_SLOT,1));
    reward.add(new IncreaseKarmaAction(10.0));
           
    npc.add(ConversationStates.QUESTION_1,
        ConversationPhrases.YES_MESSAGES,
        new PlayerHasItemWithHimCondition("chocolate bar"),
        ConversationStates.ATTENDING,
View Full Code Here

        // player killed more then needed soldiers
        speakerNPC.say("Pretty good! You killed "+(killed-killsnumber)+" extra "+
            Grammar.plnoun(killed-killsnumber, "soldier")+"! Take these " + moneyreward + " coins, and remember, I may wish you to do this job again in one week!");
      }
      int karmabonus = 5*(2*killed/(killsnumber)-1);
      final StackableItem money = (StackableItem)
          SingletonRepository.getEntityManager().getItem("money");
      money.setQuantity(moneyreward);

      player.equipOrPutOnGround(money);
      player.addKarma(karmabonus);
   
    }
View Full Code Here

            }
          }
          if (iouNote != null) {
            raiser.say("Where did you get that from? Anyways, here is the money *sighs*");
            player.drop(iouNote);
            final StackableItem money = (StackableItem) SingletonRepository.getEntityManager().getItem(
                "money");
            money.setQuantity(250);
            player.equipToInventoryOnly(money);
            player.setQuest(QUEST_SLOT, "done");
            raiser.setCurrentState(ConversationStates.ATTENDING);
          } else {
            raiser.say("I can't see that you got a valid IOU with my signature!");
View Full Code Here

          rewardClass = "meat";
        } else {
          rewardClass = "ham";
        }
        npc.say("Thank you! Here, take some " + rewardClass + "!");
        final StackableItem reward = (StackableItem) SingletonRepository.getEntityManager().getItem(rewardClass);
        reward.setQuantity(REQUIRED_WOOD);
        player.equipOrPutOnGround(reward);
        player.notifyWorldAboutChanges();
      }
    });
   
View Full Code Here

  }

  @Override
  public Item getAskedItem(final String askedItem) {
    final String[] tokens = askedItem.split(" ");
    final StackableItem item = (StackableItem) SingletonRepository.getEntityManager().getItem(tokens[1]);
    item.setInfoString(tokens[0]);
    return item;
  }
View Full Code Here

      if (checkBoard() && (moveCount <= MAX_MOVES)) {
        if (player.isQuestCompleted(QUEST_SLOT)) {
          npc.say("Congratulations, you solved the quiz again. But unfortunately I don't have any further rewards for you.");
        } else {
          npc.say("Congratulations, you solved the quiz.");
          final StackableItem money = (StackableItem) SingletonRepository.getEntityManager().getItem(
                  "money");
          money.setQuantity(50);
          player.equipToInventoryOnly(money);
          player.addXP(100);
        }
        player.setQuest(QUEST_SLOT, "done");
      } else {
View Full Code Here

    final SpeakerNPC npc = npcs.get("Andy");
   
    ChatAction addRandomNumberOfItemsAction = new ChatAction() {
      public void fire(final Player player, final Sentence sentence, final EventRaiser npc) {
        //add random number of soups
        final StackableItem soup = (StackableItem) SingletonRepository.getEntityManager()
            .getItem("soup");
        int amount;
        // between 1 and 5 soup
        amount = Rand.rand(4) + 1;
        soup.setQuantity(amount);
        player.equipOrPutOnGround(soup);
      }
    };

    final List<ChatAction> actions = new LinkedList<ChatAction>();
View Full Code Here

   * @param clazz
   * @param amount
   * @return success flag
   */
  public static boolean equipWithStackableItem(final Player player, final String clazz, final int amount) {
    final StackableItem item = (StackableItem) SingletonRepository.getEntityManager().getItem(clazz);
    item.setQuantity(amount);

    return player.equipToInventoryOnly(item);
  }
View Full Code Here

   *
   * @param player The player to remove the projectile from
   */
  private static void useMissile(Player player) {
    // Get the projectile that will be thrown/shot.
    StackableItem projectilesItem = null;
    if (player.getRangeWeapon() != null) {
      projectilesItem = player.getAmmunition();
    }
    if (projectilesItem == null) {
      // no arrows... but maybe a spear?
      projectilesItem = player.getMissileIfNotHoldingOtherWeapon();
    }
    // Creatures can attack without having projectiles, but players
    // will lose a projectile for each shot.
    if (projectilesItem != null) {
      projectilesItem.removeOne();
    }
  }
View Full Code Here

TOP

Related Classes of games.stendhal.server.entity.item.StackableItem

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.