Hello guys
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?
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!}")