Examples of ItemCollection


Examples of games.stendhal.server.util.ItemCollection

   *
   * @param player The player doing the quest
   * @return A list of item names
   */
  private ItemCollection getMissingItems(final Player player) {
    final ItemCollection missingItems = new ItemCollection();

    missingItems.addFromQuestStateString(player.getQuest(questname));

    return missingItems;
  }
View Full Code Here

Examples of games.stendhal.server.util.ItemCollection

    this.toExecuteOnCompletion = completionAction;
    this.stateAfterCompletion = stateAfterCompletion;
  }
 
  public void fire(final Player player, final Sentence sentence, final EventRaiser raiser) {
    ItemCollection missingItems = getMissingItems(player);
    final Integer missingCount = missingItems.get(itemName);

    if ((missingCount != null) && (missingCount > 0)) {
      if (dropItems(player, itemName, missingCount)) {
        missingItems = getMissingItems(player);

        if (missingItems.size() > 0) {
          raiser.say(questionForMore);
        } else {
          toExecuteOnCompletion.fire(player, sentence, raiser);
          raiser.setCurrentState(this.stateAfterCompletion);
        }
View Full Code Here

Examples of games.stendhal.server.util.ItemCollection

   */
  boolean dropItems(final Player player, final String itemName, int itemCount) {
    boolean result = false;

    // parse the quest state into a list of still missing items
    final ItemCollection itemsTodo = new ItemCollection();

    itemsTodo.addFromQuestStateString(player.getQuest(questSlot));

    if (player.drop(itemName, itemCount)) {
      if (itemsTodo.removeItem(itemName, itemCount)) {
        result = true;
      }
    } else {
      /*
       * handle the cases the player has part of the items or all divided
       * in different slots
       */
      final List<Item> items = player.getAllEquipped(itemName);
      if (items != null) {
        for (final Item item : items) {
          final int quantity = item.getQuantity();
          final int n = Math.min(itemCount, quantity);

          if (player.drop(itemName, n)) {
            itemCount -= n;

            if (itemsTodo.removeItem(itemName, n)) {
              result = true;
            }
          }

          if (itemCount == 0) {
            result = true;
            break;
          }
        }
      }
    }

     // update the quest state if some items are handed over
    if (result) {
      player.setQuest(questSlot, itemsTodo.toStringForQuestState());
    }

    return result;
  }
View Full Code Here

Examples of games.stendhal.server.util.ItemCollection

   *
   * @param player The player doing the quest
   * @return A list of item names
   */
  ItemCollection getMissingItems(final Player player) {
    final ItemCollection missingItems = new ItemCollection();

    missingItems.addFromQuestStateString(player.getQuest(questSlot));

    return missingItems;
  }
View Full Code Here

Examples of org.apache.tuscany.sca.data.collection.ItemCollection

        Entry<String, Item>[] nodeEntries = cloudCollection.getAll();

        // Dispatch to the hosts hosting these nodes
        List<Entry<String, Item>> entries = new ArrayList<Entry<String,Item>>();
        for (String host: hosts(nodeEntries)) {
            ItemCollection processCollection = processCollection(host);
            for (Entry<String, Item> remoteEntry: processCollection.getAll()) {
                entries.add(remoteEntry);
            }
            break;
        }
       
View Full Code Here

Examples of org.apache.tuscany.sca.data.collection.ItemCollection

       
        // Get the host hosting the given node
        String host = host(key);
       
        // Dispatch the request to that host
        ItemCollection processCollection = processCollection(host);
        return processCollection.get(key);
    }
View Full Code Here

Examples of org.apache.tuscany.sca.data.collection.ItemCollection

        } catch (NotFoundException e) {
            throw new ServiceRuntimeException(e);
        }
       
        // Dispatch the request to that host
        ItemCollection processCollection = processCollection(host);
        return processCollection.post(key, item);
    }
View Full Code Here

Examples of org.apache.tuscany.sca.data.collection.ItemCollection

       
        // Get the host hosting the given node
        String host = host(key);
       
        // Dispatch the request to that host
        ItemCollection processCollection = processCollection(host);
        processCollection.delete(key);
    }
View Full Code Here

Examples of org.apache.tuscany.sca.data.collection.ItemCollection

            } catch (NotFoundException e) {
                return new Entry[0];
            }
           
            // Dispatch the request to that host
            ItemCollection processCollection = processCollection(host);
            return processCollection.query(queryString);
           
        } else {
            throw new UnsupportedOperationException();
        }
    }
View Full Code Here

Examples of org.apache.tuscany.sca.data.collection.ItemCollection

        Entry<String, Item>[] nodeEntries = cloudCollection.getAll();

        // Dispatch to the hosts hosting these nodes
        List<Entry<String, Item>> entries = new ArrayList<Entry<String,Item>>();
        for (String host: hosts(nodeEntries)) {
            ItemCollection processCollection = processCollection(host);
            for (Entry<String, Item> remoteEntry: processCollection.getAll()) {
                entries.add(remoteEntry);
            }
            break;
        }
       
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.