From b541420585dbeef35f1bd99cc237794a1ed1e68b Mon Sep 17 00:00:00 2001 From: gabrielgg98 <133166574+gabrielgg98@users.noreply.github.com> Date: Sat, 29 Mar 2025 17:37:05 -0300 Subject: [PATCH 1/3] fix buyhouse command --- data/scripts/talkactions/god/buy_house.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/data/scripts/talkactions/god/buy_house.lua b/data/scripts/talkactions/god/buy_house.lua index 058e99e3ea5..c18387f0830 100644 --- a/data/scripts/talkactions/god/buy_house.lua +++ b/data/scripts/talkactions/god/buy_house.lua @@ -60,6 +60,8 @@ function buyHouse.onSay(player, words, param) return true end +if configManager.getBoolean(configKeys.CYCLOPEDIA_HOUSE_AUCTION) then buyHouse:separator(" ") buyHouse:groupType("god") buyHouse:register() +end \ No newline at end of file From a8dcceee79e5bc4263f1f24987d292aa6eaee67a Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Sat, 29 Mar 2025 20:37:45 +0000 Subject: [PATCH 2/3] Lua code format - (Stylua) --- data/scripts/talkactions/god/buy_house.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/data/scripts/talkactions/god/buy_house.lua b/data/scripts/talkactions/god/buy_house.lua index c18387f0830..9eb3b1b101d 100644 --- a/data/scripts/talkactions/god/buy_house.lua +++ b/data/scripts/talkactions/god/buy_house.lua @@ -60,8 +60,8 @@ function buyHouse.onSay(player, words, param) return true end -if configManager.getBoolean(configKeys.CYCLOPEDIA_HOUSE_AUCTION) then -buyHouse:separator(" ") -buyHouse:groupType("god") -buyHouse:register() -end \ No newline at end of file +if configManager.getBoolean(configKeys.CYCLOPEDIA_HOUSE_AUCTION) then + buyHouse:separator(" ") + buyHouse:groupType("god") + buyHouse:register() +end From 606e99761df196ffc8f440c8788f9b13204247ca Mon Sep 17 00:00:00 2001 From: gabrielgg98 <133166574+gabrielgg98@users.noreply.github.com> Date: Sat, 29 Mar 2025 23:30:36 -0300 Subject: [PATCH 3/3] delete buyhouse talkactions god --- data/scripts/talkactions/god/buy_house.lua | 67 ---------------------- 1 file changed, 67 deletions(-) delete mode 100644 data/scripts/talkactions/god/buy_house.lua diff --git a/data/scripts/talkactions/god/buy_house.lua b/data/scripts/talkactions/god/buy_house.lua deleted file mode 100644 index 9eb3b1b101d..00000000000 --- a/data/scripts/talkactions/god/buy_house.lua +++ /dev/null @@ -1,67 +0,0 @@ -local buyHouse = TalkAction("!buyhouse") - -function buyHouse.onSay(player, words, param) - local housePrice = configManager.getNumber(configKeys.HOUSE_PRICE_PER_SQM) - if housePrice == -1 then - return true - end - - if not player:isPremium() then - player:sendCancelMessage("You need a premium account.") - return true - end - - local houseBuyLevel = configManager.getNumber(configKeys.HOUSE_BUY_LEVEL) - if player:getLevel() < houseBuyLevel then - player:sendCancelMessage("You need to be level " .. houseBuyLevel .. " to buy a house.") - return true - end - - local position = player:getPosition() - position:getNextPosition(player:getDirection()) - - local tile = Tile(position) - local house = tile and tile:getHouse() - local playerPos = player:getPosition() - local houseEntry = house and house:getExitPosition() - - if not house or playerPos ~= houseEntry then - player:sendCancelMessage("You have to be looking at the door of the house you would like to buy.") - return true - end - - if house:getOwnerGuid() > 0 then - player:sendCancelMessage("This house already has an owner.") - return true - end - - if player:getHouse() then - player:sendCancelMessage("You are already the owner of a house.") - return true - end - - if house:hasItemOnTile() then - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You cannot buy this house, as there are items inside it. Please, contact an administrator.") - return true - end - - local price = house:getPrice() - if not player:removeMoneyBank(price) then - player:sendCancelMessage("You do not have enough money.") - return true - end - metrics.addCounter("balance_decrease", remainsPrice, { - player = player:getName(), - context = "house_purchase", - }) - - house:setHouseOwner(player:getGuid()) - player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have successfully bought this house, be sure to have the money for the rent in the bank.") - return true -end - -if configManager.getBoolean(configKeys.CYCLOPEDIA_HOUSE_AUCTION) then - buyHouse:separator(" ") - buyHouse:groupType("god") - buyHouse:register() -end