- Mesaj
- 50
- Çözümler
- 3
- Beğeni
- 117
- Puan
- 669
- Ticaret Puanı
- 0
Source > Server > common
service.h
Herhangi bir yere ekle ;
Source > Server > game > src
battle.cpp
Arat ;
Altına ekle ;
char.cpp
Arat ;
Altına ekle ;
Arat ;
Altına ekle ;
En sona ekle ;
char.h
Arat ;
Altına ekle ;
Arat ;
Altına ekle ;
cmd.cpp
Arat ;
Altına ekle ;
Arat ;
Altına Ekle ;
cmd_general.cpp
Arat ;
Altına ekle ;
Arat ;
Altına ekle ;
Arat ;
Altına ekle ;
Source > Server kısmı bitti. Client kısmını düzenleyelim.
Client > UserInterface
Locale_inc.h
Herhangi bir yere ekle ;
PythonApplicationModule.cpp
Arat ;
Altına ekle ;
PythonNetworkStreamPhaseGame.cpp
Arat ;
Altına ekle;
Source > Client kısmı bitti. Server kısmını düzenleyelim.
locale > turkey
locale_string.txt
En alta ekle (Notepad2 kullanarak editleyin) ;
Server kısmı bitti. Client kısmını düzenleyelim.
locale_tr > locale > tr
locale_game.txt
En alta ekle ;
locale_interface.txt
En alta ekle ;
locale_tr > locale > tr > ui
systemdialog.py
Arat ;
Değiştir ;
root
game.py
uygun bir yere ekle;
En alta ekle ;
ui.py
Arat ;
Altına ekle ;
Arat ( ReadingWnd(Bar) classı içerisinde ) ;
Altına ekle ;
ReadingWnd(Bar)'dan sonra, RegisterToolTipWindow("TEXT", TextLine)'dan önce ekle;
uisystem.py
Arat ;
Altına ekle ;
Arat ;
Altına ekle ;
2 kere arat ;
2' sini de değiştir.
Arat ;
Altına ekle ;
Arat ;
Altına ekle ;
Arat ;
Değiştir ;
Arat ;
Üstüne ekle ;
uiscript
movechanneldialog.py adında dosya oluştur.
İçine ekle ;
systemdialog.py
Arat ;
Değiştir ;
char.cpp' de ki satırı portlar ile uyumlu hale getirmek için örnek ;
serverinfo.py ;
char.cpp ;
Benim Ch1 portum "13900" Ch2 portum "13910" bu yüzden char.cpp' deki p.wport satırını -10 +10 olacak şekilde düzenledim.
Örneğin Ch1 portunuz "21000" ve Ch2 portunuz "22000" diyelim.
Artış +1000 şeklinde olduğu için aşağıdaki gibi düzenleme yapmak gerekir.
p.wPort = (wPort - 1000*(g_bChannel-1) + 1000*(channelId-1));
Düzenleme işi bitti. son olarak aşağıdaki linkte ETC içerisine atılacak dosyaları paylaşıyorum.
service.h
Herhangi bir yere ekle ;
service.h:
#define ENABLE_CHANGE_CHANNEL
Source > Server > game > src
battle.cpp
Arat ;
battle.cpp:
bool timed_event_cancel(LPCHARACTER ch)
{
if (ch->m_pkTimedEvent)
{
event_cancel(&ch->m_pkTimedEvent);
return true;
}
Altına ekle ;
battle.cpp:
#ifdef ENABLE_CHANGE_CHANNEL
if (ch->m_pkChangeChannelEvent)
{
event_cancel(&ch->m_pkChangeChannelEvent);
return true;
}
#endif
char.cpp
Arat ;
char.cpp:
m_pkPoisonEvent = NULL;
Altına ekle ;
char.cpp:
#ifdef ENABLE_CHANGE_CHANNEL
m_pkChangeChannelEvent = NULL;
#endif
Arat ;
char.cpp:
event_cancel(&m_pkPoisonEvent);
Altına ekle ;
char.cpp:
#ifdef ENABLE_CHANGE_CHANNEL
event_cancel(&m_pkChangeChannelEvent);
#endif
En sona ekle ;
char.cpp:
#ifdef ENABLE_CHANGE_CHANNEL
void CHARACTER::ChangeChannel(DWORD channelId){
long lAddr;
long lMapIndex;
WORD wPort;
long x = this->GetX();
long y = this->GetY();
if (!CMapLocation::instance().Get(x, y, lMapIndex, lAddr, wPort))
{
sys_err("cannot find map location index %d x %d y %d name %s", lMapIndex, x, y, GetName());
return;
}
if(lMapIndex >= 10000){
this->ChatPacket(CHAT_TYPE_INFO, ("You can't change channel in private map."));
return;
}
//this->ChatPacket(CHAT_TYPE_COMMAND, "RefreshChannel %d", channelId);
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 - 1000*(g_bChannel-1) + 1000*(channelId-1)); // PENTRU MINE FUNCTIONEAZA " 1000* + 1000* ", DACA ATUNCI CAND SCHIMBI CH-UL TE SCOATE LA LOGIN, TREBUIE SCOS UN "0" SAU TREBUIE ADAUGAT.
GetDesc()->Packet(&p, sizeof(TPacketGCWarp));
}
#endif
char.h
Arat ;
char.h:
void CloseMyShop();
Altına ekle ;
char.h:
#ifdef ENABLE_CHANGE_CHANNEL
void ChangeChannel(DWORD channelId);
#endif
Arat ;
char.h:
LPEVENT m_pkPoisonEvent;
Altına ekle ;
char.h:
#ifdef ENABLE_CHANGE_CHANNEL
LPEVENT m_pkChangeChannelEvent;
#endif
cmd.cpp
Arat ;
cmd.cpp:
ACMD(do_user_horse_feed);
Altına ekle ;
cmd.cpp:
#ifdef ENABLE_CHANGE_CHANNEL
ACMD(do_change_channel);
#endif
Arat ;
cmd.cpp:
{ "!RESERVED!", NULL, 0, POS_DEAD, GM_IMPLEMENTOR },
Altına Ekle ;
cmd.cpp:
#ifdef ENABLE_CHANGE_CHANNEL
{ "change_channel", do_change_channel, 0, POS_DEAD, GM_PLAYER },
#endif
cmd_general.cpp
Arat ;
cmd_general.cpp:
EVENTINFO(TimedEventInfo)
{
[...]
};
Altına ekle ;
cmd_general.cpp:
#ifdef ENABLE_CHANGE_CHANNEL
EVENTINFO(ChangeChannelEventInfo)
{
DynamicCharacterPtr ch;
int channel_number;
int left_second;
ChangeChannelEventInfo()
: ch()
, channel_number( 0 )
, left_second( 0 )
{
}
};
#endif
Arat ;
cmd_general.cpp:
EVENTFUNC(timed_event)
{
[...]
}
Altına ekle ;
cmd_general.cpp:
#ifdef ENABLE_CHANGE_CHANNEL
EVENTFUNC(change_channel_event)
{
ChangeChannelEventInfo * info = dynamic_cast<ChangeChannelEventInfo *>( event->info );
if ( info == NULL )
{
sys_err( "change_channel_event> <Factor> Null pointer" );
return 0;
}
LPCHARACTER ch = info->ch;
if (ch == NULL) { // <Factor>
return 0;
}
if (info->left_second <= 0)
{
ch->m_pkChangeChannelEvent = NULL;
ch->ChangeChannel(info->channel_number);
return 0;
}
else
{
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("CH_CHANGING_IN_%d_SECONDS"), info->left_second);
--info->left_second;
}
return PASSES_PER_SEC(1);
}
#endif
Arat ;
cmd_general.cpp:
ACMD(do_cmd)
{
[...]
}
Altına ekle ;
cmd_general.cpp:
#ifdef ENABLE_CHANGE_CHANNEL
ACMD(do_change_channel)
{
char arg1[256];
one_argument(argument, arg1, sizeof(arg1));
DWORD channel_number = 0;
str_to_number(channel_number, arg1);
//if (ch->m_pkChangeChannelEvent)
//{
// ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Change channel canceled."));
// event_cancel(&ch->m_pkChangeChannelEvent);
// return;
//}
if(!ch)
{
return;
}
if(channel_number == 99 || g_bChannel == 99){
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("CH_CANT_CHANGE_MAP"));
return;
}
if (ch->GetMapIndex() == 64 || ch->GetMapIndex() == 210)
{
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("CH_CANT_CHANGE_MAP"));
return;
}
if(channel_number == g_bChannel)
{
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("CH_ALREADY_ON_CHANNEL"));
return;
}
if (ch->IsDead() || ch->GetExchange())
{
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("CH_CANT_WAIT_10_SECONDS"));
return;
}
if(channel_number <= 0 || channel_number > 6)
{
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("CH_NOT_WORKING"));
return;
}
if (channel_number != 0)
{
if (ch->m_pkChangeChannelEvent)
{
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("CH_CANCELED"));
event_cancel(&ch->m_pkChangeChannelEvent);
return;
}
ChangeChannelEventInfo* info = AllocEventInfo<ChangeChannelEventInfo>();
{
if (ch->IsPosition(POS_FIGHTING))
info->left_second = 10;
else
info->left_second = 3;
}
info->ch = ch;
info->channel_number = channel_number;
ch->m_pkChangeChannelEvent = event_create(change_channel_event, info, 1);
}
}
#endif
Source > Server kısmı bitti. Client kısmını düzenleyelim.
Client > UserInterface
Locale_inc.h
Herhangi bir yere ekle ;
Locale_inc.h:
#define ENABLE_MOVE_CHANNEL
PythonApplicationModule.cpp
Arat ;
PythonApplicationModule.cpp:
#ifdef ENABLE_COSTUME_SYSTEM
PyModule_AddIntConstant(poModule, "ENABLE_COSTUME_SYSTEM", 1);
#else
PyModule_AddIntConstant(poModule, "ENABLE_COSTUME_SYSTEM", 0);
#endif
Altına ekle ;
PythonApplicationModule.cpp:
#ifdef ENABLE_MOVE_CHANNEL
PyModule_AddIntConstant(poModule, "ENABLE_MOVE_CHANNEL", 1);
#else
PyModule_AddIntConstant(poModule, "ENABLE_MOVE_CHANNEL", 0);
#endif
PythonNetworkStreamPhaseGame.cpp
Arat ;
PythonNetworkStreamPhaseGame.cpp:
bool CPythonNetworkStream::RecvChannelPacket()
{
TPacketGCChannel kChannelPacket;
if (!Recv(sizeof(kChannelPacket), &kChannelPacket))
return false;
//Tracef(" >> CPythonNetworkStream::RecvChannelPacket(channel=%d)\n", kChannelPacket.channel);
Altına ekle;
PythonNetworkStreamPhaseGame.cpp:
#ifdef ENABLE_MOVE_CHANNEL
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "RefreshChannel", Py_BuildValue("(i)", kChannelPacket.channel));
#endif
Source > Client kısmı bitti. Server kısmını düzenleyelim.
locale > turkey
locale_string.txt
En alta ekle (Notepad2 kullanarak editleyin) ;
locale_string.txt:
"CH_CHANGING_IN_%d_SECONDS";
"%d saniye sonra kanal değişecek.";
"CH_CANT_CHANGE_MAP";
"Bu haritada kanal değiştiremezsin.";
"CH_ALREADY_ON_CHANNEL";
"Zaten bu kanaldasın.";
"CH_CANT_WAIT_10_SECONDS";
"Kanal değiştirilemiyor. Lütfen 10 saniye bekle.";
"CH_NOT_WORKING";
"Bu kanal şu an aktif değil.";
"CH_CANCELED";
"Kanal değişikliği iptal edildi.";
Server kısmı bitti. Client kısmını düzenleyelim.
locale_tr > locale > tr
locale_game.txt
En alta ekle ;
locale_game.txt:
MOVE_CHANNEL_99 CH0
MOVE_CHANNEL_CANCEL İptal
MOVE_CHANNEL_NOTICE Zaten %d bağlısın.
MOVE_CHANNEL_NOT_MOVE Kanal değiştiremezsin.
MOVE_CHANNEL_SELECT Tamam
MOVE_CHANNEL_TITLE Kanal Değiştir
locale_interface.txt
En alta ekle ;
locale_interface.txt:
MOVE_CHANNEL_TITLE Kanal Değiştir
locale_tr > locale > tr > ui
systemdialog.py
Arat ;
systemdialog.py:
{
"name" : "help_button",
"type" : "button",
"x" : 10,
"y" : 17,
"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",
},
Değiştir ;
systemdialog.py:
{
"name" : "movechannel_button",
"type" : "button",
"x" : 10,
"y" : 17,
"text" : uiScriptLocale.MOVE_CHANNEL_TITLE,
"text_color" : 0xffF8BF24,
"default_image" : ROOT + "XLarge_Button_01.sub",
"over_image" : ROOT + "XLarge_Button_02.sub",
"down_image" : ROOT + "XLarge_Button_03.sub",
},
root
game.py
uygun bir yere ekle;
game.py:
import serverInfo
En alta ekle ;
game.py:
if app.ENABLE_MOVE_CHANNEL:
def __GetServerID(self):
serverID = 1
for i in serverInfo.REGION_DICT[0].keys():
if serverInfo.REGION_DICT[0][i]["name"] == net.GetServerInfo().split(",")[0]:
serverID = int(i)
break
return serverID
def RefreshChannel(self, channel):
channelName = ""
serverName = serverInfo.REGION_DICT[0][self.__GetServerID()]["name"]
if channel in serverInfo.REGION_DICT[0][self.__GetServerID()]["channel"]:
channelName = serverInfo.REGION_DICT[0][self.__GetServerID()]["channel"][int(channel)]["name"]
elif channel == 99:
channelName = "Special CH"
else:
channelName = "Unknow CH"
net.SetServerInfo("%s, %s" % (serverName,channelName))
if self.interface:
self.interface.wndMiniMap.serverInfo.SetText(net.GetServerInfo())
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.MOVE_CHANNEL_NOTICE % (channel))
# app.ChangeTitle(net.GetServerInfo())
ui.py
Arat ;
ui.py:
elif Type == "thinboard":
parent.Children[Index] = ThinBoard()
parent.Children[Index].SetParent(parent)
self.LoadElementThinBoard(parent.Children[Index], ElementValue, parent)
Altına ekle ;
ui.py:
elif Type == "thinboard_circle":
parent.Children[Index] = ThinBoardCircle()
parent.Children[Index].SetParent(parent)
self.LoadElementThinBoard(parent.Children[Index], ElementValue, parent)
Arat ( ReadingWnd(Bar) classı içerisinde ) ;
ui.py:
def MakeButton(parent, x, y, tooltipText, path, up, over, down):
button = Button()
button.SetParent(parent)
button.SetPosition(x, y)
button.SetUpVisual(path + up)
button.SetOverVisual(path + over)
button.SetDownVisual(path + down)
button.SetToolTipText(tooltipText)
button.Show()
return button
Altına ekle ;
ui.py:
if app.ENABLE_MOVE_CHANNEL:
def MakeRadioButton(parent, x, y, path, up, over, down):
button = RadioButton()
button.SetParent(parent)
button.SetPosition(x, y)
button.SetUpVisual(path + up)
button.SetOverVisual(path + over)
button.SetDownVisual(path + down)
button.Show()
return button
ReadingWnd(Bar)'dan sonra, RegisterToolTipWindow("TEXT", TextLine)'dan önce ekle;
ui.py:
class ThinBoardCircle(Window):
CORNER_WIDTH = 4
CORNER_HEIGHT = 4
LINE_WIDTH = 4
LINE_HEIGHT = 4
BOARD_COLOR = grp.GenerateColor(0.0, 0.0, 0.0, 1.0)
LT = 0
LB = 1
RT = 2
RB = 3
L = 0
R = 1
T = 2
B = 3
def __init__(self, layer = "UI"):
Window.__init__(self, layer)
CornerFileNames = [ "d:/ymir work/ui/pattern/thinboard_circle/thinboard_corner_"+dir+"_circle.tga" for dir in ["lefttop","leftbottom","righttop","rightbottom"] ]
LineFileNames = [ "d:/ymir work/ui/pattern/thinboard_circle/thinboard_line_"+dir+"_circle.tga" for dir in ["left","right","top","bottom"] ]
self.Corners = []
for fileName in CornerFileNames:
Corner = ExpandedImageBox()
Corner.AddFlag("attach")
Corner.AddFlag("not_pick")
Corner.LoadImage(fileName)
Corner.SetParent(self)
Corner.SetPosition(0, 0)
Corner.Show()
self.Corners.append(Corner)
self.Lines = []
for fileName in LineFileNames:
Line = ExpandedImageBox()
Line.AddFlag("attach")
Line.AddFlag("not_pick")
Line.LoadImage(fileName)
Line.SetParent(self)
Line.SetPosition(0, 0)
Line.Show()
self.Lines.append(Line)
Base = Bar()
Base.SetParent(self)
Base.AddFlag("attach")
Base.AddFlag("not_pick")
Base.SetPosition(self.CORNER_WIDTH, self.CORNER_HEIGHT)
Base.SetColor(self.BOARD_COLOR)
Base.Show()
self.Base = Base
self.ButtonText = None
self.BonusId = 0
self.Lines[self.L].SetPosition(0, self.CORNER_HEIGHT)
self.Lines[self.T].SetPosition(self.CORNER_WIDTH, 0)
def __del__(self):
Window.__del__(self)
def SetSize(self, width, height):
width = max(self.CORNER_WIDTH*2, width)
height = max(self.CORNER_HEIGHT*2, height)
Window.SetSize(self, width, height)
self.Corners[self.LB].SetPosition(0, height - self.CORNER_HEIGHT)
self.Corners[self.RT].SetPosition(width - self.CORNER_WIDTH, 0)
self.Corners[self.RB].SetPosition(width - self.CORNER_WIDTH, height - self.CORNER_HEIGHT)
self.Lines[self.R].SetPosition(width - self.CORNER_WIDTH, self.CORNER_HEIGHT)
self.Lines[self.B].SetPosition(self.CORNER_HEIGHT, height - self.CORNER_HEIGHT)
verticalShowingPercentage = float((height - self.CORNER_HEIGHT*2) - self.LINE_HEIGHT) / self.LINE_HEIGHT
horizontalShowingPercentage = float((width - self.CORNER_WIDTH*2) - self.LINE_WIDTH) / self.LINE_WIDTH
self.Lines[self.L].SetRenderingRect(0, 0, 0, verticalShowingPercentage)
self.Lines[self.R].SetRenderingRect(0, 0, 0, verticalShowingPercentage)
self.Lines[self.T].SetRenderingRect(0, 0, horizontalShowingPercentage, 0)
self.Lines[self.B].SetRenderingRect(0, 0, horizontalShowingPercentage, 0)
self.Base.SetSize(width - self.CORNER_WIDTH*2, height - self.CORNER_HEIGHT*2)
def SetText(self, text):
if not self.ButtonText:
textLine = TextLine()
textLine.SetParent(self)
textLine.SetPosition(self.GetWidth()/2, self.GetHeight()/2)
textLine.SetVerticalAlignCenter()
textLine.SetHorizontalAlignCenter()
textLine.Show()
self.ButtonText = textLine
self.ButtonText.SetText(text)
def GetText(self):
if not self.ButtonText:
return ""
return self.ButtonText.GetText()
def SetBonusId(self, bnsId):
self.BonusId = bnsId
def GetBonusId(self):
if self.BonusId != 0:
return self.BonusId
def ShowInternal(self):
self.Base.Show()
for wnd in self.Lines:
wnd.Show()
for wnd in self.Corners:
wnd.Show()
def HideInternal(self):
self.Base.Hide()
for wnd in self.Lines:
wnd.Hide()
for wnd in self.Corners:
wnd.Hide()
uisystem.py
Arat ;
uisystem.py:
SYSTEM_MENU_FOR_PORTAL = FALSE
Altına ekle ;
uisystem.py:
if app.ENABLE_MOVE_CHANNEL:
import chat,serverInfo,ServerStateChecker
Arat ;
uisystem.py:
self.gameOptionDlg = None
Altına ekle ;
uisystem.py:
if app.ENABLE_MOVE_CHANNEL:
self.moveChannelDlg = None
2 kere arat ;
uisystem.py:
self.GetChild("help_button").SAFE_SetEvent(self.__ClickHelpButton)
2' sini de değiştir.
uisystem.py:
# self.GetChild("help_button").SAFE_SetEvent(self.__ClickHelpButton)
Arat ;
uisystem.py:
if constInfo.IN_GAME_SHOP_ENABLE:
self.GetChild("mall_button").SAFE_SetEvent(self.__ClickInGameShopButton)
Altına ekle ;
uisystem.py:
if app.ENABLE_MOVE_CHANNEL:
self.GetChild("movechannel_button").SAFE_SetEvent(self.__ClickMoveChannel)
Arat ;
uisystem.py:
if self.systemOptionDlg:
self.systemOptionDlg.Destroy()
Altına ekle ;
uisystem.py:
if app.ENABLE_MOVE_CHANNEL:
if self.moveChannelDlg:
self.moveChannelDlg.Destroy()
Arat ;
uisystem.py:
def __ClickHelpButton(self):
self.Close()
if None != self.eventOpenHelpWindow:
self.eventOpenHelpWindow()
Değiştir ;
uisystem.py:
if app.ENABLE_MOVE_CHANNEL:
def __ClickMoveChannel(self):
self.Close()
if not self.moveChannelDlg:
self.moveChannelDlg = MoveChannelWindow()
self.moveChannelDlg.Show()
# def __ClickHelpButton(self):
# self.Close()
# if None != self.eventOpenHelpWindow:
# self.eventOpenHelpWindow()
Arat ;
uisystem.py:
if __name__ == "__main__":
Üstüne ekle ;
uisystem.py:
class MoveChannelWindow(ui.ScriptWindow):
def __init__(self):
ui.ScriptWindow.__init__(self)
self.titleBar = None
ServerStateChecker.Create(self)
self.channelButtonList = []
self.currentChannel = 0
self.__LoadBoard()
self.RefreshChannelButtons()
self.Show()
self.SetCenterPosition()
self.RefreshBeforeShow()
def __del__(self):
ui.ScriptWindow.__del__(self)
#print " =============================== DESTROIED MoveChannelWindow"
def __LoadBoard(self):
try:
pyScrLoader = ui.PythonScriptLoader()
pyScrLoader.LoadScriptFile(self, "UIScript/MoveChannelDialog.py")
except:
import exception
exception.Abort("MoveChannelWindow.__LoadBoard.LoadScript")
try:
self.board = self.GetChild("MoveChannelBoard")
self.titleBar = self.GetChild("MoveChannelTitle")
self.blackBoard = self.GetChild("BlackBoard")
self.okButton = self.GetChild("AcceptButton")
self.cancelButton = self.GetChild("CancelButton")
except:
import exception
exception.Abort("MoveChannelWindow.__LoadBoard.BindObject")
self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
self.okButton.SetEvent(ui.__mem_func__(self.ChangeChannel))
self.cancelButton.SetEvent(ui.__mem_func__(self.Close))
self.SetCurentChannel()
self.AddChannels()
def SetCurentChannel(self):
try:
self.currentChannel = int( int(net.GetServerInfo().split(",")[1][-1:]) - 1 )
except:
return
def __GetServerID(self):
for i in serverInfo.REGION_DICT[0].keys():
if serverInfo.REGION_DICT[0][i]["name"] == net.GetServerInfo().split(",")[0]:
serverID = int(i)
break
return serverID
def __GetChannelNumber(self):
serverID = self.__GetServerID()
try:
channelDict = serverInfo.REGION_DICT[0][serverID]["channel"]
except:
return
return len(channelDict)
def RefreshBeforeShow(self):
self.__RequestServerStateList()
def __RequestServerStateList(self):
try:
channelDict = serverInfo.REGION_DICT[0][self.__GetServerID()]["channel"]
except:
return
ServerStateChecker.Initialize(self)
for id, channelDataDict in channelDict.items():
key = channelDataDict["key"]
ip = channelDataDict["ip"]
udp_port = channelDataDict["udp_port"]
ServerStateChecker.AddChannel(key, ip, udp_port)
ServerStateChecker.Request()
def NotifyChannelState(self, addrKey, state):
try:
stateName = serverInfo.STATE_DICT[state]
except:
stateName = serverInfo.STATE_NONE
regionID = int(addrKey / 1000)
serverID = int(addrKey / 10) % 100
channelID = addrKey % 10
try:
serverInfo.REGION_DICT[regionID][serverID]["channel"][channelID]["state"] = stateName
self.__RefreshChannelStateList()
except:
pass
def AddChannels(self):
self.SetSize(190,80+30*self.__GetChannelNumber())
self.board.SetSize(190,80+30*self.__GetChannelNumber())
self.blackBoard.SetSize(163,7+30*self.__GetChannelNumber())
for i in xrange(self.__GetChannelNumber()):
self.channelButtonList.append(ui.MakeRadioButton(self.blackBoard, 7, 7+30*i, "d:/ymir work/ui/game/move_channel/", "select_btn_01.sub", "select_btn_02.sub", "select_btn_03.sub"))
self.channelButtonList[i].SetText(str(serverInfo.REGION_DICT[0][self.__GetServerID()]["channel"][i+1]["name"]))
self.channelButtonList[i].SetEvent(lambda arg=i: self.SelectChannel(arg))
self.channelButtonList[i].Show()
def SelectChannel(self,channel):
self.currentChannel = channel
self.RefreshChannelButtons()
def RefreshChannelButtons(self):
for i in xrange(self.__GetChannelNumber()):
if i == self.currentChannel:
self.channelButtonList[i].Down()
else:
self.channelButtonList[i].SetUp()
def ChangeChannel(self):
ServerStateChecker.Update()
channelID = self.currentChannel+1
channelState = serverInfo.REGION_DICT[0][self.__GetServerID()]["channel"][channelID]["state"]
if not channelID:
return
if channelState == serverInfo.STATE_NONE or channelState == serverInfo.STATE_DICT[0]:
chat.AppendChat(chat.CHAT_TYPE_INFO , "Acest canal este offline")
return
self.Close()
net.SendChatPacket("/change_channel " + str(channelID))
def Destroy(self):
self.ClearDictionary()
self.Hide()
def Close(self):
ServerStateChecker.Initialize(self)
self.Hide()
def OnUpdate(self):
ServerStateChecker.Update()
def OnPressEscapeKey(self):
self.Close()
return True
uiscript
movechanneldialog.py adında dosya oluştur.
İçine ekle ;
movechanneldialog.py:
import localeInfo
window = {
"name" : "MoveChannelDialog",
"style" : ("movable", "float", "ltr"),
"x" : (SCREEN_WIDTH/2) - (190/2),
"y" : (SCREEN_HEIGHT/2) - 100,
"width" : 0,
"height" : 0,
"children" :
(
## MainBoard
{
"name" : "MoveChannelBoard",
"type" : "board",
"style" : ("attach", "ltr"),
"x" : 0,
"y" : 0,
"width" : 0,
"height" : 0,
"children" :
(
## Title Bar
{
"name" : "MoveChannelTitle",
"type" : "titlebar",
"style" : ("attach",),
"x" : 6, "y" : 7, "width" : 190 - 13,
"children" :
(
{ "name" : "TitleName", "type" : "text", "x" : 0, "y" : 0, "text": localeInfo.MOVE_CHANNEL_TITLE, "all_align":"center" },
),
},
{
"name" : "BlackBoard",
"type" : "thinboard_circle", #_circle
"x" : 13, "y" : 36, "width" : 0, "height" : 0,
},
{
"name" : "AcceptButton",
"type" : "button",
"x" : 15,
"y" : 30,
"vertical_align" : "bottom",
"width" : 61,
"height" : 21,
"text" : localeInfo.MOVE_CHANNEL_SELECT,
"default_image" : "d:/ymir work/ui/public/middle_button_01.sub",
"over_image" : "d:/ymir work/ui/public/middle_button_02.sub",
"down_image" : "d:/ymir work/ui/public/middle_button_03.sub",
},
{
"name" : "CancelButton",
"type" : "button",
"x" : 115,
"y" : 30,
"vertical_align" : "bottom",
"width" : 61,
"height" : 21,
"text" : localeInfo.MOVE_CHANNEL_CANCEL,
"default_image" : "d:/ymir work/ui/public/middle_button_01.sub",
"over_image" : "d:/ymir work/ui/public/middle_button_02.sub",
"down_image" : "d:/ymir work/ui/public/middle_button_03.sub",
},
),
}, ## MainBoard End
),
}
systemdialog.py
Arat ;
systemdialog.py:
{
"name" : "help_button",
"type" : "button",
"x" : 10,
"y" : 17,
"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",
},
Değiştir ;
systemdialog.py:
{
"name" : "movechannel_button",
"type" : "button",
"x" : 10,
"y" : 17,
"text" : uiScriptLocale.MOVE_CHANNEL_TITLE,
"text_color" : 0xffF8BF24,
"default_image" : ROOT + "XLarge_Button_01.sub",
"over_image" : ROOT + "XLarge_Button_02.sub",
"down_image" : ROOT + "XLarge_Button_03.sub",
},
char.cpp' de ki satırı portlar ile uyumlu hale getirmek için örnek ;
serverinfo.py ;
serverinfo.py:
import app
app.ServerName = None
SERVER1 = {
"name" : "Platinium",
"host" : "192.168.1.42",
"auth" : 11900,
"ch1" : 13900,
"ch2" : 13910,
}
STATE_NONE = "..."
STATE_DICT = {
0 : "....",
1 : "Normal",
2 : "Meşgul",
3 : "Full"
}
SERVER01_CHANNEL_DICT = {
1:{"key":11, "name":"CH1", "ip":SERVER1["host"], "tcp_port":SERVER1["ch1"], "udp_port":SERVER1["ch1"], "state":STATE_NONE,},
2:{"key":12, "name":"CH2", "ip":SERVER1["host"], "tcp_port":SERVER1["ch2"], "udp_port":SERVER1["ch2"], "state":STATE_NONE,},
}
REGION_NAME_DICT = {
0 : SERVER1["name"],
}
REGION_AUTH_SERVER_DICT = {
0 : {
1 : { "ip":SERVER1["host"], "port":SERVER1["auth"], },
}
}
REGION_DICT = {
0 : {
1 : { "name" :SERVER1["name"], "channel" : SERVER01_CHANNEL_DICT, },
},
}
MARKADDR_DICT = {
10 : { "ip" : SERVER1["host"], "tcp_port" : SERVER1["ch1"], "mark" : "10.tga", "symbol_path" : "10", },
}
char.cpp ;
char.cpp:
p.wPort = (wPort - 10*(g_bChannel-1) + 10*(channelId-1));
Benim Ch1 portum "13900" Ch2 portum "13910" bu yüzden char.cpp' deki p.wport satırını -10 +10 olacak şekilde düzenledim.
Örneğin Ch1 portunuz "21000" ve Ch2 portunuz "22000" diyelim.
Artış +1000 şeklinde olduğu için aşağıdaki gibi düzenleme yapmak gerekir.
p.wPort = (wPort - 1000*(g_bChannel-1) + 1000*(channelId-1));
Düzenleme işi bitti. son olarak aşağıdaki linkte ETC içerisine atılacak dosyaları paylaşıyorum.
Burayı görüntülemek için üye girişi yapmalı veya kayıt olmalısınız.
Son düzenleme: