def get_adventure_rewards(): df = tools.read_spec_file('MapUnit', path) df = df.drop(df[(df['Id'] > 500000) | (df['Id'] < 100000) | ((df['Type'] != 31) & (df['Type'] != 27))].index) df = df.reset_index() df['Adventure'] = df['Id'].apply(get_adventure_id) df = tools.reset_rewards_to_dict(df, 'Param3') return get_sum_rewards(df, 'Adventure', adventure)
def get_rank_rewards(): df = tools.read_spec_file('Rank', path) df = tools.reset_rewards_to_dict(df, 'MissionReward') _rewards = get_sum_rewards(df, 'Id', 999999) # 排行榜奖励按天数发放 100天为上限 for _t in _rewards: _rewards[_t] = int(_rewards[_t] * min(days / 100, 1.0)) return _rewards
def get_seven_day_rewards(): df = tools.read_spec_file('Configs', path) seven_day_reward = tools.get_specific_property(df, 'value', 'key', 'SevenDaysReward') _rs = seven_day_reward.split('#S#') df = pd.DataFrame(_rs, index=range(1, 8), columns=['Reward']) df['Day'] = range(1, 8) df = tools.reset_rewards_to_dict(df, 'Reward') _rewards = get_sum_rewards(df, 'Day', days) return _rewards
def get_daily_mission_rewards(): _df = tools.read_spec_file('MissionDailyReward', path) _df = tools.reset_rewards_to_dict(_df, 'Reward') _rewards = {} for _t in rewards_type: _rewards[_t] = 0 if _t in _df.columns: _rewards[_t] += int( _df.loc[(_df['DailyType'] == 0) & (_df['ActivityRequire'] <= daily_mission_progress), _t].sum() * days) _rewards[_t] += int(_df.loc[(_df['DailyType'] == 1) & ( _df['ActivityRequire'] <= weekly_mission_progress), _t].sum() * weeks) return _rewards
def get_commission_rewards(): _df = tools.read_spec_file('Commission', path) # 将金币奖励改为2小时金币奖励,要奖励结果/7200 _df['coin'] = ';prop,402,' _df['Reward'] = _df['Reward'] + _df['coin'] + _df['CoinAfkTime'].map(str) _df = tools.reset_rewards_to_dict(_df, 'Reward') if 'prop_402' in _df.columns: _df['prop_402'] /= 7200 # 将统一委托等级下的各种奖励取平均,方便计算 _df = _df.groupby(['CommissionLevel', 'Type']).mean().fillna(0).reset_index() # 计算的结果要除以2,因为要跟金币平分概率 # 通过委托等级表,拆分出各个等级下刷新不同委托任务的权重 _df_lv = tools.read_spec_file('CommissionLevel', path) _df_lv = tools.reset_dict_str_to_dict(_df_lv, 'CommissionWeight') _df_lv.drop(_df_lv.columns.difference(['CommissionLevel', 'CommissionWeight', 'CommissionWeightTeam']), axis=1, inplace=True) _df_lv = tools.reset_dict_str_to_dict(_df_lv, 'CommissionWeightTeam') _df_lv.drop(_df_lv.columns.difference(['CommissionLevel', 'CommissionWeight', 'CommissionWeightTeam']), axis=1, inplace=True) # 根据不同天数对应的委托等级,计算委托奖励 # 等级与天数对应:5:2;14:3;39,4;89,5;152,6;195,7;99999,8 _rewards = separate_commission(_df, 5, 0, _df_lv['CommissionWeight'][1], _df_lv['CommissionWeightTeam'][1]) _rewards = tools.combine_dict(_rewards, separate_commission(_df, 14, 5, _df_lv['CommissionWeight'][2], _df_lv['CommissionWeightTeam'][2])) _rewards = tools.combine_dict(_rewards, separate_commission(_df, 39, 14, _df_lv['CommissionWeight'][3], _df_lv['CommissionWeightTeam'][3])) _rewards = tools.combine_dict(_rewards, separate_commission(_df, 89, 39, _df_lv['CommissionWeight'][4], _df_lv['CommissionWeightTeam'][4])) _rewards = tools.combine_dict(_rewards, separate_commission(_df, 152, 89, _df_lv['CommissionWeight'][5], _df_lv['CommissionWeightTeam'][5])) _rewards = tools.combine_dict(_rewards, separate_commission(_df, 195, 152, _df_lv['CommissionWeight'][6], _df_lv['CommissionWeightTeam'][6])) _rewards = tools.combine_dict(_rewards, separate_commission(_df, 999999, 195, _df_lv['CommissionWeight'][7], _df_lv['CommissionWeightTeam'][7])) return _rewards
def get_extreme_rewards(): df = tools.read_spec_file('ExtremeSimulation', path) df = tools.reset_rewards_to_dict(df, 'Reward') _rewards = {} for _t in rewards_type: _rewards[_t] = 0 if _t in df.columns: _rewards[_t] += df.loc[(df['ExtremeType'] == 11) & (df['Floor'] < extreme_standard), _t].sum() _rewards[_t] += df.loc[((df['ExtremeType'] == 1) | (df['ExtremeType'] == 2) | (df['ExtremeType'] == 3) | (df['ExtremeType'] == 4)) & (df['Floor'] < extreme_race), _t].sum() return _rewards
def get_battle_pass_rewards(): _df = tools.read_spec_file('BattlePass', path) # 免费奖励 _df1 = tools.reset_rewards_to_dict(_df, 'NormalReward') # 付费奖励 _df2 = tools.reset_rewards_to_dict(_df, 'PaidReward') _rewards = {} for _t in rewards_type: _rewards[_t] = 0 if _t in _df1.columns: # 将通行证统一处理为45天,免费奖励用1级,付费奖励用5级 _rewards[_t] += int( _df1.loc[(_df1['PassLevel'] == 1) & (_df1['Level'] <= battle_pass_level), _t].sum() * days / 45) if is_buy_battle_pass: _rewards[_t] += int( _df2.loc[(_df2['PassLevel'] == 5) & (_df2['Level'] <= battle_pass_level), _t].sum() * days / 45) return _rewards
def get_stage_afk_rewards(): _df = tools.read_spec_file('StageAfk', path) exp_rate = tools.get_specific_property(_df, 'Exp', 'Id', stage) coin_rate = tools.get_specific_property(_df, 'Coin', 'Id', stage) hero_exp_rate = tools.get_specific_property(_df, 'HeroExp', 'Id', stage) powder_rate = tools.get_specific_property(_df, 'Powder', 'Id', stage) # vip加成 _bonus = int(get_vip_bonus()) _rewards = {'hero_exp': int(hero_exp_rate / 10000 * 86400 * days * (10000 + _bonus) / 10000), 'coin': int(coin_rate / 10000 * 86400 * days * (10000 + _bonus) / 10000), 'exp': int(exp_rate / 10000 * 86400 * days), 'hero_powder': int(powder_rate / 10000 * 86400 * days)} # 快速挂机奖励 _rewards['hero_exp'] += int(hero_exp_rate / 10000 * 7200 * daily_quick_afk_times * days * (10000 + _bonus) / 10000) _rewards['coin'] += int(coin_rate / 10000 * 7200 * daily_quick_afk_times * days * (10000 + _bonus) / 10000) _rewards['hero_powder'] += int(powder_rate / 10000 * 7200 * daily_quick_afk_times * days) return _rewards
def get_vip_bonus(): _df = tools.read_spec_file('Vip', path) _df = tools.reset_dict_str_to_dict(_df, 'Properties') return tools.get_specific_property(_df, '1', 'Level', vip)
def get_mission_rewards( ): # _stage, _chapter, _extreme, _race_extreme, _days, _arena, _player_lv): df = tools.read_spec_file('Mission', path) df = tools.reset_rewards_to_dict(df, 'Reward') _rewards = {} for _t in rewards_type: _rewards[_t] = 0 if _t in df.columns: # 类型1:通关 _rewards[_t] += df.loc[(df['MissionType'] == 1) & (df['Target'] < stage), _t].sum() print(_rewards) # 类型2:拥有英雄数量 _rewards[_t] += df.loc[(df['MissionType'] == 2) & (df['Target'] <= cards_count), _t].sum() print(_rewards) # 类型3:竞技场历史最大积分 _rewards[_t] += df.loc[(df['MissionType'] == 3) & (df['Target'] <= arena_max_score), _t].sum() print(_rewards) # 类型4:竞技场胜利场数 _rewards[_t] += df.loc[(df['MissionType'] == 4) & (df['Target'] <= arena_win_count), _t].sum() print(_rewards) # 类型5:通章 _rewards[_t] += df.loc[(df['MissionType'] == 5) & (df['Target'] < chapter), _t].sum() print(_rewards) # 类型6:通关标准极限试炼 _rewards[_t] += df.loc[(df['MissionType'] == 6) & (df['Target'] < extreme_standard), _t].sum() print(_rewards) # 类型35:通关类型极限试炼 _rewards[_t] += df.loc[(df['MissionType'] == 35) & (df['Target'] < extreme_race), _t].sum() print(_rewards) # 类型7/ 8/ 10/ 11/ 12/ 14/ 19 # Discord/Facebook/Twitter/Website/JoinGuild/1PurpleHero/OasisAccount _rewards[_t] += df.loc[(df['MissionType'] == 7) | (df['MissionType'] == 8) | (df['MissionType'] == 10) | (df['MissionType'] == 11) | (df['MissionType'] == 12) | (df['MissionType'] == 14) | (df['MissionType'] == 19), _t].sum() print(_rewards) # 类型13:挂机现金总量 _rewards[_t] += df.loc[(df['MissionType'] == 13) & (df['Target'] <= afk_cash_count), _t].sum() print(_rewards) # 类型15:最大英雄等级 _rewards[_t] += df.loc[(df['MissionType'] == 15) & (df['Target'] <= max_hero_level), _t].sum() print(_rewards) # 类型16:通关强者之路次数 _rewards[_t] += df.loc[(df['MissionType'] == 16) & (df['Target'] <= (days / 2)), _t].sum() print(_rewards) # 类型17:共鸣水晶等级 _rewards[_t] += df.loc[(df['MissionType'] == 17) & (df['Target'] <= connect_level), _t].sum() print(_rewards) # 类型18:共鸣水晶槽数 _rewards[_t] += df.loc[(df['MissionType'] == 18) & (df['Target'] <= connect_holes), _t].sum() print(_rewards) # 类型20:队伍等级 _rewards[_t] += df.loc[(df['MissionType'] == 20) & (df['Target'] <= player_level), _t].sum() print(_rewards) return _rewards
def get_stage_rewards(): df = tools.read_spec_file('Stage', path) df = tools.reset_rewards_to_dict(df, 'Reward') return get_sum_rewards(df, 'Id', stage)
def get_mission_newbie_rewards(): df = tools.read_spec_file('MissionNewbie', path) df = tools.reset_rewards_to_dict(df, 'Reward') # 默认达到天数即完成 _rewards = get_sum_rewards(df, 'Day', days) return _rewards