def recv_battle_event_reward(self): url = "/root/battle!recvBattleEventReward.action" result = self.get_protocol_mgr().get_xml(url, "领取征战事件奖励") if result and result.m_bSucceed: reward_info = RewardInfo() reward_info.handle_info(result.m_objResult["rewardinfo"]) self.info("领取征战事件奖励,获得{}".format(reward_info))
def convert_royalty_weave_new2(self, need_weave_num): url = "/root/make!convertRoyaltyWeaveNew2.action" result = self.get_protocol_mgr().get_xml(url, "换购") if result and result.m_bSucceed: reward_info = RewardInfo() reward_info.handle_info(result.m_objResult["rewardinfo"]) self.info("花费{}布匹换购,获得{}".format(need_weave_num, reward_info))
def open_score_box(self): url = "/root/world!openScoreBox.action" result = self.get_protocol_mgr().get_xml(url, "打开战绩宝箱") if result and result.m_bSucceed: reward_info = RewardInfo() reward_info.handle_info(result.m_objResult["rewardinfo"]) self.info("打开战绩宝箱,获得{}".format(reward_info))
def run(self): if not self.enable(): return self.next_half_hour() info = self.get_spring_festival_wish_info() if info is None: return self.next_half_hour() if info["许愿状态"] == 1: # 辞旧岁 if info["下一福利"] is not None: reward_info = RewardInfo() reward_info.handle_info(info["下一福利"]["rewardinfo"]) self.hang_in_the_tree(reward_info) return self.immediate() elif info["可领奖状态"] == 0: self.open_cijiu_reward() return self.immediate() elif info["许愿状态"] == 2: # 迎新年 if info["可领奖状态"] == 0: self.open_yinxing_reward() return self.immediate() elif info["许愿状态"] == 3: # 领奖 if info["愿望"] is not None: wishs = list(map(int, info["愿望"][:-1].split(","))) for idx, wish in enumerate(wishs, 1): if wish == 0: self.receive_wish_reward(idx) return self.immediate() return self.next_half_hour()
def deliver_new_city_event(self): url = "/root/world!deliverNewCityEvent.action" result = self.get_protocol_mgr().get_xml(url, "领取悬赏奖励") if result and result.m_bSucceed: reward_info = RewardInfo() reward_info.handle_info(result.m_objResult["rewardinfo"]) self.info("领取悬赏奖励,获得{}".format(reward_info))
def get_reward(self, cid, opt): url = "/root/mainCity!getReward.action" data = {"cId": cid, "opt": opt} result = self.get_protocol_mgr().post_xml(url, data, "领取登录送礼") if result and result.m_bSucceed: reward_info = RewardInfo() reward_info.handle_info(result.m_objResult["rewardinfo"]) self.info("领取登录送礼,获得{}".format(reward_info))
def smelt_special_equip(self, equipdto, is_all=1): url = "/root/equip!smeltSpecialEquip.action" data = {"specialId": equipdto["storeid"], "all": is_all} result = self.get_protocol_mgr().post_xml(url, data, "熔炼专属") if result and result.m_bSucceed: reward_info = RewardInfo() reward_info.handle_info(result.m_objResult["rewardinfo"]) self.info("熔炼专属[{}]lv.{},获得{}".format(equipdto["equipname"], equipdto["equiplevel"], reward_info))
def open_gift(self): url = "/root/event!openGift.action" result = self.get_xml(url, "打开礼袋") if result and result.m_bSucceed: reward_info = RewardInfo() reward_info.handle_info(result.m_objResult["rewardinfo"]) self.add_reward(reward_info) self.info("打开礼袋,获得{}".format(reward_info))
def get_qingming_big_reward(self): url = "/root/event!getQingmingBigReward.action" result = self.get_xml(url, "群雄煮酒大礼") if result and result.m_bSucceed: reward_info = RewardInfo() reward_info.handle_info(result.m_objResult["rewardinfo"]) self.add_reward(reward_info) self.info("领取群雄煮酒大礼,获得{}".format(reward_info))
def recv_fengdi_reward(self): url = "/root/world!recvFengdiReward.action" result = self.get_protocol_mgr().get_xml(url, "领取封地奖励") if result and result.m_bSucceed: reward_info = RewardInfo() reward_info.handle_info(result.m_objResult["rewardinfo"]) self.info("领取封地奖励,获得{}".format(reward_info)) self.set_feng_di(result.m_objResult["fengdi"])
def recv_new_city_event_star_reward(self, pos): url = "/root/world!recvNewCityEventStarReward.action" data = {"pos": pos} result = self.get_protocol_mgr().post_xml(url, data, "领取悬赏星数奖励") if result and result.m_bSucceed: reward_info = RewardInfo() reward_info.handle_info(result.m_objResult["rewardinfo"]) self.info("领取悬赏星数奖励,获得{}".format(reward_info))
def get_tu_city_reward(self, player_id, area_id): url = "/root/world!getTuCityReward.action" data = {"playerId": player_id, "areaId": area_id} result = self.get_protocol_mgr().post_xml(url, data, "搜刮屠城嘉奖") if result and result.m_bSucceed: reward_info = RewardInfo() reward_info.handle_info(result.m_objResult["rewardinfo"]) self.info("搜刮屠城嘉奖,获得{}".format(reward_info))
def recv_red_paper(self): url = "/root/ringEvent!recvRedPaper.action" result = self.get_xml(url, "领取红包") if result and result.m_bSucceed: reward_info = RewardInfo() reward_info.handle_info(result.m_objResult["rewardinfo"]) self.add_reward(reward_info) self.info("领取红包,获得{}".format(reward_info))
def get_reward(self): url = "/root/training!getReward.action" result = self.get_xml(url, "打开红包") if result and result.m_bSucceed: reward_info = RewardInfo() reward_info.handle_info(result.m_objResult["rewardinfo"]) self.add_reward(reward_info) self.info("打开红包,获得{}".format(reward_info))
def open_yinxing_reward(self): url = "/root/springFestivalWish!openYinxingReward.action" result = self.get_xml(url, "辞旧岁") if result and result.m_bSucceed: reward_info = RewardInfo() reward_info.handle_info(result.m_objResult["rewardinfo"]) self.add_reward(reward_info) self.info("迎新年,获得{}".format(reward_info))
def recv_moral_reward(self, idx): url = "/root/event!recvMoralReward.action" data = {"rewardId": idx} result = self.post_xml(url, data, "领取士气奖励") if result and result.m_bSucceed: reward_info = RewardInfo() reward_info.handle_info(result.m_objResult["rewardinfo"]) self.add_reward(reward_info) self.info("领取士气奖励,获得{}".format(reward_info))
def open_box(self, reward): url = "/root/event!openBox.action" data = {"boxNum": reward["id"]} result = self.post_xml(url, data, "打开消费累计宝箱") if result and result.m_bSucceed: reward_info = RewardInfo() reward_info.handle_info(result.m_objResult["rewardinfo"]) self.add_reward(reward_info) self.info("打开消费累计宝箱,获得{}".format(reward_info))
def get_progress_reward(self, reward_id): url = "/root/eatMooncakeEvent!getProgressReward.action" data = {"rewardId": reward_id} result = self.post_xml(url, data, "领取月饼奖励") if result and result.m_bSucceed: reward_info = RewardInfo() reward_info.handle_info(result.m_objResult["rewardinfo"]) self.add_reward(reward_info) self.info("领取月饼奖励,获得{}".format(reward_info))
def open_pic_reward(self, id): url = "/root/memoryEvent!openPicReward.action" data = {"rewardId": id} result = self.post_xml(url, data, "回忆图") if result and result.m_bSucceed: reward_info = RewardInfo() reward_info.handle_info(result.m_objResult["rewardinfo"]) self.add_reward(reward_info) self.info("新春拜年, 领取回忆图奖励, 获得{}".format(reward_info))
def open_gift(self, gift_id): url = "/root/bombNianEvent!openGift.action" data = {"giftId": gift_id} result = self.post_xml(url, data, "捡起奖励") if result and result.m_bSucceed: reward_info = RewardInfo() reward_info.handle_info(result.m_objResult["rewardinfo"]) self.add_reward(reward_info) self.info("捡起奖励,获得{}".format(reward_info))
def get_rank_reward(self): url = "/root/bombNianEvent!getRankReward.action" result = self.get_xml(url, "领取排名奖励") if result and result.m_bSucceed: reward_info = RewardInfo() reward_info.handle_info( result.m_objResult["rankreward"]["rewardinfo"]) self.add_reward(reward_info) self.info("领取年兽排名奖励,获得{}".format(reward_info))
def get_progress_reward(self, reward, reward_type): url = "/root/ringEvent!getProgressReward.action" data = {"rewardId": reward["id"], "type": reward_type} result = self.post_xml(url, data, "领取进度奖励") if result and result.m_bSucceed: reward_info = RewardInfo() reward_info.handle_info(result.m_objResult["rewardinfo"]) self.add_reward(reward_info) self.info("领取进度奖励,获得{}".format(reward_info))
def open_pay_hongbao(self): url = "/root/event!openPayHongbao.action" result = self.get_xml(url, "打开红包") if result and result.m_bSucceed: reward_info = RewardInfo() reward_info.handle_info( result.m_objResult["hongbaoreward"]["rewardinfo"]) self.add_reward(reward_info) self.info("打开红包,获得{}".format(reward_info))
def receive_wish_reward(self, id): url = "/root/springFestivalWish!receiveWishReward.action" data = {"id": id} result = self.post_xml(url, data, "愿望") if result and result.m_bSucceed: reward_info = RewardInfo() reward_info.handle_info(result.m_objResult["rewardinfo"]) self.add_reward(reward_info) self.info("愿望,获得{}".format(reward_info))
def get_case_num_reward(self, case): url = "/root/snowTrading!getCaseNumReward.action" data = {"cases": case["id"]} result = self.post_xml(url, data, "领取雪地通商奖励") if result and result.m_bSucceed: reward_info = RewardInfo() reward_info.handle_info(result.m_objResult["rewardinfo"]) self.add_reward(reward_info) self.info("领取雪地通商奖励,获得{}".format(reward_info))
def get_parade_reward(self, parade_state): url = "/root/paradeEvent!getParadeReward.action" data = {"rewardId": parade_state["id"]} result = self.post_xml(url, data, "领取阅兵奖励") if result and result.m_bSucceed: reward_info = RewardInfo() reward_info.handle_info(result.m_objResult["rewardinfo"]) self.add_reward(reward_info) self.info("领取阅兵奖励,获得{}".format(reward_info))
def get_banquet_reward(self, progress_state): url = "/root/event!getBanquetReward.action" data = {"rewardId": progress_state["id"]} result = self.m_objProtocolMgr.post_xml(url, data, "开启宴请宝箱") if result and result.m_bSucceed: reward_info = RewardInfo() reward_info.handle_info(result.m_objResult["rewardinfo"]) self.add_reward(reward_info) self.info("开启宴请宝箱,获得{}".format(reward_info))
def do_refine_bin_tie_factory(self, copper, active, mode): url = "/root/refine!doRefineBintieFactory.action" data = {"mode": mode} result = self.get_protocol_mgr().post_xml(url, data, "炼制") if result and result.m_bSucceed: self.add_task_finish_num(10, 1) reward_info = RewardInfo() reward_info.handle_info(result.m_objResult["rewardinfo"]) self.info("消耗{}银币、{}行动力炼制,获得{}".format( GlobalFunc.get_short_readable(copper), active, reward_info))
def qifu_choose(self, index): url = "/root/yuandanqifu!qifuChoose.action" data = {"indexId": index} result = self.post_xml(url, data, "选择祈福") if result and result.m_bSucceed: reward_info = RewardInfo() reward_info.handle_info(result.m_objResult["reward"]["rewardinfo"]) self.add_reward(reward_info) self.info("选择祈福[{}],福气+{},获得{}".format( result.m_objResult["reward"]["indexid"], result.m_objResult["reward"]["fuqi"], reward_info))
def do_bg_event(self, cost): url = "/root/event!doBGEvent.action" result = self.m_objProtocolMgr.get_xml(url, "宴请群雄") if result and result.m_bSucceed: reward_info = RewardInfo() reward_info.handle_info(result.m_objResult["bginfo"]["rewardinfo"]) self.add_reward(reward_info) self.consume_gold(cost) if cost > 0: self.info("花费{}金币宴请群雄,获得{}".format(cost, reward_info), True) else: self.info("免费宴请群雄,获得{}".format(reward_info))