Version 1.9

This commit is contained in:
OTCv8 2020-01-21 23:45:52 +01:00
parent 11ad766308
commit be8704ee92
56 changed files with 3517 additions and 483 deletions

View File

@ -0,0 +1,7 @@
Font
name: small-9px
texture: small-9px
height: 9
glyph-size: 9 9
space-width: 3
spacing: 1 0

BIN
data/fonts/small-9px.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -0,0 +1,8 @@
Font
name: verdana-9px-bold
texture: verdana-9px-bold
height: 12
glyph-size: 13 13
space-width: 4
spacing: 0 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -0,0 +1,6 @@
Font
name: verdana-9px-italic
texture: verdana-9px-italic
height: 12
glyph-size: 13 13
space-width: 3

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -0,0 +1,7 @@
Font
name: verdana-9px
texture: verdana-9px
height: 13
glyph-size: 13 13
space-width: 3
spacing: 0 -4

BIN
data/fonts/verdana-9px.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -4,14 +4,14 @@ CreatureButton < UICreatureButton
UICreature UICreature
id: creature id: creature
size: 20 20 size: 22 22
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
phantom: true phantom: true
UIWidget UIWidget
id: spacer id: spacer
width: 5 width: 3
anchors.left: creature.right anchors.left: creature.right
anchors.top: creature.top anchors.top: creature.top
phantom: true phantom: true

View File

@ -0,0 +1,60 @@
SmallScrollBar < UIScrollBar
orientation: vertical
margin-bottom: 1
step: 20
width: 8
image-source: /images/ui/scrollbar
image-clip: 39 0 13 65
image-border: 1
pixels-scroll: true
UIButton
id: decrementButton
anchors.top: parent.top
anchors.left: parent.left
image-source: /images/ui/scrollbar
image-clip: 0 0 13 13
image-color: #ffffffff
size: 8 8
$hover:
image-clip: 13 0 13 13
$pressed:
image-clip: 26 0 13 13
$disabled:
image-color: #ffffff66
UIButton
id: incrementButton
anchors.bottom: parent.bottom
anchors.right: parent.right
size: 8 8
image-source: /images/ui/scrollbar
image-clip: 0 13 13 13
image-color: #ffffffff
$hover:
image-clip: 13 13 13 13
$pressed:
image-clip: 26 13 13 13
$disabled:
image-color: #ffffff66
UIButton
id: sliderButton
anchors.centerIn: parent
size: 8 11
image-source: /images/ui/scrollbar
image-clip: 0 26 13 13
image-border: 2
image-color: #ffffffff
$hover:
image-clip: 13 26 13 13
$pressed:
image-clip: 26 26 13 13
$disabled:
image-color: #ffffff66
Label
id: valueLabel
anchors.fill: parent
color: white
text-align: center

View File

@ -6,7 +6,6 @@ APP_VERSION = 1337 -- client version for updater and login to identify outd
Services = { Services = {
website = "http://otclient.ovh", -- currently not used website = "http://otclient.ovh", -- currently not used
updater = "", updater = "",
news = "http://otclient.ovh/api/news.php",
stats = "", stats = "",
crash = "http://otclient.ovh/api/crash.php", crash = "http://otclient.ovh/api/crash.php",
feedback = "http://otclient.ovh/api/feedback.php" feedback = "http://otclient.ovh/api/feedback.php"

View File

@ -0,0 +1,878 @@
/*
* Copyright (c) 2010-2017 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 "client.h"
#include "luavaluecasts.h"
#include "game.h"
#include "tile.h"
#include "houses.h"
#include "towns.h"
#include "container.h"
#include "item.h"
#include "effect.h"
#include "missile.h"
#include "statictext.h"
#include "animatedtext.h"
#include "creature.h"
#include "player.h"
#include "localplayer.h"
#include "map.h"
#include "minimap.h"
#include "thingtypemanager.h"
#include "spritemanager.h"
#include "shadermanager.h"
#include "protocolgame.h"
#include "uiitem.h"
#include "uicreature.h"
#include "uimap.h"
#include "uiminimap.h"
#include "uimapanchorlayout.h"
#include "uiprogressrect.h"
#include "uisprite.h"
#include "outfit.h"
#include <framework/luaengine/luainterface.h>
void Client::registerLuaFunctions()
{
g_lua.registerSingletonClass("g_things");
g_lua.bindSingletonFunction("g_things", "loadDat", &ThingTypeManager::loadDat, &g_things);
#ifdef WITH_ENCRYPTION
g_lua.bindSingletonFunction("g_things", "saveDat", &ThingTypeManager::saveDat, &g_things);
g_lua.bindSingletonFunction("g_things", "dumpTextures", &ThingTypeManager::dumpTextures, &g_things);
g_lua.bindSingletonFunction("g_things", "replaceTextures", &ThingTypeManager::replaceTextures, &g_things);
#endif
g_lua.bindSingletonFunction("g_things", "loadOtb", &ThingTypeManager::loadOtb, &g_things);
g_lua.bindSingletonFunction("g_things", "loadXml", &ThingTypeManager::loadXml, &g_things);
g_lua.bindSingletonFunction("g_things", "loadOtml", &ThingTypeManager::loadOtml, &g_things);
g_lua.bindSingletonFunction("g_things", "isDatLoaded", &ThingTypeManager::isDatLoaded, &g_things);
g_lua.bindSingletonFunction("g_things", "isOtbLoaded", &ThingTypeManager::isOtbLoaded, &g_things);
g_lua.bindSingletonFunction("g_things", "getDatSignature", &ThingTypeManager::getDatSignature, &g_things);
g_lua.bindSingletonFunction("g_things", "getContentRevision", &ThingTypeManager::getContentRevision, &g_things);
g_lua.bindSingletonFunction("g_things", "getThingType", &ThingTypeManager::getThingType, &g_things);
g_lua.bindSingletonFunction("g_things", "getItemType", &ThingTypeManager::getItemType, &g_things);
g_lua.bindSingletonFunction("g_things", "getThingTypes", &ThingTypeManager::getThingTypes, &g_things);
g_lua.bindSingletonFunction("g_things", "findItemTypeByClientId", &ThingTypeManager::findItemTypeByClientId, &g_things);
g_lua.bindSingletonFunction("g_things", "findItemTypeByName", &ThingTypeManager::findItemTypeByName, &g_things);
g_lua.bindSingletonFunction("g_things", "findItemTypesByName", &ThingTypeManager::findItemTypesByName, &g_things);
g_lua.bindSingletonFunction("g_things", "findItemTypesByString", &ThingTypeManager::findItemTypesByString, &g_things);
g_lua.bindSingletonFunction("g_things", "findItemTypeByCategory", &ThingTypeManager::findItemTypeByCategory, &g_things);
g_lua.bindSingletonFunction("g_things", "findThingTypeByAttr", &ThingTypeManager::findThingTypeByAttr, &g_things);
g_lua.registerSingletonClass("g_houses");
g_lua.bindSingletonFunction("g_houses", "clear", &HouseManager::clear, &g_houses);
g_lua.bindSingletonFunction("g_houses", "load", &HouseManager::load, &g_houses);
g_lua.bindSingletonFunction("g_houses", "save", &HouseManager::save, &g_houses);
g_lua.bindSingletonFunction("g_houses", "getHouse", &HouseManager::getHouse, &g_houses);
g_lua.bindSingletonFunction("g_houses", "getHouseByName", &HouseManager::getHouseByName, &g_houses);
g_lua.bindSingletonFunction("g_houses", "addHouse", &HouseManager::addHouse, &g_houses);
g_lua.bindSingletonFunction("g_houses", "removeHouse", &HouseManager::removeHouse, &g_houses);
g_lua.bindSingletonFunction("g_houses", "getHouseList", &HouseManager::getHouseList, &g_houses);
g_lua.bindSingletonFunction("g_houses", "filterHouses", &HouseManager::filterHouses, &g_houses);
g_lua.bindSingletonFunction("g_houses", "sort", &HouseManager::sort, &g_houses);
g_lua.registerSingletonClass("g_towns");
g_lua.bindSingletonFunction("g_towns", "getTown", &TownManager::getTown, &g_towns);
g_lua.bindSingletonFunction("g_towns", "getTownByName",&TownManager::getTownByName,&g_towns);
g_lua.bindSingletonFunction("g_towns", "addTown", &TownManager::addTown, &g_towns);
g_lua.bindSingletonFunction("g_towns", "removeTown", &TownManager::removeTown, &g_towns);
g_lua.bindSingletonFunction("g_towns", "getTowns", &TownManager::getTowns, &g_towns);
g_lua.bindSingletonFunction("g_towns", "sort", &TownManager::sort, &g_towns);
g_lua.registerSingletonClass("g_sprites");
g_lua.bindSingletonFunction("g_sprites", "loadSpr", &SpriteManager::loadSpr, &g_sprites);
#ifdef WITH_ENCRYPTION
g_lua.bindSingletonFunction("g_sprites", "saveSpr", &SpriteManager::saveSpr, &g_sprites);
g_lua.bindSingletonFunction("g_sprites", "dumpSprites", &SpriteManager::dumpSprites, &g_sprites);
#endif
g_lua.bindSingletonFunction("g_sprites", "unload", &SpriteManager::unload, &g_sprites);
g_lua.bindSingletonFunction("g_sprites", "isLoaded", &SpriteManager::isLoaded, &g_sprites);
g_lua.bindSingletonFunction("g_sprites", "getSprSignature", &SpriteManager::getSignature, &g_sprites);
g_lua.bindSingletonFunction("g_sprites", "getSpritesCount", &SpriteManager::getSpritesCount, &g_sprites);
g_lua.registerSingletonClass("g_map");
g_lua.bindSingletonFunction("g_map", "isLookPossible", &Map::isLookPossible, &g_map);
g_lua.bindSingletonFunction("g_map", "isCovered", &Map::isCovered, &g_map);
g_lua.bindSingletonFunction("g_map", "isCompletelyCovered", &Map::isCompletelyCovered, &g_map);
g_lua.bindSingletonFunction("g_map", "addThing", &Map::addThing, &g_map);
g_lua.bindSingletonFunction("g_map", "getThing", &Map::getThing, &g_map);
g_lua.bindSingletonFunction("g_map", "removeThingByPos", &Map::removeThingByPos, &g_map);
g_lua.bindSingletonFunction("g_map", "removeThing", &Map::removeThing, &g_map);
g_lua.bindSingletonFunction("g_map", "colorizeThing", &Map::colorizeThing, &g_map);
g_lua.bindSingletonFunction("g_map", "removeThingColor", &Map::removeThingColor, &g_map);
g_lua.bindSingletonFunction("g_map", "clean", &Map::clean, &g_map);
g_lua.bindSingletonFunction("g_map", "cleanTile", &Map::cleanTile, &g_map);
g_lua.bindSingletonFunction("g_map", "cleanTexts", &Map::cleanTexts, &g_map);
g_lua.bindSingletonFunction("g_map", "getTile", &Map::getTile, &g_map);
g_lua.bindSingletonFunction("g_map", "getOrCreateTile", &Map::getOrCreateTile, &g_map);
g_lua.bindSingletonFunction("g_map", "getTiles", &Map::getTiles, &g_map);
g_lua.bindSingletonFunction("g_map", "setCentralPosition", &Map::setCentralPosition, &g_map);
g_lua.bindSingletonFunction("g_map", "getCentralPosition", &Map::getCentralPosition, &g_map);
g_lua.bindSingletonFunction("g_map", "getCreatureById", &Map::getCreatureById, &g_map);
g_lua.bindSingletonFunction("g_map", "removeCreatureById", &Map::removeCreatureById, &g_map);
g_lua.bindSingletonFunction("g_map", "getSpectators", &Map::getSpectators, &g_map);
g_lua.bindSingletonFunction("g_map", "getSpectatorsInRange", &Map::getSpectatorsInRange, &g_map);
g_lua.bindSingletonFunction("g_map", "getSpectatorsInRangeEx", &Map::getSpectatorsInRangeEx, &g_map);
g_lua.bindSingletonFunction("g_map", "findPath", &Map::findPath, &g_map);
g_lua.bindSingletonFunction("g_map", "loadOtbm", &Map::loadOtbm, &g_map);
g_lua.bindSingletonFunction("g_map", "saveOtbm", &Map::saveOtbm, &g_map);
g_lua.bindSingletonFunction("g_map", "loadOtcm", &Map::loadOtcm, &g_map);
g_lua.bindSingletonFunction("g_map", "saveOtcm", &Map::saveOtcm, &g_map);
g_lua.bindSingletonFunction("g_map", "getHouseFile", &Map::getHouseFile, &g_map);
g_lua.bindSingletonFunction("g_map", "setHouseFile", &Map::setHouseFile, &g_map);
g_lua.bindSingletonFunction("g_map", "getSpawnFile", &Map::getSpawnFile, &g_map);
g_lua.bindSingletonFunction("g_map", "setSpawnFile", &Map::setSpawnFile, &g_map);
g_lua.bindSingletonFunction("g_map", "createTile", &Map::createTile, &g_map);
g_lua.bindSingletonFunction("g_map", "setWidth", &Map::setWidth, &g_map);
g_lua.bindSingletonFunction("g_map", "setHeight", &Map::setHeight, &g_map);
g_lua.bindSingletonFunction("g_map", "getSize", &Map::getSize, &g_map);
g_lua.bindSingletonFunction("g_map", "setDescription", &Map::setDescription, &g_map);
g_lua.bindSingletonFunction("g_map", "getDescriptions", &Map::getDescriptions, &g_map);
g_lua.bindSingletonFunction("g_map", "clearDescriptions", &Map::clearDescriptions, &g_map);
g_lua.bindSingletonFunction("g_map", "setShowZone", &Map::setShowZone, &g_map);
g_lua.bindSingletonFunction("g_map", "setShowZones", &Map::setShowZones, &g_map);
g_lua.bindSingletonFunction("g_map", "setZoneColor", &Map::setZoneColor, &g_map);
g_lua.bindSingletonFunction("g_map", "setZoneOpacity", &Map::setZoneOpacity, &g_map);
g_lua.bindSingletonFunction("g_map", "getZoneOpacity", &Map::getZoneOpacity, &g_map);
g_lua.bindSingletonFunction("g_map", "getZoneColor", &Map::getZoneColor, &g_map);
g_lua.bindSingletonFunction("g_map", "showZones", &Map::showZones, &g_map);
g_lua.bindSingletonFunction("g_map", "showZone", &Map::showZone, &g_map);
g_lua.bindSingletonFunction("g_map", "setForceShowAnimations", &Map::setForceShowAnimations, &g_map);
g_lua.bindSingletonFunction("g_map", "isForcingAnimations", &Map::isForcingAnimations, &g_map);
g_lua.bindSingletonFunction("g_map", "isShowingAnimations", &Map::isShowingAnimations, &g_map);
g_lua.bindSingletonFunction("g_map", "setShowAnimations", &Map::setShowAnimations, &g_map);
g_lua.bindSingletonFunction("g_map", "beginGhostMode", &Map::beginGhostMode, &g_map);
g_lua.bindSingletonFunction("g_map", "endGhostMode", &Map::endGhostMode, &g_map);
g_lua.bindSingletonFunction("g_map", "findItemsById", &Map::findItemsById, &g_map);
g_lua.bindSingletonFunction("g_map", "getAwareRange", &Map::getAwareRangeAsSize, &g_map);
g_lua.bindSingletonFunction("g_map", "findEveryPath", &Map::findEveryPath, &g_map);
g_lua.registerSingletonClass("g_minimap");
g_lua.bindSingletonFunction("g_minimap", "clean", &Minimap::clean, &g_minimap);
g_lua.bindSingletonFunction("g_minimap", "loadImage", &Minimap::loadImage, &g_minimap);
g_lua.bindSingletonFunction("g_minimap", "saveImage", &Minimap::saveImage, &g_minimap);
g_lua.bindSingletonFunction("g_minimap", "loadOtmm", &Minimap::loadOtmm, &g_minimap);
g_lua.bindSingletonFunction("g_minimap", "saveOtmm", &Minimap::saveOtmm, &g_minimap);
g_lua.registerSingletonClass("g_creatures");
g_lua.bindSingletonFunction("g_creatures", "getCreatures", &CreatureManager::getCreatures, &g_creatures);
g_lua.bindSingletonFunction("g_creatures", "getCreatureByName", &CreatureManager::getCreatureByName, &g_creatures);
g_lua.bindSingletonFunction("g_creatures", "getCreatureByLook", &CreatureManager::getCreatureByLook, &g_creatures);
g_lua.bindSingletonFunction("g_creatures", "getSpawn", &CreatureManager::getSpawn, &g_creatures);
g_lua.bindSingletonFunction("g_creatures", "getSpawnForPlacePos", &CreatureManager::getSpawnForPlacePos, &g_creatures);
g_lua.bindSingletonFunction("g_creatures", "addSpawn", &CreatureManager::addSpawn, &g_creatures);
g_lua.bindSingletonFunction("g_creatures", "loadMonsters", &CreatureManager::loadMonsters, &g_creatures);
g_lua.bindSingletonFunction("g_creatures", "loadNpcs", &CreatureManager::loadNpcs, &g_creatures);
g_lua.bindSingletonFunction("g_creatures", "loadSingleCreature", &CreatureManager::loadSingleCreature, &g_creatures);
g_lua.bindSingletonFunction("g_creatures", "loadSpawns", &CreatureManager::loadSpawns, &g_creatures);
g_lua.bindSingletonFunction("g_creatures", "saveSpawns", &CreatureManager::saveSpawns, &g_creatures);
g_lua.bindSingletonFunction("g_creatures", "isLoaded", &CreatureManager::isLoaded, &g_creatures);
g_lua.bindSingletonFunction("g_creatures", "isSpawnLoaded", &CreatureManager::isSpawnLoaded, &g_creatures);
g_lua.bindSingletonFunction("g_creatures", "clear", &CreatureManager::clear, &g_creatures);
g_lua.bindSingletonFunction("g_creatures", "clearSpawns", &CreatureManager::clearSpawns, &g_creatures);
g_lua.bindSingletonFunction("g_creatures", "getSpawns", &CreatureManager::getSpawns, &g_creatures);
g_lua.bindSingletonFunction("g_creatures", "deleteSpawn", &CreatureManager::deleteSpawn, &g_creatures);
g_lua.registerSingletonClass("g_game");
g_lua.bindSingletonFunction("g_game", "loginWorld", &Game::loginWorld, &g_game);
g_lua.bindSingletonFunction("g_game", "cancelLogin", &Game::cancelLogin, &g_game);
g_lua.bindSingletonFunction("g_game", "forceLogout", &Game::forceLogout, &g_game);
g_lua.bindSingletonFunction("g_game", "safeLogout", &Game::safeLogout, &g_game);
g_lua.bindSingletonFunction("g_game", "walk", &Game::walk, &g_game);
g_lua.bindSingletonFunction("g_game", "autoWalk", &Game::autoWalk, &g_game);
g_lua.bindSingletonFunction("g_game", "turn", &Game::turn, &g_game);
g_lua.bindSingletonFunction("g_game", "stop", &Game::stop, &g_game);
g_lua.bindSingletonFunction("g_game", "look", &Game::look, &g_game);
g_lua.bindSingletonFunction("g_game", "move", &Game::move, &g_game);
g_lua.bindSingletonFunction("g_game", "moveRaw", &Game::moveRaw, &g_game);
g_lua.bindSingletonFunction("g_game", "moveToParentContainer", &Game::moveToParentContainer, &g_game);
g_lua.bindSingletonFunction("g_game", "rotate", &Game::rotate, &g_game);
g_lua.bindSingletonFunction("g_game", "use", &Game::use, &g_game);
g_lua.bindSingletonFunction("g_game", "useWith", &Game::useWith, &g_game);
g_lua.bindSingletonFunction("g_game", "useInventoryItem", &Game::useInventoryItem, &g_game);
g_lua.bindSingletonFunction("g_game", "useInventoryItemWith", &Game::useInventoryItemWith, &g_game);
g_lua.bindSingletonFunction("g_game", "findItemInContainers", &Game::findItemInContainers, &g_game);
g_lua.bindSingletonFunction("g_game", "open", &Game::open, &g_game);
g_lua.bindSingletonFunction("g_game", "openParent", &Game::openParent, &g_game);
g_lua.bindSingletonFunction("g_game", "close", &Game::close, &g_game);
g_lua.bindSingletonFunction("g_game", "refreshContainer", &Game::refreshContainer, &g_game);
g_lua.bindSingletonFunction("g_game", "attack", &Game::attack, &g_game);
g_lua.bindSingletonFunction("g_game", "cancelAttack", &Game::cancelAttack, &g_game);
g_lua.bindSingletonFunction("g_game", "follow", &Game::follow, &g_game);
g_lua.bindSingletonFunction("g_game", "cancelFollow", &Game::cancelFollow, &g_game);
g_lua.bindSingletonFunction("g_game", "cancelAttackAndFollow", &Game::cancelAttackAndFollow, &g_game);
g_lua.bindSingletonFunction("g_game", "talk", &Game::talk, &g_game);
g_lua.bindSingletonFunction("g_game", "talkChannel", &Game::talkChannel, &g_game);
g_lua.bindSingletonFunction("g_game", "talkPrivate", &Game::talkPrivate, &g_game);
g_lua.bindSingletonFunction("g_game", "openPrivateChannel", &Game::openPrivateChannel, &g_game);
g_lua.bindSingletonFunction("g_game", "requestChannels", &Game::requestChannels, &g_game);
g_lua.bindSingletonFunction("g_game", "joinChannel", &Game::joinChannel, &g_game);
g_lua.bindSingletonFunction("g_game", "leaveChannel", &Game::leaveChannel, &g_game);
g_lua.bindSingletonFunction("g_game", "closeNpcChannel", &Game::closeNpcChannel, &g_game);
g_lua.bindSingletonFunction("g_game", "openOwnChannel", &Game::openOwnChannel, &g_game);
g_lua.bindSingletonFunction("g_game", "inviteToOwnChannel", &Game::inviteToOwnChannel, &g_game);
g_lua.bindSingletonFunction("g_game", "excludeFromOwnChannel", &Game::excludeFromOwnChannel, &g_game);
g_lua.bindSingletonFunction("g_game", "partyInvite", &Game::partyInvite, &g_game);
g_lua.bindSingletonFunction("g_game", "partyJoin", &Game::partyJoin, &g_game);
g_lua.bindSingletonFunction("g_game", "partyRevokeInvitation", &Game::partyRevokeInvitation, &g_game);
g_lua.bindSingletonFunction("g_game", "partyPassLeadership", &Game::partyPassLeadership, &g_game);
g_lua.bindSingletonFunction("g_game", "partyLeave", &Game::partyLeave, &g_game);
g_lua.bindSingletonFunction("g_game", "partyShareExperience", &Game::partyShareExperience, &g_game);
g_lua.bindSingletonFunction("g_game", "requestOutfit", &Game::requestOutfit, &g_game);
g_lua.bindSingletonFunction("g_game", "changeOutfit", &Game::changeOutfit, &g_game);
g_lua.bindSingletonFunction("g_game", "addVip", &Game::addVip, &g_game);
g_lua.bindSingletonFunction("g_game", "removeVip", &Game::removeVip, &g_game);
g_lua.bindSingletonFunction("g_game", "editVip", &Game::editVip, &g_game);
g_lua.bindSingletonFunction("g_game", "setChaseMode", &Game::setChaseMode, &g_game);
g_lua.bindSingletonFunction("g_game", "setFightMode", &Game::setFightMode, &g_game);
g_lua.bindSingletonFunction("g_game", "setPVPMode", &Game::setPVPMode, &g_game);
g_lua.bindSingletonFunction("g_game", "setSafeFight", &Game::setSafeFight, &g_game);
g_lua.bindSingletonFunction("g_game", "getChaseMode", &Game::getChaseMode, &g_game);
g_lua.bindSingletonFunction("g_game", "getFightMode", &Game::getFightMode, &g_game);
g_lua.bindSingletonFunction("g_game", "getPVPMode", &Game::getPVPMode, &g_game);
g_lua.bindSingletonFunction("g_game", "getUnjustifiedPoints", &Game::getUnjustifiedPoints, &g_game);
g_lua.bindSingletonFunction("g_game", "getOpenPvpSituations", &Game::getOpenPvpSituations, &g_game);
g_lua.bindSingletonFunction("g_game", "isSafeFight", &Game::isSafeFight, &g_game);
g_lua.bindSingletonFunction("g_game", "inspectNpcTrade", &Game::inspectNpcTrade, &g_game);
g_lua.bindSingletonFunction("g_game", "buyItem", &Game::buyItem, &g_game);
g_lua.bindSingletonFunction("g_game", "sellItem", &Game::sellItem, &g_game);
g_lua.bindSingletonFunction("g_game", "closeNpcTrade", &Game::closeNpcTrade, &g_game);
g_lua.bindSingletonFunction("g_game", "requestTrade", &Game::requestTrade, &g_game);
g_lua.bindSingletonFunction("g_game", "inspectTrade", &Game::inspectTrade, &g_game);
g_lua.bindSingletonFunction("g_game", "acceptTrade", &Game::acceptTrade, &g_game);
g_lua.bindSingletonFunction("g_game", "rejectTrade", &Game::rejectTrade, &g_game);
g_lua.bindSingletonFunction("g_game", "openRuleViolation", &Game::openRuleViolation, &g_game);
g_lua.bindSingletonFunction("g_game", "closeRuleViolation", &Game::closeRuleViolation, &g_game);
g_lua.bindSingletonFunction("g_game", "cancelRuleViolation", &Game::cancelRuleViolation, &g_game);
g_lua.bindSingletonFunction("g_game", "reportBug", &Game::reportBug, &g_game);
g_lua.bindSingletonFunction("g_game", "reportRuleViolation", &Game::reportRuleViolation, &g_game);
g_lua.bindSingletonFunction("g_game", "debugReport", &Game::debugReport, &g_game);
g_lua.bindSingletonFunction("g_game", "editText", &Game::editText, &g_game);
g_lua.bindSingletonFunction("g_game", "editList", &Game::editList, &g_game);
g_lua.bindSingletonFunction("g_game", "requestQuestLog", &Game::requestQuestLog, &g_game);
g_lua.bindSingletonFunction("g_game", "requestQuestLine", &Game::requestQuestLine, &g_game);
g_lua.bindSingletonFunction("g_game", "equipItem", &Game::equipItem, &g_game);
g_lua.bindSingletonFunction("g_game", "mount", &Game::mount, &g_game);
g_lua.bindSingletonFunction("g_game", "requestItemInfo", &Game::requestItemInfo, &g_game);
g_lua.bindSingletonFunction("g_game", "ping", &Game::ping, &g_game);
g_lua.bindSingletonFunction("g_game", "setPingDelay", &Game::setPingDelay, &g_game);
g_lua.bindSingletonFunction("g_game", "changeMapAwareRange", &Game::changeMapAwareRange, &g_game);
g_lua.bindSingletonFunction("g_game", "canPerformGameAction", &Game::canPerformGameAction, &g_game);
g_lua.bindSingletonFunction("g_game", "canReportBugs", &Game::canReportBugs, &g_game);
g_lua.bindSingletonFunction("g_game", "checkBotProtection", &Game::checkBotProtection, &g_game);
g_lua.bindSingletonFunction("g_game", "isOnline", &Game::isOnline, &g_game);
g_lua.bindSingletonFunction("g_game", "isLogging", &Game::isLogging, &g_game);
g_lua.bindSingletonFunction("g_game", "isDead", &Game::isDead, &g_game);
g_lua.bindSingletonFunction("g_game", "isAttacking", &Game::isAttacking, &g_game);
g_lua.bindSingletonFunction("g_game", "isFollowing", &Game::isFollowing, &g_game);
g_lua.bindSingletonFunction("g_game", "isConnectionOk", &Game::isConnectionOk, &g_game);
g_lua.bindSingletonFunction("g_game", "getPing", &Game::getPing, &g_game);
g_lua.bindSingletonFunction("g_game", "getContainer", &Game::getContainer, &g_game);
g_lua.bindSingletonFunction("g_game", "getContainers", &Game::getContainers, &g_game);
g_lua.bindSingletonFunction("g_game", "getVips", &Game::getVips, &g_game);
g_lua.bindSingletonFunction("g_game", "getAttackingCreature", &Game::getAttackingCreature, &g_game);
g_lua.bindSingletonFunction("g_game", "getFollowingCreature", &Game::getFollowingCreature, &g_game);
g_lua.bindSingletonFunction("g_game", "getServerBeat", &Game::getServerBeat, &g_game);
g_lua.bindSingletonFunction("g_game", "getLocalPlayer", &Game::getLocalPlayer, &g_game);
g_lua.bindSingletonFunction("g_game", "getProtocolGame", &Game::getProtocolGame, &g_game);
g_lua.bindSingletonFunction("g_game", "getProtocolVersion", &Game::getProtocolVersion, &g_game);
g_lua.bindSingletonFunction("g_game", "setProtocolVersion", &Game::setProtocolVersion, &g_game);
g_lua.bindSingletonFunction("g_game", "getCustomProtocolVersion", &Game::getCustomProtocolVersion, &g_game);
g_lua.bindSingletonFunction("g_game", "setCustomProtocolVersion", &Game::setCustomProtocolVersion, &g_game);
g_lua.bindSingletonFunction("g_game", "getClientVersion", &Game::getClientVersion, &g_game);
g_lua.bindSingletonFunction("g_game", "setClientVersion", &Game::setClientVersion, &g_game);
g_lua.bindSingletonFunction("g_game", "setCustomOs", &Game::setCustomOs, &g_game);
g_lua.bindSingletonFunction("g_game", "getOs", &Game::getOs, &g_game);
g_lua.bindSingletonFunction("g_game", "getCharacterName", &Game::getCharacterName, &g_game);
g_lua.bindSingletonFunction("g_game", "getWorldName", &Game::getWorldName, &g_game);
g_lua.bindSingletonFunction("g_game", "getGMActions", &Game::getGMActions, &g_game);
g_lua.bindSingletonFunction("g_game", "getFeature", &Game::getFeature, &g_game);
g_lua.bindSingletonFunction("g_game", "setFeature", &Game::setFeature, &g_game);
g_lua.bindSingletonFunction("g_game", "enableFeature", &Game::enableFeature, &g_game);
g_lua.bindSingletonFunction("g_game", "disableFeature", &Game::disableFeature, &g_game);
g_lua.bindSingletonFunction("g_game", "resetFeatures", &Game::resetFeatures, &g_game);
g_lua.bindSingletonFunction("g_game", "isGM", &Game::isGM, &g_game);
g_lua.bindSingletonFunction("g_game", "answerModalDialog", &Game::answerModalDialog, &g_game);
g_lua.bindSingletonFunction("g_game", "browseField", &Game::browseField, &g_game);
g_lua.bindSingletonFunction("g_game", "seekInContainer", &Game::seekInContainer, &g_game);
g_lua.bindSingletonFunction("g_game", "getLastWalkDir", &Game::getLastWalkDir, &g_game);
g_lua.bindSingletonFunction("g_game", "buyStoreOffer", &Game::buyStoreOffer, &g_game);
g_lua.bindSingletonFunction("g_game", "requestTransactionHistory", &Game::requestTransactionHistory, &g_game);
g_lua.bindSingletonFunction("g_game", "requestStoreOffers", &Game::requestStoreOffers, &g_game);
g_lua.bindSingletonFunction("g_game", "openStore", &Game::openStore, &g_game);
g_lua.bindSingletonFunction("g_game", "transferCoins", &Game::transferCoins, &g_game);
g_lua.bindSingletonFunction("g_game", "openTransactionHistory", &Game::openTransactionHistory, &g_game);
g_lua.bindSingletonFunction("g_game", "getMaxPreWalkingSteps", &Game::getMaxPreWalkingSteps, &g_game);
g_lua.bindSingletonFunction("g_game", "setMaxPreWalkingSteps", &Game::setMaxPreWalkingSteps, &g_game);
g_lua.bindSingletonFunction("g_game", "ignoreServerDirection", &Game::ignoreServerDirection, &g_game);
g_lua.bindSingletonFunction("g_game", "showRealDirection", &Game::showRealDirection, &g_game);
g_lua.bindSingletonFunction("g_game", "enableTileThingLuaCallback", &Game::enableTileThingLuaCallback, &g_game);
g_lua.bindSingletonFunction("g_game", "isTileThingLuaCallbackEnabled", &Game::isTileThingLuaCallbackEnabled, &g_game);
g_lua.registerSingletonClass("g_shaders");
g_lua.bindSingletonFunction("g_shaders", "createShader", &ShaderManager::createShader, &g_shaders);
g_lua.bindSingletonFunction("g_shaders", "createFragmentShader", &ShaderManager::createFragmentShader, &g_shaders);
g_lua.bindSingletonFunction("g_shaders", "createFragmentShaderFromCode", &ShaderManager::createFragmentShaderFromCode, &g_shaders);
g_lua.bindSingletonFunction("g_shaders", "createItemShader", &ShaderManager::createItemShader, &g_shaders);
g_lua.bindSingletonFunction("g_shaders", "createMapShader", &ShaderManager::createMapShader, &g_shaders);
g_lua.bindSingletonFunction("g_shaders", "getDefaultItemShader", &ShaderManager::getDefaultItemShader, &g_shaders);
g_lua.bindSingletonFunction("g_shaders", "getDefaultMapShader", &ShaderManager::getDefaultMapShader, &g_shaders);
g_lua.bindSingletonFunction("g_shaders", "getShader", &ShaderManager::getShader, &g_shaders);
g_lua.bindGlobalFunction("getOutfitColor", Outfit::getColor);
g_lua.bindGlobalFunction("getAngleFromPos", Position::getAngleFromPositions);
g_lua.bindGlobalFunction("getDirectionFromPos", Position::getDirectionFromPositions);
g_lua.registerClass<ProtocolGame, Protocol>();
g_lua.bindClassStaticFunction<ProtocolGame>("create", []{ return ProtocolGamePtr(new ProtocolGame); });
g_lua.bindClassMemberFunction<ProtocolGame>("login", &ProtocolGame::login);
g_lua.bindClassMemberFunction<ProtocolGame>("sendExtendedOpcode", &ProtocolGame::sendExtendedOpcode);
g_lua.bindClassMemberFunction<ProtocolGame>("addPosition", &ProtocolGame::addPosition);
g_lua.bindClassMemberFunction<ProtocolGame>("setMapDescription", &ProtocolGame::setMapDescription);
g_lua.bindClassMemberFunction<ProtocolGame>("setFloorDescription", &ProtocolGame::setFloorDescription);
g_lua.bindClassMemberFunction<ProtocolGame>("setTileDescription", &ProtocolGame::setTileDescription);
g_lua.bindClassMemberFunction<ProtocolGame>("getOutfit", &ProtocolGame::getOutfit);
g_lua.bindClassMemberFunction<ProtocolGame>("getThing", &ProtocolGame::getThing);
g_lua.bindClassMemberFunction<ProtocolGame>("getCreature", &ProtocolGame::getCreature);
g_lua.bindClassMemberFunction<ProtocolGame>("getItem", &ProtocolGame::getItem);
g_lua.bindClassMemberFunction<ProtocolGame>("getPosition", &ProtocolGame::getPosition);
g_lua.registerClass<Container>();
g_lua.bindClassMemberFunction<Container>("getItem", &Container::getItem);
g_lua.bindClassMemberFunction<Container>("getItems", &Container::getItems);
g_lua.bindClassMemberFunction<Container>("getItemsCount", &Container::getItemsCount);
g_lua.bindClassMemberFunction<Container>("getSlotPosition", &Container::getSlotPosition);
g_lua.bindClassMemberFunction<Container>("getName", &Container::getName);
g_lua.bindClassMemberFunction<Container>("getId", &Container::getId);
g_lua.bindClassMemberFunction<Container>("getCapacity", &Container::getCapacity);
g_lua.bindClassMemberFunction<Container>("getContainerItem", &Container::getContainerItem);
g_lua.bindClassMemberFunction<Container>("hasParent", &Container::hasParent);
g_lua.bindClassMemberFunction<Container>("isClosed", &Container::isClosed);
g_lua.bindClassMemberFunction<Container>("isUnlocked", &Container::isUnlocked);
g_lua.bindClassMemberFunction<Container>("hasPages", &Container::hasPages);
g_lua.bindClassMemberFunction<Container>("getSize", &Container::getSize);
g_lua.bindClassMemberFunction<Container>("getFirstIndex", &Container::getFirstIndex);
g_lua.registerClass<Thing>();
g_lua.bindClassMemberFunction<Thing>("setId", &Thing::setId);
g_lua.bindClassMemberFunction<Thing>("setPosition", &Thing::setPosition);
g_lua.bindClassMemberFunction<Thing>("getId", &Thing::getId);
g_lua.bindClassMemberFunction<Thing>("getPosition", &Thing::getPosition);
g_lua.bindClassMemberFunction<Thing>("getStackPriority", &Thing::getStackPriority);
g_lua.bindClassMemberFunction<Thing>("getStackPos", &Thing::getStackPos);
g_lua.bindClassMemberFunction<Thing>("getAnimationPhases", &Thing::getAnimationPhases);
g_lua.bindClassMemberFunction<Thing>("getTile", &Thing::getTile);
g_lua.bindClassMemberFunction<Thing>("setMarked", &Thing::setMarked);
g_lua.bindClassMemberFunction<Thing>("isItem", &Thing::isItem);
g_lua.bindClassMemberFunction<Thing>("isMonster", &Thing::isMonster);
g_lua.bindClassMemberFunction<Thing>("isNpc", &Thing::isNpc);
g_lua.bindClassMemberFunction<Thing>("isCreature", &Thing::isCreature);
g_lua.bindClassMemberFunction<Thing>("isEffect", &Thing::isEffect);
g_lua.bindClassMemberFunction<Thing>("isMissile", &Thing::isMissile);
g_lua.bindClassMemberFunction<Thing>("isPlayer", &Thing::isPlayer);
g_lua.bindClassMemberFunction<Thing>("isLocalPlayer", &Thing::isLocalPlayer);
g_lua.bindClassMemberFunction<Thing>("isAnimatedText", &Thing::isAnimatedText);
g_lua.bindClassMemberFunction<Thing>("isStaticText", &Thing::isStaticText);
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>("isIgnoreLook", &Thing::isIgnoreLook);
g_lua.bindClassMemberFunction<Thing>("isStackable", &Thing::isStackable);
g_lua.bindClassMemberFunction<Thing>("isHookSouth", &Thing::isHookSouth);
g_lua.bindClassMemberFunction<Thing>("isTranslucent", &Thing::isTranslucent);
g_lua.bindClassMemberFunction<Thing>("isFullGround", &Thing::isFullGround);
g_lua.bindClassMemberFunction<Thing>("isMarketable", &Thing::isMarketable);
g_lua.bindClassMemberFunction<Thing>("getMarketData", &Thing::getMarketData);
g_lua.bindClassMemberFunction<Thing>("isUsable", &Thing::isUsable);
g_lua.bindClassMemberFunction<Thing>("isWrapable", &Thing::isWrapable);
g_lua.bindClassMemberFunction<Thing>("isUnwrapable", &Thing::isUnwrapable);
g_lua.bindClassMemberFunction<Thing>("isTopEffect", &Thing::isTopEffect);
g_lua.bindClassMemberFunction<Thing>("isLyingCorpse", &Thing::isLyingCorpse);
g_lua.bindClassMemberFunction<Thing>("getParentContainer", &Thing::getParentContainer);
g_lua.bindClassMemberFunction<Thing>("hide", &Thing::hide);
g_lua.bindClassMemberFunction<Thing>("show", &Thing::show);
g_lua.bindClassMemberFunction<Thing>("setHidden", &Thing::setHidden);
g_lua.bindClassMemberFunction<Thing>("isHidden", &Thing::isHidden);
g_lua.registerClass<House>();
g_lua.bindClassStaticFunction<House>("create", []{ return HousePtr(new House); });
g_lua.bindClassMemberFunction<House>("setId", &House::setId);
g_lua.bindClassMemberFunction<House>("getId", &House::getId);
g_lua.bindClassMemberFunction<House>("setName", &House::setName);
g_lua.bindClassMemberFunction<House>("getName", &House::getName);
g_lua.bindClassMemberFunction<House>("setTownId", &House::setTownId);
g_lua.bindClassMemberFunction<House>("getTownId", &House::getTownId);
g_lua.bindClassMemberFunction<House>("setTile", &House::setTile);
g_lua.bindClassMemberFunction<House>("getTile", &House::getTile);
g_lua.bindClassMemberFunction<House>("setEntry", &House::setEntry);
g_lua.bindClassMemberFunction<House>("getEntry", &House::getEntry);
g_lua.bindClassMemberFunction<House>("addDoor", &House::addDoor);
g_lua.bindClassMemberFunction<House>("removeDoor", &House::removeDoor);
g_lua.bindClassMemberFunction<House>("removeDoorById", &House::removeDoorById);
g_lua.bindClassMemberFunction<House>("setSize", &House::setSize);
g_lua.bindClassMemberFunction<House>("getSize", &House::getSize);
g_lua.bindClassMemberFunction<House>("setRent", &House::setRent);
g_lua.bindClassMemberFunction<House>("getRent", &House::getRent);
g_lua.registerClass<Spawn>();
g_lua.bindClassStaticFunction<Spawn>("create", []{ return SpawnPtr(new Spawn); });
g_lua.bindClassMemberFunction<Spawn>("setRadius", &Spawn::setRadius);
g_lua.bindClassMemberFunction<Spawn>("getRadius", &Spawn::getRadius);
g_lua.bindClassMemberFunction<Spawn>("setCenterPos", &Spawn::setCenterPos);
g_lua.bindClassMemberFunction<Spawn>("getCenterPos", &Spawn::getCenterPos);
g_lua.bindClassMemberFunction<Spawn>("addCreature", &Spawn::addCreature);
g_lua.bindClassMemberFunction<Spawn>("removeCreature", &Spawn::removeCreature);
g_lua.bindClassMemberFunction<Spawn>("getCreatures", &Spawn::getCreatures);
g_lua.registerClass<Town>();
g_lua.bindClassStaticFunction<Town>("create", []{ return TownPtr(new Town); });
g_lua.bindClassMemberFunction<Town>("setId", &Town::setId);
g_lua.bindClassMemberFunction<Town>("setName", &Town::setName);
g_lua.bindClassMemberFunction<Town>("setPos", &Town::setPos);
g_lua.bindClassMemberFunction<Town>("setTemplePos", &Town::setPos); // alternative method
g_lua.bindClassMemberFunction<Town>("getId", &Town::getId);
g_lua.bindClassMemberFunction<Town>("getName", &Town::getName);
g_lua.bindClassMemberFunction<Town>("getPos", &Town::getPos);
g_lua.bindClassMemberFunction<Town>("getTemplePos", &Town::getPos); // alternative method
g_lua.registerClass<CreatureType>();
g_lua.bindClassStaticFunction<CreatureType>("create", []{ return CreatureTypePtr(new CreatureType); });
g_lua.bindClassMemberFunction<CreatureType>("setName", &CreatureType::setName);
g_lua.bindClassMemberFunction<CreatureType>("setOutfit", &CreatureType::setOutfit);
g_lua.bindClassMemberFunction<CreatureType>("setSpawnTime", &CreatureType::setSpawnTime);
g_lua.bindClassMemberFunction<CreatureType>("getName", &CreatureType::getName);
g_lua.bindClassMemberFunction<CreatureType>("getOutfit", &CreatureType::getOutfit);
g_lua.bindClassMemberFunction<CreatureType>("getSpawnTime", &CreatureType::getSpawnTime);
g_lua.bindClassMemberFunction<CreatureType>("cast", &CreatureType::cast);
g_lua.registerClass<Creature, Thing>();
g_lua.bindClassStaticFunction<Creature>("create", []{ return CreaturePtr(new Creature); });
g_lua.bindClassMemberFunction<Creature>("getId", &Creature::getId);
g_lua.bindClassMemberFunction<Creature>("getName", &Creature::getName);
g_lua.bindClassMemberFunction<Creature>("setManaPercent", &LocalPlayer::setManaPercent);
g_lua.bindClassMemberFunction<Creature>("getManaPercent", &LocalPlayer::getManaPercent);
g_lua.bindClassMemberFunction<Creature>("getHealthPercent", &Creature::getHealthPercent);
g_lua.bindClassMemberFunction<Creature>("getSpeed", &Creature::getSpeed);
g_lua.bindClassMemberFunction<Creature>("setSpeed", &Creature::setSpeed);
g_lua.bindClassMemberFunction<Creature>("getBaseSpeed", &Creature::getBaseSpeed);
g_lua.bindClassMemberFunction<Creature>("setBaseSpeed", &Creature::setBaseSpeed);
g_lua.bindClassMemberFunction<Creature>("getSkull", &Creature::getSkull);
g_lua.bindClassMemberFunction<Creature>("getShield", &Creature::getShield);
g_lua.bindClassMemberFunction<Creature>("getEmblem", &Creature::getEmblem);
g_lua.bindClassMemberFunction<Creature>("getType", &Creature::getType);
g_lua.bindClassMemberFunction<Creature>("getIcon", &Creature::getIcon);
g_lua.bindClassMemberFunction<Creature>("setOutfit", &Creature::setOutfit);
g_lua.bindClassMemberFunction<Creature>("getOutfit", &Creature::getOutfit);
g_lua.bindClassMemberFunction<Creature>("setOutfitColor", &Creature::setOutfitColor);
g_lua.bindClassMemberFunction<Creature>("getDirection", &Creature::getDirection);
g_lua.bindClassMemberFunction<Creature>("getWalkDirection", &Creature::getWalkDirection);
g_lua.bindClassMemberFunction<Creature>("getStepDuration", &Creature::getStepDuration);
g_lua.bindClassMemberFunction<Creature>("getStepProgress", &Creature::getStepProgress);
g_lua.bindClassMemberFunction<Creature>("getWalkTicksElapsed", &Creature::getWalkTicksElapsed);
g_lua.bindClassMemberFunction<Creature>("getStepTicksLeft", &Creature::getStepTicksLeft);
g_lua.bindClassMemberFunction<Creature>("setDirection", &Creature::setDirection);
g_lua.bindClassMemberFunction<Creature>("setSkullTexture", &Creature::setSkullTexture);
g_lua.bindClassMemberFunction<Creature>("setShieldTexture", &Creature::setShieldTexture);
g_lua.bindClassMemberFunction<Creature>("setEmblemTexture", &Creature::setEmblemTexture);
g_lua.bindClassMemberFunction<Creature>("setTypeTexture", &Creature::setTypeTexture);
g_lua.bindClassMemberFunction<Creature>("setIconTexture", &Creature::setIconTexture);
g_lua.bindClassMemberFunction<Creature>("showStaticSquare", &Creature::showStaticSquare);
g_lua.bindClassMemberFunction<Creature>("hideStaticSquare", &Creature::hideStaticSquare);
g_lua.bindClassMemberFunction<Creature>("isWalking", &Creature::isWalking);
g_lua.bindClassMemberFunction<Creature>("isInvisible", &Creature::isInvisible);
g_lua.bindClassMemberFunction<Creature>("isDead", &Creature::isDead);
g_lua.bindClassMemberFunction<Creature>("isRemoved", &Creature::isRemoved);
g_lua.bindClassMemberFunction<Creature>("canBeSeen", &Creature::canBeSeen);
g_lua.bindClassMemberFunction<Creature>("jump", &Creature::jump);
g_lua.bindClassMemberFunction<Creature>("getPrewalkingPosition", &Creature::getPrewalkingPosition);
g_lua.bindClassMemberFunction<Creature>("setInformationColor", &Creature::setInformationColor);
g_lua.bindClassMemberFunction<Creature>("resetInformationColor", &Creature::resetInformationColor);
g_lua.bindClassMemberFunction<Creature>("setInformationOffset", &Creature::setInformationOffset);
g_lua.bindClassMemberFunction<Creature>("getInformationOffset", &Creature::getInformationOffset);
g_lua.registerClass<ItemType>();
g_lua.bindClassMemberFunction<ItemType>("getServerId", &ItemType::getServerId);
g_lua.bindClassMemberFunction<ItemType>("getClientId", &ItemType::getClientId);
g_lua.bindClassMemberFunction<ItemType>("isWritable", &ItemType::isWritable);
g_lua.registerClass<ThingType>();
g_lua.bindClassStaticFunction<ThingType>("create", []{ return ThingTypePtr(new ThingType); });
g_lua.bindClassMemberFunction<ThingType>("getId", &ThingType::getId);
g_lua.bindClassMemberFunction<ThingType>("getClothSlot", &ThingType::getClothSlot);
g_lua.bindClassMemberFunction<ThingType>("getCategory", &ThingType::getCategory);
g_lua.bindClassMemberFunction<ThingType>("getSize", &ThingType::getSize);
g_lua.bindClassMemberFunction<ThingType>("getWidth", &ThingType::getWidth);
g_lua.bindClassMemberFunction<ThingType>("getHeight", &ThingType::getHeight);
g_lua.bindClassMemberFunction<ThingType>("getDisplacement", &ThingType::getDisplacement);
g_lua.bindClassMemberFunction<ThingType>("getDisplacementX", &ThingType::getDisplacementX);
g_lua.bindClassMemberFunction<ThingType>("getDisplacementY", &ThingType::getDisplacementY);
g_lua.bindClassMemberFunction<ThingType>("getExactSize", &ThingType::getExactSize);
g_lua.bindClassMemberFunction<ThingType>("getRealSize", &ThingType::getRealSize);
g_lua.bindClassMemberFunction<ThingType>("getLayers", &ThingType::getLayers);
g_lua.bindClassMemberFunction<ThingType>("getNumPatternX", &ThingType::getNumPatternX);
g_lua.bindClassMemberFunction<ThingType>("getNumPatternY", &ThingType::getNumPatternY);
g_lua.bindClassMemberFunction<ThingType>("getNumPatternZ", &ThingType::getNumPatternZ);
g_lua.bindClassMemberFunction<ThingType>("getAnimationPhases", &ThingType::getAnimationPhases);
g_lua.bindClassMemberFunction<ThingType>("getGroundSpeed", &ThingType::getGroundSpeed);
g_lua.bindClassMemberFunction<ThingType>("getMaxTextLength", &ThingType::getMaxTextLength);
g_lua.bindClassMemberFunction<ThingType>("getLight", &ThingType::getLight);
g_lua.bindClassMemberFunction<ThingType>("getMinimapColor", &ThingType::getMinimapColor);
g_lua.bindClassMemberFunction<ThingType>("getLensHelp", &ThingType::getLensHelp);
g_lua.bindClassMemberFunction<ThingType>("getClothSlot", &ThingType::getClothSlot);
g_lua.bindClassMemberFunction<ThingType>("getElevation", &ThingType::getElevation);
g_lua.bindClassMemberFunction<ThingType>("isGround", &ThingType::isGround);
g_lua.bindClassMemberFunction<ThingType>("isGroundBorder", &ThingType::isGroundBorder);
g_lua.bindClassMemberFunction<ThingType>("isOnBottom", &ThingType::isOnBottom);
g_lua.bindClassMemberFunction<ThingType>("isOnTop", &ThingType::isOnTop);
g_lua.bindClassMemberFunction<ThingType>("isContainer", &ThingType::isContainer);
g_lua.bindClassMemberFunction<ThingType>("isStackable", &ThingType::isStackable);
g_lua.bindClassMemberFunction<ThingType>("isForceUse", &ThingType::isForceUse);
g_lua.bindClassMemberFunction<ThingType>("isMultiUse", &ThingType::isMultiUse);
g_lua.bindClassMemberFunction<ThingType>("isWritable", &ThingType::isWritable);
g_lua.bindClassMemberFunction<ThingType>("isChargeable", &ThingType::isChargeable);
g_lua.bindClassMemberFunction<ThingType>("isWritableOnce", &ThingType::isWritableOnce);
g_lua.bindClassMemberFunction<ThingType>("isFluidContainer", &ThingType::isFluidContainer);
g_lua.bindClassMemberFunction<ThingType>("isSplash", &ThingType::isSplash);
g_lua.bindClassMemberFunction<ThingType>("isNotWalkable", &ThingType::isNotWalkable);
g_lua.bindClassMemberFunction<ThingType>("isNotMoveable", &ThingType::isNotMoveable);
g_lua.bindClassMemberFunction<ThingType>("blockProjectile", &ThingType::blockProjectile);
g_lua.bindClassMemberFunction<ThingType>("isNotPathable", &ThingType::isNotPathable);
g_lua.bindClassMemberFunction<ThingType>("setPathable", &ThingType::setPathable);
g_lua.bindClassMemberFunction<ThingType>("isPickupable", &ThingType::isPickupable);
g_lua.bindClassMemberFunction<ThingType>("isHangable", &ThingType::isHangable);
g_lua.bindClassMemberFunction<ThingType>("isHookSouth", &ThingType::isHookSouth);
g_lua.bindClassMemberFunction<ThingType>("isHookEast", &ThingType::isHookEast);
g_lua.bindClassMemberFunction<ThingType>("isRotateable", &ThingType::isRotateable);
g_lua.bindClassMemberFunction<ThingType>("hasLight", &ThingType::hasLight);
g_lua.bindClassMemberFunction<ThingType>("isDontHide", &ThingType::isDontHide);
g_lua.bindClassMemberFunction<ThingType>("isTranslucent", &ThingType::isTranslucent);
g_lua.bindClassMemberFunction<ThingType>("hasDisplacement", &ThingType::hasDisplacement);
g_lua.bindClassMemberFunction<ThingType>("hasElevation", &ThingType::hasElevation);
g_lua.bindClassMemberFunction<ThingType>("isLyingCorpse", &ThingType::isLyingCorpse);
g_lua.bindClassMemberFunction<ThingType>("isAnimateAlways", &ThingType::isAnimateAlways);
g_lua.bindClassMemberFunction<ThingType>("hasMiniMapColor", &ThingType::hasMiniMapColor);
g_lua.bindClassMemberFunction<ThingType>("hasLensHelp", &ThingType::hasLensHelp);
g_lua.bindClassMemberFunction<ThingType>("isFullGround", &ThingType::isFullGround);
g_lua.bindClassMemberFunction<ThingType>("isIgnoreLook", &ThingType::isIgnoreLook);
g_lua.bindClassMemberFunction<ThingType>("isCloth", &ThingType::isCloth);
g_lua.bindClassMemberFunction<ThingType>("isMarketable", &ThingType::isMarketable);
g_lua.bindClassMemberFunction<ThingType>("getMarketData", &ThingType::getMarketData);
g_lua.bindClassMemberFunction<ThingType>("isUsable", &ThingType::isUsable);
g_lua.bindClassMemberFunction<ThingType>("isWrapable", &ThingType::isWrapable);
g_lua.bindClassMemberFunction<ThingType>("isUnwrapable", &ThingType::isUnwrapable);
g_lua.bindClassMemberFunction<ThingType>("isTopEffect", &ThingType::isTopEffect);
g_lua.bindClassMemberFunction<ThingType>("getSprites", &ThingType::getSprites);
g_lua.bindClassMemberFunction<ThingType>("hasAttribute", &ThingType::hasAttr);
g_lua.bindClassMemberFunction<ThingType>("exportImage", &ThingType::exportImage);
g_lua.registerClass<Item, Thing>();
g_lua.bindClassStaticFunction<Item>("create", &Item::create);
g_lua.bindClassStaticFunction<Item>("createOtb", &Item::createFromOtb);
g_lua.bindClassMemberFunction<Item>("clone", &Item::clone);
g_lua.bindClassMemberFunction<Item>("getContainerItems", &Item::getContainerItems);
g_lua.bindClassMemberFunction<Item>("getContainerItem", &Item::getContainerItem);
g_lua.bindClassMemberFunction<Item>("addContainerItem", &Item::addContainerItem);
g_lua.bindClassMemberFunction<Item>("addContainerItemIndexed", &Item::addContainerItemIndexed);
g_lua.bindClassMemberFunction<Item>("removeContainerItem", &Item::removeContainerItem);
g_lua.bindClassMemberFunction<Item>("clearContainerItems", &Item::clearContainerItems);
g_lua.bindClassMemberFunction<Item>("getContainerItem", &Item::getContainerItem);
g_lua.bindClassMemberFunction<Item>("setCount", &Item::setCount);
g_lua.bindClassMemberFunction<Item>("getCount", &Item::getCount);
g_lua.bindClassMemberFunction<Item>("getSubType", &Item::getSubType);
g_lua.bindClassMemberFunction<Item>("getId", &Item::getId);
g_lua.bindClassMemberFunction<Item>("getServerId", &Item::getServerId);
g_lua.bindClassMemberFunction<Item>("getName", &Item::getName);
g_lua.bindClassMemberFunction<Item>("getDescription", &Item::getDescription);
g_lua.bindClassMemberFunction<Item>("getText", &Item::getText);
g_lua.bindClassMemberFunction<Item>("setDescription", &Item::setDescription);
g_lua.bindClassMemberFunction<Item>("setText", &Item::setText);
g_lua.bindClassMemberFunction<Item>("getUniqueId", &Item::getUniqueId);
g_lua.bindClassMemberFunction<Item>("getActionId", &Item::getActionId);
g_lua.bindClassMemberFunction<Item>("setUniqueId", &Item::setUniqueId);
g_lua.bindClassMemberFunction<Item>("setActionId", &Item::setActionId);
g_lua.bindClassMemberFunction<Item>("getTeleportDestination", &Item::getTeleportDestination);
g_lua.bindClassMemberFunction<Item>("setTeleportDestination", &Item::setTeleportDestination);
g_lua.bindClassMemberFunction<Item>("isStackable", &Item::isStackable);
g_lua.bindClassMemberFunction<Item>("isMarketable", &Item::isMarketable);
g_lua.bindClassMemberFunction<Item>("isFluidContainer", &Item::isFluidContainer);
g_lua.bindClassMemberFunction<Item>("getMarketData", &Item::getMarketData);
g_lua.bindClassMemberFunction<Item>("getClothSlot", &Item::getClothSlot);
g_lua.registerClass<Effect, Thing>();
g_lua.bindClassStaticFunction<Effect>("create", []{ return EffectPtr(new Effect); });
g_lua.bindClassMemberFunction<Effect>("setId", &Effect::setId);
g_lua.registerClass<Missile, Thing>();
g_lua.bindClassStaticFunction<Missile>("create", []{ return MissilePtr(new Missile); });
g_lua.bindClassMemberFunction<Missile>("setId", &Missile::setId);
g_lua.bindClassMemberFunction<Missile>("getId", &Missile::getId);
g_lua.bindClassMemberFunction<Missile>("getSource", &Missile::getSource);
g_lua.bindClassMemberFunction<Missile>("getDestination", &Missile::getDestination);
g_lua.registerClass<StaticText, Thing>();
g_lua.bindClassStaticFunction<StaticText>("create", []{ return StaticTextPtr(new StaticText); });
g_lua.bindClassMemberFunction<StaticText>("addMessage", &StaticText::addMessage);
g_lua.bindClassMemberFunction<StaticText>("setText", &StaticText::setText);
g_lua.bindClassMemberFunction<StaticText>("setFont", &StaticText::setFont);
g_lua.bindClassMemberFunction<StaticText>("setColor", &StaticText::setColor);
g_lua.bindClassMemberFunction<StaticText>("getColor", &StaticText::getColor);
g_lua.bindClassMemberFunction<StaticText>("getText", &StaticText::getText);
g_lua.registerClass<AnimatedText, Thing>();
g_lua.bindClassMemberFunction<AnimatedText>("getText", &AnimatedText::getText);
g_lua.bindClassMemberFunction<AnimatedText>("getOffset", &AnimatedText::getOffset);
g_lua.bindClassMemberFunction<AnimatedText>("getColor", &AnimatedText::getColor);
g_lua.registerClass<Player, Creature>();
g_lua.registerClass<Npc, Creature>();
g_lua.registerClass<Monster, Creature>();
g_lua.registerClass<LocalPlayer, Player>();
g_lua.bindClassMemberFunction<LocalPlayer>("unlockWalk", &LocalPlayer::unlockWalk);
g_lua.bindClassMemberFunction<LocalPlayer>("lockWalk", &LocalPlayer::lockWalk);
g_lua.bindClassMemberFunction<LocalPlayer>("isWalkLocked", &LocalPlayer::isWalkLocked);
g_lua.bindClassMemberFunction<LocalPlayer>("canWalk", &LocalPlayer::canWalk);
g_lua.bindClassMemberFunction<LocalPlayer>("setStates", &LocalPlayer::setStates);
g_lua.bindClassMemberFunction<LocalPlayer>("setSkill", &LocalPlayer::setSkill);
g_lua.bindClassMemberFunction<LocalPlayer>("setHealth", &LocalPlayer::setHealth);
g_lua.bindClassMemberFunction<LocalPlayer>("setTotalCapacity", &LocalPlayer::setTotalCapacity);
g_lua.bindClassMemberFunction<LocalPlayer>("setFreeCapacity", &LocalPlayer::setFreeCapacity);
g_lua.bindClassMemberFunction<LocalPlayer>("setExperience", &LocalPlayer::setExperience);
g_lua.bindClassMemberFunction<LocalPlayer>("setLevel", &LocalPlayer::setLevel);
g_lua.bindClassMemberFunction<LocalPlayer>("setMana", &LocalPlayer::setMana);
g_lua.bindClassMemberFunction<LocalPlayer>("setMagicLevel", &LocalPlayer::setMagicLevel);
g_lua.bindClassMemberFunction<LocalPlayer>("setSoul", &LocalPlayer::setSoul);
g_lua.bindClassMemberFunction<LocalPlayer>("setStamina", &LocalPlayer::setStamina);
g_lua.bindClassMemberFunction<LocalPlayer>("setKnown", &LocalPlayer::setKnown);
g_lua.bindClassMemberFunction<LocalPlayer>("setInventoryItem", &LocalPlayer::setInventoryItem);
g_lua.bindClassMemberFunction<LocalPlayer>("getStates", &LocalPlayer::getStates);
g_lua.bindClassMemberFunction<LocalPlayer>("getSkillLevel", &LocalPlayer::getSkillLevel);
g_lua.bindClassMemberFunction<LocalPlayer>("getSkillBaseLevel", &LocalPlayer::getSkillBaseLevel);
g_lua.bindClassMemberFunction<LocalPlayer>("getSkillLevelPercent", &LocalPlayer::getSkillLevelPercent);
g_lua.bindClassMemberFunction<LocalPlayer>("getHealth", &LocalPlayer::getHealth);
g_lua.bindClassMemberFunction<LocalPlayer>("getMaxHealth", &LocalPlayer::getMaxHealth);
g_lua.bindClassMemberFunction<LocalPlayer>("getFreeCapacity", &LocalPlayer::getFreeCapacity);
g_lua.bindClassMemberFunction<LocalPlayer>("getExperience", &LocalPlayer::getExperience);
g_lua.bindClassMemberFunction<LocalPlayer>("getLevel", &LocalPlayer::getLevel);
g_lua.bindClassMemberFunction<LocalPlayer>("getLevelPercent", &LocalPlayer::getLevelPercent);
g_lua.bindClassMemberFunction<LocalPlayer>("getMana", &LocalPlayer::getMana);
g_lua.bindClassMemberFunction<LocalPlayer>("getMaxMana", &LocalPlayer::getMaxMana);
g_lua.bindClassMemberFunction<LocalPlayer>("getMagicLevel", &LocalPlayer::getMagicLevel);
g_lua.bindClassMemberFunction<LocalPlayer>("getMagicLevelPercent", &LocalPlayer::getMagicLevelPercent);
g_lua.bindClassMemberFunction<LocalPlayer>("getSoul", &LocalPlayer::getSoul);
g_lua.bindClassMemberFunction<LocalPlayer>("getStamina", &LocalPlayer::getStamina);
g_lua.bindClassMemberFunction<LocalPlayer>("getOfflineTrainingTime", &LocalPlayer::getOfflineTrainingTime);
g_lua.bindClassMemberFunction<LocalPlayer>("getRegenerationTime", &LocalPlayer::getRegenerationTime);
g_lua.bindClassMemberFunction<LocalPlayer>("getBaseMagicLevel", &LocalPlayer::getBaseMagicLevel);
g_lua.bindClassMemberFunction<LocalPlayer>("getTotalCapacity", &LocalPlayer::getTotalCapacity);
g_lua.bindClassMemberFunction<LocalPlayer>("getInventoryItem", &LocalPlayer::getInventoryItem);
g_lua.bindClassMemberFunction<LocalPlayer>("getVocation", &LocalPlayer::getVocation);
g_lua.bindClassMemberFunction<LocalPlayer>("getBlessings", &LocalPlayer::getBlessings);
g_lua.bindClassMemberFunction<LocalPlayer>("isPremium", &LocalPlayer::isPremium);
g_lua.bindClassMemberFunction<LocalPlayer>("isKnown", &LocalPlayer::isKnown);
g_lua.bindClassMemberFunction<LocalPlayer>("isPreWalking", &LocalPlayer::isPreWalking);
g_lua.bindClassMemberFunction<LocalPlayer>("hasSight", &LocalPlayer::hasSight);
g_lua.bindClassMemberFunction<LocalPlayer>("isAutoWalking", &LocalPlayer::isAutoWalking);
g_lua.bindClassMemberFunction<LocalPlayer>("isServerWalking", &LocalPlayer::isServerWalking);
g_lua.bindClassMemberFunction<LocalPlayer>("stopAutoWalk", &LocalPlayer::stopAutoWalk);
g_lua.bindClassMemberFunction<LocalPlayer>("autoWalk", &LocalPlayer::autoWalk);
g_lua.bindClassMemberFunction<LocalPlayer>("preWalk", &LocalPlayer::preWalk);
g_lua.bindClassMemberFunction<LocalPlayer>("dumpWalkMatrix", &LocalPlayer::dumpWalkMatrix);
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>("getThings", &Tile::getThings);
g_lua.bindClassMemberFunction<Tile>("getEffect", &Tile::getEffect);
g_lua.bindClassMemberFunction<Tile>("getEffects", &Tile::getEffects);
g_lua.bindClassMemberFunction<Tile>("getItems", &Tile::getItems);
g_lua.bindClassMemberFunction<Tile>("getThingStackPos", &Tile::getThingStackPos);
g_lua.bindClassMemberFunction<Tile>("getThingCount", &Tile::getThingCount);
g_lua.bindClassMemberFunction<Tile>("getTopThing", &Tile::getTopThing);
g_lua.bindClassMemberFunction<Tile>("removeThing", &Tile::removeThing);
g_lua.bindClassMemberFunction<Tile>("getTopLookThing", &Tile::getTopLookThing);
g_lua.bindClassMemberFunction<Tile>("getTopLookThingEx", &Tile::getTopLookThingEx);
g_lua.bindClassMemberFunction<Tile>("getTopUseThing", &Tile::getTopUseThing);
g_lua.bindClassMemberFunction<Tile>("getTopCreature", &Tile::getTopCreature);
g_lua.bindClassMemberFunction<Tile>("getTopCreatureEx", &Tile::getTopCreatureEx);
g_lua.bindClassMemberFunction<Tile>("getTopMoveThing", &Tile::getTopMoveThing);
g_lua.bindClassMemberFunction<Tile>("getTopMultiUseThing", &Tile::getTopMultiUseThing);
g_lua.bindClassMemberFunction<Tile>("getTopMultiUseThingEx", &Tile::getTopMultiUseThingEx);
g_lua.bindClassMemberFunction<Tile>("getPosition", &Tile::getPosition);
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>("isHouseTile", &Tile::isHouseTile);
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>("hasBlockingCreature", &Tile::hasBlockingCreature);
g_lua.bindClassMemberFunction<Tile>("isEmpty", &Tile::isEmpty);
g_lua.bindClassMemberFunction<Tile>("isClickable", &Tile::isClickable);
g_lua.bindClassMemberFunction<Tile>("isPathable", &Tile::isPathable);
g_lua.bindClassMemberFunction<Tile>("overwriteMinimapColor", &Tile::overwriteMinimapColor);
g_lua.bindClassMemberFunction<Tile>("select", &Tile::select);
g_lua.bindClassMemberFunction<Tile>("unselect", &Tile::unselect);
g_lua.bindClassMemberFunction<Tile>("isSelected", &Tile::isSelected);
g_lua.bindClassMemberFunction<Tile>("remFlag", &Tile::remFlag);
g_lua.bindClassMemberFunction<Tile>("setFlag", &Tile::setFlag);
g_lua.bindClassMemberFunction<Tile>("setFlags", &Tile::setFlags);
g_lua.bindClassMemberFunction<Tile>("getFlags", &Tile::getFlags);
g_lua.bindClassMemberFunction<Tile>("hasFlag", &Tile::hasFlag);
g_lua.bindClassMemberFunction<Tile>("getElevation", &Tile::getElevation);
g_lua.bindClassMemberFunction<Tile>("hasElevation", &Tile::hasElevation);
g_lua.bindClassMemberFunction<Tile>("isBlocking", &Tile::isBlocking);
// for bot
g_lua.bindClassMemberFunction<Tile>("setText", &Tile::setText);
g_lua.bindClassMemberFunction<Tile>("getText", &Tile::getText);
g_lua.bindClassMemberFunction<Tile>("setTimer", &Tile::setTimer);
g_lua.bindClassMemberFunction<Tile>("getTimer", &Tile::getTimer);
g_lua.bindClassMemberFunction<Tile>("setFill", &Tile::setFill);
g_lua.registerClass<UIItem, UIWidget>();
g_lua.bindClassStaticFunction<UIItem>("create", []{ return UIItemPtr(new UIItem); });
g_lua.bindClassMemberFunction<UIItem>("setItemId", &UIItem::setItemId);
g_lua.bindClassMemberFunction<UIItem>("setItemCount", &UIItem::setItemCount);
g_lua.bindClassMemberFunction<UIItem>("setItemSubType", &UIItem::setItemSubType);
g_lua.bindClassMemberFunction<UIItem>("setItemVisible", &UIItem::setItemVisible);
g_lua.bindClassMemberFunction<UIItem>("setItem", &UIItem::setItem);
g_lua.bindClassMemberFunction<UIItem>("setVirtual", &UIItem::setVirtual);
g_lua.bindClassMemberFunction<UIItem>("setShowCount", &UIItem::setShowCount);
g_lua.bindClassMemberFunction<UIItem>("clearItem", &UIItem::clearItem);
g_lua.bindClassMemberFunction<UIItem>("getItemId", &UIItem::getItemId);
g_lua.bindClassMemberFunction<UIItem>("getItemCount", &UIItem::getItemCount);
g_lua.bindClassMemberFunction<UIItem>("getItemSubType", &UIItem::getItemSubType);
g_lua.bindClassMemberFunction<UIItem>("getItem", &UIItem::getItem);
g_lua.bindClassMemberFunction<UIItem>("isVirtual", &UIItem::isVirtual);
g_lua.bindClassMemberFunction<UIItem>("isItemVisible", &UIItem::isItemVisible);
g_lua.registerClass<UISprite, UIWidget>();
g_lua.bindClassStaticFunction<UISprite>("create", []{ return UISpritePtr(new UISprite); });
g_lua.bindClassMemberFunction<UISprite>("setSpriteId", &UISprite::setSpriteId);
g_lua.bindClassMemberFunction<UISprite>("clearSprite", &UISprite::clearSprite);
g_lua.bindClassMemberFunction<UISprite>("getSpriteId", &UISprite::getSpriteId);
g_lua.bindClassMemberFunction<UISprite>("setSpriteColor", &UISprite::setSpriteColor);
g_lua.bindClassMemberFunction<UISprite>("hasSprite", &UISprite::hasSprite);
g_lua.registerClass<UICreature, UIWidget>();
g_lua.bindClassStaticFunction<UICreature>("create", []{ return UICreaturePtr(new UICreature); } );
g_lua.bindClassMemberFunction<UICreature>("setCreature", &UICreature::setCreature);
g_lua.bindClassMemberFunction<UICreature>("setOutfit", &UICreature::setOutfit);
g_lua.bindClassMemberFunction<UICreature>("setFixedCreatureSize", &UICreature::setFixedCreatureSize);
g_lua.bindClassMemberFunction<UICreature>("getCreature", &UICreature::getCreature);
g_lua.bindClassMemberFunction<UICreature>("isFixedCreatureSize", &UICreature::isFixedCreatureSize);
g_lua.bindClassMemberFunction<UICreature>("setAutoRotating", &UICreature::setAutoRotating);
g_lua.bindClassMemberFunction<UICreature>("setDirection", &UICreature::setDirection);
g_lua.registerClass<UIMap, UIWidget>();
g_lua.bindClassStaticFunction<UIMap>("create", []{ return UIMapPtr(new UIMap); });
g_lua.bindClassMemberFunction<UIMap>("drawSelf", &UIMap::drawSelf);
g_lua.bindClassMemberFunction<UIMap>("movePixels", &UIMap::movePixels);
g_lua.bindClassMemberFunction<UIMap>("setZoom", &UIMap::setZoom);
g_lua.bindClassMemberFunction<UIMap>("zoomIn", &UIMap::zoomIn);
g_lua.bindClassMemberFunction<UIMap>("zoomOut", &UIMap::zoomOut);
g_lua.bindClassMemberFunction<UIMap>("followCreature", &UIMap::followCreature);
g_lua.bindClassMemberFunction<UIMap>("setCameraPosition", &UIMap::setCameraPosition);
g_lua.bindClassMemberFunction<UIMap>("setMaxZoomIn", &UIMap::setMaxZoomIn);
g_lua.bindClassMemberFunction<UIMap>("setMaxZoomOut", &UIMap::setMaxZoomOut);
g_lua.bindClassMemberFunction<UIMap>("setMultifloor", &UIMap::setMultifloor);
g_lua.bindClassMemberFunction<UIMap>("lockVisibleFloor", &UIMap::lockVisibleFloor);
g_lua.bindClassMemberFunction<UIMap>("unlockVisibleFloor", &UIMap::unlockVisibleFloor);
g_lua.bindClassMemberFunction<UIMap>("setVisibleDimension", &UIMap::setVisibleDimension);
g_lua.bindClassMemberFunction<UIMap>("setDrawFlags", &UIMap::setDrawFlags);
g_lua.bindClassMemberFunction<UIMap>("setDrawTexts", &UIMap::setDrawTexts);
g_lua.bindClassMemberFunction<UIMap>("setDrawNames", &UIMap::setDrawNames);
g_lua.bindClassMemberFunction<UIMap>("setDrawHealthBars", &UIMap::setDrawHealthBars);
g_lua.bindClassMemberFunction<UIMap>("setDrawHealthBarsOnTop", &UIMap::setDrawHealthBarsOnTop);
g_lua.bindClassMemberFunction<UIMap>("setDrawLights", &UIMap::setDrawLights);
g_lua.bindClassMemberFunction<UIMap>("setDrawManaBar", &UIMap::setDrawManaBar);
g_lua.bindClassMemberFunction<UIMap>("setDrawPlayerBars", &UIMap::setDrawPlayerBars);
g_lua.bindClassMemberFunction<UIMap>("setAnimated", &UIMap::setAnimated);
g_lua.bindClassMemberFunction<UIMap>("setKeepAspectRatio", &UIMap::setKeepAspectRatio);
g_lua.bindClassMemberFunction<UIMap>("setMapShader", &UIMap::setMapShader);
g_lua.bindClassMemberFunction<UIMap>("setMinimumAmbientLight", &UIMap::setMinimumAmbientLight);
g_lua.bindClassMemberFunction<UIMap>("setLimitVisibleRange", &UIMap::setLimitVisibleRange);
g_lua.bindClassMemberFunction<UIMap>("setFloorFading", &UIMap::setFloorFading);
g_lua.bindClassMemberFunction<UIMap>("setCrosshair", &UIMap::setCrosshair);
g_lua.bindClassMemberFunction<UIMap>("isMultifloor", &UIMap::isMultifloor);
g_lua.bindClassMemberFunction<UIMap>("isDrawingTexts", &UIMap::isDrawingTexts);
g_lua.bindClassMemberFunction<UIMap>("isDrawingNames", &UIMap::isDrawingNames);
g_lua.bindClassMemberFunction<UIMap>("isDrawingHealthBars", &UIMap::isDrawingHealthBars);
g_lua.bindClassMemberFunction<UIMap>("isDrawingHealthBarsOnTop", &UIMap::isDrawingHealthBarsOnTop);
g_lua.bindClassMemberFunction<UIMap>("isDrawingLights", &UIMap::isDrawingLights);
g_lua.bindClassMemberFunction<UIMap>("isDrawingManaBar", &UIMap::isDrawingManaBar);
g_lua.bindClassMemberFunction<UIMap>("isLimitVisibleRangeEnabled", &UIMap::isLimitVisibleRangeEnabled);
g_lua.bindClassMemberFunction<UIMap>("isAnimating", &UIMap::isAnimating);
g_lua.bindClassMemberFunction<UIMap>("isKeepAspectRatioEnabled", &UIMap::isKeepAspectRatioEnabled);
g_lua.bindClassMemberFunction<UIMap>("getVisibleDimension", &UIMap::getVisibleDimension);
g_lua.bindClassMemberFunction<UIMap>("getFollowingCreature", &UIMap::getFollowingCreature);
g_lua.bindClassMemberFunction<UIMap>("getDrawFlags", &UIMap::getDrawFlags);
g_lua.bindClassMemberFunction<UIMap>("getCameraPosition", &UIMap::getCameraPosition);
g_lua.bindClassMemberFunction<UIMap>("getPosition", &UIMap::getPosition);
g_lua.bindClassMemberFunction<UIMap>("getPositionOffset", &UIMap::getPositionOffset);
g_lua.bindClassMemberFunction<UIMap>("getTile", &UIMap::getTile);
g_lua.bindClassMemberFunction<UIMap>("getMaxZoomIn", &UIMap::getMaxZoomIn);
g_lua.bindClassMemberFunction<UIMap>("getMaxZoomOut", &UIMap::getMaxZoomOut);
g_lua.bindClassMemberFunction<UIMap>("getZoom", &UIMap::getZoom);
g_lua.bindClassMemberFunction<UIMap>("getMapShader", &UIMap::getMapShader);
g_lua.bindClassMemberFunction<UIMap>("getMinimumAmbientLight", &UIMap::getMinimumAmbientLight);
g_lua.registerClass<UIMinimap, UIWidget>();
g_lua.bindClassStaticFunction<UIMinimap>("create", []{ return UIMinimapPtr(new UIMinimap); });
g_lua.bindClassMemberFunction<UIMinimap>("zoomIn", &UIMinimap::zoomIn);
g_lua.bindClassMemberFunction<UIMinimap>("zoomOut", &UIMinimap::zoomOut);
g_lua.bindClassMemberFunction<UIMinimap>("setZoom", &UIMinimap::setZoom);
g_lua.bindClassMemberFunction<UIMinimap>("setMixZoom", &UIMinimap::setMinZoom);
g_lua.bindClassMemberFunction<UIMinimap>("setMaxZoom", &UIMinimap::setMaxZoom);
g_lua.bindClassMemberFunction<UIMinimap>("setCameraPosition", &UIMinimap::setCameraPosition);
g_lua.bindClassMemberFunction<UIMinimap>("floorUp", &UIMinimap::floorUp);
g_lua.bindClassMemberFunction<UIMinimap>("floorDown", &UIMinimap::floorDown);
g_lua.bindClassMemberFunction<UIMinimap>("getTilePoint", &UIMinimap::getTilePoint);
g_lua.bindClassMemberFunction<UIMinimap>("getTilePosition", &UIMinimap::getTilePosition);
g_lua.bindClassMemberFunction<UIMinimap>("getTileRect", &UIMinimap::getTileRect);
g_lua.bindClassMemberFunction<UIMinimap>("getCameraPosition", &UIMinimap::getCameraPosition);
g_lua.bindClassMemberFunction<UIMinimap>("getMinZoom", &UIMinimap::getMinZoom);
g_lua.bindClassMemberFunction<UIMinimap>("getMaxZoom", &UIMinimap::getMaxZoom);
g_lua.bindClassMemberFunction<UIMinimap>("getZoom", &UIMinimap::getZoom);
g_lua.bindClassMemberFunction<UIMinimap>("getScale", &UIMinimap::getScale);
g_lua.bindClassMemberFunction<UIMinimap>("anchorPosition", &UIMinimap::anchorPosition);
g_lua.bindClassMemberFunction<UIMinimap>("fillPosition", &UIMinimap::fillPosition);
g_lua.bindClassMemberFunction<UIMinimap>("centerInPosition", &UIMinimap::centerInPosition);
g_lua.registerClass<UIProgressRect, UIWidget>();
g_lua.bindClassStaticFunction<UIProgressRect>("create", []{ return UIProgressRectPtr(new UIProgressRect); } );
g_lua.bindClassMemberFunction<UIProgressRect>("setPercent", &UIProgressRect::setPercent);
g_lua.bindClassMemberFunction<UIProgressRect>("getPercent", &UIProgressRect::getPercent);
g_lua.registerClass<UIMapAnchorLayout, UIAnchorLayout>();
}

View File

@ -0,0 +1,990 @@
/*
* Copyright (c) 2010-2017 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 <framework/core/application.h>
#include <framework/core/adaptiverenderer.h>
#include <framework/luaengine/luainterface.h>
#include <framework/core/eventdispatcher.h>
#include <framework/core/configmanager.h>
#include <framework/core/config.h>
#include <framework/otml/otml.h>
#include <framework/core/modulemanager.h>
#include <framework/core/module.h>
#include <framework/util/crypt.h>
#include <framework/core/resourcemanager.h>
#include <framework/graphics/texturemanager.h>
#include <framework/stdext/net.h>
#include <framework/platform/platform.h>
#include <framework/util/stats.h>
#include <regex>
#ifdef FW_SOUND
#include <framework/sound/soundmanager.h>
#include <framework/sound/soundsource.h>
#include <framework/sound/soundchannel.h>
#include <framework/sound/combinedsoundsource.h>
#include <framework/sound/streamsoundsource.h>
#endif
#ifdef FW_GRAPHICS
#include <framework/graphics/graphics.h>
#include <framework/graphics/atlas.h>
#include <framework/platform/platformwindow.h>
#include <framework/graphics/particlemanager.h>
#include <framework/graphics/fontmanager.h>
#include <framework/ui/ui.h>
#include <framework/input/mouse.h>
#endif
#ifdef FW_NET
#include <framework/net/server.h>
#include <framework/net/protocol.h>
#ifdef FW_PROXY
#include <extras/proxy/proxy.h>
#endif
#endif
#ifdef FW_SQL
#include <framework/sql/mysql.h>
#endif
#include <framework/util/extras.h>
#include <framework/http/http.h>
void Application::registerLuaFunctions()
{
// conversion globals
g_lua.bindGlobalFunction("torect", [](const std::string& v) { return stdext::from_string<Rect>(v); });
g_lua.bindGlobalFunction("topoint", [](const std::string& v) { return stdext::from_string<Point>(v); });
g_lua.bindGlobalFunction("tocolor", [](const std::string& v) { return stdext::from_string<Color>(v); });
g_lua.bindGlobalFunction("tosize", [](const std::string& v) { return stdext::from_string<Size>(v); });
g_lua.bindGlobalFunction("recttostring", [](const Rect& v) { return stdext::to_string(v); });
g_lua.bindGlobalFunction("pointtostring", [](const Point& v) { return stdext::to_string(v); });
g_lua.bindGlobalFunction("colortostring", [](const Color& v) { return stdext::to_string(v); });
g_lua.bindGlobalFunction("sizetostring", [](const Size& v) { return stdext::to_string(v); });
g_lua.bindGlobalFunction("iptostring", [](uint32 v) { return stdext::ip_to_string(v); });
g_lua.bindGlobalFunction("stringtoip", [](const std::string& v) { return stdext::string_to_ip(v); });
g_lua.bindGlobalFunction("listSubnetAddresses", [](uint32 a, uint8 b) { return stdext::listSubnetAddresses(a, b); });
g_lua.bindGlobalFunction("ucwords", [](std::string s) { return stdext::ucwords(s); });
g_lua.bindGlobalFunction("regexMatch", [](std::string s, const std::string& exp) {
int limit = 10000;
std::vector<std::vector<std::string>> ret;
if (s.empty() || exp.empty())
return ret;
try {
std::smatch m;
std::regex e(exp);
while (std::regex_search (s,m,e)) {
ret.push_back(std::vector<std::string>());
for (auto x:m)
ret[ret.size() - 1].push_back(x);
s = m.suffix().str();
if (--limit == 0)
return ret;
}
} catch (...) {
}
return ret;
});
// Platform
g_lua.registerSingletonClass("g_platform");
g_lua.bindSingletonFunction("g_platform", "spawnProcess", &Platform::spawnProcess, &g_platform);
g_lua.bindSingletonFunction("g_platform", "getProcessId", &Platform::getProcessId, &g_platform);
g_lua.bindSingletonFunction("g_platform", "isProcessRunning", &Platform::isProcessRunning, &g_platform);
g_lua.bindSingletonFunction("g_platform", "copyFile", &Platform::copyFile, &g_platform);
g_lua.bindSingletonFunction("g_platform", "fileExists", &Platform::fileExists, &g_platform);
g_lua.bindSingletonFunction("g_platform", "removeFile", &Platform::removeFile, &g_platform);
g_lua.bindSingletonFunction("g_platform", "killProcess", &Platform::killProcess, &g_platform);
g_lua.bindSingletonFunction("g_platform", "getTempPath", &Platform::getTempPath, &g_platform);
g_lua.bindSingletonFunction("g_platform", "openUrl", &Platform::openUrl, &g_platform);
g_lua.bindSingletonFunction("g_platform", "openDir", &Platform::openDir, &g_platform);
g_lua.bindSingletonFunction("g_platform", "getCPUName", &Platform::getCPUName, &g_platform);
g_lua.bindSingletonFunction("g_platform", "getTotalSystemMemory", &Platform::getTotalSystemMemory, &g_platform);
g_lua.bindSingletonFunction("g_platform", "getMemoryUsage", &Platform::getMemoryUsage, &g_platform);
g_lua.bindSingletonFunction("g_platform", "getOSName", &Platform::getOSName, &g_platform);
g_lua.bindSingletonFunction("g_platform", "getFileModificationTime", &Platform::getFileModificationTime, &g_platform);
// Application
g_lua.registerSingletonClass("g_app");
g_lua.bindSingletonFunction("g_app", "setName", &Application::setName, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "setCompactName", &Application::setCompactName, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "setVersion", &Application::setVersion, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "isRunning", &Application::isRunning, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "isStopping", &Application::isStopping, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "getName", &Application::getName, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "getCompactName", &Application::getCompactName, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "getVersion", &Application::getVersion, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "getBuildCompiler", &Application::getBuildCompiler, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "getBuildDate", &Application::getBuildDate, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "getBuildRevision", &Application::getBuildRevision, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "getBuildCommit", &Application::getBuildCommit, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "getBuildType", &Application::getBuildType, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "getBuildArch", &Application::getBuildArch, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "getAuthor", &Application::getAuthor, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "getOs", &Application::getOs, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "getStartupOptions", &Application::getStartupOptions, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "exit", &Application::exit, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "quick_exit", &Application::quick_exit, static_cast<Application*>(&g_app));
// Crypt
g_lua.registerSingletonClass("g_crypt");
g_lua.bindSingletonFunction("g_crypt", "genUUID", &Crypt::genUUID, &g_crypt);
g_lua.bindSingletonFunction("g_crypt", "setMachineUUID", &Crypt::setMachineUUID, &g_crypt);
g_lua.bindSingletonFunction("g_crypt", "getMachineUUID", &Crypt::getMachineUUID, &g_crypt);
g_lua.bindSingletonFunction("g_crypt", "encrypt", &Crypt::encrypt, &g_crypt);
g_lua.bindSingletonFunction("g_crypt", "decrypt", &Crypt::decrypt, &g_crypt);
g_lua.bindSingletonFunction("g_crypt", "sha1Encode", &Crypt::sha1Encode, &g_crypt);
g_lua.bindSingletonFunction("g_crypt", "md5Encode", &Crypt::md5Encode, &g_crypt);
g_lua.bindSingletonFunction("g_crypt", "rsaGenerateKey", &Crypt::rsaGenerateKey, &g_crypt);
g_lua.bindSingletonFunction("g_crypt", "rsaSetPublicKey", &Crypt::rsaSetPublicKey, &g_crypt);
g_lua.bindSingletonFunction("g_crypt", "rsaSetPrivateKey", &Crypt::rsaSetPrivateKey, &g_crypt);
g_lua.bindSingletonFunction("g_crypt", "rsaCheckKey", &Crypt::rsaCheckKey, &g_crypt);
g_lua.bindSingletonFunction("g_crypt", "rsaGetSize", &Crypt::rsaGetSize, &g_crypt);
// Clock
g_lua.registerSingletonClass("g_clock");
g_lua.bindSingletonFunction("g_clock", "micros", &Clock::micros, &g_clock);
g_lua.bindSingletonFunction("g_clock", "millis", &Clock::millis, &g_clock);
g_lua.bindSingletonFunction("g_clock", "seconds", &Clock::seconds, &g_clock);
g_lua.bindSingletonFunction("g_clock", "realMillis", &Clock::realMillis, &g_clock);
g_lua.bindSingletonFunction("g_clock", "realMicros", &Clock::realMicros, &g_clock);
// ConfigManager
g_lua.registerSingletonClass("g_configs");
g_lua.bindSingletonFunction("g_configs", "getSettings", &ConfigManager::getSettings, &g_configs);
g_lua.bindSingletonFunction("g_configs", "get", &ConfigManager::get, &g_configs);
g_lua.bindSingletonFunction("g_configs", "loadSettings", &ConfigManager::loadSettings, &g_configs);
g_lua.bindSingletonFunction("g_configs", "load", &ConfigManager::load, &g_configs);
g_lua.bindSingletonFunction("g_configs", "unload", &ConfigManager::unload, &g_configs);
g_lua.bindSingletonFunction("g_configs", "create", &ConfigManager::create, &g_configs);
// Logger
g_lua.registerSingletonClass("g_logger");
g_lua.bindSingletonFunction("g_logger", "log", &Logger::log, &g_logger);
g_lua.bindSingletonFunction("g_logger", "fireOldMessages", &Logger::fireOldMessages, &g_logger);
g_lua.bindSingletonFunction("g_logger", "setLogFile", &Logger::setLogFile, &g_logger);
g_lua.bindSingletonFunction("g_logger", "setOnLog", &Logger::setOnLog, &g_logger);
g_lua.bindSingletonFunction("g_logger", "debug", &Logger::debug, &g_logger);
g_lua.bindSingletonFunction("g_logger", "info", &Logger::info, &g_logger);
g_lua.bindSingletonFunction("g_logger", "warning", &Logger::warning, &g_logger);
g_lua.bindSingletonFunction("g_logger", "error", &Logger::error, &g_logger);
g_lua.bindSingletonFunction("g_logger", "fatal", &Logger::fatal, &g_logger);
g_lua.bindSingletonFunction("g_logger", "getLastLog", &Logger::getLastLog, &g_logger);
// Lua stats
g_lua.registerSingletonClass("g_stats");
g_lua.bindSingletonFunction("g_stats", "types", &Stats::types, &g_stats);
g_lua.bindSingletonFunction("g_stats", "get", &Stats::get, &g_stats);
g_lua.bindSingletonFunction("g_stats", "clear", &Stats::clear, &g_stats);
g_lua.bindSingletonFunction("g_stats", "clearAll", &Stats::clearAll, &g_stats);
g_lua.bindSingletonFunction("g_stats", "getSlow", &Stats::getSlow, &g_stats);
g_lua.bindSingletonFunction("g_stats", "clearSlow", &Stats::clearSlow, &g_stats);
g_lua.bindSingletonFunction("g_stats", "getSleepTime", &Stats::getSleepTime, &g_stats);
g_lua.bindSingletonFunction("g_stats", "resetSleepTime", &Stats::resetSleepTime, &g_stats);
g_lua.bindSingletonFunction("g_stats", "getWidgetsInfo", &Stats::getWidgetsInfo, &g_stats);
g_lua.registerSingletonClass("g_extras");
g_lua.bindSingletonFunction("g_extras", "set", &Extras::set, &g_extras);
g_lua.bindSingletonFunction("g_extras", "get", &Extras::get, &g_extras);
g_lua.bindSingletonFunction("g_extras", "getDescription", &Extras::getDescription, &g_extras);
g_lua.bindSingletonFunction("g_extras", "getAll", &Extras::getAll, &g_extras);
g_lua.registerSingletonClass("g_http");
g_lua.bindSingletonFunction("g_http", "get", &Http::get, &g_http);
g_lua.bindSingletonFunction("g_http", "post", &Http::post, &g_http);
g_lua.bindSingletonFunction("g_http", "download", &Http::download, &g_http);
g_lua.bindSingletonFunction("g_http", "ws", &Http::ws, &g_http);
g_lua.bindSingletonFunction("g_http", "wsSend", &Http::wsSend, &g_http);
g_lua.bindSingletonFunction("g_http", "wsClose", &Http::wsClose, &g_http);
g_lua.bindSingletonFunction("g_http", "cancel", &Http::cancel, &g_http);
g_lua.registerSingletonClass("g_atlas");
g_lua.bindSingletonFunction("g_atlas", "getStats", &Atlas::getStats, &g_atlas);
g_lua.bindSingletonFunction("g_atlas", "reset", &Atlas::reset, &g_atlas);
// ModuleManager
g_lua.registerSingletonClass("g_modules");
g_lua.bindSingletonFunction("g_modules", "discoverModules", &ModuleManager::discoverModules, &g_modules);
g_lua.bindSingletonFunction("g_modules", "autoLoadModules", &ModuleManager::autoLoadModules, &g_modules);
g_lua.bindSingletonFunction("g_modules", "discoverModule", &ModuleManager::discoverModule, &g_modules);
g_lua.bindSingletonFunction("g_modules", "ensureModuleLoaded", &ModuleManager::ensureModuleLoaded, &g_modules);
g_lua.bindSingletonFunction("g_modules", "unloadModules", &ModuleManager::unloadModules, &g_modules);
g_lua.bindSingletonFunction("g_modules", "reloadModules", &ModuleManager::reloadModules, &g_modules);
g_lua.bindSingletonFunction("g_modules", "getModule", &ModuleManager::getModule, &g_modules);
g_lua.bindSingletonFunction("g_modules", "getModules", &ModuleManager::getModules, &g_modules);
// EventDispatcher
g_lua.registerSingletonClass("g_dispatcher");
g_lua.bindSingletonFunction("g_dispatcher", "addEvent", &EventDispatcher::addEventEx, &g_dispatcher);
g_lua.bindSingletonFunction("g_dispatcher", "scheduleEvent", &EventDispatcher::scheduleEventEx, &g_dispatcher);
g_lua.bindSingletonFunction("g_dispatcher", "cycleEvent", &EventDispatcher::cycleEventEx, &g_dispatcher);
// ResourceManager
g_lua.registerSingletonClass("g_resources");
g_lua.bindSingletonFunction("g_resources", "fileExists", &ResourceManager::fileExists, &g_resources);
g_lua.bindSingletonFunction("g_resources", "directoryExists", &ResourceManager::directoryExists, &g_resources);
g_lua.bindSingletonFunction("g_resources", "getWorkDir", &ResourceManager::getWorkDir, &g_resources);
g_lua.bindSingletonFunction("g_resources", "getWriteDir", &ResourceManager::getWriteDir, &g_resources);
g_lua.bindSingletonFunction("g_resources", "getBinaryName", &ResourceManager::getBinaryName, &g_resources);
g_lua.bindSingletonFunction("g_resources", "listDirectoryFiles", &ResourceManager::listDirectoryFiles, &g_resources);
g_lua.bindSingletonFunction("g_resources", "isFileType", &ResourceManager::isFileType, &g_resources);
g_lua.bindSingletonFunction("g_resources", "readFileContents", &ResourceManager::readFileContentsSafe, &g_resources);
g_lua.bindSingletonFunction("g_resources", "writeFileContents", &ResourceManager::writeFileContents, &g_resources);
g_lua.bindSingletonFunction("g_resources", "guessFilePath", &ResourceManager::guessFilePath, &g_resources);
g_lua.bindSingletonFunction("g_resources", "makeDir", &ResourceManager::makeDir, &g_resources);
g_lua.bindSingletonFunction("g_resources", "deleteFile", &ResourceManager::deleteFile, &g_resources);
g_lua.bindSingletonFunction("g_resources", "readCrashLog", &ResourceManager::readCrashLog, &g_resources);
g_lua.bindSingletonFunction("g_resources", "deleteCrashLog", &ResourceManager::deleteCrashLog, &g_resources);
g_lua.bindSingletonFunction("g_resources", "resolvePath", &ResourceManager::resolvePath, &g_resources);
g_lua.bindSingletonFunction("g_resources", "isLoadedFromMemory", &ResourceManager::isLoadedFromMemory, &g_resources);
g_lua.bindSingletonFunction("g_resources", "isLoadedFromArchive", &ResourceManager::isLoadedFromArchive, &g_resources);
g_lua.bindSingletonFunction("g_resources", "listUpdateableFiles", &ResourceManager::listUpdateableFiles, &g_resources);
g_lua.bindSingletonFunction("g_resources", "fileChecksum", &ResourceManager::fileChecksum, &g_resources);
g_lua.bindSingletonFunction("g_resources", "selfChecksum", &ResourceManager::selfChecksum, &g_resources);
g_lua.bindSingletonFunction("g_resources", "updateClient", &ResourceManager::updateClient, &g_resources);
// Config
g_lua.registerClass<Config>();
g_lua.bindClassMemberFunction<Config>("save", &Config::save);
g_lua.bindClassMemberFunction<Config>("setValue", &Config::setValue);
g_lua.bindClassMemberFunction<Config>("setList", &Config::setList);
g_lua.bindClassMemberFunction<Config>("getValue", &Config::getValue);
g_lua.bindClassMemberFunction<Config>("getList", &Config::getList);
g_lua.bindClassMemberFunction<Config>("exists", &Config::exists);
g_lua.bindClassMemberFunction<Config>("remove", &Config::remove);
g_lua.bindClassMemberFunction<Config>("setNode", &Config::setNode);
g_lua.bindClassMemberFunction<Config>("getNode", &Config::getNode);
g_lua.bindClassMemberFunction<Config>("mergeNode", &Config::mergeNode);
g_lua.bindClassMemberFunction<Config>("getFileName", &Config::getFileName);
// Module
g_lua.registerClass<Module>();
g_lua.bindClassMemberFunction<Module>("load", &Module::load);
g_lua.bindClassMemberFunction<Module>("unload", &Module::unload);
g_lua.bindClassMemberFunction<Module>("reload", &Module::reload);
g_lua.bindClassMemberFunction<Module>("canReload", &Module::canReload);
g_lua.bindClassMemberFunction<Module>("canUnload", &Module::canUnload);
g_lua.bindClassMemberFunction<Module>("isLoaded", &Module::isLoaded);
g_lua.bindClassMemberFunction<Module>("isReloadble", &Module::isReloadable);
g_lua.bindClassMemberFunction<Module>("isSandboxed", &Module::isSandboxed);
g_lua.bindClassMemberFunction<Module>("getDescription", &Module::getDescription);
g_lua.bindClassMemberFunction<Module>("getName", &Module::getName);
g_lua.bindClassMemberFunction<Module>("getAuthor", &Module::getAuthor);
g_lua.bindClassMemberFunction<Module>("getWebsite", &Module::getWebsite);
g_lua.bindClassMemberFunction<Module>("getVersion", &Module::getVersion);
g_lua.bindClassMemberFunction<Module>("getSandbox", &Module::getSandbox);
g_lua.bindClassMemberFunction<Module>("isAutoLoad", &Module::isAutoLoad);
g_lua.bindClassMemberFunction<Module>("getAutoLoadPriority", &Module::getAutoLoadPriority);
// Event
g_lua.registerClass<Event>();
g_lua.bindClassMemberFunction<Event>("cancel", &Event::cancel);
g_lua.bindClassMemberFunction<Event>("execute", &Event::execute);
g_lua.bindClassMemberFunction<Event>("isCanceled", &Event::isCanceled);
g_lua.bindClassMemberFunction<Event>("isExecuted", &Event::isExecuted);
// ScheduledEvent
g_lua.registerClass<ScheduledEvent, Event>();
g_lua.bindClassMemberFunction<ScheduledEvent>("nextCycle", &ScheduledEvent::nextCycle);
g_lua.bindClassMemberFunction<ScheduledEvent>("ticks", &ScheduledEvent::ticks);
g_lua.bindClassMemberFunction<ScheduledEvent>("remainingTicks", &ScheduledEvent::remainingTicks);
g_lua.bindClassMemberFunction<ScheduledEvent>("delay", &ScheduledEvent::delay);
g_lua.bindClassMemberFunction<ScheduledEvent>("cyclesExecuted", &ScheduledEvent::cyclesExecuted);
g_lua.bindClassMemberFunction<ScheduledEvent>("maxCycles", &ScheduledEvent::maxCycles);
#ifdef FW_GRAPHICS
// GraphicalApplication
g_lua.bindSingletonFunction("g_app", "setMaxFps", &GraphicalApplication::setMaxFps, &g_app);
g_lua.bindSingletonFunction("g_app", "getMaxFps", &GraphicalApplication::getMaxFps, &g_app);
g_lua.bindSingletonFunction("g_app", "getFps", &GraphicalApplication::getFps, &g_app);
g_lua.bindSingletonFunction("g_app", "isOnInputEvent", &GraphicalApplication::isOnInputEvent, &g_app);
g_lua.bindSingletonFunction("g_app", "doScreenshot", &GraphicalApplication::doScreenshot, &g_app);
// AdaptiveRenderer
g_lua.registerSingletonClass("g_adaptiveRenderer");
g_lua.bindSingletonFunction("g_adaptiveRenderer", "getLevel", &AdaptiveRenderer::getLevel, &g_adaptiveRenderer);
g_lua.bindSingletonFunction("g_adaptiveRenderer", "setLevel", &AdaptiveRenderer::setForcedLevel, &g_adaptiveRenderer);
g_lua.bindSingletonFunction("g_adaptiveRenderer", "getDebugInfo", &AdaptiveRenderer::getDebugInfo, &g_adaptiveRenderer);
// PlatformWindow
g_lua.registerSingletonClass("g_window");
g_lua.bindSingletonFunction("g_window", "move", &PlatformWindow::move, &g_window);
g_lua.bindSingletonFunction("g_window", "resize", &PlatformWindow::resize, &g_window);
g_lua.bindSingletonFunction("g_window", "show", &PlatformWindow::show, &g_window);
g_lua.bindSingletonFunction("g_window", "hide", &PlatformWindow::hide, &g_window);
g_lua.bindSingletonFunction("g_window", "poll", &PlatformWindow::poll, &g_window);
g_lua.bindSingletonFunction("g_window", "maximize", &PlatformWindow::maximize, &g_window);
g_lua.bindSingletonFunction("g_window", "restoreMouseCursor", &PlatformWindow::restoreMouseCursor, &g_window);
g_lua.bindSingletonFunction("g_window", "showMouse", &PlatformWindow::showMouse, &g_window);
g_lua.bindSingletonFunction("g_window", "hideMouse", &PlatformWindow::hideMouse, &g_window);
g_lua.bindSingletonFunction("g_window", "setTitle", &PlatformWindow::setTitle, &g_window);
g_lua.bindSingletonFunction("g_window", "setMouseCursor", &PlatformWindow::setMouseCursor, &g_window);
g_lua.bindSingletonFunction("g_window", "setMinimumSize", &PlatformWindow::setMinimumSize, &g_window);
g_lua.bindSingletonFunction("g_window", "setFullscreen", &PlatformWindow::setFullscreen, &g_window);
g_lua.bindSingletonFunction("g_window", "setVerticalSync", &PlatformWindow::setVerticalSync, &g_window);
g_lua.bindSingletonFunction("g_window", "setIcon", &PlatformWindow::setIcon, &g_window);
g_lua.bindSingletonFunction("g_window", "setClipboardText", &PlatformWindow::setClipboardText, &g_window);
g_lua.bindSingletonFunction("g_window", "getDisplaySize", &PlatformWindow::getDisplaySize, &g_window);
g_lua.bindSingletonFunction("g_window", "getClipboardText", &PlatformWindow::getClipboardText, &g_window);
g_lua.bindSingletonFunction("g_window", "getPlatformType", &PlatformWindow::getPlatformType, &g_window);
g_lua.bindSingletonFunction("g_window", "getDisplayWidth", &PlatformWindow::getDisplayWidth, &g_window);
g_lua.bindSingletonFunction("g_window", "getDisplayHeight", &PlatformWindow::getDisplayHeight, &g_window);
g_lua.bindSingletonFunction("g_window", "getUnmaximizedSize", &PlatformWindow::getUnmaximizedSize, &g_window);
g_lua.bindSingletonFunction("g_window", "getSize", &PlatformWindow::getSize, &g_window);
g_lua.bindSingletonFunction("g_window", "getWidth", &PlatformWindow::getWidth, &g_window);
g_lua.bindSingletonFunction("g_window", "getHeight", &PlatformWindow::getHeight, &g_window);
g_lua.bindSingletonFunction("g_window", "getUnmaximizedPos", &PlatformWindow::getUnmaximizedPos, &g_window);
g_lua.bindSingletonFunction("g_window", "getPosition", &PlatformWindow::getPosition, &g_window);
g_lua.bindSingletonFunction("g_window", "getX", &PlatformWindow::getX, &g_window);
g_lua.bindSingletonFunction("g_window", "getY", &PlatformWindow::getY, &g_window);
g_lua.bindSingletonFunction("g_window", "getMousePosition", &PlatformWindow::getMousePosition, &g_window);
g_lua.bindSingletonFunction("g_window", "getKeyboardModifiers", &PlatformWindow::getKeyboardModifiers, &g_window);
g_lua.bindSingletonFunction("g_window", "isKeyPressed", &PlatformWindow::isKeyPressed, &g_window);
g_lua.bindSingletonFunction("g_window", "isMouseButtonPressed", &PlatformWindow::isMouseButtonPressed, &g_window);
g_lua.bindSingletonFunction("g_window", "isVisible", &PlatformWindow::isVisible, &g_window);
g_lua.bindSingletonFunction("g_window", "isFullscreen", &PlatformWindow::isFullscreen, &g_window);
g_lua.bindSingletonFunction("g_window", "isMaximized", &PlatformWindow::isMaximized, &g_window);
g_lua.bindSingletonFunction("g_window", "hasFocus", &PlatformWindow::hasFocus, &g_window);
// Input
g_lua.registerSingletonClass("g_mouse");
g_lua.bindSingletonFunction("g_mouse", "loadCursors", &Mouse::loadCursors, &g_mouse);
g_lua.bindSingletonFunction("g_mouse", "addCursor", &Mouse::addCursor, &g_mouse);
g_lua.bindSingletonFunction("g_mouse", "pushCursor", &Mouse::pushCursor, &g_mouse);
g_lua.bindSingletonFunction("g_mouse", "popCursor", &Mouse::popCursor, &g_mouse);
g_lua.bindSingletonFunction("g_mouse", "isCursorChanged", &Mouse::isCursorChanged, &g_mouse);
g_lua.bindSingletonFunction("g_mouse", "isPressed", &Mouse::isPressed, &g_mouse);
// Graphics
g_lua.registerSingletonClass("g_graphics");
g_lua.bindSingletonFunction("g_graphics", "canCacheBackbuffer", &Graphics::canCacheBackbuffer, &g_graphics);
g_lua.bindSingletonFunction("g_graphics", "canUseShaders", &Graphics::canUseShaders, &g_graphics);
g_lua.bindSingletonFunction("g_graphics", "shouldUseShaders", &Graphics::shouldUseShaders, &g_graphics);
g_lua.bindSingletonFunction("g_graphics", "setShouldUseShaders", &Graphics::setShouldUseShaders, &g_graphics);
g_lua.bindSingletonFunction("g_graphics", "getViewportSize", &Graphics::getViewportSize, &g_graphics);
g_lua.bindSingletonFunction("g_graphics", "getVendor", &Graphics::getVendor, &g_graphics);
g_lua.bindSingletonFunction("g_graphics", "getRenderer", &Graphics::getRenderer, &g_graphics);
g_lua.bindSingletonFunction("g_graphics", "getVersion", &Graphics::getVersion, &g_graphics);
// Textures
g_lua.registerSingletonClass("g_textures");
g_lua.bindSingletonFunction("g_textures", "preload", &TextureManager::preload, &g_textures);
g_lua.bindSingletonFunction("g_textures", "clearCache", &TextureManager::clearCache, &g_textures);
g_lua.bindSingletonFunction("g_textures", "reload", &TextureManager::reload, &g_textures);
// UI
g_lua.registerSingletonClass("g_ui");
g_lua.bindSingletonFunction("g_ui", "clearStyles", &UIManager::clearStyles, &g_ui);
g_lua.bindSingletonFunction("g_ui", "importStyle", &UIManager::importStyle, &g_ui);
g_lua.bindSingletonFunction("g_ui", "getStyle", &UIManager::getStyle, &g_ui);
g_lua.bindSingletonFunction("g_ui", "getStyleClass", &UIManager::getStyleClass, &g_ui);
g_lua.bindSingletonFunction("g_ui", "loadUI", &UIManager::loadUI, &g_ui);
g_lua.bindSingletonFunction("g_ui", "loadUIFromString", &UIManager::loadUIFromString, &g_ui);
g_lua.bindSingletonFunction("g_ui", "displayUI", &UIManager::displayUI, &g_ui);
g_lua.bindSingletonFunction("g_ui", "createWidget", &UIManager::createWidget, &g_ui);
g_lua.bindSingletonFunction("g_ui", "createWidgetFromOTML", &UIManager::createWidgetFromOTML, &g_ui);
g_lua.bindSingletonFunction("g_ui", "getRootWidget", &UIManager::getRootWidget, &g_ui);
g_lua.bindSingletonFunction("g_ui", "getDraggingWidget", &UIManager::getDraggingWidget, &g_ui);
g_lua.bindSingletonFunction("g_ui", "getPressedWidget", &UIManager::getPressedWidget, &g_ui);
g_lua.bindSingletonFunction("g_ui", "setDebugBoxesDrawing", &UIManager::setDebugBoxesDrawing, &g_ui);
g_lua.bindSingletonFunction("g_ui", "isDrawingDebugBoxes", &UIManager::isDrawingDebugBoxes, &g_ui);
g_lua.bindSingletonFunction("g_ui", "isMouseGrabbed", &UIManager::isMouseGrabbed, &g_ui);
g_lua.bindSingletonFunction("g_ui", "isKeyboardGrabbed", &UIManager::isKeyboardGrabbed, &g_ui);
// FontManager
g_lua.registerSingletonClass("g_fonts");
g_lua.bindSingletonFunction("g_fonts", "clearFonts", &FontManager::clearFonts, &g_fonts);
g_lua.bindSingletonFunction("g_fonts", "importFont", &FontManager::importFont, &g_fonts);
g_lua.bindSingletonFunction("g_fonts", "fontExists", &FontManager::fontExists, &g_fonts);
g_lua.bindSingletonFunction("g_fonts", "setDefaultFont", &FontManager::setDefaultFont, &g_fonts);
// ParticleManager
g_lua.registerSingletonClass("g_particles");
g_lua.bindSingletonFunction("g_particles", "importParticle", &ParticleManager::importParticle, &g_particles);
g_lua.bindSingletonFunction("g_particles", "getEffectsTypes", &ParticleManager::getEffectsTypes, &g_particles);
// UIWidget
g_lua.registerClass<UIWidget>();
g_lua.bindClassStaticFunction<UIWidget>("create", []{ return UIWidgetPtr(new UIWidget); });
g_lua.bindClassMemberFunction<UIWidget>("addChild", &UIWidget::addChild);
g_lua.bindClassMemberFunction<UIWidget>("insertChild", &UIWidget::insertChild);
g_lua.bindClassMemberFunction<UIWidget>("removeChild", &UIWidget::removeChild);
g_lua.bindClassMemberFunction<UIWidget>("focusChild", &UIWidget::focusChild);
g_lua.bindClassMemberFunction<UIWidget>("focusNextChild", &UIWidget::focusNextChild);
g_lua.bindClassMemberFunction<UIWidget>("focusPreviousChild", &UIWidget::focusPreviousChild);
g_lua.bindClassMemberFunction<UIWidget>("lowerChild", &UIWidget::lowerChild);
g_lua.bindClassMemberFunction<UIWidget>("raiseChild", &UIWidget::raiseChild);
g_lua.bindClassMemberFunction<UIWidget>("moveChildToIndex", &UIWidget::moveChildToIndex);
g_lua.bindClassMemberFunction<UIWidget>("reorderChildrens", &UIWidget::reorderChildrens);
g_lua.bindClassMemberFunction<UIWidget>("lockChild", &UIWidget::lockChild);
g_lua.bindClassMemberFunction<UIWidget>("unlockChild", &UIWidget::unlockChild);
g_lua.bindClassMemberFunction<UIWidget>("mergeStyle", &UIWidget::mergeStyle);
g_lua.bindClassMemberFunction<UIWidget>("applyStyle", &UIWidget::applyStyle);
g_lua.bindClassMemberFunction<UIWidget>("addAnchor", &UIWidget::addAnchor);
g_lua.bindClassMemberFunction<UIWidget>("removeAnchor", &UIWidget::removeAnchor);
g_lua.bindClassMemberFunction<UIWidget>("fill", &UIWidget::fill);
g_lua.bindClassMemberFunction<UIWidget>("centerIn", &UIWidget::centerIn);
g_lua.bindClassMemberFunction<UIWidget>("breakAnchors", &UIWidget::breakAnchors);
g_lua.bindClassMemberFunction<UIWidget>("updateParentLayout", &UIWidget::updateParentLayout);
g_lua.bindClassMemberFunction<UIWidget>("updateLayout", &UIWidget::updateLayout);
g_lua.bindClassMemberFunction<UIWidget>("lock", &UIWidget::lock);
g_lua.bindClassMemberFunction<UIWidget>("unlock", &UIWidget::unlock);
g_lua.bindClassMemberFunction<UIWidget>("focus", &UIWidget::focus);
g_lua.bindClassMemberFunction<UIWidget>("lower", &UIWidget::lower);
g_lua.bindClassMemberFunction<UIWidget>("raise", &UIWidget::raise);
g_lua.bindClassMemberFunction<UIWidget>("grabMouse", &UIWidget::grabMouse);
g_lua.bindClassMemberFunction<UIWidget>("ungrabMouse", &UIWidget::ungrabMouse);
g_lua.bindClassMemberFunction<UIWidget>("grabKeyboard", &UIWidget::grabKeyboard);
g_lua.bindClassMemberFunction<UIWidget>("ungrabKeyboard", &UIWidget::ungrabKeyboard);
g_lua.bindClassMemberFunction<UIWidget>("bindRectToParent", &UIWidget::bindRectToParent);
g_lua.bindClassMemberFunction<UIWidget>("destroy", &UIWidget::destroy);
g_lua.bindClassMemberFunction<UIWidget>("destroyChildren", &UIWidget::destroyChildren);
g_lua.bindClassMemberFunction<UIWidget>("setId", &UIWidget::setId);
g_lua.bindClassMemberFunction<UIWidget>("setParent", &UIWidget::setParent);
g_lua.bindClassMemberFunction<UIWidget>("setLayout", &UIWidget::setLayout);
g_lua.bindClassMemberFunction<UIWidget>("setRect", &UIWidget::setRect);
g_lua.bindClassMemberFunction<UIWidget>("setStyle", &UIWidget::setStyle);
g_lua.bindClassMemberFunction<UIWidget>("setStyleFromNode", &UIWidget::setStyleFromNode);
g_lua.bindClassMemberFunction<UIWidget>("setEnabled", &UIWidget::setEnabled);
g_lua.bindClassMemberFunction<UIWidget>("setVisible", &UIWidget::setVisible);
g_lua.bindClassMemberFunction<UIWidget>("setOn", &UIWidget::setOn);
g_lua.bindClassMemberFunction<UIWidget>("setChecked", &UIWidget::setChecked);
g_lua.bindClassMemberFunction<UIWidget>("setFocusable", &UIWidget::setFocusable);
g_lua.bindClassMemberFunction<UIWidget>("setPhantom", &UIWidget::setPhantom);
g_lua.bindClassMemberFunction<UIWidget>("setDraggable", &UIWidget::setDraggable);
g_lua.bindClassMemberFunction<UIWidget>("setFixedSize", &UIWidget::setFixedSize);
g_lua.bindClassMemberFunction<UIWidget>("setClipping", &UIWidget::setClipping);
g_lua.bindClassMemberFunction<UIWidget>("setLastFocusReason", &UIWidget::setLastFocusReason);
g_lua.bindClassMemberFunction<UIWidget>("setAutoFocusPolicy", &UIWidget::setAutoFocusPolicy);
g_lua.bindClassMemberFunction<UIWidget>("setAutoRepeatDelay", &UIWidget::setAutoRepeatDelay);
g_lua.bindClassMemberFunction<UIWidget>("setVirtualOffset", &UIWidget::setVirtualOffset);
g_lua.bindClassMemberFunction<UIWidget>("isVisible", &UIWidget::isVisible);
g_lua.bindClassMemberFunction<UIWidget>("isChildLocked", &UIWidget::isChildLocked);
g_lua.bindClassMemberFunction<UIWidget>("hasChild", &UIWidget::hasChild);
g_lua.bindClassMemberFunction<UIWidget>("getChildIndex", &UIWidget::getChildIndex);
g_lua.bindClassMemberFunction<UIWidget>("getMarginRect", &UIWidget::getMarginRect);
g_lua.bindClassMemberFunction<UIWidget>("getPaddingRect", &UIWidget::getPaddingRect);
g_lua.bindClassMemberFunction<UIWidget>("getChildrenRect", &UIWidget::getChildrenRect);
g_lua.bindClassMemberFunction<UIWidget>("getAnchoredLayout", &UIWidget::getAnchoredLayout);
g_lua.bindClassMemberFunction<UIWidget>("getRootParent", &UIWidget::getRootParent);
g_lua.bindClassMemberFunction<UIWidget>("getChildAfter", &UIWidget::getChildAfter);
g_lua.bindClassMemberFunction<UIWidget>("getChildBefore", &UIWidget::getChildBefore);
g_lua.bindClassMemberFunction<UIWidget>("getChildById", &UIWidget::getChildById);
g_lua.bindClassMemberFunction<UIWidget>("getChildByPos", &UIWidget::getChildByPos);
g_lua.bindClassMemberFunction<UIWidget>("getChildByIndex", &UIWidget::getChildByIndex);
g_lua.bindClassMemberFunction<UIWidget>("recursiveGetChildById", &UIWidget::recursiveGetChildById);
g_lua.bindClassMemberFunction<UIWidget>("recursiveGetChildByPos", &UIWidget::recursiveGetChildByPos);
g_lua.bindClassMemberFunction<UIWidget>("recursiveGetChildren", &UIWidget::recursiveGetChildren);
g_lua.bindClassMemberFunction<UIWidget>("recursiveGetChildrenByPos", &UIWidget::recursiveGetChildrenByPos);
g_lua.bindClassMemberFunction<UIWidget>("recursiveGetChildrenByMarginPos", &UIWidget::recursiveGetChildrenByMarginPos);
g_lua.bindClassMemberFunction<UIWidget>("backwardsGetWidgetById", &UIWidget::backwardsGetWidgetById);
g_lua.bindClassMemberFunction<UIWidget>("resize", &UIWidget::resize);
g_lua.bindClassMemberFunction<UIWidget>("move", &UIWidget::move);
g_lua.bindClassMemberFunction<UIWidget>("rotate", &UIWidget::rotate);
g_lua.bindClassMemberFunction<UIWidget>("hide", &UIWidget::hide);
g_lua.bindClassMemberFunction<UIWidget>("show", &UIWidget::show);
g_lua.bindClassMemberFunction<UIWidget>("disable", &UIWidget::disable);
g_lua.bindClassMemberFunction<UIWidget>("enable", &UIWidget::enable);
g_lua.bindClassMemberFunction<UIWidget>("isActive", &UIWidget::isActive);
g_lua.bindClassMemberFunction<UIWidget>("isEnabled", &UIWidget::isEnabled);
g_lua.bindClassMemberFunction<UIWidget>("isDisabled", &UIWidget::isDisabled);
g_lua.bindClassMemberFunction<UIWidget>("isFocused", &UIWidget::isFocused);
g_lua.bindClassMemberFunction<UIWidget>("isHovered", &UIWidget::isHovered);
g_lua.bindClassMemberFunction<UIWidget>("isPressed", &UIWidget::isPressed);
g_lua.bindClassMemberFunction<UIWidget>("isFirst", &UIWidget::isFirst);
g_lua.bindClassMemberFunction<UIWidget>("isMiddle", &UIWidget::isMiddle);
g_lua.bindClassMemberFunction<UIWidget>("isLast", &UIWidget::isLast);
g_lua.bindClassMemberFunction<UIWidget>("isAlternate", &UIWidget::isAlternate);
g_lua.bindClassMemberFunction<UIWidget>("isChecked", &UIWidget::isChecked);
g_lua.bindClassMemberFunction<UIWidget>("isOn", &UIWidget::isOn);
g_lua.bindClassMemberFunction<UIWidget>("isDragging", &UIWidget::isDragging);
g_lua.bindClassMemberFunction<UIWidget>("isHidden", &UIWidget::isHidden);
g_lua.bindClassMemberFunction<UIWidget>("isExplicitlyEnabled", &UIWidget::isExplicitlyEnabled);
g_lua.bindClassMemberFunction<UIWidget>("isExplicitlyVisible", &UIWidget::isExplicitlyVisible);
g_lua.bindClassMemberFunction<UIWidget>("isFocusable", &UIWidget::isFocusable);
g_lua.bindClassMemberFunction<UIWidget>("isPhantom", &UIWidget::isPhantom);
g_lua.bindClassMemberFunction<UIWidget>("isDraggable", &UIWidget::isDraggable);
g_lua.bindClassMemberFunction<UIWidget>("isFixedSize", &UIWidget::isFixedSize);
g_lua.bindClassMemberFunction<UIWidget>("isClipping", &UIWidget::isClipping);
g_lua.bindClassMemberFunction<UIWidget>("isDestroyed", &UIWidget::isDestroyed);
g_lua.bindClassMemberFunction<UIWidget>("hasChildren", &UIWidget::hasChildren);
g_lua.bindClassMemberFunction<UIWidget>("containsMarginPoint", &UIWidget::containsMarginPoint);
g_lua.bindClassMemberFunction<UIWidget>("containsPaddingPoint", &UIWidget::containsPaddingPoint);
g_lua.bindClassMemberFunction<UIWidget>("containsPoint", &UIWidget::containsPoint);
g_lua.bindClassMemberFunction<UIWidget>("getId", &UIWidget::getId);
g_lua.bindClassMemberFunction<UIWidget>("getSource", &UIWidget::getSource);
g_lua.bindClassMemberFunction<UIWidget>("getParent", &UIWidget::getParent);
g_lua.bindClassMemberFunction<UIWidget>("getFocusedChild", &UIWidget::getFocusedChild);
g_lua.bindClassMemberFunction<UIWidget>("getChildren", &UIWidget::getChildren);
g_lua.bindClassMemberFunction<UIWidget>("getFirstChild", &UIWidget::getFirstChild);
g_lua.bindClassMemberFunction<UIWidget>("getLastChild", &UIWidget::getLastChild);
g_lua.bindClassMemberFunction<UIWidget>("getLayout", &UIWidget::getLayout);
g_lua.bindClassMemberFunction<UIWidget>("getStyle", &UIWidget::getStyle);
g_lua.bindClassMemberFunction<UIWidget>("getChildCount", &UIWidget::getChildCount);
g_lua.bindClassMemberFunction<UIWidget>("getLastFocusReason", &UIWidget::getLastFocusReason);
g_lua.bindClassMemberFunction<UIWidget>("getAutoFocusPolicy", &UIWidget::getAutoFocusPolicy);
g_lua.bindClassMemberFunction<UIWidget>("getAutoRepeatDelay", &UIWidget::getAutoRepeatDelay);
g_lua.bindClassMemberFunction<UIWidget>("getVirtualOffset", &UIWidget::getVirtualOffset);
g_lua.bindClassMemberFunction<UIWidget>("getStyleName", &UIWidget::getStyleName);
g_lua.bindClassMemberFunction<UIWidget>("getLastClickPosition", &UIWidget::getLastClickPosition);
g_lua.bindClassMemberFunction<UIWidget>("setX", &UIWidget::setX);
g_lua.bindClassMemberFunction<UIWidget>("setY", &UIWidget::setY);
g_lua.bindClassMemberFunction<UIWidget>("setWidth", &UIWidget::setWidth);
g_lua.bindClassMemberFunction<UIWidget>("setHeight", &UIWidget::setHeight);
g_lua.bindClassMemberFunction<UIWidget>("setSize", &UIWidget::setSize);
g_lua.bindClassMemberFunction<UIWidget>("setPosition", &UIWidget::setPosition);
g_lua.bindClassMemberFunction<UIWidget>("setColor", &UIWidget::setColor);
g_lua.bindClassMemberFunction<UIWidget>("setBackgroundColor", &UIWidget::setBackgroundColor);
g_lua.bindClassMemberFunction<UIWidget>("setBackgroundOffsetX", &UIWidget::setBackgroundOffsetX);
g_lua.bindClassMemberFunction<UIWidget>("setBackgroundOffsetY", &UIWidget::setBackgroundOffsetY);
g_lua.bindClassMemberFunction<UIWidget>("setBackgroundOffset", &UIWidget::setBackgroundOffset);
g_lua.bindClassMemberFunction<UIWidget>("setBackgroundWidth", &UIWidget::setBackgroundWidth);
g_lua.bindClassMemberFunction<UIWidget>("setBackgroundHeight", &UIWidget::setBackgroundHeight);
g_lua.bindClassMemberFunction<UIWidget>("setBackgroundSize", &UIWidget::setBackgroundSize);
g_lua.bindClassMemberFunction<UIWidget>("setBackgroundRect", &UIWidget::setBackgroundRect);
g_lua.bindClassMemberFunction<UIWidget>("setIcon", &UIWidget::setIcon);
g_lua.bindClassMemberFunction<UIWidget>("setIconColor", &UIWidget::setIconColor);
g_lua.bindClassMemberFunction<UIWidget>("setIconOffsetX", &UIWidget::setIconOffsetX);
g_lua.bindClassMemberFunction<UIWidget>("setIconOffsetY", &UIWidget::setIconOffsetY);
g_lua.bindClassMemberFunction<UIWidget>("setIconOffset", &UIWidget::setIconOffset);
g_lua.bindClassMemberFunction<UIWidget>("setIconWidth", &UIWidget::setIconWidth);
g_lua.bindClassMemberFunction<UIWidget>("setIconHeight", &UIWidget::setIconHeight);
g_lua.bindClassMemberFunction<UIWidget>("setIconSize", &UIWidget::setIconSize);
g_lua.bindClassMemberFunction<UIWidget>("setIconRect", &UIWidget::setIconRect);
g_lua.bindClassMemberFunction<UIWidget>("setIconClip", &UIWidget::setIconClip);
g_lua.bindClassMemberFunction<UIWidget>("setIconAlign", &UIWidget::setIconAlign);
g_lua.bindClassMemberFunction<UIWidget>("setBorderWidth", &UIWidget::setBorderWidth);
g_lua.bindClassMemberFunction<UIWidget>("setBorderWidthTop", &UIWidget::setBorderWidthTop);
g_lua.bindClassMemberFunction<UIWidget>("setBorderWidthRight", &UIWidget::setBorderWidthRight);
g_lua.bindClassMemberFunction<UIWidget>("setBorderWidthBottom", &UIWidget::setBorderWidthBottom);
g_lua.bindClassMemberFunction<UIWidget>("setBorderWidthLeft", &UIWidget::setBorderWidthLeft);
g_lua.bindClassMemberFunction<UIWidget>("setBorderColor", &UIWidget::setBorderColor);
g_lua.bindClassMemberFunction<UIWidget>("setBorderColorTop", &UIWidget::setBorderColorTop);
g_lua.bindClassMemberFunction<UIWidget>("setBorderColorRight", &UIWidget::setBorderColorRight);
g_lua.bindClassMemberFunction<UIWidget>("setBorderColorBottom", &UIWidget::setBorderColorBottom);
g_lua.bindClassMemberFunction<UIWidget>("setBorderColorLeft", &UIWidget::setBorderColorLeft);
g_lua.bindClassMemberFunction<UIWidget>("setMargin", &UIWidget::setMargin);
g_lua.bindClassMemberFunction<UIWidget>("setMarginHorizontal", &UIWidget::setMarginHorizontal);
g_lua.bindClassMemberFunction<UIWidget>("setMarginVertical", &UIWidget::setMarginVertical);
g_lua.bindClassMemberFunction<UIWidget>("setMarginTop", &UIWidget::setMarginTop);
g_lua.bindClassMemberFunction<UIWidget>("setMarginRight", &UIWidget::setMarginRight);
g_lua.bindClassMemberFunction<UIWidget>("setMarginBottom", &UIWidget::setMarginBottom);
g_lua.bindClassMemberFunction<UIWidget>("setMarginLeft", &UIWidget::setMarginLeft);
g_lua.bindClassMemberFunction<UIWidget>("setPadding", &UIWidget::setPadding);
g_lua.bindClassMemberFunction<UIWidget>("setPaddingHorizontal", &UIWidget::setPaddingHorizontal);
g_lua.bindClassMemberFunction<UIWidget>("setPaddingVertical", &UIWidget::setPaddingVertical);
g_lua.bindClassMemberFunction<UIWidget>("setPaddingTop", &UIWidget::setPaddingTop);
g_lua.bindClassMemberFunction<UIWidget>("setPaddingRight", &UIWidget::setPaddingRight);
g_lua.bindClassMemberFunction<UIWidget>("setPaddingBottom", &UIWidget::setPaddingBottom);
g_lua.bindClassMemberFunction<UIWidget>("setPaddingLeft", &UIWidget::setPaddingLeft);
g_lua.bindClassMemberFunction<UIWidget>("setOpacity", &UIWidget::setOpacity);
g_lua.bindClassMemberFunction<UIWidget>("setRotation", &UIWidget::setRotation);
g_lua.bindClassMemberFunction<UIWidget>("getX", &UIWidget::getX);
g_lua.bindClassMemberFunction<UIWidget>("getY", &UIWidget::getY);
g_lua.bindClassMemberFunction<UIWidget>("getPosition", &UIWidget::getPosition);
g_lua.bindClassMemberFunction<UIWidget>("getWidth", &UIWidget::getWidth);
g_lua.bindClassMemberFunction<UIWidget>("getHeight", &UIWidget::getHeight);
g_lua.bindClassMemberFunction<UIWidget>("getSize", &UIWidget::getSize);
g_lua.bindClassMemberFunction<UIWidget>("getRect", &UIWidget::getRect);
g_lua.bindClassMemberFunction<UIWidget>("getColor", &UIWidget::getColor);
g_lua.bindClassMemberFunction<UIWidget>("getBackgroundColor", &UIWidget::getBackgroundColor);
g_lua.bindClassMemberFunction<UIWidget>("getBackgroundOffsetX", &UIWidget::getBackgroundOffsetX);
g_lua.bindClassMemberFunction<UIWidget>("getBackgroundOffsetY", &UIWidget::getBackgroundOffsetY);
g_lua.bindClassMemberFunction<UIWidget>("getBackgroundOffset", &UIWidget::getBackgroundOffset);
g_lua.bindClassMemberFunction<UIWidget>("getBackgroundWidth", &UIWidget::getBackgroundWidth);
g_lua.bindClassMemberFunction<UIWidget>("getBackgroundHeight", &UIWidget::getBackgroundHeight);
g_lua.bindClassMemberFunction<UIWidget>("getBackgroundSize", &UIWidget::getBackgroundSize);
g_lua.bindClassMemberFunction<UIWidget>("getBackgroundRect", &UIWidget::getBackgroundRect);
g_lua.bindClassMemberFunction<UIWidget>("getIconColor", &UIWidget::getIconColor);
g_lua.bindClassMemberFunction<UIWidget>("getIconOffsetX", &UIWidget::getIconOffsetX);
g_lua.bindClassMemberFunction<UIWidget>("getIconOffsetY", &UIWidget::getIconOffsetY);
g_lua.bindClassMemberFunction<UIWidget>("getIconOffset", &UIWidget::getIconOffset);
g_lua.bindClassMemberFunction<UIWidget>("getIconWidth", &UIWidget::getIconWidth);
g_lua.bindClassMemberFunction<UIWidget>("getIconHeight", &UIWidget::getIconHeight);
g_lua.bindClassMemberFunction<UIWidget>("getIconSize", &UIWidget::getIconSize);
g_lua.bindClassMemberFunction<UIWidget>("getIconRect", &UIWidget::getIconRect);
g_lua.bindClassMemberFunction<UIWidget>("getIconClip", &UIWidget::getIconClip);
g_lua.bindClassMemberFunction<UIWidget>("getIconAlign", &UIWidget::getIconAlign);
g_lua.bindClassMemberFunction<UIWidget>("getBorderTopColor", &UIWidget::getBorderTopColor);
g_lua.bindClassMemberFunction<UIWidget>("getBorderRightColor", &UIWidget::getBorderRightColor);
g_lua.bindClassMemberFunction<UIWidget>("getBorderBottomColor", &UIWidget::getBorderBottomColor);
g_lua.bindClassMemberFunction<UIWidget>("getBorderLeftColor", &UIWidget::getBorderLeftColor);
g_lua.bindClassMemberFunction<UIWidget>("getBorderTopWidth", &UIWidget::getBorderTopWidth);
g_lua.bindClassMemberFunction<UIWidget>("getBorderRightWidth", &UIWidget::getBorderRightWidth);
g_lua.bindClassMemberFunction<UIWidget>("getBorderBottomWidth", &UIWidget::getBorderBottomWidth);
g_lua.bindClassMemberFunction<UIWidget>("getBorderLeftWidth", &UIWidget::getBorderLeftWidth);
g_lua.bindClassMemberFunction<UIWidget>("getMarginTop", &UIWidget::getMarginTop);
g_lua.bindClassMemberFunction<UIWidget>("getMarginRight", &UIWidget::getMarginRight);
g_lua.bindClassMemberFunction<UIWidget>("getMarginBottom", &UIWidget::getMarginBottom);
g_lua.bindClassMemberFunction<UIWidget>("getMarginLeft", &UIWidget::getMarginLeft);
g_lua.bindClassMemberFunction<UIWidget>("getPaddingTop", &UIWidget::getPaddingTop);
g_lua.bindClassMemberFunction<UIWidget>("getPaddingRight", &UIWidget::getPaddingRight);
g_lua.bindClassMemberFunction<UIWidget>("getPaddingBottom", &UIWidget::getPaddingBottom);
g_lua.bindClassMemberFunction<UIWidget>("getPaddingLeft", &UIWidget::getPaddingLeft);
g_lua.bindClassMemberFunction<UIWidget>("getOpacity", &UIWidget::getOpacity);
g_lua.bindClassMemberFunction<UIWidget>("getRotation", &UIWidget::getRotation);
g_lua.bindClassMemberFunction<UIWidget>("setQRCode", &UIWidget::setQRCode);
g_lua.bindClassMemberFunction<UIWidget>("setImageSource", &UIWidget::setImageSource);
g_lua.bindClassMemberFunction<UIWidget>("setImageSourceBase64", &UIWidget::setImageSourceBase64);
g_lua.bindClassMemberFunction<UIWidget>("setImageClip", &UIWidget::setImageClip);
g_lua.bindClassMemberFunction<UIWidget>("setImageOffsetX", &UIWidget::setImageOffsetX);
g_lua.bindClassMemberFunction<UIWidget>("setImageOffsetY", &UIWidget::setImageOffsetY);
g_lua.bindClassMemberFunction<UIWidget>("setImageOffset", &UIWidget::setImageOffset);
g_lua.bindClassMemberFunction<UIWidget>("setImageWidth", &UIWidget::setImageWidth);
g_lua.bindClassMemberFunction<UIWidget>("setImageHeight", &UIWidget::setImageHeight);
g_lua.bindClassMemberFunction<UIWidget>("setImageSize", &UIWidget::setImageSize);
g_lua.bindClassMemberFunction<UIWidget>("setImageRect", &UIWidget::setImageRect);
g_lua.bindClassMemberFunction<UIWidget>("setImageColor", &UIWidget::setImageColor);
g_lua.bindClassMemberFunction<UIWidget>("setImageFixedRatio", &UIWidget::setImageFixedRatio);
g_lua.bindClassMemberFunction<UIWidget>("setImageRepeated", &UIWidget::setImageRepeated);
g_lua.bindClassMemberFunction<UIWidget>("setImageSmooth", &UIWidget::setImageSmooth);
g_lua.bindClassMemberFunction<UIWidget>("setImageAutoResize", &UIWidget::setImageAutoResize);
g_lua.bindClassMemberFunction<UIWidget>("setImageBorderTop", &UIWidget::setImageBorderTop);
g_lua.bindClassMemberFunction<UIWidget>("setImageBorderRight", &UIWidget::setImageBorderRight);
g_lua.bindClassMemberFunction<UIWidget>("setImageBorderBottom", &UIWidget::setImageBorderBottom);
g_lua.bindClassMemberFunction<UIWidget>("setImageBorderLeft", &UIWidget::setImageBorderLeft);
g_lua.bindClassMemberFunction<UIWidget>("setImageBorder", &UIWidget::setImageBorder);
g_lua.bindClassMemberFunction<UIWidget>("getImageClip", &UIWidget::getImageClip);
g_lua.bindClassMemberFunction<UIWidget>("getImageOffsetX", &UIWidget::getImageOffsetX);
g_lua.bindClassMemberFunction<UIWidget>("getImageOffsetY", &UIWidget::getImageOffsetY);
g_lua.bindClassMemberFunction<UIWidget>("getImageOffset", &UIWidget::getImageOffset);
g_lua.bindClassMemberFunction<UIWidget>("getImageWidth", &UIWidget::getImageWidth);
g_lua.bindClassMemberFunction<UIWidget>("getImageHeight", &UIWidget::getImageHeight);
g_lua.bindClassMemberFunction<UIWidget>("getImageSize", &UIWidget::getImageSize);
g_lua.bindClassMemberFunction<UIWidget>("getImageRect", &UIWidget::getImageRect);
g_lua.bindClassMemberFunction<UIWidget>("getImageColor", &UIWidget::getImageColor);
g_lua.bindClassMemberFunction<UIWidget>("isImageFixedRatio", &UIWidget::isImageFixedRatio);
g_lua.bindClassMemberFunction<UIWidget>("isImageSmooth", &UIWidget::isImageSmooth);
g_lua.bindClassMemberFunction<UIWidget>("isImageAutoResize", &UIWidget::isImageAutoResize);
g_lua.bindClassMemberFunction<UIWidget>("getImageBorderTop", &UIWidget::getImageBorderTop);
g_lua.bindClassMemberFunction<UIWidget>("getImageBorderRight", &UIWidget::getImageBorderRight);
g_lua.bindClassMemberFunction<UIWidget>("getImageBorderBottom", &UIWidget::getImageBorderBottom);
g_lua.bindClassMemberFunction<UIWidget>("getImageBorderLeft", &UIWidget::getImageBorderLeft);
g_lua.bindClassMemberFunction<UIWidget>("getImageTextureWidth", &UIWidget::getImageTextureWidth);
g_lua.bindClassMemberFunction<UIWidget>("getImageTextureHeight", &UIWidget::getImageTextureHeight);
g_lua.bindClassMemberFunction<UIWidget>("resizeToText", &UIWidget::resizeToText);
g_lua.bindClassMemberFunction<UIWidget>("clearText", &UIWidget::clearText);
g_lua.bindClassMemberFunction<UIWidget>("setText", &UIWidget::setText);
g_lua.bindClassMemberFunction<UIWidget>("setTextAlign", &UIWidget::setTextAlign);
g_lua.bindClassMemberFunction<UIWidget>("setTextOffset", &UIWidget::setTextOffset);
g_lua.bindClassMemberFunction<UIWidget>("setTextWrap", &UIWidget::setTextWrap);
g_lua.bindClassMemberFunction<UIWidget>("setTextAutoResize", &UIWidget::setTextAutoResize);
g_lua.bindClassMemberFunction<UIWidget>("setTextVerticalAutoResize", &UIWidget::setTextVerticalAutoResize);
g_lua.bindClassMemberFunction<UIWidget>("setTextHorizontalAutoResize", &UIWidget::setTextHorizontalAutoResize);
g_lua.bindClassMemberFunction<UIWidget>("setFont", &UIWidget::setFont);
g_lua.bindClassMemberFunction<UIWidget>("getText", &UIWidget::getText);
g_lua.bindClassMemberFunction<UIWidget>("getDrawText", &UIWidget::getDrawText);
g_lua.bindClassMemberFunction<UIWidget>("getTextAlign", &UIWidget::getTextAlign);
g_lua.bindClassMemberFunction<UIWidget>("getTextOffset", &UIWidget::getTextOffset);
g_lua.bindClassMemberFunction<UIWidget>("getTextWrap", &UIWidget::getTextWrap);
g_lua.bindClassMemberFunction<UIWidget>("getFont", &UIWidget::getFont);
g_lua.bindClassMemberFunction<UIWidget>("getTextSize", &UIWidget::getTextSize);
g_lua.bindClassMemberFunction<UIWidget>("getUseCount", &UIWidget::getUseCount);
// UILayout
g_lua.registerClass<UILayout>();
g_lua.bindClassMemberFunction<UILayout>("update", &UILayout::update);
g_lua.bindClassMemberFunction<UILayout>("updateLater", &UILayout::updateLater);
g_lua.bindClassMemberFunction<UILayout>("applyStyle", &UILayout::applyStyle);
g_lua.bindClassMemberFunction<UILayout>("addWidget", &UILayout::addWidget);
g_lua.bindClassMemberFunction<UILayout>("removeWidget", &UILayout::removeWidget);
g_lua.bindClassMemberFunction<UILayout>("disableUpdates", &UILayout::disableUpdates);
g_lua.bindClassMemberFunction<UILayout>("enableUpdates", &UILayout::enableUpdates);
g_lua.bindClassMemberFunction<UILayout>("setParent", &UILayout::setParent);
g_lua.bindClassMemberFunction<UILayout>("getParentWidget", &UILayout::getParentWidget);
g_lua.bindClassMemberFunction<UILayout>("isUpdateDisabled", &UILayout::isUpdateDisabled);
g_lua.bindClassMemberFunction<UILayout>("isUpdating", &UILayout::isUpdating);
g_lua.bindClassMemberFunction<UILayout>("isUIAnchorLayout", &UILayout::isUIAnchorLayout);
g_lua.bindClassMemberFunction<UILayout>("isUIBoxLayout", &UILayout::isUIBoxLayout);
g_lua.bindClassMemberFunction<UILayout>("isUIHorizontalLayout", &UILayout::isUIHorizontalLayout);
g_lua.bindClassMemberFunction<UILayout>("isUIVerticalLayout", &UILayout::isUIVerticalLayout);
g_lua.bindClassMemberFunction<UILayout>("isUIGridLayout", &UILayout::isUIGridLayout);
// UIBoxLayout
g_lua.registerClass<UIBoxLayout, UILayout>();
g_lua.bindClassMemberFunction<UIBoxLayout>("setSpacing", &UIBoxLayout::setSpacing);
g_lua.bindClassMemberFunction<UIBoxLayout>("setFitChildren", &UIBoxLayout::setFitChildren);
// UIVerticalLayout
g_lua.registerClass<UIVerticalLayout, UIBoxLayout>();
g_lua.bindClassStaticFunction<UIVerticalLayout>("create", [](UIWidgetPtr parent){ return UIVerticalLayoutPtr(new UIVerticalLayout(parent)); } );
g_lua.bindClassMemberFunction<UIVerticalLayout>("setAlignBottom", &UIVerticalLayout::setAlignBottom);
g_lua.bindClassMemberFunction<UIVerticalLayout>("isAlignBottom", &UIVerticalLayout::isAlignBottom);
// UIHorizontalLayout
g_lua.registerClass<UIHorizontalLayout, UIBoxLayout>();
g_lua.bindClassStaticFunction<UIHorizontalLayout>("create", [](UIWidgetPtr parent){ return UIHorizontalLayoutPtr(new UIHorizontalLayout(parent)); } );
g_lua.bindClassMemberFunction<UIHorizontalLayout>("setAlignRight", &UIHorizontalLayout::setAlignRight);
// 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>("setFlow", &UIGridLayout::setFlow);
g_lua.bindClassMemberFunction<UIGridLayout>("setNumColumns", &UIGridLayout::setNumColumns);
g_lua.bindClassMemberFunction<UIGridLayout>("setNumLines", &UIGridLayout::setNumLines);
g_lua.bindClassMemberFunction<UIGridLayout>("getNumColumns", &UIGridLayout::getNumColumns);
g_lua.bindClassMemberFunction<UIGridLayout>("getNumLines", &UIGridLayout::getNumLines);
g_lua.bindClassMemberFunction<UIGridLayout>("getCellSize", &UIGridLayout::getCellSize);
g_lua.bindClassMemberFunction<UIGridLayout>("getCellSpacing", &UIGridLayout::getCellSpacing);
g_lua.bindClassMemberFunction<UIGridLayout>("isUIGridLayout", &UIGridLayout::isUIGridLayout);
// UIAnchorLayout
g_lua.registerClass<UIAnchorLayout, UILayout>();
g_lua.bindClassStaticFunction<UIAnchorLayout>("create", [](UIWidgetPtr parent){ return UIAnchorLayoutPtr(new UIAnchorLayout(parent)); } );
g_lua.bindClassMemberFunction<UIAnchorLayout>("removeAnchors", &UIAnchorLayout::removeAnchors);
g_lua.bindClassMemberFunction<UIAnchorLayout>("centerIn", &UIAnchorLayout::centerIn);
g_lua.bindClassMemberFunction<UIAnchorLayout>("fill", &UIAnchorLayout::fill);
// UITextEdit
g_lua.registerClass<UITextEdit, UIWidget>();
g_lua.bindClassStaticFunction<UITextEdit>("create", []{ return UITextEditPtr(new UITextEdit); } );
g_lua.bindClassMemberFunction<UITextEdit>("setCursorPos", &UITextEdit::setCursorPos);
g_lua.bindClassMemberFunction<UITextEdit>("setSelection", &UITextEdit::setSelection);
g_lua.bindClassMemberFunction<UITextEdit>("setCursorVisible", &UITextEdit::setCursorVisible);
g_lua.bindClassMemberFunction<UITextEdit>("setChangeCursorImage", &UITextEdit::setChangeCursorImage);
g_lua.bindClassMemberFunction<UITextEdit>("setTextHidden", &UITextEdit::setTextHidden);
g_lua.bindClassMemberFunction<UITextEdit>("setValidCharacters", &UITextEdit::setValidCharacters);
g_lua.bindClassMemberFunction<UITextEdit>("setShiftNavigation", &UITextEdit::setShiftNavigation);
g_lua.bindClassMemberFunction<UITextEdit>("setMultiline", &UITextEdit::setMultiline);
g_lua.bindClassMemberFunction<UITextEdit>("setEditable", &UITextEdit::setEditable);
g_lua.bindClassMemberFunction<UITextEdit>("setSelectable", &UITextEdit::setSelectable);
g_lua.bindClassMemberFunction<UITextEdit>("setSelectionColor", &UITextEdit::setSelectionColor);
g_lua.bindClassMemberFunction<UITextEdit>("setSelectionBackgroundColor", &UITextEdit::setSelectionBackgroundColor);
g_lua.bindClassMemberFunction<UITextEdit>("setMaxLength", &UITextEdit::setMaxLength);
g_lua.bindClassMemberFunction<UITextEdit>("setTextVirtualOffset", &UITextEdit::setTextVirtualOffset);
g_lua.bindClassMemberFunction<UITextEdit>("getTextVirtualOffset", &UITextEdit::getTextVirtualOffset);
g_lua.bindClassMemberFunction<UITextEdit>("getTextVirtualSize", &UITextEdit::getTextVirtualSize);
g_lua.bindClassMemberFunction<UITextEdit>("getTextTotalSize", &UITextEdit::getTextTotalSize);
g_lua.bindClassMemberFunction<UITextEdit>("moveCursorHorizontally", &UITextEdit::moveCursorHorizontally);
g_lua.bindClassMemberFunction<UITextEdit>("moveCursorVertically", &UITextEdit::moveCursorVertically);
g_lua.bindClassMemberFunction<UITextEdit>("appendText", &UITextEdit::appendText);
g_lua.bindClassMemberFunction<UITextEdit>("wrapText", &UITextEdit::wrapText);
g_lua.bindClassMemberFunction<UITextEdit>("removeCharacter", &UITextEdit::removeCharacter);
g_lua.bindClassMemberFunction<UITextEdit>("blinkCursor", &UITextEdit::blinkCursor);
g_lua.bindClassMemberFunction<UITextEdit>("del", &UITextEdit::del);
g_lua.bindClassMemberFunction<UITextEdit>("paste", &UITextEdit::paste);
g_lua.bindClassMemberFunction<UITextEdit>("copy", &UITextEdit::copy);
g_lua.bindClassMemberFunction<UITextEdit>("cut", &UITextEdit::cut);
g_lua.bindClassMemberFunction<UITextEdit>("selectAll", &UITextEdit::selectAll);
g_lua.bindClassMemberFunction<UITextEdit>("clearSelection", &UITextEdit::clearSelection);
g_lua.bindClassMemberFunction<UITextEdit>("getDisplayedText", &UITextEdit::getDisplayedText);
g_lua.bindClassMemberFunction<UITextEdit>("getSelection", &UITextEdit::getSelection);
g_lua.bindClassMemberFunction<UITextEdit>("getTextPos", &UITextEdit::getTextPos);
g_lua.bindClassMemberFunction<UITextEdit>("getCursorPos", &UITextEdit::getCursorPos);
g_lua.bindClassMemberFunction<UITextEdit>("getMaxLength", &UITextEdit::getMaxLength);
g_lua.bindClassMemberFunction<UITextEdit>("getSelectionStart", &UITextEdit::getSelectionStart);
g_lua.bindClassMemberFunction<UITextEdit>("getSelectionEnd", &UITextEdit::getSelectionEnd);
g_lua.bindClassMemberFunction<UITextEdit>("getSelectionColor", &UITextEdit::getSelectionColor);
g_lua.bindClassMemberFunction<UITextEdit>("getSelectionBackgroundColor", &UITextEdit::getSelectionBackgroundColor);
g_lua.bindClassMemberFunction<UITextEdit>("hasSelection", &UITextEdit::hasSelection);
g_lua.bindClassMemberFunction<UITextEdit>("isEditable", &UITextEdit::isEditable);
g_lua.bindClassMemberFunction<UITextEdit>("isSelectable", &UITextEdit::isSelectable);
g_lua.bindClassMemberFunction<UITextEdit>("isCursorVisible", &UITextEdit::isCursorVisible);
g_lua.bindClassMemberFunction<UITextEdit>("isChangingCursorImage", &UITextEdit::isChangingCursorImage);
g_lua.bindClassMemberFunction<UITextEdit>("isTextHidden", &UITextEdit::isTextHidden);
g_lua.bindClassMemberFunction<UITextEdit>("isShiftNavigation", &UITextEdit::isShiftNavigation);
g_lua.bindClassMemberFunction<UITextEdit>("isMultiline", &UITextEdit::isMultiline);
g_lua.registerClass<ShaderProgram>();
g_lua.registerClass<PainterShaderProgram>();
g_lua.bindClassMemberFunction<PainterShaderProgram>("addMultiTexture", &PainterShaderProgram::addMultiTexture);
// ParticleEffect
g_lua.registerClass<ParticleEffectType>();
g_lua.bindClassStaticFunction<ParticleEffectType>("create", []{ return ParticleEffectTypePtr(new ParticleEffectType); });
g_lua.bindClassMemberFunction<ParticleEffectType>("getName", &ParticleEffectType::getName);
g_lua.bindClassMemberFunction<ParticleEffectType>("getDescription", &ParticleEffectType::getDescription);
// UIParticles
g_lua.registerClass<UIParticles, UIWidget>();
g_lua.bindClassStaticFunction<UIParticles>("create", []{ return UIParticlesPtr(new UIParticles); } );
g_lua.bindClassMemberFunction<UIParticles>("addEffect", &UIParticles::addEffect);
#endif
#ifdef FW_NET
// Server
g_lua.registerClass<Server>();
g_lua.bindClassStaticFunction<Server>("create", &Server::create);
g_lua.bindClassMemberFunction<Server>("close", &Server::close);
g_lua.bindClassMemberFunction<Server>("isOpen", &Server::isOpen);
g_lua.bindClassMemberFunction<Server>("acceptNext", &Server::acceptNext);
// Connection
g_lua.registerClass<Connection>();
g_lua.bindClassMemberFunction<Connection>("getIp", &Connection::getIp);
// Protocol
g_lua.registerClass<Protocol>();
g_lua.bindClassStaticFunction<Protocol>("create", []{ return ProtocolPtr(new Protocol); });
g_lua.bindClassMemberFunction<Protocol>("connect", &Protocol::connect);
g_lua.bindClassMemberFunction<Protocol>("disconnect", &Protocol::disconnect);
g_lua.bindClassMemberFunction<Protocol>("isConnected", &Protocol::isConnected);
g_lua.bindClassMemberFunction<Protocol>("isConnecting", &Protocol::isConnecting);
g_lua.bindClassMemberFunction<Protocol>("getConnection", &Protocol::getConnection);
g_lua.bindClassMemberFunction<Protocol>("setConnection", &Protocol::setConnection);
g_lua.bindClassMemberFunction<Protocol>("send", &Protocol::send);
g_lua.bindClassMemberFunction<Protocol>("recv", &Protocol::recv);
g_lua.bindClassMemberFunction<Protocol>("setXteaKey", &Protocol::setXteaKey);
g_lua.bindClassMemberFunction<Protocol>("getXteaKey", &Protocol::getXteaKey);
g_lua.bindClassMemberFunction<Protocol>("generateXteaKey", &Protocol::generateXteaKey);
g_lua.bindClassMemberFunction<Protocol>("enableXteaEncryption", &Protocol::enableXteaEncryption);
g_lua.bindClassMemberFunction<Protocol>("enableChecksum", &Protocol::enableChecksum);
// InputMessage
g_lua.registerClass<InputMessage>();
g_lua.bindClassStaticFunction<InputMessage>("create", []{ return InputMessagePtr(new InputMessage); });
g_lua.bindClassMemberFunction<InputMessage>("setBuffer", &InputMessage::setBuffer);
g_lua.bindClassMemberFunction<InputMessage>("getBuffer", &InputMessage::getBuffer);
g_lua.bindClassMemberFunction<InputMessage>("skipBytes", &InputMessage::skipBytes);
g_lua.bindClassMemberFunction<InputMessage>("getU8", &InputMessage::getU8);
g_lua.bindClassMemberFunction<InputMessage>("getU16", &InputMessage::getU16);
g_lua.bindClassMemberFunction<InputMessage>("getU32", &InputMessage::getU32);
g_lua.bindClassMemberFunction<InputMessage>("getU64", &InputMessage::getU64);
g_lua.bindClassMemberFunction<InputMessage>("getString", &InputMessage::getString);
g_lua.bindClassMemberFunction<InputMessage>("peekU8", &InputMessage::peekU8);
g_lua.bindClassMemberFunction<InputMessage>("peekU16", &InputMessage::peekU16);
g_lua.bindClassMemberFunction<InputMessage>("peekU32", &InputMessage::peekU32);
g_lua.bindClassMemberFunction<InputMessage>("peekU64", &InputMessage::peekU64);
g_lua.bindClassMemberFunction<InputMessage>("decryptRsa", &InputMessage::decryptRsa);
g_lua.bindClassMemberFunction<InputMessage>("getReadSize", &InputMessage::getReadSize);
g_lua.bindClassMemberFunction<InputMessage>("getUnreadSize", &InputMessage::getUnreadSize);
g_lua.bindClassMemberFunction<InputMessage>("getMessageSize", &InputMessage::getMessageSize);
g_lua.bindClassMemberFunction<InputMessage>("eof", &InputMessage::eof);
// OutputMessage
g_lua.registerClass<OutputMessage>();
g_lua.bindClassStaticFunction<OutputMessage>("create", []{ return OutputMessagePtr(new OutputMessage); });
g_lua.bindClassMemberFunction<OutputMessage>("setBuffer", &OutputMessage::setBuffer);
g_lua.bindClassMemberFunction<OutputMessage>("getBuffer", &OutputMessage::getBuffer);
g_lua.bindClassMemberFunction<OutputMessage>("reset", &OutputMessage::reset);
g_lua.bindClassMemberFunction<OutputMessage>("addU8", &OutputMessage::addU8);
g_lua.bindClassMemberFunction<OutputMessage>("addU16", &OutputMessage::addU16);
g_lua.bindClassMemberFunction<OutputMessage>("addU32", &OutputMessage::addU32);
g_lua.bindClassMemberFunction<OutputMessage>("addU64", &OutputMessage::addU64);
g_lua.bindClassMemberFunction<OutputMessage>("addString", &OutputMessage::addString);
g_lua.bindClassMemberFunction<OutputMessage>("addPaddingBytes", &OutputMessage::addPaddingBytes);
g_lua.bindClassMemberFunction<OutputMessage>("encryptRsa", &OutputMessage::encryptRsa);
g_lua.bindClassMemberFunction<OutputMessage>("getMessageSize", &OutputMessage::getMessageSize);
g_lua.bindClassMemberFunction<OutputMessage>("setMessageSize", &OutputMessage::setMessageSize);
g_lua.bindClassMemberFunction<OutputMessage>("getWritePos", &OutputMessage::getWritePos);
g_lua.bindClassMemberFunction<OutputMessage>("setWritePos", &OutputMessage::setWritePos);
#ifdef FW_PROXY
g_lua.registerSingletonClass("g_proxy");
g_lua.bindSingletonFunction("g_proxy", "addProxy", &ProxyManager::addProxy, &g_proxy);
g_lua.bindSingletonFunction("g_proxy", "removeProxy", &ProxyManager::removeProxy, &g_proxy);
g_lua.bindSingletonFunction("g_proxy", "clear", &ProxyManager::clear, &g_proxy);
g_lua.bindSingletonFunction("g_proxy", "setMaxActiveProxies", &ProxyManager::setMaxActiveProxies, &g_proxy);
g_lua.bindSingletonFunction("g_proxy", "getProxies", &ProxyManager::getProxies, &g_proxy);
g_lua.bindSingletonFunction("g_proxy", "getProxiesDebugInfo", &ProxyManager::getProxiesDebugInfo, &g_proxy);
g_lua.bindSingletonFunction("g_proxy", "getPing", &ProxyManager::getPing, &g_proxy);
#endif
#endif
#ifdef FW_SOUND
// SoundManager
g_lua.registerSingletonClass("g_sounds");
g_lua.bindSingletonFunction("g_sounds", "preload", &SoundManager::preload, &g_sounds);
g_lua.bindSingletonFunction("g_sounds", "play", &SoundManager::play, &g_sounds);
g_lua.bindSingletonFunction("g_sounds", "getChannel", &SoundManager::getChannel, &g_sounds);
g_lua.bindSingletonFunction("g_sounds", "stopAll", &SoundManager::stopAll, &g_sounds);
g_lua.bindSingletonFunction("g_sounds", "enableAudio", &SoundManager::enableAudio, &g_sounds);
g_lua.bindSingletonFunction("g_sounds", "disableAudio", &SoundManager::disableAudio, &g_sounds);
g_lua.bindSingletonFunction("g_sounds", "setAudioEnabled", &SoundManager::setAudioEnabled, &g_sounds);
g_lua.bindSingletonFunction("g_sounds", "isAudioEnabled", &SoundManager::isAudioEnabled, &g_sounds);
g_lua.registerClass<SoundSource>();
g_lua.registerClass<CombinedSoundSource, SoundSource>();
g_lua.registerClass<StreamSoundSource, SoundSource>();
g_lua.registerClass<SoundChannel>();
g_lua.bindClassMemberFunction<SoundChannel>("play", &SoundChannel::play);
g_lua.bindClassMemberFunction<SoundChannel>("stop", &SoundChannel::stop);
g_lua.bindClassMemberFunction<SoundChannel>("enqueue", &SoundChannel::enqueue);
g_lua.bindClassMemberFunction<SoundChannel>("enable", &SoundChannel::enable);
g_lua.bindClassMemberFunction<SoundChannel>("disable", &SoundChannel::disable);
g_lua.bindClassMemberFunction<SoundChannel>("setGain", &SoundChannel::setGain);
g_lua.bindClassMemberFunction<SoundChannel>("getGain", &SoundChannel::getGain);
g_lua.bindClassMemberFunction<SoundChannel>("setEnabled", &SoundChannel::setEnabled);
g_lua.bindClassMemberFunction<SoundChannel>("isEnabled", &SoundChannel::isEnabled);
g_lua.bindClassMemberFunction<SoundChannel>("getId", &SoundChannel::getId);
#endif
#ifdef FW_SQL
// Database
g_lua.registerClass<Database>();
g_lua.bindClassMemberFunction<Database>("getDatabaseEngine", &Database::getDatabaseEngine);
g_lua.bindClassMemberFunction<Database>("isConnected", &Database::isConnected);
g_lua.bindClassMemberFunction<Database>("getStringComparer", &Database::getStringComparer);
g_lua.bindClassMemberFunction<Database>("getUpdateLimiter", &Database::getUpdateLimiter);
g_lua.bindClassMemberFunction<Database>("getLastInsertedRowID", &Database::getLastInsertedRowID);
g_lua.bindClassMemberFunction<Database>("escapeString", &Database::escapeString);
//g_lua.bindClassMemberFunction<Database>("escapeBlob", &Database::escapeBlob); // need to write a cast for this type to work (if needed)
// DBQuery
/* (not sure if this class will work as a luafunction)
g_lua.registerClass<DBQuery>();
g_lua.bindClassStaticFunction<DBQuery>("create", []{ return DBQuery(); });
g_lua.bindClassMemberFunction<DBQuery>("append", &DBQuery::append);
g_lua.bindClassMemberFunction<DBQuery>("set", &DBQuery::set);
*/
// DBResult
g_lua.registerClass<DBResult>();
g_lua.bindClassMemberFunction<DBResult>("getDataInt", &DBResult::getDataInt);
g_lua.bindClassMemberFunction<DBResult>("getDataLong", &DBResult::getDataLong);
g_lua.bindClassMemberFunction<DBResult>("getDataString", &DBResult::getDataString);
//g_lua.bindClassMemberFunction<DBResult>("getDataStream", &DBResult::getDataStream); // need to write a cast for this type to work (if needed)
g_lua.bindClassMemberFunction<DBResult>("getRowCount", &DBResult::getRowCount);
g_lua.bindClassMemberFunction<DBResult>("free", &DBResult::free);
g_lua.bindClassMemberFunction<DBResult>("next", &DBResult::next);
// MySQL
g_lua.registerClass<DatabaseMySQL, Database>();
g_lua.bindClassStaticFunction<DatabaseMySQL>("create", []{ return DatabaseMySQLPtr(new DatabaseMySQL); });
g_lua.bindClassMemberFunction<DatabaseMySQL>("connect", &DatabaseMySQL::connect);
g_lua.bindClassMemberFunction<DatabaseMySQL>("beginTransaction", &DatabaseMySQL::beginTransaction);
g_lua.bindClassMemberFunction<DatabaseMySQL>("rollback", &DatabaseMySQL::rollback);
g_lua.bindClassMemberFunction<DatabaseMySQL>("commit", &DatabaseMySQL::commit);
g_lua.bindClassMemberFunction<DatabaseMySQL>("executeQuery", &DatabaseMySQL::executeQuery);
g_lua.bindClassMemberFunction<DatabaseMySQL>("storeQuery", &DatabaseMySQL::storeQuery);
// MySQLResult
g_lua.registerClass<MySQLResult>();
g_lua.bindClassMemberFunction<MySQLResult>("getDataInt", &MySQLResult::getDataInt);
g_lua.bindClassMemberFunction<MySQLResult>("getDataLong", &MySQLResult::getDataLong);
g_lua.bindClassMemberFunction<MySQLResult>("getDataString", &MySQLResult::getDataString);
//g_lua.bindClassMemberFunction<MySQLResult>("getDataStream", &MySQLResult::getDataStream); // need to write a cast for this type to work (if needed)
g_lua.bindClassMemberFunction<MySQLResult>("getRowCount", &MySQLResult::getRowCount);
g_lua.bindClassMemberFunction<MySQLResult>("free", &MySQLResult::free);
g_lua.bindClassMemberFunction<MySQLResult>("next", &MySQLResult::next);
#endif
}

View File

@ -19,6 +19,5 @@ Module
- client_entergamev2 - client_entergamev2
- client_terminal - client_terminal
- client_stats - client_stats
- client_news
- client_feedback - client_feedback
- client_updater - client_updater

View File

@ -15,7 +15,7 @@ local serverSelector
local clientVersionSelector local clientVersionSelector
local serverHostTextEdit local serverHostTextEdit
local rememberPasswordBox local rememberPasswordBox
local protos = {"740", "760", "772", "792", "800", "810", "854", "860", "1077", "1090", "1096", "1098", "1099", "1100"} local protos = {"740", "760", "772", "792", "800", "810", "854", "860", "961", "1077", "1090", "1096", "1098", "1099", "1100"}
-- private functions -- private functions
local function onProtocolError(protocol, message, errorCode) local function onProtocolError(protocol, message, errorCode)
@ -247,7 +247,7 @@ function EnterGame.init()
end end
function EnterGame.terminate() function EnterGame.terminate()
if USE_NEW_ENERGAME then return end if not enterGame then return end
g_keyboard.unbindKeyDown('Ctrl+G') g_keyboard.unbindKeyDown('Ctrl+G')
enterGame:destroy() enterGame:destroy()
@ -263,6 +263,7 @@ function EnterGame.terminate()
end end
function EnterGame.show() function EnterGame.show()
if not enterGame then return end
if Updater and Updater.isVisible() or g_game.isOnline() then if Updater and Updater.isVisible() or g_game.isOnline() then
return EnterGame.hide() return EnterGame.hide()
end end
@ -273,6 +274,7 @@ function EnterGame.show()
end end
function EnterGame.hide() function EnterGame.hide()
if not enterGame then return end
enterGame:hide() enterGame:hide()
end end

View File

@ -1,5 +1,72 @@
local entergameWindow
local characterGroup
function init() function init()
if not USE_NEW_ENERGAME then return end
entergameWindow = g_ui.displayUI('entergamev2')
--entergameWindow.news:hide()
--entergameWindow.quick:hide()
entergameWindow.registration:hide()
entergameWindow.characters:hide()
entergameWindow.createcharacter:hide()
-- entergame
entergameWindow.entergame.register.onClick = function()
entergameWindow.registration:show()
entergameWindow.entergame:hide()
end
entergameWindow.entergame.mainPanel.button.onClick = function()
entergameWindow.entergame:hide()
entergameWindow.characters:show()
g_game.setClientVersion(1099) -- for tests
end
-- registration
entergameWindow.registration.back.onClick = function()
entergameWindow.registration:hide()
entergameWindow.entergame:show()
end
-- characters
entergameWindow.characters.logout.onClick = function()
entergameWindow.characters:hide()
entergameWindow.entergame:show()
end
entergameWindow.characters.createcharacter.onClick = function()
entergameWindow.characters:hide()
entergameWindow.createcharacter:show()
end
entergameWindow.characters.mainPanel.autoReconnect.onClick = function()
entergameWindow.characters.mainPanel.autoReconnect:setOn(not entergameWindow.characters.mainPanel.autoReconnect:isOn())
end
-- create character
entergameWindow.createcharacter.back.onClick = function()
entergameWindow.createcharacter:hide()
entergameWindow.characters:show()
end
-- tests
characterGroup = UIRadioGroup.create()
for i=1,20 do
local character = g_ui.createWidget('EntergameCharacter', entergameWindow.characters.mainPanel.charactersPanel)
characterGroup:addWidget(character)
character.outfit:setOutfit({feet=10,legs=10,body=176,type=129,auxType=0,addons=3,head=48})
end
characterGroup:selectWidget(entergameWindow.characters.mainPanel.charactersPanel:getFirstChild())
characterGroup:getSelectedWidget()
for i=1,100 do
local l = g_ui.createWidget("NewsLabel", entergameWindow.news.content)
l:setText("test xxx ssss eeee uu u llel " .. i)
end
end end
function terminate() function terminate()
if not USE_NEW_ENERGAME then return end
entergameWindow:destroy()
if characterGroup then
characterGroup:destroy()
end
end end

View File

@ -0,0 +1,587 @@
EnterGamePanel < Panel
font: verdana-11px-antialised
color: #dfdfdf
text-offset: 0 6
text-align: top
image-source: /images/ui/window
image-border: 6
image-border-top: 27
padding-top: 28
padding-left: 8
padding-right: 8
padding-bottom: 8
News < EnterGamePanel
id: news
anchors.left: parent.left
anchors.top: parent.top
anchors.bottom: parent.bottom
width: 230
!text: tr("News")
ScrollablePanel
id: content
anchors.fill: parent
margin-right: 8
margin-left: 1
margin-bottom: 5
vertical-scrollbar: newsPanelScroll
layout:
type: verticalBox
SmallScrollBar
id: newsPanelScroll
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.right: parent.right
NewsLabel < Label
text-wrap: true
text-auto-resize: true
text-align: center
font: terminus-14px-bold
NewsText < Label
text-wrap: true
text-auto-resize: true
text-align: left
margin-bottom: 10
NewsImage < Label
text-wrap: true
margin-bottom: 5
text-align: center
EnterGame < Panel
anchors.fill: parent
id: entergame
EnterGamePanel
id: mainPanel
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
size: 250 210
!text: tr("Enter Game")
padding-top: 36
padding-left: 16
padding-right: 16
padding-bottom: 16
MenuLabel
!text: tr('Account name')
anchors.left: parent.left
anchors.top: parent.top
text-auto-resize: true
TextEdit
id: account
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 2
MenuLabel
!text: tr('Password')
anchors.left: prev.left
anchors.top: prev.bottom
margin-top: 8
text-auto-resize: true
PasswordTextEdit
id: password
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 2
HorizontalSeparator
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 10
CheckBox
id: rememberPasswordBox
!text: tr('Remember password')
!tooltip: tr('Remember account and password when starts client')
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 9
HorizontalSeparator
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 9
Button
id: button
!text: tr('Login')
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 10
margin-left: 50
margin-right: 50
EnterGamePanel
id: buttons
anchors.horizontalCenter: prev.horizontalCenter
anchors.top: prev.bottom
margin-top: 20
size: 200 50
image-source: /images/ui/window_headless
image-border: 6
padding-top: 8
Button
id: register
anchors.verticalCenter: buttons.verticalCenter
anchors.horizontalCenter: buttons.horizontalCenter
!text: tr("Create account")
size: 160 30
Registration < Panel
anchors.fill: parent
id: registration
EnterGamePanel
id: mainPanel
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
size: 250 262
!text: tr("Create Acoount")
padding-top: 36
padding-left: 16
padding-right: 16
padding-bottom: 16
MenuLabel
!text: tr('Account name')
anchors.left: parent.left
anchors.top: parent.top
text-auto-resize: true
TextEdit
id: accountNameTextEdit
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 2
MenuLabel
!text: tr('Email')
anchors.left: prev.left
anchors.top: prev.bottom
margin-top: 8
text-auto-resize: true
TextEdit
id: emailTextEdit
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 2
MenuLabel
!text: tr('Password')
anchors.left: prev.left
anchors.top: prev.bottom
margin-top: 8
text-auto-resize: true
PasswordTextEdit
id: accountPasswordTextEdit
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 2
MenuLabel
!text: tr('Password confirmation')
anchors.left: prev.left
anchors.top: prev.bottom
margin-top: 8
text-auto-resize: true
PasswordTextEdit
id: accountPasswordTextEdit
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 2
HorizontalSeparator
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 9
Button
!text: tr('Create account')
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 10
margin-left: 50
margin-right: 50
@onClick: EnterGame.doLogin()
EnterGamePanel
id: buttons
anchors.horizontalCenter: prev.horizontalCenter
anchors.top: prev.bottom
margin-top: 20
size: 200 50
image-source: /images/ui/window_headless
image-border: 6
padding-top: 8
Button
id: back
anchors.verticalCenter: buttons.verticalCenter
anchors.horizontalCenter: buttons.horizontalCenter
!text: tr("Back")
size: 160 30
QuickLogin < EnterGamePanel
id: quick
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
size: 230 312
!text: tr("Quick Login & Registration")
UIButton
id: qrcode
width: 200
height: 200
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
image-fixed-ratio: true
image-smooth: false
margin-top: 5
qr: 123
UIButton
id: quathlogo
width: 66
height: 40
anchors.verticalCenter: prev.verticalCenter
anchors.horizontalCenter: prev.horizontalCenter
image-fixed-ratio: true
image-smooth: false
image-source: /images/ui/qauth
Label
anchors.top: qrcode.bottom
anchors.left: qrcode.left
anchors.right: qrcode.right
text-align: center
text-auto-resize: true
!text: tr("Scan or click QR code\nto register or login")
height: 40
margin-top: 10
margin-bottom: 5
Button
anchors.top: prev.bottom
anchors.left: parent.left
anchors.right: parent.right
text-align: center
!text: tr("Click to get PC/Android/iOS app")
height: 23
margin-top: 10
margin-left: 5
margin-right: 5
color: #FFFFFF
@onClick: g_platform.openUrl("http://qauth.co")
Characters < Panel
id: characters
anchors.fill: parent
EnterGamePanel
id: mainPanel
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
size: 550 350
!text: tr("Characters")
padding-top: 36
padding-left: 16
padding-right: 16
padding-bottom: 16
Label
id: motd
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
text-auto-resize: true
text-wrap: true
text: This is motd ;)
text-align: center
HorizontalSeparator
id: motdSeparator
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 5
height: 10
ScrollablePanel
id: charactersPanel
layout:
type: grid
cell-size: 100 100
cell-spacing: 1
flow: true
vertical-scrollbar: charactersScroll
anchors.top: prev.bottom
anchors.bottom: bottomSeparator.top
anchors.left: parent.left
anchors.right: parent.right
margin-bottom: 10
margin-right: 12
VerticalScrollBar
id: charactersScroll
anchors.top: charactersPanel.top
anchors.bottom: charactersPanel.bottom
anchors.left: charactersPanel.right
step: 14
pixels-scroll: true
HorizontalSeparator
id: bottomSeparator
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
height: 35
Button
id: autoReconnect
!text: tr('Auto reconnect: On')
width: 140
anchors.left: parent.left
anchors.bottom: parent.bottom
image-color: green
$!on:
image-color: red
!text: tr('Auto reconnect: Off')
Button
id: createCharacter
anchors.right: parent.right
anchors.bottom: parent.bottom
!text: tr("Connect")
width: 140
EnterGamePanel
id: buttons
anchors.horizontalCenter: prev.horizontalCenter
anchors.top: prev.bottom
margin-top: 20
size: 450 50
image-source: /images/ui/window_headless
image-border: 6
padding-top: 8
Button
id: createcharacter
anchors.verticalCenter: buttons.verticalCenter
anchors.left: buttons.left
!text: tr("Create character")
margin-left: 10
size: 140 30
Button
id: casts
anchors.verticalCenter: buttons.verticalCenter
anchors.horizontalCenter: buttons.horizontalCenter
!text: tr("Casts")
size: 140 30
Button
id: logout
anchors.verticalCenter: buttons.verticalCenter
anchors.right: buttons.right
margin-right: 10
!text: tr("Logout")
size: 140 30
EntergameCharacter < UIButton
border-width: 1
padding: 1 1 1 1
@onClick: self:setChecked(true)
$checked:
border-color: #ffffff
$!checked:
border-color: black
UICreature
id: outfit
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
size: 48 48
margin-bottom: 3
phantom: true
Label
id: line1
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
text: Dagusia Druid
text-align: center
text-wrap: false
height: 16
font: terminus-10px
border-width-bottom: 1
border-color: #00000077
Label
id: line2
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
text: Level: 666
text-align: center
text-wrap: false
height: 16
font: terminus-10px
border-width-bottom: 1
border-color: #00000077
Label
id: line3
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
text: World: nemezis
text-align: center
text-wrap: false
height: 16
font: terminus-10px
border-width-bottom: 1
border-color: #00000077
CreateCharacter < Panel
anchors.fill: parent
id: createcharacter
EnterGamePanel
id: mainPanel
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
size: 250 262
!text: tr("Create Character")
padding-top: 36
padding-left: 16
padding-right: 16
padding-bottom: 16
MenuLabel
!text: tr('Name')
anchors.left: parent.left
anchors.top: parent.top
text-auto-resize: true
TextEdit
id: accountNameTextEdit
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 2
MenuLabel
!text: tr('Vocation')
anchors.left: prev.left
anchors.top: prev.bottom
margin-top: 8
text-auto-resize: true
TextEdit
id: emailTextEdit
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 2
MenuLabel
!text: tr('Password')
anchors.left: prev.left
anchors.top: prev.bottom
margin-top: 8
text-auto-resize: true
PasswordTextEdit
id: accountPasswordTextEdit
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 2
MenuLabel
!text: tr('Password confirmation')
anchors.left: prev.left
anchors.top: prev.bottom
margin-top: 8
text-auto-resize: true
PasswordTextEdit
id: accountPasswordTextEdit
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 2
HorizontalSeparator
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 9
Button
!text: tr('Create character')
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
margin-top: 10
margin-left: 50
margin-right: 50
@onClick: EnterGame.doLogin()
EnterGamePanel
id: buttons
anchors.horizontalCenter: prev.horizontalCenter
anchors.top: prev.bottom
margin-top: 20
size: 200 50
image-source: /images/ui/window_headless
image-border: 6
padding-top: 8
Button
id: back
anchors.verticalCenter: buttons.verticalCenter
anchors.horizontalCenter: buttons.horizontalCenter
!text: tr("Back")
size: 160 30
Panel
anchors.top: topMenu.bottom
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
margin: 10 10 10 10
News
QuickLogin
EnterGame
Registration
Characters
CreateCharacter

View File

@ -1,119 +0,0 @@
-- private variables
local news
local newsPanel
local updateNewsEvent = nil
local ongoingNewsUpdate = false
local lastNewsUpdate = 0
local newsUpdateInterval = 30 -- seconds
-- public functions
function init()
news = g_ui.displayUI('news')
newsPanel = news:recursiveGetChildById('newsPanel')
connect(rootWidget, { onGeometryChange = updateSize })
connect(g_game, { onGameStart = hide, onGameEnd = show })
if g_game.isOnline() then
hide()
else
show()
end
end
function terminate()
disconnect(rootWidget, { onGeometryChange = updateSize })
disconnect(g_game, { onGameStart = hide, onGameEnd = show })
removeEvent(updateNewsEvent)
clearNews()
news:destroy()
news = nil
end
function hide()
news:hide()
end
function show()
news:show()
updateSize()
updateNews()
end
function updateSize()
if Services.news == nil or Services.news:len() < 4 or g_game.isOnline() then
return
end
if rootWidget:getWidth() < 790 and news:isVisible() then
hide()
elseif news:isHidden() then
show()
end
news:setWidth(math.min(math.max(250, rootWidget:getWidth() / 4), 300))
end
function updateNews()
if Services.news == nil or Services.news:len() < 4 then
hide()
return
end
if ongoingNewsUpdate or os.time() < lastNewsUpdate + newsUpdateInterval then
return
end
HTTP.getJSON(Services.news .. "?lang=" .. modules.client_locales.getCurrentLocale().name, onGotNews)
ongoingNewsUpdate = true
lastNewsUpdate = os.time()
end
function clearNews()
while newsPanel:getChildCount() > 0 do
local child = newsPanel:getLastChild()
newsPanel:destroyChildren(child)
end
end
function onGotNews(data, err)
ongoingNewsUpdate = false
if err then
return gotNewsError("Error:\n" .. err)
end
clearNews()
for i, news in pairs(data) do
local title = news["title"]
local text = news["text"]
local image = news["image"]
if title ~= nil then
newsLabel = g_ui.createWidget('NewsLabel', newsPanel)
newsLabel:setText(title)
end
if text ~= nil then
newsText = g_ui.createWidget('NewsText', newsPanel)
newsText:setText(text)
end
if image ~= nil then
newsImage = g_ui.createWidget('NewsImage', newsPanel)
newsImage:setId(imageName)
newsImage:setImageSourceBase64(image)
newsImage:setImageFixedRatio(true)
newsImage:setImageAutoResize(false)
newsImage:setHeight(200)
end
end
end
function gotNewsError(err)
updateNewsEvent = scheduleEvent(function()
updateNews()
end, 3000)
clearNews()
errorLabel = g_ui.createWidget('NewsLabel', newsPanel)
errorLabel:setText(tr("Error"))
errorInfo = g_ui.createWidget('NewsText', newsPanel)
errorInfo:setText(err)
ongoingNewsUpdate = true
end

View File

@ -1,10 +0,0 @@
Module
name: client_news
description: News
author: otclient.ovh
website: http://otclient.ovh
sandboxed: true
scripts: [ news ]
dependencies: [ client_topmenu ]
@onLoad: init()
@onUnload: terminate()

View File

@ -1,47 +0,0 @@
NewsLabel < Label
text-wrap: false
text-auto-resize: true
text-align: center
font: terminus-14px-bold
NewsText < Label
text-wrap: true
text-auto-resize: true
text-align: left
margin-bottom: 10
NewsImage < Label
text-wrap: true
margin-bottom: 5
text-align: center
StaticWindow
anchors.left: parent.left
anchors.top: topMenu.bottom
anchors.bottom: parent.bottom
margin-top: 10
margin-left: 20
margin-bottom: 10
id: newsPanelHolder
width: 300
!text: tr('News')
ScrollablePanel
id: newsPanel
layout:
type: verticalBox
vertical-scrollbar: newsScroll
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
padding-right: 10
margin-right: 10
VerticalScrollBar
id: newsScroll
anchors.top: newsPanel.top
anchors.bottom: newsPanel.bottom
anchors.left: newsPanel.right
step: 14
pixels-scroll: true

View File

@ -62,7 +62,7 @@ Panel
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
margin-top: 3 margin-top: 3
minimum: 0 minimum: 50
maximum: 300 maximum: 300
Label Label

View File

@ -3,6 +3,18 @@ Panel
id: classicView id: classicView
!text: tr('Classic view') !text: tr('Classic view')
OptionCheckBox
id: cacheMap
!text: tr('Cache map (for non-classic view)')
OptionCheckBox
id: actionBar1
!text: tr("Show first action bar")
OptionCheckBox
id: actionBar2
!text: tr("Show second action bar")
OptionCheckBox OptionCheckBox
id: showPing id: showPing
!text: tr('Show connection ping') !text: tr('Show connection ping')
@ -41,7 +53,7 @@ Panel
!text: tr('Highlight things under cursor') !text: tr('Highlight things under cursor')
Label Label
margin-top: 12 margin-top: 5
width: 90 width: 90
anchors.left: parent.left anchors.left: parent.left
anchors.top: prev.bottom anchors.top: prev.bottom
@ -110,7 +122,7 @@ Panel
self:addOption("4th right panel") self:addOption("4th right panel")
Label Label
margin-top: 12 margin-top: 3
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.top: prev.bottom anchors.top: prev.bottom

View File

@ -4,6 +4,7 @@ local defaultOptions = {
showPing = true, showPing = true,
fullscreen = false, fullscreen = false,
classicView = true, classicView = true,
cacheMap = false,
classicControl = true, classicControl = true,
smartWalk = false, smartWalk = false,
dash = false, dash = false,
@ -49,7 +50,10 @@ local defaultOptions = {
walkTurnDelay = 100, walkTurnDelay = 100,
walkStairsDelay = 50, walkStairsDelay = 50,
walkTeleportDelay = 200, walkTeleportDelay = 200,
walkCtrlTurnDelay = 150 walkCtrlTurnDelay = 150,
actionBar1 = true,
actionBar2 = false
} }
local optionsWindow local optionsWindow
@ -343,8 +347,10 @@ function setOption(key, value, force)
g_settings.set(key, value) g_settings.set(key, value)
options[key] = value options[key] = value
if key == 'classicView' or key == 'rightPanels' or key == 'leftPanels' then if key == 'classicView' or key == 'rightPanels' or key == 'leftPanels' or key == 'cacheMap' then
modules.game_interface.refreshViewMode() modules.game_interface.refreshViewMode()
elseif key == 'actionBar1' or key == 'actionBar2' then
modules.game_actionbar.show()
end end
end end

View File

@ -182,7 +182,9 @@ function HTTP.onDownload(operationId, url, err, path, checksum)
end end
if operation.callback then if operation.callback then
if operation["type"] == "image" then if operation["type"] == "image" then
if not err then
HTTP.images[url] = path HTTP.images[url] = path
end
operation.callback('/downloads/' .. path, err) operation.callback('/downloads/' .. path, err)
else else
operation.callback(path, checksum, err) operation.callback(path, checksum, err)

View File

@ -0,0 +1,330 @@
actionPanel1 = nil
actionPanel2 = nil
local actionConfig
local hotkeyAssignWindow
local actionButtonsInPanel = 50
ActionTypes = {
USE = 0,
USE_SELF = 1,
USE_TARGET = 2,
USE_WITH = 3
}
ActionColors = {
empty = '#00000022',
text = '#88888844',
itemUse = '#8888FF44',
itemUseSelf = '#00FF0044',
itemUseTarget = '#FF000044',
itemUseWith = '#F5B32544'
}
function init()
local bottomPanel = modules.game_interface.getBottomPanel()
actionPanel1 = g_ui.loadUI('actionbar', bottomPanel)
bottomPanel:moveChildToIndex(actionPanel1, 1)
actionPanel2 = g_ui.loadUI('actionbar', bottomPanel)
bottomPanel:moveChildToIndex(actionPanel2, 1)
actionConfig = g_configs.create("/actionbar.otml")
setupActionPanel(1, actionPanel1)
setupActionPanel(2, actionPanel2)
connect(g_game, {
onGameStart = online,
onGameEnd = offline
})
if g_game.isOnline() then
show()
end
end
function terminate()
disconnect(g_game, {
onGameStart = online,
onGameEnd = offline
})
saveConfig()
-- remove hotkeys
for index, panel in ipairs({actionPanel1, actionPanel2}) do
for i, child in ipairs(panel.tabBar:getChildren()) do
local gameRootPanel = modules.game_interface.getRootPanel()
if child.hotkey then
g_keyboard.unbindKeyPress(child.hotkey, child.callback, gameRootPanel)
end
end
end
actionPanel1:destroy()
actionPanel2:destroy()
end
function show()
actionPanel1:setOn(g_settings.getBoolean("actionBar1", false))
actionPanel2:setOn(g_settings.getBoolean("actionBar2", false))
end
function hide()
actionPanel1:setOn(false)
actionPanel2:setOn(false)
end
function switchMode(newMode)
if newMode then
actionPanel1:setImageColor('#ffffff88')
actionPanel2:setImageColor('#ffffff88')
else
actionPanel1:setImageColor('white')
actionPanel2:setImageColor('white')
end
end
function online()
show()
end
function offline()
hide()
if hotkeyAssignWindow then
hotkeyAssignWindow:destroy()
hotkeyAssignWindow = nil
end
saveConfig()
end
function setupActionPanel(index, panel)
local rawConfig = actionConfig:getNode('actions_' .. index) or {}
local config = {}
for i, buttonConfig in pairs(rawConfig) do -- sorting, because key in rawConfig is string
config[tonumber(i)] = buttonConfig
end
for i=1,actionButtonsInPanel do
local action = g_ui.createWidget('ActionButton', panel.tabBar)
setupAction(index, action, config[i])
end
panel.nextButton.onClick = function()
panel.tabBar:moveChildToIndex(panel.tabBar:getLastChild(), 1)
end
panel.prevButton.onClick = function()
panel.tabBar:moveChildToIndex(panel.tabBar:getFirstChild(), panel.tabBar:getChildCount())
end
end
function saveConfig()
for index, panel in ipairs({actionPanel1, actionPanel2}) do
local config = {}
for i, child in ipairs(panel.tabBar:getChildren()) do
table.insert(config, {
text = child.text:getText(),
item = child.item:getItemId(),
count = child.item:getItemCount(),
action = child.actionType,
hotkey = child.hotkey
})
end
actionConfig:setNode('actions_' .. index, config)
end
actionConfig:save()
end
function setupAction(index, action, config)
action.item:setShowCount(false)
action.onMouseRelease = actionOnMouseRelease
action.callback = function(k, c, ticks) executeAction(action, ticks) end
if config then
action.hotkey = config.hotkey
if action.hotkey then
local gameRootPanel = modules.game_interface.getRootPanel()
g_keyboard.bindKeyPress(action.hotkey, action.callback, gameRootPanel)
end
action.hotkeyLabel:setText(action.hotkey or "")
action.text:setText(config.text)
if action.text:getText():len() > 0 then
action:setBorderColor(ActionColors.text)
end
if config.item > 0 then
setupActionType(action, config.action)
end
action.item:setItemId(config.item)
action.item:setItemCount(config.count)
end
action.item.onItemChange = actionOnItemChange
end
function setupActionType(action, actionType)
action.actionType = actionType
if action.actionType == ActionTypes.USE then
action:setBorderColor(ActionColors.itemUse)
elseif action.actionType == ActionTypes.USE_SELF then
action:setBorderColor(ActionColors.itemUseSelf)
elseif action.actionType == ActionTypes.USE_TARGET then
action:setBorderColor(ActionColors.itemUseTarget)
elseif action.actionType == ActionTypes.USE_WITH then
action:setBorderColor(ActionColors.itemUseWith)
end
end
function executeAction(action, ticks)
if type(ticks) ~= 'number' then ticks = 0 end
local actionDelay = 100
if ticks == 0 then
actionDelay = 200 -- for first use
elseif action.actionDelayTo ~= nil and g_clock.millis() < action.actionDelayTo then
return
end
if action.text:getText():len() > 0 then
modules.game_console.sendMessage(action.text:getText())
action.actionDelayTo = g_clock.millis() + actionDelay
elseif action.item:getItemId() > 0 then
if action.actionType == ActionTypes.USE then
if g_game.getClientVersion() < 740 then
local item = g_game.findPlayerItem(action.item:getItemId(), hotKey.subType or -1)
if item then
g_game.use(item)
end
else
g_game.useInventoryItem(action.item:getItemId())
end
action.actionDelayTo = g_clock.millis() + actionDelay
elseif action.actionType == ActionTypes.USE_SELF then
if g_game.getClientVersion() < 740 then
local item = g_game.findPlayerItem(action.item:getItemId(), hotKey.subType or -1)
if item then
g_game.useWith(item, g_game.getLocalPlayer())
end
else
g_game.useInventoryItemWith(action.item:getItemId(), g_game.getLocalPlayer(), action.item:getItemSubType() or -1)
end
action.actionDelayTo = g_clock.millis() + actionDelay
elseif action.actionType == ActionTypes.USE_TARGET then
local attackingCreature = g_game.getAttackingCreature()
if not attackingCreature then
local item = Item.create(action.item:getItemId())
if g_game.getClientVersion() < 740 then
local tmpItem = g_game.findPlayerItem(action.item:getItemId(), action.item:getItemSubType() or -1)
if not tmpItem then return end
item = tmpItem
end
modules.game_interface.startUseWith(item, action.item:getItemSubType() or - 1)
return
end
if not attackingCreature:getTile() then return end
if g_game.getClientVersion() < 740 then
local item = g_game.findPlayerItem(action.item:getItemId(), action.item:getItemSubType() or -1)
if item then
g_game.useWith(item, attackingCreature, action.item:getItemSubType() or -1)
end
else
g_game.useInventoryItemWith(action.item:getItemId(), attackingCreature, action.item:getItemSubType() or -1)
end
action.actionDelayTo = g_clock.millis() + actionDelay
elseif action.actionType == ActionTypes.USE_WITH then
local item = Item.create(action.item:getItemId())
if g_game.getClientVersion() < 740 then
local tmpItem = g_game.findPlayerItem(action.item:getItemId(), action.item:getItemSubType() or -1)
if not tmpItem then return true end
item = tmpItem
end
modules.game_interface.startUseWith(item, action.item:getItemSubType() or - 1)
end
end
end
function actionOnMouseRelease(action, mousePosition, mouseButton)
if mouseButton == MouseRightButton then
local menu = g_ui.createWidget('PopupMenu')
menu:setGameMenu(true)
if action.item:getItemId() > 0 and action.item:getItem():isMultiUse() then
menu:addOption(tr('Use on yourself'), function() return setupActionType(action, ActionTypes.USE_SELF) end)
menu:addOption(tr('Use on target'), function() return setupActionType(action, ActionTypes.USE_TARGET) end)
menu:addOption(tr('With crosshair'), function() return setupActionType(action, ActionTypes.USE_WITH) end)
end
menu:addSeparator()
menu:addOption(tr('Set text'), function()
modules.game_textedit.singlelineEditor(action.text:getText(), function(newText)
action.item:setItemId(0)
action.text:setText(newText)
if action.text:getText():len() > 0 then
action:setBorderColor(ActionColors.text)
end
end)
end)
menu:addOption(tr('Set hotkey'), function()
if hotkeyAssignWindow then
hotkeyAssignWindow:destroy()
end
local assignWindow = g_ui.createWidget('ActionAssignWindow', rootWidget)
assignWindow:grabKeyboard()
assignWindow.comboPreview.keyCombo = ''
assignWindow.onKeyDown = function(assignWindow, keyCode, keyboardModifiers)
local keyCombo = determineKeyComboDesc(keyCode, keyboardModifiers)
assignWindow.comboPreview:setText(tr('Current action hotkey: %s', keyCombo))
assignWindow.comboPreview.keyCombo = keyCombo
assignWindow.comboPreview:resizeToText()
return true
end
assignWindow.onDestroy = function()
hotkeyAssignWindow = nil
end
assignWindow.addButton.onClick = function()
local gameRootPanel = modules.game_interface.getRootPanel()
if action.hotkey then
g_keyboard.unbindKeyPress(action.hotkey, action.callback, gameRootPanel)
end
action.hotkey = assignWindow.comboPreview.keyCombo
if action.hotkey then
g_keyboard.bindKeyPress(action.hotkey, action.callback, gameRootPanel)
end
action.hotkeyLabel:setText(action.hotkey or "")
assignWindow:destroy()
end
hotkeyAssignWindow = assignWindow
end)
menu:addSeparator()
menu:addOption(tr('Clear'), function()
action.item:setItem(nil)
action.text:setText("")
action.hotkeyLabel:setText("")
local gameRootPanel = modules.game_interface.getRootPanel()
if action.hotkey then
g_keyboard.unbindKeyPress(action.hotkey, action.callback, gameRootPanel)
end
action.hotkey = nil
action.actionType = nil
action:setBorderColor(ActionColors.empty)
end)
menu:display(mousePosition)
return true
elseif mouseButton == MouseLeftButton then
action.callback()
return true
end
return false
end
function actionOnItemChange(widget)
local action = widget:getParent()
if action.item:getItemId() > 0 then
action.text:setText("")
if action.item:getItem():isMultiUse() then
if not action.actionType or action.actionType <= 1 then
setupActionType(action, ActionTypes.USE_WITH)
end
else
setupActionType(action, ActionTypes.USE)
end
end
end

View File

@ -0,0 +1,9 @@
Module
name: game_actionbar
description: Action bar
author: otclient@otclient.ovh
website: otclient.ovh
sandboxed: true
scripts: [ actionbar ]
@onLoad: init()
@onUnload: terminate()

View File

@ -0,0 +1,134 @@
ActionButton < Panel
size: 36 36
font: cipsoftFont
anchors.top: parent.top
margin-left: 3
border-width: 1
border-color: #00000022
$first:
anchors.left: parent.left
$!first:
anchors.left: prev.right
Item
id: item
anchors.fill: parent
margin: 1 1 1 1
item-id: 3307
&selectable: true
&editable: false
virtual: true
Label
id: text
anchors.fill: parent
margin: 3 3 3 3
text-auto-resize: true
text-wrap: true
text-align: center
font: verdana-9px
Label
id: hotkeyLabel
anchors.top: parent.top
anchors.left: parent.left
margin: 2 3 3 3
text-auto-resize: true
text-wrap: false
font: small-9px
color: #D3D3D3
Panel
id: actionBar
anchors.left: parent.left
anchors.right: parent.right
image-source: /images/ui/panel_bottom
image-border: 6
focusable: false
$first:
anchors.top: parent.top
$!first:
anchors.top: prev.bottom
$on:
height: 40
visible: true
$!on:
height: 0
visible: false
TabButton
id: prevButton
icon: /images/game/console/leftarrow
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
margin-left: 1
Panel
id: tabBar
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: prev.right
anchors.right: next.left
margin-right: 3
margin-top: 2
clipping: true
TabButton
id: nextButton
icon: /images/game/console/rightarrow
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
margin-right: 1
ActionAssignWindow < MainWindow
id: assignWindow
!text: tr('Button Assign')
size: 360 150
@onEscape: self:destroy()
Label
!text: tr('Please, press the key you wish to use for action')
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
text-auto-resize: true
text-align: left
Label
id: comboPreview
!text: tr('Current action hotkey: %s', 'none')
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: prev.bottom
margin-top: 10
text-auto-resize: true
HorizontalSeparator
id: separator
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: next.top
margin-bottom: 10
Button
id: addButton
!text: tr('Add')
width: 64
anchors.right: next.left
anchors.bottom: parent.bottom
margin-right: 10
Button
id: cancelButton
!text: tr('Cancel')
width: 64
anchors.right: parent.right
anchors.bottom: parent.bottom
@onClick: self:getParent():destroy()

View File

@ -3,25 +3,16 @@ battleButton = nil
battlePanel = nil battlePanel = nil
filterPanel = nil filterPanel = nil
toggleFilterButton = nil toggleFilterButton = nil
battleButtonsList = {}
mouseWidget = nil mouseWidget = nil
sortTypeBox = nil
sortOrderBox = nil
hidePlayersButton = nil
hideNPCsButton = nil
hideMonstersButton = nil
hideSkullsButton = nil
hidePartyButton = nil
updateEvent = nil updateEvent = nil
hoveredCreature = nil hoveredCreature = nil
newHoveredCreature = nil newHoveredCreature = nil
prevCreature = nil prevCreature = nil
local creatureAgeCounter = 1 battleButtons = {}
local ageNumber = 1
function init() function init()
g_ui.importStyle('battlebutton') g_ui.importStyle('battlebutton')
@ -43,13 +34,8 @@ function init()
hideFilterPanel() hideFilterPanel()
end end
sortTypeBox = battleWindow:recursiveGetChildById('sortTypeBox') local sortTypeBox = filterPanel.sortPanel.sortTypeBox
sortOrderBox = battleWindow:recursiveGetChildById('sortOrderBox') local sortOrderBox = filterPanel.sortPanel.sortOrderBox
hidePlayersButton = battleWindow:recursiveGetChildById('hidePlayers')
hideNPCsButton = battleWindow:recursiveGetChildById('hideNPCs')
hideMonstersButton = battleWindow:recursiveGetChildById('hideMonsters')
hideSkullsButton = battleWindow:recursiveGetChildById('hideSkulls')
hidePartyButton = battleWindow:recursiveGetChildById('hideParty')
mouseWidget = g_ui.createWidget('UIButton') mouseWidget = g_ui.createWidget('UIButton')
mouseWidget:setVisible(false) mouseWidget:setVisible(false)
@ -70,11 +56,21 @@ function init()
sortOrderBox:setCurrentOptionByData(getSortOrder()) sortOrderBox:setCurrentOptionByData(getSortOrder())
sortOrderBox.onOptionChange = onChangeSortOrder sortOrderBox.onOptionChange = onChangeSortOrder
updateBattleList()
battleWindow:setup() battleWindow:setup()
for i=1,30 do
local battleButton = g_ui.createWidget('BattleButton', battlePanel)
battleButton:setup()
battleButton:hide()
battleButton.onHoverChange = onBattleButtonHoverChange
battleButton.onMouseRelease = onBattleButtonMouseRelease
table.insert(battleButtons, battleButton)
end
updateBattleList()
connect(LocalPlayer, { connect(LocalPlayer, {
onPositionChange = onCreaturePositionChange onPositionChange = onPlayerPositionChange
}) })
connect(Creature, { connect(Creature, {
onAppear = updateSquare, onAppear = updateSquare,
@ -91,14 +87,15 @@ function terminate()
return return
end end
battleButtons = {}
g_keyboard.unbindKeyDown('Ctrl+B') g_keyboard.unbindKeyDown('Ctrl+B')
battleButtonsByCreaturesList = {}
battleButton:destroy() battleButton:destroy()
battleWindow:destroy() battleWindow:destroy()
mouseWidget:destroy() mouseWidget:destroy()
disconnect(LocalPlayer, { disconnect(LocalPlayer, {
onPositionChange = onCreaturePositionChange onPositionChange = onPlayerPositionChange
}) })
disconnect(Creature, { disconnect(Creature, {
onAppear = onCreatureAppear, onAppear = onCreatureAppear,
@ -216,7 +213,8 @@ end
-- functions -- functions
function updateBattleList() function updateBattleList()
updateEvent = scheduleEvent(updateBattleList, 200) removeEvent(updateEvent)
updateEvent = scheduleEvent(updateBattleList, 100)
checkCreatures() checkCreatures()
end end
@ -229,68 +227,54 @@ function checkCreatures()
if not player then if not player then
return return
end end
local dimension = modules.game_interface.getMapPanel():getVisibleDimension() local dimension = modules.game_interface.getMapPanel():getVisibleDimension()
local spectators = g_map.getSpectatorsInRangeEx(player:getPosition(), false, math.floor(dimension.width / 2), math.floor(dimension.width / 2), math.floor(dimension.height / 2), math.floor(dimension.height / 2)) local spectators = g_map.getSpectatorsInRangeEx(player:getPosition(), false, math.floor(dimension.width / 2), math.floor(dimension.width / 2), math.floor(dimension.height / 2), math.floor(dimension.height / 2))
local maxCreatures = battlePanel:getChildCount()
local creatures = {} local creatures = {}
for _, creature in ipairs(spectators) do for _, creature in ipairs(spectators) do
if doCreatureFitFilters(creature) then if doCreatureFitFilters(creature) and #creatures < maxCreatures then
if not creature.age then
creature.age = ageNumber
ageNumber = ageNumber + 1
end
table.insert(creatures, creature) table.insert(creatures, creature)
end end
end end
updateSquare() updateSquare()
sortCreatures(creatures)
battlePanel:getLayout():disableUpdates()
-- sorting -- sorting
local creature_i = 1 local ascOrder = isSortAsc()
sortCreatures(creatures) for i=1,#creatures do
for i=1, #creatures do
if creature_i > 30 then
break
end
local creature = creatures[i] local creature = creatures[i]
if isSortAsc() then if ascOrder then
creature = creatures[#creatures - i + 1] creature = creatures[#creatures - i + 1]
end end
local battleButton = battleButtons[i]
if creature:getHealthPercent() > 0 then
local battleButton = battleButtonsList[creature_i]
if battleButton == nil then
battleButton = g_ui.createWidget('BattleButton')
battleButton.onHoverChange = onBattleButtonHoverChange
battleButton.onMouseRelease = onBattleButtonMouseRelease
battleButton:setup(creature, creature_i)
table.insert(battleButtonsList, battleButton)
battlePanel:addChild(battleButton)
end
battleButton:creatureSetup(creature) battleButton:creatureSetup(creature)
battleButton:enable() battleButton:show()
creature_i = creature_i + 1
end
end
for i=#creatures + 1, 30 do
local battleButton = battleButtonsList[i]
if battleButton then
battleButton:disable()
end
end end
local height = 0 for i=#creatures + 1,maxCreatures do
if creature_i > 1 then if battleButtons[i]:isHidden() then break end
height = 25 * (creature_i - 1) battleButtons[i]:hide()
end
if battlePanel:getHeight() ~= height then
battlePanel:setHeight(height)
end end
battlePanel:getLayout():enableUpdates()
battlePanel:getLayout():update()
end end
function doCreatureFitFilters(creature) function doCreatureFitFilters(creature)
if creature:isLocalPlayer() then if creature:isLocalPlayer() then
return false return false
end end
if creature:getHealthPercent() <= 0 then
return false
end
local pos = creature:getPosition() local pos = creature:getPosition()
if not pos then return false end if not pos then return false end
@ -298,11 +282,11 @@ function doCreatureFitFilters(creature)
local localPlayer = g_game.getLocalPlayer() local localPlayer = g_game.getLocalPlayer()
if pos.z ~= localPlayer:getPosition().z or not creature:canBeSeen() then return false end if pos.z ~= localPlayer:getPosition().z or not creature:canBeSeen() then return false end
local hidePlayers = hidePlayersButton:isChecked() local hidePlayers = filterPanel.buttons.hidePlayers:isChecked()
local hideNPCs = hideNPCsButton:isChecked() local hideNPCs = filterPanel.buttons.hideNPCs:isChecked()
local hideMonsters = hideMonstersButton:isChecked() local hideMonsters = filterPanel.buttons.hideMonsters:isChecked()
local hideSkulls = hideSkullsButton:isChecked() local hideSkulls = filterPanel.buttons.hideSkulls:isChecked()
local hideParty = hidePartyButton:isChecked() local hideParty = filterPanel.buttons.hideParty:isChecked()
if hidePlayers and creature:isPlayer() then if hidePlayers and creature:isPlayer() then
return false return false
@ -330,23 +314,23 @@ function sortCreatures(creatures)
local playerPos = player:getPosition() local playerPos = player:getPosition()
table.sort(creatures, function(a, b) table.sort(creatures, function(a, b)
if getDistanceBetween(playerPos, a:getPosition()) == getDistanceBetween(playerPos, b:getPosition()) then if getDistanceBetween(playerPos, a:getPosition()) == getDistanceBetween(playerPos, b:getPosition()) then
return a:getAge() > b:getAge() return a.age > b.age
end end
return getDistanceBetween(playerPos, a:getPosition()) > getDistanceBetween(playerPos, b:getPosition()) return getDistanceBetween(playerPos, a:getPosition()) > getDistanceBetween(playerPos, b:getPosition())
end) end)
elseif getSortType() == 'health' then elseif getSortType() == 'health' then
table.sort(creatures, function(a, b) table.sort(creatures, function(a, b)
if a:getHealthPercent() == b:getHealthPercent() then if a:getHealthPercent() == b:getHealthPercent() then
return a:getAge() > b:getAge() return a.age > b.age
end end
return a:getHealthPercent() > b:getHealthPercent() return a:getHealthPercent() > b:getHealthPercent()
end) end)
elseif getSortType() == 'age' then elseif getSortType() == 'age' then
table.sort(creatures, function(a, b) return a:getAge() > b:getAge() end) table.sort(creatures, function(a, b) return a.age > b.age end)
else -- name else -- name
table.sort(creatures, function(a, b) table.sort(creatures, function(a, b)
if a:getName():lower() == b:getName():lower() then if a:getName():lower() == b:getName():lower() then
return a:getAge() > b:getAge() return a.age > b.age
end end
return a:getName():lower() > b:getName():lower() return a:getName():lower() > b:getName():lower()
end) end)
@ -397,12 +381,8 @@ function onBattleButtonHoverChange(battleButton, hovered)
updateSquare() updateSquare()
end end
function onCreaturePositionChange(creature, newPos, oldPos) function onPlayerPositionChange(creature, newPos, oldPos)
if creature:isLocalPlayer() then addEvent(checkCreatures)
if oldPos and newPos and newPos.z ~= oldPos.z then
checkCreatures()
end
end
end end
local CreatureButtonColors = { local CreatureButtonColors = {

View File

@ -54,6 +54,7 @@ MiniWindow
height: 45 height: 45
Panel Panel
id: buttons
anchors.top: parent.top anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
height: 20 height: 20
@ -88,6 +89,7 @@ MiniWindow
@onCheckChange: modules.game_battle.checkCreatures() @onCheckChange: modules.game_battle.checkCreatures()
Panel Panel
id: sortPanel
anchors.top: prev.bottom anchors.top: prev.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
@ -147,3 +149,4 @@ MiniWindow
padding-right: 5 padding-right: 5
layout: layout:
type: verticalBox type: verticalBox
fit-children: true

View File

@ -163,7 +163,6 @@ function refresh()
configList.onOptionChange = function(widget) configList.onOptionChange = function(widget)
settings[index].config = widget:getCurrentOption().text settings[index].config = widget:getCurrentOption().text
settings[index].enabled = false
g_settings.setNode('bot', settings) g_settings.setNode('bot', settings)
g_settings.save() g_settings.save()
refresh() refresh()
@ -178,7 +177,7 @@ function refresh()
if not g_game.isOnline() or not settings[index].enabled then if not g_game.isOnline() or not settings[index].enabled then
statusLabel:setOn(true) statusLabel:setOn(true)
statusLabel:setText("Status: disabled") statusLabel:setText("Status: disabled\nPress off button to enable")
return return
end end
@ -381,7 +380,9 @@ function initCallbacks()
}) })
connect(g_map, { connect(g_map, {
onMissle = botOnMissle onMissle = botOnMissle,
onAnimatedText = botOnAnimatedText,
onStaticText = botOnStaticText
}) })
end end
@ -427,7 +428,9 @@ function terminateCallbacks()
}) })
disconnect(g_map, { disconnect(g_map, {
onMissle = botOnMissle onMissle = botOnMissle,
onAnimatedText = botOnAnimatedText,
onStaticText = botOnStaticText
}) })
end end
@ -526,6 +529,16 @@ function botOnMissle(missle)
safeBotCall(function() botExecutor.callbacks.onMissle(missle) end) safeBotCall(function() botExecutor.callbacks.onMissle(missle) end)
end end
function botOnAnimatedText(thing, text)
if botExecutor == nil then return false end
safeBotCall(function() botExecutor.callbacks.onAnimatedText(thing, text) end)
end
function botOnStaticText(thing, text)
if botExecutor == nil then return false end
safeBotCall(function() botExecutor.callbacks.onStaticText(thing, text) end)
end
function botChannelList(channels) function botChannelList(channels)
if botExecutor == nil then return false end if botExecutor == nil then return false end
safeBotCall(function() botExecutor.callbacks.onChannelList(channels) end) safeBotCall(function() botExecutor.callbacks.onChannelList(channels) end)

View File

@ -52,6 +52,8 @@ function executeBot(config, storage, tabs, msgCallback, saveConfigCallback, webs
onContainerClose = {}, onContainerClose = {},
onContainerUpdateItem = {}, onContainerUpdateItem = {},
onMissle = {}, onMissle = {},
onAnimatedText = {},
onStaticText = {},
onChannelList = {}, onChannelList = {},
onOpenChannel = {}, onOpenChannel = {},
onCloseChannel = {}, onCloseChannel = {},
@ -275,6 +277,16 @@ function executeBot(config, storage, tabs, msgCallback, saveConfigCallback, webs
callback(missle) callback(missle)
end end
end, end,
onAnimatedText = function(thing, text)
for i, callback in ipairs(context._callbacks.onAnimatedText) do
callback(thing, text)
end
end,
onStaticText = function(thing, text)
for i, callback in ipairs(context._callbacks.onStaticText) do
callback(thing, text)
end
end,
onChannelList = function(channels) onChannelList = function(channels)
for i, callback in ipairs(context._callbacks.onChannelList) do for i, callback in ipairs(context._callbacks.onChannelList) do
callback(channels) callback(channels)

View File

@ -116,6 +116,16 @@ context.onMissle = function(callback)
return context.callback("onMissle", callback) return context.callback("onMissle", callback)
end end
-- onAnimatedText -- callback = function(thing, text)
context.onAnimatedText = function(callback)
return context.callback("onAnimatedText", callback)
end
-- onStaticText -- callback = function(thing, text)
context.onStaticText = function(callback)
return context.callback("onStaticText", callback)
end
-- onChannelList -- callback = function(channels) -- onChannelList -- callback = function(channels)
context.onChannelList = function(callback) context.onChannelList = function(callback)
return context.callback("onChannelList", callback) return context.callback("onChannelList", callback)

View File

@ -123,7 +123,7 @@ context.addIcon = function(id, options, callback)
widget.onDragMove = function(widget, mousePos, moved) widget.onDragMove = function(widget, mousePos, moved)
local parentRect = widget:getParent():getRect() local parentRect = widget:getParent():getRect()
local x = math.min(math.max(parentRect.x, mousePos.x - widget.movingReference.x), parentRect.x + parentRect.width - widget:getWidth()) local x = math.min(math.max(parentRect.x, mousePos.x - widget.movingReference.x), parentRect.x + parentRect.width - widget:getWidth())
local y = math.min(math.max(parentRect.y, mousePos.y - widget.movingReference.y), parentRect.y + parentRect.height - widget:getHeight()) local y = math.min(math.max(parentRect.y - widget:getParent():getMarginTop(), mousePos.y - widget.movingReference.y), parentRect.y + parentRect.height - widget:getHeight())
widget:move(x, y) widget:move(x, y)
return true return true
end end
@ -141,8 +141,8 @@ context.addIcon = function(id, options, callback)
widget:addAnchor(AnchorHorizontalCenter, 'parent', AnchorHorizontalCenter) widget:addAnchor(AnchorHorizontalCenter, 'parent', AnchorHorizontalCenter)
widget:addAnchor(AnchorVerticalCenter, 'parent', AnchorVerticalCenter) widget:addAnchor(AnchorVerticalCenter, 'parent', AnchorVerticalCenter)
widget:setMarginTop(height * (-0.5 + config.x)) widget:setMarginTop(height * (-0.5 + config.y))
widget:setMarginLeft(width * (-0.5 + config.y)) widget:setMarginLeft(width * (-0.5 + config.x))
return true return true
end end
end end
@ -153,7 +153,7 @@ context.addIcon = function(id, options, callback)
local parentRect = parent:getRect() local parentRect = parent:getRect()
local width = parentRect.width - widget:getWidth() local width = parentRect.width - widget:getWidth()
local height = parentRect.height - widget:getHeight() local height = parentRect.height - widget:getHeight()
widget:setMarginTop(height * (-0.5 + config.y)) widget:setMarginTop(-parent:getMarginTop() + height * (-0.5 + config.y))
widget:setMarginLeft(width * (-0.5 + config.x)) widget:setMarginLeft(width * (-0.5 + config.x))
end end

View File

@ -8,3 +8,8 @@ context.displayGeneralBox = function(title, message, buttons, onEnterCallback, o
box.botWidget = true box.botWidget = true
return box return box
end end
context.doScreenshot = function(filename)
g_app.doScreenshot(filename)
end
context.screenshot = context.doScreenshot

View File

@ -26,6 +26,7 @@ BotLabel < Label
BotItem < Item BotItem < Item
virtual: true virtual: true
&selectable: true &selectable: true
&editable: true
BotTextEdit < TextEdit BotTextEdit < TextEdit
@onClick: modules.game_textedit.show(self) @onClick: modules.game_textedit.show(self)
@ -38,66 +39,7 @@ BotSeparator < HorizontalSeparator
margin-top: 5 margin-top: 5
margin-bottom: 3 margin-bottom: 3
BotSmallScrollBar < UIScrollBar BotSmallScrollBar < SmallScrollBar
orientation: vertical
margin-bottom: 1
step: 20
width: 8
image-source: /images/ui/scrollbar
image-clip: 39 0 13 65
image-border: 1
pixels-scroll: true
UIButton
id: decrementButton
anchors.top: parent.top
anchors.left: parent.left
image-source: /images/ui/scrollbar
image-clip: 0 0 13 13
image-color: #ffffffff
size: 8 8
$hover:
image-clip: 13 0 13 13
$pressed:
image-clip: 26 0 13 13
$disabled:
image-color: #ffffff66
UIButton
id: incrementButton
anchors.bottom: parent.bottom
anchors.right: parent.right
size: 8 8
image-source: /images/ui/scrollbar
image-clip: 0 13 13 13
image-color: #ffffffff
$hover:
image-clip: 13 13 13 13
$pressed:
image-clip: 26 13 13 13
$disabled:
image-color: #ffffff66
UIButton
id: sliderButton
anchors.centerIn: parent
size: 8 11
image-source: /images/ui/scrollbar
image-clip: 0 26 13 13
image-border: 2
image-color: #ffffffff
$hover:
image-clip: 13 26 13 13
$pressed:
image-clip: 26 26 13 13
$disabled:
image-color: #ffffff66
Label
id: valueLabel
anchors.fill: parent
color: white
text-align: center
BotPanel < Panel BotPanel < Panel
ScrollablePanel ScrollablePanel

View File

@ -383,44 +383,15 @@ function clear()
end end
end end
function switchMode(floating) function switchMode(newView)
if floating then if newView then
consolePanel:setImageColor('#ffffff88') consolePanel:setImageColor('#ffffff88')
consolePanel:removeAnchor(AnchorRight)
consolePanel:setWidth(600)
consolePanel:setDraggable(true)
consoleTabBar:setDraggable(true)
local bottomSplitter = modules.game_interface.bottomSplitter
if bottomSplitter then
bottomSplitter:removeAnchor(AnchorRight)
bottomSplitter:setWidth(600)
end
if not floatingMode then
local savedMargin = g_settings.get("consoleLeftMargin")
local newMargin = 150
if savedMargin and #savedMargin > 0 then
newMargin = tonumber(savedMargin)
end
newMargin = math.max(0, newMargin)
newMargin = math.min(consolePanel:getParent():getWidth() - consolePanel:getWidth(), newMargin)
consolePanel:setMarginLeft(newMargin)
if bottomSplitter then
bottomSplitter:setMarginLeft(newMargin)
end
end
else else
consolePanel:setImageColor('white') consolePanel:setImageColor('white')
consolePanel:addAnchor(AnchorLeft, 'parent', AnchorLeft)
consolePanel:addAnchor(AnchorRight, 'parent', AnchorRight)
consolePanel:setDraggable(false)
consoleTabBar:setDraggable(false)
consolePanel:setMarginLeft(0)
end end
floatingMode = floating --consolePanel:setDraggable(floating)
--consoleTabBar:setDraggable(floating)
--floatingMode = floating
end end
function onDragEnter(widget, pos) function onDragEnter(widget, pos)
@ -431,15 +402,7 @@ function onDragMove(widget, pos, moved)
if not floatingMode then if not floatingMode then
return return
end end
local newMargin = consolePanel:getMarginLeft() + moved.x -- update margin
newMargin = math.max(0, newMargin)
newMargin = math.min(consolePanel:getParent():getWidth() - consolePanel:getWidth(), newMargin)
consolePanel:setMarginLeft(newMargin)
local bottomSplitter = modules.game_interface.bottomSplitter
if bottomSplitter then
bottomSplitter:setMarginLeft(newMargin)
end
g_settings.set("consoleLeftMargin", newMargin)
return true return true
end end

View File

@ -57,11 +57,19 @@ ConsoleTabBarButton < MoveableTabBarButton
Panel Panel
id: consolePanel id: consolePanel
anchors.fill: parent
image-source: /images/ui/panel_bottom image-source: /images/ui/panel_bottom
image-border: 4 image-border: 4
phantom: false phantom: false
$first:
anchors.fill: parent
$!first:
anchors.top: prev.bottom
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
CheckBox CheckBox
id: toggleChat id: toggleChat
!tooltip: tr('Disable chat mode, allow to walk using ASDW') !tooltip: tr('Disable chat mode, allow to walk using ASDW')

View File

@ -274,8 +274,8 @@ function onOverlayGeometryChange()
topHealthBar:setMarginTop(15) topHealthBar:setMarginTop(15)
topManaBar:setMarginTop(15) topManaBar:setMarginTop(15)
else else
topHealthBar:setMarginTop(45) topHealthBar:setMarginTop(45 - overlay:getParent():getMarginTop())
topManaBar:setMarginTop(45) topManaBar:setMarginTop(45 - overlay:getParent():getMarginTop())
minMargin = 200 minMargin = 200
end end
@ -283,6 +283,6 @@ function onOverlayGeometryChange()
local width = overlay:getWidth() local width = overlay:getWidth()
topHealthBar:setMarginLeft(math.max(minMargin, (width - height) / 2 + 2)) topHealthBar:setMarginLeft(math.max(minMargin, (width - height + 50) / 2 + 2))
topManaBar:setMarginRight(math.max(minMargin, (width - height) / 2 + 2)) topManaBar:setMarginRight(math.max(minMargin, (width - height + 50) / 2 + 2))
end end

View File

@ -93,7 +93,7 @@ HealthOverlay < UIWidget
image-source: /images/game/circle/left_empty image-source: /images/game/circle/left_empty
margin-right: 169 margin-right: 169
margin-bottom: 16 margin-bottom: 16
opacity: 0.4 opacity: 0.5
phantom: true phantom: true
UIProgressBar UIProgressBar
@ -103,7 +103,7 @@ HealthOverlay < UIWidget
image-source: /images/game/circle/left_full image-source: /images/game/circle/left_full
margin-right: 169 margin-right: 169
margin-bottom: 16 margin-bottom: 16
opacity: 0.4 opacity: 0.5
phantom: true phantom: true
UIProgressBar UIProgressBar
@ -113,7 +113,7 @@ HealthOverlay < UIWidget
image-source: /images/game/circle/right_empty image-source: /images/game/circle/right_empty
margin-left: 130 margin-left: 130
margin-bottom: 16 margin-bottom: 16
opacity: 0.4 opacity: 0.5
phantom: true phantom: true
UIProgressBar UIProgressBar
@ -123,7 +123,7 @@ HealthOverlay < UIWidget
image-source: /images/game/circle/right_full image-source: /images/game/circle/right_full
margin-left: 130 margin-left: 130
margin-bottom: 16 margin-bottom: 16
opacity: 0.3 opacity: 0.4
image-color: #0000FFFF image-color: #0000FFFF
phantom: true phantom: true

View File

@ -545,7 +545,6 @@ function updateHotkeyLabel(hotkeyLabel)
end end
function updateHotkeyForm(reset) function updateHotkeyForm(reset)
local hasCustomAction = hotkeysWindow.action and hotkeysWindow.action.currentIndex > 1
configValueChanged = true configValueChanged = true
if hotkeysWindow.action then if hotkeysWindow.action then
if currentHotkeyLabel then if currentHotkeyLabel then
@ -560,6 +559,7 @@ function updateHotkeyForm(reset)
hotkeysWindow.action:setCurrentIndex(1, true) hotkeysWindow.action:setCurrentIndex(1, true)
end end
end end
local hasCustomAction = hotkeysWindow.action and hotkeysWindow.action.currentIndex > 1
if currentHotkeyLabel and not hasCustomAction then if currentHotkeyLabel and not hasCustomAction then
removeHotkeyButton:enable() removeHotkeyButton:enable()
if currentHotkeyLabel.itemId ~= nil then if currentHotkeyLabel.itemId ~= nil then

View File

@ -830,7 +830,7 @@ function refreshViewMode()
local minimumWidth = (g_settings.getNumber("rightPanels") + g_settings.getNumber("leftPanels") - 1) * 200 local minimumWidth = (g_settings.getNumber("rightPanels") + g_settings.getNumber("leftPanels") - 1) * 200
if classic then if classic then
minimumWidth = minimumWidth + 300 minimumWidth = minimumWidth + 400
end end
minimumWidth = math.max(minimumWidth, 800) minimumWidth = math.max(minimumWidth, 800)
g_window.setMinimumSize({ width = minimumWidth, height = 600 }) g_window.setMinimumSize({ width = minimumWidth, height = 600 })
@ -866,6 +866,7 @@ function refreshViewMode()
end end
gameMapPanel:setVisibleDimension({ width = 15, height = 11 }) gameMapPanel:setVisibleDimension({ width = 15, height = 11 })
gameMapPanel:setMarginTop(0)
if classic then if classic then
gameRootPanel:addAnchor(AnchorTop, 'topMenu', AnchorBottom) gameRootPanel:addAnchor(AnchorTop, 'topMenu', AnchorBottom)
@ -878,9 +879,6 @@ function refreshViewMode()
gameBottomPanel:addAnchor(AnchorLeft, 'gameLeftPanels', AnchorRight) gameBottomPanel:addAnchor(AnchorLeft, 'gameLeftPanels', AnchorRight)
gameBottomPanel:addAnchor(AnchorRight, 'gameRightPanels', AnchorLeft) gameBottomPanel:addAnchor(AnchorRight, 'gameRightPanels', AnchorLeft)
bottomSplitter:addAnchor(AnchorLeft, 'gameLeftPanels', AnchorRight)
bottomSplitter:addAnchor(AnchorRight, 'gameRightPanels', AnchorLeft)
bottomSplitter:setMarginLeft(0)
modules.client_topmenu.getTopMenu():setImageColor('white') modules.client_topmenu.getTopMenu():setImageColor('white')
gameBottomPanel:setImageColor('white') gameBottomPanel:setImageColor('white')
@ -890,21 +888,12 @@ function refreshViewMode()
modules.game_console.switchMode(false) modules.game_console.switchMode(false)
end end
else else
g_game.changeMapAwareRange(29, 19) g_game.changeMapAwareRange(31, 21)
gameMapPanel:fill('parent') gameMapPanel:fill('parent')
gameRootPanel:fill('parent') gameRootPanel:fill('parent')
gameMapPanel:setKeepAspectRatio(false) gameMapPanel:setKeepAspectRatio(false)
gameMapPanel:setLimitVisibleRange(false) gameMapPanel:setLimitVisibleRange(false)
if g_game.getFeature(GameChangeMapAwareRange) then gameMapPanel:setZoom(14)
gameMapPanel:setZoom(13)
else
gameMapPanel:setZoom(11)
end
gameBottomPanel:addAnchor(AnchorLeft, 'parent', AnchorLeft)
gameBottomPanel:addAnchor(AnchorRight, 'parent', AnchorRight)
bottomSplitter:addAnchor(AnchorLeft, 'parent', AnchorLeft)
bottomSplitter:addAnchor(AnchorRight, 'parent', AnchorRight)
modules.client_topmenu.getTopMenu():setImageColor('#ffffff66') modules.client_topmenu.getTopMenu():setImageColor('#ffffff66')
@ -912,6 +901,15 @@ function refreshViewMode()
modules.game_console.switchMode(true) modules.game_console.switchMode(true)
end end
end end
if modules.game_actionbar then
modules.game_actionbar.switchMode(not classic)
end
if g_settings.getBoolean("cacheMap") then
g_game.enableFeature(GameBiggerMapCache)
end
updateSize()
end end
function limitZoom() function limitZoom()
@ -923,15 +921,6 @@ function updateSize()
local height = gameMapPanel:getHeight() local height = gameMapPanel:getHeight()
local width = gameMapPanel:getWidth() local width = gameMapPanel:getWidth()
if not classic and modules.game_console then
local newMargin = modules.game_console.consolePanel:getMarginLeft()
newMargin = math.max(0, newMargin)
newMargin = math.min(modules.game_console.consolePanel:getParent():getWidth() - modules.game_console.consolePanel:getWidth(), newMargin)
bottomSplitter:setMarginLeft(newMargin)
modules.game_console.consolePanel:setMarginLeft(newMargin)
bottomSplitter:setMarginLeft(newMargin)
end
if not classic then if not classic then
local rheight = gameRootPanel:getHeight() local rheight = gameRootPanel:getHeight()
local rwidth = gameRootPanel:getWidth() local rwidth = gameRootPanel:getWidth()
@ -942,11 +931,20 @@ function updateSize()
local dheight = dimenstion.height local dheight = dimenstion.height
local dwidth = dimenstion.width local dwidth = dimenstion.width
local tileSize = rheight / dheight local tileSize = rheight / dheight
local maxWidth = tileSize * (awareRange.width - 4) local maxWidth = tileSize * (awareRange.width + 1)
if g_game.getFeature(GameChangeMapAwareRange) then
local maxWidth = tileSize * (awareRange.width - 1)
end
gameMapPanel:setMarginTop(-tileSize * 2)
if g_settings.getBoolean("cacheMap") then
gameMapPanel:setMarginLeft(0)
gameMapPanel:setMarginRight(0)
else
local margin = math.max(0, math.floor((rwidth - maxWidth) / 2)) local margin = math.max(0, math.floor((rwidth - maxWidth) / 2))
gameMapPanel:setMarginLeft(margin) gameMapPanel:setMarginLeft(margin)
gameMapPanel:setMarginRight(margin) gameMapPanel:setMarginRight(margin)
end end
end
--[[ --[[
local maxWidth = math.floor(height * 2) local maxWidth = math.floor(height * 2)

View File

@ -55,22 +55,23 @@ UIWidget
fit-children: true fit-children: true
spacing: -1 spacing: -1
GameBottomPanel
id: gameBottomPanel
anchors.left: gameLeftPanels.right
anchors.right: gameRightPanels.left
anchors.top: bottomSplitter.top
anchors.bottom: parent.bottom
Splitter Splitter
id: bottomSplitter id: bottomSplitter
anchors.left: gameLeftPanels.right anchors.left: gameLeftPanels.right
anchors.right: gameRightPanels.left anchors.right: gameRightPanels.left
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
relative-margin: bottom relative-margin: bottom
margin-bottom: 172 margin-bottom: 180
@canUpdateMargin: function(self, newMargin) if modules.client_options.getOption('dontStretchShrink') then return self:getMarginBottom() end return math.max(math.min(newMargin, self:getParent():getHeight() - 300), 100) end @canUpdateMargin: function(self, newMargin) if modules.client_options.getOption('dontStretchShrink') then return self:getMarginBottom() end return math.max(math.min(newMargin, self:getParent():getHeight() - 300), 80) end
@onGeometryChange: function(self) self:setMarginBottom(math.min(math.max(self:getParent():getHeight() - 300, 100), self:getMarginBottom())) end @onGeometryChange: function(self) self:setMarginBottom(math.min(math.max(self:getParent():getHeight() - 300, 80), self:getMarginBottom())) end
GameBottomPanel
id: gameBottomPanel
anchors.left: bottomSplitter.left
anchors.right: bottomSplitter.right
anchors.top: bottomSplitter.top
anchors.bottom: parent.bottom
margin-top: 3
UIWidget UIWidget
id: mouseGrabber id: mouseGrabber

View File

@ -34,6 +34,7 @@ Module
- game_shop - game_shop
- game_itemselector - game_itemselector
- game_textedit - game_textedit
- game_actionbar
- game_bot - game_bot
@onLoad: init() @onLoad: init()
@onUnload: terminate() @onUnload: terminate()

View File

@ -69,14 +69,19 @@ function init()
end end
purseButton = inventoryWindow:recursiveGetChildById('purseButton') purseButton = inventoryWindow:recursiveGetChildById('purseButton')
marketButton = inventoryWindow:recursiveGetChildById('marketButton') purseButton.onClick = function()
local function purseFunction()
local purse = g_game.getLocalPlayer():getInventoryItem(InventorySlotPurse) local purse = g_game.getLocalPlayer():getInventoryItem(InventorySlotPurse)
if purse then if purse then
g_game.use(purse) g_game.use(purse)
end end
end end
purseButton.onClick = purseFunction
marketButton = inventoryWindow:recursiveGetChildById('marketButton')
marketButton.onClick = function()
if modules.game_shop then
modules.game_shop.toggle()
end
end
-- controls -- controls
fightOffensiveBox = inventoryWindow:recursiveGetChildById('fightOffensiveBox') fightOffensiveBox = inventoryWindow:recursiveGetChildById('fightOffensiveBox')
@ -206,7 +211,7 @@ function refresh()
end end
purseButton:setVisible(g_game.getFeature(GamePurseSlot)) purseButton:setVisible(g_game.getFeature(GamePurseSlot))
marketButton:setVisible(g_game.getFeature(GamePurseSlot)) marketButton:setVisible(g_game.getFeature(GameIngameStore))
end end
function toggle() function toggle()

View File

@ -2,10 +2,15 @@
local SHOP_EXTENTED_OPCODE = 201 local SHOP_EXTENTED_OPCODE = 201
shop = nil shop = nil
local otcv8shop = false
local shopButton = nil local shopButton = nil
local msgWindow = nil local msgWindow = nil
local browsingHistory = false local browsingHistory = false
-- for classic store
local storeUrl = ""
local coinsPacketSize = 0
local CATEGORIES = {} local CATEGORIES = {}
local HISTORY = {} local HISTORY = {}
local STATUS = {} local STATUS = {}
@ -14,6 +19,10 @@ local AD = {}
local selectedOffer = {} local selectedOffer = {}
local function sendAction(action, data) local function sendAction(action, data)
if not g_game.getFeature(GameExtendedOpcode) then
return
end
local protocolGame = g_game.getProtocolGame() local protocolGame = g_game.getProtocolGame()
if data == nil then if data == nil then
data = {} data = {}
@ -25,7 +34,18 @@ end
-- public functions -- public functions
function init() function init()
connect(g_game, { onGameStart = check, onGameEnd = hide }) connect(g_game, {
onGameStart = check,
onGameEnd = hide,
onStoreInit = onStoreInit,
onStoreCategories = onStoreCategories,
onStoreOffers = onStoreOffers,
onStoreTransactionHistory = onStoreTransactionHistory,
onStorePurchase = onStorePurchase,
onStoreError = onStoreError,
onCoinBalance = onCoinBalance
})
ProtocolGame.registerExtendedJSONOpcode(SHOP_EXTENTED_OPCODE, onExtendedJSONOpcode) ProtocolGame.registerExtendedJSONOpcode(SHOP_EXTENTED_OPCODE, onExtendedJSONOpcode)
if g_game.isOnline() then if g_game.isOnline() then
@ -34,7 +54,17 @@ function init()
end end
function terminate() function terminate()
disconnect(g_game, { onGameStart = check, onGameEnd = hide }) disconnect(g_game, {
onGameStart = check,
onGameEnd = hide,
onStoreInit = onStoreInit,
onStoreCategories = onStoreCategories,
onStoreOffers = onStoreOffers,
onStoreTransactionHistory = onStoreTransactionHistory,
onStorePurchase = onStorePurchase,
onStoreError = onStoreError,
onCoinBalance = onCoinBalance
})
ProtocolGame.unregisterExtendedJSONOpcode(SHOP_EXTENTED_OPCODE, onExtendedJSONOpcode) ProtocolGame.unregisterExtendedJSONOpcode(SHOP_EXTENTED_OPCODE, onExtendedJSONOpcode)
@ -53,9 +83,7 @@ function terminate()
end end
function check() function check()
if not g_game.getFeature(GameExtendedOpcode) then otcv8shop = false
return
end
sendAction("init") sendAction("init")
end end
@ -70,6 +98,10 @@ function show()
if not shop or not shopButton then if not shop or not shopButton then
return return
end end
if g_game.getFeature(GameIngameStore) then
g_game.openStore(0)
end
shop:show() shop:show()
shop:raise() shop:raise()
shop:focus() shop:focus()
@ -86,14 +118,124 @@ function toggle()
check() check()
end end
function onExtendedJSONOpcode(protocol, code, json_data) function createShop()
if not shop then if shop then return end
shop = g_ui.displayUI('shop') shop = g_ui.displayUI('shop')
shop:hide() shop:hide()
shopButton = modules.client_topmenu.addRightGameToggleButton('shopButton', tr('Shop'), '/images/topbuttons/shop', toggle) shopButton = modules.client_topmenu.addRightGameToggleButton('shopButton', tr('Shop'), '/images/topbuttons/shop', toggle)
connect(shop.categories, { onChildFocusChange = changeCategory }) connect(shop.categories, { onChildFocusChange = changeCategory })
end
function onStoreInit(url, coins)
if otcv8shop then return end
storeUrl = url
if storeUrl:len() > 0 then
if storeUrl:sub(storeUrl:len(), storeUrl:len()) ~= "/" then
storeUrl = storeUrl .. "/"
end end
storeUrl = storeUrl .. "64/"
if storeUrl:sub(1, 4):lower() ~= "http" then
storeUrl = "http://" .. storeUrl
end
end
coinsPacketSize = coins
createShop()
end
function onStoreCategories(categories)
if otcv8shop then return end
local correctCategories = {}
for i, category in ipairs(categories) do
table.insert(correctCategories, {
type = "image",
image = storeUrl .. category.icon,
name = category.name,
offers = {}
})
end
processCategories(correctCategories)
end
function onStoreOffers(categoryName, offers)
if otcv8shop then return end
local updated = false
for i, category in ipairs(CATEGORIES) do
if category.name == categoryName then
if #category.offers ~= #offers then
updated = true
end
for i=1,#category.offers do
if category.offers[i].title ~= offers[i].name or category.offers[i].id ~= offers[i].id or category.offers[i].cost ~= offers[i].price then
updated = true
end
end
if updated then
for offer in pairs(category.offers) do
category.offers[offer] = nil
end
for i, offer in ipairs(offers) do
table.insert(category.offers, {
id=offer.id,
type="image",
image=storeUrl .. offer.icon,
cost=offer.price,
title=offer.name,
description=offer.description
})
end
end
end
end
if not updated then
return
end
local activeCategory = shop.categories:getFocusedChild()
changeCategory(activeCategory, activeCategory)
end
function onStoreTransactionHistory(currentPage, hasNextPage, offers)
if otcv8shop then return end
HISTORY = {}
for i, offer in ipairs(offers) do
table.insert(HISTORY, {
id=offer.id,
type="image",
image=storeUrl .. offer.icon,
cost=offer.price,
title=offer.name,
description=offer.description
})
end
if not browsingHistory then return end
clearOffers()
shop.categories:focusChild(nil)
for i, transaction in ipairs(HISTORY) do
addOffer(0, transaction)
end
end
function onStorePurchase(message)
if otcv8shop then return end
processMessage({title="Successful shop purchase", msg=message})
end
function onStoreError(errorType, message)
if otcv8shop then return end
processMessage({title="Shop error", msg=message})
end
function onCoinBalance(coins, transferableCoins)
shop.infoPanel.points:setText(tr("Points:") .. " " .. coins)
shop.infoPanel.buy:hide()
shop.infoPanel:setHeight(20)
end
function onExtendedJSONOpcode(protocol, code, json_data)
createShop()
local action = json_data['action'] local action = json_data['action']
local data = json_data['data'] local data = json_data['data']
@ -102,6 +244,7 @@ function onExtendedJSONOpcode(protocol, code, json_data)
return false return false
end end
otcv8shop = true
if action == 'categories' then if action == 'categories' then
processCategories(data) processCategories(data)
elseif action == 'history' then elseif action == 'history' then
@ -198,6 +341,7 @@ function processStatus(data)
end end
else else
shop.infoPanel.buy:hide() shop.infoPanel.buy:hide()
shop.infoPanel:setHeight(20)
end end
end end
@ -268,7 +412,12 @@ function showHistory(force)
if browsingHistory and not force then if browsingHistory and not force then
return return
end end
if g_game.getFeature(GameIngameStore) and not otcv8shop then
g_game.openTransactionHistory(100)
end
sendAction("history") sendAction("history")
browsingHistory = true browsingHistory = true
clearOffers() clearOffers()
shop.categories:focusChild(nil) shop.categories:focusChild(nil)
@ -295,6 +444,7 @@ function addOffer(category, data)
if data["image"]:sub(1, 4):lower() == "http" then if data["image"]:sub(1, 4):lower() == "http" then
HTTP.downloadImage(data['image'], function(path, err) HTTP.downloadImage(data['image'], function(path, err)
if err then g_logger.warning("HTTP error: " .. err) return end if err then g_logger.warning("HTTP error: " .. err) return end
if not offer.image then return end
offer.image:setImageSource(path) offer.image:setImageSource(path)
end) end)
elseif data["image"] and data["image"]:len() > 1 then elseif data["image"] and data["image"]:len() > 1 then
@ -307,6 +457,7 @@ function addOffer(category, data)
offer:setId("offer_" .. category .. "_" .. shop.offers:getChildCount()) offer:setId("offer_" .. category .. "_" .. shop.offers:getChildCount())
offer.title:setText(data["title"] .. " (" .. data["cost"] .. " points)") offer.title:setText(data["title"] .. " (" .. data["cost"] .. " points)")
offer.description:setText(data["description"]) offer.description:setText(data["description"])
offer.offerId = data["id"]
if category ~= 0 then if category ~= 0 then
offer.onDoubleClick = buyOffer offer.onDoubleClick = buyOffer
offer.buyButton.onClick = function() buyOffer(offer) end offer.buyButton.onClick = function() buyOffer(offer) end
@ -318,6 +469,11 @@ function changeCategory(widget, newCategory)
if not newCategory then if not newCategory then
return return
end end
if g_game.getFeature(GameIngameStore) and widget ~= newCategory and not otcv8shop then
g_game.requestStoreOffers(newCategory.name:getText())
end
browsingHistory = false browsingHistory = false
local id = tonumber(newCategory:getId():split("_")[2]) local id = tonumber(newCategory:getId():split("_")[2])
clearOffers() clearOffers()
@ -341,7 +497,7 @@ function buyOffer(widget)
return return
end end
selectedOffer = {category=category, offer=offer, title=item.title, cost=item.cost} selectedOffer = {category=category, offer=offer, title=item.title, cost=item.cost, id=widget.offerId}
scheduleEvent(function() scheduleEvent(function()
if msgWindow then if msgWindow then
@ -365,6 +521,19 @@ function buyConfirmed()
msgWindow:destroy() msgWindow:destroy()
msgWindow = nil msgWindow = nil
sendAction("buy", selectedOffer) sendAction("buy", selectedOffer)
if g_game.getFeature(GameIngameStore) and selectedOffer.id and not otcv8shop then
local offerName = selectedOffer.title:lower()
if string.find(offerName, "name") and string.find(offerName, "change") and modules.game_textedit then
modules.game_textedit.singlelineEditor("", function(newName)
if newName:len() == 0 then
return
end
g_game.buyStoreOffer(selectedOffer.id, 1, newName)
end)
else
g_game.buyStoreOffer(selectedOffer.id, 0, "")
end
end
end end
function buyCanceled() function buyCanceled()

View File

@ -14,7 +14,6 @@ ShopCategory < Panel
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
margin-left: 40 margin-left: 40
text-align: left text-align: left
text: UAHSbjaS ASDJHASD ASKJD
color: white color: white
font: verdana-11px-rounded font: verdana-11px-rounded
@ -69,7 +68,6 @@ ShopOffer < Panel
margin-top: 4 margin-top: 4
margin-left: 55 margin-left: 55
text-align: topleft text-align: topleft
text: UAHSbjaS ASDJHASD ASKJD
color: white color: white
font: verdana-11px-rounded font: verdana-11px-rounded

View File

@ -73,7 +73,7 @@ function terminate()
end end
function calculateVisibleTime(text) function calculateVisibleTime(text)
return math.max(#text * 100, 4000) return math.max(#text * 50, 3000)
end end
function displayMessage(mode, text) function displayMessage(mode, text)

View File

@ -141,7 +141,7 @@ function bindWalkKey(key, dir)
local gameRootPanel = modules.game_interface.getRootPanel() local gameRootPanel = modules.game_interface.getRootPanel()
g_keyboard.bindKeyDown(key, function() changeWalkDir(dir) end, gameRootPanel, true) g_keyboard.bindKeyDown(key, function() changeWalkDir(dir) end, gameRootPanel, true)
g_keyboard.bindKeyUp(key, function() changeWalkDir(dir, true) end, gameRootPanel, true) g_keyboard.bindKeyUp(key, function() changeWalkDir(dir, true) end, gameRootPanel, true)
g_keyboard.bindKeyPress(key, function() smartWalk(dir) end, gameRootPanel) g_keyboard.bindKeyPress(key, function(c, k, ticks) smartWalk(dir, ticks) end, gameRootPanel)
end end
function unbindWalkKey(key) function unbindWalkKey(key)
@ -203,11 +203,11 @@ function changeWalkDir(dir, pop)
end end
end end
function smartWalk(dir) function smartWalk(dir, ticks)
walkEvent = scheduleEvent(function() walkEvent = scheduleEvent(function()
if g_keyboard.getModifiers() == KeyboardNoModifier then if g_keyboard.getModifiers() == KeyboardNoModifier then
local direction = smartWalkDir or dir local direction = smartWalkDir or dir
walk(direction) walk(direction, ticks)
return true return true
end end
return false return false
@ -252,7 +252,7 @@ function onWalkFinish(player)
lastFinishedStep = g_clock.millis() lastFinishedStep = g_clock.millis()
if nextWalkDir ~= nil then if nextWalkDir ~= nil then
removeEvent(autoWalkEvent) removeEvent(autoWalkEvent)
autoWalkEvent = addEvent(function() if nextWalkDir ~= nil then walk(nextWalkDir) end end, false) autoWalkEvent = addEvent(function() if nextWalkDir ~= nil then walk(nextWalkDir, 0) end end, false)
end end
end end
@ -260,13 +260,18 @@ function onCancelWalk(player)
player:lockWalk(50) player:lockWalk(50)
end end
function walk(dir) function walk(dir, ticks)
lastManualWalk = g_clock.millis() lastManualWalk = g_clock.millis()
local player = g_game.getLocalPlayer() local player = g_game.getLocalPlayer()
if not player or g_game.isDead() or player:isDead() then if not player or g_game.isDead() or player:isDead() then
return return
end end
if player:isWalkLocked() then
nextWalkDir = nil
return
end
if g_game.isFollowing() then if g_game.isFollowing() then
g_game.cancelFollow() g_game.cancelFollow()
end end
@ -279,11 +284,6 @@ function walk(dir)
end end
end end
if player:isWalkLocked() then
nextWalkDir = nil
return
end
local dash = false local dash = false
local ignoredCanWalk = false local ignoredCanWalk = false
if not g_game.getFeature(GameNewWalking) then if not g_game.getFeature(GameNewWalking) then
@ -295,7 +295,7 @@ function walk(dir)
if dash then if dash then
ignoredCanWalk = true ignoredCanWalk = true
else else
if ticksToNextWalk < 500 and lastWalkDir ~= dir then if ticksToNextWalk < 500 and (lastWalkDir ~= dir or ticks == 0) then
nextWalkDir = dir nextWalkDir = dir
end end
if ticksToNextWalk < 30 and lastFinishedStep + 400 > g_clock.millis() and nextWalkDir == nil then -- clicked walk 20 ms too early, try to execute again as soon possible to keep smooth walking if ticksToNextWalk < 30 and lastFinishedStep + 400 > g_clock.millis() and nextWalkDir == nil then -- clicked walk 20 ms too early, try to execute again as soon possible to keep smooth walking
@ -349,11 +349,14 @@ function walk(dir)
end end
if dash and lastWalkDir == dir and lastWalk + 30 > g_clock.millis() then if dash and lastWalkDir == dir and lastWalk + 30 > g_clock.millis() then
walkLock = lastWalk + g_settings.getNumber('walkFirstStepDelay')
return return
end end
firstStep = (not player:isWalking() and lastFinishedStep + 100 < g_clock.millis() and walkLock + 100 < g_clock.millis()) or (player:isServerWalking() and not dash) firstStep = (not player:isWalking() and lastFinishedStep + 100 < g_clock.millis() and walkLock + 100 < g_clock.millis())
if player:isServerWalking() and not dash then
walkLock = walkLock + math.max(g_settings.getNumber('walkFirstStepDelay'), 100)
end
nextWalkDir = nil nextWalkDir = nil
removeEvent(autoWalkEvent) removeEvent(autoWalkEvent)
autoWalkEvent = nil autoWalkEvent = nil

View File

@ -170,6 +170,7 @@ GameNewWalking = 90
GameSlowerManualWalking = 91 GameSlowerManualWalking = 91
GameExtendedNewWalking = 92 GameExtendedNewWalking = 92
GameBot = 95 GameBot = 95
GameBiggerMapCache = 96
GameForceLight = 97 GameForceLight = 97
GameNoDebug = 98 GameNoDebug = 98
GameBotProtection = 99 GameBotProtection = 99

View File

@ -35,12 +35,7 @@ function UICreatureButton:getCreatureId()
return self.creature:getId() return self.creature:getId()
end end
function UICreatureButton:setup(creature, id) function UICreatureButton:setup(id)
if not id then
id = 0
end
self:setId('CreatureButton_' .. id)
self.lifeBarWidget = self:getChildById('lifeBar') self.lifeBarWidget = self:getChildById('lifeBar')
self.creatureWidget = self:getChildById('creature') self.creatureWidget = self:getChildById('creature')
self.labelWidget = self:getChildById('label') self.labelWidget = self:getChildById('label')

View File

@ -120,7 +120,7 @@ function UIItem:canAcceptDrop(widget, mousePos)
end end
function UIItem:onClick(mousePos) function UIItem:onClick(mousePos)
if not self.selectable then if not self.selectable or not self.editable then
return return
end end

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.