From 92e3c2cbd6807b870f87746475b2cbadb46a21b5 Mon Sep 17 00:00:00 2001 From: BeniS Date: Mon, 16 Jul 2012 11:08:27 +1200 Subject: [PATCH] Fixes to mounting, outfit randomizing, and added creature getSpeed to the lua binding. --- modules/game_outfit/outfit.lua | 2 +- modules/game_playermount/playermount.lua | 6 +----- src/otclient/game.cpp | 2 ++ src/otclient/luafunctions.cpp | 1 + 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/game_outfit/outfit.lua b/modules/game_outfit/outfit.lua index e97d6d6e..f4b96275 100644 --- a/modules/game_outfit/outfit.lua +++ b/modules/game_outfit/outfit.lua @@ -242,7 +242,7 @@ function Outfit.randomize() for k, section in pairs(outfitTemplate) do section:setChecked(true) - colorBoxes[math.random(1, #colorBoxes)]:setChecked(true) + colorBoxes[math.random(0, #colorBoxes)]:setChecked(true) section:setChecked(false) end outfitTemplate[1]:setChecked(true) diff --git a/modules/game_playermount/playermount.lua b/modules/game_playermount/playermount.lua index 9cc1136b..61556355 100644 --- a/modules/game_playermount/playermount.lua +++ b/modules/game_playermount/playermount.lua @@ -11,11 +11,7 @@ function PlayerMount.terminate() end function PlayerMount.toggleMount() - if g_game.isMounted() then - g_game.mount(false) - else - g_game.mount(true) - end + g_game.mount(not g_game.isMounted()) end function PlayerMount.dismount() diff --git a/src/otclient/game.cpp b/src/otclient/game.cpp index 76595d7d..1d12d0a8 100644 --- a/src/otclient/game.cpp +++ b/src/otclient/game.cpp @@ -1054,7 +1054,9 @@ void Game::mount(bool mount) { if(!canPerformGameAction()) return; + m_protocolGame->sendMountStatus(mount); + m_mounted = mount; } bool Game::checkBotProtection() diff --git a/src/otclient/luafunctions.cpp b/src/otclient/luafunctions.cpp index 5de2158a..c79865af 100644 --- a/src/otclient/luafunctions.cpp +++ b/src/otclient/luafunctions.cpp @@ -298,6 +298,7 @@ void OTClient::registerLuaFunctions() g_lua.bindClassMemberFunction("getId", &Creature::getId); g_lua.bindClassMemberFunction("getName", &Creature::getName); g_lua.bindClassMemberFunction("getHealthPercent", &Creature::getHealthPercent); + g_lua.bindClassMemberFunction("getSpeed", &Creature::getSpeed); g_lua.bindClassMemberFunction("getSkull", &Creature::getSkull); g_lua.bindClassMemberFunction("getShield", &Creature::getShield); g_lua.bindClassMemberFunction("getEmblem", &Creature::getEmblem);