| | |
| | | import PlayerBillboard
|
| | | import GameServerRefresh
|
| | | import IPY_GameWorld
|
| | | import PlayerGameWallow
|
| | | import ChPyNetSendPack
|
| | | import NetPackCommon
|
| | | import DataRecordPack
|
| | |
| | | import PyGameData
|
| | | import PlayerFeastTravel
|
| | | import PlayerActTurntable
|
| | | import GameLogic_CrossDemonKing
|
| | | import PlayerCostRebate
|
| | | import PlayerActLunhuidian
|
| | | import PlayerActGarbageSorting
|
| | | import GY_Query_CrossRealmReg
|
| | | import PlayerTongTianLing
|
| | | import FunctionNPCCommon
|
| | |
| | | # 需要动态分布线路的地图,发送到跨服服务器进行分配
|
| | | 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)
|
| | |
| | | # @return 无意义
|
| | | # @remarks 刷新玩家时钟,切地图玩家时钟记录清空,处理相应逻辑
|
| | | def RefreshPlayerTick(curPlayer):
|
| | | tick = GameWorld.GetGameWorld().GetTick()
|
| | | |
| | | #防沉迷切线时间
|
| | | PlayerGameWallow.DoLogic_WallowOnlineTime(curPlayer, tick)
|
| | | return
|
| | |
|
| | |
|
| | |
| | | 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 ,货币类型
|
| | |
| | | #---钱不够 返回假如果需要提示的话 提示信息---
|
| | | 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
|
| | |
|
| | |
| | | gold = curPlayer.GetGold() # 元宝
|
| | |
|
| | | if goldPaper + gold < Price: # 钱不够
|
| | | if needNotify:
|
| | | NotifyCode(curPlayer, "GoldErr")
|
| | | #if needNotify:
|
| | | # NotifyCode(curPlayer, "GoldErr")
|
| | | return []
|
| | |
|
| | | if goldPaper >= Price: # 只用礼券就够了
|
| | |
| | | __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
|
| | |
|
| | | ## 付款以后后续操作
|
| | |
| | | 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)
|
| | |
| | | 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
|
| | |
| | | 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())
|
| | |
|
| | |
| | | # @return 返回值真, 给钱成功
|
| | | # @param isSysHint 是否系统提示(默认是)
|
| | | # @remarks 玩家获得金钱
|
| | | def GiveMoney(curPlayer, priceType, value, giveType=ChConfig.Def_GiveMoney_Unknown, addDataDict={}, isSysHint=True, isGiveBourseMoney=True):
|
| | | def GiveMoney(curPlayer, priceType, value, giveType=ChConfig.Def_GiveMoney_Unknown, addDataDict={}, isSysHint=True, isGiveBourseMoney=True, notifyAward=False):
|
| | | if value == 0:
|
| | | return True
|
| | |
|
| | |
| | | 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])
|
| | | if notifyAward:
|
| | | ItemControler.NotifyGiveAwardInfo(curPlayer, [], giveType, moneyInfo={priceType:value})
|
| | | |
| | | __GiveMoneyAfter(curPlayer, priceType, value, giveType, addDataDict)
|
| | |
|
| | | if befMoney == 0:
|
| | |
| | | return IpyGameDataPY.GetFuncCfg("PKConfig", 2)
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | ##获得玩家升级, 获得的属性点
|
| | | # @param curPlayer 玩家实例
|
| | | # @return 返回值, 获得的属性点
|
| | | # @remarks 获得玩家升级, 获得的属性点
|
| | | def GetLvUp_AddPoint(curPlayer):
|
| | | curPlayerID = curPlayer.GetID()
|
| | | curLV = curPlayer.GetLV() # 当前等级
|
| | | |
| | | addPointDict = IpyGameDataPY.GetFuncEvalCfg("LVUPAddPoint", 1, {})
|
| | | addPoint = GameWorld.GetDictValueByRangeKey(addPointDict, curLV, 0)
|
| | | |
| | | if addPoint == None:
|
| | | raise Exception('玩家获得升级属性点异常, curLV = %s PlayerID = %s' % (curLV, curPlayerID))
|
| | | return
|
| | | return int(addPoint+ GetFabaoAddPoint(curPlayer) + GetTitleAddExtraPoint(curPlayer))
|
| | |
|
| | | def GetAllPointByLV(curPlayer):
|
| | | ##获取当前等级可得到属性点数
|
| | | openLV = GameFuncComm.GetFuncLimitLV(ShareDefine.GameFuncID_AddPoint)
|
| | | curLV = curPlayer.GetLV()
|
| | | if curLV < openLV:
|
| | | return 0
|
| | | # 初始点+(升级点+法宝效果)*称号效果倍数+境界点
|
| | | setFreePoint = IpyGameDataPY.GetFuncCfg("LVUPAddPoint", 2)
|
| | | fabaoAddPoint = GetFabaoAddPoint(curPlayer)
|
| | | titleAddPoint = GetTitleAddExtraPoint(curPlayer)
|
| | | addPointDict = IpyGameDataPY.GetFuncEvalCfg("LVUPAddPoint", 1, {})
|
| | | for rangLVs, point in addPointDict.items():
|
| | | if curLV < rangLVs[0]:
|
| | | continue
|
| | | setFreePoint += (point + fabaoAddPoint + titleAddPoint) * (min(curLV, rangLVs[1]) - rangLVs[0] + 1)
|
| | | |
| | | #境界提升点数
|
| | | setFreePoint += curPlayer.GetOfficialRank() * IpyGameDataPY.GetFuncCfg("LVUPAddPoint", 3)
|
| | | return setFreePoint
|
| | |
|
| | | def GetTitleAddExtraPoint(curPlayer):
|
| | | # 称号额外增加玩家每级获得的灵根点
|
| | |
| | | if titleID and curPlayer.GetDienstgradManager().GetDienstgrad(titleID):
|
| | | return IpyGameDataPY.GetFuncCfg("TitleAddPoint", 2)
|
| | | return 0
|
| | |
|
| | | def GetFabaoAddPoint(curPlayer):
|
| | | #法宝额外增加玩家每级获得的灵根点
|
| | | return 0
|
| | |
|
| | | def DoAddPointOpen(curPlayer):
|
| | | '''加点功能开启'''
|
| | | beforeFreePoint = curPlayer.GetFreePoint()
|
| | | |
| | | setFreePoint = GetAllPointByLV(curPlayer)
|
| | | curLV = curPlayer.GetLV()
|
| | | addDataDict = {'beforeFreePoint':beforeFreePoint}
|
| | | curPlayer.SetFreePoint(setFreePoint)
|
| | | DataRecordPack.DR_Freepoint(curPlayer, "AddPointOpen", setFreePoint, addDataDict)
|
| | | GameWorld.DebugLog(' 加点功能开启处理 beforeFreePoint=%s,curLV=%s, setFreePoint=%s'%(beforeFreePoint, curLV, setFreePoint), curPlayer.GetID())
|
| | | return
|
| | |
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | ###############################################################
|
| | |
| | | #if curPlayer.GetMaxMP() > 0:
|
| | | # curPlayer.SetMP(curPlayer.GetMaxMP())
|
| | |
|
| | | FBLogic.OnPlayerLVUp(curPlayer)
|
| | | # 记录开服活动冲级数据
|
| | | #OpenServerCampaign.UpdOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_LV, curPlayer.GetLV())
|
| | | #神秘限购
|
| | |
| | | # @param wave: 第x波
|
| | | value = ComMainLevelValue(chapterID, levelNum, wave)
|
| | | SetMainLevelPassValue(curPlayer, value)
|
| | | if wave == 0:
|
| | | lvID = chapterID * 100 + levelNum
|
| | | PlayerBillboard.UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_MainLevel, lvID)
|
| | | 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()
|
| | |
| | | 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):
|
| | |
| | | NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FightPower_HighestEx, highestFightPower / ChConfig.Def_PerPointValue)
|
| | |
|
| | | GameWorld.DebugLog("总战力: %s, 历史最高战力: %s, beforeFightPower=%s" % (value, highestFightPower, beforeFightPower), curPlayer.GetPlayerID())
|
| | | PlayerBillboard.UpdatePlayerFPTotalBillboard(curPlayer)
|
| | | #PlayerBillboard.UpdatePlayerFPTotalBillboard(curPlayer)
|
| | | # 记录开服活动数据
|
| | | #OpenServerCampaign.UpdOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_FightPower, totalFightPower)
|
| | | #if beforeFightPower != totalFightPower:
|
| | |
| | | if not lvIpyData:
|
| | | return 0
|
| | | return lvIpyData.GetExp()
|
| | |
|
| | | def GetOpenMaxLV():
|
| | | ## 获取游戏开放的最大等级
|
| | | maxLV = IpyGameDataPY.GetFuncCfg("PlayerMaxLV", 1)
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | realmIpyData = ipyDataMgr.GetRealmByIndex(ipyDataMgr.GetRealmCount() - 1)
|
| | | return min(maxLV, realmIpyData.GetLVMax())
|
| | |
|
| | | def GetPlayerMaxLV(curPlayer):
|
| | | ## 获取玩家实际可升的最大等级
|
| | |
| | |
|
| | | 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):
|