Pesquisar na Comunidade
Mostrando resultados para as tags ''c++''.
Encontrado 21 registros
-
Programação [PEDIDO] ajuda com script de guild house
lks93 postou uma questão Tópicos Não Resolvidos
Antes de fazer a sua pergunta, tenha certeza de ter lido as regras da seção e o guia abaixo: https://forums.otserv.com.br/index.php?/forums/topic/168583-regras-da-seção/ https://forums.otserv.com.br/index.php?/forums/topic/165121-como-fazer-uma-pergunta-ou-o-grande-guia-do-usuário-com-dúvidas/ Descreva em algumas palavras a base utilizada. (Nome do servidor / Nome do cliente / Nome do website / etc.). Ex: The Forgotten Server 1.3, Versão: 10.98. Base: OTServBR-Global, Versão: 12.40. Qual é a sua pergunta? Gostaria de ajuda para transcrever este script. em determinada hora a Guil House será liberada para ser dominada por qualquer Guild Você tem o código disponível? Se tiver poste-o na caixa de código que está dentro do spoiler abaixo: Você tem alguma imagem que possa auxiliar no problema? Se sim, anexe-a dentro do spoiler abaixo: -
Antes de fazer a sua pergunta, tenha certeza de ter lido as regras da seção e o guia abaixo: https://forums.otserv.com.br/index.php?/forums/topic/168583-regras-da-seção/ https://forums.otserv.com.br/index.php?/forums/topic/165121-como-fazer-uma-pergunta-ou-o-grande-guia-do-usuário-com-dúvidas/ Descreva em algumas palavras a base utilizada. (Nome do servidor / Nome do cliente / Nome do website / etc.). Ex: The Forgotten Server 1.3, Versão: 10.98. Base: Uso, The Forgotten Server 1.3 (Mark Samman/gustavo contreiras), Versão: 10.98. Repositório com as sources -- > SRC Qual é a sua pergunta? -- Olá pessoal! Estou tentando fazer com que os Monstros consigam ver os Jogadores à uma distância compatível com o número de tiles que acrescentei ao meu servidor/client. Que seria 15 quadros de distância em X e 9 Quadros em Y Mas atualmente os Monstros só começam a te seguir apartir de 9 quadros. Que é muito pouco, o jogador consegue ver ele parado até se aproximar o suficiente pra ele te ver. Queria que ele começasse a seguir apartir de 15 quadros de distância do Jogador. O meu map.h está assim: class Map { public: static constexpr int32_t maxViewportX = 15; //min value: maxClientViewportX + 1 static constexpr int32_t maxViewportY = 9; //min value: maxClientViewportY + 1 static constexpr int32_t maxClientViewportX = 14; static constexpr int32_t maxClientViewportY = 8; E meu creature.cpp assim: bool Creature::canSee(const Position& pos) const { return canSee(getPosition(), pos, Map::maxViewportX, Map::maxViewportY); } Iso era para fazer com queo range de atividade monstros serem respectivamente x = 15 e y = 9 da posição dele, não? Mas os monstros continuam se limitando à distâncias padrão já experimentei substituir a linha return canSee(getPosition(), pos, Map::maxViewportX, Map::maxViewportY); por: return canSee(getPosition(), pos, 15, 9); Porém, sem sucesso. O que eu posso estar esquecendo? Você tem o código disponível? Se tiver poste-o na caixa de código que está dentro do spoiler abaixo: Você tem alguma imagem que possa auxiliar no problema? Se sim, anexe-a dentro do spoiler abaixo:
-
Então recentemente achei esse sistema "perdido", porem ele estava com alguns bugs sinistros, os quais eram: Pokémon selvagem estava recebendo xp negativa quando seu pokémon morria. Você upava 70k de leveis caso matasse algum pokémon no selfdestruction. Por fim estes bugs foram removidos, agora estarei postando o sistema corrigido para vocês. Em monster.cpp e procure pela função: void Monster::onThink(uint32_t interval) E dentro dela, procure pela condição: else if(!targetList.empty()) E troque por esta: else if(!targetList.empty()) { if(!followCreature || !hasFollowPath) searchTarget(); } Agora procure pela função: bool Monster::selectTarget(Creature* creature) E troque por esta: bool Monster::selectTarget(Creature* creature) { #ifdef __DEBUG__ std::cout << "Selecting target... " << std::endl; #endif if(!isTarget(creature)) return false; Creature* target = creature->isPlayerSummon() ? creature->getMaster() : creature; if(!isHostile() && !hasBeenAttacked(target->getID()) && target->getAttackedCreature() != this) return false; CreatureList::iterator it = std::find(targetList.begin(), targetList.end(), creature); if(it == targetList.end()) { //Target not found in our target list. #ifdef __DEBUG__ std::cout << "Target not found in targetList." << std::endl; #endif return false; } if(setAttackedCreature(creature)) Dispatcher::getInstance().addTask(createTask(boost::bind(&Game::checkCreatureAttack, &g_game, getID()))); return setFollowCreature(creature, true); } --- Créditos pelo sistema e pela correção: Tony Araujo Crypter
-
Skull System(Red,White,Yellow) + Party System 7.60. *Players em party não sofrem dano.* Não autorizo NINGUÉM a VENDER ou POSTAR em outro FÓRUM Este Script. Mas caso você adicione em seu servidor. COLOQUE MEUS CREDITOS PORFAVOR. Creditos:Underewarr,(Gesior me ajudou em algumas coisas) Vamos esquecer o sistema de skull do 7.6 que esteja usando e começamos aqui;(TLM_PARTY_SKULLS.) Em commands.cpp em baixo de: #ifdef TRS_GM_INVISIBLE {"/invisible",&Commands::gmInvisible}, #endif //TRS_GM_INVISIBLE nós vamos adicionar isso aqui: #ifdef YELLOW_SKULLS {"!frags",&Commands::PokazFragi}, {"!rs",&Commands::PokazRs}, #endif //YELLOW_SKULLS No Final de commands.cpp vamos adicionar o seguinte: #ifdef YELLOW_SKULLS bool Commands::PokazFragi(Creature* c, const std::string &cmd, const std::string ¶m) { Player* player = dynamic_cast<Player*>(c); if (player) { std::ostringstream frag; frag << "You have " << player->skullKills << " unjustified kills. You will lose a frag in " << tickstr(player->absolveTicks) << "." << std::ends; player->sendTextMessage(MSG_BLUE_TEXT, frag.str().c_str()); } return true; } bool Commands::PokazRs(Creature* c, const std::string &cmd, const std::string ¶m) { Player* player = dynamic_cast<Player*>(c); if (player && player->skullType==SKULL_RED) { std::ostringstream rs; rs << "Redskull zniknie za " << tickstr(player->skullTicks) << '.'; player->sendTextMessage(MSG_BLUE_TEXT, rs.str().c_str()); } else { std::ostringstream rs; rs << "Nie masz Red Skull'a."; player->sendTextMessage(MSG_BLUE_TEXT, rs.str().c_str()); } return true; } #endif //YELLOW_SKULLS E então iremos em commands.h: Em baixo de: #ifdef TRS_GM_INVISIBLE bool gmInvisible(Creature* c, const std::string &cmd, const std::string ¶m); #endif //TRS_GM_INVISIBLE E em baixo adicionaremos: #ifdef YELLOW_SKULLS PokazRs bool (Creature * c, const std :: string & cmd, std :: string const & param); bool PokazFragi (Creature * c, const std :: string & cmd, const std: string & param); #endif // YELLOW_SKULLS Agora vamos em Const76h.h Procuraremos por #ifdef TJ_MONSTER_BLOOD enum bloodcolor_t // for dmg string { COLOR_NONE = 255, COLOR_WHITE_EXP = 215, COLOR_WHITE = 208, COLOR_BLUE = 2, COLOR_RED = 180, COLOR_GREEN = 50, }; E em baixo adicionaremos: #ifdef YELLOW_SKULLS enum skull_t { SKULL_NONE = 0, SKULL_YELLOW = 1, SKULL_GREEN = 2, SKULL_WHITE = 3, SKULL_RED = 4 }; #endif //YELLOW_SKULLS Agora vamos em creature.cpp Procurar por: #ifdef YUR_RINGS_AMULETS timeRing = false; #endif //YUR_RINGS_AMULET E em baixo adicionaremos: #ifdef YELLOW_SKULLS skullType = SKULL_NONE; #endif //YELLOW_SKULLS Em creature.h Procurar: virtual int getInflicatedDamage(unsigned long id); Em baixo adicionar: #ifdef YELLOW_SKULLS skull_t skullType; #endif //YELLOW_SKULLS Procurar por: stopEvent(c->eventCheckAttacking); Player* player = dynamic_cast<Player*>(c); if(player){ Em baixo Adicionar: #ifdef YELLOW_SKULLS if(player->party != 0) LeaveParty(player); #endif //YELLOW_SKULLS Vamos achar esta citação. #ifdef YUR_RINGS_AMULETS damage = applyAmulets(targetPlayer, damage, me->attackType); #endif //YUR_RINGS_AMULETS E vamos substituir todo o bloco de comando: if (damage > 0) { if(attackPlayer && attackPlayer->access < g_config.ACCESS_PROTECT) { if(targetPlayer && targetPlayer != attackPlayer && game->getWorldType() != WORLD_TYPE_NO_PVP) attackPlayer->pzLocked = true; } Por : if (damage > 0) { if(attackPlayer && attackPlayer->access < g_config.ACCESS_PROTECT) { if(targetPlayer && targetPlayer != attackPlayer && game->getWorldType() != WORLD_TYPE_NO_PVP){ attackPlayer->pzLocked = true; #ifdef YELLOW_SKULLS if(!targetPlayer->hasAttacked(attackPlayer)){ if(game->getWorldType() == WORLD_TYPE_PVP){ bool sendYellowSkull = false; if(!attackPlayer->hasAttacked(targetPlayer) && (attackPlayer->skullType == SKULL_NONE || (attackPlayer->skullType == SKULL_NONE && attackPlayer->getMaster()))){ //pokaz yellow skulla sendYellowSkull = true; } attackPlayer->addAttacked(targetPlayer); if(sendYellowSkull){ targetPlayer->onSkull(attackPlayer); } } } } #endif //YELLOW_SKULLS } Vamos procura por : #ifdef YUR_INVISIBLE if (targetCreature && !targetPlayer) { targetCreature->setInvisible(0); game->creatureChangeOutfit(targetCreature); } #endif //YUR_INVISIBLE } E adicionar em baixo: #ifdef YELLOW_SKULLS if (me->offensive && game->getWorldType() == WORLD_TYPE_PVP) game->onPvP(attacker, targetCreature, targetCreature->health <= 0); #endif //YELLOW_SKULLS Excluir: blood = true; Vamos adicionar #ifdef YELLOW_SKULLS if (game->getWorldType() == WORLD_TYPE_PVP) game->onPvP(attacker, attackedCreature, attackedCreature->health <= 0); #endif //YELLOW_SKULLS Vamos adicionar if(player->tradePartner != 0) { playerCloseTrade(player); } Vamos Adicionar #ifdef YELLOW_SKULLS if(player->party != 0) LeaveParty(player); #endif //YELLOW_SKULLS vamos adicionar #ifdef YUR_CVS_MODS player->inFightTicks = std::max(g_config.PZ_LOCKED, player->inFightTicks); #else player->inFightTicks = (long)g_config.getGlobalNumber("pzlocked", 0); #endif //YUR_CVS_MODS Adicionar tambem player->sendIcons(); Vamos procurar por if(attackedPlayer) player->pzLocked = true; } E Substituir if(attackedPlayer){ player->pzLocked = true; #ifdef YELLOW_SKULLS if(!attackedPlayer->hasAttacked(player)){ if(getWorldType() == WORLD_TYPE_PVP){ bool sendYellowSkull = false; if(!player->hasAttacked(attackedPlayer)&& (player->skullType == SKULL_NONE || (player->skullType == SKULL_NONE && player->getMaster()))) { //pokaz YS sendYellowSkull = true; } player->addAttacked(attackedPlayer); if(sendYellowSkull){ attackedPlayer->onSkull(player); } } } } #endif //YELLOW_SKULLS } Procure por: #ifdef YUR_LIGHT_ITEM player->checkLightItem(thinkTicks); #endif //YUR_LIGHT_ITEM Em baixo adicione : #ifdef YELLOW_SKULLS if (player->checkSkull(thinkTicks)) Skull(player); #endif //YELLOW_SKULLS Procure por: #ifdef YUR_INVISIBLE if (player->checkInvisible(thinkTicks)) creatureChangeOutfit(player); #endif //YUR_INVISIBLE Em baixo adicione: #ifdef YELLOW_SKULLS checkSkullTime(player); #endif //YELLOW_SKULLS No final do arquivo, Adicione: #ifdef YELLOW_SKULLS void Game::Skull(Player* player) { OTSYS_THREAD_LOCK_CLASS lockClass(gameLock, "Game::Skull()"); if (player) { SpectatorVec list; SpectatorVec::iterator it; getSpectators(Range(player->pos, true), list); for(it = list.begin(); it != list.end(); ++it) { Player* spectator = dynamic_cast<Player*>(*it); if(spectator) if(player->skullType == SKULL_NONE || player->skullType == SKULL_WHITE || player->skullType == SKULL_RED || player->skullType == SKULL_YELLOW && player->isYellowTo(spectator) || player->skullType == SKULL_YELLOW && !player->isYellowTo(spectator)) spectator->onSkull(player); } } } void Game::onPvP(Creature* creature, Creature* attacked, bool murder) { OTSYS_THREAD_LOCK_CLASS lockClass(gameLock, "Game::onPvP()"); if (creature && creature->getMaster()) creature = creature->getMaster(); // pk-ing with summons fix Player* player = dynamic_cast<Player*>(creature); Player* attackedPlayer = dynamic_cast<Player*>(attacked); if (player == attackedPlayer) return; if(!player || !attackedPlayer) return; if (player && player->access >= g_config.ACCESS_PROTECT || attackedPlayer && attackedPlayer->access >= g_config.ACCESS_PROTECT) return; player->pzLocked = true; if (!murder) { if(!player->hasAttacked(attackedPlayer)){ player->attackedSet; } if(attackedPlayer->skullType == SKULL_NONE || attackedPlayer->skullType == SKULL_YELLOW && attackedPlayer->isYellowTo(player) == 0) { if(player->skullType != SKULL_RED && player->skullType != SKULL_WHITE){ player->skullType = SKULL_WHITE; Skull(player); } } else if(attackedPlayer->skullType == SKULL_WHITE || attackedPlayer->skullType == SKULL_RED) { if(player->skullType != SKULL_RED && player->skullType != SKULL_WHITE){ if(!attackedPlayer->hasAttacked(player)){ player->skullType = SKULL_YELLOW; attackedPlayer->hasAsYellow.push_back(player); attackedPlayer->onSkull(player); } } } if(player->inFightTicks < (long)g_config.getGlobalNumber("pzlocked", 0)) player->inFightTicks = (long)g_config.getGlobalNumber("pzlocked", 0); if(player->skullTicks < (long)g_config.getGlobalNumber("pzlocked", 0)) player->skullTicks = (long)g_config.getGlobalNumber("pzlocked", 0); } else // zaatakowany zginal { if (attackedPlayer->skullType == SKULL_NONE || attackedPlayer->skullType == SKULL_YELLOW && player->isYellowTo(attackedPlayer) == 0) //Ofiara nie miala skulla oraz miala yellow ale nie na graczu ktora go zabil. { player->skullKills++; std::string justice(std::string("Warning! The murder of ") + attackedPlayer->getName() + " was not justified!"); player->sendTextMessage(MSG_RED_INFO, justice.c_str()); attackedPlayer->clearAttacked();//czyszczenie listy zaatakowanych attackedPlayer->removeFromYellowList(player);//usuwanie gracza z Yellow skull z listy atakowanych z ys #ifdef YELLOW_BAN_SYSTEM if (player->skullKills >= g_config.BAN_UNJUST) { banPlayer(player, "Przekroczono limit zabijania graczy", "AccountBan", "2", 0); }else #endif //YELLOW_BAN_SYSTEM if (player->skullKills >= g_config.RED_UNJUST) { player->skullType = SKULL_RED; if(player->skullTicks < g_config.getGlobalNumber("redtime",24*60)*60000) player->skullTicks = g_config.getGlobalNumber("redtime",24*60)*60000; if(player->inFightTicks < g_config.getGlobalNumber("whitetime",15)*60000) player->inFightTicks = g_config.getGlobalNumber("whitetime",15)*60000; Skull(player); } else { player->skullType = SKULL_WHITE; if(player->skullTicks < g_config.getGlobalNumber("whitetime",15)*60000) player->skullTicks = g_config.getGlobalNumber("whitetime",15)*60000; if(player->inFightTicks < g_config.getGlobalNumber("whitetime",15)*60000) player->inFightTicks = g_config.getGlobalNumber("whitetime",15)*60000; Skull(player); } } else if (attackedPlayer->skullType == SKULL_RED)//victim had red skull..(fair kill) { //we aren't removin his skull..are we? attackedPlayer->removeFromYellowList(player); //usuwanie gracza z Yellow skull z listy atakowanych z ys attackedPlayer->clearAttacked(); //czyszczenie listy zaatakowanych attackedPlayer->skullType = SKULL_RED; if(player->inFightTicks < g_config.getGlobalNumber("whitetime",15)*60000) player->inFightTicks = g_config.getGlobalNumber("whitetime",15)*60000;//not giving him a skull.. just setting the murder time. } else if (attackedPlayer->skullType == SKULL_WHITE) //victim had white skull.. (fair kill) { attackedPlayer->skullType = SKULL_NONE; attackedPlayer->skullTicks = 0; attackedPlayer->inFightTicks = 0; attackedPlayer->removeFromYellowList(player); //usuwanie gracza z Yellow skull z listy atakowanych z ys attackedPlayer->clearAttacked(); //czyszczenie listy zaatakowanych Skull(attackedPlayer); if(player->inFightTicks < g_config.getGlobalNumber("whitetime",15)*60000) player->inFightTicks = g_config.getGlobalNumber("whitetime",15)*60000;//not giving him a skull.. just setting the murder time. } else if (attackedPlayer->skullType == SKULL_YELLOW && attackedPlayer->isYellowTo(player))//el que murio era yellow skull para el que lo mato. { attackedPlayer->skullType = SKULL_NONE; attackedPlayer->skullTicks = 0; attackedPlayer->inFightTicks = 0; attackedPlayer->removeFromYellowList(player);//usuwanie gracza z Yellow skull z listy atakowanych z ys attackedPlayer->clearAttacked(); //czyszczenie listy zaatakowanych Skull(attackedPlayer); if(player->inFightTicks < g_config.getGlobalNumber("whitetime",15)*60000) player->inFightTicks = g_config.getGlobalNumber("whitetime",15)*60000;//not giving him a skull.. just setting the murder time. } attackedPlayer->clearAttacked();//czyszczenie listy zaatakowanych attackedPlayer->removeFromYellowList(player);//usuwanie gracza z Yellow skull z listy atakowanych z ys } } void Game::LeaveParty(Player *player) { int members = 0; std::stringstream bericht1; bericht1 << player->getName() << " has left the party"; if(player->getID() == player->party) { disbandParty(player->party); return; } for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it) { if((*it).second->party == player->party) { members++; if((*it).second->getID() != player->getID()) (*it).second->sendTextMessage(MSG_INFO, bericht1.str().c_str()); (*it).second->onPartyIcons(player, 0, false, true); player->onPartyIcons((*it).second, 0, false, true); } } if(members <= 2) { disbandParty(player->party); return; } player->sendTextMessage(MSG_INFO, "You have left the party."); player->party = 0; } void Game::disbandParty(unsigned long partyID) { for(AutoList<Player>::listiterator cit = Player::listPlayer.list.begin(); cit != Player::listPlayer.list.end(); ++cit) { if((*cit).second->party == partyID) { (*cit).second->party = 0; for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it) { (*cit).second->onPartyIcons((*it).second, 0, false, true); if((*it).second->skullType == SKULL_NONE || (*it).second->skullType == SKULL_WHITE || (*it).second->skullType == SKULL_RED || (*it).second->skullType == SKULL_YELLOW && (*it).second->isYellowTo((*cit).second)) (*cit).second->onSkull((*it).second); } (*cit).second->sendTextMessage(MSG_INFO, "Your party has been disbanded."); } } } void Game::checkSkullTime(Player* player) { if(player->skullType == SKULL_NONE)//just in case return; if(player->skullTicks < player->inFightTicks) player->skullTicks = player->inFightTicks; if(player->skullType != SKULL_RED && player->skullTicks > player->inFightTicks) //we don't want to do that if the player has a red skull... player->inFightTicks = player->skullTicks; } #endif //YELLOW_SKULLS Agora em Game.h Procure por: #ifdef TRS_GM_INVISIBLE void creatureBroadcastTileUpdated(const Position& pos); #endif //TRS_GM_INVISIBLE Adicione em baixo: #ifdef YELLOW_SKULLS void onPvP(Creature* creature, Creature* attacked, bool murder = false); void Skull(Player* player); void checkSkullTime(Player* player); void disbandParty(unsigned long partyID); void LeaveParty(Player *player); #endif //YELLOW_SKULLS Agora em ioplayerxml.cpp: Procure por: else if(str=="temple") { nodeValue = (char*)xmlGetProp(p, (const xmlChar *) "x"); if(nodeValue) { player->masterPos.x=atoi(nodeValue); xmlFreeOTSERV(nodeValue); } else isLoaded = false; nodeValue = (char*)xmlGetProp(p, (const xmlChar *) "y"); if(nodeValue) { player->masterPos.y=atoi(nodeValue); xmlFreeOTSERV(nodeValue); } else isLoaded = false; nodeValue = (char*)xmlGetProp(p, (const xmlChar *) "z"); if(nodeValue) { player->masterPos.z=atoi(nodeValue); xmlFreeOTSERV(nodeValue); } else isLoaded = false; } Adicione em baixo: #ifdef YELLOW_SKULLS else if(str=="skull") { nodeValue = (char*)xmlGetProp(p, (const xmlChar *) "type"); if(nodeValue) { player->skullType=(skull_t)atoi(nodeValue); xmlFreeOTSERV(nodeValue); } else isLoaded = false; nodeValue = (char*)xmlGetProp(p, (const xmlChar *) "kills"); if(nodeValue) { player->skullKills=atoi(nodeValue); xmlFreeOTSERV(nodeValue); } else isLoaded = false; nodeValue = (char*)xmlGetProp(p, (const xmlChar *) "ticks"); if(nodeValue) { player->skullTicks=atoi(nodeValue); xmlFreeOTSERV(nodeValue); } else isLoaded = false; nodeValue = (char*)xmlGetProp(p, (const xmlChar *) "absolve"); if(nodeValue) { player->absolveTicks=atoi(nodeValue); xmlFreeOTSERV(nodeValue); } else isLoaded = false; } #endif //YELLOW_SKULLS Procure por: pn = xmlNewNode(NULL,(const xmlChar*)"temple"); sb << player->masterPos.x; xmlSetProp(pn, (const xmlChar*) "x", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << player->masterPos.y; xmlSetProp(pn, (const xmlChar*) "y", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << player->masterPos.z; xmlSetProp(pn, (const xmlChar*) "z", (const xmlChar*)sb.str().c_str()); sb.str(""); xmlAddChild(root, pn); Adicione em baixo: #ifdef YELLOW_SKULLS pn = xmlNewNode(NULL,(const xmlChar*)"skull"); sb << (int)player->skullType; xmlSetProp(pn, (const xmlChar*) "type", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << player->skullKills; xmlSetProp(pn, (const xmlChar*) "kills", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << player->skullTicks; xmlSetProp(pn, (const xmlChar*) "ticks", (const xmlChar*)sb.str().c_str()); sb.str(""); sb << player->absolveTicks; xmlSetProp(pn, (const xmlChar*) "absolve", (const xmlChar*)sb.str().c_str()); sb.str(""); xmlAddChild(root , pn); #endif //YELLOW_SKULLS Agora em luascript.cpp: Procure por: #ifdef TLM_HOUSE_SYSTEM ACCESS_HOUSE = getGlobalNumber("accesshouse",3); MAX_HOUSE_TILE_ITEMS = getGlobalNumber("maxhousetileitems",10); #endif //TLM_HOUSE_SYSTEM Adicione em baixo: #ifdef YELLOW_SKULLS HIT_TIME = getGlobalNumber("hittime",1)*60000; WHITE_TIME = getGlobalNumber("whitetime",15)*60000; RED_TIME = getGlobalNumber("redtime",5*60)*60000; FRAG_TIME = getGlobalNumber("fragtime",10*60)*60000; RED_UNJUST = getGlobalNumber("redunjust",3); BAN_UNJUST = getGlobalNumber("banunjust",6); #endif //YELLOW_SKULLS Agora em luascript.h: Procure por: #ifdef TLM_HOUSE_SYSTEM int ACCESS_HOUSE; int MAX_HOUSE_TILE_ITEMS; #endif //TLM_HOUSE_SYSTEM Adicione em baixo: #ifdef YELLOW_SKULLS int HIT_TIME; int WHITE_TIME; int RED_TIME; int FRAG_TIME; int RED_UNJUST; int BAN_UNJUST; #endif //YELLOW_SKULLS Agora em player.cpp: Procure por: #ifdef TRS_GM_INVISIBLE gmInvisible = false; oldlookhead = 0; oldlookbody = 0; oldlooklegs = 0; oldlookfeet = 0; oldlookmaster = 0; oldlooktype = PLAYER_MALE_1; oldlookcorpse = ITEM_HUMAN_CORPSE; #endif //TRS_GM_INVISIBLE Em baixo adicione: #ifdef YELLOW_SKULLS party = 0; skullTicks = 0; skullKills = 0; absolveTicks = 0; #endif //YELLOW_SKULLS Procure por: void Player::dropLoot(Container *corpse) { Adicione a baixo: #ifdef YELLOW_SKULLS if (skullType == SKULL_RED) { for (int slot = 0; slot < 11; slot++) { if (items[slot]) { corpse->addItem(items[slot]); items[slot] = NULL; } } return; } #endif //YELLOW_SKULLS Procure por: void Player::die() { Adicione em baixo: #ifdef YELLOW_SKULLS if(skullType != SKULL_RED){ skullType = SKULL_NONE; skullTicks = 0; inFightTicks = 0; } #endif //YELLOW_SKULLS No final do código adicione: #ifdef YELLOW_SKULLS bool Player::checkSkull(int thinkTicks) { bool skullChanged = false; if (skullTicks > 0) { skullTicks -= thinkTicks; if (skullTicks <= 0) { skullTicks = 0; skullType = SKULL_NONE; skullChanged = true; for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it) { if(this->isYellowTo((*it).second)){ (*it).second->removeFromYellowList(this); } if((*it).second->hasAttacked(this)){ (*it).second->clearAttacked(); } } clearAttacked(); clearYellowList(); } } if (skullKills > 0) { if (absolveTicks > 0) { absolveTicks -= thinkTicks; if (absolveTicks <= 0) { skullKills--; if (skullKills > 0) absolveTicks = g_config.FRAG_TIME; else absolveTicks = 0; } } else absolveTicks = g_config.FRAG_TIME; } return skullChanged; } void Player::onSkull(Player* player) { client->sendSkull(player); } void Player::onPartyIcons(const Player *playa, int icontype, bool skull, bool removeskull) { client->sendPartyIcons(playa, icontype, skull, removeskull); } void Player::clearAttacked() { attackedSet.clear(); } void Player::clearYellowList() { hasAsYellow.clear(); } void Player::removeFromYellowList(Player* player) { if(!player) return; if(!hasAsYellow.empty()) for(std::vector<Player*>::iterator yellowPlayer = hasAsYellow.begin(); yellowPlayer != hasAsYellow.end(); ++yellowPlayer) { if((*yellowPlayer) == player)//found! hasAsYellow.erase(yellowPlayer);//erase him! break; } } bool Player::hasAttacked(const Player* attacked) const { if(access >= 2) return false; if(!attacked) return false; AttackedSet::const_iterator it; unsigned long attacked_id = attacked->getID(); it = attackedSet.find(attacked_id); if(it != attackedSet.end()){ return true; } else{ return false; } } void Player::addAttacked(const Player* attacked) { if(access >= 2) return; if(!attacked || attacked == this) return; AttackedSet::iterator it; unsigned long attacked_id = attacked->getID(); it = attackedSet.find(attacked_id); if(it == attackedSet.end()){ attackedSet.insert(attacked_id); } } bool Player::isYellowTo(Player* player) { if(!player || this == player) return false; if(!hasAsYellow.empty()) for(std::vector<Player*>::iterator yellowPlayer = hasAsYellow.begin(); yellowPlayer != hasAsYellow.end(); ++yellowPlayer) { if((*yellowPlayer) == player){//found! return true; } } return false; } #endif //YELLOW_SKULLS Em player.h: Procure por: #ifdef TRS_GM_INVISIBLE int oldlookhead, oldlookbody, oldlooklegs, oldlookfeet, oldlooktype, oldlookcorpse, oldlookmaster; bool gmInvisible; #endif //TRS_GM_INVISIBLE Adicione em baixo: #ifdef YELLOW_SKULLS int skullTicks, skullKills, absolveTicks; unsigned long party; void onPartyIcons(const Player *playa, int icontype, bool skull, bool removeskull); void onSkull(Player* player); bool checkSkull(int thinkTics); std::vector<Player*> inviterplayers; std::vector<Player*> invitedplayers; typedef std::set<long> AttackedSet; AttackedSet attackedSet; std::vector<Player*> hasAsYellow; bool isYellowTo(Player* player); void removeFromYellowList(Player* player); bool hasAttacked(const Player* attacked) const; void addAttacked(const Player* attacked); void clearAttacked(); void clearYellowList(); #endif //YELLOW_SKULLS Agora em protocol.h Procure por: #ifdef BD_HOUSE_WINDOW virtual void sendHouseWindow(std::string members) = 0; virtual void parseHouseWindow(NetworkMessage& msg) = 0; virtual Game* getGame() = 0; #endif //BD_HOUSE_WINDOW Em baixo adicione: #ifdef YELLOW_SKULLS virtual void sendSkull(const Player *player) = 0; virtual void sendPartyIcons(const Player *playa, int icontype, bool skull, bool removeskull) = 0; #endif //YELLOW_SKULLS Agora estamos quase finalizando vamos em protocol76.cpp: Procure por: case 0xA1: // attack parseAttack(msg); break; Adicione em baixo: case 0xA3: // invite party parseInviteParty(msg); break; case 0xA5: // revoke party parseRevokeParty(msg); break; case 0xA7: // leave party game->LeaveParty(player); break; case 0xA4: // join party parseJoinParty(msg); break; case 0xA6: // pass leadership parsePassLeadership(msg); break; Agora adicione no final do código: #ifdef YELLOW_SKULLS void Protocol76::sendSkull(const Player *player) { NetworkMessage msg; msg.AddByte(0x90); msg.AddU32(player->getID()); msg.AddByte(player->skullType); WriteBuffer(msg); } void Protocol76::sendPartyIcons(const Player *playa, int icontype, bool skull, bool removeskull) { NetworkMessage msg; msg.AddByte(0x91); msg.AddU32(playa->getID()); msg.AddByte(icontype); WriteBuffer(msg); msg.Reset(); if(skull || removeskull){ msg.AddByte(0x90); msg.AddU32(playa->getID()); if(skull){ if(playa->skullType == SKULL_WHITE || playa->skullType == SKULL_RED) msg.AddByte(playa->skullType); else msg.AddByte(2); } if(removeskull){ if(playa->skullType == SKULL_WHITE || playa->skullType == SKULL_RED) msg.AddByte(playa->skullType); else msg.AddByte(0); } WriteBuffer(msg); } } void Protocol76::parseInviteParty(NetworkMessage &msg) { unsigned long creatureid = msg.GetU32(); Creature* creature = game->getCreatureByID(creatureid); Player* target = dynamic_cast<Player*>(creature); if (!target) return; if (target->party != 0) { std::stringstream bericht; bericht << target->getName() << " is already a member of a party."; player->sendTextMessage(MSG_INFO, bericht.str().c_str()); return; } player->party = player->getID(); target->inviterplayers.push_back(player); player->invitedplayers.push_back(target); std::stringstream bericht1; bericht1 << target->getName() << " has been invited."; player->sendTextMessage(MSG_INFO, bericht1.str().c_str()); std::stringstream bericht2; if(player->getSex() == PLAYERSEX_MALE){ bericht2 << player->getName() <<" invites you to his party."; }else{ bericht2 << player->getName() <<" invites you to her party.";} target->sendTextMessage(MSG_INFO, bericht2.str().c_str()); target->onPartyIcons(player, 2, false, false); sendPartyIcons(player, 1, true, false); sendPartyIcons(player, 4, true, false); sendPartyIcons(target, 2, false, false); target->onPartyIcons(player, 1, false, false); } void Protocol76::parseRevokeParty(NetworkMessage &msg) { int members; unsigned long creatureid = msg.GetU32(); Creature* creature = game->getCreatureByID(creatureid); Player* target = dynamic_cast<Player*>(creature); std::vector<Player*>::iterator invited = std::find(player->invitedplayers.begin(), player->invitedplayers.end(), target); if(invited != player->invitedplayers.end()) player->invitedplayers.erase(invited); std::stringstream bericht1; bericht1 << "Invitation for " << target->getName() << " has been revoked."; player->sendTextMessage(MSG_INFO, bericht1.str().c_str()); std::stringstream bericht2; bericht2 << player->getName() << " has revoked his invitation."; target->sendTextMessage(MSG_INFO, bericht2.str().c_str()); target->onPartyIcons(player, 0, false, false); sendPartyIcons(target, 0, false, false); for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it) { if((*it).second->party == player->party) members++; } if(members < 2) game->disbandParty(player->party); } void Protocol76::parseJoinParty(NetworkMessage &msg) { unsigned long creatureid = msg.GetU32(); Creature* creature = game->getCreatureByID(creatureid); Player* target = dynamic_cast<Player*>(creature); player->party = target->party; std::vector<Player*>::iterator invited = std::find(target->invitedplayers.begin(), target->invitedplayers.end(), player); if(invited != target->invitedplayers.end()) target->invitedplayers.erase(invited); player->inviterplayers.clear(); std::stringstream bericht1; bericht1 << "You have joined "<< target->getName() << "'s party."; player->sendTextMessage(MSG_INFO, bericht1.str().c_str()); std::stringstream bericht2; bericht2 << player->getName() << " has joined the party."; for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it) { if((*it).second->party == target->party){ if((*it).second->getID() != player->getID()){ (*it).second->sendTextMessage(MSG_INFO, bericht2.str().c_str()); (*it).second->onPartyIcons(player, 3, true, false); } player->onPartyIcons((*it).second, 3, true, false); } if((*it).second->getID() == player->party) { player->onPartyIcons((*it).second, 4, true, false); } } } void Protocol76::parsePassLeadership(NetworkMessage &msg) { unsigned long creatureid = msg.GetU32(); Creature* creature = game->getCreatureByID(creatureid); Player* target = dynamic_cast<Player*>(creature); target->sendTextMessage(MSG_INFO, "You are now leader of your party."); std::stringstream bericht; bericht << target->getName() << " is now the leader of your party."; int oldpartyid = player->getID(); for(AutoList<Player>::listiterator it = Player::listPlayer.list.begin(); it != Player::listPlayer.list.end(); ++it) { if((*it).second->party == oldpartyid){ if((*it).second->getID() != target->getID()) (*it).second->sendTextMessage(MSG_INFO, bericht.str().c_str()); (*it).second->onPartyIcons(target, 4, true, false); (*it).second->onPartyIcons(player, 3, true, false); (*it).second->party = target->getID(); } } } #endif //YELLOW_SKULLS Agora procure por: msg.AddU16(creature->getSpeed()); Adicione logo em baixo: #ifdef YELLOW_SKULLS Creature *ctarget = game->getCreatureByID(creature->getID()); Player*target=dynamic_cast<Player*>(ctarget); std::vector<Player*>::iterator invited = std::find(player->invitedplayers.begin(), player->invitedplayers.end(), target); std::vector<Player*>::iterator inviter = std::find(player->inviterplayers.begin(), player->inviterplayers.end(), target); if(creature->skullType == SKULL_WHITE || creature->skullType == SKULL_RED) msg.AddByte(creature->skullType); else if(target && target->skullType == SKULL_NONE && target->party != 0 && player->party == target->party) msg.AddByte(2); else if(target && target->skullType == SKULL_YELLOW && player->isYellowTo(target)) msg.AddByte(1); else msg.AddByte(0x00); if(target && target->party != 0 && player->party != 0 && target->party == player->party) { if(target->getID() == player->party) msg.AddByte(4); else msg.AddByte(3); } else if(invited != player->invitedplayers.end()) msg.AddByte(2); else if(inviter != player->inviterplayers.end()) msg.AddByte(1); else msg.AddByte(0x00); #else msg.AddByte(0x00); // skull msg.AddByte(0x00); // shield #endif //YELLOW_SKULLS Como eu me esqueci voltaremos em protocol76.h: Procure por: #ifdef BD_HOUSE_WINDOW void sendHouseWindow(std::string members); void parseHouseWindow(NetworkMessage& msg); Game* getGame() { return game; } #endif //BD_HOUSE_WINDOW Adicione logo a baixo: #ifdef YELLOW_SKULLS virtual void sendSkull(const Player *player); void sendPartyIcons(const Player *playa, int icontype, bool skull, bool removeskull); void parseInviteParty(NetworkMessage &msg); void parseRevokeParty(NetworkMessage &msg); void parseJoinParty(NetworkMessage &msg); void parsePassLeadership(NetworkMessage &msg); #endif //YELLOW_SKULLS NA OPÇÃO DO COMPILADOR ADICIONAMOS : -YELLOW _SKULLS (IGUAL AO CONSOLE,GUI) Enfim vamos em config.lua e adicionamos -------------------------------- SKULLS SYSTEM --------- ------------------------- - Quantos frags você precisa receber a Caveira vermelha redunjust = 4 - Quantos frags você precisa receber uma proibição Matar banunjust = 6 - Tempo por cada jogador atacado. (1 = 1 min) hittime = 3 - Pz depois de matar o jogador (1 = 1 min) whitetime = 10 - tempo Caveira vermelha (1 = 1 min) redtime = 6 * 60 - frag tempo (1 = 1min) fragtime = 60 - Ban apos chegar ao limite tempo de frag (1 = 1 dia) pkbandays = 2 @Majesty Ta pronto.
-
Creditos: Underewar(e a ajuda do gesior) creature.h nós mudamos: exp_t getExpForLv(const int& lv) const { #ifdef YUR_HIGH_LEVELS exp_t x = lv; return ((50*x/3 - 100)*x + 850/3)*x - 200; #else return (int)((50*lv*lv*lv)/3 - 100 * lv * lv + (850*lv) / 3 - 200); #endif //YUR_HIGH_LEVELS } Para: exp_t getExpForLv(__int64 lv) { #ifdef YUR_HIGH_LEVELS exp_t x = lv; return ((80ULL * x * x) - (50ULL * x * x) + (500ULL)) / 3ULL; #else return (int)((50*lv*lv*lv)/3 - 100 * lv * lv + (850*lv) / 3 - 200); #endif //YUR_HIGH_LEVELS } ioplaxerxml.cpp nós mudamos: player->level_percent = (unsigned char)(100*(player->experience-player->getExpForLv(player->level))/(1.*player->getExpForLv(player->level+1)-player->getExpForLv(player->level))); Para: player->level_percent = (__int64)(100*(player->experience-player->getExpForLv(player->level))/(1.*player->getExpForLv(player->level+1)-player->getExpForLv(player->level))); Lembre-se apenas que o máximo de lvl a ser conduzido é provavelmente 300 ou 400kk devido ao limite de variáveis e aplicação de muitos limites de statistics> Como skill por exemplo entre outro.
-
Efeito: caractestica da vida, agora indicada como %(percent) Como Usar: Substiruiremos a função inteira de do playerstats dentro do protocolgame.cpp caso seja nas versões e tfs 0.3.6.1. Para tibia 7.6 editaremos o protocol76game.cpp TFS MASTER c++ code TFS 1.0 - 1.2 c++ code TFS 0.3.6.1 Você precisa remover o espaço de PLAYERINFO_MAXMANA se aparecer algum erro, ou algo fora do comun - não é minha culpa c++code para versões 7.6-7.9 Códigos criados em 02/12/2017 Acredito que todas as versões estejam ai. Imagens: Antes : Depois :
-
.data / talkactions / talkaction.xml' e cole este texto lá Código XML: <talkaction words="!bank" separator=" " script="bank.lua"/> Crie o arquivo "bank.lua" em "data / talkactions / scripts" e cole este código neste arquivo --************ UNDEREWAR-- function Player.deposit(self, amount) if not self:removeMoney(amount) then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You dont have money with you.") return false end self:setBankBalance(self:getBankBalance() + amount) return true end function Player.withdraw(self, amount) local balance = self:getBankBalance() if amount > balance or not self:addMoney(amount) then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You dont have money in your bank account.") return false end self:setBankBalance(balance - amount) return true end function Player.depositMoney(self, amount) if not self:removeMoney(amount) then return false end self:setBankBalance(self:getBankBalance() + amount) return true end function onSay(player, words, param) local split = param:split(",") local balance = player:getBankBalance() if split[1] == nil then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: the commands are:\n !bank balance.\n !bank deposit, XXXX.\n!bank depositall.\n!bank transfer, amount, toPlayer.") return end --------------------------- Balance --------------------------- if split[1] == 'balance' then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: Your account balance is " .. balance .. ".") --------------------------- Deposit --------------------------- elseif split[1] == 'deposit' then local amount = tonumber(split[2]) if not amount then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You need to put the amount of money to add.") return false end local amount = math.abs(amount) if amount > 0 and amount <= player:getMoney() then player:deposit(amount) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You added " .. amount .. " to your account, You can withdraw your money anytime you want to.\nYour account balance is " .. player:getBankBalance() .. ".") else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You do not have enough money to deposit.") end --------------------------- Depositall --------------------------- elseif split[1] == 'depositall' then local amount = player:getMoney() local amount = math.abs(amount) if amount > 0 and amount == player:getMoney() then player:deposit(amount) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You added " .. amount .. " to your account, You can withdraw your money anytime you want to.\nYour account balance is " .. player:getBankBalance() .. ".") else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You do not have enough money to deposit.") end --------------------------- Withdraw --------------------------- elseif split[1] == 'withdraw' then local amount = tonumber(split[2]) if not amount then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You need to put the amount of money to withdraw.") return false end local amount = math.abs(amount) if amount > 0 and amount <= player:getBankBalance() then player:withdraw(amount) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: Here you are " .. amount .. " of your account, You can deposit your money anytime you want.\nYour account balance is " .. player:getBankBalance() .. ".") else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You do not have enough money on your bank account.") end --------------------------- Withdrawall --------------------------- elseif split[1] == 'withdrawall' then local amount = player:getBankBalance() local amount = math.abs(amount) if amount > 0 and amount <= player:getBankBalance() then player:withdraw(amount) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: Here you are all your money on your account, You can deposit your money anytime you want.\nYour account balance is " .. player:getBankBalance() .. ".") else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You do not have enough money on your bank account.") end --------------------------- Transfer --------------------------- elseif split[1] == 'transfer' then local data = param local s = data:split(", ") if s[2] == nil then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You need to put the amount of money") return false else if not tonumber(s[2]) then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You need to put the amount in numbers only.") return end end if s[3] == nil then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You need to put the player name") return false end local a = tonumber(s[2]) local amount = math.abs(a) local getPlayer = Player(s[3]) if getPlayer then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You seccesfully transferred " .. s[2] .. "\n to " .. s[3] .. " bank account.") player:transferMoneyTo(s[3], amount) else if not playerExists(s[3]) then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: A player with name: " .. s[3] .. " does not exists.") return false end if playerExists(s[3]) and player:transferMoneyTo(s[3], amount) then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: You seccesfully transferred " .. s[2] .. "\n to " .. s[3] .. " bank account.") end end else player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[BankSystem]: Invalid param.") end return false end Se usar otclient precisara de arrumar seu NPC CHAT.
-
Em luascript.cpp Em luascript.cpp getPlayerSecureMode (CID) Vamos criar esse comando Código C++: getPlayerFightMode (CID) Vamos criar esse comando Código C++: Simples e fácil vou deixar um exemplo para os leigos. Exemplo em lua: qual quer duvida poste aqui ,script é bem simples.
-
No otserv.cpp: No config.lua Adicione a tag da propriedade adicionada. Qual é a prioridade para definir o OTS durante o início (normal, alta, mais alta).
-
Em ioaccountsql.cpp nós mudamos. Procure por . Account IOAccountSQL::loadAccount(uint32_t accno) E Substitua toda a função por essa (OBS LEMBRE-SE DE CONFIGURAR OS MUNDOS.). Account IOAccountSQL::loadAccount(uint32_t accno) { Account acc; Database* mysql = Database::instance(); DBQuery query; DBResult result; query << "SELECT id,password FROM accounts WHERE id=" << accno; if(mysql->connect() && mysql->storeQuery(query, result)){ acc.accnumber = result.getDataInt("id"); acc.password = result.getDataString("password"); #ifndef __ROGIER_MULTIWORLD__ query << "SELECT name FROM players WHERE account_id=" << accno; #else //__ROGIER_MULTIWORLD__ query << "SELECT name,worldid FROM players WHERE account_id=" << accno; #endif //__ROGIER_MULTIWORLD__ if(mysql->storeQuery(query, result)){ for(uint32_t i = 0; i < result.getNumRows(); ++i){ std::string ss = result.getDataString("name", i); #ifndef __ROGIER_MULTIWORLD__ acc.charList.push_back(ss.c_str()); #else //__ROGIER_MULTIWORLD__ int worldid = result.getDataInt("worldid", i); query.reset(); result.clear(); query << "SELECT * FROM worlds WHERE worldid=" << worldid; mysql->storeQuery(query, result); struct CharInfo info; info.worldName = result.getDataString("worldname", i); info.worldIp = result.getDataString("worldip", i); info.worldPort = result.getDataInt("worldport", i); acc.charList[ss] = info; #endif //__ROGIER_MULTIWORLD__ } #ifndef __ROGIER_MULTIWORLD__ acc.charList.sort(); #endif //__ROGIER_MULTIWORLD__ } } return acc; } Agora no protocollogin.cpp na função parsefirstpacket nós mudamos. Procure por. std::list<std::string>::iterator it; for(it = account.charList.begin(); it != account.charList.end(); it++){ output->AddString((*it)); output->AddString(g_config.getString(ConfigManager::WORLD _NAME)); output->AddU32(serverip); output->AddU16(g_config.getNumber(ConfigManager::PORT)) ; } Substitua por. #ifndef __ROGIER_MULTIWORLD__ std::list<std::string>::iterator it; for(it = account.charList.begin(); it != account.charList.end(); it++){ output->AddString((*it)); output->AddString(g_config.getString(ConfigManager::WORLD _NAME)); output->AddU32(serverip); output->AddU16(g_config.getNumber(ConfigManager::PORT)) ; } #else //__ROGIER_MULTIWORLD__ std::map<std::string, CharInfo>::iterator it; for(it = account.charList.begin(); it != account.charList.end(); it++){ output->AddString(it->first); output->AddString(it->second.worldName); output->AddU32(inet_addr(it->second.worldIp.c_str())); output->AddU16(it->second.worldPort); } #endif //__ROGIER_MULTIWORLD__ Agora Em account.h. procure. class Account adicione logo a baixo. #ifdef __ROGIER_MULTIWORLD__ #include <map> struct CharInfo { std::string worldIp; std::string worldName; short worldPort; }; #endif //__ROGIER_MULTIWORLD__ Novamente em account.h nós mudamos: Procure std::list<std::string> charList; Substitua #ifdef __ROGIER_MULTIWORLD__ std::list<std::string> charList; #else //__ROGIER_MULTIWORLD__ std::map<std::string, CharInfo> charList; #endif //__ROGIER_MULTIWORLD__ Adicione como parametro o seguinte seguimento para que a compilação encontre todas as alterações a cima -D__ROGIER_MULTIWORLD__ (Igual o mysql/sqlite,console,gui é adicionado) E AGORA OQUE EU FAÇO?
-
Um código simples para fazer o global server save, e logo após reiniciar o servidor. Windows Adicione no Config.Lua Esta feito agora basta compilar um programa chamado autorun.exe com o código a baixo. Após a compilação coloque o exe na pasta do servidor e inicie. Linux: Creditos: Underewar
-
Engine: OTX 2.X.S.5 (FORGOTEN_PATH_7_X) Server em questão: RealOTX-7.72 Estou com o seguinte problema: Os personagens não conseguem passar uns por dentro dos outros ( e não devem de fato), porém quando um vem de encontro ao outro andando, eles conseguem ocupar o mesmo SQM. Dei uma fuçada nas sources mas me parece normal essa parte: player.cpp Alguém sabe dizer oque pode estar acontecendo? Pode ser que seja no otclient também, não sei dizer sinceramente... Obrigado desde já!
-
Salve galera, tudo bem? Então recentemente eu tentei compilar uma função que existe na net, porem o fórum que ela estava acabou bugando totalmente o código ou parte dele na verdade, se algum de vocês conseguir me ajudar ficarei muito grato. O código foi feito para a versão: 0.3.6 - 8.54 Servidor utilizado para teste: Aqui #Resolvido: Source utilizada - http://www.mediafire.com/download/u7ctpx569nhyu5x/Sources.rar ERROS: In member function 'void ProtocolGame::AddCreature(NetworkMessage_ptr, const Creature*, bool, uint32_t)': 2670 C:\Source\protocolgame.cpp 'Nick' was not declared in this scope 2670 C:\Source\protocolgame.cpp In member function 'void ProtocolGame::reloadCreature(const Creature*)': 3102 C:\Source\protocolgame.cpp expected initializer before 'it' 3103 C:\Source\protocolgame.cpp 'it' was not declared in this scope CÓDIGO:
- 1 resposta
-
- nicksystem
- erro
-
(e mais 1)
Tags:
-
Salve galera, tudo bem? Estou com um erro ao tentar compilar uma "source 0.3.6", não sei o que pode ser pois nem alterei nada neste arquivo; Segue o erro: In member function 'void Items::parseItemNode(xmlNode*, uint32_t)': 1739 C:\Users\items.cpp a function-definition is not allowed here before '{' token 1823 C:\Users\items.cpp expected '}' at end of input 1823 C:\Users\items.cpp *** [obj//items.o] Error 1 O código: Se alguém puder me ajudar, ficarei muito grato!
-
Resumo Atualmente existe um pequeno delay que incomoda alguns jogadores. Com a aplicação das alterações abaixo você poderá ajustar a velocidade do jogador ao andar diagonal. Instalando Dentro do arquivo creature.cpp nas sources do OTClient procure por: getStepDuration(true) Altere todos que encontrar para: getStepDuration() Agora procure por: interval *= factor; Altere para: interval *= 1.5; Dentro do arquivo localplayer.cpp nas sources do OTClient procure por: getStepDuration(true) Altere para: getStepDuration() Dentro do arquivo creature.cpp nas sources do Servidor procure por: //diagonal extra cost lastStepCost = 3; Altere para: //diagonal extra cost lastStepCost = 1.5; Agora procure por: if ((dir & DIRECTION_DIAGONAL_MASK) != 0) { stepDuration *= 3; } Altere para: if ((dir & DIRECTION_DIAGONAL_MASK) != 0) { stepDuration *= 1.5; } Pronto! Os valores em vermelho definem a velocidade que será definida. A velocidade que foi utilizada no exemplo acima e que indico foi de 1.5.
-
Funções Aula 5 Ao iniciar um arquivo no C++, acrescentamos sempre o seguinte bloco: [b]int[/b] main(int argc, char *argv[]){ } Mas você sabe o que isso significa? :hmm: A função main é a responsável por fazer com que nosso programe rode, sem ela não teriamos um corpo para nosso programa. Entretanto, durante a programação outras funçõe podem ser criadas e utilizadas dentro de main(). Primeiro, vamos entender como estruturar uma função: tipo nome (parametros necessários para que a função execute) { } Sendo: tipo - o tipo de dado que a função retorna nome - um nome qualquer a sua escolha parametros - pode ser quantos quiser, são esses os dados que deverão ser passados para que a função execute. Vamos dar um exemplo durante nosso programa: Entenda o bloco abaixo: Declaramos uma função soma do tipo int e ela possui a e b como parametros. [b]int[/b] soma ([b]int[/b] a, [b]int[/b] { } Só que nossa função ainda está incompleta, está faltando o corpo dela. Essa função então terá como função (:palm:) executar a soma de dois números, serão eles a e b. [b]int[/b] soma ([b]int[/b] a, [b]int[/b] { a+b; } Bom, há um erro nessa função.. ela não funcionaria, pois assim que executarmos a função, como saberemos o resultado dela? :fuu: Simples, usando o return. O return faz com que a função que foi executada, retorne um valor IGUAL AO TIPO DA FUNÇÃO, por exemplo, se você criar uma função do tipo INT, ela tera que retornar INT. Usando o return, nosso code ficaria: [b]int[/b] soma ([b]int[/b] a, [b]int[/b] { [b]return[/b] a+b; } Fazendo um programa com funções Vamos criar um programinha para testarmos nossa função: [left][color=seagreen]#include <iostream.h>[/color][/left] [left][b]int[/b] soma ([b]int[/b] a, [b]int[/b] {[/left] [left][b]return[/b] a+b;[/left] [left]}[/left] [left][b]int[/b] main(int argc, char *argv[]){[/left] [left][b]int[/b] num1, num2, resultado;[/left] [left]cout << [color=red]"Digite dois números: "[/color] << endl; cin >> num1 >> num2; resultado = soma(num1, num2); cout << [color=red]"A soma dos dois números é: "[/color] << resultado << endl; system([color=red]"pause"[/color]); [b]return 0;[/b][/left] [left]}[/left] Declaramos nossa função antes do main para que ela seja reconhecida dentro da função main e então pedimos para o usuário digitar dois valores. Com os dois valores, executamos as funções com os seguintes parâmetros, num1 e num2 e ele retornou o valor da soma. Esse valor foi alocado na variavel resultado. Viram como é fácil trabalhar com funções? :coolface: Mais exemplo de funções: [left][color=seagreen]#include <iostream.h>[/color][/left] [b]bool[/b] checaMedia([b]int[/b] nota1, [b]int[/b] nota2){ [indent][b]if[/b] (((nota1+nota2)/2) >= 5){ [indent][b]return true[/b]; [/indent] [/indent] [indent]} [left][b]else return false[/b];[/left] [/indent]} [left][b]int[/b] main([b]int[/b] argc, [b]char[/b] *argv[]){[/left] [left][b]int[/b] num1, num2;[/left] [left]cout << [color=red]"Digite dois números: "[/color] << endl; cin >> num1 >> num2; [b]if[/b] (checaMedia(num1, num2) == [b]true[/b]){ cout << [color=red]"Aluno aprovado"[/color] << endl; } [b]else[/b] { cout << [color=red]"Aluno reprovado"[/color] << endl; } system([color=red]"pause"[/color]); [b]return 0[/b];[/left] } Por enquanto é só pessoal! Pratiquem com mais funções e qualquer dúvida e só postar!
-
Registra monstros ou players ou todos, pelo creatureevent.xml Apenas traendo de outro forum. Creditos no final. Como fazer ? Você precisa adicionar "registerTo" no xml XML Code: Pode ser feito manualente tambem (da forma antiga). XML Code: Versão : TFS 0.4 Se alguem conseguir souber passar para versão 3.6pl1, porfavor poste ou me mande. Agradecido. Instalação: # Va para creatureevent.cpp : Procure por C Code: e no bloco dessa função, procure por C Code: cole isto antes C Code: Depois disto C Code: Cole isto C Code: ------------------------------------------------------------------------------------------------------------------------------------ # Va para creatureevent.h : Depois disto C Code: Cole isto C Code: Agora, no final do arquivo, depois disto C Code: Cole isto C Code: Depois disto C Code: Cole isto C Code: ------------------------------------------------------------------------------------------------------------------------------------- # Va para monster.cpp Abaixo disto C Code: Cole isto C Code: Encontre isto C Code: e abaixo, cole isto C Code: Esta feito =D. By Doggynub
-
Olá, estarei fazendo nos próximos dias e semanas video aulas para duas séries. A série de Lógica de Programação e a de Programando em C++. A série de Lógica de Programação abordará os conceitos básicos, para quem teve pouco ou nenhum contato com programação. Esta série será feita utilizando a linguagem C++, mas estará explicando o que é uma IDE, binário, o que é uma variavel e etc... A série Programando em C++ abordará também desde o início em C++, mas não estarei explicando nessa série conceitos básicos, como por exemplo, o que é uma variavel, um vetor, metódos de repetição e etc. Estes conceitos serão abordados e explicados de como funcionam no C++, mas não será explicado explicitamente O QUE É uma variavel, apenas será usada e mostrado como se declara/utiliza no C/C++. O video de introdução destas séries explica mais explicitamente as diferenças das séries, com a intenção de lhe mostrar se é interessante para você ver desde a parte de Lógica, ou se já poderia ir direto para a série Programando em C++ . Segue abaixo o video feito por mim: Introdução as séries de Lógica e C++ [ame] [/ame] Diferencial das aulas de Programando em C++ Será abordado assuntos de iniciantes e avançados nestas aulas, no final das aulas pretendo aplicar o que foi ensinado na prática e com exercícios mais interessantes de se fazer, exemplo: jogos, situações reais (trabalho) e programas divertidos. Abordarei também toda a parte de .h, cpp, resource, MFC, OOP, que são fundamentais e quase nunca explicadas! Obs¹: Possivelmente hoje mesmo já estarei iniciando os videos de Lógica, nos proximos dias/semanas devo finalizar uma série e a parte iniciante de C++. Obs2: Posteriormente estarei postando 1 tópico para a Série de Lógica e um tópico para a Série de Programando em C++, mas acho que as duas poderiam ficar na seção de C++, pois ambas serão feitas utilizando a linguagem C++. Abraço, até a próxima!
-
vendo uns inforums, percebi que so há o "tibia cam pro" para gravar videos, entao tive a idéia de pedir aos programadores da Otnet, se há possibilidade de criar um programa similar ao deles? axo que até tem as sources do tibicam 7.1 na internet. o programa poderia ter hotkeys para gravar, acabar a gravação, pausar a gravação (ex: começo a gravação no dp, dou um pause, e continuo gravando em uma hunt), autoupdate, abrir janelas (skills, battle, vip e containers que estarian no player. ex:Backpacks, bags, e key rings). o que acharam da idéia?
-
Vou disponibilizar ao pessoal um programa que finaliza processos... Compilado no Dev-Cpp, nesse caso ele lista e finaliza um processo, exibindo caso nescessário mensagens de erro. #include <stdio.h> #include <windows.h> #include <tlhelp32.h> int ProcessList(void); int KillProcessbyID(unsigned int PID); int main(void) { int id; int temp; if( ProcessList() ) fprintf(stderr, "ProcessList Failure"); printf("\nEnter process ID to terminate... "); scanf("%d", &id); if( KillProcessbyID((unsigned int)id)==EXIT_FAILURE ) { fprintf(stderr, "KillProcess Failure\n"); } return 0; } int ProcessList(void) { PROCESSENTRY32 pe32; HANDLE hProcessSnap; bool rProcessFound; hProcessSnap=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if (hProcessSnap == INVALID_HANDLE_VALUE) return 1; pe32.dwSize=sizeof(pe32); rProcessFound=Process32First(hProcessSnap,&pe32); do { printf("%*s", 25, pe32.szExeFile); printf( "\t\t%*d\n", 4, pe32.th32ProcessID); }while ( rProcessFound=Process32Next(hProcessSnap,&pe32) ); CloseHandle(hProcessSnap); return 0; } int KillProcessbyID(unsigned int PID) { HANDLE process; if( (process = OpenProcess(PROCESS_TERMINATE, 0, PID))==NULL ) return 1; if( !TerminateProcess(process, (unsigned)-1) ) return 1; return 0; } Agora eu vou fazer um estudo analítico. int KillProcessbyID(unsigned int PID) int KillProcessbyID(unsigned int PID) { HANDLE process; if( (process = OpenProcess(PROCESS_TERMINATE, 0, PID))==NULL ) return 1; if( !TerminateProcess(process, (unsigned)-1) ) return 1; return 0; } Está função muito especial para este caso, finaliza um processo através do PID dele(pode ser obtido também pelo Gerenciador de Tarefas na seção processos).Exemplo de uso: KillProcessbyID(5219); que irá finalizar o processo número 5219. int ProcessList(void) int ProcessList(void) { PROCESSENTRY32 pe32; HANDLE hProcessSnap; bool rProcessFound; hProcessSnap=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if (hProcessSnap == INVALID_HANDLE_VALUE) return 1; pe32.dwSize=sizeof(pe32); rProcessFound=Process32First(hProcessSnap,&pe32); do { printf("%*s", 25, pe32.szExeFile); printf( "\t\t%*d\n", 4, pe32.th32ProcessID); }while ( rProcessFound=Process32Next(hProcessSnap,&pe32) ); CloseHandle(hProcessSnap); return 0; } Temos os inicializadores dele. Até que chega a parte: hProcessSnap=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if (hProcessSnap == INVALID_HANDLE_VALUE) return 1; Esta parte que dizer ao computador para ele pegar uma cópida dos processos em execução e caso tenha algo inválido ele simplesmente para retornando 1. Nesta parte: pe32.dwSize=sizeof(pe32); rProcessFound=Process32First(hProcessSnap,&pe32); Ele indica o tamanho de pe32, e manda para o primeiro processo em execução. do { printf("%*s", 25, pe32.szExeFile); printf( "\t\t%*d\n", 4, pe32.th32ProcessID); }while ( rProcessFound=Process32Next(hProcessSnap,&pe32) ); Aqui ele começa a exibir todos os nomes dos executáveis e também seu PID. Note que o while está de outra forma. Em vez da regular while(){} está do modo do{}while(). Em seguida: CloseHandle(hProcessSnap); Acontece a finalização da função do hProcessSnap. Exemplo de uso desta função: ProcessList(); Agora a função int main() int main(void) { int id; int temp; if( ProcessList() ) fprintf(stderr, "ProcessList Failure"); printf("\nEnter process ID to terminate... "); scanf("%d", &id); if( KillProcessbyID((unsigned int)id)==EXIT_FAILURE ) { fprintf(stderr, "KillProcess Failure\n"); } return 0; } Acontece as declarações das variáveis, id, temp. Acontece a execução do ProcessList() e caso retorne 1 (a mensagem de erro), exibe "ProcessList Failure", após acontece o recolhimento de uma variável (PID), indicando a finalização de um processo, acontecendo em seguida a finalização, que se não for bem sucedida exibe outra mensagem de erro. Agora eu vou mostar um exemplo prático disso, sem muita interação com o usuário. #include <stdio.h> #include <windows.h> #include <tlhelp32.h> int ProcessList(void); int KillProcessbyID(unsigned int PID); int main(void) { int id; int temp; if( ProcessList() ) fprintf(stderr, "ProcessList Failure"); return 0; } int ProcessList(void) { PROCESSENTRY32 pe32; HANDLE hProcessSnap; bool rProcessFound; hProcessSnap=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if (hProcessSnap == INVALID_HANDLE_VALUE) return 1; pe32.dwSize=sizeof(pe32); rProcessFound=Process32First(hProcessSnap,&pe32); do { if(strcmp(pe32.szExeFile, "otserv.exe")==0) KillProcessbyID(pe32.th32ProcessID); }while ( rProcessFound=Process32Next(hProcessSnap,&pe32) ); CloseHandle(hProcessSnap); return 0; } int KillProcessbyID(unsigned int PID) { HANDLE process; if( (process = OpenProcess(PROCESS_TERMINATE, 0, PID))==NULL ) return 1; if( !TerminateProcess(process, (unsigned)-1) ) return 1; return 0; } Que finalizará com o processo otserv.exe. Cuidado com as permissões de usuário. Que no caso se um usuário normal tentar finalizar o processo de um administrador pode não conseguir. Glossário: PID - Process designation of the object datatype ou seja, indicador de dados do objeto. In computer science in the Objective-C programming language id is the designation of the generic object datatype Fontes: Wikipedia - http://en.wikipedia.org/wiki/ID Planet Source Code - http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=6769&lngWId=3 Código obtido através de koby-GR, usuário do PSC. Então... é isso aí, qualquer dúvida, sugestão, correção... Mande aí. Até pessoal.
-
Isso irá melhorar o visual do console, só falta colocar cores. Divirtão-se. #include <stdio.h> #include <stdlib.h> #include "gotoxy.h" //<--Adicione o seu gotoxy #define HORIZ 80 //dimensão da janela direção horizontal #define VERTI 25 //dimensão da janela direção vertical /*213 203 184 179 179 200 203 190*/ int main() { int i,o, vv=VERTI,//-1, hh=HORIZ;//-1; system("cls"); gotoxy(0,0); for(i=0;i<=HORIZ;i++); printf("%c",203); gotoxy(0,vv); for(i=0;i<=HORIZ;i++); printf("%c",203); for(i=0;i<=vv;i++) { gotoxy(0,i); printf("%c",179); } for(i=0;i<=vv;i++) { gotoxy(hh,i); printf("%c",179); } gotoxy(0,0); printf("%c",213); gotoxy(hh,0); printf("%c",184); gotoxy(0,vv); printf("%c",200); gotoxy(hh,vv); printf("%c",190); } Eu acho que é isso, qualquer coisa poste aqui. (não foi testado no windows)