forked from wickedwaifus/wicked-waifus-rs
Compare commits
2 commits
automatic+
...
master
Author | SHA1 | Date | |
---|---|---|---|
05034b1774 | |||
4d6b79aa29 |
46 changed files with 1987 additions and 1382 deletions
|
@ -1,30 +0,0 @@
|
|||
// Folder-specific settings
|
||||
//
|
||||
// For a full list of overridable settings, and general information on folder-specific settings,
|
||||
// see the documentation: https://zed.dev/docs/configuring-zed#settings-files
|
||||
{
|
||||
"lsp": {
|
||||
"rust-analyzer": {
|
||||
"initialization_options": {
|
||||
// get more cargo-less diagnostics from rust-analyzer,
|
||||
// which might include false-positives (those can be turned off by their names)
|
||||
"diagnostics": {
|
||||
"experimental": {
|
||||
"enable": true
|
||||
}
|
||||
},
|
||||
// To disable the checking entirely
|
||||
// (ignores all cargo and check settings below)
|
||||
"checkOnSave": false,
|
||||
// To check the `lib` target only.
|
||||
"cargo": {
|
||||
"allTargets": false
|
||||
},
|
||||
// Use `-p` instead of `--workspace` for cargo check
|
||||
"check": {
|
||||
"workspace": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
127
Cargo.lock
generated
127
Cargo.lock
generated
|
@ -276,9 +276,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.2.22"
|
||||
version = "1.2.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32db95edf998450acc7881c932f94cd9b05c87b4b2599e8bab064753da4acfd1"
|
||||
checksum = "16595d3be041c03b09d08d0858631facccee9221e579704070e6e9e4915d3bc7"
|
||||
dependencies = [
|
||||
"jobserver",
|
||||
"libc",
|
||||
|
@ -902,9 +902,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "hyper-util"
|
||||
version = "0.1.11"
|
||||
version = "0.1.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "497bbc33a26fdd4af9ed9c70d63f61cf56a938375fbb32df34db9b1cd6d643f2"
|
||||
checksum = "cf9f1e950e0d9d1d3c47184416723cf29c0d1f93bd8cccf37e4beb6b44f31710"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-util",
|
||||
|
@ -965,9 +965,9 @@ checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3"
|
|||
|
||||
[[package]]
|
||||
name = "icu_properties"
|
||||
version = "2.0.0"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2549ca8c7241c82f59c80ba2a6f415d931c5b58d24fb8412caa1a1f02c49139a"
|
||||
checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b"
|
||||
dependencies = [
|
||||
"displaydoc",
|
||||
"icu_collections",
|
||||
|
@ -981,9 +981,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "icu_properties_data"
|
||||
version = "2.0.0"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8197e866e47b68f8f7d95249e172903bec06004b18b2937f1095d40a0c57de04"
|
||||
checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632"
|
||||
|
||||
[[package]]
|
||||
name = "icu_provider"
|
||||
|
@ -1118,6 +1118,26 @@ dependencies = [
|
|||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "liblzma"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "66352d7a8ac12d4877b6e6ea5a9b7650ee094257dc40889955bea5bc5b08c1d0"
|
||||
dependencies = [
|
||||
"liblzma-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "liblzma-sys"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5839bad90c3cc2e0b8c4ed8296b80e86040240f81d46b9c0e9bc8dd51ddd3af1"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libm"
|
||||
version = "0.2.15"
|
||||
|
@ -1207,27 +1227,6 @@ version = "0.4.27"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
|
||||
|
||||
[[package]]
|
||||
name = "lzma-rs"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "297e814c836ae64db86b36cf2a557ba54368d03f6afcd7d947c266692f71115e"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"crc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lzma-sys"
|
||||
version = "0.1.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5fda04ab3764e6cde78b9974eec4f779acaba7c4e84b36eca3cf77c581b85d27"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "matchers"
|
||||
version = "0.1.0"
|
||||
|
@ -1295,13 +1294,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "1.0.3"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd"
|
||||
checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"wasi 0.11.0+wasi-snapshot-preview1",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1872,9 +1871,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
version = "1.0.20"
|
||||
version = "1.0.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2"
|
||||
checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d"
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
|
@ -2073,9 +2072,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sqlx"
|
||||
version = "0.8.5"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f3c3a85280daca669cfd3bcb68a337882a8bc57ec882f72c5d13a430613a738e"
|
||||
checksum = "1fefb893899429669dcdd979aff487bd78f4064e5e7907e4269081e0ef7d97dc"
|
||||
dependencies = [
|
||||
"sqlx-core",
|
||||
"sqlx-macros",
|
||||
|
@ -2086,9 +2085,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sqlx-core"
|
||||
version = "0.8.5"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f743f2a3cea30a58cd479013f75550e879009e3a02f616f18ca699335aa248c3"
|
||||
checksum = "ee6798b1838b6a0f69c007c133b8df5866302197e404e8b6ee8ed3e3a5e68dc6"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"bytes",
|
||||
|
@ -2122,9 +2121,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sqlx-macros"
|
||||
version = "0.8.5"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f4200e0fde19834956d4252347c12a083bdcb237d7a1a1446bffd8768417dce"
|
||||
checksum = "a2d452988ccaacfbf5e0bdbc348fb91d7c8af5bee192173ac3636b5fb6e6715d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -2135,9 +2134,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sqlx-macros-core"
|
||||
version = "0.8.5"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "882ceaa29cade31beca7129b6beeb05737f44f82dbe2a9806ecea5a7093d00b7"
|
||||
checksum = "19a9c1841124ac5a61741f96e1d9e2ec77424bf323962dd894bdb93f37d5219b"
|
||||
dependencies = [
|
||||
"dotenvy",
|
||||
"either",
|
||||
|
@ -2154,16 +2153,15 @@ dependencies = [
|
|||
"sqlx-postgres",
|
||||
"sqlx-sqlite",
|
||||
"syn",
|
||||
"tempfile",
|
||||
"tokio",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sqlx-mysql"
|
||||
version = "0.8.5"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0afdd3aa7a629683c2d750c2df343025545087081ab5942593a5288855b1b7a7"
|
||||
checksum = "aa003f0038df784eb8fecbbac13affe3da23b45194bd57dba231c8f48199c526"
|
||||
dependencies = [
|
||||
"atoi",
|
||||
"base64",
|
||||
|
@ -2203,9 +2201,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sqlx-postgres"
|
||||
version = "0.8.5"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a0bedbe1bbb5e2615ef347a5e9d8cd7680fb63e77d9dafc0f29be15e53f1ebe6"
|
||||
checksum = "db58fcd5a53cf07c184b154801ff91347e4c30d17a3562a635ff028ad5deda46"
|
||||
dependencies = [
|
||||
"atoi",
|
||||
"base64",
|
||||
|
@ -2240,9 +2238,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sqlx-sqlite"
|
||||
version = "0.8.5"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c26083e9a520e8eb87a06b12347679b142dc2ea29e6e409f805644a7a979a5bc"
|
||||
checksum = "c2d12fe70b2c1b4401038055f90f151b78208de1f9f89a7dbfd41587a10c3eea"
|
||||
dependencies = [
|
||||
"atoi",
|
||||
"flume",
|
||||
|
@ -2422,9 +2420,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
|||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.45.0"
|
||||
version = "1.45.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2513ca694ef9ede0fb23fe71a4ee4107cb102b9dc1930f6d0fd77aae068ae165"
|
||||
checksum = "75ef51a33ef1da925cea3e4eb122833cb377c61439ca401b770f54902b806779"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"bytes",
|
||||
|
@ -2739,11 +2737,13 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
|
|||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "1.16.0"
|
||||
version = "1.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9"
|
||||
checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d"
|
||||
dependencies = [
|
||||
"getrandom 0.3.3",
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2793,6 +2793,7 @@ checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5"
|
|||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
"rustversion",
|
||||
"wasm-bindgen-macro",
|
||||
]
|
||||
|
||||
|
@ -3026,7 +3027,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "wicked-waifus-protocol"
|
||||
version = "0.1.0"
|
||||
source = "git+https://git.xeondev.com/wickedwaifus/wicked-waifus-proto#6f2733c09b78a6e874f379254c9b71fbef23c3a0"
|
||||
source = "git+https://git.xeondev.com/wickedwaifus/wicked-waifus-proto#316e3ee06f5ee0405e4cab567e67f4315c0f2cfb"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"crc32fast",
|
||||
|
@ -3044,7 +3045,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "wicked-waifus-protocol-derive"
|
||||
version = "0.1.0"
|
||||
source = "git+https://git.xeondev.com/wickedwaifus/wicked-waifus-proto#6f2733c09b78a6e874f379254c9b71fbef23c3a0"
|
||||
source = "git+https://git.xeondev.com/wickedwaifus/wicked-waifus-proto#316e3ee06f5ee0405e4cab567e67f4315c0f2cfb"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -3280,15 +3281,6 @@ version = "0.6.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb"
|
||||
|
||||
[[package]]
|
||||
name = "xz2"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "388c44dc09d76f1536602ead6d325eb532f5c122f17782bd57fb47baeeb767e2"
|
||||
dependencies = [
|
||||
"lzma-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "yoke"
|
||||
version = "0.8.0"
|
||||
|
@ -3436,9 +3428,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "zip"
|
||||
version = "3.0.0"
|
||||
version = "4.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "12598812502ed0105f607f941c386f43d441e00148fce9dec3ca5ffb0bde9308"
|
||||
checksum = "153a6fff49d264c4babdcfa6b4d534747f520e56e8f0f384f3b808c4b64cc1fd"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"arbitrary",
|
||||
|
@ -3450,12 +3442,11 @@ dependencies = [
|
|||
"getrandom 0.3.3",
|
||||
"hmac",
|
||||
"indexmap",
|
||||
"lzma-rs",
|
||||
"liblzma",
|
||||
"memchr",
|
||||
"pbkdf2",
|
||||
"sha1",
|
||||
"time",
|
||||
"xz2",
|
||||
"zeroize",
|
||||
"zopfli",
|
||||
"zstd",
|
||||
|
|
|
@ -55,7 +55,7 @@ wicked-waifus-network = { path = "wicked-waifus-network" }
|
|||
wicked-waifus-protocol-internal = { path = "wicked-waifus-protocol-internal" }
|
||||
wicked-waifus-protokey = { path = "wicked-waifus-protokey" }
|
||||
|
||||
wicked-waifus-protocol = { git = "https://git.xeondev.com/wickedwaifus/wicked-waifus-proto" }
|
||||
wicked-waifus-protocol = { git = "https://git.xeondev.com/wickedwaifus/wicked-waifus-proto", features = ["debug"] }
|
||||
wicked-waifus-protocol-derive = { git = "https://git.xeondev.com/wickedwaifus/wicked-waifus-proto" }
|
||||
|
||||
[profile.release]
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
use serde::Deserialize;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct BuffData {
|
||||
pub id: i64,
|
||||
pub ge_desc: String,
|
||||
pub duration_policy: i32,
|
||||
pub extra_effect_parameters: Option<Vec<String>>,
|
||||
pub game_attribute_i_d: i32
|
||||
}
|
55
wicked-waifus-data/src/fly_skin_config.rs
Normal file
55
wicked-waifus-data/src/fly_skin_config.rs
Normal file
|
@ -0,0 +1,55 @@
|
|||
use serde::Deserialize;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct FlySkinConfigData {
|
||||
pub id: i32,
|
||||
pub skin_type: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub model_id: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub stand_anim: String,
|
||||
pub quality_id: i32,
|
||||
pub skin_grade: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub name: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub type_description: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub attributes_description: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub bg_description: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub icon: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub icon_middle: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub icon_small: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub mesh: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub obtained_show_description: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub show_in_bag: bool,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub item_access: Vec<i32>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub sort_index: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub red_dot_disable_rule: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub preview_texture_in_buy_view: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub preview_texture_in_pay_shop: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub preview_texture_in_pop: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub skin_obtain_color1: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub skin_obtain_color2: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub skin_obtain_image: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub is_special_view_after_obtain: bool,
|
||||
}
|
|
@ -125,6 +125,7 @@ json_data! {
|
|||
FavorLevel;
|
||||
FavorStory;
|
||||
FavorWord;
|
||||
FlySkinConfig;
|
||||
ForgeFormula;
|
||||
FunctionCondition;
|
||||
Gacha;
|
||||
|
@ -138,7 +139,6 @@ json_data! {
|
|||
LevelPlayNodeData;
|
||||
LivenessTask;
|
||||
LordGym;
|
||||
ModelConfigPreload;
|
||||
MonsterDetection;
|
||||
MonsterPropertyGrowth;
|
||||
Motion;
|
||||
|
@ -146,7 +146,6 @@ json_data! {
|
|||
ResonanceAmplification;
|
||||
ResonantChain;
|
||||
RoleBreach;
|
||||
RoleExpItem;
|
||||
RoleInfo;
|
||||
RoleLevelConsume;
|
||||
RolePropertyGrowth;
|
||||
|
@ -160,6 +159,7 @@ json_data! {
|
|||
WeaponLevel;
|
||||
WeaponPropertyGrowth;
|
||||
WeaponReson;
|
||||
WeaponSkin;
|
||||
}
|
||||
|
||||
json_hash_table_data! {
|
||||
|
@ -168,10 +168,10 @@ json_hash_table_data! {
|
|||
BlueprintConfig, blueprint_type, String;
|
||||
DragonPool, id, i32;
|
||||
DropPackage, id, i32;
|
||||
RoleExpItem, id, i32;
|
||||
TemplateConfig, blueprint_type, String;
|
||||
SummonCfg, blueprint_type, String;
|
||||
Buff, id, i64;
|
||||
}
|
||||
|
||||
mod level_entity_config;
|
||||
|
||||
pub mod level_entity_config_data {
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
use serde::Deserialize;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct ModelConfigPreloadData {
|
||||
pub id: i32,
|
||||
pub actor_class_path: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub actor_class: Vec<String>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub animations: Vec<String>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub effects: Vec<String>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub audios: Vec<String>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub meshes: Vec<String>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub materials: Vec<String>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub animation_blueprints: Vec<String>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub others: Vec<String>,
|
||||
|
||||
}
|
|
@ -15,7 +15,6 @@ pub mod reward;
|
|||
pub mod teleport;
|
||||
pub mod timer;
|
||||
pub mod var;
|
||||
pub mod model;
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
|
@ -29,7 +28,6 @@ pub struct ComponentsData {
|
|||
pub interact_component: Option<interact::InteractComponent>,
|
||||
pub entity_state_component: Option<entity_state::EntityStateComponent>,
|
||||
pub reward_component: Option<reward::RewardComponent>,
|
||||
pub model_component: Option<model::ModelComponent>,
|
||||
// TODO: Implement this ones
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub scene_actor_ref_component: Option<serde_json::Value>,
|
||||
|
@ -72,6 +70,8 @@ pub struct ComponentsData {
|
|||
#[cfg(feature = "strict_json_fields")]
|
||||
pub photo_target_component: Option<serde_json::Value>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub model_component: Option<serde_json::Value>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub entity_group_component: Option<serde_json::Value>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub scene_item_life_cycle_component: Option<serde_json::Value>,
|
||||
|
@ -230,7 +230,6 @@ impl ComponentsData {
|
|||
interact_component: self.interact_component.as_ref().or(template.interact_component.as_ref()).cloned(),
|
||||
entity_state_component: self.entity_state_component.as_ref().or(template.entity_state_component.as_ref()).cloned(),
|
||||
reward_component: self.reward_component.as_ref().or(template.reward_component.as_ref()).cloned(),
|
||||
model_component: self.model_component.as_ref().or(template.model_component.as_ref()).cloned(),
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
use serde::Deserialize;
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct ModelType {
|
||||
pub r#type: Option<String>,
|
||||
pub model_id: Option<i32>
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct ModelComponent {
|
||||
pub half_height: Option<i32>,
|
||||
pub disabled: Option<bool>,
|
||||
pub model_type: Option<ModelType>
|
||||
}
|
|
@ -100,6 +100,7 @@ pub struct RoleInfoData {
|
|||
pub role_guide: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub red_dot_disable_rule: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub skin_damage: Vec<String>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub hide_hu_lu: bool,
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
use serde::Deserialize;
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct SummonCfgData {
|
||||
pub id: i32,
|
||||
pub blueprint_type: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub name: String,
|
||||
pub born_buff_id: Vec<i64>,
|
||||
}
|
54
wicked-waifus-data/src/weapon_skin.rs
Normal file
54
wicked-waifus-data/src/weapon_skin.rs
Normal file
|
@ -0,0 +1,54 @@
|
|||
use serde::Deserialize;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct WeaponSkinData {
|
||||
pub id: i32,
|
||||
pub weapon_skin_type: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub name: String,
|
||||
pub hide_in_skin_view: bool,
|
||||
pub quality_id: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub model_id: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub transform_id: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub models: Vec<i32>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub type_description: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub attributes_description: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub bg_description: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub card_icon_path: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub icon: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub icon_middle: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub icon_small: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
#[serde(rename = "MaxCapcity")] // kuro!
|
||||
pub max_capacity: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub item_access: Vec<i32>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub obtained_show: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub obtained_show_description: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub num_limit: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub show_in_bag: bool,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub sort_index: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub hidden_time: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub destructible: bool,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub red_dot_disable_rule: i32,
|
||||
}
|
|
@ -19,7 +19,7 @@ load_textmaps = true
|
|||
quadrant_size = 1000000
|
||||
|
||||
[asset_config]
|
||||
asset_url = "https://git.xeondev.com/wickedwaifus/wicked-waifus-data/releases/download/pioneer_2.4.1/bundle.zip"
|
||||
asset_url = "https://git.xeondev.com/wickedwaifus/wicked-waifus-data/releases/download/pioneer_2.4.4/bundle.zip"
|
||||
buffer_size = 268435456
|
||||
|
||||
[default_unlocks]
|
||||
|
@ -28,8 +28,15 @@ unlock_all_roles_max_level = false
|
|||
unlock_all_roles_all_sequences = false
|
||||
unlock_all_mc_elements = true
|
||||
unlock_all_weapons = false
|
||||
unlock_all_weapons_max_level = false
|
||||
unlock_all_weapons_all_reson = false
|
||||
unlock_all_adventures = false
|
||||
unlock_all_functions = true
|
||||
unlock_all_guides = false
|
||||
unlock_all_tutorials = false
|
||||
unlock_all_teleporter = false
|
||||
unlock_all_role_skins = false
|
||||
# TODO: Set this to the same value as unlock_all_role_skins, without it, it fails(maybe jinshi weapon skin problem??)
|
||||
unlock_all_weapon_skins = false
|
||||
unlock_all_fly_skins = false
|
||||
unlock_all_wing_skins = false
|
1
wicked-waifus-game-server/scripts/watermask-disable.js
Normal file
1
wicked-waifus-game-server/scripts/watermask-disable.js
Normal file
|
@ -0,0 +1 @@
|
|||
require('../Module/WaterMask/WaterMaskController').WaterMaskView.EOo();
|
|
@ -1,41 +0,0 @@
|
|||
const UE = require("ue"),
|
||||
Info_1 = require("../../../Core/Common/Info"),
|
||||
MathUtils_1 = require("../../../Core/Utils/MathUtils"),
|
||||
EventDefine_1 = require("../../Common/Event/EventDefine"),
|
||||
EventSystem_1 = require("../../Common/Event/EventSystem"),
|
||||
UiControllerBase_1 = require("../../Ui/Base/UiControllerBase"),
|
||||
UiLayerType_1 = require("../../Ui/Define/UiLayerType"),
|
||||
UiLayer_1 = require("../../Ui/UiLayer");
|
||||
|
||||
var _a = require('../Module/WaterMask/WaterMaskController').WaterMaskView;
|
||||
_a.LOo = 0.18;
|
||||
_a.yOo = 700;
|
||||
_a.IOo = 700;
|
||||
_a.vOo = function () {
|
||||
void 0 !== _a.SOo && _a.EOo();
|
||||
var e = UiLayer_1.UiLayer.GetLayerRootUiItem(UiLayerType_1.ELayerType.WaterMask),
|
||||
t = (_a.SOo = UE.KuroActorManager.SpawnActor(Info_1.Info.World, UE.UIContainerActor.StaticClass(),
|
||||
MathUtils_1.MathUtils.DefaultTransform, void 0), _a.SOo.RootComponent),
|
||||
e = (t.SetDisplayName("WaterMaskContainer"), UE.KuroStaticLibrary.SetActorPermanent(_a.SOo, !0, !0), _a.SOo
|
||||
.K2_AttachRootComponentTo(e), t.GetRootCanvas().GetOwner().RootComponent),
|
||||
i = e.widget.width % _a.yOo / 2,
|
||||
r = e.widget.height % _a.IOo / 2,
|
||||
n = e.widget.width / 2,
|
||||
_ = e.widget.height / 2,
|
||||
s = Math.ceil(e.widget.width / _a.yOo),
|
||||
o = Math.ceil(e.widget.height / _a.IOo),
|
||||
v = " "; // EDIT ME!
|
||||
for (let a = 0; a < s; a++)
|
||||
for (let e = 0; e < o; e++) {
|
||||
var E = UE.KuroActorManager.SpawnActor(Info_1.Info.World, UE.UITextActor.StaticClass(), MathUtils_1
|
||||
.MathUtils.DefaultTransform, void 0),
|
||||
U = E.RootComponent,
|
||||
U = (E.K2_AttachRootComponentTo(t), U.SetDisplayName("WaterMaskText"), E.GetComponentByClass(UE
|
||||
.UIText.StaticClass()));
|
||||
U.SetFontSize(_a.vFt), U.SetOverflowType(0), U.SetAlpha(_a.LOo), U.SetFont(UE.LGUIFontData
|
||||
.GetDefaultFont()), U.SetText(v), U.SetUIRelativeLocation(new UE.Vector(a * _a.yOo - n + i, e *
|
||||
_a.IOo - _ + r, 0)), U.SetUIRelativeRotation(new UE.Rotator(0, _a.TOo, 0)), UE.KuroStaticLibrary
|
||||
.SetActorPermanent(E, !0, !0)
|
||||
}
|
||||
};
|
||||
_a.vOo();
|
|
@ -37,12 +37,18 @@ pub struct DefaultUnlocks {
|
|||
pub unlock_all_roles_max_level: bool,
|
||||
pub unlock_all_roles_all_sequences: bool,
|
||||
pub unlock_all_mc_elements: bool,
|
||||
pub unlock_all_weapons: bool, // TODO:
|
||||
pub unlock_all_weapons: bool,
|
||||
pub unlock_all_weapons_max_level: bool,
|
||||
pub unlock_all_weapons_all_reson: bool,
|
||||
pub unlock_all_adventures: bool,
|
||||
pub unlock_all_functions: bool,
|
||||
pub unlock_all_guides: bool,
|
||||
pub unlock_all_tutorials: bool,
|
||||
pub unlock_all_teleporter: bool,
|
||||
pub unlock_all_role_skins: bool,
|
||||
pub unlock_all_weapon_skins: bool,
|
||||
pub unlock_all_fly_skins: bool,
|
||||
pub unlock_all_wing_skins: bool,
|
||||
}
|
||||
|
||||
impl TomlConfig for ServiceConfig {
|
||||
|
|
|
@ -19,6 +19,7 @@ mod summoner;
|
|||
mod tag;
|
||||
mod visibility;
|
||||
mod vision_skill;
|
||||
mod weapon_skin;
|
||||
|
||||
pub use attribute::Attribute;
|
||||
pub use autonomous::Autonomous;
|
||||
|
@ -41,3 +42,4 @@ pub use summoner::Summoner;
|
|||
pub use tag::Tag;
|
||||
pub use visibility::Visibility;
|
||||
pub use vision_skill::VisionSkill;
|
||||
pub use weapon_skin::WeaponSkin;
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
use wicked_waifus_protocol::entity_component_pb::ComponentPb;
|
||||
use wicked_waifus_protocol::{EntityComponentPb, WeaponSkinComponentPb};
|
||||
use crate::logic::ecs::component::Component;
|
||||
|
||||
pub struct WeaponSkin {
|
||||
pub skin_id: i32,
|
||||
}
|
||||
|
||||
impl Component for WeaponSkin {
|
||||
fn set_pb_data(&self, pb: &mut wicked_waifus_protocol::EntityPb) {
|
||||
pb.component_pbs.push(EntityComponentPb {
|
||||
component_pb: Some(ComponentPb::WeaponSkinComponentPb(WeaponSkinComponentPb {
|
||||
weapon_skin_id: self.skin_id,
|
||||
})),
|
||||
})
|
||||
}
|
||||
}
|
|
@ -8,7 +8,8 @@ pub struct BufManager {
|
|||
recycled_handles: HashMap<i32, VecDeque<i32>>,
|
||||
}
|
||||
|
||||
const OVERRIDE_BUFFS: &[i64] = &[
|
||||
impl BufManager {
|
||||
const PERMANENT_ROLE_BUFFS: &'static [i64] = &[
|
||||
3003, // Remove wall run prohibition
|
||||
3004, // Remove gliding prohibition
|
||||
1213, // Reduce stamina while flying
|
||||
|
@ -16,26 +17,8 @@ const OVERRIDE_BUFFS: &[i64] = &[
|
|||
1215, // Reduce stamina while flying up in sprint
|
||||
1216, // Reduce stamina while flying down in sprint
|
||||
640012051, // Allow flying -> tag: 1151923109
|
||||
];
|
||||
];
|
||||
|
||||
const ROLE_OVERRIDES: &[(i32, &[i64])] = &[
|
||||
(1407, &[
|
||||
// ciaconna's forte buffs are completely fucked to get from an algorithm and i hate kuro!
|
||||
1407900003,
|
||||
1407500040,
|
||||
]),
|
||||
];
|
||||
|
||||
fn get_role_buff_overrides(role_id: i32) -> Option<&'static [i64]> {
|
||||
for &(role, buff) in ROLE_OVERRIDES {
|
||||
if role == role_id {
|
||||
return Some(buff);
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
impl BufManager {
|
||||
pub fn create(&mut self, buf: &mut FightBuffInformation) {
|
||||
let handle = self
|
||||
.recycled_handles
|
||||
|
@ -52,9 +35,7 @@ impl BufManager {
|
|||
|
||||
#[inline(always)]
|
||||
pub fn remove_entity_buffs(&mut self, entity_id: i64) {
|
||||
let handles = self
|
||||
.active_buf_set
|
||||
.iter()
|
||||
let handles = self.active_buf_set.iter()
|
||||
.filter(|(_, buff)| buff.entity_id == entity_id)
|
||||
.map(|(&handle, _)| handle)
|
||||
.collect::<Vec<_>>();
|
||||
|
@ -76,33 +57,13 @@ impl BufManager {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn create_permanent_buffs(&mut self, origin_id: i64, role_id: i32) -> Vec<FightBuffInformation> {
|
||||
let mut buffs = wicked_waifus_data::buff_data::iter().filter(|(id, buf)| {
|
||||
id.to_string().starts_with(&role_id.to_string()) // must be part of char kit :)
|
||||
&&
|
||||
!id.to_string().contains("666")// KURO IS EVIL
|
||||
&&
|
||||
buf.duration_policy == 1
|
||||
&&
|
||||
!buf.ge_desc.contains("【废弃】") // remove "deprecated" buffs
|
||||
})
|
||||
.map(|x| *x.0)
|
||||
.collect::<Vec<i64>>();
|
||||
|
||||
tracing::debug!("adding roleid {:#?}", buffs);
|
||||
|
||||
buffs.extend(OVERRIDE_BUFFS.iter().copied());
|
||||
if let Some(role_buff_overrides) = get_role_buff_overrides(role_id) {
|
||||
buffs.extend(role_buff_overrides.iter().copied());
|
||||
}
|
||||
buffs.dedup();
|
||||
|
||||
buffs
|
||||
pub fn create_permanent_buffs(&mut self, origin_id: i64) -> Vec<FightBuffInformation> {
|
||||
Self::PERMANENT_ROLE_BUFFS
|
||||
.iter()
|
||||
.map(|id| {
|
||||
.map(|&id| {
|
||||
let mut buff = FightBuffInformation {
|
||||
handle_id: 0,
|
||||
buff_id: *id,
|
||||
buff_id: id,
|
||||
level: 1,
|
||||
stack_count: 1,
|
||||
instigator_id: origin_id,
|
||||
|
@ -120,26 +81,6 @@ impl BufManager {
|
|||
})
|
||||
.collect::<Vec<_>>()
|
||||
}
|
||||
|
||||
pub fn create_buff(&mut self, origin_id: i64, buff_id: i64) -> FightBuffInformation {
|
||||
let mut buff = FightBuffInformation {
|
||||
handle_id: 0,
|
||||
buff_id,
|
||||
level: 1,
|
||||
stack_count: 1,
|
||||
instigator_id: origin_id,
|
||||
entity_id: origin_id,
|
||||
apply_type: 0,
|
||||
duration: -1f32,
|
||||
left_duration: -1f32,
|
||||
context: vec![],
|
||||
is_active: true,
|
||||
server_id: 0,
|
||||
message_id: 0,
|
||||
};
|
||||
self.create(&mut buff);
|
||||
buff
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for BufManager {
|
||||
|
|
|
@ -44,6 +44,7 @@ impl_component_container! {
|
|||
Summoner;
|
||||
SoarWingSkin;
|
||||
ParaglidingSkin;
|
||||
WeaponSkin;
|
||||
}
|
||||
|
||||
pub trait Component {
|
||||
|
|
|
@ -7,7 +7,6 @@ use std::collections::hash_map::{Keys, Values};
|
|||
use std::collections::HashMap;
|
||||
use wicked_waifus_protocol::FightBuffInformation;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct WorldEntity {
|
||||
components: HashMap<i32, Vec<RefCell<ComponentContainer>>>,
|
||||
entity_manager: EntityManager,
|
||||
|
@ -108,15 +107,21 @@ impl WorldEntity {
|
|||
self.components.remove(&entity_id).is_some() && self.entity_manager.remove(entity_id)
|
||||
}
|
||||
|
||||
pub fn get_all_entity_ids(&mut self) -> Vec<i32> {
|
||||
self.entity_manager.get_all_entity_id()
|
||||
pub fn active_entity_empty(&self) -> bool {
|
||||
self.entity_manager.active_entity_empty()
|
||||
}
|
||||
|
||||
pub fn generate_role_permanent_buffs(&mut self, entity_id: i32, role_id: i32) -> Vec<FightBuffInformation> {
|
||||
self.buff_manager.create_permanent_buffs(entity_id as i64, role_id)
|
||||
}
|
||||
|
||||
pub fn create_buff(&mut self, entity_id: i32, buff_id: i64) -> FightBuffInformation {
|
||||
self.buff_manager.create_buff(entity_id as i64, buff_id)
|
||||
pub fn generate_role_permanent_buffs(&mut self, entity_id: i64) -> Vec<FightBuffInformation> {
|
||||
self.buff_manager.create_permanent_buffs(entity_id)
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for WorldEntity {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
components: HashMap::new(),
|
||||
entity_manager: EntityManager::default(),
|
||||
buff_manager: BufManager::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,7 +113,13 @@ impl GachaPool {
|
|||
match player.role_list.get(&item_id) {
|
||||
None => {
|
||||
if required_role_ids.contains(&item_id) {
|
||||
player.role_list.insert(item_id, Role::new(item_id));
|
||||
let role = Role::new(item_id);
|
||||
let role_id = role.role_id;
|
||||
let weapon_id = role.equip_weapon;
|
||||
player.role_list.insert(item_id, role);
|
||||
// TODO notifies player update
|
||||
player.inventory.add_weapon(role_id, 0, 1, 0, 0, 0, weapon_id).unwrap();
|
||||
// TODO notifies weapon update
|
||||
}
|
||||
}
|
||||
Some(role) => {
|
||||
|
|
|
@ -1,255 +0,0 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use wicked_waifus_protocol::{
|
||||
CommonTagData, EntityCommonTagNotify, EntityStateReadyNotify, FightBuffInformation, ItemRewardNotify, NormalItemUpdateNotify, RewardItemInfo, WR
|
||||
};
|
||||
|
||||
use wicked_waifus_data::pb_components::action::{
|
||||
AddBuffToEntity, AddBuffToPlayer, ChangeSelfEntityState, CollectParams, RemoveBuffFromEntity, RemoveBuffFromPlayer, UnlockTeleportTrigger
|
||||
};
|
||||
use wicked_waifus_data::pb_components::entity_state::EntityStateComponent;
|
||||
|
||||
use crate::logic::ecs::component::ComponentContainer;
|
||||
use crate::logic::ecs::world::WorldEntity;
|
||||
use crate::logic::handler::handle_action;
|
||||
use crate::logic::player::{ItemUsage, Player};
|
||||
use crate::logic::utils::tag_utils;
|
||||
use crate::query_components;
|
||||
|
||||
pub fn collect_action(
|
||||
player: &mut Player,
|
||||
_entity_id: i64,
|
||||
level_entity_data: &wicked_waifus_data::LevelEntityConfigData,
|
||||
template_config: &wicked_waifus_data::TemplateConfigData,
|
||||
_: CollectParams
|
||||
) {
|
||||
if let Some(reward_component) = level_entity_data
|
||||
.components_data
|
||||
.reward_component
|
||||
.as_ref()
|
||||
.or(template_config.components_data.reward_component.as_ref())
|
||||
{
|
||||
if reward_component.disabled.unwrap_or(false) {
|
||||
return;
|
||||
}
|
||||
// TODO: check the use of reward_type and drop_on_event
|
||||
// Seems type 0 is reward from preview, while 1 and 2 is unknown
|
||||
if let Some(reward_id) = reward_component.reward_id {
|
||||
let drop = wicked_waifus_data::drop_package_data::get(&reward_id).unwrap();
|
||||
let usages = drop
|
||||
.drop_preview
|
||||
.iter()
|
||||
.map(|(&id, &quantity)| ItemUsage { id, quantity })
|
||||
.collect::<Vec<_>>();
|
||||
let updated_items = player.inventory.add_items(&usages);
|
||||
let normal_item_list = player
|
||||
.inventory
|
||||
.to_normal_item_list_filtered(updated_items.keys().cloned().collect::<Vec<i32>>());
|
||||
player.notify(NormalItemUpdateNotify {
|
||||
normal_item_list,
|
||||
no_tips: false,
|
||||
});
|
||||
// UpdateHandBookActiveStateMapNotify
|
||||
let mut rewards: HashMap<i32, WR> = HashMap::new();
|
||||
rewards.insert(
|
||||
0,
|
||||
WR {
|
||||
item_list: drop
|
||||
.drop_preview
|
||||
.iter()
|
||||
.map(|(&id, &quantity)| RewardItemInfo {
|
||||
show_plan_id: 0, // TODO: Check how to get this
|
||||
item_id: id,
|
||||
count: quantity,
|
||||
incr_id: 0,
|
||||
})
|
||||
.collect::<Vec<_>>(),
|
||||
},
|
||||
);
|
||||
player.notify(ItemRewardNotify {
|
||||
drop_id: reward_id,
|
||||
reason: 15000,
|
||||
magnification: 1,
|
||||
reward_items: rewards,
|
||||
});
|
||||
}
|
||||
// TODO: Should we remove entity?? get pcap
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn unlock_teleport_trigger_action(
|
||||
player: &mut Player,
|
||||
_entity_id: i64,
|
||||
_level_entity_data: &wicked_waifus_data::LevelEntityConfigData,
|
||||
_template_config: &wicked_waifus_data::TemplateConfigData,
|
||||
action: UnlockTeleportTrigger
|
||||
) {
|
||||
player.unlock_teleport(action.teleport_id)
|
||||
}
|
||||
|
||||
pub fn change_self_entity_state_action(
|
||||
player: &mut Player,
|
||||
entity_id: i64,
|
||||
level_entity_data: &wicked_waifus_data::LevelEntityConfigData,
|
||||
template_config: &wicked_waifus_data::TemplateConfigData,
|
||||
action: ChangeSelfEntityState,
|
||||
) {
|
||||
let state = tag_utils::get_tag_id_by_name(action.entity_state.as_str());
|
||||
|
||||
// TODO: update Tag::CommonEntityTags too??
|
||||
let old_state = {
|
||||
let world_ref = player.world.borrow();
|
||||
let world = world_ref.get_world_entity();
|
||||
let mut state_tag = query_components!(world, entity_id, StateTag).0.unwrap();
|
||||
let old_state = state_tag.state_tag_id;
|
||||
tracing::debug!("ChangeSelfEntityState: old state {old_state} -> new state: {state}");
|
||||
state_tag.state_tag_id = state;
|
||||
old_state
|
||||
};
|
||||
|
||||
if let Some(entity_state_component) = level_entity_data
|
||||
.components_data
|
||||
.entity_state_component
|
||||
.as_ref()
|
||||
.or(template_config
|
||||
.components_data
|
||||
.entity_state_component
|
||||
.as_ref())
|
||||
.cloned()
|
||||
{
|
||||
let entity_state_component: EntityStateComponent = entity_state_component; // TODO: Remove this line, used for casting only
|
||||
|
||||
// TODO: implement rest of cases
|
||||
if let Some(state_change_behaviors) = entity_state_component.state_change_behaviors {
|
||||
for state_change_behavior in state_change_behaviors {
|
||||
// TODO: implement rest of cases
|
||||
let expected = tag_utils::get_tag_id_by_name(state_change_behavior.state.as_str());
|
||||
|
||||
if expected == state {
|
||||
if let Some(actions) = state_change_behavior.action {
|
||||
for sub in actions {
|
||||
handle_action(
|
||||
player,
|
||||
entity_id,
|
||||
level_entity_data,
|
||||
template_config,
|
||||
sub,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
player.notify(EntityCommonTagNotify {
|
||||
id: entity_id,
|
||||
tags: vec![
|
||||
CommonTagData {
|
||||
tag_id: old_state,
|
||||
remove_tag_ids: false,
|
||||
}, // Remove
|
||||
CommonTagData {
|
||||
tag_id: state,
|
||||
remove_tag_ids: true,
|
||||
}, // Add
|
||||
],
|
||||
});
|
||||
|
||||
player.notify(EntityStateReadyNotify {
|
||||
entity_id,
|
||||
tag_id: state,
|
||||
ready: true, // TODO: Always true? or shall we compare it to something??
|
||||
});
|
||||
}
|
||||
|
||||
fn add_buff_to_entity(
|
||||
world: &mut WorldEntity,
|
||||
entity_ids: Vec<i64>,
|
||||
buff_ids: Vec<i64>,
|
||||
) {
|
||||
for entity_id in entity_ids {
|
||||
let (Some(mut buff_component),) = query_components!(world, entity_id, FightBuff) else {
|
||||
continue;
|
||||
};
|
||||
|
||||
for buff_id in &buff_ids {
|
||||
buff_component.fight_buff_infos.push(FightBuffInformation {
|
||||
handle_id: 1,
|
||||
buff_id: *buff_id,
|
||||
level: 1,
|
||||
stack_count: 1,
|
||||
instigator_id: 0,
|
||||
entity_id: 0,
|
||||
apply_type: 0,
|
||||
duration: -1.0,
|
||||
left_duration: -1.0,
|
||||
context: vec![],
|
||||
is_active: true,
|
||||
server_id: 1,
|
||||
message_id: 1,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_buff_to_entity_action(
|
||||
player: &mut Player,
|
||||
entity_id: i64,
|
||||
level_entity_data: &wicked_waifus_data::LevelEntityConfigData,
|
||||
template_config: &wicked_waifus_data::TemplateConfigData,
|
||||
params: AddBuffToEntity
|
||||
) {
|
||||
tracing::info!("entity buff request received with the following details: {:#?}.", params);
|
||||
let mut world_ref = player.world.borrow_mut();
|
||||
let world = world_ref.get_mut_world_entity();
|
||||
|
||||
match params {
|
||||
AddBuffToEntity::SingleEntityBuffs(single_entity_buffs) => {
|
||||
add_buff_to_entity(world, vec![single_entity_buffs.entity_id], single_entity_buffs.buff_ids)
|
||||
},
|
||||
AddBuffToEntity::MultipleEntitiesBuff(multiple_entities_buff) => {
|
||||
add_buff_to_entity(world, multiple_entities_buff.entity_ids, multiple_entities_buff.buff_ids)
|
||||
},
|
||||
AddBuffToEntity::SelfEntityBuff(self_entity_buff) => {
|
||||
add_buff_to_entity(world, vec![entity_id], self_entity_buff.buff_ids)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub fn remove_buff_from_entity_action(
|
||||
player: &mut Player,
|
||||
entity_id: i64,
|
||||
level_entity_data: &wicked_waifus_data::LevelEntityConfigData,
|
||||
template_config: &wicked_waifus_data::TemplateConfigData,
|
||||
params: RemoveBuffFromEntity
|
||||
) {
|
||||
tracing::info!("entity buff request received with the following details: {:#?}.", params);
|
||||
let mut world_ref = player.world.borrow_mut();
|
||||
let world = world_ref.get_mut_world_entity();
|
||||
}
|
||||
|
||||
pub fn add_buff_to_player_action(
|
||||
player: &mut Player,
|
||||
entity_id: i64,
|
||||
level_entity_data: &wicked_waifus_data::LevelEntityConfigData,
|
||||
template_config: &wicked_waifus_data::TemplateConfigData,
|
||||
params: AddBuffToPlayer
|
||||
) {
|
||||
tracing::info!("entity buff request received with the following details: {:#?}.", params);
|
||||
let mut world_ref = player.world.borrow_mut();
|
||||
let world = world_ref.get_mut_world_entity();
|
||||
}
|
||||
|
||||
pub fn remove_buff_from_player_action(
|
||||
player: &mut Player,
|
||||
entity_id: i64,
|
||||
level_entity_data: &wicked_waifus_data::LevelEntityConfigData,
|
||||
template_config: &wicked_waifus_data::TemplateConfigData,
|
||||
params: RemoveBuffFromPlayer
|
||||
) {
|
||||
tracing::info!("entity buff request received with the following details: {:#?}.", params);
|
||||
let mut world_ref = player.world.borrow_mut();
|
||||
let world = world_ref.get_mut_world_entity();
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
use wicked_waifus_protocol::{AttributeChangedRequest, AttributeChangedResponse, EAttributeType, ErrorCode, FormationAttrRequest, FormationAttrResponse};
|
||||
|
||||
use crate::{logic::{ecs::component::ComponentContainer, player::Player}, query_components};
|
||||
|
||||
pub fn on_attribute_changed_request(
|
||||
player: &mut Player,
|
||||
request: AttributeChangedRequest,
|
||||
response: &mut AttributeChangedResponse,
|
||||
) {
|
||||
let mut world_ref = player.world.borrow_mut();
|
||||
let world = world_ref.get_mut_world_entity();
|
||||
|
||||
let id = request.id;
|
||||
|
||||
if let (Some(mut component),) = query_components!(world, id, Attribute) {
|
||||
for needs_editing in request.attributes {
|
||||
if let Ok(attr_type) = EAttributeType::try_from(needs_editing.attribute_type) {
|
||||
component.attr_map.get_mut(&attr_type).unwrap().0 = needs_editing.current_value;
|
||||
component.attr_map.get_mut(&attr_type).unwrap().1 = needs_editing.value_increment;
|
||||
} else {
|
||||
tracing::warn!("Attribute skipped!");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
response.error_code = ErrorCode::Success.into()
|
||||
} else {
|
||||
response.error_code = ErrorCode::ErrEntityNotFound.into()
|
||||
};
|
||||
}
|
||||
|
||||
pub fn on_formation_attr_request(
|
||||
player: &mut Player,
|
||||
request: FormationAttrRequest,
|
||||
response: &mut FormationAttrResponse,
|
||||
) {
|
||||
let mut world_ref = player.world.borrow_mut();
|
||||
let world = world_ref.get_mut_world_entity();
|
||||
|
||||
let formation = &player.formation_list[&player.cur_formation_id];
|
||||
|
||||
for role_id in formation.role_ids.clone() {
|
||||
if let (Some(mut component),) = query_components!(world, role_id as i64, Attribute) {
|
||||
for needs_editing in &request.formation_attrs {
|
||||
if let Ok(attr_type) = EAttributeType::try_from(needs_editing.attr_id) {
|
||||
component.attr_map.get_mut(&attr_type).unwrap().0 = needs_editing.current_value;
|
||||
component.attr_map.get_mut(&attr_type).unwrap().1 = needs_editing.max_value;
|
||||
} else {
|
||||
tracing::warn!("Attribute skipped!");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
response.error_code = ErrorCode::Success.into()
|
||||
} else {
|
||||
response.error_code = ErrorCode::ErrEntityNotFound.into()
|
||||
};
|
||||
}
|
||||
}
|
|
@ -160,38 +160,38 @@ fn handle_damage_execute_request(
|
|||
..Default::default()
|
||||
}),
|
||||
));
|
||||
// if let Some((value, _)) = query_components!(world, request.target_entity_id, Attribute)
|
||||
// .0
|
||||
// .unwrap()
|
||||
// .attr_map
|
||||
// .get(&EAttributeType::Life)
|
||||
// {
|
||||
// let updated_value = match value - damage >= 0 {
|
||||
// true => value - damage,
|
||||
// false => 0,
|
||||
// };
|
||||
// receive_pack.data.push(create_combat_notify(
|
||||
// CombatCommon {
|
||||
// entity_id: request.target_entity_id,
|
||||
// ..Default::default()
|
||||
// },
|
||||
// combat_notify_data::Message::AttributeChangedNotify(AttributeChangedNotify {
|
||||
// id: request.target_entity_id,
|
||||
// attributes: vec![GameplayAttributeData {
|
||||
// current_value: updated_value,
|
||||
// value_increment: updated_value,
|
||||
// attribute_type: EAttributeType::Life.into(),
|
||||
// }],
|
||||
// }),
|
||||
// ));
|
||||
// if updated_value == 0 {
|
||||
// world_util::remove_entity(
|
||||
// player,
|
||||
// request.target_entity_id,
|
||||
// ERemoveEntityType::HpIsZero,
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
if let Some((value, _)) = query_components!(world, request.target_entity_id, Attribute)
|
||||
.0
|
||||
.unwrap()
|
||||
.attr_map
|
||||
.get(&EAttributeType::Life)
|
||||
{
|
||||
let updated_value = match value - damage >= 0 {
|
||||
true => value - damage,
|
||||
false => 0,
|
||||
};
|
||||
receive_pack.data.push(create_combat_notify(
|
||||
CombatCommon {
|
||||
entity_id: request.target_entity_id,
|
||||
..Default::default()
|
||||
},
|
||||
combat_notify_data::Message::AttributeChangedNotify(AttributeChangedNotify {
|
||||
id: request.target_entity_id,
|
||||
attributes: vec![GameplayAttributeData {
|
||||
current_value: updated_value,
|
||||
value_increment: updated_value,
|
||||
attribute_type: EAttributeType::Life.into(),
|
||||
}],
|
||||
}),
|
||||
));
|
||||
if updated_value == 0 {
|
||||
world_util::remove_entity(
|
||||
player,
|
||||
request.target_entity_id,
|
||||
ERemoveEntityType::HpIsZero,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@ dummy_handler! {
|
|||
ExchangeReward;
|
||||
Liveness;
|
||||
PhotoMemory;
|
||||
WeaponSkin;
|
||||
VisionEquipGroupInfo;
|
||||
UpdatePlayStationBlockAccount;
|
||||
AdventureManual;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use wicked_waifus_protocol::{ApplyGameplayEffectPush, ApplyGameplayEffectRequest, ApplyGameplayEffectResponse, EntityAccessInfo, EntityAccessRangeRequest, EntityAccessRangeResponse, EntityActiveRequest, EntityActiveResponse, EntityFollowTrackRequest, EntityFollowTrackResponse, EntityInteractRequest, EntityInteractResponse, EntityOnLandedRequest, EntityOnLandedResponse, EntityPb, EntityPositionRequest, EntityPositionResponse, ErrorCode, GetRewardTreasureBoxRequest, GetRewardTreasureBoxResponse, MovePackagePush, OrderApplyBuffRequest, OrderApplyBuffResponse, OrderRemoveBuffRequest, OrderRemoveBuffResponse, RemoveGameplayEffectPush, RemoveGameplayEffectRequest, RemoveGameplayEffectResponse};
|
||||
use wicked_waifus_protocol::{EntityAccessInfo, EntityAccessRangeRequest, EntityAccessRangeResponse, EntityActiveRequest, EntityActiveResponse, EntityFollowTrackRequest, EntityFollowTrackResponse, EntityInteractRequest, EntityInteractResponse, EntityOnLandedRequest, EntityOnLandedResponse, EntityPb, EntityPositionRequest, EntityPositionResponse, ErrorCode, GetRewardTreasureBoxRequest, GetRewardTreasureBoxResponse, MovePackagePush};
|
||||
|
||||
use wicked_waifus_data::pb_components::option::OptionType;
|
||||
|
||||
use crate::logic::handler::handle_action;
|
||||
use crate::{logic, logic::ecs::component::ComponentContainer, logic::player::Player, query_components};
|
||||
use crate::logic::utils::action_utils::perform_action;
|
||||
use crate::logic::utils::condition_utils::check_condition;
|
||||
|
||||
pub fn on_entity_active_request(
|
||||
|
@ -190,7 +190,7 @@ pub fn on_entity_interact_request(
|
|||
match option_type {
|
||||
OptionType::Actions(actions) => {
|
||||
for action in actions.actions {
|
||||
handle_action(player, request.entity_id, &entity, template_config, action);
|
||||
perform_action(player, request.entity_id, &entity, template_config, action);
|
||||
}
|
||||
}
|
||||
OptionType::Flow(_) => {
|
||||
|
@ -234,52 +234,6 @@ pub fn on_get_reward_treasure_box_request(
|
|||
tracing::debug!("GetRewardTreasureBoxRequest with ID: {} and ConfigID {config_id}", request.entity_id);
|
||||
}
|
||||
|
||||
pub fn on_order_apply_buff_request(
|
||||
player: &Player,
|
||||
request: OrderApplyBuffRequest,
|
||||
_response: &mut OrderApplyBuffResponse,
|
||||
) {
|
||||
tracing::info!("OrderApplyBuffRequest receuived");
|
||||
}
|
||||
|
||||
pub fn on_order_remove_buff_request(
|
||||
player: &Player,
|
||||
request: OrderRemoveBuffRequest,
|
||||
_response: &mut OrderRemoveBuffResponse,
|
||||
) {
|
||||
tracing::info!("OrderRemoveBuffRequest receuived");
|
||||
}
|
||||
|
||||
pub fn on_apply_gameplay_effect_request(
|
||||
player: &Player,
|
||||
request: ApplyGameplayEffectRequest,
|
||||
response: &mut ApplyGameplayEffectResponse
|
||||
) {
|
||||
tracing::info!("applygameplayeffect receuived");
|
||||
}
|
||||
|
||||
pub fn on_apply_gameplay_effect_push(
|
||||
player: &Player,
|
||||
push: ApplyGameplayEffectPush
|
||||
) {
|
||||
tracing::info!("applygameplayeffect receuived");
|
||||
}
|
||||
|
||||
pub fn on_remove_gameplay_effect_request(
|
||||
player: &Player,
|
||||
request: RemoveGameplayEffectRequest,
|
||||
response: &mut RemoveGameplayEffectResponse
|
||||
) {
|
||||
tracing::info!("applygameplayeffect receuived");
|
||||
}
|
||||
|
||||
pub fn on_remove_gameplay_effect_push(
|
||||
player: &Player,
|
||||
push: RemoveGameplayEffectPush
|
||||
) {
|
||||
tracing::info!("applygameplayeffect receuived");
|
||||
}
|
||||
|
||||
fn get_config_id_from_entity_id(player: &Player, entity_id: i64) -> i64 {
|
||||
let world_ref = player.world.borrow();
|
||||
let world = world_ref.get_world_entity();
|
||||
|
|
|
@ -12,12 +12,11 @@ pub fn on_normal_item_request(
|
|||
}
|
||||
|
||||
pub fn on_weapon_item_request(
|
||||
_player: &mut Player,
|
||||
player: &mut Player,
|
||||
_: WeaponItemRequest,
|
||||
_response: &mut WeaponItemResponse,
|
||||
response: &mut WeaponItemResponse,
|
||||
) {
|
||||
// TODO: Implement this
|
||||
tracing::warn!("Unhandled WeaponItemRequest");
|
||||
response.weapon_item_list = player.inventory.to_weapon_item_list();
|
||||
}
|
||||
|
||||
pub fn on_phantom_item_request(
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
pub use action::*;
|
||||
pub use attribute::*;
|
||||
pub use advice::*;
|
||||
pub use animal::*;
|
||||
pub use chat::*;
|
||||
|
@ -21,9 +19,8 @@ use wicked_waifus_protocol::message::Message;
|
|||
pub use skill::*;
|
||||
pub use teleport::*;
|
||||
pub use tutorial::*;
|
||||
pub use weapon::*;
|
||||
|
||||
mod action;
|
||||
mod attribute;
|
||||
mod advice;
|
||||
mod animal;
|
||||
mod chat;
|
||||
|
@ -44,6 +41,7 @@ mod scene;
|
|||
mod skill;
|
||||
mod teleport;
|
||||
mod tutorial;
|
||||
mod weapon;
|
||||
|
||||
macro_rules! handle_request {
|
||||
($($name:ident $(, $inner_package:ident)?;)*) => {
|
||||
|
@ -59,7 +57,7 @@ macro_rules! handle_request {
|
|||
return;
|
||||
};
|
||||
|
||||
// tracing::debug!("logic: processing request {}", stringify!($($inner_package::)?[<$name Request>]));
|
||||
tracing::debug!("logic: processing request {}", stringify!($($inner_package::)?[<$name Request>]));
|
||||
|
||||
let mut response = ::wicked_waifus_protocol::$($inner_package::)?[<$name Response>]::default();
|
||||
[<on_ $($inner_package:snake _)? $name:snake _request>](player, request, &mut response);
|
||||
|
@ -114,40 +112,6 @@ macro_rules! handle_push {
|
|||
};
|
||||
}
|
||||
|
||||
macro_rules! handle_action {
|
||||
($($variant:ident),* $(,)?) => {
|
||||
use wicked_waifus_data::pb_components::action::Action;
|
||||
use crate::logic::player::Player;
|
||||
|
||||
fn perform_action(
|
||||
player: &mut Player,
|
||||
entity_id: i64,
|
||||
level_entity_data: &wicked_waifus_data::LevelEntityConfigData,
|
||||
template_config: &wicked_waifus_data::TemplateConfigData,
|
||||
action: Action
|
||||
) {
|
||||
::paste::paste! {
|
||||
match action {
|
||||
$(
|
||||
Action::$variant(inner) => {
|
||||
[<$variant:snake _action>](
|
||||
player,
|
||||
entity_id,
|
||||
level_entity_data,
|
||||
template_config,
|
||||
inner.params
|
||||
)
|
||||
},
|
||||
)*
|
||||
_ => {
|
||||
::tracing::warn!("Action not implemented for: {:?}", action);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
handle_request! {
|
||||
// Advice
|
||||
Advice;
|
||||
|
@ -158,10 +122,6 @@ handle_request! {
|
|||
AnimalDrop;
|
||||
AnimalDestroy;
|
||||
|
||||
// Attribute
|
||||
AttributeChanged;
|
||||
FormationAttr;
|
||||
|
||||
// Chat (TODO: Review TODOs)
|
||||
PrivateChat;
|
||||
PrivateChatData;
|
||||
|
@ -183,10 +143,6 @@ handle_request! {
|
|||
EntityInteract;
|
||||
EntityFollowTrack;
|
||||
GetRewardTreasureBox;
|
||||
OrderApplyBuff;
|
||||
OrderRemoveBuff;
|
||||
ApplyGameplayEffect;
|
||||
RemoveGameplayEffect;
|
||||
|
||||
// Friend (TODO: Implement them)
|
||||
FriendAll;
|
||||
|
@ -244,14 +200,21 @@ handle_request! {
|
|||
RoleShowListUpdate;
|
||||
ClientCurrentRoleReport;
|
||||
RoleFavorList;
|
||||
FormationAttr;
|
||||
UpdateFormation;
|
||||
UnlockRoleSkinList;
|
||||
RoleSkinChange;
|
||||
FlySkinWear;
|
||||
FlySkinWearAllRole;
|
||||
RoleLevelUpView;
|
||||
PbUpLevelRole;
|
||||
RoleBreakThroughView;
|
||||
|
||||
// Scene (TODO: Review this on_..., port some from go)
|
||||
SceneTrace;
|
||||
SceneLoadingFinish;
|
||||
UpdateSceneDate;
|
||||
AccessPathTimeServerConfig;
|
||||
UnlockRoleSkinList;
|
||||
PlayerHeadData;
|
||||
|
||||
// Shop (TODO: Review this on_..., port some from go)
|
||||
|
@ -282,6 +245,12 @@ handle_request! {
|
|||
TutorialReceive;
|
||||
TutorialUnlock;
|
||||
|
||||
// Weapon
|
||||
WeaponSkin;
|
||||
EquipWeaponSkin;
|
||||
SendEquipSkin;
|
||||
EquipTakeOn;
|
||||
|
||||
// TODO: Implement all this properly, workaround for game enter
|
||||
EntityPatrolStop;
|
||||
InitRange;
|
||||
|
@ -309,7 +278,6 @@ handle_request! {
|
|||
Liveness;
|
||||
WebSign;
|
||||
PhotoMemory;
|
||||
WeaponSkin;
|
||||
VisionEquipGroupInfo;
|
||||
UpdatePlayStationBlockAccount;
|
||||
AdventureManual;
|
||||
|
@ -325,200 +293,10 @@ handle_push! {
|
|||
// Entity
|
||||
MovePackage;
|
||||
|
||||
ApplyGameplayEffect;
|
||||
RemoveGameplayEffect;
|
||||
|
||||
// Misc
|
||||
VersionInfo;
|
||||
}
|
||||
|
||||
handle_action! {
|
||||
// ExecBattleAction,
|
||||
// WaitBattleCondition,
|
||||
// SetBattleState,
|
||||
// PlayFlow,
|
||||
Collect,
|
||||
// LeisureInteract,
|
||||
UnlockTeleportTrigger,
|
||||
// EnableTemporaryTeleport,
|
||||
// OpenSystemBoard,
|
||||
// OpenSystemFunction,
|
||||
ChangeSelfEntityState,
|
||||
// SetPlayerOperationRestriction,
|
||||
// Wait,
|
||||
// ChangeEntityState,
|
||||
// Log,
|
||||
// EnableNearbyTracking,
|
||||
// TeleportDungeon,
|
||||
// DestroySelf,
|
||||
// CameraLookAt,
|
||||
// StopCameraLookAt,
|
||||
// EnterOrbitalCamera,
|
||||
// ExitOrbitalCamera,
|
||||
// SendAiEvent,
|
||||
// SetInteractionLockState,
|
||||
// AwakeEntity,
|
||||
// ChangeLiftTarget,
|
||||
// CalculateVar,
|
||||
AddBuffToPlayer,
|
||||
RemoveBuffFromPlayer,
|
||||
AddBuffToEntity,
|
||||
RemoveBuffFromEntity,
|
||||
// Prompt,
|
||||
// SetEntityVisible,
|
||||
// DestroyEntity,
|
||||
// GuideTrigger,
|
||||
// TriggerCameraShake,
|
||||
// SetVar,
|
||||
// VehicleEnter,
|
||||
// VehicleExitPlayer,
|
||||
// LockEntity,
|
||||
// UnlockEntity,
|
||||
// CommonTip,
|
||||
// CommonTip2,
|
||||
// PostAkEvent,
|
||||
// VehicleEnterNpc,
|
||||
// VehicleExitNpc,
|
||||
// PlayerLookAt,
|
||||
// PlayBubble,
|
||||
// AddPlayBubble,
|
||||
// ClearPlayBubble,
|
||||
// ExecRiskHarvestEffect,
|
||||
// EnableLevelPlay,
|
||||
// ClaimLevelPlayReward,
|
||||
// SettlementDungeon,
|
||||
// ExitDungeon,
|
||||
// FinishDungeon,
|
||||
// RecordDungeonEvent,
|
||||
// RecoverDurability,
|
||||
// FadeInScreen,
|
||||
// FadeOutScreen,
|
||||
// ChangeNpcPerformState,
|
||||
// EntityTurnTo,
|
||||
// EntityLookAt,
|
||||
// ToggleMapMarkState,
|
||||
// RandomVar,
|
||||
// ModifySceneItemAttributeTag,
|
||||
// VehicleWaterfallClimbing,
|
||||
// VehicleTeleport,
|
||||
// RogueGotoNextFloor,
|
||||
// RogueReceiveReward,
|
||||
// RogueSelectRoom,
|
||||
// RogueActivatePortal,
|
||||
// MowingTowerGotoNextFloor,
|
||||
// SlashAndTowerGotoNextFloor,
|
||||
// PlayMontage,
|
||||
// OpenSystemBoardWithReturn,
|
||||
// UnlockSystemItem,
|
||||
// SetSportsState,
|
||||
// OpenSimpleGameplay,
|
||||
// PlayEffect,
|
||||
// PlayEffect2,
|
||||
// RestorePlayerCameraAdjustment,
|
||||
// AdjustPlayerCamera,
|
||||
// SetPlayerPos,
|
||||
// MoveWithSpline,
|
||||
// EnableSplineMoveModel,
|
||||
// ToggleScanSplineEffect,
|
||||
// MoveSceneItem,
|
||||
// StopSceneItemMove,
|
||||
// FireBullet,
|
||||
// ClearFishingCabinInSaleItems,
|
||||
// AcceptFishingEntrust,
|
||||
// DestroyFishingBoat,
|
||||
// SetJigsawItem,
|
||||
// SetJigsawFoundation,
|
||||
// SetTeleControl,
|
||||
// SetEntityClientVisible,
|
||||
// ToggleHighlightExploreUi,
|
||||
// ExecAlertSystemAction,
|
||||
// AddFlowInteractOption,
|
||||
// RemoveFlowInteractOption,
|
||||
// EnableHostility,
|
||||
// ChangePhantomFormation,
|
||||
// RestorePhantomFormation,
|
||||
// ChangeTimer,
|
||||
// ToggleTimerPauseState,
|
||||
// ChangeFightTeam,
|
||||
// AddTrialFollowShooter,
|
||||
// RemoveTrialFollowShooter,
|
||||
// AddTrialCharacter,
|
||||
// RemoveTrialCharacter,
|
||||
// SetAreaState,
|
||||
// SwitchSubLevels,
|
||||
// ChangeTeamPosition,
|
||||
// GetItem,
|
||||
// CreatePrefab,
|
||||
// DestroyPrefab,
|
||||
// CompleteGuide,
|
||||
// PlayDynamicSettlement,
|
||||
// UsePhantomSkill,
|
||||
// HideTargetRange,
|
||||
// ChangeOtherState,
|
||||
// SetRegionConfig,
|
||||
// SetReviveRegion,
|
||||
// ExecResurrection,
|
||||
// ShowTargetRange,
|
||||
// SetTime,
|
||||
// SetTimeLockState,
|
||||
// EnableSystem,
|
||||
// EnableAoiNotify,
|
||||
// SetForceLock,
|
||||
// PlayRegisteredMontage,
|
||||
// SetAudioState,
|
||||
// HideGroup,
|
||||
// ShowHidedGroup,
|
||||
// HideSpecificEntities,
|
||||
// ShowSpecificEntities,
|
||||
// RemovePreloadResource,
|
||||
// Preload,
|
||||
// EnableAI,
|
||||
// SwitchDataLayers,
|
||||
// DestroyQuest,
|
||||
// DestroyQuestItem,
|
||||
// PromptQuestChapterUI,
|
||||
// TakePlotPhoto,
|
||||
// SetWuYinQuState,
|
||||
// RunActions,
|
||||
// ManualOccupations,
|
||||
// SetWeather,
|
||||
// SendNpcMail,
|
||||
// EnableFunction,
|
||||
// FocusOnMapMark,
|
||||
// CharacterLookAt,
|
||||
// AddGuestCharacter,
|
||||
// RemoveGuestCharacter,
|
||||
// TeleportToAndEnterVehicle,
|
||||
// SetAreaTimeState,
|
||||
// ResetPlayerCameraFocus,
|
||||
// ResetLevelPlay,
|
||||
// VehicleSprint,
|
||||
// VehicleMoveWithPathLine,
|
||||
// ClientPreEnableSubLevels,
|
||||
// GuestOperateUiAnimation,
|
||||
// ChangeEntityCamp,
|
||||
// NewMoveWithSpline,
|
||||
// DangoAbyssActivatePortal,
|
||||
// DangoAbyssCreateRewardTreasureBox,
|
||||
// DangoAbyssGotoNextFloor,
|
||||
// DangoAbyssReceiveReward,
|
||||
// SummonEntity,
|
||||
// GetRewardByInteract,
|
||||
// OpenQte,
|
||||
// ActiveAntiGravitySafePoint,
|
||||
// BvbPlayDialog,
|
||||
// BvbSendSystemEvent,
|
||||
// BvbSendAiEvent,
|
||||
// BvbPlayerOperationConstraint,
|
||||
// ExecClientBattleAction,
|
||||
// TriggerSpecificScanEffect,
|
||||
// SetActorVar,
|
||||
// RunActorCustomEvent,
|
||||
// StopUiScreenEffect,
|
||||
// StopNewMoveWithSpline,
|
||||
// RequestSystemFunction
|
||||
}
|
||||
|
||||
pub fn handle_logic_message(player: &mut super::player::Player, msg: Message) {
|
||||
match msg {
|
||||
Message::Request { .. } => handle_request(player, msg),
|
||||
|
@ -531,13 +309,3 @@ pub fn handle_logic_message(player: &mut super::player::Player, msg: Message) {
|
|||
),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn handle_action(
|
||||
player: &mut Player,
|
||||
entity_id: i64,
|
||||
level_entity_data: &wicked_waifus_data::LevelEntityConfigData,
|
||||
template_config: &wicked_waifus_data::TemplateConfigData,
|
||||
element: Action
|
||||
) {
|
||||
perform_action(player, entity_id, level_entity_data, template_config, element)
|
||||
}
|
|
@ -1,18 +1,11 @@
|
|||
use std::collections::HashSet;
|
||||
|
||||
use wicked_waifus_protocol::{
|
||||
ClientCurrentRoleReportRequest, ClientCurrentRoleReportResponse, ERemoveEntityType, ErrorCode,
|
||||
FormationAttrRequest, FormationAttrResponse, PlayerMotionRequest, PlayerMotionResponse,
|
||||
RoleFavorListRequest, RoleFavorListResponse, RoleShowListUpdateRequest,
|
||||
RoleShowListUpdateResponse, UpdateFormationRequest, UpdateFormationResponse,
|
||||
};
|
||||
|
||||
use crate::logic::ecs::world;
|
||||
use crate::logic::player::Player;
|
||||
use crate::logic::role::{Role, RoleFormation};
|
||||
use crate::logic::utils::world_util::{add_player_entities, summon_concomitant};
|
||||
use crate::query_components;
|
||||
use crate::logic::components::{ParaglidingSkin, RoleSkin, SoarWingSkin, WeaponSkin};
|
||||
use crate::logic::ecs::component::ComponentContainer;
|
||||
use crate::logic::player::{ItemUsage, Player};
|
||||
use crate::logic::role::{Role, RoleFormation};
|
||||
use crate::modify_component;
|
||||
use wicked_waifus_protocol::{ArrayIntInt, ClientCurrentRoleReportRequest, ClientCurrentRoleReportResponse, ERemoveEntityType, EntityAddNotify, EntityEquipSkinChangeNotify, EntityFlySkinChangeData, EntityPb, EntityRemoveInfo, EntityRemoveNotify, EquipFlySkinData, ErrorCode, FlySkinConfigData, FlySkinWearAllRoleRequest, FlySkinWearAllRoleResponse, FlySkinWearRequest, FlySkinWearResponse, FormationAttrRequest, FormationAttrResponse, PbUpLevelRoleRequest, PbUpLevelRoleResponse, PlayerMotionRequest, PlayerMotionResponse, RoleBreakThroughViewRequest, RoleBreakThroughViewResponse, RoleFavorListRequest, RoleFavorListResponse, RoleFlyEquipChangeNotify, RoleLevelUpViewRequest, RoleLevelUpViewResponse, RoleShowListUpdateRequest, RoleShowListUpdateResponse, RoleSkinChangeRequest, RoleSkinChangeResponse, SoarWingOrParaglidingSkinChangeNotify, UnlockRoleSkinListRequest, UnlockRoleSkinListResponse, UpdateFormationRequest, UpdateFormationResponse, WeaponSkinComponentPb};
|
||||
|
||||
pub fn on_role_show_list_update_request(
|
||||
player: &mut Player,
|
||||
|
@ -48,6 +41,14 @@ pub fn on_role_favor_list_request(
|
|||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
||||
|
||||
pub fn on_formation_attr_request(
|
||||
_player: &Player,
|
||||
_request: FormationAttrRequest,
|
||||
response: &mut FormationAttrResponse,
|
||||
) {
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
||||
|
||||
pub fn on_update_formation_request(
|
||||
player: &mut Player,
|
||||
request: UpdateFormationRequest,
|
||||
|
@ -61,22 +62,6 @@ pub fn on_update_formation_request(
|
|||
let cur_role = formation.cur_role;
|
||||
let is_current = formation.is_current;
|
||||
|
||||
// update all formation and check formation_list
|
||||
player
|
||||
.formation_list
|
||||
.entry(formation_id)
|
||||
.and_modify(|r| {
|
||||
r.cur_role = formation.cur_role;
|
||||
r.role_ids = formation.role_ids.clone();
|
||||
r.is_current = is_current;
|
||||
})
|
||||
.or_insert(RoleFormation {
|
||||
id: formation_id,
|
||||
cur_role: formation.cur_role,
|
||||
role_ids: formation.role_ids.clone(),
|
||||
is_current,
|
||||
});
|
||||
|
||||
if is_current {
|
||||
// update player current formation id
|
||||
player.cur_formation_id = formation_id;
|
||||
|
@ -93,26 +78,30 @@ pub fn on_update_formation_request(
|
|||
}
|
||||
|
||||
if let Some(old_formation) = player.formation_list.get(&real_formation_id) {
|
||||
let mut removed_entities: Vec<i64> = old_formation
|
||||
let removed_entities: Vec<i64> = old_formation
|
||||
.role_ids
|
||||
.iter()
|
||||
.map(|&role_id| world.get_entity_id(role_id))
|
||||
.collect();
|
||||
for id in removed_entities.clone() {
|
||||
if let (Some(concomitant),) = query_components!(world, id, Concomitant) {
|
||||
removed_entities.extend(concomitant.custom_entity_ids.clone());
|
||||
};
|
||||
}
|
||||
removed_entities.iter().for_each(|&entity_id| {
|
||||
world.remove_entity(entity_id as i32);
|
||||
});
|
||||
player.notify(player.build_player_entity_remove_notify(
|
||||
removed_entities,
|
||||
ERemoveEntityType::RemoveTypeForce,
|
||||
ERemoveEntityType::RemoveTypeNormal,
|
||||
));
|
||||
}
|
||||
|
||||
player.build_player_entity_add_notify(world);
|
||||
let added_roles: Vec<Role> = formation
|
||||
.role_ids
|
||||
.iter()
|
||||
.map(|&role_id| Role::new(role_id))
|
||||
.collect();
|
||||
|
||||
if !added_roles.is_empty() {
|
||||
// add new roles
|
||||
player.notify(player.build_player_entity_add_notify(added_roles, world));
|
||||
}
|
||||
|
||||
// send update group formation notify
|
||||
player.notify(player.build_update_group_formation_notify(
|
||||
|
@ -127,6 +116,22 @@ pub fn on_update_formation_request(
|
|||
|
||||
response.formation = Some(formation.clone());
|
||||
}
|
||||
|
||||
// update all formation and check formation_list
|
||||
player
|
||||
.formation_list
|
||||
.entry(formation_id)
|
||||
.and_modify(|r| {
|
||||
r.cur_role = formation.cur_role;
|
||||
r.role_ids = formation.role_ids.clone();
|
||||
r.is_current = is_current;
|
||||
})
|
||||
.or_insert(RoleFormation {
|
||||
id: formation_id,
|
||||
cur_role: formation.cur_role,
|
||||
role_ids: formation.role_ids,
|
||||
is_current,
|
||||
});
|
||||
}
|
||||
|
||||
player.notify(player.build_update_formation_notify());
|
||||
|
@ -144,3 +149,421 @@ pub fn on_player_motion_request(
|
|||
Some(_) => response.error_id = ErrorCode::Success.into(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn on_unlock_role_skin_list_request(
|
||||
player: &Player,
|
||||
_request: UnlockRoleSkinListRequest,
|
||||
response: &mut UnlockRoleSkinListResponse,
|
||||
) {
|
||||
response.role_skin_list = player.unlocked_skins.role_skins.iter().cloned().collect();
|
||||
}
|
||||
|
||||
pub fn on_role_skin_change_request(
|
||||
player: &mut Player,
|
||||
request: RoleSkinChangeRequest,
|
||||
response: &mut RoleSkinChangeResponse,
|
||||
) {
|
||||
// TODO: Should we verify role id first against bindata?
|
||||
let role = player.role_list.get_mut(&request.role_id);
|
||||
let Some(role) = role else {
|
||||
response.error_code = ErrorCode::NotValidRole.into();
|
||||
return;
|
||||
};
|
||||
|
||||
// Verify Id exist in bindata
|
||||
let Some(skin_data) =
|
||||
wicked_waifus_data::role_skin_data::iter().find(|data| data.id == request.skin_id)
|
||||
else {
|
||||
response.error_code = ErrorCode::ErrRoleSkinConfig.into();
|
||||
return;
|
||||
};
|
||||
|
||||
// Verify Skin is unlocked
|
||||
if !player.unlocked_skins.role_skins.contains(&skin_data.id) {
|
||||
response.error_code = ErrorCode::ErrRoleSkinLocked.into();
|
||||
return;
|
||||
}
|
||||
|
||||
// Check that role has this skin
|
||||
if skin_data.role_id != role.role_id {
|
||||
response.error_code = ErrorCode::ErrRoleSkinNotMatch.into();
|
||||
return;
|
||||
}
|
||||
|
||||
role.skin_id = request.skin_id;
|
||||
if request.is_wear_weapon_skin {
|
||||
if skin_data.suit_weapon_skin_id == 0 {
|
||||
response.error_code = ErrorCode::ErrRoleSkinWeaponNotSuit.into();
|
||||
return;
|
||||
}
|
||||
role.weapon_skin_id = skin_data.suit_weapon_skin_id;
|
||||
}
|
||||
{
|
||||
let world_ref = player.world.borrow();
|
||||
let world = world_ref.get_world_entity();
|
||||
let entity_id = world.get_entity_id(request.role_id);
|
||||
modify_component!(
|
||||
world.get_entity_components(entity_id as i32),
|
||||
RoleSkin,
|
||||
|skin_component: &mut RoleSkin| {
|
||||
skin_component.skin_id = role.skin_id;
|
||||
}
|
||||
);
|
||||
if request.is_wear_weapon_skin {
|
||||
// Check for suit_weapon_skin_id == 0 has already been done
|
||||
modify_component!(
|
||||
world.get_entity_components(entity_id as i32),
|
||||
WeaponSkin,
|
||||
|skin_component: &mut WeaponSkin| {
|
||||
skin_component.skin_id = skin_data.suit_weapon_skin_id;
|
||||
}
|
||||
);
|
||||
// Since the whole entity is recreated this shouldn't be needed but meh, whatever
|
||||
player.notify(EntityEquipSkinChangeNotify {
|
||||
entity_id,
|
||||
weapon_skin_component_pb: Some(WeaponSkinComponentPb {
|
||||
weapon_skin_id:skin_data.suit_weapon_skin_id,
|
||||
}),
|
||||
});
|
||||
}
|
||||
player.notify(EntityRemoveNotify {
|
||||
remove_infos: vec![EntityRemoveInfo {
|
||||
entity_id,
|
||||
r#type: 0,
|
||||
}],
|
||||
is_remove: false,
|
||||
});
|
||||
|
||||
let mut pb = EntityPb {
|
||||
id: entity_id,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
world
|
||||
.get_entity_components(entity_id as i32)
|
||||
.into_iter()
|
||||
.for_each(|comp| comp.set_pb_data(&mut pb));
|
||||
|
||||
player.notify(EntityAddNotify {
|
||||
entity_pbs: vec![pb],
|
||||
remove_tag_ids: false,
|
||||
});
|
||||
}
|
||||
player.notify(player.build_update_formation_notify());
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
||||
|
||||
pub fn on_fly_skin_wear_request(
|
||||
player: &mut Player,
|
||||
request: FlySkinWearRequest,
|
||||
response: &mut FlySkinWearResponse,
|
||||
) {
|
||||
let role = player.role_list.get_mut(&request.role_id);
|
||||
let Some(role) = role else {
|
||||
response.error_code = ErrorCode::NotValidRole.into();
|
||||
return;
|
||||
};
|
||||
|
||||
// Verify Id exist in bindata
|
||||
let skin =
|
||||
wicked_waifus_data::fly_skin_config_data::iter().find(|&skin| skin.id == request.skin_id);
|
||||
let Some(skin) = skin else {
|
||||
response.error_code = ErrorCode::NoFlySkinItem.into();
|
||||
return;
|
||||
};
|
||||
|
||||
match skin.skin_type {
|
||||
0 => {
|
||||
// Verify Skin is unlocked
|
||||
if !player.unlocked_skins.fly_skins.contains(&skin.id) {
|
||||
response.error_code = ErrorCode::ErrRoleSkinLocked.into();
|
||||
return;
|
||||
}
|
||||
role.fly_skin_id = request.skin_id
|
||||
}
|
||||
1 => {
|
||||
if !player.unlocked_skins.wing_skins.contains(&skin.id) {
|
||||
response.error_code = ErrorCode::ErrRoleSkinLocked.into();
|
||||
return;
|
||||
}
|
||||
role.wing_skin_id = request.skin_id
|
||||
}
|
||||
_ => {
|
||||
response.error_code = ErrorCode::FlySkinTypeErr.into();
|
||||
return;
|
||||
}
|
||||
}
|
||||
{
|
||||
let world_ref = player.world.borrow();
|
||||
let world = world_ref.get_world_entity();
|
||||
let entity_id = world.get_entity_id(request.role_id);
|
||||
match skin.skin_type {
|
||||
0 => {
|
||||
modify_component!(
|
||||
world.get_entity_components(entity_id as i32),
|
||||
SoarWingSkin,
|
||||
|skin_component: &mut SoarWingSkin| {
|
||||
skin_component.skin_id = role.skin_id;
|
||||
}
|
||||
);
|
||||
}
|
||||
1 => {
|
||||
modify_component!(
|
||||
world.get_entity_components(entity_id as i32),
|
||||
ParaglidingSkin,
|
||||
|skin_component: &mut ParaglidingSkin| {
|
||||
skin_component.skin_id = role.skin_id;
|
||||
}
|
||||
);
|
||||
}
|
||||
_ => unreachable!("Already tested above"),
|
||||
}
|
||||
player.notify(SoarWingOrParaglidingSkinChangeNotify {
|
||||
fly_skin_data: vec![EntityFlySkinChangeData {
|
||||
entity_id,
|
||||
fly_skin_config_data: vec![FlySkinConfigData {
|
||||
skin_id: request.skin_id,
|
||||
fly_skin_id: skin.skin_type,
|
||||
}],
|
||||
}],
|
||||
});
|
||||
}
|
||||
|
||||
player.notify(RoleFlyEquipChangeNotify {
|
||||
fly_skin_data: vec![EquipFlySkinData {
|
||||
role_id: request.role_id,
|
||||
skin_id: request.skin_id,
|
||||
}],
|
||||
});
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
||||
|
||||
pub fn on_fly_skin_wear_all_role_request(
|
||||
player: &mut Player,
|
||||
request: FlySkinWearAllRoleRequest,
|
||||
response: &mut FlySkinWearAllRoleResponse,
|
||||
) {
|
||||
let skin =
|
||||
wicked_waifus_data::fly_skin_config_data::iter().find(|&skin| skin.id == request.skin_id);
|
||||
let Some(skin) = skin else {
|
||||
response.error_code = ErrorCode::NoFlySkinItem.into();
|
||||
return;
|
||||
};
|
||||
|
||||
match skin.skin_type {
|
||||
0 => {
|
||||
// Verify Skin is unlocked
|
||||
if !player.unlocked_skins.fly_skins.contains(&skin.id) {
|
||||
response.error_code = ErrorCode::ErrRoleSkinLocked.into();
|
||||
return;
|
||||
}
|
||||
for role in player.role_list.values_mut() {
|
||||
role.fly_skin_id = request.skin_id;
|
||||
}
|
||||
}
|
||||
1 => {
|
||||
if !player.unlocked_skins.wing_skins.contains(&skin.id) {
|
||||
response.error_code = ErrorCode::ErrRoleSkinLocked.into();
|
||||
return;
|
||||
}
|
||||
for role in player.role_list.values_mut() {
|
||||
role.wing_skin_id = request.skin_id;
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
response.error_code = ErrorCode::FlySkinTypeErr.into();
|
||||
return;
|
||||
}
|
||||
}
|
||||
player.notify(RoleFlyEquipChangeNotify {
|
||||
fly_skin_data: player
|
||||
.role_list
|
||||
.values()
|
||||
.map(|r| EquipFlySkinData {
|
||||
role_id: r.role_id,
|
||||
skin_id: request.skin_id,
|
||||
})
|
||||
.collect::<Vec<_>>(),
|
||||
});
|
||||
{
|
||||
let world_ref = player.world.borrow();
|
||||
let world = world_ref.get_world_entity();
|
||||
let data = player
|
||||
.role_list
|
||||
.values()
|
||||
.filter_map(|role| {
|
||||
let entity_id = world.get_entity_id(role.role_id);
|
||||
if entity_id == -1 {
|
||||
None
|
||||
} else {
|
||||
match skin.skin_type {
|
||||
0 => {
|
||||
modify_component!(
|
||||
world.get_entity_components(entity_id as i32),
|
||||
SoarWingSkin,
|
||||
|skin_component: &mut SoarWingSkin| {
|
||||
skin_component.skin_id = role.skin_id;
|
||||
}
|
||||
);
|
||||
}
|
||||
1 => {
|
||||
modify_component!(
|
||||
world.get_entity_components(entity_id as i32),
|
||||
ParaglidingSkin,
|
||||
|skin_component: &mut ParaglidingSkin| {
|
||||
skin_component.skin_id = role.skin_id;
|
||||
}
|
||||
);
|
||||
}
|
||||
_ => unreachable!("Already tested above"),
|
||||
}
|
||||
Some(EntityFlySkinChangeData {
|
||||
entity_id,
|
||||
fly_skin_config_data: vec![FlySkinConfigData {
|
||||
skin_id: request.skin_id,
|
||||
fly_skin_id: skin.skin_type,
|
||||
}],
|
||||
})
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
player.notify(SoarWingOrParaglidingSkinChangeNotify {
|
||||
fly_skin_data: data,
|
||||
});
|
||||
}
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
||||
|
||||
pub fn on_role_level_up_view_request(
|
||||
player: &mut Player,
|
||||
request: RoleLevelUpViewRequest,
|
||||
response: &mut RoleLevelUpViewResponse,
|
||||
) {
|
||||
let role = player.role_list.get(&request.role_id);
|
||||
let Some(role) = role else {
|
||||
response.error_code = ErrorCode::NotValidRole.into();
|
||||
return;
|
||||
};
|
||||
|
||||
response.level = role.level;
|
||||
// TODO: shall we get from data? seems client can do it by himself
|
||||
response.level_exp_info = vec![ArrayIntInt { key: 1, value: 200 }];
|
||||
response.exp = role.exp;
|
||||
// it seems add_exp, final_prop, cost_list amd overflow_list are handled by client, so skip
|
||||
|
||||
let items = wicked_waifus_data::role_exp_item_data::iter()
|
||||
.map(|(&id, _)| id)
|
||||
.collect::<Vec<_>>();
|
||||
response.item_list = player.inventory.to_array_int_int_filtered(&items);
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
||||
|
||||
pub fn on_pb_up_level_role_request(
|
||||
player: &mut Player,
|
||||
request: PbUpLevelRoleRequest,
|
||||
response: &mut PbUpLevelRoleResponse,
|
||||
) {
|
||||
response.role_id = request.role_id;
|
||||
let role = player.role_list.get(&request.role_id);
|
||||
let Some(role) = role else {
|
||||
response.error_code = ErrorCode::NotValidRole.into();
|
||||
return;
|
||||
};
|
||||
|
||||
// TODO: no shell_credit??? :turtle_skull:
|
||||
let items = player.inventory.consume_items(
|
||||
&request
|
||||
.item_list
|
||||
.iter()
|
||||
.map(|item| ItemUsage {
|
||||
id: item.key,
|
||||
quantity: -item.value,
|
||||
})
|
||||
.collect::<Vec<_>>(),
|
||||
);
|
||||
let Ok(_items) = items else {
|
||||
response.error_code = ErrorCode::ErrConsumeNotEnough.into();
|
||||
return;
|
||||
};
|
||||
|
||||
let mut total_exp = request
|
||||
.item_list
|
||||
.iter()
|
||||
.filter_map(|item| {
|
||||
wicked_waifus_data::role_exp_item_data::get(&item.key)
|
||||
.map(|exp| exp.basic_exp * item.value)
|
||||
})
|
||||
.sum();
|
||||
|
||||
let role_level_consume_id = wicked_waifus_data::role_info_data::iter()
|
||||
.find(|role| role.id == request.role_id)
|
||||
.map(|role| role.level_consume_id)
|
||||
.unwrap_or(10001);
|
||||
|
||||
let mut levels_consume = wicked_waifus_data::role_level_consume_data::iter()
|
||||
.filter(|consume| {
|
||||
consume.consume_group_id == role_level_consume_id && consume.level > role.level
|
||||
}) // TODO: add upper bound too(till breakthrough)
|
||||
.collect::<Vec<_>>();
|
||||
levels_consume.sort_by_key(|item| item.level);
|
||||
|
||||
let mut level = role.level;
|
||||
for level_consume in levels_consume {
|
||||
if level_consume.exp_count > total_exp {
|
||||
break;
|
||||
}
|
||||
total_exp -= level_consume.exp_count;
|
||||
level = level_consume.level;
|
||||
}
|
||||
response.level = level;
|
||||
response.exp = total_exp;
|
||||
|
||||
// TODO is item_map the overflowing items or all items used? also should we sent more notifies?
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
||||
|
||||
// on_role_break_through_view_request
|
||||
|
||||
pub fn on_role_break_through_view_request(
|
||||
player: &mut Player,
|
||||
request: RoleBreakThroughViewRequest,
|
||||
response: &mut RoleBreakThroughViewResponse,
|
||||
) {
|
||||
let role = player.role_list.get(&request.role_id);
|
||||
let Some(role) = role else {
|
||||
response.error_code = ErrorCode::NotValidRole.into();
|
||||
return;
|
||||
};
|
||||
|
||||
// TODO:
|
||||
// if !condition {
|
||||
// response.error_code = ErrorCode::ErrRoleConditionNotFind.into();
|
||||
// response.is_condition_finish = false;
|
||||
// }
|
||||
|
||||
let role_breach_id = wicked_waifus_data::role_info_data::iter()
|
||||
.find(|role| role.id == request.role_id)
|
||||
.map(|role| role.breach_id)
|
||||
.unwrap_or(request.role_id);
|
||||
|
||||
let condition = wicked_waifus_data::role_breach_data::iter()
|
||||
.find(|role_breach_data| {
|
||||
role_breach_data.breach_group_id == role_breach_id
|
||||
&& role_breach_data.breach_level == role.breakthrough
|
||||
})
|
||||
.unwrap(); // TODO: handling
|
||||
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
response.level_limit = condition.max_level;
|
||||
|
||||
response.cost_list = condition
|
||||
.breach_consume
|
||||
.iter()
|
||||
.map(|(&id, &count)| ArrayIntInt {
|
||||
key: id,
|
||||
value: count,
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
// TODO: un_lock_skill_id, reward_list, final_prop
|
||||
response.is_condition_finish = true; // is this last??
|
||||
}
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
use wicked_waifus_protocol::{ErrorCode, SceneLoadingFinishRequest, SceneLoadingFinishResponse, SceneTraceRequest, SceneTraceResponse, UpdateSceneDateRequest, UpdateSceneDateResponse, AccessPathTimeServerConfigRequest, AccessPathTimeServerConfigResponse, PlayerHeadDataRequest, PlayerHeadDataResponse, UnlockRoleSkinListRequest, UnlockRoleSkinListResponse, JsPatchNotify};
|
||||
use wicked_waifus_protocol::{
|
||||
AccessPathTimeServerConfigRequest, AccessPathTimeServerConfigResponse, ErrorCode,
|
||||
JsPatchNotify, PlayerHeadDataRequest, PlayerHeadDataResponse, SceneLoadingFinishRequest,
|
||||
SceneLoadingFinishResponse, SceneTraceRequest, SceneTraceResponse, UpdateSceneDateRequest,
|
||||
UpdateSceneDateResponse,
|
||||
};
|
||||
|
||||
//const WATER_MASK: &str = include_str!("../../../scripts/watermask-disable.js");
|
||||
const WATER_MASK: &str = include_str!("../../../scripts/watermask-edit.js");
|
||||
const WATER_MASK: &str = include_str!("../../../scripts/watermask-disable.js");
|
||||
const UID_FIX: &str = include_str!("../../../scripts/uidfix.js");
|
||||
const CENSORSHIP_FIX: &str = include_str!("../../../scripts/censorshipfix.js");
|
||||
const DEBUG_DISABLE: &str = include_str!("../../../scripts/debug_disable.js");
|
||||
|
@ -66,14 +70,3 @@ pub fn on_player_head_data_request(
|
|||
// TODO: port this from golang
|
||||
response.pi = vec![];
|
||||
}
|
||||
|
||||
pub fn on_unlock_role_skin_list_request(
|
||||
_player: &Player,
|
||||
_request: UnlockRoleSkinListRequest,
|
||||
response: &mut UnlockRoleSkinListResponse,
|
||||
) {
|
||||
// TODO: port this from golang
|
||||
response.role_skin_list = wicked_waifus_data::role_skin_data::iter()
|
||||
.map(|data| data.id)
|
||||
.collect::<Vec<_>>();
|
||||
}
|
175
wicked-waifus-game-server/src/logic/handler/weapon.rs
Normal file
175
wicked-waifus-game-server/src/logic/handler/weapon.rs
Normal file
|
@ -0,0 +1,175 @@
|
|||
use crate::logic::components::{Equip, WeaponSkin};
|
||||
use crate::logic::ecs::component::ComponentContainer;
|
||||
use crate::logic::player::Player;
|
||||
use crate::modify_component;
|
||||
use wicked_waifus_protocol::{EntityEquipChangeNotify, EntityEquipSkinChangeNotify, EquipComponentPb, EquipTakeOnNotify, EquipTakeOnRequest, EquipTakeOnResponse, EquipWeaponSkinRequest, EquipWeaponSkinResponse, ErrorCode, LoadEquipData, SendEquipSkinRequest, SendEquipSkinResponse, WeaponSkinComponentPb, WeaponSkinDeleteNotify, WeaponSkinRequest, WeaponSkinResponse};
|
||||
|
||||
pub fn on_weapon_skin_request(
|
||||
player: &Player,
|
||||
_request: WeaponSkinRequest,
|
||||
response: &mut WeaponSkinResponse,
|
||||
) {
|
||||
response.equip_list = player
|
||||
.role_list
|
||||
.values()
|
||||
.filter(|role| role.weapon_skin_id != 0)
|
||||
.map(|role| LoadEquipData {
|
||||
role_id: role.role_id,
|
||||
skin_id: role.weapon_skin_id,
|
||||
})
|
||||
.collect();
|
||||
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
||||
|
||||
pub fn on_equip_weapon_skin_request(
|
||||
player: &mut Player,
|
||||
request: EquipWeaponSkinRequest,
|
||||
response: &mut EquipWeaponSkinResponse,
|
||||
) {
|
||||
let Some(equip_data) = request.data else {
|
||||
return;
|
||||
};
|
||||
|
||||
let role = player.role_list.get_mut(&equip_data.role_id);
|
||||
let Some(role) = role else {
|
||||
response.error_code = ErrorCode::NotValidRole.into();
|
||||
return;
|
||||
};
|
||||
|
||||
// Verify Id exist in bindata
|
||||
let Some(skin_data) =
|
||||
wicked_waifus_data::weapon_skin_data::iter().find(|data| data.id == equip_data.skin_id)
|
||||
else {
|
||||
response.error_code = ErrorCode::WeaponSkinDataErr.into();
|
||||
return;
|
||||
};
|
||||
|
||||
// Verify Skin is unlocked
|
||||
if !player.unlocked_skins.weapon_skins.contains(&skin_data.id) {
|
||||
response.error_code = ErrorCode::WeaponSkinUnLockErr.into();
|
||||
return;
|
||||
}
|
||||
|
||||
role.weapon_skin_id = equip_data.skin_id;
|
||||
{
|
||||
let world_ref = player.world.borrow();
|
||||
let world = world_ref.get_world_entity();
|
||||
let entity_id = world.get_entity_id(equip_data.role_id);
|
||||
modify_component!(
|
||||
world.get_entity_components(entity_id as i32),
|
||||
WeaponSkin,
|
||||
|skin_component: &mut WeaponSkin| {
|
||||
skin_component.skin_id = equip_data.skin_id;
|
||||
}
|
||||
);
|
||||
player.notify(EntityEquipSkinChangeNotify {
|
||||
entity_id,
|
||||
weapon_skin_component_pb: Some(WeaponSkinComponentPb {
|
||||
weapon_skin_id: equip_data.skin_id,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
// Is the all list needed or only the new one??
|
||||
response.data_list = player
|
||||
.role_list
|
||||
.values()
|
||||
.filter(|role| role.weapon_skin_id != 0)
|
||||
.map(|role| LoadEquipData {
|
||||
role_id: role.role_id,
|
||||
skin_id: role.weapon_skin_id,
|
||||
})
|
||||
.collect();
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
||||
|
||||
pub fn on_send_equip_skin_request(
|
||||
player: &mut Player,
|
||||
request: SendEquipSkinRequest,
|
||||
response: &mut SendEquipSkinResponse,
|
||||
) {
|
||||
let role = player.role_list.get_mut(&request.role_id);
|
||||
let Some(role) = role else {
|
||||
response.error_code = ErrorCode::NotValidRole.into();
|
||||
return;
|
||||
};
|
||||
|
||||
let old_skin_id = role.weapon_skin_id;
|
||||
role.weapon_skin_id = 0;
|
||||
{
|
||||
let world_ref = player.world.borrow();
|
||||
let world = world_ref.get_world_entity();
|
||||
let entity_id = world.get_entity_id(request.role_id);
|
||||
modify_component!(
|
||||
world.get_entity_components(entity_id as i32),
|
||||
WeaponSkin,
|
||||
|skin_component: &mut WeaponSkin| {
|
||||
skin_component.skin_id = 0;
|
||||
}
|
||||
);
|
||||
player.notify(EntityEquipSkinChangeNotify {
|
||||
entity_id,
|
||||
weapon_skin_component_pb: Some(WeaponSkinComponentPb {
|
||||
weapon_skin_id: 0,
|
||||
}),
|
||||
});
|
||||
player.notify(WeaponSkinDeleteNotify {
|
||||
role_id: request.role_id,
|
||||
skin_id: old_skin_id,
|
||||
})
|
||||
}
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
||||
|
||||
pub fn on_equip_take_on_request(
|
||||
player: &mut Player,
|
||||
request: EquipTakeOnRequest,
|
||||
response: &mut EquipTakeOnResponse,
|
||||
) {
|
||||
let Some(equip_data) = request.data else {
|
||||
return;
|
||||
};
|
||||
|
||||
// TODO: Add sanity checks(add from another role, a.k.a.: switch from roles)
|
||||
player.notify(EquipTakeOnNotify { data_list: vec![equip_data] });
|
||||
|
||||
let role = player.role_list.get_mut(&equip_data.role_id);
|
||||
let Some(role) = role else {
|
||||
response.error_code = ErrorCode::NotValidRole.into();
|
||||
return;
|
||||
};
|
||||
|
||||
let Some((id, breach)) = player.inventory.get_weapon_equip_info(equip_data.equip_inc_id) else {
|
||||
response.error_code = ErrorCode::ErrItemNotFound.into();
|
||||
return;
|
||||
};
|
||||
role.equip_weapon = id;
|
||||
|
||||
// TODO: Change attributes based on weapon (PbRolePropsNotify + buffs + CombatNotifyAttributeChangedNotify)
|
||||
|
||||
{
|
||||
// TODO: remove from old one if in scene in case of weapon switch
|
||||
let world_ref = player.world.borrow();
|
||||
let world = world_ref.get_world_entity();
|
||||
let entity_id = world.get_entity_id(equip_data.role_id);
|
||||
modify_component!(
|
||||
world.get_entity_components(entity_id as i32),
|
||||
Equip,
|
||||
|equip_component: &mut Equip| {
|
||||
equip_component.weapon_id = id;
|
||||
equip_component.weapon_breach_level = breach;
|
||||
}
|
||||
);
|
||||
player.notify(EntityEquipChangeNotify {
|
||||
entity_id,
|
||||
equip_component: Some(EquipComponentPb {
|
||||
weapon_id: id,
|
||||
weapon_breach_level: breach,
|
||||
}),
|
||||
})
|
||||
}
|
||||
// TODO: Should we return all of them??
|
||||
response.data_list = vec![equip_data];
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
|
@ -12,10 +12,6 @@ pub struct ExploreTools {
|
|||
pub roulette: Roulette,
|
||||
}
|
||||
|
||||
const ADDITIONAL_ROULETTE: &[i32] = &[
|
||||
1015 // flight
|
||||
];
|
||||
|
||||
impl ExploreTools {
|
||||
pub fn build_save_data(&self) -> PlayerExploreToolsData {
|
||||
PlayerExploreToolsData {
|
||||
|
@ -67,16 +63,6 @@ impl ExploreTools {
|
|||
.enumerate()
|
||||
.for_each(|(i, e)| roulette[i] = e.phantom_skill_id);
|
||||
|
||||
let mut count = 2;
|
||||
|
||||
explore_tools_data::iter()
|
||||
.for_each(|e| {
|
||||
if ADDITIONAL_ROULETTE.contains(&e.phantom_skill_id) {
|
||||
count += 1;
|
||||
roulette[count] = e.phantom_skill_id
|
||||
}
|
||||
});
|
||||
|
||||
roulette
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,27 +9,26 @@ use wicked_waifus_protocol::message::Message;
|
|||
use wicked_waifus_protocol::player_attr::Value;
|
||||
use wicked_waifus_protocol::{
|
||||
AdventreTask, AdventureManualData, AdventureUpdateNotify, AdviceSettingNotify, BuffItemNotify,
|
||||
ControlInfoNotify, ERemoveEntityType, EnergyInfo, EnergyUpdateNotify,
|
||||
EntityRemoveInfo, EntityRemoveNotify,
|
||||
FavorItem, FightFormationNotifyInfo, FightRoleInfo, FightRoleInfos, FormationRoleInfo,
|
||||
GroupFormation, HostTeleportUnlockNotify, InstDataNotify, ItemPkgOpenNotify,
|
||||
LevelPlayInfoNotify, LivingStatus, MailInfosNotify,
|
||||
MonthCardDailyRewardNotify, MoonChasingTargetGetCountNotify,
|
||||
MoonChasingTrackMoonHandbookRewardNotify, NormalItemUpdateNotify, PassiveSkillNotify,
|
||||
PbGetRoleListNotify, PlayerAttr, PlayerAttrKey, PlayerAttrNotify, PlayerAttrType,
|
||||
PlayerFightFormations, PlayerVarNotify, ProtocolUnit, PushContextIdNotify,
|
||||
PushDataCompleteNotify, RoguelikeCurrencyNotify, RoleChangeUnlockNotify, RoleFavor,
|
||||
RoleFavorListNotify, RoleMotion, RoleMotionListNotify, SettingNotify, TeleportUpdateNotify,
|
||||
UpdateFormationNotify, UpdateGroupFormationNotify,
|
||||
ControlInfoNotify, EEntityType, ERemoveEntityType, EnergyInfo, EnergyUpdateNotify,
|
||||
EntityAddNotify, EntityConfigType, EntityPb, EntityRemoveInfo, EntityRemoveNotify, EntityState,
|
||||
FavorItem, FightFormationNotifyInfo, FightRoleInfo, FightRoleInfos, FlyEquipAddNotify,
|
||||
FlySkinEquipData, GroupFormation, HostTeleportUnlockNotify, InstDataNotify, ItemPkgOpenNotify,
|
||||
LevelPlayInfoNotify, LivingStatus, MailInfosNotify, MonthCardDailyRewardNotify,
|
||||
MoonChasingTargetGetCountNotify, MoonChasingTrackMoonHandbookRewardNotify,
|
||||
NormalItemUpdateNotify, PassiveSkillNotify, PbGetRoleListNotify, PlayerAttr, PlayerAttrKey,
|
||||
PlayerAttrNotify, PlayerAttrType, PlayerFightFormations, PlayerVarNotify, ProtocolUnit,
|
||||
PushContextIdNotify, PushDataCompleteNotify, RoguelikeCurrencyNotify, RoleChangeUnlockNotify,
|
||||
RoleFavor, RoleFavorListNotify, RoleFlyEquipNotify, RoleMotion, RoleMotionListNotify,
|
||||
SettingNotify, TeleportUpdateNotify, UnlockSkinDataNotify, UpdateFormationNotify,
|
||||
UpdateGroupFormationNotify,
|
||||
};
|
||||
use wicked_waifus_protocol_internal::{PlayerBasicData, PlayerRoleData, PlayerSaveData};
|
||||
|
||||
use super::ecs::component::ComponentContainer;
|
||||
use super::utils::world_util::add_player_entities;
|
||||
use super::{
|
||||
ecs::world::World,
|
||||
role::{Role, RoleFormation},
|
||||
};
|
||||
use crate::logic::components::RoleSkin;
|
||||
use crate::logic::ecs::world::WorldEntity;
|
||||
use crate::logic::player::basic_info::PlayerBasicInfo;
|
||||
use crate::logic::player::explore_tools::ExploreTools;
|
||||
|
@ -47,9 +46,17 @@ use crate::logic::player::player_mc_element::PlayerMcElement;
|
|||
use crate::logic::player::player_month_card::PlayerMonthCard;
|
||||
use crate::logic::player::player_teleports::{PlayerTeleport, PlayerTeleports};
|
||||
use crate::logic::player::player_tutorials::{PlayerTutorial, PlayerTutorials};
|
||||
use crate::session::Session;
|
||||
use crate::{config, query_components};
|
||||
use crate::logic::player::Element::Spectro;
|
||||
use crate::logic::{
|
||||
components::{
|
||||
Attribute, EntityConfig, Equip, FightBuff, Movement, OwnerPlayer, ParaglidingSkin,
|
||||
PlayerOwnedEntityMarker, Position, SoarWingSkin, Visibility, VisionSkill, WeaponSkin,
|
||||
},
|
||||
ecs::component::ComponentContainer,
|
||||
};
|
||||
use crate::session::Session;
|
||||
use crate::{config, create_player_entity_pb};
|
||||
use crate::logic::player::player_unlocked_skins::PlayerUnlockedSkins;
|
||||
|
||||
mod basic_info;
|
||||
mod explore_tools;
|
||||
|
@ -66,6 +73,7 @@ mod player_mc_element;
|
|||
mod player_month_card;
|
||||
mod player_teleports;
|
||||
mod player_tutorials;
|
||||
mod player_unlocked_skins;
|
||||
|
||||
pub struct Player {
|
||||
session: Option<Arc<Session>>,
|
||||
|
@ -87,6 +95,7 @@ pub struct Player {
|
|||
pub map_trace: PlayerMapTrace,
|
||||
pub month_card: PlayerMonthCard,
|
||||
pub mc_element: PlayerMcElement,
|
||||
pub unlocked_skins: PlayerUnlockedSkins,
|
||||
// Runtime
|
||||
pub world: Rc<RefCell<World>>,
|
||||
pub last_save_time: u64,
|
||||
|
@ -117,6 +126,10 @@ impl Player {
|
|||
self.notify(self.explore_tools.build_roulette_update_notify());
|
||||
self.notify(self.build_role_favor_list_notify());
|
||||
self.notify(self.func.build_func_open_notify());
|
||||
self.notify(self.build_weapon_skin_notify());
|
||||
self.notify(self.build_fly_equip_notify());
|
||||
self.notify(self.build_role_fly_equip_notify());
|
||||
|
||||
self.notify(InstDataNotify {
|
||||
enter_infos: vec![], // TODO: No effect in normal world, to implement for dungeon::logic()
|
||||
});
|
||||
|
@ -205,6 +218,11 @@ impl Player {
|
|||
self.role_list.insert(role_id, Role::new(role_id));
|
||||
});
|
||||
}
|
||||
for role in self.role_list.values() {
|
||||
self.inventory
|
||||
.add_weapon(role.equip_weapon, 0, 1, 0, 0, 0, role.role_id)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
self.formation_list.insert(1, RoleFormation::default());
|
||||
self.cur_formation_id = 1;
|
||||
|
@ -257,7 +275,7 @@ impl Player {
|
|||
}
|
||||
|
||||
if !rf.role_ids.contains(&rf.cur_role) {
|
||||
rf.cur_role = *rf.role_ids.first().unwrap();
|
||||
rf.cur_role = *rf.role_ids.iter().nth(0).unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -298,7 +316,9 @@ impl Player {
|
|||
pub fn build_role_favor_list_notify(&self) -> RoleFavorListNotify {
|
||||
RoleFavorListNotify {
|
||||
favor_list: self
|
||||
.role_list.values().map(|role| RoleFavor {
|
||||
.role_list
|
||||
.values()
|
||||
.map(|role| RoleFavor {
|
||||
role_id: role.role_id,
|
||||
level: role.favor_level,
|
||||
exp: role.favor_exp,
|
||||
|
@ -330,10 +350,73 @@ impl Player {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn build_weapon_skin_notify(&self) -> UnlockSkinDataNotify {
|
||||
UnlockSkinDataNotify {
|
||||
phantom_skin_list: self.unlocked_skins.weapon_skins.iter().cloned().collect(),
|
||||
is_login: true,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn build_fly_equip_notify(&self) -> FlyEquipAddNotify {
|
||||
FlyEquipAddNotify {
|
||||
unlock_fly_skin_ids: self
|
||||
.unlocked_skins
|
||||
.fly_skins
|
||||
.iter()
|
||||
.chain(&self.unlocked_skins.wing_skins)
|
||||
.cloned()
|
||||
.collect(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn build_role_fly_equip_notify(&self) -> RoleFlyEquipNotify {
|
||||
let merged: Vec<_> = self
|
||||
.unlocked_skins
|
||||
.fly_skins
|
||||
.iter()
|
||||
.chain(&self.unlocked_skins.wing_skins)
|
||||
.cloned()
|
||||
.collect();
|
||||
|
||||
let mut equipped_skins: HashMap<i32, Vec<i32>> = HashMap::new();
|
||||
for role in self.role_list.values() {
|
||||
if role.fly_skin_id != 0 {
|
||||
equipped_skins
|
||||
.entry(role.fly_skin_id)
|
||||
.or_default()
|
||||
.push(role.role_id);
|
||||
}
|
||||
if role.wing_skin_id != 0 {
|
||||
equipped_skins
|
||||
.entry(role.wing_skin_id)
|
||||
.or_default()
|
||||
.push(role.role_id);
|
||||
}
|
||||
}
|
||||
|
||||
RoleFlyEquipNotify {
|
||||
fly_skin_equip_data: merged
|
||||
.iter()
|
||||
.map(|&skin| match equipped_skins.get(&skin) {
|
||||
Some(role_list) => FlySkinEquipData {
|
||||
role_ids: role_list.to_vec(),
|
||||
skin_id: skin,
|
||||
},
|
||||
None => FlySkinEquipData {
|
||||
role_ids: vec![],
|
||||
skin_id: skin,
|
||||
},
|
||||
})
|
||||
.collect(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn build_motion_list_notify(&self) -> RoleMotionListNotify {
|
||||
RoleMotionListNotify {
|
||||
motion_list: self
|
||||
.role_list.values().map(|role| {
|
||||
.role_list
|
||||
.values()
|
||||
.map(|role| {
|
||||
RoleMotion {
|
||||
role_id: role.role_id,
|
||||
motion_ids: motion_data::iter()
|
||||
|
@ -352,8 +435,16 @@ impl Player {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn build_player_entity_add_notify(&self, world: &mut WorldEntity) {
|
||||
add_player_entities(self, self.formation_list.get(&self.cur_formation_id).unwrap(), Some(world))
|
||||
pub fn build_player_entity_add_notify(&self, role_list: Vec<Role>, world: &mut WorldEntity) -> EntityAddNotify {
|
||||
create_player_entity_pb!(
|
||||
role_list,
|
||||
self.basic_info.cur_map_id,
|
||||
self,
|
||||
self.basic_info.id,
|
||||
self.location.position.clone(),
|
||||
self.explore_tools,
|
||||
world
|
||||
)
|
||||
}
|
||||
|
||||
pub fn build_player_entity_remove_notify(
|
||||
|
@ -387,14 +478,10 @@ impl Player {
|
|||
fight_role_infos: cur_formation
|
||||
.role_ids
|
||||
.iter()
|
||||
.map(|&role_id| {
|
||||
let entity_id = world.get_entity_id(role_id);
|
||||
let _role_skin = query_components!(world, entity_id, RoleSkin).0.unwrap();
|
||||
FightRoleInfo {
|
||||
.map(|&role_id| FightRoleInfo {
|
||||
role_id,
|
||||
entity_id: world.get_entity_id(role_id),
|
||||
on_stage_without_control: false,
|
||||
}
|
||||
})
|
||||
.collect(),
|
||||
cur_role: cur_formation.cur_role,
|
||||
|
@ -431,14 +518,7 @@ impl Player {
|
|||
tracing::warn!("Role {} not found in use role list", role_id);
|
||||
return Default::default();
|
||||
}
|
||||
let role = *role_map.get(role_id).unwrap();
|
||||
FormationRoleInfo {
|
||||
role_id: role.role_id,
|
||||
max_hp: 0,
|
||||
cur_hp: 0,
|
||||
level: role.level,
|
||||
..Default::default()
|
||||
}
|
||||
role_map.get(role_id).unwrap().to_formation_protobuf()
|
||||
})
|
||||
.collect(),
|
||||
is_current: formation.is_current,
|
||||
|
@ -496,7 +576,7 @@ impl Player {
|
|||
}],
|
||||
});
|
||||
self.notify(NormalItemUpdateNotify {
|
||||
normal_item_list: self.inventory.to_normal_item_list_filtered(vec![3]),
|
||||
normal_item_list: self.inventory.to_normal_item_list_filtered(&[3]),
|
||||
no_tips: false,
|
||||
});
|
||||
self.notify(MonthCardDailyRewardNotify {
|
||||
|
@ -578,6 +658,10 @@ impl Player {
|
|||
.mc_element
|
||||
.map(PlayerMcElement::load_from_save)
|
||||
.unwrap_or_default(),
|
||||
unlocked_skins: save_data
|
||||
.unlocked_skins
|
||||
.map(PlayerUnlockedSkins::load_from_save)
|
||||
.unwrap_or_default(),
|
||||
world: Rc::new(RefCell::new(World::new())),
|
||||
last_save_time: time_util::unix_timestamp(),
|
||||
quadrant_id: 0,
|
||||
|
@ -589,7 +673,9 @@ impl Player {
|
|||
basic_data: Some(self.basic_info.build_save_data()),
|
||||
role_data: Some(PlayerRoleData {
|
||||
role_list: self
|
||||
.role_list.values().map(|role| role.build_save_data())
|
||||
.role_list
|
||||
.iter()
|
||||
.map(|(_, role)| role.build_save_data())
|
||||
.collect(),
|
||||
role_formation_list: self
|
||||
.formation_list
|
||||
|
@ -611,6 +697,7 @@ impl Player {
|
|||
map_trace: Some(self.map_trace.build_save_data()),
|
||||
month_card: Some(self.month_card.build_save_data()),
|
||||
mc_element: Some(self.mc_element.build_save_data()),
|
||||
unlocked_skins: Some(self.unlocked_skins.build_save_data()),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -619,10 +706,11 @@ impl Player {
|
|||
}
|
||||
|
||||
pub fn build_role_list_notify(&self) -> PbGetRoleListNotify {
|
||||
// TODO: There is a bug we are investigating with several resonators, this is a workaround
|
||||
PbGetRoleListNotify {
|
||||
role_list: self
|
||||
.role_list.values().map(|role| role.to_protobuf())
|
||||
.role_list
|
||||
.values()
|
||||
.map(|role| role.to_protobuf())
|
||||
.collect(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
use std::collections::HashMap;
|
||||
use std::sync::atomic::AtomicI32;
|
||||
use wicked_waifus_protocol::{ArrayIntInt, NormalItem, WeaponItem};
|
||||
|
||||
use wicked_waifus_protocol::NormalItem;
|
||||
|
||||
use wicked_waifus_protocol_internal::PlayerInventoryData;
|
||||
use crate::config;
|
||||
use crate::logic::utils::seq_utils::{SequenceGenerator, Sequencer};
|
||||
use wicked_waifus_protocol_internal::{PlayerInventoryData, PlayerInventoryWeaponData};
|
||||
|
||||
pub struct PlayerInventory {
|
||||
items: HashMap<i32, i32>,
|
||||
weapons_seq: SequenceGenerator<i32, AtomicI32>,
|
||||
weapons: HashMap<i32, PlayerInventoryWeaponData>,
|
||||
}
|
||||
|
||||
pub struct ItemUsage {
|
||||
|
@ -33,13 +37,16 @@ impl PlayerInventory {
|
|||
|
||||
pub fn load_from_save(data: PlayerInventoryData) -> Self {
|
||||
Self {
|
||||
weapons_seq: SequenceGenerator::from_data(&data.weapons),
|
||||
items: data.items.clone(),
|
||||
weapons: data.weapons.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn build_save_data(&self) -> PlayerInventoryData {
|
||||
PlayerInventoryData {
|
||||
items: self.items.clone(),
|
||||
weapons: self.weapons.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,10 +59,19 @@ impl PlayerInventory {
|
|||
}
|
||||
|
||||
pub fn consume_item(&mut self, id: i32, quantity: i32) -> Result<i32, InventoryError> {
|
||||
Ok(*self.consume_items(&[ItemUsage { id, quantity: -quantity }])?.get(&id).unwrap())
|
||||
Ok(*self
|
||||
.consume_items(&[ItemUsage {
|
||||
id,
|
||||
quantity: -quantity,
|
||||
}])?
|
||||
.get(&id)
|
||||
.unwrap())
|
||||
}
|
||||
|
||||
pub fn consume_items(&mut self, usages: &[ItemUsage]) -> Result<HashMap<i32, i32>, InventoryError> {
|
||||
pub fn consume_items(
|
||||
&mut self,
|
||||
usages: &[ItemUsage],
|
||||
) -> Result<HashMap<i32, i32>, InventoryError> {
|
||||
if !self.has_enough_items(usages) {
|
||||
return Err(InventoryError::ItemsNotEnough());
|
||||
}
|
||||
|
@ -68,6 +84,11 @@ impl PlayerInventory {
|
|||
self.items.get(&Self::UNION_EXP_ID).copied().unwrap_or(0)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn add_shell_credits(&mut self, count: i32) -> i32 {
|
||||
self.add_internal(Self::SHELL_CREDIT_ID, count)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn get_shell_credits(&self) -> i32 {
|
||||
self.items.get(&Self::SHELL_CREDIT_ID).copied().unwrap_or(0)
|
||||
|
@ -97,35 +118,113 @@ impl PlayerInventory {
|
|||
// TODO: Check if this is item or not
|
||||
#[inline(always)]
|
||||
pub fn get_waveplate_crystal(&self) -> i32 {
|
||||
self.items.get(&Self::WAVEPLATE_CRYSTAL_ID).copied().unwrap_or(0)
|
||||
self.items
|
||||
.get(&Self::WAVEPLATE_CRYSTAL_ID)
|
||||
.copied()
|
||||
.unwrap_or(0)
|
||||
}
|
||||
|
||||
pub fn to_normal_item_list(&self) -> Vec<NormalItem> {
|
||||
self.items.iter()
|
||||
self.items
|
||||
.iter()
|
||||
.filter(|(&id, _)| Self::WAVEPLATE_ID != id && Self::WAVEPLATE_CRYSTAL_ID != id)
|
||||
// TODO: Implement expiration
|
||||
.map(|(&id, &count)| NormalItem { id, count, expire_time: 0 })
|
||||
.map(|(&id, &count)| NormalItem {
|
||||
id,
|
||||
count,
|
||||
expire_time: 0,
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
}
|
||||
|
||||
pub fn to_normal_item_list_filtered(&self, ids: Vec<i32>) -> Vec<NormalItem> {
|
||||
self.items.iter()
|
||||
pub fn to_normal_item_list_filtered(&self, ids: &[i32]) -> Vec<NormalItem> {
|
||||
self.items
|
||||
.iter()
|
||||
.filter(|(&id, _)| ids.contains(&id))
|
||||
// TODO: Implement expiration
|
||||
.map(|(&id, &count)| NormalItem { id, count, expire_time: 0 })
|
||||
.map(|(&id, &count)| NormalItem {
|
||||
id,
|
||||
count,
|
||||
expire_time: 0,
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
}
|
||||
|
||||
pub fn to_array_int_int_filtered(&self, ids: &[i32]) -> Vec<ArrayIntInt> {
|
||||
ids.iter()
|
||||
.map(|id| ArrayIntInt {
|
||||
key: *id,
|
||||
value: self.items.get(id).copied().unwrap_or(0),
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
}
|
||||
|
||||
pub fn add_weapon(
|
||||
&mut self,
|
||||
id: i32,
|
||||
func: i32,
|
||||
level: i32,
|
||||
exp: i32,
|
||||
breach: i32,
|
||||
reson: i32,
|
||||
role: i32,
|
||||
) -> Result<i32, InventoryError> {
|
||||
let inc_id = self.weapons_seq.take_id();
|
||||
self.weapons.insert(
|
||||
inc_id,
|
||||
PlayerInventoryWeaponData {
|
||||
id,
|
||||
func_value: func,
|
||||
level,
|
||||
exp,
|
||||
breach,
|
||||
reson_level: reson,
|
||||
role_id: role,
|
||||
},
|
||||
);
|
||||
Ok(inc_id)
|
||||
}
|
||||
|
||||
pub fn remove_weapon(&mut self, id: i32) {
|
||||
self.weapons.remove(&id);
|
||||
self.weapons_seq.give_id(id);
|
||||
}
|
||||
|
||||
pub fn to_weapon_item_list(&self) -> Vec<WeaponItem> {
|
||||
self.weapons
|
||||
.iter()
|
||||
.map(|(&inc_id, data)| WeaponItem {
|
||||
id: data.id,
|
||||
incr_id: inc_id,
|
||||
func_value: data.func_value,
|
||||
weapon_level: data.level,
|
||||
weapon_exp: data.exp,
|
||||
weapon_breach: data.breach,
|
||||
weapon_reson_level: data.reson_level,
|
||||
role_id: data.role_id,
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn get_weapon_equip_info(&self, inc_id: i32) -> Option<(i32, i32)> {
|
||||
self.weapons
|
||||
.get(&inc_id)
|
||||
.map(|weapon_data| (weapon_data.id, weapon_data.breach))
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn add_internal(&mut self, id: i32, quantity: i32) -> i32 {
|
||||
*self.items.entry(id)
|
||||
*self
|
||||
.items
|
||||
.entry(id)
|
||||
.and_modify(|count| *count += quantity)
|
||||
.or_insert(quantity)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn add_many_internal(&mut self, usages: &[ItemUsage]) -> HashMap<i32, i32> {
|
||||
usages.iter()
|
||||
usages
|
||||
.iter()
|
||||
.filter(|usage| usage.quantity != 0)
|
||||
.map(|delta| (delta.id, self.add_internal(delta.id, delta.quantity)))
|
||||
.collect::<HashMap<_, _>>()
|
||||
|
@ -138,17 +237,80 @@ impl PlayerInventory {
|
|||
|
||||
#[inline(always)]
|
||||
fn has_enough_items(&self, items_delta: &[ItemUsage]) -> bool {
|
||||
items_delta.iter()
|
||||
.fold(true, |is_enough, delta| {
|
||||
is_enough && self.has_enough_item(delta.id, -delta.quantity)
|
||||
})
|
||||
items_delta
|
||||
.iter()
|
||||
.all(|delta| self.has_enough_item(delta.id, -delta.quantity))
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for PlayerInventory {
|
||||
fn default() -> Self {
|
||||
let mut weapons_seq = SequenceGenerator::new();
|
||||
let default_unlocks = &config::get_config().default_unlocks;
|
||||
let weapons: HashMap<i32, PlayerInventoryWeaponData> =
|
||||
match default_unlocks.unlock_all_weapons {
|
||||
true => wicked_waifus_data::weapon_conf_data::iter()
|
||||
.map(|data| {
|
||||
let (level, breach) = if default_unlocks.unlock_all_weapons_max_level {
|
||||
(
|
||||
wicked_waifus_data::weapon_level_data::iter()
|
||||
.filter(|level_data| level_data.level_id == data.level_id)
|
||||
.map(|level_data| level_data.level)
|
||||
.max()
|
||||
.unwrap_or(1),
|
||||
wicked_waifus_data::weapon_breach_data::iter()
|
||||
.filter(|level_data| level_data.breach_id == data.breach_id)
|
||||
.map(|level_data| level_data.level)
|
||||
.max()
|
||||
.unwrap_or(0),
|
||||
)
|
||||
} else {
|
||||
(
|
||||
wicked_waifus_data::weapon_level_data::iter()
|
||||
.filter(|level_data| level_data.level_id == data.level_id)
|
||||
.map(|level_data| level_data.level)
|
||||
.min()
|
||||
.unwrap_or(1),
|
||||
wicked_waifus_data::weapon_breach_data::iter()
|
||||
.filter(|level_data| level_data.breach_id == data.breach_id)
|
||||
.map(|level_data| level_data.level)
|
||||
.min()
|
||||
.unwrap_or(0),
|
||||
)
|
||||
};
|
||||
let reson_level = if default_unlocks.unlock_all_weapons_all_reson {
|
||||
wicked_waifus_data::weapon_reson_data::iter()
|
||||
.filter(|level_data| level_data.reson_id == data.reson_id)
|
||||
.map(|level_data| level_data.level)
|
||||
.max()
|
||||
.unwrap_or(0)
|
||||
} else {
|
||||
wicked_waifus_data::weapon_reson_data::iter()
|
||||
.filter(|level_data| level_data.reson_id == data.reson_id)
|
||||
.map(|level_data| level_data.level)
|
||||
.min()
|
||||
.unwrap_or(0)
|
||||
};
|
||||
(
|
||||
weapons_seq.take_id(),
|
||||
PlayerInventoryWeaponData {
|
||||
id: data.item_id,
|
||||
func_value: 0,
|
||||
level,
|
||||
exp: 0,
|
||||
breach,
|
||||
reson_level,
|
||||
role_id: 0,
|
||||
},
|
||||
)
|
||||
})
|
||||
.collect::<HashMap<_, _>>(),
|
||||
false => Default::default(),
|
||||
};
|
||||
Self {
|
||||
items: HashMap::new(),
|
||||
weapons_seq,
|
||||
weapons,
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
use crate::config;
|
||||
use std::collections::HashSet;
|
||||
use wicked_waifus_protocol_internal::PlayerUnlockedSkinsData;
|
||||
|
||||
pub struct PlayerUnlockedSkins {
|
||||
pub role_skins: HashSet<i32>,
|
||||
pub weapon_skins: HashSet<i32>,
|
||||
pub fly_skins: HashSet<i32>,
|
||||
pub wing_skins: HashSet<i32>,
|
||||
}
|
||||
|
||||
impl PlayerUnlockedSkins {
|
||||
pub fn load_from_save(data: PlayerUnlockedSkinsData) -> Self {
|
||||
Self {
|
||||
role_skins: data.role_skins.iter().cloned().collect(),
|
||||
weapon_skins: data.weapon_skins.iter().cloned().collect(),
|
||||
fly_skins: data.fly_skins.iter().cloned().collect(),
|
||||
wing_skins: data.wing_skins.iter().cloned().collect(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn build_save_data(&self) -> PlayerUnlockedSkinsData {
|
||||
PlayerUnlockedSkinsData {
|
||||
role_skins: self.role_skins.iter().cloned().collect(),
|
||||
weapon_skins: self.weapon_skins.iter().cloned().collect(),
|
||||
fly_skins: self.fly_skins.iter().cloned().collect(),
|
||||
wing_skins: self.wing_skins.iter().cloned().collect(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for PlayerUnlockedSkins {
|
||||
fn default() -> Self {
|
||||
let unlocks = &config::get_config().default_unlocks;
|
||||
|
||||
Self {
|
||||
role_skins: if unlocks.unlock_all_role_skins {
|
||||
wicked_waifus_data::role_skin_data::iter()
|
||||
.map(|skin| skin.id)
|
||||
.collect()
|
||||
} else {
|
||||
HashSet::new()
|
||||
},
|
||||
|
||||
weapon_skins: if unlocks.unlock_all_weapon_skins {
|
||||
wicked_waifus_data::weapon_skin_data::iter()
|
||||
.map(|skin| skin.id)
|
||||
.collect()
|
||||
} else {
|
||||
HashSet::new()
|
||||
},
|
||||
|
||||
fly_skins: if unlocks.unlock_all_fly_skins {
|
||||
wicked_waifus_data::fly_skin_config_data::iter()
|
||||
.filter(|skin| skin.skin_type == 0)
|
||||
.map(|skin| skin.id)
|
||||
.collect()
|
||||
} else {
|
||||
HashSet::new()
|
||||
},
|
||||
|
||||
wing_skins: if unlocks.unlock_all_wing_skins {
|
||||
wicked_waifus_data::fly_skin_config_data::iter()
|
||||
.filter(|skin| skin.skin_type == 1)
|
||||
.map(|skin| skin.id)
|
||||
.collect()
|
||||
} else {
|
||||
HashSet::new()
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ pub struct RoleFormation {
|
|||
|
||||
// Will be updated every version
|
||||
// const DEFAULT_FORMATION: &[i32] = &[5101, 1407, 1507];
|
||||
const DEFAULT_FORMATION: &[i32] = &[1506, 1207, 1409];
|
||||
const DEFAULT_FORMATION: &[i32] = &[1205, 1207, 1409];
|
||||
|
||||
impl RoleFormation {
|
||||
pub fn default_roles() -> &'static [i32] {
|
||||
|
@ -29,7 +29,7 @@ impl RoleFormation {
|
|||
RoleFormationData {
|
||||
formation_id: self.id,
|
||||
cur_role: self.cur_role,
|
||||
role_id_list: self.role_ids.to_vec(),
|
||||
role_id_list: self.role_ids.iter().copied().collect(),
|
||||
is_current: self.is_current,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use wicked_waifus_protocol::{ArrayIntInt, RoleInfo};
|
||||
use wicked_waifus_protocol::{ArrayIntInt, FormationRoleInfo, RoleInfo};
|
||||
|
||||
use crate::config;
|
||||
use crate::logic::utils::growth_utils::get_role_props_by_level;
|
||||
|
@ -50,6 +50,9 @@ pub struct Role {
|
|||
pub element_energy: i32,
|
||||
pub favor_level: i32,
|
||||
pub favor_exp: i32,
|
||||
pub wing_skin_id: i32,
|
||||
pub fly_skin_id: i32,
|
||||
pub weapon_skin_id: i32,
|
||||
}
|
||||
|
||||
impl Role {
|
||||
|
@ -119,21 +122,44 @@ impl Role {
|
|||
|
||||
let default_unlocks = &config::get_config().default_unlocks;
|
||||
let (level, breakthrough) = if default_unlocks.unlock_all_roles_max_level {
|
||||
(data.max_level, 6)
|
||||
(
|
||||
data.max_level,
|
||||
wicked_waifus_data::role_breach_data::iter()
|
||||
.filter(|level_data| level_data.breach_group_id == data.breach_id)
|
||||
.map(|level_data| level_data.breach_level)
|
||||
.max()
|
||||
.unwrap_or(0),
|
||||
)
|
||||
} else {
|
||||
(1, 0)
|
||||
(
|
||||
1,
|
||||
wicked_waifus_data::role_breach_data::iter()
|
||||
.filter(|level_data| level_data.breach_group_id == data.breach_id)
|
||||
.map(|level_data| level_data.breach_level)
|
||||
.min()
|
||||
.unwrap_or(0),
|
||||
)
|
||||
};
|
||||
let resonant_chain_group_index = if default_unlocks.unlock_all_roles_all_sequences {
|
||||
6
|
||||
wicked_waifus_data::resonant_chain_data::iter()
|
||||
.filter(|level_data| level_data.group_id == data.resonant_chain_group_id)
|
||||
.map(|level_data| level_data.group_index)
|
||||
.max()
|
||||
.unwrap_or(0)
|
||||
} else {
|
||||
0
|
||||
wicked_waifus_data::resonant_chain_data::iter()
|
||||
.filter(|level_data| level_data.group_id == data.resonant_chain_group_id)
|
||||
.map(|level_data| level_data.group_index)
|
||||
.min()
|
||||
.unwrap_or(0)
|
||||
};
|
||||
// TODO: add weapon and echo stats
|
||||
let base_stats = &get_role_props_by_level(role_id, level, breakthrough);
|
||||
Self {
|
||||
role_id,
|
||||
name: String::with_capacity(0),
|
||||
level,
|
||||
exp: 0, // TODO: Compute based on level??
|
||||
exp: 0,
|
||||
breakthrough,
|
||||
skill_map: HashMap::new(), // TODO!
|
||||
star: 0,
|
||||
|
@ -151,24 +177,29 @@ impl Role {
|
|||
element_energy: base_stats.element_energy,
|
||||
favor_level: 0,
|
||||
favor_exp: 0,
|
||||
wing_skin_id: 0,
|
||||
fly_skin_id: 0,
|
||||
weapon_skin_id: 0,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_base_properties(&self) -> BasePropertyData {
|
||||
// Overwrite dynamic attributes with stores values
|
||||
let mut base_stats = get_role_props_by_level(self.role_id, self.level, self.breakthrough);
|
||||
// TODO: add weapon and echo stats
|
||||
// TODO: Integrity check, value has to be between 0 and max
|
||||
base_stats.life = base_stats.life_max;
|
||||
base_stats.energy = base_stats.energy_max;
|
||||
base_stats.life = self.hp;
|
||||
base_stats.energy = self.energy;
|
||||
base_stats.special_energy_1 = self.special_energy_1;
|
||||
base_stats.special_energy_2 = self.special_energy_2;
|
||||
base_stats.special_energy_3 = self.special_energy_3;
|
||||
base_stats.special_energy_4 = self.special_energy_4;
|
||||
base_stats.element_energy = base_stats.element_energy_max;
|
||||
base_stats.element_energy = self.element_energy;
|
||||
base_stats
|
||||
}
|
||||
|
||||
pub fn to_protobuf(&self) -> RoleInfo {
|
||||
// TODO: add weapon and echo stats
|
||||
let base_prop: HashMap<i32, i32> = load_key_value(&self.get_base_properties());
|
||||
RoleInfo {
|
||||
role_id: self.role_id,
|
||||
|
@ -192,6 +223,17 @@ impl Role {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn to_formation_protobuf(&self) -> FormationRoleInfo {
|
||||
let base_stats = get_role_props_by_level(self.role_id, self.level, self.breakthrough);
|
||||
FormationRoleInfo {
|
||||
role_id: self.role_id,
|
||||
max_hp: base_stats.life_max,
|
||||
cur_hp: base_stats.life,
|
||||
level: self.level,
|
||||
role_skin_id: self.skin_id,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn load_from_save(data: RoleData) -> (i32, Self) {
|
||||
(
|
||||
data.role_id,
|
||||
|
@ -217,6 +259,9 @@ impl Role {
|
|||
element_energy: data.stats.unwrap().element_energy,
|
||||
favor_level: data.favor_level,
|
||||
favor_exp: data.favor_exp,
|
||||
wing_skin_id: data.wing_skin_id,
|
||||
fly_skin_id: data.fly_skin_id,
|
||||
weapon_skin_id: data.weapon_skin_id,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
@ -250,6 +295,9 @@ impl Role {
|
|||
}),
|
||||
favor_level: self.favor_level,
|
||||
favor_exp: self.favor_exp,
|
||||
wing_skin_id: self.wing_skin_id,
|
||||
fly_skin_id: self.fly_skin_id,
|
||||
weapon_skin_id: self.weapon_skin_id,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
use super::{ecs::world::World, player::Player, utils::world_util};
|
||||
use crate::logic::ecs::world::WorldEntity;
|
||||
use crate::{
|
||||
logic,
|
||||
player_save_task::{self, PlayerSaveReason},
|
||||
session::Session,
|
||||
};
|
||||
use wicked_waifus_commons::time_util;
|
||||
use wicked_waifus_protocol_internal::PlayerSaveData;
|
||||
use wicked_waifus_protocol::{message::Message, AfterJoinSceneNotify, EnterGameResponse, JoinSceneNotify, SilenceNpcNotify, TransitionOptionPb};
|
||||
use std::collections::hash_map::Entry::Vacant;
|
||||
use std::{
|
||||
cell::RefCell,
|
||||
|
@ -17,20 +13,16 @@ use std::{
|
|||
thread,
|
||||
time::Duration,
|
||||
};
|
||||
use wicked_waifus_commons::time_util;
|
||||
use wicked_waifus_protocol::{
|
||||
message::Message, AfterJoinSceneNotify, EnterGameResponse, JoinSceneNotify, SilenceNpcNotify,
|
||||
TransitionOptionPb,
|
||||
};
|
||||
use wicked_waifus_protocol::{FormationAttr, FormationAttrNotify};
|
||||
use wicked_waifus_protocol_internal::PlayerSaveData;
|
||||
use super::{ecs::world::World, player::Player, utils::world_util};
|
||||
use crate::logic::ecs::world::WorldEntity;
|
||||
use crate::{logic, player_save_task::{self, PlayerSaveReason}, session::Session};
|
||||
|
||||
pub enum LogicInput {
|
||||
AddPlayer {
|
||||
player_id: i32,
|
||||
enter_rpc_id: u16,
|
||||
session: Arc<Session>,
|
||||
player_save_data: Box<PlayerSaveData>,
|
||||
player_save_data: PlayerSaveData,
|
||||
},
|
||||
RemovePlayer {
|
||||
player_id: i32,
|
||||
|
@ -140,14 +132,16 @@ fn handle_logic_input(state: &mut LogicState, input: LogicInput) {
|
|||
} => {
|
||||
let (player, is_player) = if let Vacant(e) = state.players.entry(player_id) {
|
||||
(
|
||||
e.insert(RefCell::new(Player::load_from_save(*player_save_data))),
|
||||
e.insert(RefCell::new(Player::load_from_save(player_save_data))),
|
||||
true,
|
||||
)
|
||||
} else if let Some(player) = state.players.get_mut(&player_id) {
|
||||
} else {
|
||||
if let Some(player) = state.players.get_mut(&player_id) {
|
||||
(player, false)
|
||||
} else {
|
||||
tracing::warn!("logic_thread: get player requested, but player {player_id} with data doesn't exist");
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
let mut player = player.borrow_mut();
|
||||
|
@ -169,7 +163,8 @@ fn handle_logic_input(state: &mut LogicState, input: LogicInput) {
|
|||
.world
|
||||
.borrow_mut()
|
||||
.set_in_world_player_data(player.build_in_world_player());
|
||||
world_util::add_player_entities(&player, player.formation_list.get(&player.cur_formation_id).unwrap(), None);
|
||||
|
||||
world_util::add_player_entities(&player);
|
||||
let scene_info = world_util::build_scene_information(&player);
|
||||
|
||||
player.notify(SilenceNpcNotify::default());
|
||||
|
@ -180,26 +175,6 @@ fn handle_logic_input(state: &mut LogicState, input: LogicInput) {
|
|||
transition_option: Some(TransitionOptionPb::default()),
|
||||
});
|
||||
|
||||
player.notify(FormationAttrNotify {
|
||||
duration: 1534854458,
|
||||
formation_attrs: vec![
|
||||
FormationAttr {
|
||||
attr_id: 1,
|
||||
ratio: 2400,
|
||||
base_max_value: 24000,
|
||||
max_value: 24000,
|
||||
current_value: 24000,
|
||||
},
|
||||
FormationAttr {
|
||||
attr_id: 10,
|
||||
ratio: 2400,
|
||||
base_max_value: 15000,
|
||||
max_value: 15000,
|
||||
current_value: 15000,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
player.notify(AfterJoinSceneNotify::default());
|
||||
player.notify(player.build_update_formation_notify());
|
||||
|
||||
|
@ -236,14 +211,10 @@ fn handle_logic_input(state: &mut LogicState, input: LogicInput) {
|
|||
return;
|
||||
};
|
||||
|
||||
let removed_world = state.worlds.remove(&player_id).unwrap();
|
||||
let mut removed_world_ref = removed_world.borrow_mut();
|
||||
let world = removed_world_ref.get_mut_world_entity();
|
||||
for entity_id in world.get_all_entity_ids() {
|
||||
world.remove_entity(entity_id);
|
||||
}
|
||||
|
||||
let _ = state.worlds.remove(&player_id);
|
||||
// TODO: kick co-op players from removed world
|
||||
// TODO: Remove all entities
|
||||
|
||||
player_save_task::push(
|
||||
player_id,
|
||||
player.borrow().build_save_data(),
|
||||
|
|
315
wicked-waifus-game-server/src/logic/utils/action_utils.rs
Normal file
315
wicked-waifus-game-server/src/logic/utils/action_utils.rs
Normal file
|
@ -0,0 +1,315 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use wicked_waifus_protocol::{CommonTagData, EntityCommonTagNotify, EntityStateReadyNotify, ItemRewardNotify, NormalItemUpdateNotify, RewardItemInfo, WR};
|
||||
|
||||
use wicked_waifus_data::pb_components::action::{Action, ChangeSelfEntityState, UnlockTeleportTrigger};
|
||||
use wicked_waifus_data::pb_components::entity_state::EntityStateComponent;
|
||||
|
||||
use crate::logic::ecs::component::ComponentContainer;
|
||||
use crate::logic::player::{ItemUsage, Player};
|
||||
use crate::logic::utils::tag_utils;
|
||||
use crate::query_components;
|
||||
|
||||
macro_rules! unimplemented_action {
|
||||
($action:ident) => {
|
||||
{
|
||||
tracing::warn!("Action not implemented for: {:?}", $action);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn perform_action(player: &mut Player,
|
||||
entity_id: i64,
|
||||
level_entity_data: &wicked_waifus_data::LevelEntityConfigData,
|
||||
template_config: &wicked_waifus_data::TemplateConfigData,
|
||||
element: Action) {
|
||||
match element {
|
||||
Action::SetBattleState(action) => unimplemented_action! { action },
|
||||
Action::ExecBattleAction(action) => unimplemented_action! { action },
|
||||
Action::WaitBattleCondition(action) => unimplemented_action! { action },
|
||||
Action::PlayFlow(action) => unimplemented_action! { action },
|
||||
Action::Collect(_) => collect_action(player, level_entity_data, template_config),
|
||||
Action::LeisureInteract(action) => unimplemented_action! { action },
|
||||
Action::UnlockTeleportTrigger(action) => unlock_teleport_trigger(player, action.params),
|
||||
Action::EnableTemporaryTeleport(action) => unimplemented_action! { action },
|
||||
Action::OpenSystemBoard(action) => unimplemented_action! { action },
|
||||
Action::OpenSystemFunction(action) => unimplemented_action! { action },
|
||||
Action::ChangeSelfEntityState(action) => change_self_entity_state(player, entity_id, level_entity_data, template_config, action.params),
|
||||
Action::SetPlayerOperationRestriction(action) => unimplemented_action! { action },
|
||||
Action::Wait(action) => unimplemented_action! { action },
|
||||
Action::ChangeEntityState(action) => unimplemented_action! { action },
|
||||
Action::Log(action) => unimplemented_action! { action },
|
||||
Action::EnableNearbyTracking(action) => unimplemented_action! { action },
|
||||
Action::TeleportDungeon(action) => unimplemented_action! { action },
|
||||
Action::DestroySelf(action) => unimplemented_action! { action },
|
||||
Action::CameraLookAt(action) => unimplemented_action! { action },
|
||||
Action::StopCameraLookAt(action) => unimplemented_action! { action },
|
||||
Action::EnterOrbitalCamera(action) => unimplemented_action! { action },
|
||||
Action::ExitOrbitalCamera(action) => unimplemented_action! { action },
|
||||
Action::SendAiEvent(action) => unimplemented_action! { action },
|
||||
Action::SetInteractionLockState(action) => unimplemented_action! { action },
|
||||
Action::AwakeEntity(action) => unimplemented_action! { action },
|
||||
Action::ChangeLiftTarget(action) => unimplemented_action! { action },
|
||||
Action::CalculateVar(action) => unimplemented_action! { action },
|
||||
Action::AddBuffToPlayer(action) => unimplemented_action! { action },
|
||||
Action::RemoveBuffFromPlayer(action) => unimplemented_action! { action },
|
||||
Action::AddBuffToEntity(action) => unimplemented_action! { action },
|
||||
Action::RemoveBuffFromEntity(action) => unimplemented_action! { action },
|
||||
Action::Prompt(action) => unimplemented_action! { action },
|
||||
Action::SetEntityVisible(action) => unimplemented_action! { action },
|
||||
Action::DestroyEntity(action) => unimplemented_action! { action },
|
||||
Action::GuideTrigger(action) => unimplemented_action! { action },
|
||||
Action::TriggerCameraShake(action) => unimplemented_action! { action },
|
||||
Action::SetVar(action) => unimplemented_action! { action },
|
||||
Action::VehicleEnter(action) => unimplemented_action! { action },
|
||||
Action::VehicleExitPlayer(action) => unimplemented_action! { action },
|
||||
Action::LockEntity(action) => unimplemented_action! { action },
|
||||
Action::UnlockEntity(action) => unimplemented_action! { action },
|
||||
Action::CommonTip(action) => unimplemented_action! { action },
|
||||
Action::CommonTip2(action) => unimplemented_action! { action },
|
||||
Action::PostAkEvent(action) => unimplemented_action! { action },
|
||||
Action::VehicleEnterNpc(action) => unimplemented_action! { action },
|
||||
Action::VehicleExitNpc(action) => unimplemented_action! { action },
|
||||
Action::PlayerLookAt(action) => unimplemented_action! { action },
|
||||
Action::PlayBubble(action) => unimplemented_action! { action },
|
||||
Action::AddPlayBubble(action) => unimplemented_action! { action },
|
||||
Action::ClearPlayBubble(action) => unimplemented_action! { action },
|
||||
Action::ExecRiskHarvestEffect(action) => unimplemented_action! { action },
|
||||
Action::EnableLevelPlay(action) => unimplemented_action! { action },
|
||||
Action::ClaimLevelPlayReward(action) => unimplemented_action! { action },
|
||||
Action::SettlementDungeon(action) => unimplemented_action! { action },
|
||||
Action::ExitDungeon(action) => unimplemented_action! { action },
|
||||
Action::FinishDungeon(action) => unimplemented_action! { action },
|
||||
Action::RecordDungeonEvent(action) => unimplemented_action! { action },
|
||||
Action::RecoverDurability(action) => unimplemented_action! { action },
|
||||
Action::FadeInScreen(action) => unimplemented_action! { action },
|
||||
Action::FadeOutScreen(action) => unimplemented_action! { action },
|
||||
Action::ChangeNpcPerformState(action) => unimplemented_action! { action },
|
||||
Action::EntityTurnTo(action) => unimplemented_action! { action },
|
||||
Action::EntityLookAt(action) => unimplemented_action! { action },
|
||||
Action::ToggleMapMarkState(action) => unimplemented_action! { action },
|
||||
Action::RandomVar(action) => unimplemented_action! { action },
|
||||
Action::ModifySceneItemAttributeTag(action) => unimplemented_action! { action },
|
||||
Action::VehicleWaterfallClimbing(action) => unimplemented_action! { action },
|
||||
Action::VehicleTeleport(action) => unimplemented_action! { action },
|
||||
Action::RogueGotoNextFloor(action) => unimplemented_action! { action },
|
||||
Action::RogueReceiveReward(action) => unimplemented_action! { action },
|
||||
Action::RogueSelectRoom(action) => unimplemented_action! { action },
|
||||
Action::RogueActivatePortal(action) => unimplemented_action! { action },
|
||||
Action::MowingTowerGotoNextFloor(action) => unimplemented_action! { action },
|
||||
Action::SlashAndTowerGotoNextFloor(action) => unimplemented_action! { action },
|
||||
Action::PlayMontage(action) => unimplemented_action! { action },
|
||||
Action::OpenSystemBoardWithReturn(action) => unimplemented_action! { action },
|
||||
Action::UnlockSystemItem(action) => unimplemented_action! { action },
|
||||
Action::SetSportsState(action) => unimplemented_action! { action },
|
||||
Action::OpenSimpleGameplay(action) => unimplemented_action! { action },
|
||||
Action::PlayEffect(action) => unimplemented_action! { action },
|
||||
Action::PlayEffect2(action) => unimplemented_action! { action },
|
||||
Action::RestorePlayerCameraAdjustment(action) => unimplemented_action! { action },
|
||||
Action::AdjustPlayerCamera(action) => unimplemented_action! { action },
|
||||
Action::SetPlayerPos(action) => unimplemented_action! { action },
|
||||
Action::MoveWithSpline(action) => unimplemented_action! { action },
|
||||
Action::EnableSplineMoveModel(action) => unimplemented_action! { action },
|
||||
Action::ToggleScanSplineEffect(action) => unimplemented_action! { action },
|
||||
Action::MoveSceneItem(action) => unimplemented_action! { action },
|
||||
Action::StopSceneItemMove(action) => unimplemented_action! { action },
|
||||
Action::FireBullet(action) => unimplemented_action! { action },
|
||||
Action::ClearFishingCabinInSaleItems(action) => unimplemented_action! { action },
|
||||
Action::AcceptFishingEntrust(action) => unimplemented_action! { action },
|
||||
Action::DestroyFishingBoat(action) => unimplemented_action! { action },
|
||||
Action::SetJigsawItem(action) => unimplemented_action! { action },
|
||||
Action::SetJigsawFoundation(action) => unimplemented_action! { action },
|
||||
Action::SetTeleControl(action) => unimplemented_action! { action },
|
||||
Action::SetEntityClientVisible(action) => unimplemented_action! { action },
|
||||
Action::ToggleHighlightExploreUi(action) => unimplemented_action! { action },
|
||||
Action::ExecAlertSystemAction(action) => unimplemented_action! { action },
|
||||
Action::AddFlowInteractOption(action) => unimplemented_action! { action },
|
||||
Action::RemoveFlowInteractOption(action) => unimplemented_action! { action },
|
||||
Action::EnableHostility(action) => unimplemented_action! { action },
|
||||
Action::ChangePhantomFormation(action) => unimplemented_action! { action },
|
||||
Action::RestorePhantomFormation(action) => unimplemented_action! { action },
|
||||
Action::ChangeTimer(action) => unimplemented_action! { action },
|
||||
Action::ToggleTimerPauseState(action) => unimplemented_action! { action },
|
||||
Action::ChangeFightTeam(action) => unimplemented_action! { action },
|
||||
Action::AddTrialFollowShooter(action) => unimplemented_action! { action },
|
||||
Action::RemoveTrialFollowShooter(action) => unimplemented_action! { action },
|
||||
Action::AddTrialCharacter(action) => unimplemented_action! { action },
|
||||
Action::RemoveTrialCharacter(action) => unimplemented_action! { action },
|
||||
Action::SetAreaState(action) => unimplemented_action! { action },
|
||||
Action::SwitchSubLevels(action) => unimplemented_action! { action },
|
||||
Action::ChangeTeamPosition(action) => unimplemented_action! { action },
|
||||
Action::GetItem(action) => unimplemented_action! { action },
|
||||
Action::CreatePrefab(action) => unimplemented_action! { action },
|
||||
Action::DestroyPrefab(action) => unimplemented_action! { action },
|
||||
Action::CompleteGuide(action) => unimplemented_action! { action },
|
||||
Action::PlayDynamicSettlement(action) => unimplemented_action! { action },
|
||||
Action::UsePhantomSkill(action) => unimplemented_action! { action },
|
||||
Action::HideTargetRange(action) => unimplemented_action! { action },
|
||||
Action::ChangeOtherState(action) => unimplemented_action! { action },
|
||||
Action::SetRegionConfig(action) => unimplemented_action! { action },
|
||||
Action::SetReviveRegion(action) => unimplemented_action! { action },
|
||||
Action::ExecResurrection(action) => unimplemented_action! { action },
|
||||
Action::ShowTargetRange(action) => unimplemented_action! { action },
|
||||
Action::SetTime(action) => unimplemented_action! { action },
|
||||
Action::SetTimeLockState(action) => unimplemented_action! { action },
|
||||
Action::EnableSystem(action) => unimplemented_action! { action },
|
||||
Action::EnableAoiNotify(action) => unimplemented_action! { action },
|
||||
Action::SetForceLock(action) => unimplemented_action! { action },
|
||||
Action::PlayRegisteredMontage(action) => unimplemented_action! { action },
|
||||
Action::SetAudioState(action) => unimplemented_action! { action },
|
||||
Action::HideGroup(action) => unimplemented_action! { action },
|
||||
Action::ShowHidedGroup(action) => unimplemented_action! { action },
|
||||
Action::HideSpecificEntities(action) => unimplemented_action! { action },
|
||||
Action::ShowSpecificEntities(action) => unimplemented_action! { action },
|
||||
Action::RemovePreloadResource(action) => unimplemented_action! { action },
|
||||
Action::Preload(action) => unimplemented_action! { action },
|
||||
Action::EnableAI(action) => unimplemented_action! { action },
|
||||
Action::SwitchDataLayers(action) => unimplemented_action! { action },
|
||||
Action::DestroyQuest(action) => unimplemented_action! { action },
|
||||
Action::DestroyQuestItem(action) => unimplemented_action! { action },
|
||||
Action::PromptQuestChapterUI(action) => unimplemented_action! { action },
|
||||
Action::TakePlotPhoto(action) => unimplemented_action! { action },
|
||||
Action::SetWuYinQuState(action) => unimplemented_action! { action },
|
||||
Action::RunActions(action) => unimplemented_action! { action },
|
||||
Action::ManualOccupations(action) => unimplemented_action! { action },
|
||||
Action::SetWeather(action) => unimplemented_action! { action },
|
||||
Action::SendNpcMail(action) => unimplemented_action! { action },
|
||||
Action::EnableFunction(action) => unimplemented_action! { action },
|
||||
Action::FocusOnMapMark(action) => unimplemented_action! { action },
|
||||
Action::CharacterLookAt(action) => unimplemented_action! { action },
|
||||
Action::AddGuestCharacter(action) => unimplemented_action! { action },
|
||||
Action::RemoveGuestCharacter(action) => unimplemented_action! { action },
|
||||
Action::TeleportToAndEnterVehicle(action) => unimplemented_action! { action },
|
||||
Action::SetAreaTimeState(action) => unimplemented_action! { action },
|
||||
Action::ResetPlayerCameraFocus(action) => unimplemented_action! { action },
|
||||
Action::ResetLevelPlay(action) => unimplemented_action! { action },
|
||||
Action::VehicleSprint(action) => unimplemented_action! { action },
|
||||
Action::VehicleMoveWithPathLine(action) => unimplemented_action! { action },
|
||||
Action::ClientPreEnableSubLevels(action) => unimplemented_action! { action },
|
||||
Action::GuestOperateUiAnimation(action) => unimplemented_action! { action },
|
||||
Action::ChangeEntityCamp(action) => unimplemented_action! { action },
|
||||
Action::NewMoveWithSpline(action) => unimplemented_action! { action },
|
||||
Action::DangoAbyssActivatePortal(action) => unimplemented_action! { action },
|
||||
Action::DangoAbyssCreateRewardTreasureBox(action) => unimplemented_action! { action },
|
||||
Action::DangoAbyssGotoNextFloor(action) => unimplemented_action! { action },
|
||||
Action::DangoAbyssReceiveReward(action) => unimplemented_action! { action },
|
||||
Action::SummonEntity(action) => unimplemented_action! { action },
|
||||
Action::GetRewardByInteract(action) => unimplemented_action! { action },
|
||||
Action::OpenQte(action) => unimplemented_action! { action },
|
||||
Action::ActiveAntiGravitySafePoint(action) => unimplemented_action! { action },
|
||||
Action::BvbPlayDialog(action) => unimplemented_action! { action },
|
||||
Action::BvbSendSystemEvent(action) => unimplemented_action! { action },
|
||||
Action::BvbSendAiEvent(action) => unimplemented_action! { action },
|
||||
Action::BvbPlayerOperationConstraint(action) => unimplemented_action! { action },
|
||||
Action::ExecClientBattleAction(action) => unimplemented_action! { action },
|
||||
Action::TriggerSpecificScanEffect(action) => unimplemented_action! { action },
|
||||
Action::SetActorVar(action) => unimplemented_action! { action },
|
||||
Action::RunActorCustomEvent(action) => unimplemented_action! { action },
|
||||
Action::StopUiScreenEffect(action) => unimplemented_action! { action },
|
||||
Action::StopNewMoveWithSpline(action) => unimplemented_action! { action },
|
||||
Action::RequestSystemFunction(action) => unimplemented_action! { action },
|
||||
}
|
||||
}
|
||||
|
||||
fn collect_action(player: &mut Player,
|
||||
level_entity_data: &wicked_waifus_data::LevelEntityConfigData,
|
||||
template_config: &wicked_waifus_data::TemplateConfigData) {
|
||||
if let Some(reward_component) = level_entity_data.components_data.reward_component
|
||||
.as_ref()
|
||||
.or(template_config.components_data.reward_component.as_ref()) {
|
||||
if reward_component.disabled.unwrap_or(false) {
|
||||
return;
|
||||
}
|
||||
// TODO: check the use of reward_type and drop_on_event
|
||||
// Seems type 0 is reward from preview, while 1 and 2 is unknown
|
||||
if let Some(reward_id) = reward_component.reward_id {
|
||||
let drop = wicked_waifus_data::drop_package_data::get(&reward_id).unwrap();
|
||||
let usages = drop.drop_preview.iter()
|
||||
.map(|(&id, &quantity)| ItemUsage { id, quantity })
|
||||
.collect::<Vec<_>>();
|
||||
let updated_items = player.inventory.add_items(&usages);
|
||||
let normal_item_list = player.inventory.to_normal_item_list_filtered(
|
||||
&updated_items.keys().cloned().collect::<Vec<i32>>()
|
||||
);
|
||||
player.notify(NormalItemUpdateNotify { normal_item_list, no_tips: false });
|
||||
// UpdateHandBookActiveStateMapNotify
|
||||
let mut rewards: HashMap<i32, WR> = HashMap::new();
|
||||
rewards.insert(0, WR {
|
||||
item_list: drop.drop_preview.iter()
|
||||
.map(|(&id, &quantity)| RewardItemInfo {
|
||||
show_plan_id: 0, // TODO: Check how to get this
|
||||
item_id: id,
|
||||
count: quantity,
|
||||
incr_id: 0,
|
||||
})
|
||||
.collect::<Vec<_>>(),
|
||||
});
|
||||
player.notify(ItemRewardNotify {
|
||||
drop_id: reward_id,
|
||||
reason: 15000,
|
||||
magnification: 1,
|
||||
reward_items: rewards,
|
||||
});
|
||||
}
|
||||
// TODO: Should we remove entity?? get pcap
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn unlock_teleport_trigger(player: &mut Player, action: UnlockTeleportTrigger) {
|
||||
player.unlock_teleport(action.teleport_id)
|
||||
}
|
||||
|
||||
fn change_self_entity_state(player: &mut Player,
|
||||
entity_id: i64,
|
||||
level_entity_data: &wicked_waifus_data::LevelEntityConfigData,
|
||||
template_config: &wicked_waifus_data::TemplateConfigData,
|
||||
action: ChangeSelfEntityState) {
|
||||
let state = tag_utils::get_tag_id_by_name(action.entity_state.as_str());
|
||||
|
||||
// TODO: update Tag::CommonEntityTags too??
|
||||
let old_state = {
|
||||
let world_ref = player.world.borrow();
|
||||
let world = world_ref.get_world_entity();
|
||||
let mut state_tag = query_components!(world, entity_id, StateTag).0.unwrap();
|
||||
let old_state = state_tag.state_tag_id;
|
||||
tracing::debug!("ChangeSelfEntityState: old state {old_state} -> new state: {state}");
|
||||
state_tag.state_tag_id = state;
|
||||
old_state
|
||||
};
|
||||
|
||||
if let Some(entity_state_component) = level_entity_data.components_data.entity_state_component.as_ref()
|
||||
.or(template_config.components_data.entity_state_component.as_ref()).cloned() {
|
||||
let entity_state_component: EntityStateComponent = entity_state_component; // TODO: Remove this line, used for casting only
|
||||
|
||||
// TODO: implement rest of cases
|
||||
if let Some(state_change_behaviors) = entity_state_component.state_change_behaviors {
|
||||
for state_change_behavior in state_change_behaviors {
|
||||
// TODO: implement rest of cases
|
||||
let expected = tag_utils::get_tag_id_by_name(state_change_behavior.state.as_str());
|
||||
|
||||
if expected == state {
|
||||
if let Some(actions) = state_change_behavior.action {
|
||||
for sub in actions {
|
||||
perform_action(player, entity_id, level_entity_data, template_config, sub);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
player.notify(EntityCommonTagNotify {
|
||||
id: entity_id,
|
||||
tags: vec![
|
||||
CommonTagData { tag_id: old_state, remove_tag_ids: false }, // Remove
|
||||
CommonTagData { tag_id: state, remove_tag_ids: true }, // Add
|
||||
],
|
||||
});
|
||||
|
||||
player.notify(EntityStateReadyNotify {
|
||||
entity_id,
|
||||
tag_id: state,
|
||||
ready: true, // TODO: Always true? or shall we compare it to something??
|
||||
});
|
||||
}
|
|
@ -1,7 +1,9 @@
|
|||
pub mod action_utils;
|
||||
pub mod condition_utils;
|
||||
pub mod entity_serializer;
|
||||
pub mod load_role_info;
|
||||
pub mod world_util;
|
||||
pub mod quadrant_util;
|
||||
pub mod growth_utils;
|
||||
pub mod load_role_info;
|
||||
pub mod quadrant_util;
|
||||
pub mod seq_utils;
|
||||
pub mod tag_utils;
|
||||
pub mod world_util;
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::sync::OnceLock;
|
|||
|
||||
use wicked_waifus_data::LevelEntityConfigData;
|
||||
|
||||
struct StaticConfig {
|
||||
pub(crate) struct StaticConfig {
|
||||
edge_size: f32,
|
||||
edge_check: f32,
|
||||
}
|
||||
|
|
55
wicked-waifus-game-server/src/logic/utils/seq_utils.rs
Normal file
55
wicked-waifus-game-server/src/logic/utils/seq_utils.rs
Normal file
|
@ -0,0 +1,55 @@
|
|||
use std::collections::{HashMap, VecDeque};
|
||||
|
||||
pub trait Sequencer<T> {
|
||||
fn new() -> Self;
|
||||
fn from_data<V>(data: &HashMap<T, V>) -> Self;
|
||||
fn take_id(&mut self) -> T;
|
||||
fn give_id(&mut self, id: T);
|
||||
}
|
||||
|
||||
pub struct SequenceGenerator<T, A> {
|
||||
recycled_ids: VecDeque<T>,
|
||||
next_id: A,
|
||||
}
|
||||
|
||||
macro_rules! sequence_trait_impl {
|
||||
($t:ty, $a:ty) => (
|
||||
impl Sequencer<$t> for SequenceGenerator<$t, $a> {
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
recycled_ids: Default::default(),
|
||||
next_id: <$a>::new(1),
|
||||
}
|
||||
}
|
||||
|
||||
fn from_data<V>(data: &HashMap<$t, V>) -> Self {
|
||||
let max_id = data.keys().max().copied().unwrap_or(1);
|
||||
let next_id = <$a>::new(max_id);
|
||||
|
||||
let mut recycled_ids = VecDeque::new();
|
||||
for i in 1..max_id {
|
||||
if !data.contains_key(&i) {
|
||||
recycled_ids.push_back(i);
|
||||
}
|
||||
}
|
||||
Self {
|
||||
recycled_ids,
|
||||
next_id,
|
||||
}
|
||||
}
|
||||
|
||||
fn take_id(&mut self) -> $t {
|
||||
self.recycled_ids
|
||||
.pop_front()
|
||||
.unwrap_or_else(|| self.next_id.fetch_add(1, std::sync::atomic::Ordering::Relaxed))
|
||||
}
|
||||
|
||||
fn give_id(&mut self, id: $t) {
|
||||
self.recycled_ids.push_back(id);
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
sequence_trait_impl!(i32, std::sync::atomic::AtomicI32);
|
||||
sequence_trait_impl!(i64, std::sync::atomic::AtomicI64);
|
|
@ -1,172 +1,145 @@
|
|||
use wicked_waifus_protocol::summon::ESummonType;
|
||||
use wicked_waifus_protocol::{
|
||||
EEntityType, ERemoveEntityType, EntityAddNotify, EntityConfigType, EntityPb, EntityRemoveInfo, EntityRemoveNotify, EntityState, FightBuffInformation, FightRoleInfo, FightRoleInfos, LivingStatus, SceneInformation, SceneMode, ScenePlayerInformation, SceneTimeInfo
|
||||
EEntityType, ERemoveEntityType, EntityAddNotify, EntityConfigType, EntityPb, EntityRemoveInfo,
|
||||
EntityRemoveNotify, EntityState, FightRoleInfo, FightRoleInfos, LivingStatus, SceneInformation,
|
||||
SceneMode, ScenePlayerInformation, SceneTimeInfo,
|
||||
};
|
||||
|
||||
use wicked_waifus_data::pb_components::ComponentsData;
|
||||
use wicked_waifus_data::{
|
||||
base_property_data, blueprint_config_data, summon_cfg_data, template_config_data, EntityLogic, EntityType, LevelEntityConfigData
|
||||
blueprint_config_data, template_config_data, EntityLogic, EntityType, LevelEntityConfigData,
|
||||
};
|
||||
|
||||
use crate::logic::components::{Autonomous, Fsm, Interact, MonsterAi, SoarWingSkin, StateTag, Tag};
|
||||
use crate::logic::ecs::entity::{Entity, EntityBuilder};
|
||||
use crate::logic::ecs::world::{World, WorldEntity};
|
||||
use crate::logic::components::{Autonomous, Fsm, Interact, MonsterAi, ParaglidingSkin, SoarWingSkin, StateTag, Tag, WeaponSkin};
|
||||
use crate::logic::ecs::entity::EntityBuilder;
|
||||
use crate::logic::ecs::world::World;
|
||||
use crate::logic::math::Transform;
|
||||
use crate::logic::player::Player;
|
||||
use crate::logic::role::RoleFormation;
|
||||
use crate::logic::utils::growth_utils::get_monster_props_by_level;
|
||||
use crate::logic::utils::{entity_serializer, tag_utils};
|
||||
use crate::logic::utils::growth_utils::get_monster_props_by_level;
|
||||
use crate::logic::{
|
||||
components::{
|
||||
Attribute, Concomitant, EntityConfig, Equip, FightBuff, Movement, OwnerPlayer,
|
||||
PlayerOwnedEntityMarker, Position, RoleSkin, Summoner, Visibility, VisionSkill,
|
||||
Attribute, EntityConfig, Equip, FightBuff, Movement, OwnerPlayer, PlayerOwnedEntityMarker,
|
||||
Position, RoleSkin, Visibility, VisionSkill,
|
||||
},
|
||||
ecs::component::ComponentContainer,
|
||||
};
|
||||
//use crate::resonator_data::{ResonatorData, Concomitant, SummonerComponent};
|
||||
|
||||
use crate::query_with;
|
||||
|
||||
pub fn summon_concomitant(player: &Player, world: &mut WorldEntity, template_cfg: &wicked_waifus_data::TemplateConfigData, cur_summon_id: i32) -> (Entity, Vec<i64>) {
|
||||
let mut concomitant_buffs: Vec<FightBuffInformation> = Vec::new();
|
||||
|
||||
let summon_cfg = summon_cfg_data::get(&template_cfg.blueprint_type).unwrap();
|
||||
let concomitant_config_id = template_cfg.id;
|
||||
|
||||
let con_entity = world.create_entity(
|
||||
cur_summon_id,
|
||||
EEntityType::Monster.into(),
|
||||
player.basic_info.cur_map_id,
|
||||
);
|
||||
|
||||
for buff_id in &summon_cfg.born_buff_id {
|
||||
concomitant_buffs.push(world.create_buff(cur_summon_id, *buff_id));
|
||||
}
|
||||
|
||||
tracing::info!("Adding Concomitant with id: {} and buffs {:#?}", concomitant_config_id, concomitant_buffs);
|
||||
|
||||
(world
|
||||
.create_builder(con_entity)
|
||||
.with(ComponentContainer::PlayerOwnedEntityMarker(PlayerOwnedEntityMarker {
|
||||
entity_type: EEntityType::Monster,
|
||||
}))
|
||||
.with(ComponentContainer::EntityConfig(EntityConfig {
|
||||
camp: 0,
|
||||
config_id: concomitant_config_id,
|
||||
config_type: EntityConfigType::Template,
|
||||
entity_type: EEntityType::Monster,
|
||||
entity_state: EntityState::Born,
|
||||
}))
|
||||
.with(ComponentContainer::OwnerPlayer(OwnerPlayer(
|
||||
player.basic_info.id,
|
||||
)))
|
||||
.with(ComponentContainer::Position(Position(
|
||||
player.location.position.clone(),
|
||||
)))
|
||||
.with(ComponentContainer::Visibility(Visibility {
|
||||
is_visible: false,
|
||||
is_actor_visible: true,
|
||||
}))
|
||||
.with(ComponentContainer::Attribute(Attribute::from_data(
|
||||
base_property_data::iter()
|
||||
.find(|d| d.id == template_cfg.components_data.attribute_component.clone().unwrap().property_id.unwrap())
|
||||
.unwrap(),
|
||||
None,
|
||||
None,
|
||||
)))
|
||||
.with(ComponentContainer::FightBuff(FightBuff { fight_buff_infos: concomitant_buffs, ..Default::default() }))
|
||||
.with(ComponentContainer::Summoner(Summoner {
|
||||
summon_cfg_id: summon_cfg.id,
|
||||
summon_skill_id: 0,
|
||||
summon_type: ESummonType::ESummonTypeConcomitantCustom.into()
|
||||
}))
|
||||
.with(ComponentContainer::Autonomous(Autonomous { autonomous_id: 3 }))
|
||||
.build(), summon_cfg.born_buff_id.clone())
|
||||
}
|
||||
|
||||
fn add_player_entity(player: &Player, formation: &RoleFormation, world: &mut WorldEntity) {
|
||||
let role_vec = formation
|
||||
.role_ids
|
||||
.iter()
|
||||
.map(|role_id| player.role_list.get(role_id).unwrap())
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
tracing::info!("adding player entity for formation {:#?}", formation.role_ids);
|
||||
let cur_role_id = formation.cur_role;
|
||||
#[macro_export]
|
||||
macro_rules! create_player_entity_pb {
|
||||
($role_list:expr, $cur_map_id:expr, $player:expr, $player_id:expr, $position:expr, $explore_tools:expr, $world:expr) => {{
|
||||
let current_formation = $player.formation_list.get(&$player.cur_formation_id).unwrap();
|
||||
let cur_role_id = current_formation.cur_role;
|
||||
|
||||
let mut pbs = Vec::new();
|
||||
|
||||
for role in $role_list {
|
||||
let entity = $world.create_entity(
|
||||
role.role_id,
|
||||
EEntityType::Player.into(),
|
||||
$cur_map_id,
|
||||
);
|
||||
// Once per character buffs are implemented, add a mut on role_buffs
|
||||
let fight_buff_infos = $world.generate_role_permanent_buffs(entity.entity_id as i64);
|
||||
let buf_manager = FightBuff {
|
||||
fight_buff_infos,
|
||||
list_buff_effect_cd: vec![],
|
||||
};
|
||||
|
||||
let entity = $world.create_builder(entity)
|
||||
.with(ComponentContainer::PlayerOwnedEntityMarker(PlayerOwnedEntityMarker {
|
||||
entity_type: EEntityType::Player,
|
||||
}))
|
||||
.with(ComponentContainer::EntityConfig(EntityConfig {
|
||||
camp: 0,
|
||||
config_id: role.role_id,
|
||||
config_type: EntityConfigType::Character,
|
||||
entity_type: EEntityType::Player.into(),
|
||||
entity_state: EntityState::Default,
|
||||
}))
|
||||
.with(ComponentContainer::OwnerPlayer(OwnerPlayer($player_id)))
|
||||
.with(ComponentContainer::Position(Position($position)))
|
||||
.with(ComponentContainer::Visibility(Visibility{
|
||||
is_visible: role.role_id == cur_role_id,
|
||||
is_actor_visible: true,
|
||||
}))
|
||||
// TODO: Check if role has hardness or rage_mode
|
||||
// TODO: Support AddProp from Equipment(Echo, weapon, buffs??), weapon base state goes to base_prop too.
|
||||
.with(ComponentContainer::Attribute(
|
||||
Attribute::from_data(
|
||||
&role.get_base_properties(),
|
||||
None,
|
||||
None,
|
||||
)
|
||||
))
|
||||
.with(ComponentContainer::Movement(Movement::default()))
|
||||
.with(ComponentContainer::Equip(Equip {
|
||||
weapon_id: role.equip_weapon,
|
||||
weapon_breach_level: 90, // TODO: store this too
|
||||
}))
|
||||
.with(ComponentContainer::VisionSkill(VisionSkill {
|
||||
skill_id: $explore_tools.active_explore_skill,
|
||||
}))
|
||||
.with(ComponentContainer::RoleSkin(RoleSkin {
|
||||
skin_id: role.skin_id,
|
||||
}))
|
||||
.with(ComponentContainer::SoarWingSkin(SoarWingSkin {
|
||||
skin_id: role.fly_skin_id,
|
||||
}))
|
||||
.with(ComponentContainer::ParaglidingSkin(ParaglidingSkin {
|
||||
skin_id: role.wing_skin_id,
|
||||
}))
|
||||
.with(ComponentContainer::WeaponSkin(WeaponSkin {
|
||||
skin_id: role.weapon_skin_id,
|
||||
}))
|
||||
.with(ComponentContainer::FightBuff(buf_manager))
|
||||
.build();
|
||||
|
||||
let mut pb = EntityPb {
|
||||
id: entity.entity_id as i64,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
$world
|
||||
.get_entity_components(entity.entity_id)
|
||||
.into_iter()
|
||||
.for_each(|comp| comp.set_pb_data(&mut pb));
|
||||
pbs.push(pb);
|
||||
}
|
||||
|
||||
EntityAddNotify {
|
||||
entity_pbs: pbs,
|
||||
remove_tag_ids: true,
|
||||
}
|
||||
}};
|
||||
}
|
||||
|
||||
pub fn add_player_entities(player: &Player) {
|
||||
let mut world_ref = player.world.borrow_mut();
|
||||
let world = world_ref.get_mut_world_entity();
|
||||
|
||||
let current_formation = player.formation_list.get(&player.cur_formation_id).unwrap();
|
||||
|
||||
let role_vec = current_formation
|
||||
.role_ids
|
||||
.iter()
|
||||
.map(|role_id| player.role_list.get(&role_id).unwrap())
|
||||
.collect::<Vec<_>>();
|
||||
let cur_role_id = current_formation.cur_role;
|
||||
|
||||
if world.active_entity_empty() {
|
||||
for role in role_vec {
|
||||
let entity = world.create_entity(
|
||||
role.role_id,
|
||||
EEntityType::Player.into(),
|
||||
player.basic_info.cur_map_id,
|
||||
);
|
||||
|
||||
let mut fight_buff_infos = world.generate_role_permanent_buffs(entity.entity_id, role.role_id);
|
||||
|
||||
// TODO: add actual weapon switching and remove this! - rabby
|
||||
let equip_weapon = match role.role_id {
|
||||
1409 => 21020056, // cartethyia
|
||||
1207 => 21010036, // lupa
|
||||
1301 => 21010036,
|
||||
_ => role.equip_weapon,
|
||||
};
|
||||
|
||||
let mut concomitants: Vec<i64> = vec![];
|
||||
let mut concom_pbs = Vec::new();
|
||||
|
||||
let role_data = wicked_waifus_data::role_info_data::iter().find(|r| r.id == role.role_id).unwrap();
|
||||
if let Some(skin_damage_first) = role_data.skin_damage.first() {
|
||||
let role_name = skin_damage_first.as_str()
|
||||
.split('/').next_back()
|
||||
.and_then(|s| s.strip_prefix("DA_"))
|
||||
.and_then(|s| s.split('_').next()).unwrap();
|
||||
|
||||
let mut summon_id = 1000;
|
||||
for model_config in wicked_waifus_data::model_config_preload_data::iter().filter(|cfg| {
|
||||
cfg.actor_class_path.starts_with("/Game/Aki/Character/Monster/Summon/") && cfg.actor_class_path.contains(role_name)
|
||||
}) {
|
||||
let template_cfg = wicked_waifus_data::template_config_data::iter().find(|cfg| {
|
||||
let template_model_component = cfg.1.components_data.model_component.clone();
|
||||
template_model_component.is_some()
|
||||
&&
|
||||
template_model_component.clone().unwrap().model_type.unwrap().model_id.is_some()
|
||||
&&
|
||||
template_model_component.unwrap().model_type.unwrap().model_id.unwrap() == model_config.id
|
||||
}).unwrap().1;
|
||||
|
||||
let (concomitant, buffs) = summon_concomitant(player, world, template_cfg, summon_id);
|
||||
let mut pb = EntityPb {
|
||||
id: summon_id as i64,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
for buff_id in buffs {
|
||||
fight_buff_infos.push(world.create_buff(entity.entity_id, buff_id));
|
||||
}
|
||||
|
||||
world
|
||||
.get_entity_components(summon_id)
|
||||
.into_iter()
|
||||
.for_each(|comp| comp.set_pb_data(&mut pb));
|
||||
concom_pbs.push(pb);
|
||||
summon_id += 1;
|
||||
concomitants.push(concomitant.entity_id.into());
|
||||
}
|
||||
|
||||
player.notify(EntityAddNotify {
|
||||
entity_pbs: concom_pbs,
|
||||
remove_tag_ids: true,
|
||||
});
|
||||
}
|
||||
fight_buff_infos.dedup_by(|x, z| x.buff_id == z.buff_id);
|
||||
|
||||
// Once per character buffs are implemented, add a mut on role_buffs
|
||||
let fight_buff_infos = world.generate_role_permanent_buffs(entity.entity_id as i64);
|
||||
let buf_manager = FightBuff {
|
||||
fight_buff_infos,
|
||||
list_buff_effect_cd: vec![]
|
||||
list_buff_effect_cd: vec![],
|
||||
};
|
||||
|
||||
let entity = world
|
||||
.create_builder(entity)
|
||||
.with(ComponentContainer::PlayerOwnedEntityMarker(
|
||||
|
@ -178,7 +151,7 @@ fn add_player_entity(player: &Player, formation: &RoleFormation, world: &mut Wor
|
|||
camp: 0,
|
||||
config_id: role.role_id,
|
||||
config_type: EntityConfigType::Character,
|
||||
entity_type: EEntityType::Player,
|
||||
entity_type: EEntityType::Player.into(),
|
||||
entity_state: EntityState::Default,
|
||||
}))
|
||||
.with(ComponentContainer::OwnerPlayer(OwnerPlayer(
|
||||
|
@ -201,7 +174,7 @@ fn add_player_entity(player: &Player, formation: &RoleFormation, world: &mut Wor
|
|||
)))
|
||||
.with(ComponentContainer::Movement(Movement::default()))
|
||||
.with(ComponentContainer::Equip(Equip {
|
||||
weapon_id: equip_weapon,
|
||||
weapon_id: role.equip_weapon,
|
||||
weapon_breach_level: 0, // TODO: store this too
|
||||
}))
|
||||
.with(ComponentContainer::VisionSkill(VisionSkill {
|
||||
|
@ -211,48 +184,24 @@ fn add_player_entity(player: &Player, formation: &RoleFormation, world: &mut Wor
|
|||
skin_id: role.skin_id,
|
||||
}))
|
||||
.with(ComponentContainer::SoarWingSkin(SoarWingSkin {
|
||||
skin_id: 84000001,
|
||||
skin_id: role.fly_skin_id,
|
||||
}))
|
||||
.with(ComponentContainer::ParaglidingSkin(ParaglidingSkin {
|
||||
skin_id: role.wing_skin_id,
|
||||
}))
|
||||
.with(ComponentContainer::WeaponSkin(WeaponSkin {
|
||||
skin_id: role.weapon_skin_id, // TODO: Is this kept on weapon change
|
||||
}))
|
||||
.with(ComponentContainer::FightBuff(buf_manager))
|
||||
.with(ComponentContainer::Concomitant(Concomitant {
|
||||
vision_entity_id: 0,
|
||||
custom_entity_ids: concomitants,
|
||||
phantom_role_id: 0
|
||||
}))
|
||||
.build();
|
||||
|
||||
let mut pb = EntityPb {
|
||||
id: entity.entity_id as i64,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
world
|
||||
.get_entity_components(entity.entity_id)
|
||||
.into_iter()
|
||||
.for_each(|comp| comp.set_pb_data(&mut pb));
|
||||
pbs.push(pb);
|
||||
|
||||
tracing::debug!(
|
||||
"created player entity, id: {}, role_id: {}",
|
||||
entity.entity_id,
|
||||
role.role_id
|
||||
);
|
||||
}
|
||||
|
||||
player.notify(EntityAddNotify {
|
||||
entity_pbs: pbs,
|
||||
remove_tag_ids: true,
|
||||
});
|
||||
}
|
||||
|
||||
pub fn add_player_entities(player: &Player, formation: &RoleFormation, possible_world: Option<&mut WorldEntity>) {
|
||||
match possible_world {
|
||||
Some(world) => add_player_entity(player, formation, world),
|
||||
None => {
|
||||
let mut world_ref = player.world.borrow_mut();
|
||||
add_player_entity(player, formation, world_ref.get_mut_world_entity())
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
pub fn build_scene_information(player: &Player) -> SceneInformation {
|
||||
|
@ -303,11 +252,10 @@ fn build_player_info_list(world: &World) -> Vec<ScenePlayerInformation> {
|
|||
world.get_world_entity(),
|
||||
PlayerOwnedEntityMarker,
|
||||
OwnerPlayer,
|
||||
EntityConfig,
|
||||
RoleSkin
|
||||
EntityConfig
|
||||
)
|
||||
.into_iter()
|
||||
.filter(|(_, _, owner, _, _)| owner.0 == sp.player_id);
|
||||
.filter(|(_, _, owner, _)| owner.0 == sp.player_id);
|
||||
|
||||
ScenePlayerInformation {
|
||||
cur_role: cur_role_id,
|
||||
|
@ -324,7 +272,7 @@ fn build_player_info_list(world: &World) -> Vec<ScenePlayerInformation> {
|
|||
cur_role: cur_role_id,
|
||||
// is_retain: true,
|
||||
fight_role_infos: active_characters
|
||||
.map(|(id, _, _, conf, _role_skin)| FightRoleInfo {
|
||||
.map(|(id, _, _, conf)| FightRoleInfo {
|
||||
entity_id: id.into(),
|
||||
role_id: conf.config_id,
|
||||
on_stage_without_control: false,
|
||||
|
@ -490,13 +438,7 @@ pub fn add_entities(player: &Player, entities: &[&LevelEntityConfigData], extern
|
|||
|
||||
build_autonomous_component(&mut builder, player.basic_info.id, entity_logic);
|
||||
build_interact_component(&mut builder, &components);
|
||||
build_tags_components(
|
||||
&mut builder,
|
||||
&components,
|
||||
player,
|
||||
blueprint_config.unwrap().entity_type,
|
||||
config_id as i64,
|
||||
);
|
||||
build_tags_components(&mut builder, &components, player, blueprint_config.unwrap().entity_type, config_id as i64);
|
||||
build_attribute_component(&mut builder, &components, player.location.instance_id);
|
||||
build_ai_components(&mut builder, &components);
|
||||
added_entities.push(builder.build());
|
||||
|
@ -562,10 +504,7 @@ fn build_tags_components(
|
|||
if let Some(entity_state_component) = &components.entity_state_component {
|
||||
let state = match entity_type {
|
||||
EntityType::Teleporter | EntityType::TemporaryTeleporter => {
|
||||
let result = player
|
||||
.teleports
|
||||
.teleports_data
|
||||
.iter()
|
||||
let result = player.teleports.teleports_data.iter()
|
||||
.find(|teleporter| teleporter.entity_config_id == config_id);
|
||||
match result.is_some() {
|
||||
true => tag_utils::get_tag_id_by_name("关卡.Common.状态.激活"),
|
||||
|
|
|
@ -51,12 +51,12 @@ async fn handler_loop(
|
|||
return;
|
||||
};
|
||||
|
||||
// tracing::debug!(
|
||||
// "received message from service: {}, rpc_id: {} message_id: {}",
|
||||
// message.src_service_id,
|
||||
// message.rpc_id,
|
||||
// message.message_id
|
||||
// );
|
||||
tracing::debug!(
|
||||
"received message from service: {}, rpc_id: {} message_id: {}",
|
||||
message.src_service_id,
|
||||
message.rpc_id,
|
||||
message.message_id
|
||||
);
|
||||
|
||||
match message.message_id {
|
||||
CreatePlayerDataRequest::MESSAGE_ID => {
|
||||
|
@ -141,7 +141,7 @@ async fn on_start_player_session_request(
|
|||
player_id: player_data.player_id,
|
||||
enter_rpc_id: message.rpc_id,
|
||||
session: session.clone(),
|
||||
player_save_data: Box::new(player_save_data),
|
||||
player_save_data,
|
||||
});
|
||||
|
||||
session_mgr.add(session.clone());
|
||||
|
|
|
@ -60,6 +60,9 @@ message RoleData {
|
|||
RoleStats stats = 17;
|
||||
int32 favor_level = 18;
|
||||
int32 favor_exp = 19;
|
||||
int32 wing_skin_id = 20;
|
||||
int32 fly_skin_id = 21;
|
||||
int32 weapon_skin_id = 22;
|
||||
}
|
||||
|
||||
message RoleFormationData {
|
||||
|
@ -135,8 +138,19 @@ message PlayerAdventureStatusData {
|
|||
repeated PlayerAdventureGlobalStatusData status = 1;
|
||||
}
|
||||
|
||||
message PlayerInventoryWeaponData {
|
||||
int32 id = 1;
|
||||
int32 func_value = 2;
|
||||
int32 level = 3;
|
||||
int32 exp = 4;
|
||||
int32 breach = 5;
|
||||
int32 reson_level = 6;
|
||||
int32 role_id = 7;
|
||||
}
|
||||
|
||||
message PlayerInventoryData {
|
||||
map<int32, int32> items = 1;
|
||||
map<int32, PlayerInventoryWeaponData> weapons = 2;
|
||||
}
|
||||
|
||||
message PlayerTeleportData {
|
||||
|
@ -182,6 +196,13 @@ message PlayerMcElementData {
|
|||
PlayerMcElementType current_element = 2;
|
||||
}
|
||||
|
||||
message PlayerUnlockedSkinsData {
|
||||
repeated int32 role_skins = 1;
|
||||
repeated int32 weapon_skins = 2;
|
||||
repeated int32 fly_skins = 3;
|
||||
repeated int32 wing_skins = 4;
|
||||
}
|
||||
|
||||
message PlayerSaveData {
|
||||
PlayerBasicData basic_data = 1;
|
||||
PlayerRoleData role_data = 2;
|
||||
|
@ -198,4 +219,5 @@ message PlayerSaveData {
|
|||
PlayerMapTraceData map_trace = 13;
|
||||
PlayerMonthCardData month_card = 14;
|
||||
PlayerMcElementData mc_element = 15;
|
||||
PlayerUnlockedSkinsData unlocked_skins = 16;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue