implement grid layout
This commit is contained in:
parent
8db565f456
commit
c1cf53829e
1
BUGS
1
BUGS
|
@ -10,3 +10,4 @@ hotkeys works while windows are locked, it shouldnt
|
||||||
some animated hits are displayed as 2 hits instead of one
|
some animated hits are displayed as 2 hits instead of one
|
||||||
numpad on windows doesn't work correctly
|
numpad on windows doesn't work correctly
|
||||||
skulls is rendering outside map bounds
|
skulls is rendering outside map bounds
|
||||||
|
these are some issues when skill progressbar is 0% or 100%
|
||||||
|
|
1
TODO
1
TODO
|
@ -54,7 +54,6 @@ Low priority TODO
|
||||||
|
|
||||||
== UI
|
== UI
|
||||||
[bart] fix massive hotkeys when holding down a key
|
[bart] fix massive hotkeys when holding down a key
|
||||||
[bart] grid layout
|
|
||||||
[bart] horizontal box layout
|
[bart] horizontal box layout
|
||||||
[bart] move layout proprieties to widget style
|
[bart] move layout proprieties to widget style
|
||||||
[bart] multiline text editor widget
|
[bart] multiline text editor widget
|
||||||
|
|
|
@ -189,8 +189,9 @@ SET(framework_SOURCES ${framework_SOURCES}
|
||||||
${CMAKE_CURRENT_LIST_DIR}/ui/uiwidgettext.cpp
|
${CMAKE_CURRENT_LIST_DIR}/ui/uiwidgettext.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/ui/uiwidgetbasestyle.cpp
|
${CMAKE_CURRENT_LIST_DIR}/ui/uiwidgetbasestyle.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/ui/uilineedit.cpp
|
${CMAKE_CURRENT_LIST_DIR}/ui/uilineedit.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/ui/uianchorlayout.cpp
|
|
||||||
${CMAKE_CURRENT_LIST_DIR}/ui/uiverticallayout.cpp
|
${CMAKE_CURRENT_LIST_DIR}/ui/uiverticallayout.cpp
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/ui/uigridlayout.cpp
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/ui/uianchorlayout.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/ui/uilayout.cpp
|
${CMAKE_CURRENT_LIST_DIR}/ui/uilayout.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/ui/uiframecounter.cpp
|
${CMAKE_CURRENT_LIST_DIR}/ui/uiframecounter.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/ui/uitranslator.cpp
|
${CMAKE_CURRENT_LIST_DIR}/ui/uitranslator.cpp
|
||||||
|
|
|
@ -281,6 +281,17 @@ void Application::registerLuaFunctions()
|
||||||
g_lua.bindClassStaticFunction<UIVerticalLayout>("create", [](UIWidgetPtr parent){ return UIVerticalLayoutPtr(new UIVerticalLayout(parent)); } );
|
g_lua.bindClassStaticFunction<UIVerticalLayout>("create", [](UIWidgetPtr parent){ return UIVerticalLayoutPtr(new UIVerticalLayout(parent)); } );
|
||||||
g_lua.bindClassMemberFunction<UIVerticalLayout>("setFitParent", &UIVerticalLayout::setFitParent);
|
g_lua.bindClassMemberFunction<UIVerticalLayout>("setFitParent", &UIVerticalLayout::setFitParent);
|
||||||
|
|
||||||
|
// UIGridLayout
|
||||||
|
g_lua.registerClass<UIGridLayout, UILayout>();
|
||||||
|
g_lua.bindClassStaticFunction<UIGridLayout>("create", [](UIWidgetPtr parent){ return UIGridLayoutPtr(new UIGridLayout(parent)); });
|
||||||
|
g_lua.bindClassMemberFunction<UIGridLayout>("setCellSize", &UIGridLayout::setCellSize);
|
||||||
|
g_lua.bindClassMemberFunction<UIGridLayout>("setCellWidth", &UIGridLayout::setCellWidth);
|
||||||
|
g_lua.bindClassMemberFunction<UIGridLayout>("setCellHeight", &UIGridLayout::setCellHeight);
|
||||||
|
g_lua.bindClassMemberFunction<UIGridLayout>("setCellSpacing", &UIGridLayout::setCellSpacing);
|
||||||
|
g_lua.bindClassMemberFunction<UIGridLayout>("setNumColumns", &UIGridLayout::setNumColumns);
|
||||||
|
g_lua.bindClassMemberFunction<UIGridLayout>("setNumLines", &UIGridLayout::setNumLines);
|
||||||
|
g_lua.bindClassMemberFunction<UIGridLayout>("asUIGridLayout", &UIGridLayout::asUIGridLayout);
|
||||||
|
|
||||||
// UIAnchorLayout
|
// UIAnchorLayout
|
||||||
g_lua.registerClass<UIAnchorLayout, UILayout>();
|
g_lua.registerClass<UIAnchorLayout, UILayout>();
|
||||||
g_lua.bindClassStaticFunction<UIAnchorLayout>("create", [](UIWidgetPtr parent){ return UIAnchorLayoutPtr(new UIAnchorLayout(parent)); } );
|
g_lua.bindClassStaticFunction<UIAnchorLayout>("create", [](UIWidgetPtr parent){ return UIAnchorLayoutPtr(new UIAnchorLayout(parent)); } );
|
||||||
|
|
|
@ -31,6 +31,7 @@ class UILineEdit;
|
||||||
class UIFrameCounter;
|
class UIFrameCounter;
|
||||||
class UILayout;
|
class UILayout;
|
||||||
class UIVerticalLayout;
|
class UIVerticalLayout;
|
||||||
|
class UIGridLayout;
|
||||||
class UIAnchorLayout;
|
class UIAnchorLayout;
|
||||||
|
|
||||||
typedef std::shared_ptr<UIWidget> UIWidgetPtr;
|
typedef std::shared_ptr<UIWidget> UIWidgetPtr;
|
||||||
|
@ -40,6 +41,7 @@ typedef std::shared_ptr<UILineEdit> UILineEditPtr;
|
||||||
typedef std::shared_ptr<UIFrameCounter> UIFrameCounterPtr;
|
typedef std::shared_ptr<UIFrameCounter> UIFrameCounterPtr;
|
||||||
typedef std::shared_ptr<UILayout> UILayoutPtr;
|
typedef std::shared_ptr<UILayout> UILayoutPtr;
|
||||||
typedef std::shared_ptr<UIVerticalLayout> UIVerticalLayoutPtr;
|
typedef std::shared_ptr<UIVerticalLayout> UIVerticalLayoutPtr;
|
||||||
|
typedef std::shared_ptr<UIGridLayout> UIGridLayoutPtr;
|
||||||
typedef std::shared_ptr<UIAnchorLayout> UIAnchorLayoutPtr;
|
typedef std::shared_ptr<UIAnchorLayout> UIAnchorLayoutPtr;
|
||||||
|
|
||||||
typedef std::deque<UIWidgetPtr> UIWidgetList;
|
typedef std::deque<UIWidgetPtr> UIWidgetList;
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "uiframecounter.h"
|
#include "uiframecounter.h"
|
||||||
#include "uilayout.h"
|
#include "uilayout.h"
|
||||||
#include "uiverticallayout.h"
|
#include "uiverticallayout.h"
|
||||||
|
#include "uigridlayout.h"
|
||||||
#include "uianchorlayout.h"
|
#include "uianchorlayout.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -0,0 +1,91 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010-2012 OTClient <https://github.com/edubart/otclient>
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "uigridlayout.h"
|
||||||
|
#include "uiwidget.h"
|
||||||
|
|
||||||
|
UIGridLayout::UIGridLayout(UIWidgetPtr parentWidget): UILayout(parentWidget)
|
||||||
|
{
|
||||||
|
m_cellSize = Size(16,16);
|
||||||
|
m_cellSpacing = 0;
|
||||||
|
m_numColumns = 1;
|
||||||
|
m_numLines = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UIGridLayout::applyStyle(const OTMLNodePtr& styleNode)
|
||||||
|
{
|
||||||
|
UILayout::applyStyle(styleNode);
|
||||||
|
|
||||||
|
|
||||||
|
for(const OTMLNodePtr& node : styleNode->children()) {
|
||||||
|
if(node->tag() == "cell-size")
|
||||||
|
setCellSize(node->value<Size>());
|
||||||
|
else if(node->tag() == "cell-width")
|
||||||
|
setCellWidth(node->value<int>());
|
||||||
|
else if(node->tag() == "cell-height")
|
||||||
|
setCellHeight(node->value<int>());
|
||||||
|
else if(node->tag() == "cell-spacing")
|
||||||
|
setCellSpacing(node->value<int>());
|
||||||
|
else if(node->tag() == "num-columns")
|
||||||
|
setNumColumns(node->value<int>());
|
||||||
|
else if(node->tag() == "num-lines")
|
||||||
|
setNumLines(node->value<int>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void UIGridLayout::removeWidget(const UIWidgetPtr& widget)
|
||||||
|
{
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UIGridLayout::addWidget(const UIWidgetPtr& widget)
|
||||||
|
{
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UIGridLayout::internalUpdate()
|
||||||
|
{
|
||||||
|
UIWidgetPtr parentWidget = getParentWidget();
|
||||||
|
UIWidgetList widgets = parentWidget->getChildren();
|
||||||
|
|
||||||
|
Rect childrenRect = parentWidget->getChildrenRect();
|
||||||
|
Point topLeft = childrenRect.topLeft();
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
|
for(const UIWidgetPtr& widget : widgets) {
|
||||||
|
if(!widget->isExplicitlyVisible())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
int line = index / m_numLines;
|
||||||
|
int column = index % m_numLines;
|
||||||
|
Point virtualPos = Point(column * (m_cellSize.width() + m_cellSpacing), line * (m_cellSize.height() + m_cellSpacing));
|
||||||
|
Point pos = topLeft + virtualPos;
|
||||||
|
|
||||||
|
widget->setRect(Rect(pos, m_cellSize));
|
||||||
|
|
||||||
|
index++;
|
||||||
|
|
||||||
|
if(index >= m_numColumns * m_numLines)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010-2012 OTClient <https://github.com/edubart/otclient>
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef UIGRIDLAYOUT_H
|
||||||
|
#define UIGRIDLAYOUT_H
|
||||||
|
|
||||||
|
#include <framework/ui/uilayout.h>
|
||||||
|
|
||||||
|
class UIGridLayout : public UILayout
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
UIGridLayout(UIWidgetPtr parentWidget);
|
||||||
|
|
||||||
|
void applyStyle(const OTMLNodePtr& styleNode);
|
||||||
|
void removeWidget(const UIWidgetPtr& widget);
|
||||||
|
void addWidget(const UIWidgetPtr& widget);
|
||||||
|
|
||||||
|
void setCellSize(const Size& size) { m_cellSize = size; update(); }
|
||||||
|
void setCellWidth(int width) { m_cellSize.setWidth(width); update(); }
|
||||||
|
void setCellHeight(int height) { m_cellSize.setHeight(height); update(); }
|
||||||
|
void setCellSpacing(int spacing) { m_cellSpacing = spacing; update(); }
|
||||||
|
void setNumColumns(int columns) { m_numColumns = columns; update(); }
|
||||||
|
void setNumLines(int lines) { m_numLines = lines; update(); }
|
||||||
|
|
||||||
|
virtual UIGridLayoutPtr asUIGridLayout() { return nullptr; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void internalUpdate();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Size m_cellSize;
|
||||||
|
int m_cellSpacing;
|
||||||
|
int m_numColumns;
|
||||||
|
int m_numLines;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#include "declarations.h"
|
#include "declarations.h"
|
||||||
#include <framework/luascript/luaobject.h>
|
#include <framework/luascript/luaobject.h>
|
||||||
#include <framework/otml/declarations.h>
|
#include <framework/otml/otml.h>
|
||||||
|
|
||||||
class UILayout : public LuaObject
|
class UILayout : public LuaObject
|
||||||
{
|
{
|
||||||
|
@ -46,11 +46,11 @@ public:
|
||||||
|
|
||||||
bool isUpdateDisabled() { return m_updateDisabled; }
|
bool isUpdateDisabled() { return m_updateDisabled; }
|
||||||
bool isUpdating() { return m_updating; }
|
bool isUpdating() { return m_updating; }
|
||||||
virtual bool needsUpdatesOnChildChange() { return false; }
|
|
||||||
|
|
||||||
UILayoutPtr asUILayout() { return std::static_pointer_cast<UILayout>(shared_from_this()); }
|
UILayoutPtr asUILayout() { return std::static_pointer_cast<UILayout>(shared_from_this()); }
|
||||||
virtual UIAnchorLayoutPtr asUIAnchorLayout() { return nullptr; }
|
virtual UIAnchorLayoutPtr asUIAnchorLayout() { return nullptr; }
|
||||||
virtual UIVerticalLayoutPtr asUIVerticalLayout() { return nullptr; }
|
virtual UIVerticalLayoutPtr asUIVerticalLayout() { return nullptr; }
|
||||||
|
virtual UIGridLayoutPtr asUIGridLayout() { return nullptr; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void internalUpdate() = 0;
|
virtual void internalUpdate() = 0;
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010-2012 OTClient <https://github.com/edubart/otclient>
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "uirichtext.h"
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010-2012 OTClient <https://github.com/edubart/otclient>
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef UIRICHTEXT_H
|
||||||
|
#define UIRICHTEXT_H
|
||||||
|
|
||||||
|
#include <framework/ui/uiwidget.h>
|
||||||
|
|
||||||
|
|
||||||
|
class UIRichText : public UIWidget
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // UIRICHTEXT_H
|
|
@ -22,7 +22,6 @@
|
||||||
|
|
||||||
#include "uiverticallayout.h"
|
#include "uiverticallayout.h"
|
||||||
#include "uiwidget.h"
|
#include "uiwidget.h"
|
||||||
#include <framework/otml/otml.h>
|
|
||||||
#include <framework/core/eventdispatcher.h>
|
#include <framework/core/eventdispatcher.h>
|
||||||
|
|
||||||
UIVerticalLayout::UIVerticalLayout(UIWidgetPtr parentWidget)
|
UIVerticalLayout::UIVerticalLayout(UIWidgetPtr parentWidget)
|
||||||
|
@ -45,35 +44,6 @@ void UIVerticalLayout::applyStyle(const OTMLNodePtr& styleNode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIVerticalLayout::addWidget(const UIWidgetPtr& widget)
|
|
||||||
{
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void UIVerticalLayout::removeWidget(const UIWidgetPtr& widget)
|
|
||||||
{
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void UIVerticalLayout::setAlignBottom(bool aliginBottom)
|
|
||||||
{
|
|
||||||
m_alignBottom = aliginBottom;
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void UIVerticalLayout::setSpacing(int spacing)
|
|
||||||
{
|
|
||||||
m_spacing = spacing;
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void UIVerticalLayout::setFitParent(bool fitParent)
|
|
||||||
{
|
|
||||||
m_fitParent = fitParent;
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void UIVerticalLayout::internalUpdate()
|
void UIVerticalLayout::internalUpdate()
|
||||||
{
|
{
|
||||||
UIWidgetPtr parentWidget = getParentWidget();
|
UIWidgetPtr parentWidget = getParentWidget();
|
||||||
|
|
|
@ -31,14 +31,12 @@ public:
|
||||||
UIVerticalLayout(UIWidgetPtr parentWidget);
|
UIVerticalLayout(UIWidgetPtr parentWidget);
|
||||||
|
|
||||||
void applyStyle(const OTMLNodePtr& styleNode);
|
void applyStyle(const OTMLNodePtr& styleNode);
|
||||||
void addWidget(const UIWidgetPtr& widget);
|
void addWidget(const UIWidgetPtr& widget) { update(); }
|
||||||
void removeWidget(const UIWidgetPtr& widget);
|
void removeWidget(const UIWidgetPtr& widget) { update(); }
|
||||||
|
|
||||||
void setAlignBottom(bool aliginBottom);
|
void setAlignBottom(bool aliginBottom) { m_alignBottom = aliginBottom; update(); }
|
||||||
void setSpacing(int spacing);
|
void setSpacing(int spacing) { m_spacing = spacing; update(); }
|
||||||
void setFitParent(bool fitParent);
|
void setFitParent(bool fitParent) { m_fitParent = fitParent; update(); }
|
||||||
|
|
||||||
bool needsUpdatesOnChildChange() { return m_fitParent; }
|
|
||||||
|
|
||||||
UIVerticalLayoutPtr asUIVerticalLayout() { return std::static_pointer_cast<UIVerticalLayout>(shared_from_this()); }
|
UIVerticalLayoutPtr asUIVerticalLayout() { return std::static_pointer_cast<UIVerticalLayout>(shared_from_this()); }
|
||||||
|
|
||||||
|
|
|
@ -364,8 +364,8 @@ void UIWidget::unlockChild(const UIWidgetPtr& child)
|
||||||
|
|
||||||
void UIWidget::applyStyle(const OTMLNodePtr& styleNode)
|
void UIWidget::applyStyle(const OTMLNodePtr& styleNode)
|
||||||
{
|
{
|
||||||
try {
|
|
||||||
m_loadingStyle = true;
|
m_loadingStyle = true;
|
||||||
|
try {
|
||||||
onStyleApply(styleNode->tag(), styleNode);
|
onStyleApply(styleNode->tag(), styleNode);
|
||||||
callLuaField("onStyleApply", styleNode->tag(), styleNode);
|
callLuaField("onStyleApply", styleNode->tag(), styleNode);
|
||||||
|
|
||||||
|
@ -377,10 +377,10 @@ void UIWidget::applyStyle(const OTMLNodePtr& styleNode)
|
||||||
}
|
}
|
||||||
m_firstOnStyle = false;
|
m_firstOnStyle = false;
|
||||||
|
|
||||||
m_loadingStyle = false;
|
|
||||||
} catch(Exception& e) {
|
} catch(Exception& e) {
|
||||||
logError("Failed to apply style to widget '", m_id, "' style: ", e.what());
|
logError("Failed to apply style to widget '", m_id, "' style: ", e.what());
|
||||||
}
|
}
|
||||||
|
m_loadingStyle = false;
|
||||||
}
|
}
|
||||||
void UIWidget::addAnchor(Fw::AnchorEdge anchoredEdge, const std::string& hookedWidgetId, Fw::AnchorEdge hookedEdge)
|
void UIWidget::addAnchor(Fw::AnchorEdge anchoredEdge, const std::string& hookedWidgetId, Fw::AnchorEdge hookedEdge)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,8 +21,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "uiwidget.h"
|
#include "uiwidget.h"
|
||||||
#include "uianchorlayout.h"
|
|
||||||
#include "uiverticallayout.h"
|
#include "uiverticallayout.h"
|
||||||
|
#include "uigridlayout.h"
|
||||||
|
#include "uianchorlayout.h"
|
||||||
#include "uitranslator.h"
|
#include "uitranslator.h"
|
||||||
|
|
||||||
#include <framework/graphics/painter.h>
|
#include <framework/graphics/painter.h>
|
||||||
|
@ -233,6 +234,8 @@ void UIWidget::parseBaseStyle(const OTMLNodePtr& styleNode)
|
||||||
UILayoutPtr layout;
|
UILayoutPtr layout;
|
||||||
if(layoutType == "verticalBox")
|
if(layoutType == "verticalBox")
|
||||||
layout = UIVerticalLayoutPtr(new UIVerticalLayout(asUIWidget()));
|
layout = UIVerticalLayoutPtr(new UIVerticalLayout(asUIWidget()));
|
||||||
|
else if(layoutType == "grid")
|
||||||
|
layout = UIGridLayoutPtr(new UIGridLayout(asUIWidget()));
|
||||||
else if(layoutType == "anchor")
|
else if(layoutType == "anchor")
|
||||||
layout = UIAnchorLayoutPtr(new UIAnchorLayout(asUIWidget()));
|
layout = UIAnchorLayoutPtr(new UIAnchorLayout(asUIWidget()));
|
||||||
else
|
else
|
||||||
|
|
|
@ -31,7 +31,7 @@ class Item : public Thing
|
||||||
public:
|
public:
|
||||||
Item();
|
Item();
|
||||||
|
|
||||||
static ItemPtr create(int id = 0);
|
static ItemPtr create(int id);
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
TICKS_PER_FRAME = 500
|
TICKS_PER_FRAME = 500
|
||||||
|
|
|
@ -60,18 +60,18 @@ public:
|
||||||
void sendPlayerPurchase(int thingId, int count, int amount, bool ignoreCapacity, bool buyWithBackpack);
|
void sendPlayerPurchase(int thingId, int count, int amount, bool ignoreCapacity, bool buyWithBackpack);
|
||||||
void sendPlayerSale(int thingId, int count, int amount, bool ignoreEquipped);
|
void sendPlayerSale(int thingId, int count, int amount, bool ignoreEquipped);
|
||||||
void sendCloseShop();
|
void sendCloseShop();
|
||||||
void sendRequestTrade(const Position& pos, int thingId, int stackpos, int playerId);
|
void sendRequestTrade(const Position& pos, int thingId, int stackpos, uint playerId);
|
||||||
void sendLookInTrade(bool counterOffer, int index);
|
void sendLookInTrade(bool counterOffer, int index);
|
||||||
void sendAcceptTrade();
|
void sendAcceptTrade();
|
||||||
void sendRejectTrade();
|
void sendRejectTrade();
|
||||||
void sendUseItem(const Position& position, int itemId, int stackpos, int index);
|
void sendUseItem(const Position& position, int itemId, int stackpos, int index);
|
||||||
void sendUseItemEx(const Position& fromPos, int fromThingId, int fromStackpos, const Position& toPos, int toThingId, int toStackpos);
|
void sendUseItemEx(const Position& fromPos, int fromThingId, int fromStackpos, const Position& toPos, int toThingId, int toStackpos);
|
||||||
void sendUseItemCreature(const Position& pos, int thingId, int stackpos, int creatureId);
|
void sendUseItemCreature(const Position& pos, int thingId, int stackpos, uint creatureId);
|
||||||
void sendRotateItem(const Position& pos, int thingId, int stackpos);
|
void sendRotateItem(const Position& pos, int thingId, int stackpos);
|
||||||
void sendCloseContainer(int containerId);
|
void sendCloseContainer(int containerId);
|
||||||
void sendUpContainer(int containerId);
|
void sendUpContainer(int containerId);
|
||||||
void sendTextWindow(int windowTextId, const std::string& text);
|
void sendTextWindow(uint windowTextId, const std::string& text);
|
||||||
void sendHouseWindow(int doorId, int id, const std::string& text);
|
void sendHouseWindow(int doorId, uint id, const std::string& text);
|
||||||
void sendLookAt(const Position& position, int thingId, int stackpos);
|
void sendLookAt(const Position& position, int thingId, int stackpos);
|
||||||
void sendTalk(int channelType, int channelId, const std::string& receiver, const std::string& message);
|
void sendTalk(int channelType, int channelId, const std::string& receiver, const std::string& message);
|
||||||
void sendGetChannels();
|
void sendGetChannels();
|
||||||
|
@ -80,12 +80,12 @@ public:
|
||||||
void sendPrivateChannel(const std::string& receiver);
|
void sendPrivateChannel(const std::string& receiver);
|
||||||
void sendCloseNpcChannel();
|
void sendCloseNpcChannel();
|
||||||
void sendFightTatics(Otc::FightModes fightMode, Otc::ChaseModes chaseMode, bool safeFight);
|
void sendFightTatics(Otc::FightModes fightMode, Otc::ChaseModes chaseMode, bool safeFight);
|
||||||
void sendAttack(int creatureId);
|
void sendAttack(uint creatureId);
|
||||||
void sendFollow(int creatureId);
|
void sendFollow(uint creatureId);
|
||||||
void sendInviteToParty(int creatureId);
|
void sendInviteToParty(uint creatureId);
|
||||||
void sendJoinParty(int creatureId);
|
void sendJoinParty(uint creatureId);
|
||||||
void sendRevokeInvitation(int creatureId);
|
void sendRevokeInvitation(uint creatureId);
|
||||||
void sendPassLeadership(int creatureId);
|
void sendPassLeadership(uint creatureId);
|
||||||
void sendLeaveParty();
|
void sendLeaveParty();
|
||||||
void sendShareExperience(bool active, int unknown);
|
void sendShareExperience(bool active, int unknown);
|
||||||
void sendOpenChannel();
|
void sendOpenChannel();
|
||||||
|
@ -96,12 +96,12 @@ public:
|
||||||
void sendGetOutfit();
|
void sendGetOutfit();
|
||||||
void sendSetOutfit(const Outfit& outfit);
|
void sendSetOutfit(const Outfit& outfit);
|
||||||
void sendAddVip(const std::string& name);
|
void sendAddVip(const std::string& name);
|
||||||
void sendRemoveVip(int playerId);
|
void sendRemoveVip(uint playerId);
|
||||||
void sendGetQuestLog();
|
void sendGetQuestLog();
|
||||||
void sendGetQuestLine(int questId);
|
void sendGetQuestLine(int questId);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void sendLoginPacket(uint32 timestamp, uint8 unknown);
|
void sendLoginPacket(uint timestamp, uint8 unknown);
|
||||||
|
|
||||||
// Parse Messages
|
// Parse Messages
|
||||||
void parseMessage(InputMessage& msg);
|
void parseMessage(InputMessage& msg);
|
||||||
|
@ -173,13 +173,13 @@ private:
|
||||||
void parseQuestList(InputMessage& msg);
|
void parseQuestList(InputMessage& msg);
|
||||||
void parseQuestPartList(InputMessage& msg);
|
void parseQuestPartList(InputMessage& msg);
|
||||||
|
|
||||||
void setMapDescription(InputMessage& msg, int32 x, int32 y, int32 z, int32 width, int32 height);
|
void setMapDescription(InputMessage& msg, int x, int y, int z, int width, int height);
|
||||||
void setFloorDescription(InputMessage& msg, int32 x, int32 y, int32 z, int32 width, int32 height, int32 offset, int32* skipTiles);
|
void setFloorDescription(InputMessage& msg, int x, int y, int z, int width, int height, int offset, int* skipTiles);
|
||||||
void setTileDescription(InputMessage& msg, Position position);
|
void setTileDescription(InputMessage& msg, Position position);
|
||||||
|
|
||||||
Outfit internalGetOutfit(InputMessage& msg);
|
Outfit internalGetOutfit(InputMessage& msg);
|
||||||
ThingPtr internalGetThing(InputMessage& msg);
|
ThingPtr internalGetThing(InputMessage& msg);
|
||||||
ItemPtr internalGetItem(InputMessage& msg, uint16 id);
|
ItemPtr internalGetItem(InputMessage& msg, int id = 0);
|
||||||
|
|
||||||
void addPosition(OutputMessage& msg, const Position& position);
|
void addPosition(OutputMessage& msg, const Position& position);
|
||||||
Position parsePosition(InputMessage& msg);
|
Position parsePosition(InputMessage& msg);
|
||||||
|
|
|
@ -37,7 +37,7 @@ void ProtocolGame::parseMessage(InputMessage& msg)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
while(!msg.eof()) {
|
while(!msg.eof()) {
|
||||||
uint8 opt = msg.getU8();
|
int opt = msg.getU8();
|
||||||
|
|
||||||
switch(opt) {
|
switch(opt) {
|
||||||
case Proto::GameServerInitGame:
|
case Proto::GameServerInitGame:
|
||||||
|
@ -267,7 +267,7 @@ void ProtocolGame::parseMessage(InputMessage& msg)
|
||||||
|
|
||||||
void ProtocolGame::parsePlayerLogin(InputMessage& msg)
|
void ProtocolGame::parsePlayerLogin(InputMessage& msg)
|
||||||
{
|
{
|
||||||
int playerId = msg.getU32();
|
uint playerId = msg.getU32();
|
||||||
int serverBeat = msg.getU16();
|
int serverBeat = msg.getU16();
|
||||||
int playerCanReportBugs = msg.getU8();
|
int playerCanReportBugs = msg.getU8();
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ void ProtocolGame::parsePlayerLogin(InputMessage& msg)
|
||||||
|
|
||||||
void ProtocolGame::parseGMActions(InputMessage& msg)
|
void ProtocolGame::parseGMActions(InputMessage& msg)
|
||||||
{
|
{
|
||||||
for(uint8 i = 0; i < Proto::NumViolationReasons; ++i)
|
for(int i = 0; i < Proto::NumViolationReasons; ++i)
|
||||||
msg.getU8();
|
msg.getU8();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,7 +359,7 @@ void ProtocolGame::parseMoveWest(InputMessage& msg)
|
||||||
void ProtocolGame::parseUpdateTile(InputMessage& msg)
|
void ProtocolGame::parseUpdateTile(InputMessage& msg)
|
||||||
{
|
{
|
||||||
Position tilePos = parsePosition(msg);
|
Position tilePos = parsePosition(msg);
|
||||||
uint16 thingId = msg.getU16(true);
|
int thingId = msg.getU16(true);
|
||||||
if(thingId == 0xFF01) {
|
if(thingId == 0xFF01) {
|
||||||
msg.getU16();
|
msg.getU16();
|
||||||
} else {
|
} else {
|
||||||
|
@ -371,7 +371,7 @@ void ProtocolGame::parseUpdateTile(InputMessage& msg)
|
||||||
void ProtocolGame::parseTileAddThing(InputMessage& msg)
|
void ProtocolGame::parseTileAddThing(InputMessage& msg)
|
||||||
{
|
{
|
||||||
Position pos = parsePosition(msg);
|
Position pos = parsePosition(msg);
|
||||||
uint8 stackPos = msg.getU8();
|
int stackPos = msg.getU8();
|
||||||
|
|
||||||
ThingPtr thing = internalGetThing(msg);
|
ThingPtr thing = internalGetThing(msg);
|
||||||
g_map.addThing(thing, pos, stackPos);
|
g_map.addThing(thing, pos, stackPos);
|
||||||
|
@ -380,13 +380,13 @@ void ProtocolGame::parseTileAddThing(InputMessage& msg)
|
||||||
void ProtocolGame::parseTileTransformThing(InputMessage& msg)
|
void ProtocolGame::parseTileTransformThing(InputMessage& msg)
|
||||||
{
|
{
|
||||||
Position pos = parsePosition(msg);
|
Position pos = parsePosition(msg);
|
||||||
uint8 stackPos = msg.getU8();
|
int stackPos = msg.getU8();
|
||||||
|
|
||||||
uint16 thingId = msg.getU16();
|
int thingId = msg.getU16();
|
||||||
|
assert(thingId != 0);
|
||||||
if(thingId == 0x0061 || thingId == 0x0062 || thingId == 0x0063) {
|
if(thingId == 0x0061 || thingId == 0x0062 || thingId == 0x0063) {
|
||||||
parseCreatureTurn(msg);
|
parseCreatureTurn(msg);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
ThingPtr thing = internalGetItem(msg, thingId);
|
ThingPtr thing = internalGetItem(msg, thingId);
|
||||||
g_map.removeThingByPos(pos, stackPos);
|
g_map.removeThingByPos(pos, stackPos);
|
||||||
g_map.addThing(thing, pos, stackPos);
|
g_map.addThing(thing, pos, stackPos);
|
||||||
|
@ -396,7 +396,7 @@ void ProtocolGame::parseTileTransformThing(InputMessage& msg)
|
||||||
void ProtocolGame::parseTileRemoveThing(InputMessage& msg)
|
void ProtocolGame::parseTileRemoveThing(InputMessage& msg)
|
||||||
{
|
{
|
||||||
Position pos = parsePosition(msg);
|
Position pos = parsePosition(msg);
|
||||||
uint8 stackPos = msg.getU8();
|
int stackPos = msg.getU8();
|
||||||
|
|
||||||
g_map.removeThingByPos(pos, stackPos);
|
g_map.removeThingByPos(pos, stackPos);
|
||||||
}
|
}
|
||||||
|
@ -404,7 +404,7 @@ void ProtocolGame::parseTileRemoveThing(InputMessage& msg)
|
||||||
void ProtocolGame::parseCreatureMove(InputMessage& msg)
|
void ProtocolGame::parseCreatureMove(InputMessage& msg)
|
||||||
{
|
{
|
||||||
Position oldPos = parsePosition(msg);
|
Position oldPos = parsePosition(msg);
|
||||||
uint8 oldStackpos = msg.getU8();
|
int oldStackpos = msg.getU8();
|
||||||
Position newPos = parsePosition(msg);
|
Position newPos = parsePosition(msg);
|
||||||
|
|
||||||
ThingPtr thing = g_map.getTile(oldPos)->getThing(oldStackpos);
|
ThingPtr thing = g_map.getTile(oldPos)->getThing(oldStackpos);
|
||||||
|
@ -435,10 +435,10 @@ void ProtocolGame::parseOpenContainer(InputMessage& msg)
|
||||||
msg.getString(); // name
|
msg.getString(); // name
|
||||||
msg.getU8(); // capacity
|
msg.getU8(); // capacity
|
||||||
msg.getU8(); // hasParent
|
msg.getU8(); // hasParent
|
||||||
uint8 size = msg.getU8(); // size
|
int size = msg.getU8(); // size
|
||||||
|
|
||||||
for(uint32 i = 0; i < size; i++)
|
for(int i = 0; i < size; i++)
|
||||||
internalGetItem(msg, 0xFFFF);
|
internalGetItem(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::parseCloseContainer(InputMessage& msg)
|
void ProtocolGame::parseCloseContainer(InputMessage& msg)
|
||||||
|
@ -449,14 +449,14 @@ void ProtocolGame::parseCloseContainer(InputMessage& msg)
|
||||||
void ProtocolGame::parseContainerAddItem(InputMessage& msg)
|
void ProtocolGame::parseContainerAddItem(InputMessage& msg)
|
||||||
{
|
{
|
||||||
msg.getU8(); // cid
|
msg.getU8(); // cid
|
||||||
internalGetItem(msg, 0xFFFF);
|
internalGetItem(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::parseContainerUpdateItem(InputMessage& msg)
|
void ProtocolGame::parseContainerUpdateItem(InputMessage& msg)
|
||||||
{
|
{
|
||||||
msg.getU8(); // cid
|
msg.getU8(); // cid
|
||||||
msg.getU8(); // slot
|
msg.getU8(); // slot
|
||||||
internalGetItem(msg, 0xFFFF);
|
internalGetItem(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::parseContainerRemoveItem(InputMessage& msg)
|
void ProtocolGame::parseContainerRemoveItem(InputMessage& msg)
|
||||||
|
@ -467,21 +467,21 @@ void ProtocolGame::parseContainerRemoveItem(InputMessage& msg)
|
||||||
|
|
||||||
void ProtocolGame::parseAddInventoryItem(InputMessage& msg)
|
void ProtocolGame::parseAddInventoryItem(InputMessage& msg)
|
||||||
{
|
{
|
||||||
uint8 slot = msg.getU8();
|
int slot = msg.getU8();
|
||||||
ItemPtr item = internalGetItem(msg, 0xFFFF);
|
ItemPtr item = internalGetItem(msg);
|
||||||
g_game.processInventoryChange(slot, item);
|
g_game.processInventoryChange(slot, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::parseRemoveInventoryItem(InputMessage& msg)
|
void ProtocolGame::parseRemoveInventoryItem(InputMessage& msg)
|
||||||
{
|
{
|
||||||
uint8 slot = msg.getU8();
|
int slot = msg.getU8();
|
||||||
g_game.processInventoryChange(slot, ItemPtr());
|
g_game.processInventoryChange(slot, ItemPtr());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::parseOpenShopWindow(InputMessage& msg)
|
void ProtocolGame::parseOpenShopWindow(InputMessage& msg)
|
||||||
{
|
{
|
||||||
uint8 listCount = msg.getU8();
|
int listCount = msg.getU8();
|
||||||
for(uint8 i = 0; i < listCount; ++i) {
|
for(int i = 0; i < listCount; ++i) {
|
||||||
msg.getU16(); // item id
|
msg.getU16(); // item id
|
||||||
msg.getU8(); // runecharges
|
msg.getU8(); // runecharges
|
||||||
msg.getString(); // item name
|
msg.getString(); // item name
|
||||||
|
@ -494,7 +494,7 @@ void ProtocolGame::parseOpenShopWindow(InputMessage& msg)
|
||||||
void ProtocolGame::parsePlayerCash(InputMessage& msg)
|
void ProtocolGame::parsePlayerCash(InputMessage& msg)
|
||||||
{
|
{
|
||||||
msg.getU32();
|
msg.getU32();
|
||||||
uint8 size = msg.getU8();
|
int size = msg.getU8();
|
||||||
|
|
||||||
for(int i = 0; i < size; i++) {
|
for(int i = 0; i < size; i++) {
|
||||||
msg.getU16(); // itemid
|
msg.getU16(); // itemid
|
||||||
|
@ -509,10 +509,10 @@ void ProtocolGame::parseCloseShopWindow(InputMessage&)
|
||||||
void ProtocolGame::parseSafeTradeRequest(InputMessage& msg)
|
void ProtocolGame::parseSafeTradeRequest(InputMessage& msg)
|
||||||
{
|
{
|
||||||
msg.getString(); // name
|
msg.getString(); // name
|
||||||
uint8 count = msg.getU8();
|
int count = msg.getU8();
|
||||||
|
|
||||||
for(uint8 i = 0; i < count; i++)
|
for(int i = 0; i < count; i++)
|
||||||
internalGetItem(msg, 0xFFFF);
|
internalGetItem(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::parseSafeTradeClose(InputMessage&)
|
void ProtocolGame::parseSafeTradeClose(InputMessage&)
|
||||||
|
@ -542,7 +542,7 @@ void ProtocolGame::parseMagicEffect(InputMessage& msg)
|
||||||
void ProtocolGame::parseAnimatedText(InputMessage& msg)
|
void ProtocolGame::parseAnimatedText(InputMessage& msg)
|
||||||
{
|
{
|
||||||
Position position = parsePosition(msg);
|
Position position = parsePosition(msg);
|
||||||
uint8 color = msg.getU8();
|
int color = msg.getU8();
|
||||||
std::string text = msg.getString();
|
std::string text = msg.getString();
|
||||||
|
|
||||||
AnimatedTextPtr animatedText = AnimatedTextPtr(new AnimatedText);
|
AnimatedTextPtr animatedText = AnimatedTextPtr(new AnimatedText);
|
||||||
|
@ -566,8 +566,8 @@ void ProtocolGame::parseDistanceMissile(InputMessage& msg)
|
||||||
|
|
||||||
void ProtocolGame::parseCreatureSquare(InputMessage& msg)
|
void ProtocolGame::parseCreatureSquare(InputMessage& msg)
|
||||||
{
|
{
|
||||||
uint32 id = msg.getU32();
|
uint id = msg.getU32();
|
||||||
uint8 color = msg.getU8();
|
int color = msg.getU8();
|
||||||
|
|
||||||
CreaturePtr creature = g_map.getCreatureById(id);
|
CreaturePtr creature = g_map.getCreatureById(id);
|
||||||
if(creature)
|
if(creature)
|
||||||
|
@ -576,8 +576,8 @@ void ProtocolGame::parseCreatureSquare(InputMessage& msg)
|
||||||
|
|
||||||
void ProtocolGame::parseCreatureHealth(InputMessage& msg)
|
void ProtocolGame::parseCreatureHealth(InputMessage& msg)
|
||||||
{
|
{
|
||||||
uint32 id = msg.getU32();
|
uint id = msg.getU32();
|
||||||
uint8 healthPercent = msg.getU8();
|
int healthPercent = msg.getU8();
|
||||||
|
|
||||||
CreaturePtr creature = g_map.getCreatureById(id);
|
CreaturePtr creature = g_map.getCreatureById(id);
|
||||||
if(creature)
|
if(creature)
|
||||||
|
@ -586,7 +586,7 @@ void ProtocolGame::parseCreatureHealth(InputMessage& msg)
|
||||||
|
|
||||||
void ProtocolGame::parseCreatureLight(InputMessage& msg)
|
void ProtocolGame::parseCreatureLight(InputMessage& msg)
|
||||||
{
|
{
|
||||||
uint32 id = msg.getU32();
|
uint id = msg.getU32();
|
||||||
|
|
||||||
Light light;
|
Light light;
|
||||||
light.intensity = msg.getU8();
|
light.intensity = msg.getU8();
|
||||||
|
@ -599,7 +599,7 @@ void ProtocolGame::parseCreatureLight(InputMessage& msg)
|
||||||
|
|
||||||
void ProtocolGame::parseCreatureOutfit(InputMessage& msg)
|
void ProtocolGame::parseCreatureOutfit(InputMessage& msg)
|
||||||
{
|
{
|
||||||
uint32 id = msg.getU32();
|
uint id = msg.getU32();
|
||||||
Outfit outfit = internalGetOutfit(msg);
|
Outfit outfit = internalGetOutfit(msg);
|
||||||
|
|
||||||
CreaturePtr creature = g_map.getCreatureById(id);
|
CreaturePtr creature = g_map.getCreatureById(id);
|
||||||
|
@ -609,8 +609,8 @@ void ProtocolGame::parseCreatureOutfit(InputMessage& msg)
|
||||||
|
|
||||||
void ProtocolGame::parseCreatureSpeed(InputMessage& msg)
|
void ProtocolGame::parseCreatureSpeed(InputMessage& msg)
|
||||||
{
|
{
|
||||||
uint32 id = msg.getU32();
|
uint id = msg.getU32();
|
||||||
uint16 speed = msg.getU16();
|
int speed = msg.getU16();
|
||||||
|
|
||||||
CreaturePtr creature = g_map.getCreatureById(id);
|
CreaturePtr creature = g_map.getCreatureById(id);
|
||||||
if(creature)
|
if(creature)
|
||||||
|
@ -619,8 +619,8 @@ void ProtocolGame::parseCreatureSpeed(InputMessage& msg)
|
||||||
|
|
||||||
void ProtocolGame::parseCreatureSkulls(InputMessage& msg)
|
void ProtocolGame::parseCreatureSkulls(InputMessage& msg)
|
||||||
{
|
{
|
||||||
uint32 id = msg.getU32();
|
uint id = msg.getU32();
|
||||||
uint8 skull = msg.getU8();
|
int skull = msg.getU8();
|
||||||
|
|
||||||
CreaturePtr creature = g_map.getCreatureById(id);
|
CreaturePtr creature = g_map.getCreatureById(id);
|
||||||
if(creature)
|
if(creature)
|
||||||
|
@ -629,8 +629,8 @@ void ProtocolGame::parseCreatureSkulls(InputMessage& msg)
|
||||||
|
|
||||||
void ProtocolGame::parseCreatureShields(InputMessage& msg)
|
void ProtocolGame::parseCreatureShields(InputMessage& msg)
|
||||||
{
|
{
|
||||||
uint32 id = msg.getU32();
|
uint id = msg.getU32();
|
||||||
uint8 shield = msg.getU8();
|
int shield = msg.getU8();
|
||||||
|
|
||||||
CreaturePtr creature = g_map.getCreatureById(id);
|
CreaturePtr creature = g_map.getCreatureById(id);
|
||||||
if(creature)
|
if(creature)
|
||||||
|
@ -639,7 +639,7 @@ void ProtocolGame::parseCreatureShields(InputMessage& msg)
|
||||||
|
|
||||||
void ProtocolGame::parseCreatureTurn(InputMessage& msg)
|
void ProtocolGame::parseCreatureTurn(InputMessage& msg)
|
||||||
{
|
{
|
||||||
uint32 id = msg.getU32();
|
uint id = msg.getU32();
|
||||||
Otc::Direction direction = (Otc::Direction)msg.getU8();
|
Otc::Direction direction = (Otc::Direction)msg.getU8();
|
||||||
|
|
||||||
CreaturePtr creature = g_map.getCreatureById(id);
|
CreaturePtr creature = g_map.getCreatureById(id);
|
||||||
|
@ -744,7 +744,7 @@ void ProtocolGame::parsePlayerSkills(InputMessage& msg)
|
||||||
|
|
||||||
void ProtocolGame::parsePlayerIcons(InputMessage& msg)
|
void ProtocolGame::parsePlayerIcons(InputMessage& msg)
|
||||||
{
|
{
|
||||||
uint16 icons = msg.getU16();
|
int icons = msg.getU16();
|
||||||
m_localPlayer->setIcons((Otc::PlayerIcons)icons);
|
m_localPlayer->setIcons((Otc::PlayerIcons)icons);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -837,7 +837,7 @@ void ProtocolGame::parseClosePrivateChannel(InputMessage& msg)
|
||||||
|
|
||||||
void ProtocolGame::parseTextMessage(InputMessage& msg)
|
void ProtocolGame::parseTextMessage(InputMessage& msg)
|
||||||
{
|
{
|
||||||
uint8 type = msg.getU8();
|
int type = msg.getU8();
|
||||||
|
|
||||||
std::string typeDesc = Proto::translateTextMessageType(type);
|
std::string typeDesc = Proto::translateTextMessageType(type);
|
||||||
std::string message = msg.getString();
|
std::string message = msg.getString();
|
||||||
|
@ -857,9 +857,9 @@ void ProtocolGame::parseFloorChangeUp(InputMessage& msg)
|
||||||
Position pos = g_map.getCentralPosition();
|
Position pos = g_map.getCentralPosition();
|
||||||
pos.z--;
|
pos.z--;
|
||||||
|
|
||||||
int32 skip = 0;
|
int skip = 0;
|
||||||
if(pos.z == 7)
|
if(pos.z == 7)
|
||||||
for(int32 i = 5; i >= 0; i--)
|
for(int i = 5; i >= 0; i--)
|
||||||
setFloorDescription(msg, pos.x - 8, pos.y - 6, i, 18, 14, 8 - i, &skip);
|
setFloorDescription(msg, pos.x - 8, pos.y - 6, i, 18, 14, 8 - i, &skip);
|
||||||
else if(pos.z > 7)
|
else if(pos.z > 7)
|
||||||
setFloorDescription(msg, pos.x - 8, pos.y - 6, pos.z - 2, 18, 14, 3, &skip);
|
setFloorDescription(msg, pos.x - 8, pos.y - 6, pos.z - 2, 18, 14, 3, &skip);
|
||||||
|
@ -913,7 +913,7 @@ void ProtocolGame::parseOutfitWindow(InputMessage& msg)
|
||||||
|
|
||||||
void ProtocolGame::parseVipState(InputMessage& msg)
|
void ProtocolGame::parseVipState(InputMessage& msg)
|
||||||
{
|
{
|
||||||
int id = msg.getU32();
|
uint id = msg.getU32();
|
||||||
std::string name = msg.getString();
|
std::string name = msg.getString();
|
||||||
bool online = msg.getU8() != 0;
|
bool online = msg.getU8() != 0;
|
||||||
|
|
||||||
|
@ -922,14 +922,14 @@ void ProtocolGame::parseVipState(InputMessage& msg)
|
||||||
|
|
||||||
void ProtocolGame::parseVipLogin(InputMessage& msg)
|
void ProtocolGame::parseVipLogin(InputMessage& msg)
|
||||||
{
|
{
|
||||||
int id = msg.getU32();
|
uint id = msg.getU32();
|
||||||
|
|
||||||
g_lua.callGlobalField("Game", "onVipStateChange", id, true);
|
g_lua.callGlobalField("Game", "onVipStateChange", id, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::parseVipLogout(InputMessage& msg)
|
void ProtocolGame::parseVipLogout(InputMessage& msg)
|
||||||
{
|
{
|
||||||
int id = msg.getU32();
|
uint id = msg.getU32();
|
||||||
|
|
||||||
g_lua.callGlobalField("Game", "onVipStateChange", id, false);
|
g_lua.callGlobalField("Game", "onVipStateChange", id, false);
|
||||||
}
|
}
|
||||||
|
@ -948,8 +948,8 @@ void ProtocolGame::parseAddMarker(InputMessage& msg)
|
||||||
|
|
||||||
void ProtocolGame::parseQuestList(InputMessage& msg)
|
void ProtocolGame::parseQuestList(InputMessage& msg)
|
||||||
{
|
{
|
||||||
uint16 questsCount = msg.getU16();
|
int questsCount = msg.getU16();
|
||||||
for(uint16 i = 0; i < questsCount; i++) {
|
for(int i = 0; i < questsCount; i++) {
|
||||||
msg.getU16(); // quest id
|
msg.getU16(); // quest id
|
||||||
msg.getString(); // quest name
|
msg.getString(); // quest name
|
||||||
msg.getU8(); // quest state
|
msg.getU8(); // quest state
|
||||||
|
@ -959,8 +959,8 @@ void ProtocolGame::parseQuestList(InputMessage& msg)
|
||||||
void ProtocolGame::parseQuestPartList(InputMessage& msg)
|
void ProtocolGame::parseQuestPartList(InputMessage& msg)
|
||||||
{
|
{
|
||||||
msg.getU16(); // quest id
|
msg.getU16(); // quest id
|
||||||
uint8 missionCount = msg.getU8();
|
int missionCount = msg.getU8();
|
||||||
for(uint8 i = 0; i < missionCount; i++) {
|
for(int i = 0; i < missionCount; i++) {
|
||||||
msg.getString(); // quest name
|
msg.getString(); // quest name
|
||||||
msg.getString(); // quest description
|
msg.getString(); // quest description
|
||||||
}
|
}
|
||||||
|
@ -987,12 +987,12 @@ void ProtocolGame::setMapDescription(InputMessage& msg, int32 x, int32 y, int32
|
||||||
|
|
||||||
void ProtocolGame::setFloorDescription(InputMessage& msg, int32 x, int32 y, int32 z, int32 width, int32 height, int32 offset, int32* skipTiles)
|
void ProtocolGame::setFloorDescription(InputMessage& msg, int32 x, int32 y, int32 z, int32 width, int32 height, int32 offset, int32* skipTiles)
|
||||||
{
|
{
|
||||||
int32 skip = *skipTiles;
|
int skip = *skipTiles;
|
||||||
|
|
||||||
for(int32 nx = 0; nx < width; nx++) {
|
for(int nx = 0; nx < width; nx++) {
|
||||||
for(int32 ny = 0; ny < height; ny++) {
|
for(int ny = 0; ny < height; ny++) {
|
||||||
if(skip == 0) {
|
if(skip == 0) {
|
||||||
uint16 tileOpt = msg.getU16(true);
|
int tileOpt = msg.getU16(true);
|
||||||
if(tileOpt >= 0xFF00)
|
if(tileOpt >= 0xFF00)
|
||||||
skip = (msg.getU16() & 0xFF);
|
skip = (msg.getU16() & 0xFF);
|
||||||
else {
|
else {
|
||||||
|
@ -1014,7 +1014,7 @@ void ProtocolGame::setTileDescription(InputMessage& msg, Position position)
|
||||||
|
|
||||||
int stackPos = 0;
|
int stackPos = 0;
|
||||||
while(true) {
|
while(true) {
|
||||||
uint16 inspectTileId = msg.getU16(true);
|
int inspectTileId = msg.getU16(true);
|
||||||
if(inspectTileId >= 0xFF00)
|
if(inspectTileId >= 0xFF00)
|
||||||
return;
|
return;
|
||||||
else {
|
else {
|
||||||
|
@ -1022,6 +1022,7 @@ void ProtocolGame::setTileDescription(InputMessage& msg, Position position)
|
||||||
logTraceError("too many things, stackpos=", stackPos, " pos=", position);
|
logTraceError("too many things, stackpos=", stackPos, " pos=", position);
|
||||||
|
|
||||||
ThingPtr thing = internalGetThing(msg);
|
ThingPtr thing = internalGetThing(msg);
|
||||||
|
if(thing)
|
||||||
g_map.addThing(thing, position, 255);
|
g_map.addThing(thing, position, 255);
|
||||||
}
|
}
|
||||||
stackPos++;
|
stackPos++;
|
||||||
|
@ -1032,14 +1033,14 @@ Outfit ProtocolGame::internalGetOutfit(InputMessage& msg)
|
||||||
{
|
{
|
||||||
Outfit outfit;
|
Outfit outfit;
|
||||||
|
|
||||||
uint16 id = msg.getU16();
|
int id = msg.getU16();
|
||||||
if(id != 0) {
|
if(id != 0) {
|
||||||
outfit.setCategory(ThingsType::Creature);
|
outfit.setCategory(ThingsType::Creature);
|
||||||
uint8 head = msg.getU8();
|
int head = msg.getU8();
|
||||||
uint8 body = msg.getU8();
|
int body = msg.getU8();
|
||||||
uint8 legs = msg.getU8();
|
int legs = msg.getU8();
|
||||||
uint8 feet = msg.getU8();
|
int feet = msg.getU8();
|
||||||
uint8 addons = msg.getU8();
|
int addons = msg.getU8();
|
||||||
|
|
||||||
outfit.setId(id);
|
outfit.setId(id);
|
||||||
outfit.setHead(head);
|
outfit.setHead(head);
|
||||||
|
@ -1049,7 +1050,7 @@ Outfit ProtocolGame::internalGetOutfit(InputMessage& msg)
|
||||||
outfit.setAddons(addons);
|
outfit.setAddons(addons);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
uint16 id = msg.getU16();
|
int id = msg.getU16();
|
||||||
if(id == 0) {
|
if(id == 0) {
|
||||||
outfit.setCategory(ThingsType::Effect);
|
outfit.setCategory(ThingsType::Effect);
|
||||||
outfit.setId(13);
|
outfit.setId(13);
|
||||||
|
@ -1067,12 +1068,13 @@ ThingPtr ProtocolGame::internalGetThing(InputMessage& msg)
|
||||||
{
|
{
|
||||||
ThingPtr thing;
|
ThingPtr thing;
|
||||||
|
|
||||||
uint16 thingId = msg.getU16();
|
int thingId = msg.getU16();
|
||||||
|
assert(thingId != 0);
|
||||||
if(thingId == 0x0061 || thingId == 0x0062) { // add new creature
|
if(thingId == 0x0061 || thingId == 0x0062) { // add new creature
|
||||||
CreaturePtr creature;
|
CreaturePtr creature;
|
||||||
|
|
||||||
if(thingId == 0x0062) { //creature is known
|
if(thingId == 0x0062) { //creature is known
|
||||||
uint32 id = msg.getU32();
|
uint id = msg.getU32();
|
||||||
|
|
||||||
CreaturePtr knownCreature = g_map.getCreatureById(id);
|
CreaturePtr knownCreature = g_map.getCreatureById(id);
|
||||||
if(knownCreature)
|
if(knownCreature)
|
||||||
|
@ -1080,8 +1082,8 @@ ThingPtr ProtocolGame::internalGetThing(InputMessage& msg)
|
||||||
else
|
else
|
||||||
logTraceError("server says creature is known, but its not on creatures list");
|
logTraceError("server says creature is known, but its not on creatures list");
|
||||||
} else if(thingId == 0x0061) { //creature is not known
|
} else if(thingId == 0x0061) { //creature is not known
|
||||||
uint32 removeId = msg.getU32();
|
uint removeId = msg.getU32();
|
||||||
uint32 id = msg.getU32();
|
uint id = msg.getU32();
|
||||||
std::string name = msg.getString();
|
std::string name = msg.getString();
|
||||||
|
|
||||||
if(name.length() > 0) // every creature name must start with a capital letter
|
if(name.length() > 0) // every creature name must start with a capital letter
|
||||||
|
@ -1112,11 +1114,11 @@ ThingPtr ProtocolGame::internalGetThing(InputMessage& msg)
|
||||||
light.intensity = msg.getU8();
|
light.intensity = msg.getU8();
|
||||||
light.color = msg.getU8();
|
light.color = msg.getU8();
|
||||||
|
|
||||||
uint16 speed = msg.getU16();
|
int speed = msg.getU16();
|
||||||
uint8 skull = msg.getU8();
|
int skull = msg.getU8();
|
||||||
uint8 shield = msg.getU8();
|
int shield = msg.getU8();
|
||||||
|
|
||||||
uint8 emblem = 0;
|
int emblem = 0;
|
||||||
if(thingId == 0x0061) // emblem is sent only in packet type 0x61
|
if(thingId == 0x0061) // emblem is sent only in packet type 0x61
|
||||||
emblem = msg.getU8();
|
emblem = msg.getU8();
|
||||||
|
|
||||||
|
@ -1144,9 +1146,9 @@ ThingPtr ProtocolGame::internalGetThing(InputMessage& msg)
|
||||||
return thing;
|
return thing;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemPtr ProtocolGame::internalGetItem(InputMessage& msg, uint16 id)
|
ItemPtr ProtocolGame::internalGetItem(InputMessage& msg, int id)
|
||||||
{
|
{
|
||||||
if(id == 0xFFFF)
|
if(id == 0)
|
||||||
id = msg.getU16();
|
id = msg.getU16();
|
||||||
|
|
||||||
ItemPtr item = Item::create(id);
|
ItemPtr item = Item::create(id);
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include "protocolgame.h"
|
#include "protocolgame.h"
|
||||||
#include <framework/net/rsa.h>
|
#include <framework/net/rsa.h>
|
||||||
|
|
||||||
void ProtocolGame::sendLoginPacket(uint32 timestamp, uint8 unknown)
|
void ProtocolGame::sendLoginPacket(uint timestamp, uint8 unknown)
|
||||||
{
|
{
|
||||||
OutputMessage oMsg;
|
OutputMessage oMsg;
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ void ProtocolGame::sendCloseShop()
|
||||||
send(oMsg);
|
send(oMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::sendRequestTrade(const Position& pos, int thingId, int stackpos, int playerId)
|
void ProtocolGame::sendRequestTrade(const Position& pos, int thingId, int stackpos, uint playerId)
|
||||||
{
|
{
|
||||||
OutputMessage oMsg;
|
OutputMessage oMsg;
|
||||||
oMsg.addU8(Proto::ClientTradeObject);
|
oMsg.addU8(Proto::ClientTradeObject);
|
||||||
|
@ -275,7 +275,7 @@ void ProtocolGame::sendUseItemEx(const Position& fromPos, int fromThingId, int f
|
||||||
send(oMsg);
|
send(oMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::sendUseItemCreature(const Position& pos, int thingId, int stackpos, int creatureId)
|
void ProtocolGame::sendUseItemCreature(const Position& pos, int thingId, int stackpos, uint creatureId)
|
||||||
{
|
{
|
||||||
OutputMessage oMsg;
|
OutputMessage oMsg;
|
||||||
oMsg.addU8(Proto::ClientUseOnCreature);
|
oMsg.addU8(Proto::ClientUseOnCreature);
|
||||||
|
@ -312,7 +312,7 @@ void ProtocolGame::sendUpContainer(int containerId)
|
||||||
send(oMsg);
|
send(oMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::sendTextWindow(int windowTextId, const std::string& text)
|
void ProtocolGame::sendTextWindow(uint windowTextId, const std::string& text)
|
||||||
{
|
{
|
||||||
OutputMessage oMsg;
|
OutputMessage oMsg;
|
||||||
oMsg.addU8(Proto::ClientEditText);
|
oMsg.addU8(Proto::ClientEditText);
|
||||||
|
@ -321,7 +321,7 @@ void ProtocolGame::sendTextWindow(int windowTextId, const std::string& text)
|
||||||
send(oMsg);
|
send(oMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::sendHouseWindow(int doorId, int id, const std::string& text)
|
void ProtocolGame::sendHouseWindow(int doorId, uint id, const std::string& text)
|
||||||
{
|
{
|
||||||
OutputMessage oMsg;
|
OutputMessage oMsg;
|
||||||
oMsg.addU8(Proto::ClientEditList);
|
oMsg.addU8(Proto::ClientEditList);
|
||||||
|
@ -420,7 +420,7 @@ void ProtocolGame::sendFightTatics(Otc::FightModes fightMode, Otc::ChaseModes ch
|
||||||
send(oMsg);
|
send(oMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::sendAttack(int creatureId)
|
void ProtocolGame::sendAttack(uint creatureId)
|
||||||
{
|
{
|
||||||
OutputMessage oMsg;
|
OutputMessage oMsg;
|
||||||
oMsg.addU8(Proto::ClientAttack);
|
oMsg.addU8(Proto::ClientAttack);
|
||||||
|
@ -430,7 +430,7 @@ void ProtocolGame::sendAttack(int creatureId)
|
||||||
send(oMsg);
|
send(oMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::sendFollow(int creatureId)
|
void ProtocolGame::sendFollow(uint creatureId)
|
||||||
{
|
{
|
||||||
OutputMessage oMsg;
|
OutputMessage oMsg;
|
||||||
oMsg.addU8(Proto::ClientFollow);
|
oMsg.addU8(Proto::ClientFollow);
|
||||||
|
@ -438,7 +438,7 @@ void ProtocolGame::sendFollow(int creatureId)
|
||||||
send(oMsg);
|
send(oMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::sendInviteToParty(int creatureId)
|
void ProtocolGame::sendInviteToParty(uint creatureId)
|
||||||
{
|
{
|
||||||
OutputMessage oMsg;
|
OutputMessage oMsg;
|
||||||
oMsg.addU8(Proto::ClientInviteToParty);
|
oMsg.addU8(Proto::ClientInviteToParty);
|
||||||
|
@ -446,7 +446,7 @@ void ProtocolGame::sendInviteToParty(int creatureId)
|
||||||
send(oMsg);
|
send(oMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::sendJoinParty(int creatureId)
|
void ProtocolGame::sendJoinParty(uint creatureId)
|
||||||
{
|
{
|
||||||
OutputMessage oMsg;
|
OutputMessage oMsg;
|
||||||
oMsg.addU8(Proto::ClientJoinParty);
|
oMsg.addU8(Proto::ClientJoinParty);
|
||||||
|
@ -454,7 +454,7 @@ void ProtocolGame::sendJoinParty(int creatureId)
|
||||||
send(oMsg);
|
send(oMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::sendRevokeInvitation(int creatureId)
|
void ProtocolGame::sendRevokeInvitation(uint creatureId)
|
||||||
{
|
{
|
||||||
OutputMessage oMsg;
|
OutputMessage oMsg;
|
||||||
oMsg.addU8(Proto::ClientRevokeInvitation);
|
oMsg.addU8(Proto::ClientRevokeInvitation);
|
||||||
|
@ -462,7 +462,7 @@ void ProtocolGame::sendRevokeInvitation(int creatureId)
|
||||||
send(oMsg);
|
send(oMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::sendPassLeadership(int creatureId)
|
void ProtocolGame::sendPassLeadership(uint creatureId)
|
||||||
{
|
{
|
||||||
OutputMessage oMsg;
|
OutputMessage oMsg;
|
||||||
oMsg.addU8(Proto::ClientPassLeadership);
|
oMsg.addU8(Proto::ClientPassLeadership);
|
||||||
|
@ -555,7 +555,7 @@ void ProtocolGame::sendAddVip(const std::string& name)
|
||||||
send(oMsg);
|
send(oMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::sendRemoveVip(int playerId)
|
void ProtocolGame::sendRemoveVip(uint playerId)
|
||||||
{
|
{
|
||||||
OutputMessage oMsg;
|
OutputMessage oMsg;
|
||||||
oMsg.addU8(Proto::ClientRemoveBuddy);
|
oMsg.addU8(Proto::ClientRemoveBuddy);
|
||||||
|
|
|
@ -55,7 +55,7 @@ void ProtocolLogin::onRecv(InputMessage& inputMessage)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
while(!inputMessage.eof()) {
|
while(!inputMessage.eof()) {
|
||||||
uint8 opt = inputMessage.getU8();
|
int opt = inputMessage.getU8();
|
||||||
switch(opt) {
|
switch(opt) {
|
||||||
case Proto::LoginServerError:
|
case Proto::LoginServerError:
|
||||||
parseError(inputMessage);
|
parseError(inputMessage);
|
||||||
|
|
Loading…
Reference in New Issue