Few minor fixes here and there:
* Fixed miniwindow cancelling (sorry Summ! :D) * Fixed pathFind to check floor change tiles * Fixed buying/selling stackable items in pv < 860 * Added force walk to the first step of auto walking for open tibia
This commit is contained in:
parent
6ad7269e5a
commit
1500c1d2f2
|
@ -29,8 +29,8 @@ function init()
|
|||
g_ui.importStyle('styles/countwindow.otui')
|
||||
|
||||
connect(g_game, {
|
||||
onGameStart = show,
|
||||
onGameEnd = hide,
|
||||
onGameStart = onGameStart,
|
||||
onGameEnd = onGameEnd,
|
||||
onLoginAdvice = onLoginAdvice
|
||||
}, true)
|
||||
|
||||
|
@ -98,8 +98,8 @@ end
|
|||
|
||||
function terminate()
|
||||
disconnect(g_game, {
|
||||
onGameStart = show,
|
||||
onGameEnd = hide,
|
||||
onGameStart = onGameStart,
|
||||
onGameEnd = onGameEnd,
|
||||
onLoginAdvice = onLoginAdvice
|
||||
})
|
||||
|
||||
|
@ -109,6 +109,19 @@ function terminate()
|
|||
gameRootPanel:destroy()
|
||||
end
|
||||
|
||||
function onGameStart()
|
||||
show()
|
||||
|
||||
-- open tibia has delay in auto walking
|
||||
if not g_game.isOfficialTibia() then
|
||||
g_game.enableFeature(GameForceFirstAutoWalkStep)
|
||||
end
|
||||
end
|
||||
|
||||
function onGameEnd()
|
||||
hide()
|
||||
end
|
||||
|
||||
function show()
|
||||
connect(g_app, { onClose = tryExit })
|
||||
logoutButton:show()
|
||||
|
|
|
@ -85,13 +85,13 @@ function onGameEditText(id, itemId, maxLength, text, writter, time)
|
|||
end
|
||||
|
||||
okButton.onClick = doneFunc
|
||||
cancelButton.onClick = destroyWindows
|
||||
cancelButton.onClick = destroy
|
||||
|
||||
if not writeable then
|
||||
textWindow.onEnter = doneFunc
|
||||
end
|
||||
|
||||
textWindow.onEscape = destroyWindows
|
||||
textWindow.onEscape = destroy
|
||||
|
||||
table.insert(windows, textWindow)
|
||||
end
|
||||
|
@ -121,10 +121,10 @@ function onGameEditList(id, doorId, text)
|
|||
end
|
||||
|
||||
okButton.onClick = doneFunc
|
||||
cancelButton.onClick = destroyWindows
|
||||
cancelButton.onClick = destroy
|
||||
|
||||
textWindow.onEnter = doneFunc
|
||||
textWindow.onEscape = destroyWindows
|
||||
textWindow.onEscape = destroy
|
||||
|
||||
table.insert(windows, textWindow)
|
||||
end
|
||||
|
|
|
@ -77,6 +77,7 @@ GameBlueNpcNameColor = 33
|
|||
GameDiagonalAnimatedText = 34
|
||||
GameLoginPending = 35
|
||||
GameNewSpeedLaw = 36
|
||||
GameForceFirstAutoWalkStep = 37
|
||||
|
||||
TextColors = {
|
||||
red = '#f55e5e', --'#c83200'
|
||||
|
|
|
@ -347,6 +347,7 @@ namespace Otc
|
|||
GameDiagonalAnimatedText = 34,
|
||||
GameLoginPending = 35,
|
||||
GameNewSpeedLaw = 36,
|
||||
GameForceFirstAutoWalkStep = 37,
|
||||
// 51-100 reserved to be defined in lua
|
||||
LastGameFeature = 101
|
||||
};
|
||||
|
@ -363,7 +364,8 @@ namespace Otc
|
|||
PathFindAllowNullTiles = 1,
|
||||
PathFindAllowCreatures = 2,
|
||||
PathFindAllowNonPathable = 4,
|
||||
PathFindAllowNonWalkable = 8
|
||||
PathFindAllowNonWalkable = 8,
|
||||
PathFindAllowChangeFloor = 16
|
||||
};
|
||||
|
||||
enum AutomapFlags
|
||||
|
|
|
@ -619,13 +619,17 @@ void Game::autoWalk(std::vector<Otc::Direction> dirs)
|
|||
if(isFollowing())
|
||||
cancelFollow();
|
||||
|
||||
Otc::Direction direction = dirs.front();
|
||||
auto it = dirs.begin();
|
||||
Otc::Direction direction = *it;
|
||||
if(m_localPlayer->canWalk(direction)) {
|
||||
TilePtr toTile = g_map.getTile(m_localPlayer->getPosition().translatedToDirection(direction));
|
||||
if(toTile && toTile->isWalkable() && !m_localPlayer->isAutoWalking()) {
|
||||
m_localPlayer->preWalk(direction);
|
||||
//forceWalk(direction);
|
||||
//dirs.erase(it);
|
||||
|
||||
if(getFeature(Otc::GameForceFirstAutoWalkStep)) {
|
||||
forceWalk(direction);
|
||||
dirs.erase(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -210,7 +210,9 @@ int Item::getSubType()
|
|||
{
|
||||
if(isSplash() || isFluidContainer())
|
||||
return m_countOrSubType;
|
||||
if(g_game.getProtocolVersion() >= 860)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Item::getCount()
|
||||
|
|
|
@ -600,7 +600,7 @@ std::tuple<std::vector<Otc::Direction>, Otc::PathFindResult> Map::findPath(const
|
|||
but it is breaking normal path finding.
|
||||
*/
|
||||
if(!(flags & Otc::PathFindAllowNullTiles) && !tile)
|
||||
walkFactor = 2.0f;
|
||||
walkFactor = 3.0f;
|
||||
if(tile) {
|
||||
if(!(flags & Otc::PathFindAllowCreatures) && tile->hasCreature())
|
||||
continue;
|
||||
|
@ -608,6 +608,8 @@ std::tuple<std::vector<Otc::Direction>, Otc::PathFindResult> Map::findPath(const
|
|||
continue;
|
||||
if(!(flags & Otc::PathFindAllowNonWalkable) && !tile->isWalkable())
|
||||
continue;
|
||||
if(!(flags & Otc::PathFindAllowChangeFloor) && tile->changesFloor())
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue