| | |
| | | import PlayerExpandPackCfgMgr
|
| | | import EventReport
|
| | | import PlayerCoat
|
| | | import PlayerSuccess
|
| | | import PlayerGatherSoul
|
| | | import PlayerArrestTask
|
| | | import PlayerRune
|
| | | import IpyGameDataPY
|
| | |
| | | EventLogic(curPlayer, sendPack_EventNPCID, tick)
|
| | | return
|
| | |
|
| | | #// C1 06 跨服NPC对话 #tagCMCrossNPCTalk
|
| | | #
|
| | | #struct tagCMCrossNPCTalk
|
| | | #{
|
| | | # tagHead Head;
|
| | | # WORD ObjID;
|
| | | # DWORD NPCID;
|
| | | # WORD PosX;
|
| | | # WORD PosY;
|
| | | #};
|
| | | def OnCrossNPCTalk(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | |
| | | objID = clientData.ObjID
|
| | | npcID = clientData.NPCID
|
| | | #posX = clientData.PosX
|
| | | #posY = clientData.PosY
|
| | | if GameWorld.IsCrossServer():
|
| | | return
|
| | | |
| | | lastTick = curPlayer.GetDictByKey("CrossNPCTalkTick")
|
| | | if tick - lastTick < 2000:
|
| | | return
|
| | | curPlayer.SetDict("CrossNPCTalkTick", tick)
|
| | | |
| | | npcData = GameWorld.GetGameData().FindNPCDataByID(npcID)
|
| | | if not npcData:
|
| | | GameWorld.ErrLog("跨服NPCID不存在! npcID=%s" % npcID)
|
| | | return
|
| | | |
| | | # 目前暂支持跨服采集
|
| | | if npcData.GetType() not in [IPY_GameWorld.ntCollection, IPY_GameWorld.ntMissionCollect]:
|
| | | return
|
| | | |
| | | collectNPCIpyData = IpyGameDataPY.GetIpyGameData("CollectNPC", npcID)
|
| | | if collectNPCIpyData:
|
| | | if not NPCCommon.CheckCanCollectByNPCID(curPlayer, npcID, collectNPCIpyData):
|
| | | return
|
| | | |
| | | msgDict = {"PlayerID":curPlayer.GetPlayerID(), "ObjID":objID, "NPCID":npcID}
|
| | | GameWorld.SendMsgToCrossServer(ShareDefine.ClientServerMsg_CollectNPC, msgDict)
|
| | | |
| | | return
|
| | |
|
| | | def ClientServerMsg_CollectNPC(curPlayer, msgData, serverGroupID, tick):
|
| | | ## 收到子服同步的采集NPC
|
| | | objID = msgData["ObjID"]
|
| | | npcID = msgData["NPCID"]
|
| | | curNPC = GameWorld.FindNPCByID(objID)
|
| | | if not curNPC:
|
| | | return
|
| | | if npcID != curNPC.GetNPCID():
|
| | | GameWorld.ErrLog("采集跨服NPC错误!npcID=%s != curNPCID=%s" % (npcID, curNPC.GetNPCID()))
|
| | | return
|
| | | EventLogic(curPlayer, objID, tick)
|
| | | return
|
| | |
|
| | | ##客户端//08 01封包响应 自定义函数: 事件处理
|
| | | #@param curPlayer 当前玩家
|
| | | #@param eventNPCID 事件NPCID
|
| | |
| | | return
|
| | |
|
| | | curPlayer.SetActionObj(curNPC)
|
| | | |
| | | if NPCCommon.OnCollectNPCBegin(curPlayer, curNPC, tick):
|
| | | return
|
| | |
|
| | | prepareTime = FBLogic.GetFBPrepareTime(curPlayer, curNPC)
|
| | |
|
| | |
| | | giveItem.Clear()
|
| | | continue
|
| | |
|
| | | #---初始化装备显隐---
|
| | | curPlayer.SetEquipShowSwitch(IPY_GameWorld.revClothesCoat|IPY_GameWorld.revWeaponCoat|IPY_GameWorld.revMask)
|
| | | #---初始化装备显隐---前端自己设置
|
| | | #curPlayer.SetEquipShowSwitch(IPY_GameWorld.revClothesCoat|IPY_GameWorld.revWeaponCoat|IPY_GameWorld.revMask)
|
| | |
|
| | | #默认触发一次功能开启
|
| | | if curPlayer.GetLV() == 1:
|
| | |
| | | RunQuestEvent(curPlayer, "magicweaponlv", '%s_%s'%(mwID, lv), Def_RunQuestType_RunAll)
|
| | | return
|
| | |
|
| | | def EventRespons_MagicWeaponFBPassLV(curPlayer, mwID, lv):
|
| | | # 魔族法宝关卡进度
|
| | | RunQuestEvent(curPlayer, "mwfbpasslv", '%s_%s'%(mwID, lv), Def_RunQuestType_Normal)
|
| | | return
|
| | |
|
| | | def EventRespons_SuccessFinish(curPlayer, succID):
|
| | | # 领取完成就
|
| | | RunQuestEvent(curPlayer, "successfinish", succID, Def_RunQuestType_RunAll)
|
| | |
| | | def EventRespons_CompoundEquip(curPlayer, itemColor, itemQuality):
|
| | | #装备合成某品质某星级
|
| | | RunQuestEvent(curPlayer, "compoundequip", '%s_%s'%(itemColor, itemQuality), Def_RunQuestType_Normal)
|
| | | return
|
| | |
|
| | | def EventRespons_EquipWash(curPlayer, washType, washLV):
|
| | | #装备洗练至X级
|
| | | RunQuestEvent(curPlayer, "equipwash", '%s_%s'%(washType, washLV), Def_RunQuestType_Normal)
|
| | | return
|
| | |
|
| | | def EventRespons_AddBourseItem(curPlayer):
|
| | | #上架集市物品
|
| | | RunQuestEvent(curPlayer, "addbourseitem", "addbourseitem", Def_RunQuestType_Normal)
|
| | | return
|
| | |
|
| | | def EventRespons_StoreDonate(curPlayer):
|
| | | #捐献仙盟装备
|
| | | RunQuestEvent(curPlayer, "storedonate", "storedonate", Def_RunQuestType_Normal)
|
| | | return
|
| | |
|
| | | def EventRespons_EquipPlus(curPlayer):
|
| | | #强化等级变化
|
| | | RunQuestEvent(curPlayer, "equipplus", "equipplus", Def_RunQuestType_Normal)
|
| | | return
|
| | |
|
| | | def EventRespons_EquipStar(curPlayer):
|
| | | #装备总星级变化
|
| | | RunQuestEvent(curPlayer, "equipstar", "equipstar", Def_RunQuestType_Normal)
|
| | | return
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | |
| | | curPlayer.SetForbiddenResetItem(0)
|
| | | ExitCompose(curPlayer)
|
| | | ExitWarehouse(curPlayer)
|
| | | ExitRepair(curPlayer)
|
| | | #ExitRepair(curPlayer)
|
| | | ExitCreateFamily(curPlayer)
|
| | | ExitBillboard(curPlayer)
|
| | | #ExitEventLock(curPlayer)
|
| | |
| | | #npc商店退出
|
| | | ExitNPCShop(curPlayer)
|
| | |
|
| | | PlayerTrade.LeaveTrade(curPlayer, 0)
|
| | | #PlayerTrade.LeaveTrade(curPlayer, 0)
|
| | | # 清除py自定义状态
|
| | | ClearPyPlayerAction(curPlayer)
|
| | | #ClearPyPlayerAction(curPlayer)
|
| | |
|
| | | #调用底层结束事件
|
| | | #避免策划变更,导致其他退出锁定事件使任务1未接取就退出锁定
|
| | |
| | | # @remarks 自定义函数, 读数据库任务删除表, 删除任务
|
| | | def __DoLogic_DeleteMission(curPlayer, curMission):
|
| | | missionID = curMission.GetMissionID()
|
| | | |
| | | GameWorld.Log("__DoLogic_DeleteMission---%s"%missionID, curPlayer.GetID())
|
| | | delMissionData = GameWorld.GetGameData().GetMissionDeleteByID(missionID)
|
| | | #任务删除表中无此任务
|
| | | if not delMissionData:
|
| | |
| | | # 符印交换
|
| | | if PlayerRune.SwitchRune(curPlayer, pack_SrcBackpack, pack_DesBackPack, pack_SrcIndex, pack_DestIndex):
|
| | | return
|
| | | |
| | | # 聚魂交换
|
| | | if PlayerGatherSoul.SwitchGatherSoul(curPlayer, pack_SrcBackpack, pack_DesBackPack, pack_SrcIndex, pack_DestIndex):
|
| | | return
|
| | |
|
| | | #ʱװ
|
| | | if PlayerCoat.SwitchCoat(curPlayer, pack_SrcBackpack, pack_DesBackPack, pack_SrcIndex, pack_DestIndex):
|
| | |
| | | if hasGotAward:
|
| | | GameWorld.DebugLog('领取环任务每轮奖励 已奖励 类型 %s'%taskType)
|
| | | return
|
| | | runTaskAwardDict = IpyGameDataPY.GetFuncEvalCfg('RunTaskAward')
|
| | | if taskType not in runTaskAwardDict:
|
| | | GameWorld.DebugLog('领取环任务每轮奖励 RunTaskAward 没有配置类型的奖励 类型 %s'%taskType)
|
| | | return
|
| | | moneyNum = 0
|
| | | specialAwardDict = IpyGameDataPY.GetFuncEvalCfg('RunTaskAward', 2)
|
| | | if taskType in specialAwardDict:
|
| | | rate, moneyCnt = specialAwardDict[taskType]
|
| | | if GameWorld.CanHappen(rate):
|
| | | moneyNum = moneyCnt
|
| | | if taskType == QuestCommon.Def_Mission_Type_RunDaily:
|
| | | PlayerControl.WorldNotify(0, 'CoinTaskReward', [curPlayer.GetName()])
|
| | | moneyType, minMoney, maxMoney = runTaskAwardDict[taskType]
|
| | | if not moneyNum:
|
| | | moneyNum = random.randint(minMoney, maxMoney)
|
| | | if moneyType == ShareDefine.TYPE_Price_Family_Contribution:
|
| | | PlayerFamily.AddPlayerFamilyActiveValue(curPlayer, moneyNum, True, ShareDefine.Def_AddFAVReason_DoFamilyMisson)
|
| | | else:
|
| | | addDataDict = {ChConfig.Def_Give_Reason_SonKey:"Run"}
|
| | | PlayerControl.GiveMoney(curPlayer, moneyType, moneyNum, ChConfig.Def_GiveMoney_Mission, addDataDict, False)
|
| | | #物品奖励
|
| | | itemList = []
|
| | | itemAwardDict = IpyGameDataPY.GetFuncEvalCfg('RunTaskAward', 3, {})
|
| | | if str(taskType) in itemAwardDict:
|
| | | itemList = itemAwardDict[str(taskType)]
|
| | | # 检查背包
|
| | | needSpace = len(itemList)
|
| | | packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)
|
| | | if needSpace > packSpace:
|
| | | PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
|
| | | return
|
| | | for itemID, itemCount, isBind in itemList:
|
| | | ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isBind, [IPY_GameWorld.rptItem])
|
| | |
|
| | | #给经验
|
| | | giveExp = 0
|
| | | expAwardDict = IpyGameDataPY.GetFuncEvalCfg('RunTaskAward', 4, {})
|
| | | if str(taskType) in expAwardDict:
|
| | | reExp = PlayerControl.GetPlayerReExp(curPlayer)
|
| | | giveExp = eval(expAwardDict[str(taskType)])
|
| | | PlayerControl.PlayerControl(curPlayer).AddExp(giveExp)
|
| | | |
| | | #给钱
|
| | | moneyType = 0
|
| | | moneyNum = 0
|
| | | runTaskMoneyAwardDict = IpyGameDataPY.GetFuncEvalCfg('RunTaskAward')
|
| | | if taskType in runTaskMoneyAwardDict:
|
| | | specialAwardDict = IpyGameDataPY.GetFuncEvalCfg('RunTaskAward', 2, {})
|
| | | if taskType in specialAwardDict:
|
| | | rate, moneyCnt = specialAwardDict[taskType]
|
| | | if GameWorld.CanHappen(rate):
|
| | | moneyNum = moneyCnt
|
| | | if taskType == QuestCommon.Def_Mission_Type_RunDaily:
|
| | | PlayerControl.WorldNotify(0, 'CoinTaskReward', [curPlayer.GetName()])
|
| | | moneyType, minMoney, maxMoney = runTaskMoneyAwardDict[taskType]
|
| | | if not moneyNum:
|
| | | moneyNum = random.randint(minMoney, maxMoney)
|
| | | if moneyType == ShareDefine.TYPE_Price_Family_Contribution:
|
| | | PlayerFamily.AddPlayerFamilyActiveValue(curPlayer, moneyNum, True, ShareDefine.Def_AddFAVReason_DoFamilyMisson)
|
| | | else:
|
| | | addDataDict = {ChConfig.Def_Give_Reason_SonKey:"Run"}
|
| | | PlayerControl.GiveMoney(curPlayer, moneyType, moneyNum, ChConfig.Def_GiveMoney_Mission, addDataDict, False)
|
| | | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RunTaskAwardRecord % taskType, moneyNum)
|
| | | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RunTaskAwardState % taskType, 1)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RunTaskAwardRecord % taskType, moneyNum)
|
| | | GameWorld.DebugLog('领取环任务每轮奖励成功 moneyType=%s, moneyNum=%s'%(moneyType, moneyNum))
|
| | | GameWorld.DebugLog('领取环任务每轮奖励成功 moneyType=%s, moneyNum=%s, itemList=%s, giveExp=%s'%(moneyType, moneyNum, itemList, giveExp))
|
| | |
|
| | | #通知客户端
|
| | | NotifyRunEndAward(curPlayer, taskType)
|