@ -113,6 +113,7 @@ void House::setOwner(uint32_t guid, bool updateDatabase/* = true*/, Player* play
void House::addDoor(Door* door)
updateDoorDescription();
the tile under the door has house property?i use tfs 1.5 - 8.6
have a strange problem with houses in game door houses looks like normal houses but in rme i can see that they are houses, what the problem could be? the map is already fucked up?
ingame picture
View attachment 77032
in rme
View attachment 77033
yep, right.Nah, he is asking if the tile the door is located on has been assigned as a house SQM.
It has to already be assigned otherwise the Door ID option would be grayed out.
local openOddDoors = {
[12695] = { locked = 13237, closed = 12692 },
[12703] = { locked = 13236, closed = 12701 },
[14635] = { locked = 14634, closed = 14633 },
[17435] = { locked = 14641, closed = 14640 },
[26533] = { locked = 26530, closed = 26529 },
[26534] = { locked = 26532, closed = 26531 },
[31176] = { locked = 31175, closed = 27559 },
[31024] = { locked = 31021, closed = 31020 },
[31025] = { locked = 31023, closed = 31022 },
[31541] = { locked = 31314, closed = 31314 },
[31542] = { locked = 31315, closed = 31315 },
[32691] = { locked = 32705, closed = 32689 },
[32692] = { locked = 32706, closed = 32690 },
[32695] = { locked = 32707, closed = 32693 },
[32696] = { locked = 32708, closed = 32694 },
[33432] = { locked = 33429, closed = 33428 },
[33433] = { locked = 33431, closed = 33430 },
[33493] = { locked = 33490, closed = 33489 },
[33494] = { locked = 33492, closed = 33491 },
[34152] = { locked = 34150, closed = 34150 },
[34153] = { locked = 34151, closed = 34151 },
[36292] = { locked = 36289, closed = 36288 },
[36293] = { locked = 36291, closed = 36290 },
[37596] = { locked = 37593, closed = 37592 },
[37597] = { locked = 37595, closed = 37594 },
[39119] = { locked = 39116, closed = 39115 },
[39120] = { locked = 39118, closed = 39117 }
}
local closedOddDoors = {
[12692] = { locked = 13237, open = 12695 },
[12701] = { locked = 13236, open = 12703 },
[14633] = { locked = 14634, open = 14635 },
[14640] = { locked = 14641, open = 17435 },
[26529] = { locked = 26530, open = 26533 },
[26531] = { locked = 26532, open = 26534 },
[27559] = { locked = 31175, open = 31176 },
[31020] = { locked = 31021, open = 31024 },
[31022] = { locked = 31023, open = 31025 },
[31314] = { locked = 31314, open = 31541 },
[31315] = { locked = 31315, open = 31542 },
[32689] = { locked = 32705, open = 32691 },
[32690] = { locked = 32706, open = 32692 },
[32693] = { locked = 32707, open = 32695 },
[32694] = { locked = 32708, open = 32696 },
[33428] = { locked = 33429, open = 33432 },
[33430] = { locked = 33431, open = 33433 },
[33489] = { locked = 33490, open = 33493 },
[33491] = { locked = 33492, open = 33494 },
[34150] = { locked = 34150, open = 34152 },
[34151] = { locked = 34151, open = 34153 },
[36288] = { locked = 36289, open = 36292 },
[36290] = { locked = 36291, open = 36293 },
[37592] = { locked = 37593, open = 37596 },
[37594] = { locked = 37595, open = 37597 },
[39115] = { locked = 39116, open = 39119 },
[39117] = { locked = 39118, open = 39120 }
}
local lockedOddDoors = {
[13237] = { closed = 12692, open = 12695 },
[13236] = { closed = 12701, open = 12703 },
[14634] = { closed = 14633, open = 14635 },
[14641] = { closed = 14640, open = 17435 },
[26530] = { closed = 26529, open = 26533 },
[26532] = { closed = 26531, open = 26534 },
[31175] = { closed = 27559, open = 31176 },
[31021] = { closed = 31020, open = 31024 },
[31023] = { closed = 31022, open = 31025 },
[32705] = { closed = 32689, open = 32691 },
[32706] = { closed = 32690, open = 32692 },
[32707] = { closed = 32693, open = 32695 },
[32708] = { closed = 32694, open = 32696 },
[33429] = { closed = 33428, open = 33432 },
[33431] = { closed = 33430, open = 33433 },
[33490] = { closed = 33489, open = 33493 },
[33492] = { closed = 33491, open = 33494 },
[36289] = { closed = 36288, open = 36292 },
[36291] = { closed = 36290, open = 36293 },
[37593] = { closed = 37592, open = 37596 },
[37595] = { closed = 37594, open = 37597 },
[39116] = { closed = 39115, open = 39119 },
[39118] = { closed = 39117, open = 39120 }
}
local verticalDoors = {1211, 1220, 1224, 1228, 1233, 1238, 1242, 1246, 1251, 1256, 1260, 1540, 3546, 3548, 3550, 3552, 4915, 5083, 5109, 5111, 5113, 5115, 5127, 5129, 5131, 5133, 5142, 5145, 5283, 5285, 5289, 5293, 5516, 5737, 5749, 6194, 6199, 6203, 6207, 6251, 6256, 6260, 6264, 6798, 6802, 6902, 6904, 6906, 6908, 7044, 7046, 7048, 7050, 7055, 8543, 8548, 8552, 8556, 9167, 9172, 9269, 9274, 9274, 9269, 9278, 9282, 10270, 10275, 10279, 10283, 10479, 10481, 10485, 10483, 10786, 12101, 12199, 19851, 19853, 19991, 19993, 20284, 20286, 17238, 13021, 10790, 12103, 12205, 19855, 19995, 20288, 10792, 12105, 12203, 19857, 19997, 20290}
local horizontalDoors = {1214, 1222, 1226, 1230, 1236, 1240, 1244, 1248, 1254, 1258, 1262, 1542, 3537, 3539, 3541, 3543, 4918, 5085, 5100, 5102, 5104, 5106, 5118, 5120, 5122, 5124, 5136, 5139, 5280, 5287, 5291, 5295, 5518, 5734, 5746, 6197, 6201, 6205, 6209, 6254, 6258, 6262, 6266, 6796, 6800, 6893, 6895, 6897, 6899, 7035, 7037, 7039, 7041, 7057, 8546, 8550, 8554, 8558, 9170, 9174, 9272, 9276, 9280, 9284, 10273, 10277, 10281, 10285, 10470, 10472, 10476, 10474, 10777, 12094, 12190, 19842, 19844, 19982, 19984, 20275, 20277, 17236, 18209, 13023, 10781, 12096, 12196, 19846, 19986, 20279, 10783, 12098, 12194, 19848, 19988, 20281}
--local positionOffsets = {
--vertical = {
-- {x = 1, y = 0}, -- east
-- {x = -1, y = 0}, -- west
--},
-- horizontal = {
-- {x = 0, y = 1}, -- south
-- {x = 0, y = -1}, -- north
-- }
--}
local door = Action()
function door.onUse(player, item, fromPosition, target, toPosition, isHotkey)
local itemId = item:getId()
if table.contains(closedQuestDoors, itemId) then
if player:getStorageValue(item.actionid) ~= -1 or player:getGroup():getAccess() then
item:transform(itemId + 1)
player:teleportTo(toPosition, true)
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The door seems to be sealed against unwanted intruders.")
end
return true
elseif table.contains(closedLevelDoors, itemId) then
if item.actionid > 0 and player:getLevel() >= item.actionid - actionIds.levelDoor or player:getGroup():getAccess() then
item:transform(itemId + 1)
player:teleportTo(toPosition, true)
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.")
end
return true
elseif table.contains(keys, itemId) then
local tile = Tile(toPosition)
if not tile then
return false
end
target = tile:getTopVisibleThing()
if target.actionid == 0 then
return false
end
if table.contains(keys, target.itemid) then
return false
end
if not table.contains(openDoors, target.itemid) and not table.contains(closedDoors, target.itemid) and not table.contains(lockedDoors, target.itemid) then
return false
end
if item.actionid ~= target.actionid then
player:sendTextMessage(MESSAGE_STATUS_SMALL, "The key does not match.")
return true
end
local transformTo = target.itemid + 2
if table.contains(openDoors, target.itemid) then
transformTo = target.itemid - 2
elseif table.contains(closedDoors, target.itemid) then
transformTo = target.itemid - 1
end
target:transform(transformTo)
return true
elseif table.contains(lockedDoors, itemId) then
player:sendTextMessage(MESSAGE_INFO_DESCR, "It is locked.")
return true
elseif table.contains(horizontalDoors, itemId) then
local horizontalDoors = Tile(toPosition):getTopCreature()
if horizontalDoors then
toPosition.y = toPosition.y + 1
horizontalDoors:teleportTo(toPosition, true)
end
item:transform(itemId - 1)
return true
elseif table.contains(closedDoors, itemId) or table.contains(closedExtraDoors, itemId) or table.contains(closedHouseDoors, itemId) then
item:transform(itemId + 1)
return true
elseif table.contains(openDoors, itemId) or table.contains(openExtraDoors, itemId) or table.contains(openHouseDoors, itemId) then
local doorCreature = Tile(toPosition):getTopCreature()
if doorCreature then
toPosition.x = toPosition.x + 1
doorCreature:teleportTo(toPosition, true)
end
item:transform(itemId - 1)
return true
elseif table.contains(closedDoors, itemId) or table.contains(closedExtraDoors, itemId) or table.contains(closedHouseDoors, itemId) then
item:transform(itemId + 1)
return true
end
return false
end
local doorTables = {keys, openDoors, closedDoors, lockedDoors, openExtraDoors, closedExtraDoors, openHouseDoors, closedHouseDoors, closedQuestDoors, closedLevelDoors, openVerticalDoors, closedVerticalDoors}
for _, doors in pairs(doorTables) do
for _, doorId in pairs(doors) do
door:id(doorId)
end
end
door:register()
this my global.lua
[CODE]math.randomseed(os.time())
dofile('data/lib/lib.lua')
ropeSpots = {
384, 418, 8278, 8592, 13189, 14435, 14436, 14857, 15635, 19518, 24621, 24622, 24623, 24624, 26019
}
keys = {
2086, 2087, 2088, 2089, 2090, 2091, 2092, 10032
}
openDoors = {
1211, 1214, 1233, 1236, 1251, 1254, 3546, 3537, 4915, 4918, 5100, 5109, 5118, 5127, 5136, 5139, 5142,
5145, 5280, 5283, 5734, 5737, 6194, 6197, 6251, 6254, 6893, 6902, 7035, 7044, 8543, 8546, 9167, 9170,
9269, 9272, 10270, 10273, 10470, 10479, 10777, 10786, 12094, 12101, 12190, 12199, 19842, 19851, 19982,
19991, 20275, 20284
}
closedDoors = {
1210, 1213, 1232, 1235, 1250, 1253, 3536, 3545, 4914, 4917, 5099, 5108, 5117, 5126, 5135, 5138, 5141,
5144, 5279, 5282, 5733, 5736, 6193, 6196, 6250, 6253, 6892, 6901, 7034, 7043, 8542, 8545, 9166, 9169,
9268, 9271, 10269, 10272, 10766, 10785, 10469, 10478, 12093, 12100, 12189, 12198, 19841, 19850, 19981,
19990, 20274, 20283
}
lockedDoors = {
1209, 1212, 1231, 1234, 1249, 1252, 3535, 3544, 4913, 4916, 5098, 5107, 5116, 5125, 5134, 5137, 5140,
5143, 5278, 5281, 5732, 5735, 6192, 6195, 6249, 6252, 6891, 6900, 7033, 7042, 8541, 8544, 9165, 9168,
9267, 9270, 10268, 10271, 10468, 10477, 10775, 10784, 12092, 12099, 12188, 12197, 19840, 19849, 19980,
19989, 20273, 20282
}
openExtraDoors = {
1540, 1542, 6796, 6798, 6800, 6802, 7055, 7057, 13021, 13023, 17236, 17238, 25159, 25161
}
closedExtraDoors = {
1539, 1541, 6795, 6797, 6799, 6801, 7054, 7056, 13020, 13022, 17235, 17237, 25158, 25160
}
openHouseDoors = {
1220, 1222, 1238, 1240, 3539, 3548, 5083, 5085, 5102, 5111, 5120, 5129, 5285, 5287, 5516, 5518, 6199,
6201, 6256, 6258, 6895, 6904, 7037, 7046, 8548, 8550, 9172, 9174, 9274, 9276, 10275, 10277, 10472, 10481,
18209, 19844, 19853, 19984, 19993, 20277, 20286
}
closedHouseDoors = {
1219, 1221, 1237, 1239, 3538, 3547, 5082, 5084, 5101, 5110, 5119, 5128, 5284, 5286, 5515, 5517, 6198,
6200, 6255, 6257, 6894, 6903, 7036, 7045, 8547, 8549, 9171, 9173, 9273, 9275, 10274, 10276, 10471, 10480,
18208, 19843, 19852, 19983, 19992, 20276, 20285
}
openQuestDoors = {
1224, 1226, 1242, 1244, 1256, 1258, 3543, 3552, 5106, 5115, 5124, 5133, 5289, 5291, 5746, 5749, 6203,
6205, 6260, 6262, 6899, 6908, 7041, 7050, 8552, 8554, 9176, 9178, 9278, 9280, 10279, 10281, 10476, 10485,
10783, 10792, 12098, 12105, 12194, 12203, 19848, 19857, 19988, 19997, 20281, 20290, 25163, 25165
}
closedQuestDoors = {
1223, 1225, 1241, 1243, 1255, 1257, 3542, 3551, 5105, 5114, 5123, 5132, 5288, 5290, 5745, 5748, 6202,
6204, 6259, 6261, 6898, 6907, 7040, 7049, 8551, 8553, 9175, 9177, 9277, 9279, 10278, 10280, 10475, 10484,
10782, 10791, 12097, 12104, 12193, 12202, 19847, 19856, 19987, 19996, 20280, 20289, 25162, 25164
}
openLevelDoors = {
1228, 1230, 1246, 1248, 1260, 1262, 3541, 3550, 5104, 5113, 5122, 5131, 5293, 5295, 6207, 6209, 6264,
6266, 6897, 6906, 7039, 7048, 8556, 8558, 9180, 9182, 9282, 9284, 10283, 10285, 10474, 10483, 10781,
10790, 12096, 12103, 12196, 12205, 19846, 19855, 19986, 19995, 20279, 20288
}
closedLevelDoors = {
1227, 1229, 1245, 1247, 1259, 1261, 3540, 3549, 5103, 5112, 5121, 5130, 5292, 5294, 6206, 6208, 6263,
6265, 6896, 6905, 7038, 7047, 8555, 8557, 9179, 9181, 9281, 9283, 10282, 10284, 10473, 10482, 10780,
10789, 12095, 12102, 12195, 12204, 19845, 19854, 19985, 19994, 20278--, --20287
<item id="1219" article="a" name="closed door">
<attribute key="type" value="door"/>
<attribute key="blockprojectile" value="1"/>
</item>
<item id="1220" article="an" name="open door">
<attribute key="type" value="door"/>
</item>
i dont think it's related to any lua code...uo, don't get it i reviewed and it's not the items.xml don't know if it's global.lua the problem but i changed door ids to review. somebody has an idea?
this is my scripts/actions/doors.lua
Lua:local openOddDoors = { [12695] = { locked = 13237, closed = 12692 }, [12703] = { locked = 13236, closed = 12701 }, [14635] = { locked = 14634, closed = 14633 }, [17435] = { locked = 14641, closed = 14640 }, [26533] = { locked = 26530, closed = 26529 }, [26534] = { locked = 26532, closed = 26531 }, [31176] = { locked = 31175, closed = 27559 }, [31024] = { locked = 31021, closed = 31020 }, [31025] = { locked = 31023, closed = 31022 }, [31541] = { locked = 31314, closed = 31314 }, [31542] = { locked = 31315, closed = 31315 }, [32691] = { locked = 32705, closed = 32689 }, [32692] = { locked = 32706, closed = 32690 }, [32695] = { locked = 32707, closed = 32693 }, [32696] = { locked = 32708, closed = 32694 }, [33432] = { locked = 33429, closed = 33428 }, [33433] = { locked = 33431, closed = 33430 }, [33493] = { locked = 33490, closed = 33489 }, [33494] = { locked = 33492, closed = 33491 }, [34152] = { locked = 34150, closed = 34150 }, [34153] = { locked = 34151, closed = 34151 }, [36292] = { locked = 36289, closed = 36288 }, [36293] = { locked = 36291, closed = 36290 }, [37596] = { locked = 37593, closed = 37592 }, [37597] = { locked = 37595, closed = 37594 }, [39119] = { locked = 39116, closed = 39115 }, [39120] = { locked = 39118, closed = 39117 } } local closedOddDoors = { [12692] = { locked = 13237, open = 12695 }, [12701] = { locked = 13236, open = 12703 }, [14633] = { locked = 14634, open = 14635 }, [14640] = { locked = 14641, open = 17435 }, [26529] = { locked = 26530, open = 26533 }, [26531] = { locked = 26532, open = 26534 }, [27559] = { locked = 31175, open = 31176 }, [31020] = { locked = 31021, open = 31024 }, [31022] = { locked = 31023, open = 31025 }, [31314] = { locked = 31314, open = 31541 }, [31315] = { locked = 31315, open = 31542 }, [32689] = { locked = 32705, open = 32691 }, [32690] = { locked = 32706, open = 32692 }, [32693] = { locked = 32707, open = 32695 }, [32694] = { locked = 32708, open = 32696 }, [33428] = { locked = 33429, open = 33432 }, [33430] = { locked = 33431, open = 33433 }, [33489] = { locked = 33490, open = 33493 }, [33491] = { locked = 33492, open = 33494 }, [34150] = { locked = 34150, open = 34152 }, [34151] = { locked = 34151, open = 34153 }, [36288] = { locked = 36289, open = 36292 }, [36290] = { locked = 36291, open = 36293 }, [37592] = { locked = 37593, open = 37596 }, [37594] = { locked = 37595, open = 37597 }, [39115] = { locked = 39116, open = 39119 }, [39117] = { locked = 39118, open = 39120 } } local lockedOddDoors = { [13237] = { closed = 12692, open = 12695 }, [13236] = { closed = 12701, open = 12703 }, [14634] = { closed = 14633, open = 14635 }, [14641] = { closed = 14640, open = 17435 }, [26530] = { closed = 26529, open = 26533 }, [26532] = { closed = 26531, open = 26534 }, [31175] = { closed = 27559, open = 31176 }, [31021] = { closed = 31020, open = 31024 }, [31023] = { closed = 31022, open = 31025 }, [32705] = { closed = 32689, open = 32691 }, [32706] = { closed = 32690, open = 32692 }, [32707] = { closed = 32693, open = 32695 }, [32708] = { closed = 32694, open = 32696 }, [33429] = { closed = 33428, open = 33432 }, [33431] = { closed = 33430, open = 33433 }, [33490] = { closed = 33489, open = 33493 }, [33492] = { closed = 33491, open = 33494 }, [36289] = { closed = 36288, open = 36292 }, [36291] = { closed = 36290, open = 36293 }, [37593] = { closed = 37592, open = 37596 }, [37595] = { closed = 37594, open = 37597 }, [39116] = { closed = 39115, open = 39119 }, [39118] = { closed = 39117, open = 39120 } } local verticalDoors = {1211, 1220, 1224, 1228, 1233, 1238, 1242, 1246, 1251, 1256, 1260, 1540, 3546, 3548, 3550, 3552, 4915, 5083, 5109, 5111, 5113, 5115, 5127, 5129, 5131, 5133, 5142, 5145, 5283, 5285, 5289, 5293, 5516, 5737, 5749, 6194, 6199, 6203, 6207, 6251, 6256, 6260, 6264, 6798, 6802, 6902, 6904, 6906, 6908, 7044, 7046, 7048, 7050, 7055, 8543, 8548, 8552, 8556, 9167, 9172, 9269, 9274, 9274, 9269, 9278, 9282, 10270, 10275, 10279, 10283, 10479, 10481, 10485, 10483, 10786, 12101, 12199, 19851, 19853, 19991, 19993, 20284, 20286, 17238, 13021, 10790, 12103, 12205, 19855, 19995, 20288, 10792, 12105, 12203, 19857, 19997, 20290} local horizontalDoors = {1214, 1222, 1226, 1230, 1236, 1240, 1244, 1248, 1254, 1258, 1262, 1542, 3537, 3539, 3541, 3543, 4918, 5085, 5100, 5102, 5104, 5106, 5118, 5120, 5122, 5124, 5136, 5139, 5280, 5287, 5291, 5295, 5518, 5734, 5746, 6197, 6201, 6205, 6209, 6254, 6258, 6262, 6266, 6796, 6800, 6893, 6895, 6897, 6899, 7035, 7037, 7039, 7041, 7057, 8546, 8550, 8554, 8558, 9170, 9174, 9272, 9276, 9280, 9284, 10273, 10277, 10281, 10285, 10470, 10472, 10476, 10474, 10777, 12094, 12190, 19842, 19844, 19982, 19984, 20275, 20277, 17236, 18209, 13023, 10781, 12096, 12196, 19846, 19986, 20279, 10783, 12098, 12194, 19848, 19988, 20281} --local positionOffsets = { --vertical = { -- {x = 1, y = 0}, -- east -- {x = -1, y = 0}, -- west --}, -- horizontal = { -- {x = 0, y = 1}, -- south -- {x = 0, y = -1}, -- north -- } --} local door = Action() function door.onUse(player, item, fromPosition, target, toPosition, isHotkey) local itemId = item:getId() if table.contains(closedQuestDoors, itemId) then if player:getStorageValue(item.actionid) ~= -1 or player:getGroup():getAccess() then item:transform(itemId + 1) player:teleportTo(toPosition, true) else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The door seems to be sealed against unwanted intruders.") end return true elseif table.contains(closedLevelDoors, itemId) then if item.actionid > 0 and player:getLevel() >= item.actionid - actionIds.levelDoor or player:getGroup():getAccess() then item:transform(itemId + 1) player:teleportTo(toPosition, true) else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.") end return true elseif table.contains(keys, itemId) then local tile = Tile(toPosition) if not tile then return false end target = tile:getTopVisibleThing() if target.actionid == 0 then return false end if table.contains(keys, target.itemid) then return false end if not table.contains(openDoors, target.itemid) and not table.contains(closedDoors, target.itemid) and not table.contains(lockedDoors, target.itemid) then return false end if item.actionid ~= target.actionid then player:sendTextMessage(MESSAGE_STATUS_SMALL, "The key does not match.") return true end local transformTo = target.itemid + 2 if table.contains(openDoors, target.itemid) then transformTo = target.itemid - 2 elseif table.contains(closedDoors, target.itemid) then transformTo = target.itemid - 1 end target:transform(transformTo) return true elseif table.contains(lockedDoors, itemId) then player:sendTextMessage(MESSAGE_INFO_DESCR, "It is locked.") return true elseif table.contains(horizontalDoors, itemId) then local horizontalDoors = Tile(toPosition):getTopCreature() if horizontalDoors then toPosition.y = toPosition.y + 1 horizontalDoors:teleportTo(toPosition, true) end item:transform(itemId - 1) return true elseif table.contains(closedDoors, itemId) or table.contains(closedExtraDoors, itemId) or table.contains(closedHouseDoors, itemId) then item:transform(itemId + 1) return true elseif table.contains(openDoors, itemId) or table.contains(openExtraDoors, itemId) or table.contains(openHouseDoors, itemId) then local doorCreature = Tile(toPosition):getTopCreature() if doorCreature then toPosition.x = toPosition.x + 1 doorCreature:teleportTo(toPosition, true) end item:transform(itemId - 1) return true elseif table.contains(closedDoors, itemId) or table.contains(closedExtraDoors, itemId) or table.contains(closedHouseDoors, itemId) then item:transform(itemId + 1) return true end return false end local doorTables = {keys, openDoors, closedDoors, lockedDoors, openExtraDoors, closedExtraDoors, openHouseDoors, closedHouseDoors, closedQuestDoors, closedLevelDoors, openVerticalDoors, closedVerticalDoors} for _, doors in pairs(doorTables) do for _, doorId in pairs(doors) do door:id(doorId) end end door:register()
[/CODE]Code:this my global.lua [CODE]math.randomseed(os.time()) dofile('data/lib/lib.lua') ropeSpots = { 384, 418, 8278, 8592, 13189, 14435, 14436, 14857, 15635, 19518, 24621, 24622, 24623, 24624, 26019 } keys = { 2086, 2087, 2088, 2089, 2090, 2091, 2092, 10032 } openDoors = { 1211, 1214, 1233, 1236, 1251, 1254, 3546, 3537, 4915, 4918, 5100, 5109, 5118, 5127, 5136, 5139, 5142, 5145, 5280, 5283, 5734, 5737, 6194, 6197, 6251, 6254, 6893, 6902, 7035, 7044, 8543, 8546, 9167, 9170, 9269, 9272, 10270, 10273, 10470, 10479, 10777, 10786, 12094, 12101, 12190, 12199, 19842, 19851, 19982, 19991, 20275, 20284 } closedDoors = { 1210, 1213, 1232, 1235, 1250, 1253, 3536, 3545, 4914, 4917, 5099, 5108, 5117, 5126, 5135, 5138, 5141, 5144, 5279, 5282, 5733, 5736, 6193, 6196, 6250, 6253, 6892, 6901, 7034, 7043, 8542, 8545, 9166, 9169, 9268, 9271, 10269, 10272, 10766, 10785, 10469, 10478, 12093, 12100, 12189, 12198, 19841, 19850, 19981, 19990, 20274, 20283 } lockedDoors = { 1209, 1212, 1231, 1234, 1249, 1252, 3535, 3544, 4913, 4916, 5098, 5107, 5116, 5125, 5134, 5137, 5140, 5143, 5278, 5281, 5732, 5735, 6192, 6195, 6249, 6252, 6891, 6900, 7033, 7042, 8541, 8544, 9165, 9168, 9267, 9270, 10268, 10271, 10468, 10477, 10775, 10784, 12092, 12099, 12188, 12197, 19840, 19849, 19980, 19989, 20273, 20282 } openExtraDoors = { 1540, 1542, 6796, 6798, 6800, 6802, 7055, 7057, 13021, 13023, 17236, 17238, 25159, 25161 } closedExtraDoors = { 1539, 1541, 6795, 6797, 6799, 6801, 7054, 7056, 13020, 13022, 17235, 17237, 25158, 25160 } openHouseDoors = { 1220, 1222, 1238, 1240, 3539, 3548, 5083, 5085, 5102, 5111, 5120, 5129, 5285, 5287, 5516, 5518, 6199, 6201, 6256, 6258, 6895, 6904, 7037, 7046, 8548, 8550, 9172, 9174, 9274, 9276, 10275, 10277, 10472, 10481, 18209, 19844, 19853, 19984, 19993, 20277, 20286 } closedHouseDoors = { 1219, 1221, 1237, 1239, 3538, 3547, 5082, 5084, 5101, 5110, 5119, 5128, 5284, 5286, 5515, 5517, 6198, 6200, 6255, 6257, 6894, 6903, 7036, 7045, 8547, 8549, 9171, 9173, 9273, 9275, 10274, 10276, 10471, 10480, 18208, 19843, 19852, 19983, 19992, 20276, 20285 } openQuestDoors = { 1224, 1226, 1242, 1244, 1256, 1258, 3543, 3552, 5106, 5115, 5124, 5133, 5289, 5291, 5746, 5749, 6203, 6205, 6260, 6262, 6899, 6908, 7041, 7050, 8552, 8554, 9176, 9178, 9278, 9280, 10279, 10281, 10476, 10485, 10783, 10792, 12098, 12105, 12194, 12203, 19848, 19857, 19988, 19997, 20281, 20290, 25163, 25165 } closedQuestDoors = { 1223, 1225, 1241, 1243, 1255, 1257, 3542, 3551, 5105, 5114, 5123, 5132, 5288, 5290, 5745, 5748, 6202, 6204, 6259, 6261, 6898, 6907, 7040, 7049, 8551, 8553, 9175, 9177, 9277, 9279, 10278, 10280, 10475, 10484, 10782, 10791, 12097, 12104, 12193, 12202, 19847, 19856, 19987, 19996, 20280, 20289, 25162, 25164 } openLevelDoors = { 1228, 1230, 1246, 1248, 1260, 1262, 3541, 3550, 5104, 5113, 5122, 5131, 5293, 5295, 6207, 6209, 6264, 6266, 6897, 6906, 7039, 7048, 8556, 8558, 9180, 9182, 9282, 9284, 10283, 10285, 10474, 10483, 10781, 10790, 12096, 12103, 12196, 12205, 19846, 19855, 19986, 19995, 20279, 20288 } closedLevelDoors = { 1227, 1229, 1245, 1247, 1259, 1261, 3540, 3549, 5103, 5112, 5121, 5130, 5292, 5294, 6206, 6208, 6263, 6265, 6896, 6905, 7038, 7047, 8555, 8557, 9179, 9181, 9281, 9283, 10282, 10284, 10473, 10482, 10780, 10789, 12095, 12102, 12195, 12204, 19845, 19854, 19985, 19994, 20278--, --20287
items.xml
Code:<item id="1219" article="a" name="closed door"> <attribute key="type" value="door"/> <attribute key="blockprojectile" value="1"/> </item> <item id="1220" article="an" name="open door"> <attribute key="type" value="door"/> </item>
23:22 You see a closed door.
23:23 You have successfully bought this house, be sure to have the money for the rent in the bank.
23:23 You see an open door.
23:22 You see a closed door.
23:23 You have successfully bought this house, be sure to have the money for the rent in the bank.
23:23 You see an open door.
23:22 You see a closed door.
23:22 You see a closed door.
23:23 You have successfully bought this house, be sure to have the money for the rent in the bank.
23:23 You see an open door.
23:25 You see a closed door.
23:25 You see a closed door.
function Item.getType(self)
return ItemType(self:getId())
end
function Item.isContainer(self)
return false
end
function Item.isCreature(self)
return false
end
function Item.isMonster(self)
return false
end
function Item.isNpc(self)
return false
end
function Item.isPlayer(self)
return false
end
function Item.isTeleport(self)
return false
end
function Item.isTile(self)
return false
end
-- Helper class to make string formatting prettier
StringStream = {}
setmetatable(StringStream, {
__call = function(self)
local obj = {}
return setmetatable(obj, {__index = StringStream})
end
})
function StringStream.append(self, str, ...)
self[#self+1] = string.format(str, ...)
end
function StringStream.concat(self, sep)
return table.concat(self, sep)
end
local aux = {
['Defense'] = {key = ITEM_ATTRIBUTE_DEFENSE},
['ExtraDefense'] = {key = ITEM_ATTRIBUTE_EXTRADEFENSE},
['Attack'] = {key = ITEM_ATTRIBUTE_ATTACK},
['AttackSpeed'] = {key = ITEM_ATTRIBUTE_ATTACK_SPEED},
['HitChance'] = {key = ITEM_ATTRIBUTE_HITCHANCE},
['ShootRange'] = {key = ITEM_ATTRIBUTE_SHOOTRANGE},
['Armor'] = {key = ITEM_ATTRIBUTE_ARMOR},
['Duration'] = {key = ITEM_ATTRIBUTE_DURATION, cmp = function(v) return v > 0 end},
['Text'] = {key = ITEM_ATTRIBUTE_TEXT, cmp = function(v) return v ~= '' end},
['Date'] = {key = ITEM_ATTRIBUTE_DATE},
['Writer'] = {key = ITEM_ATTRIBUTE_WRITER, cmp = function(v) return v ~= '' end}
}
function setAuxFunctions()
for name, def in pairs(aux) do
Item['get'.. name] = function(self)
local attr = self:getAttribute(def.key)
if def.cmp and def.cmp(attr) then
return attr
elseif not def.cmp and attr and attr ~= 0 then
return attr
end
local default = ItemType['get'.. name]
return default and default(self:getType()) or nil
end
end
end
setAuxFunctions()
do
local function internalItemGetNameDescription(it, item, subType, addArticle)
local subType = subType or (item and item:getSubType() or -1)
local ss = StringStream()
local obj = item or it
local name = obj:getName()
if name ~= '' then
if it:isStackable() and subType > 1 then
if it:hasShowCount() then
ss:append('%d ', subType)
end
ss:append('%s', obj:getPluralName())
else
if addArticle and obj:getArticle() ~= '' then
ss:append('%s ', obj:getArticle())
end
ss:append('%s', obj:getName())
end
else
ss:append('an item of type %d', obj:getId())
end
return ss:concat()
end
function Item.getNameDescription(self, subType, addArticle)
return internalItemGetNameDescription(self:getType(), self, subType, addArticle)
end
function ItemType.getNameDescription(self, subType, addArticle)
return internalItemGetNameDescription(self, nil, subType, addArticle)
end
end
do
local function addSeparator(ss, begin)
if begin then
begin = false
ss:append(' (')
else
ss:append(', ')
end
return begin
end
local function addGenerics(item, it, abilities, ss, begin)
local obj = item or it
if it:getWeaponType() == WEAPON_DISTANCE and it:getAmmoType() ~= 0 then
ss:append(' (Range:%d', obj:getShootRange())
local attack = obj:getAttack()
local hitChance = obj:getHitChance()
if attack ~= 0 then
ss:append(', Atk%s%d', showpos(attack), math.abs(attack))
end
if hitChance ~= 0 then
ss:append(', Hit%%%s%d', showpos(hitChance), math.abs(hitChance))
end
begin = false
elseif it:getWeaponType() ~= WEAPON_AMMO then
local attack = obj:getAttack()
local defense = obj:getDefense()
local extraDefense = obj:getExtraDefense()
if attack ~= 0 then
begin = false
ss:append(' (Atk:%d', attack)
if abilities.elementType ~= COMBAT_NONE and abilities.elementDamage ~= 0 then
ss:append(' physical + %d %s', abilities.elementDamage, getCombatName(abilities.elementType))
end
end
if defense ~= 0 or extraDefense ~= 0 then
begin = addSeparator(ss, begin)
ss:append('Def:%d', defense)
if extraDefense ~= 0 then
ss:append(' %s%d', showpos(extraDefense), math.abs(extraDefense))
end
end
end
-- Skills
for skill, value in ipairs(abilities.skills) do
if value ~= 0 then
begin = addSeparator(ss, begin)
ss:append('%s %s%d', getSkillName(skill - 1), showpos(value), math.abs(value))
end
end
-- Special Skills
for specialSkill, value in ipairs(abilities.specialSkills) do
if value ~= 0 then
begin = addSeparator(ss, begin)
ss:append('%s %s%d%%', getSpecialSkillName(specialSkill - 1), showpos(value), math.abs(value))
end
end
local magicPoints = abilities.stats[4]
if magicPoints ~= 0 then
begin = addSeparator(ss, begin)
ss:append('magic level %s%d', showpos(magicPoints), math.abs(magicPoints))
end
-- Absorb
local show = abilities.absorbPercent[1]
if show ~= 0 then
for _, value in ipairs(abilities.absorbPercent) do
if value ~= show then
show = 0
end
end
end
if show == 0 then
local tmp = true
for i, value in ipairs(abilities.absorbPercent) do
if value ~= 0 then
if tmp then
tmp = false
begin = addSeparator(ss, begin)
ss:append('protection ')
else
ss:append(', ')
end
ss:append('%s %s%d%%', getCombatName(indexToCombatType(i - 1)), showpos(value), math.abs(value))
end
end
else
begin = addSeparator(ss, begin)
ss:append('protection all %s%d%%', showpos(show), math.abs(show))
end
-- Field absorb
local show = abilities.fieldAbsorbPercent[1]
if show ~= 0 then
for _, value in ipairs(abilities.fieldAbsorbPercent) do
if value ~= show then
show = 0
end
end
end
if show == 0 then
local tmp = true
for i, value in ipairs(abilities.fieldAbsorbPercent) do
if value ~= 0 then
if tmp then
tmp = false
begin = addSeparator(ss, begin)
ss:append('protection ')
else
ss:append(', ')
end
ss:append('%s field %s%d%%', getCombatName(indexToCombatType(i - 1)), showpos(value), math.abs(value))
end
end
else
begin = addSeparator(ss, begin)
ss:append('protection all fields %s%d%%', showpos(show), math.abs(show))
end
if abilities.speed ~= 0 then
begin = addSeparator(ss, begin)
ss:append('speed %s%d', showpos(abilities.speed), math.abs(abilities.speed / 2))
end
return begin
end
local function internalItemGetDescription(it, lookDistance, item, subType, addArticle)
local abilities = it:getAbilities()
local ss = StringStream()
local subType = subType or (item and item:getSubType() or -1)
local text = nil
local begin = true
local obj = item or it
if item then
ss:append(item:getNameDescription(subType, addArticle or true))
else
ss:append(it:getNameDescription(subType, addArticle or true))
end
if it:isRune() then
local rune = Spell(it:getId())
if rune then
if rune:runeLevel() and rune:runeLevel() > 0 or rune:runeMagicLevel() and rune:runeMagicLevel() > 0 then
local tmpVocMap = rune:vocation()
local vocMap = {}
for k, vocName in ipairs(tmpVocMap) do
local vocation = Vocation(vocName)
if vocation and vocation:getPromotion() then
vocMap[#vocMap + 1] = vocName
end
end
ss:append('. %s can only be used by', it:isStackable() and subType > 1 and 'They' or 'It')
-- Only show base vocations in description; promotions should be a given
if #vocMap == 0 then
ss:append(' players')
else
for i = 1, #vocMap - 1 do
local vocName = vocMap[i]
local vocation = Vocation(vocName)
ss:append(' %ss', vocName:lower())
if i + 1 == #vocMap then
ss:append(' and')
else
ss:append(',')
end
end
local vocName = vocMap[#vocMap]
ss:append(' %ss', vocName:lower())
end
ss:append(' with')
if rune:runeLevel() > 0 then
ss:append(' level %d', rune:runeLevel())
end
if rune:runeMagicLevel() > 0 then
if rune:runeLevel() > 0 then
ss:append(' and ')
end
ss:append('magic level %d', rune:runeMagicLevel())
end
ss:append(' or higher')
end
if not begin then
ss:append(')')
end
end
elseif it:getWeaponType() ~= WEAPON_NONE then
begin = addGenerics(item, it, abilities, ss, begin)
if not begin then
ss:append(')')
end
elseif obj:getArmor() ~= 0 or it:hasShowAttributes() then
if obj:getArmor() ~= 0 then
ss:append(' (Arm:%d', obj:getArmor())
begin = false
end
begin = addGenerics(item, it, abilities, ss, begin)
if not begin then
ss:append(')')
end
elseif it:isContainer() or item and item:isContainer() then
local volume = 0
if not item or not item:hasAttribute(ITEM_ATTRIBUTE_UNIQUEID) then
if it:isContainer() then
volume = it:getCapacity()
else
volume = item:getCapacity()
end
end
if volume ~= 0 then
ss:append(' (Vol:%d)', volume)
end
else
local found = true
if abilities.speed > 0 then
ss:append(' (speed %s%d)', showpos(abilities.speed), math.abs(abilities.speed / 2))
elseif bit.band(abilities.conditionSuppressions, CONDITION_DRUNK) == 1 then
ss:append(' (hard drinking)')
elseif abilities.invisible then
ss:append(' (invisibility)')
elseif abilities.regeneration then
ss:append(' (faster regeneration)')
elseif abilities.manashield then
ss:append(' (mana shield)')
else
found = false
end
if not found then
if it:getType() == ITEM_TYPE_KEY then
local aid = item and item:getActionId() or 0
ss:append(' (Key:%s)', ('0'):rep(4 - #tostring(aid)) .. aid)
elseif it:getGroup() == ITEM_GROUP_FLUID then
if subType > 0 then
local name = getSubTypeName(subType)
ss:append(' of %s', name ~= '' and name or 'unknown')
else
ss:append('. It is empty')
end
elseif it:getGroup() == ITEM_GROUP_SPLASH then
local name = getSubTypeName(subType)
ss:append(' of ')
if subType > 0 and name ~= '' then
ss:append(name)
else
ss:append('unknown')
end
elseif it:hasAllowDistRead() and (it:getId() < 7369 or it:getId() > 7371) then
ss:append('.\n')
if lookDistance <= 4 then
if item then
if not text then
text = item:getText()
end
if text then
local writer = item:getWriter()
if writer then
local date = item:getDate()
ss:append('%s wrote', writer)
if date then
ss:append(' on %s', os.date('%d %b %Y'))
end
ss:append(': ')
else
ss:append('You read: ')
end
ss:append(text)
else
ss:append('Nothing is written on it')
end
else
ss:append('Nothing is written on it')
end
else
ss:append('You are too far away to read it.')
end
elseif it:getLevelDoor() ~= 0 and item then
local aid = item:getActionId()
if aid >= it:getLevelDoor() then
ss:append(' for level %d', aid - it:getLevelDoor())
end
end
end
end
if it:hasShowCharges() then
ss:append(' that has %d charge%s left', subType, subType ~= -1 and 's' or '')
end
-- show duration
if it:hasShowDuration() then
if item and item:hasAttribute(ITEM_ATTRIBUTE_DURATION) then
local duration = item:getDuration() / 1000
if duration > 0 then
ss:append(' that will expire in ')
if duration >= 86400 then
local days = math.floor(duration / 86400)
local hours = math.floor((duration % 86400) / 3600)
ss:append('%d day%s', days, days ~= 1 and 's' or '')
if hours > 0 then
ss:append(' and %d hour%s', hours, hours ~= 1 and 's' or '')
end
elseif duration >= 3600 then
local hours = math.floor(duration / 3600)
local minutes = math.floor((duration % 3600) / 60)
ss:append('%d hour%s', hours, hours ~= 1 and 's' or '')
if minutes > 0 then
ss:append(' and %d minute%s', minutes, minutes ~= 1 and 's' or '')
end
elseif duration >= 60 then
local minutes = math.floor(duration / 60)
local seconds = duration % 60
ss:append('%d minute%s', minutes, minutes ~= 1 and 's' or '')
if seconds > 0 then
ss:append(' and %d second%s', seconds, seconds ~= 1 and 's' or '')
end
else
ss:append('%d second%s', duration, duration ~= 1 and 's' or '')
end
end
else
ss:append(' that is brand-new')
end
end
if not it:hasAllowDistRead() or (it:getId() >= 7369 and it:getId() <= 7371) then
ss:append('.')
else
if not text and item then
text = item:getText()
end
if not text or text == '' then
ss:append('.')
end
end
local wieldInfo = it:getWieldInfo()
if wieldInfo ~= 0 then
ss:append('\nIt can only be wielded properly by ')
if bit.band(wieldInfo, WIELDINFO_PREMIUM) ~= 0 then
ss:append('premium ')
end
local vocStr = it:getVocationString()
if vocStr ~= '' then
ss:append(vocStr)
else
ss:append('players')
end
if bit.band(wieldInfo, WIELDINFO_LEVEL) ~= 0 then
ss:append(' of level %d or higher', it:getMinReqLevel())
end
if bit.band(wieldInfo, WIELDINFO_MAGLV) ~= 0 then
if bit.band(wieldInfo, WIELDINFO_LEVEL) ~= 0 then
ss:append(' and')
else
ss:append(' of')
end
ss:append(' magic level %d or higher', it:getMinReqMagicLevel())
end
ss:append('.')
end
if lookDistance <= 1 then
local weight = obj:getWeight()
local count = item and item:getCount() or 1
if weight ~= 0 and it:isPickupable() then
ss:append('\n')
if it:isStackable() and count > 1 and it:hasShowCount() then
ss:append('They weigh ')
else
ss:append('It weighs ')
end
ss:append('%.2f oz.', weight / 100)
end
end
local desc = it:getDescription()
if item then
local specialDesc = item:getSpecialDescription()
if specialDesc ~= '' then
ss:append('\n%s', specialDesc)
elseif lookDistance <= 1 and desc ~= '' then
ss:append('\n%s', desc)
end
elseif lookDistance <= 1 and desc ~= '' then
ss:append('\n%s', it:getDescription())
end
if it:hasAllowDistRead() or (it:getId() >= 7369 and it:getId() <= 7371) then
if not text and item then
text = item:getText()
end
if text and text ~= '' then
ss:append('\n%s', text)
end
end
return ss:concat()
end
if not oldItemDesc then
oldItemDesc = Item.getDescription
end
if configManager.getBoolean(configKeys.LUA_ITEM_DESC) then
function Item.getDescription(self, lookDistance, subType)
return internalItemGetDescription(self:getType(), lookDistance, self, subType)
end
function ItemType.getItemDescription(self, lookDistance, subType)
return internalItemGetDescription(self, lookDistance, nil, subType)
end
else
Item.getDescription = oldItemDesc
end
end
-- empty fluid container suffix
if itemGroup == ITEM_GROUP_FLUID and subType < 1 then
response[#response + 1] = " It is empty."
end
-- house door
if isDoor and not isVirtual then
local tile = item:getTile()
if tile then
local house = tile:getHouse()
if house then
local houseName = house:getName()
local houseOwnerName = house:getOwnerName()
local isForSale = false
if not houseOwnerName or houseOwnerName:len() == 0 then
houseOwnerName = "Nobody"
isForSale = true
end
response[#response + 1] = string.format(" It belongs to house '%s'. %s owns this house.", houseName, houseOwnerName)
if housePriceVisible and isForSale and pricePerSQM > 0 then
response[#response + 1] = string.format(" It costs %d gold coins.", pricePerSQM * house:getTileCount())
end
end
end
end
-- house door
if isDoor and not isVirtual then
local tile = item:getTile()
if tile then
local house = tile:getHouse()
if house then
local houseName = house:getName()
local houseOwnerName = house:getOwnerName()
--local isForSale = false
if not houseOwnerName or houseOwnerName:len() == 0 then
houseOwnerName = "Nobody"
--isForSale = true
end
response[#response + 1] = string.format(" It belongs to house '%s'. %s owns this house.", houseName, houseOwnerName)
if housePriceVisible and isForSale and pricePerSQM > 0 then
response[#response + 1] = string.format(" It costs %d gold coins.", pricePerSQM * house:getTileCount())
end
end
end
end
bool IOMapSerialize::saveHouseInfo()
{
Database& db = Database::getInstance();
DBTransaction transaction;
if (!transaction.begin()) {
return false;
}
if (!db.executeQuery("DELETE FROM `house_lists`")) {
return false;
}
for (const auto& it : g_game.map.houses.getHouses()) {
House* house = it.second;
DBResult_ptr result = db.storeQuery(fmt::format("SELECT `id` FROM `houses` WHERE `id` = {:d}", house->getId()));
if (result) {
db.executeQuery(fmt::format("UPDATE `houses` SET `owner` = {:d}, `paid` = {:d}, `warnings` = {:d}, `name` = {:s}, `town_id` = {:d}, `rent` = {:d}, `size` = {:d}, `beds` = {:d} WHERE `id` = {:d}", house->getOwner(), house->getPaidUntil(), house->getPayRentWarnings(), db.escapeString(house->getName()), house->getTownId(), house->getRent(), house->getTiles().size(), house->getBedCount(), house->getId()));
} else {
db.executeQuery(fmt::format("INSERT INTO `houses` (`id`, `owner`, `paid`, `warnings`, `name`, `town_id`, `rent`, `size`, `beds`) VALUES ({:d}, {:d}, {:d}, {:d}, {:s}, {:d}, {:d}, {:d}, {:d})", house->getId(), house->getOwner(), house->getPaidUntil(), house->getPayRentWarnings(), db.escapeString(house->getName()), house->getTownId(), house->getRent(), house->getTiles().size(), house->getBedCount()));
}
}
DBInsert stmt("INSERT INTO `house_lists` (`house_id` , `listid` , `list`) VALUES ");
for (const auto& it : g_game.map.houses.getHouses()) {
House* house = it.second;
std::string listText;
if (house->getAccessList(GUEST_LIST, listText) && !listText.empty()) {
if (!stmt.addRow(
fmt::format("{:d}, {}, {:s}", house->getId(), format_as(GUEST_LIST), db.escapeString(listText)))) {
return false;
}
listText.clear();
}
if (house->getAccessList(SUBOWNER_LIST, listText) && !listText.empty()) {
if (!stmt.addRow(fmt::format("{:d}, {}, {:s}", house->getId(), format_as(SUBOWNER_LIST),
db.escapeString(listText)))) {
return false;
}
listText.clear();
}
for (Door* door : house->getDoors()) {
if (door->getAccessList(listText) && !listText.empty()) {
if (!stmt.addRow(fmt::format("{:d}, {:d}, {:s}", house->getId(), door->getDoorId(), db.escapeString(listText)))) {
return false;
}
listText.clear();
}
}
}
if (!stmt.execute()) {
return false;
}
return transaction.commit();
}
It belongs to house 'Sunset Homes, Flat 01'. Nobody owns this house. It costs 20000 gold coins.
Item ID: 1219
Position: 32332, 32232, 7
@ -113,6 +113,7 @@ void House::setOwner(uint32_t guid, bool updateDatabase/* = true*/, Player* play
void House::addDoor(Door* door)
updateDoorDescription();