underewar 32 #1 Posted March 4, 2019 (edited) 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. Edited March 5, 2019 by underewar 1 Majesty reacted to this Share this post Link to post
Majesty 1,755 #2 Posted March 5, 2019 Muito obrigado pela sua contribuição, seu tópico de conteúdo foi aprovado! Nós do OTServ Brasil agradecemos, seu conteúdo com certeza ajudará a muitos outros. Você recebeu +1 REP! Share this post Link to post