eternalthug
New Member
- Joined
- Jul 25, 2009
- Messages
- 51
- Reaction score
- 0
Hey i got tfs 0.4.0 and my furniture isn't working.... anybody else get this problem?
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() end
-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
keywordHandler:addKeyword({'chairs'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell wooden, sofa, red cushioned, green cushioned, tusk and ivory chairs.'})
keywordHandler:addKeyword({'tables'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell big, square, round, small, stone, tusk, bamboo tables.'})
keywordHandler:addKeyword({'plants'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell pink and green flowers, also christmas trees.'})
keywordHandler:addKeyword({'furniture'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell large trunks, boxes, drawers, dressers, lockers and troughs.'})
keywordHandler:addKeyword({'more'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell coal basins, birdcages, harps, pianos, globes, clocks and lamps.'})
keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell blue, green, orange, pink, red, white and yellow tapestries.'})
keywordHandler:addKeyword({'small'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell small purple, small green, small red, small blue, small orange, small turquiose and small white pillows.'})
keywordHandler:addKeyword({'round'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell round blue, round red, round purple and round turquiose pillows.'})
keywordHandler:addKeyword({'square'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell blue, red, green and yellow pillows.'})
keywordHandler:addKeyword({'pillows'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell heart, small, sqare and round pillows.'})
keywordHandler:addKeyword({'beds'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell {green}, {red} and {yellow} {beds} for {5000}gp. I can sell you too standard bed (to remove modification)'})
npcHandler:addModule(FocusModule:new())
local CONSTRUCTIONS = {
[3901] = 1650, [3902] = 1658, [3903] = 1666, [3904] = 1670, [3905] = 3813, [3906] = 3817, [3907] = 2093, [3908] = 2603, [3909] = 1614, [3910] = 1615,
[3911] = 1616, [3912] = 1619, [3913] = 3805, [3914] = 3807, [3915] = 1740, [3916] = 1774, [3917] = 2084, [3918] = 2095, [3919] = 3809, [3920] = 3832,
[3921] = 1714, [3922] = 2107, [3923] = 2104, [3924] = 7670, [3925] = 1740, [3926] = 2080, [3927] = 2098, [3928] = 1676, [3929] = 2101, [3930] = 1739,
[3931] = 2105, [3932] = 1724, [3933] = 1728, [3934] = 1732, [3935] = 1775, [3936] = 3812, [3937] = 2064, [3938] = 6371, [5086] = 1738, [5087] = 1741, [5088] = 1770,
[6114] = 2106, [6115] = 2034, [6372] = 3811, [6373] = 1736, [7503] = 1750, [7700] = 5928, [7960] = 3821, [7961] = 3811, [7962] = 2582, [8692] = 8688, [8693] = 7486
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(fromPosition.x == CONTAINER_POSITION) then
doPlayerSendCancel(cid, "Put the construction kit on the floor first.")
elseif(not getTileInfo(fromPosition).house) then
doPlayerSendCancel(cid,"You may construct this only inside a house.")
elseif(CONSTRUCTIONS[item.itemid] ~= nil) then
doTransformItem(item.uid, CONSTRUCTIONS[item.itemid])
doSendMagicEffect(fromPosition, CONST_ME_POFF)
else
return false
end
return true
end
local BEDS = {
[7904] = {{7811, 7812}, {7813, 7814}}, -- green kit
[7905] = {{7815, 7816}, {7817, 7818}}, -- red kit
[7906] = {{7819, 7820}, {7821, 7822}}, -- yellow kit
[7907] = {{1754, 1755}, {1760, 1761}} -- removal kit
}
local function internalBedTransform(item, itemEx, toPosition, ids)
doTransformItem(itemEx.uid, ids[1])
doTransformItem(getThingfromPos(toPosition).uid, ids[2])
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_POFF)
doSendMagicEffect(toPosition, CONST_ME_POFF)
doRemoveItem(item.uid)
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local newBed = BEDS[item.itemid]
if(not newBed or not getHouseFromPos(getCreaturePosition(cid))) then
return false
end
--TODO
--Is it possible in real tibia, to use same modification on current used?
if(isInArray({newBed[1][1], newBed[2][1]}, itemEx.itemid)) then
doPlayerSendCancel(cid, "You already have this bed modification.")
return true
end
for kit, bed in pairs(BEDS) do
if(bed[1][1] == itemEx.itemid or itemEx.itemid == 1758) then
toPosition.y = toPosition.y + 1
internalBedTransform(item, itemEx, toPosition, newBed[1])
break
elseif(bed[2][1] == itemEx.itemid or itemEx.itemid == 1756) then
toPosition.x = toPosition.x + 1
internalBedTransform(item, itemEx, toPosition, newBed[2])
break
end
end
return true
end
<!-- Construction kits -->
<action fromid="3901" toid="3938" event="script" value="other/constructionkits.lua"/>
<action fromid="5086" toid="5088" event="script" value="other/constructionkits.lua"/>
<action fromid="6114" toid="6115" event="script" value="other/constructionkits.lua"/>
<action fromid="6372" toid="6373" event="script" value="other/constructionkits.lua"/>
<action fromid="7960" toid="7962" event="script" value="other/constructionkits.lua"/>
<action fromid="8692" toid="8693" event="script" value="other/constructionkits.lua"/>
<action itemid="7503" event="script" value="other/constructionkits.lua"/>
<action itemid="7700" event="script" value="other/constructionkits.lua"/>
<!-- Bed construction kits -->
<action fromid="7904" toid="7907" event="script" value="other/furniturebeds.lua"/>