Advertisement
Guest User

Untitled

a guest
Jan 24th, 2020
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. void CHARACTER::ChannelSwitch(int iNewChannel)
  2. {
  3.  
  4. long lAddr;
  5. long lMapIndex;
  6. WORD wPort;
  7. long x = this->GetX();
  8. long y = this->GetY();
  9.  
  10. if (!CMapLocation::instance().Get(x, y, lMapIndex, lAddr, wPort))
  11. {
  12. return;
  13. }
  14.  
  15. if(lMapIndex >= 10000){
  16. return;
  17. }
  18.  
  19. if (IsHack ())
  20. return;
  21.  
  22. std::map<WORD, int>ch;
  23.  
  24. #ifdef ENABLE_FIX_ZMIANA_CH_PO_HANDLU
  25.  
  26. int nExitLimitTime = 10;
  27.  
  28. if (IsHack(false, true, nExitLimitTime))
  29. {
  30. ChatPacket(CHAT_TYPE_INFO, "Wybrałeś przycisk zmiany kanału. Poczekaj chwilę.");
  31. return;
  32. }
  33. #endif
  34.  
  35. // for(int i = 0; i < 4; i++)
  36. // {
  37. // for(int i2 = 0; i < 2; i++)
  38. // {
  39. // ch[(13 * 1000) + (i * 3000) + i2] = i + 1;
  40. // if (i == 3)
  41. // ch[(13 * 1000) + ((i * 3000) - 1000) + i2] = i + 1;
  42. // }
  43. // }
  44.  
  45. // By Paszka 25.08.2019
  46. for(BYTE i = 0; i < 4; i++)
  47. {
  48. for(BYTE i2 = 0; i2 < 2; i2++)
  49. {
  50. ch[13 * 1000 + i + i2 * 50] = i + 1;
  51. }
  52. }
  53.  
  54. int chan;
  55. if(ch.find(wPort) != ch.end())
  56. {
  57. chan = ch[wPort];
  58. }
  59. else
  60. {
  61. return;
  62. }
  63. Stop();
  64. Save();
  65.  
  66. if(GetSectree())
  67. {
  68. GetSectree()->RemoveEntity(this);
  69. ViewCleanup();
  70.  
  71. EncodeRemovePacket(this);
  72. }
  73.  
  74. TPacketGCWarp p;
  75. p.bHeader = HEADER_GC_WARP;
  76. p.lX = x;
  77. p.lY = y;
  78. p.lAddr = lAddr;
  79. // p.wPort = (wPort - 3000*(chan-1) + 3000*(iNewChannel-1));
  80. // paszka
  81. // p.wPort = (wPort - 1 * (iChannel - 1 ) + 1 * (iNewChannel - 1));
  82. //////
  83. p.wPort = (wPort - 1 * (chan - 1 ) + 1 * (iNewChannel - 1));
  84.  
  85. ChatPacket(CHAT_TYPE_COMMAND, "Update %d",iNewChannel); // to starcza
  86. GetDesc()->Packet(&p, sizeof(TPacketGCWarp));
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement