Skocz do zawartości
  • 👋 Witaj na MPCForum!

    Przeglądasz forum jako gość, co oznacza, że wiele świetnych funkcji jest jeszcze przed Tobą! 😎

    • Pełny dostęp do działów i ukrytych treści
    • Możliwość pisania i odpowiadania w tematach
    • System prywatnych wiadomości
    • Zbieranie reputacji i rozwijanie swojego profilu
    • Członkostwo w jednej z największych społeczności graczy

    👉 Dołączenie zajmie Ci mniej niż minutę – a zyskasz znacznie więcej!

    Zarejestruj się teraz

[Tut]Edycja serverinfo


GameMania

Rekomendowane odpowiedzi

Opublikowano

Witam dzisiaj chce napisać tut o edytowaniu serverinfo do kamer moda.

Pokaże wam jak zedytować oraz dam gotowe.

 

A więc kod zawierający 1 serwer:

 

 

 

 import locale
def BuildServerList(orderList):
retMarkAddrDict = {}
retAuthAddrDict = {}
retRegion0 = {}

ridx = 1
for region, auth, mark, channels in orderList:
cidx = 1
channelDict = {}
for channel in channels:
key = ridx * 10 + cidx
channel['key'] = key
channelDict[cidx] = channel
cidx += 1

region['channel'] = channelDict

retRegion0[ridx] = region
retAuthAddrDict[ridx] = auth
retMarkAddrDict[ridx*10] = mark
ridx += 1

return retRegion0, retAuthAddrDict, retMarkAddrDict
if locale.IsEUROPE():
STATE_NONE = '...'

STATE_DICT = {
0 : '....',
1 : 'NORM',
2 : 'BUSY',
3 : 'FULL',
}

CHANNELS1 = [
{'name':'CH1','ip':'000.00.000.00','tcp_port':13001,'udp_port':13001,'state':STATE_NONE,},
]
MARK1 = { 'ip' : '000.00.000.00', 'tcp_port' : 13001, 'mark' : '120.tga', 'symbol_path' : '120', }
AUTH1 = {'ip':'000.00.000.00','port':11201, }
NAME1 = { 'name' : 'Serwerek'}
REGION0_ORDER_LIST = [
(NAME1, AUTH1, MARK1, CHANNELS1),
]
NEW_REGION0, NEW_REGION0_AUTH_SERVER_DICT, NEW_MARKADDR_DICT = BuildServerList(REGION0_ORDER_LIST)
# RESULT
NEW_REGION_NAME_DICT = {0 : 'POLAND',}
NEW_REGION_AUTH_SERVER_DICT = {0 : NEW_REGION0_AUTH_SERVER_DICT,}
NEW_REGION_DICT = {0 : NEW_REGION0,}

MARKADDR_DICT = NEW_MARKADDR_DICT
REGION_DICT = NEW_REGION_DICT
REGION_NAME_DICT = NEW_REGION_NAME_DICT
REGION_AUTH_SERVER_DICT = NEW_REGION_AUTH_SERVER_DICT

TESTADDR = { 'ip' : '210.123.10.153', 'tcp_port' : 50000, 'udp_port' : 50000, }

 

 

To co potrzebujemy zedytować to te linijki:

 

 

{'name':'CH1','ip':'000.00.000.00','tcp_port':13001,'udp_port':13001,'state':STATE_NONE,},

]

MARK1 = { 'ip' : '000.00.000.00', 'tcp_port' : 13001, 'mark' : '120.tga', 'symbol_path' : '120', }

AUTH1 = {'ip':'000.00.000.00','port':11201, }

NAME1 = { 'name' : 'Serwerek'}

 

Czerwony - IP serwera

Żółty - Nazwa serwera

 

Czasami trzeba także zmienić port który zaznaczyłem tym kolorem.

 

To tera gotowy kod, przy którym edytujemy 3 napisy

 

- TUTAJ IP (Przykład: 123.45.678.90)

- TUTAJ PORT (Standardowy: 11002)

- TUTAJ NAZWA

 

Jak będziecie edytować to usuwać tylko to co napisane TUTAJ NAZWA bez żadnych spacji itp.

Dokładnie jak będzie 'TUTAJ NAZWA' to po usunięciu powinno być ''

 

Gotowy kod:

 

 

import locale
def BuildServerList(orderList):
retMarkAddrDict = {}
retAuthAddrDict = {}
retRegion0 = {}

ridx = 1
for region, auth, mark, channels in orderList:
cidx = 1
channelDict = {}
for channel in channels:
key = ridx * 10 + cidx
channel['key'] = key
channelDict[cidx] = channel
cidx += 1

region['channel'] = channelDict

retRegion0[ridx] = region
retAuthAddrDict[ridx] = auth
retMarkAddrDict[ridx*10] = mark
ridx += 1

return retRegion0, retAuthAddrDict, retMarkAddrDict
if locale.IsEUROPE():
STATE_NONE = '...'

STATE_DICT = {
0 : '....',
1 : 'NORM',
2 : 'BUSY',
3 : 'FULL',
}

CHANNELS1 = [
{'name':'CH1','ip':'TUTAJ IP','tcp_port':TUTAJ PORT,'udp_port':TUTAJ PORT,'state':STATE_NONE,},
]
MARK1 = { 'ip' : 'TUTAJ IP', 'tcp_port' : TUTAJ PORT, 'mark' : '120.tga', 'symbol_path' : '120', }
AUTH1 = {'ip':'TUTAJ IP','port':11201, }
NAME1 = { 'name' : 'TUTAJ NAZWA'}
REGION0_ORDER_LIST = [
(NAME1, AUTH1, MARK1, CHANNELS1),
]
NEW_REGION0, NEW_REGION0_AUTH_SERVER_DICT, NEW_MARKADDR_DICT = BuildServerList(REGION0_ORDER_LIST)
# RESULT
NEW_REGION_NAME_DICT = {0 : 'POLAND',}
NEW_REGION_AUTH_SERVER_DICT = {0 : NEW_REGION0_AUTH_SERVER_DICT,}
NEW_REGION_DICT = {0 : NEW_REGION0,}

MARKADDR_DICT = NEW_MARKADDR_DICT
REGION_DICT = NEW_REGION_DICT
REGION_NAME_DICT = NEW_REGION_NAME_DICT
REGION_AUTH_SERVER_DICT = NEW_REGION_AUTH_SERVER_DICT

TESTADDR = { 'ip' : '210.123.10.153', 'tcp_port' : 50000, 'udp_port' : 50000, }

 

 

Tut 100% by me, licze na lajki.

 

Dałem kody w spoiler.

jedeny.png

Zarchiwizowany

Ten temat przebywa obecnie w archiwum. Dodawanie nowych odpowiedzi zostało zablokowane.

×
×
  • Dodaj nową pozycję...