Jump to content
Forgot your email address? ×
×
×
  • Create New...
  • 0

InGame channel switch


BlackWidow

Question

  • Premium

Hello guys :o

I tried / wanted to add the IG ChannelSwitch "system" to my client.

But I found out that it's harder than I thought.

With the buttons I don't have any prolems.

They're looking wonderful.

But I have a problm with their function

The buttons have this function

        self.GetChild("ChWechseln").SAFE_SetEvent(self.__Phiro2CH)
        self.GetChild("ChWechseln2").SAFE_SetEvent(self.__Phiro2CH)
        self.GetChild("ChWechseln3").SAFE_SetEvent(self.__Phiro2CH)
        self.GetChild("ChWechseln4").SAFE_SetEvent(self.__Phiro2CH)

And here I got stuck. I don't really know how to made the
buttons, so that they're working

 

Could somebody help me? :unsure:

I found something, but I still don't jnow what to do

import ui
import net
import app
import chat
import math
import wndMgr
import serverInfo
import background
import ServerStateChecker

    def __IsSpecialMap(self):
        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"
        ]
        if str(background.GetCurrentMapName()) in dis_maps:
            return TRUE
        return FALSE

    def __OnSelectChannel(self):
        if self.ChangeButton.IsDown():
            self.EnableChangeButton()

    def __OnClickConnectButton(self):
        regionID = self.__GetRegionID()
        serverID = self.__GetServerID()
        channelID = self.ChannelList.GetSelectedItem()
        if not channelID:
            chat.AppendChat(1, "Erfolgreich!")
            return

        try:
            serverName = serverInfo.REGION_DICT[regionID][serverID]["name"]
            channelName = serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["name"]
            addrKey = serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["key"]
            ip = serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["ip"]
            tcp_port = serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["tcp_port"]
            state = serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["state"]

            account_ip = serverInfo.REGION_AUTH_SERVER_DICT[regionID][serverID]["ip"]
            account_port = serverInfo.REGION_AUTH_SERVER_DICT[regionID][serverID]["port"]

            markKey = regionID * 1000 + serverID * 10
            markAddrValue=serverInfo.MARKADDR_DICT[markKey]
            net.SetMarkServer(markAddrValue["ip"], markAddrValue["tcp_port"])
            app.SetGuildMarkPath(markAddrValue["mark"])
            app.SetGuildSymbolPath(markAddrValue["symbol_path"])
        except:
            chat.AppendChat(1, "Ein Fehler ist während des Logn Vorgang aufgetreten!")
            return

        if state == serverInfo.STATE_NONE:
            chat.AppendChat(1, "Der ausgewählte channel ist nicht verfügbar!")
            return
        elif state == serverInfo.STATE_DICT[3]:
            chat.AppendChat(1, "Der ausgewählte channel ist voll!")
            return
        elif net.GetServerInfo().strip().split(", ")[1] == self.ChannelList.textDict[self.ChannelList.selectedLine].strip().split(" ")[0]:
            chat.AppendChat(1, "Du befindest dich schon auf diesen channel!")
            return
        elif self.__IsSpecialMap():
            chat.AppendChat(1, "Auf diese Map kannst du den channel nicht wechseln!")
            return

        self.Close()
        net.SetServerInfo("%s, %s" % (serverName, channelName))
        self.DirectConnect(ip, tcp_port, account_ip, account_port)

    def DirectConnect(self, ChannelIP, ChannelPort, AuthServerIP, AuthServerPort):
        net.SetLoginInfo(decode_string(net.ACCOUNT_ID), decode_string(net.ACCOUNT_PW))
        net.ConnectToAccountServer(ChannelIP, ChannelPort, AuthServerIP, AuthServerPort)
        net.DirectEnter(0)
        net.SendSelectCharacterPacket(0)
        net.SendEnterGamePacket()

    def Show(self):
        ui.ScriptWindow.Show(self)

    def Close(self):
        ServerStateChecker.Destroy(self)
        self.Hide()
        return TRUE

    def OnPressEscapeKey(self):
        self.Close()
        return TRUE

    def OnUpdate(self):
        ServerStateChecker.Update()

iom = ChannelChanger()
iom.Show()
chat.AppendChat(1, "#P2#{Erfolgreich!}")
  • Love 1
Link to comment

9 answers to this question

Recommended Posts

  • 0
  • Premium

Do you need this sytem or... ? I don't understand your problem.

 

The both piece of code looks like different people wrote it, so you are searching this system ?

Link to comment
  • 0
  • Premium

I've made the functions for the buttons.

And I found the code for such a system

on the Internet. And now I need a little bit

of help, to combine bought. It would be nice

if someone could give me an Advice or

something how to combine bought :D

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Announcements

  • -15% Discount in Metin2 Dev Store (01/10/2021 => 31/12/2021) => Code => 15_PCT_OCT_TO_DEC_2021


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.