syntax = "proto3"; package honghuang; option go_package = "github.com/honghuang-game/server/api/proto"; // ----------------------------------------------------------------------------- // 通用结构 // ----------------------------------------------------------------------------- message CommonError { int32 code = 1; string message = 2; } message Pagination { int32 page = 1; int32 page_size = 2; int32 total = 3; } message ItemAmount { string inventory_id = 1; string item_id = 2; int32 quantity = 3; } message CurrencyAmount { string currency_code = 1; string amount = 2; // 使用字符串保留 numeric 精度 } message MaterialCost { string inventory_id = 1; int32 quantity = 2; } message RealmPoint { int32 realm_tier = 1; int32 minor_realm = 2; } // ----------------------------------------------------------------------------- // 账号/角色 // ----------------------------------------------------------------------------- message RegisterReq { string device_id = 1; string platform = 2; string invite_code = 3; } message LoginReq { string device_id = 1; string platform = 2; string refresh_token = 3; } message AuthResp { int32 code = 1; string message = 2; string trace_id = 3; string player_id = 4; string nakama_token = 5; string expires_at = 6; bool is_new = 7; } message CreateCharacterReq { string name = 1; string race_id = 2; int32 birth_world_tier = 3; } message GetCharacterReq { string character_id = 1; bool with_snapshot = 2; } message CharacterResp { int32 code = 1; string message = 2; string trace_id = 3; string character_id = 4; string player_id = 5; string name = 6; string race_id = 7; int32 world_tier = 8; int32 realm_tier = 9; int32 minor_realm = 10; string realm_status = 11; int32 level = 12; int64 exp = 13; string status = 14; string base_stats = 15; // JSON string battle_stats = 16; // JSON int32 san_current = 17; int32 san_max = 18; int32 crime_score = 19; int32 heavenly_value = 20; int32 karma_value = 21; int32 reputation_score = 22; string last_online_at = 23; string created_at = 24; } // ----------------------------------------------------------------------------- // 修炼/境界 // ----------------------------------------------------------------------------- message RealmReq { string character_id = 1; } message RealmProgressResp { int32 code = 1; string message = 2; string trace_id = 3; int32 realm_tier = 4; int32 minor_realm = 5; string realm_name = 6; int64 exp = 7; int64 exp_to_next = 8; int32 max_unlocked_world_tier = 9; string realm_status = 10; bool breakthrough_ready = 11; bool tribulation_pending = 12; } message BreakthroughReq { string character_id = 1; int32 target_minor_realm = 2; repeated MaterialCost consumables = 3; repeated string helper_ids = 4; string idempotency_key = 5; } message BreakthroughResp { int32 code = 1; string message = 2; string trace_id = 3; bool success = 4; RealmPoint from = 5; RealmPoint to = 6; int64 exp_consumed = 7; string record_id = 8; string special_event = 9; } message TribulationReq { string character_id = 1; int32 target_realm_tier = 2; string tribulation_type = 3; repeated MaterialCost consumables = 4; repeated string helper_ids = 5; } message TribulationResp { int32 code = 1; string message = 2; string trace_id = 3; string tribulation_id = 4; string status = 5; double base_success_rate = 6; double modified_success_rate = 7; int32 estimated_ticks = 8; string start_at = 9; string result = 10; int32 from_realm_tier = 11; int32 to_realm_tier = 12; string penalties = 13; // JSON repeated ItemAmount drops = 14; } message WorldBreakReq { string character_id = 1; int32 target_world_tier = 2; string key_item_instance_id = 3; bool confirm = 4; } message WorldBreakResp { int32 code = 1; string message = 2; string trace_id = 3; bool success = 4; int32 from_world_tier = 5; int32 to_world_tier = 6; int32 from_realm_tier = 7; int32 to_realm_tier = 8; string breakthrough_record_id = 9; string world_event = 10; bool ruin_generated = 11; } // ----------------------------------------------------------------------------- // 战斗 // ----------------------------------------------------------------------------- message StartCombatReq { string battle_type = 1; string context_id = 2; repeated string party_members = 3; repeated string preferred_skills = 4; } message PvpChallengeReq { string target_character_id = 1; string bounty_id = 2; bool use_paid_chance = 3; } message CombatResp { int32 code = 1; string message = 2; string trace_id = 3; string battle_id = 4; string status = 5; string result_summary = 6; // JSON string drops = 7; // JSON bool death_penalty_applied = 8; int32 honor_points = 9; int32 daily_pvp_count = 10; int32 daily_pvp_limit = 11; } message BattleReportReq { string battle_id = 1; } message BattleReportResp { int32 code = 1; string message = 2; string trace_id = 3; string battle_id = 4; string type = 5; int32 realm_tier = 6; string game_timestamp = 7; string attacker = 8; // JSON string defender = 9; // JSON string rounds = 10; // JSON string result = 11; // JSON string special_events = 12; // JSON } // ----------------------------------------------------------------------------- // 功法 // ----------------------------------------------------------------------------- message ManualListReq { string character_id = 1; bool is_buffing = 2; int32 page = 3; int32 page_size = 4; } message ManualItem { string manual_instance_id = 1; string manual_id = 2; string name = 3; int32 current_layer = 4; int32 max_layer = 5; int32 proficiency = 6; bool is_main = 7; bool is_buffing = 8; string domain = 9; string element = 10; string source_tag = 11; } message ManualListResp { int32 code = 1; string message = 2; string trace_id = 3; int32 total = 4; repeated ManualItem list = 5; } message UpgradeManualReq { string character_id = 1; string manual_instance_id = 2; repeated MaterialCost materials = 3; bool use_insight_item = 4; string idempotency_key = 5; } message ManualResp { int32 code = 1; string message = 2; string trace_id = 3; string manual_instance_id = 4; int32 old_layer = 5; int32 new_layer = 6; bool success = 7; int32 proficiency_left = 8; ItemAmount unlocked_skill = 9; } message BuffManualReq { string character_id = 1; string manual_instance_id = 2; int32 slot_index = 3; bool unset_others = 4; } message BuffSlotResp { int32 code = 1; string message = 2; string trace_id = 3; int32 slot_index = 4; string manual_instance_id = 5; double buff_speed_bonus = 6; string breakin_until = 7; } // ----------------------------------------------------------------------------- // 技能 // ----------------------------------------------------------------------------- message LearnSkillReq { string character_id = 1; string source_type = 2; string source_id = 3; string custom_name = 4; } message SkillResp { int32 code = 1; string message = 2; string trace_id = 3; string skill_instance_id = 4; string skill_id = 5; string name = 6; string source_tag = 7; bool can_copy_to_jade_slip = 8; int32 proficiency = 9; string instance_data = 10; // JSON } message JadeSlipReq { string character_id = 1; string skill_instance_id = 2; bool consume_proficiency = 3; int32 copy_count = 4; } message ItemResp { int32 code = 1; string message = 2; string trace_id = 3; string inventory_id = 4; string item_id = 5; string name = 6; int32 quantity = 7; string instance_data = 8; // JSON int32 proficiency_consumed = 9; } // ----------------------------------------------------------------------------- // 经济/背包 // ----------------------------------------------------------------------------- message CurrencyReq { string character_id = 1; } message CurrencyBalance { string currency_code = 1; string amount = 2; string total_earned = 3; string total_spent = 4; } message CurrencyBalancesResp { int32 code = 1; string message = 2; string trace_id = 3; repeated CurrencyBalance balances = 4; } message MarketOrderReq { string inventory_id = 1; string currency_code = 2; string unit_price = 3; int32 quantity = 4; int32 duration_hours = 5; } message MarketOrderResp { int32 code = 1; string message = 2; string trace_id = 3; string order_id = 4; string status = 5; string listed_at = 6; string expired_at = 7; double tax_rate = 8; } message OrderIdReq { string order_id = 1; } message BuyOrderReq { string order_id = 1; int32 quantity = 2; } message TradeResp { int32 code = 1; string message = 2; string trace_id = 3; string trade_id = 4; string order_id = 5; int32 quantity = 6; string total_price = 7; string tax = 8; string currency_code = 9; repeated ItemAmount items = 10; } message AuctionListReq { int32 world_tier = 1; string auction_type = 2; string category = 3; string status = 4; int32 page = 5; int32 page_size = 6; } message AuctionItem { string auction_id = 1; string seller_id = 2; string item_id = 3; string category = 4; string currency_code = 5; string start_price = 6; string status = 7; string started_at = 8; string ended_at = 9; } message AuctionListResp { int32 code = 1; string message = 2; string trace_id = 3; int32 total = 4; repeated AuctionItem list = 5; } message BidReq { string auction_id = 1; string amount = 2; bool is_auto_bid = 3; string auto_max_amount = 4; } message BidResp { int32 code = 1; string message = 2; string trace_id = 3; string bid_id = 4; string auction_id = 5; string amount = 6; string deposit_paid = 7; bool is_auto_bid = 8; string bid_at = 9; } message IntelListReq { string intel_type = 1; int32 target_world_tier = 2; int32 page = 3; int32 page_size = 4; } message IntelItem { string order_id = 1; string seller_id = 2; string intel_type = 3; int32 target_world_tier = 4; string content_summary = 5; string currency_code = 6; string price = 7; int32 purchase_count = 8; int32 max_purchase = 9; } message IntelListResp { int32 code = 1; string message = 2; string trace_id = 3; int32 total = 4; repeated IntelItem list = 5; } message BuyIntelReq { string order_id = 1; } message IntelBuffResp { int32 code = 1; string message = 2; string trace_id = 3; string buff_id = 4; string order_id = 5; string detail_data = 6; // JSON string expires_at = 7; } // ----------------------------------------------------------------------------- // 社交/组织/悬赏 // ----------------------------------------------------------------------------- message CreateOrgReq { string org_type = 1; string name = 2; string region_id = 3; repeated string founding_members = 4; } message OrgIdReq { string guild_id = 1; } message OrgResp { int32 code = 1; string message = 2; string trace_id = 3; string guild_id = 4; string name = 5; string org_type = 6; string leader_id = 7; int32 level = 8; int32 member_limit = 9; string created_at = 10; } message OrgMemberReq { string guild_id = 1; } message OrgMemberResp { int32 code = 1; string message = 2; string trace_id = 3; string guild_id = 4; string character_id = 5; string role = 6; string joined_at = 7; } message UpdateRoleReq { string guild_id = 1; string character_id = 2; string role = 3; string action = 4; } message RelationReq { string relation_type = 1; string target_character_id = 2; string vow_path = 3; } message RelationResponseReq { string relation_type = 1; string request_id = 2; string action = 3; } message RelationResp { int32 code = 1; string message = 2; string trace_id = 3; string request_id = 4; string relation_type = 5; string from_character_id = 6; string to_character_id = 7; string status = 8; } message PublishContractReq { string contract_type = 1; int32 difficulty = 2; string currency_code = 3; string base_reward = 4; string target_params = 5; // JSON string valid_until = 6; } message AcceptContractReq { string contract_id = 1; string accept_type = 2; string disciple_id = 3; repeated string party_members = 4; } message ContractResp { int32 code = 1; string message = 2; string trace_id = 3; string contract_id = 4; string contract_type = 5; string status = 6; string publisher_id = 7; string base_reward = 8; string currency_code = 9; string valid_until = 10; } message PublishBountyReq { string bounty_type = 1; string target_character_id = 2; string reward_amount = 3; string currency_code = 4; int32 valid_days = 5; bool is_anonymous = 6; } message BountyIdReq { string bounty_id = 1; } message BountyResp { int32 code = 1; string message = 2; string trace_id = 3; string bounty_id = 4; string bounty_type = 5; string target_id = 6; string reward_amount = 7; string status = 8; string valid_until = 9; } // ----------------------------------------------------------------------------- // 地图/副本/事件 // ----------------------------------------------------------------------------- message RegionReq { string region_id = 1; } message RegionResp { int32 code = 1; string message = 2; string trace_id = 3; string region_id = 4; int32 world_tier = 5; string name = 6; bool is_safe_zone = 7; string pvp_rules = 8; // JSON string weather = 9; int32 resource_density = 10; int32 danger_level = 11; int32 nearby_player_count = 12; } message NearbyReq { string region_id = 1; int32 limit = 2; repeated string event_types = 3; } message NearbyResp { int32 code = 1; string message = 2; string trace_id = 3; string players = 4; // JSON string events = 5; // JSON } message EnterInstanceReq { string instance_id = 1; repeated string party_members = 2; string consumable_key_id = 3; bool use_stamina = 4; } message InstanceRunResp { int32 code = 1; string message = 2; string trace_id = 3; string run_id = 4; string instance_id = 5; string status = 6; double difficulty_coefficient = 7; int32 consumed_keys = 8; string started_at = 9; } message WorldEventReq { int32 world_tier = 1; string region_id = 2; string event_scope = 3; int32 page = 4; int32 page_size = 5; } message WorldEventItem { string event_id = 1; string event_type = 2; int32 world_tier = 3; string region_id = 4; string title = 5; string content = 6; string expires_at = 7; } message WorldEventListResp { int32 code = 1; string message = 2; string trace_id = 3; int32 total = 4; repeated WorldEventItem list = 5; } message PlayerEventReq { string event_type = 1; string region_id = 2; repeated MaterialCost cost_items = 3; string description = 4; } message WorldEventResp { int32 code = 1; string message = 2; string trace_id = 3; string event_id = 4; string event_type = 5; string status = 6; string created_at = 7; } // ----------------------------------------------------------------------------- // 弟子/领地 // ----------------------------------------------------------------------------- message DispatchReq { string disciple_id = 1; string target_type = 2; string target_id = 3; int32 duration_minutes = 4; string insurance_item_id = 5; } message DiscipleMissionResp { int32 code = 1; string message = 2; string trace_id = 3; string mission_id = 4; string disciple_id = 5; string target_type = 6; string started_at = 7; string ended_at = 8; string status = 9; } message MissionIdReq { string mission_id = 1; } message MissionRewardResp { int32 code = 1; string message = 2; string trace_id = 3; string mission_id = 4; string result = 5; string rewards = 6; // JSON } message TerritoryBidReq { string guild_id = 1; string territory_id = 2; string bid_amount = 3; bool is_renewal = 4; } message TerritoryBidResp { int32 code = 1; string message = 2; string trace_id = 3; string bid_id = 4; string territory_id = 5; string bid_amount = 6; string deposit_locked = 7; string window_end_at = 8; } // ----------------------------------------------------------------------------- // 服务定义 // ----------------------------------------------------------------------------- service AuthService { rpc Register (RegisterReq) returns (AuthResp); rpc Login (LoginReq) returns (AuthResp); } service CharacterService { rpc CreateCharacter (CreateCharacterReq) returns (CharacterResp); rpc GetCharacter (GetCharacterReq) returns (CharacterResp); } service RealmService { rpc GetRealmProgress (RealmReq) returns (RealmProgressResp); rpc AttemptBreakthrough (BreakthroughReq) returns (BreakthroughResp); rpc StartTribulation (TribulationReq) returns (TribulationResp); rpc GetTribulationResult (TribulationReq) returns (TribulationResp); rpc WorldBreak (WorldBreakReq) returns (WorldBreakResp); } service BattleService { rpc StartCombat (StartCombatReq) returns (CombatResp); rpc GetBattleReport (BattleReportReq) returns (BattleReportResp); rpc PvpChallenge (PvpChallengeReq) returns (CombatResp); } service ManualService { rpc ListManuals (ManualListReq) returns (ManualListResp); rpc UpgradeManual (UpgradeManualReq) returns (ManualResp); rpc SetBuffingManual (BuffManualReq) returns (BuffSlotResp); } service SkillService { rpc LearnSkill (LearnSkillReq) returns (SkillResp); rpc CreateJadeSlip (JadeSlipReq) returns (ItemResp); } service EconomyService { rpc GetCurrencyBalances (CurrencyReq) returns (CurrencyBalancesResp); rpc CreateMarketOrder (MarketOrderReq) returns (MarketOrderResp); rpc CancelMarketOrder (OrderIdReq) returns (MarketOrderResp); rpc BuyMarketOrder (BuyOrderReq) returns (TradeResp); rpc ListAuctions (AuctionListReq) returns (AuctionListResp); rpc BidAuction (BidReq) returns (BidResp); rpc ListIntelligence (IntelListReq) returns (IntelListResp); rpc BuyIntelligence (BuyIntelReq) returns (IntelBuffResp); } service SocialService { rpc CreateOrganization (CreateOrgReq) returns (OrgResp); rpc GetOrganization (OrgIdReq) returns (OrgResp); rpc JoinOrganization (OrgMemberReq) returns (OrgMemberResp); rpc LeaveOrganization (OrgIdReq) returns (OrgMemberResp); rpc UpdateMemberRole (UpdateRoleReq) returns (OrgMemberResp); rpc SendRelationRequest (RelationReq) returns (RelationResp); rpc RespondRelationRequest (RelationResponseReq) returns (RelationResp); rpc PublishContract (PublishContractReq) returns (ContractResp); rpc AcceptContract (AcceptContractReq) returns (ContractResp); rpc PublishBounty (PublishBountyReq) returns (BountyResp); rpc AcceptBounty (BountyIdReq) returns (BountyResp); } service MapService { rpc GetRegion (RegionReq) returns (RegionResp); rpc GetNearby (NearbyReq) returns (NearbyResp); rpc EnterInstance (EnterInstanceReq) returns (InstanceRunResp); rpc ListWorldEvents (WorldEventReq) returns (WorldEventListResp); rpc PublishPlayerEvent (PlayerEventReq) returns (WorldEventResp); } service DiscipleService { rpc DispatchDisciple (DispatchReq) returns (DiscipleMissionResp); rpc ClaimMissionOutput (MissionIdReq) returns (MissionRewardResp); rpc BidTerritory (TerritoryBidReq) returns (TerritoryBidResp); }