From 5385ddc1f759a0918f255cfb749968a9a033f165 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期六, 30 三月 2019 16:48:31 +0800 Subject: [PATCH] 5433 【开发】GM命令支持添加榜单数据(BillboardData) --- ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/BillboardData.py | 94 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 94 insertions(+), 0 deletions(-) diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/BillboardData.py b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/BillboardData.py new file mode 100644 index 0000000..7b241c5 --- /dev/null +++ b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/BillboardData.py @@ -0,0 +1,94 @@ +#!/usr/bin/python +# -*- coding: GBK -*- +#------------------------------------------------------------------------------- +# +##@package GM.Commands.BillboardData +# +# @todo:榜单数据 +# @author hxp +# @date 2019-03-30 +# @version 1.0 +# +# 详细描述: 榜单数据 +# +#------------------------------------------------------------------------------- +#"""Version = 2019-03-30 17:00""" +#------------------------------------------------------------------------------- + +import GameWorld +import ShareDefine +import PlayerBillboard + +def __Help(curPlayer, errInfo=""): + GameWorld.DebugAnswer(curPlayer, "---------- %s" % GameWorld.GetCurrentDataTimeStr()) + if errInfo: + GameWorld.DebugAnswer(curPlayer, errInfo) + GameWorld.DebugAnswer(curPlayer, "新增榜单假数据: BillboardData 类型 条数 比较值1 可选参数(比较值2 常规值1 常规值2)") + GameWorld.DebugAnswer(curPlayer, "删除榜单假数据: BillboardData 类型") + GameWorld.DebugAnswer(curPlayer, "榜单类型:0-战力,1-龙魂,2-灵瑶,4-等级,5-坐骑,6-灵宠,7-符印,8-脱机,9-境界,19-助战,23-诛仙") + GameWorld.DebugAnswer(curPlayer, "开服活动榜类型:11-强化,12-坐骑,13-宝石,14-冲级,15-境界,16-战力,18-符印,20-神兵,21-充值,22-灵宠") + GameWorld.DebugAnswer(curPlayer, "运营活动榜类型:17-仙界盛典,24-仙界盛典2") + return + +## 执行逻辑 +# @param curPlayer 当前玩家 +# @param gmList [] +# @return None +def OnExec(curPlayer, gmList): + + paramLen = len(gmList) + if not paramLen: + __Help(curPlayer) + return + + billboardIndex = gmList[0] + if billboardIndex < 0 or billboardIndex >= ShareDefine.Def_BT_Max: + __Help(curPlayer, "榜单类型不存在!") + return + billBoard = GameWorld.GetBillboard().FindBillboard(billboardIndex) + curDataCount = billBoard.GetCount() + maxDataCount = billBoard.GetMaxCount() + + # 清除榜单假数据 + if paramLen == 1: + delCount = 0 + while curDataCount > 0: + curDataCount -= 1 + index = curDataCount + billBoardData = billBoard.At(index) + if billBoardData.GetID() <= maxDataCount: + billBoard.DeleteByIndex(index) + delCount += 1 + + GameWorld.DebugAnswer(curPlayer, "删除榜单(%s)数据: %s 条" % (billboardIndex, delCount)) + return + + if paramLen < 3: + __Help(curPlayer) + return + + billboardIndex, count, cmpValue1 = gmList[:3] + cmpValue2 = gmList[3] if len(gmList) > 3 else 0 + value1 = gmList[4] if len(gmList) > 4 else 0 + value2 = gmList[5] if len(gmList) > 5 else 0 + + autoSort = False + bType2 = 0 + curPlayerOpInfo = "" + + count = min(count, maxDataCount - curDataCount) + FakeName = "假名字".decode(ShareDefine.Def_Game_Character_Encoding).encode(GameWorld.GetCharacterEncoding()) + + for i in xrange(count): + dataPlayerID = curDataCount + 1 + i + dataPlayerName = "%s%s" % (FakeName, i) + cmpValue1 = max(0, cmpValue1 - i) + cmpValue2 = max(0, cmpValue2 - i) + PlayerBillboard.UpdatePlayerBillboard(dataPlayerID, dataPlayerName, curPlayerOpInfo, billboardIndex, bType2, value1, value2, cmpValue1, autoSort, cmpValue2) + + billBoard.Sort() + + GameWorld.DebugAnswer(curPlayer, "添加榜单(%s)数据: %s 条" % (billboardIndex, count)) + return + + -- Gitblit v1.8.0