Skip to content

Commit

Permalink
feat: 单次礼物消息增加连击标识
Browse files Browse the repository at this point in the history
  • Loading branch information
ddiu8081 committed Oct 11, 2022
1 parent 5580c1a commit a75a089
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Expand Up @@ -442,6 +442,15 @@ export interface GiftMsg {
uname: string
room_id: number
}
/** 礼物连击 */
combo?: {
/** 连击id */
batch_id: string
/** 当前连击数(礼物总数) */
combo_num: number
/** 连击礼物总价格,除以1000为RMB */
total_price: number
}
}
```

Expand Down
16 changes: 16 additions & 0 deletions src/parser/SEND_GIFT.ts
Expand Up @@ -19,6 +19,15 @@ export interface GiftMsg {
uname: string
room_id: number
}
/** 礼物连击 */
combo?: {
/** 连击id */
batch_id: string
/** 当前连击数(礼物总数) */
combo_num: number
/** 连击礼物总价格,除以1000为RMB */
total_price: number
}
}

const parser = (data: any): GiftMsg => {
Expand Down Expand Up @@ -55,6 +64,13 @@ const parser = (data: any): GiftMsg => {
uname: rawData.send_master.uname,
room_id: rawData.send_master.room_id,
} : undefined,
// 礼物连击:
// data.combo_send 仅首次连击不为空;data.batch_combo_send 速度过快时可能为空;data.batch_combo_id 常驻存在
combo: rawData.batch_combo_id ? {
batch_id: rawData.batch_combo_id,
combo_num: rawData.super_batch_gift_num,
total_price: rawData.combo_total_coin,
} : undefined,
}
}

Expand Down

0 comments on commit a75a089

Please sign in to comment.