forked from wickedwaifus/wicked-waifus-rs
Compare commits
3 commits
automatic+
...
master
Author | SHA1 | Date | |
---|---|---|---|
1758cfd13e | |||
05034b1774 | |||
4d6b79aa29 |
86 changed files with 4011 additions and 2423 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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
207
Cargo.lock
generated
207
Cargo.lock
generated
|
@ -105,13 +105,13 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
|
|||
|
||||
[[package]]
|
||||
name = "axum"
|
||||
version = "0.7.9"
|
||||
version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f"
|
||||
checksum = "021e862c184ae977658b36c4500f7feac3221ca5da43e3f25bd04ab6c79a29b5"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"axum-core",
|
||||
"bytes",
|
||||
"form_urlencoded",
|
||||
"futures-util",
|
||||
"http",
|
||||
"http-body",
|
||||
|
@ -139,13 +139,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "axum-core"
|
||||
version = "0.4.5"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199"
|
||||
checksum = "68464cd0412f486726fb3373129ef5d2993f90c34bc2bc1c1e9943b2f4fc7ca6"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"bytes",
|
||||
"futures-util",
|
||||
"futures-core",
|
||||
"http",
|
||||
"http-body",
|
||||
"http-body-util",
|
||||
|
@ -276,9 +275,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 +901,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 +964,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 +980,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 +1117,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 +1226,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"
|
||||
|
@ -1239,9 +1237,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "matchit"
|
||||
version = "0.7.3"
|
||||
version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94"
|
||||
checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3"
|
||||
|
||||
[[package]]
|
||||
name = "md-5"
|
||||
|
@ -1295,13 +1293,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]]
|
||||
|
@ -1547,9 +1545,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "prettyplease"
|
||||
version = "0.2.32"
|
||||
version = "0.2.35"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "664ec5419c51e34154eec046ebcba56312d5a2fc3b09a06da188e1ad21afadf6"
|
||||
checksum = "061c1221631e079b26479d25bbf2275bfe5917ae8419cd7e34f13bfc2aa7539a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"syn",
|
||||
|
@ -1566,9 +1564,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "prost"
|
||||
version = "0.13.5"
|
||||
version = "0.14.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2796faa41db3ec313a31f7624d9286acf277b52de526150b7e69f3debf891ee5"
|
||||
checksum = "7231bd9b3d3d33c86b58adbac74b5ec0ad9f496b19d22801d773636feaa95f3d"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"prost-derive",
|
||||
|
@ -1576,9 +1574,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "prost-build"
|
||||
version = "0.13.5"
|
||||
version = "0.14.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "be769465445e8c1474e9c5dac2018218498557af32d9ed057325ec9a41ae81bf"
|
||||
checksum = "ac6c3320f9abac597dcbc668774ef006702672474aad53c6d596b62e487b40b1"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"itertools",
|
||||
|
@ -1596,9 +1594,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "prost-derive"
|
||||
version = "0.13.5"
|
||||
version = "0.14.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d"
|
||||
checksum = "9120690fafc389a67ba3803df527d0ec9cbbc9cc45e4cc20b332996dfb672425"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"itertools",
|
||||
|
@ -1609,9 +1607,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "prost-types"
|
||||
version = "0.13.5"
|
||||
version = "0.14.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "52c2c1bf36ddb1a1c396b3601a3cec27c2462e45f07c386894ec3ccf5332bd16"
|
||||
checksum = "b9b4db3d6da204ed77bb26ba83b6122a73aeb2e87e25fbf7ad2e84c4ccbf8f72"
|
||||
dependencies = [
|
||||
"prost",
|
||||
]
|
||||
|
@ -1872,9 +1870,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"
|
||||
|
@ -1943,9 +1941,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_spanned"
|
||||
version = "0.6.8"
|
||||
version = "0.6.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1"
|
||||
checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
@ -2073,9 +2071,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 +2084,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 +2120,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 +2133,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 +2152,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 +2200,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 +2237,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",
|
||||
|
@ -2287,9 +2284,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.101"
|
||||
version = "2.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf"
|
||||
checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -2422,9 +2419,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",
|
||||
|
@ -2476,9 +2473,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.8.22"
|
||||
version = "0.8.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "05ae329d1f08c4d17a59bed7ff5b5a769d062e64a62d34a3261b219e62cd5aae"
|
||||
checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
|
@ -2488,18 +2485,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "toml_datetime"
|
||||
version = "0.6.9"
|
||||
version = "0.6.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3da5db5a963e24bc68be8b17b6fa82814bb22ee8660f192bb182771d498f09a3"
|
||||
checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_edit"
|
||||
version = "0.22.26"
|
||||
version = "0.22.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "310068873db2c5b3e7659d2cc35d21855dbafa50d1ce336397c666e3cb08137e"
|
||||
checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"serde",
|
||||
|
@ -2511,9 +2508,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "toml_write"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bfb942dfe1d8e29a7ee7fcbde5bd2b9a25fb89aa70caea2eba3bee836ff41076"
|
||||
checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
|
||||
|
||||
[[package]]
|
||||
name = "tower"
|
||||
|
@ -2533,12 +2530,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tower-http"
|
||||
version = "0.6.4"
|
||||
version = "0.6.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fdb0c213ca27a9f57ab69ddb290fd80d970922355b83ae380b395d3986b8a2e"
|
||||
checksum = "adc82fd73de2a9722ac5da747f12383d2bfdb93591ee6c58486e0097890f05f2"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"bytes",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"http",
|
||||
"http-body",
|
||||
|
@ -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",
|
||||
]
|
||||
|
||||
|
@ -2875,7 +2876,7 @@ name = "wicked-waifus-asset-updater"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"git2",
|
||||
"thiserror 1.0.69",
|
||||
"thiserror 2.0.12",
|
||||
"tracing",
|
||||
"ureq",
|
||||
"zip-extract",
|
||||
|
@ -2913,7 +2914,7 @@ dependencies = [
|
|||
"serde",
|
||||
"serde_json",
|
||||
"serde_repr",
|
||||
"thiserror 1.0.69",
|
||||
"thiserror 2.0.12",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
|
@ -2936,7 +2937,7 @@ dependencies = [
|
|||
"paste",
|
||||
"rand 0.9.1",
|
||||
"serde",
|
||||
"thiserror 1.0.69",
|
||||
"thiserror 2.0.12",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"unreal-niggery-rs",
|
||||
|
@ -2961,7 +2962,7 @@ dependencies = [
|
|||
"kcp",
|
||||
"paste",
|
||||
"serde",
|
||||
"thiserror 1.0.69",
|
||||
"thiserror 2.0.12",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"wicked-waifus-commons",
|
||||
|
@ -2995,7 +2996,7 @@ dependencies = [
|
|||
"cbc",
|
||||
"rbase64",
|
||||
"serde",
|
||||
"thiserror 1.0.69",
|
||||
"thiserror 2.0.12",
|
||||
"tower-http",
|
||||
"tracing",
|
||||
]
|
||||
|
@ -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://github.com/xavo95/wicked-waifus-proto-dev.git?branch=2.5.1#17cd6d994259ef38c8c74ef9acf6306c24c582b8"
|
||||
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://github.com/xavo95/wicked-waifus-proto-dev.git?branch=2.5.1#17cd6d994259ef38c8c74ef9acf6306c24c582b8"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -3061,7 +3062,7 @@ dependencies = [
|
|||
"prost-build",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror 1.0.69",
|
||||
"thiserror 2.0.12",
|
||||
"wicked-waifus-protocol",
|
||||
"wicked-waifus-protocol-derive",
|
||||
]
|
||||
|
@ -3076,7 +3077,7 @@ dependencies = [
|
|||
"rbase64",
|
||||
"rsa",
|
||||
"serde",
|
||||
"thiserror 1.0.69",
|
||||
"thiserror 2.0.12",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
|
@ -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",
|
||||
|
|
32
Cargo.toml
32
Cargo.toml
|
@ -7,14 +7,14 @@ version = "0.1.0"
|
|||
|
||||
[workspace.dependencies]
|
||||
# Framework
|
||||
tokio = { version = "1.39.3", features = ["full"] }
|
||||
tower-http = { version = "0.6.1", features = ["fs", "trace"] }
|
||||
axum = "0.7.5"
|
||||
axum-server = "0.7.1"
|
||||
tokio = { version = "1.45.1", features = ["full"] }
|
||||
tower-http = { version = "0.6.6", features = ["fs", "trace"] }
|
||||
axum = "0.8.4"
|
||||
axum-server = "0.7.2"
|
||||
zeromq = { version = "0.4.0", default-features = false, features = ["tokio-runtime", "tcp-transport"] }
|
||||
|
||||
# Database
|
||||
sqlx = { version = "0.8.2", features = ["postgres", "runtime-tokio-rustls"] }
|
||||
sqlx = { version = "0.8.6", features = ["postgres", "runtime-tokio-rustls"] }
|
||||
|
||||
# Cryptography
|
||||
aes = "0.8.4"
|
||||
|
@ -25,16 +25,16 @@ rand = "0.8.5"
|
|||
rsa = { version = "0.9.6", features = ["pem"] }
|
||||
|
||||
# Serialization
|
||||
serde = { version = "1.0.209", features = ["derive"] }
|
||||
serde_json = "1.0.128"
|
||||
serde_repr = "0.1.19"
|
||||
toml = "0.8.19"
|
||||
prost = "0.13.2"
|
||||
prost-build = "0.13.2"
|
||||
serde = { version = "1.0.219", features = ["derive"] }
|
||||
serde_json = "1.0.140"
|
||||
serde_repr = "0.1.20"
|
||||
toml = "0.8.23"
|
||||
prost = "0.14.1"
|
||||
prost-build = "0.14.1"
|
||||
|
||||
# Utility
|
||||
anyhow = "1.0.86"
|
||||
thiserror = "1.0.63"
|
||||
anyhow = "1.0.98"
|
||||
thiserror = "2.0.12"
|
||||
paste = "1.0.15"
|
||||
rbase64 = "2.0.3"
|
||||
dashmap = "6.1.0"
|
||||
|
@ -42,8 +42,8 @@ hex = "0.4.3"
|
|||
byteorder = "1.5.0"
|
||||
|
||||
# Tracing
|
||||
tracing = "0.1.40"
|
||||
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
|
||||
tracing = "0.1.41"
|
||||
tracing-subscriber = { version = "0.3.19", features = ["env-filter"] }
|
||||
|
||||
# Internal
|
||||
wicked-waifus-asset-updater = { path = "wicked-waifus-asset-updater" }
|
||||
|
@ -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]
|
||||
|
|
|
@ -11,5 +11,5 @@ serve_dir_path = "data/assets/config-server"
|
|||
|
||||
[asset_config]
|
||||
repository_url = "https://git.xeondev.com/wickedwaifus/wicked-waifus-config-server-files.git"
|
||||
reference = "f088e91db3"
|
||||
reference = "a7ad3d4ef8"
|
||||
discard_local_changes = true
|
|
@ -1,5 +1,88 @@
|
|||
use serde::Deserialize;
|
||||
use crate::StateMachineJson;
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct StateMachineTransition {
|
||||
pub from: i32,
|
||||
pub to: i32,
|
||||
pub transition_prediction_type: i32,
|
||||
pub weight: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub conditions: Vec<serde_json::Value>, // TODO: Implement conditions
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct StateMachineNodeCommon {
|
||||
pub uuid: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub is_anim_state_machine: Option<bool>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub is_conduit_node: Option<bool>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub is_any_state: Option<bool>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub name: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub take_control_type: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub transition_rule: i32,
|
||||
pub children: Option<Vec<i32>>,
|
||||
pub transitions: Option<Vec<StateMachineTransition>>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub on_enter_actions: Option<Vec<serde_json::Value>>, // TODO: Implement actions
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub on_exit_actions: Option<Vec<serde_json::Value>>, // TODO: Implement actions
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub bind_states: Option<Vec<serde_json::Value>>, // TODO: Implement bindStates
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub task: Option<serde_json::Value>, // TODO: Implement bindStates
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct StateMachineNodeReferenced {
|
||||
pub reference_uuid: i32,
|
||||
#[serde(flatten)]
|
||||
pub common: StateMachineNodeCommon,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct StateMachineNodeOverrideCommon {
|
||||
pub override_common_uuid: i32,
|
||||
#[serde(flatten)]
|
||||
pub common: StateMachineNodeCommon,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct StateMachineNodeCustom {
|
||||
#[serde(flatten)]
|
||||
pub common: StateMachineNodeCommon,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum StateMachineNode {
|
||||
Reference(StateMachineNodeReferenced),
|
||||
Override(StateMachineNodeOverrideCommon),
|
||||
Custom(StateMachineNodeCustom),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct StateMachineJson {
|
||||
pub version: u32,
|
||||
pub state_machines: Vec<i32>,
|
||||
pub nodes: Vec<StateMachineNode>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
|
|
|
@ -1,6 +1,206 @@
|
|||
use serde::Deserialize;
|
||||
|
||||
use crate::{EntityLogic, EntityType};
|
||||
#[derive(Deserialize, PartialEq, Debug, Copy, Clone)]
|
||||
pub enum EntityType {
|
||||
AdsorptionFoundation,
|
||||
AdviseItem,
|
||||
AiAlertNotifier,
|
||||
AiGearController,
|
||||
AiMovementGear,
|
||||
AirPassage,
|
||||
AiSceneItem,
|
||||
Animal,
|
||||
Animal2,
|
||||
AnnunciatorCenter,
|
||||
AnnunciatorWire,
|
||||
AreaOccupation,
|
||||
Audio,
|
||||
AudioBox,
|
||||
BatchBulletCaster,
|
||||
BeamCastBullet,
|
||||
BeamCaster,
|
||||
BeamCrystal,
|
||||
BeamDeliver,
|
||||
BeamReceiver,
|
||||
BondageTrap,
|
||||
BuffConsumer,
|
||||
BuffProducer,
|
||||
BurstCrystalFoundation,
|
||||
Chair,
|
||||
Chair2,
|
||||
ChallengeInteract,
|
||||
Chessboard,
|
||||
Chessman,
|
||||
ClientTrigger,
|
||||
Collect,
|
||||
Collect2,
|
||||
Collect3,
|
||||
CollectAnimal,
|
||||
CollectAnimalPart,
|
||||
CombatAnimal,
|
||||
CombatAnimal2,
|
||||
CombinedVisibleGroup,
|
||||
ControlConnector,
|
||||
ConveyorBelt,
|
||||
CookTool,
|
||||
CurveControlDestructible,
|
||||
CustomAoiEditor,
|
||||
Destructible,
|
||||
DestructibleControl,
|
||||
DestructibleExploreInteractor,
|
||||
DestructibleSceneBullet,
|
||||
DestructibleTrigger,
|
||||
Disc,
|
||||
Drop,
|
||||
DungeonEntry,
|
||||
DynamicPortalCreater,
|
||||
EffectArea,
|
||||
EnrichmentArea,
|
||||
EntityBatchRefresh,
|
||||
EntityBundle,
|
||||
EntityList,
|
||||
EntityPackage,
|
||||
ExploreSkillInteractor,
|
||||
FishingBoat,
|
||||
FollowShooter,
|
||||
FollowShooter2,
|
||||
FollowTrack,
|
||||
FollowTrackFoundation,
|
||||
Gramophone,
|
||||
GravityFlip,
|
||||
GroupAi,
|
||||
HackingTypeFollowShooter,
|
||||
HitConditionListener,
|
||||
HookLockPoint,
|
||||
HookSoundBox,
|
||||
HookWithRange,
|
||||
HorseBettingTuanzi,
|
||||
InhaledItem,
|
||||
InteractFoundation,
|
||||
InteractFoundationWithSceneItemAttribute,
|
||||
InteractGear,
|
||||
InteractGearGroup,
|
||||
InteractiveConditionListener,
|
||||
Item,
|
||||
ItemFoundation,
|
||||
JigsawFoundation,
|
||||
JigsawItem,
|
||||
KiteHook,
|
||||
LevelPlay,
|
||||
LevelPlayReward,
|
||||
LevelQteTrigger,
|
||||
LevelSeqTrigger,
|
||||
LevitateMagnet,
|
||||
LifePointCenter,
|
||||
Lift,
|
||||
Lift2,
|
||||
LightDeliver,
|
||||
LocationSafety,
|
||||
Monitor,
|
||||
Monster,
|
||||
MonsterGachaBase,
|
||||
MonsterGachaItem,
|
||||
MoveableTrigger,
|
||||
MusicStand,
|
||||
NoRenderPortal,
|
||||
Npc,
|
||||
Npc2,
|
||||
PasserbyNpc,
|
||||
PerformanceOptimizer,
|
||||
PhotoTarget,
|
||||
PhysicsSwing,
|
||||
Portal,
|
||||
Position,
|
||||
ProgressBarController,
|
||||
ProgressBarControllerWithAttribute,
|
||||
PullingObject,
|
||||
Range,
|
||||
RangeTriggerTargetGear,
|
||||
ReboundPlateGear,
|
||||
RefreshGroup,
|
||||
RenderSpecifiedRange,
|
||||
RenderSpecifiedRange2,
|
||||
Resurrection,
|
||||
RewardNpc,
|
||||
RollingFireball,
|
||||
Rotator,
|
||||
SceneAura,
|
||||
SceneBullet,
|
||||
SceneBulletCanHit,
|
||||
SceneBulletTrigger,
|
||||
SceneBulletWithMovement,
|
||||
SceneItemStateHint,
|
||||
SimpleInteract,
|
||||
SimpleNPc,
|
||||
SkyboxTrigger,
|
||||
SlideRail,
|
||||
Slots,
|
||||
SoundBox,
|
||||
SpawnMonster,
|
||||
SpawnPasserbyNpc,
|
||||
Spline,
|
||||
SplineRange,
|
||||
SummonGongduolaPoint,
|
||||
StateSceneItem,
|
||||
StateTrigger,
|
||||
StatueFoundation,
|
||||
SuiGuangHook,
|
||||
TargetGear,
|
||||
TargetGear2,
|
||||
TargetGearGroup,
|
||||
TargetGearGroup2,
|
||||
TargetGearPro,
|
||||
TargetGearWithLevelPrefabPerform,
|
||||
TeleControl,
|
||||
TeleControl3,
|
||||
TeleControl4,
|
||||
TeleControlGroup,
|
||||
Teleporter,
|
||||
TemplateEntitySpawner,
|
||||
TemporaryTeleporter,
|
||||
TimedStrikeDevice,
|
||||
TimelineTrackController,
|
||||
TimeScaledHook,
|
||||
TimeStop,
|
||||
Trample,
|
||||
Trample2,
|
||||
Trample3,
|
||||
TrampleWithSceneItemAttribute,
|
||||
TreasureBox,
|
||||
Trigger,
|
||||
TriggerConditionListener,
|
||||
TuanziNpc,
|
||||
TuningStand,
|
||||
TurntableController,
|
||||
VacuumCleaner,
|
||||
VarManager,
|
||||
Vehicle,
|
||||
Vehicle2,
|
||||
VehicleNpc,
|
||||
VehicleSceneItem,
|
||||
VisibleTrigger,
|
||||
Vision,
|
||||
VisionItem,
|
||||
VisionTreasureBox,
|
||||
WalkingPatternController,
|
||||
WaterCollection,
|
||||
WaterSpout,
|
||||
Weapon,
|
||||
WindSource,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, PartialEq, Debug, Copy, Clone)]
|
||||
pub enum EntityLogic {
|
||||
Item,
|
||||
Animal,
|
||||
Monster,
|
||||
Vehicle,
|
||||
Npc,
|
||||
Vision,
|
||||
ClientOnly,
|
||||
ServerOnly,
|
||||
Custom,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
|
@ -10,10 +210,7 @@ pub struct BlueprintConfigData {
|
|||
pub blueprint_type: String,
|
||||
pub entity_type: EntityType,
|
||||
pub entity_logic: EntityLogic,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub model_id: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub half_height: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub track_height: i32,
|
||||
}
|
|
@ -5,8 +5,105 @@ use serde::Deserialize;
|
|||
#[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
|
||||
pub ge_desc: String,
|
||||
pub duration_policy: i32, // TODO: Enum ??
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub duration_calculation_policy: Vec<i32>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub duration_magnitude: Vec<i32>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub duration_magnitude2: Vec<i32>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub b_duration_affected_by_bullet_time: bool,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub formation_policy: i32, // TODO: Enum ??
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub probability: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub period: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub b_execute_periodic_effect_on_application: bool,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub periodic_inhibition_policy: i32, // TODO: Enum ??
|
||||
#[serde(rename = "GameAttributeID")]
|
||||
pub game_attribute_id: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub calculation_policy: Vec<i32>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub modifier_magnitude: Vec<i32>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub modifier_magnitude2: Vec<i32>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub stacking_type: i32, // TODO: Enum??
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub default_stack_count: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub stack_append_count: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub stack_limit_count: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub stack_duration_refresh_policy: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub stack_period_reset_policy: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub stack_expiration_remove_number: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub b_deny_overflow_application: bool,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub b_clear_stack_on_overflow: bool,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub b_require_modifier_success_to_trigger_cues: bool,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub b_suppress_stacking_cues: bool,
|
||||
pub gameplay_cue_ids: Vec<i64>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub granted_tags: Vec<String>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub application_source_tag_requirements: Vec<String>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub application_source_tag_ignores: Vec<String>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub application_tag_requirements: Vec<String>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub application_tag_ignores: Vec<String>,
|
||||
pub ongoing_tag_requirements: Vec<String>,
|
||||
pub ongoing_tag_ignores: Vec<String>,
|
||||
pub removal_tag_requirements: Vec<String>,
|
||||
pub removal_tag_ignores: Vec<String>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub remove_buff_with_tags: Vec<String>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub granted_application_immunity_tags: Vec<String>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub granted_application_immunity_tag_ignores: Vec<String>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub premature_expiration_effects: Vec<String>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub routine_expiration_effects: Vec<String>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub overflow_effects: Vec<String>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub related_extra_effect_buff_id: Vec<String>,
|
||||
#[serde(rename = "ExtraEffectID")]
|
||||
pub extra_effect_id: i32,
|
||||
pub extra_effect_parameters: Vec<String>,
|
||||
pub extra_effect_parameters_grow1: Vec<i32>,
|
||||
pub extra_effect_parameters_grow2: Vec<i32>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub extra_effect_requirements: Vec<String>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub extra_effect_req_para: Vec<String>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub extra_effect_req_setting: i32, // TODO: Enum??
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub extra_effect_cd: Vec<i32>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub extra_effect_remove_stack_num: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub extra_effect_probability: Vec<i32>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub buff_action: Vec<String>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub tag_logic: Vec<String>,
|
||||
pub dead_remove: bool,
|
||||
}
|
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,
|
||||
}
|
|
@ -1,5 +1,20 @@
|
|||
use serde::Deserialize;
|
||||
use crate::GachaViewTypeInfoId;
|
||||
use serde_repr::Deserialize_repr;
|
||||
|
||||
#[derive(Deserialize_repr, PartialEq, Debug, Copy, Clone)]
|
||||
#[repr(i32)]
|
||||
pub enum GachaViewTypeInfoId {
|
||||
NoviceConvene = 1,
|
||||
FeaturedResonatorConvene = 2,
|
||||
FeaturedWeaponConvene = 3,
|
||||
StandardResonatorConvene = 4,
|
||||
StandardWeaponConvene = 5,
|
||||
BeginnersChoiceConvene = 6,
|
||||
AnniversaryResonatorConvene = 7,
|
||||
AnniversaryWeaponConvene = 8,
|
||||
NewVoyageResonatorConvene = 9,
|
||||
NewVoyageWeaponConvene = 10,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
|
|
|
@ -2,7 +2,14 @@ use std::collections::HashMap;
|
|||
|
||||
use serde::Deserialize;
|
||||
|
||||
use crate::{EntranceEntityData, VectorData};
|
||||
use crate::VectorData;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct EntranceEntityData {
|
||||
pub dungeon_id: i32,
|
||||
pub entrance_entity_id: i64,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
|
|
|
@ -1,5 +1,154 @@
|
|||
use serde::Deserialize;
|
||||
use crate::LevelPlayDataDetail;
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub enum LevelPlayType {
|
||||
Challenge,
|
||||
SilentArea,
|
||||
Dungeon,
|
||||
MonsterTreasure,
|
||||
Quest,
|
||||
Riddle,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase", deny_unknown_fields)]
|
||||
pub struct LevelPlayOpenCondition {
|
||||
pub conditions: Option<Vec<Condition>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase", deny_unknown_fields)]
|
||||
pub struct LevelPlayActive {
|
||||
pub active_type: i32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase", deny_unknown_fields)]
|
||||
pub struct LevelPlayRewardConfigResetTypeMidNight {
|
||||
pub count: i32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(tag = "Type")]
|
||||
pub enum LevelPlayRewardConfigResetType {
|
||||
MidNight(LevelPlayRewardConfigResetTypeMidNight),
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase", deny_unknown_fields)]
|
||||
pub struct LevelPlayRewardConfigInteract {
|
||||
pub reward_id: i32,
|
||||
pub reward_entity_id: i64,
|
||||
pub reward_complete_actions: Vec<Action>,
|
||||
pub first_complete_actions: Option<Vec<Action>>,
|
||||
pub reset: Option<LevelPlayRewardConfigResetType>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(tag = "Type")]
|
||||
pub enum LevelPlayRewardConfig {
|
||||
None,
|
||||
Interact(LevelPlayRewardConfigInteract),
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub enum FixedDateTime {
|
||||
Daily,
|
||||
Weekly
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase", deny_unknown_fields)]
|
||||
pub struct LevelPlayRefreshConfigFixedDateTime {
|
||||
pub update_type: FixedDateTime,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase", deny_unknown_fields)]
|
||||
pub struct LevelPlayRefreshConfigCompleted {
|
||||
pub min_refresh_cd: i32,
|
||||
pub max_refresh_cd: i32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(tag = "Type")]
|
||||
pub enum LevelPlayRefreshConfig {
|
||||
None,
|
||||
FixedDateTime(LevelPlayRefreshConfigFixedDateTime),
|
||||
Completed(LevelPlayRefreshConfigCompleted),
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase", deny_unknown_fields)]
|
||||
pub struct LevelPlayTrack {
|
||||
pub track_radius: i32,
|
||||
pub track_priority: i32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase", deny_unknown_fields)]
|
||||
pub struct LevelPlayMark {
|
||||
pub mark_id: i32,
|
||||
pub map_bg_path: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub enum OnlineType {
|
||||
Multiplayer,
|
||||
Local,
|
||||
Hang,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub enum ObjType {
|
||||
LevelPlay,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase", deny_unknown_fields)]
|
||||
pub struct LevelPlayDataDetail { // Json file contains Data in name, so it has to be DataData
|
||||
pub id: i32,
|
||||
pub key: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub internal_dest: String,
|
||||
pub level_id: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub tid_name: String,
|
||||
pub r#type: LevelPlayType,
|
||||
pub instance_id: i32,
|
||||
pub level_play_entity_id: i64,
|
||||
pub level_additive_id: i32,
|
||||
pub enter_radius: i32,
|
||||
pub leave_radius: i32,
|
||||
pub delay_refresh: bool,
|
||||
pub delay_destroy: bool,
|
||||
pub level_play_open_condition: LevelPlayOpenCondition,
|
||||
pub level_play_active: LevelPlayActive,
|
||||
pub level_play_reward_config: LevelPlayRewardConfig,
|
||||
pub level_play_refresh_config: LevelPlayRefreshConfig,
|
||||
pub level_play_track: LevelPlayTrack,
|
||||
pub level_play_mark: Option<LevelPlayMark>,
|
||||
pub enter_in_range_actions: Option<Vec<Action>>,
|
||||
pub pack_id: i32,
|
||||
pub online_type: OnlineType,
|
||||
pub obj_type: ObjType,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub children: Option<Vec<String>>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub reference: Vec<String>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub weak_reference: Option<Vec<String>>,
|
||||
pub exploratory_degree: Option<i32>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
|
|
|
@ -3,7 +3,6 @@ use std::io::BufReader;
|
|||
|
||||
use paste::paste;
|
||||
|
||||
pub use level_entity_config::LevelEntityConfigData;
|
||||
pub use misc_data::*;
|
||||
|
||||
pub mod node_data;
|
||||
|
@ -11,6 +10,7 @@ pub mod pb_components;
|
|||
pub mod text_map_data;
|
||||
|
||||
mod misc_data;
|
||||
mod level_entity_config;
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum LoadDataError {
|
||||
|
@ -24,13 +24,14 @@ macro_rules! json_data {
|
|||
($($table_type:ident;)*) => {
|
||||
$(paste! {
|
||||
mod [<$table_type:snake>];
|
||||
pub use [<$table_type:snake>]::[<$table_type Data>];
|
||||
})*
|
||||
|
||||
$(paste! {
|
||||
pub mod [<$table_type:snake _data>] {
|
||||
pub use super::[<$table_type:snake>]::*;
|
||||
|
||||
use std::sync::OnceLock;
|
||||
type Data = super::[<$table_type Data>];
|
||||
type Data = super::[<$table_type:snake>]::[<$table_type Data>];
|
||||
pub(crate) static TABLE: OnceLock<Vec<Data>> = OnceLock::new();
|
||||
|
||||
pub fn iter() -> std::slice::Iter<'static, Data> {
|
||||
|
@ -58,15 +59,16 @@ macro_rules! json_hash_table_data {
|
|||
($($table_type:ident, $key_param:expr, $key_type:ty;)*) => {
|
||||
$(paste! {
|
||||
mod [<$table_type:snake>];
|
||||
pub use [<$table_type:snake>]::[<$table_type Data>];
|
||||
})*
|
||||
|
||||
$(paste! {
|
||||
pub mod [<$table_type:snake _data>] {
|
||||
pub use super::[<$table_type:snake>]::*;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::sync::OnceLock;
|
||||
|
||||
pub(crate) type Data = super::[<$table_type Data>];
|
||||
pub(crate) type Data = super::[<$table_type:snake>]::[<$table_type Data>];
|
||||
pub(crate) static TABLE: OnceLock<HashMap<$key_type, Data>> = OnceLock::new();
|
||||
|
||||
pub fn iter() -> std::collections::hash_map::Iter<'static, $key_type, Data> {
|
||||
|
@ -125,6 +127,7 @@ json_data! {
|
|||
FavorLevel;
|
||||
FavorStory;
|
||||
FavorWord;
|
||||
FlySkinConfig;
|
||||
ForgeFormula;
|
||||
FunctionCondition;
|
||||
Gacha;
|
||||
|
@ -142,11 +145,12 @@ json_data! {
|
|||
MonsterDetection;
|
||||
MonsterPropertyGrowth;
|
||||
Motion;
|
||||
PhantomCustomizeItem;
|
||||
PhantomItem;
|
||||
QuestNodeData;
|
||||
ResonanceAmplification;
|
||||
ResonantChain;
|
||||
RoleBreach;
|
||||
RoleExpItem;
|
||||
RoleInfo;
|
||||
RoleLevelConsume;
|
||||
RolePropertyGrowth;
|
||||
|
@ -160,25 +164,28 @@ json_data! {
|
|||
WeaponLevel;
|
||||
WeaponPropertyGrowth;
|
||||
WeaponReson;
|
||||
WeaponSkin;
|
||||
}
|
||||
|
||||
json_hash_table_data! {
|
||||
AiBase, id, i32;
|
||||
AiStateMachineConfig, id, String;
|
||||
BlueprintConfig, blueprint_type, String;
|
||||
Buff, id, i64;
|
||||
DragonPool, id, i32;
|
||||
DropPackage, id, i32;
|
||||
TemplateConfig, blueprint_type, String;
|
||||
RoleExpItem, id, i32;
|
||||
SummonCfg, blueprint_type, String;
|
||||
Buff, id, i64;
|
||||
TemplateConfig, blueprint_type, String;
|
||||
}
|
||||
mod level_entity_config;
|
||||
|
||||
pub mod level_entity_config_data {
|
||||
pub use super::level_entity_config::*;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::sync::OnceLock;
|
||||
|
||||
pub(crate) type Data = super::LevelEntityConfigData;
|
||||
pub(crate) type Data = LevelEntityConfigData;
|
||||
pub(crate) static TABLE: OnceLock<HashMap<String, Data>> = OnceLock::new();
|
||||
|
||||
pub fn iter() -> std::collections::hash_map::Iter<'static, String, Data> {
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
use serde::Deserialize;
|
||||
use serde_repr::Deserialize_repr;
|
||||
|
||||
use crate::pb_components::action::Action;
|
||||
use crate::pb_components::condition::Condition;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
|
@ -52,455 +48,9 @@ impl RawVectorData {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct EntranceEntityData {
|
||||
pub dungeon_id: i32,
|
||||
pub entrance_entity_id: i64,
|
||||
}
|
||||
|
||||
#[derive(Deserialize_repr, PartialEq, Debug, Copy, Clone)]
|
||||
#[repr(i32)]
|
||||
pub enum GachaViewTypeInfoId {
|
||||
NoviceConvene = 1,
|
||||
FeaturedResonatorConvene = 2,
|
||||
FeaturedWeaponConvene = 3,
|
||||
StandardResonatorConvene = 4,
|
||||
StandardWeaponConvene = 5,
|
||||
BeginnersChoiceConvene = 6,
|
||||
MultipleChoiceResonatorConvene = 7,
|
||||
MultipleChoiceWeaponConvene = 8,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Clone)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct ConsumeItem {
|
||||
pub item_id: i32,
|
||||
pub count: i32,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, PartialEq, Debug, Copy, Clone)]
|
||||
pub enum EntityType {
|
||||
AdsorptionFoundation,
|
||||
AdviseItem,
|
||||
AiAlertNotifier,
|
||||
AiGearController,
|
||||
AiMovementGear,
|
||||
AirPassage,
|
||||
AiSceneItem,
|
||||
Animal,
|
||||
Animal2,
|
||||
AnnunciatorCenter,
|
||||
AnnunciatorWire,
|
||||
AreaOccupation,
|
||||
Audio,
|
||||
AudioBox,
|
||||
BatchBulletCaster,
|
||||
BeamCastBullet,
|
||||
BeamCaster,
|
||||
BeamCrystal,
|
||||
BeamDeliver,
|
||||
BeamReceiver,
|
||||
BondageTrap,
|
||||
BuffConsumer,
|
||||
BuffProducer,
|
||||
BurstCrystalFoundation,
|
||||
Chair,
|
||||
Chair2,
|
||||
ChallengeInteract,
|
||||
Chessboard,
|
||||
Chessman,
|
||||
ClientTrigger,
|
||||
Collect,
|
||||
Collect2,
|
||||
Collect3,
|
||||
CollectAnimal,
|
||||
CollectAnimalPart,
|
||||
CombatAnimal,
|
||||
CombatAnimal2,
|
||||
CombinedVisibleGroup,
|
||||
ControlConnector,
|
||||
ConveyorBelt,
|
||||
CookTool,
|
||||
CurveControlDestructible,
|
||||
CustomAoiEditor,
|
||||
Destructible,
|
||||
DestructibleControl,
|
||||
DestructibleExploreInteractor,
|
||||
DestructibleSceneBullet,
|
||||
DestructibleTrigger,
|
||||
Disc,
|
||||
Drop,
|
||||
DungeonEntry,
|
||||
DynamicPortalCreater,
|
||||
EffectArea,
|
||||
EnrichmentArea,
|
||||
EntityBatchRefresh,
|
||||
EntityBundle,
|
||||
EntityList,
|
||||
EntityPackage,
|
||||
ExploreSkillInteractor,
|
||||
FishingBoat,
|
||||
FollowShooter,
|
||||
FollowShooter2,
|
||||
FollowTrack,
|
||||
FollowTrackFoundation,
|
||||
Gramophone,
|
||||
GravityFlip,
|
||||
GroupAi,
|
||||
HackingTypeFollowShooter,
|
||||
HookLockPoint,
|
||||
HookSoundBox,
|
||||
HookWithRange,
|
||||
HorseBettingTuanzi,
|
||||
InhaledItem,
|
||||
InteractFoundation,
|
||||
InteractFoundationWithSceneItemAttribute,
|
||||
InteractGear,
|
||||
InteractGearGroup,
|
||||
InteractiveConditionListener,
|
||||
Item,
|
||||
ItemFoundation,
|
||||
JigsawFoundation,
|
||||
JigsawItem,
|
||||
KiteHook,
|
||||
LevelPlay,
|
||||
LevelPlayReward,
|
||||
LevelQteTrigger,
|
||||
LevelSeqTrigger,
|
||||
LevitateMagnet,
|
||||
LifePointCenter,
|
||||
Lift,
|
||||
LightDeliver,
|
||||
LocationSafety,
|
||||
Monitor,
|
||||
Monster,
|
||||
MonsterGachaBase,
|
||||
MonsterGachaItem,
|
||||
MoveableTrigger,
|
||||
NoRenderPortal,
|
||||
Npc,
|
||||
Npc2,
|
||||
PasserbyNpc,
|
||||
PhotoTarget,
|
||||
PhysicsSwing,
|
||||
Portal,
|
||||
Position,
|
||||
ProgressBarController,
|
||||
ProgressBarControllerWithAttribute,
|
||||
PullingObject,
|
||||
Range,
|
||||
RangeTriggerTargetGear,
|
||||
ReboundPlateGear,
|
||||
RefreshGroup,
|
||||
RenderSpecifiedRange,
|
||||
RenderSpecifiedRange2,
|
||||
Resurrection,
|
||||
RewardNpc,
|
||||
RollingFireball,
|
||||
Rotator,
|
||||
SceneAura,
|
||||
SceneBullet,
|
||||
SceneBulletCanHit,
|
||||
SceneBulletWithMovement,
|
||||
SceneItemStateHint,
|
||||
SimpleInteract,
|
||||
SimpleNPc,
|
||||
SkyboxTrigger,
|
||||
SlideRail,
|
||||
SoundBox,
|
||||
SpawnMonster,
|
||||
SpawnPasserbyNpc,
|
||||
Spline,
|
||||
SplineRange,
|
||||
SummonGongduolaPoint,
|
||||
StateSceneItem,
|
||||
StateTrigger,
|
||||
StatueFoundation,
|
||||
SuiGuangHook,
|
||||
TargetGear,
|
||||
TargetGear2,
|
||||
TargetGearGroup,
|
||||
TargetGearGroup2,
|
||||
TargetGearPro,
|
||||
TargetGearWithLevelPrefabPerform,
|
||||
TeleControl,
|
||||
TeleControl3,
|
||||
TeleControlGroup,
|
||||
Teleporter,
|
||||
TemplateEntitySpawner,
|
||||
TemporaryTeleporter,
|
||||
TimedStrikeDevice,
|
||||
TimelineTrackController,
|
||||
TimeStop,
|
||||
Trample,
|
||||
Trample2,
|
||||
Trample3,
|
||||
TreasureBox,
|
||||
Trigger,
|
||||
TriggerConditionListener,
|
||||
TuanziNpc,
|
||||
TurntableController,
|
||||
VacuumCleaner,
|
||||
VarManager,
|
||||
Vehicle,
|
||||
Vehicle2,
|
||||
VehicleNpc,
|
||||
VehicleSceneItem,
|
||||
VisibleTrigger,
|
||||
Vision,
|
||||
VisionItem,
|
||||
VisionTreasureBox,
|
||||
WalkingPatternController,
|
||||
WaterCollection,
|
||||
WaterSpout,
|
||||
Weapon,
|
||||
WindSource,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, PartialEq, Debug, Copy, Clone)]
|
||||
pub enum EntityLogic {
|
||||
Item,
|
||||
Animal,
|
||||
Monster,
|
||||
Vehicle,
|
||||
Npc,
|
||||
Vision,
|
||||
ClientOnly,
|
||||
ServerOnly,
|
||||
Custom,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub enum LevelPlayType {
|
||||
Challenge,
|
||||
SilentArea,
|
||||
Dungeon,
|
||||
MonsterTreasure,
|
||||
Quest,
|
||||
Riddle,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase", deny_unknown_fields)]
|
||||
pub struct LevelPlayOpenCondition {
|
||||
pub conditions: Option<Vec<Condition>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase", deny_unknown_fields)]
|
||||
pub struct LevelPlayActive {
|
||||
pub active_type: i32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase", deny_unknown_fields)]
|
||||
pub struct LevelPlayRewardConfigResetTypeMidNight {
|
||||
pub count: i32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(tag = "Type")]
|
||||
pub enum LevelPlayRewardConfigResetType {
|
||||
MidNight(LevelPlayRewardConfigResetTypeMidNight),
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase", deny_unknown_fields)]
|
||||
pub struct LevelPlayRewardConfigInteract {
|
||||
pub reward_id: i32,
|
||||
pub reward_entity_id: i64,
|
||||
pub reward_complete_actions: Vec<Action>,
|
||||
pub first_complete_actions: Option<Vec<Action>>,
|
||||
pub reset: Option<LevelPlayRewardConfigResetType>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(tag = "Type")]
|
||||
pub enum LevelPlayRewardConfig {
|
||||
None,
|
||||
Interact(LevelPlayRewardConfigInteract),
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub enum FixedDateTime {
|
||||
Daily,
|
||||
Weekly
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase", deny_unknown_fields)]
|
||||
pub struct LevelPlayRefreshConfigFixedDateTime {
|
||||
pub update_type: FixedDateTime,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase", deny_unknown_fields)]
|
||||
pub struct LevelPlayRefreshConfigCompleted {
|
||||
pub min_refresh_cd: i32,
|
||||
pub max_refresh_cd: i32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(tag = "Type")]
|
||||
pub enum LevelPlayRefreshConfig {
|
||||
None,
|
||||
FixedDateTime(LevelPlayRefreshConfigFixedDateTime),
|
||||
Completed(LevelPlayRefreshConfigCompleted),
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase", deny_unknown_fields)]
|
||||
pub struct LevelPlayTrack {
|
||||
pub track_radius: i32,
|
||||
pub track_priority: i32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase", deny_unknown_fields)]
|
||||
pub struct LevelPlayMark {
|
||||
pub mark_id: i32,
|
||||
pub map_bg_path: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub enum OnlineType {
|
||||
Multiplayer,
|
||||
Local,
|
||||
Hang,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub enum ObjType {
|
||||
LevelPlay,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase", deny_unknown_fields)]
|
||||
pub struct LevelPlayDataDetail { // Json file contains Data in name, so it has to be DataData
|
||||
pub id: i32,
|
||||
pub key: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub internal_dest: String,
|
||||
pub level_id: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub tid_name: String,
|
||||
pub r#type: LevelPlayType,
|
||||
pub instance_id: i32,
|
||||
pub level_play_entity_id: i64,
|
||||
pub level_additive_id: i32,
|
||||
pub enter_radius: i32,
|
||||
pub leave_radius: i32,
|
||||
pub delay_refresh: bool,
|
||||
pub delay_destroy: bool,
|
||||
pub level_play_open_condition: LevelPlayOpenCondition,
|
||||
pub level_play_active: LevelPlayActive,
|
||||
pub level_play_reward_config: LevelPlayRewardConfig,
|
||||
pub level_play_refresh_config: LevelPlayRefreshConfig,
|
||||
pub level_play_track: LevelPlayTrack,
|
||||
pub level_play_mark: Option<LevelPlayMark>,
|
||||
pub enter_in_range_actions: Option<Vec<Action>>,
|
||||
pub pack_id: i32,
|
||||
pub online_type: OnlineType,
|
||||
pub obj_type: ObjType,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub children: Option<Vec<String>>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub reference: Vec<String>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub weak_reference: Option<Vec<String>>,
|
||||
pub exploratory_degree: Option<i32>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct StateMachineTransition {
|
||||
pub from: i32,
|
||||
pub to: i32,
|
||||
pub transition_prediction_type: i32,
|
||||
pub weight: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub conditions: Vec<serde_json::Value>, // TODO: Implement conditions
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct StateMachineNodeCommon {
|
||||
pub uuid: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub is_anim_state_machine: Option<bool>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub is_conduit_node: Option<bool>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub is_any_state: Option<bool>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub name: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub take_control_type: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub transition_rule: i32,
|
||||
pub children: Option<Vec<i32>>,
|
||||
pub transitions: Option<Vec<StateMachineTransition>>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub on_enter_actions: Option<Vec<serde_json::Value>>, // TODO: Implement actions
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub on_exit_actions: Option<Vec<serde_json::Value>>, // TODO: Implement actions
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub bind_states: Option<Vec<serde_json::Value>>, // TODO: Implement bindStates
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub task: Option<serde_json::Value>, // TODO: Implement bindStates
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct StateMachineNodeReferenced {
|
||||
pub reference_uuid: i32,
|
||||
#[serde(flatten)]
|
||||
pub common: StateMachineNodeCommon,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct StateMachineNodeOverrideCommon {
|
||||
pub override_common_uuid: i32,
|
||||
#[serde(flatten)]
|
||||
pub common: StateMachineNodeCommon,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct StateMachineNodeCustom {
|
||||
#[serde(flatten)]
|
||||
pub common: StateMachineNodeCommon,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum StateMachineNode {
|
||||
Reference(StateMachineNodeReferenced),
|
||||
Override(StateMachineNodeOverrideCommon),
|
||||
Custom(StateMachineNodeCustom),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct StateMachineJson {
|
||||
pub version: u32,
|
||||
pub state_machines: Vec<i32>,
|
||||
pub nodes: Vec<StateMachineNode>,
|
||||
}
|
|
@ -22,5 +22,4 @@ pub struct ModelConfigPreloadData {
|
|||
pub animation_blueprints: Vec<String>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub others: Vec<String>,
|
||||
|
||||
}
|
|
@ -1097,6 +1097,7 @@ pub enum VehicleType {
|
|||
FishingBoat,
|
||||
Gongduola,
|
||||
Appointed(AppointedVehicleType),
|
||||
Current,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
|
@ -1215,6 +1216,7 @@ pub enum SystemType {
|
|||
ConfirmBox(SystemTypeConfirmBox),
|
||||
FishingItemDelivery(SystemTypeFishingItemDelivery),
|
||||
SoaringChallenge(SystemTypeSoaringChallenge),
|
||||
ConfirmBox2, // TODO:
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
|
@ -1439,6 +1441,7 @@ pub enum GameplayConfig {
|
|||
FishingRoulette,
|
||||
DaolingAuthentication,
|
||||
SundialPuzzle,
|
||||
TuningStand,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
|
@ -1760,6 +1763,35 @@ pub struct RemoveTrialCharacter {
|
|||
pub character_group: Vec<i64>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct CharacterGroup {
|
||||
pub character_id: i64,
|
||||
pub is_ai_character: bool,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct UpdateTrialCharacter {
|
||||
pub character_group_new: Option<Vec<CharacterGroup>>,
|
||||
pub auto_change: Option<bool>,
|
||||
pub is_remove_tips: Option<bool>,
|
||||
pub enable_map_and_teleport: Option<bool>,
|
||||
pub dungeon_list: Option<Vec<i32>>,
|
||||
pub enter_range_entities: Option<Vec<i64>>,
|
||||
pub create_temp_team: Option<bool>,
|
||||
// TODO: IsDisableRollBackRestoreCharacter ActiveRange
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct RestoreTrialCharacter {
|
||||
// TODO
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
|
@ -2351,6 +2383,30 @@ pub struct RequestSystemFunction {
|
|||
pub config: serde_json::Value,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct SetTimeScale {
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub config: serde_json::Value,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct EndCommonTip {
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub config: serde_json::Value,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct SetupMoraleSystem {
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub config: serde_json::Value,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
#[serde(tag = "Name")]
|
||||
pub enum Action {
|
||||
|
@ -2465,6 +2521,8 @@ pub enum Action {
|
|||
RemoveTrialFollowShooter(ActionFields<RemoveTrialFollowShooter>),
|
||||
AddTrialCharacter(ActionFields<AddTrialCharacter>),
|
||||
RemoveTrialCharacter(ActionFields<RemoveTrialCharacter>),
|
||||
UpdateTrialCharacter(ActionFields<UpdateTrialCharacter>),
|
||||
RestoreTrialCharacter(ActionFields<RestoreTrialCharacter>),
|
||||
SetAreaState(ActionFields<SetAreaState>),
|
||||
SwitchSubLevels(ActionFields<SwitchSubLevels>),
|
||||
ChangeTeamPosition(ActionFields<ChangeTeamPosition>),
|
||||
|
@ -2538,6 +2596,9 @@ pub enum Action {
|
|||
StopUiScreenEffect(ActionFields<StopUiScreenEffect>),
|
||||
StopNewMoveWithSpline(ActionFields<StopNewMoveWithSpline>),
|
||||
RequestSystemFunction(ActionFields<RequestSystemFunction>),
|
||||
SetTimeScale(ActionFields<SetTimeScale>),
|
||||
EndCommonTip(ActionFields<EndCommonTip>),
|
||||
SetupMoraleSystem(ActionFields<SetupMoraleSystem>),
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
|
|
|
@ -336,6 +336,7 @@ pub enum VehicleType {
|
|||
FishingBoat,
|
||||
Gongduola,
|
||||
SceneItemAutoMoveVehicle,
|
||||
CoBathingEmptyVehicle,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
|
@ -1198,6 +1199,24 @@ pub struct CheckDangoCultivationProgress {
|
|||
pub UiType: serde_json::Value,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct CheckPlayerMoraleLevelRange {
|
||||
// TODO:
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub UiType: serde_json::Value,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct ProgramSpecialProcess {
|
||||
// TODO:
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub UiType: serde_json::Value,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
#[serde(tag = "Type")]
|
||||
pub enum Condition {
|
||||
|
@ -1305,6 +1324,8 @@ pub enum Condition {
|
|||
FinishBvbChallenge(FinishBvbChallenge),
|
||||
CompareActorVar(CompareActorVar),
|
||||
CheckDangoCultivationProgress(CheckDangoCultivationProgress),
|
||||
CheckPlayerMoraleLevelRange(CheckPlayerMoraleLevelRange),
|
||||
ProgramSpecialProcess(ProgramSpecialProcess),
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
|
|
|
@ -9,13 +9,13 @@ pub mod condition;
|
|||
pub mod entity_state;
|
||||
pub mod flow;
|
||||
pub mod interact;
|
||||
pub mod model;
|
||||
pub mod monster;
|
||||
pub mod option;
|
||||
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 +29,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>,
|
||||
|
@ -71,6 +70,7 @@ pub struct ComponentsData {
|
|||
pub guide_line_creator_component: Option<serde_json::Value>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub photo_target_component: Option<serde_json::Value>,
|
||||
pub model_component: Option<model::ModelComponent>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub entity_group_component: Option<serde_json::Value>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
|
@ -222,15 +222,51 @@ pub struct ComponentsData {
|
|||
impl ComponentsData {
|
||||
pub fn merge_with_template(&self, template: &Self) -> Self {
|
||||
Self {
|
||||
base_info_component: self.base_info_component.as_ref().or(template.base_info_component.as_ref()).cloned(),
|
||||
ai_component: self.ai_component.as_ref().or(template.ai_component.as_ref()).cloned(),
|
||||
attribute_component: self.attribute_component.as_ref().or(template.attribute_component.as_ref()).cloned(),
|
||||
teleport_component: self.teleport_component.as_ref().or(template.teleport_component.as_ref()).cloned(),
|
||||
monster_component: self.monster_component.as_ref().or(template.monster_component.as_ref()).cloned(),
|
||||
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(),
|
||||
base_info_component: self
|
||||
.base_info_component
|
||||
.as_ref()
|
||||
.or(template.base_info_component.as_ref())
|
||||
.cloned(),
|
||||
ai_component: self
|
||||
.ai_component
|
||||
.as_ref()
|
||||
.or(template.ai_component.as_ref())
|
||||
.cloned(),
|
||||
attribute_component: self
|
||||
.attribute_component
|
||||
.as_ref()
|
||||
.or(template.attribute_component.as_ref())
|
||||
.cloned(),
|
||||
teleport_component: self
|
||||
.teleport_component
|
||||
.as_ref()
|
||||
.or(template.teleport_component.as_ref())
|
||||
.cloned(),
|
||||
monster_component: self
|
||||
.monster_component
|
||||
.as_ref()
|
||||
.or(template.monster_component.as_ref())
|
||||
.cloned(),
|
||||
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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,16 +3,83 @@ 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>
|
||||
pub struct ModelIdType {
|
||||
pub model_id: i32
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct PrefabStateList {
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub scene_interaction_state: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub level_tag: i64,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct LevelPrefabType {
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub blueprint_path: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub prefab_path: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub prefab_state_list: Vec<PrefabStateList>,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub effect_state_list: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct MeshType {
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub mesh: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct DaType {
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub da: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
#[serde(tag = "Type")]
|
||||
pub enum NpcModel {
|
||||
Mesh(MeshType),
|
||||
Da(DaType),
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct NpcType {
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub blueprint_path: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub npc_model: NpcModel,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub abp: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
#[serde(tag = "Type")]
|
||||
pub enum ModelType {
|
||||
ModelId(ModelIdType),
|
||||
LevelPrefab(LevelPrefabType),
|
||||
Npc(NpcType),
|
||||
}
|
||||
|
||||
#[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 half_height: Option<i32>,
|
||||
pub track_height: Option<i32>,
|
||||
pub disabled: Option<bool>,
|
||||
pub model_type: Option<ModelType>
|
||||
pub model_type: Option<ModelType>,
|
||||
}
|
10
wicked-waifus-data/src/phantom_customize_item.rs
Normal file
10
wicked-waifus-data/src/phantom_customize_item.rs
Normal file
|
@ -0,0 +1,10 @@
|
|||
use serde::Deserialize;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct PhantomCustomizeItemData {
|
||||
pub item_id: i32,
|
||||
pub phantom_id: i32,
|
||||
pub skin_item_id: i32,
|
||||
}
|
58
wicked-waifus-data/src/phantom_item.rs
Normal file
58
wicked-waifus-data/src/phantom_item.rs
Normal file
|
@ -0,0 +1,58 @@
|
|||
use serde::Deserialize;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct MainProp {
|
||||
pub rand_group_id: i32,
|
||||
pub rand_num: i32,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct PhantomItemData {
|
||||
pub item_id: i32,
|
||||
pub monster_id: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub monster_name: String,
|
||||
pub element_type: Vec<i32>,
|
||||
pub main_prop: MainProp,
|
||||
pub level_up_group_id: i32,
|
||||
pub skill_id: i32,
|
||||
pub calabash_buffs: Vec<i32>,
|
||||
pub rarity: i32,
|
||||
pub mesh_id: i32,
|
||||
pub zoom: [f32; 3],
|
||||
pub location: [f32; 3],
|
||||
pub rotator: [f32; 3],
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub stand_anim: 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 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,
|
||||
pub quality_id: i32,
|
||||
pub max_capcity: i32,
|
||||
pub item_access: Vec<i32>,
|
||||
pub obtained_show: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub obtained_show_description: String,
|
||||
pub num_limit: i32,
|
||||
pub show_in_bag: bool,
|
||||
pub sort_index: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub skill_icon: String,
|
||||
pub destructible: bool,
|
||||
pub red_dot_disable_rule: i32,
|
||||
pub fetter_group: Vec<i32>,
|
||||
pub phantom_type: i32,
|
||||
pub parent_monster_id: i32,
|
||||
}
|
|
@ -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,
|
||||
|
|
|
@ -77,7 +77,6 @@ pub struct RoleSkinData {
|
|||
pub ui_mesh_id: i32,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
pub role_body: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
#[serde(rename = "UiScenePerformanceABP")]
|
||||
pub ui_scene_performance_abp: String,
|
||||
#[cfg(feature = "strict_json_fields")]
|
||||
|
|
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.5.2/bundle.zip"
|
||||
buffer_size = 268435456
|
||||
|
||||
[default_unlocks]
|
||||
|
@ -28,8 +28,18 @@ 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
|
||||
unlock_all_echo_skins = false
|
||||
unlock_all_echo = false
|
||||
# TODO: Add max level here too??
|
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();
|
96
wicked-waifus-game-server/scripts/watermask-dvd.js
Normal file
96
wicked-waifus-game-server/scripts/watermask-dvd.js
Normal file
|
@ -0,0 +1,96 @@
|
|||
const UE = require("ue");
|
||||
const Info_1 = require("../../../Core/Common/Info");
|
||||
const MathUtils_1 = require("../../../Core/Utils/MathUtils");
|
||||
const UiLayerType_1 = require("../../Ui/Define/UiLayerType");
|
||||
const UiLayer_1 = require("../../Ui/UiLayer");
|
||||
|
||||
var _a = require("../Module/WaterMask/WaterMaskController").WaterMaskView;
|
||||
|
||||
_a.LOo = 0.12;
|
||||
_a.yOo = 700;
|
||||
_a.IOo = 700;
|
||||
|
||||
let colorCycle = [
|
||||
"#FF0000",
|
||||
"#FF7F00",
|
||||
"#FFFF00",
|
||||
"#00FF00",
|
||||
"#0000FF",
|
||||
"#4B0082",
|
||||
"#9400D3",
|
||||
];
|
||||
let colorIndex = 0;
|
||||
let directionX = 3;
|
||||
let directionY = 3;
|
||||
const SPEED = 8;
|
||||
const TEXT_OFFSET_X = 270;
|
||||
const TEXT_OFFSET_Y = 20;
|
||||
|
||||
_a.vOo = function () {
|
||||
void 0 !== _a.SOo && _a.EOo();
|
||||
let e = UiLayer_1.UiLayer.GetLayerRootUiItem(
|
||||
UiLayerType_1.ELayerType.WaterMask,
|
||||
);
|
||||
_a.SOo = UE.KuroActorManager.SpawnActor(
|
||||
Info_1.Info.World,
|
||||
UE.UIContainerActor.StaticClass(),
|
||||
MathUtils_1.MathUtils.DefaultTransform,
|
||||
void 0,
|
||||
);
|
||||
let t = _a.SOo.RootComponent;
|
||||
t.SetDisplayName("WaterMaskContainer");
|
||||
UE.KuroStaticLibrary.SetActorPermanent(_a.SOo, !0, !0);
|
||||
_a.SOo.K2_AttachRootComponentTo(e);
|
||||
|
||||
let rootComponent = t.GetRootCanvas().GetOwner().RootComponent;
|
||||
let screenWidth = rootComponent.widget.width;
|
||||
let screenHeight = rootComponent.widget.height;
|
||||
|
||||
let textActor = UE.KuroActorManager.SpawnActor(
|
||||
Info_1.Info.World,
|
||||
UE.UITextActor.StaticClass(),
|
||||
MathUtils_1.MathUtils.DefaultTransform,
|
||||
void 0,
|
||||
);
|
||||
let textRoot = textActor.RootComponent;
|
||||
textActor.K2_AttachRootComponentTo(t);
|
||||
textRoot.SetDisplayName("NangPoRao:fuckhadros:");
|
||||
let textComponent = textActor.GetComponentByClass(UE.UIText.StaticClass());
|
||||
|
||||
textComponent.SetFontSize(48);
|
||||
textComponent.SetOverflowType(0);
|
||||
textComponent.SetAlpha(_a.LOo);
|
||||
textComponent.SetFont(UE.LGUIFontData.GetDefaultFont());
|
||||
textComponent.SetText("{PLAYER_USERNAME}{CUSTOM_TEXT}");
|
||||
textComponent.SetColor(UE.Color.FromHex(colorCycle[colorIndex]));
|
||||
|
||||
let posX = 0;
|
||||
let posY = 0;
|
||||
const halfWidth = screenWidth / 2 - TEXT_OFFSET_X;
|
||||
const halfHeight = screenHeight / 2 - TEXT_OFFSET_Y;
|
||||
|
||||
function updatePosition() {
|
||||
posX += directionX;
|
||||
posY += directionY;
|
||||
|
||||
if (posX > halfWidth || posX < -halfWidth) {
|
||||
directionX *= -1;
|
||||
colorIndex = (colorIndex + 1) % colorCycle.length;
|
||||
textComponent.SetColor(UE.Color.FromHex(colorCycle[colorIndex]));
|
||||
textComponent.SetAlpha(_a.LOo);
|
||||
}
|
||||
|
||||
if (posY > halfHeight || posY < -halfHeight) {
|
||||
directionY *= -1;
|
||||
colorIndex = (colorIndex + 1) % colorCycle.length;
|
||||
textComponent.SetColor(UE.Color.FromHex(colorCycle[colorIndex]));
|
||||
textComponent.SetAlpha(_a.LOo);
|
||||
}
|
||||
|
||||
textRoot.SetUIRelativeLocation(new UE.Vector(posX, posY, 0));
|
||||
}
|
||||
|
||||
setInterval(updatePosition, 16);
|
||||
};
|
||||
|
||||
_a.vOo();
|
|
@ -24,7 +24,7 @@ _a.vOo = function () {
|
|||
_ = e.widget.height / 2,
|
||||
s = Math.ceil(e.widget.width / _a.yOo),
|
||||
o = Math.ceil(e.widget.height / _a.IOo),
|
||||
v = " "; // EDIT ME!
|
||||
v = "{PLAYER_USERNAME}{CUSTOM_TEXT}"; // 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
|
||||
|
|
|
@ -37,12 +37,20 @@ 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,
|
||||
pub unlock_all_echo_skins: bool,
|
||||
pub unlock_all_echo: bool,
|
||||
}
|
||||
|
||||
impl TomlConfig for ServiceConfig {
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
use wicked_waifus_data::BasePropertyData;
|
||||
use wicked_waifus_protocol::{
|
||||
entity_component_pb::ComponentPb, AttrData, AttributeComponentPb, EAttributeType,
|
||||
EntityComponentPb, LivingStatus,
|
||||
};
|
||||
use std::collections::HashMap;
|
||||
|
||||
use wicked_waifus_data::base_property_data::BasePropertyData;
|
||||
use crate::logic::ecs::component::Component;
|
||||
use crate::logic::utils::load_role_info::attribute_from_data;
|
||||
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
use wicked_waifus_protocol::entity_component_pb::ComponentPb;
|
||||
use wicked_waifus_protocol::{CharacterAttachComponentPb, CharacterAttachInfo, EntityComponentPb};
|
||||
|
||||
use crate::logic::ecs::component::Component;
|
||||
|
||||
pub struct CharacterAttach {
|
||||
pub pb_combine_part_info_list: Vec<CharacterAttachInfo>,
|
||||
pub pb_combine_target_server_id: i64,
|
||||
}
|
||||
|
||||
impl Component for CharacterAttach {
|
||||
fn set_pb_data(&self, pb: &mut wicked_waifus_protocol::EntityPb) {
|
||||
pb.component_pbs.push(EntityComponentPb {
|
||||
component_pb: Some(ComponentPb::CharacterAttachComponentPb(
|
||||
CharacterAttachComponentPb {
|
||||
pb_combine_part_info_list: self.pb_combine_part_info_list.clone(),
|
||||
pb_combine_target_server_id: self.pb_combine_target_server_id,
|
||||
},
|
||||
)),
|
||||
})
|
||||
}
|
||||
}
|
|
@ -5,8 +5,8 @@ use indexmap::IndexMap;
|
|||
use wicked_waifus_protocol::{DFsm, DFsmBlackBoard, EntityComponentPb, EntityFsmComponentPb, FsmCustomBlackboardDatas};
|
||||
use wicked_waifus_protocol::entity_component_pb::ComponentPb;
|
||||
|
||||
use wicked_waifus_data::{ai_base_data, ai_state_machine_config_data, AiStateMachineConfigData, StateMachineJson, StateMachineNode, StateMachineNodeCommon};
|
||||
|
||||
use wicked_waifus_data::{ai_base_data, ai_state_machine_config_data};
|
||||
use wicked_waifus_data::ai_state_machine_config_data::{AiStateMachineConfigData, StateMachineJson, StateMachineNode, StateMachineNodeCommon};
|
||||
use crate::logic::ecs::component::Component;
|
||||
|
||||
static COMMON_FSM: OnceLock<AiStateMachineConfigData> = OnceLock::new();
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
use wicked_waifus_protocol::entity_component_pb::ComponentPb;
|
||||
use wicked_waifus_protocol::{EntityComponentPb, LogicStateComponentPb};
|
||||
|
||||
use crate::logic::ecs::component::Component;
|
||||
|
||||
pub struct LogicState {
|
||||
pub position_state: i32,
|
||||
pub move_state: i32,
|
||||
pub direction_state: i32,
|
||||
pub position_sub_state: i32,
|
||||
}
|
||||
|
||||
impl Component for LogicState {
|
||||
fn set_pb_data(&self, pb: &mut wicked_waifus_protocol::EntityPb) {
|
||||
pb.component_pbs.push(EntityComponentPb {
|
||||
component_pb: Some(ComponentPb::LogicStateComponentPb(LogicStateComponentPb {
|
||||
position_state: self.position_state,
|
||||
move_state: self.move_state,
|
||||
direction_state: self.direction_state,
|
||||
position_sub_state: self.position_sub_state,
|
||||
})),
|
||||
})
|
||||
}
|
||||
}
|
|
@ -1,11 +1,13 @@
|
|||
mod attribute;
|
||||
mod autonomous;
|
||||
mod character_attach;
|
||||
mod concomitant;
|
||||
mod entity_config;
|
||||
mod equip;
|
||||
mod fight_buff;
|
||||
mod fsm;
|
||||
mod interact;
|
||||
mod logic_state;
|
||||
mod monster_ai;
|
||||
mod movement;
|
||||
mod owner_player;
|
||||
|
@ -19,15 +21,18 @@ mod summoner;
|
|||
mod tag;
|
||||
mod visibility;
|
||||
mod vision_skill;
|
||||
mod weapon_skin;
|
||||
|
||||
pub use attribute::Attribute;
|
||||
pub use autonomous::Autonomous;
|
||||
pub use character_attach::CharacterAttach;
|
||||
pub use concomitant::Concomitant;
|
||||
pub use entity_config::EntityConfig;
|
||||
pub use equip::Equip;
|
||||
pub use fight_buff::FightBuff;
|
||||
pub use fsm::Fsm;
|
||||
pub use interact::Interact;
|
||||
pub use logic_state::LogicState;
|
||||
pub use monster_ai::MonsterAi;
|
||||
pub use movement::Movement;
|
||||
pub use owner_player::OwnerPlayer;
|
||||
|
@ -41,3 +46,4 @@ pub use summoner::Summoner;
|
|||
pub use tag::Tag;
|
||||
pub use visibility::Visibility;
|
||||
pub use vision_skill::VisionSkill;
|
||||
pub use weapon_skin::WeaponSkin;
|
||||
|
|
|
@ -4,6 +4,7 @@ use wicked_waifus_protocol::entity_component_pb::ComponentPb;
|
|||
use crate::logic::ecs::component::Component;
|
||||
|
||||
pub struct Summoner {
|
||||
pub summoner_id: i64,
|
||||
pub summon_cfg_id: i32,
|
||||
pub summon_skill_id: i32,
|
||||
pub summon_type: i32,
|
||||
|
@ -13,7 +14,7 @@ impl Component for Summoner {
|
|||
fn set_pb_data(&self, pb: &mut wicked_waifus_protocol::EntityPb) {
|
||||
pb.component_pbs.push(EntityComponentPb {
|
||||
component_pb: Some(ComponentPb::SummonerComponent(SummonerComponentPb {
|
||||
summoner_id: pb.id + 1,
|
||||
summoner_id: self.summoner_id,
|
||||
summon_cfg_id: self.summon_cfg_id,
|
||||
summon_skill_id: self.summon_skill_id,
|
||||
player_id: pb.player_id,
|
||||
|
|
|
@ -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,34 +8,17 @@ pub struct BufManager {
|
|||
recycled_handles: HashMap<i32, VecDeque<i32>>,
|
||||
}
|
||||
|
||||
const OVERRIDE_BUFFS: &[i64] = &[
|
||||
3003, // Remove wall run prohibition
|
||||
3004, // Remove gliding prohibition
|
||||
1213, // Reduce stamina while flying
|
||||
1214, // Reduce stamina while flying in sprint
|
||||
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 {
|
||||
const PERMANENT_ROLE_BUFFS: &'static [i64] = &[
|
||||
3003, // Remove wall run prohibition
|
||||
3004, // Remove gliding prohibition
|
||||
1213, // Reduce stamina while flying
|
||||
1214, // Reduce stamina while flying in sprint
|
||||
1215, // Reduce stamina while flying up in sprint
|
||||
1216, // Reduce stamina while flying down in sprint
|
||||
640012051, // Allow flying -> tag: 1151923109
|
||||
];
|
||||
|
||||
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 {
|
||||
|
|
|
@ -23,27 +23,30 @@ macro_rules! impl_component_container {
|
|||
}
|
||||
|
||||
impl_component_container! {
|
||||
Position;
|
||||
EntityConfig;
|
||||
OwnerPlayer;
|
||||
Visibility;
|
||||
Attribute;
|
||||
PlayerOwnedEntityMarker;
|
||||
Movement;
|
||||
Equip;
|
||||
VisionSkill;
|
||||
MonsterAi;
|
||||
Fsm;
|
||||
RoleSkin;
|
||||
FightBuff;
|
||||
StateTag;
|
||||
Tag;
|
||||
Autonomous;
|
||||
Interact;
|
||||
CharacterAttach;
|
||||
Concomitant;
|
||||
Summoner;
|
||||
SoarWingSkin;
|
||||
EntityConfig;
|
||||
Equip;
|
||||
FightBuff;
|
||||
Fsm;
|
||||
Interact;
|
||||
LogicState;
|
||||
MonsterAi;
|
||||
Movement;
|
||||
OwnerPlayer;
|
||||
ParaglidingSkin;
|
||||
PlayerOwnedEntityMarker;
|
||||
Position;
|
||||
RoleSkin;
|
||||
SoarWingSkin;
|
||||
StateTag;
|
||||
Summoner;
|
||||
Tag;
|
||||
Visibility;
|
||||
VisionSkill;
|
||||
WeaponSkin;
|
||||
}
|
||||
|
||||
pub trait Component {
|
||||
|
|
|
@ -25,8 +25,8 @@ macro_rules! find_component {
|
|||
// Query specified components from all entities (and)
|
||||
#[macro_export]
|
||||
macro_rules! query_with {
|
||||
($world_entitys:expr, $($comp:ident),*) => {
|
||||
$world_entitys.components().iter().filter(|(_, comps)| {
|
||||
($world_entities:expr, $($comp:ident),*) => {
|
||||
$world_entities.components().iter().filter(|(_, comps)| {
|
||||
$(comps.iter().any(|comp| matches!(&*comp.borrow(), ComponentContainer::$comp(_))) && )
|
||||
* true
|
||||
})
|
||||
|
@ -44,8 +44,8 @@ macro_rules! query_with {
|
|||
// Query specified components from all entities (or)
|
||||
#[macro_export]
|
||||
macro_rules! query_hn_with {
|
||||
($world_entitys:expr, $($comp:ident),*) => {
|
||||
$world_entitys.components().iter().filter(|(_, comps)| {
|
||||
($world_entities:expr, $($comp:ident),*) => {
|
||||
$world_entities.components().iter().filter(|(_, comps)| {
|
||||
$(comps.iter().any(|comp| matches!(&*comp.borrow(), ComponentContainer::$comp(_))) || )
|
||||
* false
|
||||
})
|
||||
|
@ -70,8 +70,8 @@ macro_rules! ident_as_none {
|
|||
// Query components of specified entity
|
||||
#[macro_export]
|
||||
macro_rules! query_components {
|
||||
($world_entitys:expr, $entity_id:expr, $($comp:ident),*) => {
|
||||
$world_entitys.components().iter().find(|(id, _)| $entity_id == i64::from(**id))
|
||||
($world_entities:expr, $entity_id:expr, $($comp:ident),*) => {
|
||||
$world_entities.components().iter().find(|(id, _)| $entity_id == i64::from(**id))
|
||||
.map(|(_, comps)| {
|
||||
($(
|
||||
$crate::find_component!(comps, $comp),
|
||||
|
|
|
@ -16,7 +16,7 @@ pub struct WorldEntity {
|
|||
|
||||
pub struct World {
|
||||
pub player_cur_map_id: i32,
|
||||
pub world_entitys: HashMap<i32, WorldEntity>, // i32 -> map_id
|
||||
pub world_entities: HashMap<i32, WorldEntity>, // i32 -> map_id
|
||||
pub in_world_players: HashMap<i32, InWorldPlayer>, // joined players metadata
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ impl World {
|
|||
pub fn new() -> Self {
|
||||
Self {
|
||||
player_cur_map_id: 8,
|
||||
world_entitys: HashMap::new(),
|
||||
world_entities: HashMap::new(),
|
||||
in_world_players: HashMap::new(),
|
||||
}
|
||||
}
|
||||
|
@ -43,13 +43,13 @@ impl World {
|
|||
}
|
||||
|
||||
pub fn get_mut_world_entity(&mut self) -> &mut WorldEntity {
|
||||
self.world_entitys
|
||||
self.world_entities
|
||||
.get_mut(&self.player_cur_map_id)
|
||||
.unwrap_or_else(|| panic!("Failed to get cur map data: {}", self.player_cur_map_id))
|
||||
}
|
||||
|
||||
pub fn get_world_entity(&self) -> &WorldEntity {
|
||||
self.world_entitys
|
||||
self.world_entities
|
||||
.get(&self.player_cur_map_id)
|
||||
.unwrap_or_else(|| panic!("Failed to get cur map data: {}", self.player_cur_map_id))
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ impl WorldEntity {
|
|||
entity,
|
||||
self.components
|
||||
.entry(entity.entity_id)
|
||||
.or_insert(Vec::new()),
|
||||
.or_default(),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -108,15 +108,11 @@ 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 generate_role_permanent_buffs(&mut self, entity_id: i64) -> Vec<FightBuffInformation> {
|
||||
self.buff_manager.create_permanent_buffs(entity_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)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,10 +2,10 @@ use rand::prelude::IndexedRandom;
|
|||
use rand::Rng;
|
||||
use wicked_waifus_protocol::{ErrorCode, GachaResult, GachaReward};
|
||||
|
||||
use wicked_waifus_data::GachaViewTypeInfoId::{
|
||||
BeginnersChoiceConvene, FeaturedResonatorConvene, FeaturedWeaponConvene,
|
||||
MultipleChoiceResonatorConvene, MultipleChoiceWeaponConvene, NoviceConvene,
|
||||
StandardResonatorConvene, StandardWeaponConvene,
|
||||
use wicked_waifus_data::gacha_view_info_data::GachaViewTypeInfoId::{
|
||||
AnniversaryResonatorConvene, AnniversaryWeaponConvene, BeginnersChoiceConvene,
|
||||
FeaturedResonatorConvene, FeaturedWeaponConvene, NewVoyageResonatorConvene,
|
||||
NewVoyageWeaponConvene, NoviceConvene, StandardResonatorConvene, StandardWeaponConvene,
|
||||
};
|
||||
|
||||
use crate::logic::gacha::pool_info::PoolInfo;
|
||||
|
@ -113,7 +113,16 @@ 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) => {
|
||||
|
@ -145,13 +154,15 @@ impl GachaPool {
|
|||
},
|
||||
2 => match self.info.pool_type {
|
||||
NoviceConvene | StandardResonatorConvene => &[1405, 1301, 1503, 1104, 1203],
|
||||
// TODO: Review MultipleChoiceConvene
|
||||
// TODO: Review MultipleChoiceConvene(anniversary and new voyage)
|
||||
FeaturedResonatorConvene
|
||||
| FeaturedWeaponConvene
|
||||
| StandardWeaponConvene
|
||||
| BeginnersChoiceConvene
|
||||
| MultipleChoiceResonatorConvene
|
||||
| MultipleChoiceWeaponConvene => &self.info.rate_up_five_star[..],
|
||||
| AnniversaryResonatorConvene
|
||||
| AnniversaryWeaponConvene
|
||||
| NewVoyageResonatorConvene
|
||||
| NewVoyageWeaponConvene => &self.info.rate_up_five_star[..],
|
||||
},
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
use std::time::SystemTime;
|
||||
|
||||
use wicked_waifus_data::GachaViewTypeInfoId;
|
||||
use wicked_waifus_data::GachaViewTypeInfoId::{
|
||||
BeginnersChoiceConvene, FeaturedResonatorConvene, FeaturedWeaponConvene,
|
||||
MultipleChoiceResonatorConvene, MultipleChoiceWeaponConvene, NoviceConvene,
|
||||
StandardResonatorConvene, StandardWeaponConvene,
|
||||
use wicked_waifus_data::gacha_view_info_data::GachaViewTypeInfoId;
|
||||
use wicked_waifus_data::gacha_view_info_data::GachaViewTypeInfoId::{
|
||||
AnniversaryResonatorConvene, AnniversaryWeaponConvene, BeginnersChoiceConvene,
|
||||
FeaturedResonatorConvene, FeaturedWeaponConvene, NewVoyageResonatorConvene,
|
||||
NewVoyageWeaponConvene, NoviceConvene, StandardResonatorConvene, StandardWeaponConvene,
|
||||
};
|
||||
|
||||
use crate::logic::gacha::category::PoolCategory;
|
||||
|
@ -78,11 +78,14 @@ impl PoolInfo {
|
|||
StandardResonatorConvene | StandardWeaponConvene => {
|
||||
(50001, 0, 80, PitySystem::default())
|
||||
}
|
||||
// TODO: Review MultipleChoiceConvene
|
||||
FeaturedResonatorConvene
|
||||
| MultipleChoiceResonatorConvene
|
||||
| MultipleChoiceWeaponConvene => (50002, 0, 0, PitySystem::default()),
|
||||
FeaturedWeaponConvene => (50005, 0, 0, PitySystem::default()),
|
||||
// TODO: Review MultipleChoiceConvene(anniversary and new voyage)
|
||||
FeaturedResonatorConvene | AnniversaryResonatorConvene | NewVoyageResonatorConvene => {
|
||||
(50002, 0, 0, PitySystem::default())
|
||||
}
|
||||
// TODO: Review MultipleChoiceConvene(anniversary and new voyage)
|
||||
FeaturedWeaponConvene | AnniversaryWeaponConvene | NewVoyageWeaponConvene => {
|
||||
(50005, 0, 0, PitySystem::default())
|
||||
}
|
||||
BeginnersChoiceConvene => match pool_id {
|
||||
51..56 => (50006, 0, 1, PitySystem::default()),
|
||||
_ => (50001, 0, 80, PitySystem::default()),
|
||||
|
|
|
@ -5,10 +5,10 @@ use rand::prelude::StdRng;
|
|||
use rand::SeedableRng;
|
||||
|
||||
use wicked_waifus_data::gacha_view_info_data;
|
||||
use wicked_waifus_data::GachaViewTypeInfoId::{
|
||||
BeginnersChoiceConvene, FeaturedResonatorConvene, FeaturedWeaponConvene,
|
||||
MultipleChoiceResonatorConvene, MultipleChoiceWeaponConvene, NoviceConvene,
|
||||
StandardResonatorConvene, StandardWeaponConvene,
|
||||
use wicked_waifus_data::gacha_view_info_data::GachaViewTypeInfoId::{
|
||||
AnniversaryResonatorConvene, AnniversaryWeaponConvene, BeginnersChoiceConvene,
|
||||
FeaturedResonatorConvene, FeaturedWeaponConvene, NewVoyageResonatorConvene,
|
||||
NewVoyageWeaponConvene, NoviceConvene, StandardResonatorConvene, StandardWeaponConvene,
|
||||
};
|
||||
use wicked_waifus_protocol::{ErrorCode, GachaResult};
|
||||
|
||||
|
@ -41,11 +41,15 @@ impl GachaService {
|
|||
NoviceConvene | StandardResonatorConvene | StandardWeaponConvene => {
|
||||
PoolCategory::Permanent
|
||||
}
|
||||
// TODO: Review MultipleChoiceConvene
|
||||
// TODO: Review MultipleChoiceConvene(anniversary and new voyage)
|
||||
FeaturedResonatorConvene
|
||||
| FeaturedWeaponConvene
|
||||
| MultipleChoiceResonatorConvene
|
||||
| MultipleChoiceWeaponConvene => PoolCategory::Event(Self::THREE_WEEKS),
|
||||
| StandardWeaponConvene
|
||||
| BeginnersChoiceConvene
|
||||
| AnniversaryResonatorConvene
|
||||
| AnniversaryWeaponConvene
|
||||
| NewVoyageResonatorConvene
|
||||
| NewVoyageWeaponConvene => PoolCategory::Event(Self::THREE_WEEKS),
|
||||
BeginnersChoiceConvene => match element.id {
|
||||
51..56 => PoolCategory::Special(Self::ONE_WEEK),
|
||||
_ => PoolCategory::Permanent,
|
||||
|
|
|
@ -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,13 +1,13 @@
|
|||
use crate::logic::thread_mgr::NetContext;
|
||||
use wicked_waifus_protocol::{AdviceSetRequest, AdviceSetResponse, ErrorCode};
|
||||
use crate::logic::player::Player;
|
||||
|
||||
pub fn on_advice_set_request(
|
||||
player: &mut Player,
|
||||
ctx: &mut NetContext,
|
||||
request: AdviceSetRequest,
|
||||
response: &mut AdviceSetResponse,
|
||||
) {
|
||||
player.advise.is_show = request.is_show;
|
||||
ctx.player.advise.is_show = request.is_show;
|
||||
|
||||
response.is_show = request.is_show;
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,21 @@
|
|||
use wicked_waifus_protocol::{AnimalDestroyRequest, AnimalDestroyResponse, AnimalDieRequest, AnimalDieResponse, AnimalDropRequest, AnimalDropResponse, EEntityType, ERemoveEntityType, EntityLivingStatusNotify, ErrorCode, LivingStatus};
|
||||
use wicked_waifus_protocol::{
|
||||
AnimalDestroyRequest, AnimalDestroyResponse, AnimalDieRequest, AnimalDieResponse,
|
||||
AnimalDropRequest, AnimalDropResponse, EEntityType, ERemoveEntityType,
|
||||
EntityLivingStatusNotify, ErrorCode, LivingStatus,
|
||||
};
|
||||
|
||||
use crate::logic::ecs::component::ComponentContainer;
|
||||
use crate::logic::player::Player;
|
||||
use crate::logic::thread_mgr::NetContext;
|
||||
use crate::logic::utils::world_util;
|
||||
use crate::query_components;
|
||||
|
||||
pub fn on_animal_die_request(
|
||||
player: &mut Player,
|
||||
ctx: &mut NetContext,
|
||||
request: AnimalDieRequest,
|
||||
response: &mut AnimalDieResponse,
|
||||
) {
|
||||
tracing::warn!("AnimalDieRequest not fully implemented");
|
||||
player.notify(EntityLivingStatusNotify {
|
||||
ctx.player.notify(EntityLivingStatusNotify {
|
||||
id: request.entity_id,
|
||||
living_status: LivingStatus::Dead.into(),
|
||||
drop_vision_item: vec![],
|
||||
|
@ -21,7 +25,7 @@ pub fn on_animal_die_request(
|
|||
}
|
||||
|
||||
pub fn on_animal_drop_request(
|
||||
_player: &mut Player,
|
||||
_ctx: &mut NetContext,
|
||||
_request: AnimalDropRequest,
|
||||
response: &mut AnimalDropResponse,
|
||||
) {
|
||||
|
@ -32,15 +36,13 @@ pub fn on_animal_drop_request(
|
|||
}
|
||||
|
||||
pub fn on_animal_destroy_request(
|
||||
player: &mut Player,
|
||||
ctx: &mut NetContext,
|
||||
request: AnimalDestroyRequest,
|
||||
response: &mut AnimalDestroyResponse,
|
||||
) {
|
||||
let entity_id = request.entity_id;
|
||||
{
|
||||
let entity_id = request.entity_id;
|
||||
let world_ref = player.world.borrow();
|
||||
let world = world_ref.get_world_entity();
|
||||
let (Some(config), ) = query_components!(world,entity_id,EntityConfig) else {
|
||||
let (Some(config), ) = query_components!(ctx.world.get_world_entity(), entity_id, EntityConfig) else {
|
||||
response.error_code = ErrorCode::ErrAnimalEntityNotExist.into();
|
||||
return;
|
||||
};
|
||||
|
@ -48,7 +50,7 @@ pub fn on_animal_destroy_request(
|
|||
response.error_code = ErrorCode::ErrNotAnimalEntity.into();
|
||||
}
|
||||
}
|
||||
world_util::remove_entity(player, request.entity_id, ERemoveEntityType::RemoveTypeNormal);
|
||||
world_util::remove_entity(ctx, request.entity_id, ERemoveEntityType::RemoveTypeNormal);
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
||||
|
||||
|
@ -62,4 +64,4 @@ fn get_animal_reward() {
|
|||
// NormalItemUpdateNotify
|
||||
// UpdateHandBookActiveStateMapNotify
|
||||
// ItemRewardNotify
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1,17 +1,21 @@
|
|||
use tracing::debug;
|
||||
|
||||
use wicked_waifus_protocol::{ErrorCode, PrivateChatDataRequest, PrivateChatDataResponse, PrivateChatHistoryRequest, PrivateChatHistoryResponse, PrivateChatOperateRequest, PrivateChatOperateResponse, PrivateChatOperateType, PrivateChatRequest, PrivateChatResponse};
|
||||
use wicked_waifus_protocol::{
|
||||
ErrorCode, PrivateChatDataRequest, PrivateChatDataResponse, PrivateChatHistoryRequest,
|
||||
PrivateChatHistoryResponse, PrivateChatOperateRequest, PrivateChatOperateResponse,
|
||||
PrivateChatOperateType, PrivateChatRequest, PrivateChatResponse,
|
||||
};
|
||||
|
||||
use crate::logic::player::Player;
|
||||
use crate::logic::thread_mgr::NetContext;
|
||||
|
||||
pub fn on_private_chat_request(
|
||||
player: &mut Player,
|
||||
ctx: &mut NetContext,
|
||||
request: PrivateChatRequest,
|
||||
response: &mut PrivateChatResponse,
|
||||
) {
|
||||
let own_id = player.basic_info.id;
|
||||
let own_id = ctx.player.basic_info.id;
|
||||
// TODO: Implement block and ban checks?? Ignore them for the time being
|
||||
let result = player.player_chat.validate_message(
|
||||
let result = ctx.player.player_chat.validate_message(
|
||||
own_id,
|
||||
request.target_uid,
|
||||
request.chat_content_type,
|
||||
|
@ -19,7 +23,7 @@ pub fn on_private_chat_request(
|
|||
);
|
||||
match result {
|
||||
Ok(message) => {
|
||||
player.player_chat.add_message(own_id, message.clone());
|
||||
ctx.player.player_chat.add_message(own_id, message.clone());
|
||||
// TODO: Check how to search a player from a different world(db search or session search)
|
||||
// let other_player = ...;
|
||||
// let other_player_message = message.clone();
|
||||
|
@ -37,38 +41,37 @@ pub fn on_private_chat_request(
|
|||
// )
|
||||
// })
|
||||
}
|
||||
Err(error_code) => response.error_code = error_code
|
||||
Err(error_code) => response.error_code = error_code,
|
||||
};
|
||||
}
|
||||
|
||||
pub fn on_private_chat_data_request(
|
||||
_: &Player,
|
||||
_: &NetContext,
|
||||
_: PrivateChatDataRequest,
|
||||
_: &mut PrivateChatDataResponse,
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
pub fn on_private_chat_history_request(
|
||||
player: &Player,
|
||||
ctx: &NetContext,
|
||||
request: PrivateChatHistoryRequest,
|
||||
response: &mut PrivateChatHistoryResponse,
|
||||
) {
|
||||
match player.player_chat.build_private_chat_history_content_proto(
|
||||
request.target_uid,
|
||||
request.start_index,
|
||||
) {
|
||||
match ctx
|
||||
.player
|
||||
.player_chat
|
||||
.build_private_chat_history_content_proto(request.target_uid, request.start_index)
|
||||
{
|
||||
Ok(chat_history_content_proto) => {
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
response.data = Some(chat_history_content_proto)
|
||||
}
|
||||
Err(error_code) => response.error_code = error_code
|
||||
Err(error_code) => response.error_code = error_code,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pub fn on_private_chat_operate_request(
|
||||
_player: &Player,
|
||||
_ctx: &NetContext,
|
||||
request: PrivateChatOperateRequest,
|
||||
response: &mut PrivateChatOperateResponse,
|
||||
) {
|
||||
|
@ -78,7 +81,10 @@ pub fn on_private_chat_operate_request(
|
|||
response.error_code = ErrorCode::Success.into();
|
||||
} else {
|
||||
// TODO: Additional checks
|
||||
debug!("on_private_chat_operate_request called for unimplemented case: {:?}", request);
|
||||
debug!(
|
||||
"on_private_chat_operate_request called for unimplemented case: {:?}",
|
||||
request
|
||||
);
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,15 +5,15 @@ use wicked_waifus_protocol::combat_message::{
|
|||
};
|
||||
use wicked_waifus_protocol::{
|
||||
AttributeChangedNotify, CombatCommon, DErrorResult, DamageExecuteRequest,
|
||||
DamageExecuteResponse, EAttributeType, ERemoveEntityType, ErrorCode,
|
||||
FsmConditionPassRequest, FsmConditionPassResponse, GameplayAttributeData,
|
||||
PlayerBattleStateChangeNotify, SwitchRoleRequest, SwitchRoleResponse,
|
||||
DamageExecuteResponse, EAttributeType, ERemoveEntityType, ErrorCode, FsmConditionPassRequest,
|
||||
FsmConditionPassResponse, GameplayAttributeData, PlayerBattleStateChangeNotify,
|
||||
SwitchRoleRequest, SwitchRoleResponse,
|
||||
};
|
||||
|
||||
use wicked_waifus_data::damage_data;
|
||||
|
||||
use crate::logic::ecs::component::ComponentContainer;
|
||||
use crate::logic::player::Player;
|
||||
use crate::logic::thread_mgr::NetContext;
|
||||
use crate::logic::utils::world_util;
|
||||
use crate::query_components;
|
||||
|
||||
|
@ -49,7 +49,7 @@ fn create_combat_notify(
|
|||
}
|
||||
|
||||
pub fn on_combat_message_combat_send_pack_request(
|
||||
player: &mut Player,
|
||||
ctx: &mut NetContext,
|
||||
request: CombatSendPackRequest,
|
||||
response: &mut CombatSendPackResponse,
|
||||
) {
|
||||
|
@ -58,13 +58,13 @@ pub fn on_combat_message_combat_send_pack_request(
|
|||
if let Some(ref request_message) = request_data.message {
|
||||
match request_message {
|
||||
combat_request_data::Message::SwitchRoleRequest(ref request) => {
|
||||
handle_switch_role_request(player, request_data, request, response);
|
||||
handle_switch_role_request(ctx, request_data, request, response);
|
||||
}
|
||||
combat_request_data::Message::FsmConditionPassRequest(ref request) => {
|
||||
handle_fsm_condition_request(player, request_data, request, response);
|
||||
handle_fsm_condition_request(ctx, request_data, request, response);
|
||||
}
|
||||
combat_request_data::Message::DamageExecuteRequest(ref request) => {
|
||||
handle_damage_execute_request(player, request_data, request, response);
|
||||
handle_damage_execute_request(ctx, request_data, request, response);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
@ -75,13 +75,18 @@ pub fn on_combat_message_combat_send_pack_request(
|
|||
}
|
||||
|
||||
fn handle_switch_role_request(
|
||||
player: &mut Player,
|
||||
ctx: &mut NetContext,
|
||||
combat_request: &CombatRequestData,
|
||||
request: &SwitchRoleRequest,
|
||||
response: &mut CombatSendPackResponse,
|
||||
) {
|
||||
// Find current formation and update current role
|
||||
if let Some(formation) = player.formation_list.values_mut().find(|f| f.is_current) {
|
||||
if let Some(formation) = ctx
|
||||
.player
|
||||
.formation_list
|
||||
.values_mut()
|
||||
.find(|f| f.is_current)
|
||||
{
|
||||
formation.cur_role = request.role_id;
|
||||
|
||||
let receive_pack = response
|
||||
|
@ -105,7 +110,7 @@ fn handle_switch_role_request(
|
|||
}
|
||||
|
||||
fn handle_damage_execute_request(
|
||||
player: &mut Player,
|
||||
ctx: &mut NetContext,
|
||||
combat_request: &CombatRequestData,
|
||||
request: &DamageExecuteRequest,
|
||||
response: &mut CombatSendPackResponse,
|
||||
|
@ -114,8 +119,7 @@ fn handle_damage_execute_request(
|
|||
.receive_pack_notify
|
||||
.get_or_insert_with(Default::default);
|
||||
|
||||
let mut world_ref = player.world.borrow_mut();
|
||||
let world = world_ref.get_mut_world_entity();
|
||||
let world = ctx.world.get_mut_world_entity();
|
||||
let config_id = world.get_config_id(request.attacker_entity_id.try_into().unwrap());
|
||||
let mut damage = 1; // TODO: Fix the formula with real parameters(10 field equation)
|
||||
if config_id.to_string().len() == 4 {
|
||||
|
@ -160,44 +164,44 @@ 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,
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
let mut entities_to_remove = Vec::new();
|
||||
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 {
|
||||
entities_to_remove.push(request.target_entity_id);
|
||||
}
|
||||
}
|
||||
|
||||
for entity in entities_to_remove {
|
||||
world_util::remove_entity(ctx, entity, ERemoveEntityType::HpIsZero);
|
||||
}
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
||||
|
||||
fn handle_battle(
|
||||
player: &mut Player,
|
||||
ctx: &mut NetContext,
|
||||
combat_request: &CombatRequestData,
|
||||
response: &mut CombatSendPackResponse,
|
||||
condition: bool,
|
||||
|
@ -209,15 +213,14 @@ fn handle_battle(
|
|||
receive_pack.data.push(create_combat_notify(
|
||||
combat_request.combat_common.unwrap(),
|
||||
combat_notify_data::Message::PlayerBattleStateChangeNotify(PlayerBattleStateChangeNotify {
|
||||
player_id: player.basic_info.id,
|
||||
|
||||
player_id: ctx.player.basic_info.id,
|
||||
in_battle: condition,
|
||||
}),
|
||||
));
|
||||
}
|
||||
|
||||
fn handle_fsm_condition_request(
|
||||
player: &mut Player,
|
||||
ctx: &mut NetContext,
|
||||
combat_request: &CombatRequestData,
|
||||
request: &FsmConditionPassRequest,
|
||||
response: &mut CombatSendPackResponse,
|
||||
|
@ -238,5 +241,5 @@ fn handle_fsm_condition_request(
|
|||
}),
|
||||
}),
|
||||
));
|
||||
handle_battle(player, combat_request, response, true);
|
||||
handle_battle(ctx, combat_request, response, true);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use crate::logic::thread_mgr::NetContext;
|
||||
use wicked_waifus_protocol::{ErrorCode, LobbyListRequest, LobbyListResponse};
|
||||
use crate::logic::player::Player;
|
||||
|
||||
pub fn on_lobby_list_request(
|
||||
_player: &mut Player,
|
||||
_ctx: &mut NetContext,
|
||||
request: LobbyListRequest,
|
||||
response: &mut LobbyListResponse,
|
||||
) {
|
||||
|
@ -15,4 +15,4 @@ pub fn on_lobby_list_request(
|
|||
}
|
||||
}
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::logic::player::Player;
|
||||
use crate::logic::thread_mgr::NetContext;
|
||||
|
||||
macro_rules! dummy_handler {
|
||||
($($type_name:ident;)*) => {
|
||||
|
@ -9,7 +9,7 @@ macro_rules! dummy_handler {
|
|||
|
||||
$(::paste::paste! {
|
||||
pub fn [<on_ $type_name:snake _request>](
|
||||
_player: &Player,
|
||||
_ctx: &NetContext,
|
||||
_request: [<$type_name Request>],
|
||||
_response: &mut [<$type_name Response>],
|
||||
) {
|
||||
|
@ -33,7 +33,6 @@ dummy_handler! {
|
|||
ExchangeReward;
|
||||
Liveness;
|
||||
PhotoMemory;
|
||||
WeaponSkin;
|
||||
VisionEquipGroupInfo;
|
||||
UpdatePlayStationBlockAccount;
|
||||
AdventureManual;
|
||||
|
|
|
@ -1,24 +1,30 @@
|
|||
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::thread_mgr::NetContext;
|
||||
use crate::logic::utils::action_utils::perform_action;
|
||||
use crate::logic::utils::condition_utils::check_condition;
|
||||
use crate::{logic, logic::ecs::component::ComponentContainer, query_components};
|
||||
|
||||
pub fn on_entity_active_request(
|
||||
player: &Player,
|
||||
ctx: &NetContext,
|
||||
request: EntityActiveRequest,
|
||||
response: &mut EntityActiveResponse,
|
||||
) {
|
||||
let world_ref = player.world.borrow();
|
||||
let world = world_ref.get_world_entity();
|
||||
let world = ctx.world.get_world_entity();
|
||||
|
||||
if !world.is_in_all_world_map(request.entity_id as i32) {
|
||||
tracing::debug!(
|
||||
"EntityActiveRequest: entity with id {} doesn't exist, player_id: {}",
|
||||
request.entity_id,
|
||||
player.basic_info.id
|
||||
ctx.player.basic_info.id
|
||||
);
|
||||
return;
|
||||
};
|
||||
|
@ -29,17 +35,19 @@ pub fn on_entity_active_request(
|
|||
..Default::default()
|
||||
};
|
||||
|
||||
world.get_entity_components(request.entity_id as i32)
|
||||
world
|
||||
.get_entity_components(request.entity_id as i32)
|
||||
.into_iter()
|
||||
.for_each(|comp| comp.set_pb_data(&mut pb));
|
||||
pb.component_pbs
|
||||
};
|
||||
|
||||
// TODO: Remove attribute
|
||||
if let (Some(position), Some(_attribute)) =
|
||||
query_components!(world, request.entity_id, Position, Attribute)
|
||||
if let (Some(position), Some(_attribute), Some(visibility)) =
|
||||
query_components!(world, request.entity_id, Position, Attribute, Visibility)
|
||||
{
|
||||
response.is_visible = true;
|
||||
response.is_visible = visibility.is_visible;
|
||||
|
||||
response.pos = Some(position.0.get_position_protobuf());
|
||||
response.rot = Some(position.0.get_rotation_protobuf());
|
||||
|
||||
|
@ -51,13 +59,12 @@ pub fn on_entity_active_request(
|
|||
"EntityActiveRequest: entity with id {} not found",
|
||||
request.entity_id
|
||||
);
|
||||
response.error_code = ErrorCode::ErrEntityNotFound.into(); // TODO: replace with appropriate error code
|
||||
return;
|
||||
response.error_code = ErrorCode::ErrEntityNotFound.into(); // TODO: replace with appropriate error code;
|
||||
};
|
||||
}
|
||||
|
||||
pub fn on_entity_on_landed_request(
|
||||
_: &Player,
|
||||
_: &NetContext,
|
||||
request: EntityOnLandedRequest,
|
||||
_: &mut EntityOnLandedResponse,
|
||||
) {
|
||||
|
@ -69,7 +76,7 @@ pub fn on_entity_on_landed_request(
|
|||
}
|
||||
|
||||
pub fn on_entity_position_request(
|
||||
_: &Player,
|
||||
_: &NetContext,
|
||||
request: EntityPositionRequest,
|
||||
_: &mut EntityPositionResponse,
|
||||
) {
|
||||
|
@ -81,27 +88,25 @@ pub fn on_entity_position_request(
|
|||
);
|
||||
}
|
||||
|
||||
pub fn on_move_package_push(player: &mut Player, push: MovePackagePush) {
|
||||
pub fn on_move_package_push(ctx: &mut NetContext, push: MovePackagePush) {
|
||||
for moving_entity in push.moving_entities {
|
||||
// Query components borrows world component so lets wrap it
|
||||
{
|
||||
let world_ref = player.world.borrow();
|
||||
let world = world_ref.get_world_entity();
|
||||
let world = ctx.world.get_world_entity();
|
||||
|
||||
if !world.is_in_all_world_map(moving_entity.entity_id as i32) {
|
||||
tracing::debug!(
|
||||
"MovePackage: entity with id {} doesn't exist",
|
||||
moving_entity.entity_id
|
||||
);
|
||||
"MovePackage: entity with id {} doesn't exist",
|
||||
moving_entity.entity_id
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
let Some(mut movement) = query_components!(world, moving_entity.entity_id, Movement).0
|
||||
else {
|
||||
tracing::warn!(
|
||||
"MovePackage: entity {} doesn't have movement component",
|
||||
moving_entity.entity_id
|
||||
);
|
||||
"MovePackage: entity {} doesn't have movement component",
|
||||
moving_entity.entity_id
|
||||
);
|
||||
continue;
|
||||
};
|
||||
|
||||
|
@ -110,24 +115,25 @@ pub fn on_move_package_push(player: &mut Player, push: MovePackagePush) {
|
|||
.extend(moving_entity.move_infos);
|
||||
}
|
||||
|
||||
let map = logic::utils::quadrant_util::get_map(player.basic_info.cur_map_id);
|
||||
let map = logic::utils::quadrant_util::get_map(ctx.player.basic_info.cur_map_id);
|
||||
let quadrant_id = map.get_quadrant_id(
|
||||
player.location.position.position.x * 100.0,
|
||||
player.location.position.position.y * 100.0,
|
||||
ctx.player.location.position.position.x * 100.0,
|
||||
ctx.player.location.position.position.y * 100.0,
|
||||
);
|
||||
|
||||
// TODO: This may require some changes for Co-Op
|
||||
if quadrant_id != player.quadrant_id {
|
||||
let (entities_to_remove, entities_to_add) = map.get_update_entities(player.quadrant_id, quadrant_id);
|
||||
player.quadrant_id = quadrant_id;
|
||||
logic::utils::world_util::remove_entities(player, &entities_to_remove);
|
||||
logic::utils::world_util::add_entities(player, &entities_to_add, false);
|
||||
if quadrant_id != ctx.player.quadrant_id {
|
||||
let (entities_to_remove, entities_to_add) =
|
||||
map.get_update_entities(ctx.player.quadrant_id, quadrant_id);
|
||||
ctx.player.quadrant_id = quadrant_id;
|
||||
logic::utils::world_util::remove_entities(ctx, &entities_to_remove);
|
||||
logic::utils::world_util::add_entities(ctx, &entities_to_add, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn on_entity_access_range_request(
|
||||
_: &Player,
|
||||
_: &NetContext,
|
||||
request: EntityAccessRangeRequest,
|
||||
response: &mut EntityAccessRangeResponse,
|
||||
) {
|
||||
|
@ -147,26 +153,40 @@ pub fn on_entity_access_range_request(
|
|||
}
|
||||
|
||||
pub fn on_entity_interact_request(
|
||||
player: &mut Player,
|
||||
ctx: &mut NetContext,
|
||||
request: EntityInteractRequest,
|
||||
response: &mut EntityInteractResponse,
|
||||
) {
|
||||
let config_id = get_config_id_from_entity_id(player, request.entity_id);
|
||||
tracing::debug!("EntityInteractRequest with ID: {} and ConfigID {}", request.entity_id, config_id);
|
||||
let config_id = get_config_id_from_entity_id(ctx, request.entity_id);
|
||||
tracing::debug!(
|
||||
"EntityInteractRequest with ID: {} and ConfigID {}",
|
||||
request.entity_id,
|
||||
config_id
|
||||
);
|
||||
|
||||
// TODO: add cases outside LevelEntityConfig if exist
|
||||
let Some(entity) = wicked_waifus_data::level_entity_config_data::get(player.basic_info.cur_map_id, config_id) else {
|
||||
let Some(entity) = wicked_waifus_data::level_entity_config_data::get(
|
||||
ctx.player.basic_info.cur_map_id,
|
||||
config_id,
|
||||
) else {
|
||||
response.error_code = ErrorCode::ErrEntityNotFound.into();
|
||||
return;
|
||||
};
|
||||
|
||||
let Some(template_config) = wicked_waifus_data::template_config_data::get(&entity.blueprint_type) else {
|
||||
let Some(template_config) =
|
||||
wicked_waifus_data::template_config_data::get(&entity.blueprint_type)
|
||||
else {
|
||||
response.error_code = ErrorCode::ErrEntityNotFound.into();
|
||||
return;
|
||||
};
|
||||
|
||||
let Some(interact_component) = entity.components_data.interact_component.as_ref()
|
||||
.or(template_config.components_data.interact_component.as_ref()).cloned() else {
|
||||
let Some(interact_component) = entity
|
||||
.components_data
|
||||
.interact_component
|
||||
.as_ref()
|
||||
.or(template_config.components_data.interact_component.as_ref())
|
||||
.cloned()
|
||||
else {
|
||||
response.error_code = ErrorCode::ErrInteractComponentNotExist.into();
|
||||
return;
|
||||
};
|
||||
|
@ -179,7 +199,7 @@ pub fn on_entity_interact_request(
|
|||
let mut check = true;
|
||||
if let Some(conditions) = option.condition {
|
||||
for element in conditions.conditions {
|
||||
check = check_condition(player, request.entity_id, &entity, template_config, element);
|
||||
check = check_condition(ctx, request.entity_id, entity, template_config, element);
|
||||
if !check {
|
||||
break;
|
||||
}
|
||||
|
@ -190,7 +210,13 @@ 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(
|
||||
ctx,
|
||||
request.entity_id,
|
||||
entity,
|
||||
template_config,
|
||||
action,
|
||||
);
|
||||
}
|
||||
}
|
||||
OptionType::Flow(_) => {
|
||||
|
@ -206,15 +232,16 @@ pub fn on_entity_interact_request(
|
|||
}
|
||||
|
||||
pub fn on_entity_follow_track_request(
|
||||
player: &Player,
|
||||
ctx: &mut NetContext,
|
||||
request: EntityFollowTrackRequest,
|
||||
response: &mut EntityFollowTrackResponse,
|
||||
) {
|
||||
let config_id = get_config_id_from_entity_id(player, request.entity_id);
|
||||
let config_id = get_config_id_from_entity_id(ctx, request.entity_id);
|
||||
let position = {
|
||||
let world_ref = player.world.borrow();
|
||||
let world = world_ref.get_world_entity();
|
||||
let position = query_components!(world, request.entity_id, Position).0.unwrap();
|
||||
let world = ctx.world.get_world_entity();
|
||||
let position = query_components!(world, request.entity_id, Position)
|
||||
.0
|
||||
.unwrap();
|
||||
position.0.clone()
|
||||
};
|
||||
tracing::debug!(
|
||||
|
@ -226,63 +253,19 @@ pub fn on_entity_follow_track_request(
|
|||
}
|
||||
|
||||
pub fn on_get_reward_treasure_box_request(
|
||||
player: &Player,
|
||||
ctx: &NetContext,
|
||||
request: GetRewardTreasureBoxRequest,
|
||||
_response: &mut GetRewardTreasureBoxResponse,
|
||||
) {
|
||||
let config_id = get_config_id_from_entity_id(player, request.entity_id);
|
||||
tracing::debug!("GetRewardTreasureBoxRequest with ID: {} and ConfigID {config_id}", request.entity_id);
|
||||
let config_id = get_config_id_from_entity_id(ctx, request.entity_id);
|
||||
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();
|
||||
fn get_config_id_from_entity_id(ctx: &NetContext, entity_id: i64) -> i64 {
|
||||
let world = ctx.world.get_world_entity();
|
||||
let entity_config = query_components!(world, entity_id, EntityConfig).0.unwrap();
|
||||
entity_config.config_id as i64
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use crate::logic::player::Player;
|
||||
use crate::logic::thread_mgr::NetContext;
|
||||
use wicked_waifus_protocol::{
|
||||
ErrorCode, FriendAllRequest, FriendAllResponse, FriendInfo, PlayerBasicInfoGetRequest,
|
||||
PlayerBasicInfoGetResponse, PlayerDetails,
|
||||
};
|
||||
|
||||
pub fn on_friend_all_request(
|
||||
_player: &Player,
|
||||
_ctx: &NetContext,
|
||||
_: FriendAllRequest,
|
||||
response: &mut FriendAllResponse,
|
||||
) {
|
||||
|
@ -23,7 +23,7 @@ pub fn on_friend_all_request(
|
|||
}
|
||||
|
||||
// pub fn on_friend_apply_send_request(
|
||||
// _player: &Player,
|
||||
// _ctx: &NetContext,
|
||||
// _request: FriendApplySendRequest,
|
||||
// _response: &mut FriendApplySendResponse,
|
||||
// ) {
|
||||
|
@ -31,7 +31,7 @@ pub fn on_friend_all_request(
|
|||
// }
|
||||
//
|
||||
// pub fn on_friend_recently_team_request(
|
||||
// _player: &Player,
|
||||
// _ctx: &NetContext,
|
||||
// _request: FriendRecentlyTeamRequest,
|
||||
// _response: &mut FriendRecentlyTeamResponse,
|
||||
// ) {
|
||||
|
@ -39,7 +39,7 @@ pub fn on_friend_all_request(
|
|||
// }
|
||||
|
||||
pub fn on_player_basic_info_get_request(
|
||||
_player: &Player,
|
||||
_ctx: &NetContext,
|
||||
request: PlayerBasicInfoGetRequest,
|
||||
response: &mut PlayerBasicInfoGetResponse,
|
||||
) {
|
||||
|
|
|
@ -2,31 +2,35 @@ use std::collections::HashMap;
|
|||
use std::sync::{Mutex, OnceLock};
|
||||
use std::time::UNIX_EPOCH;
|
||||
|
||||
use wicked_waifus_data::{gacha_pool_data, gacha_view_info_data, GachaPoolData, text_map_data};
|
||||
use wicked_waifus_data::GachaViewTypeInfoId::{BeginnersChoiceConvene, NoviceConvene};
|
||||
use wicked_waifus_protocol::{ErrorCode, GachaConsume, GachaInfo, GachaInfoRequest, GachaInfoResponse,
|
||||
GachaPoolInfo, GachaRequest, GachaResponse, GachaResult, GachaReward,
|
||||
GachaUsePoolRequest, GachaUsePoolResponse, WeaponItem};
|
||||
|
||||
use crate::logic::gacha::gacha_pool::GachaPool;
|
||||
use crate::logic::gacha::pool_info::PoolInfo;
|
||||
use crate::logic::gacha::service::GachaService;
|
||||
use crate::logic::player::Player;
|
||||
use crate::logic::thread_mgr::NetContext;
|
||||
use wicked_waifus_data::gacha_pool_data::GachaPoolData;
|
||||
use wicked_waifus_data::gacha_view_info_data::GachaViewTypeInfoId::{
|
||||
BeginnersChoiceConvene, NoviceConvene,
|
||||
};
|
||||
use wicked_waifus_data::{gacha_pool_data, gacha_view_info_data, text_map_data};
|
||||
use wicked_waifus_protocol::{
|
||||
ErrorCode, GachaConsume, GachaInfo, GachaInfoRequest, GachaInfoResponse, GachaPoolInfo,
|
||||
GachaRequest, GachaResponse, GachaResult, GachaReward, GachaUsePoolRequest,
|
||||
GachaUsePoolResponse, WeaponItem,
|
||||
};
|
||||
|
||||
static GACHA_SERVICE: OnceLock<Mutex<GachaService>> = OnceLock::new();
|
||||
|
||||
pub fn on_gacha_request(
|
||||
player: &mut Player,
|
||||
request: GachaRequest,
|
||||
response: &mut GachaResponse,
|
||||
) {
|
||||
let mut gacha_service = GACHA_SERVICE.get_or_init(|| Mutex::new(GachaService::new())).lock().unwrap();
|
||||
pub fn on_gacha_request(ctx: &mut NetContext, request: GachaRequest, response: &mut GachaResponse) {
|
||||
let mut gacha_service = GACHA_SERVICE
|
||||
.get_or_init(|| Mutex::new(GachaService::new()))
|
||||
.lock()
|
||||
.unwrap();
|
||||
|
||||
// TODO: ensure we have enough elements before pulling
|
||||
|
||||
match gacha_service.pull(player, request.gacha_id, request.gacha_times) {
|
||||
match gacha_service.pull(ctx.player, request.gacha_id, request.gacha_times) {
|
||||
Ok(results) => {
|
||||
match consume_tides(player, request.gacha_id, request.gacha_times) {
|
||||
match consume_tides(ctx.player, request.gacha_id, request.gacha_times) {
|
||||
Ok(_) => {
|
||||
let _summary = process_gacha_results(&results);
|
||||
//update_player_inventory(player, summary);
|
||||
|
@ -48,20 +52,22 @@ pub fn on_gacha_request(
|
|||
}
|
||||
|
||||
pub fn on_gacha_info_request(
|
||||
_player: &Player,
|
||||
_ctx: &NetContext,
|
||||
request: GachaInfoRequest,
|
||||
response: &mut GachaInfoResponse,
|
||||
) {
|
||||
tracing::debug!("received gacha request for language: {}", request.language);
|
||||
let text_map = text_map_data::get_textmap(request.language);
|
||||
|
||||
let gacha_service = GACHA_SERVICE.get_or_init(|| Mutex::new(GachaService::new())).lock().unwrap();
|
||||
let gacha_service = GACHA_SERVICE
|
||||
.get_or_init(|| Mutex::new(GachaService::new()))
|
||||
.lock()
|
||||
.unwrap();
|
||||
let active_pools = gacha_service.get_active_pools();
|
||||
|
||||
response.gacha_infos = active_pools.into_iter()
|
||||
.filter_map(|(pool_id, pool)| {
|
||||
create_gacha_info(pool_id, pool, text_map)
|
||||
})
|
||||
response.gacha_infos = active_pools
|
||||
.into_iter()
|
||||
.filter_map(|(pool_id, pool)| create_gacha_info(pool_id, pool, text_map))
|
||||
.collect();
|
||||
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
|
@ -73,7 +79,7 @@ pub fn on_gacha_info_request(
|
|||
}
|
||||
|
||||
pub fn on_gacha_use_pool_request(
|
||||
_player: &Player,
|
||||
_ctx: &NetContext,
|
||||
_request: GachaUsePoolRequest,
|
||||
response: &mut GachaUsePoolResponse,
|
||||
) {
|
||||
|
@ -81,9 +87,11 @@ pub fn on_gacha_use_pool_request(
|
|||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
||||
|
||||
fn create_gacha_info(pool_id: i32,
|
||||
pool: &GachaPool,
|
||||
textmap: &HashMap<String, String>) -> Option<GachaInfo> {
|
||||
fn create_gacha_info(
|
||||
pool_id: i32,
|
||||
pool: &GachaPool,
|
||||
textmap: &HashMap<String, String>,
|
||||
) -> Option<GachaInfo> {
|
||||
let pools: Vec<GachaPoolInfo> = gacha_pool_data::iter()
|
||||
.filter(|p| p.gacha_id == pool_id)
|
||||
.filter_map(|p| create_pool_info(p, &pool.info, textmap))
|
||||
|
@ -103,8 +111,15 @@ fn create_gacha_info(pool_id: i32,
|
|||
gacha_consumes,
|
||||
use_pool_id: pools[0].id,
|
||||
pools,
|
||||
begin_time: pool.info.start_time.duration_since(UNIX_EPOCH).unwrap().as_secs() as i64,
|
||||
end_time: pool.info.end_time.map_or(0, |end_time| end_time.duration_since(UNIX_EPOCH).unwrap().as_secs() as i64),
|
||||
begin_time: pool
|
||||
.info
|
||||
.start_time
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.unwrap()
|
||||
.as_secs() as i64,
|
||||
end_time: pool.info.end_time.map_or(0, |end_time| {
|
||||
end_time.duration_since(UNIX_EPOCH).unwrap().as_secs() as i64
|
||||
}),
|
||||
daily_limit_times: pool.info.daily_limit,
|
||||
total_limit_times: pool.info.total_limit,
|
||||
resources_id: pool.info.resources_id().to_string(),
|
||||
|
@ -121,29 +136,51 @@ fn create_pool_info(
|
|||
// TODO: debug textmap logic
|
||||
gacha_view_info_data::iter()
|
||||
.find(|view| view.id == pool.id)
|
||||
.map(|view| {
|
||||
GachaPoolInfo {
|
||||
id: pool.id,
|
||||
begin_time: pool_info.start_time.duration_since(UNIX_EPOCH).unwrap().as_secs() as i64,
|
||||
end_time: pool_info.end_time.map_or(0, |end_time| end_time.duration_since(UNIX_EPOCH).unwrap().as_secs() as i64),
|
||||
title: textmap.get(&view.summary_title).unwrap_or(&view.summary_title).to_string(),
|
||||
description: textmap.get(&view.summary_describe).unwrap_or(&view.summary_describe).to_string(),
|
||||
ui_type: view.r#type as i32,
|
||||
theme_color: view.theme_color.clone(),
|
||||
show_id_list: view.show_id_list.clone(),
|
||||
up_list: view.up_list.clone(),
|
||||
preview_id_list: view.preview_id_list.clone(),
|
||||
}
|
||||
.map(|view| GachaPoolInfo {
|
||||
id: pool.id,
|
||||
begin_time: pool_info
|
||||
.start_time
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.unwrap()
|
||||
.as_secs() as i64,
|
||||
end_time: pool_info.end_time.map_or(0, |end_time| {
|
||||
end_time.duration_since(UNIX_EPOCH).unwrap().as_secs() as i64
|
||||
}),
|
||||
title: textmap
|
||||
.get(&view.summary_title)
|
||||
.unwrap_or(&view.summary_title)
|
||||
.to_string(),
|
||||
description: textmap
|
||||
.get(&view.summary_describe)
|
||||
.unwrap_or(&view.summary_describe)
|
||||
.to_string(),
|
||||
ui_type: view.r#type as i32,
|
||||
theme_color: view.theme_color.clone(),
|
||||
show_id_list: view.show_id_list.clone(),
|
||||
up_list: view.up_list.clone(),
|
||||
preview_id_list: view.preview_id_list.clone(),
|
||||
})
|
||||
}
|
||||
|
||||
fn handle_gacha_consumes(pool_info: &PoolInfo) -> Vec<GachaConsume> {
|
||||
match (pool_info.pool_type, pool_info.pool_id) {
|
||||
(NoviceConvene, _) => vec![GachaConsume { times: 10, consume: 0 }], // 8
|
||||
(BeginnersChoiceConvene, 51..56) => vec![GachaConsume { times: 1, consume: 0 }], // 1,
|
||||
(NoviceConvene, _) => vec![GachaConsume {
|
||||
times: 10,
|
||||
consume: 0,
|
||||
}], // 8
|
||||
(BeginnersChoiceConvene, 51..56) => vec![GachaConsume {
|
||||
times: 1,
|
||||
consume: 0,
|
||||
}], // 1,
|
||||
(_, _) => vec![
|
||||
GachaConsume { times: 1, consume: 0 }, // 1
|
||||
GachaConsume { times: 10, consume: 0 }, // 10
|
||||
GachaConsume {
|
||||
times: 1,
|
||||
consume: 0,
|
||||
}, // 1
|
||||
GachaConsume {
|
||||
times: 10,
|
||||
consume: 0,
|
||||
}, // 10
|
||||
],
|
||||
}
|
||||
}
|
||||
|
@ -214,9 +251,9 @@ fn consume_tides(_player: &mut Player, pool_id: i32, pull_count: i32) -> Result<
|
|||
(50001, discounted_cost)
|
||||
}
|
||||
2 | 31..=35 | 41..=45 => (50001, pull_count), // Standard, permanent weapon, and beginner character -> Lustrous Tide
|
||||
100001..=100100 => (50002, pull_count), // Character -> Radiant Tide
|
||||
200001..=200100 => (50005, pull_count), // Weapon -> Forging Tide
|
||||
51..56 => (50006, pull_count), // Special -> Voucher of Reciprocal Tides
|
||||
100001..=100100 => (50002, pull_count), // Character -> Radiant Tide
|
||||
200001..=200100 => (50005, pull_count), // Weapon -> Forging Tide
|
||||
51..56 => (50006, pull_count), // Special -> Voucher of Reciprocal Tides
|
||||
_ => return Err(ErrorCode::ErrGachaPoolConfigNotFound),
|
||||
};
|
||||
|
||||
|
@ -228,4 +265,4 @@ fn consume_tides(_player: &mut Player, pool_id: i32, pull_count: i32) -> Result<
|
|||
//player.remove_item(currency_id, actual_cost);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,51 +1,54 @@
|
|||
use wicked_waifus_protocol::{ErrorCode, GuideFinishRequest, GuideFinishResponse, GuideInfoRequest, GuideInfoResponse, GuideTriggerRequest, GuideTriggerResponse};
|
||||
|
||||
use crate::logic::player::Player;
|
||||
use crate::logic::thread_mgr::NetContext;
|
||||
use wicked_waifus_protocol::{
|
||||
ErrorCode, GuideFinishRequest, GuideFinishResponse, GuideInfoRequest, GuideInfoResponse,
|
||||
GuideTriggerRequest, GuideTriggerResponse,
|
||||
};
|
||||
|
||||
pub fn on_guide_info_request(
|
||||
player: &Player,
|
||||
ctx: &NetContext,
|
||||
_: GuideInfoRequest,
|
||||
response: &mut GuideInfoResponse,
|
||||
) {
|
||||
response.guide_group_finish_list = player.guides.finished_guides.iter()
|
||||
.cloned()
|
||||
.collect();
|
||||
response.guide_group_finish_list = ctx.player.guides.finished_guides.iter().cloned().collect();
|
||||
}
|
||||
|
||||
pub fn on_guide_trigger_request(
|
||||
player: &mut Player,
|
||||
ctx: &mut NetContext,
|
||||
request: GuideTriggerRequest,
|
||||
response: &mut GuideTriggerResponse,
|
||||
) {
|
||||
response.error_code = check_if_guide_exists_and_is_repeatable(player, request.group_id);
|
||||
response.error_code = check_if_guide_exists_and_is_repeatable(ctx.player, request.group_id);
|
||||
if response.error_code == <ErrorCode as Into<i32>>::into(ErrorCode::Success) {
|
||||
// TODO: We need to check if guide can be repeated or not
|
||||
// if player.guides.started_guides.contains(&request.group_id) {
|
||||
// response.error_code = ErrorCode::GuideGroupDoing.into();
|
||||
// return;
|
||||
// }
|
||||
player.guides.started_guides.insert(request.group_id);
|
||||
ctx.player.guides.started_guides.insert(request.group_id);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn on_guide_finish_request(
|
||||
player: &mut Player,
|
||||
ctx: &mut NetContext,
|
||||
request: GuideFinishRequest,
|
||||
response: &mut GuideFinishResponse,
|
||||
) {
|
||||
response.error_code = check_if_guide_exists_and_is_repeatable(player, request.group_id);
|
||||
response.error_code = check_if_guide_exists_and_is_repeatable(ctx.player, request.group_id);
|
||||
if response.error_code == <ErrorCode as Into<i32>>::into(ErrorCode::Success) {
|
||||
if !player.guides.started_guides.contains(&request.group_id) {
|
||||
if !ctx.player.guides.started_guides.contains(&request.group_id) {
|
||||
response.error_code = ErrorCode::GuideGroupNoClient.into();
|
||||
return;
|
||||
}
|
||||
player.guides.started_guides.remove(&request.group_id);
|
||||
player.guides.finished_guides.insert(request.group_id);
|
||||
ctx.player.guides.started_guides.remove(&request.group_id);
|
||||
ctx.player.guides.finished_guides.insert(request.group_id);
|
||||
}
|
||||
}
|
||||
|
||||
fn check_if_guide_exists_and_is_repeatable(player: &Player, guide_id: i32) -> i32 {
|
||||
let Some(guide) = wicked_waifus_data::guide_group_data::iter().find(|guide| guide.id == guide_id) else {
|
||||
let Some(guide) =
|
||||
wicked_waifus_data::guide_group_data::iter().find(|guide| guide.id == guide_id)
|
||||
else {
|
||||
return ErrorCode::GuideGroupIdNoMatch.into();
|
||||
};
|
||||
// TODO: We need to check if guide can be repeated or not
|
||||
|
@ -53,4 +56,4 @@ fn check_if_guide_exists_and_is_repeatable(player: &Player, guide_id: i32) -> i3
|
|||
return ErrorCode::GuideGroupIsNotRepeat.into();
|
||||
}
|
||||
ErrorCode::Success.into()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,36 +1,48 @@
|
|||
use wicked_waifus_protocol::{ItemExchangeInfo, ItemExchangeInfoRequest, ItemExchangeInfoResponse, NormalItemRequest, NormalItemResponse, PhantomItemRequest, PhantomItemResponse, WeaponItemRequest, WeaponItemResponse};
|
||||
|
||||
use crate::logic::player::Player;
|
||||
use crate::logic::thread_mgr::NetContext;
|
||||
use wicked_waifus_protocol::{
|
||||
ItemExchangeInfo, ItemExchangeInfoRequest, ItemExchangeInfoResponse, NormalItemRequest,
|
||||
NormalItemResponse, PhantomItemRequest, PhantomItemResponse, WeaponItemRequest,
|
||||
WeaponItemResponse,
|
||||
};
|
||||
|
||||
pub fn on_normal_item_request(
|
||||
player: &mut Player,
|
||||
ctx: &NetContext,
|
||||
_: NormalItemRequest,
|
||||
response: &mut NormalItemResponse,
|
||||
) {
|
||||
tracing::debug!("Received NormalItemRequest, returning player inventory");
|
||||
response.normal_item_list = player.inventory.to_normal_item_list();
|
||||
response.normal_item_list = ctx.player.inventory.to_normal_item_list();
|
||||
}
|
||||
|
||||
pub fn on_weapon_item_request(
|
||||
_player: &mut Player,
|
||||
ctx: &NetContext,
|
||||
_: WeaponItemRequest,
|
||||
_response: &mut WeaponItemResponse,
|
||||
response: &mut WeaponItemResponse,
|
||||
) {
|
||||
// TODO: Implement this
|
||||
tracing::warn!("Unhandled WeaponItemRequest");
|
||||
response.weapon_item_list = ctx.player.inventory.to_weapon_item_list();
|
||||
}
|
||||
|
||||
pub fn on_phantom_item_request(
|
||||
_player: &mut Player,
|
||||
ctx: &mut NetContext,
|
||||
_: PhantomItemRequest,
|
||||
_response: &mut PhantomItemResponse,
|
||||
response: &mut PhantomItemResponse,
|
||||
) {
|
||||
// TODO: Implement this
|
||||
tracing::warn!("Unhandled PhantomItemRequest");
|
||||
let (items, equip_info, prop_info) = ctx.player.inventory.get_echoes_list();
|
||||
response.phantom_item_list = items;
|
||||
response.equip_info_list = equip_info;
|
||||
response.ows = prop_info;
|
||||
response.max_cost = 8; // TODO: Max cost from calabash
|
||||
response.phantom_skin_list = ctx
|
||||
.player
|
||||
.unlocked_skins
|
||||
.echo_skins
|
||||
.iter()
|
||||
.copied()
|
||||
.collect();
|
||||
}
|
||||
|
||||
pub fn on_item_exchange_info_request(
|
||||
_player: &mut Player,
|
||||
_ctx: &mut NetContext,
|
||||
_: ItemExchangeInfoRequest,
|
||||
response: &mut ItemExchangeInfoResponse,
|
||||
) {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use wicked_waifus_protocol::{LordGymInfoRequest, LordGymInfoResponse};
|
||||
|
||||
use crate::logic::player::Player;
|
||||
use crate::logic::thread_mgr::NetContext;
|
||||
|
||||
pub fn on_lord_gym_info_request(
|
||||
_player: &Player,
|
||||
_ctx: &NetContext,
|
||||
request: LordGymInfoRequest,
|
||||
_response: &mut LordGymInfoResponse,
|
||||
) {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use wicked_waifus_protocol::{MailBind, MailBindInfoRequest, MailBindInfoResponse};
|
||||
|
||||
use crate::logic::player::Player;
|
||||
use crate::logic::thread_mgr::NetContext;
|
||||
|
||||
pub fn on_mail_bind_info_request(
|
||||
_: &Player,
|
||||
_: &NetContext,
|
||||
_: MailBindInfoRequest,
|
||||
response: &mut MailBindInfoResponse,
|
||||
) {
|
||||
|
|
|
@ -6,10 +6,10 @@ use wicked_waifus_protocol::{
|
|||
PlayerAccessEffectAreaResponse,
|
||||
};
|
||||
|
||||
use crate::logic::player::Player;
|
||||
use crate::logic::thread_mgr::NetContext;
|
||||
|
||||
pub fn on_dark_coast_delivery_request(
|
||||
_player: &mut Player,
|
||||
_ctx: &mut NetContext,
|
||||
request: DarkCoastDeliveryRequest,
|
||||
response: &mut DarkCoastDeliveryResponse,
|
||||
) {
|
||||
|
@ -40,36 +40,36 @@ pub fn on_dark_coast_delivery_request(
|
|||
}
|
||||
|
||||
pub fn on_map_cancel_trace_request(
|
||||
player: &mut Player,
|
||||
ctx: &mut NetContext,
|
||||
request: MapCancelTraceRequest,
|
||||
response: &mut MapCancelTraceResponse,
|
||||
) {
|
||||
player.map_trace.traces.remove(&request.mark_id);
|
||||
ctx.player.map_trace.traces.remove(&request.mark_id);
|
||||
response.mark_id = request.mark_id;
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
||||
|
||||
pub fn on_map_trace_request(
|
||||
player: &mut Player,
|
||||
ctx: &mut NetContext,
|
||||
request: MapTraceRequest,
|
||||
response: &mut MapTraceResponse,
|
||||
) {
|
||||
player.map_trace.traces.insert(request.mark_id);
|
||||
ctx.player.map_trace.traces.insert(request.mark_id);
|
||||
response.mark_id = request.mark_id;
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
||||
|
||||
pub fn on_map_trace_info_request(
|
||||
player: &Player,
|
||||
ctx: &NetContext,
|
||||
_: MapTraceInfoRequest,
|
||||
response: &mut MapTraceInfoResponse,
|
||||
) {
|
||||
response.mark_id_list = player.map_trace.traces.iter().cloned().collect();
|
||||
response.mark_id_list = ctx.player.map_trace.traces.iter().cloned().collect();
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
||||
|
||||
pub fn on_map_unlock_field_info_request(
|
||||
_player: &mut Player,
|
||||
_ctx: &NetContext,
|
||||
_: MapUnlockFieldInfoRequest,
|
||||
response: &mut MapUnlockFieldInfoResponse,
|
||||
) {
|
||||
|
@ -81,7 +81,7 @@ pub fn on_map_unlock_field_info_request(
|
|||
}
|
||||
|
||||
pub fn on_player_access_effect_area_request(
|
||||
_player: &Player,
|
||||
_ctx: &NetContext,
|
||||
request: PlayerAccessEffectAreaRequest,
|
||||
response: &mut PlayerAccessEffectAreaResponse,
|
||||
) {
|
||||
|
|
|
@ -1,28 +1,32 @@
|
|||
use wicked_waifus_protocol::{ErrorCode, InputSettingRequest, InputSettingResponse, InputSettingUpdateRequest, InputSettingUpdateResponse, LanguageSettingUpdateRequest, LanguageSettingUpdateResponse, MonthCardRequest, MonthCardResponse, ServerPlayStationPlayOnlyStateRequest, ServerPlayStationPlayOnlyStateResponse, UpdateVoxelEnvRequest, UpdateVoxelEnvResponse, VersionInfoPush, WebSignRequest, WebSignResponse, Zih};
|
||||
use wicked_waifus_protocol::{
|
||||
ErrorCode, InputSettingRequest, InputSettingResponse, InputSettingUpdateRequest,
|
||||
InputSettingUpdateResponse, LanguageSettingUpdateRequest, LanguageSettingUpdateResponse,
|
||||
MonthCardRequest, MonthCardResponse, ServerPlayStationPlayOnlyStateRequest,
|
||||
ServerPlayStationPlayOnlyStateResponse, UpdateVoxelEnvRequest, UpdateVoxelEnvResponse,
|
||||
VersionInfoPush, WebSignRequest, WebSignResponse, Zih,
|
||||
};
|
||||
|
||||
use crate::logic::player::Player;
|
||||
use crate::logic::thread_mgr::NetContext;
|
||||
|
||||
pub fn on_month_card_request(
|
||||
player: &mut Player,
|
||||
ctx: &mut NetContext,
|
||||
_: MonthCardRequest,
|
||||
response: &mut MonthCardResponse,
|
||||
) {
|
||||
// TODO: Check if we should send MonthCardUseNotify
|
||||
response.days = player.month_card.days;
|
||||
response.is_daily_got = wicked_waifus_commons::time_util::unix_days() == player.month_card.last_received_day;
|
||||
response.days = ctx.player.month_card.days;
|
||||
response.is_daily_got =
|
||||
wicked_waifus_commons::time_util::unix_days() == ctx.player.month_card.last_received_day;
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
||||
|
||||
pub fn on_web_sign_request(
|
||||
_: &mut Player,
|
||||
_: WebSignRequest,
|
||||
response: &mut WebSignResponse,
|
||||
) {
|
||||
response.notice_sign = "Welcome to Wicked Waifus PS provided by Reversed Rooms Dev Team".to_string();
|
||||
pub fn on_web_sign_request(_: &mut NetContext, _: WebSignRequest, response: &mut WebSignResponse) {
|
||||
response.notice_sign =
|
||||
"Welcome to Wicked Waifus PS provided by Reversed Rooms Dev Team".to_string();
|
||||
}
|
||||
|
||||
pub fn on_input_setting_request(
|
||||
_: &Player,
|
||||
_: &NetContext,
|
||||
_: InputSettingRequest,
|
||||
response: &mut InputSettingResponse,
|
||||
) {
|
||||
|
@ -30,7 +34,7 @@ pub fn on_input_setting_request(
|
|||
}
|
||||
|
||||
pub fn on_input_setting_update_request(
|
||||
_: &Player,
|
||||
_: &NetContext,
|
||||
_: InputSettingUpdateRequest,
|
||||
response: &mut InputSettingUpdateResponse,
|
||||
) {
|
||||
|
@ -38,7 +42,7 @@ pub fn on_input_setting_update_request(
|
|||
}
|
||||
|
||||
pub fn on_language_setting_update_request(
|
||||
_: &Player,
|
||||
_: &NetContext,
|
||||
_: LanguageSettingUpdateRequest,
|
||||
response: &mut LanguageSettingUpdateResponse,
|
||||
) {
|
||||
|
@ -46,14 +50,14 @@ pub fn on_language_setting_update_request(
|
|||
}
|
||||
|
||||
pub fn on_server_play_station_play_only_state_request(
|
||||
_: &Player,
|
||||
_: &NetContext,
|
||||
_: ServerPlayStationPlayOnlyStateRequest,
|
||||
response: &mut ServerPlayStationPlayOnlyStateResponse,
|
||||
) {
|
||||
response.cross_play_enabled = false;
|
||||
}
|
||||
|
||||
pub fn on_version_info_push(_player: &Player, push: VersionInfoPush) {
|
||||
pub fn on_version_info_push(_player: &NetContext, push: VersionInfoPush) {
|
||||
// TODO: Shall we do safety check and ensure we have compatible versions?
|
||||
tracing::debug!(
|
||||
"Client versions: launcher: {}, app: {}, resources: {}",
|
||||
|
@ -64,7 +68,7 @@ pub fn on_version_info_push(_player: &Player, push: VersionInfoPush) {
|
|||
}
|
||||
|
||||
pub fn on_update_voxel_env_request(
|
||||
_: &Player,
|
||||
_: &NetContext,
|
||||
request: UpdateVoxelEnvRequest,
|
||||
response: &mut UpdateVoxelEnvResponse,
|
||||
) {
|
||||
|
|
|
@ -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,10 +41,11 @@ mod scene;
|
|||
mod skill;
|
||||
mod teleport;
|
||||
mod tutorial;
|
||||
mod weapon;
|
||||
|
||||
macro_rules! handle_request {
|
||||
($($name:ident $(, $inner_package:ident)?;)*) => {
|
||||
fn handle_request(player: &mut super::player::Player, mut msg: Message) {
|
||||
fn handle_request(ctx: &mut super::thread_mgr::NetContext, mut msg: Message) {
|
||||
use ::wicked_waifus_protocol::{MessageID, Protobuf};
|
||||
|
||||
::paste::paste! {
|
||||
|
@ -55,16 +53,16 @@ macro_rules! handle_request {
|
|||
$(
|
||||
::wicked_waifus_protocol::$($inner_package::)?[<$name Request>]::MESSAGE_ID => {
|
||||
let Ok(request) = ::wicked_waifus_protocol::$($inner_package::)?[<$name Request>]::decode(&*msg.remove_payload()) else {
|
||||
tracing::debug!("failed to decode {}, player_id: {}", stringify!($($inner_package::)?[<$name Request>]), player.basic_info.id);
|
||||
tracing::debug!("failed to decode {}, player_id: {}", stringify!($($inner_package::)?[<$name Request>]), ctx.player.basic_info.id);
|
||||
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);
|
||||
[<on_ $($inner_package:snake _)? $name:snake _request>](ctx, request, &mut response);
|
||||
|
||||
player.respond(response, msg.get_rpc_id());
|
||||
ctx.player.respond(response, msg.get_rpc_id());
|
||||
},
|
||||
)*
|
||||
unhandled => {
|
||||
|
@ -83,7 +81,7 @@ macro_rules! handle_request {
|
|||
|
||||
macro_rules! handle_push {
|
||||
($($name:ident $(, $inner_package:ident)?;)*) => {
|
||||
fn handle_push(player: &mut super::player::Player, mut msg: Message) {
|
||||
fn handle_push(ctx: &mut super::thread_mgr::NetContext, mut msg: Message) {
|
||||
use ::wicked_waifus_protocol::{MessageID, Protobuf};
|
||||
|
||||
::paste::paste! {
|
||||
|
@ -91,13 +89,13 @@ macro_rules! handle_push {
|
|||
$(
|
||||
::wicked_waifus_protocol::$($inner_package::)?[<$name Push>]::MESSAGE_ID => {
|
||||
let Ok(push) = ::wicked_waifus_protocol::$($inner_package::)?[<$name Push>]::decode(&*msg.remove_payload()) else {
|
||||
tracing::debug!("failed to decode {}, player_id: {}", stringify!($($inner_package::)?[<$name Push>]), player.basic_info.id);
|
||||
tracing::debug!("failed to decode {}, player_id: {}", stringify!($($inner_package::)?[<$name Push>]), ctx.player.basic_info.id);
|
||||
return;
|
||||
};
|
||||
|
||||
tracing::debug!("logic: processing push {}", stringify!($($inner_package::)?[<$name Push>]));
|
||||
|
||||
[<on_ $($inner_package:snake _)? $name:snake _push>](player, push);
|
||||
[<on_ $($inner_package:snake _)? $name:snake _push>](ctx, push);
|
||||
},
|
||||
)*
|
||||
unhandled => {
|
||||
|
@ -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,219 +293,19 @@ 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) {
|
||||
pub fn handle_logic_message(ctx: &mut super::thread_mgr::NetContext, msg: Message) {
|
||||
match msg {
|
||||
Message::Request { .. } => handle_request(player, msg),
|
||||
Message::Push { .. } => handle_push(player, msg),
|
||||
Message::Request { .. } => handle_request(ctx, msg),
|
||||
Message::Push { .. } => handle_push(ctx, msg),
|
||||
_ => tracing::warn!(
|
||||
"handle_logic_message: wrong message type: {}, message_id: {}, player_id: {}",
|
||||
msg.get_message_type(),
|
||||
msg.get_message_id(),
|
||||
player.basic_info.id,
|
||||
ctx.player.basic_info.id,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
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,29 +1,36 @@
|
|||
use std::collections::HashSet;
|
||||
|
||||
use crate::logic::components::{ParaglidingSkin, RoleSkin, SoarWingSkin, WeaponSkin};
|
||||
use crate::logic::ecs::component::ComponentContainer;
|
||||
use crate::logic::player::ItemUsage;
|
||||
use crate::logic::role::{Role, RoleFormation};
|
||||
use crate::logic::thread_mgr::NetContext;
|
||||
use crate::modify_component;
|
||||
use wicked_waifus_protocol::{
|
||||
ClientCurrentRoleReportRequest, ClientCurrentRoleReportResponse, ERemoveEntityType, ErrorCode,
|
||||
FormationAttrRequest, FormationAttrResponse, PlayerMotionRequest, PlayerMotionResponse,
|
||||
RoleFavorListRequest, RoleFavorListResponse, RoleShowListUpdateRequest,
|
||||
RoleShowListUpdateResponse, UpdateFormationRequest, UpdateFormationResponse,
|
||||
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,
|
||||
};
|
||||
|
||||
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::ecs::component::ComponentContainer;
|
||||
|
||||
pub fn on_role_show_list_update_request(
|
||||
player: &mut Player,
|
||||
ctx: &mut NetContext,
|
||||
request: RoleShowListUpdateRequest,
|
||||
response: &mut RoleShowListUpdateResponse,
|
||||
) {
|
||||
let role_ids: HashSet<i32> = player.role_list.keys().cloned().collect();
|
||||
let role_ids: HashSet<i32> = ctx.player.role_list.keys().cloned().collect();
|
||||
let all_exist = request.role_list.iter().all(|id| role_ids.contains(id));
|
||||
|
||||
if all_exist {
|
||||
player.basic_info.role_show_list = request.role_list;
|
||||
ctx.player.basic_info.role_show_list = request.role_list;
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
} else {
|
||||
response.error_code = ErrorCode::InvalidRequest.into(); // TODO: replace with appropriate error code
|
||||
|
@ -31,7 +38,7 @@ pub fn on_role_show_list_update_request(
|
|||
}
|
||||
|
||||
pub fn on_client_current_role_report_request(
|
||||
_player: &Player,
|
||||
_ctx: &NetContext,
|
||||
request: ClientCurrentRoleReportRequest,
|
||||
response: &mut ClientCurrentRoleReportResponse,
|
||||
) {
|
||||
|
@ -40,7 +47,7 @@ pub fn on_client_current_role_report_request(
|
|||
}
|
||||
|
||||
pub fn on_role_favor_list_request(
|
||||
_player: &Player,
|
||||
_ctx: &NetContext,
|
||||
_request: RoleFavorListRequest,
|
||||
response: &mut RoleFavorListResponse,
|
||||
) {
|
||||
|
@ -48,21 +55,89 @@ pub fn on_role_favor_list_request(
|
|||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
||||
|
||||
pub fn on_formation_attr_request(
|
||||
_ctx: &NetContext,
|
||||
_request: FormationAttrRequest,
|
||||
response: &mut FormationAttrResponse,
|
||||
) {
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
||||
|
||||
pub fn on_update_formation_request(
|
||||
player: &mut Player,
|
||||
ctx: &mut NetContext,
|
||||
request: UpdateFormationRequest,
|
||||
response: &mut UpdateFormationResponse,
|
||||
) {
|
||||
let mut world_ref = player.world.borrow_mut();
|
||||
let world = world_ref.get_mut_world_entity();
|
||||
let world = ctx.world.get_mut_world_entity();
|
||||
|
||||
for formation in request.formations {
|
||||
let formation_id = formation.formation_id;
|
||||
let cur_role = formation.cur_role;
|
||||
let is_current = formation.is_current;
|
||||
|
||||
if is_current {
|
||||
// update player current formation id
|
||||
ctx.player.cur_formation_id = formation_id;
|
||||
|
||||
// search old formation id and set real_formation_id, set is_current to false
|
||||
let mut real_formation_id = formation_id;
|
||||
if let Some(rf) = ctx
|
||||
.player
|
||||
.formation_list
|
||||
.values_mut()
|
||||
.find(|rf| rf.is_current && rf.id != formation_id)
|
||||
{
|
||||
real_formation_id = rf.id;
|
||||
rf.is_current = false;
|
||||
}
|
||||
|
||||
if let Some(old_formation) = ctx.player.formation_list.get(&real_formation_id) {
|
||||
let removed_entities: Vec<i64> = old_formation
|
||||
.role_ids
|
||||
.iter()
|
||||
.map(|&role_id| world.get_entity_id(role_id))
|
||||
.collect();
|
||||
removed_entities.iter().for_each(|&entity_id| {
|
||||
world.remove_entity(entity_id as i32);
|
||||
});
|
||||
ctx.player
|
||||
.notify(ctx.player.build_player_entity_remove_notify(
|
||||
removed_entities,
|
||||
ERemoveEntityType::RemoveTypeNormal,
|
||||
));
|
||||
}
|
||||
|
||||
let added_roles: Vec<&Role> = formation
|
||||
.role_ids
|
||||
.iter()
|
||||
.map(|role_id| ctx.player.role_list.get(role_id).unwrap())
|
||||
.collect();
|
||||
|
||||
if !added_roles.is_empty() {
|
||||
// add new roles
|
||||
ctx.player.notify(
|
||||
ctx.player
|
||||
.build_player_entity_add_notify(added_roles, world),
|
||||
);
|
||||
}
|
||||
|
||||
// send update group formation notify
|
||||
ctx.player
|
||||
.notify(ctx.player.build_update_group_formation_notify(
|
||||
RoleFormation {
|
||||
id: formation_id,
|
||||
cur_role,
|
||||
role_ids: formation.role_ids.clone(),
|
||||
is_current,
|
||||
},
|
||||
world,
|
||||
));
|
||||
|
||||
response.formation = Some(formation.clone());
|
||||
}
|
||||
|
||||
// update all formation and check formation_list
|
||||
player
|
||||
ctx.player
|
||||
.formation_list
|
||||
.entry(formation_id)
|
||||
.and_modify(|r| {
|
||||
|
@ -73,69 +148,19 @@ pub fn on_update_formation_request(
|
|||
.or_insert(RoleFormation {
|
||||
id: formation_id,
|
||||
cur_role: formation.cur_role,
|
||||
role_ids: formation.role_ids.clone(),
|
||||
role_ids: formation.role_ids,
|
||||
is_current,
|
||||
});
|
||||
|
||||
if is_current {
|
||||
// update player current formation id
|
||||
player.cur_formation_id = formation_id;
|
||||
|
||||
// search old formation id and set real_formation_id, set is_current to false
|
||||
let mut real_formation_id = formation_id;
|
||||
if let Some(rf) = player
|
||||
.formation_list
|
||||
.values_mut()
|
||||
.find(|rf| rf.is_current && rf.id != formation_id)
|
||||
{
|
||||
real_formation_id = rf.id;
|
||||
rf.is_current = false;
|
||||
}
|
||||
|
||||
if let Some(old_formation) = player.formation_list.get(&real_formation_id) {
|
||||
let mut 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,
|
||||
));
|
||||
}
|
||||
|
||||
player.build_player_entity_add_notify(world);
|
||||
|
||||
// send update group formation notify
|
||||
player.notify(player.build_update_group_formation_notify(
|
||||
RoleFormation {
|
||||
id: formation_id,
|
||||
cur_role,
|
||||
role_ids: formation.role_ids.clone(),
|
||||
is_current,
|
||||
},
|
||||
world,
|
||||
));
|
||||
|
||||
response.formation = Some(formation.clone());
|
||||
}
|
||||
}
|
||||
|
||||
player.notify(player.build_update_formation_notify());
|
||||
ctx.player
|
||||
.notify(ctx.player.build_update_formation_notify());
|
||||
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
||||
|
||||
pub fn on_player_motion_request(
|
||||
_: &Player,
|
||||
_: &NetContext,
|
||||
request: PlayerMotionRequest,
|
||||
response: &mut PlayerMotionResponse,
|
||||
) {
|
||||
|
@ -144,3 +169,417 @@ pub fn on_player_motion_request(
|
|||
Some(_) => response.error_id = ErrorCode::Success.into(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn on_unlock_role_skin_list_request(
|
||||
ctx: &NetContext,
|
||||
_request: UnlockRoleSkinListRequest,
|
||||
response: &mut UnlockRoleSkinListResponse,
|
||||
) {
|
||||
response.role_skin_list = ctx.player.unlocked_skins.role_skins.iter().cloned().collect();
|
||||
}
|
||||
|
||||
pub fn on_role_skin_change_request(
|
||||
ctx: &mut NetContext,
|
||||
request: RoleSkinChangeRequest,
|
||||
response: &mut RoleSkinChangeResponse,
|
||||
) {
|
||||
// TODO: Should we verify role id first against bindata?
|
||||
let role = ctx.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 !ctx.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 = ctx.world.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
|
||||
ctx.player.notify(EntityEquipSkinChangeNotify {
|
||||
entity_id,
|
||||
weapon_skin_component_pb: Some(WeaponSkinComponentPb {
|
||||
weapon_skin_id: skin_data.suit_weapon_skin_id,
|
||||
}),
|
||||
});
|
||||
}
|
||||
ctx.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));
|
||||
|
||||
ctx.player.notify(EntityAddNotify {
|
||||
entity_pbs: vec![pb],
|
||||
remove_tag_ids: false,
|
||||
});
|
||||
// player.notify(player.build_update_group_formation_notify(aaa, world));
|
||||
ctx.player
|
||||
.notify(ctx.player.build_update_formation_notify());
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
||||
|
||||
pub fn on_fly_skin_wear_request(
|
||||
ctx: &mut NetContext,
|
||||
request: FlySkinWearRequest,
|
||||
response: &mut FlySkinWearResponse,
|
||||
) {
|
||||
let role = ctx.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 !ctx.player.unlocked_skins.fly_skins.contains(&skin.id) {
|
||||
response.error_code = ErrorCode::ErrRoleSkinLocked.into();
|
||||
return;
|
||||
}
|
||||
role.fly_skin_id = request.skin_id
|
||||
}
|
||||
1 => {
|
||||
if !ctx.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 = ctx.world.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"),
|
||||
}
|
||||
ctx.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,
|
||||
}],
|
||||
}],
|
||||
});
|
||||
|
||||
ctx.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(
|
||||
ctx: &mut NetContext,
|
||||
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 !ctx.player.unlocked_skins.fly_skins.contains(&skin.id) {
|
||||
response.error_code = ErrorCode::ErrRoleSkinLocked.into();
|
||||
return;
|
||||
}
|
||||
for role in ctx.player.role_list.values_mut() {
|
||||
role.fly_skin_id = request.skin_id;
|
||||
}
|
||||
}
|
||||
1 => {
|
||||
if !ctx.player.unlocked_skins.wing_skins.contains(&skin.id) {
|
||||
response.error_code = ErrorCode::ErrRoleSkinLocked.into();
|
||||
return;
|
||||
}
|
||||
for role in ctx.player.role_list.values_mut() {
|
||||
role.wing_skin_id = request.skin_id;
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
response.error_code = ErrorCode::FlySkinTypeErr.into();
|
||||
return;
|
||||
}
|
||||
}
|
||||
ctx.player.notify(RoleFlyEquipChangeNotify {
|
||||
fly_skin_data: ctx
|
||||
.player
|
||||
.role_list
|
||||
.values()
|
||||
.map(|r| EquipFlySkinData {
|
||||
role_id: r.role_id,
|
||||
skin_id: request.skin_id,
|
||||
})
|
||||
.collect::<Vec<_>>(),
|
||||
});
|
||||
let world = ctx.world.get_world_entity();
|
||||
let data = ctx
|
||||
.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<_>>();
|
||||
ctx.player.notify(SoarWingOrParaglidingSkinChangeNotify {
|
||||
fly_skin_data: data,
|
||||
});
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
||||
|
||||
pub fn on_role_level_up_view_request(
|
||||
ctx: &mut NetContext,
|
||||
request: RoleLevelUpViewRequest,
|
||||
response: &mut RoleLevelUpViewResponse,
|
||||
) {
|
||||
let role = ctx.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 = ctx.player.inventory.to_array_int_int_filtered(&items);
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
||||
|
||||
pub fn on_pb_up_level_role_request(
|
||||
ctx: &mut NetContext,
|
||||
request: PbUpLevelRoleRequest,
|
||||
response: &mut PbUpLevelRoleResponse,
|
||||
) {
|
||||
response.role_id = request.role_id;
|
||||
let role = ctx.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 = ctx.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(
|
||||
ctx: &mut NetContext,
|
||||
request: RoleBreakThroughViewRequest,
|
||||
response: &mut RoleBreakThroughViewResponse,
|
||||
) {
|
||||
let role = ctx.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,15 +1,19 @@
|
|||
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");
|
||||
|
||||
use crate::logic::player::Player;
|
||||
use crate::logic::thread_mgr::NetContext;
|
||||
|
||||
pub fn on_scene_trace_request(
|
||||
_player: &Player,
|
||||
_ctx: &NetContext,
|
||||
request: SceneTraceRequest,
|
||||
_: &mut SceneTraceResponse,
|
||||
) {
|
||||
|
@ -17,22 +21,22 @@ pub fn on_scene_trace_request(
|
|||
}
|
||||
|
||||
pub fn on_scene_loading_finish_request(
|
||||
player: &Player,
|
||||
ctx: &NetContext,
|
||||
_request: SceneLoadingFinishRequest,
|
||||
response: &mut SceneLoadingFinishResponse,
|
||||
) {
|
||||
player.notify(JsPatchNotify {
|
||||
ctx.player.notify(JsPatchNotify {
|
||||
content: WATER_MASK.to_string(),
|
||||
});
|
||||
player.notify(JsPatchNotify {
|
||||
ctx.player.notify(JsPatchNotify {
|
||||
content: UID_FIX
|
||||
.replace("{PLAYER_USERNAME}", &player.basic_info.name)
|
||||
.replace("{PLAYER_USERNAME}", &ctx.player.basic_info.name)
|
||||
.replace("{SELECTED_COLOR}", "50FC71"),
|
||||
});
|
||||
player.notify(JsPatchNotify {
|
||||
ctx.player.notify(JsPatchNotify {
|
||||
content: CENSORSHIP_FIX.to_string(),
|
||||
});
|
||||
player.notify(JsPatchNotify {
|
||||
ctx.player.notify(JsPatchNotify {
|
||||
content: DEBUG_DISABLE.to_string(),
|
||||
});
|
||||
|
||||
|
@ -41,7 +45,7 @@ pub fn on_scene_loading_finish_request(
|
|||
}
|
||||
|
||||
pub fn on_update_scene_date_request(
|
||||
_player: &Player,
|
||||
_ctx: &NetContext,
|
||||
_request: UpdateSceneDateRequest,
|
||||
response: &mut UpdateSceneDateResponse,
|
||||
) {
|
||||
|
@ -50,7 +54,7 @@ pub fn on_update_scene_date_request(
|
|||
}
|
||||
|
||||
pub fn on_access_path_time_server_config_request(
|
||||
_player: &Player,
|
||||
_ctx: &NetContext,
|
||||
_request: AccessPathTimeServerConfigRequest,
|
||||
response: &mut AccessPathTimeServerConfigResponse,
|
||||
) {
|
||||
|
@ -59,21 +63,10 @@ pub fn on_access_path_time_server_config_request(
|
|||
}
|
||||
|
||||
pub fn on_player_head_data_request(
|
||||
_player: &Player,
|
||||
_ctx: &NetContext,
|
||||
_request: PlayerHeadDataRequest,
|
||||
response: &mut PlayerHeadDataResponse,
|
||||
) {
|
||||
// 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<_>>();
|
||||
}
|
|
@ -1,23 +1,26 @@
|
|||
use crate::logic::ecs::component::ComponentContainer;
|
||||
use wicked_waifus_protocol::{ErrorCode, ExploreSkillRouletteSetRequest, ExploreSkillRouletteSetResponse, VisionExploreSkillSetRequest, VisionExploreSkillSetResponse, VisionSkillChangeNotify, VisionSkillInformation};
|
||||
use wicked_waifus_protocol::{
|
||||
ErrorCode, ExploreSkillRouletteSetRequest, ExploreSkillRouletteSetResponse,
|
||||
VisionExploreSkillSetRequest, VisionExploreSkillSetResponse, VisionSkillChangeNotify,
|
||||
VisionSkillInformation,
|
||||
};
|
||||
|
||||
use crate::{logic::player::Player, query_with};
|
||||
use crate::logic::thread_mgr::NetContext;
|
||||
use crate::query_with;
|
||||
|
||||
pub fn on_vision_explore_skill_set_request(
|
||||
player: &mut Player,
|
||||
ctx: &mut NetContext,
|
||||
request: VisionExploreSkillSetRequest,
|
||||
response: &mut VisionExploreSkillSetResponse,
|
||||
) {
|
||||
player.explore_tools.active_explore_skill = request.skill_id;
|
||||
ctx.player.explore_tools.active_explore_skill = request.skill_id;
|
||||
|
||||
for (entity, owner, mut vision_skill) in query_with!(
|
||||
player.world.borrow().get_world_entity(),
|
||||
OwnerPlayer,
|
||||
VisionSkill
|
||||
) {
|
||||
if owner.0 == player.basic_info.id {
|
||||
for (entity, owner, mut vision_skill) in
|
||||
query_with!(ctx.world.get_world_entity(), OwnerPlayer, VisionSkill)
|
||||
{
|
||||
if owner.0 == ctx.player.basic_info.id {
|
||||
vision_skill.skill_id = request.skill_id;
|
||||
player.notify(VisionSkillChangeNotify {
|
||||
ctx.player.notify(VisionSkillChangeNotify {
|
||||
entity_id: entity.into(),
|
||||
vision_skill_infos: vec![VisionSkillInformation {
|
||||
skill_id: request.skill_id,
|
||||
|
@ -32,25 +35,34 @@ pub fn on_vision_explore_skill_set_request(
|
|||
}
|
||||
|
||||
pub fn on_explore_skill_roulette_set_request(
|
||||
player: &mut Player,
|
||||
ctx: &mut NetContext,
|
||||
request: ExploreSkillRouletteSetRequest,
|
||||
response: &mut ExploreSkillRouletteSetResponse,
|
||||
) {
|
||||
let mut illegal_skill = false;
|
||||
for skill_roulette in &request.skill_roulettes {
|
||||
for skill_id in &skill_roulette.skill_ids {
|
||||
if *skill_id != 0 && !player.explore_tools.unlocked_explore_skills.contains(skill_id) {
|
||||
if *skill_id != 0
|
||||
&& !ctx
|
||||
.player
|
||||
.explore_tools
|
||||
.unlocked_explore_skills
|
||||
.contains(skill_id)
|
||||
{
|
||||
illegal_skill = true;
|
||||
break
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
match illegal_skill {
|
||||
true => response.error_code = ErrorCode::ErrRouletteFuncIdInvaild.into(),
|
||||
false => {
|
||||
player.explore_tools.roulette = request.skill_roulettes.get(0).unwrap().skill_ids.iter()
|
||||
.map(|&skill_id| skill_id)
|
||||
.collect::<Vec<i32>>()
|
||||
ctx.player.explore_tools.roulette = request
|
||||
.skill_roulettes
|
||||
.first()
|
||||
.unwrap()
|
||||
.skill_ids
|
||||
.to_vec()
|
||||
.as_slice()
|
||||
.try_into()
|
||||
.unwrap();
|
||||
|
@ -58,4 +70,4 @@ pub fn on_explore_skill_roulette_set_request(
|
|||
response.skill_roulettes = request.skill_roulettes;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,37 +1,51 @@
|
|||
use wicked_waifus_protocol::{ErrorCode, JoinSceneNotify, LeaveSceneNotify, TeleportDataRequest, TeleportDataResponse, TeleportFinishRequest, TeleportFinishResponse, TeleportNotify, TeleportReason, TeleportTransferRequest, TeleportTransferResponse, TransitionOptionPb};
|
||||
use wicked_waifus_protocol::{
|
||||
ErrorCode, JoinSceneNotify, LeaveSceneNotify, TeleportDataRequest, TeleportDataResponse,
|
||||
TeleportFinishRequest, TeleportFinishResponse, TeleportNotify, TeleportReason,
|
||||
TeleportTransferRequest, TeleportTransferResponse, TransitionOptionPb,
|
||||
};
|
||||
|
||||
use wicked_waifus_data::{level_entity_config_data, RawVectorData};
|
||||
use wicked_waifus_data::pb_components::teleport::TeleportComponent;
|
||||
use wicked_waifus_data::{level_entity_config_data, RawVectorData};
|
||||
|
||||
use crate::logic::math::Vector3f;
|
||||
use crate::logic::player::Player;
|
||||
use crate::logic::thread_mgr::NetContext;
|
||||
use crate::logic::utils::world_util;
|
||||
|
||||
pub fn on_teleport_data_request(
|
||||
player: &mut Player,
|
||||
ctx: &NetContext,
|
||||
_: TeleportDataRequest,
|
||||
response: &mut TeleportDataResponse,
|
||||
) {
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
response.ids = player.teleports.teleports_data.iter()
|
||||
response.ids = ctx
|
||||
.player
|
||||
.teleports
|
||||
.teleports_data
|
||||
.iter()
|
||||
.map(|teleport| teleport.id)
|
||||
.collect::<Vec<_>>();
|
||||
}
|
||||
|
||||
pub fn on_teleport_transfer_request(
|
||||
player: &mut Player,
|
||||
ctx: &mut NetContext,
|
||||
request: TeleportTransferRequest,
|
||||
response: &mut TeleportTransferResponse,
|
||||
) {
|
||||
tracing::debug!("received transfer request for teleport id: {}", request.id);
|
||||
let Some(teleport) = wicked_waifus_data::teleporter_data::iter()
|
||||
.find(|teleporter| request.id == teleporter.id) else {
|
||||
let Some(teleport) =
|
||||
wicked_waifus_data::teleporter_data::iter().find(|teleporter| request.id == teleporter.id)
|
||||
else {
|
||||
response.error_code = ErrorCode::ErrTeleportIdNotExist.into();
|
||||
return;
|
||||
};
|
||||
|
||||
println!("received transfer request for teleport entity id: {}", &teleport.teleport_entity_config_id);
|
||||
let Some(tp) = level_entity_config_data::get(teleport.map_id, teleport.teleport_entity_config_id) else {
|
||||
println!(
|
||||
"received transfer request for teleport entity id: {}",
|
||||
&teleport.teleport_entity_config_id
|
||||
);
|
||||
let Some(tp) =
|
||||
level_entity_config_data::get(teleport.map_id, teleport.teleport_entity_config_id)
|
||||
else {
|
||||
response.error_code = ErrorCode::ErrTeleportEntityNotExist.into();
|
||||
return;
|
||||
};
|
||||
|
@ -41,8 +55,7 @@ pub fn on_teleport_transfer_request(
|
|||
return;
|
||||
};
|
||||
|
||||
if teleport_component.disabled.unwrap_or(false) ||
|
||||
teleport_component.teleporter_id.is_none() {
|
||||
if teleport_component.disabled.unwrap_or(false) || teleport_component.teleporter_id.is_none() {
|
||||
response.error_code = ErrorCode::ErrTeleportGmGetCreatureGenCfgFailed.into();
|
||||
}
|
||||
if teleport_component.teleporter_id.unwrap() != request.id {
|
||||
|
@ -58,8 +71,8 @@ pub fn on_teleport_transfer_request(
|
|||
response.yaw = 0f32;
|
||||
response.roll = 0f32;
|
||||
|
||||
if player.basic_info.cur_map_id == teleport.map_id {
|
||||
player.notify(TeleportNotify {
|
||||
if ctx.player.basic_info.cur_map_id == teleport.map_id {
|
||||
ctx.player.notify(TeleportNotify {
|
||||
map_id: teleport.map_id,
|
||||
pos: Some(teleport_position.to_protobuf()),
|
||||
rot: None,
|
||||
|
@ -71,14 +84,14 @@ pub fn on_teleport_transfer_request(
|
|||
});
|
||||
} else {
|
||||
// remove entity
|
||||
player.notify(LeaveSceneNotify {
|
||||
player_id: player.basic_info.id,
|
||||
ctx.player.notify(LeaveSceneNotify {
|
||||
player_id: ctx.player.basic_info.id,
|
||||
scene_id: "".to_string(),
|
||||
transition_option: Some(TransitionOptionPb::default()),
|
||||
});
|
||||
let scene_info = world_util::build_scene_information(&player);
|
||||
let scene_info = world_util::build_scene_information(ctx);
|
||||
// TODO: Trigger initial join world flow??
|
||||
player.notify(JoinSceneNotify {
|
||||
ctx.player.notify(JoinSceneNotify {
|
||||
scene_info: Some(scene_info),
|
||||
max_entity_id: i64::MAX,
|
||||
transition_option: Some(TransitionOptionPb::default()),
|
||||
|
@ -88,7 +101,7 @@ pub fn on_teleport_transfer_request(
|
|||
}
|
||||
|
||||
pub fn on_teleport_finish_request(
|
||||
_player: &mut Player,
|
||||
_ctx: &mut NetContext,
|
||||
_: TeleportFinishRequest,
|
||||
response: &mut TeleportFinishResponse,
|
||||
) {
|
||||
|
@ -103,4 +116,4 @@ fn get_teleport_position(transform: &[RawVectorData], component: &TeleportCompon
|
|||
entity_position.add_teleport_position(teleport_position);
|
||||
}
|
||||
entity_position
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,14 +4,15 @@ use wicked_waifus_protocol::{
|
|||
TutorialReceiveResponse, TutorialUnlockRequest, TutorialUnlockResponse,
|
||||
};
|
||||
|
||||
use crate::logic::player::Player;
|
||||
use crate::logic::thread_mgr::NetContext;
|
||||
|
||||
pub fn on_tutorial_info_request(
|
||||
player: &mut Player,
|
||||
ctx: &NetContext,
|
||||
_: TutorialInfoRequest,
|
||||
response: &mut TutorialInfoResponse,
|
||||
) {
|
||||
response.unlock_list = player
|
||||
response.unlock_list = ctx
|
||||
.player
|
||||
.tutorials
|
||||
.tutorials
|
||||
.iter()
|
||||
|
@ -24,7 +25,7 @@ pub fn on_tutorial_info_request(
|
|||
}
|
||||
|
||||
pub fn on_tutorial_receive_request(
|
||||
player: &mut Player,
|
||||
ctx: &mut NetContext,
|
||||
request: TutorialReceiveRequest,
|
||||
response: &mut TutorialReceiveResponse,
|
||||
) {
|
||||
|
@ -35,12 +36,13 @@ pub fn on_tutorial_receive_request(
|
|||
return;
|
||||
};
|
||||
|
||||
let Some(tutorial) = player
|
||||
let Some(tutorial) = ctx
|
||||
.player
|
||||
.tutorials
|
||||
.tutorials
|
||||
.iter()
|
||||
.find(|tutorial| tutorial.id == request.id) else {
|
||||
|
||||
.find(|tutorial| tutorial.id == request.id)
|
||||
else {
|
||||
response.error_code = ErrorCode::GuideTutorialNotUnlock.into();
|
||||
return;
|
||||
};
|
||||
|
@ -51,7 +53,10 @@ pub fn on_tutorial_receive_request(
|
|||
}
|
||||
|
||||
// TODO: Search the rewards in drop_package
|
||||
tracing::debug!("Tutorial receive request with drop: {}", tutorial_data.drop_id);
|
||||
tracing::debug!(
|
||||
"Tutorial receive request with drop: {}",
|
||||
tutorial_data.drop_id
|
||||
);
|
||||
|
||||
// TODO: Fill in the item map
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
|
@ -59,7 +64,7 @@ pub fn on_tutorial_receive_request(
|
|||
}
|
||||
|
||||
pub fn on_tutorial_unlock_request(
|
||||
player: &mut Player,
|
||||
ctx: &mut NetContext,
|
||||
request: TutorialUnlockRequest,
|
||||
response: &mut TutorialUnlockResponse,
|
||||
) {
|
||||
|
@ -70,7 +75,8 @@ pub fn on_tutorial_unlock_request(
|
|||
return;
|
||||
};
|
||||
|
||||
if let Some(tutorial) = player
|
||||
if let Some(tutorial) = ctx
|
||||
.player
|
||||
.tutorials
|
||||
.tutorials
|
||||
.iter()
|
||||
|
@ -84,7 +90,7 @@ pub fn on_tutorial_unlock_request(
|
|||
return;
|
||||
}
|
||||
|
||||
let tutorial = player.unlock_tutorial(request.id);
|
||||
let tutorial = ctx.player.unlock_tutorial(request.id);
|
||||
response.un_lock_info = Some(TutorialInfo {
|
||||
id: tutorial.id,
|
||||
create_time: tutorial.create_time,
|
||||
|
|
177
wicked-waifus-game-server/src/logic/handler/weapon.rs
Normal file
177
wicked-waifus-game-server/src/logic/handler/weapon.rs
Normal file
|
@ -0,0 +1,177 @@
|
|||
use crate::logic::components::{Equip, WeaponSkin};
|
||||
use crate::logic::ecs::component::ComponentContainer;
|
||||
use crate::logic::player::Player;
|
||||
use crate::logic::thread_mgr::NetContext;
|
||||
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(
|
||||
ctx: &NetContext,
|
||||
_request: WeaponSkinRequest,
|
||||
response: &mut WeaponSkinResponse,
|
||||
) {
|
||||
response.equip_list = get_player_weapons(ctx.player);
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
||||
|
||||
pub fn on_equip_weapon_skin_request(
|
||||
ctx: &mut NetContext,
|
||||
request: EquipWeaponSkinRequest,
|
||||
response: &mut EquipWeaponSkinResponse,
|
||||
) {
|
||||
let Some(equip_data) = request.data else {
|
||||
return;
|
||||
};
|
||||
|
||||
let role = ctx.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 !ctx
|
||||
.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 = ctx.world.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;
|
||||
}
|
||||
);
|
||||
ctx.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 = get_player_weapons(ctx.player);
|
||||
response.error_code = ErrorCode::Success.into();
|
||||
}
|
||||
|
||||
pub fn on_send_equip_skin_request(
|
||||
ctx: &mut NetContext,
|
||||
request: SendEquipSkinRequest,
|
||||
response: &mut SendEquipSkinResponse,
|
||||
) {
|
||||
let role = ctx.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 = ctx.world.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;
|
||||
}
|
||||
);
|
||||
ctx.player.notify(EntityEquipSkinChangeNotify {
|
||||
entity_id,
|
||||
weapon_skin_component_pb: Some(WeaponSkinComponentPb { weapon_skin_id: 0 }),
|
||||
});
|
||||
ctx.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(
|
||||
ctx: &mut NetContext,
|
||||
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)
|
||||
ctx.player.notify(EquipTakeOnNotify {
|
||||
data_list: vec![equip_data],
|
||||
});
|
||||
|
||||
let role = ctx.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)) = ctx
|
||||
.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 = ctx.world.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;
|
||||
}
|
||||
);
|
||||
ctx.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();
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn get_player_weapons(player: &Player) -> Vec<LoadEquipData> {
|
||||
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()
|
||||
}
|
|
@ -30,9 +30,9 @@ impl Transform {
|
|||
}
|
||||
|
||||
pub fn set_rotation_from_protobuf(&mut self, rotator: &Rotator) {
|
||||
self.rotation.x = rotator.pitch;
|
||||
self.rotation.y = rotator.yaw;
|
||||
self.rotation.z = rotator.roll;
|
||||
self.rotation.x = rotator.roll;
|
||||
self.rotation.y = rotator.pitch;
|
||||
self.rotation.z = rotator.yaw;
|
||||
}
|
||||
|
||||
pub fn load_from_save(data: TransformData) -> Self {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
pub use in_world_player::InWorldPlayer;
|
||||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
use wicked_waifus_commons::time_util;
|
||||
use wicked_waifus_data::motion_data;
|
||||
|
@ -9,27 +7,23 @@ 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 super::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 +41,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 +68,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,8 +90,9 @@ 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 world_owner_id: i32,
|
||||
pub last_save_time: u64,
|
||||
pub quadrant_id: u64,
|
||||
}
|
||||
|
@ -117,6 +121,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 +213,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 +270,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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -290,6 +303,8 @@ impl Player {
|
|||
.collect::<Vec<_>>(),
|
||||
now_chapter: global_status.now_chapter,
|
||||
received_chapter: global_status.received_chapter,
|
||||
i_k1: vec![],
|
||||
r_k1: vec![],
|
||||
})
|
||||
.collect::<Vec<_>>(),
|
||||
}
|
||||
|
@ -298,7 +313,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 +347,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 +432,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 +475,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 {
|
||||
role_id,
|
||||
entity_id: world.get_entity_id(role_id),
|
||||
on_stage_without_control: false,
|
||||
}
|
||||
.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 +515,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 +573,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,7 +655,11 @@ impl Player {
|
|||
.mc_element
|
||||
.map(PlayerMcElement::load_from_save)
|
||||
.unwrap_or_default(),
|
||||
world: Rc::new(RefCell::new(World::new())),
|
||||
unlocked_skins: save_data
|
||||
.unlocked_skins
|
||||
.map(PlayerUnlockedSkins::load_from_save)
|
||||
.unwrap_or_default(),
|
||||
world_owner_id: 0,
|
||||
last_save_time: time_util::unix_timestamp(),
|
||||
quadrant_id: 0,
|
||||
}
|
||||
|
@ -589,7 +670,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 +694,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 +703,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,22 @@
|
|||
use std::collections::HashMap;
|
||||
use std::sync::atomic::AtomicI32;
|
||||
use wicked_waifus_protocol::{
|
||||
ArrayIntInt, NormalItem, PhantomItem, PhantomPropInfo, RolePhantomEquipInfo,
|
||||
RolePhantomPropInfo, 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, PlayerInventoryPhantomData, PlayerInventoryWeaponData,
|
||||
};
|
||||
|
||||
pub struct PlayerInventory {
|
||||
items: HashMap<i32, i32>,
|
||||
weapons_seq: SequenceGenerator<i32, AtomicI32>,
|
||||
weapons: HashMap<i32, PlayerInventoryWeaponData>,
|
||||
echoes_seq: SequenceGenerator<i32, AtomicI32>,
|
||||
echoes: HashMap<i32, PlayerInventoryPhantomData>,
|
||||
}
|
||||
|
||||
pub struct ItemUsage {
|
||||
|
@ -33,13 +44,20 @@ impl PlayerInventory {
|
|||
|
||||
pub fn load_from_save(data: PlayerInventoryData) -> Self {
|
||||
Self {
|
||||
weapons_seq: SequenceGenerator::from_data(&data.weapons),
|
||||
echoes_seq: SequenceGenerator::from_data(&data.echoes),
|
||||
items: data.items.clone(),
|
||||
weapons: data.weapons.clone(),
|
||||
echoes: data.echoes.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn build_save_data(&self) -> PlayerInventoryData {
|
||||
PlayerInventoryData {
|
||||
items: self.items.clone(),
|
||||
weapons: self.weapons.clone(),
|
||||
echoes: self.echoes.clone(),
|
||||
echo_presets: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,10 +70,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 +95,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 +129,182 @@ 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))
|
||||
}
|
||||
|
||||
pub fn get_echoes_list(
|
||||
&self,
|
||||
) -> (
|
||||
Vec<PhantomItem>,
|
||||
Vec<RolePhantomEquipInfo>,
|
||||
Vec<RolePhantomPropInfo>,
|
||||
) {
|
||||
let mut equip_info: HashMap<i32, Vec<i32>> = HashMap::new();
|
||||
// TODO: probably change vec to hashmaps so comulative attributes are O(1) search range
|
||||
let mut prop_info: HashMap<i32, (Vec<ArrayIntInt>, Vec<ArrayIntInt>)> = HashMap::new();
|
||||
|
||||
let echoes = self
|
||||
.echoes
|
||||
.iter()
|
||||
.map(|(&inc_id, data)| {
|
||||
if data.role_id != 0 {
|
||||
equip_info.entry(data.role_id).or_default().push(inc_id);
|
||||
// TODO add propInfo here
|
||||
prop_info.entry(data.role_id).or_default();
|
||||
}
|
||||
|
||||
PhantomItem {
|
||||
id: data.id,
|
||||
incr_id: inc_id,
|
||||
func_value: data.func_value,
|
||||
phantom_level: data.level,
|
||||
phantom_exp: data.exp,
|
||||
phantom_main_prop: data
|
||||
.main_prop
|
||||
.iter()
|
||||
.map(|data| PhantomPropInfo {
|
||||
phantom_prop_id: data.prop_id,
|
||||
value: data.value,
|
||||
})
|
||||
.collect(),
|
||||
phantom_sub_prop: data
|
||||
.sub_prop
|
||||
.iter()
|
||||
.map(|data| PhantomPropInfo {
|
||||
phantom_prop_id: data.prop_id,
|
||||
value: data.value,
|
||||
})
|
||||
.collect(),
|
||||
fetter_group_id: data.fetter_group_id,
|
||||
skin_id: data.skin_id,
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
|
||||
let equip_info = equip_info
|
||||
.iter()
|
||||
.map(|(&role_id, info)| RolePhantomEquipInfo {
|
||||
role_id,
|
||||
phantom_item_incr_id: info.clone(),
|
||||
})
|
||||
.collect();
|
||||
|
||||
let prop_info = prop_info
|
||||
.iter()
|
||||
.map(|(&role_id, info)| RolePhantomPropInfo {
|
||||
role_id,
|
||||
base_prop: info.0.clone(),
|
||||
add_prop: info.1.clone(),
|
||||
})
|
||||
.collect();
|
||||
|
||||
(echoes, equip_info, prop_info)
|
||||
}
|
||||
|
||||
#[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 +317,107 @@ 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(),
|
||||
};
|
||||
let mut echoes_seq = SequenceGenerator::new();
|
||||
let echoes: HashMap<i32, PlayerInventoryPhantomData> =
|
||||
if default_unlocks.unlock_all_echo {
|
||||
wicked_waifus_data::phantom_item_data::iter()
|
||||
.filter(|data| data.item_id % 10 == 5) // TODO: Naruse??
|
||||
.flat_map(|data| {
|
||||
let phantom_incr_id = echoes_seq.take_id();
|
||||
data.fetter_group.iter()
|
||||
.map(move |&fetter_group_id| {
|
||||
(
|
||||
phantom_incr_id,
|
||||
PlayerInventoryPhantomData {
|
||||
id: data.item_id,
|
||||
func_value: 0,
|
||||
level: 25, // TODO: Max level config
|
||||
fetter_group_id,
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
})
|
||||
})
|
||||
.collect()
|
||||
} else {
|
||||
HashMap::new()
|
||||
};
|
||||
Self {
|
||||
items: HashMap::new(),
|
||||
weapons_seq,
|
||||
weapons,
|
||||
echoes_seq,
|
||||
echoes,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
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>,
|
||||
pub echo_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(),
|
||||
echo_skins: data.echo_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(),
|
||||
echo_skins: self.echo_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()
|
||||
},
|
||||
|
||||
echo_skins: if unlocks.unlock_all_echo_skins {
|
||||
wicked_waifus_data::phantom_customize_item_data::iter()
|
||||
.filter(|data| data.skin_item_id != 0)
|
||||
.map(|data| data.skin_item_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,13 +1,14 @@
|
|||
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;
|
||||
use crate::logic::utils::load_role_info::load_key_value;
|
||||
pub use formation::RoleFormation;
|
||||
use wicked_waifus_commons::time_util;
|
||||
use wicked_waifus_data::{role_info_data, BasePropertyData};
|
||||
use wicked_waifus_data::base_property_data::BasePropertyData;
|
||||
use wicked_waifus_data::role_info_data;
|
||||
use wicked_waifus_protocol_internal::{RoleData, RoleStats};
|
||||
use crate::logic::player::Element;
|
||||
|
||||
|
@ -50,6 +51,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 +123,40 @@ 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
|
||||
};
|
||||
// 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 +174,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 +220,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 +256,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 +292,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,11 +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 std::collections::hash_map::Entry::Vacant;
|
||||
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::{
|
||||
cell::RefCell,
|
||||
collections::{HashMap, VecDeque},
|
||||
|
@ -17,20 +12,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,
|
||||
|
@ -130,6 +121,11 @@ fn logic_thread_func(receiver: mpsc::Receiver<LogicInput>, load: Arc<AtomicUsize
|
|||
}
|
||||
}
|
||||
|
||||
pub struct NetContext<'logic> {
|
||||
pub player: &'logic mut Player,
|
||||
pub world: &'logic mut World,
|
||||
}
|
||||
|
||||
fn handle_logic_input(state: &mut LogicState, input: LogicInput) {
|
||||
match input {
|
||||
LogicInput::AddPlayer {
|
||||
|
@ -138,81 +134,56 @@ fn handle_logic_input(state: &mut LogicState, input: LogicInput) {
|
|||
session,
|
||||
player_save_data,
|
||||
} => {
|
||||
let (player, is_player) = if let Vacant(e) = state.players.entry(player_id) {
|
||||
(
|
||||
e.insert(RefCell::new(Player::load_from_save(*player_save_data))),
|
||||
true,
|
||||
)
|
||||
} 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 = state.players.entry(player_id).or_insert_with(|| {
|
||||
RefCell::new(Player::load_from_save(player_save_data))
|
||||
}).borrow_mut();
|
||||
|
||||
let mut player = player.borrow_mut();
|
||||
if is_player {
|
||||
player
|
||||
.world
|
||||
.borrow_mut()
|
||||
.world_entitys
|
||||
.insert(player.basic_info.cur_map_id, WorldEntity::default());
|
||||
state.worlds.insert(player_id, player.world.clone());
|
||||
}
|
||||
// TODO: shall we search in coop?
|
||||
player.world_owner_id = player_id;
|
||||
let mut world = state.worlds.entry(player_id).or_insert_with(|| {
|
||||
let mut world = World::new();
|
||||
world.world_entities.insert(
|
||||
player.basic_info.cur_map_id,
|
||||
WorldEntity::default(),
|
||||
);
|
||||
Rc::new(RefCell::new(world))
|
||||
}).borrow_mut();
|
||||
|
||||
player.init();
|
||||
player.set_session(session);
|
||||
player.respond(EnterGameResponse::default(), enter_rpc_id);
|
||||
player.notify_general_data();
|
||||
|
||||
player
|
||||
.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);
|
||||
let scene_info = world_util::build_scene_information(&player);
|
||||
world.set_in_world_player_data(player.build_in_world_player());
|
||||
|
||||
player.notify(SilenceNpcNotify::default());
|
||||
let mut ctx = NetContext {
|
||||
player: &mut player,
|
||||
world: &mut world,
|
||||
};
|
||||
world_util::add_player_entities(&mut ctx);
|
||||
let scene_info = world_util::build_scene_information(&mut ctx);
|
||||
|
||||
player.notify(JoinSceneNotify {
|
||||
ctx.player.notify(SilenceNpcNotify::default());
|
||||
|
||||
ctx.player.notify(JoinSceneNotify {
|
||||
scene_info: Some(scene_info),
|
||||
max_entity_id: i64::MAX,
|
||||
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,
|
||||
},
|
||||
],
|
||||
});
|
||||
ctx.player.notify(AfterJoinSceneNotify::default());
|
||||
ctx.player.notify(ctx.player.build_update_formation_notify());
|
||||
|
||||
player.notify(AfterJoinSceneNotify::default());
|
||||
player.notify(player.build_update_formation_notify());
|
||||
|
||||
let map = logic::utils::quadrant_util::get_map(player.basic_info.cur_map_id);
|
||||
let map = logic::utils::quadrant_util::get_map(ctx.player.basic_info.cur_map_id);
|
||||
let quadrant_id = map.get_quadrant_id(
|
||||
player.location.position.position.x * 100.0,
|
||||
player.location.position.position.y * 100.0,
|
||||
ctx.player.location.position.position.x * 100.0,
|
||||
ctx.player.location.position.position.y * 100.0,
|
||||
);
|
||||
player.quadrant_id = quadrant_id;
|
||||
player.notify_month_card();
|
||||
ctx.player.quadrant_id = quadrant_id;
|
||||
ctx.player.notify_month_card();
|
||||
|
||||
let entities = map.get_initial_entities(quadrant_id);
|
||||
world_util::add_entities(&player, &entities, false);
|
||||
world_util::add_entities(&mut ctx, &entities, false);
|
||||
|
||||
drop(player);
|
||||
|
||||
|
@ -225,8 +196,17 @@ fn handle_logic_input(state: &mut LogicState, input: LogicInput) {
|
|||
tracing::warn!("logic_thread: process message requested, but player with id {player_id} doesn't exist");
|
||||
return;
|
||||
};
|
||||
|
||||
super::handler::handle_logic_message(&mut player.borrow_mut(), message);
|
||||
let mut player = player.borrow_mut();
|
||||
let Some(world) = state.worlds.get_mut(&player.world_owner_id) else {
|
||||
tracing::warn!("logic_thread: process message requested, but world for player id {} doesn't exist", player.world_owner_id);
|
||||
return;
|
||||
};
|
||||
let mut world = world.borrow_mut();
|
||||
let mut net_context = NetContext {
|
||||
player: &mut player,
|
||||
world: &mut world,
|
||||
};
|
||||
super::handler::handle_logic_message(&mut net_context, message);
|
||||
}
|
||||
LogicInput::RemovePlayer { player_id } => {
|
||||
let Some(player) = state.players.remove(&player_id) else {
|
||||
|
@ -236,14 +216,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(),
|
||||
|
|
320
wicked-waifus-game-server/src/logic/utils/action_utils.rs
Normal file
320
wicked-waifus-game-server/src/logic/utils/action_utils.rs
Normal file
|
@ -0,0 +1,320 @@
|
|||
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;
|
||||
use crate::logic::thread_mgr::NetContext;
|
||||
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(ctx: &mut NetContext,
|
||||
entity_id: i64,
|
||||
level_entity_data: &wicked_waifus_data::level_entity_config_data::LevelEntityConfigData,
|
||||
template_config: &wicked_waifus_data::template_config_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(ctx, level_entity_data, template_config),
|
||||
Action::LeisureInteract(action) => unimplemented_action! { action },
|
||||
Action::UnlockTeleportTrigger(action) => unlock_teleport_trigger(ctx, 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(ctx, 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::UpdateTrialCharacter(action) => unimplemented_action! { action },
|
||||
Action::RestoreTrialCharacter(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 },
|
||||
Action::SetTimeScale(action) => unimplemented_action! { action },
|
||||
Action::EndCommonTip(action) => unimplemented_action! { action },
|
||||
Action::SetupMoraleSystem(action) => unimplemented_action! { action },
|
||||
}
|
||||
}
|
||||
|
||||
fn collect_action(ctx: &mut NetContext,
|
||||
level_entity_data: &wicked_waifus_data::level_entity_config_data::LevelEntityConfigData,
|
||||
template_config: &wicked_waifus_data::template_config_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 = ctx.player.inventory.add_items(&usages);
|
||||
let normal_item_list = ctx.player.inventory.to_normal_item_list_filtered(
|
||||
&updated_items.keys().cloned().collect::<Vec<i32>>()
|
||||
);
|
||||
ctx.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<_>>(),
|
||||
});
|
||||
ctx.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(ctx: &mut NetContext, action: UnlockTeleportTrigger) {
|
||||
ctx.player.unlock_teleport(action.teleport_id)
|
||||
}
|
||||
|
||||
fn change_self_entity_state(ctx: &mut NetContext,
|
||||
entity_id: i64,
|
||||
level_entity_data: &wicked_waifus_data::level_entity_config_data::LevelEntityConfigData,
|
||||
template_config: &wicked_waifus_data::template_config_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 = ctx.world.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(ctx, entity_id, level_entity_data, template_config, sub);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ctx.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
|
||||
],
|
||||
});
|
||||
|
||||
ctx.player.notify(EntityStateReadyNotify {
|
||||
entity_id,
|
||||
tag_id: state,
|
||||
ready: true, // TODO: Always true? or shall we compare it to something??
|
||||
});
|
||||
}
|
|
@ -1,28 +1,30 @@
|
|||
use wicked_waifus_data::pb_components::condition::{CheckConditionGroup, CompareEntityState, Condition};
|
||||
use wicked_waifus_data::pb_components::condition::{
|
||||
CheckConditionGroup, CompareEntityState, Condition, HasBuff,
|
||||
};
|
||||
|
||||
use crate::logic::ecs::component::ComponentContainer;
|
||||
use crate::logic::player::Player;
|
||||
use crate::logic::thread_mgr::NetContext;
|
||||
use crate::logic::utils::tag_utils;
|
||||
use crate::query_components;
|
||||
|
||||
macro_rules! unimplemented_condition {
|
||||
($condition:ident) => {
|
||||
{
|
||||
tracing::warn!("Condition check not implemented for: {:?}", $condition);
|
||||
true
|
||||
}
|
||||
}
|
||||
($condition:ident) => {{
|
||||
tracing::warn!("Condition check not implemented for: {:?}", $condition);
|
||||
true
|
||||
}};
|
||||
}
|
||||
|
||||
pub fn check_condition(player: &Player,
|
||||
entity_id: i64,
|
||||
level_entity_data: &wicked_waifus_data::LevelEntityConfigData,
|
||||
template_config: &wicked_waifus_data::TemplateConfigData,
|
||||
element: Condition) -> bool {
|
||||
pub fn check_condition(
|
||||
ctx: &mut NetContext,
|
||||
entity_id: i64,
|
||||
level_entity_data: &wicked_waifus_data::level_entity_config_data::LevelEntityConfigData,
|
||||
template_config: &wicked_waifus_data::template_config_data::TemplateConfigData,
|
||||
element: Condition,
|
||||
) -> bool {
|
||||
match element {
|
||||
Condition::CompareTimePeriod(condition) => unimplemented_condition! { condition },
|
||||
Condition::CheckChildQuestFinished(condition) => unimplemented_condition! { condition },
|
||||
Condition::CompareEntityState(condition) => compare_entity_state(player, entity_id, condition),
|
||||
Condition::CompareEntityState(condition) => compare_entity_state(ctx, entity_id, condition),
|
||||
Condition::CheckEntityState(condition) => unimplemented_condition! { condition },
|
||||
Condition::CompareVar(condition) => unimplemented_condition! { condition },
|
||||
Condition::CompareWeather(condition) => unimplemented_condition! { condition },
|
||||
|
@ -36,13 +38,15 @@ pub fn check_condition(player: &Player,
|
|||
Condition::PreLevelPlay(condition) => unimplemented_condition! { condition },
|
||||
Condition::CheckLevelPlay(condition) => unimplemented_condition! { condition },
|
||||
Condition::CheckLevelPlayState(condition) => unimplemented_condition! { condition },
|
||||
Condition::CheckLevelPlayCompleteNumber(condition) => unimplemented_condition! { condition },
|
||||
Condition::CheckLevelPlayCompleteNumber(condition) => {
|
||||
unimplemented_condition! { condition }
|
||||
}
|
||||
Condition::CompareLevelPlayRewardState(condition) => unimplemented_condition! { condition },
|
||||
Condition::CheckItems(condition) => unimplemented_condition! { condition },
|
||||
Condition::HandInItems(condition) => unimplemented_condition! { condition },
|
||||
Condition::GetItem(condition) => unimplemented_condition! { condition },
|
||||
Condition::UseItem(condition) => unimplemented_condition! { condition },
|
||||
Condition::HasBuff(condition) => unimplemented_condition! { condition },
|
||||
Condition::HasBuff(condition) => has_buff(ctx, entity_id, condition),
|
||||
Condition::CompareLift(condition) => unimplemented_condition! { condition },
|
||||
Condition::CheckJigsawInfo(condition) => unimplemented_condition! { condition },
|
||||
Condition::CheckInCombat(condition) => unimplemented_condition! { condition },
|
||||
|
@ -68,14 +72,20 @@ pub fn check_condition(player: &Player,
|
|||
Condition::CheckEntityLocked(condition) => unimplemented_condition! { condition },
|
||||
Condition::CheckRogueAbilitySelect(condition) => unimplemented_condition! { condition },
|
||||
Condition::CompareFishingBoatState(condition) => unimplemented_condition! { condition },
|
||||
Condition::CompleteCertainFishingEntrust(condition) => unimplemented_condition! { condition },
|
||||
Condition::CompleteCertainFishingEntrust(condition) => {
|
||||
unimplemented_condition! { condition }
|
||||
}
|
||||
Condition::CompareFishingPrestigeLevel(condition) => unimplemented_condition! { condition },
|
||||
Condition::CheckCertainFishingItemCount(condition) => unimplemented_condition! { condition },
|
||||
Condition::CheckCertainFishingItemCount(condition) => {
|
||||
unimplemented_condition! { condition }
|
||||
}
|
||||
Condition::CompareFishingTechLevel(condition) => unimplemented_condition! { condition },
|
||||
Condition::ListenEntitySelfEvent(condition) => unimplemented_condition! { condition },
|
||||
Condition::CheckHookLockPoint(condition) => unimplemented_condition! { condition },
|
||||
Condition::CheckEntitesExist(condition) => unimplemented_condition! { condition },
|
||||
Condition::CheckEntityHasSceneItemAttributeTag(condition) => unimplemented_condition! { condition },
|
||||
Condition::CheckEntityHasSceneItemAttributeTag(condition) => {
|
||||
unimplemented_condition! { condition }
|
||||
}
|
||||
Condition::CheckTargetBattleAttribute(condition) => unimplemented_condition! { condition },
|
||||
Condition::CheckAlertAreaEnabled(condition) => unimplemented_condition! { condition },
|
||||
Condition::CompareAlertValue(condition) => unimplemented_condition! { condition },
|
||||
|
@ -99,7 +109,13 @@ pub fn check_condition(player: &Player,
|
|||
Condition::ParallaxAlign(condition) => unimplemented_condition! { condition },
|
||||
Condition::WaitBattleCondition(condition) => unimplemented_condition! { condition },
|
||||
Condition::CheckDirection(condition) => unimplemented_condition! { condition },
|
||||
Condition::CheckConditionGroup(condition) => check_condition_group(player, entity_id, level_entity_data, template_config, condition),
|
||||
Condition::CheckConditionGroup(condition) => check_condition_group(
|
||||
ctx,
|
||||
entity_id,
|
||||
level_entity_data,
|
||||
template_config,
|
||||
condition,
|
||||
),
|
||||
Condition::CheckTreasureBeenClaimed(condition) => unimplemented_condition! { condition },
|
||||
Condition::RangeSphere(condition) => unimplemented_condition! { condition },
|
||||
Condition::CheckInRange(condition) => unimplemented_condition! { condition },
|
||||
|
@ -119,40 +135,68 @@ pub fn check_condition(player: &Player,
|
|||
Condition::CheckEntityGravityDirection(condition) => unimplemented_condition! { condition },
|
||||
Condition::CheckTeleControlState(condition) => unimplemented_condition! { condition },
|
||||
Condition::CheckEntityReward(condition) => unimplemented_condition! { condition },
|
||||
Condition::CheckIsGramophonePlayingMusic(condition) => unimplemented_condition! { condition },
|
||||
Condition::CheckIsGramophonePlayingMusic(condition) => {
|
||||
unimplemented_condition! { condition }
|
||||
}
|
||||
Condition::CheckBVBEvent(condition) => unimplemented_condition! { condition },
|
||||
Condition::FinishBvbChallenge(condition) => unimplemented_condition! { condition },
|
||||
Condition::CompareActorVar(condition) => unimplemented_condition! { condition },
|
||||
Condition::CheckDangoCultivationProgress(condition) => unimplemented_condition! { condition },
|
||||
Condition::CheckDangoCultivationProgress(condition) => {
|
||||
unimplemented_condition! { condition }
|
||||
},
|
||||
Condition::CheckPlayerMoraleLevelRange(condition) => {
|
||||
unimplemented_condition! { condition }
|
||||
},
|
||||
Condition::ProgramSpecialProcess(condition) => {
|
||||
unimplemented_condition! { condition }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn compare_entity_state(player: &Player, entity_id: i64, condition: CompareEntityState) -> bool {
|
||||
fn compare_entity_state(ctx: &NetContext, entity_id: i64, condition: CompareEntityState) -> bool {
|
||||
let actual = {
|
||||
let world_ref = player.world.borrow();
|
||||
let world = world_ref.get_world_entity();
|
||||
let world = ctx.world.get_world_entity();
|
||||
let state_tag = query_components!(world, entity_id, StateTag).0.unwrap();
|
||||
state_tag.state_tag_id
|
||||
};
|
||||
let expected = tag_utils::get_tag_id_by_name(condition.state.as_str());
|
||||
// In theory, we can only check for equal or not equal
|
||||
tracing::debug!("CompareEntityState: type {:?}, actual: {actual}, expected: {expected}", condition.compare);
|
||||
tracing::debug!(
|
||||
"CompareEntityState: type {:?}, actual: {actual}, expected: {expected}",
|
||||
condition.compare
|
||||
);
|
||||
condition.compare.cmp(&expected, &actual)
|
||||
}
|
||||
|
||||
fn check_condition_group(player: &Player,
|
||||
entity_id: i64,
|
||||
level_entity_data: &wicked_waifus_data::LevelEntityConfigData,
|
||||
template_config: &wicked_waifus_data::TemplateConfigData,
|
||||
condition: CheckConditionGroup) -> bool {
|
||||
fn has_buff(ctx: &NetContext, entity_id: i64, condition: HasBuff) -> bool {
|
||||
let has_buff = {
|
||||
let world = ctx.world.get_world_entity();
|
||||
let buff = query_components!(world, entity_id, FightBuff).0.unwrap();
|
||||
// TODO: use online condition
|
||||
// TODO: Check if there are other type of Eq
|
||||
buff.fight_buff_infos
|
||||
.iter()
|
||||
.find(|buf| buf.buff_id == condition.buff_id)
|
||||
.is_some()
|
||||
};
|
||||
tracing::debug!("Entity {entity_id} has buff: {has_buff:?}");
|
||||
has_buff
|
||||
}
|
||||
|
||||
fn check_condition_group(
|
||||
ctx: &mut NetContext,
|
||||
entity_id: i64,
|
||||
level_entity_data: &wicked_waifus_data::level_entity_config_data::LevelEntityConfigData,
|
||||
template_config: &wicked_waifus_data::template_config_data::TemplateConfigData,
|
||||
condition: CheckConditionGroup,
|
||||
) -> bool {
|
||||
let mut check = true;
|
||||
// TODO: Investigate if type has a meaning
|
||||
for element in condition.condition.conditions {
|
||||
check = check_condition(player, entity_id, level_entity_data, template_config, element);
|
||||
check = check_condition(ctx, entity_id, level_entity_data, template_config, element);
|
||||
if !check {
|
||||
break;
|
||||
}
|
||||
}
|
||||
check
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,31 +3,27 @@ use wicked_waifus_protocol::{EEntityType, EntityPb, PlayerSceneAoiData};
|
|||
use std::collections::HashSet;
|
||||
|
||||
use crate::logic::components::Visibility;
|
||||
use crate::logic::player::Player;
|
||||
use crate::{modify_component, query_hn_with};
|
||||
use crate::logic::thread_mgr::NetContext;
|
||||
|
||||
pub fn build_scene_add_on_init_data(player: &Player) -> PlayerSceneAoiData {
|
||||
let mut world_ref = player.world.borrow_mut();
|
||||
let world = world_ref.get_mut_world_entity();
|
||||
|
||||
pub fn build_scene_add_on_init_data(ctx: &mut NetContext) -> PlayerSceneAoiData {
|
||||
let world = ctx.world.get_mut_world_entity();
|
||||
let entities = query_hn_with!(world, PlayerOwnedEntityMarker)
|
||||
.into_iter()
|
||||
.map(|(entity_id, _)| {
|
||||
let res_map: (EEntityType, i32);
|
||||
match EEntityType::try_from(
|
||||
world.get_entity(world.get_config_id(entity_id)).entity_type,
|
||||
) {
|
||||
Ok(EEntityType::Player) => {
|
||||
res_map = (EEntityType::Player, entity_id);
|
||||
(EEntityType::Player, entity_id)
|
||||
}
|
||||
Ok(EEntityType::Monster) => {
|
||||
res_map = (EEntityType::Monster, entity_id);
|
||||
(EEntityType::Monster, entity_id)
|
||||
}
|
||||
_ => {
|
||||
res_map = (EEntityType::default(), -1);
|
||||
(EEntityType::default(), -1)
|
||||
}
|
||||
}
|
||||
res_map
|
||||
})
|
||||
.collect::<HashSet<(EEntityType, i32)>>();
|
||||
|
||||
|
@ -44,9 +40,9 @@ pub fn build_scene_add_on_init_data(player: &Player) -> PlayerSceneAoiData {
|
|||
world.get_entity_components(entity_id),
|
||||
Visibility,
|
||||
|vis: &mut Visibility| {
|
||||
let cur_role_id = player
|
||||
let cur_role_id = ctx.player
|
||||
.formation_list
|
||||
.get(&player.cur_formation_id)
|
||||
.get(&ctx.player.cur_formation_id)
|
||||
.unwrap()
|
||||
.cur_role;
|
||||
(vis.is_visible, vis.is_actor_visible) = if config_id == cur_role_id {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use wicked_waifus_data::{BasePropertyData, base_property_data, monster_property_growth_data, role_property_growth_data};
|
||||
use wicked_waifus_data::{base_property_data, monster_property_growth_data, role_property_growth_data};
|
||||
use wicked_waifus_data::base_property_data::BasePropertyData;
|
||||
|
||||
pub fn get_role_props_by_level(id: i32, level: i32, breach: i32) -> BasePropertyData {
|
||||
let mut base_props = get_role_props_or_default(id).clone();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use wicked_waifus_data::BasePropertyData;
|
||||
use wicked_waifus_data::base_property_data::BasePropertyData;
|
||||
use wicked_waifus_protocol::EAttributeType;
|
||||
use std::collections::HashMap;
|
||||
|
||||
|
|
|
@ -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 tag_utils;
|
||||
pub mod load_role_info;
|
||||
pub mod quadrant_util;
|
||||
pub mod seq_utils;
|
||||
pub mod tag_utils;
|
||||
pub mod world_util;
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
use std::collections::HashMap;
|
||||
use std::sync::OnceLock;
|
||||
use wicked_waifus_data::level_entity_config_data::LevelEntityConfigData;
|
||||
|
||||
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,277 +1,235 @@
|
|||
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
|
||||
use crate::logic::components::{
|
||||
Autonomous, Fsm, Interact, MonsterAi, ParaglidingSkin, SoarWingSkin, StateTag, Tag, WeaponSkin,
|
||||
};
|
||||
|
||||
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::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::thread_mgr::NetContext;
|
||||
use crate::logic::utils::growth_utils::get_monster_props_by_level;
|
||||
use crate::logic::utils::{entity_serializer, tag_utils};
|
||||
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;
|
||||
use wicked_waifus_data::blueprint_config_data::{EntityLogic, EntityType};
|
||||
use wicked_waifus_data::level_entity_config_data::LevelEntityConfigData;
|
||||
use wicked_waifus_data::pb_components::ComponentsData;
|
||||
use wicked_waifus_data::{blueprint_config_data, template_config_data};
|
||||
|
||||
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();
|
||||
const COUNT_OVERRIDE: &[(i32, i32)] = &[
|
||||
(1105, 3),
|
||||
(1301, 4)
|
||||
];
|
||||
|
||||
let summon_cfg = summon_cfg_data::get(&template_cfg.blueprint_type).unwrap();
|
||||
let concomitant_config_id = template_cfg.id;
|
||||
#[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 con_entity = world.create_entity(
|
||||
cur_summon_id,
|
||||
EEntityType::Monster.into(),
|
||||
player.basic_info.cur_map_id,
|
||||
);
|
||||
let mut pbs = Vec::new();
|
||||
|
||||
for buff_id in &summon_cfg.born_buff_id {
|
||||
concomitant_buffs.push(world.create_buff(cur_summon_id, *buff_id));
|
||||
}
|
||||
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![],
|
||||
};
|
||||
|
||||
tracing::info!("Adding Concomitant with id: {} and buffs {:#?}", concomitant_config_id, concomitant_buffs);
|
||||
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();
|
||||
|
||||
(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())
|
||||
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,
|
||||
}
|
||||
}};
|
||||
}
|
||||
|
||||
fn add_player_entity(player: &Player, formation: &RoleFormation, world: &mut WorldEntity) {
|
||||
let role_vec = formation
|
||||
pub fn add_player_entities(ctx: &mut NetContext) {
|
||||
let world = ctx.world.get_mut_world_entity();
|
||||
let current_formation = ctx
|
||||
.player
|
||||
.formation_list
|
||||
.get(&ctx.player.cur_formation_id)
|
||||
.unwrap();
|
||||
|
||||
let role_vec = current_formation
|
||||
.role_ids
|
||||
.iter()
|
||||
.map(|role_id| player.role_list.get(role_id).unwrap())
|
||||
.map(|role_id| ctx.player.role_list.get(role_id).unwrap())
|
||||
.collect::<Vec<_>>();
|
||||
let cur_role_id = current_formation.cur_role;
|
||||
|
||||
tracing::info!("adding player entity for formation {:#?}", formation.role_ids);
|
||||
let cur_role_id = formation.cur_role;
|
||||
if world.active_entity_empty() {
|
||||
for role in role_vec {
|
||||
let entity = world.create_entity(
|
||||
role.role_id,
|
||||
EEntityType::Player.into(),
|
||||
ctx.player.basic_info.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(
|
||||
ctx.player.basic_info.id,
|
||||
)))
|
||||
.with(ComponentContainer::Position(Position(
|
||||
ctx.player.location.position.clone(),
|
||||
)))
|
||||
.with(ComponentContainer::Visibility(Visibility {
|
||||
is_visible: role.role_id == cur_role_id,
|
||||
is_actor_visible: true,
|
||||
}))
|
||||
// TODO: from role
|
||||
// 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: 0, // TODO: store this too
|
||||
}))
|
||||
.with(ComponentContainer::VisionSkill(VisionSkill {
|
||||
skill_id: ctx.player.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, // TODO: Is this kept on weapon change
|
||||
}))
|
||||
.with(ComponentContainer::FightBuff(buf_manager))
|
||||
.build();
|
||||
|
||||
let mut pbs = Vec::new();
|
||||
|
||||
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,
|
||||
});
|
||||
tracing::debug!(
|
||||
"created player entity, id: {}, role_id: {}",
|
||||
entity.entity_id,
|
||||
role.role_id
|
||||
);
|
||||
}
|
||||
fight_buff_infos.dedup_by(|x, z| x.buff_id == z.buff_id);
|
||||
|
||||
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,
|
||||
entity_state: EntityState::Default,
|
||||
}))
|
||||
.with(ComponentContainer::OwnerPlayer(OwnerPlayer(
|
||||
player.basic_info.id,
|
||||
)))
|
||||
.with(ComponentContainer::Position(Position(
|
||||
player.location.position.clone(),
|
||||
)))
|
||||
.with(ComponentContainer::Visibility(Visibility {
|
||||
is_visible: role.role_id == cur_role_id,
|
||||
is_actor_visible: true,
|
||||
}))
|
||||
// TODO: from role
|
||||
// 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: equip_weapon,
|
||||
weapon_breach_level: 0, // TODO: store this too
|
||||
}))
|
||||
.with(ComponentContainer::VisionSkill(VisionSkill {
|
||||
skill_id: player.explore_tools.active_explore_skill,
|
||||
}))
|
||||
.with(ComponentContainer::RoleSkin(RoleSkin {
|
||||
skin_id: role.skin_id,
|
||||
}))
|
||||
.with(ComponentContainer::SoarWingSkin(SoarWingSkin {
|
||||
skin_id: 84000001,
|
||||
}))
|
||||
.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 {
|
||||
pub fn build_scene_information(ctx: &mut NetContext) -> SceneInformation {
|
||||
SceneInformation {
|
||||
scene_id: String::new(),
|
||||
instance_id: player.location.instance_id,
|
||||
owner_id: player.basic_info.id,
|
||||
instance_id: ctx.player.location.instance_id,
|
||||
owner_id: ctx.player.basic_info.id,
|
||||
dynamic_entity_list: Vec::new(),
|
||||
blackboard_params: Vec::new(),
|
||||
end_time: 0,
|
||||
aoi_data: Some(entity_serializer::build_scene_add_on_init_data(player)),
|
||||
player_infos: build_player_info_list(&player.world.borrow_mut()),
|
||||
aoi_data: Some(entity_serializer::build_scene_add_on_init_data(ctx)),
|
||||
player_infos: build_player_info_list(ctx.world),
|
||||
mode: SceneMode::Single.into(),
|
||||
time_info: Some(SceneTimeInfo {
|
||||
owner_time_clock_time_span: 0,
|
||||
hour: 8,
|
||||
minute: 0,
|
||||
}),
|
||||
cur_context_id: player.basic_info.id as i64,
|
||||
cur_context_id: ctx.player.basic_info.id as i64,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
@ -303,11 +261,12 @@ 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(|(_, e, owner, _)| {
|
||||
owner.0 == sp.player_id && e.entity_type == EEntityType::Player
|
||||
});
|
||||
|
||||
ScenePlayerInformation {
|
||||
cur_role: cur_role_id,
|
||||
|
@ -324,7 +283,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,
|
||||
|
@ -339,12 +298,14 @@ fn build_player_info_list(world: &World) -> Vec<ScenePlayerInformation> {
|
|||
.collect()
|
||||
}
|
||||
|
||||
pub fn remove_entity(player: &Player, entity_id: i64, remove_type: ERemoveEntityType) {
|
||||
let mut world_ref = player.world.borrow_mut();
|
||||
let world = world_ref.get_mut_world_entity();
|
||||
|
||||
if world.remove_entity(entity_id as i32) {
|
||||
player.notify(EntityRemoveNotify {
|
||||
pub fn remove_entity(ctx: &mut NetContext, entity_id: i64, remove_type: ERemoveEntityType) {
|
||||
if ctx
|
||||
.world
|
||||
.get_mut_world_entity()
|
||||
.remove_entity(entity_id as i32)
|
||||
{
|
||||
// TODO: For COOP find a way to get players from world
|
||||
ctx.player.notify(EntityRemoveNotify {
|
||||
remove_infos: vec![EntityRemoveInfo {
|
||||
entity_id,
|
||||
r#type: remove_type.into(),
|
||||
|
@ -354,22 +315,19 @@ pub fn remove_entity(player: &Player, entity_id: i64, remove_type: ERemoveEntity
|
|||
}
|
||||
}
|
||||
|
||||
pub fn remove_entities(player: &Player, entities: &[&LevelEntityConfigData]) {
|
||||
pub fn remove_entities(ctx: &mut NetContext, entities: &[&LevelEntityConfigData]) {
|
||||
let mut removed_entities = Vec::with_capacity(entities.len());
|
||||
// Enclose to drop borrow mut ASAP
|
||||
{
|
||||
let mut world_ref = player.world.borrow_mut();
|
||||
let world = world_ref.get_mut_world_entity();
|
||||
|
||||
for entity in entities {
|
||||
let entity_id = entity.entity_id as i32; // TODO: Should be i64
|
||||
if world.remove_entity(entity_id) {
|
||||
removed_entities.push(world.get_entity_id(entity_id));
|
||||
}
|
||||
let world = ctx.world.get_mut_world_entity();
|
||||
for entity in entities {
|
||||
let entity_id = entity.entity_id as i32; // TODO: Should be i64
|
||||
if world.remove_entity(entity_id) {
|
||||
removed_entities.push(world.get_entity_id(entity_id));
|
||||
}
|
||||
}
|
||||
for entity_id in removed_entities {
|
||||
player.notify(EntityRemoveNotify {
|
||||
// TODO: For COOP find a way to get players from world
|
||||
ctx.player.notify(EntityRemoveNotify {
|
||||
remove_infos: vec![EntityRemoveInfo {
|
||||
entity_id,
|
||||
r#type: 0,
|
||||
|
@ -379,134 +337,139 @@ pub fn remove_entities(player: &Player, entities: &[&LevelEntityConfigData]) {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn add_entities(player: &Player, entities: &[&LevelEntityConfigData], external_awake: bool) {
|
||||
pub fn add_entities(
|
||||
ctx: &mut NetContext,
|
||||
entities: &[&LevelEntityConfigData],
|
||||
external_awake: bool,
|
||||
) {
|
||||
let mut added_entities = Vec::with_capacity(entities.len());
|
||||
// Enclose to drop borrow mut ASAP
|
||||
{
|
||||
let mut world_ref = player.world.borrow_mut();
|
||||
let world = world_ref.get_mut_world_entity();
|
||||
|
||||
for entity in entities {
|
||||
// Skip hidden entities
|
||||
if entity.is_hidden {
|
||||
tracing::debug!("Hidden entity with config id: {}", entity.entity_id);
|
||||
continue;
|
||||
}
|
||||
if entity.in_sleep && !external_awake {
|
||||
let world = ctx.world.get_mut_world_entity();
|
||||
for entity in entities {
|
||||
// Skip hidden entities
|
||||
if entity.is_hidden {
|
||||
tracing::debug!("Hidden entity with config id: {}", entity.entity_id);
|
||||
continue;
|
||||
}
|
||||
if entity.in_sleep && !external_awake {
|
||||
tracing::debug!(
|
||||
"Sleep entity with config id not spawned: {}",
|
||||
entity.entity_id
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
let blueprint_config = blueprint_config_data::get(&entity.blueprint_type);
|
||||
let template_config = template_config_data::get(&entity.blueprint_type);
|
||||
if blueprint_config.is_none() || template_config.is_none() {
|
||||
continue;
|
||||
}
|
||||
|
||||
let entity_logic: EntityLogic = blueprint_config.unwrap().entity_logic;
|
||||
let (config_type, entity_type, mut entity_state) = match entity_logic {
|
||||
EntityLogic::Item => (
|
||||
EntityConfigType::Level,
|
||||
EEntityType::SceneItem,
|
||||
EntityState::Default,
|
||||
),
|
||||
EntityLogic::Animal => (
|
||||
EntityConfigType::Level,
|
||||
EEntityType::Animal,
|
||||
EntityState::Default,
|
||||
),
|
||||
EntityLogic::Monster => (
|
||||
EntityConfigType::Level,
|
||||
EEntityType::Monster,
|
||||
EntityState::Born,
|
||||
),
|
||||
EntityLogic::Vehicle => (
|
||||
EntityConfigType::Level,
|
||||
EEntityType::Vehicle,
|
||||
EntityState::Default,
|
||||
),
|
||||
EntityLogic::Npc => (
|
||||
EntityConfigType::Level,
|
||||
EEntityType::Npc,
|
||||
EntityState::Default,
|
||||
),
|
||||
EntityLogic::Vision => (
|
||||
EntityConfigType::Level,
|
||||
EEntityType::Vision,
|
||||
EntityState::Default,
|
||||
),
|
||||
EntityLogic::ClientOnly => (
|
||||
EntityConfigType::Level,
|
||||
EEntityType::ClientOnly,
|
||||
EntityState::Default,
|
||||
),
|
||||
EntityLogic::ServerOnly => {
|
||||
tracing::debug!(
|
||||
"Sleep entity with config id not spawned: {}",
|
||||
"Unhandled entity to be added of logic: {:?} with blueprint_type {} and id: {}",
|
||||
entity_logic,
|
||||
entity.blueprint_type,
|
||||
entity.entity_id
|
||||
);
|
||||
continue;
|
||||
}
|
||||
EntityLogic::Custom => (
|
||||
EntityConfigType::Level,
|
||||
EEntityType::Custom,
|
||||
EntityState::Default,
|
||||
),
|
||||
};
|
||||
|
||||
let blueprint_config = blueprint_config_data::get(&entity.blueprint_type);
|
||||
let template_config = template_config_data::get(&entity.blueprint_type);
|
||||
if blueprint_config.is_none() || template_config.is_none() {
|
||||
continue;
|
||||
}
|
||||
|
||||
let entity_logic: EntityLogic = blueprint_config.unwrap().entity_logic;
|
||||
let (config_type, entity_type, mut entity_state) = match entity_logic {
|
||||
EntityLogic::Item => (
|
||||
EntityConfigType::Level,
|
||||
EEntityType::SceneItem,
|
||||
EntityState::Default,
|
||||
),
|
||||
EntityLogic::Animal => (
|
||||
EntityConfigType::Level,
|
||||
EEntityType::Animal,
|
||||
EntityState::Default,
|
||||
),
|
||||
EntityLogic::Monster => (
|
||||
EntityConfigType::Level,
|
||||
EEntityType::Monster,
|
||||
EntityState::Born,
|
||||
),
|
||||
EntityLogic::Vehicle => (
|
||||
EntityConfigType::Level,
|
||||
EEntityType::Vehicle,
|
||||
EntityState::Default,
|
||||
),
|
||||
EntityLogic::Npc => (
|
||||
EntityConfigType::Level,
|
||||
EEntityType::Npc,
|
||||
EntityState::Default,
|
||||
),
|
||||
EntityLogic::Vision => (
|
||||
EntityConfigType::Level,
|
||||
EEntityType::Vision,
|
||||
EntityState::Default,
|
||||
),
|
||||
EntityLogic::ClientOnly => (
|
||||
EntityConfigType::Level,
|
||||
EEntityType::ClientOnly,
|
||||
EntityState::Default,
|
||||
),
|
||||
EntityLogic::ServerOnly => {
|
||||
tracing::debug!("Unhandled entity to be added of logic: {:?} with blueprint_type {} and id: {}", entity_logic, entity.blueprint_type, entity.entity_id);
|
||||
continue;
|
||||
}
|
||||
EntityLogic::Custom => (
|
||||
EntityConfigType::Level,
|
||||
EEntityType::Custom,
|
||||
EntityState::Default,
|
||||
),
|
||||
};
|
||||
|
||||
if entity.in_sleep {
|
||||
entity_state = EntityState::Sleep;
|
||||
}
|
||||
|
||||
let config_id = entity.entity_id as i32; // TODO: i64????
|
||||
let map_id = entity.map_id;
|
||||
let components: ComponentsData = entity
|
||||
.components_data
|
||||
.merge_with_template(&template_config.unwrap().components_data);
|
||||
let tmp_entity = world.create_entity(config_id, config_type.into(), map_id);
|
||||
let mut builder = world.create_builder(tmp_entity);
|
||||
builder
|
||||
.with(ComponentContainer::EntityConfig(EntityConfig {
|
||||
camp: components
|
||||
.base_info_component
|
||||
.as_ref()
|
||||
.and_then(|b| b.camp)
|
||||
.unwrap_or(0),
|
||||
config_id,
|
||||
config_type,
|
||||
entity_type,
|
||||
entity_state,
|
||||
}))
|
||||
.with(ComponentContainer::Position(Position(Transform::from(
|
||||
&entity.transform[..],
|
||||
))))
|
||||
.with(ComponentContainer::Visibility(Visibility {
|
||||
is_visible: true,
|
||||
is_actor_visible: true,
|
||||
}))
|
||||
// Some entities may not actually have movement, but it's okay since we won't
|
||||
// receive move package push for them
|
||||
.with(ComponentContainer::Movement(Movement::default()));
|
||||
|
||||
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_attribute_component(&mut builder, &components, player.location.instance_id);
|
||||
build_ai_components(&mut builder, &components);
|
||||
added_entities.push(builder.build());
|
||||
if entity.in_sleep {
|
||||
entity_state = EntityState::Sleep;
|
||||
}
|
||||
|
||||
let config_id = entity.entity_id as i32; // TODO: i64????
|
||||
let map_id = entity.map_id;
|
||||
let components: ComponentsData = entity
|
||||
.components_data
|
||||
.merge_with_template(&template_config.unwrap().components_data);
|
||||
let tmp_entity = world.create_entity(config_id, config_type.into(), map_id);
|
||||
let mut builder = world.create_builder(tmp_entity);
|
||||
builder
|
||||
.with(ComponentContainer::EntityConfig(EntityConfig {
|
||||
camp: components
|
||||
.base_info_component
|
||||
.as_ref()
|
||||
.and_then(|b| b.camp)
|
||||
.unwrap_or(0),
|
||||
config_id,
|
||||
config_type,
|
||||
entity_type,
|
||||
entity_state,
|
||||
}))
|
||||
.with(ComponentContainer::Position(Position(Transform::from(
|
||||
&entity.transform[..],
|
||||
))))
|
||||
.with(ComponentContainer::Visibility(Visibility {
|
||||
is_visible: true,
|
||||
is_actor_visible: true,
|
||||
}))
|
||||
// Some entities may not actually have movement, but it's okay since we won't
|
||||
// receive move package push for them
|
||||
.with(ComponentContainer::Movement(Movement::default()));
|
||||
|
||||
build_autonomous_component(&mut builder, ctx.player.basic_info.id, entity_logic);
|
||||
build_interact_component(&mut builder, &components);
|
||||
build_tags_components(
|
||||
&mut builder,
|
||||
&components,
|
||||
ctx.player,
|
||||
blueprint_config.unwrap().entity_type,
|
||||
config_id as i64,
|
||||
);
|
||||
build_attribute_component(&mut builder, &components, ctx.player.location.instance_id);
|
||||
build_ai_components(&mut builder, &components);
|
||||
added_entities.push(builder.build());
|
||||
}
|
||||
|
||||
let world_ref = player.world.borrow();
|
||||
let world = world_ref.get_world_entity();
|
||||
let world = ctx.world.get_world_entity();
|
||||
// Since kuro has issues, we can only send one
|
||||
for entity in added_entities {
|
||||
// TODO: For COOP find a way to get players from world
|
||||
let mut pb = EntityPb {
|
||||
id: entity.entity_id as i64, // TODO: Should be i64
|
||||
..Default::default()
|
||||
|
@ -517,7 +480,7 @@ pub fn add_entities(player: &Player, entities: &[&LevelEntityConfigData], extern
|
|||
.into_iter()
|
||||
.for_each(|comp| comp.set_pb_data(&mut pb));
|
||||
|
||||
player.notify(EntityAddNotify {
|
||||
ctx.player.notify(EntityAddNotify {
|
||||
entity_pbs: vec![pb],
|
||||
remove_tag_ids: true,
|
||||
});
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -59,7 +59,10 @@ impl<S: Clone + Send + Sync + 'static> Application<S> {
|
|||
}
|
||||
|
||||
pub fn serve_dir(mut self, path: &str, dir: &str) -> Self {
|
||||
self.router = self.router.nest_service(path, ServeDir::new(dir));
|
||||
self.router = match path {
|
||||
"" | "/" => self.router.fallback_service(ServeDir::new(dir)),
|
||||
_ => self.router.nest_service(path, ServeDir::new(dir))
|
||||
};
|
||||
self
|
||||
}
|
||||
|
||||
|
|
|
@ -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,43 @@ 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 PhantomPropInfo {
|
||||
int32 prop_id = 1;
|
||||
int32 value = 2;
|
||||
}
|
||||
|
||||
message PlayerInventoryPhantomData {
|
||||
int32 id = 1;
|
||||
int32 func_value = 2;
|
||||
int32 level = 3;
|
||||
int32 exp = 4;
|
||||
repeated PhantomPropInfo main_prop = 5; // TODO: repeated vs map
|
||||
repeated PhantomPropInfo sub_prop = 6; // TODO: repeated vs map
|
||||
int32 fetter_group_id = 7;
|
||||
int32 skin_id = 8;
|
||||
int32 role_id = 9;
|
||||
}
|
||||
|
||||
message PlayerInventoryPhantomLoadoutData {
|
||||
int32 name = 1;
|
||||
map<int32, int32> incr_id = 2; // Key is position (0,1,2,3,4), value is incr_id
|
||||
}
|
||||
|
||||
message PlayerInventoryData {
|
||||
map<int32, int32> items = 1;
|
||||
map<int32, PlayerInventoryWeaponData> weapons = 2; // Key is incr_id
|
||||
map<int32, PlayerInventoryPhantomData> echoes = 3; // Key is incr_id
|
||||
map<int32, PlayerInventoryPhantomLoadoutData> echo_presets = 4; // Key is loadout number
|
||||
}
|
||||
|
||||
message PlayerTeleportData {
|
||||
|
@ -182,6 +220,14 @@ 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;
|
||||
repeated int32 echo_skins = 5;
|
||||
}
|
||||
|
||||
message PlayerSaveData {
|
||||
PlayerBasicData basic_data = 1;
|
||||
PlayerRoleData role_data = 2;
|
||||
|
@ -198,4 +244,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