| | |
| | | import PlayerWeekParty
|
| | | import ShareDefine
|
| | | import EventShell
|
| | |
|
| | | #import EquipZhuXian
|
| | |
|
| | | g_stoneCanPlaceList = [] #可镶嵌的位置
|
| | |
|
| | |
|
| | | #def OnLogin(curPlayer):
|
| | | # ###登录发包同步客户端宝石信息
|
| | |
| | | g_stoneCanPlaceList.append(gridIndex)
|
| | | return g_stoneCanPlaceList
|
| | |
|
| | |
|
| | | def GetAllEquipPlaceHoleIndex():
|
| | | ### 得到装备位所有孔位
|
| | | gemOpenNeedStarList = IpyGameDataPY.GetFuncEvalCfg("GemOpen", 1)
|
| | |
| | |
|
| | | return range(maxEquipHoleCnt) + range(ChConfig.Def_Stone_VipHole, ChConfig.Def_Stone_VipHole + maxHoleVipCnt)
|
| | |
|
| | |
|
| | | def GetEquipIndexStoneIDList(curPlayer, equipIndex):
|
| | | ### 装备位孔位宝石ID列表
|
| | |
|
| | |
| | | stoneID = GetEquipIndexStoneIDAndIsBand(curPlayer, equipIndex, holeIndex) [0]
|
| | | holeStoneIDList.append(stoneID)
|
| | | return holeStoneIDList
|
| | |
|
| | |
|
| | | def GetEquipIndexStoneIDAndIsBand(curPlayer, equipIndex, holeIndex):
|
| | | '''获得装备位孔位宝石ID和绑定信息
|
| | |
| | | #获取装备位孔位上宝石是否绑定状态
|
| | | stoneIsBind = stoneInfo % ChConfig.Def_Stone_SaveStoneInfoXNumber
|
| | | return stoneID, stoneIsBind
|
| | |
|
| | |
|
| | | def SetEquipIndexStoneIDAndIsBand(curPlayer, equipIndex, holeIndex, changeStoneID, isBind):
|
| | | ### 保存装备位孔位宝石ID和绑定信息
|
| | |
| | | befTotalStoneLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TotalStoneLV)
|
| | | updTotalStoneLV = max(0, befTotalStoneLV + aftStoneLV - befStoneLV)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TotalStoneLV, updTotalStoneLV)
|
| | | GameWorld.DebugLog("设置宝石等级: equipIndex=%s,holeIndex=%s,befStoneLV=%s,aftStoneLV=%s,befTotalStoneLV=%s,updTotalStoneLV=%s" |
| | | GameWorld.DebugLog(
|
| | | "设置宝石等级: equipIndex=%s,holeIndex=%s,befStoneLV=%s,aftStoneLV=%s,befTotalStoneLV=%s,updTotalStoneLV=%s"
|
| | | % (equipIndex, holeIndex, befStoneLV, aftStoneLV, befTotalStoneLV, updTotalStoneLV))
|
| | | return
|
| | |
|
| | |
|
| | | def GetPackTypeByEquipPlace(equipPlace):
|
| | | ##目前支持镶嵌普通装备、诛仙装备
|
| | |
| | | stonePackType = IPY_GameWorld.rptItem
|
| | | placeIndex = equipPlace
|
| | | return equipPackType, stonePackType, placeIndex
|
| | |
|
| | |
|
| | | #//A3 04 宝石镶嵌或替换 #tagCMEquipEnchase
|
| | | #struct tagCMEquipEnchase
|
| | |
| | | stoneIndex = clientData.StoneIndex
|
| | | holeIndex = clientData.HoleIndex
|
| | |
|
| | | GameWorld.DebugLog("宝石镶嵌: equipPackIndex=%s,stoneIndex=%s,holeIndex=%s" % (equipPackIndex, stoneIndex, holeIndex), playerID)
|
| | | GameWorld.DebugLog("宝石镶嵌: equipPackIndex=%s,stoneIndex=%s,holeIndex=%s" % (equipPackIndex, stoneIndex, holeIndex),
|
| | | playerID)
|
| | | equipPackType, stonePackType, placeIndex = GetPackTypeByEquipPlace(equipPackIndex)
|
| | |
|
| | | #获得装备位装备实例
|
| | |
| | | return
|
| | |
|
| | | # 扣除宝石
|
| | | ItemCommon.DelItem(curPlayer, curStone, 1, True, ChConfig.ItemDel_EquipEnchase, {"equipPackIndex":equipPackIndex, "HoleIndex":holeIndex})
|
| | | ItemCommon.DelItem(curPlayer, curStone, 1, True, ChConfig.ItemDel_EquipEnchase,
|
| | | {"equipPackIndex": equipPackIndex, "HoleIndex": holeIndex})
|
| | |
|
| | | isBind = 1 if isBind else 0
|
| | |
|
| | |
| | |
|
| | | EventShell.EventRespons_InlayStone(curPlayer)
|
| | | return
|
| | |
|
| | |
|
| | | def DoStoneSuccess(curPlayer):
|
| | | PlayerSuccess.ResetSuccessByType(curPlayer, ShareDefine.SuccType_InlayStone1)
|
| | |
| | | PlayerSuccess.UptateSuccessProgress(curPlayer, ShareDefine.SuccType_StoneTotalLV, totalStoneLV)
|
| | | PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_Stone, totalStoneLV, False, True)
|
| | | return
|
| | |
|
| | |
|
| | | #//A3 05 宝石摘取 #tagCMEquipStonePick
|
| | | #struct tagCMEquipStonePick
|
| | |
| | | PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_Stone, totalStoneLV, False, True)
|
| | | return
|
| | |
|
| | |
|
| | | def GetTotalStoneLV(curPlayer):
|
| | | ##宝石总等级
|
| | | return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TotalStoneLV)
|
| | |
|
| | |
|
| | | def GetStoneCntByLV(curPlayer, stoneLV):
|
| | | ##指定等级的宝石数量
|
| | |
| | | if gemLV >= stoneLV:
|
| | | cnt += 1
|
| | | return cnt
|
| | |
|
| | |
|
| | | #// A3 06 宝石升级 #tagCMEquipStoneUpgrade
|
| | | #struct tagCMEquipStoneUpgrade
|
| | |
| | | ipyData = IpyGameDataPY.GetIpyGameDataByCondition('EquipPlaceIndexMap', {'GridIndex':equipPackIndex})
|
| | | if not ipyData:
|
| | | return
|
| | | # 额外材料
|
| | | extraItemInfoDict = IpyGameDataPY.GetFuncEvalCfg("GemUpCostFormula", 3, {})
|
| | | classLV = ipyData.GetClassLV()
|
| | | if upWay == 0: #仙玉
|
| | | stoneTypeItemIDDict = IpyGameDataPY.GetFuncEvalCfg("GemUpCostFormula", 1)
|
| | |
| | | return
|
| | | costCount = pow(needCount, level - 1) * (needCount - 1)
|
| | | costGold = costCount * unitPrice
|
| | | # 额外材料
|
| | | costExtraItemDict = {}
|
| | | i, cnt =0, 1
|
| | | for lv in xrange(level+1, 1, -1):
|
| | | cnt =1 if i is 0 else pow(needCount, i-1)
|
| | | i+=1
|
| | | extraItemInfo = extraItemInfoDict.get(str(lv))
|
| | | if extraItemInfo:
|
| | | extraItemID, extraItemCnt = extraItemInfo
|
| | | extraItemPrice = ItemCommon.GetShopItemPrice(extraItemID, IPY_GameWorld.TYPE_Price_Gold_Money)
|
| | | if not extraItemPrice:
|
| | | return
|
| | | costGold += extraItemPrice * extraItemCnt * cnt
|
| | | costExtraItemDict[extraItemID] = costExtraItemDict.get(extraItemID, 0) + extraItemCnt * cnt
|
| | | if costGold <= 0:
|
| | | return
|
| | | infoDict = {"StoneItemID":stoneItemID, "CurStoneIDLV":level, "UpgradeStoneID":upgradeStoneID, "CostCount":costCount, "UnitPrice":unitPrice}
|
| | | if not PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, costGold, ChConfig.Def_Cost_EquipStone, infoDict):
|
| | | infoDict = {"StoneItemID": stoneItemID, "CurStoneIDLV": level, "UpgradeStoneID": upgradeStoneID,
|
| | | "CostCount": costCount, "UnitPrice": unitPrice, 'costExtraItemDict':costExtraItemDict}
|
| | |
|
| | | if not PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, costGold,
|
| | | ChConfig.Def_Cost_EquipStone, infoDict):
|
| | | GameWorld.DebugLog("仙玉不足!costGold=%s" % costGold)
|
| | | return
|
| | | else:
|
| | | #同级宝石
|
| | | costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, stoneItemID, packType=stonePackType)
|
| | | if bindCnt + unBindCnt < needCount-1:
|
| | | GameWorld.DebugLog("同级宝石不足 %s!" % (needCount-1))
|
| | | return
|
| | | if stoneIsBind:
|
| | | costIndexList = (costItemIndexList[0]+costItemIndexList[1])[:2]
|
| | | else:
|
| | | costIndexList = (costItemIndexList[1]+costItemIndexList[0])[:2]
|
| | | costItemDict = {stoneItemID:needCount - 1}
|
| | | if str(level + 1) in extraItemInfoDict:
|
| | | extraItemID, extraItemCnt = extraItemInfoDict[str(level + 1)]
|
| | | costItemDict[extraItemID] = extraItemCnt
|
| | | itemPack = curPlayer.GetItemManager().GetPack(stonePackType)
|
| | | hasBind = ItemCommon.ReduceItem(curPlayer, itemPack, costIndexList, needCount-1, False, ChConfig.ItemDel_StoneUpgrade, |
| | | delItemList = []
|
| | | for itemID, itemCnt in costItemDict.items():
|
| | | hasEnough, itemIndexList = ItemCommon.GetItem_FromPack_ByID(itemID, itemPack, itemCnt)
|
| | | if not hasEnough:
|
| | | GameWorld.DebugLog("材料不足 itemID=%s!,needCnt=%s" % (itemID, itemCnt))
|
| | | return
|
| | | delItemList.append([itemIndexList, itemCnt])
|
| | | for delItemIndexList, delCnt in delItemList:
|
| | | ItemCommon.ReduceItem(curPlayer, itemPack, delItemIndexList, delCnt, False,
|
| | | ChConfig.ItemDel_StoneUpgrade,
|
| | | {"equipPackIndex":equipPackIndex, "HoleIndex":holeIndex})
|
| | | if hasBind:
|
| | | stoneIsBind = True
|
| | |
|
| | |
|
| | | __DoChangeEquipHoleStone(curPlayer, equipPackIndex, holeIndex, upgradeStoneID, stoneIsBind, "StoneUpgrade", False)
|
| | | __DoChangeEquipHoleStone(curPlayer, equipPackIndex, holeIndex, upgradeStoneID, False, "StoneUpgrade", False)
|
| | |
|
| | | # 刷新属性
|
| | | RefreshAttrByStoneAction(curPlayer, equipPackType, False, classLV)
|
| | |
| | |
|
| | | return True
|
| | |
|
| | |
|
| | | def __DoChangeEquipHoleStone(curPlayer, equipPackIndex, holeIndex, changeStoneID, isBind, eventName, isPickoff):
|
| | | ## 变更玩家装备孔宝石
|
| | |
|
| | |
| | | if ItemCommon.CheckPackHasSpace(curPlayer, stonePackType):
|
| | | ItemControler.GivePlayerItem(curPlayer, stoneID, itemCount, 0,
|
| | | [stonePackType],
|
| | | event=[ChConfig.ItemGive_StonePickoff, False, {"equipPackIndex":equipPackIndex, "HoleIndex":holeIndex}])
|
| | | event=[ChConfig.ItemGive_StonePickoff, False,
|
| | | {"equipPackIndex": equipPackIndex, "HoleIndex": holeIndex}])
|
| | | else:
|
| | | PlayerControl.SendMailByKey("GemToPlayer", [curPlayer.GetPlayerID()], [[stoneID, 1, stoneIsBind]])
|
| | |
|
| | | DataRecordPack.DR_StoneItemChange(curPlayer, eventName, {'equipPackIndex':equipPackIndex,"holeIndex":holeIndex, "stoneID":stoneID, 'changeStoneID':changeStoneID})
|
| | | DataRecordPack.DR_StoneItemChange(curPlayer, eventName,
|
| | | {'equipPackIndex': equipPackIndex, "holeIndex": holeIndex, "stoneID": stoneID,
|
| | | 'changeStoneID': changeStoneID})
|
| | | EventShell.EventRespons_StoneChange(curPlayer)
|
| | | return
|
| | |
|
| | |
| | | __DoSysPickoffEquipStone(curPlayer, equipPackType, stonePackType, pickoffHoleList, "EquipChange", False)
|
| | | return
|
| | |
|
| | |
|
| | | def OnVIPTimeOut(curPlayer):
|
| | | ## VIP到期处理
|
| | | #过期一样有效,屏蔽该逻辑
|
| | | return
|
| | |
|
| | |
|
| | | def __DoSysPickoffEquipStone(curPlayer, equipPackType, stonePackType, pickoffHoleList, eventName, isRefreshAttr):
|
| | | ## 系统摘除宝石
|
| | |
| | | stoneInfo = GetEquipIndexStoneIDAndIsBand(curPlayer, equipIndex, holeIndex)
|
| | | mailItemInfoList.append([stoneInfo[0], 1, stoneInfo[1]])
|
| | | SetEquipIndexStoneIDAndIsBand(curPlayer, equipIndex, holeIndex, 0, 0)
|
| | | DataRecordPack.DR_StoneItemChange(curPlayer, eventName, {'changeStoneID':0,'equipIndex':equipIndex,"holeIndex":holeIndex, "stoneID":stoneInfo[0]})
|
| | | DataRecordPack.DR_StoneItemChange(curPlayer, eventName,
|
| | | {'changeStoneID': 0, 'equipIndex': equipIndex, "holeIndex": holeIndex,
|
| | | "stoneID": stoneInfo[0]})
|
| | | if equipIndex not in equipIndexList:
|
| | | equipIndexList.append(equipIndex)
|
| | | PlayerControl.SendMailByKey("GemToPlayer", [curPlayer.GetPlayerID()], mailItemInfoList)
|
| | |
| | | if equipIndexList:
|
| | | Sycn_StoneHoleInfo(curPlayer, equipIndexList)
|
| | | return
|
| | |
|
| | |
|
| | | def Sycn_StoneHoleInfo(curPlayer, equipIndexList=[]):
|
| | | ###同步客户端宝石信息
|
| | |
| | | sendPack.EquipCount = len(sendPack.InfoList)
|
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | | return
|
| | |
|