| | |
| | | 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,
|
| | | ShareDefine.SuccType_UseStoveBylv,
|
| | | ]
|
| | |
|
| | | 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:
|
| | | ResetSuccessByType(curPlayer, succType)
|
| | | 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_EquipPlusLV:
|
| | | ResetSuccessByType(curPlayer, succType)
|
| | | for pType, indexList in ChConfig.Pack_EquipPart_CanPlusStar.items():
|
| | | for i in indexList:
|
| | | equipPartStarLV = ChEquip.GetEquipPartPlusLV(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:
|
| | | ResetSuccessByType(curPlayer, succType)
|
| | | 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:
|
| | | ResetSuccessByType(curPlayer, succType)
|
| | | 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:
|
| | | ResetSuccessByType(curPlayer, succType)
|
| | | 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:
|
| | | ResetSuccessByType(curPlayer, succType)
|
| | | 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])
|
| | | elif succType == ShareDefine.SuccType_UseStoveBylv:
|
| | | ResetSuccessByType(curPlayer, succType)
|
| | | for i in xrange(ipyDataMgr.GetAttrFruitCount()):
|
| | | ipyData = ipyDataMgr.GetAttrFruitByIndex(i)
|
| | | fruitItemID = ipyData.GetID()
|
| | | hasUseCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AttrFruitEatCnt % fruitItemID)
|
| | | if ipyData.GetFuncID() == ShareDefine.Def_AttrFruitFunc_Stove:
|
| | | itemData = GameWorld.GetGameData().GetItemByTypeID(fruitItemID)
|
| | | if not itemData:
|
| | | continue
|
| | | DoAddSuccessProgress(curPlayer, succType, hasUseCnt, [itemData.GetLV()])
|
| | | |
| | | pass
|
| | | |
| | | DataRecordPack.DR_CheckOldPlayerSuccess(curPlayer)
|
| | | SetPDictValue(curPlayer, ChConfig.Def_PDict_Success_CheckVersion, initGameWorldTime)
|
| | | GameWorld.DebugLog("更新老玩家上线检查成就updCheckVersions=%s" % (initGameWorldTime), curPlayer.GetID())
|
| | |
| | | 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.retGuard1,ShareDefine.retGuard2,ShareDefine.retHorse]:
|
| | | DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_EquipColorItem, 1, [classLV, itemColor])
|
| | | if equipIndex in ChConfig.EquipPlace_BaseWeapon:
|
| | | DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_EquipWeapon, 1, [itemColor, itemQuality, classLV])
|
| | | elif equipIndex in ChConfig.EquipPlace_BaseArmor:
|
| | | 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
|
| | |
|
| | |
|
| | |
| | | # 可向下增加进度的, 仅配置值 <= 该值的可增加进度
|
| | | 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
|