Jump to content

Ingame Channel Switcher System


Recommended Posts

thx for the system i didnt test it or add it
also iam not c++ progream but your code it seem to be ugly -_-

good luck :)

Really? I can't find anything ugly about this. Actually the c++ part is very nice. I didn't check on python.

And why are you wishing him good luck at his own release? ._. Sometimes I don't understand people...^^

 

Anyway, the idea behind that is great and I like the c++ part a lot. Oh, and a german sentence slipped through ;)

 

I know that it isn't the best c++ Code, but I really.love using maps ^^

 

Py part is 1:1 from wom:o

 

And yeah the German sentence comes through :D

sorry for that ^^

Mobile phone and yeah :D

i dont know how to tell u why he is ugly

also iam arabic from libya not germany

alina wasn't talking to  you when he/she wrote this ---> "and a german sentence slipped through ;)"

he/she was talking to the topic maker

 

and for the python part :

go to uisystem.py in root and search for this tow times

self.GetChild("help_button").SAFE_SetEvent(self.__ClickHelpButton)

and under it write this

self.GetChild("Change_Channel").SAFE_SetEvent(self.__ClickChangeChButton)

and after this

	def __ClickInGameShopButton(self):	   	
	   	self.Close()
		net.SendChatPacket("/in_game_mall")

write this

 

Hidden Content

3: change systemdialog.py in uiscript with this

 

Hidden Content

and finally go to constnfo.py in root and write this

channel = 0

and the python part is over <3

Forgot your post channel for uiscript :D. For press for change and not anything going on.

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 1
Link to comment
Share on other sites

  • Former Staff

You know that the system as released here works perfectly or? 

 

But you need correct entries in the serverinfo and also the right ports

 

Also the map checks is serverside 

If Ch99 isn't set to the map then you function allways returns if player is in ch99

The clientside part I just took from wom2 because was too lazy go create own guy 

 

i'm not saying that the system doesn't work i just can't open tow channels at the same time to test it (i don't know why -still investing.)... plus about the map check the server never check where is he going (to which map) just checks if the map index found or not ....

to be more specific i'm talking about those maps

		dis_maps = [
			"season1/metin2_map_oxevent",
			"season2/metin2_map_guild_inside01",
			"season2/metin2_map_empirewar01",
			"season2/metin2_map_empirewar02",
			"season2/metin2_map_empirewar03",
			"metin2_map_dragon_timeattack_01",
			"metin2_map_dragon_timeattack_02",
			"metin2_map_dragon_timeattack_03",
			"metin2_map_skipia_dungeon_boss",
			"metin2_map_skipia_dungeon_boss2",
			"metin2_map_devilsCatacomb",
			"metin2_map_deviltower1",
			"metin2_map_t1",
			"metin2_map_t2",
			"metin2_map_t3",
			"metin2_map_t4",
			"metin2_map_t5",
			"metin2_map_wedding_01",
			"metin2_map_duel",
			"metin2_map_orclabyrinth",
			"metin2_map_n_flame_dungeon_01",
			"metin2_map_n_snow_dungeon_01"
		]

you can open the index file from map folder in the server and take the indexes of these maps

and check them in the c++ code ... (server side)

Link to comment
Share on other sites

All maps you are showing are on ch99.

So basically it checks clientside if it is on ch99. 

 

If you don't add ch99 to the index in the mapping it doesn't find it and the function isn't run. 

 

So basically it allready checks it.

 

Also if an port isn't added to the mapping then teleport won't work if you are on this ch

Link to comment
Share on other sites

void CHARACTER::ChannelSwitch(int iNewChannel)
{
        long lAddr, lMapIndex;
        WORD wPort;
        
        long x = GetX();
        long y = 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, GetName());
                return;
        }
        
        if (lMapIndex >= 10000)
                return;
        
        std::map<WORD, BYTE> ChannelsPorts;
        for (BYTE i = 0; i < 4; i++)
        {
                for (BYTE j = 2; j < 9; j++)
                        ChannelsPorts[13 * 1000 + (i * 100) + j] = i + 1;
        }
        
        int iChannel = ChannelsPorts.find(wPort) != ChannelsPorts.end() ? ChannelsPorts[wPort] : 0;
        
        if (iChannel == 0)
        {
                sys_err("This port is not available! (%d)", wPort);
                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));
}

Kind Regards

Ken

Edited by Ken
  • Love 1

Do not be sorry, be better.

Link to comment
Share on other sites

  • 1 month later...

@flygun i have this error

0822 00:11:39668 ::   File "networkModule.py", line 239, in SetGamePhase

0822 00:11:39668 ::   File "game.py", line 111, in __init__

0822 00:11:39668 ::   File "interfaceModule.py", line 294, in MakeInterface

0822 00:11:39668 ::   File "interfaceModule.py", line 229, in __MakeDialogs

0822 00:11:39668 ::   File "uiSystem.py", line 33, in LoadDialog

0822 00:11:39669 ::   File "uiSystem.py", line 48, in __LoadSystemMenu_Default

0822 00:11:39669 ::   File "ui.py", line 2742, in GetChild

0822 00:11:39669 :: KeyError
0822 00:11:39669 :: : 
0822 00:11:39669 :: 'Change_Channel'
0822 00:11:39669 :: 

 

Link to comment
Share on other sites

  • Former Staff

@flygun i have this error

0822 00:11:39668 ::   File "networkModule.py", line 239, in SetGamePhase

0822 00:11:39668 ::   File "game.py", line 111, in __init__

0822 00:11:39668 ::   File "interfaceModule.py", line 294, in MakeInterface

0822 00:11:39668 ::   File "interfaceModule.py", line 229, in __MakeDialogs

0822 00:11:39668 ::   File "uiSystem.py", line 33, in LoadDialog

0822 00:11:39669 ::   File "uiSystem.py", line 48, in __LoadSystemMenu_Default

0822 00:11:39669 ::   File "ui.py", line 2742, in GetChild

0822 00:11:39669 :: KeyError
0822 00:11:39669 :: : 
0822 00:11:39669 :: 'Change_Channel'
0822 00:11:39669 :: 

 

make sure you did the third step 

3: change systemdialog.py in uiscript with this

import uiScriptLocale

ROOT = "d:/ymir work/ui/public/"

window = {
	"name" : "SystemDialog",
	"style" : ("float",),

	"x" : SCREEN_WIDTH/2 - 100,
	"y" : SCREEN_HEIGHT/2 - 114,

	"width" : 200,
	"height" : 298,

	"children" :
	(
		{
			"name" : "board",
			"type" : "thinboard",

			"x" : 0,
			"y" : 0,

			"width" : 200,
			"height" : 298,

			"children" :
			(
				{
					"name" : "Change_Channel",
					"type" : "button",

					"x" : 10,
					"y" : 17,

					"text" : uiScriptLocale.SYSTEM_CHANGE_CH,

					"default_image" : ROOT + "XLarge_Button_01.sub",
					"over_image" : ROOT + "XLarge_Button_02.sub",
					"down_image" : ROOT + "XLarge_Button_03.sub",
				},
				{
					"name" : "help_button",
					"type" : "button",

					"x" : 10,
					"y" : 47,

					"text" : uiScriptLocale.SYSTEM_HELP,

					"default_image" : ROOT + "XLarge_Button_01.sub",
					"over_image" : ROOT + "XLarge_Button_02.sub",
					"down_image" : ROOT + "XLarge_Button_03.sub",
				},

				{
					"name" : "system_option_button",
					"type" : "button",

					"x" : 10,
					"y" : 97,

					"text" : uiScriptLocale.SYSTEMOPTION_TITLE,

					"default_image" : ROOT + "XLarge_Button_01.sub",
					"over_image" : ROOT + "XLarge_Button_02.sub",
					"down_image" : ROOT + "XLarge_Button_03.sub",
				},
				{
					"name" : "game_option_button",
					"type" : "button",

					"x" : 10,
					"y" : 127,

					"text" : uiScriptLocale.GAMEOPTION_TITLE,

					"default_image" : ROOT + "XLarge_Button_01.sub",
					"over_image" : ROOT + "XLarge_Button_02.sub",
					"down_image" : ROOT + "XLarge_Button_03.sub",
				},
				{
					"name" : "change_button",
					"type" : "button",

					"x" : 10,
					"y" : 157,

					"text" : uiScriptLocale.SYSTEM_CHANGE,

					"default_image" : ROOT + "XLarge_Button_01.sub",
					"over_image" : ROOT + "XLarge_Button_02.sub",
					"down_image" : ROOT + "XLarge_Button_03.sub",
				},
				{
					"name" : "logout_button",
					"type" : "button",

					"x" : 10,
					"y" : 187,

					"text" : uiScriptLocale.SYSTEM_LOGOUT,

					"default_image" : ROOT + "XLarge_Button_01.sub",
					"over_image" : ROOT + "XLarge_Button_02.sub",
					"down_image" : ROOT + "XLarge_Button_03.sub",
				},
				{
					"name" : "exit_button",
					"type" : "button",

					"x" : 10,
					"y" : 217,

					"text" : uiScriptLocale.SYSTEM_EXIT,

					"default_image" : ROOT + "XLarge_Button_01.sub",
					"over_image" : ROOT + "XLarge_Button_02.sub",
					"down_image" : ROOT + "XLarge_Button_03.sub",
				},
				{
					"name" : "cancel_button",
					"type" : "button",

					"x" : 10,
					"y" : 257,

					"text" : uiScriptLocale.CANCEL,

					"default_image" : ROOT + "XLarge_Button_01.sub",
					"over_image" : ROOT + "XLarge_Button_02.sub",
					"down_image" : ROOT + "XLarge_Button_03.sub",
				},
			),
		},
	),
}

[\spoiler]

 
Link to comment
Share on other sites

  • 3 weeks later...

@flygun i have this error

0822 00:11:39668 ::   File "networkModule.py", line 239, in SetGamePhase

0822 00:11:39668 ::   File "game.py", line 111, in __init__

0822 00:11:39668 ::   File "interfaceModule.py", line 294, in MakeInterface

0822 00:11:39668 ::   File "interfaceModule.py", line 229, in __MakeDialogs

0822 00:11:39668 ::   File "uiSystem.py", line 33, in LoadDialog

0822 00:11:39669 ::   File "uiSystem.py", line 48, in __LoadSystemMenu_Default

0822 00:11:39669 ::   File "ui.py", line 2742, in GetChild

0822 00:11:39669 :: KeyError
0822 00:11:39669 :: : 
0822 00:11:39669 :: 'Change_Channel'
0822 00:11:39669 :: 

 

help?

Link to comment
Share on other sites

  • 1 month later...
  • 4 weeks later...
4 minutes ago, asterix2 said:

Port ch1: 11002 and etc

Port is 13002, 13102. 

My port is in intrologin.py

    def SetChannelKurwy(self, ch):
        self.SetChannelInfo(ch)
        
        for (channelID, channelButtons) in self.channelButton.items():
            if ch != channelID:
                channelButtons.SetUp()
        
        self.stream.SetConnectInfo("129.131.112.101", self.ChannelPort(ch, 0), "129.131.112.101", self.ChannelPort("LOGIN"))
        net.SetMarkServer("129.131.112.101", self.ChannelPort("LOGO"))
        app.SetGuildMarkPath("10.tga")
        app.SetGuildSymbolPath("10")
        net.SetServerInfo(self.ChannelPort(ch, 2))
        
    def SetChannelInfo(self, ch):
        self.channels = str(ch)
        
    def GetChannel(self):
        return self.channels
        
    def ChannelPort(self, ch="CH1", value=0):
        channel = {
            "CH1"    :    [13002, "SERVERNAME", "CH 1"],
            "CH2"    :    [13102, "SERVERNAME", "CH 2"],}
        
        if ch == "LOGIN":
            return 11004
        elif ch == "LOGO":
            return channel["CH1"][0]
        elif value == 2:
            return "%s, %s" % (channel[ch][1], channel[ch][2])
        else:
            return channel[ch][value]
                
                

Link to comment
Share on other sites

Just now, vladbos35 said:

Port is 13002, 13102. 

My port is in intrologin.py

    def ChannelPort(self, ch="CH1", value=0):
        channel = {
            "CH1"    :    [13002, "SERVER", "CH 1"],
            "CH2"    :    [13102, "SERVER", "CH 2"],

        
        if ch == "LOGIN":
            return 11004
        elif ch == "LOGO":
            return channel["CH1"][0]
        elif value == 2:
            return "%s, %s" % (channel[ch][1], channel[ch][2])
        else:
            return channel[ch][value]
                

hm

Link to comment
Share on other sites

Announcements



×
×
  • 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.