| | |
| | | import EventShell
|
| | | import PlayerActivity
|
| | | import PlayerFairyCeremony
|
| | | import PlayerVip
|
| | |
|
| | | import copy
|
| | |
|
| | |
|
| | | ##功能开启
|
| | | def DoRefineStoveOpen(curPlayer):
|
| | |
| | | ##登录处理
|
| | | def DoOnLogin(curPlayer, tick):
|
| | | Sycn_AlchemyMsg(curPlayer)
|
| | | Sycn_AlchemyPrayMsg(curPlayer)
|
| | | return
|
| | |
|
| | | def OnDay(curPlayer):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AlchemyPrayCnt, 0)
|
| | | Sycn_AlchemyPrayMsg(curPlayer)
|
| | | return
|
| | |
|
| | | #// A5 76 玩家炼丹 #tagCMPlayerRefine
|
| | | #
|
| | |
| | | GameWorld.DebugLog("更新炼丹产出特殊物品次数: makeItemID=%s,outputCount=%s" % (makeItemID, outputCount), playerID)
|
| | |
|
| | | #给物品
|
| | | ItemControler.GivePlayerItem(curPlayer, makeItemID, itemCount, delItemHasBind, [IPY_GameWorld.rptItem], |
| | | notBindItemList = IpyGameDataPY.GetFuncEvalCfg("SpecialAlchemy", 4) # 固定不绑定的物品
|
| | | if makeItemID in notBindItemList:
|
| | | makeItemBind = False
|
| | | else:
|
| | | makeItemBind = delItemHasBind
|
| | | ItemControler.GivePlayerItem(curPlayer, makeItemID, itemCount, makeItemBind, [IPY_GameWorld.rptItem], |
| | | event=[ChConfig.ItemGive_Refine, False, {}])
|
| | |
|
| | | Sycn_AlchemyMsg(curPlayer, makeItemID)
|
| | |
| | | GameWorld.DebugLog("增加炼丹经验: alchemyLV=%s,addExp=%s,alchemyExp=%s" % (alchemyLV, addExp, alchemyExp), curPlayer.GetPlayerID())
|
| | |
|
| | | isLVUp = False
|
| | | stoveIpyData = IpyGameDataPY.GetIpyGameData("RefineStove", alchemyLV)
|
| | | stoveIpyData = IpyGameDataPY.GetIpyGameDataNotLog("RefineStove", alchemyLV)
|
| | | while stoveIpyData and stoveIpyData.GetUpNeedExp() and alchemyExp >= stoveIpyData.GetUpNeedExp():
|
| | | alchemyExp -= stoveIpyData.GetUpNeedExp()
|
| | | needExp = stoveIpyData.GetUpNeedExp()
|
| | | nextLV = alchemyLV + 1
|
| | | stoveIpyData = IpyGameDataPY.GetIpyGameDataNotLog("RefineStove", nextLV)
|
| | | if not stoveIpyData:
|
| | | GameWorld.DebugLog("没有下一级数据了,已满级!不可升级!", curPlayer.GetPlayerID())
|
| | | break
|
| | | |
| | | alchemyExp -= needExp
|
| | | alchemyLV += 1
|
| | | GameWorld.DebugLog(" 炼丹升级: alchemyLV=%s,alchemyExp=%s" % (alchemyLV, alchemyExp), curPlayer.GetPlayerID())
|
| | | stoveIpyData = IpyGameDataPY.GetIpyGameDataNotLog("RefineStove", alchemyLV)
|
| | | isLVUp = True
|
| | | EventShell.EventRespons_RefineStoveUp(curPlayer, alchemyLV)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AlchemyExp, alchemyExp)
|
| | | if not isLVUp:
|
| | | return False
|
| | |
|
| | | GameWorld.DebugLog("升级后剩余经验: %s" % alchemyExp, curPlayer.GetPlayerID())
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AlchemyLV, alchemyLV)
|
| | | PlayerSuccess.UptateSuccessProgress(curPlayer, ShareDefine.SuccType_AlchemyLV, alchemyLV)
|
| | |
|
| | |
| | | def CalcStoveAttr(curPlayer):
|
| | | # 果实加成
|
| | | allAttrYaoList = [{} for _ in range(4)]
|
| | | PlayerAttrFruit.CalcAttrFruitAddAtrr(curPlayer, allAttrYaoList, ShareDefine.Def_AttrFruitFunc_Stove)
|
| | | fightPowerEx = PlayerAttrFruit.CalcAttrFruitAddAtrr(curPlayer, allAttrYaoList, ShareDefine.Def_AttrFruitFunc_Stove)
|
| | | PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_StoveYao, allAttrYaoList)
|
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_MFPEx % ShareDefine.Def_MFPType_StoveYao, fightPowerEx)
|
| | |
|
| | | allAttrList = [{} for _ in range(4)]
|
| | | alchemyLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyLV)
|
| | |
| | |
|
| | | PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_Stove, allAttrList)
|
| | | return
|
| | |
|
| | | g_needAlchemyLVDict = {}
|
| | | def GetIsCanOutByAlchemyLV(curPlayer, itemID):
|
| | | #判断当前丹炉等级是否可产出该丹药
|
| | | global g_needAlchemyLVDict
|
| | | if not g_needAlchemyLVDict:
|
| | | ipyMgr = IpyGameDataPY.IPY_Data()
|
| | | for i in xrange(ipyMgr.GetAlchemyCount()):
|
| | | ipyData = ipyMgr.GetAlchemyByIndex(i)
|
| | | needAlchemyLV = ipyData.GetNeedAlchemyLV()
|
| | | itemList = ipyData.GetAlchemyItem()
|
| | | for itemInfo in itemList:
|
| | | g_needAlchemyLVDict[itemInfo[1]] = needAlchemyLV
|
| | | for i in xrange(ipyMgr.GetAlchemySpecCount()):
|
| | | ipyData = ipyMgr.GetAlchemySpecByIndex(i)
|
| | | needAlchemyLV = ipyData.GetNeedAlchemyLV()
|
| | | itemList = ipyData.GetAlchemyItem()
|
| | | for itemInfo in itemList:
|
| | | g_needAlchemyLVDict[itemInfo[1]] = needAlchemyLV
|
| | | return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyLV) >= g_needAlchemyLVDict.get(itemID, 0)
|
| | |
|
| | |
|
| | | #// A5 14 祈福丹药 #tagCMPrayElixir
|
| | | #
|
| | | #struct tagCMPrayElixir
|
| | | #
|
| | | #{
|
| | | # tagHead Head;
|
| | | #};
|
| | | def PlayerPrayElixir(index, clientPack, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | prayCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyPrayCnt)
|
| | | limitCnt = PlayerVip.GetPrivilegeValue(curPlayer, ChConfig.VIPPrivilege_PrayElixir)
|
| | | if prayCnt >= limitCnt:
|
| | | GameWorld.DebugLog('今日祈福丹药次数已满!prayCnt=%s'%prayCnt)
|
| | | return
|
| | | packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, 1) |
| | | if not packSpace:
|
| | | PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
|
| | | return
|
| | | |
| | | alchemyItemList = IpyGameDataPY.GetFuncEvalCfg('GodAlchemy')
|
| | | |
| | | newItemInfoList = []
|
| | | for itemInfo in alchemyItemList:
|
| | | itemID = itemInfo[1]
|
| | | if not GetIsCanOutByAlchemyLV(curPlayer, itemID):
|
| | | #GameWorld.DebugLog('祈福丹药,炼丹等级未达到,移除产出库!itemID=%s'%itemID)
|
| | | continue
|
| | | if PlayerAttrFruit.IsFruitEatFull(curPlayer, itemID):
|
| | | #GameWorld.DebugLog('祈福丹药,使用次数已满,移除产出库!itemID=%s'%itemID)
|
| | | continue
|
| | | newItemInfoList.append(itemInfo)
|
| | | if not newItemInfoList:
|
| | | GameWorld.DebugLog('祈福丹药,没有丹药可产出!!')
|
| | | return
|
| | | |
| | | makeItemInfo = GameWorld.GetResultByWeightList(newItemInfoList)
|
| | | if not makeItemInfo:
|
| | | GameWorld.DebugLog("祈福丹药, 结果错误!")
|
| | | return
|
| | | |
| | | makeItemID, itemCount = makeItemInfo
|
| | | makeItemData = GameWorld.GetGameData().GetItemByTypeID(makeItemID)
|
| | | if not makeItemData:
|
| | | return
|
| | | |
| | | costMoney = IpyGameDataPY.GetFuncCfg('GodAlchemy', 2)
|
| | | if not PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, costMoney, ChConfig.Def_Cost_AlchemyPray):
|
| | | return
|
| | | #给物品
|
| | | ItemControler.GivePlayerItem(curPlayer, makeItemID, itemCount, True, [IPY_GameWorld.rptItem], |
| | | event=[ChConfig.ItemGive_Refine, False, {}])
|
| | | #GameWorld.DebugLog('makeItemID=%s,newItemInfoList=%s'%(makeItemID, newItemInfoList))
|
| | | |
| | | |
| | | #紫色及以上全服广播
|
| | | notifyColor = IpyGameDataPY.GetFuncCfg("AlchemyNotify", 1)
|
| | | needNotifyItemIDList = IpyGameDataPY.GetFuncEvalCfg("AlchemyNotify", 2)
|
| | | notNotifyItemIDList = IpyGameDataPY.GetFuncEvalCfg("AlchemyNotify", 3)
|
| | | if makeItemID not in notNotifyItemIDList and (makeItemID in needNotifyItemIDList or makeItemData.GetItemColor() >= notifyColor):
|
| | | PlayerControl.WorldNotify(0, "BlastfurnaceBlessing", [curPlayer.GetPlayerName(), makeItemID])
|
| | | |
| | | #更新次数
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AlchemyPrayCnt, prayCnt+1)
|
| | | Sycn_AlchemyPrayMsg(curPlayer, makeItemID)
|
| | | return
|
| | |
|
| | | def Sycn_AlchemyPrayMsg(curPlayer, itemID=0):
|
| | | #祈福丹药结果
|
| | | if not itemID and not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_RefineStove):
|
| | | return
|
| | | pack = ChPyNetSendPack.tagMCPrayElixirResult()
|
| | | pack.PrayCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyPrayCnt)
|
| | | pack.ItemID = itemID
|
| | | NetPackCommon.SendFakePack(curPlayer, pack)
|
| | | return |