Fortera Global
Intermediate OT User
- Joined
- Nov 20, 2015
- Messages
- 1,181
- Solutions
- 2
- Reaction score
- 117
This code dont store items in reward chest if you have an item that is there for 7 days or more, however it is don't storing all the others new items as well.
It was for him to just not store the old items and save the new ones. does anyone know how to fix it?
tfs 1.2
It was for him to just not store the old items and save the new ones. does anyone know how to fix it?
tfs 1.2
C++:
if (!rewardList.empty()) {
DBInsert rewardQuery("INSERT INTO `player_rewards` (`player_id`, `pid`, `sid`, `itemtype`, `count`, `attributes`) VALUES ");
itemList.clear();
int running = 0;
for (const auto& rewardId : rewardList) {
Reward* reward = player->getReward(rewardId, false);
// rewards that are empty or older than 7 days aren't stored
if (!reward->empty() && (time(nullptr) - rewardId <= 60 * 60 * 24 * 7)) {
itemList.emplace_back(++running, reward);
}
}
if (!saveItems(player, itemList, rewardQuery, propWriteStream)) {
return false;
}
}