From 3196b9eef5ff1d7c35f8f68b295951ce8af35a0c Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期四, 18 三月 2021 18:57:41 +0800 Subject: [PATCH] 8728 【主干】【bt】【bt2】【btzf】【GM工具】增加删除物品、扣除货币功能 --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTDelPlayerItem.py | 136 +++++++++++++++++++++++++++ ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_DelPlayerMoney.py | 42 ++++++++ ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_DelPlayerItem.py | 46 +++++++++ ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTDelPlayerMoney.py | 68 +++++++++++++ 4 files changed, 292 insertions(+), 0 deletions(-) diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_DelPlayerItem.py b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_DelPlayerItem.py new file mode 100644 index 0000000..22e8f80 --- /dev/null +++ b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_DelPlayerItem.py @@ -0,0 +1,46 @@ +#!/usr/bin/python +# -*- coding: GBK -*- +#------------------------------------------------------------------------------- +# +##@package GM.Commands.GMT_DelPlayerItem +# +# @todo:GM工具扣除玩家物品 +# @author hxp +# @date 2021-03-18 +# @version 1.0 +# +# 详细描述: GM工具扣除玩家物品 +# +#------------------------------------------------------------------------------- +#"""Version = 2021-03-18 19:00""" +#------------------------------------------------------------------------------- + +import GMCommon +import ChConfig +import GameWorld + + +#逻辑实现(这里curPlayer = None) +## 执行逻辑 +# @param curPlayer 当前玩家 None +# @param gmList [cmdIndex,gmAccID,forbidAccIP] +# @return None +# @remarks 函数详细说明. +def OnExec(orderId, gmCmdDict): + GameWorld.Log("GMT_DelPlayerItem: %s" % gmCmdDict) + + playerFind = gmCmdDict.get(GMCommon.Def_GMKey_PlayerFind, '') + queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '') + + if queryType == 'accID': + #玩家账户 [] + GMCommon.GMTool_MapServer_Query(ChConfig.queryType_sqtPlayerByAccID, orderId, + playerFind, gmCmdDict, 'GMTDelPlayerItem', [orderId, gmCmdDict], False) + return + + #玩家名字 [] + GMCommon.GMTool_MapServer_Query(ChConfig.queryType_sqtPlayerByName, orderId, + playerFind, gmCmdDict, 'GMTDelPlayerItem', [orderId, gmCmdDict], False) + return + + diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_DelPlayerMoney.py b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_DelPlayerMoney.py new file mode 100644 index 0000000..016f839 --- /dev/null +++ b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_DelPlayerMoney.py @@ -0,0 +1,42 @@ +#!/usr/bin/python +# -*- coding: GBK -*- +#------------------------------------------------------------------------------- +# +##@package GM.Commands.GMT_DelPlayerMoney +# +# @todo:GM工具扣除玩家货币 +# @author hxp +# @date 2021-03-18 +# @version 1.0 +# +# 详细描述: GM工具扣除玩家货币 +# +#------------------------------------------------------------------------------- +#"""Version = 2021-03-18 19:00""" +#------------------------------------------------------------------------------- +import GMCommon +import ChConfig + + +#逻辑实现(这里curPlayer = None) +## 执行逻辑 +# @param curPlayer 当前玩家 None +# @param gmList [cmdIndex,gmAccID,forbidAccIP] +# @return None +# @remarks 函数详细说明. +def OnExec(orderId, gmCmdDict): + playerFind = gmCmdDict.get(GMCommon.Def_GMKey_PlayerFind, '') + queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '') + + if queryType == 'accID': + #玩家账户 [] + GMCommon.GMTool_MapServer_Query(ChConfig.queryType_sqtPlayerByAccID, orderId, + playerFind, gmCmdDict, 'GMTDelPlayerMoney', [orderId, gmCmdDict], False) + return + + #玩家名字 [] + GMCommon.GMTool_MapServer_Query(ChConfig.queryType_sqtPlayerByName, orderId, + playerFind, gmCmdDict, 'GMTDelPlayerMoney', [orderId, gmCmdDict], False) + return + + diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTDelPlayerItem.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTDelPlayerItem.py new file mode 100644 index 0000000..f391fb9 --- /dev/null +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTDelPlayerItem.py @@ -0,0 +1,136 @@ +#!/usr/bin/python +# -*- coding: GBK -*- +#------------------------------------------------------------------------------- +# +##@package Player.RemoteQuery.GY_Query_GMTDelPlayerItem +# +# @todo:GM工具扣除玩家物品 +# @author hxp +# @date 2021-03-18 +# @version 1.0 +# +# 详细描述: GM工具扣除玩家物品 +# +#------------------------------------------------------------------------------- +#"""Version = 2021-03-18 19:00""" +#------------------------------------------------------------------------------- + +import GMCommon +import ItemCommon +import ShareDefine +import GameWorld +import ChConfig + +## 请求逻辑 +# @param query_Type 请求类型 +# @param query_ID 请求的玩家ID +# @param packCMDList 发包命令 [ ] +# @param tick 当前时间 +# @return resultDisc +# @remarks 函数详细说明. +def DoLogic(query_Type, query_ID, packCMDList, tick): + curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(query_ID) + + if not curPlayer or curPlayer.IsEmpty(): + return '' + orderId, gmCmdDict = packCMDList + GameWorld.Log("GY_Query_GMTDelPlayerItem: %s" % gmCmdDict, query_ID) + itemID = GameWorld.ToIntDef(gmCmdDict.get("itemID", 0)) + delItemCount = GameWorld.ToIntDef(gmCmdDict.get("delItemCount", 0)) + + Result = GMCommon.Def_Success + retMsg = {"itemID":itemID, "delItemCount":delItemCount, "accID":curPlayer.GetAccID()} + + # 删除物品 + _DoGMDelItem(curPlayer, gmCmdDict, itemID, delItemCount, retMsg) + + # 查询剩余物品明细 + findItemDict = {} + for packIndex in xrange(ShareDefine.rptMax): + itemPack = curPlayer.GetItemManager().GetPack(packIndex) + if not itemPack: + continue + itemList = [] + for index in xrange(itemPack.GetCount()): + curItem = itemPack.GetAt(index) + if not curItem or curItem.IsEmpty(): + continue + if curItem.GetItemTypeID() != itemID: + continue + itemList.append(_GetItemInfo(curItem)) + if itemList: + findItemDict[str(packIndex)] = itemList + retMsg["findItemDict"] = findItemDict + + resultMsg = str([orderId, retMsg, 'GMT_DelPlayerItem', Result]) + GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'GMToolResult', resultMsg, len(resultMsg)) + return '' + +def _DoGMDelItem(curPlayer, gmCmdDict, itemID, delItemCount, retMsg): + + delRemark = gmCmdDict.get("delRemark", "") + delGUIDInfo = gmCmdDict.get("delGUIDInfo", "") + delGUIDInfo = eval(delGUIDInfo) if (delGUIDInfo.startswith("{") and delGUIDInfo.endswith("}")) else {} + if not delGUIDInfo: + return + GameWorld.DebugLog("delGUIDInfo: %s" % delGUIDInfo) + succDelItemDict = {} + succDelCount = 0 + for delGUID, delItemInfo in delGUIDInfo.items(): + packIndex, delIndex = delItemInfo + GameWorld.DebugLog("delGUID=%s,packIndex=%s,delIndex=%s" % (delGUID, packIndex, delIndex)) + itemPack = curPlayer.GetItemManager().GetPack(int(packIndex)) + if not itemPack: + continue + if delIndex >= itemPack.GetCount(): + continue + curItem = itemPack.GetAt(delIndex) + if not curItem or curItem.IsEmpty(): + continue + if curItem.GetItemTypeID() != itemID: + continue + if curItem.GetGUID() != delGUID: + continue + + remainDelCount = delItemCount - succDelCount # 还需要删除的个数 + if remainDelCount <= 0: + break + curCount = curItem.GetCount() + delCnt = min(remainDelCount, curCount) + itemInfo = _GetItemInfo(curItem) + GameWorld.DebugLog(" delCnt=%s" % delCnt) + + infoDict = {ChConfig.Def_Cost_Reason_SonKey:delRemark} + ItemCommon.DelItem(curPlayer, curItem, delCnt, False, "GM", infoDict, isForceDR=True) + + itemInfo["Count"] = "-%s" % delCnt + succDelCount += delCnt + + if str(packIndex) not in succDelItemDict: + succDelItemDict[str(packIndex)] = [] + itemList = succDelItemDict[str(packIndex)] + itemList.append(itemInfo) + + retMsg["succDelItemDict"] = succDelItemDict + retMsg["succDelCount"] = succDelCount + return + +def _GetItemInfo(curItem): + curItemInfo = {"ItemGUID":curItem.GetGUID(), + "ItemTypeID":curItem.GetItemTypeID(), + "ItemName":curItem.GetName().decode(ShareDefine.Def_Game_Character_Encoding).encode(GameWorld.GetCharacterEncoding()), + "Count":curItem.GetCount(), + "UserData":curItem.GetUserData(), + "IsBind":curItem.GetIsBind(), + "IsSuite":1 if curItem.GetSuiteID() else 0, + "RemainHour":curItem.GetRemainHour(), + "GearScore":curItem.GetGearScore(), + "CreateTime":curItem.GetCreateTime(), + "ItemPlaceIndex":curItem.GetItemPlaceIndex() + } + return curItemInfo + + + + + diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTDelPlayerMoney.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTDelPlayerMoney.py new file mode 100644 index 0000000..6ba2146 --- /dev/null +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_GMTDelPlayerMoney.py @@ -0,0 +1,68 @@ +#!/usr/bin/python +# -*- coding: GBK -*- +#------------------------------------------------------------------------------- +# +##@package Player.RemoteQuery.GY_Query_GMTDelPlayerMoney +# +# @todo:GM工具扣除玩家货币 +# @author hxp +# @date 2021-03-18 +# @version 1.0 +# +# 详细描述: GM工具扣除玩家货币 +# +#------------------------------------------------------------------------------- +#"""Version = 2021-03-18 19:00""" +#------------------------------------------------------------------------------- + +import GMCommon +import ShareDefine +import PlayerControl +import GameWorld +import ChConfig + +## 请求逻辑 +# @param query_Type 请求类型 +# @param query_ID 请求的玩家ID +# @param packCMDList 发包命令 [ ] +# @param tick 当前时间 +# @return resultDisc +# @remarks 函数详细说明. +def DoLogic(query_Type, query_ID, packCMDList, tick): + curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(query_ID) + + if not curPlayer or curPlayer.IsEmpty(): + return '' + + orderId, gmCmdDict = packCMDList + moneyType = GameWorld.ToIntDef(gmCmdDict.get("moneyType")) + moneyValue = GameWorld.ToIntDef(gmCmdDict.get("moneyValue")) + delRemark = gmCmdDict.get("delRemark", "") + + retMsg = "" + Result = GMCommon.Def_Success + if moneyType not in [1, 2, 3, 4] and moneyType not in ShareDefine.TYPE_Price_CurrencyDict: + Result = GMCommon.Def_MoneyTypeErr + elif not moneyValue: + Result = GMCommon.Def_ParamErr + retMsg = "money value error." + elif not PlayerControl.HaveMoney(curPlayer, moneyType, moneyValue, False): + Result = GMCommon.Def_ParamErr + retMsg = "money is not enough. only %s" % PlayerControl.GetMoney(curPlayer, moneyType) + + if Result == GMCommon.Def_Success: + infoDict = {ChConfig.Def_Cost_Reason_SonKey:delRemark} + if not PlayerControl.PayMoney(curPlayer, moneyType, moneyValue, ChConfig.Def_Cost_GM, infoDict, isNotify=False): + Result = GMCommon.Def_Unknow + retMsg = "pay money error." + else: + retMsg = "remaining money %s" % PlayerControl.GetMoney(curPlayer, moneyType) + + resultMsg = str([orderId, retMsg, 'GMT_DelPlayerMoney', Result]) + GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'GMToolResult', resultMsg, len(resultMsg)) + return '' + + + + + \ No newline at end of file -- Gitblit v1.8.0