Core/Items: Implemented CreateTime item field and changed refund/soulbound trade timers to also count time offline

This commit is contained in:
Shauren
2024-04-12 00:18:20 +02:00
parent 8c274a8e8d
commit 69da702b93
10 changed files with 115 additions and 128 deletions

View File

@@ -0,0 +1,9 @@
ALTER TABLE `item_instance` ADD `createTime` bigint NOT NULL DEFAULT '0' AFTER `playedTime`;
UPDATE `item_instance` SET `createTime` = COALESCE(
(SELECT LEAST(c.`logout_time`, GREATEST(c.`createTime`, c.`logout_time` -
((c.`totaltime`-`playedTime`)
/ GREATEST(c.`totaltime`, 1)
* (c.`logout_time`-c.`createTime`)))) FROM `characters` c WHERE c.`guid`=`owner_guid`),
UNIX_TIMESTAMP()
);