You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

66 lines
1.7 KiB

import json
def MakeRealm(realmId, name, status=1, openTime=None):
realm = {}
realm["realmId"] = realmId
realm["name"] = name
realm["status"] = status
realm["bdcName"] = str(10000 + realmId)
if openTime == None:
openTime = "2021-10-02 10:00:00"
realm["openTime"] = openTime
return realm
def GetRealmList(realmCount, worldCount=1):
realmListDict = {}
realmList = []
for j in range(worldCount):
worldRealmList = []
tempRealm = {}
# tempRealm['worldId'] = j+1
tempRealm['worldId'] = 1
tempRealm['gate'] = ["$realmgateurl$"]
tempRealm['chatGate'] = ["$chatgateurl$"]
for i in range(realmCount):
tempRealmName = "testRealm"+ str(j+1) + "-" + str(i+1)
tempworldRealm = MakeRealm(i+1, tempRealmName)
worldRealmList.append(tempworldRealm)
tempRealm["worldRealmList"] = worldRealmList
realmList.append(tempRealm)
realmListDict['realmList'] = realmList
return realmListDict
def SetRealmListToFile(filePath, realmDict):
with open(filePath, "w+", encoding="utf-8") as f:
json.dump(realmDict, f)
return
def SetRealmName(clusterPath, realmColunt):
with open(clusterPath,"rw",encoding='utf-8') as f:
cluster = json.load(f)
bussiness = cluster["bussiness"]
for data in list(bussiness):
if data["businessname"] == "mgame@tcp":
paramStr = data["param"]
return
count = 5
realmPath = "E:\\Code\\arpg_svr_proj\\cfg\\standalone\\Realmlist\\realmList.json"
# realmPath = "E:\\Code\\arpg_svr_proj\\Test\\Realmlist\\realmList.json"
SetRealmListToFile(realmPath, GetRealmList(count))