def boss_has_been_killed(self, boss_id): # 击杀boss后发送奖励 logs = self.get_battle_members_in_ordered(boss_id) member_ids = [log.char_id for log in logs] killer = self.char_id m = Mail(killer) drop = make_standard_drop_from_template() drop['union_coin'] = UNION_BOSS_KILLER_REWARD.coin m.add( UNION_BOSS_KILLER_REWARD.mail_title, UNION_BOSS_KILLER_REWARD.mail_content, attachment=json.dumps(drop) ) LOWEST_RANK = max(UNION_BOSS_REWARD.keys()) UNION_BOSS_REWARD_TUPLE = UNION_BOSS_REWARD.items() UNION_BOSS_REWARD_TUPLE.sort(key=lambda item: item[0]) for index, mid in enumerate(member_ids): rank = index + 1 if rank > LOWEST_RANK: break m = Mail(mid) for _rank, _reward in UNION_BOSS_REWARD_TUPLE: if _rank >= rank: drop = make_standard_drop_from_template() drop['union_coin'] = _reward.coin m.add( _reward.mail_title.format(rank), _reward.mail_content.format(rank), attachment=json.dumps(drop) ) break # 工会获得贡献度 self.union.add_contribute_points(UNION_BOSS[boss_id].contribute_points)
def boss_has_been_killed(self, boss_id): # 击杀boss后发送奖励 logs = self.get_battle_members_in_ordered(boss_id) member_ids = [log.char_id for log in logs] killer = self.mongo_boss.opened[str(boss_id)].killer m = Mail(killer) drop = make_standard_drop_from_template() drop['union_coin'] = UNION_BOSS_KILLER_REWARD.coin m.add( UNION_BOSS_KILLER_REWARD.mail_title, UNION_BOSS_KILLER_REWARD.mail_content, attachment=json.dumps(drop) ) LOWEST_RANK = max(UNION_BOSS_REWARD.keys()) UNION_BOSS_REWARD_TUPLE = UNION_BOSS_REWARD.items().sort(key=lambda item: item[0]) for index, mid in enumerate(member_ids): rank = index + 1 if rank > LOWEST_RANK: break m = Mail(mid) for _rank, _reward in UNION_BOSS_REWARD_TUPLE: if _rank >= rank: drop = make_standard_drop_from_template() drop['union_coin'] = _reward.coin m.add( _reward.mail_title.format(rank), _reward.mail_content.format(rank), attachment=json.dumps(drop) ) break # 工会获得贡献度 self.union.add_contribute_points(UNION_BOSS[boss_id].contribute_points)
BUFFS = [11,12,13] BUFF_NAME_TABLE = { 11: 'attack', 12: 'defense', 13: 'hp', } UNION_STORE_BUFF_STORE_ID_DICT = {} for _k, _v in UNION_STORE.items(): if _v.tp in BUFFS: UNION_STORE_BUFF_STORE_ID_DICT[_v.tp] = _k MAX_UNION_LEVEL = max(UNION_LEVEL.keys()) MAX_UNION_POSITION = max(UNION_POSITION.keys()) UNION_BOSS_KILLER_REWARD = UNION_BOSS_REWARD.pop(0) def get_battle_init_score(): # 竞技场初始化积分 if MongoUnion.objects.count() == 0: return UNION_BATTLE_INITIAL_SCORE else: score = MongoUnion.objects.all().order_by('score')[0].score if score < UNION_BATTLE_LOWEST_SCORE: score = UNION_BATTLE_LOWEST_SCORE return score
from core.attachment import make_standard_drop_from_template, standard_drop_to_attachment_protomsg from core.mail import Mail from core.character import Char from core.battle.hero import InBattleHero from core.battle.battle import Ground from core.battle import PVE from preset import errormsg from preset.data import UNION_BOSS, UNION_BOSS_REWARD, UNION_LEVEL import protomsg UNION_BOSS_KILLER_REWARD = UNION_BOSS_REWARD.pop(0) UNION_BOSS_REWARD_LOWEST_RANK = max(UNION_BOSS_REWARD.keys()) class UnionBoss(UnionLoadBase): def __init__(self, char_id): super(UnionBoss, self).__init__(char_id) if isinstance(self.union, UnionBase): self.load_data() self.member = Member(self.char_id) def load_data(self): try: self.mongo_boss = MongoUnionBoss.objects.get(id=self.union.union_id) except DoesNotExist:
from core.attachment import make_standard_drop_from_template, standard_drop_to_attachment_protomsg from core.mail import Mail from core.character import get_char_property from core.battle.hero import InBattleHero from core.battle.battle import Ground from core.battle import PVE from utils.lock import Lock, LockTimeOut from preset import errormsg from preset.data import UNION_BOSS, UNION_BOSS_REWARD, UNION_LEVEL import protomsg UNION_BOSS_KILLER_REWARD = UNION_BOSS_REWARD.pop(0) UNION_BOSS_REWARD_LOWEST_RANK = max(UNION_BOSS_REWARD.keys()) class UnionBoss(UnionLoadBase): def __init__(self, char_id): super(UnionBoss, self).__init__(char_id) if isinstance(self.union, UnionBase): self.load_data() self.member = Member(self.char_id) def load_data(self): try: self.mongo_boss = MongoUnionBoss.objects.get( id=self.union.union_id) except DoesNotExist: