コード例 #1
0
    def sendYwBossKillReward(self, bossId, isTimeout=1):
        """击杀野外boss奖励"""
        resYwBoss = Game.res_mgr.res_ywBoss.get(bossId)
        if not resYwBoss:
            return
        barrRes = Game.res_mgr.res_barrier.get(resYwBoss.fbId)
        if not barrRes:
            return
        rewardRes = Game.res_mgr.res_reward.get(barrRes.rewardId)
        if not rewardRes:
            return
        dReward = rewardRes.doReward()
        respBag = self.player.bag.add(dReward,
                                      constant.ITEM_ADD_YWBOSS_REWARD,
                                      wLog=True)
        iTodayNum = self.player.boss.GetYwBossTodayTZ()
        # 修改挑战次数
        self.player.boss.SetYwBossTodayTZ(iTodayNum + 1)
        # 修改最后挑战时间
        now = int(time.time())
        self.player.boss.SetYwBossLastTZTime(now)

        #抛事件
        self.player.safe_pub(msg_define.MSG_KILL_YW_BOSS)
        if isTimeout:
            dUpdate = self.player.packRespBag(respBag)
            resp = {
                "allUpdate": dUpdate,
            }
            spawn(self.player.call, "ywBossKill", resp, noresult=True)
        return respBag
コード例 #2
0
ファイル: marryRPC.py プロジェクト: hw233/gsdld_pokemon2
    def marryPowerPush(self, id, en, num, pid, name):
        self.player.marry.marryPowerPush(id, en, num, pid, name)

        dUpdate = {}
        dUpdate["marryInfo"] = self.player.marry.to_init_data()
        pushData = {
            "id": id,  # 配置表id
            "allUpdate": dUpdate,
        }
        spawn(self.player.call, "marryPowerPush", pushData, noresult=True)
コード例 #3
0
    def ssjBossTZNotice(self, id, fightLog, pid):
        ssjRes = Game.res_mgr.res_ssjBoss.get(id)
        if not ssjRes:
            return
        barrRes = Game.res_mgr.res_barrier.get(ssjRes.fbId)
        if not barrRes:
            return
        helpres = Game.res_mgr.res_common.get("ssjBossHelpNum")
        if not helpres:
            return

        fightResult = fightLog["result"].get("win", 0)
        respBag = {}
        if fightResult:
            dReward = {}
            if not self.player.boss.GetSsjBossTodayKill(id):
                rewardRes = Game.res_mgr.res_reward.get(barrRes.rewardId)
                if rewardRes:
                    dReward = rewardRes.doReward()
                #是否已首通
                isFirst = self.player.boss.GetSsjBossFirst(id)
                if not isFirst:
                    self.player.boss.SetSsjBossFirst(id)
                    dReward.update(barrRes.firstReward)
                    #设置击杀
                    self.player.boss.SetSsjBossTodayKill(id)
            #是否协助
            if pid != self.player.id:
                iHelpNum = self.player.boss.GetSsjBossTodayHelp()
                if iHelpNum < helpres.i:
                    rewardRes = Game.res_mgr.res_reward.get(
                        barrRes.helpRewardId)
                    if rewardRes:
                        dHelpReward = rewardRes.doReward()
                        for iNo, iNum in dHelpReward.items():
                            if dReward.get(iNo):
                                dReward[iNo] += iNum
                            else:
                                dReward[iNo] = iNum

                    self.player.boss.SetSsjBossTodayHelp(iHelpNum + 1)

            respBag = self.player.bag.add(dReward,
                                          constant.ITEM_ADD_SSJBOSS_REWARD,
                                          wLog=True)
        # 打包返回信息
        dUpdate = self.player.packRespBag(respBag)
        dUpdate["boss"] = self.player.boss.to_ssjboss_data([id])
        resp = {
            "id": id,
            "fightLog": fightLog,
            "allUpdate": dUpdate,
        }
        spawn(self.player.call, "ssjBossTZNotice", resp, noresult=True)
コード例 #4
0
ファイル: marryRPC.py プロジェクト: hw233/gsdld_pokemon2
 def addHouseExp(self, exp, kind):
     self.player.house.addUnrecvExp(exp, kind)
     spawn(self.player.call, "houseUpgradePush", {}, noresult=True)
コード例 #5
0
ファイル: marryRPC.py プロジェクト: hw233/gsdld_pokemon2
 def divorce(self):
     self.player.marry.divorce()
     spawn(self.player.call, "divorcePush", {}, noresult=True)
コード例 #6
0
ファイル: marryRPC.py プロジェクト: hw233/gsdld_pokemon2
 def marryResultPush(self, data):
     spawn(self.player.call, "marryResultPush", data, noresult=True)
コード例 #7
0
 def to_init_data(self):
     init_data = {}
     spawn(self.registerRobotData, config.serverNo, self.owner.GetFightData(constant.BATTLE_ARRAY_TYPE_NORMAL))  # 用额外的协程,避免卡死
     spawn(self.sendWeekRankData)  # 用额外的协程,避免卡死
     return init_data
コード例 #8
0
 def sendYwBossTZ(self, resp):
     spawn(self.player.call, "ywBossTZ", resp, noresult=True)