Compare commits

..

10 commits

Author SHA1 Message Date
YYHEggEgg
3043d45ac9 implement free agent & choosing UP 2024-08-04 19:00:34 +08:00
YYHEggEgg
05e8ef740d Make Gacha interact with Item & Role Model 2024-08-01 14:15:28 +08:00
YYHEggEgg
950a3725ea command: player kick [uid] [reason] 2024-08-01 14:15:28 +08:00
YYHEggEgg
157832198c Gacha Model bugfix: post_configure on creating 2024-08-01 14:15:27 +08:00
YYHEggEgg
55780314d1 Gacha impl 2024-08-01 14:15:26 +08:00
YYHEggEgg
db2677be50 Proto (Gacha related) 2024-08-01 14:15:26 +08:00
YYHEggEgg
a7a1f4da37 Implement static config gacha needed 2024-08-01 14:15:25 +08:00
220fbc42f0 Implement bangboo for battles (works in archive quests) 2024-08-01 02:43:13 +03:00
7d7bd76ae8 Implement MainCityBgmConfigTemplate 2024-08-01 01:38:05 +03:00
26fe9551d4 MainCity BGM 2024-07-31 14:08:06 +03:00
18 changed files with 2251 additions and 130 deletions

View file

@ -0,0 +1,32 @@
[
{
"ID": 0,
"PlayEventName": "Play_BGM_Maincity",
"StateName": "Normal"
},
{
"ID": 1001,
"PlayEventName": "Play_BGM_Maincity",
"StateName": "Hack_Maincity"
},
{
"ID": 1002,
"PlayEventName": "Play_BGM_Maincity",
"StateName": "WorkShop_OnMission"
},
{
"ID": 1003,
"PlayEventName": "Play_BGM_Maincity",
"StateName": "SummerActivity_Ready"
},
{
"ID": 1004,
"PlayEventName": "Play_BGM_Maincity",
"StateName": "SummerActivity_Start"
},
{
"ID": 1005,
"PlayEventName": "Play_BGM_Maincity",
"StateName": "Mission_Accomplish"
}
]

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,8 @@
use std::collections::{HashMap, HashSet};
use chrono::{prelude::Local, DateTime};
use serde::Deserialize;
use proto::GachaAddedItemType;
use serde::{Deserialize, Deserializer};
use tracing;
#[derive(Debug, Default, Deserialize)]
@ -125,11 +126,21 @@ pub struct MustGainItem {
pub category_tag: String,
}
#[derive(Debug, Default, Deserialize)]
pub struct FreeSelectItem {
pub milestones: Vec<u32>,
pub rarity: u32,
pub category_tags: Vec<String>,
pub free_select_progress_record_tag: String,
pub free_select_usage_record_tag: String,
}
#[derive(Debug, Default, Deserialize)]
pub struct DiscountPolicyCollection {
pub ten_pull_discount_map: HashMap<String, TenPullDiscount>,
pub must_gain_item_map: HashMap<String, MustGainItem>,
pub advanced_guarantee_map: HashMap<String, AdvancedGuarantee>,
pub free_select_map: HashMap<String, FreeSelectItem>,
}
impl DiscountPolicyCollection {
@ -147,6 +158,21 @@ pub struct GachaCategoryInfo {
pub is_promotional_items: bool,
pub item_ids: Vec<u32>,
pub category_weight: u32,
#[serde(default, deserialize_with = "from_str")]
pub item_type: GachaAddedItemType,
}
pub fn from_str<'de, D>(deserializer: D) -> Result<GachaAddedItemType, D::Error>
where
D: Deserializer<'de>,
{
let s: String = Deserialize::deserialize(deserializer)?;
let result = GachaAddedItemType::from_str_name(&s);
match result {
Some(val) => Ok(val),
None => Ok(GachaAddedItemType::None)
}
}
#[derive(Debug, Default, Deserialize)]

View file

@ -0,0 +1,12 @@
use serde::Deserialize;
template_id!(MainCityBgmConfig u32 id);
#[derive(Deserialize, Debug)]
#[serde(rename_all = "PascalCase")]
pub struct MainCityBgmConfigTemplate {
#[serde(rename = "ID")]
pub id: MainCityBgmConfigID,
pub play_event_name: String,
pub state_name: String,
}

View file

@ -84,6 +84,7 @@ template_tables! {
WeaponTemplate;
MainCityObjectTemplate;
MainCityDefaultObjectTemplate;
MainCityBgmConfigTemplate;
ArchiveFileQuestTemplate;
ArchiveBattleQuestTemplate;
}

View file

@ -138,12 +138,13 @@ pub async fn kick(
}
let uid = args[0].parse::<u32>()?;
let default_reason = DisconnectReason::ServerKick.into();
let reason = match args.get(1) {
Some(arg) => match arg.parse::<i32>() {
Ok(val) => val,
Err(_err) => 1,
Err(_err) => default_reason,
},
None => 1,
None => default_reason,
};
let reason_str = match DisconnectReason::try_from(reason) {
Ok(converted_enum) => converted_enum.as_str_name().to_owned(),

View file

@ -1,8 +1,19 @@
use data::gacha::{gacha_config::*, global_gacha_config};
use std::{
cmp::min,
collections::{
hash_map::Entry::{Occupied, Vacant},
HashSet,
},
};
use data::{
gacha::{gacha_config::*, global_gacha_config},
tables::{AvatarBaseID, WeaponID},
};
use proto::*;
use super::*;
use chrono::{DateTime, Local};
use proto::*;
pub async fn on_get_gacha_data(
_session: &NetSession,
@ -21,7 +32,7 @@ pub async fn on_get_gacha_data(
Ok(GetGachaDataScRsp {
retcode: Retcode::RetSucc.into(),
gacha_type: req.gacha_type,
gacha_data: Some(generate_all_gacha_info(_player)),
gacha_data: Some(generate_all_gacha_info(_player, &Local::now())),
})
}
}
@ -33,6 +44,8 @@ pub async fn on_do_gacha(
) -> NetResult<DoGachaScRsp> {
let gachaconf = global_gacha_config();
let gacha_model = &mut _player.gacha_model;
let item_model = &mut _player.item_model;
let role_model = &mut _player.role_model;
let pull_time = Local::now();
let target_pool = get_gacha_pool(
&gachaconf.character_gacha_pool_list,
@ -40,16 +53,20 @@ pub async fn on_do_gacha(
&pull_time,
);
if let None = target_pool {
tracing::info!(
"refuse gacha because: pool of parent_schedule_id {} not found",
req.gacha_parent_schedule_id
);
return Ok(DoGachaScRsp {
retcode: Retcode::RetSucc.into(),
retcode: Retcode::RetFail.into(),
..Default::default()
});
};
let target_pool = target_pool.unwrap();
// TODO: Validate cost_item_count
// tracing::info!("cost_item_count: {}", body.cost_item_count);
// tracing::info!("cost_item_count: {}", req.cost_item_count);
let mut pull_count = if req.cost_item_count > 1 { 10 } else { 1 };
let mut cost_count = pull_count;
if pull_count == 10 {
let discount_tag = &gachaconf.common_properties.ten_pull_discount_tag;
@ -67,32 +84,291 @@ pub async fn on_do_gacha(
let usage = status_bin.discount_usage_map.get_mut(discount_tag).unwrap();
if *usage < discount_policy.use_limit {
*usage += 1;
// cost_count = discount_policy.discounted_prize;
}
}
}
if cost_count != req.cost_item_count {
tracing::info!(
"refuse gacha because: expected cost item {cost_count}, found {}",
req.cost_item_count
);
return Ok(DoGachaScRsp {
retcode: Retcode::RetFail.into(),
..Default::default()
});
} else {
// TODO: cost resource
}
let mut gain_item_list: Vec<GainItemInfo> = vec![];
while pull_count > 0 {
let pull_result = gacha_model.perform_pull_pool(&pull_time, target_pool);
let extra_item_bin = pull_result.extra_item_bin.unwrap();
let extra_item_bin = pull_result.extra_item_bin.clone().unwrap();
let uid = match GachaAddedItemType::try_from(pull_result.item_type) {
Ok(enum_val) => match enum_val {
GachaAddedItemType::Weapon => match WeaponID::new(pull_result.obtained_item_id) {
Some(id) => item_model.add_weapon(id).value(),
None => 0,
},
GachaAddedItemType::Character => {
match AvatarBaseID::new(pull_result.obtained_item_id) {
Some(id) => {
role_model.add_avatar(id);
0
}
None => 0,
}
}
_ => 0,
},
Err(_err) => 0,
};
if extra_item_bin.extra_item_id != 0 {
item_model.add_resource(
extra_item_bin.extra_item_id,
extra_item_bin.extra_item_count,
);
}
gain_item_list.push(GainItemInfo {
item_id: pull_result.obtained_item_id,
extra_item_id: extra_item_bin.extra_item_id,
extra_item_count: extra_item_bin.extra_item_count,
uid,
num: 1,
..GainItemInfo::default()
});
pull_count -= 1;
gacha_model.gacha_bin.gacha_records.push(pull_result);
}
Ok(DoGachaScRsp {
retcode: Retcode::RetSucc.into(),
gain_item_list,
gacha_data: Some(generate_all_gacha_info(_player)),
gacha_data: Some(generate_all_gacha_info(_player, &pull_time)),
cost_item_count: req.cost_item_count,
})
}
pub async fn on_gacha_free_agent(
_session: &NetSession,
_player: &mut Player,
req: GachaFreeAgentCsReq,
) -> NetResult<GachaFreeAgentScRsp> {
let gachaconf = global_gacha_config();
let gacha_model = &mut _player.gacha_model;
let role_model = &mut _player.role_model;
let pull_time = Local::now();
let target_pool = get_gacha_pool(
&gachaconf.character_gacha_pool_list,
&req.gacha_parent_schedule_id,
&pull_time,
);
if let None = target_pool {
tracing::info!(
"refuse free agent because: pool of parent_schedule_id {} not found",
req.gacha_parent_schedule_id
);
return Ok(GachaFreeAgentScRsp {
retcode: Retcode::RetFail.into(),
..Default::default()
});
};
let target_pool = target_pool.unwrap();
let gacha_bin = &mut _player.gacha_model.gacha_bin;
let sharing_guarantee_category_tag = &target_pool.sharing_guarantee_info_category;
let status_bin = gacha_bin
.gacha_status_map
.get_mut(sharing_guarantee_category_tag)
.unwrap();
let mut free_select_policy: Option<&FreeSelectItem> = None;
let mut free_select_progress: u32 = 0;
let mut free_select_required_pull: u32 = 0;
for discount_policy_tag in target_pool.discount_policy_tags.iter() {
if gachaconf
.discount_policies
.free_select_map
.contains_key(discount_policy_tag)
{
let policy = gachaconf
.discount_policies
.free_select_map
.get(discount_policy_tag)
.unwrap();
let free_select_demand_idx = usize::try_from(
*(status_bin
.discount_usage_map
.get(&policy.free_select_usage_record_tag)
.unwrap()),
)
.unwrap();
if policy.milestones.len() <= free_select_demand_idx {
continue;
}
let free_select_actual_progress = status_bin
.discount_usage_map
.get(&policy.free_select_progress_record_tag)
.unwrap();
free_select_policy = Some(policy);
free_select_required_pull = policy
.milestones
.get(free_select_demand_idx)
.unwrap()
.to_owned();
free_select_progress = min(free_select_required_pull, *free_select_actual_progress);
}
}
if let None = free_select_policy {
tracing::info!(
"refuse free agent because: pool of parent_schedule_id {} hasn't defined free agent discount yet (or used up chance)",
req.gacha_parent_schedule_id
);
return Ok(GachaFreeAgentScRsp {
retcode: Retcode::RetFail.into(),
..Default::default()
});
} else if free_select_progress < free_select_required_pull {
tracing::info!(
"refuse free agent because: use pulled {free_select_progress} (after last free agent) in parent_schedule_id {}, required {free_select_required_pull}",
req.gacha_parent_schedule_id
);
return Ok(GachaFreeAgentScRsp {
retcode: Retcode::RetFail.into(),
..Default::default()
});
}
let free_select_policy = free_select_policy.unwrap();
let mut has_demanded_item = false;
for rarity_items in target_pool.gacha_items.iter() {
if rarity_items.rarity != free_select_policy.rarity {
continue;
}
for (category_tag, category) in rarity_items.categories.iter() {
if !free_select_policy.category_tags.contains(category_tag) {
continue;
}
has_demanded_item |= category.item_ids.contains(&req.avatar_id);
}
}
if !has_demanded_item {
tracing::info!(
"refuse free agent because: pool of parent_schedule_id {} doesn't have demanded item {}",
req.gacha_parent_schedule_id, req.avatar_id
);
return Ok(GachaFreeAgentScRsp {
retcode: Retcode::RetFail.into(),
..Default::default()
});
}
role_model.add_avatar(AvatarBaseID::new(req.avatar_id).unwrap());
(*status_bin
.discount_usage_map
.get_mut(&free_select_policy.free_select_usage_record_tag)
.unwrap()) += 1;
(*status_bin
.discount_usage_map
.get_mut(&free_select_policy.free_select_progress_record_tag)
.unwrap()) -= free_select_required_pull;
Ok(GachaFreeAgentScRsp {
retcode: Retcode::RetSucc.into(),
})
}
pub async fn on_choose_gacha_up(
_session: &NetSession,
_player: &mut Player,
req: ChooseGachaUpCsReq,
) -> NetResult<ChooseGachaUpScRsp> {
let gachaconf = global_gacha_config();
let gacha_model = &mut _player.gacha_model;
let pull_time = Local::now();
let target_pool = get_gacha_pool(
&gachaconf.character_gacha_pool_list,
&req.gacha_parent_schedule_id,
&pull_time,
);
if let None = target_pool {
return Ok(ChooseGachaUpScRsp {
retcode: Retcode::RetFail.into(),
..Default::default()
});
};
let target_pool = target_pool.unwrap();
for rarity_items in target_pool.gacha_items.iter() {
if rarity_items.rarity != gachaconf.common_properties.s_item_rarity {
continue;
}
for guarantee_policy_tag in rarity_items.category_guarantee_policy_tags.iter() {
let category_guarantee_policy = gachaconf
.category_guarantee_policy_map
.get(guarantee_policy_tag)
.unwrap();
if !category_guarantee_policy.chooseable {
continue;
}
let mut up_category: Option<&String> = None;
for (category_tag, category) in rarity_items.categories.iter() {
if category.item_ids.contains(&req.item_id) {
up_category = Some(category_tag);
break;
}
}
if let None = up_category {
return Ok(ChooseGachaUpScRsp {
retcode: Retcode::RetFail.into(),
..Default::default()
});
};
let up_category = up_category.unwrap();
let progress_bin = gacha_model
.gacha_bin
.gacha_status_map
.get_mut(&target_pool.sharing_guarantee_info_category)
.unwrap()
.rarity_status_map
.get_mut(&rarity_items.rarity)
.unwrap();
match progress_bin
.categories_chosen_guarantee_item_map
.entry(guarantee_policy_tag.clone())
{
Occupied(mut occupied_entry) => {
occupied_entry.insert(req.item_id);
}
Vacant(vacant_entry) => {
vacant_entry.insert(req.item_id);
}
};
match progress_bin
.categories_chosen_guarantee_category_map
.entry(up_category.clone())
{
Occupied(mut occupied_entry) => {
occupied_entry.insert(up_category.clone());
}
Vacant(vacant_entry) => {
vacant_entry.insert(up_category.clone());
}
};
return Ok(ChooseGachaUpScRsp {
retcode: Retcode::RetSucc.into(),
..Default::default()
});
}
}
Ok(ChooseGachaUpScRsp {
retcode: Retcode::RetFail.into(),
..Default::default()
})
}
fn generate_gacha_info_from_pool(
gacha_bin: &GachaModelBin,
target_pool: &CharacterGachaPool,
@ -114,34 +390,13 @@ fn generate_gacha_info_from_pool(
.get(&common_properties.a_item_rarity)
.unwrap()
.pity;
let mut up_s_item_list: Vec<u32> = vec![];
let mut up_a_item_list: Vec<u32> = vec![];
let mut s_guarantee: u32 = 0;
let mut a_guarantee: u32 = 0;
for rarity_items in target_pool.gacha_items.iter() {
for category in rarity_items.categories.values() {
let probability_model = gachaconf
.probability_model_map
.get(&rarity_items.probability_model_tag)
.unwrap();
if rarity_items.rarity == common_properties.s_item_rarity {
if category.is_promotional_items {
up_s_item_list = category.item_ids.clone();
}
s_guarantee = probability_model.maximum_guarantee_pity - pity_s + 1;
}
if rarity_items.rarity == common_properties.a_item_rarity {
if category.is_promotional_items {
up_a_item_list = category.item_ids.clone();
}
a_guarantee = probability_model.maximum_guarantee_pity - pity_a + 1;
}
}
}
let mut discount_ten_roll_prize: u32 = 0;
let mut discount_avaliable_num: u32 = 0;
let mut advanced_s_guarantee: u32 = 0;
let mut free_select_progress: u32 = 0;
let mut free_select_required_pull: u32 = 0;
let mut free_select_policy: Option<&FreeSelectItem> = None;
for discount_policy_tag in target_pool.discount_policy_tags.iter() {
if common_properties.newcomer_advanced_s_tag == *discount_policy_tag {
let policy = gachaconf
@ -171,6 +426,123 @@ fn generate_gacha_info_from_pool(
discount_ten_roll_prize = policy.discounted_prize;
discount_avaliable_num = policy.use_limit - discount_usage;
}
} else if gachaconf
.discount_policies
.free_select_map
.contains_key(discount_policy_tag)
{
let policy = gachaconf
.discount_policies
.free_select_map
.get(discount_policy_tag)
.unwrap();
let free_select_demand_idx = usize::try_from(
*(status_bin
.discount_usage_map
.get(&policy.free_select_usage_record_tag)
.unwrap()),
)
.unwrap();
if policy.milestones.len() <= free_select_demand_idx {
continue;
}
let free_select_actual_progress = status_bin
.discount_usage_map
.get(&policy.free_select_progress_record_tag)
.unwrap();
free_select_policy = Some(policy);
free_select_required_pull = policy
.milestones
.get(free_select_demand_idx)
.unwrap()
.to_owned();
free_select_progress = min(free_select_required_pull, *free_select_actual_progress);
}
}
let mut up_s_item_list: Vec<u32> = vec![];
let mut up_a_item_list: Vec<u32> = vec![];
let mut free_select_item_list: Vec<u32> = vec![];
let mut chooseable_up_list: Vec<u32> = vec![];
let mut chosen_up_item: u32 = 0;
let mut s_guarantee: u32 = 0;
let mut a_guarantee: u32 = 0;
for rarity_items in target_pool.gacha_items.iter() {
let mut chooseable_up_included_category_tags: Option<&HashSet<String>> = None;
let mut chooseable_policy_tag: Option<&String> = None;
for guarantee_policy_tag in rarity_items.category_guarantee_policy_tags.iter() {
let category_guarantee_policy = gachaconf
.category_guarantee_policy_map
.get(guarantee_policy_tag)
.unwrap();
if !category_guarantee_policy.chooseable {
continue;
}
chooseable_policy_tag = Some(guarantee_policy_tag);
chooseable_up_included_category_tags =
Some(&category_guarantee_policy.included_category_tags);
if let Some(item) = status_bin
.rarity_status_map
.get(&rarity_items.rarity)
.unwrap()
.categories_chosen_guarantee_item_map
.get(guarantee_policy_tag)
{
chosen_up_item = item.clone();
}
}
for (category_tag, category) in rarity_items.categories.iter() {
let probability_model = gachaconf
.probability_model_map
.get(&rarity_items.probability_model_tag)
.unwrap();
let maximum_pity = &probability_model.maximum_guarantee_pity;
if rarity_items.rarity == common_properties.s_item_rarity {
if category.is_promotional_items {
up_s_item_list = category.item_ids.clone();
}
// tracing::info!("pity_s: {pity_s}");
// thread 'tokio-runtime-worker' panicked at nap_gameserver\src\handlers\gacha.rs:369:31:
// attempt to subtract with overflow
s_guarantee = maximum_pity - min(pity_s, maximum_pity.clone()) + 1;
}
if rarity_items.rarity == common_properties.a_item_rarity {
if category.is_promotional_items {
up_a_item_list = category.item_ids.clone();
}
// tracing::info!("pity_a: {pity_a}");
a_guarantee = maximum_pity - min(pity_a, maximum_pity.clone()) + 1;
}
if let Some(val) = free_select_policy {
if val.rarity == rarity_items.rarity && val.category_tags.contains(category_tag) {
free_select_item_list.append(&mut category.item_ids.clone());
}
}
if let Some(tags) = chooseable_up_included_category_tags {
if tags.contains(category_tag) {
chooseable_up_list.append(&mut category.item_ids.clone());
}
}
}
if let Some(priority_policy_tag) = chooseable_policy_tag {
// if let Some(item) = status_bin
// .rarity_status_map
// .get(&rarity_items.rarity)
// .unwrap()
// .categories_chosen_guarantee_item_map
// .get(priority_policy_tag)
// {
if rarity_items.rarity == gachaconf.common_properties.s_item_rarity {
up_s_item_list = vec![];
} else if rarity_items.rarity == gachaconf.common_properties.a_item_rarity {
up_a_item_list = vec![];
}
// }
}
}
@ -179,7 +551,7 @@ fn generate_gacha_info_from_pool(
need_item_count: 1,
}];
Gacha {
let mut result = Gacha {
gacha_schedule_id: target_pool.gacha_schedule_id,
gacha_parent_schedule_id: target_pool.gacha_parent_schedule_id,
gacha_type: target_pool.gacha_type,
@ -187,32 +559,46 @@ fn generate_gacha_info_from_pool(
end_timestamp: target_pool.end_time.timestamp(),
discount_avaliable_num,
discount_ten_roll_prize,
up_s_item_list,
up_a_item_list,
advanced_s_guarantee,
s_guarantee,
a_guarantee,
need_item_info_list,
// iehkehofjop: target_pool.gacha_parent_schedule_id,
// eggcehlgkii: 223,
// ijoahiepmfo: 101,
free_select_progress,
free_select_required_pull,
free_select_item_list,
chosen_up_item,
// nammdglepbk: 563,
// hgmcofcjmbg: 101,
// akggbhgkifd: chooseable_up_list.clone(),
chooseable_up_list,
..Gacha::default()
};
if up_s_item_list.len() > 0 {
result.up_s_item_list = up_s_item_list;
}
if up_a_item_list.len() > 0 {
result.up_a_item_list = up_a_item_list;
}
result
}
fn generate_all_gacha_info(_player: &Player) -> GachaData {
fn generate_all_gacha_info(_player: &Player, now: &DateTime<Local>) -> GachaData {
let gachaconf = global_gacha_config();
let gacha_bin = &_player.gacha_model.gacha_bin;
let mut gacha_list: Vec<Gacha> = vec![];
for target_pool in gachaconf.character_gacha_pool_list.iter() {
gacha_list.push(generate_gacha_info_from_pool(
&gacha_bin,
target_pool,
&gachaconf.common_properties,
));
if target_pool.is_still_open(now) {
gacha_list.push(generate_gacha_info_from_pool(
&gacha_bin,
target_pool,
&gachaconf.common_properties,
));
}
}
// tracing::info!("gacha_list: {:?}", gacha_list);
GachaData {
random_number: 0,
random_number: 6167,
gacha_pool: Some(GachaPool { gacha_list }),
..GachaData::default()
}

View file

@ -120,6 +120,8 @@ req_handlers! {
quest::BeginArchiveBattleQuest;
quest::FinishArchiveQuest;
gacha::DoGacha;
gacha::ChooseGachaUp;
gacha::GachaFreeAgent;
}
notify_handlers! {

View file

@ -85,8 +85,13 @@ pub async fn on_begin_archive_battle_quest(
let quest_id = ArchiveBattleQuestID::new(req.quest_id).ok_or(Retcode::RetFail)?;
player.game_instance = GameInstance::Hollow(
HollowGame::create_archive_battle(quest_id, ELocalPlayType::ArchiveBattle, &req.avatars)
.map_err(LogicError::from)?,
HollowGame::create_archive_battle(
quest_id,
ELocalPlayType::ArchiveBattle,
&req.avatars,
req.buddy_id,
)
.map_err(LogicError::from)?,
);
let world_init_notify = player.game_instance.create_world_init_notify()?;

View file

@ -0,0 +1,25 @@
use std::collections::HashMap;
use proto::EquippedBuddyData;
use crate::logic::{BaseProperty, BuddyTeamType};
pub struct EquippedBuddyDataItem {
pub buddy_id: u32,
pub buddy_team: BuddyTeamType,
pub override_property_map: HashMap<BaseProperty, i32>,
}
impl EquippedBuddyDataItem {
pub fn to_client(&self) -> EquippedBuddyData {
EquippedBuddyData {
buddy_id: self.buddy_id,
r#type: self.buddy_team.to_protocol().into(),
mp_property_override_map: self
.override_property_map
.iter()
.map(|(prop, value)| (*prop as u32, *value))
.collect(),
}
}
}

View file

@ -1,4 +1,7 @@
mod avatar;
pub use avatar::InLevelAvatarDataItem;
mod buddy;
mod team;
pub use avatar::InLevelAvatarDataItem;
pub use buddy::EquippedBuddyDataItem;
pub use team::TeamDataItem;

View file

@ -1,13 +1,16 @@
use std::collections::HashMap;
use super::InLevelAvatarDataItem;
use crate::logic::BuddyTeamType;
use super::{EquippedBuddyDataItem, InLevelAvatarDataItem};
pub struct TeamDataItem {
pub avatar_member_list: Vec<InLevelAvatarDataItem>,
pub equipped_buddy_list: Vec<EquippedBuddyDataItem>,
}
impl TeamDataItem {
pub fn new(avatars: &[u32]) -> Self {
pub fn new(avatars: &[u32], buddy_id: u32) -> Self {
Self {
avatar_member_list: avatars
.iter()
@ -16,6 +19,13 @@ impl TeamDataItem {
mp_property_override: HashMap::new(),
})
.collect(),
equipped_buddy_list: (buddy_id != 0)
.then_some(vec![EquippedBuddyDataItem {
buddy_id,
buddy_team: BuddyTeamType::Assisting,
override_property_map: HashMap::new(),
}])
.unwrap_or_default(),
}
}
}

View file

@ -259,3 +259,22 @@ pub enum BaseProperty {
Luck = 5,
AllDamageResist = 43,
}
#[allow(dead_code)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(i32)]
pub enum BuddyTeamType {
Unknown = 0,
Fighting = 1,
Assisting = 2,
}
impl BuddyTeamType {
pub fn to_protocol(&self) -> ::proto::BuddyTeamType {
match *self {
Self::Unknown => ::proto::BuddyTeamType::Unknown,
Self::Fighting => ::proto::BuddyTeamType::Fighting,
Self::Assisting => ::proto::BuddyTeamType::Assisting,
}
}
}

View file

@ -52,10 +52,42 @@ impl GachaModel {
&mut progress_bin.categories_progress_map,
&category_guarantee_policy_tag,
);
let guarantee_policy = gachaconf
.category_guarantee_policy_map
.get(category_guarantee_policy_tag)
.unwrap();
if !guarantee_policy.chooseable {
continue;
}
get_or_add(
&mut progress_bin.categories_chosen_guarantee_progress_map,
&category_guarantee_policy_tag,
);
}
}
for discount_policy_tag in gacha_pool.discount_policy_tags.iter() {
get_or_add(&mut status_bin.discount_usage_map, &discount_policy_tag);
if gachaconf
.discount_policies
.free_select_map
.contains_key(discount_policy_tag)
{
let policy = gachaconf
.discount_policies
.free_select_map
.get(discount_policy_tag)
.unwrap();
get_or_add(
&mut status_bin.discount_usage_map,
&policy.free_select_progress_record_tag,
);
get_or_add(
&mut status_bin.discount_usage_map,
&policy.free_select_usage_record_tag,
);
} else {
get_or_add(&mut status_bin.discount_usage_map, &discount_policy_tag);
}
}
}
self
@ -70,8 +102,14 @@ impl GachaModel {
let (rarity_items, progress_bin, status_bin, probability_model) =
determine_rarity(&gacha_bin, target_pool);
let (category_tag, category) = determine_category(rarity_items, progress_bin, target_pool);
let result =
determine_gacha_result(pull_time, category, target_pool, status_bin, rarity_items);
let result = determine_gacha_result(
pull_time,
category,
target_pool,
status_bin,
progress_bin,
rarity_items,
);
update_pity(&mut gacha_bin, rarity_items, probability_model, target_pool);
update_category_guarantee_info(&mut gacha_bin, rarity_items, &category_tag, target_pool);
update_discount(&mut gacha_bin, target_pool, &category_tag, rarity_items);
@ -196,9 +234,27 @@ fn determine_category<'bin, 'conf>(
let mut category_tag_inited = false;
let mut category_tag_result: HashSet<String> = HashSet::new();
// First of all, if there's a chooseable category and
// it's can be triggered, then we MUST give that
// category's item.
// TODO: Only Genshin can do
// it is SELECTED then we MUST give that category's item.
for guarantee_policy_tag in rarity_items.category_guarantee_policy_tags.iter() {
let category_guarantee_policy = gachaconf
.category_guarantee_policy_map
.get(guarantee_policy_tag)
.unwrap();
if !category_guarantee_policy.chooseable {
continue;
}
// As we found a policy defined chooseable, we
// should head to look whether the user chose
// the category he want.
if let Some(category_tag) = progress_bin
.categories_chosen_guarantee_category_map
.get(guarantee_policy_tag)
{
// User chose a category; our work are done here.
category_tag_result.insert(category_tag.clone());
category_tag_inited = true;
}
}
// Then we should take a look at MustGainItem.
if !category_tag_inited {
for discount_policy_tag in target_pool.discount_policy_tags.iter() {
@ -262,14 +318,49 @@ fn determine_gacha_result<'bin, 'conf>(
category: &'conf GachaCategoryInfo,
target_pool: &'conf CharacterGachaPool,
status_bin: &'bin GachaStatusBin,
progress_bin: &'bin GachaProgressBin,
rarity_items: &'conf GachaAvailableItemsInfo,
) -> GachaRecordBin {
let gachaconf = gacha::global_gacha_config();
let item_pool_len = category.item_ids.len() as u32;
let item_id = category
.item_ids
.get(rand::thread_rng().gen_range(0..item_pool_len) as usize)
.unwrap();
let mut item_id: Option<&u32> = None;
// We should see whether user's search priority exists.
for guarantee_policy_tag in rarity_items.category_guarantee_policy_tags.iter() {
let category_guarantee_policy = gachaconf
.category_guarantee_policy_map
.get(guarantee_policy_tag)
.unwrap();
if !category_guarantee_policy.chooseable {
continue;
}
// Firstly, judge whether the user failed enough times.
// The user is limited to get only this category's item,
// so we should record the user's failure to get his
// selected item elsewhere.
if progress_bin
.categories_chosen_guarantee_progress_map
.get(guarantee_policy_tag)
.unwrap()
< &category_guarantee_policy.trigger_on_failure_times
{
continue;
}
// We directly look whether user chose an UP item.
if let Some(item) = progress_bin
.categories_chosen_guarantee_item_map
.get(guarantee_policy_tag)
{
item_id = Some(item);
}
}
let item_id = match item_id {
Some(val) => val,
None => category
.item_ids
.get(rand::thread_rng().gen_range(0..item_pool_len) as usize)
.unwrap(),
};
let mut extra_item_id: u32 = 0;
let mut extra_item_count: u32 = 0;
@ -279,6 +370,7 @@ fn determine_gacha_result<'bin, 'conf>(
.get(extra_items_policy_tag)
.unwrap();
// TODO: apply_on_owned_count in a context with bag
// TODO: That's what RoleModel should do, not me.
if extra_items_policy.apply_on_owned_count == 0 {
extra_item_id = extra_items_policy.id;
extra_item_count = extra_items_policy.count;
@ -295,6 +387,7 @@ fn determine_gacha_result<'bin, 'conf>(
gacha_id: target_pool.gacha_schedule_id.clone(),
progress_map: status_bin.rarity_status_map.clone(),
extra_item_bin: Some(extra_item_bin),
item_type: category.item_type.into(),
}
}
@ -395,4 +488,18 @@ fn update_discount<'bin, 'conf>(
*usage += 1;
}
}
for (policy_tag, policy) in gachaconf.discount_policies.free_select_map.iter() {
if !target_pool.discount_policy_tags.contains(policy_tag) {
continue;
}
let status_bin = gacha_bin
.gacha_status_map
.get_mut(&target_pool.sharing_guarantee_info_category)
.unwrap();
let progress = status_bin
.discount_usage_map
.get_mut(&policy.free_select_progress_record_tag)
.unwrap();
*progress += 1;
}
}

View file

@ -1,4 +1,4 @@
use data::tables::{AvatarBaseID, SectionConfigID};
use data::tables::{AvatarBaseID, MainCityBgmConfigID, SectionConfigID};
use proto::*;
use thiserror::Error;
@ -14,6 +14,7 @@ use super::NapGameMode;
pub struct FrontendGame {
section_id: SectionConfigID,
frontend_avatar_id: AvatarBaseID,
main_city_bgm: MainCityBgmConfigID,
scene_unit_mgr: SceneUnitManager,
camera_x: u32,
camera_y: u32,
@ -30,6 +31,8 @@ pub enum FrontendGameError {
}
impl FrontendGame {
const DEFAULT_BGM_ID: u32 = 1005;
pub fn new(
section_id: SectionConfigID,
avatar_id: AvatarBaseID,
@ -40,6 +43,7 @@ impl FrontendGame {
let instance = Self {
section_id,
main_city_time,
main_city_bgm: MainCityBgmConfigID::new_unchecked(Self::DEFAULT_BGM_ID),
scene_unit_mgr: SceneUnitManager::new(section_id),
frontend_avatar_id: avatar_id,
camera_x: 0xFFFFFFFF,
@ -65,6 +69,7 @@ impl NapGameMode for FrontendGame {
hall_scene_info: Some(HallSceneInfo {
section_id: self.section_id.value(),
frontend_avatar_id: self.frontend_avatar_id.value(),
main_city_bgm_id: self.main_city_bgm.value(),
camera_x: self.camera_x,
camera_y: self.camera_y,
transform: self

View file

@ -4,7 +4,7 @@ use proto::{DungeonInfo, DungeonItemData, FightSceneInfo, SceneInfo, WeatherPool
use thiserror::Error;
use crate::logic::{
battle::{InLevelAvatarDataItem, TeamDataItem},
battle::{EquippedBuddyDataItem, InLevelAvatarDataItem, TeamDataItem},
ELocalPlayType, ESceneType, TimePeriodType, WeatherType,
};
@ -38,7 +38,7 @@ impl HollowGame {
weather: WeatherType::SunShine,
start_timestamp: util::cur_timestamp() as i64,
play_type,
team_data: TeamDataItem::new(avatars),
team_data: TeamDataItem::new(avatars, 0),
})
}
@ -46,6 +46,7 @@ impl HollowGame {
archive_battle_quest_id: ArchiveBattleQuestID,
play_type: ELocalPlayType,
avatars: &[u32],
buddy_id: u32,
) -> Result<Self, HollowGameError> {
let template = archive_battle_quest_id.template();
@ -56,7 +57,7 @@ impl HollowGame {
weather: WeatherType::SunShine,
start_timestamp: util::cur_timestamp() as i64,
play_type,
team_data: TeamDataItem::new(avatars),
team_data: TeamDataItem::new(avatars, buddy_id),
})
}
}
@ -94,6 +95,12 @@ impl NapGameMode for HollowGame {
.iter()
.map(InLevelAvatarDataItem::to_client)
.collect(),
buddy_list: self
.team_data
.equipped_buddy_list
.iter()
.map(EquippedBuddyDataItem::to_client)
.collect(),
..Default::default()
})
}

View file

@ -2270,7 +2270,7 @@ pub struct PlayerSyncScNotify {
#[prost(message, optional, tag = "12")]
pub gchokpdeeci: ::core::option::Option<Mbhjjoafcmc>,
#[prost(message, optional, tag = "13")]
pub kplhefeipee: ::core::option::Option<Onacbnhpicf>,
pub buddy: ::core::option::Option<BuddySync>,
#[prost(message, optional, tag = "14")]
pub mobpkchjfai: ::core::option::Option<Phnapedndek>,
#[prost(message, optional, tag = "15")]
@ -2406,7 +2406,7 @@ pub struct Khhjipglbll {
pub bcbcjioepod: u32,
#[xor(2704)]
#[prost(uint32, tag = "1")]
pub buddy: u32,
pub buddy_id: u32,
#[prost(uint32, repeated, tag = "11")]
pub avatars: ::prost::alloc::vec::Vec<u32>,
#[xor(9370)]
@ -2760,7 +2760,7 @@ pub struct Iedkhplmbab {
pub struct StartTrialFightingMissionCsReq {
#[xor(15246)]
#[prost(uint32, tag = "1")]
pub buddy: u32,
pub buddy_id: u32,
#[xor(3842)]
#[prost(uint32, tag = "11")]
pub quest_id: u32,
@ -2800,8 +2800,8 @@ pub struct Eoaebmjlfjc {
pub struct EquippedBuddyData {
#[xor(8856)]
#[prost(uint32, tag = "9")]
pub buddy: u32,
#[prost(enumeration = "Hneekphmejf", tag = "6")]
pub buddy_id: u32,
#[prost(enumeration = "BuddyTeamType", tag = "6")]
pub r#type: i32,
#[prost(map = "uint32, int32", tag = "10")]
pub mp_property_override_map: ::std::collections::HashMap<u32, i32>,
@ -5821,7 +5821,7 @@ pub struct Mcmkalpefjk {
pub struct Aibcmljaojd {
#[xor(3014)]
#[prost(uint32, tag = "1")]
pub naffoonclpe: u32,
pub main_city_bgm_id: u32,
}
#[derive(proto_gen::CmdID)]
#[cmdid(1091)]
@ -5916,7 +5916,7 @@ pub struct Lpjpfoaehlg {
pub lbmgeignmef: u32,
#[xor(2510)]
#[prost(uint32, tag = "8")]
pub buddy: u32,
pub buddy_id: u32,
}
#[derive(proto_gen::CmdID)]
#[derive(proto_gen::XorFields)]
@ -6844,7 +6844,7 @@ pub struct Pofhbffcjap {
#[derive(proto_gen::XorFields)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Nhffnnompfh {
pub struct ChooseGachaUpScRsp {
#[xor(4109)]
#[prost(int32, tag = "2")]
pub retcode: i32,
@ -7859,7 +7859,7 @@ pub struct LogBattleStatistics {
#[prost(message, optional, tag = "13")]
pub ncfafdpojjh: ::core::option::Option<Bacignlfind>,
#[prost(message, repeated, tag = "14")]
pub lmailahlomk: ::prost::alloc::vec::Vec<Jaokcopjeip>,
pub buddy_list: ::prost::alloc::vec::Vec<Jaokcopjeip>,
#[prost(uint32, tag = "15")]
pub mlagnchinll: u32,
#[prost(message, optional, tag = "17")]
@ -8538,7 +8538,7 @@ pub struct HallSceneInfo {
pub hoagdhfnhhp: u32,
#[xor(4796)]
#[prost(uint32, tag = "4")]
pub naffoonclpe: u32,
pub main_city_bgm_id: u32,
#[prost(message, optional, tag = "12")]
pub position: ::core::option::Option<Transform>,
#[xor(6272)]
@ -8695,7 +8695,7 @@ pub struct BeginArchiveBattleQuestCsReq {
pub quest_id: u32,
#[xor(1830)]
#[prost(uint32, tag = "11")]
pub buddy: u32,
pub buddy_id: u32,
#[prost(bool, tag = "1")]
pub is_story: bool,
#[prost(uint32, repeated, tag = "2")]
@ -9176,7 +9176,7 @@ pub struct Bijjamapnjm {
pub struct Bffgkjikbhp {
#[xor(3555)]
#[prost(uint32, tag = "14")]
pub buddy: u32,
pub buddy_id: u32,
#[xor(10954)]
#[prost(uint32, tag = "1")]
pub lbmgeignmef: u32,
@ -9395,7 +9395,7 @@ pub struct Kmkbpddeaoe {
pub struct Bhmhgadoncc {
#[xor(5509)]
#[prost(uint32, tag = "14")]
pub buddy: u32,
pub buddy_id: u32,
#[xor(10314)]
#[prost(int32, tag = "12")]
pub nledmfjbmmo: i32,
@ -10824,7 +10824,7 @@ pub struct Gccdaofpapp {
pub struct Ihilkekkdmh {
#[xor(10553)]
#[prost(uint32, tag = "13")]
pub buddy: u32,
pub buddy_id: u32,
#[xor(13840)]
#[prost(int32, tag = "1")]
pub retcode: i32,
@ -12833,7 +12833,7 @@ pub struct Okkjjhonnik {
pub ajichmhgblg: u32,
#[xor(1870)]
#[prost(uint32, tag = "7")]
pub buddy: u32,
pub buddy_id: u32,
}
#[derive(proto_gen::CmdID)]
#[derive(proto_gen::XorFields)]
@ -16216,7 +16216,7 @@ pub struct NeedItemInfo {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Onlmpmgcdle {
#[prost(message, repeated, tag = "13")]
pub lmailahlomk: ::prost::alloc::vec::Vec<EquippedBuddyData>,
pub buddy_list: ::prost::alloc::vec::Vec<EquippedBuddyData>,
}
#[derive(proto_gen::CmdID)]
#[cmdid(5211)]
@ -16488,7 +16488,7 @@ pub struct DungeonItemData {
#[prost(message, repeated, tag = "6")]
pub dldfgemogip: ::prost::alloc::vec::Vec<Ljcocgillfb>,
#[prost(message, repeated, tag = "14")]
pub lmailahlomk: ::prost::alloc::vec::Vec<BuddyInfo>,
pub buddy_list: ::prost::alloc::vec::Vec<BuddyInfo>,
}
#[derive(proto_gen::CmdID)]
#[derive(proto_gen::XorFields)]
@ -16638,7 +16638,7 @@ pub struct Ejjimjcohgg {
pub feanogfdcjh: u32,
#[xor(3653)]
#[prost(uint32, tag = "9")]
pub naffoonclpe: u32,
pub main_city_bgm_id: u32,
#[prost(message, repeated, tag = "3")]
pub imfhefkhano: ::prost::alloc::vec::Vec<Ckndhmekhfm>,
}
@ -17052,7 +17052,7 @@ pub struct Fkibbohbdin {
#[derive(proto_gen::XorFields)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Onacbnhpicf {
pub struct BuddySync {
#[prost(uint32, repeated, tag = "1")]
pub kghfhlopgjb: ::prost::alloc::vec::Vec<u32>,
#[prost(uint32, repeated, tag = "9")]
@ -17066,7 +17066,7 @@ pub struct Onacbnhpicf {
#[prost(uint32, tag = "3")]
pub lpfeinagkha: u32,
#[prost(message, repeated, tag = "2")]
pub lmailahlomk: ::prost::alloc::vec::Vec<BuddyInfo>,
pub buddy_list: ::prost::alloc::vec::Vec<BuddyInfo>,
}
#[derive(proto_gen::CmdID)]
#[derive(proto_gen::XorFields)]
@ -17266,7 +17266,7 @@ pub struct Ilehibpgief {
pub struct Fjppbkgebcl {
#[xor(7354)]
#[prost(uint32, tag = "8")]
pub buddy: u32,
pub buddy_id: u32,
}
#[derive(proto_gen::CmdID)]
#[derive(proto_gen::XorFields)]
@ -20840,7 +20840,7 @@ pub struct Ghgbhljlmde {
pub bikhplpcalp: ::std::collections::HashMap<u32, u32>,
#[xor(4986)]
#[prost(uint32, tag = "6")]
pub buddy: u32,
pub buddy_id: u32,
#[xor(1495)]
#[prost(uint32, tag = "5")]
pub ihgcjhffkdf: u32,
@ -20969,8 +20969,8 @@ pub struct Acobofkfjgj {
pub struct Oidkngmaipi {
#[xor(8441)]
#[prost(uint32, tag = "14")]
pub buddy: u32,
#[prost(enumeration = "Hneekphmejf", tag = "7")]
pub buddy_id: u32,
#[prost(enumeration = "BuddyTeamType", tag = "7")]
pub ddogpdoomde: i32,
}
#[derive(proto_gen::CmdID)]
@ -21192,7 +21192,7 @@ pub struct Labghjgfhhh {
pub lbmgeignmef: u32,
#[xor(13505)]
#[prost(uint32, tag = "4")]
pub buddy: u32,
pub buddy_id: u32,
}
#[derive(proto_gen::CmdID)]
#[derive(proto_gen::XorFields)]
@ -21227,7 +21227,7 @@ pub struct Gmgoddaldob {
#[prost(uint32, tag = "1")]
pub pmnjlmekmbc: u32,
#[prost(uint32, tag = "2")]
pub buddy: u32,
pub buddy_id: u32,
#[prost(bool, tag = "3")]
pub majldghlkab: bool,
#[prost(bytes = "vec", tag = "4")]
@ -21748,7 +21748,7 @@ pub struct GetBuddyDataScRsp {
#[prost(uint32, tag = "12")]
pub lpfeinagkha: u32,
#[prost(message, repeated, tag = "5")]
pub lmailahlomk: ::prost::alloc::vec::Vec<BuddyInfo>,
pub buddy_list: ::prost::alloc::vec::Vec<BuddyInfo>,
#[prost(uint32, repeated, tag = "10")]
pub kghfhlopgjb: ::prost::alloc::vec::Vec<u32>,
}
@ -22137,7 +22137,7 @@ pub struct Kakpeoaekgb {
pub struct Mbchikbhcmp {
#[xor(8473)]
#[prost(uint32, tag = "10")]
pub buddy: u32,
pub buddy_id: u32,
#[prost(bool, tag = "6")]
pub aobemkmdkgo: bool,
#[prost(message, repeated, tag = "14")]
@ -22295,7 +22295,7 @@ pub struct Gacha {
pub gacha_info_list_webview: ::prost::alloc::string::String,
#[xor(9009)]
#[prost(uint32, tag = "419")]
pub ekjlhhdekka: u32,
pub chosen_up_item: u32,
#[prost(string, tag = "923")]
pub fjohnbicmce: ::prost::alloc::string::String,
#[xor(1379)]
@ -22404,7 +22404,7 @@ pub struct Aecgodfnpao {
pub lbmgeignmef: u32,
#[xor(7503)]
#[prost(uint32, tag = "12")]
pub buddy: u32,
pub buddy_id: u32,
}
#[derive(proto_gen::CmdID)]
#[derive(proto_gen::XorFields)]
@ -22612,7 +22612,7 @@ pub struct Ghojoimpnad {
pub ndcnfidonje: u32,
#[xor(8060)]
#[prost(uint32, tag = "2")]
pub buddy: u32,
pub buddy_id: u32,
#[xor(15324)]
#[prost(uint32, tag = "1")]
pub lbmgeignmef: u32,
@ -24257,7 +24257,7 @@ pub struct Enaagloodio {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Ecjcmfjjgdp {
#[prost(int32, tag = "1")]
pub buddy: i32,
pub buddy_id: i32,
#[prost(int32, repeated, tag = "2")]
pub jpncidefiba: ::prost::alloc::vec::Vec<i32>,
#[prost(message, optional, tag = "3")]
@ -24558,7 +24558,7 @@ pub struct Obpccjhnbpe {
#[derive(proto_gen::XorFields)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Pahjnbjogon {
pub struct ChooseGachaUpCsReq {
#[xor(3180)]
#[prost(uint32, tag = "6")]
pub item_id: u32,
@ -25751,7 +25751,7 @@ pub struct DungeonInfo {
#[prost(message, optional, tag = "3")]
pub ncfafdpojjh: ::core::option::Option<Kalfjemiaaa>,
#[prost(message, optional, tag = "8")]
pub kplhefeipee: ::core::option::Option<EquippedBuddyData>,
pub buddy: ::core::option::Option<EquippedBuddyData>,
#[prost(bool, tag = "1724")]
pub gjhgpapkmod: bool,
#[prost(bool, tag = "1109")]
@ -25769,7 +25769,7 @@ pub struct DungeonInfo {
#[prost(map = "uint32, int32", tag = "7")]
pub njfikojmpcm: ::std::collections::HashMap<u32, i32>,
#[prost(message, repeated, tag = "1395")]
pub lmailahlomk: ::prost::alloc::vec::Vec<EquippedBuddyData>,
pub buddy_list: ::prost::alloc::vec::Vec<EquippedBuddyData>,
#[prost(message, optional, tag = "2")]
pub dungeon_item_data: ::core::option::Option<DungeonItemData>,
#[prost(message, optional, tag = "5")]
@ -27252,7 +27252,7 @@ pub struct Aicalelcmii {
pub kplhkiofbah: bool,
#[xor(3343)]
#[prost(uint32, tag = "7")]
pub buddy: u32,
pub buddy_id: u32,
}
#[derive(proto_gen::CmdID)]
#[cmdid(4100)]
@ -27531,7 +27531,7 @@ pub struct TipsInfo {
#[derive(proto_gen::XorFields)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Ieimfkpmegp {
pub struct GachaFreeAgentCsReq {
#[xor(378)]
#[prost(uint32, tag = "12")]
pub gacha_parent_schedule_id: u32,
@ -28678,7 +28678,7 @@ pub struct Bkkmkacnhne {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Dpijpabbknc {
#[prost(message, optional, tag = "1")]
pub buddy: ::core::option::Option<StringEntry>,
pub buddy_id: ::core::option::Option<StringEntry>,
#[prost(enumeration = "Afnpekehlge", tag = "2")]
pub ddogpdoomde: i32,
}
@ -29634,7 +29634,7 @@ pub struct Jlgmobeofhe {
pub jipabmjagbi: u32,
#[xor(12923)]
#[prost(uint32, tag = "4")]
pub buddy: u32,
pub buddy_id: u32,
#[xor(11558)]
#[prost(uint32, tag = "14")]
pub pmnjlmekmbc: u32,
@ -30207,7 +30207,7 @@ pub struct Dlenhbdpddl {
#[prost(uint32, tag = "5")]
pub uid: u32,
#[prost(message, repeated, tag = "7")]
pub lmailahlomk: ::prost::alloc::vec::Vec<Fjppbkgebcl>,
pub buddy_list: ::prost::alloc::vec::Vec<Fjppbkgebcl>,
}
#[derive(proto_gen::CmdID)]
#[cmdid(1394)]
@ -30566,7 +30566,7 @@ pub struct Jcfdccfejcg {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Jaokcopjeip {
#[prost(int32, tag = "1")]
pub buddy: i32,
pub buddy_id: i32,
#[prost(int64, tag = "2")]
pub cjehpadgajn: i64,
#[prost(int32, tag = "3")]
@ -31687,7 +31687,7 @@ pub struct Amhlhmjgcpk {
#[derive(proto_gen::XorFields)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Idonpiailid {
pub struct GachaFreeAgentScRsp {
#[xor(3883)]
#[prost(int32, tag = "3")]
pub retcode: i32,
@ -32158,7 +32158,7 @@ pub struct Hphfnebchnb {
pub struct Hoeafbihgpd {
#[xor(1739)]
#[prost(uint32, tag = "3")]
pub buddy: u32,
pub buddy_id: u32,
}
#[derive(proto_gen::CmdID)]
#[cmdid(3238)]
@ -33225,7 +33225,7 @@ pub struct Gkegfnbpiok {
pub star: u32,
#[xor(15011)]
#[prost(uint32, tag = "3")]
pub buddy: u32,
pub buddy_id: u32,
#[xor(810)]
#[prost(uint32, tag = "5")]
pub exp: u32,
@ -33399,7 +33399,7 @@ pub struct Jcincgmdflc {
pub olcifcglpdd: ::prost::alloc::vec::Vec<u32>,
#[xor(3275)]
#[prost(uint32, tag = "11")]
pub buddy: u32,
pub buddy_id: u32,
#[xor(10845)]
#[prost(uint32, tag = "13")]
pub quest_id: u32,
@ -33777,7 +33777,7 @@ pub struct Jhinopamaoa {
pub avatars: ::prost::alloc::vec::Vec<u32>,
#[xor(6842)]
#[prost(uint32, tag = "14")]
pub buddy: u32,
pub buddy_id: u32,
#[prost(uint32, repeated, tag = "3")]
pub obpdhglkbgk: ::prost::alloc::vec::Vec<u32>,
#[xor(8158)]
@ -34490,7 +34490,7 @@ pub struct Jiflifhgkhk {
pub is_story: bool,
#[xor(7590)]
#[prost(uint32, tag = "5")]
pub buddy: u32,
pub buddy_id: u32,
#[prost(bool, tag = "14")]
pub jcflmpbcojd: bool,
}
@ -48346,32 +48346,32 @@ impl DungeonContentDropPoolType {
#[derive(proto_gen::XorFields)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Hneekphmejf {
Jhlmmfkphgb = 0,
Kjppindjool = 1,
Ehemncmjnkg = 2,
Lddkjjhcikb = 3,
pub enum BuddyTeamType {
None = 0,
Unknown = 1,
Fighting = 2,
Assisting = 3,
}
impl Hneekphmejf {
impl BuddyTeamType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Hneekphmejf::Jhlmmfkphgb => "HNEEKPHMEJF_JHLMMFKPHGB",
Hneekphmejf::Kjppindjool => "HNEEKPHMEJF_KJPPINDJOOL",
Hneekphmejf::Ehemncmjnkg => "HNEEKPHMEJF_EHEMNCMJNKG",
Hneekphmejf::Lddkjjhcikb => "HNEEKPHMEJF_LDDKJJHCIKB",
BuddyTeamType::None => "BUDDY_TEAM_TYPE_NONE",
BuddyTeamType::Unknown => "BUDDY_TEAM_TYPE_UNKNOWN",
BuddyTeamType::Fighting => "BUDDY_TEAM_TYPE_FIGHTING",
BuddyTeamType::Assisting => "BUDDY_TEAM_TYPE_ASSISTING",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"HNEEKPHMEJF_JHLMMFKPHGB" => Some(Self::Jhlmmfkphgb),
"HNEEKPHMEJF_KJPPINDJOOL" => Some(Self::Kjppindjool),
"HNEEKPHMEJF_EHEMNCMJNKG" => Some(Self::Ehemncmjnkg),
"HNEEKPHMEJF_LDDKJJHCIKB" => Some(Self::Lddkjjhcikb),
"BUDDY_TEAM_TYPE_NONE" => Some(Self::None),
"BUDDY_TEAM_TYPE_UNKNOWN" => Some(Self::Unknown),
"BUDDY_TEAM_TYPE_FIGHTING" => Some(Self::Fighting),
"BUDDY_TEAM_TYPE_ASSISTING" => Some(Self::Assisting),
_ => None,
}
}

View file

@ -117,6 +117,7 @@ pub struct MainCityModelBin {
#[prost(uint32, tag = "3")]
pub section_id: u32,
}
/// The progress record of a specified rarity. All maps' keys are category_guarantee_policy_tag.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GachaProgressBin {
@ -129,12 +130,24 @@ pub struct GachaProgressBin {
::prost::alloc::string::String,
u32,
>,
/// The selected priority for a Chooseable category.
/// The selected priority (category) for a Chooseable category.
#[prost(map = "string, string", tag = "3")]
pub category_chosen_guarantee_map: ::std::collections::HashMap<
pub categories_chosen_guarantee_category_map: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
/// The selectedpriority (a specified item) for a Chooseable category.
#[prost(map = "string, uint32", tag = "4")]
pub categories_chosen_guarantee_item_map: ::std::collections::HashMap<
::prost::alloc::string::String,
u32,
>,
/// The failure times for selected priority (a specified item).
#[prost(map = "string, uint32", tag = "5")]
pub categories_chosen_guarantee_progress_map: ::std::collections::HashMap<
::prost::alloc::string::String,
u32,
>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
@ -162,6 +175,8 @@ pub struct GachaRecordBin {
pub progress_map: ::std::collections::HashMap<u32, GachaProgressBin>,
#[prost(message, optional, tag = "5")]
pub extra_item_bin: ::core::option::Option<GachaExtraItemBin>,
#[prost(enumeration = "GachaAddedItemType", tag = "6")]
pub item_type: i32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
@ -204,3 +219,35 @@ pub struct PlayerDataBin {
#[prost(message, optional, tag = "6")]
pub gacha_model: ::core::option::Option<GachaModelBin>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum GachaAddedItemType {
None = 0,
Weapon = 1,
Character = 2,
Bangboo = 3,
}
impl GachaAddedItemType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
GachaAddedItemType::None => "GACHA_ADDED_ITEM_TYPE_NONE",
GachaAddedItemType::Weapon => "GACHA_ADDED_ITEM_TYPE_WEAPON",
GachaAddedItemType::Character => "GACHA_ADDED_ITEM_TYPE_CHARACTER",
GachaAddedItemType::Bangboo => "GACHA_ADDED_ITEM_TYPE_BANGBOO",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"GACHA_ADDED_ITEM_TYPE_NONE" => Some(Self::None),
"GACHA_ADDED_ITEM_TYPE_WEAPON" => Some(Self::Weapon),
"GACHA_ADDED_ITEM_TYPE_CHARACTER" => Some(Self::Character),
"GACHA_ADDED_ITEM_TYPE_BANGBOO" => Some(Self::Bangboo),
_ => None,
}
}
}