Premium Domniq 928 Posted September 26, 2017 Premium Share Posted September 26, 2017 M2 Download Center This is the hidden content, please Sign In or Sign Up ( Internal ) Hey, Move Channel System with countdown (same as logout, change character and quit), similar to gf. command: /move_channel number Files to edit char.cpp, char.h, cmd.cpp, cmd.h, cmd_general.cpp char.cpp Spoiler find void CHARACTER::StartWarpNPCEvent() add above // MOVE_CHANNEL void CHARACTER::MoveChannel(int iNewChannel) { long lAddr, lMapIndex; WORD wPort; long x = GetX(); long y = GetY(); if (!CMapLocation::Instance().Get(x, y, lMapIndex, lAddr, wPort)) return; std::map<WORD, BYTE> ChannelsPorts; for (BYTE i = 0; i < 6; i++) //replace with maximum channels { //core1 ChannelsPorts[13 * 1000 + i] = i + 1; // 1300i - channel port //core2 //ChannelsPorts[13 * 1000 + 50 + i] = i + 1; // 1305i - channel port //etc. } int iChannel = ChannelsPorts.find(wPort) != ChannelsPorts.end() ? ChannelsPorts[wPort] : 0; 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 - (iChannel - 1) + (iNewChannel - 1)); GetDesc()->Packet(&p, sizeof(TPacketGCWarp)); } // END_OF_MOVE_CHANNEL char.h Spoiler find void StartWarpNPCEvent(); add bellow // MOVE_CHANNEL void MoveChannel(int new_ch); // END_OF_MOVE_CHANNEL cmd.cpp Spoiler find { "mall_close", do_mall_close, 0, POS_DEAD, GM_PLAYER }, add bellow // MOVE_CHANNEL { "move_channel", do_cmd, SCMD_MOVE_CHANNEL, POS_DEAD, GM_PLAYER }, // END_OF_MOVE_CHANNEL cmd.h Spoiler find struct command_info add above // MOVE_CHANNEL extern int channel_index; // END_OF_MOVE_CHANNEL cmd_general.cpp Spoiler 1) find extern int g_server_id; 1) add above // MOVE_CHANNEL #include "map_location.h" // END_OF_MOVE_CHANNEL 2) find switch (info->subcmd) { case SCMD_LOGOUT: case SCMD_QUIT: case SCMD_PHASE_SELECT: 2) add bellow // MOVE_CHANNEL case SCMD_MOVE_CHANNEL: // END_OF_MOVE_CHANNEL 3) find case SCMD_PHASE_SELECT: { ch->Disconnect("timed_event - SCMD_PHASE_SELECT"); if (d) { d->SetPhase(PHASE_SELECT); } } break; 3) add bellow // MOVE_CHANNEL case SCMD_MOVE_CHANNEL: ch->MoveChannel(channel_index); break; // END_OF_MOVE_CHANNEL 4) find case SCMD_PHASE_SELECT: ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Äł¸ŻĹ͸¦ ŔüČŻ ÇŐ´Ď´Ů. Ŕá˝Ă¸¸ ±â´Ů¸®ĽĽżä.")); break; 4) add bellow // MOVE_CHANNEL case SCMD_MOVE_CHANNEL: //ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("SCMD_MOVE_CHANNEL")); char arg1[256]; one_argument(argument, arg1, sizeof(arg1)); if (!*arg1) return; int new_ch; str_to_number(new_ch, arg1); if (new_ch < 1 || new_ch > 6) // replace with your channel count return; if (!ch->IsPC()) return; channel_index = new_ch; break; // END_OF_MOVE_CHANNEL 5) find case SCMD_LOGOUT: case SCMD_QUIT: case SCMD_PHASE_SELECT: { TimedEventInfo* info = AllocEventInfo<TimedEventInfo>(); { if (ch->IsPosition(POS_FIGHTING)) info->left_second = 10; else info->left_second = 3; } info->ch = ch; info->subcmd = subcmd; strlcpy(info->szReason, argument, sizeof(info->szReason)); ch->m_pkTimedEvent = event_create(timed_event, info, 1); } break; 5) add bellow // MOVE_CHANNEL case SCMD_MOVE_CHANNEL: { int lMapArray[] = { 66, 113, 207 }; // disallowed map index long lAddr, lMapIndex; WORD wPort; long x = ch->GetX(); long y = ch->GetY(); if (!CMapLocation::Instance().Get(x, y, lMapIndex, lAddr, wPort)) { sys_err("Can not find map location index[%ld] x[%ld] y[%ld] name[%s]", lMapIndex, x, y, ch->GetName()); return; } if (lMapIndex >= 10000) { sys_err("Map index higher or equal to 10000"); return; } for (int i = 0; i < _countof(lMapArray); i++) { if (lMapIndex == lMapArray[i]) { ch->ChatPacket(CHAT_TYPE_INFO, "You can't change channel while you're inside this location"); return; } } std::map<WORD, BYTE> ChannelsPorts; for (BYTE i = 0; i < 6; i++) //replace with maximum channels { //core1 ChannelsPorts[13 * 1000 + i] = i + 1; // channel port //core2 //ChannelsPorts[13 * 1000 + 50 + i] = i + 1; // channel port //etc. } int iChannel = ChannelsPorts.find(wPort) != ChannelsPorts.end() ? ChannelsPorts[wPort] : 0; if (iChannel == 0) { ch->ChatPacket(CHAT_TYPE_INFO, "This port is not available! (%d)", wPort); return; } if (wPort == (wPort - (iChannel - 1) + (channel_index - 1))) { ch->ChatPacket(CHAT_TYPE_INFO, "You're on this channel, select another one!"); return; } TimedEventInfo* info = AllocEventInfo<TimedEventInfo>(); { if (ch->IsPosition(POS_FIGHTING)) info->left_second = 10; else info->left_second = 3; } ch->ChatPacket(CHAT_TYPE_INFO, "Please wait a moment. Changing channel..."); info->ch = ch; info->subcmd = subcmd; strlcpy(info->szReason, argument, sizeof(info->szReason)); ch->m_pkTimedEvent = event_create(timed_event, info, 1); } break; // END_OF_MOVE_CHANNEL CALCULATE YOUR PORTS HERE https://repl.it/@Nevisor/ChannelPortCalculator 73 1 2 2 1 29 3 49 Link to comment Share on other sites More sharing options...
Premium North 1171 Posted September 30, 2017 Premium Share Posted September 30, 2017 Thanks, if anyone is willing to share the zip with the official buttons for the switcher i can make the official interface (a video of the official channel changer would be great since i have no idea how it looks) Link to comment Share on other sites More sharing options...
Active+ Member Abel(Tiger) 1193 Posted September 30, 2017 Active+ Member Share Posted September 30, 2017 (edited) This is the hidden content, please Sign In or Sign Up https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif d:/ymir work/ui/game/myshop_deco/select_btn_01.sub ... Edited August 24, 2022 by Metin2 Dev Core X - External 2 Internal 25 1 6 13 Link to comment Share on other sites More sharing options...
thespeedy 20 Posted September 30, 2017 Share Posted September 30, 2017 (edited) and ui python part? vor 1 Stunde schrieb Abel(Tiger): This is the hidden content, please Sign In or Sign Up https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif d:/ymir work/ui/game/myshop_deco/select_btn_01.sub ... Edited August 24, 2022 by Metin2 Dev Core X - External 2 Internal 4 2 Link to comment Share on other sites More sharing options...
Premium Domniq 928 Posted September 30, 2017 Author Premium Share Posted September 30, 2017 btw. I've already made python part too (update 1.4 contains all files) 1 3 Link to comment Share on other sites More sharing options...
.Rise 18 Posted April 1, 2018 Share Posted April 1, 2018 On 30. 9. 2017 at 6:11 PM, Nevisor said: btw. I've already made python part too (update 1.4 contains all files) I tried your python part but when I change channel, channel info (under minimap) is still same.. How Can I fix it? Thanks. If I helped you, do not forget to press "Thanks" button! Link to comment Share on other sites More sharing options...
Lajk 7 Posted April 1, 2018 Share Posted April 1, 2018 4 godziny temu, .Rise napisał: I tried your python part but when I change channel, channel info (under minimap) is still same.. How Can I fix it? Thanks. net.SetServerInfo("Server, Channel: %d" % channel) Link to comment Share on other sites More sharing options...
Premium Domniq 928 Posted April 1, 2018 Author Premium Share Posted April 1, 2018 5 godzin temu, .Rise napisał: I tried your python part but when I change channel, channel info (under minimap) is still same.. How Can I fix it? Thanks. There is part in my game.py that is doing that as I remember 1 Link to comment Share on other sites More sharing options...
.Rise 18 Posted April 1, 2018 Share Posted April 1, 2018 9 hours ago, Nevisor said: There is part in my game.py that is doing that as I remember Ok.. it is solved now but there is another bug: when I am shopping and try to change channel (click on "OK"), after teleport it will refresh on chosen channel instead of staying, because I cant change channel while shopping.. If I helped you, do not forget to press "Thanks" button! Link to comment Share on other sites More sharing options...
Danonek 3 Posted September 1, 2018 Share Posted September 1, 2018 (edited) Nice release Edited April 29, 2021 by Danonek Link to comment Share on other sites More sharing options...
kertus 0 Posted October 27, 2018 Share Posted October 27, 2018 Anyone con help me with set ch port in the char.cpp???? ch1 core 1 31000 ch1 core 2 33000 ch2 core 1 31001 ch2 core 2 33001 Link to comment Share on other sites More sharing options...
Pitos 0 Posted October 28, 2018 Share Posted October 28, 2018 Dnia 27.10.2018 o 07:02, kertus napisał: Anyone con help me with set ch port in the char.cpp???? ch1 core 1 31000 ch1 core 2 33000 ch2 core 1 31001 ch2 core 2 33001 //cor1 ChannelsPorts[31 * 1000 + i] = i + 1; //cor2 ChannelsPorts[33 * 1000 + i] = i + 1; Link to comment Share on other sites More sharing options...
notbugme 14 Posted November 5, 2018 Share Posted November 5, 2018 I tried your python part but when I change channel, channel info (under minimap) is still same..How Can I fix it? Thanks. Link to comment Share on other sites More sharing options...
notbugme 14 Posted November 9, 2018 Share Posted November 9, 2018 I tried your python part but when I change channel, channel info (under minimap) is still same..How Can I fix it? Thanks. Link to comment Share on other sites More sharing options...
LordZiege 279 Posted January 14, 2019 Share Posted January 14, 2019 When only Channel 1 online and in Channelchanger you click channel 4 you get kicked. any solution or if clause for ask if channel online or offline? Link to comment Share on other sites More sharing options...
Micha aka xCPx 336 Posted May 6, 2020 Share Posted May 6, 2020 Quite nice,, that you use nearly my exact script, i released 2015 on Epvp. simply search for [RLS] Ingame Channel Switcher like WOM2 and compare But @LordZiege: you need to check this first in the clientside-script ( i think the check was in my py scripts for the original switcher) Link to comment Share on other sites More sharing options...
danhakhavro 42 Posted April 12, 2021 Share Posted April 12, 2021 When changing the channel, the game returns to the login page after 3 seconds. Can anyone explain how to configure the ports? More exactly this part: p.wPort = (wPort - 100*(g_bChannel-1) + 100*(channelId-1)); For exemple: I have ch1_core1: 30000 For exemple: I have ch1_core2: 30001 For exemple: I have ch2_core1: 30002 For exemple: I have ch2_core2: 30003 How it works? What is the logic ? Thank you very much. Link to comment Share on other sites More sharing options...
covfefe 32 Posted January 7, 2022 Share Posted January 7, 2022 (edited) ######### Edited January 7, 2022 by covfefe clarification Link to comment Share on other sites More sharing options...
covfefe 32 Posted January 7, 2022 Share Posted January 7, 2022 (edited) Undefined reference to channel_index please help Edited January 7, 2022 by covfefe Link to comment Share on other sites More sharing options...
Giecu 4 Posted August 8, 2022 Share Posted August 8, 2022 (edited) cmd.h enum SCMD_CMD { SCMD_LOGOUT, SCMD_QUIT, SCMD_PHASE_SELECT, SCMD_SHUTDOWN, // MOVE_CHANNEL SCMD_MOVE_CHANNEL, // END_OF_MOVE_CHANNEL }; cmd.h delete // MOVE_CHANNEL extern int channel_index; // END_OF_MOVE_CHANNEL cmd_general.cpp add under includes // MOVE_CHANNEL int channel_index; // END_OF_MOVE_CHANNEL Edited August 8, 2022 by Giecu Link to comment Share on other sites More sharing options...
Recommended Posts