Jump to content

Recommended Posts

Hey guys so i have this problem with my channel switcher, i don't know how to configure it .... 

Please have a look at my code and tell me where i was wrong or do it for me if possible ...

 

My ports are:

CH1- 13000

CH2- 16000

CH3- 19000

CH4 - 21000

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;
}

std::map<WORD, int>ch;

for(int i = 0; i < 4; i++){
for(int i2 = 1; i2 < 9; i2++){
ch[100*100 + (i*3000)] = i+1; //This is where the ports are being calculated
}
}
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 - 100 * (iChannel - 1) + 100 * (iNewChannel - 1)); GetDesc()->Packet(&p, sizeof(TPacketGCWarp));

}

I know the calculator cant calculate ch4 eighter because it doesnt fit the pattern.

So if you guys know a better way to do this like to calculate each ch separately please help me out here...

Link to comment
https://metin2.dev/topic/12082-channel-switcher/
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

7 minutes ago, arves100 said:

As i see in map_location.cpp

Can you share sys_log when:

"Map(%d): Server(%x:%d)"

oncurred?

i cant find anything like that in syslog.

I just need help configuring the ports to match the ones on my server or a different function to calculate each ch port separately.

Link to comment
https://metin2.dev/topic/12082-channel-switcher/#findComment-70071
Share on other sites

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.