Ir para conteúdo

[7.8+]hotkey (aimbot)


tibiaa4e

Posts Recomendados

O codigo + esperado esta aki

 

Codigo do Rappa Carnauba e Black Demon modificado pelo Kuja_Back para funcionar fluids e foods

 

começando

 

Em game.cpp

 

troque:

bool Game::playerUseItemEx(Player* player, const Position& fromPos, uint8_t fromStackPos, uint16_t fromSpriteId, 
  const Position& toPos, uint8_t toStackPos, uint16_t toSpriteId) 
{ 
  OTSYS_THREAD_LOCK_CLASS lockClass(gameLock, "Game::playerUseItemEx()"); 
  if(player->isRemoved()) 
     return false; 

  ReturnValue ret = RET_NOERROR; 
  if((ret = Actions::canUse(player, fromPos)) != RET_NOERROR){ 
     player->sendCancelMessage(ret); 
     return false; 
  } 
   
  Thing* thing = internalGetThing(player, fromPos, fromStackPos); 
  if(!thing){ 
     player->sendCancelMessage(RET_NOTPOSSIBLE); 
     return false; 
  } 
   
  Item* item = thing->getItem(); 
  if(!item || item->getClientID() != fromSpriteId || !item->isUseable()){ 
     player->sendCancelMessage(RET_CANNOTUSETHISOBJECT); 
     return false; 
  } 

  return internalUseItemEx(player, fromPos, item, toPos, toStackPos, toSpriteId); 
}

 

por :

bool Game::playerUseItemEx(Player* player, const Position& fromPos, uint8_t fromStackPos, uint16_t fromSpriteId, 
  const Position& toPos, uint8_t toStackPos, uint16_t toSpriteId) 
{ 
  OTSYS_THREAD_LOCK_CLASS lockClass(gameLock, "Game::playerUseItemEx()"); 
  if(player->isRemoved()) 
     return false; 
 
  ReturnValue ret = RET_NOERROR; 
  if((ret = Actions::canUse(player, fromPos)) != RET_NOERROR){ 
     player->sendCancelMessage(ret); 
     return false; 
  } 
   
   

   Item* item = dynamic_cast<Item*>(internalGetThing(player, fromPos, fromStackPos)); 
   player->usedHotkey = false; 
   if(!item && fromPos == Position(0xFFFF, 0, 0)){ 
      item = player->getHotkeyItem(fromSpriteId, fromStackPos); 
   
   if(!item){ 
      player->sendCancelMessage(RET_NOERROR); 
     return false; 
   } 
   Cylinder* cylinder = item->getParent(); 
   
   if(cylinder == NULL){ 
      return false; 
   } 
   fromStackPos = cylinder->__getIndexOfThing(item); 
   player->usedHotkey = true; 
   } 

   if(!item || item->getClientID() != fromSpriteId || !item->isUseable()){ 
     player->sendCancelMessage(RET_CANNOTUSETHISOBJECT); 
     return false; 
  } 
   
  return internalUseItemEx(player, fromPos, item, toPos, toStackPos, toSpriteId); 
}

 

 

troque tambem:

bool Game::playerUseBattleWindow(Player* player, const Position& fromPos, uint8_t fromStackPos, 
  uint32_t creatureId, uint16_t spriteId) 
{ 
  OTSYS_THREAD_LOCK_CLASS lockClass(gameLock, "Game::playerUseBattleWindow"); 
  if(player->isRemoved()) 
     return false; 

  Creature* creature = getCreatureByID(creatureId); 
  if(!creature){    
     return false; 
  } 
   
  if(!Position::areInRange<7,5,0>(creature->getPosition(), player->getPosition())){ 
     return false; 
  } 
   
  if(creature->getPlayer()){ 
     player->sendCancelMessage(RET_DIRECTPLAYERSHOOT); 
     return false; 
  } 

  ReturnValue ret = RET_NOERROR; 
  if((ret = Actions::canUse(player, fromPos)) != RET_NOERROR){ 
     player->sendCancelMessage(ret); 
     return false; 
  } 

  Thing* thing = internalGetThing(player, fromPos, STACKPOS_USE); 
  if(!thing){ 
     return false; 
  } 
  Item* item = thing->getItem(); 
  if(!item){ 
     player->sendCancelMessage(RET_CANNOTUSETHISOBJECT); 
     return false; 
  } 
   
  return internalUseItemEx(player, fromPos, item, creature->getPosition(), 0, 0); 
}

 

por:

bool Game::playerUseBattleWindow(Player* player, const Position& fromPos, uint8_t fromStackPos, 
  uint32_t creatureId, uint16_t spriteId) 
{ 
  OTSYS_THREAD_LOCK_CLASS lockClass(gameLock, "Game::playerUseBattleWindow"); 
  if(player->isRemoved()) 
     return false; 

  Creature* creature = getCreatureByID(creatureId); 
  if(!creature){    
     return false; 
  } 
   
  if(!Position::areInRange<7,5,0>(creature->getPosition(), player->getPosition())){ 
     return false; 
  } 
   
  if(creature->getPlayer()){ 
     player->sendCancelMessage(RET_DIRECTPLAYERSHOOT); 
     return false; 
  } 

  ReturnValue ret = RET_NOERROR; 
  if((ret = Actions::canUse(player, fromPos)) != RET_NOERROR){ 
     player->sendCancelMessage(ret); 
     return false; 
  } 

   Item* item = dynamic_cast<Item*>(internalGetThing(player, fromPos, STACKPOS_USE)); 
   
   player->usedHotkey = false; 
   
   if(!item && fromPos == Position(0xFFFF, 0, 0)){ 
      item = player->getHotkeyItem(spriteId, fromStackPos); 
   
   if(!item){ 
      player->sendCancelMessage(RET_NOERROR); 
     return false; 
   } 
   Cylinder* cylinder = item->getParent(); 
   
   if(cylinder == NULL){ 
      return false; 
   } 
      fromStackPos = cylinder->__getIndexOfThing(item); 
      player->usedHotkey = true; 
   } 
 
   if(!item){ 
     player->sendCancelMessage(RET_CANNOTUSETHISOBJECT); 
     return false; 
  } 
   
  return internalUseItemEx(player, fromPos, item, creature->getPosition(), 0, 0); 
}

 

Em spells.cpp

troque:

bool RuneSpell::executeUse(Player* player, Item* item, const PositionEx& posFrom, const PositionEx& posTo, bool extendedUse) 
{ 
  if(!playerRuneSpellCheck(player, posTo)){ 
     return false; 
  } 

  bool result = false; 

  if(m_scripted){ 
     LuaVariant var; 
     var.type = VARIANT_POSITION; 
     var.pos = posTo; 

     result = internalCastSpell(player, var); 
  } 
  else{ 
     if(function){ 
        result = function(this, player, item, posFrom, posTo); 
     } 
  } 

  if(result){ 
     Spell::postCastSpell(player); 
      
     if(hasCharges && item){ 
        int32_t newCharge = std::max(0, item->getItemCharge() - 1); 
        g_game.transformItem(item, item->getID(), newCharge); 
     } 
  } 

  return result; 
}

 

para:

bool RuneSpell::executeUse(Player* player, Item* item, const PositionEx& posFrom, const PositionEx& posTo, bool extendedUse) 
{ 
  if(!playerRuneSpellCheck(player, posTo)){ 
     return false; 
  } 

  bool result = false; 

  if(m_scripted){ 
     LuaVariant var; 
     var.type = VARIANT_POSITION; 
     var.pos = posTo; 

     result = internalCastSpell(player, var); 
  } 
  else{ 
     if(function){ 
        result = function(this, player, item, posFrom, posTo); 
     } 
  } 

  if(result){ 
     Spell::postCastSpell(player); 
      
     if(hasCharges && item){ 
        int32_t newCharge = std::max(0, item->getItemCharge() - 1); 
      
        bool usedHotkey = player->usedHotkey; 
        g_game.transformItem(item, item->getID(), newCharge); 
        if(usedHotkey){ 
               uint16_t totalCharges = player->getTotalCharges(item->getID()); 
               if(totalCharges == 0){ 
                 player->sendTextMessage(MSG_INFO_DESCR, "That was your last rune!"); 
              } 
              else{ 
                 std::stringstream chargeStream; 
                 chargeStream << totalCharges << " charges left..."; 
                 player->sendTextMessage(MSG_INFO_DESCR, chargeStream.str().c_str()); 
              } 
            } 
          } 
     } 
   
     return result; 
}

 

Em player.cpp

depois de:

chaseMode = CHASEMODE_STANDSTILL;

 

Adicione:

usedHotkey = false;

 

E no final de game.cpp adicione:

Item* Player::getHotkeyItem(uint16_t itemId, uint8_t itemType) 
{ 
    const long fluidMap[] = {FLUID_EMPTY_1, FLUID_BLUE_1, FLUID_RED_1, FLUID_BROWN_1, FLUID_GREEN_1, FLUID_YELLOW_1, FLUID_WHITE_1, FLUID_PURPLE_1, FLUID_RED_2, FLUID_BROWN_2, FLUID_PURPLE_2}; 
   std::list<const Container*> listContainer; 
   ItemList::const_iterator cit; 
   Container* tmpContainer = NULL; 
 
   Item* item = NULL; 
   for(int i = SLOT_FIRST; i < SLOT_LAST; i++){ 
       if(item = inventory[i]){ 
          if(item->getClientID() == itemId){ 
             if(item->isFluidContainer() && fluidMap[item->getFluidType()] == itemType){ 
                   return item; 
             } 
              else if(!item->isFluidContainer()){ 
                   return item; 
             } 
           } 
         if(tmpContainer = item->getContainer()){ 
            listContainer.push_back(tmpContainer); 
           } 
        } 
     } 
   while(listContainer.size() > 0){ 
     const Container* container = listContainer.front(); 
     listContainer.pop_front(); 
   
   for(cit = container->getItems(); cit != container->getEnd(); ++ cit){ 
       if((*cit)->getClientID() == itemId){ 
          if((*cit)->isFluidContainer() && fluidMap[(*cit)->getFluidType()] == itemType){ 
             return (*cit); 
             } 
          else if(!(*cit)->isFluidContainer()){ 
             return (*cit); 
             } 
          } 
      if(tmpContainer = (*cit)->getContainer()){ 
         listContainer.push_back(tmpContainer); 
       } 
     } 
   } 
   return NULL; 
} 
 
           

uint32_t Player::getTotalCharges(Cylinder* cylinder) const 
{ 
    if(cylinder == NULL) 
       return 0; 
     
    std::list<Container*> listContainer; 
    ItemList::const_iterator it; 
   Container* tmpContainer = NULL; 
   
   Thing* thing = NULL; 
   Item* item = NULL; 
   uint32_t charges = 0; 
   
    for(int i = cylinder->__getFirstIndex(); i < cylinder->__getLastIndex(); ++i){ 
     if(!(thing = cylinder->__getThing(i))) 
        continue; 

     if(!(item = thing->getItem())) 
        continue; 
        if(tmpContainer = item->getContainer()){ 
        listContainer.push_back(tmpContainer); 
     } 
     else{ 
        if(item->isRune()){ 
           charges += item->getItemCharge(); 
        } 
     } 
  } 
  while(listContainer.size() > 0) 
  { 
      Container* container = listContainer.front(); 
      listContainer.pop_front(); 
   for(it = container->getItem(); it != container->getEnd(); ++it) 
   { 
      Item* item = (*it); 
       
      if(listContainer = item->getContainer()){ 
         listContainer.push_back(tmpContainer); 
      } 
      else{ 
         if(item->isRune()){ 
            charges += item->getItemCharges(); 
         } 
     } 
  } 
  return charges; 
}

 

Em player.h

Nos includes add:

#include "networkmessage.h"

 

E em public adicione:

Item* getHotkeyItem(uint16_t itemId, uint8_t itemType); 
  uint32_t Player::getTotalCharges(uint16_t itemId) const; 
  bool usedHotkey;

 

De rebuild all e parabens vc tem hotkey

 

comentem

 

flws :hi:

Link para o comentário
Compartilhar em outros sites

  • 3 weeks later...
×
×
  • Criar Novo...