Ir para conteúdo
Entre para seguir isso  
punkndisaster

Trade Channel Delay(7.9)

Recommended Posts

punkndisaster    0
punkndisaster

Trade channel delay(tanto de main como de rook) configurável pelo config.lua - svn 17/12/06(XikeOT)

 

Eu só fiz configurável pelo config.lua e a outra parte o GH057 que fez.

 

Com isso, fim do spam nos servers :lol:

 

vamos começar o code:

 

na função:

 

bool Chat::talkToChannel(Player* player, SpeakClasses type, const std::string& text, unsigned short channelId)

{

em baixo de:

 

if(!channel)

  return false;

adicione:

 

#ifdef __TRADE_DELAY__/*

    if(channel->talk(player, type, text, channelId))

    return true;

    else

    return false;*/

    if(player && player->getAccessLevel() < (ConfigManager::ACCESS_TALK) && (channel->getName() == "Trade")&& (player->getVocationId() != VOCATION_NONE))

    {

          int32_t addExhaustion = 0;

          if(!player->hasCondition(CONDITION_TRADE_EXHAUSTED))

          {

               addExhaustion = g_config.getNumber(ConfigManager::DELAY_TRADE);

           Condition* condition = Condition::createCondition(CONDITIONID_DEFAULT, CONDITION_TRADE_EXHAUSTED, addExhaustion * 1000, 0);

         player->addCondition(condition);

         if(channel->talk(player, type, text, channelId))

               return true;

          }

          else

          {

              player->sendCancel("You may only place one offer in two minutes.");

              return false;

          }

    }

    if(player && player->getAccessLevel() < (ConfigManager::ACCESS_TALK) && (channel->getName() == "Trade-Rookgaard")&& (player->getVocationId() == VOCATION_NONE))

    {

          int32_t addExhaustion = 0;

          if(!player->hasCondition(CONDITION_TRADE_EXHAUSTED))

          {

               addExhaustion = g_config.getNumber(ConfigManager::DELAY_TRADE);

           Condition* condition = Condition::createCondition(CONDITIONID_DEFAULT, CONDITION_TRADE_EXHAUSTED, addExhaustion * 1000, 0);

         player->addCondition(condition);

         if(channel->talk(player, type, text, channelId))

               return true;

          }

          else

          {

              player->sendCancel("You may only place one offer in two minutes.");

              return false;

          }

    }

    if(channel->getName() != "Trade")

    {

         if(channel->talk(player, type, text, channelId))

         return true;

         else

         return false;

    }

    #endif

 

em baixo de:

case CONDITION_EXHAUSTED:

  {

  	return new ConditionGeneric(_id, _type,_ticks);

  	break;

  }

adicione:

 

#ifdef __TRADE_DELAY__

        case CONDITION_TRADE_EXHAUSTED:

  {

  	return new ConditionGeneric(_id, _type,_ticks);

  	break;

  }

        #endif

procure:

 

CONDITION_SOUL          = 16384,

abaixo adicione:

 

#ifdef __TRADE_DELAY__

	CONDITION_TRADE_EXHAUSTED  	= 32768

    #endif

procure:

 

m_confInteger[OTSERV_DB_ENABLED] = getGlobalNumber(L, "otserv_db_enabled", 0);

abaixo, adicione:

 

#ifdef __TRADE_DELAY__

    m_confInteger[DELAY_TRADE] = getGlobalNumber(L, "delaytrade", 3);

    #endif

procure em configmanager.h :

 

 

KICK_TIME,

abaixo adicione:

 

#ifdef __TRADE_DELAY__

  DELAY_TRADE,

        #endif

agora vá em Project -> Project Options(Alt+p) -> Parameters -> C++ Compiler e adicione:

 

-D__TRADE_DELAY__

agora vá em config.lua na pasta do ot

 

e adicione esta linha em qualquer lugar:

 

-- Trade time between offers (1 = 1 second, 0 To disable)

delaytrade = 2*60

É isso aí, qualquer pergunta só falar, o code acabou :D

Compartilhar este post


Link para o post
punkndisaster    0
punkndisaster

Trade channel delay(tanto de main como de rook) configurável pelo config.lua - svn 17/12/06(XikeOT)

 

Eu só fiz configurável pelo config.lua e a outra parte o GH057 que fez.

 

Com isso, fim do spam nos servers :lol:

 

vamos começar o code:

 

na função:

 

bool Chat::talkToChannel(Player* player, SpeakClasses type, const std::string& text, unsigned short channelId)

{

em baixo de:

 

if(!channel)

  return false;

adicione:

 

#ifdef __TRADE_DELAY__/*

    if(channel->talk(player, type, text, channelId))

    return true;

    else

    return false;*/

    if(player && player->getAccessLevel() < (ConfigManager::ACCESS_TALK) && (channel->getName() == "Trade")&& (player->getVocationId() != VOCATION_NONE))

    {

          int32_t addExhaustion = 0;

          if(!player->hasCondition(CONDITION_TRADE_EXHAUSTED))

          {

               addExhaustion = g_config.getNumber(ConfigManager::DELAY_TRADE);

           Condition* condition = Condition::createCondition(CONDITIONID_DEFAULT, CONDITION_TRADE_EXHAUSTED, addExhaustion * 1000, 0);

         player->addCondition(condition);

         if(channel->talk(player, type, text, channelId))

               return true;

          }

          else

          {

              player->sendCancel("You may only place one offer in two minutes.");

              return false;

          }

    }

    if(player && player->getAccessLevel() < (ConfigManager::ACCESS_TALK) && (channel->getName() == "Trade-Rookgaard")&& (player->getVocationId() == VOCATION_NONE))

    {

          int32_t addExhaustion = 0;

          if(!player->hasCondition(CONDITION_TRADE_EXHAUSTED))

          {

               addExhaustion = g_config.getNumber(ConfigManager::DELAY_TRADE);

           Condition* condition = Condition::createCondition(CONDITIONID_DEFAULT, CONDITION_TRADE_EXHAUSTED, addExhaustion * 1000, 0);

         player->addCondition(condition);

         if(channel->talk(player, type, text, channelId))

               return true;

          }

          else

          {

              player->sendCancel("You may only place one offer in two minutes.");

              return false;

          }

    }

    if(channel->getName() != "Trade")

    {

         if(channel->talk(player, type, text, channelId))

         return true;

         else

         return false;

    }

    #endif

 

em baixo de:

case CONDITION_EXHAUSTED:

  {

  	return new ConditionGeneric(_id, _type,_ticks);

  	break;

  }

adicione:

 

#ifdef __TRADE_DELAY__

        case CONDITION_TRADE_EXHAUSTED:

  {

  	return new ConditionGeneric(_id, _type,_ticks);

  	break;

  }

        #endif

procure:

 

CONDITION_SOUL          = 16384,

abaixo adicione:

 

#ifdef __TRADE_DELAY__

	CONDITION_TRADE_EXHAUSTED  	= 32768

    #endif

procure:

 

m_confInteger[OTSERV_DB_ENABLED] = getGlobalNumber(L, "otserv_db_enabled", 0);

abaixo, adicione:

 

#ifdef __TRADE_DELAY__

    m_confInteger[DELAY_TRADE] = getGlobalNumber(L, "delaytrade", 3);

    #endif

procure em configmanager.h :

 

 

KICK_TIME,

abaixo adicione:

 

#ifdef __TRADE_DELAY__

  DELAY_TRADE,

        #endif

agora vá em Project -> Project Options(Alt+p) -> Parameters -> C++ Compiler e adicione:

 

-D__TRADE_DELAY__

agora vá em config.lua na pasta do ot

 

e adicione esta linha em qualquer lugar:

 

-- Trade time between offers (1 = 1 second, 0 To disable)

delaytrade = 2*60

É isso aí, qualquer pergunta só falar, o code acabou :D

Compartilhar este post


Link para o post
Tokeras    0
Tokeras

Hmm... muito bom, estava procurando mesmo apersar de quase ninguem usar o Trade Channel... mas tá valendo :D Valeu ai! Belo Script

 

=]~

Fuiz

Compartilhar este post


Link para o post
Tokeras    0
Tokeras

Hmm... muito bom, estava procurando mesmo apersar de quase ninguem usar o Trade Channel... mas tá valendo :D Valeu ai! Belo Script

 

=]~

Fuiz

Compartilhar este post


Link para o post
Jackson Zani    1
Jackson Zani

code muito bom

para servidor sério

;) thankz

Compartilhar este post


Link para o post
Jackson Zani    1
Jackson Zani

code muito bom

para servidor sério

;) thankz

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.

×