| | |
| | | import PlayerRune
|
| | | import Operate_EquipStone
|
| | | import Operate_EquipWash
|
| | | import Operate_EquipSuitCompose
|
| | | import PlayerFeastRedPacket
|
| | | import PlayerDogz
|
| | | import QuestCommon
|
| | | import DataRecordPack
|
| | |
| | | SetSuccFinish(curPlayer, succID, 0)
|
| | |
|
| | | Sync_SuccTypeIndexAwardRecord(curPlayer, [succID], True) #设置成未领取的在外层同步
|
| | | PlayerMagicWeapon.ActiveMagicWeapon(curPlayer, succID)
|
| | | EventShell.EventRespons_SuccessFinish(curPlayer, succID)
|
| | |
|
| | | return
|
| | |
|
| | | def GetSuccPassportAwardHasGot(curPlayer, succID):
|
| | | #获取成就通行证奖励是否已领取
|
| | | return GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_Success_PassportAward, succID)
|
| | | def SetSuccPassportAwardHasGot(curPlayer, succID, hasGot=True):
|
| | | #设置成就通行证奖励领取状态
|
| | | GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_Success_PassportAward, succID, hasGot)
|
| | | if hasGot:
|
| | | Sync_SuccTypeIndexAwardRecord(curPlayer, [succID])
|
| | | return
|
| | | |
| | | def SetSuccFinishValue(curPlayer, succType, condition, value):
|
| | | #设置成就完成度
|
| | | key = ChConfig.Def_PDict_Success_CntValue % (succType, condition)
|
| | |
| | | self.preSuccIDList = [] # 前置成就ID
|
| | | self.condition = [] # 辅助条件(根据类型自定义配置)
|
| | | self.awardItemDict = {} # 完成成就可领取的奖励物品{itemid:itemcnt}
|
| | | self.awardItemDict2 = {} # 完成成就可领取的奖励物品,通行证奖励{itemid:itemcnt}
|
| | | self.moneyDict = {} # 完成成就获得的金钱 {moneyType:money}
|
| | | self.exp = 0 # 完成成就获得的经验
|
| | | self.attrDict = {} # 完成成就获得的属性 {attrid:attrvalue}
|
| | |
| | | succData.preSuccIDList = list(successIpyData.GetPreSuccess())
|
| | | succData.condition = list(successIpyData.GetCondition())
|
| | | succData.awardItemDict = successIpyData.GetAwardItem()
|
| | | succData.awardItemDict2 = successIpyData.GetAwardItem2()
|
| | | succData.moneyDict = successIpyData.GetMoney()
|
| | | succData.exp = successIpyData.GetExp()
|
| | | succData.attrDict = successIpyData.GetAwardAttr()
|
| | |
| | | magicWeaponExp = successIpyData.GetMagicWeaponExp()
|
| | | if magicWeaponID and magicWeaponExp:
|
| | | succData.magicWeaponExp[magicWeaponID] = magicWeaponExp
|
| | | succData.hasAward = bool(succData.awardItemDict or succData.moneyDict or succData.exp or succData.attrDict or succData.redPacketID or succData.magicWeaponExp)
|
| | | succData.hasAward = bool(succData.awardItemDict or succData.moneyDict or succData.exp or succData.attrDict or succData.redPacketID or succData.magicWeaponExp \
|
| | | or succData.awardItemDict2)
|
| | | successDataObjDict[succData.succID]=succData
|
| | | if tuple(succData.condition) not in conditionDict:
|
| | | conditionDict[tuple(succData.condition)] = [succData.succID]
|
| | |
| | | def __CheckOldPlayerSuccess(curPlayer):
|
| | | ''' 成就版本更新老玩家检查 每次启动服务后 玩家第一次上线检查成就完成情况
|
| | | '''
|
| | | #Versions = 2 #版本号,往上增加
|
| | | initGameWorldTime = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_InitGameWorldTime)
|
| | | # 上线需要检查老玩家成就完成情况类型{成就类型:维护版本号, ...}
|
| | | # 上线需要检查老玩家成就完成情况类型
|
| | | NeedCheckSuccTypeList = [
|
| | | ShareDefine.SuccType_GetMagicWeapon,
|
| | | ShareDefine.SuccType_PassRuneTower,
|
| | | ShareDefine.SuccType_GodWeapon,
|
| | | ShareDefine.SuccType_HorseAllLV,
|
| | | #ShareDefine.SuccType_EquipPlusLV,
|
| | | ShareDefine.SuccType_EquipColorItem,
|
| | | ShareDefine.SuccType_EquipArmor,
|
| | | ShareDefine.SuccType_EquipWeapon,
|
| | | ShareDefine.SuccType_InlayRune,
|
| | | ShareDefine.SuccType_RuneLvUp,
|
| | | ShareDefine.SuccType_RealmlvUp,
|
| | | ShareDefine.SuccType_PetClassLV,
|
| | | ShareDefine.SuccType_InlayStone1,
|
| | | ShareDefine.SuccType_InlayStone2,
|
| | | ShareDefine.SuccType_XJMJGetExp,
|
| | | ShareDefine.SuccType_EquipWashLV1,
|
| | | ShareDefine.SuccType_EquipWashLV2,
|
| | | ShareDefine.SuccType_EquipWashLV3,
|
| | | ShareDefine.SuccType_EquipWing,
|
| | | ShareDefine.SuccType_MWSkillUp,
|
| | | ShareDefine.SuccType_EquipSuit,
|
| | | ShareDefine.SuccType_FamilyTechLV,
|
| | | ShareDefine.SuccType_AlchemyLV,
|
| | | ShareDefine.SuccType_VIPLV,
|
| | | ShareDefine.SuccType_StoneTotalLV,
|
| | | ShareDefine.SuccType_XBXZ,
|
| | | ShareDefine.SuccType_DogzBattle,
|
| | | ShareDefine.SuccType_DogzEquipPlus,
|
| | | ShareDefine.SuccType_MainTaskNode,
|
| | | ShareDefine.SuccType_InlayGatherSoul,
|
| | | ShareDefine.SuccType_GatherSoulLvUp,
|
| | | ]
|
| | |
|
| | | curCheckVersion = GetPDictValue(curPlayer, ChConfig.Def_PDict_Success_CheckVersion)
|
| | |
| | | GameWorld.DebugLog("更新老玩家上线检查成就curCheckVersion=%s" % (curCheckVersion))
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for succType in NeedCheckSuccTypeList:
|
| | | if succType == ShareDefine.SuccType_GetMagicWeapon:
|
| | | |
| | | for i in xrange(ipyDataMgr.GetTreasureCount()):
|
| | | treasureIpyData = ipyDataMgr.GetTreasureByIndex(i)
|
| | | magicWeaponID = treasureIpyData.GetID()
|
| | | isActive = PlayerMagicWeapon.GetIsActiveMagicWeapon(curPlayer, magicWeaponID)
|
| | | if not isActive:
|
| | | continue
|
| | | curMWLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponLV % magicWeaponID)
|
| | | for lv in xrange(curMWLV+1):
|
| | | DoAddSuccessProgress(curPlayer, succType, 1, [magicWeaponID, lv])
|
| | | elif succType == ShareDefine.SuccType_PassRuneTower:
|
| | | passlv = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_TrialTower_PassLV)
|
| | | DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_PassRuneTower, 1, [passlv])
|
| | | elif succType == ShareDefine.SuccType_GodWeapon:
|
| | | maxType = ipyDataMgr.GetGodWeaponByIndex(ipyDataMgr.GetGodWeaponCount()-1).GetType()
|
| | | for i in xrange(1, maxType + 1):
|
| | | weaponLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GodWeaponLV % i)
|
| | | UptateSuccessProgress(curPlayer, succType, weaponLV, [i])
|
| | | elif succType == ShareDefine.SuccType_HorseAllLV:
|
| | | ResetSuccessByType(curPlayer, succType)
|
| | | for i in xrange(ipyDataMgr.GetHorseCount()):
|
| | | ipyData = ipyDataMgr.GetHorseByIndex(i)
|
| | | index = ipyData.GetHorseID()
|
| | | lv = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Horser_LV % index, 0, ChConfig.Def_PDictType_Horse)
|
| | | if not lv:
|
| | | continue
|
| | | for rlv in xrange(1, lv+1):
|
| | | DoAddSuccessProgress(curPlayer, succType, 1, [index, rlv])
|
| | | elif succType == ShareDefine.SuccType_EquipPlusLV:
|
| | | ResetSuccessByType(curPlayer, succType)
|
| | | for pType, indexList in ChConfig.Pack_EquipPart_CanPlusStar.items():
|
| | | for i in indexList:
|
| | | equipPartStarLV = ChEquip.GetEquipPartStarLV(curPlayer, pType, i)
|
| | | for pluslv in xrange(1, equipPartStarLV+1):
|
| | | DoAddSuccessProgress(curPlayer, succType, 1, [pluslv])
|
| | | |
| | | elif succType in [ShareDefine.SuccType_EquipColorItem, ShareDefine.SuccType_EquipArmor, ShareDefine.SuccType_EquipWeapon, ShareDefine.SuccType_EquipWing]:
|
| | | DoEquipSuccessLogic(curPlayer)
|
| | | elif succType in [ShareDefine.SuccType_InlayRune, ShareDefine.SuccType_RuneLvUp]:
|
| | | PlayerRune.DoRuneSuccessLogic(curPlayer)
|
| | | elif succType in [ShareDefine.SuccType_InlayGatherSoul, ShareDefine.SuccType_GatherSoulLvUp]:
|
| | | PlayerGatherSoul.DoGatherSoulSuccessLogic(curPlayer)
|
| | | elif succType == ShareDefine.SuccType_RealmlvUp:
|
| | | UptateSuccessProgress(curPlayer, succType, curPlayer.GetOfficialRank())
|
| | | elif succType == ShareDefine.SuccType_PetClassLV:
|
| | | ResetSuccessByType(curPlayer, succType)
|
| | | petDataPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptPet)
|
| | | for petDataIndex in range(petDataPack.GetCount()):
|
| | | petItem = petDataPack.GetAt(petDataIndex)
|
| | | if petItem.IsEmpty():
|
| | | continue
|
| | | petNPCID = petItem.GetUserAttr(ShareDefine.Def_IudetPet_NPCID)
|
| | | classLV = petItem.GetUserAttr(ShareDefine.Def_IudetPet_ClassLV)
|
| | | for lv in xrange(classLV+1):
|
| | | DoAddSuccessProgress(curPlayer, succType, 1, [petNPCID, lv+1])
|
| | | |
| | | elif succType in [ShareDefine.SuccType_InlayStone1, ShareDefine.SuccType_InlayStone2, ShareDefine.SuccType_StoneTotalLV]:
|
| | | Operate_EquipStone.DoStoneSuccess(curPlayer)
|
| | | elif succType == ShareDefine.SuccType_XJMJGetExp:
|
| | | expPointRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BZZD_TotalFightExpPoint)
|
| | | DoAddSuccessProgress(curPlayer, succType, 1, [expPointRecord])
|
| | | elif succType in [ShareDefine.SuccType_EquipWashLV1,ShareDefine.SuccType_EquipWashLV2,ShareDefine.SuccType_EquipWashLV3]:
|
| | | Operate_EquipWash.EquipWashSuccess(curPlayer)
|
| | | elif succType == ShareDefine.SuccType_MWSkillUp:
|
| | | skillManager = curPlayer.GetSkillManager()
|
| | | for i in range(0, skillManager.GetSkillCount()):
|
| | | curSkill = skillManager.GetSkillByIndex(i)
|
| | | if curSkill.GetFuncType() in [ChConfig.Def_SkillFuncType_FbSkill,ChConfig.Def_SkillFuncType_FbSPSkill]:
|
| | | curSkillLV = curSkill.GetSkillLV()
|
| | | UptateSuccessProgress(curPlayer, succType, curSkillLV, [curSkill.GetSkillTypeID()])
|
| | | |
| | | elif succType == ShareDefine.SuccType_EquipSuit:
|
| | | Operate_EquipSuitCompose.DoSuiteSuccess(curPlayer)
|
| | | elif succType == ShareDefine.SuccType_FamilyTechLV:
|
| | | techNeedLVDict = IpyGameDataPY.GetFuncEvalCfg('FamilyTechNeedLV', 1, {})
|
| | | techIDList = techNeedLVDict.keys()
|
| | | for techID in techIDList:
|
| | | techLV = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyTechLV % techID)
|
| | | UptateSuccessProgress(curPlayer, succType, techLV, [techID])
|
| | | elif succType == ShareDefine.SuccType_AlchemyLV:
|
| | | alchemyLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyLV)
|
| | | UptateSuccessProgress(curPlayer, succType, alchemyLV)
|
| | | elif succType == ShareDefine.SuccType_VIPLV:
|
| | | DoAddSuccessProgress(curPlayer, succType, 1, [curPlayer.GetVIPLv()])
|
| | | elif succType == ShareDefine.SuccType_XBXZ:
|
| | | ResetSuccessByType(curPlayer, succType)
|
| | | for i in xrange(ipyDataMgr.GetXBXZCount()):
|
| | | ipyData = ipyDataMgr.GetXBXZByIndex(i)
|
| | | if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_XBXZAwardRecord, ipyData.GetID()):
|
| | | DoAddSuccessProgress(curPlayer, succType, 1, [ipyData.GetMWID()])
|
| | |
|
| | | elif succType == ShareDefine.SuccType_DogzBattle:
|
| | | for i in xrange(ipyDataMgr.GetDogzCount()):
|
| | | ipyData = ipyDataMgr.GetDogzByIndex(i)
|
| | | if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_DogzFightState, i):
|
| | | DoAddSuccessProgress(curPlayer, succType, 1, [ipyData.GetDogzID()])
|
| | | |
| | | elif succType == ShareDefine.SuccType_DogzEquipPlus:
|
| | | ResetSuccessByType(curPlayer, succType)
|
| | | DoAddSuccessProgress(curPlayer, succType, PlayerDogz.GetFightDogzTotalPlusLv(curPlayer))
|
| | | elif succType == ShareDefine.SuccType_MainTaskNode: #只能处理主线任务
|
| | | succInfoList = GetSuccDataMng().GetSuccDataByType(succType)
|
| | | for succData in succInfoList:
|
| | | missionID = succData.condition[0]
|
| | | if QuestCommon.GetHadFinishMainMission(curPlayer, missionID):
|
| | | DoAddSuccessProgress(curPlayer, succType, 1, [missionID])
|
| | | |
| | | pass
|
| | | |
| | | DataRecordPack.DR_CheckOldPlayerSuccess(curPlayer)
|
| | | SetPDictValue(curPlayer, ChConfig.Def_PDict_Success_CheckVersion, initGameWorldTime)
|
| | | GameWorld.DebugLog("更新老玩家上线检查成就updCheckVersions=%s" % (initGameWorldTime), curPlayer.GetID())
|
| | |
| | | SetSuccHasGot(curPlayer, succID, False)
|
| | | resetList.append(succID)
|
| | | GameWorld.DebugLog(" OnWeek 重置成就类型: succID=%s" % (succID))
|
| | | if resetList:
|
| | | Sync_SuccTypeIndexAwardRecord(curPlayer, resetList, True)
|
| | | Sync_SuccessInfo(curPlayer, resetList, True)
|
| | | return
|
| | |
|
| | | def DoResetSuccessIDList(curPlayer, resetSuccIDList):
|
| | | ## 重置成就相关数据
|
| | | if not resetSuccIDList:
|
| | | return
|
| | | resetList = []
|
| | | for succID in resetSuccIDList:
|
| | | succData = GetSuccDataMng().GetSuccessData(succID)
|
| | | if not succData:
|
| | | continue
|
| | | succType = succData.succType
|
| | | condition = succData.condition
|
| | | #if not GetSuccFinishValue(curPlayer, succType, condition):
|
| | | # continue
|
| | | SetSuccFinishValue(curPlayer, succType, condition, 0)
|
| | | SetSuccFinish(curPlayer, succID, False)
|
| | | SetSuccHasGot(curPlayer, succID, False)
|
| | | resetList.append(succID)
|
| | | GameWorld.DebugLog(" 重置成就类型: succType=%s,succID=%s" % (succType, succID))
|
| | | if resetList:
|
| | | Sync_SuccTypeIndexAwardRecord(curPlayer, resetList, True)
|
| | | Sync_SuccessInfo(curPlayer, resetList, True)
|
| | |
| | | SetSuccFinishValue(curPlayer, succType, condition, 0)
|
| | | return
|
| | |
|
| | | def DoEquipSuccessLogic(curPlayer):
|
| | | def DoEquipSuccessLogic(curPlayer, classLV):
|
| | | #玩家当前可装备的装备类型
|
| | | ResetSuccessByType(curPlayer, ShareDefine.SuccType_EquipColorItem)
|
| | | ResetSuccessByType(curPlayer, ShareDefine.SuccType_EquipArmor)
|
| | | ResetSuccessByType(curPlayer, ShareDefine.SuccType_EquipWeapon)
|
| | |
|
| | | packType = IPY_GameWorld.rptEquip
|
| | | ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('EquipPlaceIndexMap', {'ClassLV':classLV}, True)
|
| | | if not ipyDataList:
|
| | | return
|
| | |
|
| | | playerEquip = curPlayer.GetItemManager().GetPack(packType)
|
| | | for equipIndex in xrange(playerEquip.GetCount()):
|
| | | if equipIndex not in ShareDefine.RoleEquipType :
|
| | | continue
|
| | | |
| | | placeCountDict, colorCountDict, suitCountDict = {}, {}, {}
|
| | | playerEquip = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
|
| | | for ipyData in ipyDataList:
|
| | | equipIndex = ipyData.GetGridIndex()
|
| | | curEquip = playerEquip.GetAt(equipIndex)
|
| | | if curEquip.IsEmpty():
|
| | | continue
|
| | | itemColor = curEquip.GetUserAttr(ShareDefine.Def_IudetItemColor)
|
| | | if not itemColor:
|
| | | itemPlace = curEquip.GetEquipPlace()
|
| | | |
| | | # 套装、颜色 成就 统计基础部位
|
| | | if itemPlace in ChConfig.EquipPlace_Base:
|
| | | itemColor = curEquip.GetItemColor()
|
| | | colorConditionKey = (classLV, itemColor)
|
| | | colorCountDict[colorConditionKey] = colorCountDict.get(colorConditionKey, 0) + 1
|
| | | |
| | | # 统计套装数
|
| | | if curEquip.GetSuiteID():
|
| | | suitConditionKey = (classLV, )
|
| | | suitCountDict[suitConditionKey] = suitCountDict.get(suitConditionKey, 0) + 1
|
| | | |
| | | # 部位 成就 统计特殊部位
|
| | | elif itemPlace in ChConfig.EquipPlace_Special:
|
| | | placeConditionKey = (classLV, itemPlace)
|
| | | placeCountDict[placeConditionKey] = placeCountDict.get(placeConditionKey, 0) + 1
|
| | | |
| | | # 更新成就
|
| | | #GameWorld.DebugLog("装备阶部位成就数据: classLV=%s,placeCountDict=%s" % (classLV, placeCountDict))
|
| | | UpdateSuccessProgressByConditions(curPlayer, ShareDefine.SuccType_EquipPlace, placeCountDict)
|
| | | |
| | | #GameWorld.DebugLog("装备阶颜色成就数据: classLV=%s,colorCountDict=%s" % (classLV, colorCountDict))
|
| | | UpdateSuccessProgressByConditions(curPlayer, ShareDefine.SuccType_EquipColorItem, colorCountDict)
|
| | | |
| | | #GameWorld.DebugLog("装备阶套装成就数据: classLV=%s,suitCountDict=%s" % (classLV, suitCountDict))
|
| | | UpdateSuccessProgressByConditions(curPlayer, ShareDefine.SuccType_EquipSuit, suitCountDict)
|
| | | return
|
| | |
|
| | | def UpdateSuccessProgressByConditions(curPlayer, successType, conditionCountDict):
|
| | | if successType not in ShareDefine.SuccessTypeList:
|
| | | return
|
| | | succInfoList = GetSuccDataMng().GetSuccDataByType(successType)
|
| | | if not succInfoList:
|
| | | return
|
| | | updIDList = []
|
| | | updsuccDataList = []
|
| | | updConditionDict = {}
|
| | | |
| | | for condition, newCount in conditionCountDict.items():
|
| | | addCondList = [] # 不同的成就ID条件可能相同,只是最大进度不同,故传入的条件计数针对相同成就条件只能累加一次
|
| | | for succDataObj in succInfoList:
|
| | | cond = succDataObj.condition
|
| | | |
| | | tupleCond = tuple(cond) # 作为字典key用
|
| | | succID = succDataObj.succID
|
| | | needCnt = succDataObj.needCnt
|
| | | |
| | | if tupleCond not in updConditionDict:
|
| | | updConditionDict[tupleCond] = [cond, 0, 0] # [条件, 更新值, 最大进度值]
|
| | | updInfo = updConditionDict[tupleCond]
|
| | | if updInfo[2] < needCnt:
|
| | | updInfo[2] = needCnt
|
| | | |
| | | if not __CheckCanAddSuccess(curPlayer, succDataObj, list(condition)):
|
| | | continue
|
| | | |
| | | if succID not in updIDList:
|
| | | updIDList.append(succID)
|
| | | updsuccDataList.append(succDataObj)
|
| | | |
| | | if tupleCond not in addCondList:
|
| | | addCondList.append(tupleCond)
|
| | | updConditionDict[tupleCond][1] = updConditionDict[tupleCond][1] + newCount # 更新进度值
|
| | | |
| | | # 没有找到更新目标不处理
|
| | | #GameWorld.DebugLog(" updConditionDict=%s" % updConditionDict)
|
| | | #GameWorld.DebugLog(" updIDList=%s" % updIDList)
|
| | | if not updIDList:
|
| | | return
|
| | | |
| | | isUpd = False
|
| | | # 先更新成就记录值后再判断完成与否
|
| | | for cond, updCnt, maxCnt in updConditionDict.values():
|
| | | if not updCnt:
|
| | | continue
|
| | | updCnt = min(maxCnt, updCnt)
|
| | | if GetSuccFinishValue(curPlayer, successType, cond) == updCnt:
|
| | | continue
|
| | | isUpd = True
|
| | | SetSuccFinishValue(curPlayer, successType, cond, updCnt)
|
| | | #GameWorld.DebugLog(" successType=%s,cond=%s,updCnt=%s,maxCnt=%s" % (successType, cond, updCnt, maxCnt))
|
| | |
|
| | | itemQuality = curEquip.GetItemQuality()
|
| | | classLV = ItemCommon.GetItemClassLV(curEquip)
|
| | | if equipIndex not in [ShareDefine.retWing,ShareDefine.retGuard,ShareDefine.retHorse]:
|
| | | DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_EquipColorItem, 1, [classLV, itemColor])
|
| | | if equipIndex in ChConfig.BaseEquipPlace_Weapon:
|
| | | DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_EquipWeapon, 1, [itemColor, itemQuality, classLV])
|
| | | elif equipIndex in ChConfig.BaseEquipPlace_Armor:
|
| | | DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_EquipArmor, 1, [itemColor, itemQuality, classLV])
|
| | | |
| | | elif equipIndex == ShareDefine.retWing:
|
| | | DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_EquipWing, 1, [classLV, itemColor])
|
| | | if not isUpd:
|
| | | return
|
| | | |
| | | # 同步更新信息
|
| | | Sync_SuccessInfo(curPlayer, updIDList, False)
|
| | | |
| | | # 更新值后检查成就完成情况
|
| | | __DoCheckSuccessFinish(curPlayer, successType, updsuccDataList)
|
| | | return
|
| | |
|
| | |
|
| | |
| | | def UptateSuccessProgress(curPlayer, successType, newCnt, condition=[]):
|
| | | if successType not in ShareDefine.SuccessTypeList:
|
| | | return
|
| | | if successType in ShareDefine.FeastRedPackSuccessTypeList:
|
| | | if not PlayerFeastRedPacket.GetFeastRedPacketState():
|
| | | return
|
| | | succInfoList = GetSuccDataMng().GetSuccDataByType(successType)
|
| | | if not succInfoList:
|
| | | return
|
| | |
| | | succID = succDataObj.succID
|
| | | cond = succDataObj.condition
|
| | |
|
| | | if successType in ShareDefine.FeastRedPackSuccessTypeList:
|
| | | todayFeastSuccIDList = PlayerFeastRedPacket.GetTodayFeastSuccIDList()
|
| | | if not todayFeastSuccIDList or succID not in todayFeastSuccIDList:
|
| | | #GameWorld.DebugLog(" 非今日节日红包成就,不增加进度! succID=%s,todayFeastSuccIDList=%s" % (succID, todayFeastSuccIDList))
|
| | | return
|
| | | isUnDownCheck = successType in ShareDefine.UnDownCheckSuccessTypeList
|
| | | isContain = successType in ShareDefine.ContainSuccessTypeList
|
| | | # 已完成的不再检查
|
| | |
| | | # 可向下增加进度的, 仅配置值 <= 该值的可增加进度
|
| | | if not isUnDownCheck:
|
| | | isbreak = False
|
| | | undowncheckIndexList = [] # 不向下检查的条件索引
|
| | | if successType in ShareDefine.PartUnDownCheckSuccessTypeInfo:
|
| | | undowncheckIndexList = ShareDefine.PartUnDownCheckSuccessTypeInfo[successType]
|
| | | for i, num in enumerate(cond):
|
| | | if i in undowncheckIndexList:
|
| | | if num != condition[i]:
|
| | | isbreak = True
|
| | | break
|
| | | if num > condition[i]:
|
| | | isbreak = True
|
| | | break
|
| | |
| | | def DoAddSuccessProgress(curPlayer, successType, addCnt, condition=[], delayCalc=True):
|
| | | #GameWorld.DebugLog("DoAddSuccessProgress type=%s,addCnt=%s,condition=%s"
|
| | | # % (successType, addCnt, condition), curPlayer.GetPlayerID())
|
| | |
|
| | | if GameWorld.IsCrossServer():
|
| | | return
|
| | | |
| | | if successType in ShareDefine.FeastRedPackSuccessTypeList:
|
| | | if not PlayerFeastRedPacket.GetFeastRedPacketState():
|
| | | #GameWorld.DebugLog("非节日红包活动时间,不增加成就!successType=%s" % successType)
|
| | | return
|
| | | |
| | | playerID = curPlayer.GetID()
|
| | | if delayCalc and successType not in ShareDefine.NeedResetSuccessTypeList:
|
| | | if playerID not in PyGameData.g_delaySuccessDict:
|
| | |
| | | awardDict[itemID] = awardDict.get(itemID, 0)+itemCnt
|
| | | return awardDict
|
| | |
|
| | | def GetSuccessPassportState(curPlayer):
|
| | | ## 成就通行证状态
|
| | | return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGGoodsBuyCount % ChConfig.Def_CTGID_SuccessPassport) > 0
|
| | |
|
| | | #// A5 42 领取成就奖励 #tagMCGetSuccessAward
|
| | | #
|
| | | #struct tagMCGetSuccessAward
|
| | | #{
|
| | | # tagHead Head;
|
| | | # DWORD SuccID; //成就ID
|
| | | # BYTE IsPassport; //是否通行证奖励
|
| | | #};
|
| | | ## 领取成就奖励
|
| | | # @param None
|
| | | # @return
|
| | | def OnGetSuccessAward(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | succID = clientData.SuccID
|
| | | __DoGetSuccTypeIndexAward(curPlayer, succID)
|
| | | isPassport = clientData.IsPassport
|
| | | __DoGetSuccTypeIndexAward(curPlayer, succID, isPassport=isPassport)
|
| | | return
|
| | |
|
| | | ## 领取某个成就奖励
|
| | | # @param None
|
| | | # @return
|
| | | def __DoGetSuccTypeIndexAward(curPlayer, succID, isGiveItem=True):
|
| | | GameWorld.DebugLog("领取成就奖励succID=%s" % (succID))
|
| | | def __DoGetSuccTypeIndexAward(curPlayer, succID, isGiveItem=True, isPassport=False):
|
| | | GameWorld.DebugLog("领取成就奖励succID=%s,isPassport=%s" % (succID, isPassport))
|
| | |
|
| | | succData = GetSuccDataMng().GetSuccessData(succID)
|
| | | if not succData:
|
| | | GameWorld.DebugLog(" 成就数据不存在!succID=%s" % (succID))
|
| | | return
|
| | | |
| | | finishTime = GetSuccIsFinish(curPlayer, succID)
|
| | | if finishTime <= 0:
|
| | | GameWorld.DebugLog(" 该成就未完成!")
|
| | | return
|
| | | |
| | | if GetSuccHasGot(curPlayer, succID):
|
| | | GameWorld.DebugLog(" 该成就奖励已经领取过!")
|
| | | return
|
| | | |
| | | |
| | | if not succData.hasAward:
|
| | | GameWorld.DebugLog(" 该成就没有配置奖励!")
|
| | | return
|
| | |
|
| | | itemDict = succData.awardItemDict
|
| | | finishTime = GetSuccIsFinish(curPlayer, succID)
|
| | | hasGot = GetSuccHasGot(curPlayer, succID) # 因为普通奖励领取后会重置是否已完成,所以如果已经领取普通奖励也代表已完成
|
| | | if finishTime <= 0 and not hasGot:
|
| | | GameWorld.DebugLog(" 该成就未完成!")
|
| | | return
|
| | | |
| | | if isPassport:
|
| | | if GetSuccPassportAwardHasGot(curPlayer, succID):
|
| | | GameWorld.DebugLog(" 该成就通行证奖励已经领取过!")
|
| | | return
|
| | | |
| | | if not GetSuccessPassportState(curPlayer):
|
| | | GameWorld.DebugLog(" 未开通成就通行证,无法领取通行证奖励!")
|
| | | return
|
| | | itemDict = succData.awardItemDict2
|
| | | if not itemDict:
|
| | | GameWorld.DebugLog(" 该成就没用通行证奖励!")
|
| | | return
|
| | | else:
|
| | | if hasGot:
|
| | | GameWorld.DebugLog(" 该成就奖励已经领取过!")
|
| | | return
|
| | | itemDict = succData.awardItemDict
|
| | | |
| | | # if awardItemDict and '[' in str(awardItemDict):
|
| | | # #修行成就奖励根据境界等级变
|
| | | # curRealmLV = curPlayer.GetOfficialRank()
|
| | |
| | | # else:
|
| | | # itemDict = awardItemDict
|
| | |
|
| | | |
| | | |
| | | |
| | | # 检查背包
|
| | | if isGiveItem:
|
| | | packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem)
|
| | | needSpace = len(itemDict)
|
| | | if needSpace > packSpace:
|
| | | PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
|
| | | if not ItemCommon.CheckPackEnough(curPlayer, itemDict):
|
| | | return
|
| | | # packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem)
|
| | | # needSpace = len(itemDict)
|
| | | # if needSpace > packSpace:
|
| | | # PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
|
| | | # return
|
| | |
|
| | | # 更新领奖记录
|
| | | SetSuccHasGot(curPlayer, succID)
|
| | | if isPassport:
|
| | | SetSuccPassportAwardHasGot(curPlayer, succID)
|
| | | else:
|
| | | SetSuccHasGot(curPlayer, succID)
|
| | |
|
| | | # 给物品
|
| | | if isGiveItem:
|
| | | for itemID, itemCnt in itemDict.items():
|
| | | isPutIn = ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 1,
|
| | | [IPY_GameWorld.rptItem, IPY_GameWorld.rptAnyWhere], True)
|
| | | isPutIn = ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 0, [IPY_GameWorld.rptItem, IPY_GameWorld.rptAnyWhere])
|
| | |
|
| | | if isPassport:
|
| | | # 通行证奖励只给物品
|
| | | return itemDict
|
| | | |
| | | #给钱
|
| | | for moneyType, value in succData.moneyDict.items():
|
| | | PlayerControl.GiveMoney(curPlayer, moneyType, value)
|
| | |
| | | if succIDList:
|
| | | recordIndexList = []
|
| | | for succID in succIDList:
|
| | | recordIndexList.append(succID / 31)
|
| | | recordIndex = succID / 31
|
| | | if recordIndex not in recordIndexList:
|
| | | recordIndexList.append(recordIndex)
|
| | | else:
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | succCnt = ipyDataMgr.GetSuccessCount()
|
| | | if not succCnt:
|
| | | return
|
| | | maxSuccid = ipyDataMgr.GetSuccessByIndex(succCnt-1).GetID()
|
| | | recordIndexList = range(maxSuccid / 31+1)
|
| | | recordIndexList = xrange(maxSuccid / 31+1)
|
| | |
|
| | | succFARPack = ChPyNetSendPack.tagMCSuccessFinishAwardRecordList()
|
| | | succFARPack.Clear()
|
| | | succFARPack.RecordList = []
|
| | | for i in recordIndexList:
|
| | | awardRecord=curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Success_AwardRecord%i)
|
| | | if not isSyncZero and not awardRecord:
|
| | | passportAwardRecord=curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Success_PassportAward%i)
|
| | | if not isSyncZero and not awardRecord and not passportAwardRecord:
|
| | | continue
|
| | | recordInfo = ChPyNetSendPack.tagMCSuccessFinishAwardRecord()
|
| | | recordInfo.RecordIndex = i
|
| | | recordInfo.Record = awardRecord
|
| | | recordInfo.PassportRecord = passportAwardRecord
|
| | | succFARPack.RecordList.append(recordInfo)
|
| | | |
| | | |
| | | succFARPack.RecordCnt = len(succFARPack.RecordList)
|
| | | NetPackCommon.SendFakePack(curPlayer, succFARPack)
|
| | | return
|