* fix viplist
* fix skills update
* fix mouse grabber
* minimize send interval
* add api to get world name
master
Eduardo Bart 12 years ago
parent 47e7eef716
commit a475384b73

@ -40,7 +40,7 @@ local function tryLogin(charInfo, tries)
CharacterList.destroyLoadBox()
g_game.loginWorld(EnterGame.account, EnterGame.password, charInfo.worldHost, charInfo.worldPort, charInfo.characterName)
g_game.loginWorld(EnterGame.account, EnterGame.password, charInfo.worldName, charInfo.worldHost, charInfo.worldPort, charInfo.characterName)
loadBox = displayCancelBox('Please wait', 'Connecting to game server...')
connect(loadBox, { onCancel = function()

@ -7,7 +7,7 @@ local gameRightPanel
local gameLeftPanel
local gameBottomPanel
local logoutButton
local m_mouseGrabberWidget
local mouseGrabberWidget
function GameInterface.init()
connect(g_game, { onGameStart = GameInterface.show }, true)
@ -17,9 +17,9 @@ function GameInterface.init()
gameRootPanel:hide()
gameRootPanel:lower()
m_mouseGrabberWidget = gameRootPanel:getChildById('mouseGrabber')
connect(m_mouseGrabberWidget, { onMouseRelease = GameInterface.onUseWithMouseRelease })
mouseGrabberWidget = gameRootPanel:getChildById('mouseGrabber')
mouseGrabberWidget.onMouseRelease = GameInterface.onUseWithMouseRelease
gameMapPanel = gameRootPanel:getChildById('gameMapPanel')
gameRightPanel = gameRootPanel:getChildById('gameRightPanel')
gameLeftPanel = gameRootPanel:getChildById('gameLeftPanel')
@ -60,7 +60,6 @@ end
function GameInterface.terminate()
disconnect(g_game, { onGameStart = GameInterface.show })
disconnect(g_game, { onGameEnd = GameInterface.hide })
disconnect(m_mouseGrabberWidget, { onMouseRelease = onUseWithMouseRelease })
logoutButton:destroy()
logoutButton = nil
@ -70,9 +69,8 @@ function GameInterface.terminate()
gameRightPanel = nil
gameLeftPanel = nil
gameBottomPanel = nil
mouseGrabberWidget = nil
GameInterface = nil
m_mouseGrabberWidget:destroy()
m_mouseGrabberWidget = nil
end
function GameInterface.show()
@ -128,7 +126,7 @@ end
function GameInterface.startUseWith(thing)
GameInterface.selectedThing = thing
m_mouseGrabberWidget:grabMouse()
mouseGrabberWidget:grabMouse()
Mouse.setTargetCursor()
end

@ -20,23 +20,17 @@ end
local function setSkillValue(id, value)
local skill = skillsWindow:recursiveGetChildById(id)
if skill then
local widget = skill:getChildById('value')
widget:setText(value)
end
local widget = skill:getChildById('value')
widget:setText(value)
end
local function setSkillPercent(id, percent, tooltip)
local skill = skillsWindow:recursiveGetChildById(id)
local widget = skill:getChildById('percent')
widget:setPercent(percent)
if skill then
local widget = skill:getChildById('percent')
widget:setPercent(percent)
if tooltip then
widget:setTooltip(tooltip)
end
if tooltip then
widget:setTooltip(tooltip)
end
end

@ -101,7 +101,7 @@ function VipList.onAddVip(id, name, online)
end
function VipList.onVipStateChange(id, online)
local vipList = vipWindow:getChildById('vipList')
local vipList = vipWindow:getChildById('contentsPanel')
local label = vipList:getChildById('vip' .. id)
local text = label:getText()
vipList:removeChild(label)

@ -36,7 +36,7 @@ class Connection : public std::enable_shared_from_this<Connection>, boost::nonco
enum {
READ_TIMEOUT = 30,
WRITE_TIMEOUT = 30,
SEND_INTERVAL = 10,
SEND_INTERVAL = 1,
SEND_BUFFER_SIZE = 65536,
RECV_BUFFER_SIZE = 65536
};

@ -315,14 +315,16 @@ void Game::processWalkCancel(Otc::Direction direction)
m_localPlayer->cancelWalk(direction);
}
void Game::loginWorld(const std::string& account, const std::string& password, const std::string& worldHost, int worldPort, const std::string& characterName)
void Game::loginWorld(const std::string& account, const std::string& password, const std::string& worldName, const std::string& worldHost, int worldPort, const std::string& characterName)
{
if(m_protocolGame || isOnline()) {
logTraceError("unable to login into a world while already online or logging");
return;
}
m_protocolGame = ProtocolGamePtr(new ProtocolGame);
m_protocolGame->login(account, password, worldHost, (uint16)worldPort, characterName);
m_worldName = worldName;
}
void Game::cancelLogin()

@ -114,7 +114,8 @@ protected:
public:
// login related
void loginWorld(const std::string& account,
const std::string& password,
const std::string& password,
const std::string& worldName,
const std::string& worldHost, int worldPort,
const std::string& characterName);
void cancelLogin();
@ -223,6 +224,7 @@ public:
LocalPlayerPtr getLocalPlayer() { return m_localPlayer; }
ProtocolGamePtr getProtocolGame() { return m_protocolGame; }
int getProtocolVersion() { return PROTOCOL; }
std::string getWorldName() { return m_worldName; }
private:
void setAttackingCreature(const CreaturePtr& creature);
@ -238,6 +240,7 @@ private:
Otc::FightModes m_fightMode;
Otc::ChaseModes m_chaseMode;
bool m_safeFight;
std::string m_worldName;
};
extern Game g_game;

@ -182,7 +182,7 @@ void LocalPlayer::setSkill(Otc::Skill skill, int level, int levelPercent)
int oldLevel = m_skillsLevel[skill];
int oldLevelPercent = m_skillsLevelPercent[skill];
if(level != oldLevel && levelPercent != oldLevelPercent) {
if(level != oldLevel || levelPercent != oldLevelPercent) {
m_skillsLevel[skill] = level;
m_skillsLevelPercent[skill] = levelPercent;

@ -78,7 +78,7 @@ void OTClient::registerLuaFunctions()
g_lua.bindClassStaticFunction("g_map", "findPath", std::bind(&Map::findPath, &g_map, _1, _2, _3));
g_lua.registerStaticClass("g_game");
g_lua.bindClassStaticFunction("g_game", "loginWorld", std::bind(&Game::loginWorld, &g_game, _1, _2, _3, _4, _5));
g_lua.bindClassStaticFunction("g_game", "loginWorld", std::bind(&Game::loginWorld, &g_game, _1, _2, _3, _4, _5, _6));
g_lua.bindClassStaticFunction("g_game", "cancelLogin", std::bind(&Game::cancelLogin, &g_game));
g_lua.bindClassStaticFunction("g_game", "forceLogout", std::bind(&Game::forceLogout, &g_game));
g_lua.bindClassStaticFunction("g_game", "safeLogout", std::bind(&Game::safeLogout, &g_game));
@ -153,6 +153,7 @@ void OTClient::registerLuaFunctions()
g_lua.bindClassStaticFunction("g_game", "getLocalPlayer", std::bind(&Game::getLocalPlayer, &g_game));
g_lua.bindClassStaticFunction("g_game", "getProtocolGame", std::bind(&Game::getProtocolGame, &g_game));
g_lua.bindClassStaticFunction("g_game", "getProtocolVersion", std::bind(&Game::getProtocolVersion, &g_game));
g_lua.bindClassStaticFunction("g_game", "getWorldName", std::bind(&Game::getWorldName, &g_game));
g_lua.bindGlobalFunction("getOufitColor", Outfit::getColor);

Loading…
Cancel
Save