Skip to content
This repository has been archived by the owner on May 20, 2023. It is now read-only.

Fixed market offers duplication money #797

Merged
merged 2 commits into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion data/migrations/20.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
function onUpdateDatabase()
return false -- true = There are others migrations file | false = this is the last migration file
Spdlog.info("Updating database to version 21 (Fix market price size)")
db.query("ALTER TABLE `market_history` CHANGE `price` `price` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0';")
db.query("ALTER TABLE `market_offers` CHANGE `price` `price` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0';")
return true
end
3 changes: 3 additions & 0 deletions data/migrations/21.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function onUpdateDatabase()
return false -- true = There are others migrations file | false = this is the last migration file
end
2 changes: 1 addition & 1 deletion data/monster/quests/dark_trails/death_priest_shargon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ monster.flags = {
}

monster.events = {
"DeathPriestShargonDeath"
"ShargonKill"
}

monster.light = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
local config = {
teleportId = 1949,
teleportPosition = {x = 33487, y = 32101, z = 9},
destinationPosition = Position(33489, 32088, 9),
storageKey = Storage.DarkTrails.Mission18,
getStorageValue = 1,
setStorageValue = 2
}

local function removeTeleport(position)
local teleportItem = Tile({x = 33487, y = 32101, z = 9}):getItemById(1949)
local teleportItem = Tile(config.teleportPosition):getItemById(config.teleportId)
if teleportItem then
teleportItem:remove()
position:sendMagicEffect(CONST_ME_POFF)
Expand All @@ -14,12 +23,14 @@ function deathPriestShargon.onKill(creature, target)

local position = target:getPosition()
position:sendMagicEffect(CONST_ME_TELEPORT)
local item = Game.createItem(1949, 1, {x = 33487, y = 32101, z = 9})
local item = Game.createItem(config.teleportId, 1, config.teleportPosition)
if item:isTeleport() then
item:setDestination(Position(33489,32088,9))
item:setDestination(config.destinationPosition)
end
if creature:getStorageValue(Storage.DarkTrails.Mission18) < 1 then
creature:setStorageValue(Storage.DarkTrails.Mission18, 1)
if config.storageKey ~= nil then
if creature:getStorageValue(config.storageKey) < config.getStorageValue then
creature:setStorageValue(config.storageKey, config.setStorageValue)
end
end
addEvent(removeTeleport, 5 * 60 * 1000, position)
return true
Expand Down
6 changes: 3 additions & 3 deletions schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ CREATE TABLE IF NOT EXISTS `server_config` (
CONSTRAINT `server_config_pk` PRIMARY KEY (`config`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

INSERT INTO `server_config` (`config`, `value`) VALUES ('db_version', '20'), ('motd_hash', ''), ('motd_num', '0'), ('players_record', '0');
INSERT INTO `server_config` (`config`, `value`) VALUES ('db_version', '21'), ('motd_hash', ''), ('motd_num', '0'), ('players_record', '0');

-- --------------------------------------------------------

Expand Down Expand Up @@ -524,7 +524,7 @@ CREATE TABLE IF NOT EXISTS `market_history` (
`sale` tinyint(1) NOT NULL DEFAULT '0',
`itemtype` int(10) UNSIGNED NOT NULL,
`amount` smallint(5) UNSIGNED NOT NULL,
`price` int(10) UNSIGNED NOT NULL DEFAULT '0',
`price` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
`expires_at` bigint(20) UNSIGNED NOT NULL,
`inserted` bigint(20) UNSIGNED NOT NULL,
`state` tinyint(1) UNSIGNED NOT NULL,
Expand All @@ -549,7 +549,7 @@ CREATE TABLE IF NOT EXISTS `market_offers` (
`amount` smallint(5) UNSIGNED NOT NULL,
`created` bigint(20) UNSIGNED NOT NULL,
`anonymous` tinyint(1) NOT NULL DEFAULT '0',
`price` int(10) UNSIGNED NOT NULL DEFAULT '0',
`price` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
INDEX `sale` (`sale`,`itemtype`),
INDEX `created` (`created`),
INDEX `player_id` (`player_id`),
Expand Down