primate
Member
How can I make these lines not use "OTSYS_TIME()", For the following code and be able to use "potions[] = {26031, 26030};" and runes at the same time.
Thanks for your time.
C++:
int32_t potions[] = {26031, 26030};
int16_t potionID = item->getID();
if(std::find(std::begin(potions), std::end(potions), potionID) == std::end(potions))
C++:
bool Actions::useItemEx(Player* player, const Position& fromPos, const Position& toPos,
uint8_t toStackPos, Item* item, bool isHotkey, Creature* creature/* = nullptr*/)
{
int32_t potions[] = {26031, 26030};
int16_t potionID = item->getID();
if(std::find(std::begin(potions), std::end(potions), potionID) == std::end(potions)) {
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;
}
Thanks for your time.