changes to wotk with protocol 860
This commit is contained in:
parent
d04596c5fd
commit
fbaa7c8c43
|
@ -7,6 +7,7 @@ Module
|
|||
onLoad: |
|
||||
require 'ext/table'
|
||||
require 'ext/string'
|
||||
require 'ext/os'
|
||||
require 'math/point'
|
||||
require 'math/size'
|
||||
require 'math/color'
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
function os.execute(command)
|
||||
local f = assert(io.popen(command, 'r'))
|
||||
local data = assert(f:read('*a'))
|
||||
f:close()
|
||||
print(data)
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
Mouse = {}
|
||||
|
|
@ -5,20 +5,72 @@ importStyle 'textmessage.otui'
|
|||
|
||||
-- private variables
|
||||
local bottomLabelWidget, centerLabelWidget
|
||||
local messageTypes = {
|
||||
first = 12,
|
||||
{ msgtype = 'MessageOrange', color = '#C87832', showOnConsole = true, showOnWindow = false },
|
||||
{ msgtype = 'MessageOrange', color = '#C87832', showOnConsole = true, showOnWindow = false },
|
||||
{ msgtype = 'MessageRed', color = '#C83200', showOnConsole = true, showOnWindow = true, windowLocation = 'CenterLabel' },
|
||||
{ msgtype = 'MessageWhite', color = '#FFFFFF', showOnConsole = true, showOnWindow = true, windowLocation = 'CenterLabel' },
|
||||
{ msgtype = 'MessageWhite', color = '#FFFFFF', showOnConsole = true, showOnWindow = true, windowLocation = 'BottomLabel' },
|
||||
{ msgtype = 'MessageWhite', color = '#FFFFFF', showOnConsole = true, showOnWindow = true, windowLocation = 'BottomLabel' },
|
||||
{ msgtype = 'MessageGreen', color = '#3FBE32', showOnConsole = true, showOnWindow = true, windowLocation = 'CenterLabel' },
|
||||
{ msgtype = 'MessageWhite', color = '#FFFFFF', showOnConsole = false, showOnWindow = true, windowLocation = 'BottomLabel' },
|
||||
{ msgtype = 'MessageBlue', color = '#3264C8', showOnConsole = true, showOnWindow = false },
|
||||
{ msgtype = 'MessageRed', color = '#C83200', showOnConsole = true, showOnWindow = false }
|
||||
|
||||
local MessageTypes = {
|
||||
warning = { color = '#F55E5E', showOnConsole = true, showOnWindow = true, windowLocation = 'CenterLabel' },
|
||||
eventAdvance = { color = '#FFFFFF', showOnConsole = true, showOnWindow = true, windowLocation = 'CenterLabel' },
|
||||
eventDefault = { color = '#FFFFFF', showOnConsole = true, showOnWindow = true, windowLocation = 'BottomLabel' },
|
||||
statusDefault = { color = '#FFFFFF', showOnConsole = true, showOnWindow = true, windowLocation = 'BottomLabel' },
|
||||
infoDesc = { color = '#00EB00', showOnConsole = true, showOnWindow = true, windowLocation = 'CenterLabel' },
|
||||
statusSmall = { color = '#FFFFFF', showOnConsole = false, showOnWindow = true, windowLocation = 'BottomLabel' },
|
||||
consoleOrange = { color = '#FE6500', showOnConsole = true, showOnWindow = false },
|
||||
consoleBlue = { color = '#9F9DFD', showOnConsole = true, showOnWindow = false },
|
||||
consoleRed = { color = '#F55E5E', showOnConsole = true, showOnWindow = false }
|
||||
}
|
||||
local hideEvent
|
||||
|
||||
local MessageTypesMap = {
|
||||
[12] = MessageTypes.consoleOrange,
|
||||
[13] = MessageTypes.consoleOrange,
|
||||
[14] = MessageTypes.warning,
|
||||
[15] = MessageTypes.eventAdvance,
|
||||
[15] = MessageTypes.eventDefault,
|
||||
[16] = MessageTypes.statusDefault,
|
||||
[17] = MessageTypes.infoDesc,
|
||||
[18] = MessageTypes.statusSmall,
|
||||
[19] = MessageTypes.consoleBlue,
|
||||
[20] = MessageTypes.consoleRed,
|
||||
--[[
|
||||
[18] = MessageTypes.consoleRed,
|
||||
[19] = MessageTypes.consoleOrange,
|
||||
[20] = MessageTypes.consoleOrange,
|
||||
[21] = MessageTypes.warning,
|
||||
[22] = MessageTypes.eventAdvance,
|
||||
[23] = MessageTypes.eventDefault,
|
||||
[24] = MessageTypes.statusDefault,
|
||||
[25] = MessageTypes.infoDesc,
|
||||
[26] = MessageTypes.statusSmall,
|
||||
[27] = MessageTypes.consoleBlue
|
||||
]]--
|
||||
}
|
||||
|
||||
-- private variables
|
||||
local bottomLabelHideEvent
|
||||
local centerLabelHideEvent
|
||||
|
||||
-- private functions
|
||||
local function displayMessage(msgtype, msg)
|
||||
if msgtype.showOnConsole then
|
||||
-- TODO
|
||||
end
|
||||
|
||||
if msgtype.showOnWindow then
|
||||
local label
|
||||
if msgtype.windowLocation == 'BottomLabel' then
|
||||
label = bottomLabelWidget
|
||||
elseif msgtype.windowLocation == 'CenterLabel' then
|
||||
label = centerLabelWidget
|
||||
end
|
||||
|
||||
label:setVisible(true)
|
||||
label:setText(msg)
|
||||
label:setStyle(msgtype.windowLocation)
|
||||
label:setForegroundColor(msgtype.color)
|
||||
|
||||
time = #msg * 75
|
||||
removeEvent(label.hideEvent)
|
||||
label.hideEvent = scheduleEvent(function() label:setVisible(false) end, time)
|
||||
end
|
||||
end
|
||||
|
||||
-- public functions
|
||||
function TextMessage.create()
|
||||
|
@ -26,33 +78,22 @@ function TextMessage.create()
|
|||
centerLabelWidget = createWidget('UILabel', Game.gameMapPanel)
|
||||
end
|
||||
|
||||
function TextMessage.displayWarning(msg)
|
||||
TextMessage.display(MessageTypes.warning, msg)
|
||||
end
|
||||
|
||||
function TextMessage.display(msgtypeid, msg)
|
||||
local msgtype = MessageTypesMap[msgtypeid]
|
||||
if msgtype == nil then
|
||||
error('unknown text msg type ' .. msgtypeid)
|
||||
return
|
||||
end
|
||||
displayMessage(msgtype, msg)
|
||||
end
|
||||
|
||||
-- hooked events
|
||||
function TextMessage.onTextMessage(msgtype, message)
|
||||
local messageType = messageTypes[msgtype - messageTypes.first]
|
||||
|
||||
if messageType.showOnConsole then
|
||||
-- TODO
|
||||
end
|
||||
|
||||
if messageType.showOnWindow then
|
||||
local label
|
||||
if messageType.windowLocation == 'BottomLabel' then
|
||||
label = bottomLabelWidget
|
||||
elseif messageType.windowLocation == 'CenterLabel' then
|
||||
label = centerLabelWidget
|
||||
end
|
||||
|
||||
label:setVisible(true)
|
||||
label:setText(message)
|
||||
label:setStyle(messageType.windowLocation)
|
||||
label:setForegroundColor(messageType.color)
|
||||
|
||||
time = #message * 75
|
||||
removeEvent(hideEvent)
|
||||
hideEvent = scheduleEvent(function()
|
||||
label:setVisible(false)
|
||||
end, time)
|
||||
end
|
||||
function TextMessage.onTextMessage(msgtypeid, msg)
|
||||
TextMessage.display(msgtypeid, msg)
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -2,10 +2,11 @@
|
|||
-- you can place any custom user code here
|
||||
|
||||
Hotkeys.bind('F1', function() Game.talk('exura gran') end)
|
||||
Hotkeys.bind('F2', function() Game.talk('exori frigo') end)
|
||||
Hotkeys.bind('F3', function() Game.talk('exevo flam hur') end)
|
||||
Hotkeys.bind('F4', function() Game.talk('exevo pan') end)
|
||||
Hotkeys.bind('F5', function() Game.talk('exani tera') end)
|
||||
Hotkeys.bind('F2', function() Game.talk('exori mort') end)
|
||||
Hotkeys.bind('F3', function() Game.talk('exori frigo') end)
|
||||
Hotkeys.bind('F4', function() Game.talk('exevo vis hur') end)
|
||||
Hotkeys.bind('F5', function() Game.talk('utani gran hur') end)
|
||||
Hotkeys.bind('F6', function() Game.talk('exani tera') end)
|
||||
Hotkeys.bind('Ctrl+R', function() runscript('otclientrc.lua') end)
|
||||
|
||||
if rcloaded then
|
||||
|
|
|
@ -4,14 +4,16 @@ IF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6)
|
|||
ENDIF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6)
|
||||
|
||||
# otclient options
|
||||
OPTION(FORBIDDEN_FUNCTIONS "Enable forbidden lua functions" ON)
|
||||
OPTION(NO_BOT_PROTECTION "Disables bot protection" OFF)
|
||||
SET(PROTOCOL 862 CACHE "Protocol version" STRING)
|
||||
ADD_DEFINITIONS(-DPROTOCOL=${PROTOCOL})
|
||||
|
||||
IF(FORBIDDEN_FUNCTIONS)
|
||||
ADD_DEFINITIONS(-DFORBIDDEN_FUNCTIONS)
|
||||
MESSAGE(STATUS "Lua forbidden functions: ON")
|
||||
ELSE(FORBIDDEN_FUNCTIONS)
|
||||
MESSAGE(STATUS "Lua forbidden functions: OFF")
|
||||
ENDIF(FORBIDDEN_FUNCTIONS)
|
||||
IF(NO_BOT_PROTECTION)
|
||||
ADD_DEFINITIONS(-DNO_BOT_PROTECTION)
|
||||
MESSAGE(STATUS "Bot protection: OFF")
|
||||
ELSE(NO_BOT_PROTECTION)
|
||||
MESSAGE(STATUS "Bot protection: ON")
|
||||
ENDIF(NO_BOT_PROTECTION)
|
||||
|
||||
SET(otclient_SOURCES ${otclient_SOURCES}
|
||||
# otclient
|
||||
|
|
|
@ -333,20 +333,30 @@ namespace Otc
|
|||
};
|
||||
|
||||
enum SpeakClasses {
|
||||
SpeakSay = 0x01, //normal talk
|
||||
SpeakWhisper = 0x02, //whispering - #w text
|
||||
SpeakYell = 0x03, //yelling - #y text
|
||||
SpeakPrivatePlayerToNpc = 0x04, //Player-to-NPC speaking(NPCs channel)
|
||||
SpeakPrivateNpcToPlayer = 0x05, //NPC-to-Player speaking
|
||||
SpeakPrivate = 0x06, //Players speaking privately to players
|
||||
SpeakChannelYellow = 0x07, //Yellow message in chat
|
||||
SpeakChannelWhite = 0x08, //White message in chat
|
||||
SpeakBroadcast = 0x09, //Broadcast a message - #b
|
||||
SpeakChannelRed = 0x0A, //Talk red on chat - #c
|
||||
SpeakPrivateRed = 0x0B, //Red private - @name@ text
|
||||
SpeakChannelOrange = 0x0C, //Talk orange on text
|
||||
SpeakMonsterSay = 0x0D, //Talk orange
|
||||
SpeakMonsterYell = 0x0E //Yell orange
|
||||
SpeakSay = 1, //normal talk
|
||||
SpeakWhisper, //whispering - #w text
|
||||
SpeakYell, //yelling - #y text
|
||||
SpeakPrivatePlayerToNpc, //Player-to-NPC speaking(NPCs channel)
|
||||
SpeakPrivateNpcToPlayer, //NPC-to-Player speaking
|
||||
SpeakPrivate, //Players speaking privately to players
|
||||
SpeakChannelYellow, //Yellow message in chat
|
||||
SpeakChannelWhite, //White message in chat
|
||||
#if PROTOCOL==860
|
||||
SpeakReportChannel, //Reporting rule violation - Ctrl+R
|
||||
SpeakReportAnswer, //Answering report
|
||||
SpeakReportContinue, //Answering the answer of the report
|
||||
#endif
|
||||
SpeakBroadcast, //Broadcast a message - #b
|
||||
SpeakChannelRed, //Talk red on chat - #c
|
||||
SpeakPrivateRed, //Red private - @name@ text
|
||||
SpeakChannelOrange, //Talk orange on text
|
||||
#if PROTOCOL==860
|
||||
SpeakUnk1,
|
||||
SpeakChannelRed2, //Talk red anonymously on chat - #d
|
||||
SpeakUnk2,
|
||||
#endif
|
||||
SpeakMonsterSay, //Talk orange
|
||||
SpeakMonsterYell //Yell orange
|
||||
};
|
||||
|
||||
enum CreaturesIdRange {
|
||||
|
|
|
@ -322,7 +322,7 @@ void Game::removeVip(int playerId)
|
|||
|
||||
bool Game::checkBotProtection()
|
||||
{
|
||||
#ifndef DISABLE_BOT_PROTECTION
|
||||
#ifndef NO_BOT_PROTECTION
|
||||
if(g_lua.isInCppCallback() && !g_ui.isOnInputEvent()) {
|
||||
logError("caught a lua call to a bot protected game function, the call was canceled");
|
||||
return false;
|
||||
|
|
|
@ -78,6 +78,7 @@ public:
|
|||
|
||||
LocalPlayerPtr getLocalPlayer() { return m_localPlayer; }
|
||||
ProtocolGamePtr getProtocolGame() { return m_protocolGame; }
|
||||
int getProtocolVersion() { return PROTOCOL; }
|
||||
|
||||
private:
|
||||
LocalPlayerPtr m_localPlayer;
|
||||
|
|
|
@ -286,10 +286,10 @@ ThingPtr Map::getThing(const Position& pos, int stackPos)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void Map::removeThing(const Position& pos, int stackPos)
|
||||
void Map::removeThingByPos(const Position& pos, int stackPos)
|
||||
{
|
||||
if(TilePtr& tile = m_tiles[pos])
|
||||
tile->removeThing(stackPos);
|
||||
tile->removeThingByStackpos(stackPos);
|
||||
}
|
||||
|
||||
void Map::removeThing(const ThingPtr& thing)
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
|
||||
void addThing(const ThingPtr& thing, const Position& pos, int stackPos = -1);
|
||||
ThingPtr getThing(const Position& pos, int stackPos);
|
||||
void removeThing(const Position& pos, int stackPos);
|
||||
void removeThingByPos(const Position& pos, int stackPos);
|
||||
void removeThing(const ThingPtr& thing);
|
||||
void cleanTile(const Position& pos);
|
||||
TilePtr getTile(const Position& pos);
|
||||
|
|
|
@ -107,7 +107,7 @@ void StaticText::compose()
|
|||
m_color = Color(95, 247, 247);
|
||||
}
|
||||
else {
|
||||
logWarning("unknown message type: ", m_type);
|
||||
logWarning("unknown speak type: ", m_type);
|
||||
}
|
||||
|
||||
// Todo: add break lines
|
||||
|
|
|
@ -149,7 +149,7 @@ ThingPtr Tile::getTopThing()
|
|||
return m_things[m_things.size() - 1];
|
||||
}
|
||||
|
||||
ThingPtr Tile::removeThing(int stackPos)
|
||||
ThingPtr Tile::removeThingByStackpos(int stackPos)
|
||||
{
|
||||
ThingPtr oldObject;
|
||||
if(stackPos >= 0 && stackPos < (int)m_things.size()) {
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
ThingPtr getThing(int stackPos);
|
||||
int getThingStackpos(const ThingPtr& thing);
|
||||
ThingPtr getTopThing();
|
||||
ThingPtr removeThing(int stackPos);
|
||||
ThingPtr removeThingByStackpos(int stackPos);
|
||||
ThingPtr removeThing(const ThingPtr& thing);
|
||||
|
||||
|
||||
|
|
|
@ -26,6 +26,10 @@
|
|||
#include <otclient/core/game.h>
|
||||
#include <otclient/core/tile.h>
|
||||
#include <otclient/core/item.h>
|
||||
#include <otclient/core/effect.h>
|
||||
#include <otclient/core/missile.h>
|
||||
#include <otclient/core/statictext.h>
|
||||
#include <otclient/core/animatedtext.h>
|
||||
#include <otclient/core/creature.h>
|
||||
#include <otclient/core/player.h>
|
||||
#include <otclient/core/localplayer.h>
|
||||
|
@ -54,6 +58,27 @@ void OTClient::registerLuaFunctions()
|
|||
g_lua.bindClassStaticFunction("g_sprites", "isLoaded", std::bind(&SpriteManager::isLoaded, &g_sprites));
|
||||
g_lua.bindClassStaticFunction("g_sprites", "getSignature", std::bind(&SpriteManager::getSignature, &g_sprites));
|
||||
|
||||
g_lua.registerStaticClass("g_map");
|
||||
g_lua.bindClassStaticFunction("g_map", "getFirstVisibleFloor", std::bind(&Map::getFirstVisibleFloor, &g_map));
|
||||
g_lua.bindClassStaticFunction("g_map", "isLookPossible", std::bind(&Map::isLookPossible, &g_map, _1));
|
||||
g_lua.bindClassStaticFunction("g_map", "isCovered", std::bind(&Map::isCovered, &g_map, _1, _2));
|
||||
g_lua.bindClassStaticFunction("g_map", "isCompletlyCovered", std::bind(&Map::isCompletlyCovered, &g_map, _1, _2));
|
||||
g_lua.bindClassStaticFunction("g_map", "addThing", std::bind(&Map::addThing, &g_map, _1, _2, _3));
|
||||
g_lua.bindClassStaticFunction("g_map", "getThing", std::bind(&Map::getThing, &g_map, _1, _2));
|
||||
g_lua.bindClassStaticFunction("g_map", "removeThingByPos", std::bind(&Map::removeThingByPos, &g_map, _1, _2));
|
||||
g_lua.bindClassStaticFunction("g_map", "removeThing", std::bind(&Map::removeThing, &g_map, _1));
|
||||
g_lua.bindClassStaticFunction("g_map", "cleanTile", std::bind(&Map::cleanTile, &g_map, _1));
|
||||
g_lua.bindClassStaticFunction("g_map", "getTile", std::bind(&Map::getTile, &g_map, _1));
|
||||
g_lua.bindClassStaticFunction("g_map", "setCentralPosition", std::bind(&Map::setCentralPosition, &g_map, _1));
|
||||
g_lua.bindClassStaticFunction("g_map", "getCentralPosition", std::bind(&Map::getCentralPosition, &g_map));
|
||||
g_lua.bindClassStaticFunction("g_map", "addCreature", std::bind(&Map::addCreature, &g_map, _1));
|
||||
g_lua.bindClassStaticFunction("g_map", "getCreatureById", std::bind(&Map::getCreatureById, &g_map, _1));
|
||||
g_lua.bindClassStaticFunction("g_map", "removeCreatureById", std::bind(&Map::removeCreatureById, &g_map, _1));
|
||||
g_lua.bindClassStaticFunction("g_map", "setVisibleSize", std::bind(&Map::setVisibleSize, &g_map, _1));
|
||||
g_lua.bindClassStaticFunction("g_map", "getVibibleSize", std::bind(&Map::getVibibleSize, &g_map));
|
||||
g_lua.bindClassStaticFunction("g_map", "getCentralOffset", std::bind(&Map::getCentralOffset, &g_map));
|
||||
g_lua.bindClassStaticFunction("g_map", "positionTo2D", std::bind(&Map::positionTo2D, &g_map, _1));
|
||||
|
||||
g_lua.bindGlobalFunction("getOufitColor", Outfit::getColor);
|
||||
|
||||
g_lua.registerClass<ProtocolLogin, Protocol>();
|
||||
|
@ -64,16 +89,36 @@ void OTClient::registerLuaFunctions()
|
|||
g_lua.registerClass<ProtocolGame, Protocol>();
|
||||
|
||||
g_lua.registerClass<Thing>();
|
||||
g_lua.bindClassMemberFunction<Thing>("setId", &Thing::setId);
|
||||
g_lua.bindClassMemberFunction<Thing>("setPos", &Thing::setPos);
|
||||
g_lua.bindClassMemberFunction<Thing>("getId", &Thing::getId);
|
||||
g_lua.bindClassMemberFunction<Thing>("getType", &Thing::getType);
|
||||
g_lua.bindClassMemberFunction<Thing>("getPos", &Thing::getPos);
|
||||
g_lua.bindClassMemberFunction<Thing>("getStackPriority", &Thing::getStackPriority);
|
||||
g_lua.bindClassMemberFunction<Thing>("getAnimationPhases", &Thing::getAnimationPhases);
|
||||
g_lua.bindClassMemberFunction<Thing>("setXPattern", &Thing::setXPattern);
|
||||
g_lua.bindClassMemberFunction<Thing>("setYPattern", &Thing::setYPattern);
|
||||
g_lua.bindClassMemberFunction<Thing>("setZPattern", &Thing::setZPattern);
|
||||
g_lua.bindClassMemberFunction<Thing>("asThing", &Thing::asThing);
|
||||
g_lua.bindClassMemberFunction<Thing>("asItem", &Thing::asItem);
|
||||
g_lua.bindClassMemberFunction<Thing>("asCreature", &Thing::asCreature);
|
||||
g_lua.bindClassMemberFunction<Thing>("asEffect", &Thing::asEffect);
|
||||
g_lua.bindClassMemberFunction<Thing>("asMissile", &Thing::asMissile);
|
||||
g_lua.bindClassMemberFunction<Thing>("asPlayer", &Thing::asPlayer);
|
||||
g_lua.bindClassMemberFunction<Thing>("asLocalPlayer", &Thing::asLocalPlayer);
|
||||
g_lua.bindClassMemberFunction<Thing>("asAnimatedText", &Thing::asAnimatedText);
|
||||
g_lua.bindClassMemberFunction<Thing>("asStaticText", &Thing::asStaticText);
|
||||
g_lua.bindClassMemberFunction<Thing>("isGround", &Thing::isGround);
|
||||
g_lua.bindClassMemberFunction<Thing>("isGroundBorder", &Thing::isGroundBorder);
|
||||
g_lua.bindClassMemberFunction<Thing>("isOnBottom", &Thing::isOnBottom);
|
||||
g_lua.bindClassMemberFunction<Thing>("isOnTop", &Thing::isOnTop);
|
||||
g_lua.bindClassMemberFunction<Thing>("isContainer", &Thing::isContainer);
|
||||
g_lua.bindClassMemberFunction<Thing>("isForceUse", &Thing::isForceUse);
|
||||
g_lua.bindClassMemberFunction<Thing>("isMultiUse", &Thing::isMultiUse);
|
||||
g_lua.bindClassMemberFunction<Thing>("isRotateable", &Thing::isRotateable);
|
||||
g_lua.bindClassMemberFunction<Thing>("isNotMoveable", &Thing::isNotMoveable);
|
||||
g_lua.bindClassMemberFunction<Thing>("isPickupable", &Thing::isPickupable);
|
||||
g_lua.bindClassMemberFunction<Thing>("asCreature", &Thing::asCreature);
|
||||
g_lua.bindClassMemberFunction<Thing>("asPlayer", &Thing::asPlayer);
|
||||
g_lua.bindClassMemberFunction<Thing>("asLocalPlayer", &Thing::asLocalPlayer);
|
||||
g_lua.bindClassMemberFunction<Thing>("ignoreLook", &Thing::ignoreLook);
|
||||
g_lua.bindClassMemberFunction<Thing>("isStackable", &Thing::isStackable);
|
||||
|
||||
g_lua.registerClass<Creature, Thing>();
|
||||
g_lua.bindClassMemberFunction<Creature>("getName", &Creature::getName);
|
||||
|
@ -85,12 +130,40 @@ void OTClient::registerLuaFunctions()
|
|||
|
||||
g_lua.registerClass<Player, Creature>();
|
||||
|
||||
g_lua.registerClass<Effect, Thing>();
|
||||
g_lua.registerClass<Missile, Thing>();
|
||||
g_lua.registerClass<StaticText, Thing>();
|
||||
g_lua.registerClass<AnimatedText, Thing>();
|
||||
|
||||
g_lua.registerClass<LocalPlayer, Player>();
|
||||
g_lua.bindClassMemberFunction<LocalPlayer>("getAttackingCreature", &LocalPlayer::getAttackingCreature);
|
||||
g_lua.bindClassMemberFunction<LocalPlayer>("getFollowingCreature", &LocalPlayer::getFollowingCreature);
|
||||
|
||||
g_lua.registerClass<Item, Thing>();
|
||||
|
||||
g_lua.registerClass<Tile>();
|
||||
g_lua.bindClassMemberFunction<Tile>("clean", &Tile::clean);
|
||||
g_lua.bindClassMemberFunction<Tile>("addThing", &Tile::addThing);
|
||||
g_lua.bindClassMemberFunction<Tile>("getThing", &Tile::getThing);
|
||||
g_lua.bindClassMemberFunction<Tile>("getThingStackpos", &Tile::getThingStackpos);
|
||||
g_lua.bindClassMemberFunction<Tile>("getTopThing", &Tile::getTopThing);
|
||||
g_lua.bindClassMemberFunction<Tile>("removeThingByStackpos", &Tile::removeThingByStackpos);
|
||||
g_lua.bindClassMemberFunction<Tile>("removeThing", &Tile::removeThing);
|
||||
g_lua.bindClassMemberFunction<Tile>("getTopLookThing", &Tile::getTopLookThing);
|
||||
g_lua.bindClassMemberFunction<Tile>("getTopUseThing", &Tile::getTopUseThing);
|
||||
g_lua.bindClassMemberFunction<Tile>("getTopCreature", &Tile::getTopCreature);
|
||||
g_lua.bindClassMemberFunction<Tile>("getPos", &Tile::getPos);
|
||||
g_lua.bindClassMemberFunction<Tile>("getDrawElevation", &Tile::getDrawElevation);
|
||||
g_lua.bindClassMemberFunction<Tile>("getCreatures", &Tile::getCreatures);
|
||||
g_lua.bindClassMemberFunction<Tile>("getGround", &Tile::getGround);
|
||||
g_lua.bindClassMemberFunction<Tile>("isWalkable", &Tile::isWalkable);
|
||||
g_lua.bindClassMemberFunction<Tile>("isFullGround", &Tile::isFullGround);
|
||||
g_lua.bindClassMemberFunction<Tile>("isFullyOpaque", &Tile::isFullyOpaque);
|
||||
g_lua.bindClassMemberFunction<Tile>("isLookPossible", &Tile::isLookPossible);
|
||||
g_lua.bindClassMemberFunction<Tile>("hasCreature", &Tile::hasCreature);
|
||||
g_lua.bindClassMemberFunction<Tile>("isEmpty", &Tile::isEmpty);
|
||||
g_lua.bindClassMemberFunction<Tile>("isClickable", &Tile::isClickable);
|
||||
|
||||
g_lua.registerClass<Map>();
|
||||
|
||||
g_lua.registerClass<Game>();
|
||||
|
@ -114,6 +187,7 @@ void OTClient::registerLuaFunctions()
|
|||
g_lua.bindClassStaticFunction<Game>("talkChannel", std::bind(&Game::talkChannel, &g_game, _1, _2, _3));
|
||||
g_lua.bindClassStaticFunction<Game>("talkPrivate", std::bind(&Game::talkPrivate, &g_game, _1, _2, _3));
|
||||
g_lua.bindClassStaticFunction<Game>("getLocalPlayer", std::bind(&Game::getLocalPlayer, &g_game));
|
||||
g_lua.bindClassStaticFunction<Game>("getProtocolVersion", std::bind(&Game::getProtocolVersion, &g_game));
|
||||
|
||||
g_lua.registerClass<UIItem, UIWidget>();
|
||||
g_lua.bindClassStaticFunction<UIItem>("create", []{ return UIItemPtr(new UIItem); } );
|
||||
|
|
|
@ -80,6 +80,7 @@ bool luavalue_cast(int index, Position& pos)
|
|||
pos.y = g_lua.popInteger();
|
||||
g_lua.getField("z", index);
|
||||
pos.z = g_lua.popInteger();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -353,8 +353,6 @@ void ProtocolGame::parseMoveWest(InputMessage& msg)
|
|||
|
||||
void ProtocolGame::parseUpdateTile(InputMessage& msg)
|
||||
{
|
||||
logDebug("PARSE UPDATE TILE!");
|
||||
|
||||
Position tilePos = parsePosition(msg);
|
||||
uint16 thingId = msg.getU16(true);
|
||||
if(thingId == 0xFF01) {
|
||||
|
@ -390,7 +388,7 @@ void ProtocolGame::parseTileTransformThing(InputMessage& msg)
|
|||
}
|
||||
else {
|
||||
ThingPtr thing = internalGetItem(msg, thingId);
|
||||
g_map.removeThing(pos, stackPos);
|
||||
g_map.removeThingByPos(pos, stackPos);
|
||||
g_map.addThing(thing, pos, stackPos);
|
||||
}
|
||||
}
|
||||
|
@ -400,7 +398,7 @@ void ProtocolGame::parseTileRemoveThing(InputMessage& msg)
|
|||
Position pos = parsePosition(msg);
|
||||
uint8 stackPos = msg.getU8();
|
||||
|
||||
g_map.removeThing(pos, stackPos);
|
||||
g_map.removeThingByPos(pos, stackPos);
|
||||
}
|
||||
|
||||
void ProtocolGame::parseCreatureMove(InputMessage& msg)
|
||||
|
@ -756,10 +754,13 @@ void ProtocolGame::parseCreatureSpeak(InputMessage& msg)
|
|||
case Otc::SpeakPrivateNpcToPlayer:
|
||||
creaturePos = parsePosition(msg);
|
||||
break;
|
||||
case Otc::SpeakChannelRed:
|
||||
case Otc::SpeakChannelOrange:
|
||||
case Otc::SpeakChannelYellow:
|
||||
case Otc::SpeakChannelWhite:
|
||||
case Otc::SpeakChannelRed:
|
||||
#if PROTOCOL==860
|
||||
case Otc::SpeakChannelRed2:
|
||||
#endif
|
||||
case Otc::SpeakChannelOrange:
|
||||
channelId = msg.getU16();
|
||||
break;
|
||||
case Otc::SpeakPrivate:
|
||||
|
@ -767,6 +768,11 @@ void ProtocolGame::parseCreatureSpeak(InputMessage& msg)
|
|||
case Otc::SpeakBroadcast:
|
||||
case Otc::SpeakPrivateRed:
|
||||
break;
|
||||
#if PROTOCOL==860
|
||||
case Otc::SpeakReportChannel:
|
||||
msg.getU32();
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
logTraceError("unknown speak type ", type);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue