diff --git a/src/framework/luafunctions.cpp b/src/framework/luafunctions.cpp index 1925230f..57e42459 100644 --- a/src/framework/luafunctions.cpp +++ b/src/framework/luafunctions.cpp @@ -45,7 +45,6 @@ void Application::registerLuaFunctions() g_lua.bindGlobalFunction("pointtostring", [](const Point& v) { return Fw::tostring(v); }); g_lua.bindGlobalFunction("colortostring", [](const Color& v) { return Fw::tostring(v); }); g_lua.bindGlobalFunction("sizetostring", [](const Size& v) { return Fw::tostring(v); }); - g_lua.bindGlobalFunction("getticks", []() { return g_clock.asyncTicks(); }); // Event g_lua.registerClass(); diff --git a/src/otclient/core/game.cpp b/src/otclient/core/game.cpp index 3b44d317..a7b20285 100644 --- a/src/otclient/core/game.cpp +++ b/src/otclient/core/game.cpp @@ -479,9 +479,8 @@ void Game::walk(Otc::Direction direction) return; // only do prewalks to walkable tiles - TilePtr fromTile = m_localPlayer->getTile(); TilePtr toTile = g_map.getTile(m_localPlayer->getPosition().translatedToDirection(direction)); - if(toTile && toTile->isWalkable()/* && fromTile && fromTile->hasThing(m_localPlayer)*/) + if(toTile && toTile->isWalkable()) m_localPlayer->preWalk(direction); else m_localPlayer->lockWalk(); diff --git a/src/otclient/core/map.cpp b/src/otclient/core/map.cpp index 779bb9c7..a6f6af09 100644 --- a/src/otclient/core/map.cpp +++ b/src/otclient/core/map.cpp @@ -120,6 +120,7 @@ void Map::cleanDynamicThings() removeThing(creature); creature->setRemoved(true); } + m_knownCreatures.clear(); for(int i=0;i<=Otc::MAX_Z;++i) m_floorMissiles[i].clear(); @@ -296,9 +297,9 @@ void Map::setCentralPosition(const Position& centralPosition) logTraceError("invalid creature"); } - // this fixes local player position when the local player is removed fro the map, - // the local player is removed from the map when there are too many creatures on his tile - // so there is not enough stackpos to the server send him + // this fixes local player position when the local player is removed from the map, + // the local player is removed from the map when there are too many creatures on his tile, + // so there is no enough stackpos to the server send him g_eventDispatcher.addEvent([this] { LocalPlayerPtr localPlayer = g_game.getLocalPlayer(); if(!localPlayer || localPlayer->getPosition() == m_centralPosition) diff --git a/src/otclient/net/protocolgameparse.cpp b/src/otclient/net/protocolgameparse.cpp index 1180492a..aa146f9e 100644 --- a/src/otclient/net/protocolgameparse.cpp +++ b/src/otclient/net/protocolgameparse.cpp @@ -445,8 +445,6 @@ void ProtocolGame::parseCreatureMove(InputMessage& msg) if(!g_map.removeThing(thing)) logTraceError("could not remove thing"); g_map.addThing(thing, newPos); - - //g_game.processCreatureMove(creature, oldPos, newPos); } void ProtocolGame::parseOpenContainer(InputMessage& msg) @@ -629,7 +627,7 @@ void ProtocolGame::parseCreatureMark(InputMessage& msg) if(creature) creature->addTimedSquare(color); else - logTraceError("could not get greature"); + logTraceError("could not get creature"); } void ProtocolGame::parseCreatureHealth(InputMessage& msg) @@ -641,7 +639,7 @@ void ProtocolGame::parseCreatureHealth(InputMessage& msg) if(creature) creature->setHealthPercent(healthPercent); else - logTraceError("could not get greature"); + logTraceError("could not get creature"); } void ProtocolGame::parseCreatureLight(InputMessage& msg) @@ -656,7 +654,7 @@ void ProtocolGame::parseCreatureLight(InputMessage& msg) if(creature) creature->setLight(light); else - logTraceError("could not get greature"); + logTraceError("could not get creature"); } void ProtocolGame::parseCreatureOutfit(InputMessage& msg) @@ -668,7 +666,7 @@ void ProtocolGame::parseCreatureOutfit(InputMessage& msg) if(creature) creature->setOutfit(outfit); else - logTraceError("could not get greature"); + logTraceError("could not get creature"); } void ProtocolGame::parseCreatureSpeed(InputMessage& msg) @@ -680,7 +678,7 @@ void ProtocolGame::parseCreatureSpeed(InputMessage& msg) if(creature) creature->setSpeed(speed); else - logTraceError("could not get greature"); + logTraceError("could not get creature"); } void ProtocolGame::parseCreatureSkulls(InputMessage& msg) @@ -692,7 +690,7 @@ void ProtocolGame::parseCreatureSkulls(InputMessage& msg) if(creature) creature->setSkull(skull); else - logTraceError("could not get greature"); + logTraceError("could not get creature"); } void ProtocolGame::parseCreatureShields(InputMessage& msg) @@ -704,7 +702,7 @@ void ProtocolGame::parseCreatureShields(InputMessage& msg) if(creature) creature->setShield(shield); else - logTraceError("could not get greature"); + logTraceError("could not get creature"); } void ProtocolGame::parseCreatureUnpass(InputMessage& msg) @@ -716,7 +714,7 @@ void ProtocolGame::parseCreatureUnpass(InputMessage& msg) if(creature) creature->setPassable(!unpass); else - logTraceError("could not get greature"); + logTraceError("could not get creature"); } void ProtocolGame::parseCreatureTurn(InputMessage& msg) @@ -728,7 +726,7 @@ void ProtocolGame::parseCreatureTurn(InputMessage& msg) if(creature) creature->turn(direction); else - logTraceError("could not get greature"); + logTraceError("could not get creature"); } void ProtocolGame::parseEditText(InputMessage& msg) @@ -1233,10 +1231,12 @@ ThingPtr ProtocolGame::internalGetThing(InputMessage& msg) else logTraceError("creature id is invalid"); - creature->setId(id); - creature->setName(name); + if(creature) { + creature->setId(id); + creature->setName(name); - g_map.addCreature(creature); + g_map.addCreature(creature); + } } int healthPercent = msg.getU8();