akira021 28 Postado Maio 17, 2013 Share Postado Maio 17, 2013 humm, eu testei na [8.6 (0.4)] e nao funfou mais tudo bem 8.54 0.3.6 eh oq eu uso msm, tava soh testando ai, vlw Banana, Rep+ Link para o comentário https://xtibia.com/forum/topic/213108-c-opcode-vers%C3%A3o-854/page/2/#findComment-1521713 Compartilhar em outros sites More sharing options...
BananaFight 196 Postado Maio 17, 2013 Autor Share Postado Maio 17, 2013 Akira, Se você tem a 0.4, você tem que usar a versão original dela, isso é uma adaptação. Link para o comentário https://xtibia.com/forum/topic/213108-c-opcode-vers%C3%A3o-854/page/2/#findComment-1521749 Compartilhar em outros sites More sharing options...
3145288 17 Postado Junho 29, 2013 Share Postado Junho 29, 2013 qual versao do otclient utilizada? compilei nas sources 0.3.6pl1 e nao funfou, da erro no client ao usar a funcao... adaptei as sources no 0.4_DEV e tbm nao funcionou... acredito que seja a minha versao do otclient (testei na 0.6.1 e 0.6.2) Link para o comentário https://xtibia.com/forum/topic/213108-c-opcode-vers%C3%A3o-854/page/2/#findComment-1535377 Compartilhar em outros sites More sharing options...
M4TH3U5 11 Postado Agosto 4, 2013 Share Postado Agosto 4, 2013 (editado) Essa barra causaria um erro? enum OperatingSystem_t{CLIENTOS_LINUX = 0x01,CLIENTOS_WINDOWS = 0x02,CLIENTOS_OTCLIENT_LINUX = 0x0A,CLIENTOS_OTCLIENT_WINDOWS = 0x0B,CLIENTOS_OTCLIENT_MAC = 0x0C,};/ Editado Agosto 4, 2013 por R1B31R0 Link para o comentário https://xtibia.com/forum/topic/213108-c-opcode-vers%C3%A3o-854/page/2/#findComment-1547123 Compartilhar em outros sites More sharing options...
OriGM 25 Postado Outubro 2, 2013 Share Postado Outubro 2, 2013 R1B31R0 ,sim causaria como causou! rsrs Estava dando erro,e fui analisar as linhas de erro,e graças a essa barra não estava compilando. Sei que o TÓPICO é velho,mas acredito que pessoas como eu ainda busca informações antigas,e pode acabar deparando com o mesmo problema,então basta retirar a barra "/" no final do código do arquivo enums.h Abração. Link para o comentário https://xtibia.com/forum/topic/213108-c-opcode-vers%C3%A3o-854/page/2/#findComment-1568285 Compartilhar em outros sites More sharing options...
Vinc 101 Postado Dezembro 3, 2013 Share Postado Dezembro 3, 2013 aqui o send funciona normal, mas o parse(creature event) n faz nada(n da nenhum erro),já conferi e ta igualzinho ao que esta ai Link para o comentário https://xtibia.com/forum/topic/213108-c-opcode-vers%C3%A3o-854/page/2/#findComment-1588663 Compartilhar em outros sites More sharing options...
Waterson 9 Postado Janeiro 2, 2014 Share Postado Janeiro 2, 2014 Estou tentando usar em uma versão nova 9.83, e não está funcionando corretamente a função doSendPlayerExtendedOpCode, logo abaixo segue o script e o erro no console, sei que estão realmente instaladas porque usei a seguinte função >isPlayerUsingOtclient(cid) e ela funcionou corretamente; Script extendedopcodes.lua em creaturescripts: OPCODE_LANGUAGE = 1 function onExtendedOpcode(cid, opcode, buffer) if(opcode == OPCODE_LANGUAGE) then -- otclient language if(buffer == 'en' or buffer == 'pt') then -- example, setting player language, because otclient is multi-language... --doCreatureSetStorage(cid, CREATURE_STORAGE_LANGUAGE, buffer) end else -- other opcodes can be ignored, and the server will just work fine... end end function onExtendedOpcode(cid, opcode, buffer) if isPlayerUsingOtclient(cid) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "YOU USE OTCLIENT") -- estou recebendo a menssagem end if opcode == 25 then doSendPlayerExtendedOpcode(cid, 26, "ALOU") end return true end Erro no console server: [2/1/2014 6:13:12] [Error - CreatureScript Interface] [2/1/2014 6:13:12] data/creaturescripts/scripts/extendedopcode.lua:onExtendedOpcode [2/1/2014 6:13:12] Description: [2/1/2014 6:13:12] data/creaturescripts/scripts/extendedopcode.lua:19: attempt to call global 'doSendPlayerExtendedOpcode' (a nil value) [2/1/2014 6:13:12] stack traceback: [2/1/2014 6:13:12] data/creaturescripts/scripts/extendedopcode.lua:19: in function <data/creaturescripts/scripts/extendedopcode.lua:14> Link para o comentário https://xtibia.com/forum/topic/213108-c-opcode-vers%C3%A3o-854/page/2/#findComment-1597805 Compartilhar em outros sites More sharing options...
Gufipl 3 Postado Abril 30, 2017 Share Postado Abril 30, 2017 Adaptação pra source 8.54+ LEMBRE-SE, ISSO É NA SOURCE DO SERVIDOR Vamos ao código. protocolgame.h Embaixo de void AddShopItem(NetworkMessage_ptr msg, const ShopInfo item); Adicione void parseExtendedOpcode(NetworkMessage& msg); void sendExtendedOpcode(uint8_t opcode, const std::string& buffer); protocolgame.cpp Embaixo de uint32_t key[4] = {msg.GetU32(), msg.GetU32(), msg.GetU32(), msg.GetU32()}; enableXTEAEncryption(); setXTEAKey(key); Adicione // notifies to otclient that this server can receive extended game protocol opcodes if(operatingSystem >= CLIENTOS_OTCLIENT_LINUX) sendExtendedOpcode(0x00, std::string()); Embaixo de void ProtocolGame::AddShopItem(NetworkMessage_ptr msg, const ShopInfo item) { const ItemType& it = Item::items[item.itemId]; msg->AddU16(it.clientId); if(it.isSplash() || it.isFluidContainer()) msg->AddByte(fluidMap[item.subType % 8]); else if(it.stackable || it.charges) msg->AddByte(item.subType); else msg->AddByte(0x01); msg->AddString(item.itemName); msg->AddU32(uint32_t(it.weight * 100)); msg->AddU32(item.buyPrice); msg->AddU32(item.sellPrice); } Adicione void ProtocolGame::parseExtendedOpcode(NetworkMessage& msg) { uint8_t opcode = msg.GetByte(); std::string buffer = msg.GetString(); // process additional opcodes via lua script event addGameTask(&Game::parsePlayerExtendedOpcode, player->getID(), opcode, buffer); } void ProtocolGame::sendExtendedOpcode(uint8_t opcode, const std::string& buffer) { // extended opcodes can only be send to players using otclient, cipsoft's tibia can't understand them NetworkMessage_ptr msg = getOutputBuffer(); if(msg) { TRACK_MESSAGE(msg); msg->AddByte(0x32); msg->AddByte(opcode); msg->AddString(buffer); } } Embaixo de case 0x1E: // keep alive / ping response parseReceivePing(msg); break; Adicione case 0x32: // otclient extended opcode parseExtendedOpcode(msg); break; enums.h Embaixo de enum GuildLevel_t { GUILDLEVEL_NONE = 0, GUILDLEVEL_MEMBER, GUILDLEVEL_VICE, GUILDLEVEL_LEADER }; Substitua o OperatingSystem por este enum OperatingSystem_t { CLIENTOS_LINUX = 0x01, CLIENTOS_WINDOWS = 0x02, CLIENTOS_OTCLIENT_LINUX = 0x0A, CLIENTOS_OTCLIENT_WINDOWS = 0x0B, CLIENTOS_OTCLIENT_MAC = 0x0C, };/ player.h Embaixo de void sendCreatureShield(const Creature* creature) Adicione void sendExtendedOpcode(uint8_t opcode, const std::string& buffer) {if(client) client->sendExtendedOpcode(opcode, buffer);} luascript.cpp Embaixo de void LuaScriptInterface::registerFunctions() { Adicione //doSendPlayerExtendedOpcode(cid, opcode, buffer) lua_register(m_luaState, "doSendPlayerExtendedOpcode", LuaScriptInterface::luaDoSendPlayerExtendedOpcode); Embaixo de SHIFT_OPERATOR(int32_t, LeftShift, <<) SHIFT_OPERATOR(int32_t, RightShift, >>) SHIFT_OPERATOR(uint32_t, ULeftShift, <<) SHIFT_OPERATOR(uint32_t, URightShift, >>) #undef SHIFT_OPERATOR Adicione int32_t LuaScriptInterface::luaDoSendPlayerExtendedOpcode(lua_State* L) { //doSendPlayerExtendedOpcode(cid, opcode, buffer) std::string buffer = popString(L); int opcode = popNumber(L); ScriptEnviroment* env = getEnv(); if(Player* player = env->getPlayerByUID(popNumber(L))) { player->sendExtendedOpcode(opcode, buffer); lua_pushboolean(L, true); } lua_pushboolean(L, false); return 1; } luascript.h Embaixo de virtual void registerFunctions(); Adicione static int32_t luaDoSendPlayerExtendedOpcode(lua_State* L); creatureevent.h . Substitua CREATURE_EVENT_PREPAREDEATH Por isso CREATURE_EVENT_PREPAREDEATH, CREATURE_EVENT_EXTENDED_OPCODE // otclient additional network opcodes Embaixo de uint32_t executePrepareDeath(Creature* creature, DeathList deathList); Adicione uint32_t executeExtendedOpcode(Creature* creature, uint8_t opcode, const std::string& buffer); creatureevent.cpp Embaixo de else if(tmpStr == "death") m_type = CREATURE_EVENT_DEATH; Adicione else if(tmpStr == "extendedopcode") m_type = CREATURE_EVENT_EXTENDED_OPCODE; Embaixo de case CREATURE_EVENT_DEATH: return "onDeath"; Adicione case CREATURE_EVENT_EXTENDED_OPCODE: return "onExtendedOpcode"; Embaixo de case CREATURE_EVENT_DEATH: return "cid, corpse, deathList"; Adicione case CREATURE_EVENT_EXTENDED_OPCODE: return "cid, opcode, buffer"; Embaixo de std::cout << "[Error - CreatureEvent::executeFollow] Call stack overflow." << std::endl; return 0; } } Adicione uint32_t CreatureEvent::executeExtendedOpcode(Creature* creature, uint8_t opcode, const std::string& buffer) { //onExtendedOpcode(cid, opcode, buffer) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(creature->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(creature) << std::endl; scriptstream << "local opcode = " << (int)opcode << std::endl; scriptstream << "local buffer = " << buffer.c_str() << std::endl; scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ char desc[35]; sprintf(desc, "%s", player->getName().c_str()); env->setEvent(desc); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(creature->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(creature)); lua_pushnumber(L, opcode); lua_pushlstring(L, buffer.c_str(), buffer.length()); bool result = m_interface->callFunction(3); m_interface->releaseEnv(); return result; } } else { std::cout << "[Error - CreatureEvent::executeRemoved] Call stack overflow." << std::endl; return 0; } } game.h Embaixo de int32_t getLightHour() {return lightHour;} void startDecay(Item* item); Adicione void parsePlayerExtendedOpcode(uint32_t playerId, uint8_t opcode, const std::string& buffer); game.cpp Embaixo de player->sendTextMessage(MSG_INFO_DESCR, buffer); } Adicione void Game::parsePlayerExtendedOpcode(uint32_t playerId, uint8_t opcode, const std::string& buffer) { Player* player = getPlayerByID(playerId); if(!player || player->isRemoved()) return; CreatureEventList extendedOpcodeEvents = player->getCreatureEvents(CREATURE_EVENT_EXTENDED_OPCODE); for(CreatureEventList::iterator it = extendedOpcodeEvents.begin(); it != extendedOpcodeEvents.end(); ++it) (*it)->executeExtendedOpcode(player, opcode, buffer); } /creaturescripts/creaturescrips.xml /creaturescripts/extendedopcode.lua OPCODE_LANGUAGE = 1 function onExtendedOpcode(cid, opcode, buffer) if opcode == OPCODE_LANGUAGE then -- otclient language if buffer == 'en' or buffer == 'pt' then -- example, setting player language, because otclient is multi-language... --doCreatureSetStorage(cid, CREATURE_STORAGE_LANGUAGE, buffer) end else -- other opcodes can be ignored, and the server will just work fine... end end Link para o comentário https://xtibia.com/forum/topic/213108-c-opcode-vers%C3%A3o-854/page/2/#findComment-1716874 Compartilhar em outros sites More sharing options...
Luquinhas Brito 0 Postado Setembro 7, 2017 Share Postado Setembro 7, 2017 Quando eu tento logar o executavel fecha automaticamente. Link para o comentário https://xtibia.com/forum/topic/213108-c-opcode-vers%C3%A3o-854/page/2/#findComment-1721800 Compartilhar em outros sites More sharing options...
NiCaDo 4 Postado Junho 4, 2019 Share Postado Junho 4, 2019 (editado) Resolvido Editado Maio 15, 2020 por NiCaDo coloquei apenas a parte importante do assunto Link para o comentário https://xtibia.com/forum/topic/213108-c-opcode-vers%C3%A3o-854/page/2/#findComment-1751863 Compartilhar em outros sites More sharing options...
KaboFlow 54 Postado Maio 15, 2020 Share Postado Maio 15, 2020 Em 26/04/2013 em 20:29, BananaFight disse: Serve para comunicar servidor com client, Com isso é possível criar muitos sistemas, como de andar e soltar som etc. void AddShopItem(NetworkMessage_ptr msg, const ShopInfo item); Link para o comentário https://xtibia.com/forum/topic/213108-c-opcode-vers%C3%A3o-854/page/2/#findComment-1759681 Compartilhar em outros sites More sharing options...
NiCaDo 4 Postado Maio 15, 2020 Share Postado Maio 15, 2020 9 horas atrás, KaboFlow disse: void AddShopItem(NetworkMessage_ptr msg, const ShopInfo item); Consagrado não sei se entendi direito mas void AddShopItem(NetworkMessage_ptr msg, const ShopInfo item); e em protocolgame.h Link para o comentário https://xtibia.com/forum/topic/213108-c-opcode-vers%C3%A3o-854/page/2/#findComment-1759689 Compartilhar em outros sites More sharing options...
KaboFlow 54 Postado Maio 15, 2020 Share Postado Maio 15, 2020 3 horas atrás, NiCaDo disse: Consagrado não sei se entendi direito mas void AddShopItem(NetworkMessage_ptr msg, const ShopInfo item); e em protocolgame.h nao mano meu source nao tenhe void AddShopItem(NetworkMessage_ptr msg, const ShopInfo item); to com um source d DXP Link para o comentário https://xtibia.com/forum/topic/213108-c-opcode-vers%C3%A3o-854/page/2/#findComment-1759695 Compartilhar em outros sites More sharing options...
Posts Recomendados