I'm having an issue with my OTC that I edited to log into Cipsoft Files, and the only problem I couldn't fix was the use of mana and life fluids. It works under ladder and dirt floor, for example, but it doesn't work on other floors. I've edited both the Lua and C++ files, but I couldn't get the expected result.


In Lua, the responsible function is this one here.
And in C++, maybe this is the issue.
If anyone has any suggestions and wants to help, I can share the OTC.


In Lua, the responsible function is this one here.
function onUseWith(clickedWidget, mousePosition)
if clickedWidget:getClassName() == 'UIGameMap' then
local tile = clickedWidget:getTile(mousePosition)
if tile then
if selectedThing:isFluidContainer() or selectedThing:isMultiUse() then
if selectedThing:getId() == 3180 or selectedThing:getId() == 3156 then
-- special version for mwall
g_game.useWith(selectedThing, tile:getTopUseThing(), selectedSubtype)
else
g_game.useWith(selectedThing, tile:getTopUseThing(), selectedSubtype)
modules.game_textmessage.displayFailureMessage(tr('aqui.'))
end
else
g_game.useWith(selectedThing, tile:getTopUseThing(), selectedSubtype)
end
end
elseif clickedWidget:getClassName() == 'UIItem' and not clickedWidget:isVirtual() then
g_game.useWith(selectedThing, clickedWidget:getItem(), selectedSubtype)
elseif clickedWidget:getClassName() == 'UICreatureButton' then
local creature = clickedWidget:getCreature()
if creature then
if creature:isMonster() then
g_game.useWith(selectedThing, creature, selectedSubtype)
else
modules.game_textmessage.displayFailureMessage(tr("You are not allowed to shoot directly on players."))
end
end
end
end
And in C++, maybe this is the issue.
ThingPtr Tile::getTopUseThing()
{
if(isEmpty())
return nullptr;
for(uint i = 0; i < m_things.size(); ++i) {
ThingPtr thing = m_things;
if (thing->isForceUse() || (!thing->isGround() && !thing->isGroundBorder() && !thing->isOnBottom() && !thing->isOnTop() && !thing->isCreature() && !thing->isSplash()))
return thing;
}
for (uint i = m_things.size() - 1; i > 0; --i) {
ThingPtr thing = m_things;
if (!thing->isSplash() && !thing->isCreature())
return thing;
}
return m_things[0];
}
If anyone has any suggestions and wants to help, I can share the OTC.