-
Total de itens
956 -
Registro em
-
Última visita
-
Dias Ganhos
23
Tudo que Luga03 postou
-
xPoketibia [Open source] (OFICIAL!)
tópico respondeu ao Wend ll de Luga03 em OTServer Alternativo (ATS)
Ae, estou esperando atualizações- 51 respostas
-
- pokemon ot
- otpokemon
- (e 4 mais)
-
blz vou tentar robar o sistema hauehauehaueh GoGo Esta indo MT bem com seu projeto
-
Eae pessoal blz?? estou com o sistema de login Delay! eu dei uma adaptada pequena, uma configuração mt facil, mas eu tentei colocar para aparecer quando tempo falta exatamente! tipo eu logo, ai deslogo em menos de 5 segundos, aparece uma mensagem dizendo 5 segundos, e dps antes dos 5 segundos aparece a mesma mensagem! eu gostaria de reformular ele, para aparecer tipo assim: [Pokémon X Timer] Aguarde 5 segundo(s) Para Poder Deslogar!. [Pokémon X Timer] Aguarde 4 segundo(s) Para Poder Deslogar!. [Pokémon X Timer] Aguarde 3 segundo(s) Para Poder Deslogar!. [Pokémon X Timer] Aguarde 2 segundo(s) Para Poder Deslogar!. [Pokémon X Timer] Aguarde 1 segundo(s) Para Poder Deslogar!. ai fica aparecendo de acordo com o tempo que falta! ta ai o script: local config = { segundos = 5, lerIP = "yes" } config.lerIP = getBooleanFromString(config.lerIP) local m_lastLogin, m_lastIP = 0, 0 function onLogout(cid) local timeNow, playerIP = os.time(), getPlayerIp(cid) doPlayerSendTextMessage(cid,19, "[Pokémon X Timer] Aguarde "..config.segundos.." segundo(s) Para Poder Deslogar!.") if(m_lastLogin + config.segundos >= timeNow and (config.lerIP == FALSE or m_lastIP == playerIP)) then return false end m_lastIP = playerIP m_lastLogin = timeNow return true end rep+ para quem conseguir me ajudar Pfv UP
-
SIm coloca o OT on, e usa o OTC com IP configurado!
-
Servio de nada [28/06/2015 15:00:22] [Error - TalkAction Interface] [28/06/2015 15:00:22] data/talkactions/scripts/move1.lua:onSay [28/06/2015 15:00:22] Description: [28/06/2015 15:00:22] data/talkactions/scripts/move1.lua:115: attempt to index local 'moveTable' (a boolean value) [28/06/2015 15:00:22] stack traceback: [28/06/2015 15:00:22] data/talkactions/scripts/move1.lua:115: in function <data/talkactions/scripts/move1.lua:20>
- 166 respostas
-
- mega stone
- megevolution
-
(e 1 mais)
Tags:
-
o meu OT não é de Icone
- 166 respostas
-
- mega stone
- megevolution
-
(e 1 mais)
Tags:
-
goback.lua look.lua
- 166 respostas
-
- mega stone
- megevolution
-
(e 1 mais)
Tags:
-
da uma olhada neste tutorial vai que ajuda http://www.xtibia.com/forum/topic/234203-otc-modificando-seu-otcliente/
-
Como funciona este Sistema de Egg's?
-
Saberia me dizer o nome do projeto desta pessoa???
-
Ai man, estou achando estes emoticons feios de mais! acho que poderia deixar mais bonito eles ^^
-
Bem que poderia Refazer
-
Estou utilizando a PDA 2015 Open Source!
- 166 respostas
-
- mega stone
- megevolution
-
(e 1 mais)
Tags:
-
Man eu fiz e refiz este tutorial 2 vezes! linha 180: if table.t == "fighting" then --alterado v2.6 acontece a msm coisa aq tbm!
- 166 respostas
-
- mega stone
- megevolution
-
(e 1 mais)
Tags:
-
Zipter98! Acabei de me deparar com um problema com o meu server com este sistema! quando eu adiciono a stone na pokeball e vou transformar ele na forma mega, ele da este erro: [26/06/2015 18:05:05] [Error - TalkAction Interface] [26/06/2015 18:05:05] data/talkactions/scripts/move1.lua:onSay [26/06/2015 18:05:05] Description: [26/06/2015 18:05:05] data/lib/pokemon moves.lua:180: attempt to index local 'table' (a nil value) [26/06/2015 18:05:05] stack traceback: [26/06/2015 18:05:05] data/lib/pokemon moves.lua:180: in function 'docastspell' [26/06/2015 18:05:05] data/talkactions/scripts/move1.lua:245: in function <data/talkactions/scripts/move1.lua:20> mas quando eu adiciono direto no configuration.lua, quando o poke não esta com a mega stone, o player fala "NOMEDOPOKE, Mega Evolve" algo assim, e não acontece nada! mas quando esta configurado no configuration.lua e esta com a mega stone no poke, ele se transforma 100%!
- 166 respostas
-
- mega stone
- megevolution
-
(e 1 mais)
Tags:
-
[Resolvido] ajuda com magia unown e air vortex
pergunta respondeu ao clebao666 de Luga03 em Resolvidos
Ae manow! Agora esta Funcionando 100% sem nenhum erro! -
poketibia Aumentar Limite De Efeitos
tópico respondeu ao gabrielbsales de Luga03 em Linguagens de Programação
Manow eu achei isto: void addMagicEffect(const Position& pos, uint8_t effect, bool ghostMode = false); ai modifiquei para isto: void addMagicEffect(const Position& pos, uint16_t effect, bool ghostMode = false); no que vc postou ali encima tem o "/* = false */" e o meu n tem, eu deixo do mesmo jeito que está agora ou modifico mais algo?? -
poketibia Aumentar Limite De Efeitos
tópico respondeu ao gabrielbsales de Luga03 em Linguagens de Programação
Pronto no Protocolgame.h eu achei as duas tags sem o "::protocolgame" então eu removi eles e adicionei no server, mas então eu não achei nada similar no game.h com oque vc pediu: //////////////////////////////////////////////////////////////////////// // OpenTibia - an opensource roleplaying game //////////////////////////////////////////////////////////////////////// // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. //////////////////////////////////////////////////////////////////////// #ifndef __GAME__ #define __GAME__ #include "otsystem.h" #include "enums.h" #include "templates.h" #include "scheduler.h" #include "map.h" #include "spawn.h" #include "item.h" #include "player.h" #include "npc.h" #include "monster.h" class ServiceManager; class Creature; class Player; class Monster; class Npc; class CombatInfo; enum stackposType_t { STACKPOS_NORMAL, STACKPOS_MOVE, STACKPOS_LOOK, STACKPOS_USE, STACKPOS_USEITEM }; enum WorldType_t { WORLD_TYPE_FIRST = 1, WORLD_TYPE_NO_PVP = WORLD_TYPE_FIRST, WORLD_TYPE_PVP = 2, WORLD_TYPE_PVP_ENFORCED = 3, WORLD_TYPE_LAST = WORLD_TYPE_PVP_ENFORCED }; enum GameState_t { GAME_STATE_FIRST = 1, GAME_STATE_STARTUP = GAME_STATE_FIRST, GAME_STATE_INIT = 2, GAME_STATE_NORMAL = 3, GAME_STATE_MAINTAIN = 4, GAME_STATE_CLOSED = 5, GAME_STATE_CLOSING = 6, GAME_STATE_SHUTDOWN = 7, GAME_STATE_LAST = GAME_STATE_SHUTDOWN }; enum LightState_t { LIGHT_STATE_DAY, LIGHT_STATE_NIGHT, LIGHT_STATE_SUNSET, LIGHT_STATE_SUNRISE }; enum ReloadInfo_t { RELOAD_FIRST = 1, RELOAD_ACTIONS = RELOAD_FIRST, RELOAD_CHAT = 2, RELOAD_CONFIG = 3, RELOAD_CREATUREEVENTS = 4, RELOAD_GAMESERVERS = 5, RELOAD_GLOBALEVENTS = 6, RELOAD_GROUPS = 7, RELOAD_HIGHSCORES = 8, RELOAD_HOUSEPRICES = 9, RELOAD_ITEMS = 10, RELOAD_MONSTERS = 11, RELOAD_MOVEEVENTS = 12, RELOAD_NPCS = 13, RELOAD_OUTFITS = 14, RELOAD_QUESTS = 15, RELOAD_RAIDS = 16, RELOAD_SPELLS = 17, RELOAD_STAGES = 18, RELOAD_TALKACTIONS = 19, RELOAD_VOCATIONS = 20, RELOAD_WEAPONS = 21, RELOAD_MODS = 22, RELOAD_ALL = 23, RELOAD_LAST = RELOAD_MODS }; struct RuleViolation { RuleViolation(Player* _reporter, const std::string& _text, uint32_t _time): reporter(_reporter), gamemaster(NULL), text(_text), time(_time), isOpen(true) {} Player* reporter; Player* gamemaster; std::string text; uint32_t time; bool isOpen; private: RuleViolation(const RuleViolation&); }; struct RefreshBlock_t { TileItemVector list; uint64_t lastRefresh; }; typedef std::map<uint32_t, shared_ptr<RuleViolation> > RuleViolationsMap; typedef std::map<Tile*, RefreshBlock_t> RefreshTiles; typedef std::vector< std::pair<std::string, uint32_t> > Highscore; typedef std::list<Position> Trash; typedef std::map<int32_t, float> StageList; #define EVENT_LIGHTINTERVAL 10000 #define EVENT_DECAYINTERVAL 1000 #define EVENT_DECAYBUCKETS 16 #define STATE_DELAY 1000 /** * Main Game class. * This class is responsible to control everything that happens */ class Game { public: Game(); virtual ~Game(); void start(ServiceManager* servicer); Highscore getHighscore(uint16_t skill); std::string getHighscoreString(uint16_t skill); void checkHighscores(); bool reloadHighscores(); void prepareGlobalSave(); void globalSave(); /** * Load a map. * \param filename Mapfile to load * \returns int32_t 0 built-in spawns, 1 needs xml spawns, 2 needs sql spawns, -1 if got error */ int32_t loadMap(std::string filename); /** * Get the map size - info purpose only * \param width width of the map * \param height height of the map */ void getMapDimensions(uint32_t& width, uint32_t& height) { width = map->mapWidth; height = map->mapHeight; return; } void setWorldType(WorldType_t type) {worldType = type;} WorldType_t getWorldType() const {return worldType;} Cylinder* internalGetCylinder(Player* player, const Position& pos); Thing* internalGetThing(Player* player, const Position& pos, int32_t index, uint32_t spriteId = 0, stackposType_t type = STACKPOS_NORMAL); void internalGetPosition(Item* item, Position& pos, int16_t& stackpos); std::string getTradeErrorDescription(ReturnValue ret, Item* item); /** * Get a single tile of the map. * \returns A pointer to the tile */ Tile* getTile(int32_t x, int32_t y, int32_t z) {return map->getTile(x, y, z);} Tile* getTile(const Position& pos) {return map->getTile(pos);} /** * Set a single tile of the map, position is read from this tile */ void setTile(Tile* newTile) {if(map) return map->setTile(newTile->getPosition(), newTile);} /** * Get a leaf of the map. * \returns A pointer to a leaf */ QTreeLeafNode* getLeaf(uint32_t x, uint32_t y) {return map->getLeaf(x, y);} /** * Returns a creature based on the unique creature identifier * \param id is the unique creature id to get a creature pointer to * \returns A Creature pointer to the creature */ Creature* getCreatureByID(uint32_t id); /** * Returns a player based on the unique creature identifier * \param id is the unique player id to get a player pointer to * \returns A Pointer to the player */ Player* getPlayerByID(uint32_t id); /** * Returns a creature based on a string name identifier * \param s is the name identifier * \returns A Pointer to the creature */ Creature* getCreatureByName(std::string s); /** * Returns a player based on a string name identifier * \param s is the name identifier * \returns A Pointer to the player */ Player* getPlayerByName(std::string s); /** * Returns a player based on a string name identifier * this function returns a pointer even if the player is offline, * it is up to the caller of the function to delete the pointer - if the player is offline * use isOffline() to determine if the player was offline * \param s is the name identifier * \return A Pointer to the player */ Player* getPlayerByNameEx(const std::string& s); /** * Returns a player based on a guid identifier * this function returns a pointer even if the player is offline, * it is up to the caller of the function to delete the pointer - if the player is offline * use isOffline() to determine if the player was offline * \param guid is the identifier * \return A Pointer to the player */ Player* getPlayerByGuid(uint32_t guid); /** * Returns a player based on a guid identifier * this function returns a pointer even if the player is offline, * it is up to the caller of the function to delete the pointer - if the player is offline * use isOffline() to determine if the player was offline * \param guid is the identifier */ Player* getPlayerByGuidEx(uint32_t guid); /** * Returns a player based on a string name identifier, with support for the "~" wildcard. * \param s is the name identifier, with or without wildcard * \param player will point to the found player (if any) * \return "RET_PLAYERWITHTHISNAMEISNOTONLINE" or "RET_NAMEISTOOAMBIGUOUS" */ ReturnValue getPlayerByNameWildcard(std::string s, Player*& player); /** * Returns a player based on an account number identifier * \param acc is the account identifier * \returns A Pointer to the player */ Player* getPlayerByAccount(uint32_t acc); /** * Returns all players based on their name * \param s is the player name * \return A vector of all players with the selected name */ PlayerVector getPlayersByName(std::string s); /** * Returns all players based on their account number identifier * \param acc is the account identifier * \return A vector of all players with the selected account number */ PlayerVector getPlayersByAccount(uint32_t acc); /** * Returns all players with a certain IP address * \param ip is the IP address of the clients, as an unsigned long * \param mask An IP mask, default 255.255.255.255 * \return A vector of all players with the selected IP */ PlayerVector getPlayersByIP(uint32_t ip, uint32_t mask = 0xFFFFFFFF); /** * Place Creature on the map without sending out events to the surrounding. * \param creature Creature to place on the map * \param pos The position to place the creature * \param forced If true, placing the creature will not fail because of obstacles (creatures/items) */ bool internalPlaceCreature(Creature* creature, const Position& pos, bool extendedPos = false, bool forced = false); /** * Place Creature on the map. * \param creature Creature to place on the map * \param pos The position to place the creature * \param forced If true, placing the creature will not fail because of obstacles (creatures/items) */ bool placeCreature(Creature* creature, const Position& pos, bool extendedPos = false, bool forced = false); ReturnValue placeSummon(Creature* creature, const std::string& name); /** * Remove Creature from the map. * Removes the Creature the map * \param c Creature to remove */ bool removeCreature(Creature* creature, bool isLogout = true); void addCreatureCheck(Creature* creature); void removeCreatureCheck(Creature* creature); uint32_t getPlayersOnline() {return (uint32_t)Player::autoList.size();} uint32_t getMonstersOnline() {return (uint32_t)Monster::autoList.size();} uint32_t getNpcsOnline() {return (uint32_t)Npc::autoList.size();} uint32_t getCreaturesOnline() {return (uint32_t)autoList.size();} uint32_t getPlayersRecord() {return playersRecord;} void getWorldLightInfo(LightInfo& lightInfo); void getSpectators(SpectatorVec& list, const Position& centerPos, bool checkforduplicate = false, bool multifloor = false, int32_t minRangeX = 0, int32_t maxRangeX = 0, int32_t minRangeY = 0, int32_t maxRangeY = 0) {map->getSpectators(list, centerPos, checkforduplicate, multifloor, minRangeX, maxRangeX, minRangeY, maxRangeY);} const SpectatorVec& getSpectators(const Position& centerPos) {return map->getSpectators(centerPos);} void clearSpectatorCache() {if(map) map->clearSpectatorCache();} ReturnValue internalMoveCreature(Creature* creature, Direction direction, uint32_t flags = 0); ReturnValue internalMoveCreature(Creature* actor, Creature* creature, Cylinder* fromCylinder, Cylinder* toCylinder, uint32_t flags = 0); ReturnValue internalMoveItem(Creature* actor, Cylinder* fromCylinder, Cylinder* toCylinder, int32_t index, Item* item, uint32_t count, Item** _moveItem, uint32_t flags = 0); ReturnValue internalAddItem(Creature* actor, Cylinder* toCylinder, Item* item, int32_t index = INDEX_WHEREEVER, uint32_t flags = 0, bool test = false); ReturnValue internalRemoveItem(Creature* actor, Item* item, int32_t count = -1, bool test = false, uint32_t flags = 0); ReturnValue internalPlayerAddItem(Creature* actor, Player* player, Item* item, bool dropOnMap = true); /** * Find an item of a certain type * \param cylinder to search the item * \param itemId is the item to remove * \param subType is the extra type an item can have such as charges/fluidtype, default is -1 * meaning it's not used * \param depthSearch if true it will check child containers aswell * \returns A pointer to the item to an item and NULL if not found */ Item* findItemOfType(Cylinder* cylinder, uint16_t itemId, bool depthSearch = true, int32_t subType = -1); /** * Remove item(s) of a certain type * \param cylinder to remove the item(s) from * \param itemId is the item to remove * \param count is the amount to remove * \param subType is the extra type an item can have such as charges/fluidtype, default is -1 * meaning it's not used * \returns true if the removal was successful */ bool removeItemOfType(Cylinder* cylinder, uint16_t itemId, int32_t count, int32_t subType = -1); /** * Get the amount of money in a a cylinder * \returns the amount of money found */ uint32_t getMoney(const Cylinder* cylinder); /** * Remove/Add item(s) with a monetary value * \param cylinder to remove the money from * \param money is the amount to remove * \param flags optional flags to modifiy the default behaviour * \returns true if the removal was successful */ bool removeMoney(Cylinder* cylinder, int32_t money, uint32_t flags = 0); /** * Add item(s) with monetary value * \param cylinder which will receive money * \param money the amount to give * \param flags optional flags to modify default behavior */ void addMoney(Cylinder* cylinder, int32_t money, uint32_t flags = 0); /** * Transform one item to another type/count * \param item is the item to transform * \param newId is the new itemid * \param newCount is the new count value, use default value (-1) to not change it * \returns true if the tranformation was successful */ Item* transformItem(Item* item, uint16_t newId, int32_t newCount = -1); /** * Teleports an object to another position * \param thing is the object to teleport * \param newPos is the new position * \param flags optional flags to modify default behavior * \returns true if the teleportation was successful */ ReturnValue internalTeleport(Thing* thing, const Position& newPos, bool pushMove, uint32_t flags = 0); /** * Turn a creature to a different direction. * \param creature Creature to change the direction * \param dir Direction to turn to */ bool internalCreatureTurn(Creature* creature, Direction dir); /** * Creature wants to say something. * \param creature Creature pointer * \param type Type of message * \param text The text to say * \param ghostMode Is creature on ghost mode * \param spectators Send message only to creatures pointed in vector * \param pos Appear as sent from different position */ bool internalCreatureSay(Creature* creature, SpeakClasses type, const std::string& text, bool ghostMode, SpectatorVec* spectators = NULL, Position* pos = NULL); bool internalStartTrade(Player* player, Player* partner, Item* tradeItem); bool internalCloseTrade(Player* player); //Implementation of player invoked events bool playerBroadcastMessage(Player* player, SpeakClasses type, const std::string& text); bool playerReportBug(uint32_t playerId, std::string bug); bool playerViolationWindow(uint32_t playerId, std::string name, uint8_t reason, ViolationAction_t action, std::string comment, std::string statement, uint32_t statementId, bool ipBanishment); bool playerMoveThing(uint32_t playerId, const Position& fromPos, uint16_t spriteId, int16_t fromStackpos, const Position& toPos, uint8_t count); bool playerMoveCreature(uint32_t playerId, uint32_t movingCreatureId, const Position& movingCreatureOrigPos, const Position& toPos); bool playerMoveItem(uint32_t playerId, const Position& fromPos, uint16_t spriteId, int16_t fromStackpos, const Position& toPos, uint8_t count); bool playerMove(uint32_t playerId, Direction dir); bool playerCreatePrivateChannel(uint32_t playerId); bool playerChannelInvite(uint32_t playerId, const std::string& name); bool playerChannelExclude(uint32_t playerId, const std::string& name); bool playerRequestChannels(uint32_t playerId); bool playerOpenChannel(uint32_t playerId, uint16_t channelId); bool playerCloseChannel(uint32_t playerId, uint16_t channelId); bool playerOpenPrivateChannel(uint32_t playerId, std::string& receiver); bool playerCloseNpcChannel(uint32_t playerId); bool playerProcessRuleViolation(uint32_t playerId, const std::string& name); bool playerCloseRuleViolation(uint32_t playerId, const std::string& name); bool playerCancelRuleViolation(uint32_t playerId); bool playerReceivePing(uint32_t playerId); bool playerAutoWalk(uint32_t playerId, std::list<Direction>& listDir); bool playerStopAutoWalk(uint32_t playerId); bool playerUseItemEx(uint32_t playerId, const Position& fromPos, int16_t fromStackpos, uint16_t fromSpriteId, const Position& toPos, int16_t toStackpos, uint16_t toSpriteId, bool isHotkey); bool playerUseItem(uint32_t playerId, const Position& pos, int16_t stackpos, uint8_t index, uint16_t spriteId, bool isHotkey); bool playerUseBattleWindow(uint32_t playerId, const Position& fromPos, int16_t fromStackpos, uint32_t creatureId, uint16_t spriteId, bool isHotkey); bool playerCloseContainer(uint32_t playerId, uint8_t cid); bool playerMoveUpContainer(uint32_t playerId, uint8_t cid); bool playerUpdateContainer(uint32_t playerId, uint8_t cid); bool playerUpdateTile(uint32_t playerId, const Position& pos); bool playerRotateItem(uint32_t playerId, const Position& pos, int16_t stackpos, const uint16_t spriteId); bool playerWriteItem(uint32_t playerId, uint32_t windowTextId, const std::string& text); bool playerUpdateHouseWindow(uint32_t playerId, uint8_t listId, uint32_t windowTextId, const std::string& text); bool playerRequestTrade(uint32_t playerId, const Position& pos, int16_t stackpos, uint32_t tradePlayerId, uint16_t spriteId); bool playerAcceptTrade(uint32_t playerId); bool playerLookInTrade(uint32_t playerId, bool lookAtCounterOffer, int index); bool playerPurchaseItem(uint32_t playerId, uint16_t spriteId, uint8_t count, uint8_t amount, bool ignoreCap = false, bool inBackpacks = false); bool playerSellItem(uint32_t playerId, uint16_t spriteId, uint8_t count, uint8_t amount); bool playerCloseShop(uint32_t playerId); bool playerLookInShop(uint32_t playerId, uint16_t spriteId, uint8_t count); bool playerCloseTrade(uint32_t playerId); bool playerSetAttackedCreature(uint32_t playerId, uint32_t creatureId); bool playerFollowCreature(uint32_t playerId, uint32_t creatureId); bool playerCancelAttackAndFollow(uint32_t playerId); bool playerSetFightModes(uint32_t playerId, fightMode_t fightMode, chaseMode_t chaseMode, secureMode_t secureMode); bool playerLookAt(uint32_t playerId, const Position& pos, uint16_t spriteId, int16_t stackpos); bool playerQuests(uint32_t playerId); bool playerQuestInfo(uint32_t playerId, uint16_t questId); bool playerRequestAddVip(uint32_t playerId, const std::string& name); bool playerRequestRemoveVip(uint32_t playerId, uint32_t guid); bool playerTurn(uint32_t playerId, Direction dir); bool playerRequestOutfit(uint32_t playerId); bool playerSay(uint32_t playerId, uint16_t channelId, SpeakClasses type, const std::string& receiver, const std::string& text); bool playerChangeOutfit(uint32_t playerId, Outfit_t outfit); bool playerInviteToParty(uint32_t playerId, uint32_t invitedId); bool playerJoinParty(uint32_t playerId, uint32_t leaderId); bool playerRevokePartyInvitation(uint32_t playerId, uint32_t invitedId); bool playerPassPartyLeadership(uint32_t playerId, uint32_t newLeaderId); bool playerLeaveParty(uint32_t playerId); bool playerSharePartyExperience(uint32_t playerId, bool activate, uint8_t unknown); void kickPlayer(uint32_t playerId, bool displayEffect); bool broadcastMessage(const std::string& text, MessageClasses type); void showHotkeyUseMessage(Player* player, Item* item); int32_t getMotdId(); void loadMotd(); void loadPlayersRecord(); void checkPlayersRecord(Player* player); bool reloadInfo(ReloadInfo_t reload, uint32_t playerId = 0); void cleanup(); void shutdown(); void freeThing(Thing* thing); bool canThrowObjectTo(const Position& fromPos, const Position& toPos, bool checkLineOfSight = true, int32_t rangex = Map::maxClientViewportX, int32_t rangey = Map::maxClientViewportY); bool isSightClear(const Position& fromPos, const Position& toPos, bool sameFloor); bool getPathTo(const Creature* creature, const Position& destPos, std::list<Direction>& listDir, int32_t maxSearchDist /*= -1*/); bool getPathToEx(const Creature* creature, const Position& targetPos, std::list<Direction>& dirList, const FindPathParams& fpp); bool getPathToEx(const Creature* creature, const Position& targetPos, std::list<Direction>& dirList, uint32_t minTargetDist, uint32_t maxTargetDist, bool fullPathSearch = true, bool clearSight = true, int32_t maxSearchDist = -1); Position getClosestFreeTile(Creature* creature, Position pos, bool extended = false, bool ignoreHouse = true); std::string getSearchString(const Position fromPos, const Position toPos, bool fromIsCreature = false, bool toIsCreature = false); void changeLight(const Creature* creature); void changeSpeed(Creature* creature, int32_t varSpeedDelta); void internalCreatureChangeOutfit(Creature* creature, const Outfit_t& oufit, bool forced = false); void internalCreatureChangeVisible(Creature* creature, Visible_t visible); void updateCreatureSkull(Creature* creature); void sendPublicSquare(Player* sender, SquareColor_t color); GameState_t getGameState() const {return gameState;} void setGameState(GameState_t newState); void saveGameState(bool shallow); void loadGameState(); void cleanMap(uint32_t& count); void refreshMap(RefreshTiles::iterator* it = NULL, uint32_t limit = 0); void proceduralRefresh(RefreshTiles::iterator* it = NULL); void addTrash(Position pos) {trash.push_back(pos);} void addRefreshTile(Tile* tile, RefreshBlock_t rb) {refreshTiles[tile] = rb;} //Events void checkCreatureWalk(uint32_t creatureId); void updateCreatureWalk(uint32_t creatureId); void checkCreatureAttack(uint32_t creatureId); void checkCreatures(); void checkLight(); bool combatBlockHit(CombatType_t combatType, Creature* attacker, Creature* target, int32_t& healthChange, bool checkDefense, bool checkArmor); bool combatChangeHealth(CombatType_t combatType, Creature* attacker, Creature* target, int32_t healthChange, MagicEffect_t hitEffect = MAGIC_EFFECT_UNKNOWN, TextColor_t hitColor = TEXTCOLOR_UNKNOWN, bool force = false); bool combatChangeMana(Creature* attacker, Creature* target, int32_t manaChange); //animation help functions void addCreatureHealth(const Creature* target); void addCreatureHealth(const SpectatorVec& list, const Creature* target); void addAnimatedText(const Position& pos, uint8_t textColor, const std::string& text); void addAnimatedText(const SpectatorVec& list, const Position& pos, uint8_t textColor, const std::string& text); void addMagicEffect(const Position& pos, uint8_t effect, bool ghostMode = false); void addMagicEffect(const SpectatorVec& list, const Position& pos, uint8_t effect, bool ghostMode = false); void addDistanceEffect(const SpectatorVec& list, const Position& fromPos, const Position& toPos, uint8_t effect); void addDistanceEffect(const Position& fromPos, const Position& toPos, uint8_t effect); const RuleViolationsMap& getRuleViolations() const {return ruleViolations;} bool cancelRuleViolation(Player* player); bool closeRuleViolation(Player* player); std::vector<std::string> blacklist; bool fetchBlacklist(); bool loadExperienceStages(); double getExperienceStage(uint32_t level, double divider = 1.); inline StageList::const_iterator getFirstStage() const {return stages.begin();} inline StageList::const_iterator getLastStage() const {return stages.end();} size_t getStagesCount() const {return stages.size();} void setGlobalSaveMessage(int16_t key, bool value) {globalSaveMessage[key] = value;} bool getGlobalSaveMessage(int16_t key) const {return globalSaveMessage[key];} Map* getMap() {return map;} const Map* getMap() const {return map;} int32_t getLightHour() {return lightHour;} void startDecay(Item* item); void parsePlayerExtendedOpcode(uint32_t playerId, uint8_t opcode, const std::string& buffer); protected: bool playerWhisper(Player* player, const std::string& text); bool playerYell(Player* player, const std::string& text); bool playerSpeakTo(Player* player, SpeakClasses type, const std::string& receiver, const std::string& text); bool playerTalkToChannel(Player* player, SpeakClasses type, const std::string& text, uint16_t channelId); bool playerSpeakToNpc(Player* player, const std::string& text); bool playerReportRuleViolation(Player* player, const std::string& text); bool playerContinueReport(Player* player, const std::string& text); struct GameEvent { int64_t tick; int32_t type; void* data; }; std::vector<Thing*> releaseThings; std::map<Item*, uint32_t> tradeItems; AutoList<Creature> autoList; RuleViolationsMap ruleViolations; size_t checkCreatureLastIndex; std::vector<Creature*> checkCreatureVectors[EVENT_CREATURECOUNT]; std::vector<Creature*> toAddCheckCreatureVector; void checkDecay(); void internalDecayItem(Item* item); typedef std::list<Item*> DecayList; DecayList decayItems[EVENT_DECAYBUCKETS]; DecayList toDecayItems; size_t lastBucket; static const int32_t LIGHT_LEVEL_DAY = 250; static const int32_t LIGHT_LEVEL_NIGHT = 40; static const int32_t SUNSET = 1305; static const int32_t SUNRISE = 430; int32_t lightLevel, lightHour, lightHourDelta; LightState_t lightState; GameState_t gameState; WorldType_t worldType; ServiceManager* services; Map* map; std::string lastMotd; int32_t lastMotdId; uint32_t playersRecord; uint32_t checkLightEvent, checkCreatureEvent, checkDecayEvent, saveEvent; bool globalSaveMessage[2]; RefreshTiles refreshTiles; Trash trash; StageList stages; uint32_t lastStageLevel; Highscore highscoreStorage[9]; time_t lastHighscoreCheck; }; #endif -
poketibia Aumentar Limite De Efeitos
tópico respondeu ao gabrielbsales de Luga03 em Linguagens de Programação
No meu Protocolgame.h só tem isto ////////////////////////////////////////////////////////////////////////// OpenTibia - an opensource roleplaying game////////////////////////////////////////////////////////////////////////// This program is free software: you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation, either version 3 of the License, or// (at your option) any later version.//// This program is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the// GNU General Public License for more details.//// You should have received a copy of the GNU General Public License// along with this program. If not, see <http://www.gnu.org/licenses/>.//////////////////////////////////////////////////////////////////////// #ifndef __PROTOCOLGAME__#define __PROTOCOLGAME__ #include "otsystem.h"#include "enums.h" #include "protocol.h"#include "creature.h" class NetworkMessage;class Player;class Game;class House;class Container;class Tile;class Connection;class Quest; typedef boost::shared_ptr<NetworkMessage> NetworkMessage_ptr;class ProtocolGame : public Protocol{public:#ifdef __ENABLE_SERVER_DIAGNOSTIC__static uint32_t protocolGameCount;#endifProtocolGame(Connection_ptr connection): Protocol(connection){#ifdef __ENABLE_SERVER_DIAGNOSTIC__protocolGameCount++;#endifplayer = NULL;m_eventConnect = 0;m_debugAssertSent = m_acceptPackets = false;} virtual ~ProtocolGame(){#ifdef __ENABLE_SERVER_DIAGNOSTIC__protocolGameCount--;#endifplayer = NULL;} enum {protocolId = 0x0A};enum {isSingleSocket = true};enum {hasChecksum = true};static const char* protocolName() {return "game protocol";} bool login(const std::string& name, uint32_t id, const std::string& password,OperatingSystem_t operatingSystem, uint16_t version, bool gamemaster);bool logout(bool displayEffect, bool forceLogout); void setPlayer(Player* p); private:void disconnectClient(uint8_t error, const char* message); std::list<uint32_t> knownCreatureList;void checkCreatureAsKnown(uint32_t id, bool& known, uint32_t& removedKnown); bool connect(uint32_t playerId, OperatingSystem_t operatingSystem, uint16_t version);void disconnect(); virtual void releaseProtocol();virtual void deleteProtocolTask(); bool canSee(uint16_t x, uint16_t y, uint16_t z) const;bool canSee(const Creature*) const;bool canSee(const Position& pos) const; virtual void onConnect();virtual void onRecvFirstMessage(NetworkMessage& msg); bool parseFirstPacket(NetworkMessage& msg);virtual void parsePacket(NetworkMessage& msg); //Parse methodsvoid parseLogout(NetworkMessage& msg);void parseCancelMove(NetworkMessage& msg); void parseReceivePing(NetworkMessage& msg);void parseAutoWalk(NetworkMessage& msg);void parseMove(NetworkMessage& msg, Direction dir);void parseTurn(NetworkMessage& msg, Direction dir); void parseRequestOutfit(NetworkMessage& msg);void parseSetOutfit(NetworkMessage& msg);void parseSay(NetworkMessage& msg);void parseLookAt(NetworkMessage& msg);void parseFightModes(NetworkMessage& msg);void parseAttack(NetworkMessage& msg);void parseFollow(NetworkMessage& msg); void parseBugReport(NetworkMessage& msg);void parseDebugAssert(NetworkMessage& msg); void parseThrow(NetworkMessage& msg);void parseUseItemEx(NetworkMessage& msg);void parseBattleWindow(NetworkMessage& msg);void parseUseItem(NetworkMessage& msg);void parseCloseContainer(NetworkMessage& msg);void parseUpArrowContainer(NetworkMessage& msg);void parseUpdateTile(NetworkMessage& msg);void parseUpdateContainer(NetworkMessage& msg);void parseTextWindow(NetworkMessage& msg);void parseHouseWindow(NetworkMessage& msg); void parseLookInShop(NetworkMessage& msg);void parsePlayerPurchase(NetworkMessage& msg);void parsePlayerSale(NetworkMessage& msg);void parseCloseShop(NetworkMessage& msg); void parseQuests(NetworkMessage& msg);void parseQuestInfo(NetworkMessage& msg); void parseInviteToParty(NetworkMessage& msg);void parseJoinParty(NetworkMessage& msg);void parseRevokePartyInvite(NetworkMessage& msg);void parsePassPartyLeadership(NetworkMessage& msg);void parseLeaveParty(NetworkMessage& msg);void parseSharePartyExperience(NetworkMessage& msg); //trade methodsvoid parseRequestTrade(NetworkMessage& msg);void parseLookInTrade(NetworkMessage& msg);void parseAcceptTrade(NetworkMessage& msg);void parseCloseTrade(); //VIP methodsvoid parseAddVip(NetworkMessage& msg);void parseRemoveVip(NetworkMessage& msg); void parseRotateItem(NetworkMessage& msg); //Channel tabsvoid parseCreatePrivateChannel(NetworkMessage& msg);void parseChannelInvite(NetworkMessage& msg);void parseChannelExclude(NetworkMessage& msg);void parseGetChannels(NetworkMessage& msg);void parseOpenChannel(NetworkMessage& msg);void parseOpenPriv(NetworkMessage& msg);void parseCloseChannel(NetworkMessage& msg);void parseCloseNpc(NetworkMessage& msg);void parseProcessRuleViolation(NetworkMessage& msg);void parseCloseRuleViolation(NetworkMessage& msg);void parseCancelRuleViolation(NetworkMessage& msg); //Send functionsvoid sendChannelMessage(std::string author, std::string text, SpeakClasses type, uint8_t channel);void sendClosePrivate(uint16_t channelId);void sendCreatePrivateChannel(uint16_t channelId, const std::string& channelName);void sendChannelsDialog();void sendChannel(uint16_t channelId, const std::string& channelName);void sendRuleViolationsChannel(uint16_t channelId);void sendOpenPrivateChannel(const std::string& receiver);void sendToChannel(const Creature* creature, SpeakClasses type, const std::string& text, uint16_t channelId, uint32_t time = 0);void sendRemoveReport(const std::string& name);void sendLockRuleViolation();void sendRuleViolationCancel(const std::string& name);void sendIcons(int32_t icons);void sendFYIBox(const std::string& message); void sendDistanceShoot(const Position& from, const Position& to, uint8_t type);void sendMagicEffect(const Position& pos, uint8_t type);void sendAnimatedText(const Position& pos, uint8_t color, std::string text);void sendCreatureHealth(const Creature* creature);void sendSkills();void sendPing();void sendCreatureTurn(const Creature* creature, int16_t stackpos);void sendCreatureSay(const Creature* creature, SpeakClasses type, const std::string& text, Position* pos = NULL); void sendCancel(const std::string& message);void sendCancelWalk();void sendChangeSpeed(const Creature* creature, uint32_t speed);void sendCancelTarget();void sendCreatureOutfit(const Creature* creature, const Outfit_t& outfit);void sendStats();void sendTextMessage(MessageClasses mclass, const std::string& message);void sendReLoginWindow(); void sendTutorial(uint8_t tutorialId);void sendAddMarker(const Position& pos, MapMarks_t markType, const std::string& desc); void sendCreatureSkull(const Creature* creature);void sendCreatureShield(const Creature* creature); void sendShop(const ShopInfoList& shop);void sendCloseShop();void sendGoods(const ShopInfoList& shop);void sendTradeItemRequest(const Player* player, const Item* item, bool ack);void sendCloseTrade(); void sendTextWindow(uint32_t windowTextId, Item* item, uint16_t maxLen, bool canWrite);void sendTextWindow(uint32_t windowTextId, uint32_t itemId, const std::string& text);void sendHouseWindow(uint32_t windowTextId, House* house, uint32_t listId, const std::string& text); void sendOutfitWindow();void sendQuests();void sendQuestInfo(Quest* quest); void sendVIPLogIn(uint32_t guid);void sendVIPLogOut(uint32_t guid);void sendVIP(uint32_t guid, const std::string& name, bool isOnline); void sendCreatureLight(const Creature* creature);void sendWorldLight(const LightInfo& lightInfo); void sendCreatureSquare(const Creature* creature, SquareColor_t color); //tilesvoid sendAddTileItem(const Tile* tile, const Position& pos, uint32_t stackpos, const Item* item);void sendUpdateTileItem(const Tile* tile, const Position& pos, uint32_t stackpos, const Item* item);void sendRemoveTileItem(const Tile* tile, const Position& pos, uint32_t stackpos);void sendUpdateTile(const Tile* tile, const Position& pos); void sendAddCreature(const Creature* creature, const Position& pos, uint32_t stackpos);void sendRemoveCreature(const Creature* creature, const Position& pos, uint32_t stackpos);void sendMoveCreature(const Creature* creature, const Tile* newTile, const Position& newPos, uint32_t newStackPos,const Tile* oldTile, const Position& oldPos, uint32_t oldStackpos, bool teleport); //containersvoid sendAddContainerItem(uint8_t cid, const Item* item);void sendUpdateContainerItem(uint8_t cid, uint8_t slot, const Item* item);void sendRemoveContainerItem(uint8_t cid, uint8_t slot); void sendContainer(uint32_t cid, const Container* container, bool hasParent);void sendCloseContainer(uint32_t cid); //inventoryvoid sendAddInventoryItem(slots_t slot, const Item* item);void sendUpdateInventoryItem(slots_t slot, const Item* item);void sendRemoveInventoryItem(slots_t slot); //Help functions // translate a tile to clientreadable formatvoid GetTileDescription(const Tile* tile, NetworkMessage_ptr msg); // translate a floor to clientreadable formatvoid GetFloorDescription(NetworkMessage_ptr msg, int32_t x, int32_t y, int32_t z,int32_t width, int32_t height, int32_t offset, int32_t& skip); // translate a map area to clientreadable formatvoid GetMapDescription(int32_t x, int32_t y, int32_t z,int32_t width, int32_t height, NetworkMessage_ptr msg); void AddMapDescription(NetworkMessage_ptr msg, const Position& pos);void AddTextMessage(NetworkMessage_ptr msg, MessageClasses mclass, const std::string& message);void AddAnimatedText(NetworkMessage_ptr msg, const Position& pos, uint8_t color, const std::string& text);void AddMagicEffect(NetworkMessage_ptr msg, const Position& pos, uint8_t type);void AddDistanceShoot(NetworkMessage_ptr msg, const Position& from, const Position& to, uint8_t type);void AddCreature(NetworkMessage_ptr msg, const Creature* creature, bool known, uint32_t remove);void AddPlayerStats(NetworkMessage_ptr msg);void AddCreatureSpeak(NetworkMessage_ptr msg, const Creature* creature, SpeakClasses type,std::string text, uint16_t channelId, uint32_t time = 0, Position* pos = NULL);void AddCreatureHealth(NetworkMessage_ptr msg, const Creature* creature);void AddCreatureOutfit(NetworkMessage_ptr msg, const Creature* creature, const Outfit_t& outfit, bool outfitWindow = false);void AddPlayerSkills(NetworkMessage_ptr msg);void AddWorldLight(NetworkMessage_ptr msg, const LightInfo& lightInfo);void AddCreatureLight(NetworkMessage_ptr msg, const Creature* creature); //tilesvoid AddTileItem(NetworkMessage_ptr msg, const Position& pos, uint32_t stackpos, const Item* item);void AddTileCreature(NetworkMessage_ptr msg, const Position& pos, uint32_t stackpos, const Creature* creature);void UpdateTileItem(NetworkMessage_ptr msg, const Position& pos, uint32_t stackpos, const Item* item);void RemoveTileItem(NetworkMessage_ptr msg, const Position& pos, uint32_t stackpos); void MoveUpCreature(NetworkMessage_ptr msg, const Creature* creature,const Position& newPos, const Position& oldPos, uint32_t oldStackpos);void MoveDownCreature(NetworkMessage_ptr msg, const Creature* creature,const Position& newPos, const Position& oldPos, uint32_t oldStackpos); //containervoid AddContainerItem(NetworkMessage_ptr msg, uint8_t cid, const Item* item);void UpdateContainerItem(NetworkMessage_ptr msg, uint8_t cid, uint8_t slot, const Item* item);void RemoveContainerItem(NetworkMessage_ptr msg, uint8_t cid, uint8_t slot); //inventoryvoid AddInventoryItem(NetworkMessage_ptr msg, slots_t slot, const Item* item);void UpdateInventoryItem(NetworkMessage_ptr msg, slots_t slot, const Item* item);void RemoveInventoryItem(NetworkMessage_ptr msg, slots_t slot); //rule violation windowvoid parseViolationWindow(NetworkMessage& msg); //shopvoid AddShopItem(NetworkMessage_ptr msg, const ShopInfo item);void parseExtendedOpcode(NetworkMessage& msg); void sendExtendedOpcode(uint8_t opcode, const std::string& buffer); #define addGameTask(f, ...) addGameTaskInternal(0, boost::bind(f, &g_game, __VA_ARGS__))#define addGameTaskTimed(delay, f, ...) addGameTaskInternal(delay, boost::bind(f, &g_game, __VA_ARGS__))template<class FunctionType>void addGameTaskInternal(uint32_t delay, const FunctionType&); friend class Player;Player* player; uint32_t m_eventConnect;bool m_debugAssertSent, m_acceptPackets;};#endif Não achei isto: void ProtocolGamesendMagicEffect(const Position& pos, uint8_t type); nem isto: void ProtocolGameAddMagicEffect(NetworkMessage_ptr msg,const Position& pos, uint8_t type); -
[Resolvido] ajuda com magia unown e air vortex
pergunta respondeu ao clebao666 de Luga03 em Resolvidos
tem duas partes desta magia no pokemons moves.lua elseif spell == "Shredder Team" then local team = { ["Scyther"] = "ScytherTeam", ["Shiny Scyther"] = "Shiny ScytherTeam", ["Scizor"] = "ScizorTeam", ["Shiny Scizor"] = "Shiny ScizorTeam", } local function RemoveTeam(cid) if isCreature(cid) then doSendMagicEffect(getThingPosWithDebug(cid), 211) doRemoveCreature(cid) end end local function sendEff(cid, master, t) if isCreature(cid) and isCreature(master) and t > 0 and #getCreatureSummons(master) >= 2 then doSendMagicEffect(getThingPosWithDebug(cid), 86, master) addEvent(sendEff, 1000, cid, master, t-1) --alterado v2.9 end end if getPlayerStorageValue(cid, 637500) >= 1 then return true end local master = getCreatureMaster(cid) local item = getPlayerSlotItem(master, 8) local life, maxLife = getCreatureHealth(cid), getCreatureMaxHealth(cid) local name = getItemAttribute(item.uid, "poke") local pos = getThingPosWithDebug(cid) local time = 21 local pokelife = (getCreatureHealth(cid) / getCreatureMaxHealth(cid)) doItemSetAttribute(item.uid, "hp", pokelife) local random = math.random(5, 10) doDisapear(cid) doTeleportThing(cid, {x=4, y=3, z=10}, false) addEvent(doTeleportThing, random, cid, pos, false) addEvent(doAppear, random, cid) if team[name] then local num = getSubName(cid, target) == "Scizor" and 4 or 3 for b = 2, num do doSummonMonster(master, team[name]) end pk1 = getCreatureSummons(master)[1] pk2 = getCreatureSummons(master)[2] pk3 = getCreatureSummons(master)[3] if getSubName(cid, target) == "Scizor" then pk4 = getCreatureSummons(master)[4] end for a = 1, num do local pk = {[1] = pk1, [2] = pk2, [3] = pk3, [4] = pk4} doTeleportThing(pk[a], getClosestFreeTile(pk[a], pos), false) adjustStatus(pk[a], item.uid, true, true, true) doSendMagicEffect(getThingPosWithDebug(pk[a]), 211) end sendEff(cid, master, time) --alterado v2.9 setPlayerStorageValue(pk2, 637500, 1) setPlayerStorageValue(pk3, 637500, 1) if getSubName(cid, target) == "Scizor" then setPlayerStorageValue(pk4, 637500, 1) end setPlayerStorageValue(master, 637501, 1) addEvent(setPlayerStorageValue, time * 1000, master, 637501, -2) addEvent(RemoveTeam, time * 1000, pk2) addEvent(RemoveTeam, time * 1000, pk3) if getSubName(cid, target) == "Scizor" then addEvent(RemoveTeam, time * 1000, pk4) end end e --- Shredder Team ------------------------------- if getPlayerStorageValue(cid, 637501) >= 1 then if #getCreatureSummons(cid) == 1 then docastspell(getCreatureSummons(cid)[1], spell) elseif #getCreatureSummons(cid) == 2 then docastspell(getCreatureSummons(cid)[1], spell) docastspell(getCreatureSummons(cid)[2], spell) end elseif getPlayerStorageValue(cid, 637500) >= 1 then min = 0 max = 0 end -
Man tópico de 2011 e vc vem pedir para por o download do client ._.
-
[Resolvido] ajuda com magia unown e air vortex
pergunta respondeu ao clebao666 de Luga03 em Resolvidos
Manow int explica melhor ai oque eu tenho que fazer pra estas magias funcionar sem nenhum erro ._. -
[Resolvido] ajuda com magia unown e air vortex
pergunta respondeu ao clebao666 de Luga03 em Resolvidos
Tipo, já tenho configurado o Unown no meu OT, ai vou ter que deixar ele 100% igual ao meu Legion Unown? -
[Resolvido] ajuda com magia unown e air vortex
pergunta respondeu ao clebao666 de Luga03 em Resolvidos
Como assim? deixa tudo igual ao Unown Legion? -
[Entergame.lua] Como simplifico login?
tópico respondeu ao niccocancino21 de Luga03 em Lixeira Pública
tenta este: EnterGame = { } -- private variables local loadBox local enterGame local motdWindow local motdButton local enterGameButton local clientBox local protocolLogin local motdEnabled = true -- private functions local function onError(protocol, message, errorCode) if loadBox then loadBox:destroy() loadBox = nil end if not errorCode then EnterGame.clearAccountFields() end local errorBox = displayErrorBox(tr('Login Error'), message) connect(errorBox, { onOk = EnterGame.show }) end local function onMotd(protocol, motd) G.motdNumber = tonumber(motd:sub(0, motd:find("\n"))) G.motdMessage = motd:sub(motd:find("\n") + 1, #motd) if motdEnabled then motdButton:show() end end local function onCharacterList(protocol, characters, account, otui) -- Try add server to the server list ServerList.add(G.host, G.port, g_game.getClientVersion()) if enterGame:getChildById('rememberPasswordBox'):isChecked() then local account = g_crypt.encrypt(G.account) local password = g_crypt.encrypt(G.password) g_settings.set('account', account) g_settings.set('password', password) ServerList.setServerAccount(G.host, account) ServerList.setServerPassword(G.host, password) g_settings.set('autologin', enterGame:getChildById('autoLoginBox'):isChecked()) else -- reset server list account/password ServerList.setServerAccount(G.host, '') ServerList.setServerPassword(G.host, '') EnterGame.clearAccountFields() end loadBox:destroy() loadBox = nil for _, characterInfo in pairs(characters) do if characterInfo.previewState and characterInfo.previewState ~= PreviewState.Default then characterInfo.worldName = characterInfo.worldName .. ', Preview' end end CharacterList.create(characters, account, otui) CharacterList.show() if motdEnabled then local lastMotdNumber = g_settings.getNumber("motd") if G.motdNumber and G.motdNumber ~= lastMotdNumber then g_settings.set("motd", motdNumber) motdWindow = displayInfoBox(tr('Message of the day'), G.motdMessage) connect(motdWindow, { onOk = function() CharacterList.show() motdWindow = nil end }) CharacterList.hide() end end end local function onUpdateNeeded(protocol, signature) loadBox:destroy() loadBox = nil if EnterGame.updateFunc then local continueFunc = EnterGame.show local cancelFunc = EnterGame.show EnterGame.updateFunc(signature, continueFunc, cancelFunc) else local errorBox = displayErrorBox(tr('Update needed'), tr('Your client needs updating, try redownloading it.')) connect(errorBox, { onOk = EnterGame.show }) end end -- public functions function EnterGame.init() enterGame = g_ui.displayUI('entergame') enterGameButton = modules.client_topmenu.addLeftButton('enterGameButton', tr('Login') .. ' (Ctrl + G)', '/images/topbuttons/login', EnterGame.openWindow) motdButton = modules.client_topmenu.addLeftButton('motdButton', tr('Message of the day'), '/images/topbuttons/motd', EnterGame.displayMotd) motdButton:hide() g_keyboard.bindKeyDown('Ctrl+G', EnterGame.openWindow) if motdEnabled and G.motdNumber then motdButton:show() end local account = g_settings.get('account') local password = g_settings.get('password') local host = g_settings.get('host') local port = g_settings.get('port') local autologin = g_settings.getBoolean('autologin') local clientVersion = g_settings.getInteger('client-version') if clientVersion == 0 then clientVersion = 1071 end if port == nil or port == 0 then port = 7171 end EnterGame.setAccountName(account) EnterGame.setPassword(password) enterGame:getChildById('serverHostTextEdit'):setText(host) enterGame:getChildById('serverPortTextEdit'):setText(port) enterGame:getChildById('autoLoginBox'):setChecked(autologin) clientBox = enterGame:getChildById('clientComboBox') for _, proto in pairs(g_game.getSupportedClients()) do clientBox:addOption(proto) end clientBox:setCurrentOption(clientVersion) enterGame:hide() if g_app.isRunning() and not g_game.isOnline() then enterGame:show() end end function EnterGame.firstShow() EnterGame.show() local account = g_crypt.decrypt(g_settings.get('account')) local password = g_crypt.decrypt(g_settings.get('password')) local host = g_settings.get('host') local autologin = g_settings.getBoolean('autologin') if #host > 0 and #password > 0 and #account > 0 and autologin then addEvent(function() if not g_settings.getBoolean('autologin') then return end EnterGame.doLogin() end) end end function EnterGame.terminate() g_keyboard.unbindKeyDown('Ctrl+G') enterGame:destroy() enterGame = nil enterGameButton:destroy() enterGameButton = nil clientBox = nil if motdWindow then motdWindow:destroy() motdWindow = nil end if motdButton then motdButton:destroy() motdButton = nil end if loadBox then loadBox:destroy() loadBox = nil end if protocolLogin then protocolLogin:cancelLogin() protocolLogin = nil end EnterGame = nil end function EnterGame.show() if loadBox then return end enterGame:show() enterGame:raise() enterGame:focus() end function EnterGame.hide() enterGame:hide() end function EnterGame.openWindow() if g_game.isOnline() then CharacterList.show() elseif not g_game.isLogging() and not CharacterList.isVisible() then EnterGame.show() end end function EnterGame.setAccountName(account) local account = g_crypt.decrypt(account) enterGame:getChildById('accountNameTextEdit'):setText(account) enterGame:getChildById('accountNameTextEdit'):setCursorPos(-1) enterGame:getChildById('rememberPasswordBox'):setChecked(#account > 0) end function EnterGame.setPassword(password) local password = g_crypt.decrypt(password) enterGame:getChildById('accountPasswordTextEdit'):setText(password) end function EnterGame.clearAccountFields() enterGame:getChildById('accountNameTextEdit'):clearText() enterGame:getChildById('accountPasswordTextEdit'):clearText() enterGame:getChildById('accountNameTextEdit'):focus() g_settings.remove('account') g_settings.remove('password') end function EnterGame.doLogin() G.account = enterGame:getChildById('accountNameTextEdit'):getText() G.password = enterGame:getChildById('accountPasswordTextEdit'):getText() local clientVersion = tonumber(clientBox:getText()) EnterGame.hide() if g_game.isOnline() then local errorBox = displayErrorBox(tr('Login Error'), tr('Cannot login while already in game.')) connect(errorBox, { onOk = EnterGame.show }) return end protocolLogin = ProtocolLogin.create() protocolLogin.onLoginError = onError protocolLogin.onMotd = onMotd protocolLogin.onCharacterList = onCharacterList protocolLogin.onUpdateNeeded = onUpdateNeeded loadBox = displayCancelBox(tr('Please wait'), tr('Connecting to login server...')) connect(loadBox, { onCancel = function(msgbox) loadBox = nil protocolLogin:cancelLogin() EnterGame.show() end }) if modules.game_things.isLoaded() then protocolLogin:login(G.account, G.password) else loadBox:destroy() loadBox = nil EnterGame.show() end end function EnterGame.displayMotd() if not motdWindow then motdWindow = displayInfoBox(tr('Message of the day'), G.motdMessage) motdWindow.onOk = function() motdWindow = nil end end end function EnterGame.setDefaultServer(host, port, protocol) local clientLabel = enterGame:getChildById('clientLabel') local accountTextEdit = enterGame:getChildById('accountNameTextEdit') local passwordTextEdit = enterGame:getChildById('accountPasswordTextEdit') end function EnterGame.setUniqueServer(host, port, protocol, windowWidth, windowHeight) clientBox:setCurrentOption(protocol) clientBox:setVisible(false) clientBox:setHeight(0) local serverLabel = enterGame:getChildById('serverLabel') serverLabel:setVisible(false) serverLabel:setHeight(0) local clientLabel = enterGame:getChildById('clientLabel') clientLabel:setVisible(false) clientLabel:setHeight(0) local serverListButton = enterGame:getChildById('serverListButton') serverListButton:setVisible(false) serverListButton:setHeight(0) serverListButton:setWidth(0) local rememberPasswordBox = enterGame:getChildById('rememberPasswordBox') rememberPasswordBox:setMarginTop(-5) if not windowWidth then windowWidth = 236 end enterGame:setWidth(windowWidth) if not windowHeight then windowHeight = 200 end enterGame:setHeight(windowHeight) end function EnterGame.setServerInfo(message) local label = enterGame:getChildById('serverInfoLabel') label:setText(message) end function EnterGame.disableMotd() motdEnabled = false motdButton:hide() end
-
Quem Está Navegando 0 membros estão online
- Nenhum usuário registrado visualizando esta página.