Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: house transfer owner only in startup #1621

Merged
merged 6 commits into from
Sep 23, 2023
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
6 changes: 6 additions & 0 deletions config.lua.dist
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ deathLosePercent = -1
-- Houses
-- NOTE: set housePriceEachSQM to -1 to disable the ingame buy house functionality
-- NOTE: set houseBuyLevel to 0 to disable the min level purchase functionality.
--[[ NOTE: The togglehouseTransferOnRestart setting controls whether house transfers/leave are true/false upon server restart.
• When set to true, the transfers will only occur during a server restart.
Setting this to false may pose risks; if a house is abandoned and contains a large number of items on the floor, those items will be transferred to the player's depot instantly.
• This could potentially freeze the server due to the heavy operation. It's advised to keep this setting enabled (true) to minimize risks.
]]
-- Periods: daily/weekly/monthly/yearly/never
-- Base: sqm,rent,sqm+rent
housePriceRentMultiplier = 0.0
Expand All @@ -263,6 +268,7 @@ houseOwnedByAccount = false
houseBuyLevel = 100
housePurchasedShowPrice = false
onlyInvitedCanMoveHouseItems = true
togglehouseTransferOnRestart = true

-- Item Usage
timeBetweenActions = 200
Expand Down
4 changes: 3 additions & 1 deletion data-canary/scripts/actions/other/construction_kits.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ function constructionKits.onUse(player, item, fromPosition, target, toPosition,
elseif not Tile(fromPosition):getHouse() then
player:sendTextMessage(MESSAGE_FAILURE, "You may construct this only inside a house.")
else
item:transform(kit)
item:transform(ITEM_DECORATION_KIT)
item:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "Unwrap it in your own house to create a <" .. ItemType(kit):getName() .. ">.")
item:setCustomAttribute("unWrapId", kit)
fromPosition:sendMagicEffect(CONST_ME_POFF)
player:addAchievementProgress("Interior Decorator", 1000)
end
Expand Down
2 changes: 1 addition & 1 deletion data-otservbr-global/lib/compat/compat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1231,7 +1231,7 @@ end

function setHouseOwner(id, guid)
local h = House(id)
return h and h:setOwnerGuid(guid) or false
return h and h:setHouseOwner(guid) or false
end

function getHouseRent(id)
Expand Down
4 changes: 3 additions & 1 deletion data-otservbr-global/migrations/39.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
function onUpdateDatabase()
return false -- true = There are others migrations file | false = this is the last migration file
logger.info("Updating database to version 39 (house transfer ownership on startup)")
db.query("ALTER TABLE `houses` ADD `new_owner` int(11) NOT NULL DEFAULT '-1';")
return true
end
3 changes: 3 additions & 0 deletions data-otservbr-global/migrations/40.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
16 changes: 8 additions & 8 deletions data-otservbr-global/npc/allen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,25 @@ npcConfig.shop = {
{ itemName = "canopy headboard", clientId = 32481, buy = 40 },
{ itemName = "cot footboard", clientId = 32486, buy = 40 },
{ itemName = "cot headboard", clientId = 32477, buy = 40 },
{ itemName = "green cushioned chair kit", clientId = 2776, buy = 40 },
{ itemName = "green cushioned chair kit", clientId = 2378, buy = 40 },
{ itemName = "green footboard", clientId = 32483, buy = 40 },
{ itemName = "green headboard", clientId = 32474, buy = 40 },
{ itemName = "hammock foot section", clientId = 32487, buy = 40 },
{ itemName = "hammock head section", clientId = 32478, buy = 40 },
{ itemName = "red cushioned chair kit", clientId = 2775, buy = 40 },
{ itemName = "red cushioned chair kit", clientId = 2374, buy = 40 },
{ itemName = "red footboard", clientId = 32484, buy = 40 },
{ itemName = "red headboard", clientId = 32475, buy = 40 },
{ itemName = "rocking chair kit", clientId = 2778, buy = 25 },
{ itemName = "rocking chair kit", clientId = 2382, buy = 25 },
{ itemName = "simple footboard", clientId = 32488, buy = 40 },
{ itemName = "simple headboard", clientId = 32479, buy = 40 },
{ itemName = "sofa chair kit", clientId = 2779, buy = 55 },
{ itemName = "sofa chair kit", clientId = 2366, buy = 55 },
{ itemName = "straw mat foot section", clientId = 32489, buy = 40 },
{ itemName = "straw mat head section", clientId = 32480, buy = 40 },
{ itemName = "treasure chest", clientId = 2478, buy = 1000 },
{ itemName = "venorean cabinet kit", clientId = 17974, buy = 90 },
{ itemName = "venorean drawer kit", clientId = 17977, buy = 40 },
{ itemName = "venorean wardrobe kit", clientId = 17975, buy = 50 },
{ itemName = "wooden chair kit", clientId = 2777, buy = 15 },
{ itemName = "venorean cabinet kit", clientId = 18015, buy = 90 },
{ itemName = "venorean drawer kit", clientId = 18019, buy = 40 },
{ itemName = "venorean wardrobe kit", clientId = 18017, buy = 50 },
{ itemName = "wooden chair kit", clientId = 2360, buy = 15 },
{ itemName = "yellow footboard", clientId = 32485, buy = 40 },
{ itemName = "yellow headboard", clientId = 32476, buy = 40 },
}
Expand Down
2 changes: 1 addition & 1 deletion data-otservbr-global/npc/asphota.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ npcConfig.shop = {
{ itemName = "scroll", clientId = 2815, buy = 5 },
{ itemName = "scythe", clientId = 3453, buy = 50, sell = 10 },
{ itemName = "shovel", clientId = 3457, buy = 50, sell = 8 },
{ itemName = "telescope kit", clientId = 2799, buy = 70 },
{ itemName = "telescope kit", clientId = 3485, buy = 70 },
{ itemName = "torch", clientId = 2920, buy = 2 },
{ itemName = "watch", clientId = 2906, buy = 20, sell = 6 },
{ itemName = "wooden hammer", clientId = 3459, sell = 15 },
Expand Down
24 changes: 12 additions & 12 deletions data-otservbr-global/npc/borkas.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,22 @@ end
npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, true)

npcConfig.shop = {
{ itemName = "armor rack kit", clientId = 6114, buy = 90 },
{ itemName = "barrel kit", clientId = 2793, buy = 12 },
{ itemName = "bookcase kit", clientId = 6372, buy = 70 },
{ itemName = "armor rack kit", clientId = 6111, buy = 90 },
{ itemName = "barrel kit", clientId = 2523, buy = 12 },
{ itemName = "bookcase kit", clientId = 6370, buy = 70 },
{ itemName = "box", clientId = 2469, buy = 10 },
{ itemName = "chest", clientId = 2472, buy = 10 },
{ itemName = "crate", clientId = 2471, buy = 10 },
{ itemName = "drawer kit", clientId = 2789, buy = 18 },
{ itemName = "dresser kit", clientId = 2790, buy = 25 },
{ itemName = "locker kit", clientId = 2791, buy = 30 },
{ itemName = "drawer kit", clientId = 2433, buy = 18 },
{ itemName = "dresser kit", clientId = 2441, buy = 25 },
{ itemName = "locker kit", clientId = 2449, buy = 30 },
{ itemName = "treasure chest", clientId = 2478, buy = 1000 },
{ itemName = "trough kit", clientId = 2792, buy = 7 },
{ itemName = "trunk kit", clientId = 2794, buy = 10 },
{ itemName = "venorean cabinet kit", clientId = 17974, buy = 90 },
{ itemName = "venorean drawer kit", clientId = 17977, buy = 40 },
{ itemName = "venorean wardrobe kit", clientId = 17975, buy = 50 },
{ itemName = "weapon rack kit", clientId = 6115, buy = 90 },
{ itemName = "trough kit", clientId = 2524, buy = 7 },
{ itemName = "trunk kit", clientId = 2483, buy = 10 },
{ itemName = "venorean cabinet kit", clientId = 18015, buy = 90 },
{ itemName = "venorean drawer kit", clientId = 18019, buy = 40 },
{ itemName = "venorean wardrobe kit", clientId = 18017, buy = 50 },
{ itemName = "weapon rack kit", clientId = 6109, buy = 90 },
}
-- On buy npc shop message
npcType.onBuyItem = function(npc, player, itemId, subType, amount, ignore, inBackpacks, totalCost)
Expand Down
8 changes: 4 additions & 4 deletions data-otservbr-global/npc/cael.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ local tomes = Storage.Quest.U8_54.TheNewFrontier.TomeofKnowledge
npcConfig.shop = {
{ itemName = "didgeridoo", clientId = 2965, buy = 5000, storageKey = tomes, storageValue = 6 },
{ itemName = "war drum", clientId = 2966, buy = 1000, storageKey = tomes, storageValue = 6 },
{ itemName = "Dragon Statue Kit", clientId = 10216, buy = 2500, storageKey = tomes, storageValue = 11 },
{ itemName = "Dragon Throne Kit", clientId = 10288, buy = 5000, storageKey = tomes, storageValue = 12 },
{ itemName = "Dragon Statue Kit", clientId = 10212, buy = 2500, storageKey = tomes, storageValue = 11 },
{ itemName = "Dragon Throne Kit", clientId = 10286, buy = 5000, storageKey = tomes, storageValue = 12 },
}
-- On buy npc shop message
npcType.onBuyItem = function(npc, player, itemId, subType, amount, ignore, inBackpacks, totalCost)
Expand Down Expand Up @@ -317,7 +317,7 @@ local function creatureSayCallback(npc, creature, type, message)
end
elseif MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 65 then
if player:removeItem(10289, 1) then
player:addItem(10216, 1)
player:addItem(10212, 1)
npcHandler:say("Let's put this little lantern here.. there you go. I wrap it up for you, just unwrap it in your house again!", npc, creature)
npcHandler:setTopic(playerId, 0)
else
Expand All @@ -331,7 +331,7 @@ local function creatureSayCallback(npc, creature, type, message)
end
elseif MsgContains(message, "yes") and npcHandler:getTopic(playerId) == 66 then
if player:removeItem(5911, 1) then
player:addItem(10288, 1)
player:addItem(10286, 1)
npcHandler:say("Let's put this cloth over the seat.. there you go. I wrap it up for you, just unwrap it in your house again!", npc, creature)
npcHandler:setTopic(playerId, 0)
else
Expand Down
76 changes: 38 additions & 38 deletions data-otservbr-global/npc/dorbin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,68 +54,68 @@ npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, true)

npcConfig.shop = {
{ itemName = "amphora", clientId = 2893, buy = 4 },
{ itemName = "armor rack kit", clientId = 6114, buy = 90 },
{ itemName = "barrel kit", clientId = 2793, buy = 12 },
{ itemName = "big table kit", clientId = 2785, buy = 30 },
{ itemName = "birdcage kit", clientId = 2796, buy = 50 },
{ itemName = "armor rack kit", clientId = 6111, buy = 90 },
{ itemName = "barrel kit", clientId = 2523, buy = 12 },
{ itemName = "big table kit", clientId = 2314, buy = 30 },
{ itemName = "birdcage kit", clientId = 2976, buy = 50 },
{ itemName = "blue footboard", clientId = 32482, buy = 40 },
{ itemName = "blue headboard", clientId = 32473, buy = 40 },
{ itemName = "blue pillow", clientId = 2394, buy = 25 },
{ itemName = "blue tapestry", clientId = 2659, buy = 25 },
{ itemName = "bookcase kit", clientId = 6372, buy = 70 },
{ itemName = "bookcase kit", clientId = 6370, buy = 70 },
{ itemName = "box", clientId = 2469, buy = 10 },
{ itemName = "canopy footboard", clientId = 32490, buy = 40 },
{ itemName = "canopy headboard", clientId = 32481, buy = 40 },
{ itemName = "chest", clientId = 2472, buy = 10 },
{ itemName = "chimney kit", clientId = 7864, buy = 200 },
{ itemName = "coal basin kit", clientId = 2806, buy = 25 },
{ itemName = "chimney kit", clientId = 7860, buy = 200 },
{ itemName = "coal basin kit", clientId = 3513, buy = 25 },
{ itemName = "cot footboard", clientId = 32486, buy = 40 },
{ itemName = "cot headboard", clientId = 32477, buy = 40 },
{ itemName = "crate", clientId = 2471, buy = 10 },
{ itemName = "crystal table kit", clientId = 9061, buy = 150 },
{ itemName = "crystal table kit", clientId = 9062, buy = 150 },
{ itemName = "cuckoo clock", clientId = 2664, buy = 40 },
{ itemName = "drawer kit", clientId = 2789, buy = 18 },
{ itemName = "dresser kit", clientId = 2790, buy = 25 },
{ itemName = "drawer kit", clientId = 2433, buy = 18 },
{ itemName = "dresser kit", clientId = 2441, buy = 25 },
{ itemName = "empty goldfish bowl", clientId = 5928, buy = 50 },
{ itemName = "flower bowl", clientId = 2983, buy = 6 },
{ itemName = "globe kit", clientId = 2800, buy = 50 },
{ itemName = "goblin statue kit", clientId = 2804, buy = 50 },
{ itemName = "globe kit", clientId = 2998, buy = 50 },
{ itemName = "goblin statue kit", clientId = 2030, buy = 50 },
{ itemName = "god flowers", clientId = 2981, buy = 5 },
{ itemName = "green cushioned chair kit", clientId = 2776, buy = 40 },
{ itemName = "green cushioned chair kit", clientId = 2378, buy = 40 },
{ itemName = "green footboard", clientId = 32483, buy = 40 },
{ itemName = "green headboard", clientId = 32474, buy = 40 },
{ itemName = "green pillow", clientId = 2396, buy = 25 },
{ itemName = "green tapestry", clientId = 2647, buy = 25 },
{ itemName = "hammock foot section", clientId = 32487, buy = 40 },
{ itemName = "hammock head section", clientId = 32478, buy = 40 },
{ itemName = "harp kit", clientId = 2808, buy = 50 },
{ itemName = "harp kit", clientId = 2963, buy = 50 },
{ itemName = "heart pillow", clientId = 2393, buy = 30 },
{ itemName = "honey flower", clientId = 2984, buy = 5 },
{ itemName = "indoor plant kit", clientId = 2811, buy = 8 },
{ itemName = "knight statue kit", clientId = 2802, buy = 50 },
{ itemName = "large amphora kit", clientId = 2805, buy = 50 },
{ itemName = "locker kit", clientId = 2791, buy = 30 },
{ itemName = "minotaur statue kit", clientId = 2803, buy = 50 },
{ itemName = "indoor plant kit", clientId = 2982, buy = 8 },
{ itemName = "knight statue kit", clientId = 2025, buy = 50 },
{ itemName = "large amphora kit", clientId = 2904, buy = 50 },
{ itemName = "locker kit", clientId = 2449, buy = 30 },
{ itemName = "minotaur statue kit", clientId = 2029, buy = 50 },
{ itemName = "orange tapestry", clientId = 2653, buy = 25 },
{ itemName = "oven kit", clientId = 6371, buy = 80 },
{ itemName = "pendulum clock kit", clientId = 2801, buy = 75 },
{ itemName = "piano kit", clientId = 2807, buy = 200 },
{ itemName = "oven kit", clientId = 6355, buy = 80 },
{ itemName = "pendulum clock kit", clientId = 2445, buy = 75 },
{ itemName = "piano kit", clientId = 2959, buy = 200 },
{ itemName = "picture", clientId = 2639, buy = 50 },
{ itemName = "picture", clientId = 2640, buy = 50 },
{ itemName = "picture", clientId = 2641, buy = 50 },
{ itemName = "potted flower", clientId = 2985, buy = 5 },
{ itemName = "purple tapestry", clientId = 2644, buy = 25 },
{ itemName = "red cushioned chair kit", clientId = 2775, buy = 40 },
{ itemName = "red cushioned chair kit", clientId = 2374, buy = 40 },
{ itemName = "red footboard", clientId = 32484, buy = 40 },
{ itemName = "red headboard", clientId = 32475, buy = 40 },
{ itemName = "red pillow", clientId = 2395, buy = 25 },
{ itemName = "red tapestry", clientId = 2656, buy = 25 },
{ itemName = "rocking chair kit", clientId = 2778, buy = 25 },
{ itemName = "rocking horse kit", clientId = 2800, buy = 30 },
{ itemName = "rocking chair kit", clientId = 2382, buy = 25 },
{ itemName = "rocking horse kit", clientId = 2998, buy = 30 },
{ itemName = "round blue pillow", clientId = 2398, buy = 25 },
{ itemName = "round purple pillow", clientId = 2400, buy = 25 },
{ itemName = "round red pillow", clientId = 2399, buy = 25 },
{ itemName = "round table kit", clientId = 2783, buy = 25 },
{ itemName = "round table kit", clientId = 2316, buy = 25 },
{ itemName = "round turquoise pillow", clientId = 2401, buy = 25 },
{ itemName = "simple footboard", clientId = 32488, buy = 40 },
{ itemName = "simple headboard", clientId = 32479, buy = 40 },
Expand All @@ -124,28 +124,28 @@ npcConfig.shop = {
{ itemName = "small orange pillow", clientId = 2390, buy = 20 },
{ itemName = "small purple pillow", clientId = 2386, buy = 20 },
{ itemName = "small red pillow", clientId = 2388, buy = 20 },
{ itemName = "small table kit", clientId = 2782, buy = 20 },
{ itemName = "small table kit", clientId = 2319, buy = 20 },
{ itemName = "small turquoise pillow", clientId = 2391, buy = 20 },
{ itemName = "small white pillow", clientId = 2392, buy = 20 },
{ itemName = "sofa chair kit", clientId = 2779, buy = 55 },
{ itemName = "square table kit", clientId = 2784, buy = 25 },
{ itemName = "sofa chair kit", clientId = 2366, buy = 55 },
{ itemName = "square table kit", clientId = 2315, buy = 25 },
{ itemName = "straw mat foot section", clientId = 32489, buy = 40 },
{ itemName = "straw mat head section", clientId = 32480, buy = 40 },
{ itemName = "table lamp kit", clientId = 2798, buy = 35 },
{ itemName = "telescope kit", clientId = 2799, buy = 70 },
{ itemName = "table lamp kit", clientId = 2934, buy = 35 },
{ itemName = "telescope kit", clientId = 3485, buy = 70 },
{ itemName = "treasure chest", clientId = 2478, buy = 1000 },
{ itemName = "trophy stand", clientId = 872, buy = 50 },
{ itemName = "trough kit", clientId = 2792, buy = 7 },
{ itemName = "trunk kit", clientId = 2794, buy = 10 },
{ itemName = "trough kit", clientId = 2524, buy = 7 },
{ itemName = "trunk kit", clientId = 2483, buy = 10 },
{ itemName = "vase", clientId = 2876, buy = 3 },
{ itemName = "venorean cabinet kit", clientId = 17974, buy = 90 },
{ itemName = "venorean drawer kit", clientId = 17977, buy = 40 },
{ itemName = "venorean wardrobe kit", clientId = 17975, buy = 50 },
{ itemName = "venorean cabinet kit", clientId = 18015, buy = 90 },
{ itemName = "venorean drawer kit", clientId = 18019, buy = 40 },
{ itemName = "venorean wardrobe kit", clientId = 18017, buy = 50 },
{ itemName = "wall mirror", clientId = 2638, buy = 40 },
{ itemName = "water pipe", clientId = 2980, buy = 40 },
{ itemName = "weapon rack kit", clientId = 6115, buy = 90 },
{ itemName = "weapon rack kit", clientId = 6109, buy = 90 },
{ itemName = "white tapestry", clientId = 2667, buy = 25 },
{ itemName = "wooden chair kit", clientId = 2777, buy = 15 },
{ itemName = "wooden chair kit", clientId = 2360, buy = 15 },
{ itemName = "yellow footboard", clientId = 32485, buy = 40 },
{ itemName = "yellow headboard", clientId = 32476, buy = 40 },
{ itemName = "yellow pillow", clientId = 900, buy = 25 },
Expand Down
Loading
Loading