mirror of
https://github.com/jwdeveloper/TikTokLiveJava.git
synced 2026-02-27 08:49:40 -05:00
Add support for TikTokLinkMicBattleItemCard for battle/match power-ups
This commit is contained in:
@@ -0,0 +1,15 @@
|
|||||||
|
package io.github.jwdeveloper.tiktok.data.events;
|
||||||
|
|
||||||
|
import io.github.jwdeveloper.tiktok.annotations.*;
|
||||||
|
import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent;
|
||||||
|
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMicBattleItemCard;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@EventMeta(eventType = EventType.Message)
|
||||||
|
public class TikTokLinkMicBattleItemCard extends TikTokHeaderEvent {
|
||||||
|
|
||||||
|
public TikTokLinkMicBattleItemCard(WebcastLinkMicBattleItemCard msg) {
|
||||||
|
super(msg.getCommon());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
package io.github.jwdeveloper.tiktok.data.models.battles;
|
package io.github.jwdeveloper.tiktok.data.models.battles;
|
||||||
|
|
||||||
import io.github.jwdeveloper.tiktok.data.models.users.User;
|
import io.github.jwdeveloper.tiktok.data.models.users.User;
|
||||||
|
import io.github.jwdeveloper.tiktok.messages.data.BattleUserInfo;
|
||||||
import io.github.jwdeveloper.tiktok.messages.enums.BattleType;
|
import io.github.jwdeveloper.tiktok.messages.enums.BattleType;
|
||||||
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMicBattle;
|
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMicBattle;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -72,12 +73,12 @@ public class Team {
|
|||||||
this.hosts = List.copyOf(hosts);
|
this.hosts = List.copyOf(hosts);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Team(WebcastLinkMicBattle.BattleUserInfo anchorInfo) {
|
public Team(BattleUserInfo anchorInfo) {
|
||||||
this.hosts = List.of(new User(anchorInfo.getUser()));
|
this.hosts = List.of(new User(anchorInfo.getUser()));
|
||||||
this.teamId = hosts.get(0).getId();
|
this.teamId = hosts.get(0).getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Team(WebcastLinkMicBattle.BattleUserInfo anchorInfo, WebcastLinkMicBattle.BattleComboInfo battleCombo) {
|
public Team(BattleUserInfo anchorInfo, WebcastLinkMicBattle.BattleComboInfo battleCombo) {
|
||||||
this(anchorInfo);
|
this(anchorInfo);
|
||||||
this.winStreak = (int) battleCombo.getComboCount();
|
this.winStreak = (int) battleCombo.getComboCount();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ package io.github.jwdeveloper.tiktok.data.models.users;
|
|||||||
|
|
||||||
import io.github.jwdeveloper.tiktok.data.models.Picture;
|
import io.github.jwdeveloper.tiktok.data.models.Picture;
|
||||||
import io.github.jwdeveloper.tiktok.data.models.badges.Badge;
|
import io.github.jwdeveloper.tiktok.data.models.badges.Badge;
|
||||||
import io.github.jwdeveloper.tiktok.messages.data.BattleUserArmy;
|
import io.github.jwdeveloper.tiktok.messages.data.*;
|
||||||
import io.github.jwdeveloper.tiktok.messages.webcast.*;
|
import io.github.jwdeveloper.tiktok.messages.webcast.*;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ public class User {
|
|||||||
this(id, name, profileId, null, picture, 0, 0, List.of(Badge.empty()));
|
this(id, name, profileId, null, picture, 0, 0, List.of(Badge.empty()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public User(WebcastLinkMicBattle.BattleUserInfo.BattleBaseUserInfo host) {
|
public User(BattleUserInfo.BattleBaseUserInfo host) {
|
||||||
this(host.getUserId(), host.getDisplayId(), host.getNickName(), Picture.map(host.getAvatarThumb()));
|
this(host.getUserId(), host.getDisplayId(), host.getNickName(), Picture.map(host.getAvatarThumb()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2121,6 +2121,24 @@ message PublicAreaMessageCommon {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message BattleUserInfo {
|
||||||
|
BattleBaseUserInfo user = 1;
|
||||||
|
repeated BattleRivalTag tags = 2;
|
||||||
|
|
||||||
|
message BattleBaseUserInfo {
|
||||||
|
int64 user_id = 1;
|
||||||
|
string nick_name = 2;
|
||||||
|
Image avatar_thumb = 3;
|
||||||
|
string display_id = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message BattleRivalTag {
|
||||||
|
Image bg_image = 1;
|
||||||
|
Image icon_image = 2;
|
||||||
|
string content = 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
message GiftModeMeta {
|
message GiftModeMeta {
|
||||||
int64 gift_id = 1;
|
int64 gift_id = 1;
|
||||||
string gift_name_key = 2;
|
string gift_name_key = 2;
|
||||||
|
|||||||
@@ -821,3 +821,18 @@ enum BattleInviteType {
|
|||||||
BATTLE_INVITE_TYPE_NORMAL = 0;
|
BATTLE_INVITE_TYPE_NORMAL = 0;
|
||||||
BATTLE_INVITE_TYPE_AGAIN = 1;
|
BATTLE_INVITE_TYPE_AGAIN = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum BattleCardMsgType {
|
||||||
|
BATTLE_CARD_MSG_TYPE_UNKNOWN_CARD_ACTION = 0;
|
||||||
|
BATTLE_CARD_MSG_TYPE_CARD_OBTAIN_GUIDE = 1;
|
||||||
|
BATTLE_CARD_MSG_TYPE_USE_CRITICAL_STRIKE_CARD = 2;
|
||||||
|
BATTLE_CARD_MSG_TYPE_USE_SMOKE_CARD = 3;
|
||||||
|
BATTLE_CARD_MSG_TYPE_AWARD_CARD_NOTICE = 4;
|
||||||
|
BATTLE_CARD_MSG_TYPE_USE_EXTRA_TIME_CARD = 5;
|
||||||
|
BATTLE_CARD_MSG_TYPE_USE_SPECIAL_EFFECT_CARD = 6;
|
||||||
|
BATTLE_CARD_MSG_TYPE_USE_POTION_CARD = 7;
|
||||||
|
BATTLE_CARD_MSG_TYPE_USE_WAVE_CARD = 8;
|
||||||
|
BATTLE_CARD_MSG_TYPE_SPECIAL_EFFECT_NOTICE = 9;
|
||||||
|
BATTLE_CARD_MSG_TYPE_USE_TOP_2_CARD = 10;
|
||||||
|
BATTLE_CARD_MSG_TYPE_USE_TOP_3_CARD = 11;
|
||||||
|
}
|
||||||
@@ -1219,24 +1219,6 @@ message WebcastLinkMicBattle {
|
|||||||
// BattleUserInfo user_info = 2;
|
// BattleUserInfo user_info = 2;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
message BattleUserInfo {
|
|
||||||
BattleBaseUserInfo user = 1;
|
|
||||||
repeated BattleRivalTag tags = 2;
|
|
||||||
|
|
||||||
message BattleBaseUserInfo {
|
|
||||||
int64 user_id = 1;
|
|
||||||
string nick_name = 2;
|
|
||||||
Image avatar_thumb = 3;
|
|
||||||
string display_id = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
message BattleRivalTag {
|
|
||||||
Image bg_image = 1;
|
|
||||||
Image icon_image = 2;
|
|
||||||
string content = 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
message BattleABTestSetting {
|
message BattleABTestSetting {
|
||||||
int64 uid = 1;
|
int64 uid = 1;
|
||||||
BattleABTestList ab_test_list = 2;
|
BattleABTestList ab_test_list = 2;
|
||||||
@@ -1472,3 +1454,138 @@ message RoomVerifyMessage {
|
|||||||
int64 noticeType = 4;
|
int64 noticeType = 4;
|
||||||
bool closeRoom = 5;
|
bool closeRoom = 5;
|
||||||
}
|
}
|
||||||
|
message WebcastLinkMicBattleItemCard {
|
||||||
|
CommonMessageData common = 1;
|
||||||
|
int64 battle_id = 2;
|
||||||
|
BattleCardMsgType msg_type = 3;
|
||||||
|
CardObtainGuide card_obtain_guide = 4;
|
||||||
|
UseCriticalStrikeCard use_critical_strike_card = 5;
|
||||||
|
UseSmokeCard use_smoke_card = 6;
|
||||||
|
AwardCardNotice award_card_notice = 7;
|
||||||
|
UseExtraTimeCard use_extra_time_card = 8;
|
||||||
|
UseSpecialEffectCard use_special_effect_card = 9;
|
||||||
|
UsePotionCard use_potion_card = 10;
|
||||||
|
UseWaveCard use_wave_card = 11;
|
||||||
|
SpecialEffectNotice special_effect_notice = 12;
|
||||||
|
UseTop2Card use_top2_card = 13;
|
||||||
|
UseTop3Card use_top3_card = 14;
|
||||||
|
|
||||||
|
message CardObtainGuide {
|
||||||
|
int32 not_in_use = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UseCriticalStrikeCard {
|
||||||
|
CriticalStrikeCardInfo card_info = 1;
|
||||||
|
int64 anchor_id = 2;
|
||||||
|
Text display_content = 3;
|
||||||
|
|
||||||
|
message CriticalStrikeCardInfo {
|
||||||
|
string card_name_key = 1;
|
||||||
|
Image card_image = 2;
|
||||||
|
int64 send_time_sec = 3;
|
||||||
|
BattleUserInfo send_user = 4;
|
||||||
|
int64 effect_last_duration = 5;
|
||||||
|
int64 critical_strike_rate_low = 6;
|
||||||
|
int64 critical_strike_rate_high = 7;
|
||||||
|
int64 multiple = 8;
|
||||||
|
string gift_name_key = 9;
|
||||||
|
string rule_url = 10;
|
||||||
|
int64 effect_time_sec = 11;
|
||||||
|
int64 to_anchor_id = 12;
|
||||||
|
string to_anchor_id_str = 13;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message UseSmokeCard {
|
||||||
|
CommonCardInfo card_info = 1;
|
||||||
|
int64 anchor_id = 2;
|
||||||
|
Text display_content = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AwardCardNotice {
|
||||||
|
Text display_content = 1;
|
||||||
|
repeated BattleUserInfo awarded_users = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UseExtraTimeCard {
|
||||||
|
ExtraTimeCardInfo card_info = 1;
|
||||||
|
int64 anchor_id = 2;
|
||||||
|
Text display_content = 3;
|
||||||
|
|
||||||
|
message ExtraTimeCardInfo {
|
||||||
|
string card_name_key = 1;
|
||||||
|
Image card_image = 2;
|
||||||
|
int64 send_time_sec = 3;
|
||||||
|
BattleUserInfo send_user = 4;
|
||||||
|
int64 effect_last_duration = 5;
|
||||||
|
string rule_url = 6;
|
||||||
|
int64 effect_time_sec = 7;
|
||||||
|
int64 to_anchor_id = 8;
|
||||||
|
int64 extra_duration_sec = 9;
|
||||||
|
string to_anchor_id_str = 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message UseSpecialEffectCard {
|
||||||
|
CommonCardInfo card_info = 1;
|
||||||
|
int64 anchor_id = 2;
|
||||||
|
Text display_content = 3;
|
||||||
|
repeated AnchorPair affected_anchor_pairs = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AnchorPair {
|
||||||
|
int64 source_anchor_id = 1;
|
||||||
|
int64 target_anchor_id = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UsePotionCard {
|
||||||
|
CommonCardInfo card_info = 1;
|
||||||
|
int64 anchor_id = 2;
|
||||||
|
Text display_content = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UseWaveCard {
|
||||||
|
CommonCardInfo card_info = 1;
|
||||||
|
int64 anchor_id = 2;
|
||||||
|
Text display_content = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CommonCardInfo {
|
||||||
|
string card_name_key = 1;
|
||||||
|
Image card_image = 2;
|
||||||
|
int64 send_time_sec = 3;
|
||||||
|
BattleUserInfo send_user = 4;
|
||||||
|
int64 effect_last_duration = 5;
|
||||||
|
string rule_url = 6;
|
||||||
|
int64 effect_time_sec = 7;
|
||||||
|
int64 to_anchor_id = 8;
|
||||||
|
string to_anchor_id_str = 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SpecialEffectNotice {
|
||||||
|
int64 score = 1;
|
||||||
|
int64 from_user_id = 2;
|
||||||
|
int64 to_anchor_id = 3;
|
||||||
|
repeated AnchorPair affected_anchor_pairs = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UseTop2Card {
|
||||||
|
Top2CardInfo card_info = 1;
|
||||||
|
int64 anchor_id = 2;
|
||||||
|
Text display_content = 3;
|
||||||
|
|
||||||
|
message Top2CardInfo {
|
||||||
|
CommonCardInfo common = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message UseTop3Card {
|
||||||
|
Top3CardInfo card_info = 1;
|
||||||
|
int64 anchor_id = 2;
|
||||||
|
Text display_content = 3;
|
||||||
|
|
||||||
|
message Top3CardInfo {
|
||||||
|
CommonCardInfo common = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -104,7 +104,7 @@ public class MessagesMapperFactory {
|
|||||||
var message = mapperHelper.bytesToWebcastObject(inputBytes, WebcastLinkMicArmies.class);
|
var message = mapperHelper.bytesToWebcastObject(inputBytes, WebcastLinkMicArmies.class);
|
||||||
return MappingResult.of(message, new TikTokLinkMicArmiesEvent(message));
|
return MappingResult.of(message, new TikTokLinkMicArmiesEvent(message));
|
||||||
});
|
});
|
||||||
mapper.forMessage(WebcastLinkMessage.class, ((inputBytes, messageName, mapperHelper) -> {
|
mapper.forMessage(WebcastLinkMessage.class, (inputBytes, messageName, mapperHelper) -> {
|
||||||
var message = mapperHelper.bytesToWebcastObject(inputBytes, WebcastLinkMessage.class);
|
var message = mapperHelper.bytesToWebcastObject(inputBytes, WebcastLinkMessage.class);
|
||||||
return MappingResult.of(message, switch (message.getMessageType()) {
|
return MappingResult.of(message, switch (message.getMessageType()) {
|
||||||
case TYPE_LINKER_INVITE -> new TikTokLinkInviteEvent(message);
|
case TYPE_LINKER_INVITE -> new TikTokLinkInviteEvent(message);
|
||||||
@@ -116,8 +116,7 @@ public class MessagesMapperFactory {
|
|||||||
case TYPE_LINKER_KICK_OUT -> new TikTokLinkKickOutEvent(message);
|
case TYPE_LINKER_KICK_OUT -> new TikTokLinkKickOutEvent(message);
|
||||||
case TYPE_LINKER_LINKED_LIST_CHANGE -> new TikTokLinkLinkedListChangeEvent(message);
|
case TYPE_LINKER_LINKED_LIST_CHANGE -> new TikTokLinkLinkedListChangeEvent(message);
|
||||||
case TYPE_LINKER_UPDATE_USER -> new TikTokLinkUpdateUserEvent(message);
|
case TYPE_LINKER_UPDATE_USER -> new TikTokLinkUpdateUserEvent(message);
|
||||||
case TYPE_LINKER_WAITING_LIST_CHANGE, TYPE_LINKER_WAITING_LIST_CHANGE_V2 ->
|
case TYPE_LINKER_WAITING_LIST_CHANGE, TYPE_LINKER_WAITING_LIST_CHANGE_V2 -> new TikTokLinkWaitListChangeEvent(message);
|
||||||
new TikTokLinkWaitListChangeEvent(message);
|
|
||||||
case TYPE_LINKER_MUTE -> new TikTokLinkMuteEvent(message);
|
case TYPE_LINKER_MUTE -> new TikTokLinkMuteEvent(message);
|
||||||
case TYPE_LINKER_MATCH -> new TikTokLinkRandomMatchEvent(message);
|
case TYPE_LINKER_MATCH -> new TikTokLinkRandomMatchEvent(message);
|
||||||
case TYPE_LINKER_UPDATE_USER_SETTING -> new TikTokLinkUpdateUserSettingEvent(message);
|
case TYPE_LINKER_UPDATE_USER_SETTING -> new TikTokLinkUpdateUserSettingEvent(message);
|
||||||
@@ -130,7 +129,11 @@ public class MessagesMapperFactory {
|
|||||||
case TYPE_LINKMIC_USER_TOAST -> new TikTokLinkUserToastEvent(message);
|
case TYPE_LINKMIC_USER_TOAST -> new TikTokLinkUserToastEvent(message);
|
||||||
default -> new TikTokLinkEvent(message);
|
default -> new TikTokLinkEvent(message);
|
||||||
});
|
});
|
||||||
}));
|
});
|
||||||
|
mapper.forMessage(WebcastLinkMicBattleItemCard.class, (inputBytes, messageName, mapperHelper) -> {
|
||||||
|
var message = mapperHelper.bytesToWebcastObject(inputBytes, WebcastLinkMicBattleItemCard.class);
|
||||||
|
return MappingResult.of(message, new TikTokLinkMicBattleItemCard(message));
|
||||||
|
});
|
||||||
// mapper.webcastObjectToConstructor(WebcastLinkMicMethod.class, TikTokLinkMicMethodEvent.class);
|
// mapper.webcastObjectToConstructor(WebcastLinkMicMethod.class, TikTokLinkMicMethodEvent.class);
|
||||||
// mapper.webcastObjectToConstructor(WebcastLinkMicFanTicketMethod.class, TikTokLinkMicFanTicketEvent.class);
|
// mapper.webcastObjectToConstructor(WebcastLinkMicFanTicketMethod.class, TikTokLinkMicFanTicketEvent.class);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user