Example #1
0
void Player::applyAction() {
  vector<Item*> items = chooseItem("Choose an item to apply:", [this](const Item* item) {
      return creature->applyItem(const_cast<Item*>(item));}, UserInput::APPLY_ITEM);
  if (items.size() == 0)
    return;
  applyItem(items);
}
Example #2
0
void Player::applyAction() {
  if (!creature->isHumanoid())
    return;
  if (creature->numGoodArms() == 0) {
    privateMessage("You don't have hands!");
    return;
  }
  vector<Item*> items = chooseItem("Choose an item to apply:", [this](const Item* item) {
      return creature->canApplyItem(item);}, ActionId::APPLY_ITEM);
  if (items.size() == 0)
    return;
  applyItem(items);
}
Example #3
0
void Player::displayInventory() {
  if (!creature->isHumanoid()) {
    model->getView()->presentText("", "You can't use inventory.");
    return;
  }
  if (creature->getEquipment().isEmpty()) {
    model->getView()->presentText("", "Your inventory is empty.");
    return;
  }
  vector<Item*> item = chooseItem("Inventory:", alwaysTrue<const Item*>(), ActionId::SHOW_INVENTORY);
  if (item.size() == 0) {
    return;
  }
  vector<View::ListElem> options;
  if (creature->canEquip(item[0], nullptr)) {
    options.push_back("equip");
  }
  if (creature->canApplyItem(item[0])) {
    options.push_back("apply");
  }
  if (creature->canUnequip(item[0], nullptr))
    options.push_back("remove");
  else {
    options.push_back("throw");
    options.push_back("drop");
  }
  auto index = model->getView()->chooseFromList("What to do with " + getPluralName(item[0], item.size()) + "?", options);
  if (!index) {
    displayInventory();
    return;
  }
  if (options[*index].getText() == "drop") {
    creature->privateMessage("You drop " + getPluralName(item[0], item.size()));
    creature->drop(item);
  }
  if (options[*index].getText() == "throw") {
    throwItem(item);
  }
  if (options[*index].getText() == "apply") {
    applyItem(item);
  }
  if (options[*index].getText() == "remove") {
    creature->privateMessage("You remove " + getPluralName(item[0], item.size()));
    creature->unequip(getOnlyElement(item));
  }
  if (options[*index].getText() == "equip") {
    creature->privateMessage("You equip " + getPluralName(item[0], item.size()));
    creature->equip(item[0]);
  }
}
Example #4
0
void Configurator::setPropertiesPanel()
{
    k->settingsPanel = new Settings(this);

    connect(k->settingsPanel, SIGNAL(startingPointChanged(int)), this, SIGNAL(startingPointChanged(int)));
    connect(k->settingsPanel, SIGNAL(clickedSelect()), this, SIGNAL(clickedSelect()));
    connect(k->settingsPanel, SIGNAL(clickedDefineProperties()), this, SIGNAL(clickedDefineProperties()));
    connect(k->settingsPanel, SIGNAL(clickedApplyTween()), this, SLOT(applyItem()));
    connect(k->settingsPanel, SIGNAL(clickedResetTween()), this, SLOT(closeTweenProperties()));

    k->settingsLayout->addWidget(k->settingsPanel);

    activePropertiesPanel(false);
}
Example #5
0
void Configurator::setTweenerPanel()
{
    k->tweenList = new TweenerPanel(this);

    connect(k->tweenList, SIGNAL(clickedSelect()), this, SIGNAL(clickedSelect()));
    connect(k->tweenList, SIGNAL(clickedTweenProperties()), this, SIGNAL(clickedTweenProperties()));
    connect(k->tweenList, SIGNAL(clickedApplyTween()), this, SLOT(applyItem()));

    connect(k->tweenList, SIGNAL(tweenPropertiesActivated(TweenerPanel::TweenerType)), 
            this, SIGNAL(tweenPropertiesActivated(TweenerPanel::TweenerType)));

    connect(k->tweenList, SIGNAL(startingPointChanged(int)), 
            this, SIGNAL(startingPointChanged(int)));

    connect(k->tweenList, SIGNAL(clickedResetTween()), this, SLOT(closeTweenList()));
    connect(k->tweenList, SIGNAL(loadPath(bool, bool)), this, SIGNAL(loadPath(bool, bool)));

    k->settingsLayout->addWidget(k->tweenList);
    activeTweenerPanel(false);
}