feat: initial commit for TheFarmer project

This commit is contained in:
Karriis
2026-02-18 13:52:06 +08:00
commit 8ceb5fa9db
420 changed files with 61918 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
syntax = "proto3";
package corepb;
// ============ 通用物品 ============
message Item {
int64 id = 1; // 物品ID
int64 count = 2; // 数量
int64 expire_time = 3; // 过期时间
// field 4 reserved
// google.protobuf.Any detail = 5; // 详情 (略)
int64 uid = 6; // UID
bool is_new = 7; // 是否新获得
repeated int64 mutant_types = 8; // 变异类型
// ItemShow show = 100; // 展示信息 (略)
}
// 背包(物品列表)
message ItemBag {
repeated Item items = 1;
}
// ============ 物品变化 ============
message ItemChg {
Item item = 1; // 物品信息
int64 delta = 2; // 变化量 (正数增加, 负数减少)
}

View File

@@ -0,0 +1,120 @@
syntax = "proto3";
package gamepb.friendpb;
// ============ 好友农场摘要信息 ============
message Plant {
int64 dry_time_sec = 1; // 缺水倒计时秒
int64 weed_time_sec = 2; // 长草倒计时秒
int64 insect_time_sec = 3; // 生虫倒计时秒
int64 ripe_time_sec = 4; // 成熟倒计时秒
int64 ripe_fruit_id = 5; // 成熟果实ID
int64 steal_plant_num = 6; // 可偷数量
int64 dry_num = 7; // 缺水地块数
int64 weed_num = 8; // 有草地块数
int64 insect_num = 9; // 有虫地块数
}
// ============ 标签 ============
message Tags {
bool is_new = 1;
bool is_follow = 2;
}
// ============ 好友信息 ============
message GameFriend {
int64 gid = 1;
string open_id = 2;
string name = 3;
string avatar_url = 4;
string remark = 5;
int64 level = 6;
int64 gold = 7;
Tags tags = 8;
Plant plant = 9;
int32 authorized_status = 10;
// field 11 reserved
// Illustrated illustrated = 12; // 略
// repeated AvatarFrame equip_avatar_frames = 13; // 略
}
// ============ 请求/回复 ============
// --- 获取所有好友 ---
message GetAllRequest {}
message GetAllReply {
repeated GameFriend game_friends = 1;
// repeated Invitation invitations = 2; // 略
int64 application_count = 3;
}
// --- 同步好友 (带 open_ids) ---
message SyncAllRequest {
// field 1 reserved
repeated string open_ids = 2;
}
message SyncAllReply {
repeated GameFriend game_friends = 1;
// repeated Invitation invitations = 2; // 略
int64 application_count = 3;
}
// ============ 好友申请 (微信同玩) ============
// 申请信息
message Application {
int64 gid = 1;
int64 time_at = 2;
string open_id = 3;
string name = 4;
string avatar_url = 5;
int64 level = 6;
// repeated AvatarFrame equip_avatar_frames = 7; // 略
}
// --- 获取好友申请列表 ---
message GetApplicationsRequest {}
message GetApplicationsReply {
repeated Application applications = 1;
bool block_applications = 2; // 是否屏蔽申请
}
// --- 同意好友申请 ---
message AcceptFriendsRequest {
repeated int64 friend_gids = 1;
}
message AcceptFriendsReply {
repeated GameFriend friends = 1;
}
// --- 拒绝好友申请 ---
message RejectFriendsRequest {
repeated int64 friend_gids = 1;
}
message RejectFriendsReply {}
// --- 设置屏蔽申请 ---
message SetBlockApplicationsRequest {
bool block = 1;
}
message SetBlockApplicationsReply {
bool block = 1;
}
// ============ 服务器推送通知 ============
// 收到好友申请通知
message FriendApplicationReceivedNotify {
repeated Application applications = 1;
}
// 好友添加成功通知 (对方同意后)
message FriendAddedNotify {
repeated GameFriend friends = 1;
}

View File

@@ -0,0 +1,44 @@
syntax = "proto3";
// ============ gatepb ============
// 网关层协议 - 所有WS消息的外壳
package gatepb;
// Meta.Type 枚举
enum MessageType {
None = 0;
Request = 1;
Response = 2;
Notify = 3;
}
// 消息元信息
message Meta {
string service_name = 1;
string method_name = 2;
int32 message_type = 3; // MessageType enum
int64 client_seq = 4;
int64 server_seq = 5;
int64 error_code = 6;
string error_message = 7;
map<string, bytes> metadata = 8;
}
// 每个WS帧的结构
message Message {
Meta meta = 1;
bytes body = 2;
}
// 服务器推送事件
message EventMessage {
string message_type = 1;
bytes body = 2;
}
// 被踢下线通知
message KickoutNotify {
int64 reason = 1;
string reason_message = 2;
}

View File

@@ -0,0 +1,53 @@
syntax = "proto3";
package gamepb.itempb;
import "corepb.proto";
// ============ 背包/仓库 ============
// 获取背包
message BagRequest {}
message BagReply {
corepb.ItemBag item_bag = 1; // 与 game 一致,背包数据在 item_bag 里
}
// ============ 出售物品 ============
message SellRequest {
repeated corepb.Item items = 1; // 要出售的物品列表 (id + count)
}
message SellReply {
repeated corepb.Item sell_items = 1; // 出售的物品
repeated corepb.Item get_items = 2; // 获得的物品id=1001为金币, id=1002为点券
}
// ============ 使用物品 ============
message UseRequest {
int64 item_id = 1;
int64 count = 2;
repeated int64 land_ids = 3;
}
message UseReply {
repeated corepb.Item items = 1;
}
// ============ 批量使用物品 ============
message UseItem {
int64 item_id = 1;
int64 count = 2;
int64 land_count = 6; // 根据抓包字段6为18推测为土地数
}
message BatchUseRequest {
repeated UseItem items = 1;
}
message BatchUseReply {
repeated corepb.Item items = 1;
}

View File

@@ -0,0 +1,10 @@
syntax = "proto3";
package gamepb.itempb;
import "corepb.proto";
// ============ 物品变化通知 ============
message ItemNotify {
repeated corepb.ItemChg items = 1;
}

View File

@@ -0,0 +1,266 @@
syntax = "proto3";
package gamepb.plantpb;
// ============ 生长阶段枚举 ============
enum PlantPhase {
PHASE_UNKNOWN = 0;
SEED = 1; // 种子
GERMINATION = 2; // 发芽
SMALL_LEAVES = 3; // 小叶
LARGE_LEAVES = 4; // 大叶
BLOOMING = 5; // 开花
MATURE = 6; // 成熟 (可收获)
DEAD = 7; // 枯死
}
// ============ 土地信息 ============
message LandInfo {
int64 id = 1;
bool unlocked = 2;
int64 level = 3;
int64 max_level = 4;
bool could_unlock = 5;
bool could_upgrade = 6;
LandUnlockCondition unlock_condition = 7;
LandUpgradeCondition upgrade_condition = 8;
Buff buff = 9;
PlantInfo plant = 10;
bool is_shared = 11;
bool can_share = 12;
int64 master_land_id = 13;
repeated int64 slave_land_ids = 14;
int64 land_size = 15;
int64 lands_level = 16;
// 土地buff
message Buff {
int64 plant_yield_bonus = 1;
int64 planting_time_reduction = 2;
int64 plant_exp_bonus = 3;
}
}
// 土地解锁条件 (简化)
message LandUnlockCondition {
int64 need_level = 1;
int64 need_gold = 2;
// ... 其他条件字段
}
// 土地升级条件 (简化)
message LandUpgradeCondition {
int64 need_level = 1;
int64 need_gold = 2;
// ... 其他条件字段
}
// ============ 植物信息 ============
message PlantInfo {
int64 id = 1; // 植物/种子ID
string name = 2; // 名称
// field 3 reserved
repeated PlantPhaseInfo phases = 4; // 生长阶段列表
int64 season = 5; // 季节
int64 dry_num = 6; // 缺水次数 (>0需要浇水)
// fields 7,8 reserved
int64 stole_num = 9; // 被偷次数
int64 fruit_id = 10; // 果实ID
int64 fruit_num = 11; // 果实数量
repeated int64 weed_owners = 12; // 放草的人 (非空=有草)
repeated int64 insect_owners = 13; // 放虫的人 (非空=有虫)
repeated int64 stealers = 14; // 偷菜的人
int64 grow_sec = 15; // 生长秒数
bool stealable = 16; // 是否可偷
int64 left_inorc_fert_times = 17; // 剩余施肥次数
int64 left_fruit_num = 18; // 剩余果实数
int64 steal_intimacy_level = 19; // 偷菜亲密度等级
repeated int64 mutant_config_ids = 20; // 变异配置ID
bool is_nudged = 21; // 是否被催熟
}
// ============ 生长阶段详情 ============
message PlantPhaseInfo {
int32 phase = 1; // PlantPhase 枚举值
int64 begin_time = 2; // 阶段开始时间
int64 phase_id = 3; // 阶段ID
// fields 4,5 reserved
int64 dry_time = 6; // 变干时间 (>0 需要浇水)
int64 weeds_time = 7; // 长草时间 (>0 有杂草)
int64 insect_time = 8; // 生虫时间 (>0 有虫害)
map<int64, int64> ferts_used = 9; // 已用肥料
repeated MutantInfo mutants = 10; // 变异信息
}
// 变异信息
message MutantInfo {
int64 mutant_time = 1;
int64 mutant_config_id = 2;
int64 weather_id = 3;
}
// ============ 操作限制 ============
// 每种操作的每日限制信息
message OperationLimit {
int64 id = 1; // 操作类型ID
int64 day_times = 2; // 今日已操作次数
int64 day_times_lt = 3; // 每日操作上限
int64 day_share_id = 4; // 分享ID
int64 day_exp_times = 5; // 今日已获得经验次数
int64 day_ex_times_lt = 6; // 每日可获得经验上限
int64 day_exp_share_id = 7; // 经验分享ID
}
// 操作类型ID:
// 10001 = 帮好友浇水
// 10002 = 帮好友除虫
// 10003 = 帮好友除草
// 10004 = 偷菜
// 10005 = 放虫
// 10006 = 放草
// ============ 请求/回复消息 ============
// --- 获取所有土地 ---
message AllLandsRequest {
int64 host_gid = 1; // 0或自己的GID=查看自己
}
message AllLandsReply {
repeated LandInfo lands = 1;
repeated OperationLimit operation_limits = 2;
}
// --- 收获 ---
message HarvestRequest {
repeated int64 land_ids = 1; // 要收获的土地ID列表
int64 host_gid = 2; // 农场主GID
bool is_all = 3; // 是否全部收获
}
message HarvestReply {
repeated LandInfo land = 1;
// repeated Item items = 2; // corepb.Item
// repeated Item lost_items = 3;
repeated OperationLimit operation_limits = 4;
}
// --- 浇水 ---
message WaterLandRequest {
repeated int64 land_ids = 1;
int64 host_gid = 2;
}
message WaterLandReply {
repeated LandInfo land = 1;
repeated OperationLimit operation_limits = 2;
}
// --- 除草 ---
message WeedOutRequest {
repeated int64 land_ids = 1;
int64 host_gid = 2;
}
message WeedOutReply {
repeated LandInfo land = 1;
repeated OperationLimit operation_limits = 2;
}
// --- 除虫 ---
message InsecticideRequest {
repeated int64 land_ids = 1;
int64 host_gid = 2;
}
message InsecticideReply {
repeated LandInfo land = 1;
repeated OperationLimit operation_limits = 2;
}
// --- 播种 ---
message PlantItem {
int64 seed_id = 1; // 种子ID
repeated int64 land_ids = 2; // 要种植的土地ID列表
bool auto_slave = 3; // 是否自动副产
}
message PlantRequest {
map<int64, int64> land_and_seed = 1; // land_id -> seed_id (旧版)
repeated PlantItem items = 2; // 新版: 按种子分组种植
}
message PlantReply {
repeated LandInfo land = 1;
repeated OperationLimit operation_limits = 2;
}
// --- 移除植物 ---
message RemovePlantRequest {
repeated int64 land_ids = 1;
}
message RemovePlantReply {
repeated LandInfo land = 1;
repeated OperationLimit operation_limits = 2;
}
// --- 施肥 ---
message FertilizeRequest {
repeated int64 land_ids = 1;
int64 fertilizer_id = 2;
}
message FertilizeReply {
repeated LandInfo land = 1;
repeated OperationLimit operation_limits = 2;
int64 fertilizer = 3; // 剩余肥料时间
}
// --- 升级土地 ---
message UpgradeLandRequest {
int64 land_id = 1;
}
message UpgradeLandReply {
LandInfo land = 1;
}
// --- 解锁土地 ---
message UnlockLandRequest {
int64 land_id = 1;
bool do_shared = 2;
}
message UnlockLandReply {
LandInfo land = 1;
}
// --- 放虫 ---
message PutInsectsRequest {
repeated int64 land_ids = 1;
int64 host_gid = 2;
}
message PutInsectsReply {
repeated LandInfo land = 1;
repeated OperationLimit operation_limits = 2;
}
// --- 放草 ---
message PutWeedsRequest {
repeated int64 land_ids = 1;
int64 host_gid = 2;
}
message PutWeedsReply {
repeated LandInfo land = 1;
repeated OperationLimit operation_limits = 2;
}
// ============ 服务器推送通知 ============
// 土地状态变化通知 (被放虫/放草/偷菜等)
message LandsNotify {
repeated LandInfo lands = 1; // 变化的土地列表
int64 host_gid = 2; // 农场主GID
}

View File

@@ -0,0 +1,74 @@
syntax = "proto3";
package gamepb.shoppb;
import "corepb.proto";
// ============ 商店类型: 1=道具商店, 2=种子商店, 3=宠物商店 ============
// ============ 商店概览 ============
message ShopProfile {
int64 shop_id = 1; // 商店ID
string shop_name = 2; // 商店名称
int32 shop_type = 3; // 商店类型
}
// ============ 商品信息 ============
message GoodsInfo {
int64 id = 1; // 商品ID (用于购买)
int64 bought_num = 2; // 已购买数量
int64 price = 3; // 价格 (金币)
int64 limit_count = 4; // 限购数量 (0=不限购)
bool unlocked = 5; // 是否已解锁
int64 item_id = 6; // 物品ID (即种子ID)
int64 item_count = 7; // 每次购买获得数量
repeated Cond conds = 8; // 解锁条件
}
// ============ 解锁条件 ============
enum CondType {
COND_TYPE_UNKNOWN = 0;
MIN_LEVEL = 1; // 最低等级要求
UNLOCK_CARD = 2; // 需要解锁卡
}
message Cond {
int32 type = 1; // CondType
int64 param = 2; // 参数值 (如等级要求的等级数)
}
// ============ 请求/回复 ============
// --- 获取商店列表 ---
message ShopProfilesRequest {}
message ShopProfilesReply {
repeated ShopProfile shop_profiles = 1;
}
// --- 获取商店商品 ---
message ShopInfoRequest {
int64 shop_id = 1;
}
message ShopInfoReply {
repeated GoodsInfo goods_list = 1;
}
// --- 购买商品 ---
message BuyGoodsRequest {
int64 goods_id = 1; // 商品ID (GoodsInfo.id)
int64 num = 2; // 购买数量
int64 price = 3; // 单价
}
message BuyGoodsReply {
GoodsInfo goods = 1; // 更新后的商品信息
repeated corepb.Item get_items = 2; // 获得的物品
repeated corepb.Item cost_items = 3; // 消耗的物品
}
// --- 商品解锁推送 ---
message GoodsUnlockNotify {
repeated GoodsInfo goods_list = 1;
}

View File

@@ -0,0 +1,81 @@
syntax = "proto3";
package gamepb.taskpb;
import "corepb.proto";
// ============ 任务类型 ============
// 1 = 成长任务 (GROWTH_TASK)
// 2 = 每日任务 (DAILY_TASK)
// ============ 单个任务 ============
message Task {
int64 id = 1; // 任务ID
int64 progress = 2; // 当前进度
bool is_claimed = 3; // 是否已领取
bool is_unlocked = 4; // 是否已解锁
repeated corepb.Item rewards = 5; // 奖励列表
int64 total_progress = 6; // 总进度
int64 share_multiple = 7; // 分享倍数 (>1 表示可分享翻倍)
repeated string params = 8; // 参数
string desc = 9; // 描述
int32 task_type = 10; // 任务类型
int64 group = 11; // 分组
int64 cond_type = 12; // 条件类型
int64 is_show_text = 13; // 是否显示文本
}
// ============ 活跃度奖励 ============
message Active {
int64 id = 1;
int32 status = 2; // 0=未完成, 1=已完成, 2=未完成
repeated corepb.Item items = 3;
}
// ============ 任务信息汇总 ============
message TaskInfo {
repeated Task growth_tasks = 1; // 成长任务列表
repeated Task daily_tasks = 2; // 每日任务列表
repeated Task tasks = 3; // 其他任务
repeated Active actives = 4; // 活跃度奖励
}
// ============ 请求/回复 ============
// --- 获取任务信息 ---
message TaskInfoRequest {}
message TaskInfoReply {
TaskInfo task_info = 1;
}
// --- 领取单个任务奖励 ---
message ClaimTaskRewardRequest {
int64 id = 1; // 任务ID
bool do_shared = 2; // 是否使用分享翻倍 (true=翻倍, false=普通领取)
}
message ClaimTaskRewardReply {
repeated corepb.Item items = 1; // 获得的物品
TaskInfo task_info = 2; // 更新后的任务信息
repeated corepb.Item compensated_items = 3; // 补偿物品
}
// --- 批量领取任务奖励 ---
message BatchClaimTaskRewardRequest {
repeated int64 ids = 1; // 任务ID列表
bool do_shared = 2; // 是否使用分享翻倍
}
message BatchClaimTaskRewardReply {
repeated corepb.Item items = 1;
TaskInfo task_info = 2;
repeated corepb.Item compensated_items = 3;
}
// ============ 服务器推送 ============
// 任务状态变化通知
message TaskInfoNotify {
TaskInfo task_info = 1;
}

View File

@@ -0,0 +1,123 @@
syntax = "proto3";
package gamepb.userpb;
// ============ 登录请求 ============
message LoginRequest {
// 字段 1,2 保留未使用
int64 sharer_id = 3;
string sharer_open_id = 4;
DeviceInfo device_info = 5;
int64 share_cfg_id = 6;
string scene_id = 7;
ReportData report_data = 8;
}
// 设备信息
message DeviceInfo {
string client_version = 1; // e.g. "1.6.0.8_20251224"
string sys_software = 2; // e.g. "Windows Unknown x64"
string sys_hardware = 3;
string telecom_oper = 4;
string network = 5; // e.g. "wifi"
int64 screen_width = 6;
int64 screen_height = 7;
float density = 8;
string cpu = 9; // e.g. "microsoft"
int64 memory = 10;
string gl_render = 11;
string gl_version = 12;
string device_id = 13;
string android_oaid = 14;
string ios_caid = 15;
}
// 上报数据
message ReportData {
string callback = 1;
string cd_extend_info = 2;
string click_id = 3;
string clue_token = 4;
string minigame_channel = 5;
int32 minigame_platid = 6;
string req_id = 7;
string trackid = 8;
}
// ============ 登录回复 ============
message LoginReply {
BasicInfo basic = 1;
// ItemBag item_bag = 2; // corepb.ItemBag, 复杂结构先跳过
int64 time_now_millis = 3;
bool is_first_login = 4;
// GuideInfo guide_info = 5;
repeated QQGroupInfo qq_group_infos = 6;
// Illustrated illustrated = 7;
// repeated SystemUnlockItem unlocked_items = 8;
VersionInfo version_info = 9;
// MallMsg mall_msg = 10;
int64 qq_friend_recommend_authorized = 11;
}
// 用户基本信息
message BasicInfo {
int64 gid = 1;
string name = 2;
int64 level = 3;
int64 exp = 4;
int64 gold = 5;
string open_id = 6;
string avatar_url = 7;
string remark = 8;
string signature = 9;
int32 gender = 10;
// repeated AvatarFrame equip_avatar_frames = 11;
// map<int64, ShareInfo> share_infos = 12;
int32 authorized_status = 13;
bool disable_nudge = 14;
}
// QQ群信息
message QQGroupInfo {
string qq_group_id = 1;
string qq_group_name = 2;
}
// 版本信息
message VersionInfo {
int32 status = 1;
string version_recommend = 2;
string version_force = 3;
string res_version = 4;
}
// ============ 心跳 ============
message HeartbeatRequest {
int64 gid = 1;
string client_version = 2;
}
message HeartbeatReply {
int64 server_time = 1;
VersionInfo version_info = 2;
}
// ============ 上报分享点击 ============
// 用于已登录状态下处理分享链接(触发好友申请)
message ReportArkClickRequest {
int64 sharer_id = 1;
string sharer_open_id = 2;
string scene_id = 3;
int64 share_cfg_id = 4;
}
message ReportArkClickReply {
// 通常为空响应
}
// ============ 服务器推送通知 ============
// 基本信息变化通知 (升级/金币变化等)
message BasicNotify {
BasicInfo basic = 1;
}

View File

@@ -0,0 +1,42 @@
syntax = "proto3";
package gamepb.visitpb;
import "plantpb.proto";
import "userpb.proto";
// ============ 访问好友农场服务 ============
// service VisitService {
// rpc Enter(EnterRequest) returns (EnterReply);
// rpc Leave(LeaveRequest) returns (LeaveReply);
// }
// ============ 进入原因枚举 ============
enum EnterReason {
ENTER_REASON_UNKNOWN = 0;
ENTER_REASON_BUBBLE = 1;
ENTER_REASON_FRIEND = 2;
ENTER_REASON_INTERACT = 3;
}
// ============ 进入好友农场 ============
message EnterRequest {
int64 host_gid = 1; // 好友的GID
int32 reason = 2; // EnterReason 进入原因
}
message EnterReply {
gamepb.userpb.BasicInfo basic = 1; // 好友基本信息
repeated gamepb.plantpb.LandInfo lands = 2; // 好友的所有土地
// field 3: brief_dog_info (不需要)
// field 4: nudge_info (不需要)
}
// ============ 离开好友农场 ============
message LeaveRequest {
int64 host_gid = 1; // 好友的GID
}
message LeaveReply {
// 空消息
}