From a388abb4b97782c1c694a8d28d8a1e73e03a35c0 Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期一, 10 六月 2019 16:33:25 +0800
Subject: [PATCH] 7155 【后端】【2.0】新增仙盟创建规则(通知修改)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerMagicWeapon.py | 603 ++++++++++++++----------------------------------------
1 files changed, 161 insertions(+), 442 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerMagicWeapon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerMagicWeapon.py
index 3e53455..a0c2c21 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerMagicWeapon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerMagicWeapon.py
@@ -9,7 +9,7 @@
# @date 2017-05-18
# @version 1.0
#
-# 详细描述: 法宝系统
+# 详细描述: 法宝系统 目前激活方式:1.任务接口激活 2.通关副本 3.获得某物品 4.仙宝寻主
#
#-------------------------------------------------------------------------------
#"""Version = 2017-05-18 12:00"""
@@ -33,29 +33,24 @@
import PassiveBuffEffMng
import ItemControler
import PlayerActivity
-import ChEquip
+import FBCommon
import PlayerVip
import random
-g_succInfoDict = {}
-g_potentialsSkillDict = {}
##登录处理
# @param curPlayer 玩家
# @return None
def PlayerMagicWeaponLogin(curPlayer):
- NotifyMagicWeapon(curPlayer, True)
SyncXBXZAwardRecord(curPlayer)
Sycn_MagicWeaponLV(curPlayer)
- Sycn_MWPrivilegeData(curPlayer)
return
+
def OnDay(curPlayer):
- #重置法宝之魂每日领取记录
- for privilege in ChConfig.MWPrivilegeList:
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MWSoulGotItemState % privilege, 0)
- Sycn_MWPrivilegeData(curPlayer, isForce=True)
+
return
+
def DoMagicWeaponOpen(curPlayer):
## 法宝功能开启 激活第一个法宝
@@ -63,75 +58,75 @@
# mwID = ipyData.GetID()
# GameWorld.DebugLog("法宝功能开启 激活第一个法宝 mwID=%s"%mwID)
# DoActiveMW(curPlayer, mwID)
-# NotifyMagicWeapon(curPlayer)
+
return True
-def GetIsActiveMagicWeapon(curPlayer, mwID, lv=0):
- #获取法宝是否激活
- #通过玩家字典值可直接判断是否已经激活,这里可不验证法宝ID是否存在,即使传入不存在的也是返回未激活
- #if not GetWMIpyData(mwID):
- # return False
- if lv:
- curMWLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponLV % mwID)
- return curMWLV >= lv
- return GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_MagicWeaponIsActive, mwID % 100, True, [mwID / 100])
-def SetMagicWeaponActiveState(curPlayer, mwID, isActive=True):
- #设置法宝激活状态
- GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_MagicWeaponIsActive, mwID % 100, isActive, True, [mwID / 100])
- return
+def GetIsActiveMagicWeapon(curPlayer, mwID, lv=1):
+ #获取法宝是否达到X级
+ curMWLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponLV % mwID)
+ return curMWLV >= lv
-def ActiveMagicWeapon(curPlayer, succID):
- ##激活法宝
- mwID = GetMWIDBySuccID(succID)
- if mwID == None:
- return
-
- isActive = GetIsActiveMagicWeapon(curPlayer, mwID)
- if isActive:
- return
- succIDList = GetNeedSuccIDByMWID(mwID)
- needExp = len(succIDList)
- curExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponExp % mwID)
-
- if curExp >= needExp:
- return
-
- newExp = min(needExp, curExp + 1)
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MagicWeaponExp % mwID, newExp)
- DataRecordPack.DR_MagicWeaponExp(curPlayer, mwID, succID, newExp, needExp)
- ipyData = GetWMIpyData(mwID)
- needItemDict = ipyData.GetNeedItem()
- #GameWorld.DebugLog(' 激活法宝 mwID=%s,curExp=%s,succIDList=%s' % (mwID, newExp,succIDList))
- if newExp >= needExp and not needItemDict:
- #成就条件达成 激活法宝
+
+
+def ActiveMagicWeaponByFB(curPlayer, mapID, lineID, passLV=0):
+ ##通关副本激活法宝(人族、魔族法宝)
+ ipyData = IpyGameDataPY.GetIpyGameDataByCondition('MagicWeaponFB', {'LineID':lineID, 'Level':passLV})
+ if ipyData:
+ mwID = ipyData.GetMWID()
+ GameWorld.Log('更新魔族副本关卡 mwID=%s,level=%s' % (mwID, passLV), curPlayer.GetID())
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MWFBPassLevel % mwID, passLV)
+ Sycn_MagicWeaponLV(curPlayer, mwID)
+ EventShell.EventRespons_MagicWeaponFBPassLV(curPlayer, mwID, passLV)
+ ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('MagicWeaponFB', {'LineID':lineID}, True)
+ maxLevel = ipyDataList[-1].GetLevel()
+ if passLV >= maxLevel:
+ DoActiveMW(curPlayer, mwID)
+ else:
+ CalcMagicWeaponAttr(curPlayer)
+ PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
+ else:
+ ipyData = IpyGameDataPY.GetIpyGameDataByCondition('Treasure', {'FBMapID':mapID, 'FBLineID':lineID})
+ if not ipyData:
+ return
+ mwID = ipyData.GetID()
+ if curPlayer.GetLV() < ipyData.GetNeedLV():
+ GameWorld.Log('通关副本激活法宝 ,等级不足!!!mwID=%s, needLV=%s' % (mwID, ipyData.GetNeedLV()))
+ return
+
DoActiveMW(curPlayer, mwID)
-
return
-def DoActiveMW(curPlayer, mwID, mwLV=0):
+
+def DoActiveMW(curPlayer, mwID, mwLV=1):
if not GetWMIpyData(mwID):
return
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MagicWeaponLV % mwID, mwLV)
- if mwLV == 0:
- SetMagicWeaponActiveState(curPlayer, mwID)
- #通知
- NotifyMagicWeapon(curPlayer)
-
-
+ if mwLV == 1:
+
if mwID in IpyGameDataPY.GetFuncEvalCfg('UnblockTreasure'):
PlayerControl.NotifyCode(curPlayer, 'UnblockTreasure', [curPlayer.GetName(), mwID])
else:
sysMark = IpyGameDataPY.GetFuncEvalCfg('UnblockTreasure', 2, {}).get(mwID, 'UnblockTreasure')
PlayerControl.WorldNotify(0, sysMark, [curPlayer.GetName(), mwID])
-
- #任务
- EventShell.EventRespons_OnActiveMagicWeapon(curPlayer, mwID)
- else:
-
- #通知客户端等级
- Sycn_MagicWeaponLV(curPlayer, mwID)
- EventShell.EventRespons_MagicWeaponLV(curPlayer, mwID, mwLV)
+ if mwID == IpyGameDataPY.GetFuncCfg('FabaoAddPoint', 1):
+ addPointDict = IpyGameDataPY.GetFuncEvalCfg("LVUPAddPoint", 1, {})
+ fabaoAddPoint = IpyGameDataPY.GetFuncCfg('FabaoAddPoint', 2)
+ curLV = curPlayer.GetLV()
+ addFreePoint = 0
+ for rangLVs, point in addPointDict.items():
+ if curLV < rangLVs[0]:
+ continue
+ addFreePoint += fabaoAddPoint * (min(curLV, rangLVs[1]) - rangLVs[0] + 1)
+ freePoint = curPlayer.GetFreePoint()
+ updFreePoint = freePoint + addFreePoint
+ curPlayer.SetFreePoint(updFreePoint)
+ GameWorld.DebugLog("激活法宝增加自由属性点: freePoint=%s,addFreePoint=%s,curLV=%s,updFreePoint=%s"
+ % (freePoint, addFreePoint, curLV, updFreePoint))
+
+ EventShell.EventRespons_MagicWeaponLV(curPlayer, mwID, mwLV)
+ #通知客户端等级
+ Sycn_MagicWeaponLV(curPlayer, mwID)
#成就
PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_GetMagicWeapon, 1, [mwID, mwLV])
@@ -142,33 +137,14 @@
skillIDList = upIpyData.GetUnLockSkill()
for skillID in skillIDList:
GiveSkill(curPlayer, skillID, GameWorld.GetGameWorld().GetTick())
- #物品奖励
- itemAward = upIpyData.GetItemAward()
- if itemAward:
- itemID, itemCnt, isBind = itemAward
- packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, 1)
- if 1 > packSpace:
- PlayerControl.SendMailByKey('TreasureWakeUp', [curPlayer.GetID()], [itemAward])
- else:
- ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, isBind,
- [IPY_GameWorld.rptItem], True, showSysInfo=True, event=["MWAward", False, {"mwID":mwID}])
- activeMWID = upIpyData.GetActiveMWID()
- if activeMWID == mwID:
- GameWorld.ErrLog(' TreasureUp.txt 配置异常 不可激活自身法宝 mwID=%s'%mwID)
- elif activeMWID:
- DoActiveMW(curPlayer, activeMWID)
-
- #激活魂
- activeSoulID = upIpyData.GetActiveSoulID()
- if activeSoulID:
- __DoActiveMWSoul(curPlayer, activeSoulID, False)
+
CalcMagicWeaponAttr(curPlayer)
PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
GameWorld.DebugLog(' 激活法宝 mwID=%s,mwLV=%s' % (mwID, mwLV))
- vipAddAtkMWID = IpyGameDataPY.GetFuncCfg("VIPAddAtkEXP", 2) # VIP杀怪加属性所需激活法宝
+ vipAddAtkMWID = IpyGameDataPY.GetFuncCfg("VIPAddAtkEXP", 2) # VIP杀怪加属性所需激活法宝
if mwID == vipAddAtkMWID:
PlayerVip.RefreshVIPAttr(curPlayer)
@@ -177,31 +153,9 @@
DataRecordPack.DR_MagicWeaponActive(curPlayer, mwID, mwLV)
return True
+
def GetWMIpyData(mwID):return IpyGameDataPY.GetIpyGameData('Treasure', mwID)
-def GetNeedSuccIDByMWID(mwID, ipyData=None):
- ##获取法宝ID开启需要完成的成就ID
- if not ipyData:
- ipyData = GetWMIpyData(mwID)
- if not ipyData:
- return []
- succIDList = list(ipyData.GetSuccID())
- return succIDList
-
-def GetMWIDBySuccID(succID):
- global g_succInfoDict
-
- if not g_succInfoDict:
- ipyDataMgr = IpyGameDataPY.IPY_Data()
- for i in xrange(ipyDataMgr.GetTreasureCount()):
- ipyData = ipyDataMgr.GetTreasureByIndex(i)
- mwID = ipyData.GetID()
- succIDList = GetNeedSuccIDByMWID(mwID, ipyData)
- for succid in succIDList:
- if succid in g_succInfoDict:
- GameWorld.ErrLog(' 存在相同成就激活条件的法宝 %s 和 %s' % (mwID, g_succInfoDict[succid]))
- g_succInfoDict[succid] = mwID
- return g_succInfoDict.get(succID)
def GetMWActiveCntTotal(curPlayer):
## 获取激活的法宝总个数
@@ -214,6 +168,7 @@
activeCnt += 1
return activeCnt
+
def GetMWActiveCntByType(curPlayer, mwType):
## 根据法宝类型获取已激活数量
dataList = IpyGameDataPY.GetIpyGameDataByCondition('Treasure', {'TreasureType':mwType}, True, False)
@@ -225,6 +180,7 @@
if isActive:
activeCnt += 1
return activeCnt
+
## 给技能
# @param curPlayer
@@ -263,43 +219,20 @@
return
-def NotifyMagicWeapon(curPlayer, isLogin=False):
- #通知法宝信息
- packData = ChPyNetSendPack.tagMCMagicWeaponData()
- packData.Clear()
- packData.MagicWeaponID = []
-
- ipyDataMgr = IpyGameDataPY.IPY_Data()
- for i in xrange(ipyDataMgr.GetTreasureCount()):
- ipyData = ipyDataMgr.GetTreasureByIndex(i)
- magicWeaponID = ipyData.GetID()
- isActive = GetIsActiveMagicWeapon(curPlayer, magicWeaponID)
- if not isActive:
- continue
- packData.MagicWeaponID.append(magicWeaponID)
-
- packData.Num = len(packData.MagicWeaponID)
- if packData.Num or isLogin:
- NetPackCommon.SendFakePack(curPlayer, packData)
- return
-
-
##--------------------------------------------------------------------------------------------------
-def GetMWRefineIpyData(treasureID, treasureLV):
- #获取法宝等级信息
- return IpyGameDataPY.GetIpyGameDataNotLog("TreasureRefine", treasureID, treasureLV)
+
def CalcMagicWeaponAttr(curPlayer):
## 计算法宝属性
- allAttrList1 = [{} for _ in range(4)] #人族法宝
- allAttrList2 = [{} for _ in range(4)] #魔族法宝
- allAttrList3 = [{} for _ in range(4)] #仙族法宝
- allAttrList4 = [{} for _ in range(4)] #王者法宝
+ allAttrList1 = [{} for _ in range(4)] #人族法宝
+ allAttrList2 = [{} for _ in range(4)] #魔族法宝
+ allAttrList3 = [{} for _ in range(4)] #仙族法宝
+ allAttrList4 = [{} for _ in range(4)] #王者法宝
mwTypeMfpTypeDict = {1:ShareDefine.Def_MFPType_MagicWeapon1,
2:ShareDefine.Def_MFPType_MagicWeapon2,
3:ShareDefine.Def_MFPType_MagicWeapon3,
4:ShareDefine.Def_MFPType_MagicWeapon4}
- addPowerDict = {} #额外战力
+ addPowerDict = {} #额外战力
signDayMWID = IpyGameDataPY.GetFuncCfg('MWSignDayAttr', 2)
ipyDataMgr = IpyGameDataPY.IPY_Data()
for i in xrange(ipyDataMgr.GetTreasureCount()):
@@ -309,20 +242,13 @@
# if not isActive:
# continue
allAttrDict = {}
- #=======================================================================
- # #铸炼属性
- # mwRefineLv = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponRefineLV % magicWeaponID)
- # refineipyData = GetMWRefineIpyData(magicWeaponID, mwRefineLv)
- # if refineipyData:
- # attrDict = refineipyData.GetTreasureAttr()
- # GameWorld.AddDictValue(allAttrDict, attrDict)
- #=======================================================================
+
treasureType = treasureIpyData.GetTreasureType()
if isActive:
mfpType = mwTypeMfpTypeDict.get(treasureType, ShareDefine.Def_MFPType_Role)
#等级属性
curMWLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponLV % magicWeaponID)
- for lv in xrange(curMWLV+1):
+ for lv in xrange(curMWLV + 1):
upIpyData = IpyGameDataPY.GetIpyGameDataNotLog('TreasureUp', magicWeaponID, lv)
if upIpyData:
attrDict = upIpyData.GetAddAttr()
@@ -331,7 +257,7 @@
if magicWeaponID == signDayMWID:
#签到属性
- totalSignNum = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TotalSignNum) # 总签到天数
+ totalSignNum = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TotalSignNum) # 总签到天数
addAttr = {}
for attid, attnum in IpyGameDataPY.GetFuncEvalCfg('MWSignDayAttr', 1, {}).items():
addAttr[int(attid)] = attnum * totalSignNum
@@ -345,22 +271,13 @@
GameWorld.AddDictValue(allAttrDict, attrDict)
fbpasslv = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWFBPassLevel % magicWeaponID)
- #老号已激活的魔族法宝没有关卡属性,直接设置满关卡
- if isActive and not fbpasslv:
- ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('MagicWeaponFB', {'MWID':magicWeaponID}, True, False)
- if ipyDataList:
- maxLevel = ipyDataList[-1].GetLevel()
- fbpasslv = maxLevel
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MWFBPassLevel % magicWeaponID, maxLevel)
- GameWorld.Log('老号已激活的魔族法宝没有关卡属性,直接设置满关卡 magicWeaponID=%s,maxLevel=%s'%(magicWeaponID, maxLevel), curPlayer.GetID())
- if fbpasslv: #副本关卡属性
+ if fbpasslv: #副本关卡属性
fbipyData = IpyGameDataPY.GetIpyGameData('MagicWeaponFB', magicWeaponID, fbpasslv)
if fbipyData:
attrDict = fbipyData.GetAttrDict()
for effID, value in attrDict.items():
effID = int(effID)
allAttrDict[effID] = allAttrDict.get(effID, 0) + value
-
for effID, value in allAttrDict.items():
if treasureType == 1:
@@ -397,11 +314,8 @@
if isActive:
GameWorld.DebugLog(' 该法宝已开启! mwID=%s' % mwID)
return
- succIDList = GetNeedSuccIDByMWID(mwID)
- curExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponExp % mwID)
- if curExp < len(succIDList):
- GameWorld.DebugLog(' 该法宝所需成就未完成! mwID=%s, curExp=%s, succIDList=%s' % (mwID, curExp, succIDList))
- return
+ ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('XBXZ', {'MWID':mwID}, True, False)
+
#消耗物品判断
ipyData = GetWMIpyData(mwID)
needItemDict = ipyData.GetNeedItem()
@@ -417,19 +331,57 @@
#扣消耗
ItemCommon.DelCostItem(curPlayer, itemPack, delInfoDict, ChConfig.ItemDel_MagicWeapon)
- else:
- ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('XBXZ', {'MWID':mwID}, True, False)
- if not ipyDataList:
- return
+ elif ipyDataList:
for ipyData in ipyDataList:
if not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_XBXZAwardRecord, ipyData.GetID()):
return
-
-
+ elif mwID == 101: #定海神针特殊 可直接获得
+ FBCommon.Notify_FB_Over(curPlayer, {FBCommon.Over_dataMapID:ChConfig.Def_FBMapID_MagicWeapon,FBCommon.Over_isPass:1})
+ PlayerControl.SetCustomMap(curPlayer, 0, 0)
+ else:
+ return
DoActiveMW(curPlayer, mwID)
return
+def GetXBXZAwardProgress(curPlayer, mwID):
+ ##获取仙宝寻主当前达到条件的个数
+ ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('XBXZ', {'MWID': mwID}, True, False)
+ if not ipyDataList:
+ return 0
+ cnt = 0
+ playerEquip = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
+ for ipyData in ipyDataList:
+ curType = ipyData.GetType()
+ conditionList = ipyData.GetCondition()
+
+ if curType == 1:
+ #穿戴X阶X颜色是否套装X部位装备
+ for classlv, color, suite, place in conditionList:
+ equipIpyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap',classlv,place)
+ if not equipIpyData:
+ continue
+ gridIndex = equipIpyData.GetGridIndex()
+ curEquip = playerEquip.GetAt(gridIndex)
+ if curEquip.IsEmpty():
+ continue
+ curItemColor = curEquip.GetItemColor()
+ curIsSuite = curEquip.GetSuiteID()
+ if curItemColor >= color and curIsSuite >= suite:
+ cnt += 1
+ break
+ else:
+ continue
+ return cnt
+
+# ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('XBXZ', {'MWID': mwID}, True, False)
+# cnt = 0
+# if ipyDataList:
+# for ipyData in ipyDataList:
+# if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_XBXZAwardRecord, ipyData.GetID()):
+# cnt += 1
+# return cnt
#-------------------------------------------------------------------------------
+
def OnGetXBXZAward(curPlayer, index):
##仙宝寻主领奖
@@ -444,47 +396,22 @@
conditionList = ipyData.GetCondition()
cnt = 0
if curType == 1:
- #角色防御到XX
- cnt = PlayerControl.GetFuncDef(curPlayer)
-
- elif curType == 2:
- #穿戴三阶橙色1星或四阶紫色1星以上头盔
+ #穿戴X阶X颜色是否套装X部位装备
+ cnt = 0
playerEquip = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
- SamboSpecialUnlock = IpyGameDataPY.GetFuncEvalCfg('SamboSpecialUnlock')
- for equipIndex in xrange(playerEquip.GetCount()):
- curEquip = playerEquip.GetAt(equipIndex)
+ for classlv, color, suite, place in conditionList:
+ equipIpyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap',classlv,place)
+ if not equipIpyData:
+ continue
+ gridIndex = equipIpyData.GetGridIndex()
+ curEquip = playerEquip.GetAt(gridIndex)
if curEquip.IsEmpty():
continue
- curClassLV = ItemCommon.GetItemClassLV(curEquip)
- itemColor = curEquip.GetItemColor()
- itemQuality = curEquip.GetItemQuality()
- itemID = curEquip.GetItemTypeID()
- for classlv, color, star, place in conditionList:
- if equipIndex is place and itemID in SamboSpecialUnlock:
- cnt = 1
- break
- if equipIndex is place and curClassLV >= classlv and itemColor >= color and itemQuality >= star:
- cnt = 1
- break
- if cnt:
+ curItemColor = curEquip.GetItemColor()
+ curIsSuite = curEquip.GetSuiteID()
+ if curItemColor >= color and curIsSuite >= suite:
+ cnt = 1
break
-# elif curType == 3:
-# #全身装备X星
-# cnt = ChEquip.GetTotalEquipStars(curPlayer)
-
-# elif curType == 4:
-# #X阶普通、强化套装
-# suiteCntDict = {}
-# playerEquip = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
-# for equipIndex in xrange(playerEquip.GetCount()):
-# curEquip = playerEquip.GetAt(equipIndex)
-# if curEquip.IsEmpty():
-# continue
-# suiteInfo = ChEquip.GetSuiteInfoByPlace(curPlayer, equipIndex, curEquip)
-# for suitelv, suiteType in conditionList:
-# if suiteInfo.get(suiteType, 0) >= suitelv:
-# suiteCntDict[suiteType] = suiteCntDict.get(suiteType, 0)+1
-# cnt = max(suiteCntDict.values()) if suiteCntDict else 0
else:
return
@@ -507,17 +434,17 @@
# 给物品
if awardItemList:
for itemID, itemCnt in awardItemList:
- ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 1, [IPY_GameWorld.rptItem], True)
+ ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 0, [IPY_GameWorld.rptItem])
#给钱
for moneyType, value in ipyData.GetMoney():
PlayerControl.GiveMoney(curPlayer, moneyType, value)
- SyncXBXZAwardRecord(curPlayer,[index])
+ SyncXBXZAwardRecord(curPlayer, [index])
#成就
PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_XBXZ, 1, [ipyData.GetMWID()])
+ EventShell.EventRespons_XBXZ(curPlayer, ipyData.GetMWID())
GameWorld.DebugLog(' 仙宝寻主领奖OK, ID=%s, cnt=%s' % (index, cnt))
return
-
## 通知仙宝寻主对应奖励领奖记录
# @param None
@@ -532,14 +459,14 @@
succCnt = ipyDataMgr.GetXBXZCount()
if not succCnt:
return
- maxSuccid = ipyDataMgr.GetXBXZByIndex(succCnt-1).GetID()
- recordIndexList = range(maxSuccid / 31+1)
+ maxSuccid = ipyDataMgr.GetXBXZByIndex(succCnt - 1).GetID()
+ recordIndexList = range(maxSuccid / 31 + 1)
succFARPack = ChPyNetSendPack.tagMCXBXZAwardRecordList()
succFARPack.Clear()
succFARPack.RecordList = []
for i in recordIndexList:
- awardRecord=curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_XBXZAwardRecord%i)
+ awardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_XBXZAwardRecord % i)
if not awardRecord:
continue
recordInfo = ChPyNetSendPack.tagMCXBXZAwardRecord()
@@ -550,6 +477,7 @@
succFARPack.RecordCnt = len(succFARPack.RecordList)
NetPackCommon.SendFakePack(curPlayer, succFARPack)
return
+
#-------------------------------------------------------------------------------
#// A5 15 提升法宝等级 #tagCMMagicWeaponUp
@@ -565,26 +493,27 @@
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
mwID = clientData.MWID
curMWLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponLV % mwID)
- nextMWLV = curMWLV+1
+ nextMWLV = curMWLV + 1
nextIpyData = IpyGameDataPY.GetIpyGameData('TreasureUp', mwID, nextMWLV)
if not nextIpyData:
return
needExp = nextIpyData.GetNeedExp()
curUpExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponUpExp % mwID)
if curUpExp < needExp:
- GameWorld.DebugLog('法宝升级经验不足%s'%needExp)
+ GameWorld.DebugLog('法宝升级经验不足%s' % needExp)
return
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MagicWeaponUpExp % mwID, curUpExp-needExp)
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MagicWeaponUpExp % mwID, curUpExp - needExp)
DoActiveMW(curPlayer, mwID, nextMWLV)
return
+
def AddMagicWeaponUpExp(curPlayer, mwID, addExp):
#增加法宝升级经验
- GameWorld.DebugLog('增加法宝升级经验 mwID=%s,addExp=%s'%(mwID, addExp))
+ GameWorld.DebugLog('增加法宝升级经验 mwID=%s,addExp=%s' % (mwID, addExp))
curUpExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponUpExp % mwID)
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MagicWeaponUpExp % mwID, curUpExp+addExp)
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MagicWeaponUpExp % mwID, curUpExp + addExp)
Sycn_MagicWeaponLV(curPlayer, mwID)
# 每日活动
ipyData = GetWMIpyData(mwID)
@@ -593,7 +522,8 @@
PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_MagicWeapon)
return
-def Sycn_MagicWeaponLV(curPlayer, mwID= -1):
+
+def Sycn_MagicWeaponLV(curPlayer, mwID=-1):
#通知法宝等级信息
if mwID == -1:
isAll = True
@@ -610,16 +540,15 @@
for mwID in needCalList:
mwLv = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponLV % mwID)
curUpExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponUpExp % mwID)
- state = GetIsClickMagicWeapon(curPlayer, mwID)
+
FBPassLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWFBPassLevel % mwID)
isWear = GetIsWearMagicWeapon(curPlayer, mwID)
- if isAll and not mwLv and not curUpExp and not state and not FBPassLV and not isWear:
+ if isAll and not mwLv and not curUpExp and not FBPassLV and not isWear:
continue
pack = ChPyNetSendPack.tagMCMagicWeaponInfo()
pack.MWID = mwID
pack.LV = mwLv
pack.Exp = curUpExp
- pack.State = state
pack.FBPassLV = FBPassLV
pack.IsWear = isWear
sendPack.InfoList.append(pack)
@@ -628,160 +557,7 @@
NetPackCommon.SendFakePack(curPlayer, sendPack)
return
-def GetMagicWeaponPrivilege(curPlayer, privilege):
- #法宝等级权限
- if not GetIsActiveMWSoul(curPlayer, privilege):
- return 0
- privilegeIpyData = IpyGameDataPY.GetIpyGameDataNotLog('TreasurePrivilege', privilege)
- if not privilegeIpyData:
- return 0
- return privilegeIpyData
-def GetMagicWeaponPrivilegeAttr(curPlayer, privilege):
- #获取法宝特权增加的属性
- addAttr = {}
- privilegeIpyData = IpyGameDataPY.GetIpyGameDataNotLog('TreasurePrivilege', privilege)
- if not privilegeIpyData:
- return addAttr
- attrInfo = privilegeIpyData.GetAddAttr()
- if not attrInfo:
- attrInfo = {}
- singleValue = privilegeIpyData.GetSingleValue()
-
- if privilege == ChConfig.MWPrivilege_EquipPlus:
- #强化加成
- addAttr = ChEquip.CalcAllEquipAllPlusLVAttr(curPlayer)
- else:
- multiple = 1 #倍数
- if singleValue:
- gotValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWSoulGotValue % privilege)
- maxValue = privilegeIpyData.GetMaxValue()
- if maxValue:
- gotValue = min(maxValue, gotValue)
- multiple = gotValue/singleValue
- for attid, attnum in attrInfo.items():
- addAttr[int(attid)] = attnum * multiple
-
- GameWorld.DebugLog(' 获取法宝特权增加的属性 privilege=%s,addAttr=%s' % (privilege,addAttr), curPlayer.GetID())
- return addAttr
-
-def SetMWPrivilegeData(curPlayer, privilege, data, isAdd=False):
- ##设置法宝特权相关数据
- privilegeIpyData = IpyGameDataPY.GetIpyGameDataNotLog('TreasurePrivilege', privilege)
- if not privilegeIpyData:
- return
- curGotValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWSoulGotValue % privilege)
- singleValue = privilegeIpyData.GetSingleValue()
- if singleValue and curGotValue % singleValue:
- fixGotValue = curGotValue/singleValue*singleValue
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MWSoulGotValue % privilege, fixGotValue)
- GameWorld.Log('玩家法宝之魂已领的数据不是单次进度的倍数,修复! privilege=%s,curGotValue=%s, fixGotValue=%s'%(privilege, curGotValue, fixGotValue))
-
- curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWSoulCurValue % privilege)
- newData = curValue + data if isAdd else data
- maxValue = privilegeIpyData.GetMaxValue()
- if maxValue:
- newData = min(maxValue, newData)
- if curValue != newData:
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MWSoulCurValue % privilege, newData)
-
- Sycn_MWPrivilegeData(curPlayer, privilege)
- GameWorld.Log(' privilege=%s,data=%s,curValue=%s,newData=%s'%(privilege, data,curValue,newData))
- return
-
-def GetMWSoulAward(curPlayer, privilege):
- #领取法宝之魂奖励
- ipyData = GetMagicWeaponPrivilege(curPlayer, privilege)
- if not ipyData:
- GameWorld.DebugLog('领取法宝之魂奖励,对应法宝之魂未激活,或未配置 privilege=%s'%privilege)
- return
- singleValue = ipyData.GetSingleValue()
- maxValue = ipyData.GetMaxValue()
- if singleValue:
- #达到进度则可领取属性
- curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWSoulCurValue % privilege)
- gotValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWSoulGotValue % privilege)
- if gotValue >= curValue:
- return
- canGetCnt = (curValue - gotValue) / singleValue
- if canGetCnt <= 0 and maxValue and curValue >= maxValue:
- canGetCnt = 1 #已达到次数上限,最后一次不管是否满足都让领(一般是因为配置错误或者变更导致)
- if canGetCnt <= 0:
- return
- updGotCnt = min(maxValue, gotValue+canGetCnt*singleValue) if maxValue else gotValue+canGetCnt*singleValue
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MWSoulGotValue % privilege, updGotCnt)
- CalcMagicWeaponSoulAttr(curPlayer)
- PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
-
-
- itemList = ipyData.GetItemAward()
- if itemList:
- #每日物品奖励
- if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWSoulGotItemState % privilege):
- GameWorld.Log(' 领取法宝之魂奖励 今日已领取 privilege=%s'%privilege)
- return
- needSpace = len(itemList)
- packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)
- if needSpace > packSpace:
- PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_676165", [IPY_GameWorld.rptItem])
- return
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MWSoulGotItemState % privilege, 1)
- for itemid, cnt, isBind in itemList:
- ItemControler.GivePlayerItem(curPlayer, int(itemid), int(cnt), isBind,
- [IPY_GameWorld.rptItem], True, showSysInfo=True, event=["MWSoulAward", False, {"privilege":privilege}])
-
- #通知
- Sycn_MWPrivilegeData(curPlayer, privilege)
- return
-
-def Sycn_MWPrivilegeData(curPlayer, privilegeID= -1, isForce=False):
- #通知法宝特权信息
- if privilegeID == -1:
- needCalList = ChConfig.MWPrivilegeList
- else:
- needCalList = [privilegeID]
- sendPack = ChPyNetSendPack.tagMCMWPrivilegeDataInfo()
- sendPack.InfoList = []
- for priID in needCalList:
- pack = ChPyNetSendPack.tagMCMWPrivilegeData()
- pack.CurValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWSoulCurValue % priID)
- pack.GotValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWSoulGotValue % priID)
- pack.ItemAwardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MWSoulGotItemState % priID)
- pack.State = GetIsActiveMWSoul(curPlayer, priID)
- if not isForce and max([pack.CurValue, pack.GotValue, pack.ItemAwardState, pack.State]) == 0:
- continue
- pack.PriID = priID
- sendPack.InfoList.append(pack)
- sendPack.Count = len(sendPack.InfoList)
- if sendPack.Count:
- NetPackCommon.SendFakePack(curPlayer, sendPack)
- return
-
-#// A5 16 法宝状态记录 #tagCMMagicWeaponState
-#
-#struct tagCMMagicWeaponState
-#
-#{
-# tagHead Head;
-# DWORD MWID; //法宝ID
-#};
-def SaveMagicWeaponState(index, clientData, tick):
- curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
- mwID = clientData.MWID
- if GetIsClickMagicWeapon(curPlayer, mwID):
- return
- SetMagicWeaponClickState(curPlayer, mwID)
- Sycn_MagicWeaponLV(curPlayer, mwID)
- return
-
-def GetIsClickMagicWeapon(curPlayer, mwID):
- #获取法宝是否点击认主
- return GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_MagicWeaponIsClick, mwID % 100, True, [mwID / 100])
-
-def SetMagicWeaponClickState(curPlayer, mwID, state=1):
- #设置法宝是否点击认主状态
- GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_MagicWeaponIsClick, mwID % 100, state, True, [mwID / 100])
- return
#// A5 1D 法宝佩戴 #tagCMWearMagicWeapon
#
@@ -805,7 +581,7 @@
if hasWearCnt >= maxCnt:
return
if GetIsWearMagicWeapon(curPlayer, mid):
- hasWearCnt +=1
+ hasWearCnt += 1
SetMagicWeaponWearState(curPlayer, mwID, isWear)
CalcMagicWeaponAttr(curPlayer)
@@ -813,84 +589,27 @@
Sycn_MagicWeaponLV(curPlayer, mwID)
return
+
def GetIsWearMagicWeapon(curPlayer, mwID):
#获取法宝是否佩戴
- return GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_MagicWeaponIsWear, mwID % 100, True, [mwID / 100])
+ return GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_MagicWeaponIsWear, mwID, True)
+
def SetMagicWeaponWearState(curPlayer, mwID, state):
#设置法宝是否佩戴
- GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_MagicWeaponIsWear, mwID % 100, state, True, [mwID / 100])
+ GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_MagicWeaponIsWear, mwID, state, True)
return
-#// A5 12 激活法宝之魂 #tagCMActiveMWSoul
+#// A5 12 感应法宝 #tagCMThinkMagicWeapon
#
-#struct tagCMActiveMWSoul
-#
+#struct tagCMThinkMagicWeapon
#{
# tagHead Head;
-# BYTE ID; //编号
+# DWORD MWID;
#};
-def OnActiveMWSoul(index, clientData, tick):
+def OnThinkMagicWeapon(index, clientData, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
- soulID = clientData.ID
- ipyData = IpyGameDataPY.GetIpyGameData('TreasurePrivilege', soulID)
- if not ipyData:
- return
- if GetIsActiveMWSoul(curPlayer, soulID):
- GameWorld.Log(' 该法宝之魂已经激活!! soulID=%s'%soulID)
- return
- #检查成就
- succList = ipyData.GetSuccessList()
- for succID in succList:
- if not PlayerSuccess.GetSuccHasGot(curPlayer, succID):
- GameWorld.DebugLog(' 激活法宝之魂 成就未完成 soulID=%s,succID=%s'%(soulID, succID))
- return
-
- __DoActiveMWSoul(curPlayer, soulID)
- return
-
-def __DoActiveMWSoul(curPlayer, soulID, isRefreshAttr=True):
- GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_MWSoulActiveState, soulID, 1, True)
- #任务
- EventShell.EventRespons_MWSoulActive(curPlayer, soulID)
-
- CalcMagicWeaponSoulAttr(curPlayer)
- if isRefreshAttr:
- PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
-
- #通知
- Sycn_MWPrivilegeData(curPlayer, soulID)
- return
-
-
-def GetIsActiveMWSoul(curPlayer, soulID):
- #获取法宝之魂是否已激活
- return GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_MWSoulActiveState, soulID)
-
-def CalcMagicWeaponSoulAttr(curPlayer):
- #法宝之魂属性刷新
- allAttrList = [{} for _ in range(4)]
- allAttrDict = {}
- ipyMgr = IpyGameDataPY.IPY_Data()
- for i in xrange(ipyMgr.GetTreasurePrivilegeCount()):
- ipyData = ipyMgr.GetTreasurePrivilegeByIndex(i)
- soulID = ipyData.GetPrivilegeID()
- if not GetIsActiveMWSoul(curPlayer, soulID):
- continue
- attrDict = GetMagicWeaponPrivilegeAttr(curPlayer, soulID)
- GameWorld.AddDictValue(allAttrDict, attrDict)
-
- for attrID, attrValue in allAttrDict.items():
- PlayerControl.CalcAttrDict_Type(attrID, attrValue, allAttrList)
- PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_MagicWeaponSoul, allAttrList)
- return
-
-def UptateMWFBPasslv(curPlayer, mwID, passLV):
- GameWorld.Log('更新关卡 mwID=%s,level=%s'%(mwID, passLV), curPlayer.GetID())
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MWFBPassLevel % mwID, passLV)
- CalcMagicWeaponAttr(curPlayer)
- PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
- Sycn_MagicWeaponLV(curPlayer, mwID)
-
- EventShell.EventRespons_MagicWeaponFBPassLV(curPlayer, mwID, passLV)
+ mwID = clientData.MWID
+ #只触发任务接口
+ EventShell.EventRespons_ThinkMagicWeapon(curPlayer)
return
\ No newline at end of file
--
Gitblit v1.8.0