Advertisement
deadx2

Untitled

Nov 12th, 2017
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.06 KB | None | 0 0
  1. // Dodaj na samym dole pliku:
  2. void CHARACTER::ChannelSwitch(int iNewChannel)
  3. {
  4.     long lAddr, lMapIndex;
  5.     WORD wPort;
  6.  
  7.     long x = GetX();
  8.     long y = GetY();
  9.  
  10.     /*
  11.     if (OffShopBug > get_global_time())
  12.     {
  13.         ChatPacket(CHAT_TYPE_INFO, "Poczekaj 10 sekund!");
  14.         return;
  15.     }
  16.     */
  17.  
  18.     if (!CMapLocation::Instance().Get(x, y, lMapIndex, lAddr, wPort))
  19.     {
  20.         sys_err("Can not find map location index[%ld] x[%ld] y[%ld] name[%s]", lMapIndex, x, y, GetName());
  21.         return;
  22.     }
  23.  
  24.     if (g_bChannel == iNewChannel)
  25.     {
  26.         ChatPacket(CHAT_TYPE_INFO, "[Neshalie] Nie mozesz przeniesc sie na ten sam kanał!");
  27.         return;
  28.     }
  29.  
  30.     if (g_bChannel == 99)
  31.     {
  32.         ChatPacket(CHAT_TYPE_INFO, "[Neshalie] Tutaj nie mozna zmienic kanału!");
  33.         return;
  34.     }
  35.  
  36.     if (GetDungeon())
  37.     {
  38.         ChatPacket(CHAT_TYPE_INFO, "[Neshalie] Niestety na dungeonie nie mozna zmienic kanału!");
  39.         return;
  40.     }
  41.  
  42.     if (lMapIndex >= 10000)
  43.         return;
  44.  
  45.     if (!g_bChannel || g_bChannel == 0)
  46.     {
  47.         return;
  48.     }
  49.     BYTE podch = 0;
  50.     WORD malpa = 0;
  51.  
  52.     if (wPort == 15100 || wPort == 15200 || wPort == 15300 || wPort == 15400)
  53.     {
  54.         podch = 1;
  55.     }
  56.     else if (wPort == 15101 || wPort == 15201 || wPort == 15301 || wPort == 15401)
  57.     {
  58.         podch = 2;
  59.     }
  60.     else if (wPort == 15102 || wPort == 15202 || wPort == 15302 || wPort == 15402)
  61.     {
  62.         podch = 3;
  63.     }
  64.     else if (wPort == 15103 || wPort == 15203 || wPort == 15303 || wPort == 15403)
  65.     {
  66.         podch = 4;
  67.     }
  68.     else
  69.     {
  70.         podch = 0;
  71.     }
  72.  
  73.     Stop();
  74.     Save();
  75.  
  76.     if (GetSectree())
  77.     {
  78.         GetSectree()->RemoveEntity(this);
  79.         ViewCleanup();
  80.         EncodeRemovePacket(this);
  81.     }
  82.  
  83.     if (podch == 1)
  84.     {
  85.         malpa = 15000 + 100 * iNewChannel;
  86.         podch = 0;
  87.     }
  88.     else if (podch == 2)
  89.     {
  90.         malpa = 15001 + 100 * iNewChannel;
  91.         podch = 0;
  92.     }
  93.     else if (podch == 3)
  94.     {
  95.         malpa = 15002 + 100 * iNewChannel;
  96.         podch = 0;
  97.     }
  98.     else if (podch == 4)
  99.     {
  100.         malpa = 15003 + 100 * iNewChannel;
  101.         podch = 0;
  102.     }
  103.     else
  104.     {
  105.         malpa = 15000 + 100 * iNewChannel;
  106.     }
  107.        
  108.     TPacketGCWarp p;
  109.     p.bHeader   = HEADER_GC_WARP;
  110.     p.lX    = x;
  111.     p.lY    = y;
  112.     p.lAddr     = lAddr;
  113.     p.wPort     = malpa;  
  114.        
  115.     GetDesc()->Packet(&p, sizeof(TPacketGCWarp));
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement