From 19e0109ec1e936204cb85362d2e3f705b8b9554c Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期四, 03 十二月 2020 11:19:38 +0800 Subject: [PATCH] 8585 【主干】【BT】【长尾】【后端】竞技场(封包) --- ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py | 33 ++++++++++++++++++++++++++++++++- 1 files changed, 32 insertions(+), 1 deletions(-) diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py index 4968286..ae54f4e 100644 --- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py +++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py @@ -44,6 +44,7 @@ import time import random import copy +import urllib #import psyco #--------------------------------------------------------------------- GameWorldData = IPY_GameServer.IPY_GameWorld() @@ -543,6 +544,15 @@ @param dateInfo: 运营活动表配置的日期信息, 如果是纯数字代表开服天 @param openServerDay: 当前开服天 ''' + if not dateInfo: + curDateTime = datetime.datetime.today() + return "%d-%d-%d" % (curDateTime.year, curDateTime.month, curDateTime.day) + if dateInfo.startswith("W"): + curDateTime = datetime.datetime.today() + curWeekday = curDateTime.weekday() + 1 + actionWeekday = int(dateInfo[1:]) + actionDateTime = curDateTime + datetime.timedelta(days=(actionWeekday-curWeekday)) + return "%d-%d-%d" % (actionDateTime.year, actionDateTime.month, actionDateTime.day) if dateInfo.startswith("Mix"): diffDay = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_MixServerDay) + 1 actionServerDay = int(dateInfo[3:]) @@ -838,6 +848,14 @@ def GetDatetimeBySubDays(diffDays): return datetime.datetime.today() - datetime.timedelta(days = diffDays) +def GetDailyDateStr(): + ## 获取日常日期 yyyy-MM-dd + curDate = GetServerTime() + if curDate.hour >= ShareDefine.Def_OnEventHour: + return "%d-%s-%s" % (curDate.year, curDate.month, curDate.day) + preDate = curDate - datetime.timedelta(days = -1) # 属于前一天 + return "%s-%s-%s" % (preDate.year, preDate.month, preDate.day) + def IsCrossServer(): ## 是否跨服服务器 return ToIntDef(ReadChConfig.GetPyMongoConfig("Merge", "IsMergeServer"), 0) @@ -915,6 +933,19 @@ return smallList[1] return defValue + +## 从列表中产生物品,[[权重, object], ....] +# @param weightList 待选列表 +def GetResultByWeightList(weightList): + randList = [] + weight = 0 + for info in weightList: + weight += info[0] + randList.append([weight, info[1] if len(info) == 2 else info[1:]]) + if not randList: + return + rate = random.randint(1, randList[-1][0]) + return GetResultByRiseList(randList, rate) ## 根据字典key获取value值 # @return @@ -1026,7 +1057,7 @@ getUrl = ReadChConfig.GetPyMongoConfig("EventReport", "OpenStateUrl") groupID = ReadChConfig.GetPyMongoConfig("platform", "GroupID") userDBName = ReadChConfig.GetPyMongoConfig("connect", "USER_DB_NAME") - getUrl = getUrl + "?Type=GameWarning&groupID=%s&userDBName=%s&MsgInfo=%s"%(groupID, userDBName, msgInfo) + getUrl = getUrl + "?Type=GameWarning&groupID=%s&userDBName=%s&MsgInfo=%s"%(groupID, userDBName, urllib.quote_plus(msgInfo)) GetGameWorld().EventReport_EventReport("", "", "", "", 0, getUrl) \ No newline at end of file -- Gitblit v1.8.0