* 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() 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...') loadBox = displayCancelBox('Please wait', 'Connecting to game server...')
connect(loadBox, { onCancel = function() connect(loadBox, { onCancel = function()

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

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

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

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

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

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

@ -182,7 +182,7 @@ void LocalPlayer::setSkill(Otc::Skill skill, int level, int levelPercent)
int oldLevel = m_skillsLevel[skill]; int oldLevel = m_skillsLevel[skill];
int oldLevelPercent = m_skillsLevelPercent[skill]; int oldLevelPercent = m_skillsLevelPercent[skill];
if(level != oldLevel && levelPercent != oldLevelPercent) { if(level != oldLevel || levelPercent != oldLevelPercent) {
m_skillsLevel[skill] = level; m_skillsLevel[skill] = level;
m_skillsLevelPercent[skill] = levelPercent; 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.bindClassStaticFunction("g_map", "findPath", std::bind(&Map::findPath, &g_map, _1, _2, _3));
g_lua.registerStaticClass("g_game"); 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", "cancelLogin", std::bind(&Game::cancelLogin, &g_game));
g_lua.bindClassStaticFunction("g_game", "forceLogout", std::bind(&Game::forceLogout, &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)); 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", "getLocalPlayer", std::bind(&Game::getLocalPlayer, &g_game));
g_lua.bindClassStaticFunction("g_game", "getProtocolGame", std::bind(&Game::getProtocolGame, &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", "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); g_lua.bindGlobalFunction("getOufitColor", Outfit::getColor);

Loading…
Cancel
Save