Ir para conteúdo
Entre para seguir isso  
Black Draguns

canal de loots

Recommended Posts

Black Draguns    0
Black Draguns

º Algo que eu gostaria de usar porque sou muito preguiçoso para abrir cadáveres.

º Nada muito difícil que um codificador decente não poderia ter feito. Basicamente só o broadcastPartyLoot mudou em função do SVN broadcastPlayerLoot e criou um novo canal .. qualquer jeito aqui vai .. (Funciona tanto para 0,2 e 0,3 TFS)

 

UPDATED: Jogadores não falar no canal fonte foi alterado

mude CHANNEL_LOOT para 0x10 no TFS 0.2

 

Para 0.3 (a menos que você tenha canais em enums para 0,2 tão bem)

enums.h

Procure:

enum Channels_t 

Adicione

CHANNEL_LOOT = 0x10  

 

chat.cpp

Procure:

else if(player->getLevel() < 2 && channelId > CHANNEL_GUILD && channelId < CHANNEL_PARTY)
       {
           player->sendCancel("You may not speak into channels as long as you are on level 1.");
           return true;
       } 

 

º E depois adcione

Código PHP:

else if(channelId == CHANNEL_LOOT)
       {
           player->sendCancel("You may not speak in this channel.");
           return true;
       }  

 

Então jogadores não podem falar neste canal

Procure:

Código:

m_partyChannels.clear(); 

E adicionar

Código PHP:

for(LootChannelMap::iterator it = m_lootChannels.begin(); it != m_lootChannels.end(); ++it)
       delete it->second;

   m_lootChannels.clear();  

 

ir a baixo 30 linhas (chat:: createchannel) e depois

Código:

case CHANNEL_PARTY:
       {
           ChatChannel* newChannel = NULL;
           if(player->getParty() && (newChannel = new ChatChannel(channelId, "Party")))
               m_partyChannels[player->getParty()] = newChannel;

           return newChannel;
       } 

Adicionar

Código PHP:

case CHANNEL_LOOT:
       {
           ChatChannel* newChannel = NULL;
           if(player->getLoot() && (newChannel = new ChatChannel(channelId, "Loot")))
               m_lootChannels[player->getLoot()] = newChannel;

           return newChannel;
       }  

 

Depois, em Chat :: deletechannel adicione

Código PHP:

case CHANNEL_LOOT:
       {
           LootChannelMap::iterator it = m_lootChannels.find(player->getLoot());
           if(it == m_lootChannels.end())
               return false;

           delete it->second;
           m_lootChannels.erase(it);
           return true;
       }  

 

Em Chat :: getchannellist adicione

Código PHP:

if(player->getLoot())
   {
       ChatChannel* channel = getChannel(player, CHANNEL_LOOT);
       if(channel)
           list.push_back(channel);
       else if((channel = createChannel(player, CHANNEL_LOOT)))
           list.push_back(channel);
   }  

 

Finalmente, em Chat:: getchannel adicione

Código PHP:

if(channelId == CHANNEL_LOOT)
   {
       if(!player->getLoot())
           return NULL;
       LootChannelMap::iterator it = m_lootChannels.find(player->getLoot());
       if(it != m_lootChannels.end())
           return it->second;

       return NULL;
   }  

 

chat.h

para o final de

Código:

private: 

Adicione

Código PHP:

typedef std::map<uint32_t, ChatChannel*> LootChannelMap;  

 

E depois dele

Código PHP:

LootChannelMap m_lootChannels;

 

player.cpp

Procure:

Código:

ghostMode = false; 

 

Adicioná-lo depois

Código PHP:

showLoot = false;  

 

E na parte inferior da página adicione

Código PHP:

void Player::broadcastPlayerLoot(const std::string& monster, const ItemVector& items)
{
   std::stringstream s;
   s << "Loot of " << monster << ": ";
   if(items.size())
   {
       for(ItemVector::const_reverse_iterator rit = items.rbegin(); rit != items.rend(); ++rit)
       {
           s << (*rit)->getNameDescription();
           if((*rit) != items.front())
               s << ", ";
       }
   }
   else
       s << "none";

   s << ".";
   sendChannelMessage("", s.str().c_str(), SPEAK_CHANNEL_W, CHANNEL_LOOT);
}  

 

player.h

na a parte pública: adicionar

Código PHP:

void switchGetLoot() {showLoot = !showLoot;}
       bool getLoot() const {return showLoot;}  

 

também adicionar em públic:

Código PHP:

void broadcastPlayerLoot(const std::string& monster, const ItemVector& items);  

 

Procure:

Código:

bool ghostMode; 

 

Adicioná-lo depois

Código PHP:

bool showLoot;  

 

monsters.cpp

pesquise

Código:

if((owner = g_game.getPlayerByID(ownerId)) && owner->getParty())
           owner->getParty()->broadcastPartyLoot(name, itemVector); 

E adicioná-lo depois

Código PHP:

if((owner = g_game.getPlayerByID(ownerId)) && owner->getLoot())
           owner->broadcastPlayerLoot(name, itemVector);  

talkactions.cpp [0.3]

na parte inferior adicionar

Código PHP:

bool TalkAction::showLoot(Player* player, const std::string& cmd, const std::string& param)
{
   player->switchGetLoot();

   char buffer[90];
   sprintf(buffer, "You have %s the loot channel.", (player->getLoot() ? "enabled" : "disabled"));
   player->sendTextMessage(MSG_INFO_DESCR, buffer);

   char channel[90];
   sprintf(channel, "The loot channel has been %s.", (player->getLoot () ? "activated" : "deactivated"));
   player->sendChannelMessage("", channel, SPEAK_CHANNEL_R1, CHANNEL_LOOT);

   return true;
}  

 

commands.cpp [0.2]

Código PHP:

bool Commands::showLoot(Creature* creature, const std::string& cmd, const std::string& param)
{
   Player* player = creature->getPlayer();
   player->switchGetLoot();

   char buffer[90];
   sprintf(buffer, "You have %s the loot channel.", (player->getLoot() ? "enabled" : "disabled"));
   player->sendTextMessage(MSG_INFO_DESCR, buffer);

   char channel[90];
   sprintf(channel, "The loot channel has been %s.", (player->getLoot () ? "activated" : "deactivated"));
   player->sendChannelMessage("", channel, SPEAK_CHANNEL_R1, 0x10);

   return true;
}  

 

 

Creditos Ao: xxgoosexx

Editado por Black Draguns

Compartilhar este post


Link para o post
Pedroddcunha    3
Pedroddcunha

Obrigado pelo tutorial

 

 

- Aprovado -

Compartilhar este post


Link para o post
KwiiBy~    0
KwiiBy~

Caracas deve ter dado um trabalhão néah? Muito rox =]

Compartilhar este post


Link para o post
Eventide    7
Eventide

seu tópico não está de acordo com as regras da OTnet pois não contem os créditos do autor, e ainda contem erros de tradução.

caso não arrume isso irei fechar o tópico e reporta-lo.

 

(rip = ban permanente, não se esqueça!)

Compartilhar este post


Link para o post
Black Draguns    0
Black Draguns

Certo.

Ja Estou Vendo Isto.

 

Edit.

Ja Arrumei...

 

Deslcupe Pela Demora!!!!!

Editado por Black Draguns

Compartilhar este post


Link para o post
magopoter    0
magopoter

putz tbm acho que deve ter dado um trabalhao mas ficou massa!

Compartilhar este post


Link para o post
Visitante
Este tópico está impedido de receber novos posts.
Entre para seguir isso  
  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×