finish quest log and fix bug that expiring storage does not fit in int32 so changed to store time in minutes instead of ms

This commit is contained in:
ErikasKontenis
2020-03-01 15:26:02 +02:00
parent 384bbc0c5c
commit 6b76e8db9f
15 changed files with 41 additions and 160 deletions

View File

@@ -973,7 +973,7 @@ void BehaviourDatabase::checkAction(const NpcBehaviourAction* action, Player* pl
case BEHAVIOUR_TYPE_EXPIRINGQUESTVALUE: {
int32_t questNumber = evaluate(action->expression, player, message);
int32_t ticks = evaluate(action->expression2, player, message);
player->addStorageValue(questNumber, OTSYS_TIME() + ticks);
player->addStorageValue(questNumber, OTSYS_TIME_MINUTES() + (ticks / 60 / 1000));
break;
}
case BEHAVIOUR_TYPE_ADDOUTFITADDON: {
@@ -1201,7 +1201,7 @@ int32_t BehaviourDatabase::evaluate(NpcBehaviourNode* node, Player* player, cons
int32_t questNumber = evaluate(node->left, player, message);
int32_t questValue;
player->getStorageValue(questNumber, questValue);
return questValue - OTSYS_TIME();
return questValue - OTSYS_TIME_MINUTES();
}
case BEHAVIOUR_TYPE_MESSAGE_COUNT: {
int32_t value = searchDigit(message);

View File

@@ -108,4 +108,9 @@ inline int64_t OTSYS_TIME()
return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
}
inline int32_t OTSYS_TIME_MINUTES()
{
return std::chrono::duration_cast<std::chrono::minutes>(std::chrono::system_clock::now().time_since_epoch()).count();
}
#endif