| | |
| | |
|
| | | import copy
|
| | |
|
| | |
|
| | | ##功能开启
|
| | | def DoRefineStoveOpen(curPlayer):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AlchemyLV, 1)
|
| | |
| | | ##登录处理
|
| | | 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
|
| | | #
|
| | |
| | |
|
| | | 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 = IpyGameDataPY.GetFuncCfg('GodAlchemy', 3)
|
| | | if limitCnt and 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 |