Implement AddEquip GM Command (the command to add custom drive discs)

This commit is contained in:
xeon 2025-05-29 20:05:29 +03:00
parent 3c66353745
commit 8718a417fb
4 changed files with 46 additions and 1 deletions

1
Cargo.lock generated
View file

@ -2573,6 +2573,7 @@ dependencies = [
"common", "common",
"config", "config",
"const_format", "const_format",
"itertools",
"paste", "paste",
"rand", "rand",
"scc", "scc",

View file

@ -29,6 +29,12 @@ pub enum GMCmd {
star: u32, star: u32,
refine_level: u32, refine_level: u32,
}, },
AddEquip {
equip_id: u32,
level: u32,
star: u32,
property_params: Vec<u32>,
},
SetAvatarSkin { SetAvatarSkin {
avatar_id: u32, avatar_id: u32,
avatar_skin_id: u32, avatar_skin_id: u32,

View file

@ -13,6 +13,7 @@ thiserror.workspace = true
rand.workspace = true rand.workspace = true
tracing.workspace = true tracing.workspace = true
itertools.workspace = true
paste.workspace = true paste.workspace = true
scc.workspace = true scc.workspace = true

View file

@ -1,7 +1,11 @@
use std::cmp; use std::cmp;
use itertools::Itertools;
use tracing::{error, instrument}; use tracing::{error, instrument};
use vivian_logic::{debug::GMCmd, item::EAvatarSkillType}; use vivian_logic::{
debug::GMCmd,
item::{EAvatarSkillType, EquipItem},
};
use vivian_models::SceneSnapshotExt; use vivian_models::SceneSnapshotExt;
use crate::{ use crate::{
@ -117,6 +121,39 @@ pub fn execute_gm_cmd(player: &mut Player, cmd: GMCmd) {
weapon.star = star; weapon.star = star;
weapon.refine_level = refine_level; weapon.refine_level = refine_level;
} }
AddEquip {
equip_id,
level,
star,
property_params,
} => {
let mut property_params = property_params.into_iter().tuples();
let properties = property_params
.next()
.into_iter()
.map(|(key, base_value, add_value)| (key, (base_value, add_value)))
.collect();
let sub_properties = property_params
.map(|(key, base_value, add_value)| (key, (base_value, add_value)))
.collect();
let uid = player.item_model.next_uid();
player.item_model.equip_map.insert(
uid,
EquipItem {
id: equip_id,
level,
star,
exp: 0,
lock: false,
properties,
sub_properties,
},
);
}
SetAvatarSkin { SetAvatarSkin {
avatar_id, avatar_id,
avatar_skin_id, avatar_skin_id,