Combreal

EnableFlyCmdMangosZero02.cpp

Apr 20th, 2020 (edited)
554
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //src\game\object\Player.cpp
  2. void Player::SetCanFly(bool enable)
  3. {
  4.     WorldPacket data;
  5.     if (enable)
  6.         data.Initialize(MSG_MOVE_START_SWIM, 12);
  7.     else
  8.         data.Initialize(MSG_MOVE_STOP_SWIM, 12);
  9.  
  10.     data << GetPackGUID();
  11.     data << uint32(0);                                    
  12.     SendMessageToSet(&data, true);
  13.  
  14.     /*data.Initialize(MSG_MOVE_UPDATE_CAN_FLY, 64); //hope we can skip this
  15.     data << GetPackGUID();
  16.     m_movementInfo.Write(data);
  17.     SendMessageToSet(&data, false);*/
  18. }
  19.  
  20.  
  21. //src\game\chatCommands\Level3.cpp It's already present in MangosZero
  22. #include "Opcodes.h"
  23. bool ChatHandler::HandleGMFlyCommand(char* args)
  24. {
  25.     bool value;
  26.     if (!ExtractOnOff(&args, value))
  27.     {
  28.         SendSysMessage(LANG_USE_BOL);
  29.         SetSentErrorMessage(true);
  30.         return false;
  31.     }
  32.  
  33.     Player* target = getSelectedPlayer();
  34.     if (!target)
  35.     {
  36.         target = m_session->GetPlayer();
  37.     }
  38.  
  39.     /* [-ZERO] Need reimplement in another way //hope we can skip this
  40.     {
  41.         SendSysMessage(LANG_USE_BOL);
  42.         return false;
  43.     }*/
  44.     target->SetCanFly(value);
  45.     PSendSysMessage(LANG_COMMAND_FLYMODE_STATUS, GetNameLink(target).c_str(), args); //not sure LANG_COMMAND_FLYMODE_STATUS exists in MangosZero, might need fix here
  46.     return true;
  47. }
Add Comment
Please, Sign In to add comment