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')
|
g_ui.importStyle('styles/countwindow.otui')
|
||||||
|
|
||||||
connect(g_game, {
|
connect(g_game, {
|
||||||
onGameStart = show,
|
onGameStart = onGameStart,
|
||||||
onGameEnd = hide,
|
onGameEnd = onGameEnd,
|
||||||
onLoginAdvice = onLoginAdvice
|
onLoginAdvice = onLoginAdvice
|
||||||
}, true)
|
}, true)
|
||||||
|
|
||||||
|
@ -98,8 +98,8 @@ end
|
||||||
|
|
||||||
function terminate()
|
function terminate()
|
||||||
disconnect(g_game, {
|
disconnect(g_game, {
|
||||||
onGameStart = show,
|
onGameStart = onGameStart,
|
||||||
onGameEnd = hide,
|
onGameEnd = onGameEnd,
|
||||||
onLoginAdvice = onLoginAdvice
|
onLoginAdvice = onLoginAdvice
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -109,6 +109,19 @@ function terminate()
|
||||||
gameRootPanel:destroy()
|
gameRootPanel:destroy()
|
||||||
end
|
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()
|
function show()
|
||||||
connect(g_app, { onClose = tryExit })
|
connect(g_app, { onClose = tryExit })
|
||||||
logoutButton:show()
|
logoutButton:show()
|
||||||
|
|
|
@ -85,13 +85,13 @@ function onGameEditText(id, itemId, maxLength, text, writter, time)
|
||||||
end
|
end
|
||||||
|
|
||||||
okButton.onClick = doneFunc
|
okButton.onClick = doneFunc
|
||||||
cancelButton.onClick = destroyWindows
|
cancelButton.onClick = destroy
|
||||||
|
|
||||||
if not writeable then
|
if not writeable then
|
||||||
textWindow.onEnter = doneFunc
|
textWindow.onEnter = doneFunc
|
||||||
end
|
end
|
||||||
|
|
||||||
textWindow.onEscape = destroyWindows
|
textWindow.onEscape = destroy
|
||||||
|
|
||||||
table.insert(windows, textWindow)
|
table.insert(windows, textWindow)
|
||||||
end
|
end
|
||||||
|
@ -121,10 +121,10 @@ function onGameEditList(id, doorId, text)
|
||||||
end
|
end
|
||||||
|
|
||||||
okButton.onClick = doneFunc
|
okButton.onClick = doneFunc
|
||||||
cancelButton.onClick = destroyWindows
|
cancelButton.onClick = destroy
|
||||||
|
|
||||||
textWindow.onEnter = doneFunc
|
textWindow.onEnter = doneFunc
|
||||||
textWindow.onEscape = destroyWindows
|
textWindow.onEscape = destroy
|
||||||
|
|
||||||
table.insert(windows, textWindow)
|
table.insert(windows, textWindow)
|
||||||
end
|
end
|
||||||
|
|
|
@ -77,6 +77,7 @@ GameBlueNpcNameColor = 33
|
||||||
GameDiagonalAnimatedText = 34
|
GameDiagonalAnimatedText = 34
|
||||||
GameLoginPending = 35
|
GameLoginPending = 35
|
||||||
GameNewSpeedLaw = 36
|
GameNewSpeedLaw = 36
|
||||||
|
GameForceFirstAutoWalkStep = 37
|
||||||
|
|
||||||
TextColors = {
|
TextColors = {
|
||||||
red = '#f55e5e', --'#c83200'
|
red = '#f55e5e', --'#c83200'
|
||||||
|
|
|
@ -347,6 +347,7 @@ namespace Otc
|
||||||
GameDiagonalAnimatedText = 34,
|
GameDiagonalAnimatedText = 34,
|
||||||
GameLoginPending = 35,
|
GameLoginPending = 35,
|
||||||
GameNewSpeedLaw = 36,
|
GameNewSpeedLaw = 36,
|
||||||
|
GameForceFirstAutoWalkStep = 37,
|
||||||
// 51-100 reserved to be defined in lua
|
// 51-100 reserved to be defined in lua
|
||||||
LastGameFeature = 101
|
LastGameFeature = 101
|
||||||
};
|
};
|
||||||
|
@ -363,7 +364,8 @@ namespace Otc
|
||||||
PathFindAllowNullTiles = 1,
|
PathFindAllowNullTiles = 1,
|
||||||
PathFindAllowCreatures = 2,
|
PathFindAllowCreatures = 2,
|
||||||
PathFindAllowNonPathable = 4,
|
PathFindAllowNonPathable = 4,
|
||||||
PathFindAllowNonWalkable = 8
|
PathFindAllowNonWalkable = 8,
|
||||||
|
PathFindAllowChangeFloor = 16
|
||||||
};
|
};
|
||||||
|
|
||||||
enum AutomapFlags
|
enum AutomapFlags
|
||||||
|
|
|
@ -619,13 +619,17 @@ void Game::autoWalk(std::vector<Otc::Direction> dirs)
|
||||||
if(isFollowing())
|
if(isFollowing())
|
||||||
cancelFollow();
|
cancelFollow();
|
||||||
|
|
||||||
Otc::Direction direction = dirs.front();
|
auto it = dirs.begin();
|
||||||
|
Otc::Direction direction = *it;
|
||||||
if(m_localPlayer->canWalk(direction)) {
|
if(m_localPlayer->canWalk(direction)) {
|
||||||
TilePtr toTile = g_map.getTile(m_localPlayer->getPosition().translatedToDirection(direction));
|
TilePtr toTile = g_map.getTile(m_localPlayer->getPosition().translatedToDirection(direction));
|
||||||
if(toTile && toTile->isWalkable() && !m_localPlayer->isAutoWalking()) {
|
if(toTile && toTile->isWalkable() && !m_localPlayer->isAutoWalking()) {
|
||||||
m_localPlayer->preWalk(direction);
|
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())
|
if(isSplash() || isFluidContainer())
|
||||||
return m_countOrSubType;
|
return m_countOrSubType;
|
||||||
|
if(g_game.getProtocolVersion() >= 860)
|
||||||
return 0;
|
return 0;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Item::getCount()
|
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.
|
but it is breaking normal path finding.
|
||||||
*/
|
*/
|
||||||
if(!(flags & Otc::PathFindAllowNullTiles) && !tile)
|
if(!(flags & Otc::PathFindAllowNullTiles) && !tile)
|
||||||
walkFactor = 2.0f;
|
walkFactor = 3.0f;
|
||||||
if(tile) {
|
if(tile) {
|
||||||
if(!(flags & Otc::PathFindAllowCreatures) && tile->hasCreature())
|
if(!(flags & Otc::PathFindAllowCreatures) && tile->hasCreature())
|
||||||
continue;
|
continue;
|
||||||
|
@ -608,6 +608,8 @@ std::tuple<std::vector<Otc::Direction>, Otc::PathFindResult> Map::findPath(const
|
||||||
continue;
|
continue;
|
||||||
if(!(flags & Otc::PathFindAllowNonWalkable) && !tile->isWalkable())
|
if(!(flags & Otc::PathFindAllowNonWalkable) && !tile->isWalkable())
|
||||||
continue;
|
continue;
|
||||||
|
if(!(flags & Otc::PathFindAllowChangeFloor) && tile->changesFloor())
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue