• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

OTClient Magic Wall Timer(pure hack)

Yamaken

Pro OpenTibia Developer
Joined
Jul 27, 2013
Messages
534
Solutions
4
Reaction score
431
Well i have only dedicated few hours to this and i'm not willing to spend more to make it more performance wise.

Inside map.cpp:

replace
Code:
void Map::addThing(const ThingPtr& thing, const Position& pos, int stackPos)
{
    if(!thing)
        return;

    if(thing->isItem() || thing->isCreature() || thing->isEffect()) {
        const TilePtr& tile = getOrCreateTile(pos);
        if(tile)
            tile->addThing(thing, stackPos);
with this:
Code:
void Map::addThing(const ThingPtr& thing, const Position& pos, int stackPos)
{
    if(!thing)
        return;

    if(thing->isItem() || thing->isCreature() || thing->isEffect()) {
        const TilePtr& tile = getOrCreateTile(pos);
        if (tile) {
            tile->addThing(thing, stackPos);

            if (thing->isItem()) {
                thing->static_self_cast<Item>()->mwTimer();
            }
        }

on item.h:
after:
Code:
ThingType *rawGetThingType();
add:
Code:
void mwTimer();

after:
Code:
ticks_t m_lastPhase;
add:
Code:
    Timer m_mwAnimationTimer;
    uint16_t m_mwTime;
    BitmapFontPtr m_mwFont;
    bool m_isMW;

inside item.cpp:

replace this:

Code:
Item::Item() :
m_clientId(0),
m_serverId(0),
m_countOrSubType(1),
m_color(Color::alpha),
m_async(true),
m_phase(0),
m_lastPhase(0)

with this:

Code:
Item::Item() :
    m_clientId(0),
    m_serverId(0),
    m_countOrSubType(1),
    m_color(Color::alpha),
    m_async(true),
    m_phase(0),
    m_lastPhase(0),
    m_isMW(false)

find Item::draw, inside Item::draw:

After this:
Code:
rawGetThingType()->draw(dest, scaleFactor, 0, xPattern, yPattern, zPattern, animationPhase, lightView);

add:
Code:
    if (m_isMW) {
        std::string text = stdext::to_string(static_cast<float>(m_mwTime - m_mwAnimationTimer.ticksElapsed()) / 1000);
        g_painter->setColor(Color::white);
        m_mwFont->drawText(text, Rect(dest.x - 20, dest.y - 12, 20, 20));
    }


add at the item.cpp file end:

Code:
void Item::mwTimer()
{
    if (m_clientId == 2128) {
        m_mwAnimationTimer.restart();
        m_mwTime = 20000;
        m_isMW = true;

        m_mwFont = g_fonts.getFont("verdana-11px-rounded");
    }
}

change 2128 to magic wall client id.

As said, its a hack but at least it works.

Result:

mX87Z8V.png
 
Last edited:
After login in account when i try to login a character, thats what happen:

Client crash and show it on otclient.log
Code:
ERROR: Unable to send extended opcode 1, extended opcodes are not enabled
ERROR: invalid effect id 31
C++ stack traceback:
   [C++]: ProtocolGame::parseMagicEffect
   /home/ubuntu/Documents/otclient/build/otclient(ProtocolGame::parseMagicEffect(stdext::shared_object_ptr<InputMessage> const&)+0x13b) [0x928653]
   /home/ubuntu/Documents/otclient/build/otclient(ProtocolGame::parseMessage(stdext::shared_object_ptr<InputMessage> const&)+0x440) [0x92ea0e]
   /home/ubuntu/Documents/otclient/build/otclient(ProtocolGame::onRecv(stdext::shared_object_ptr<InputMessage> const&)+0x132) [0x91fac6]
   /home/ubuntu/Documents/otclient/build/otclient(Protocol::internalRecvData(unsigned char*, unsigned short)+0x274) [0x84c4ac]
   /home/ubuntu/Documents/otclient/build/otclient(std::_Function_handler<void (unsigned char*, unsigned short), std::_Bind<std::_Mem_fn<void (Protocol::*)(unsigned char*, unsigned short)> (stdext::shared_object_ptr<Protocol>, std::_Placeholder<1>, std::_Placeholder<2>)> >::_M_invoke(std::_Any_data const&, unsigned char*&&, unsigned short&&)+0x4a) [0x84caee]
   /home/ubuntu/Documents/otclient/build/otclient(Connection::onRecv(boost::system::error_code const&, unsigned long)+0x86) [0x83dfda]
   /home/ubuntu/Documents/otclient/build/otclient(boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, std::_Bind<std::_Mem_fn<void (Connection::*)(boost::system::error_code const&, unsigned long)> (stdext::shared_object_ptr<Connection>, std::_Placeholder<1>, std::_Placeholder<2>)> >::operator()(boost::system::error_code const&, unsigned long, int)+0x329) [0x847cef]
   /home/ubuntu/Documents/otclient/build/otclient(boost::asio::detail::reactive_socket_recv_op<boost::asio::mutable_buffers_1, boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, std::_Bind<std::_Mem_fn<void (Connection::*)(boost::system::error_code const&, unsigned long)> (stdext::shared_object_ptr<Connection>, std::_Placeholder<1>, std::_Placeholder<2>)> > >::do_complete(boost::asio::detail::task_io_service*, boost::asio::detail::task_io_service_operation*, boost::system::error_code const&, unsigned long)+0xc8) [0x847dec]
ERROR: Application crashed
app name: OTClient
app version: 0.6.6
build compiler: gcc 5.4.0 20160609
build date: Mar 23 2017
build type: RelWithDebInfo
build revision: 0 (devel)
crash date: Mar 23 2017 23:41:38
  at rip = 0x7f5368129428
     rax = 0
     rbx = 0x7f535b137000
     rcx = 0x7f5368129428
     rdx = 0x6
     rsi = 0x675d
     rdi = 0x675d
     rbp = 0xb2e078
     rsp = 0x7ffda8184018
     efl = 0x202

  backtrace:
    1: /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38) [0x7f5368129428]
    2: /lib/x86_64-linux-gnu/libc.so.6(abort+0x16a) [0x7f536812b02a]
    3: /lib/x86_64-linux-gnu/libc.so.6(+0x2dbd7) [0x7f5368121bd7]
    4: /lib/x86_64-linux-gnu/libc.so.6(+0x2dc82) [0x7f5368121c82]
    5: /home/ubuntu/Documents/otclient/build/otclient(Item::draw(TPoint<int> const&, float, bool, LightView*)+0x214) [0x8db8f6]
    6: /home/ubuntu/Documents/otclient/build/otclient(Tile::draw(TPoint<int> const&, float, int, LightView*)+0x3dd) [0x90756b]
    7: /home/ubuntu/Documents/otclient/build/otclient(MapView::draw(TRect<int> const&)+0x463) [0x8f1403]
    8: /home/ubuntu/Documents/otclient/build/otclient(UIMap::drawSelf(Fw::DrawPane)+0x127) [0x93de91]
    9: /home/ubuntu/Documents/otclient/build/otclient(UIWidget::draw(TRect<int> const&, Fw::DrawPane)+0xf1) [0x8064c7]
    10: /home/ubuntu/Documents/otclient/build/otclient(UIWidget::drawChildren(TRect<int> const&, Fw::DrawPane)+0x20d) [0x80599f]
    11: /home/ubuntu/Documents/otclient/build/otclient(UIWidget::draw(TRect<int> const&, Fw::DrawPane)+0x227) [0x8065fd]
    12: /home/ubuntu/Documents/otclient/build/otclient(UIWidget::drawChildren(TRect<int> const&, Fw::DrawPane)+0x20d) [0x80599f]
    13: /home/ubuntu/Documents/otclient/build/otclient(UIWidget::draw(TRect<int> const&, Fw::DrawPane)+0x227) [0x8065fd]
    14: /home/ubuntu/Documents/otclient/build/otclient(UIManager::render(Fw::DrawPane)+0x5f) [0x7ee6a5]
    15: /home/ubuntu/Documents/otclient/build/otclient(GraphicalApplication::run()+0x2ab) [0x825147]
    16: /home/ubuntu/Documents/otclient/build/otclient(main+0x21a) [0x941365]

ERROR: Failed to save crash report!
 
Your client is not crashing too @Yamaken ?
Because it's not work here, compile fine, but when i try to login, client crashes
 
No its not crashing. Try changing the magic wall id(2128) in the code for the real magic wall id on the newer versions.
 
No its not crashing. Try changing the magic wall id(2128) in the code for the real magic wall id on the newer versions.

it's start to crashing here :(
after add your mw times codes...

after i remove back stop to crash

2128 is for witch version?
how to get items ID for OTclient?
There is a way to print ID while look like is on bots for tibia?
 
After login in account when i try to login a character, thats what happen:

Client crash and show it on otclient.log
Code:
ERROR: Unable to send extended opcode 1, extended opcodes are not enabled
ERROR: invalid effect id 31
C++ stack traceback:
   [C++]: ProtocolGame::parseMagicEffect
   /home/ubuntu/Documents/otclient/build/otclient(ProtocolGame::parseMagicEffect(stdext::shared_object_ptr<InputMessage> const&)+0x13b) [0x928653]
   /home/ubuntu/Documents/otclient/build/otclient(ProtocolGame::parseMessage(stdext::shared_object_ptr<InputMessage> const&)+0x440) [0x92ea0e]
   /home/ubuntu/Documents/otclient/build/otclient(ProtocolGame::onRecv(stdext::shared_object_ptr<InputMessage> const&)+0x132) [0x91fac6]
   /home/ubuntu/Documents/otclient/build/otclient(Protocol::internalRecvData(unsigned char*, unsigned short)+0x274) [0x84c4ac]
   /home/ubuntu/Documents/otclient/build/otclient(std::_Function_handler<void (unsigned char*, unsigned short), std::_Bind<std::_Mem_fn<void (Protocol::*)(unsigned char*, unsigned short)> (stdext::shared_object_ptr<Protocol>, std::_Placeholder<1>, std::_Placeholder<2>)> >::_M_invoke(std::_Any_data const&, unsigned char*&&, unsigned short&&)+0x4a) [0x84caee]
   /home/ubuntu/Documents/otclient/build/otclient(Connection::onRecv(boost::system::error_code const&, unsigned long)+0x86) [0x83dfda]
   /home/ubuntu/Documents/otclient/build/otclient(boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, std::_Bind<std::_Mem_fn<void (Connection::*)(boost::system::error_code const&, unsigned long)> (stdext::shared_object_ptr<Connection>, std::_Placeholder<1>, std::_Placeholder<2>)> >::operator()(boost::system::error_code const&, unsigned long, int)+0x329) [0x847cef]
   /home/ubuntu/Documents/otclient/build/otclient(boost::asio::detail::reactive_socket_recv_op<boost::asio::mutable_buffers_1, boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, std::_Bind<std::_Mem_fn<void (Connection::*)(boost::system::error_code const&, unsigned long)> (stdext::shared_object_ptr<Connection>, std::_Placeholder<1>, std::_Placeholder<2>)> > >::do_complete(boost::asio::detail::task_io_service*, boost::asio::detail::task_io_service_operation*, boost::system::error_code const&, unsigned long)+0xc8) [0x847dec]
ERROR: Application crashed
app name: OTClient
app version: 0.6.6
build compiler: gcc 5.4.0 20160609
build date: Mar 23 2017
build type: RelWithDebInfo
build revision: 0 (devel)
crash date: Mar 23 2017 23:41:38
  at rip = 0x7f5368129428
     rax = 0
     rbx = 0x7f535b137000
     rcx = 0x7f5368129428
     rdx = 0x6
     rsi = 0x675d
     rdi = 0x675d
     rbp = 0xb2e078
     rsp = 0x7ffda8184018
     efl = 0x202

  backtrace:
    1: /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38) [0x7f5368129428]
    2: /lib/x86_64-linux-gnu/libc.so.6(abort+0x16a) [0x7f536812b02a]
    3: /lib/x86_64-linux-gnu/libc.so.6(+0x2dbd7) [0x7f5368121bd7]
    4: /lib/x86_64-linux-gnu/libc.so.6(+0x2dc82) [0x7f5368121c82]
    5: /home/ubuntu/Documents/otclient/build/otclient(Item::draw(TPoint<int> const&, float, bool, LightView*)+0x214) [0x8db8f6]
    6: /home/ubuntu/Documents/otclient/build/otclient(Tile::draw(TPoint<int> const&, float, int, LightView*)+0x3dd) [0x90756b]
    7: /home/ubuntu/Documents/otclient/build/otclient(MapView::draw(TRect<int> const&)+0x463) [0x8f1403]
    8: /home/ubuntu/Documents/otclient/build/otclient(UIMap::drawSelf(Fw::DrawPane)+0x127) [0x93de91]
    9: /home/ubuntu/Documents/otclient/build/otclient(UIWidget::draw(TRect<int> const&, Fw::DrawPane)+0xf1) [0x8064c7]
    10: /home/ubuntu/Documents/otclient/build/otclient(UIWidget::drawChildren(TRect<int> const&, Fw::DrawPane)+0x20d) [0x80599f]
    11: /home/ubuntu/Documents/otclient/build/otclient(UIWidget::draw(TRect<int> const&, Fw::DrawPane)+0x227) [0x8065fd]
    12: /home/ubuntu/Documents/otclient/build/otclient(UIWidget::drawChildren(TRect<int> const&, Fw::DrawPane)+0x20d) [0x80599f]
    13: /home/ubuntu/Documents/otclient/build/otclient(UIWidget::draw(TRect<int> const&, Fw::DrawPane)+0x227) [0x8065fd]
    14: /home/ubuntu/Documents/otclient/build/otclient(UIManager::render(Fw::DrawPane)+0x5f) [0x7ee6a5]
    15: /home/ubuntu/Documents/otclient/build/otclient(GraphicalApplication::run()+0x2ab) [0x825147]
    16: /home/ubuntu/Documents/otclient/build/otclient(main+0x21a) [0x941365]

ERROR: Failed to save crash report!

Your client is not crashing too @Yamaken ?
Because it's not work here, compile fine, but when i try to login, client crashes

it's start to crashing here :(
after add your mw times codes...

after i remove back stop to crash

2128 is for witch version?
how to get items ID for OTclient?
There is a way to print ID while look like is on bots for tibia?

My bad, i forgot to add this "m_isMW(false)" to the tutorial. Check the tutorial again, you must add this "m_isMW(false)" to the Item::Item() function inside item.cpp.
 
My bad, i forgot to add this "m_isMW(false)" to the tutorial. Check the tutorial again, you must add this "m_isMW(false)" to the Item::Item() function inside item.cpp.

nice its work here now!

how did you get MW id?
how did u get items id for otclient?
 
Last edited:
It's work in 7x servers, but 10x servers not work...
how to get itemsid and check to each version?
 
But how to get it, i want take by my way not ask everytime i need a ID
OtitemEditor, get the magic wall id and then search that id in the otitemeditor to get the client id.
 
Back
Top