Manigold
Active Member
- Joined
- Nov 2, 2017
- Messages
- 197
- Solutions
- 8
- Reaction score
- 47
I'm having a problem when i use fluids on hotkeys (manafluid,lifefluid etc).
i always receive the count of vials , not the fluids inside vials ,i want to show the count of manafluids or other fluids inside the vials .
(manafluid id 2006,7)
ex:
here's the showUseHotkeyMessage part on the actions.cpp
i always receive the count of vials , not the fluids inside vials ,i want to show the count of manafluids or other fluids inside the vials .
(manafluid id 2006,7)
ex:
here's the showUseHotkeyMessage part on the actions.cpp
C++:
bool Actions::useItem(Player* player, const Position& pos, uint8_t index, Item* item, bool isHotkey)
{
player->setNextAction(OTSYS_TIME() + g_config.getNumber(ConfigManager::ACTIONS_DELAY_INTERVAL));
//player->stopWalk();
if (isHotkey) {
showUseHotkeyMessage(player, item, player->getItemTypeCount(item->getID(), -1));
}
ReturnValue ret = internalUseItem(player, pos, index, item, isHotkey);
if (ret != RETURNVALUE_NOERROR) {
player->sendCancelMessage(ret);
return false;
}
return true;
}
bool Actions::useItemEx(Player* player, const Position& fromPos, const Position& toPos,
uint8_t toStackPos, Item* item, bool isHotkey, Creature* creature/* = nullptr*/)
{
player->setNextAction(OTSYS_TIME() + g_config.getNumber(ConfigManager::EX_ACTIONS_DELAY_INTERVAL));
//player->stopWalk();
Action* action = getAction(item);
if (!action) {
player->sendCancelMessage(RETURNVALUE_CANNOTUSETHISOBJECT);
return false;
}
ReturnValue ret = action->canExecuteAction(player, toPos);
if (ret != RETURNVALUE_NOERROR) {
player->sendCancelMessage(ret);
return false;
}
if (isHotkey) {
showUseHotkeyMessage(player, item, player->getItemTypeCount(item->getID(), -1));
}
if (!action->executeUse(player, item, fromPos, action->getTarget(player, creature, toPos, toStackPos), toPos, isHotkey)) {
if (!action->hasOwnErrorHandler()) {
player->sendCancelMessage(RETURNVALUE_CANNOTUSETHISOBJECT);
}
return false;
}
return true;
}
void Actions::showUseHotkeyMessage(Player* player, const Item* item, uint32_t count)
{
std::ostringstream ss;
const ItemType& it = Item::items[item->getID()];
if (!it.showCount) {
ss << "Using one of " << item->getName() << "...";
} else if (count == 1) {
ss << "Using the last " << item->getName() << "...";
} else {
ss << "Using one of " << count << ' ' << item->getPluralName() << "...";
}
player->sendTextMessage(MESSAGE_INFO_DESCR, ss.str());
}
Last edited: