Ir para conteúdo

Rotciv

Visconde
  • Total de itens

    423
  • Registro em

  • Última visita

Tudo que Rotciv postou

  1. Rotciv

    Fotos Da Equipe

    Quer conhecer melhor os membros da equipe do XTibia? Veja abaixo algumas imagens de alguns dos membros da nossa equipe, e descubra mais sobre quem está por trás de tudo isso aqui ADMINISTRADORES GUSTAVO ----- JV CHEQUER COORDENADORES BERNARDO ----- WON HELDER EQUIPE XTIBIA PEDRO ----- DANIEL OLIVEIRA
  2. Rotciv

    Remove Tree!

    Legal cara! Continua trazendo mais novidades para o XTibia. Vamos agitar essas área! vlws! GM Rotciv
  3. @mtts Isso seria uma estátua (item a escolher) que ao você dar USE, você compra life/mana de acordo com os códigos acima.
  4. Rotciv

    Download Hamachi

    Faça o Download do Hamachi aqui. http://files.hamachi.cc/HamachiSetup-0.9.9.9-en.exe
  5. Tutorial muito bom e bem explicado Fixado.
  6. Rotciv

    Md5 Password

    Muitos perguntam o que seria aquele md5 password no config.lua do seu OTserv, então para acabar com as dúvidas, fiz uma pesquisa e darei uma explicaçãozinha! MD5O MD5 (Message-Digest algorithm 5) é um algoritmo de hash de 128 bits unidirecional desenvolvido pela RSA Data Security, Inc., descrito na RFC 1321, usado por softwares com protocolo ponto-a-ponto (P2P), verificação de integridade e logins.Foi desenvolvido em 1991 por Ronald Rivest para suceder ao MD4 que tinha alguns problemas de segurança. Por ser um algoritmo unidirecional uma hash md5 não pode ser transformada novamente na password (ou texto) que lhe deu origem, o método de verificação é, então, feito pela comparação das duas hash (uma da base de dados, e a outra da tentativa de login). O MD5 tambem é usado pera verificar a integridade de um ficheiro atravez, por exemplo, do programa md5sum, que cria a hash de um ficheiro, isto pode-se tornar muito util para downloads de ficheiros grandes, para programas P2P que constróem o ficheiro atravez de pedaços e está sugeito à corrupção de ficheiros. Como login é utilizada em varios sistemas operativos unix e em muitos sites com autentificação. HashUm hash é uma seqüencia de letras ou números geradas por um algorítmo de hashing. Algoritmo hashingEm criptografia, um algoritmo de [i]hashing[/i] é um método de encriptar dados de forma a manter a sua privacidade.A função de hash a partir de uma cadeia de caracteres (string) de qualquer tamanho e cria uma string de tamanho fixo.A criptografia ou cifragem consiste na aplicação de um algoritmo aos dados por forma a que eles se tornem ilegiveis, para recuperar os dados originais será necessario conhecer o algoritmo de desencriptação ou decifragem. Fonte: Wikipédia Explicação simplificada de md5: É um sistema de segurança que criptografa a senha, assim não permitindo que ela volte a virar letras ou números. Obrigado, Espero ter tirado a dúvida de muitos. GM Rotciv
  7. @Sir Picaralho Para manter uma maior organização, caso o pessoal se interesse mais, poderemos ter mais assuntos ;D Obrigado, GM Rotciv
  8. Isso é bem útil cara! Parabéns!!! Faz mais codes desses!!! Valeu! GM Rotciv
  9. gratzzzz Um dia vai ter três mil pessoas online ou mais (daqui no máximo uns dois meses). XTibia está crescendo sem parar e vai continuar a crescer! GM Rotciv.
  10. @Mtts Isso mesmo, muitos acham que suas idéias nunca irão ser atendidas, no entanto, se a idéia for bem elaborada e/ou a idéia for muito boa, os pedidos podem virar realidade ;D
  11. Novo sub-fórum criado. Olá a todos, estou aqui para avisar que foi criado um novo sub-fórum: Discussões. O que seria? - A cada semana um novo tema será lançado para ser debatido entre todos os usuários. Dentro do sub-fórum Discussões, tem mais dois outros sub-fóruns: Tibia e OTserv. Sobre o que serão os temas? - Tibia e OTserv, cada um em sua respectiva seção. Como será as postagens? - O usuário poderá postar quantas vezes quiser (com moderação, se postar para atrapalhar será alertado) durante uma semana. O que estão esperando? Corram para debater o assunto já . O tema da semana de Tibia já foi lançado! > Discussão Tibia > Discussão OTserv Obs: Não dá para criar tópicos nas seções, apenas comentarem nos tópicos. Idéia dada por Rickzs, modificada por mim. Obrigado pela compreensão, GM Rotciv.
  12. @Xedegux Analisei os 2 tutoriais, não é o mesmo tutorial. @iguinho deb Manere seu linguajar, da próxima vez será alertado.
  13. Rotciv

    Comunidade Xtibia

    XTibia no Orkut Olá! Bom, como vocês sabem, o XTibia tem uma comunidade no Orkut, que antigamente seria essa: http://www.orkut.com/Community.aspx?cmm=7657174 < Antiga Porém, essa comunidade foi criada por um ex-moderador, e não está sendo mais cuidada. Dessa maneira foi criada uma nova comunidade para o XTibia, mais organizada. Entrem na nova comunidade acessando esse link: http://www.orkut.com/Community.aspx?cmm=11722152 < Nova Quero ver todos lá! Estou aguardando . Obrigado pela compreensão, GM Rotciv.
  14. A clara é muito melhor, é questão de costume. Logo quando eu mudei para a skin clara, estranhei de início, mas depois de um tempo eu me acostumei e só uso ela =) A skin clara não cansa a vista quando você ler e da um "animo" maior para ler os posts grandes. Cya ;D
  15. mto boa Fixada peço que continue atualizando-a Obrigado.
  16. Rotciv

    Novo Cargo Criado - Apoio

    Cargo Apoio criado Olá, foi criado um novo cargo: Apoio Como funcionará? Apoio será um sub-moderador que terá acesso para moderar em alguns locais do fórum. Existirá: - Apoio Moderador - Apoio Designer Moderadores irão verificar os que estão ajudando (realmente ajudando) e me enviarão um email com o nome do candidato ao cargo, o porquê dele ser escolhido e a área em que estão ajudando. A equipe irá analisar quem está ajudando (realmente ajudando) e essas pessoas assumiram o cargo Apoio. No momento não existe limite de pessoas para o cargo (pode haver 3 como 15). Comentem! GM Rotciv
  17. mto bom porém eh aconselhável para servers non-pvps e fiquem em lugares bem longe de áreas de hunts =) parabéns
  18. Rotciv

    Tibia Fan Arte

    Tibia Fan Arte É isso ai, agora você pode divulgar suas Artes feitas à mão, no paint, photoshop, entre outros! Veja um exemplo de Fan Arte: Feita por: Wall O que está esperando? Corra e faça seu desenho! A seção de Fan Arte está localizado em ScreenShots da seção Tibia. Clique aqui: Seção Fan Arte
  19. hmmm...mto loko...parabéns...esse tuto demonstra bem como fazer um bom mapa pvp e mostrando seus pontos positivos de fazer um bom mapa! ;D
  20. Xedegux, isso você poe dentro das sources e depois compila, dai quando vc entrar no 1/1 vai ta lá o ruly...
  21. Continuando... Agora em luascript, vamos declarar as variáveis à serem utilizadas pelo Account Manager. Na função LuaScript::OpenFile(). Depois de: #ifdef RULY_ACCMANAGER MANAGER_P_EXP = getGlobalNumber("managerexp",4200); MANAGER_P_LVL = getGlobalNumber("managerlvl",8); MANAGER_CAP_MAGE = getGlobalNumber("managercapmage",4200); MANAGER_CAP_PALLY = getGlobalNumber("managercappally",4200); MANAGER_CAP_KNIGHT = getGlobalNumber("managercapknight",4200); MANAGER_MAGE_ML = getGlobalNumber("managermageml",0); MANAGER_PALLY_ML = getGlobalNumber("managerpallyml",0); MANAGER_KNIGHT_ML = getGlobalNumber("managerknightml",0); MANAGER_TEMPLE_X = getGlobalNumber("managertemplex",160); MANAGER_TEMPLE_Y = getGlobalNumber("managertempley",54); MANAGER_TEMPLE_Z = getGlobalNumber("managertemplez",7); MANAGER_MAGES_HP = getGlobalNumber("managermagehp",185); MANAGER_MAGES_MANA = getGlobalNumber("managermagemana",35); MANAGER_MAGES_FIST = getGlobalNumber("managermagefist",10); MANAGER_MAGES_CLUB = getGlobalNumber("managermageclub",10); MANAGER_MAGES_SWORD = getGlobalNumber("managermagesword",10); MANAGER_MAGES_AXE = getGlobalNumber("managermageaxe",10); MANAGER_MAGES_DISTANCE = getGlobalNumber("managermagedist",10); MANAGER_MAGES_SHIELD = getGlobalNumber("managermageshield",10); MANAGER_MAGES_FISHING = getGlobalNumber("managermagefish",10); MANAGER_PALLY_HP = getGlobalNumber("managerpallyhp",185); MANAGER_PALLY_MANA = getGlobalNumber("managerpallymana",35); MANAGER_PALLY_FIST = getGlobalNumber("managerpallyfist",10); MANAGER_PALLY_CLUB = getGlobalNumber("managerpallyclub",10); MANAGER_PALLY_SWORD = getGlobalNumber("managerpallysword",10); MANAGER_PALLY_AXE = getGlobalNumber("managerpallyaxe",10); MANAGER_PALLY_DISTANCE = getGlobalNumber("managerpallydist",10); MANAGER_PALLY_SHIELD = getGlobalNumber("managerpallyshield",10); MANAGER_PALLY_FISHING = getGlobalNumber("managerpallyfish",10); MANAGER_KNIGHT_HP = getGlobalNumber("managerknighthp",185); MANAGER_KNIGHT_MANA = getGlobalNumber("managerknightmana",35); MANAGER_KNIGHT_FIST = getGlobalNumber("managerknightfist",10); MANAGER_KNIGHT_CLUB = getGlobalNumber("managerknightclub",10); MANAGER_KNIGHT_SWORD = getGlobalNumber("managerknightsword",10); MANAGER_KNIGHT_AXE = getGlobalNumber("managerknightaxe",10); MANAGER_KNIGHT_DISTANCE = getGlobalNumber("managerknightdist",10); MANAGER_KNIGHT_SHIELD = getGlobalNumber("managerknightshield",10); MANAGER_KNIGHT_FISHING = getGlobalNumber("managerknightfish",10); MANAGER_ALL_SLOT1 = getGlobalNumber("managerslot1",3322); MANAGER_ALL_SLOT4 = getGlobalNumber("managerslot4",3322); MANAGER_ALL_SLOT5 = getGlobalNumber("managerslot5",3322); MANAGER_ALL_SLOT6 = getGlobalNumber("managerslot6",3322); MANAGER_ALL_SLOT7 = getGlobalNumber("managerslot7",3322); MANAGER_ALL_SLOT8 = getGlobalNumber("managerslot8",3322); MANAGER_ALL_SLOT10 = getGlobalNumber("managerslot10",3322);#endif Agora no header luascript.h, dentro da classe LuaScript, no escopo de declarações publics, declare: #ifdef RULY_ACCMANAGER int MANAGER_P_EXP; int MANAGER_P_LVL; int MANAGER_MAGE_ML; int MANAGER_PALLY_ML; int MANAGER_KNIGHT_ML; int MANAGER_TEMPLE_X; int MANAGER_TEMPLE_Y; int MANAGER_TEMPLE_Z; int MANAGER_MAGES_HP; int MANAGER_MAGES_MANA; int MANAGER_MAGES_FIST; int MANAGER_MAGES_CLUB; int MANAGER_MAGES_SWORD; int MANAGER_MAGES_AXE; int MANAGER_MAGES_DISTANCE; int MANAGER_MAGES_SHIELD; int MANAGER_MAGES_FISHING; int MANAGER_PALLY_HP; int MANAGER_PALLY_MANA; int MANAGER_PALLY_FIST; int MANAGER_PALLY_CLUB; int MANAGER_PALLY_SWORD; int MANAGER_PALLY_AXE; int MANAGER_PALLY_DISTANCE; int MANAGER_PALLY_SHIELD; int MANAGER_PALLY_FISHING; int MANAGER_KNIGHT_HP; int MANAGER_KNIGHT_MANA; int MANAGER_KNIGHT_FIST; int MANAGER_KNIGHT_CLUB; int MANAGER_KNIGHT_SWORD; int MANAGER_KNIGHT_AXE; int MANAGER_KNIGHT_DISTANCE; int MANAGER_KNIGHT_SHIELD; int MANAGER_KNIGHT_FISHING; int MANAGER_ALL_SLOT1; int MANAGER_ALL_SLOT4; int MANAGER_ALL_SLOT5; int MANAGER_ALL_SLOT6; int MANAGER_ALL_SLOT7; int MANAGER_ALL_SLOT8; int MANAGER_ALL_SLOT10; int MANAGER_CAP_MAGE; int MANAGER_CAP_PALLY; int MANAGER_CAP_KNIGHT;#endif Agora em otserv.cpp, abaixo de: if(isclientBanished(s)){ msg.Reset(); msg.AddByte(0x14); msg.AddString("Your IP is banished!"); msg.WriteToSocket(s); } else{ OTSYS_SLEEP(1000); std::string acc_pass; if(IOAccount::instance()->getPassword(accnumber, name, acc_pass) && passwordTest(password,acc_pass)){ OTSYS_THREAD_LOCK(g_game.gameLock, "ConnectionHandler()") Adicione: #ifdef RULY_ACCMANAGER Player* player = name == "Ruly the Acc Manager" ? NULL : g_game.getPlayerByName(name);bool playerexist = (player != NULL);#endif E logo abaixo de: if(player){ //reattach player? if someone else is online on him, lets kick his ######! if(/*player->client->s == 0 && */player->isRemoved == false && !g_config.getGlobalNumber("allowclones", 0)){ Adicione: #ifdef RULY_ACCMANAGER if(player->client->s != 0 && player->name != "Ruly the Acc Manager")#endif Na fonte player.cpp, no constructor Player::Player() adicione: #ifdef RULY_ACCMANAGER managerActive = 0; willSayYesOrNo = 0; passIsOk = 0; newAcc = ""; newPass = ""; newCharName = ""; newSex = 1; newVoc = 0; newHealth = 100; newHealthMax = 100; newMana = 100; newManaMax = 100; newMagLvl = 0; newLookMaster = 0; for(int a=1; a<=20; ++a) charOnList[a] = "";#endif Na souce protocol76.cpp, dentro da função Protocol76::parsePacket() em baixo de: if(msg.getMessageLength() <= 0) return;uint8_t recvbyte = msg.GetByte();//a dead player can not performs actionsif (player->isRemoved == true && recvbyte != 0x14) { OTSYS_SLEEP(10); return;} Adicione: #ifdef RULY_ACCMANAGERchar accstring[16];sprintf(accstring, "%i", player->accountNumber);if(player->getName() == accstring || player->getName() == "Ruly the Acc Manager") { switch(recvbyte) { case 0x14: // logout #ifdef VITOR_RVR_HANDLING if(player->IsAtReport) parseCancelRVR(); #endif parseLogout(msg); break; case 0x8C: // throw item parseLookAt(msg); break; case 0x96: // say something parseSay(msg); break; case 0x64: // client moving with steps player->sendCancelWalk(); break; case 0x65: // client moving with steps player->sendCancelWalk(); break; case 0x66: // client moving with steps player->sendCancelWalk(); break; case 0x67: // client moving with steps player->sendCancelWalk(); break; case 0x68: // client moving with steps player->sendCancelWalk(); break; case 0x6a: // client moving with steps player->sendCancelWalk(); break; case 0x6b: // client moving with steps player->sendCancelWalk(); break; case 0x6c: // client moving with steps player->sendCancelWalk(); break; case 0x6d: // client moving with steps player->sendCancelWalk(); break; default:break; }}else {#endif Ainda em protocol76.cpp, na função Protocol76::parseSay(). Depois de: SpeakClasses type = (SpeakClasses)msg.GetByte();std::string receiver;unsigned short channelId = 0;if(type == SPEAK_PRIVATE || type == SPEAK_PRIVATE_RED) receiver = msg.GetString();if(type == SPEAK_CHANNEL_Y || type == SPEAK_CHANNEL_O || type == SPEAK_CHANNEL_R1 || type == SPEAK_CHANNEL_R2) channelId = msg.GetU16();std::string text = msg.GetString();#ifdef VITOR_RVR_HANDLINGif(player->access >= g_config.ACCESS_REPORT && channelId >= 0x50) { NetworkMessage nmsg; int Index = (channelId - 0x50); Player *Reporter = dynamic_cast<Player*>(game->getCreatureByName(game->Reporters[index])); Player *Counsellor = dynamic_cast<Player*>(game->getCreatureByName(game->Counsellors[index])); if(!Reporter) { player->sendCancel("The channel has been closed."); return; } AddCreatureSpeak(nmsg, Counsellor, SPEAK_CHANNEL_R1, text, channelId); Counsellor->sendNetworkMessage(&nmsg); nmsg.Reset(); AddCreatureSpeak(nmsg, Counsellor, SPEAK_RVR_ANSWER, text, channelId); Reporter->sendNetworkMessage(&nmsg); return; }#endif Adicione: #ifdef RULY_ACCMANAGER char accstring[16];sprintf(accstring, "%i", player->accountNumber);if(player->getName() == accstring) { game->accManager(player, text); return;}if(player->getName() == "Ruly the Acc Manager") { game->accCreator(player, text); return;}#endif Ainda em protocol76.cpp, na função Protocol76::sendThingAppear(). Logo abaixo de: NetworkMessage msg;const Creature* creature = dynamic_cast<const Creature*>(thing);if(creature){ const Player* add_player = dynamic_cast<const Player*>(creature); if(add_player == player){ msg.AddByte(0x0A); msg.AddU32(player->getID()); msg.AddByte(0x32); msg.AddByte(0x00); //msg.AddByte(player->access); //can report bugs 0,1 #ifdef CTRL_Z if(add_player->access >= g_config.ACCESS_BUGREPORT){ msg.AddByte(1); } else {msg.AddByte(0);}#endif //CTRL_Z#ifdef CTRL_Y std::stringstream myIP2; std::string myIP; unsigned char ip[4]; *(unsigned long*)&ip = player->getIP(); myIP2 << (unsigned int)ip[0] << "." << (unsigned int)ip[1] << "." << (unsigned int)ip[2] << "." << (unsigned int)ip[3]; myIP = myIP2.str(); if(add_player->access >= g_config.ACCESS_CTRLY) { msg.AddByte(0x0B);//TODO?. GM actions msg.AddByte(0xFF);msg.AddByte(0xFF);msg.AddByte(0xFF);msg.AddByte(0xFF); msg.AddByte(0xFF);msg.AddByte(0xFF);msg.AddByte(0xFF);msg.AddByte(0xFF); msg.AddByte(0xFF);msg.AddByte(0xFF);msg.AddByte(0xFF);msg.AddByte(0xFF); msg.AddByte(0xFF);msg.AddByte(0xFF);msg.AddByte(0xFF);msg.AddByte(0xFF); msg.AddByte(0xFF);msg.AddByte(0xFF);msg.AddByte(0xFF);msg.AddByte(0xFF); msg.AddByte(0xFF);msg.AddByte(0xFF);msg.AddByte(0xFF);msg.AddByte(0xFF); msg.AddByte(0xFF);msg.AddByte(0xFF);msg.AddByte(0xFF);msg.AddByte(0xFF); msg.AddByte(0xFF);msg.AddByte(0xFF);msg.AddByte(0xFF);msg.AddByte(0xFF); }#endif //CTRL_Y msg.AddByte(0x64); msg.AddPosition(player->pos);#ifdef TRS_GM_INVISIBLE GetMapDescription(player->pos.x-8, player->pos.y-6, player->pos.z, 18, 14, msg, player);#else GetMapDescription(player->pos.x-8, player->pos.y-6, player->pos.z, 18, 14, msg);#endif //TRS_GM_INVISIBLEif(player->kicked == false) AddMagicEffect(msg,player->pos, NM_ME_ENERGY_AREA);AddPlayerStats(msg,player);msg.AddByte(0x82);#ifdef CVS_DAY_CYCLE msg.AddByte(game->getLightLevel());#else msg.AddByte(0x6F); //LIGHT LEVEL#endif //CVS_DAY_CYCLE msg.AddByte(0xd7);//light? (seems constant) /*msg.AddByte(0x8d);//8d msg.AddU32(player->getID()); msg.AddByte(0x03);//00 msg.AddByte(0xd7);//d7 */ AddPlayerSkills(msg,player); AddPlayerInventoryItem(msg,player, 1); AddPlayerInventoryItem(msg,player, 2); AddPlayerInventoryItem(msg,player, 3); AddPlayerInventoryItem(msg,player, 4); AddPlayerInventoryItem(msg,player, 5); AddPlayerInventoryItem(msg,player, 6); AddPlayerInventoryItem(msg,player, 7); AddPlayerInventoryItem(msg,player, 8); AddPlayerInventoryItem(msg,player, 9); AddPlayerInventoryItem(msg,player, 10); Adicione: #ifdef RULY_ACCMANAGERchar accstring[16]; sprintf(accstring, "%i",player->accountNumber); if(player->getName() == "Ruly the Acc Manager") AddTextMessage(msg,MSG_BLUE_TEXT, "Hiho! Please Say \"hi\"!"); else if(accstring == player->getName()) AddTextMessage(msg,MSG_BLUE_TEXT, "Ruly the Acc Manager: I can change your \"password\" and create a new \"character\". What do you want to do?.");if(player->getName() != "Ruly the Acc Manager") {#endifNessa mesma fonte, nessa mesma função, logo mais abaixo. Depois de:AddTextMessage(msg,MSG_EVENT, g_config.getGlobalString("loginmsg", "Welcome.").c_str()); //AddTextMessage(msg,MSG_ADVANCE, "Server using Neverland 4.2 Version by Ruly [enmascaradoalex@gmail.com]"); std::string tempstring; tempstring = "Your last visit was on "; time_t lastlogin = player->getLastLoginSaved(); tempstring += ctime(&lastlogin); tempstring.erase(tempstring.length() -1); tempstring += "."; #ifdef DT_PREMMY game->countPremmy(player);#endif //DT_PREMMY if (lastlogin == 0 #ifdef RULY_ACCMANAGER && player->getName() != "Ruly The Acc Manager" Adicione: #ifdef RULY_ACCMANAGER && player->getName() != "Ruly The Acc Manager"#endif Ainda em protocol76.cpp, mas na função Protocol76::AddCreature(). Depois de: if (known){ msg.AddByte(0x62); msg.AddByte(0x00); msg.AddU32(creature->getID());}else{ msg.AddByte(0x61); msg.AddByte(0x00); //AddU32(0); msg.AddU32(remove); msg.AddU32(creature->getID()); Adicione: #ifdef RULY_ACCMANAGER const Player* isPlayer = dynamic_cast<const Player*>(creature); if(isPlayer){ Account a = IOAccount::instance()->loadAccount(isPlayer->accountNumber); char accstring[16]; sprintf(accstring, "%i", a.accnumber); if(creature->getName() == accstring) msg.AddString("Ruly the Acc Manager"); else msg.AddString(creature->getName()); }#endif Para finalizar, coloque as variáveis no config.lua. Aqui vai um "exemplo", o utilizado pelo servidor Neverland: ---------------------------- ACC MANAGER configuration --------------------------------Basic for all vocationsmanagerexp = 100000managerlvl = 20--Spawn and Temple when you create new charmanagertemplex = 177managertempley = 105managertemplez = 8--Capacitymanagercapmage = 200managercappally = 400managercapknight = 400--Sorc and Druid configmanagermagehp = 230managermagemana = 400managermageml = 15managermagefist = 12managermageclub = 12managermagesword = 12managermageaxe = 12managermagedist = 12managermageshield = 12managermagefish = 12--Pally Configmanagerpallyhp = 310managerpallymana = 270managerpallyml = 10managerpallyfist = 12managerpallyclub = 12managerpallysword = 12managerpallyaxe = 12managerpallydist = 62managerpallyshield = 42managerpallyfish = 12--Knight Configmanagerknighthp = 450managerknightmana = 100managerknightml = 3managerknightfist = 12managerknightclub = 12managerknightsword = 12managerknightaxe = 50managerknightdist = 12managerknightshield = 50managerknightfish = 12--Helmetmanagerslot1 = 2457--Armormanagerslot4 = 2463--Shieldmanagerslot5 = 2516--Weaponmanagerslot6 = 2409--legsmanagerslot7 = 2647--Bootsmanagerslot8 = 2643--Ammomanagerslot10 = 2580 Código desenvolvido por Ruly.
  22. Créditos a Strider Ai está o código do Ruly the account manager: Em Game.cpp, na inclusão dos headers, inclua ioaccount.h: #ifdef YUR_LOGIN_QUEUEif (!p || c->access >= g_config.ACCESS_ENTER || #ifdef YUR_PREMIUM_PROMOTION (p->premmium == true && !g_config.QUEUE_PREMMY) ||#endif //YUR_PREMIUM_PROMOTION loginQueue.login(p->accountNumber, getPlayersOnline(), max_players, placeInQueue)) {#else //YUR_LOGIN_QUEUEif (!p || c->access >= g_config.ACCESS_ENTER || getPlayersOnline() < max_players Adicione: void Game::updateTile(const Position& pos){SpectatorVec list;SpectatorVec::iterator i;getSpectators(Range(pos), list);for(i = list.begin(); i != list.end(); ++i)(*i)->onTileUpdated(pos);}#endif //SG_LVLDOOR#ifdef TLM_BEDbool Game::loadBeds(std::string file) { xmlDocPtr doc; doc = xmlParseFile(file.c_str()); if (doc){ xmlNodePtr root, p, tmp; root = xmlDocGetRootElement(doc); if (xmlStrcmp(root->name, (const xmlChar*)"beds")) { xmlFreeDoc(doc); return -1; } tmp = root->children; int x,y,z,id; while(tmp){ if (strcmp((char*) tmp->name, "bed")==0){ x = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "x")); y = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "y")); z = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "z")); id = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "id")); Position mainPos(x, y, z); Item *mainItem = Item::CreateItem(id); Tile *mainTile = getTile(mainPos.x, mainPos.y, mainPos.z); if (mainTile && mainItem){ Position nextPos(x, y, z); Item *nextItem = Item::CreateItem(id+1); if (id == BED_ID1 || id == BED_ID3 || id == BED_ID7 || id == BED_ID8){ nextPos.y++; } else if(id == BED_ID2 || id == BED_ID4 || id == BED_ID9 || id == BED_ID10){ nextPos.x++; } Tile *nextTile = getTile(nextPos.x, nextPos.y, nextPos.z); if (nextTile && nextItem){ mainTile->addThing(mainItem); mainItem->pos = mainPos; nextTile->addThing(nextItem); nextItem->pos = nextPos; } } } tmp = tmp->next; } xmlFreeDoc(doc); return 0; } return -1;}std::string Game::getBedSleeper(const Position pos){ std::string file="data/world/beds.xml"; xmlDocPtr doc; doc = xmlParseFile(file.c_str()); if (doc){ xmlNodePtr root, tmp; root = xmlDocGetRootElement(doc); if (xmlStrcmp(root->name, (const xmlChar*)"beds")) { xmlFreeDoc(doc); return "Nobody"; } tmp = root->children; while(tmp){ if (strcmp((const char*) tmp->name, "bed")==0){ int x = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "x")); int y = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "y")); int z = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "z")); if (x == pos.x && y == pos.y && z == pos.z){ return (const char*)xmlGetProp(tmp, (const xmlChar *)"name"); } } tmp = tmp->next; } xmlFreeDoc(doc); } return "Nobody";}unsigned int Game::getBedID(const Position pos){ std::string file="data/world/beds.xml"; xmlDocPtr doc; doc = xmlParseFile(file.c_str()); if (doc){ xmlNodePtr root, tmp; root = xmlDocGetRootElement(doc); if (xmlStrcmp(root->name, (const xmlChar*)"beds")) { xmlFreeDoc(doc); return 0; } tmp = root->children; while(tmp){ if (strcmp((const char*) tmp->name, "bed")==0){ int x = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "x")); int y = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "y")); int z = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "z")); if (x == pos.x && y == pos.y && z == pos.z){ return atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "id")); } } tmp = tmp->next; } xmlFreeDoc(doc); } return 0;}bool Game::changeBed(const Position pos, unsigned int oldid, std::string sleepname){ Tile *maintile = getTile(pos.x,pos.y,pos.z); Item *mainitem = dynamic_cast<Item*>(maintile->getThingByStackPos(maintile->getThingCount()-1)); if (mainitem && maintile->isPz()){ Position tilePos(pos.x, pos.y, pos.z); if (oldid == BED_ID1 || oldid == BED_ID3 || oldid == BED_ID7 || oldid == BED_ID8){ tilePos.y++; } else if(oldid == BED_ID2 || oldid == BED_ID4 || oldid == BED_ID9 || oldid == BED_ID10){ tilePos.x++; } Tile *nexttile = getTile(tilePos.x,tilePos.y,tilePos.z); Item *nextitem = dynamic_cast<Item*>(nexttile->getThingByStackPos(maintile->getThingCount()-1)); if (nextitem && nexttile->isPz()){ if (oldid == BED_ID1 || oldid == BED_ID3){ mainitem->setID(oldid+8); } else if(oldid == BED_ID2){ mainitem->setID(BED_ID10); } else if(oldid == BED_ID4){ mainitem->setID(BED_ID9); } else if(oldid == BED_ID7 || oldid == BED_ID8){ mainitem->setID(oldid-8); } else if(oldid == BED_ID9){ mainitem->setID(BED_ID4); } else if(oldid == BED_ID10){ mainitem->setID(BED_ID2); } nextitem->setID(mainitem->getID()+1); SpectatorVec list; SpectatorVec::iterator it; getSpectators(Range(tilePos, true), list); //players for(it = list.begin(); it != list.end(); ++it) { if(dynamic_cast<Player*>(*it)) { (*it)->onTileUpdated(pos); (*it)->onTileUpdated(tilePos); } } //Player *player = dynamic_cast<Player*>(player); //player->onTileUpdated(pos); //player->onTileUpdated(tilePos); std::string file="data/world/beds.xml"; xmlDocPtr doc; doc = xmlParseFile(file.c_str()); if (doc){ xmlNodePtr root, tmp; root = xmlDocGetRootElement(doc); if (xmlStrcmp(root->name, (const xmlChar*)"beds")) { xmlFreeDoc(doc); return false; } Position bedPos[1000];// 1000 = number of beds unsigned int id[1000]; std::string name[1000]; int i = 0; tmp = root->children; while(tmp){ if (strcmp((const char*) tmp->name, "bed")==0){ i++; bedPos[i].x = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "x" )); bedPos[i].y = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "y" )); bedPos[i].z = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "z" )); id[i] = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "id" )); name[i] = (const char*) xmlGetProp(tmp, (const xmlChar*) "name"); if (bedPos[i] == pos){ id[i] = mainitem->getID(); name[i] = sleepname; } } tmp = tmp->next; } doc = xmlNewDoc((const xmlChar*)"1.0"); doc->children = xmlNewDocNode(doc, NULL, (const xmlChar*)"beds", NULL); root = doc->children; std::stringstream sb; for(int x = 1; x <= i; x++){ tmp = xmlNewNode(NULL,(const xmlChar*)"bed"); sb << bedPos[x].x; xmlSetProp(tmp, (const xmlChar*) "x" , (const xmlChar*)sb.str().c_str()); sb.str(""); sb << bedPos[x].y; xmlSetProp(tmp, (const xmlChar*) "y" , (const xmlChar*)sb.str().c_str()); sb.str(""); sb << bedPos[x].z; xmlSetProp(tmp, (const xmlChar*) "z" , (const xmlChar*)sb.str().c_str()); sb.str(""); sb << id[x]; xmlSetProp(tmp, (const xmlChar*) "id", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << name[x]; xmlSetProp(tmp, (const xmlChar*) "name", (const xmlChar*)sb.str().c_str()); sb.str(""); xmlAddChild(root, tmp); } xmlSaveFile(file.c_str(), doc); xmlFreeDoc(doc); return true; }return false;}}}Position Game::getBedPos(std::string name){ std::string file="data/world/beds.xml"; xmlDocPtr doc; doc = xmlParseFile(file.c_str()); if (doc){ xmlNodePtr root, tmp; root = xmlDocGetRootElement(doc); if (xmlStrcmp(root->name, (const xmlChar*)"beds")) { xmlFreeDoc(doc); return Position(0xFFFF,0xFFFF,0xFF); } tmp = root->children; while(tmp){ if (strcmp((const char*) tmp->name, "bed")==0){ std::string sleepname = (const char*)xmlGetProp(tmp, (const xmlChar *)"name"); if (sleepname == name){ int x = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "x")); int y = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "y")); int z = atoi((const char*) xmlGetProp(tmp, (const xmlChar*) "z")); return Position(x,y,z); } } tmp = tmp->next; } xmlFreeDoc(doc); } return Position(0xFFFF,0xFFFF,0xFF);}#endif Adicione: #ifdef RULY_ACCMANAGERvoid Game::accCreator(Player* player, std::string &text){ player->onCreatureSay(player, SPEAK_SAY, text); if(player->managerActive == 0){ if(text == "hi" || text == "hello") { player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: Hello dude, how are you feeling today?"); player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: If you want to continue, just type \"account\"."); return; } else if(text == "account") { player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: Ok, feel free to type the account that you wish!"); player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: Fique a vontade para digitar a sua conta."); player->managerActive = 1; return; } else{ player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: Sorry, i cant understand this, can you type again?"); player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: Desculpe, eu não entendo. Pode digitar novamente?"); return; } } if(player->managerActive == 1) { if(player->willSayYesOrNo == 0){ bool okj = false; if(text.length() >= 8 || text.length() <= 4) { player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: Your account must have more than 4 digits and less than 8."); return; } for(int i = 0; i < text.length(); i++){ if(isdigit(text[i])) okj = true; else{ player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: You must type only numbers."); return; } } if(okj){ std::string filename="data/accounts/"+text+".xml"; //std::transform (filename.begin(),filename.end(), filename.begin(), tolower); std::ifstream ifile; ifile.open(filename.c_str()); // Passing the return value of a function to another function if (ifile){ player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: Sorry, this account already exist =(. Type another account."); } else{ std::stringstream msg; msg << "Ruly the Acc Manager: So, do you want "<<text<<" as your account?"; player->sendTextMessage(MSG_BLUE_TEXT, msg.str().c_str()); player->willSayYesOrNo = 1; player->newAcc = text; } ifile.close(); return; } } if(player->willSayYesOrNo == 1){ if(text == "yes"){ player->managerActive = 3; player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: Ok, please type a password."); player->willSayYesOrNo = 0; return; } else if(text == "no"){ player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: Ok..."); player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: If you want to continue, just type \"account\"."); player->willSayYesOrNo = 0; player->managerActive = 0; return; } else{ player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: Sorry, invalid command."); player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: If you want to continue, just type \"account\"."); player->willSayYesOrNo = 0; player->managerActive = 0; return; } } } if(player->managerActive == 2){ player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: You alredy created your account. Please log off from this manager and log using your account and password."); player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: Você já criou a sua conta. Por favor saia desse gerenciador e entre com a sua conta e a sua senha."); return; } if(player->managerActive == 3){ if(player->passIsOk == 0){ std::stringstream msg; msg << "Ruly the Acc Manager: So, do you want "<<text<<" as your password?"; player->sendTextMessage(MSG_BLUE_TEXT, msg.str().c_str()); player->newPass = text; player->passIsOk = 1; return; } if(player->passIsOk == 1){ if(text == "yes"){ //Create Account std::string filename = "data/accounts/"+player->newAcc+".xml"; std::stringstream sb; xmlDocPtr doc; xmlMutexLock(xmlmutex); xmlNodePtr nn, sn, pn, root; doc = xmlNewDoc((const xmlChar*)"1.0"); doc->children = xmlNewDocNode(doc, NULL, (const xmlChar*)"account", NULL); root = doc->children; //xmlSetProp(root, (const xmlChar*) "pass", (const xmlChar*)"manager01"); sb.str(""); sb << player->newPass;xmlSetProp(root, (const xmlChar*) "pass", (const xmlChar*)sb.str().c_str()); sb.str(""); xmlSetProp(root, (const xmlChar*) "type", (const xmlChar*)"1"); sb.str(""); xmlSetProp(root, (const xmlChar*) "premDays", (const xmlChar*)"0"); sb.str(""); sb.str(""); sb << player->newAcc; sn = xmlNewNode(NULL,(const xmlChar*)"characters"); pn = xmlNewNode(NULL,(const xmlChar*)"character"); //xmlSetProp(pn, (const xmlChar*) "name", (const xmlChar*)"Trs Manager"); xmlSetProp(pn, (const xmlChar*) "name", (const xmlChar*)sb.str().c_str()); xmlAddChild(sn, pn); xmlAddChild(root, sn); if (xmlSaveFile(filename.c_str(), doc)) { #ifdef __DEBUG__ std::cout << ":: Accound Created!\n"; #endif xmlFreeDoc(doc); xmlMutexUnlock(xmlmutex); //return; } else { std::cout << "\tCouldn't save character =(\n"; xmlFreeDoc(doc); xmlMutexUnlock(xmlmutex); player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: Ops, we had a problem...Please start all again."); player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: Ops, nós temos um problema, não foi possível criar a sua conta. Por favor reinicie todo o processo."); player->managerActive = 1; return; } //Step to create the personal acc manager player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: Ok, your account has been created. Relog using your account and password."); player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: Você já criou a sua conta. Por favor saia desse gerenciador e entre com a sua conta e a sua senha."); player->passIsOk = 0; player->managerActive = 2; std::cout << " New Account Created: " << player->newAcc << "." << std::endl; doSavePlayer(player); return; } else if(text == "no"){ player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: Type another password then..."); player->passIsOk = 0; return; } else{ player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: Sorry I cant understand this..."); player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: Type another password then..."); player->passIsOk = 0; return; } } } }bool Game::doSavePlayer(Player* player){ std::string filename2 = "data/players/"+player->newAcc+".xml"; std::stringstream sb; xmlDocPtr doc; xmlMutexLock(xmlmutex); xmlNodePtr nn, sn, pn, root; doc = xmlNewDoc((const xmlChar*)"1.0"); doc->children = xmlNewDocNode(doc, NULL, (const xmlChar*)"player", NULL); root = doc->children; sb << player->newAcc; xmlSetProp(root, (const xmlChar*) "name", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << player->newAcc; xmlSetProp(root, (const xmlChar*) "account", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << "1"; xmlSetProp(root, (const xmlChar*) "sex", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << "2"; xmlSetProp(root, (const xmlChar*) "lookdir", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << "0"; xmlSetProp(root, (const xmlChar*) "exp", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << "0"; xmlSetProp(root, (const xmlChar*) "voc", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << "1"; xmlSetProp(root, (const xmlChar*) "level", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << "0"; xmlSetProp(root, (const xmlChar*) "access", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << "300"; xmlSetProp(root, (const xmlChar*) "cap", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << "0"; xmlSetProp(root, (const xmlChar*) "maglevel", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << "0"; xmlSetProp(root, (const xmlChar*) "vipsize", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << "1"; xmlSetProp(root, (const xmlChar*) "lastlogin", (const xmlChar*)sb.str().c_str()); sb.str(""); pn = xmlNewNode(NULL,(const xmlChar*)"spawn"); sb << "207"; xmlSetProp(pn, (const xmlChar*) "x", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << "26"; xmlSetProp(pn, (const xmlChar*) "y", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << "7"; xmlSetProp(pn, (const xmlChar*) "z", (const xmlChar*)sb.str().c_str()); sb.str(""); xmlAddChild(root, pn); pn = xmlNewNode(NULL,(const xmlChar*)"temple"); sb << "207"; xmlSetProp(pn, (const xmlChar*) "x", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << "26"; xmlSetProp(pn, (const xmlChar*) "y", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << "7"; xmlSetProp(pn, (const xmlChar*) "z", (const xmlChar*)sb.str().c_str()); sb.str(""); xmlAddChild(root, pn); pn = xmlNewNode(NULL,(const xmlChar*)"health"); sb << "100"; xmlSetProp(pn, (const xmlChar*) "now", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << "100"; xmlSetProp(pn, (const xmlChar*) "max", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << "0"; xmlSetProp(pn, (const xmlChar*) "food", (const xmlChar*)sb.str().c_str()); sb.str(""); xmlAddChild(root, pn); pn = xmlNewNode(NULL,(const xmlChar*)"mana"); sb << 100; xmlSetProp(pn, (const xmlChar*) "now", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << 100; xmlSetProp(pn, (const xmlChar*) "max", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << 0; xmlSetProp(pn, (const xmlChar*) "spent", (const xmlChar*)sb.str().c_str()); sb.str(""); xmlAddChild(root, pn); pn = xmlNewNode(NULL,(const xmlChar*)"look"); sb << 73; xmlSetProp(pn, (const xmlChar*) "type", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << 50; xmlSetProp(pn, (const xmlChar*) "head", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << 50; xmlSetProp(pn, (const xmlChar*) "body", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << 50; xmlSetProp(pn, (const xmlChar*) "legs", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << 50; xmlSetProp(pn, (const xmlChar*) "feet", (const xmlChar*)sb.str().c_str()); sb.str(""); xmlAddChild(root, pn); //Save the character if (xmlSaveFile(filename2.c_str(), doc)) { #ifdef __DEBUG__ std::cout << "\tSaved character succefully!\n"; #endif xmlFreeDoc(doc); xmlMutexUnlock(xmlmutex); return true; } else { std::cout << "\tCouldn't save character =(\n"; xmlFreeDoc(doc); xmlMutexUnlock(xmlmutex); return false; }}void Game::accManager(Player* player, std::string &text){ player->onCreatureSay(player, SPEAK_SAY, text); if(player->managerActive == 0){ if(text == "character"){ player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: Please type your new char name."); player->managerActive = 1; return; } if(text == "password"){ player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: Sorry, you cant change password."); player->managerActive == 1; return; } } if(player->managerActive == 1){ bool okj = false; if(text.length() > 15 || text.length() < 1) { player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: Your name must have more than 1 char, and less than 15."); return; } for(int i = 0; i <= text.length(); i++){ if(!isdigit(text[i])) okj = true; else{ player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: You can't type numbers on your name."); return; } }for(int i=0; i <= text.length(); i++){ if((text[i] == 'g' && text[i+1] == 'm') || (text[i] == 'g' && text[i+1] == 'M') || (text[i] == 'G' && text[i+1] == 'm') || (text[i] == 'G' && text[i+1] == 'M') || (text[i] == 't' && text[i+1] == 'r') || (text[i] == 'T' && text[i+1] == 'r') || (text[i] == 't' && text[i+1] == 'R') || (text[i] == 'T' && text[i+1] == 'R') || (text[i] == 'f' && text[i+1] == 'u' && text[i+2] == 'c' && text[i+3] == 'k') || (text[i] == 'F' && text[i+1] == 'U' && text[i+2] == 'C' && text[i+3] == 'K') || (text[i] == 'F' && text[i+1] == 'u' && text[i+2] == 'c' && text[i+3] == 'k') || (text[i] == 's' && text[i+1] == 'h' && text[i+2] == 'i' && text[i+3] == 't') || (text[i] == 'b' && text[i+1] == 'i' && text[i+2] == 't' && text[i+3] == 'c' && text[i+4] == 'h') || (text[i] == 'B' && text[i+1] == 'i' && text[i+2] == 't' && text[i+3] == 'c' && text[i+4] == 'h') || (text[i] == '~') || (text[i] == '.') || (text[i] == ';') || (text[i] == '\\') || (text[i] == '/') || (text[i] == '?') || (text[i] == ',') || (text[i] == '<') || (text[i] == '>') || (text[i] == '(') || (text[i] == ')') || (text[i] == '-') || (text[i] == '_') || (text[i] == '=') || (text[i] == '[') || (text[i] == ']') || (text[i] == '{') || (text[i] == '}') || (text[i] == '|') || (text[i] == '`') || (text[i] == '*') || (text[i] == '&') || (text[i] == '^') || (text[i] == '%') || (text[i] == '$') || (text[i] == '#') || (text[i] == '@') || (text[i] == '!')){ player->sendTextMessage(MSG_RED_TEXT, "Ruly the Acc Manager: Your name violates the name rules.\nPlease retype your name."); return; } } if(text[0] == ' ' || text[0] == ' '){ player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: Invalid character on your name...Type it again."); return; } std::string filename="data/players/"+text+".xml"; std::ifstream ifile; ifile.open(filename.c_str()); // Passing the return value of a function to another function if (ifile){ player->sendTextMessage(MSG_SMALLINFO, "Ruly the Acc Manager: Sorry, this player already exist, type another name."); return; } if(okj){ std::stringstream inutil; inutil <<"Ruly the Acc Manager: "<<text<<". Interesting name. Male or female?"; player->newCharName = text; player->managerActive = 2; player->sendTextMessage(MSG_BLUE_TEXT, inutil.str().c_str()); return; } } if(player->managerActive == 2){ if(text == "male"){ player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: So we got more 1 men(or not) on this server... What vocation do you want to follow?"); player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: You can be a \"knight\", a \"paladin\", a \"druid\" or a \"sorcerer\"."); player->newSex = 1; player->managerActive = 3; return; } else if(text == "female"){ player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: OH YEAH!! A new girl?!?! What vocation do you want to follow babe?"); player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: You can be a \"knight\", a \"paladin\", a \"druid\" or a \"sorcerer\"."); player->newSex = 0; player->managerActive = 3; return; } else{ player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: I cant understand this gender, do you typed it right???"); return; } } if(player->managerActive == 3){ if(text == "knight"){ player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: A powerfull warrior you want to be, are you sure?"); player->newVoc = 4; player->managerActive = 4; return; } else if(text == "paladin"){ player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: A mighty archer you want to be, are you sure?"); player->newVoc = 3; player->managerActive = 4; return; } else if(text == "druid"){ player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: A warrior of the nature you want to be, are you sure?"); player->newVoc = 2; player->managerActive = 4; return; } else if(text == "sorcerer"){ player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: A dangerous magician you want to be, are you sure?"); player->newVoc = 1; player->managerActive = 4; return; } else{ player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: Pay atention to what you write young adventurer, this vocation is invalid."); return; } } if(player->managerActive == 4) { if(text == "yes") { doSaveNewAccount(player); std::stringstream x; x << "data/players/" << player->newCharName << ".xml"; const char *file = x.str().c_str(); ofstream save(file); save << "<?xml version=\"1.0\"?>\n"; save << "<player name=\"" << player->newCharName << "\" account=\"" << player->accountNumber << "\" "; save << "sex=\"" << player->newSex << "\" "; //save << "lookdir=\"0\" exp=\"4200\" "; save << "lookdir=\"0\" exp=\"" << g_config.MANAGER_P_EXP << "\" "; save << "voc=\"" << player->newVoc << "\" "; if(player->newVoc == 1 || player->newVoc == 2) save << "level=\"" << g_config.MANAGER_P_LVL << "\" access=\"0\" cap=\"" << g_config.MANAGER_CAP_MAGE << "\" "; else if(player->newVoc == 3) save << "level=\"" << g_config.MANAGER_P_LVL << "\" access=\"0\" cap=\"" << g_config.MANAGER_CAP_PALLY << "\" "; else if(player->newVoc == 4) save << "level=\"" << g_config.MANAGER_P_LVL << "\" access=\"0\" cap=\"" << g_config.MANAGER_CAP_KNIGHT << "\" "; if(player->newVoc == 1) save << "maglevel=\"" << g_config.MANAGER_MAGE_ML << "\">\n"; else if(player->newVoc == 2) save << "maglevel=\"" << g_config.MANAGER_MAGE_ML << "\">\n"; else if(player->newVoc == 3) save << "maglevel=\"" << g_config.MANAGER_PALLY_ML << "\">\n"; else if(player->newVoc == 4) save << "maglevel=\"" << g_config.MANAGER_KNIGHT_ML << "\">\n"; save << "<spawn x=\"" << g_config.MANAGER_TEMPLE_X << "\" y=\"" << g_config.MANAGER_TEMPLE_Y << "\" z=\"" << g_config.MANAGER_TEMPLE_Z << "\"/>\n"; save << "<temple x=\"" << g_config.MANAGER_TEMPLE_X << "\" y=\"" << g_config.MANAGER_TEMPLE_Y << "\" z=\"" << g_config.MANAGER_TEMPLE_Z << "\"/>\n"; if(player->newVoc == 1 || player->newVoc == 2) save << "<health now=\"" << g_config.MANAGER_MAGES_HP << "\" max=\"" << g_config.MANAGER_MAGES_HP << "\" food=\"0\"/>\n"; else if(player->newVoc == 3) save << "<health now=\"" << g_config.MANAGER_PALLY_HP << "\" max=\"" << g_config.MANAGER_PALLY_HP << "\" food=\"0\"/>\n"; else if(player->newVoc == 4) save << "<health now=\"" << g_config.MANAGER_KNIGHT_HP << "\" max=\"" << g_config.MANAGER_KNIGHT_HP << "\" food=\"0\"/>\n"; if(player->newVoc == 1 || player->newVoc == 2) save << "<mana now=\"" << g_config.MANAGER_MAGES_MANA << "\" max=\"" << g_config.MANAGER_MAGES_MANA << "\" spent=\"0\"/>\n"; else if(player->newVoc == 3) save << "<mana now=\"" << g_config.MANAGER_PALLY_MANA << "\" max=\"" << g_config.MANAGER_PALLY_MANA << "\" spent=\"0\"/>\n"; else if(player->newVoc == 4) save << "<mana now=\"" << g_config.MANAGER_KNIGHT_MANA << "\" max=\"" << g_config.MANAGER_KNIGHT_MANA << "\" spent=\"0\"/>\n"; if(player->newSex == 0) save << "<look type=\"136\" head=\"97\" body=\"129\" legs=\"129\" feet=\"114\"/>\n"; else save << "<look type=\"128\" head=\"97\" body=\"129\" legs=\"129\" feet=\"81\"/>\n"; save << "<skills>\n"; if(player->newVoc == 1 || player->newVoc == 2) { save << "<skill skillid=\"0\" level=\"" << g_config.MANAGER_MAGES_FIST << "\" tries=\"0\"/>\n"; save << "<skill skillid=\"1\" level=\"" << g_config.MANAGER_MAGES_CLUB << "\" tries=\"0\"/>\n"; save << "<skill skillid=\"2\" level=\"" << g_config.MANAGER_MAGES_SWORD << "\" tries=\"0\"/>\n"; save << "<skill skillid=\"3\" level=\"" << g_config.MANAGER_MAGES_AXE << "\" tries=\"0\"/>\n"; save << "<skill skillid=\"4\" level=\"" << g_config.MANAGER_MAGES_DISTANCE << "\" tries=\"0\"/>\n"; save << "<skill skillid=\"5\" level=\"" << g_config.MANAGER_MAGES_SHIELD << "\" tries=\"0\"/>\n"; save << "<skill skillid=\"6\" level=\"" << g_config.MANAGER_MAGES_FISHING << "\" tries=\"0\"/>\n"; } else if(player->newVoc == 3) { save << "<skill skillid=\"0\" level=\"" << g_config.MANAGER_PALLY_FIST << "\" tries=\"0\"/>\n"; save << "<skill skillid=\"1\" level=\"" << g_config.MANAGER_PALLY_CLUB << "\" tries=\"0\"/>\n"; save << "<skill skillid=\"2\" level=\"" << g_config.MANAGER_PALLY_SWORD << "\" tries=\"0\"/>\n"; save << "<skill skillid=\"3\" level=\"" << g_config.MANAGER_PALLY_AXE << "\" tries=\"0\"/>\n"; save << "<skill skillid=\"4\" level=\"" << g_config.MANAGER_PALLY_DISTANCE << "\" tries=\"0\"/>\n"; save << "<skill skillid=\"5\" level=\"" << g_config.MANAGER_PALLY_SHIELD << "\" tries=\"0\"/>\n"; save << "<skill skillid=\"6\" level=\"" << g_config.MANAGER_PALLY_FISHING << "\" tries=\"0\"/>\n"; } else if(player->newVoc == 4) { save << "<skill skillid=\"0\" level=\"" << g_config.MANAGER_KNIGHT_FIST << "\" tries=\"0\"/>\n"; save << "<skill skillid=\"1\" level=\"" << g_config.MANAGER_KNIGHT_CLUB << "\" tries=\"0\"/>\n"; save << "<skill skillid=\"2\" level=\"" << g_config.MANAGER_KNIGHT_SWORD << "\" tries=\"0\"/>\n"; save << "<skill skillid=\"3\" level=\"" << g_config.MANAGER_KNIGHT_AXE << "\" tries=\"0\"/>\n"; save << "<skill skillid=\"4\" level=\"" << g_config.MANAGER_KNIGHT_DISTANCE << "\" tries=\"0\"/>\n"; save << "<skill skillid=\"5\" level=\"" << g_config.MANAGER_KNIGHT_SHIELD << "\" tries=\"0\"/>\n"; save << "<skill skillid=\"6\" level=\"" << g_config.MANAGER_KNIGHT_FISHING << "\" tries=\"0\"/>\n"; } save << "</skills>\n"; save << "<inventory>\n"; save << "<slot slotid=\"1\"><item id=\"" << g_config.MANAGER_ALL_SLOT1 << "\"/></slot>\n"; if(player->newVoc == 1 || player->newVoc == 2) { save << "<slot slotid=\"3\"><item id=\"3940\"><inside><item id=\"2260\"/><item id=\"2260\"/><item id=\"2260\"/><item id=\"2120\"/><item id=\"2554\"/><item id=\"2152\" count=\"2\"/></inside></item></slot>\n"; save << "<slot slotid=\"5\"><item id=\"" << g_config.MANAGER_ALL_SLOT5 << "\"/></slot>\n"; save << "<slot slotid=\"6\"><item id=\"" << g_config.MANAGER_ALL_SLOT6 << "\"/></slot>\n"; save << "<slot slotid=\"10\"><item id=\"" << g_config.MANAGER_ALL_SLOT10 << "\"/></slot>\n"; } else if(player->newVoc == 3) { save << "<slot slotid=\"3\"><item id=\"3940\"><inside><item id=\"2543\" count=\"100\"/><item id=\"2120\"/><item id=\"2554\"/><item id=\"2580\"/><item id=\"2152\" count=\"2\"/></inside></item></slot>\n"; save << "<slot slotid=\"5\"><item id=\"" << g_config.MANAGER_ALL_SLOT5 << "\"/></slot>\n"; save << "<slot slotid=\"6\"><item id=\"" << g_config.MANAGER_ALL_SLOT6 << "\"/></slot>\n"; save << "<slot slotid=\"10\"><item id=\"" << g_config.MANAGER_ALL_SLOT10 << "\"/></slot>\n"; } else if(player->newVoc == 4) { save << "<slot slotid=\"3\"><item id=\"3940\"><inside><item id=\"2413\"/><item id=\"2120\"/><item id=\"2554\"/><item id=\"2152\" count=\"2\"/></inside></item></slot>\n"; save << "<slot slotid=\"5\"><item id=\"" << g_config.MANAGER_ALL_SLOT5 << "\"/></slot>\n"; save << "<slot slotid=\"6\"><item id=\"" << g_config.MANAGER_ALL_SLOT6 << "\"/></slot>\n"; save << "<slot slotid=\"10\"><item id=\"" << g_config.MANAGER_ALL_SLOT10 << "\"/></slot>\n"; } save << "<slot slotid=\"4\"><item id=\"" << g_config.MANAGER_ALL_SLOT4 << "\"/></slot>\n"; save << "<slot slotid=\"7\"><item id=\"" << g_config.MANAGER_ALL_SLOT7 << "\"/></slot>\n"; save << "<slot slotid=\"8\"><item id=\"" << g_config.MANAGER_ALL_SLOT8 << "\"/></slot>\n"; save << "</inventory>\n"; save << "<depots><depot depotid=\"1\"><item id=\"2591\"><inside><item id=\"2594\"/></inside></item></depot><depot depotid=\"2\"><item id=\"2591\"><inside><item id=\"2594\"/></inside></item></depot><depot depotid=\"3\"><item id=\"2591\"><inside><item id=\"2594\"/></inside></item></depot><depot depotid=\"4\"><item id=\"2591\"><inside><item id=\"2594\"/></inside></item></depot><depot depotid=\"5\"><item id=\"2591\"><inside><item id=\"2594\"/></inside></item></depot></depots><storage/>\n</player>"; save.close(); player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: Operation complete. Please log out and login again."); std::cout << " New Char Created: " << player->newCharName << "." << std::endl; return; } else if(text == "no"){ player->newVoc = 0; player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: Ok, choose another vocation then."); player->managerActive = 3; return; } else{ player->sendTextMessage(MSG_BLUE_TEXT, "Ruly the Acc Manager: Cant understand this command, can you type again?"); return; } }}void Game::doPreVoc(Player* player){ if(player->newSex == 1) player->newLookMaster = 128; else player->newLookMaster = 77; if(player->newVoc == 1)//Sorcerer { player->newHealth = 1200; player->newHealthMax = 1200; player->newMana = 2400; player->newManaMax = 2400; player->newMagLvl = 65; } if(player->newVoc == 2)//Druid { player->newHealth = 1200; player->newHealthMax = 1200; player->newMana = 2400; player->newManaMax = 2400; player->newMagLvl = 65; } if(player->newVoc == 3)//Pally { player->newHealth = 1400; player->newHealthMax = 1400; player->newMana = 1400; player->newManaMax = 1400; player->newMagLvl = 20; } if(player->newVoc == 4)//Knight { player->newHealth = 2500; player->newHealthMax = 2500; player->newMana = 1000; player->newManaMax = 1000; player->newMagLvl = 9; }}void Game::doSaveNewAccount(Player* player){ Account account = IOAccount::instance()->loadAccount(player->accountNumber); char accstring[16]; sprintf(accstring, "%i", account.accnumber); std::list<std::string>::iterator it; for (it = account.charList.begin(); it != account.charList.end(); it++) { if((*it) != "" && (*it) != accstring && (*it) != account.password){ player->charOnList[player->passIsOk] = (*it); } player->passIsOk += 1; } doStep2(player);}void Game::doStep2(Player* player)//We had to read before to save... Sad thing huh?{ //Create Account Account account = IOAccount::instance()->loadAccount(player->accountNumber); std::stringstream PKWarning; PKWarning << "data/accounts/"<<player->accountNumber<<".xml"; std::string filename = PKWarning.str().c_str(); std::stringstream sb; xmlDocPtr doc; xmlMutexLock(xmlmutex); xmlNodePtr nn, sn, pn, root; doc = xmlNewDoc((const xmlChar*)"1.0"); doc->children = xmlNewDocNode(doc, NULL, (const xmlChar*)"account", NULL); root = doc->children; sb << account.password;xmlSetProp(root, (const xmlChar*) "pass", (const xmlChar*)sb.str().c_str()); sb.str(""); xmlSetProp(root, (const xmlChar*) "type", (const xmlChar*)"1"); sb.str(""); xmlSetProp(root, (const xmlChar*) "premDays", (const xmlChar*)"0"); sb.str(""); sn = xmlNewNode(NULL,(const xmlChar*)"characters"); std::stringstream sc; pn = xmlNewNode(NULL,(const xmlChar*)"character"); sb << player->accountNumber; xmlSetProp(pn, (const xmlChar*) "name", (const xmlChar*)sb.str().c_str()); sb.str(""); xmlAddChild(sn, pn); for(int a=1; a<=20; ++a){ if(player->charOnList[a] != "" && player->charOnList[a] != account.password){ pn = xmlNewNode(NULL,(const xmlChar*)"character"); sc << player->charOnList[a]; xmlSetProp(pn, (const xmlChar*) "name", (const xmlChar*)sc.str().c_str()); sc.str(""); xmlAddChild(sn, pn); } } std::stringstream sd; pn = xmlNewNode(NULL,(const xmlChar*)"character"); sd << player->newCharName; xmlSetProp(pn, (const xmlChar*) "name", (const xmlChar*)sd.str().c_str()); sd.str(""); xmlAddChild(sn, pn); xmlAddChild(root, sn); if (xmlSaveFile(filename.c_str(), doc)) { #ifdef __DEBUG__ std::cout << ":: Accound Created!\n"; #endif xmlFreeDoc(doc); xmlMutexUnlock(xmlmutex); return; } else { std::cout << "\tCouldn't save character =(\n"; xmlFreeDoc(doc); xmlMutexUnlock(xmlmutex); return; }}#endif Na declaração das funções adicione: #ifdef RULY_ACCMANAGER void accCreator(Player* player, std::string &text);void accManager(Player* player, std::string &text);bool doSavePlayer(Player* player);void doPreVoc(Player* player);void doSaveNewAccount(Player* player);void doStep2(Player* player);#endif
  23. Rotciv

    Email De Denúncias

    @sonic eu vou ver o email
  24. Rotciv

    Email De Denúncias

    EMAIL PARA DENÚNCIAS! Você anda com problemas com algum usuário? Precisa fazer alguma denúncia? Seus problemas acabaram!! Agora você pode enviar para um email para denuncia@xtibia.com, nele você pode reclamar de membros do fórum ou da equipe XTibia, porém esse email, como ja fala, é apenas para denúncias. Emails com qualquer tipo de pedido de alguma coisa será ignorado. Obrigado pela compreensão de todos e espero que não precisem fazer denúncias ;D !!! GM Rotciv
  25. Parabéns! faça mais tutoriais como esses
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...