Strogman 89 Posted December 24, 2015 Report Share Posted December 24, 2015 exclusividade xtibia porfavor não postar em outro forum system exclusivo para o xtibia Bom vi muito gente a traz desse sistema e, então resolvi fazer esse nick para ajudar a galera que quer sair do Lixo do pda e começar um projeto bom com os open source. para quem não sabe, nick system é um system muito popular na família dos poketibias, é um system que muda o nome/adiciona um apelido no personagem, muda o nome de exibição no client o nome que fica em cima do personagem no jogo. fulano: Gristony como essa função funciona? Gristony: exatamente igual a do pda! Em ProtocolGame.cpp em baixo de: void ProtocolGameAddShopItem(NetworkMessage_ptr msg, const ShopInfo item){ const ItemType& it = Itemitems[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 ProtocolGamereloadCreature(const Creature* creature){ if(!canSee(creature)) return; // we are cheating the client in here! uint32_t stackpos = creature->getTile()->getClientIndexOfThing(player, creature); if(stackpos >= 10) return; NetworkMessage_ptr msg = getOutputBuffer(); if(msg) { TRACK_MESSAGE(msg); stdlist<uint32_t>iterator it = stdfind(knownCreatureList.begin(), knownCreatureList.end(), creature->getID()); if(it != knownCreatureList.end()) { RemoveTileItem(msg, creature->getPosition(), stackpos); msg->AddByte(0x6A); msg->AddPosition(creature->getPosition()); msg->AddByte(stackpos); AddCreature(msg, creature, false, creature->getID()); } else AddTileCreature(msg, creature->getPosition(), stackpos, creature); }}void ProtocolGamesendCreatureNick(const Creature* creature){ reloadCreature(creature);} Em ProtocolGame.h em baixo de: void sendQuestInfo(Quest* quest); adicione: void reloadCreature(const Creature* creature);void sendCreatureNick(const Creature* creature); Em Player.h em baixo de: void sendCreatureShield(const Creature* creature) {if(client) client->sendCreatureShield(creature);} adicione: void sendCreatureNick(const Creature* creature) {if(client) client->sendCreatureNick(creature);} Em Creature.cpp em baixo de: partyShield = SHIELD_NONE; adicione: Nick = ""; Em Creature.h em baixo de: virtual const Monster* getMonster() const {return NULL;} adicione: stdstring Nick; Luascript.cpp em baixo de: //doPlayerSendCancel(cid, text) lua_register(m_luaState, "doPlayerSendCancel", LuaScriptInterfaceluaDoPlayerSendCancel); adicione: //doCreatureSetNick(cid, nick) lua_register(m_luaState, "doCreatureSetNick", LuaScriptInterfaceluaDoCreatureSetNick); em baixo de: int32_t LuaScriptInterfaceluaDoPlayerSendCancel(lua_State* L){ //doPlayerSendCancel(cid, text) stdstring text = popString(L); ScriptEnviroment* env = getEnv(); if(const Player* player = env->getPlayerByUID(popNumber(L))) { player->sendCancel(text); lua_pushboolean(L, true); } else { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); } return 1;} adicione: int32_t LuaScriptInterfaceluaDoCreatureSetNick(lua_State* L){ //doCreatureSetNick(cid, nick) ScriptEnviroment* env = getEnv(); stdstring nick = popString(L); Creature* creature = env->getCreatureByUID(popNumber(L)); if(creature) { SpectatorVec list; g_game.getSpectators(list, creature->getPosition()); Player* player = NULL; creature->Nick = nick; for(SpectatorVecconst_iterator it = list.begin(); it != list.end(); ++it) { if(player = (*it)->getPlayer()) { player->sendCreatureNick(creature); break; } } }else{ lua_pushnil(L); } return 1;} Em Luascript.h em baixo de: static int32_t luaDoRemoveItem(lua_State* L); adicione: static int32_t luaDoCreatureSetNick(lua_State* L); Em Protocolgame.cpp procure por: void ProtocolGameAddCreature(NetworkMessage_ptr msg, const Creature* creature, bool known, uint32_t remove){ if(!known) { em baixo de: msg->AddU32(creature->getID()); adicione: stdstring nick = creature->getName(); if (creature->Nick != "") nick = creature->Nick; substitua: msg->AddString(creature->getHideName() ? "" : creature->getName()); por: msg->AddString(creature->getHideName() ? "" : nick); Obs: compilar em rebuild all ou sem os arquivos .obj exemplo de uso: doCreatureSetNick(getCreatureSummons(cid)[1], "Gristony") Creditos Gristony façam bom uso do code pequenos grilos Oloster Games and dragonittao 2 Link to comment https://xtibia.com/forum/topic/238461-perfect-nick-system-100/ Share on other sites More sharing options...
Bluester 206 Posted December 24, 2015 Report Share Posted December 24, 2015 Boa Viktor, ótimo conteúdo para o fórum ! Link to comment https://xtibia.com/forum/topic/238461-perfect-nick-system-100/#findComment-1679104 Share on other sites More sharing options...
Aberos 71 Posted December 24, 2015 Report Share Posted December 24, 2015 Perfeito Bahianinha kkkkkkkk! Parabens! Link to comment https://xtibia.com/forum/topic/238461-perfect-nick-system-100/#findComment-1679107 Share on other sites More sharing options...
Administrador Administrador 1437 Posted December 24, 2015 Administrador Report Share Posted December 24, 2015 Caraca ótimo conteúdo brother! Parabéns e obrigado por postar =) Link to comment https://xtibia.com/forum/topic/238461-perfect-nick-system-100/#findComment-1679109 Share on other sites More sharing options...
Slyton 8 Posted December 24, 2015 Report Share Posted December 24, 2015 Não vou dar REP seu baiano, Você sabe sobre minha opinião sobre este tipo de coisa, mas BOA por fazer o código em si. Link to comment https://xtibia.com/forum/topic/238461-perfect-nick-system-100/#findComment-1679112 Share on other sites More sharing options...
valakas 90 Posted December 24, 2015 Report Share Posted December 24, 2015 hehe muito bom reputado Link to comment https://xtibia.com/forum/topic/238461-perfect-nick-system-100/#findComment-1679141 Share on other sites More sharing options...
ClaudioMar231o 15 Posted December 24, 2015 Report Share Posted December 24, 2015 ótimo ! rsrs Link to comment https://xtibia.com/forum/topic/238461-perfect-nick-system-100/#findComment-1679142 Share on other sites More sharing options...
Strogman 89 Posted December 24, 2015 Author Report Share Posted December 24, 2015 @all Fico feliz que tenham gostado do conteúdo. vamos que vamos@Aberos Bahianinha é seu ra@#### kkk seu alogoense da lagoa preta XD Link to comment https://xtibia.com/forum/topic/238461-perfect-nick-system-100/#findComment-1679155 Share on other sites More sharing options...
Luga03 333 Posted December 25, 2015 Report Share Posted December 25, 2015 Parabéns manin! Gostei bastante http://gyazo.com/81703eaaed3c22b90afa2a06f4c5bf92Deu este erro Teria como ajudar? Obs: Eu utilizo Tfs 0.4 Link to comment https://xtibia.com/forum/topic/238461-perfect-nick-system-100/#findComment-1679156 Share on other sites More sharing options...
Strogman 89 Posted December 25, 2015 Author Report Share Posted December 25, 2015 Parabéns manin! Gostei bastante http://gyazo.com/81703eaaed3c22b90afa2a06f4c5bf92 Deu este erro Teria como ajudar? Obs: Eu utilizo Tfs 0.4 na parte do protocolgame de vez de fazer o que tá la em cima /\ segue \/ em protocolgame.cpp adicione só isso void ProtocolGame::sendCreatureNick(const Creature* creature) { reloadCreature(creature); } em protocolgame.h adicione só isso void sendCreatureNick(const Creature* creature); Link to comment https://xtibia.com/forum/topic/238461-perfect-nick-system-100/#findComment-1679187 Share on other sites More sharing options...
Luga03 333 Posted December 25, 2015 Report Share Posted December 25, 2015 Pronto, aquele erro foi consertado mas agora está dando este erro: https://gyazo.com/72f347406ae464da07ae9bb7c806eb6e Obs: Está função serve apenas para monstros e summons ou servem para player também? Link to comment https://xtibia.com/forum/topic/238461-perfect-nick-system-100/#findComment-1679205 Share on other sites More sharing options...
deglorio 44 Posted December 25, 2015 Report Share Posted December 25, 2015 @@gristony Parabéns pelo ótimo trabalho Link to comment https://xtibia.com/forum/topic/238461-perfect-nick-system-100/#findComment-1679209 Share on other sites More sharing options...
Strogman 89 Posted December 25, 2015 Author Report Share Posted December 25, 2015 (edited) Pronto, aquele erro foi consertado mas agora está dando este erro: https://gyazo.com/72f347406ae464da07ae9bb7c806eb6e Obs: Está função serve apenas para monstros e summons ou servem para player também? sim, serve para player também. int32_t LuaScriptInterface::luaDoCreatureSetNick(lua_State* L) { //doCreatureSetNick(cid, nick) ScriptEnviroment* env = getEnv(); std::string nick = popString(L); Creature* creature = env->getCreatureByUID(popNumber(L)); if(creature) { Player* player; creature->nick = nick; player->sendCreatureNick(creature); }else{ lua_pushnil(L); } return 1; } edit topic corrigido em protocolgame procure por void ProtocolGame::AddCreature(NetworkMessage_ptr msg, const Creature* creature, bool known, uint32_t remove) { if(!known) { em baixo de msg->put<uint32_t>(creature->getID()); adicione std::string nick = creature->getName(); if (creature->nick != "") nick = creature->nick; substitua msg->putString(creature->getHideName() ? "" : creature->getName()); por msg->putString(creature->getHideName() ? "" : nick); Edited December 25, 2015 by gristony Poke X Ice 1 Link to comment https://xtibia.com/forum/topic/238461-perfect-nick-system-100/#findComment-1679212 Share on other sites More sharing options...
deglorio 44 Posted December 25, 2015 Report Share Posted December 25, 2015 Error creature->nick = nick; ...luascript.cpp 'class Creature' has no member named 'nick' Link to comment https://xtibia.com/forum/topic/238461-perfect-nick-system-100/#findComment-1679215 Share on other sites More sharing options...
Luga03 333 Posted December 25, 2015 Report Share Posted December 25, 2015 Estou com o mesmo problema dele /\ Link to comment https://xtibia.com/forum/topic/238461-perfect-nick-system-100/#findComment-1679217 Share on other sites More sharing options...
Recommended Posts