From 97fef842ed56dfd7c7dd73f9c7acf20df55b9a23 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期五, 05 九月 2025 11:35:20 +0800 Subject: [PATCH] 129 【战斗】战斗系统-服务端(优化主线掉落装备:改为按Boss类型掉落,祝福树区分不同的Boss类型掉落概率;分解装备按消耗的战锤进行均分计算分解所得;) --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py | 164 ++++++++++++++++++++++++------------------------------ 1 files changed, 72 insertions(+), 92 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py index b35b8c3..d35a1a2 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py @@ -17,9 +17,7 @@ import SkillShell import ChConfig import PlayerHorse -import PlayerTeam import SkillCommon -import MirrorAttack import GameMap import FBLogic import GameWorldProcess @@ -35,7 +33,6 @@ import PlayerBillboard import GameServerRefresh import IPY_GameWorld -import PlayerGameWallow import ChPyNetSendPack import NetPackCommon import DataRecordPack @@ -49,16 +46,10 @@ import GameFuncComm import IpyGameDataPY import PyGameData -import PlayerMagicWeapon import PlayerFeastTravel import PlayerActTurntable -import GameLogic_SealDemon -import GameLogic_ZhuXianBoss -import GameLogic_CrossDemonKing -import PlayerVip import PlayerCostRebate import PlayerActLunhuidian -import PlayerActGarbageSorting import GY_Query_CrossRealmReg import PlayerTongTianLing import FunctionNPCCommon @@ -66,7 +57,6 @@ import CrossRealmPlayer import CrossPlayerData import ChNetSendPack -import PlayerAssist import PlayerState import PlayerGubao import PlayerOnline @@ -578,7 +568,7 @@ # @return 返回值无意义 def ClearPyPlayerAction(curPlayer): #清除py自定义状态 - PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_PyPlayerAction, 0) + NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_PyPlayerAction, 0) return #--------------------------------------------------------------------- @@ -973,9 +963,6 @@ #刷新技能剩余时间 SkillCommon.RefreshAllSkillRemainTime(curPlayer, tick) - #队伍玩家退出地图 - PlayerTeam.TeamPlayerLeaveMap(curPlayer, tick, isDisconnect) - #退出采集 NPCCommon.ClearCollectNPC(curPlayer) @@ -1237,9 +1224,6 @@ NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FromFBLineID, lineID) GameWorld.DebugLog("进入副本时,最后一次离开的可返回的副本ID更新!mapID=%s,lineID=%s,Pos(%s,%s)" % (mapID, lineID, posX, posY)) - # 离开地图 - PlayerAssist.OnPlayerLeaveMap(curPlayer) - # 从副本中切图 if GameWorld.GetMap().GetMapFBType() != IPY_GameWorld.fbtNull: #默认回满血 @@ -1392,21 +1376,12 @@ if not FBLogic.OnEnterFBEvent(curPlayer, mapID, lineID, tick): GameWorld.DebugLog(" OnEnterFBEvent False!", curPlayer.GetPlayerID()) - if mapID in [ChConfig.Def_FBMapID_CrossBattlefield]: - NotifyCode(curPlayer, "GeRen_chenxin_268121") - else: - NotifyCode(curPlayer, "SingleEnterDefaul") + NotifyCode(curPlayer, "SingleEnterDefaul") return # 需要动态分布线路的地图,发送到跨服服务器进行分配 if mapID in ChConfig.Def_CrossDynamicLineMap: extendInfo = {} - if mapID == ChConfig.Def_FBMapID_CrossDemonKing: - bossID = GameLogic_CrossDemonKing.GetCurFBLineBOSSID(mapID, lineID) - if not bossID: - return - extendInfo["BossID"] = bossID - msgDict = {"PlayerID":curPlayer.GetPlayerID(), "MapID":mapID, "FuncLineID":lineID, "LV":curPlayer.GetLV()} if extendInfo: msgDict.update(extendInfo) @@ -1441,10 +1416,6 @@ tick = GameWorld.GetGameWorld().GetTick() if CheckMoveToFB(curPlayer, mapID, lineID, fbIpyData, fbLineIpyData, tick) != ShareDefine.EntFBAskRet_OK: return -# if mapID == ChConfig.Def_FBMapID_XMZZ: -# #仙魔之争 -# GameLogic_XMZZ.XMZZStartFight(curPlayer) -# return if posX == 0 and posY == 0: ipyEnterPosInfo = FBCommon.GetFBLineEnterPosInfo(mapID, lineID, fbLineIpyData) retPos = FBLogic.OnGetFBEnterPos(curPlayer, mapID, lineID, ipyEnterPosInfo, tick) @@ -1469,26 +1440,7 @@ if isSendToGameServer or mapID in ChConfig.Def_MapID_SendToGameServer \ or mapID in ReadChConfig.GetEvalChConfig("MapID_SendToGameServer"): extendParamList = [] - if mapID == ChConfig.Def_FBMapID_SealDemon: - newbielineList = IpyGameDataPY.GetFuncEvalCfg('SealDemonNewbieLine', 1) - # 新手线路特殊处理,直接进入 - if lineID in newbielineList: - GameWorld.DebugLog("封魔坛虚拟线路只能通过自定义场景进入挑战!") - return - else: - bossID = GameLogic_SealDemon.CurFBLineBOSSID(lineID) - extendParamList = [bossID] - elif mapID == ChConfig.Def_FBMapID_ZhuXianBoss: - bossID = GameLogic_ZhuXianBoss.CurFBLineBOSSID(lineID) - extendParamList = [bossID, -1] - enterCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_EnterFbCntDay % ChConfig.Def_FBMapID_ZhuXianBoss) - if enterCnt >= FBCommon.GetEnterFBMaxCnt(curPlayer, ChConfig.Def_FBMapID_ZhuXianBoss): - if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ZhuXianBossHelpCnt): - extendParamList = [bossID, curPlayer.GetFamilyID()] - elif mapID == ChConfig.Def_FBMapID_DemonKing: - bossID = GameLogic_CrossDemonKing.GetCurFBLineBOSSID(mapID, lineID) - extendParamList = [bossID] - elif mapID in ChConfig.Def_MapID_LineIDToPropertyID: + if mapID in ChConfig.Def_MapID_LineIDToPropertyID: enterCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_EnterFbCntDay % mapID) extendParamList = [enterCnt] elif mapID in ChConfig.MirrorBattleMapIDList: @@ -1639,10 +1591,6 @@ # @return 无意义 # @remarks 刷新玩家时钟,切地图玩家时钟记录清空,处理相应逻辑 def RefreshPlayerTick(curPlayer): - tick = GameWorld.GetGameWorld().GetTick() - - #防沉迷切线时间 - PlayerGameWallow.DoLogic_WallowOnlineTime(curPlayer, tick) return @@ -2551,6 +2499,20 @@ NetPackCommon.SendFakePack(curPlayer, clientPack) return +def GetUnXiantaoCntEquip(curPlayer): + '''因为战锤对应装备是1个战锤可能对应多个装备掉落,所以分解装备的时候1个战锤需要支持可拆分 + 所以需要支持小数存储,暂定以支持3位小数存储 + ''' + return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_UnXiantaoCntEquip) / 1000.0 +def AddUnXiantaoCntEquip(curPlayer, addCnt): + unXiantaoCntEquip = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_UnXiantaoCntEquip) + addCnt * 1000 + return NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_UnXiantaoCntEquip, unXiantaoCntEquip) +def SetUnXiantaoCntEquip(curPlayer, unXiantaoCntEquip): + ## 保存装备未结算战锤数,保留3位小数 + # @param unXiantaoCntEquip: 实际的未结算数量,支持小数 + unXiantaoCntEquip = int(round(unXiantaoCntEquip, 3) * 1000) # 保留3为小数 + return NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_UnXiantaoCntEquip, unXiantaoCntEquip) + ##玩家是否有钱款 # @param curPlayer 玩家实例 # @param TYPE_Price ,货币类型 @@ -2607,7 +2569,7 @@ #---钱不够 返回假如果需要提示的话 提示信息--- if needMoneyCount < Price: if needNotify and notifyCode: - NotifyCode(curPlayer, notifyCode) + pass#NotifyCode(curPlayer, notifyCode) GameWorld.DebugLog("货币不足: TYPE_Price=%s, Price=%s, curMoneyCount=%s" % (TYPE_Price, Price, needMoneyCount)) return False @@ -2656,8 +2618,8 @@ gold = curPlayer.GetGold() # 元宝 if goldPaper + gold < Price: # 钱不够 - if needNotify: - NotifyCode(curPlayer, "GoldErr") + #if needNotify: + # NotifyCode(curPlayer, "GoldErr") return [] if goldPaper >= Price: # 只用礼券就够了 @@ -2792,11 +2754,11 @@ __PayMoneyAfter(curPlayer, type_Price, lostMoney, costType, infoDict, quantity, costVIPGold) #通知客户端失去金钱 - if isNotify: - if type_Price == ShareDefine.TYPE_Price_PayCoin: - NotifyCode(curPlayer, "LostMoney", [type_Price, str(round(lostMoney/100.0, 2))]) - else: - NotifyCode(curPlayer, "LostMoney", [type_Price, lostMoney]) + #if isNotify: + # if type_Price == ShareDefine.TYPE_Price_PayCoin: + # NotifyCode(curPlayer, "LostMoney", [type_Price, str(round(lostMoney/100.0, 2))]) + # else: + # NotifyCode(curPlayer, "LostMoney", [type_Price, lostMoney]) return True ## 付款以后后续操作 @@ -2837,11 +2799,28 @@ #轮回殿 PlayerActLunhuidian.AddLunhuidianValue(curPlayer, PlayerActLunhuidian.AwardType_PayMoney, type_Price, price) if type_Price == ShareDefine.TYPE_Price_Xiantao: + # 累加未结算战锤 - 经验 unXiantaoCntExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_UnXiantaoCntExp) NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_UnXiantaoCntExp, unXiantaoCntExp + price) - unXiantaoCntEquip = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_UnXiantaoCntEquip) - NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_UnXiantaoCntEquip, unXiantaoCntEquip + price) + # 累加未结算战锤 - 装备 + AddUnXiantaoCntEquip(curPlayer, price) + # 累加未结算战锤 - 战利品 + chapterID = GetMainLevelNowInfo(curPlayer)[0] + chapterIpyData = IpyGameDataPY.GetIpyGameData("MainChapter", chapterID) + if chapterIpyData: + DailyBootyUpperList = chapterIpyData.GetDailyBootyUpperList() + for itemID, upperCnt in DailyBootyUpperList: + if upperCnt <= 0: + continue + if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BootyDropToday % itemID) >= upperCnt: + continue + unXiantaoCntBooty = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_UnXiantaoCntBooty % itemID) + NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_UnXiantaoCntBooty % itemID, unXiantaoCntBooty + price) + PlayerPrestigeSys.AddRealmTaskValue(curPlayer, PlayerPrestigeSys.RealmTaskType_UseXiantao, price) + PlayerTask.AddTaskValue(curPlayer, ChConfig.TaskType_CutTree, price) + + unitPrice = price if quantity == 1 else int(math.ceil(price * 1.0 / quantity)) # 单价 #reason_name = "Unknown" if not costType else costType reason_name = costType @@ -2921,7 +2900,6 @@ if costType not in ChConfig.CostRebate_DisableType: PlayerCostRebate.AddCostRebateGold(curPlayer, costType, price, infoDict) PlayerFeastTravel.AddFeastTravelTaskValue(curPlayer, ChConfig.Def_FeastTravel_UseGold, price) - PlayerActGarbageSorting.AddActGarbageTaskProgress(curPlayer, ChConfig.Def_GarbageTask_UseGold, price) else: GameWorld.DebugLog("不计入消费活动的消费类型!costType=%s" % costType, curPlayer.GetPlayerID()) @@ -3076,12 +3054,12 @@ if priceType == ShareDefine.TYPE_Price_PayCoinDay: priceType = ShareDefine.TYPE_Price_PayCoin - if isSysHint and priceType != ShareDefine.TYPE_Price_BourseMoney: - #通知客户端得到金钱 - if priceType == ShareDefine.TYPE_Price_PayCoin: - NotifyCode(curPlayer, "GetMoney", [priceType, str(round(value/100.0, 2))]) - else: - NotifyCode(curPlayer, "GetMoney", [priceType, value]) + #if isSysHint and priceType != ShareDefine.TYPE_Price_BourseMoney: + # #通知客户端得到金钱 + # if priceType == ShareDefine.TYPE_Price_PayCoin: + # NotifyCode(curPlayer, "GetMoney", [priceType, str(round(value/100.0, 2))]) + # else: + # NotifyCode(curPlayer, "GetMoney", [priceType, value]) __GiveMoneyAfter(curPlayer, priceType, value, giveType, addDataDict) if befMoney == 0: @@ -3392,10 +3370,7 @@ def GetFabaoAddPoint(curPlayer): #法宝额外增加玩家每级获得的灵根点 - mwID = IpyGameDataPY.GetFuncCfg('FabaoAddPoint', 1) - if not PlayerMagicWeapon.GetIsActiveMagicWeapon(curPlayer, mwID, lv=1): - return 0 - return IpyGameDataPY.GetFuncCfg('FabaoAddPoint', 2) + return 0 def DoAddPointOpen(curPlayer): '''加点功能开启''' @@ -3476,7 +3451,8 @@ # 杀怪 if expViewType == ShareDefine.Def_ViewExpType_KillNPC: - exp_rate = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_TotalExpRate) + #exp_rate = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_TotalExpRate) + exp_rate = 10000 elif expViewType in [ShareDefine.Def_ViewExpType_GameEvent, ShareDefine.Def_ViewExpType_Sit]: exp_rate = curPlayer.GetGameEventExpRate() #exp_rate += GetFamilySitExpPer(curPlayer) @@ -3614,7 +3590,6 @@ #if curPlayer.GetMaxMP() > 0: # curPlayer.SetMP(curPlayer.GetMaxMP()) - FBLogic.OnPlayerLVUp(curPlayer) # 记录开服活动冲级数据 #OpenServerCampaign.UpdOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_LV, curPlayer.GetLV()) #神秘限购 @@ -3844,8 +3819,6 @@ DoPlayerDead(curPlayer) GameObj.ClearPyPlayerState(curPlayer) - - MirrorAttack.OnPlayerDead(curPlayer) return @@ -4282,7 +4255,6 @@ def Sync_ExpRateChange(curPlayer): totalExpRate = GetPlayerExpRate(curPlayer) fightExpRate = curPlayer.GetFightExpRate() # 系统及功能累加 - fightExpRate += PlayerVip.GetPrivilegeValue(curPlayer, ChConfig.VIPPrivilege_FightExpRate) # VIP加成 fightExpRate += PlayerGoldInvest.GetAddFightExpRate(curPlayer) actExpRateInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_ExpRate, {})# 多倍经验活动加成 @@ -4449,11 +4421,17 @@ # @param wave: 第x波 value = ComMainLevelValue(chapterID, levelNum, wave) SetMainLevelPassValue(curPlayer, value) + if wave == 0: + PlayerTask.UpdTaskValue(curPlayer, ChConfig.TaskType_MainLevel) return value def GetMainLevelPassInfo(curPlayer): ## 获取主线关卡过关进度信息 # @return: chapterID, levelNum, wave - return GetMainLevelValue(GetMainLevelPassValue(curPlayer)) + chapterID, levelNum, wave = GetMainLevelValue(GetMainLevelPassValue(curPlayer)) + if not chapterID and not levelNum: + chapterID, levelNum, wave = 1, 1, 0 + SetMainLevelPassValue(curPlayer, ComMainLevelValue(chapterID, levelNum, wave)) + return chapterID, levelNum, wave ## 主线关卡当前进度值 = 章节*10000+关卡编号*100+第x波 def GetMainLevelNowValue(curPlayer): return curPlayer.GetExAttr2() @@ -4469,7 +4447,14 @@ def GetMainLevelNowInfo(curPlayer): ## 获取主线关卡当前进度信息 # @return: chapterID, levelNum, wave - return GetMainLevelValue(GetMainLevelNowValue(curPlayer)) + chapterID, levelNum, wave = GetMainLevelValue(GetMainLevelNowValue(curPlayer)) + if not chapterID and not levelNum: + chapterID, levelNum, wave = 1, 1, 1 + SetMainLevelNowInfo(curPlayer, chapterID, levelNum, wave) + if not wave: + wave = 1 + SetMainLevelNowInfo(curPlayer, chapterID, levelNum, wave) + return chapterID, levelNum, wave def ComMainLevelValue(chapterID, levelNum, wave=0): return chapterID * 10000 + levelNum * 100 + wave def GetMainLevelValue(value): @@ -4966,12 +4951,6 @@ customAttrDict = {} return attrList, insidePerAttrDict, customAttrDict -def GetLordAttr(curPlayer): - ## 获取主公属性汇总 - lordAttrDict = {"Atk":curPlayer.GetMaxAtk(), "Def":curPlayer.GetDef(), "MaxHP":GameObj.GetMaxHP(curPlayer), - "Hit":curPlayer.GetHit(), "Miss":curPlayer.GetMiss()} - return lordAttrDict - #------------------------------------------------------------------------------- ## 设置玩家字典值, 存库 def NomalDictSetProperty(curPlayer, key, value, dType=0): @@ -4984,10 +4963,11 @@ if value == 0: curPlayer.NomalDictDelProperty(key, dType) - return + return 0 # 2^31 - 1 - curPlayer.NomalDictAddProperty(key, min(value, ChConfig.Def_UpperLimit_DWordEx), dType) - return + value = max(0, min(value, ChConfig.Def_UpperLimit_DWordEx)) + curPlayer.NomalDictAddProperty(key, value, dType) + return value ## 通知祝福值 def Sync_BlessValue(curPlayer, blessType, value, multiple=0): -- Gitblit v1.8.0