Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void CHARACTER::ChannelSwitch(int iNewChannel)
- {
- long lAddr;
- long lMapIndex;
- WORD wPort;
- long x = this->GetX();
- long y = this->GetY();
- if (!CMapLocation::instance().Get(x, y, lMapIndex, lAddr, wPort))
- {
- return;
- }
- if(lMapIndex >= 10000){
- return;
- }
- if (IsHack ())
- return;
- std::map<WORD, int>ch;
- #ifdef ENABLE_FIX_ZMIANA_CH_PO_HANDLU
- int nExitLimitTime = 10;
- if (IsHack(false, true, nExitLimitTime))
- {
- ChatPacket(CHAT_TYPE_INFO, "Wybrałeś przycisk zmiany kanału. Poczekaj chwilę.");
- return;
- }
- #endif
- // for(int i = 0; i < 4; i++)
- // {
- // for(int i2 = 0; i < 2; i++)
- // {
- // ch[(13 * 1000) + (i * 3000) + i2] = i + 1;
- // if (i == 3)
- // ch[(13 * 1000) + ((i * 3000) - 1000) + i2] = i + 1;
- // }
- // }
- // By Paszka 25.08.2019
- for(BYTE i = 0; i < 4; i++)
- {
- for(BYTE i2 = 0; i2 < 2; i2++)
- {
- ch[13 * 1000 + i + i2 * 50] = i + 1;
- }
- }
- int chan;
- if(ch.find(wPort) != ch.end())
- {
- chan = ch[wPort];
- }
- else
- {
- return;
- }
- Stop();
- Save();
- if(GetSectree())
- {
- GetSectree()->RemoveEntity(this);
- ViewCleanup();
- EncodeRemovePacket(this);
- }
- TPacketGCWarp p;
- p.bHeader = HEADER_GC_WARP;
- p.lX = x;
- p.lY = y;
- p.lAddr = lAddr;
- // p.wPort = (wPort - 3000*(chan-1) + 3000*(iNewChannel-1));
- // paszka
- // p.wPort = (wPort - 1 * (iChannel - 1 ) + 1 * (iNewChannel - 1));
- //////
- p.wPort = (wPort - 1 * (chan - 1 ) + 1 * (iNewChannel - 1));
- ChatPacket(CHAT_TYPE_COMMAND, "Update %d",iNewChannel); // to starcza
- GetDesc()->Packet(&p, sizeof(TPacketGCWarp));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement