com um clique
financial-system
电竞经理游戏的财政系统。管理球队财务、赛事奖金、赞助收入、薪资支出、转会预算。当需要修改财务规则、奖金配置、财务报告时使用此技能。
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Menu
电竞经理游戏的财政系统。管理球队财务、赛事奖金、赞助收入、薪资支出、转会预算。当需要修改财务规则、奖金配置、财务报告时使用此技能。
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Baseado na classificação ocupacional SOC
电竞经理游戏的数据中心系统。管理选手赛季统计、影响力排行、赛事表现记录、身价变化追踪。当需要修改统计计算、排行榜逻辑、年度评分时使用此技能。
电竞经理游戏的金额单位规范。全项目金额统一以「元」存储和传递,前端使用 formatMoney 系列函数格式化显示。当需要新增金额相关计算、修改身价/薪资/奖金/赞助公式、添加新的金额字段、或排查金额显示异常时使用此技能。
电竞经理游戏的版本更新(Meta)系统。管理20种Meta版本、位置权重、加权战力计算、赛季版本轮换。当需要修改Meta配置、位置权重、战力计算公式、版本轮换规则时使用此技能。
电竞经理游戏的选手系统。管理选手属性、成长曲线、忠诚度、满意度、身价计算。当需要修改选手属性、成长规则、身价公式、忠诚度机制时使用此技能。
电竞经理游戏的时间推进系统。管理赛季阶段、比赛模拟、赛季结算等核心游戏流程。当需要修改游戏进度、阶段推进、比赛模拟逻辑时使用此技能。
电竞经理游戏的选手特性系统。管理14种选手特性的定义、触发条件、修正计算、随机生成、互斥规则。特性影响比赛模拟中选手的ability/stability/condition。当需要修改特性效果、添加新特性、调整触发条件、修改生成规则时使用此技能。
| name | financial-system |
| description | 电竞经理游戏的财政系统。管理球队财务、赛事奖金、赞助收入、薪资支出、转会预算。当需要修改财务规则、奖金配置、财务报告时使用此技能。 |
财政系统管理游戏中所有球队的财务状况,包括赛事奖金分配、赞助收入计算、薪资支出管理、转会预算建议等。它是转会系统决策的重要参考依据。
文件: src-tauri/src/engines/financial.rs
财务引擎,管理所有财务相关计算和交易。
pub struct FinancialEngine {
config: FinancialConfig,
}
核心方法:
calculate_prize_money(...) - 计算赛事奖金calculate_sponsorship(...) - 计算赞助收入calculate_league_share() - 计算联赛分成calculate_operating_cost() - 计算运营成本generate_season_report(...) - 生成赛季财务报告distribute_prize_money(...) - 分配比赛奖金pub struct FinancialConfig {
pub base_operating_cost: u64, // 基础运营成本: 300万/赛季
pub prize_pools: HashMap<TournamentType, PrizePool>,
pub league_revenue_share: u64, // 联赛分成: 150万/赛季
pub sponsorship_coefficient: f64, // 赞助系数: 2.0
}
| 赛事 | 总奖金 | 冠军 | 亚军 | 季军 | 殿军 |
|---|---|---|---|---|---|
| MSI | 4000万 | 2000万 (50%) | 1000万 (25%) | 500万 (12.5%) | 200万 (5%) |
| 世界赛 | 1.2亿 | 5000万 (41.7%) | 2500万 (20.8%) | 1200万 (10%) | 1200万 (10%) |
| Super洲际赛 | 1.5亿 | 6000万 (40%) | 3000万 (20%) | 1500万 (10%) | 1500万 (10%) |
| 马德里大师赛 | 2000万 | 800万 (40%) | 400万 (20%) | 200万 (10%) | 200万 (10%) |
| Claude洲际赛 | 2000万 | 800万 (40%) | 400万 (20%) | 200万 (10%) | 200万 (10%) |
| 上海大师赛 | 2500万 | 1000万 (40%) | 500万 (20%) | 250万 (10%) | 250万 (10%) |
| ICP洲际对抗赛 | 3000万 | 1200万 (40%) | 600万 (20%) | 300万 (10%) | 300万 (10%) |
| 赛事 | 总奖金 | 冠军 | 亚军 | 季军 | 殿军 | 5-8名 |
|---|---|---|---|---|---|---|
| 春季季后赛 | 200万 | 70万 (35%) | 50万 (25%) | 30万 (15%) | 20万 (10%) | 8万 (4%/队) |
| 夏季季后赛 | 200万 | 70万 (35%) | 50万 (25%) | 30万 (15%) | 20万 (10%) | 8万 (4%/队) |
pub struct TeamSeasonFinance {
pub id: u64,
pub team_id: u64,
pub season_id: u64,
pub opening_balance: i64, // 期初余额
pub closing_balance: i64, // 期末余额
pub total_income: u64, // 总收入
pub total_expense: u64, // 总支出
pub financial_status: FinancialStatus,
pub salary_cap_used: u64, // 薪资支出
}
pub enum FinancialStatus {
Wealthy, // 富裕 (余额 > 1000万)
Healthy, // 健康 (500-1000万)
Tight, // 紧张 (100-500万)
Deficit, // 赤字 (0-100万)
Bankrupt, // 破产 (< 0)
}
pub struct FinancialTransaction {
pub id: u64,
pub save_id: String,
pub team_id: u64,
pub season_id: u64,
pub transaction_type: TransactionType,
pub amount: i64, // 正数收入,负数支出
pub description: Option<String>,
pub related_player_id: Option<u64>,
pub related_tournament_id: Option<u64>,
}
pub enum TransactionType {
// 收入类型
Sponsorship, // 赞助收入
LeagueShare, // 联赛分成
PlayoffBonus, // 季后赛奖金
InternationalBonus, // 国际赛奖金
TransferIn, // 转会收入
// 支出类型
Salary, // 薪资
OperatingCost, // 运营成本
TransferOut, // 转会支出
Fine, // 罚款
}
pub struct FinancialStatusSummary {
pub team_id: u64,
pub balance: i64,
pub is_crisis: bool,
pub transfer_budget: i64,
pub max_new_salary: u64,
pub projected_season_profit: i64,
}
基于球队战力和胜率计算:
fn calculate_sponsorship(&self, team: &Team) -> u64 {
let base = match team.power_rating as u32 {
90..=100 => 200, // 顶级队伍
85..=89 => 150,
80..=84 => 120,
75..=79 => 90,
70..=74 => 70,
65..=69 => 50,
_ => 30,
};
let win_rate_bonus = if team.win_rate > 0.7 {
1.5
} else if team.win_rate > 0.5 {
1.2
} else {
1.0
};
(base as f64 * win_rate_bonus * 2.0) as u64 // ×赞助系数
}
固定金额:150万/赛季
fn calculate_prize_money(&self, tournament_type: TournamentType, position: &str) -> u64 {
if let Some(pool) = self.config.prize_pools.get(&tournament_type) {
if let Some(&percentage) = pool.distribution.get(position) {
return (pool.total as f64 * percentage) as u64;
}
}
0
}
固定金额:300万/赛季
fn calculate_salary_expense(players: &[(u64, u64)]) -> u64 {
players.iter().map(|(_, salary)| salary).sum()
}
fn is_in_financial_crisis(&self, team: &Team) -> bool {
// 余额低于运营成本50%视为财务危机
team.balance < (300 * 10000 / 2) // < 150万
}
fn suggest_transfer_budget(&self, team: &Team) -> i64 {
if self.is_in_financial_crisis(team) {
0
} else {
(team.balance as f64 * 0.3) as i64 // 建议使用30%余额
}
}
fn max_affordable_salary(&self, team: &Team, current_salary_total: u64) -> u64 {
let projected_income = sponsorship + league_share;
let max_salary_budget = (projected_income as f64 * 0.6) as u64; // 不超过收入60%
if max_salary_budget > current_salary_total {
max_salary_budget - current_salary_total
} else {
0
}
}
文件: src-tauri/src/commands/finance_commands.rs
| 命令 | 功能 | 返回类型 |
|---|---|---|
get_team_finance_summary | 获取球队财务摘要 | TeamFinanceSummary |
get_all_teams_finance | 获取所有球队财务 | Vec<TeamFinanceSummary> |
get_team_transactions | 获取交易记录 | Vec<FinancialTransaction> |
record_transaction | 记录交易 | bool |
get_season_finance_report | 获取赛季报告 | TeamSeasonFinance |
pay_team_salaries | 支付薪资 | bool |
distribute_league_share | 发放联赛分成 | bool |
get_prize_pool_info | 获取奖金池信息 | PrizePool |
distribute_tournament_prizes | 发放赛事奖金 | i32 |
get_team_prize_details | 获取奖金明细 | Vec<PrizeDetail> |
文件: src/api/tauri.ts
// 获取球队财务摘要
export async function getTeamFinanceSummary(teamId: number): Promise<TeamFinanceSummary>
// 获取所有球队财务
export async function getAllTeamsFinance(): Promise<TeamFinanceSummary[]>
// 获取交易记录
export async function getTeamTransactions(teamId: number, seasonId?: number): Promise<FinancialTransaction[]>
// 获取赛季财务报告
export async function getSeasonFinanceReport(teamId: number, seasonId: number): Promise<TeamSeasonFinance>
// 获取奖金池信息
export async function getPrizePoolInfo(tournamentType: string): Promise<PrizePool>
// 发放赛事奖金
export async function distributeTournamentPrizes(tournamentId: number): Promise<number>
let engine = FinancialEngine::new();
let champion_prize = engine.calculate_prize_money(TournamentType::WorldChampionship, "CHAMPION");
println!("世界赛冠军奖金: {}万元", champion_prize / 10000);
// 输出: 世界赛冠军奖金: 5000万元
let status = engine.get_financial_status(&team, current_salary);
if status.is_crisis {
println!("警告: 财务危机!");
} else {
println!("转会预算: {}万", status.transfer_budget / 10000);
println!("可新增薪资: {}万", status.max_new_salary / 10000);
}
let report = engine.generate_season_report(
&team,
season_id,
salary_expense,
prize_money,
transfer_income,
);
println!("期初余额: {}万", report.opening_balance / 10000);
println!("总收入: {}万", report.total_income / 10000);
println!("总支出: {}万", report.total_expense / 10000);
println!("期末余额: {}万", report.closing_balance / 10000);
println!("财务状态: {:?}", report.financial_status);
// 发放世界赛奖金
const count = await distributeTournamentPrizes(worldsTournamentId)
console.log(`已向${count}支队伍发放奖金`)
CREATE TABLE financial_transactions (
id INTEGER PRIMARY KEY,
save_id TEXT NOT NULL,
team_id INTEGER NOT NULL,
season_id INTEGER NOT NULL,
transaction_type TEXT NOT NULL,
amount INTEGER NOT NULL,
description TEXT,
related_player_id INTEGER,
related_tournament_id INTEGER,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE team_season_finance (
id INTEGER PRIMARY KEY,
team_id INTEGER NOT NULL,
season_id INTEGER NOT NULL,
opening_balance INTEGER,
closing_balance INTEGER,
total_income INTEGER,
total_expense INTEGER,
financial_status TEXT,
salary_cap_used INTEGER,
UNIQUE(team_id, season_id)
);
generate_season_report 生成报告record_transaction 记录