Compare commits
No commits in common. "master" and "master" have entirely different histories.
79 changed files with 1395 additions and 3550 deletions
207
Cargo.lock
generated
207
Cargo.lock
generated
|
@ -105,13 +105,13 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "axum"
|
name = "axum"
|
||||||
version = "0.8.4"
|
version = "0.7.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "021e862c184ae977658b36c4500f7feac3221ca5da43e3f25bd04ab6c79a29b5"
|
checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"async-trait",
|
||||||
"axum-core",
|
"axum-core",
|
||||||
"bytes",
|
"bytes",
|
||||||
"form_urlencoded",
|
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"http",
|
"http",
|
||||||
"http-body",
|
"http-body",
|
||||||
|
@ -139,12 +139,13 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "axum-core"
|
name = "axum-core"
|
||||||
version = "0.5.2"
|
version = "0.4.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "68464cd0412f486726fb3373129ef5d2993f90c34bc2bc1c1e9943b2f4fc7ca6"
|
checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"async-trait",
|
||||||
"bytes",
|
"bytes",
|
||||||
"futures-core",
|
"futures-util",
|
||||||
"http",
|
"http",
|
||||||
"http-body",
|
"http-body",
|
||||||
"http-body-util",
|
"http-body-util",
|
||||||
|
@ -275,9 +276,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.2.24"
|
version = "1.2.22"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "16595d3be041c03b09d08d0858631facccee9221e579704070e6e9e4915d3bc7"
|
checksum = "32db95edf998450acc7881c932f94cd9b05c87b4b2599e8bab064753da4acfd1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"jobserver",
|
"jobserver",
|
||||||
"libc",
|
"libc",
|
||||||
|
@ -901,9 +902,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hyper-util"
|
name = "hyper-util"
|
||||||
version = "0.1.12"
|
version = "0.1.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cf9f1e950e0d9d1d3c47184416723cf29c0d1f93bd8cccf37e4beb6b44f31710"
|
checksum = "497bbc33a26fdd4af9ed9c70d63f61cf56a938375fbb32df34db9b1cd6d643f2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
|
@ -964,9 +965,9 @@ checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "icu_properties"
|
name = "icu_properties"
|
||||||
version = "2.0.1"
|
version = "2.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b"
|
checksum = "2549ca8c7241c82f59c80ba2a6f415d931c5b58d24fb8412caa1a1f02c49139a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"displaydoc",
|
"displaydoc",
|
||||||
"icu_collections",
|
"icu_collections",
|
||||||
|
@ -980,9 +981,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "icu_properties_data"
|
name = "icu_properties_data"
|
||||||
version = "2.0.1"
|
version = "2.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632"
|
checksum = "8197e866e47b68f8f7d95249e172903bec06004b18b2937f1095d40a0c57de04"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "icu_provider"
|
name = "icu_provider"
|
||||||
|
@ -1117,26 +1118,6 @@ dependencies = [
|
||||||
"pkg-config",
|
"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]]
|
[[package]]
|
||||||
name = "libm"
|
name = "libm"
|
||||||
version = "0.2.15"
|
version = "0.2.15"
|
||||||
|
@ -1226,6 +1207,27 @@ version = "0.4.27"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
|
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]]
|
[[package]]
|
||||||
name = "matchers"
|
name = "matchers"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
@ -1237,9 +1239,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "matchit"
|
name = "matchit"
|
||||||
version = "0.8.4"
|
version = "0.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3"
|
checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "md-5"
|
name = "md-5"
|
||||||
|
@ -1293,13 +1295,13 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mio"
|
name = "mio"
|
||||||
version = "1.0.4"
|
version = "1.0.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c"
|
checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"wasi 0.11.0+wasi-snapshot-preview1",
|
"wasi 0.11.0+wasi-snapshot-preview1",
|
||||||
"windows-sys 0.59.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1545,9 +1547,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "prettyplease"
|
name = "prettyplease"
|
||||||
version = "0.2.35"
|
version = "0.2.32"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "061c1221631e079b26479d25bbf2275bfe5917ae8419cd7e34f13bfc2aa7539a"
|
checksum = "664ec5419c51e34154eec046ebcba56312d5a2fc3b09a06da188e1ad21afadf6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"syn",
|
"syn",
|
||||||
|
@ -1564,9 +1566,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "prost"
|
name = "prost"
|
||||||
version = "0.14.1"
|
version = "0.13.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7231bd9b3d3d33c86b58adbac74b5ec0ad9f496b19d22801d773636feaa95f3d"
|
checksum = "2796faa41db3ec313a31f7624d9286acf277b52de526150b7e69f3debf891ee5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"prost-derive",
|
"prost-derive",
|
||||||
|
@ -1574,9 +1576,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "prost-build"
|
name = "prost-build"
|
||||||
version = "0.14.1"
|
version = "0.13.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ac6c3320f9abac597dcbc668774ef006702672474aad53c6d596b62e487b40b1"
|
checksum = "be769465445e8c1474e9c5dac2018218498557af32d9ed057325ec9a41ae81bf"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heck",
|
"heck",
|
||||||
"itertools",
|
"itertools",
|
||||||
|
@ -1594,9 +1596,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "prost-derive"
|
name = "prost-derive"
|
||||||
version = "0.14.1"
|
version = "0.13.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9120690fafc389a67ba3803df527d0ec9cbbc9cc45e4cc20b332996dfb672425"
|
checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"itertools",
|
"itertools",
|
||||||
|
@ -1607,9 +1609,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "prost-types"
|
name = "prost-types"
|
||||||
version = "0.14.1"
|
version = "0.13.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b9b4db3d6da204ed77bb26ba83b6122a73aeb2e87e25fbf7ad2e84c4ccbf8f72"
|
checksum = "52c2c1bf36ddb1a1c396b3601a3cec27c2462e45f07c386894ec3ccf5332bd16"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"prost",
|
"prost",
|
||||||
]
|
]
|
||||||
|
@ -1870,9 +1872,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustversion"
|
name = "rustversion"
|
||||||
version = "1.0.21"
|
version = "1.0.20"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d"
|
checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ryu"
|
name = "ryu"
|
||||||
|
@ -1941,9 +1943,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_spanned"
|
name = "serde_spanned"
|
||||||
version = "0.6.9"
|
version = "0.6.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3"
|
checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
@ -2071,9 +2073,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sqlx"
|
name = "sqlx"
|
||||||
version = "0.8.6"
|
version = "0.8.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1fefb893899429669dcdd979aff487bd78f4064e5e7907e4269081e0ef7d97dc"
|
checksum = "f3c3a85280daca669cfd3bcb68a337882a8bc57ec882f72c5d13a430613a738e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"sqlx-core",
|
"sqlx-core",
|
||||||
"sqlx-macros",
|
"sqlx-macros",
|
||||||
|
@ -2084,9 +2086,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sqlx-core"
|
name = "sqlx-core"
|
||||||
version = "0.8.6"
|
version = "0.8.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ee6798b1838b6a0f69c007c133b8df5866302197e404e8b6ee8ed3e3a5e68dc6"
|
checksum = "f743f2a3cea30a58cd479013f75550e879009e3a02f616f18ca699335aa248c3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
@ -2120,9 +2122,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sqlx-macros"
|
name = "sqlx-macros"
|
||||||
version = "0.8.6"
|
version = "0.8.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a2d452988ccaacfbf5e0bdbc348fb91d7c8af5bee192173ac3636b5fb6e6715d"
|
checksum = "7f4200e0fde19834956d4252347c12a083bdcb237d7a1a1446bffd8768417dce"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -2133,9 +2135,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sqlx-macros-core"
|
name = "sqlx-macros-core"
|
||||||
version = "0.8.6"
|
version = "0.8.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "19a9c1841124ac5a61741f96e1d9e2ec77424bf323962dd894bdb93f37d5219b"
|
checksum = "882ceaa29cade31beca7129b6beeb05737f44f82dbe2a9806ecea5a7093d00b7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dotenvy",
|
"dotenvy",
|
||||||
"either",
|
"either",
|
||||||
|
@ -2152,15 +2154,16 @@ dependencies = [
|
||||||
"sqlx-postgres",
|
"sqlx-postgres",
|
||||||
"sqlx-sqlite",
|
"sqlx-sqlite",
|
||||||
"syn",
|
"syn",
|
||||||
|
"tempfile",
|
||||||
"tokio",
|
"tokio",
|
||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sqlx-mysql"
|
name = "sqlx-mysql"
|
||||||
version = "0.8.6"
|
version = "0.8.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "aa003f0038df784eb8fecbbac13affe3da23b45194bd57dba231c8f48199c526"
|
checksum = "0afdd3aa7a629683c2d750c2df343025545087081ab5942593a5288855b1b7a7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"atoi",
|
"atoi",
|
||||||
"base64",
|
"base64",
|
||||||
|
@ -2200,9 +2203,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sqlx-postgres"
|
name = "sqlx-postgres"
|
||||||
version = "0.8.6"
|
version = "0.8.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "db58fcd5a53cf07c184b154801ff91347e4c30d17a3562a635ff028ad5deda46"
|
checksum = "a0bedbe1bbb5e2615ef347a5e9d8cd7680fb63e77d9dafc0f29be15e53f1ebe6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"atoi",
|
"atoi",
|
||||||
"base64",
|
"base64",
|
||||||
|
@ -2237,9 +2240,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sqlx-sqlite"
|
name = "sqlx-sqlite"
|
||||||
version = "0.8.6"
|
version = "0.8.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c2d12fe70b2c1b4401038055f90f151b78208de1f9f89a7dbfd41587a10c3eea"
|
checksum = "c26083e9a520e8eb87a06b12347679b142dc2ea29e6e409f805644a7a979a5bc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"atoi",
|
"atoi",
|
||||||
"flume",
|
"flume",
|
||||||
|
@ -2284,9 +2287,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.104"
|
version = "2.0.101"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
|
checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -2419,9 +2422,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio"
|
name = "tokio"
|
||||||
version = "1.45.1"
|
version = "1.45.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "75ef51a33ef1da925cea3e4eb122833cb377c61439ca401b770f54902b806779"
|
checksum = "2513ca694ef9ede0fb23fe71a4ee4107cb102b9dc1930f6d0fd77aae068ae165"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"backtrace",
|
"backtrace",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
@ -2473,9 +2476,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml"
|
name = "toml"
|
||||||
version = "0.8.23"
|
version = "0.8.22"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"
|
checksum = "05ae329d1f08c4d17a59bed7ff5b5a769d062e64a62d34a3261b219e62cd5aae"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_spanned",
|
"serde_spanned",
|
||||||
|
@ -2485,18 +2488,18 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_datetime"
|
name = "toml_datetime"
|
||||||
version = "0.6.11"
|
version = "0.6.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c"
|
checksum = "3da5db5a963e24bc68be8b17b6fa82814bb22ee8660f192bb182771d498f09a3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_edit"
|
name = "toml_edit"
|
||||||
version = "0.22.27"
|
version = "0.22.26"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
|
checksum = "310068873db2c5b3e7659d2cc35d21855dbafa50d1ce336397c666e3cb08137e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"serde",
|
"serde",
|
||||||
|
@ -2508,9 +2511,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_write"
|
name = "toml_write"
|
||||||
version = "0.1.2"
|
version = "0.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
|
checksum = "bfb942dfe1d8e29a7ee7fcbde5bd2b9a25fb89aa70caea2eba3bee836ff41076"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tower"
|
name = "tower"
|
||||||
|
@ -2530,13 +2533,12 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tower-http"
|
name = "tower-http"
|
||||||
version = "0.6.6"
|
version = "0.6.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "adc82fd73de2a9722ac5da747f12383d2bfdb93591ee6c58486e0097890f05f2"
|
checksum = "0fdb0c213ca27a9f57ab69ddb290fd80d970922355b83ae380b395d3986b8a2e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"bytes",
|
"bytes",
|
||||||
"futures-core",
|
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"http",
|
"http",
|
||||||
"http-body",
|
"http-body",
|
||||||
|
@ -2737,13 +2739,11 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "uuid"
|
name = "uuid"
|
||||||
version = "1.17.0"
|
version = "1.16.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d"
|
checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom 0.3.3",
|
"getrandom 0.3.3",
|
||||||
"js-sys",
|
|
||||||
"wasm-bindgen",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2793,7 +2793,6 @@ checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"rustversion",
|
|
||||||
"wasm-bindgen-macro",
|
"wasm-bindgen-macro",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2876,7 +2875,7 @@ name = "wicked-waifus-asset-updater"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"git2",
|
"git2",
|
||||||
"thiserror 2.0.12",
|
"thiserror 1.0.69",
|
||||||
"tracing",
|
"tracing",
|
||||||
"ureq",
|
"ureq",
|
||||||
"zip-extract",
|
"zip-extract",
|
||||||
|
@ -2914,7 +2913,7 @@ dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_repr",
|
"serde_repr",
|
||||||
"thiserror 2.0.12",
|
"thiserror 1.0.69",
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2937,7 +2936,7 @@ dependencies = [
|
||||||
"paste",
|
"paste",
|
||||||
"rand 0.9.1",
|
"rand 0.9.1",
|
||||||
"serde",
|
"serde",
|
||||||
"thiserror 2.0.12",
|
"thiserror 1.0.69",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
"unreal-niggery-rs",
|
"unreal-niggery-rs",
|
||||||
|
@ -2962,7 +2961,7 @@ dependencies = [
|
||||||
"kcp",
|
"kcp",
|
||||||
"paste",
|
"paste",
|
||||||
"serde",
|
"serde",
|
||||||
"thiserror 2.0.12",
|
"thiserror 1.0.69",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
"wicked-waifus-commons",
|
"wicked-waifus-commons",
|
||||||
|
@ -2996,7 +2995,7 @@ dependencies = [
|
||||||
"cbc",
|
"cbc",
|
||||||
"rbase64",
|
"rbase64",
|
||||||
"serde",
|
"serde",
|
||||||
"thiserror 2.0.12",
|
"thiserror 1.0.69",
|
||||||
"tower-http",
|
"tower-http",
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
@ -3027,7 +3026,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wicked-waifus-protocol"
|
name = "wicked-waifus-protocol"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/xavo95/wicked-waifus-proto-dev.git?branch=2.5.1#17cd6d994259ef38c8c74ef9acf6306c24c582b8"
|
source = "git+https://git.xeondev.com/wickedwaifus/wicked-waifus-proto#6f2733c09b78a6e874f379254c9b71fbef23c3a0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"crc32fast",
|
"crc32fast",
|
||||||
|
@ -3045,7 +3044,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wicked-waifus-protocol-derive"
|
name = "wicked-waifus-protocol-derive"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/xavo95/wicked-waifus-proto-dev.git?branch=2.5.1#17cd6d994259ef38c8c74ef9acf6306c24c582b8"
|
source = "git+https://git.xeondev.com/wickedwaifus/wicked-waifus-proto#6f2733c09b78a6e874f379254c9b71fbef23c3a0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -3062,7 +3061,7 @@ dependencies = [
|
||||||
"prost-build",
|
"prost-build",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"thiserror 2.0.12",
|
"thiserror 1.0.69",
|
||||||
"wicked-waifus-protocol",
|
"wicked-waifus-protocol",
|
||||||
"wicked-waifus-protocol-derive",
|
"wicked-waifus-protocol-derive",
|
||||||
]
|
]
|
||||||
|
@ -3077,7 +3076,7 @@ dependencies = [
|
||||||
"rbase64",
|
"rbase64",
|
||||||
"rsa",
|
"rsa",
|
||||||
"serde",
|
"serde",
|
||||||
"thiserror 2.0.12",
|
"thiserror 1.0.69",
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -3281,6 +3280,15 @@ version = "0.6.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb"
|
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]]
|
[[package]]
|
||||||
name = "yoke"
|
name = "yoke"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
|
@ -3428,9 +3436,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zip"
|
name = "zip"
|
||||||
version = "4.0.0"
|
version = "3.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "153a6fff49d264c4babdcfa6b4d534747f520e56e8f0f384f3b808c4b64cc1fd"
|
checksum = "12598812502ed0105f607f941c386f43d441e00148fce9dec3ca5ffb0bde9308"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes",
|
"aes",
|
||||||
"arbitrary",
|
"arbitrary",
|
||||||
|
@ -3442,11 +3450,12 @@ dependencies = [
|
||||||
"getrandom 0.3.3",
|
"getrandom 0.3.3",
|
||||||
"hmac",
|
"hmac",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"liblzma",
|
"lzma-rs",
|
||||||
"memchr",
|
"memchr",
|
||||||
"pbkdf2",
|
"pbkdf2",
|
||||||
"sha1",
|
"sha1",
|
||||||
"time",
|
"time",
|
||||||
|
"xz2",
|
||||||
"zeroize",
|
"zeroize",
|
||||||
"zopfli",
|
"zopfli",
|
||||||
"zstd",
|
"zstd",
|
||||||
|
|
32
Cargo.toml
32
Cargo.toml
|
@ -7,14 +7,14 @@ version = "0.1.0"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
# Framework
|
# Framework
|
||||||
tokio = { version = "1.45.1", features = ["full"] }
|
tokio = { version = "1.39.3", features = ["full"] }
|
||||||
tower-http = { version = "0.6.6", features = ["fs", "trace"] }
|
tower-http = { version = "0.6.1", features = ["fs", "trace"] }
|
||||||
axum = "0.8.4"
|
axum = "0.7.5"
|
||||||
axum-server = "0.7.2"
|
axum-server = "0.7.1"
|
||||||
zeromq = { version = "0.4.0", default-features = false, features = ["tokio-runtime", "tcp-transport"] }
|
zeromq = { version = "0.4.0", default-features = false, features = ["tokio-runtime", "tcp-transport"] }
|
||||||
|
|
||||||
# Database
|
# Database
|
||||||
sqlx = { version = "0.8.6", features = ["postgres", "runtime-tokio-rustls"] }
|
sqlx = { version = "0.8.2", features = ["postgres", "runtime-tokio-rustls"] }
|
||||||
|
|
||||||
# Cryptography
|
# Cryptography
|
||||||
aes = "0.8.4"
|
aes = "0.8.4"
|
||||||
|
@ -25,16 +25,16 @@ rand = "0.8.5"
|
||||||
rsa = { version = "0.9.6", features = ["pem"] }
|
rsa = { version = "0.9.6", features = ["pem"] }
|
||||||
|
|
||||||
# Serialization
|
# Serialization
|
||||||
serde = { version = "1.0.219", features = ["derive"] }
|
serde = { version = "1.0.209", features = ["derive"] }
|
||||||
serde_json = "1.0.140"
|
serde_json = "1.0.128"
|
||||||
serde_repr = "0.1.20"
|
serde_repr = "0.1.19"
|
||||||
toml = "0.8.23"
|
toml = "0.8.19"
|
||||||
prost = "0.14.1"
|
prost = "0.13.2"
|
||||||
prost-build = "0.14.1"
|
prost-build = "0.13.2"
|
||||||
|
|
||||||
# Utility
|
# Utility
|
||||||
anyhow = "1.0.98"
|
anyhow = "1.0.86"
|
||||||
thiserror = "2.0.12"
|
thiserror = "1.0.63"
|
||||||
paste = "1.0.15"
|
paste = "1.0.15"
|
||||||
rbase64 = "2.0.3"
|
rbase64 = "2.0.3"
|
||||||
dashmap = "6.1.0"
|
dashmap = "6.1.0"
|
||||||
|
@ -42,8 +42,8 @@ hex = "0.4.3"
|
||||||
byteorder = "1.5.0"
|
byteorder = "1.5.0"
|
||||||
|
|
||||||
# Tracing
|
# Tracing
|
||||||
tracing = "0.1.41"
|
tracing = "0.1.40"
|
||||||
tracing-subscriber = { version = "0.3.19", features = ["env-filter"] }
|
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
|
||||||
|
|
||||||
# Internal
|
# Internal
|
||||||
wicked-waifus-asset-updater = { path = "wicked-waifus-asset-updater" }
|
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-protocol-internal = { path = "wicked-waifus-protocol-internal" }
|
||||||
wicked-waifus-protokey = { path = "wicked-waifus-protokey" }
|
wicked-waifus-protokey = { path = "wicked-waifus-protokey" }
|
||||||
|
|
||||||
wicked-waifus-protocol = { git = "https://git.xeondev.com/wickedwaifus/wicked-waifus-proto", features = ["debug"] }
|
wicked-waifus-protocol = { git = "https://git.xeondev.com/wickedwaifus/wicked-waifus-proto" }
|
||||||
wicked-waifus-protocol-derive = { git = "https://git.xeondev.com/wickedwaifus/wicked-waifus-proto" }
|
wicked-waifus-protocol-derive = { git = "https://git.xeondev.com/wickedwaifus/wicked-waifus-proto" }
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
|
|
|
@ -11,5 +11,5 @@ serve_dir_path = "data/assets/config-server"
|
||||||
|
|
||||||
[asset_config]
|
[asset_config]
|
||||||
repository_url = "https://git.xeondev.com/wickedwaifus/wicked-waifus-config-server-files.git"
|
repository_url = "https://git.xeondev.com/wickedwaifus/wicked-waifus-config-server-files.git"
|
||||||
reference = "a7ad3d4ef8"
|
reference = "f088e91db3"
|
||||||
discard_local_changes = true
|
discard_local_changes = true
|
|
@ -1,88 +1,5 @@
|
||||||
use serde::Deserialize;
|
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)]
|
#[derive(Clone, Debug, Deserialize)]
|
||||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||||
|
|
|
@ -1,206 +1,6 @@
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
||||||
#[derive(Deserialize, PartialEq, Debug, Copy, Clone)]
|
use crate::{EntityLogic, EntityType};
|
||||||
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)]
|
#[derive(Deserialize)]
|
||||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||||
|
@ -210,7 +10,10 @@ pub struct BlueprintConfigData {
|
||||||
pub blueprint_type: String,
|
pub blueprint_type: String,
|
||||||
pub entity_type: EntityType,
|
pub entity_type: EntityType,
|
||||||
pub entity_logic: EntityLogic,
|
pub entity_logic: EntityLogic,
|
||||||
|
#[cfg(feature = "strict_json_fields")]
|
||||||
pub model_id: i32,
|
pub model_id: i32,
|
||||||
|
#[cfg(feature = "strict_json_fields")]
|
||||||
pub half_height: i32,
|
pub half_height: i32,
|
||||||
|
#[cfg(feature = "strict_json_fields")]
|
||||||
pub track_height: i32,
|
pub track_height: i32,
|
||||||
}
|
}
|
|
@ -1,109 +0,0 @@
|
||||||
use serde::Deserialize;
|
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
|
||||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
|
||||||
#[serde(rename_all = "PascalCase")]
|
|
||||||
pub struct BuffData {
|
|
||||||
pub id: i64,
|
|
||||||
pub ge_desc: String,
|
|
||||||
pub duration_policy: i32, // 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,
|
|
||||||
}
|
|
|
@ -1,55 +0,0 @@
|
||||||
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,20 +1,5 @@
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde_repr::Deserialize_repr;
|
use crate::GachaViewTypeInfoId;
|
||||||
|
|
||||||
#[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)]
|
#[derive(Debug, Deserialize)]
|
||||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||||
|
|
|
@ -2,14 +2,7 @@ use std::collections::HashMap;
|
||||||
|
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
||||||
use crate::VectorData;
|
use crate::{EntranceEntityData, VectorData};
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
|
||||||
#[serde(rename_all = "PascalCase")]
|
|
||||||
pub struct EntranceEntityData {
|
|
||||||
pub dungeon_id: i32,
|
|
||||||
pub entrance_entity_id: i64,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||||
|
|
|
@ -1,154 +1,5 @@
|
||||||
use serde::Deserialize;
|
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)]
|
#[derive(Debug, Deserialize)]
|
||||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||||
|
|
|
@ -3,6 +3,7 @@ use std::io::BufReader;
|
||||||
|
|
||||||
use paste::paste;
|
use paste::paste;
|
||||||
|
|
||||||
|
pub use level_entity_config::LevelEntityConfigData;
|
||||||
pub use misc_data::*;
|
pub use misc_data::*;
|
||||||
|
|
||||||
pub mod node_data;
|
pub mod node_data;
|
||||||
|
@ -10,7 +11,6 @@ pub mod pb_components;
|
||||||
pub mod text_map_data;
|
pub mod text_map_data;
|
||||||
|
|
||||||
mod misc_data;
|
mod misc_data;
|
||||||
mod level_entity_config;
|
|
||||||
|
|
||||||
#[derive(thiserror::Error, Debug)]
|
#[derive(thiserror::Error, Debug)]
|
||||||
pub enum LoadDataError {
|
pub enum LoadDataError {
|
||||||
|
@ -24,14 +24,13 @@ macro_rules! json_data {
|
||||||
($($table_type:ident;)*) => {
|
($($table_type:ident;)*) => {
|
||||||
$(paste! {
|
$(paste! {
|
||||||
mod [<$table_type:snake>];
|
mod [<$table_type:snake>];
|
||||||
|
pub use [<$table_type:snake>]::[<$table_type Data>];
|
||||||
})*
|
})*
|
||||||
|
|
||||||
$(paste! {
|
$(paste! {
|
||||||
pub mod [<$table_type:snake _data>] {
|
pub mod [<$table_type:snake _data>] {
|
||||||
pub use super::[<$table_type:snake>]::*;
|
|
||||||
|
|
||||||
use std::sync::OnceLock;
|
use std::sync::OnceLock;
|
||||||
type Data = super::[<$table_type:snake>]::[<$table_type Data>];
|
type Data = super::[<$table_type Data>];
|
||||||
pub(crate) static TABLE: OnceLock<Vec<Data>> = OnceLock::new();
|
pub(crate) static TABLE: OnceLock<Vec<Data>> = OnceLock::new();
|
||||||
|
|
||||||
pub fn iter() -> std::slice::Iter<'static, Data> {
|
pub fn iter() -> std::slice::Iter<'static, Data> {
|
||||||
|
@ -59,16 +58,15 @@ macro_rules! json_hash_table_data {
|
||||||
($($table_type:ident, $key_param:expr, $key_type:ty;)*) => {
|
($($table_type:ident, $key_param:expr, $key_type:ty;)*) => {
|
||||||
$(paste! {
|
$(paste! {
|
||||||
mod [<$table_type:snake>];
|
mod [<$table_type:snake>];
|
||||||
|
pub use [<$table_type:snake>]::[<$table_type Data>];
|
||||||
})*
|
})*
|
||||||
|
|
||||||
$(paste! {
|
$(paste! {
|
||||||
pub mod [<$table_type:snake _data>] {
|
pub mod [<$table_type:snake _data>] {
|
||||||
pub use super::[<$table_type:snake>]::*;
|
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::sync::OnceLock;
|
use std::sync::OnceLock;
|
||||||
|
|
||||||
pub(crate) type Data = super::[<$table_type:snake>]::[<$table_type Data>];
|
pub(crate) type Data = super::[<$table_type Data>];
|
||||||
pub(crate) static TABLE: OnceLock<HashMap<$key_type, Data>> = OnceLock::new();
|
pub(crate) static TABLE: OnceLock<HashMap<$key_type, Data>> = OnceLock::new();
|
||||||
|
|
||||||
pub fn iter() -> std::collections::hash_map::Iter<'static, $key_type, Data> {
|
pub fn iter() -> std::collections::hash_map::Iter<'static, $key_type, Data> {
|
||||||
|
@ -127,7 +125,6 @@ json_data! {
|
||||||
FavorLevel;
|
FavorLevel;
|
||||||
FavorStory;
|
FavorStory;
|
||||||
FavorWord;
|
FavorWord;
|
||||||
FlySkinConfig;
|
|
||||||
ForgeFormula;
|
ForgeFormula;
|
||||||
FunctionCondition;
|
FunctionCondition;
|
||||||
Gacha;
|
Gacha;
|
||||||
|
@ -141,16 +138,14 @@ json_data! {
|
||||||
LevelPlayNodeData;
|
LevelPlayNodeData;
|
||||||
LivenessTask;
|
LivenessTask;
|
||||||
LordGym;
|
LordGym;
|
||||||
ModelConfigPreload;
|
|
||||||
MonsterDetection;
|
MonsterDetection;
|
||||||
MonsterPropertyGrowth;
|
MonsterPropertyGrowth;
|
||||||
Motion;
|
Motion;
|
||||||
PhantomCustomizeItem;
|
|
||||||
PhantomItem;
|
|
||||||
QuestNodeData;
|
QuestNodeData;
|
||||||
ResonanceAmplification;
|
ResonanceAmplification;
|
||||||
ResonantChain;
|
ResonantChain;
|
||||||
RoleBreach;
|
RoleBreach;
|
||||||
|
RoleExpItem;
|
||||||
RoleInfo;
|
RoleInfo;
|
||||||
RoleLevelConsume;
|
RoleLevelConsume;
|
||||||
RolePropertyGrowth;
|
RolePropertyGrowth;
|
||||||
|
@ -164,28 +159,24 @@ json_data! {
|
||||||
WeaponLevel;
|
WeaponLevel;
|
||||||
WeaponPropertyGrowth;
|
WeaponPropertyGrowth;
|
||||||
WeaponReson;
|
WeaponReson;
|
||||||
WeaponSkin;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
json_hash_table_data! {
|
json_hash_table_data! {
|
||||||
AiBase, id, i32;
|
AiBase, id, i32;
|
||||||
AiStateMachineConfig, id, String;
|
AiStateMachineConfig, id, String;
|
||||||
BlueprintConfig, blueprint_type, String;
|
BlueprintConfig, blueprint_type, String;
|
||||||
Buff, id, i64;
|
|
||||||
DragonPool, id, i32;
|
DragonPool, id, i32;
|
||||||
DropPackage, id, i32;
|
DropPackage, id, i32;
|
||||||
RoleExpItem, id, i32;
|
|
||||||
SummonCfg, blueprint_type, String;
|
|
||||||
TemplateConfig, blueprint_type, String;
|
TemplateConfig, blueprint_type, String;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod level_entity_config_data {
|
mod level_entity_config;
|
||||||
pub use super::level_entity_config::*;
|
|
||||||
|
|
||||||
|
pub mod level_entity_config_data {
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::sync::OnceLock;
|
use std::sync::OnceLock;
|
||||||
|
|
||||||
pub(crate) type Data = LevelEntityConfigData;
|
pub(crate) type Data = super::LevelEntityConfigData;
|
||||||
pub(crate) static TABLE: OnceLock<HashMap<String, Data>> = OnceLock::new();
|
pub(crate) static TABLE: OnceLock<HashMap<String, Data>> = OnceLock::new();
|
||||||
|
|
||||||
pub fn iter() -> std::collections::hash_map::Iter<'static, String, Data> {
|
pub fn iter() -> std::collections::hash_map::Iter<'static, String, Data> {
|
||||||
|
@ -193,10 +184,7 @@ pub mod level_entity_config_data {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get(map_id: i32, entity_id: i64) -> Option<&'static Data> {
|
pub fn get(map_id: i32, entity_id: i64) -> Option<&'static Data> {
|
||||||
TABLE
|
TABLE.get().unwrap().get(&create_key_internal(map_id, entity_id))
|
||||||
.get()
|
|
||||||
.unwrap()
|
|
||||||
.get(&create_key_internal(map_id, entity_id))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
@ -219,9 +207,10 @@ fn load_json_entity_level_config_data(base_path: &str) -> Result<(), LoadDataErr
|
||||||
serde_json::from_reader::<BufReader<File>, Vec<level_entity_config_data::Data>>(reader)?
|
serde_json::from_reader::<BufReader<File>, Vec<level_entity_config_data::Data>>(reader)?
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|element| (level_entity_config_data::create_key(&element), element))
|
.map(|element| (level_entity_config_data::create_key(&element), element))
|
||||||
.collect::<std::collections::HashMap<_, _>>(),
|
.collect::<std::collections::HashMap<_, _>>()
|
||||||
);
|
);
|
||||||
tracing::info!("Loading data finished: {path}");
|
tracing::info!("Loading data finished: {path}");
|
||||||
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
|
@ -1,4 +1,8 @@
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
use serde_repr::Deserialize_repr;
|
||||||
|
|
||||||
|
use crate::pb_components::action::Action;
|
||||||
|
use crate::pb_components::condition::Condition;
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(rename_all = "PascalCase")]
|
#[serde(rename_all = "PascalCase")]
|
||||||
|
@ -48,9 +52,455 @@ 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)]
|
#[derive(Debug, Deserialize, Clone)]
|
||||||
#[serde(rename_all = "PascalCase")]
|
#[serde(rename_all = "PascalCase")]
|
||||||
pub struct ConsumeItem {
|
pub struct ConsumeItem {
|
||||||
pub item_id: i32,
|
pub item_id: i32,
|
||||||
pub count: 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>,
|
||||||
|
}
|
|
@ -1,25 +0,0 @@
|
||||||
use serde::Deserialize;
|
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
|
||||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
|
||||||
#[serde(rename_all = "PascalCase")]
|
|
||||||
pub struct ModelConfigPreloadData {
|
|
||||||
pub id: i32,
|
|
||||||
pub actor_class_path: String,
|
|
||||||
#[cfg(feature = "strict_json_fields")]
|
|
||||||
pub actor_class: Vec<String>,
|
|
||||||
#[cfg(feature = "strict_json_fields")]
|
|
||||||
pub animations: Vec<String>,
|
|
||||||
#[cfg(feature = "strict_json_fields")]
|
|
||||||
pub effects: Vec<String>,
|
|
||||||
#[cfg(feature = "strict_json_fields")]
|
|
||||||
pub audios: Vec<String>,
|
|
||||||
#[cfg(feature = "strict_json_fields")]
|
|
||||||
pub meshes: Vec<String>,
|
|
||||||
#[cfg(feature = "strict_json_fields")]
|
|
||||||
pub materials: Vec<String>,
|
|
||||||
#[cfg(feature = "strict_json_fields")]
|
|
||||||
pub animation_blueprints: Vec<String>,
|
|
||||||
#[cfg(feature = "strict_json_fields")]
|
|
||||||
pub others: Vec<String>,
|
|
||||||
}
|
|
|
@ -1097,7 +1097,6 @@ pub enum VehicleType {
|
||||||
FishingBoat,
|
FishingBoat,
|
||||||
Gongduola,
|
Gongduola,
|
||||||
Appointed(AppointedVehicleType),
|
Appointed(AppointedVehicleType),
|
||||||
Current,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, Clone)]
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
|
@ -1216,7 +1215,6 @@ pub enum SystemType {
|
||||||
ConfirmBox(SystemTypeConfirmBox),
|
ConfirmBox(SystemTypeConfirmBox),
|
||||||
FishingItemDelivery(SystemTypeFishingItemDelivery),
|
FishingItemDelivery(SystemTypeFishingItemDelivery),
|
||||||
SoaringChallenge(SystemTypeSoaringChallenge),
|
SoaringChallenge(SystemTypeSoaringChallenge),
|
||||||
ConfirmBox2, // TODO:
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, Clone)]
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
|
@ -1441,7 +1439,6 @@ pub enum GameplayConfig {
|
||||||
FishingRoulette,
|
FishingRoulette,
|
||||||
DaolingAuthentication,
|
DaolingAuthentication,
|
||||||
SundialPuzzle,
|
SundialPuzzle,
|
||||||
TuningStand,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, Clone)]
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
|
@ -1763,35 +1760,6 @@ pub struct RemoveTrialCharacter {
|
||||||
pub character_group: Vec<i64>,
|
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)]
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
||||||
#[serde(rename_all = "PascalCase")]
|
#[serde(rename_all = "PascalCase")]
|
||||||
|
@ -2383,30 +2351,6 @@ pub struct RequestSystemFunction {
|
||||||
pub config: serde_json::Value,
|
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)]
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
#[serde(tag = "Name")]
|
#[serde(tag = "Name")]
|
||||||
pub enum Action {
|
pub enum Action {
|
||||||
|
@ -2521,8 +2465,6 @@ pub enum Action {
|
||||||
RemoveTrialFollowShooter(ActionFields<RemoveTrialFollowShooter>),
|
RemoveTrialFollowShooter(ActionFields<RemoveTrialFollowShooter>),
|
||||||
AddTrialCharacter(ActionFields<AddTrialCharacter>),
|
AddTrialCharacter(ActionFields<AddTrialCharacter>),
|
||||||
RemoveTrialCharacter(ActionFields<RemoveTrialCharacter>),
|
RemoveTrialCharacter(ActionFields<RemoveTrialCharacter>),
|
||||||
UpdateTrialCharacter(ActionFields<UpdateTrialCharacter>),
|
|
||||||
RestoreTrialCharacter(ActionFields<RestoreTrialCharacter>),
|
|
||||||
SetAreaState(ActionFields<SetAreaState>),
|
SetAreaState(ActionFields<SetAreaState>),
|
||||||
SwitchSubLevels(ActionFields<SwitchSubLevels>),
|
SwitchSubLevels(ActionFields<SwitchSubLevels>),
|
||||||
ChangeTeamPosition(ActionFields<ChangeTeamPosition>),
|
ChangeTeamPosition(ActionFields<ChangeTeamPosition>),
|
||||||
|
@ -2596,9 +2538,6 @@ pub enum Action {
|
||||||
StopUiScreenEffect(ActionFields<StopUiScreenEffect>),
|
StopUiScreenEffect(ActionFields<StopUiScreenEffect>),
|
||||||
StopNewMoveWithSpline(ActionFields<StopNewMoveWithSpline>),
|
StopNewMoveWithSpline(ActionFields<StopNewMoveWithSpline>),
|
||||||
RequestSystemFunction(ActionFields<RequestSystemFunction>),
|
RequestSystemFunction(ActionFields<RequestSystemFunction>),
|
||||||
SetTimeScale(ActionFields<SetTimeScale>),
|
|
||||||
EndCommonTip(ActionFields<EndCommonTip>),
|
|
||||||
SetupMoraleSystem(ActionFields<SetupMoraleSystem>),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, Clone)]
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
|
|
|
@ -336,7 +336,6 @@ pub enum VehicleType {
|
||||||
FishingBoat,
|
FishingBoat,
|
||||||
Gongduola,
|
Gongduola,
|
||||||
SceneItemAutoMoveVehicle,
|
SceneItemAutoMoveVehicle,
|
||||||
CoBathingEmptyVehicle,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, Clone)]
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
|
@ -1199,24 +1198,6 @@ pub struct CheckDangoCultivationProgress {
|
||||||
pub UiType: serde_json::Value,
|
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)]
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
#[serde(tag = "Type")]
|
#[serde(tag = "Type")]
|
||||||
pub enum Condition {
|
pub enum Condition {
|
||||||
|
@ -1324,8 +1305,6 @@ pub enum Condition {
|
||||||
FinishBvbChallenge(FinishBvbChallenge),
|
FinishBvbChallenge(FinishBvbChallenge),
|
||||||
CompareActorVar(CompareActorVar),
|
CompareActorVar(CompareActorVar),
|
||||||
CheckDangoCultivationProgress(CheckDangoCultivationProgress),
|
CheckDangoCultivationProgress(CheckDangoCultivationProgress),
|
||||||
CheckPlayerMoraleLevelRange(CheckPlayerMoraleLevelRange),
|
|
||||||
ProgramSpecialProcess(ProgramSpecialProcess),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, Clone)]
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
|
|
|
@ -9,7 +9,6 @@ pub mod condition;
|
||||||
pub mod entity_state;
|
pub mod entity_state;
|
||||||
pub mod flow;
|
pub mod flow;
|
||||||
pub mod interact;
|
pub mod interact;
|
||||||
pub mod model;
|
|
||||||
pub mod monster;
|
pub mod monster;
|
||||||
pub mod option;
|
pub mod option;
|
||||||
pub mod reward;
|
pub mod reward;
|
||||||
|
@ -70,7 +69,8 @@ pub struct ComponentsData {
|
||||||
pub guide_line_creator_component: Option<serde_json::Value>,
|
pub guide_line_creator_component: Option<serde_json::Value>,
|
||||||
#[cfg(feature = "strict_json_fields")]
|
#[cfg(feature = "strict_json_fields")]
|
||||||
pub photo_target_component: Option<serde_json::Value>,
|
pub photo_target_component: Option<serde_json::Value>,
|
||||||
pub model_component: Option<model::ModelComponent>,
|
#[cfg(feature = "strict_json_fields")]
|
||||||
|
pub model_component: Option<serde_json::Value>,
|
||||||
#[cfg(feature = "strict_json_fields")]
|
#[cfg(feature = "strict_json_fields")]
|
||||||
pub entity_group_component: Option<serde_json::Value>,
|
pub entity_group_component: Option<serde_json::Value>,
|
||||||
#[cfg(feature = "strict_json_fields")]
|
#[cfg(feature = "strict_json_fields")]
|
||||||
|
@ -222,51 +222,14 @@ pub struct ComponentsData {
|
||||||
impl ComponentsData {
|
impl ComponentsData {
|
||||||
pub fn merge_with_template(&self, template: &Self) -> Self {
|
pub fn merge_with_template(&self, template: &Self) -> Self {
|
||||||
Self {
|
Self {
|
||||||
base_info_component: self
|
base_info_component: self.base_info_component.as_ref().or(template.base_info_component.as_ref()).cloned(),
|
||||||
.base_info_component
|
ai_component: self.ai_component.as_ref().or(template.ai_component.as_ref()).cloned(),
|
||||||
.as_ref()
|
attribute_component: self.attribute_component.as_ref().or(template.attribute_component.as_ref()).cloned(),
|
||||||
.or(template.base_info_component.as_ref())
|
teleport_component: self.teleport_component.as_ref().or(template.teleport_component.as_ref()).cloned(),
|
||||||
.cloned(),
|
monster_component: self.monster_component.as_ref().or(template.monster_component.as_ref()).cloned(),
|
||||||
ai_component: self
|
interact_component: self.interact_component.as_ref().or(template.interact_component.as_ref()).cloned(),
|
||||||
.ai_component
|
entity_state_component: self.entity_state_component.as_ref().or(template.entity_state_component.as_ref()).cloned(),
|
||||||
.as_ref()
|
reward_component: self.reward_component.as_ref().or(template.reward_component.as_ref()).cloned(),
|
||||||
.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(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,85 +0,0 @@
|
||||||
use serde::Deserialize;
|
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, Clone)]
|
|
||||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
|
||||||
#[serde(rename_all = "PascalCase")]
|
|
||||||
pub struct 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 track_height: Option<i32>,
|
|
||||||
pub disabled: Option<bool>,
|
|
||||||
pub model_type: Option<ModelType>,
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
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,
|
|
||||||
}
|
|
|
@ -1,58 +0,0 @@
|
||||||
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,
|
|
||||||
}
|
|
|
@ -77,6 +77,7 @@ pub struct RoleSkinData {
|
||||||
pub ui_mesh_id: i32,
|
pub ui_mesh_id: i32,
|
||||||
#[cfg(feature = "strict_json_fields")]
|
#[cfg(feature = "strict_json_fields")]
|
||||||
pub role_body: String,
|
pub role_body: String,
|
||||||
|
#[cfg(feature = "strict_json_fields")]
|
||||||
#[serde(rename = "UiScenePerformanceABP")]
|
#[serde(rename = "UiScenePerformanceABP")]
|
||||||
pub ui_scene_performance_abp: String,
|
pub ui_scene_performance_abp: String,
|
||||||
#[cfg(feature = "strict_json_fields")]
|
#[cfg(feature = "strict_json_fields")]
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
use serde::Deserialize;
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
|
||||||
#[cfg_attr(feature = "strict_json_fields", serde(deny_unknown_fields))]
|
|
||||||
#[serde(rename_all = "PascalCase")]
|
|
||||||
pub struct SummonCfgData {
|
|
||||||
pub id: i32,
|
|
||||||
pub blueprint_type: String,
|
|
||||||
#[cfg(feature = "strict_json_fields")]
|
|
||||||
pub name: String,
|
|
||||||
pub born_buff_id: Vec<i64>,
|
|
||||||
}
|
|
|
@ -1,54 +0,0 @@
|
||||||
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
|
quadrant_size = 1000000
|
||||||
|
|
||||||
[asset_config]
|
[asset_config]
|
||||||
asset_url = "https://git.xeondev.com/wickedwaifus/wicked-waifus-data/releases/download/pioneer_2.5.2/bundle.zip"
|
asset_url = "https://git.xeondev.com/wickedwaifus/wicked-waifus-data/releases/download/pioneer_2.4.1/bundle.zip"
|
||||||
buffer_size = 268435456
|
buffer_size = 268435456
|
||||||
|
|
||||||
[default_unlocks]
|
[default_unlocks]
|
||||||
|
@ -28,18 +28,8 @@ unlock_all_roles_max_level = false
|
||||||
unlock_all_roles_all_sequences = false
|
unlock_all_roles_all_sequences = false
|
||||||
unlock_all_mc_elements = true
|
unlock_all_mc_elements = true
|
||||||
unlock_all_weapons = false
|
unlock_all_weapons = false
|
||||||
unlock_all_weapons_max_level = false
|
|
||||||
unlock_all_weapons_all_reson = false
|
|
||||||
unlock_all_adventures = false
|
unlock_all_adventures = false
|
||||||
unlock_all_functions = true
|
unlock_all_functions = true
|
||||||
unlock_all_guides = false
|
unlock_all_guides = false
|
||||||
unlock_all_tutorials = false
|
unlock_all_tutorials = false
|
||||||
unlock_all_teleporter = 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,96 +0,0 @@
|
||||||
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();
|
|
|
@ -1,41 +0,0 @@
|
||||||
const UE = require("ue"),
|
|
||||||
Info_1 = require("../../../Core/Common/Info"),
|
|
||||||
MathUtils_1 = require("../../../Core/Utils/MathUtils"),
|
|
||||||
EventDefine_1 = require("../../Common/Event/EventDefine"),
|
|
||||||
EventSystem_1 = require("../../Common/Event/EventSystem"),
|
|
||||||
UiControllerBase_1 = require("../../Ui/Base/UiControllerBase"),
|
|
||||||
UiLayerType_1 = require("../../Ui/Define/UiLayerType"),
|
|
||||||
UiLayer_1 = require("../../Ui/UiLayer");
|
|
||||||
|
|
||||||
var _a = require('../Module/WaterMask/WaterMaskController').WaterMaskView;
|
|
||||||
_a.LOo = 0.18;
|
|
||||||
_a.yOo = 700;
|
|
||||||
_a.IOo = 700;
|
|
||||||
_a.vOo = function () {
|
|
||||||
void 0 !== _a.SOo && _a.EOo();
|
|
||||||
var e = UiLayer_1.UiLayer.GetLayerRootUiItem(UiLayerType_1.ELayerType.WaterMask),
|
|
||||||
t = (_a.SOo = UE.KuroActorManager.SpawnActor(Info_1.Info.World, UE.UIContainerActor.StaticClass(),
|
|
||||||
MathUtils_1.MathUtils.DefaultTransform, void 0), _a.SOo.RootComponent),
|
|
||||||
e = (t.SetDisplayName("WaterMaskContainer"), UE.KuroStaticLibrary.SetActorPermanent(_a.SOo, !0, !0), _a.SOo
|
|
||||||
.K2_AttachRootComponentTo(e), t.GetRootCanvas().GetOwner().RootComponent),
|
|
||||||
i = e.widget.width % _a.yOo / 2,
|
|
||||||
r = e.widget.height % _a.IOo / 2,
|
|
||||||
n = e.widget.width / 2,
|
|
||||||
_ = e.widget.height / 2,
|
|
||||||
s = Math.ceil(e.widget.width / _a.yOo),
|
|
||||||
o = Math.ceil(e.widget.height / _a.IOo),
|
|
||||||
v = "{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
|
|
||||||
.MathUtils.DefaultTransform, void 0),
|
|
||||||
U = E.RootComponent,
|
|
||||||
U = (E.K2_AttachRootComponentTo(t), U.SetDisplayName("WaterMaskText"), E.GetComponentByClass(UE
|
|
||||||
.UIText.StaticClass()));
|
|
||||||
U.SetFontSize(_a.vFt), U.SetOverflowType(0), U.SetAlpha(_a.LOo), U.SetFont(UE.LGUIFontData
|
|
||||||
.GetDefaultFont()), U.SetText(v), U.SetUIRelativeLocation(new UE.Vector(a * _a.yOo - n + i, e *
|
|
||||||
_a.IOo - _ + r, 0)), U.SetUIRelativeRotation(new UE.Rotator(0, _a.TOo, 0)), UE.KuroStaticLibrary
|
|
||||||
.SetActorPermanent(E, !0, !0)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
_a.vOo();
|
|
|
@ -37,20 +37,12 @@ pub struct DefaultUnlocks {
|
||||||
pub unlock_all_roles_max_level: bool,
|
pub unlock_all_roles_max_level: bool,
|
||||||
pub unlock_all_roles_all_sequences: bool,
|
pub unlock_all_roles_all_sequences: bool,
|
||||||
pub unlock_all_mc_elements: bool,
|
pub unlock_all_mc_elements: bool,
|
||||||
pub unlock_all_weapons: bool,
|
pub unlock_all_weapons: bool, // TODO:
|
||||||
pub unlock_all_weapons_max_level: bool,
|
|
||||||
pub unlock_all_weapons_all_reson: bool,
|
|
||||||
pub unlock_all_adventures: bool,
|
pub unlock_all_adventures: bool,
|
||||||
pub unlock_all_functions: bool,
|
pub unlock_all_functions: bool,
|
||||||
pub unlock_all_guides: bool,
|
pub unlock_all_guides: bool,
|
||||||
pub unlock_all_tutorials: bool,
|
pub unlock_all_tutorials: bool,
|
||||||
pub unlock_all_teleporter: 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 {
|
impl TomlConfig for ServiceConfig {
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
|
use wicked_waifus_data::BasePropertyData;
|
||||||
use wicked_waifus_protocol::{
|
use wicked_waifus_protocol::{
|
||||||
entity_component_pb::ComponentPb, AttrData, AttributeComponentPb, EAttributeType,
|
entity_component_pb::ComponentPb, AttrData, AttributeComponentPb, EAttributeType,
|
||||||
EntityComponentPb, LivingStatus,
|
EntityComponentPb, LivingStatus,
|
||||||
};
|
};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use wicked_waifus_data::base_property_data::BasePropertyData;
|
|
||||||
use crate::logic::ecs::component::Component;
|
use crate::logic::ecs::component::Component;
|
||||||
use crate::logic::utils::load_role_info::attribute_from_data;
|
use crate::logic::utils::load_role_info::attribute_from_data;
|
||||||
|
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
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::{DFsm, DFsmBlackBoard, EntityComponentPb, EntityFsmComponentPb, FsmCustomBlackboardDatas};
|
||||||
use wicked_waifus_protocol::entity_component_pb::ComponentPb;
|
use wicked_waifus_protocol::entity_component_pb::ComponentPb;
|
||||||
|
|
||||||
use wicked_waifus_data::{ai_base_data, ai_state_machine_config_data};
|
use wicked_waifus_data::{ai_base_data, ai_state_machine_config_data, AiStateMachineConfigData, StateMachineJson, StateMachineNode, StateMachineNodeCommon};
|
||||||
use wicked_waifus_data::ai_state_machine_config_data::{AiStateMachineConfigData, StateMachineJson, StateMachineNode, StateMachineNodeCommon};
|
|
||||||
use crate::logic::ecs::component::Component;
|
use crate::logic::ecs::component::Component;
|
||||||
|
|
||||||
static COMMON_FSM: OnceLock<AiStateMachineConfigData> = OnceLock::new();
|
static COMMON_FSM: OnceLock<AiStateMachineConfigData> = OnceLock::new();
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
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,13 +1,11 @@
|
||||||
mod attribute;
|
mod attribute;
|
||||||
mod autonomous;
|
mod autonomous;
|
||||||
mod character_attach;
|
|
||||||
mod concomitant;
|
mod concomitant;
|
||||||
mod entity_config;
|
mod entity_config;
|
||||||
mod equip;
|
mod equip;
|
||||||
mod fight_buff;
|
mod fight_buff;
|
||||||
mod fsm;
|
mod fsm;
|
||||||
mod interact;
|
mod interact;
|
||||||
mod logic_state;
|
|
||||||
mod monster_ai;
|
mod monster_ai;
|
||||||
mod movement;
|
mod movement;
|
||||||
mod owner_player;
|
mod owner_player;
|
||||||
|
@ -21,18 +19,15 @@ mod summoner;
|
||||||
mod tag;
|
mod tag;
|
||||||
mod visibility;
|
mod visibility;
|
||||||
mod vision_skill;
|
mod vision_skill;
|
||||||
mod weapon_skin;
|
|
||||||
|
|
||||||
pub use attribute::Attribute;
|
pub use attribute::Attribute;
|
||||||
pub use autonomous::Autonomous;
|
pub use autonomous::Autonomous;
|
||||||
pub use character_attach::CharacterAttach;
|
|
||||||
pub use concomitant::Concomitant;
|
pub use concomitant::Concomitant;
|
||||||
pub use entity_config::EntityConfig;
|
pub use entity_config::EntityConfig;
|
||||||
pub use equip::Equip;
|
pub use equip::Equip;
|
||||||
pub use fight_buff::FightBuff;
|
pub use fight_buff::FightBuff;
|
||||||
pub use fsm::Fsm;
|
pub use fsm::Fsm;
|
||||||
pub use interact::Interact;
|
pub use interact::Interact;
|
||||||
pub use logic_state::LogicState;
|
|
||||||
pub use monster_ai::MonsterAi;
|
pub use monster_ai::MonsterAi;
|
||||||
pub use movement::Movement;
|
pub use movement::Movement;
|
||||||
pub use owner_player::OwnerPlayer;
|
pub use owner_player::OwnerPlayer;
|
||||||
|
@ -46,4 +41,3 @@ pub use summoner::Summoner;
|
||||||
pub use tag::Tag;
|
pub use tag::Tag;
|
||||||
pub use visibility::Visibility;
|
pub use visibility::Visibility;
|
||||||
pub use vision_skill::VisionSkill;
|
pub use vision_skill::VisionSkill;
|
||||||
pub use weapon_skin::WeaponSkin;
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ use wicked_waifus_protocol::entity_component_pb::ComponentPb;
|
||||||
use crate::logic::ecs::component::Component;
|
use crate::logic::ecs::component::Component;
|
||||||
|
|
||||||
pub struct Summoner {
|
pub struct Summoner {
|
||||||
pub summoner_id: i64,
|
|
||||||
pub summon_cfg_id: i32,
|
pub summon_cfg_id: i32,
|
||||||
pub summon_skill_id: i32,
|
pub summon_skill_id: i32,
|
||||||
pub summon_type: i32,
|
pub summon_type: i32,
|
||||||
|
@ -14,7 +13,7 @@ impl Component for Summoner {
|
||||||
fn set_pb_data(&self, pb: &mut wicked_waifus_protocol::EntityPb) {
|
fn set_pb_data(&self, pb: &mut wicked_waifus_protocol::EntityPb) {
|
||||||
pb.component_pbs.push(EntityComponentPb {
|
pb.component_pbs.push(EntityComponentPb {
|
||||||
component_pb: Some(ComponentPb::SummonerComponent(SummonerComponentPb {
|
component_pb: Some(ComponentPb::SummonerComponent(SummonerComponentPb {
|
||||||
summoner_id: self.summoner_id,
|
summoner_id: pb.id + 1,
|
||||||
summon_cfg_id: self.summon_cfg_id,
|
summon_cfg_id: self.summon_cfg_id,
|
||||||
summon_skill_id: self.summon_skill_id,
|
summon_skill_id: self.summon_skill_id,
|
||||||
player_id: pb.player_id,
|
player_id: pb.player_id,
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
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,
|
|
||||||
})),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -23,30 +23,27 @@ macro_rules! impl_component_container {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_component_container! {
|
impl_component_container! {
|
||||||
Attribute;
|
|
||||||
Autonomous;
|
|
||||||
CharacterAttach;
|
|
||||||
Concomitant;
|
|
||||||
EntityConfig;
|
|
||||||
Equip;
|
|
||||||
FightBuff;
|
|
||||||
Fsm;
|
|
||||||
Interact;
|
|
||||||
LogicState;
|
|
||||||
MonsterAi;
|
|
||||||
Movement;
|
|
||||||
OwnerPlayer;
|
|
||||||
ParaglidingSkin;
|
|
||||||
PlayerOwnedEntityMarker;
|
|
||||||
Position;
|
Position;
|
||||||
RoleSkin;
|
EntityConfig;
|
||||||
SoarWingSkin;
|
OwnerPlayer;
|
||||||
StateTag;
|
|
||||||
Summoner;
|
|
||||||
Tag;
|
|
||||||
Visibility;
|
Visibility;
|
||||||
|
Attribute;
|
||||||
|
PlayerOwnedEntityMarker;
|
||||||
|
Movement;
|
||||||
|
Equip;
|
||||||
VisionSkill;
|
VisionSkill;
|
||||||
WeaponSkin;
|
MonsterAi;
|
||||||
|
Fsm;
|
||||||
|
RoleSkin;
|
||||||
|
FightBuff;
|
||||||
|
StateTag;
|
||||||
|
Tag;
|
||||||
|
Autonomous;
|
||||||
|
Interact;
|
||||||
|
Concomitant;
|
||||||
|
Summoner;
|
||||||
|
SoarWingSkin;
|
||||||
|
ParaglidingSkin;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Component {
|
pub trait Component {
|
||||||
|
|
|
@ -25,8 +25,8 @@ macro_rules! find_component {
|
||||||
// Query specified components from all entities (and)
|
// Query specified components from all entities (and)
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! query_with {
|
macro_rules! query_with {
|
||||||
($world_entities:expr, $($comp:ident),*) => {
|
($world_entitys:expr, $($comp:ident),*) => {
|
||||||
$world_entities.components().iter().filter(|(_, comps)| {
|
$world_entitys.components().iter().filter(|(_, comps)| {
|
||||||
$(comps.iter().any(|comp| matches!(&*comp.borrow(), ComponentContainer::$comp(_))) && )
|
$(comps.iter().any(|comp| matches!(&*comp.borrow(), ComponentContainer::$comp(_))) && )
|
||||||
* true
|
* true
|
||||||
})
|
})
|
||||||
|
@ -44,8 +44,8 @@ macro_rules! query_with {
|
||||||
// Query specified components from all entities (or)
|
// Query specified components from all entities (or)
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! query_hn_with {
|
macro_rules! query_hn_with {
|
||||||
($world_entities:expr, $($comp:ident),*) => {
|
($world_entitys:expr, $($comp:ident),*) => {
|
||||||
$world_entities.components().iter().filter(|(_, comps)| {
|
$world_entitys.components().iter().filter(|(_, comps)| {
|
||||||
$(comps.iter().any(|comp| matches!(&*comp.borrow(), ComponentContainer::$comp(_))) || )
|
$(comps.iter().any(|comp| matches!(&*comp.borrow(), ComponentContainer::$comp(_))) || )
|
||||||
* false
|
* false
|
||||||
})
|
})
|
||||||
|
@ -70,8 +70,8 @@ macro_rules! ident_as_none {
|
||||||
// Query components of specified entity
|
// Query components of specified entity
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! query_components {
|
macro_rules! query_components {
|
||||||
($world_entities:expr, $entity_id:expr, $($comp:ident),*) => {
|
($world_entitys:expr, $entity_id:expr, $($comp:ident),*) => {
|
||||||
$world_entities.components().iter().find(|(id, _)| $entity_id == i64::from(**id))
|
$world_entitys.components().iter().find(|(id, _)| $entity_id == i64::from(**id))
|
||||||
.map(|(_, comps)| {
|
.map(|(_, comps)| {
|
||||||
($(
|
($(
|
||||||
$crate::find_component!(comps, $comp),
|
$crate::find_component!(comps, $comp),
|
||||||
|
|
|
@ -7,7 +7,6 @@ use std::collections::hash_map::{Keys, Values};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use wicked_waifus_protocol::FightBuffInformation;
|
use wicked_waifus_protocol::FightBuffInformation;
|
||||||
|
|
||||||
#[derive(Default)]
|
|
||||||
pub struct WorldEntity {
|
pub struct WorldEntity {
|
||||||
components: HashMap<i32, Vec<RefCell<ComponentContainer>>>,
|
components: HashMap<i32, Vec<RefCell<ComponentContainer>>>,
|
||||||
entity_manager: EntityManager,
|
entity_manager: EntityManager,
|
||||||
|
@ -16,7 +15,7 @@ pub struct WorldEntity {
|
||||||
|
|
||||||
pub struct World {
|
pub struct World {
|
||||||
pub player_cur_map_id: i32,
|
pub player_cur_map_id: i32,
|
||||||
pub world_entities: HashMap<i32, WorldEntity>, // i32 -> map_id
|
pub world_entitys: HashMap<i32, WorldEntity>, // i32 -> map_id
|
||||||
pub in_world_players: HashMap<i32, InWorldPlayer>, // joined players metadata
|
pub in_world_players: HashMap<i32, InWorldPlayer>, // joined players metadata
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +23,7 @@ impl World {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
player_cur_map_id: 8,
|
player_cur_map_id: 8,
|
||||||
world_entities: HashMap::new(),
|
world_entitys: HashMap::new(),
|
||||||
in_world_players: HashMap::new(),
|
in_world_players: HashMap::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,13 +42,13 @@ impl World {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_mut_world_entity(&mut self) -> &mut WorldEntity {
|
pub fn get_mut_world_entity(&mut self) -> &mut WorldEntity {
|
||||||
self.world_entities
|
self.world_entitys
|
||||||
.get_mut(&self.player_cur_map_id)
|
.get_mut(&self.player_cur_map_id)
|
||||||
.unwrap_or_else(|| panic!("Failed to get cur map data: {}", 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 {
|
pub fn get_world_entity(&self) -> &WorldEntity {
|
||||||
self.world_entities
|
self.world_entitys
|
||||||
.get(&self.player_cur_map_id)
|
.get(&self.player_cur_map_id)
|
||||||
.unwrap_or_else(|| panic!("Failed to get cur map data: {}", self.player_cur_map_id))
|
.unwrap_or_else(|| panic!("Failed to get cur map data: {}", self.player_cur_map_id))
|
||||||
}
|
}
|
||||||
|
@ -65,7 +64,7 @@ impl WorldEntity {
|
||||||
entity,
|
entity,
|
||||||
self.components
|
self.components
|
||||||
.entry(entity.entity_id)
|
.entry(entity.entity_id)
|
||||||
.or_default(),
|
.or_insert(Vec::new()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,3 +115,13 @@ impl WorldEntity {
|
||||||
self.buff_manager.create_permanent_buffs(entity_id)
|
self.buff_manager.create_permanent_buffs(entity_id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for WorldEntity {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
components: HashMap::new(),
|
||||||
|
entity_manager: EntityManager::default(),
|
||||||
|
buff_manager: BufManager::default(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -2,10 +2,10 @@ use rand::prelude::IndexedRandom;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use wicked_waifus_protocol::{ErrorCode, GachaResult, GachaReward};
|
use wicked_waifus_protocol::{ErrorCode, GachaResult, GachaReward};
|
||||||
|
|
||||||
use wicked_waifus_data::gacha_view_info_data::GachaViewTypeInfoId::{
|
use wicked_waifus_data::GachaViewTypeInfoId::{
|
||||||
AnniversaryResonatorConvene, AnniversaryWeaponConvene, BeginnersChoiceConvene,
|
BeginnersChoiceConvene, FeaturedResonatorConvene, FeaturedWeaponConvene,
|
||||||
FeaturedResonatorConvene, FeaturedWeaponConvene, NewVoyageResonatorConvene,
|
MultipleChoiceResonatorConvene, MultipleChoiceWeaponConvene, NoviceConvene,
|
||||||
NewVoyageWeaponConvene, NoviceConvene, StandardResonatorConvene, StandardWeaponConvene,
|
StandardResonatorConvene, StandardWeaponConvene,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::logic::gacha::pool_info::PoolInfo;
|
use crate::logic::gacha::pool_info::PoolInfo;
|
||||||
|
@ -113,16 +113,7 @@ impl GachaPool {
|
||||||
match player.role_list.get(&item_id) {
|
match player.role_list.get(&item_id) {
|
||||||
None => {
|
None => {
|
||||||
if required_role_ids.contains(&item_id) {
|
if required_role_ids.contains(&item_id) {
|
||||||
let role = Role::new(item_id);
|
player.role_list.insert(item_id, 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) => {
|
Some(role) => {
|
||||||
|
@ -154,15 +145,13 @@ impl GachaPool {
|
||||||
},
|
},
|
||||||
2 => match self.info.pool_type {
|
2 => match self.info.pool_type {
|
||||||
NoviceConvene | StandardResonatorConvene => &[1405, 1301, 1503, 1104, 1203],
|
NoviceConvene | StandardResonatorConvene => &[1405, 1301, 1503, 1104, 1203],
|
||||||
// TODO: Review MultipleChoiceConvene(anniversary and new voyage)
|
// TODO: Review MultipleChoiceConvene
|
||||||
FeaturedResonatorConvene
|
FeaturedResonatorConvene
|
||||||
| FeaturedWeaponConvene
|
| FeaturedWeaponConvene
|
||||||
| StandardWeaponConvene
|
| StandardWeaponConvene
|
||||||
| BeginnersChoiceConvene
|
| BeginnersChoiceConvene
|
||||||
| AnniversaryResonatorConvene
|
| MultipleChoiceResonatorConvene
|
||||||
| AnniversaryWeaponConvene
|
| MultipleChoiceWeaponConvene => &self.info.rate_up_five_star[..],
|
||||||
| NewVoyageResonatorConvene
|
|
||||||
| NewVoyageWeaponConvene => &self.info.rate_up_five_star[..],
|
|
||||||
},
|
},
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
use std::time::SystemTime;
|
use std::time::SystemTime;
|
||||||
|
|
||||||
use wicked_waifus_data::gacha_view_info_data::GachaViewTypeInfoId;
|
use wicked_waifus_data::GachaViewTypeInfoId;
|
||||||
use wicked_waifus_data::gacha_view_info_data::GachaViewTypeInfoId::{
|
use wicked_waifus_data::GachaViewTypeInfoId::{
|
||||||
AnniversaryResonatorConvene, AnniversaryWeaponConvene, BeginnersChoiceConvene,
|
BeginnersChoiceConvene, FeaturedResonatorConvene, FeaturedWeaponConvene,
|
||||||
FeaturedResonatorConvene, FeaturedWeaponConvene, NewVoyageResonatorConvene,
|
MultipleChoiceResonatorConvene, MultipleChoiceWeaponConvene, NoviceConvene,
|
||||||
NewVoyageWeaponConvene, NoviceConvene, StandardResonatorConvene, StandardWeaponConvene,
|
StandardResonatorConvene, StandardWeaponConvene,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::logic::gacha::category::PoolCategory;
|
use crate::logic::gacha::category::PoolCategory;
|
||||||
|
@ -78,14 +78,11 @@ impl PoolInfo {
|
||||||
StandardResonatorConvene | StandardWeaponConvene => {
|
StandardResonatorConvene | StandardWeaponConvene => {
|
||||||
(50001, 0, 80, PitySystem::default())
|
(50001, 0, 80, PitySystem::default())
|
||||||
}
|
}
|
||||||
// TODO: Review MultipleChoiceConvene(anniversary and new voyage)
|
// TODO: Review MultipleChoiceConvene
|
||||||
FeaturedResonatorConvene | AnniversaryResonatorConvene | NewVoyageResonatorConvene => {
|
FeaturedResonatorConvene
|
||||||
(50002, 0, 0, PitySystem::default())
|
| MultipleChoiceResonatorConvene
|
||||||
}
|
| MultipleChoiceWeaponConvene => (50002, 0, 0, PitySystem::default()),
|
||||||
// TODO: Review MultipleChoiceConvene(anniversary and new voyage)
|
FeaturedWeaponConvene => (50005, 0, 0, PitySystem::default()),
|
||||||
FeaturedWeaponConvene | AnniversaryWeaponConvene | NewVoyageWeaponConvene => {
|
|
||||||
(50005, 0, 0, PitySystem::default())
|
|
||||||
}
|
|
||||||
BeginnersChoiceConvene => match pool_id {
|
BeginnersChoiceConvene => match pool_id {
|
||||||
51..56 => (50006, 0, 1, PitySystem::default()),
|
51..56 => (50006, 0, 1, PitySystem::default()),
|
||||||
_ => (50001, 0, 80, PitySystem::default()),
|
_ => (50001, 0, 80, PitySystem::default()),
|
||||||
|
|
|
@ -5,10 +5,10 @@ use rand::prelude::StdRng;
|
||||||
use rand::SeedableRng;
|
use rand::SeedableRng;
|
||||||
|
|
||||||
use wicked_waifus_data::gacha_view_info_data;
|
use wicked_waifus_data::gacha_view_info_data;
|
||||||
use wicked_waifus_data::gacha_view_info_data::GachaViewTypeInfoId::{
|
use wicked_waifus_data::GachaViewTypeInfoId::{
|
||||||
AnniversaryResonatorConvene, AnniversaryWeaponConvene, BeginnersChoiceConvene,
|
BeginnersChoiceConvene, FeaturedResonatorConvene, FeaturedWeaponConvene,
|
||||||
FeaturedResonatorConvene, FeaturedWeaponConvene, NewVoyageResonatorConvene,
|
MultipleChoiceResonatorConvene, MultipleChoiceWeaponConvene, NoviceConvene,
|
||||||
NewVoyageWeaponConvene, NoviceConvene, StandardResonatorConvene, StandardWeaponConvene,
|
StandardResonatorConvene, StandardWeaponConvene,
|
||||||
};
|
};
|
||||||
use wicked_waifus_protocol::{ErrorCode, GachaResult};
|
use wicked_waifus_protocol::{ErrorCode, GachaResult};
|
||||||
|
|
||||||
|
@ -41,15 +41,11 @@ impl GachaService {
|
||||||
NoviceConvene | StandardResonatorConvene | StandardWeaponConvene => {
|
NoviceConvene | StandardResonatorConvene | StandardWeaponConvene => {
|
||||||
PoolCategory::Permanent
|
PoolCategory::Permanent
|
||||||
}
|
}
|
||||||
// TODO: Review MultipleChoiceConvene(anniversary and new voyage)
|
// TODO: Review MultipleChoiceConvene
|
||||||
FeaturedResonatorConvene
|
FeaturedResonatorConvene
|
||||||
| FeaturedWeaponConvene
|
| FeaturedWeaponConvene
|
||||||
| StandardWeaponConvene
|
| MultipleChoiceResonatorConvene
|
||||||
| BeginnersChoiceConvene
|
| MultipleChoiceWeaponConvene => PoolCategory::Event(Self::THREE_WEEKS),
|
||||||
| AnniversaryResonatorConvene
|
|
||||||
| AnniversaryWeaponConvene
|
|
||||||
| NewVoyageResonatorConvene
|
|
||||||
| NewVoyageWeaponConvene => PoolCategory::Event(Self::THREE_WEEKS),
|
|
||||||
BeginnersChoiceConvene => match element.id {
|
BeginnersChoiceConvene => match element.id {
|
||||||
51..56 => PoolCategory::Special(Self::ONE_WEEK),
|
51..56 => PoolCategory::Special(Self::ONE_WEEK),
|
||||||
_ => PoolCategory::Permanent,
|
_ => PoolCategory::Permanent,
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
use crate::logic::thread_mgr::NetContext;
|
|
||||||
use wicked_waifus_protocol::{AdviceSetRequest, AdviceSetResponse, ErrorCode};
|
use wicked_waifus_protocol::{AdviceSetRequest, AdviceSetResponse, ErrorCode};
|
||||||
|
use crate::logic::player::Player;
|
||||||
|
|
||||||
pub fn on_advice_set_request(
|
pub fn on_advice_set_request(
|
||||||
ctx: &mut NetContext,
|
player: &mut Player,
|
||||||
request: AdviceSetRequest,
|
request: AdviceSetRequest,
|
||||||
response: &mut AdviceSetResponse,
|
response: &mut AdviceSetResponse,
|
||||||
) {
|
) {
|
||||||
ctx.player.advise.is_show = request.is_show;
|
player.advise.is_show = request.is_show;
|
||||||
|
|
||||||
response.is_show = request.is_show;
|
response.is_show = request.is_show;
|
||||||
response.error_code = ErrorCode::Success.into();
|
response.error_code = ErrorCode::Success.into();
|
||||||
|
|
|
@ -1,21 +1,17 @@
|
||||||
use wicked_waifus_protocol::{
|
use wicked_waifus_protocol::{AnimalDestroyRequest, AnimalDestroyResponse, AnimalDieRequest, AnimalDieResponse, AnimalDropRequest, AnimalDropResponse, EEntityType, ERemoveEntityType, EntityLivingStatusNotify, ErrorCode, LivingStatus};
|
||||||
AnimalDestroyRequest, AnimalDestroyResponse, AnimalDieRequest, AnimalDieResponse,
|
|
||||||
AnimalDropRequest, AnimalDropResponse, EEntityType, ERemoveEntityType,
|
|
||||||
EntityLivingStatusNotify, ErrorCode, LivingStatus,
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::logic::ecs::component::ComponentContainer;
|
use crate::logic::ecs::component::ComponentContainer;
|
||||||
use crate::logic::thread_mgr::NetContext;
|
use crate::logic::player::Player;
|
||||||
use crate::logic::utils::world_util;
|
use crate::logic::utils::world_util;
|
||||||
use crate::query_components;
|
use crate::query_components;
|
||||||
|
|
||||||
pub fn on_animal_die_request(
|
pub fn on_animal_die_request(
|
||||||
ctx: &mut NetContext,
|
player: &mut Player,
|
||||||
request: AnimalDieRequest,
|
request: AnimalDieRequest,
|
||||||
response: &mut AnimalDieResponse,
|
response: &mut AnimalDieResponse,
|
||||||
) {
|
) {
|
||||||
tracing::warn!("AnimalDieRequest not fully implemented");
|
tracing::warn!("AnimalDieRequest not fully implemented");
|
||||||
ctx.player.notify(EntityLivingStatusNotify {
|
player.notify(EntityLivingStatusNotify {
|
||||||
id: request.entity_id,
|
id: request.entity_id,
|
||||||
living_status: LivingStatus::Dead.into(),
|
living_status: LivingStatus::Dead.into(),
|
||||||
drop_vision_item: vec![],
|
drop_vision_item: vec![],
|
||||||
|
@ -25,7 +21,7 @@ pub fn on_animal_die_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_animal_drop_request(
|
pub fn on_animal_drop_request(
|
||||||
_ctx: &mut NetContext,
|
_player: &mut Player,
|
||||||
_request: AnimalDropRequest,
|
_request: AnimalDropRequest,
|
||||||
response: &mut AnimalDropResponse,
|
response: &mut AnimalDropResponse,
|
||||||
) {
|
) {
|
||||||
|
@ -36,13 +32,15 @@ pub fn on_animal_drop_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_animal_destroy_request(
|
pub fn on_animal_destroy_request(
|
||||||
ctx: &mut NetContext,
|
player: &mut Player,
|
||||||
request: AnimalDestroyRequest,
|
request: AnimalDestroyRequest,
|
||||||
response: &mut AnimalDestroyResponse,
|
response: &mut AnimalDestroyResponse,
|
||||||
) {
|
) {
|
||||||
let entity_id = request.entity_id;
|
|
||||||
{
|
{
|
||||||
let (Some(config), ) = query_components!(ctx.world.get_world_entity(), entity_id, EntityConfig) else {
|
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 {
|
||||||
response.error_code = ErrorCode::ErrAnimalEntityNotExist.into();
|
response.error_code = ErrorCode::ErrAnimalEntityNotExist.into();
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
@ -50,7 +48,7 @@ pub fn on_animal_destroy_request(
|
||||||
response.error_code = ErrorCode::ErrNotAnimalEntity.into();
|
response.error_code = ErrorCode::ErrNotAnimalEntity.into();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
world_util::remove_entity(ctx, request.entity_id, ERemoveEntityType::RemoveTypeNormal);
|
world_util::remove_entity(player, request.entity_id, ERemoveEntityType::RemoveTypeNormal);
|
||||||
response.error_code = ErrorCode::Success.into();
|
response.error_code = ErrorCode::Success.into();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,17 @@
|
||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
|
|
||||||
use wicked_waifus_protocol::{
|
use wicked_waifus_protocol::{ErrorCode, PrivateChatDataRequest, PrivateChatDataResponse, PrivateChatHistoryRequest, PrivateChatHistoryResponse, PrivateChatOperateRequest, PrivateChatOperateResponse, PrivateChatOperateType, PrivateChatRequest, PrivateChatResponse};
|
||||||
ErrorCode, PrivateChatDataRequest, PrivateChatDataResponse, PrivateChatHistoryRequest,
|
|
||||||
PrivateChatHistoryResponse, PrivateChatOperateRequest, PrivateChatOperateResponse,
|
|
||||||
PrivateChatOperateType, PrivateChatRequest, PrivateChatResponse,
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::logic::thread_mgr::NetContext;
|
use crate::logic::player::Player;
|
||||||
|
|
||||||
pub fn on_private_chat_request(
|
pub fn on_private_chat_request(
|
||||||
ctx: &mut NetContext,
|
player: &mut Player,
|
||||||
request: PrivateChatRequest,
|
request: PrivateChatRequest,
|
||||||
response: &mut PrivateChatResponse,
|
response: &mut PrivateChatResponse,
|
||||||
) {
|
) {
|
||||||
let own_id = ctx.player.basic_info.id;
|
let own_id = player.basic_info.id;
|
||||||
// TODO: Implement block and ban checks?? Ignore them for the time being
|
// TODO: Implement block and ban checks?? Ignore them for the time being
|
||||||
let result = ctx.player.player_chat.validate_message(
|
let result = player.player_chat.validate_message(
|
||||||
own_id,
|
own_id,
|
||||||
request.target_uid,
|
request.target_uid,
|
||||||
request.chat_content_type,
|
request.chat_content_type,
|
||||||
|
@ -23,7 +19,7 @@ pub fn on_private_chat_request(
|
||||||
);
|
);
|
||||||
match result {
|
match result {
|
||||||
Ok(message) => {
|
Ok(message) => {
|
||||||
ctx.player.player_chat.add_message(own_id, message.clone());
|
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)
|
// TODO: Check how to search a player from a different world(db search or session search)
|
||||||
// let other_player = ...;
|
// let other_player = ...;
|
||||||
// let other_player_message = message.clone();
|
// let other_player_message = message.clone();
|
||||||
|
@ -41,37 +37,38 @@ 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(
|
pub fn on_private_chat_data_request(
|
||||||
_: &NetContext,
|
_: &Player,
|
||||||
_: PrivateChatDataRequest,
|
_: PrivateChatDataRequest,
|
||||||
_: &mut PrivateChatDataResponse,
|
_: &mut PrivateChatDataResponse,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_private_chat_history_request(
|
pub fn on_private_chat_history_request(
|
||||||
ctx: &NetContext,
|
player: &Player,
|
||||||
request: PrivateChatHistoryRequest,
|
request: PrivateChatHistoryRequest,
|
||||||
response: &mut PrivateChatHistoryResponse,
|
response: &mut PrivateChatHistoryResponse,
|
||||||
) {
|
) {
|
||||||
match ctx
|
match player.player_chat.build_private_chat_history_content_proto(
|
||||||
.player
|
request.target_uid,
|
||||||
.player_chat
|
request.start_index,
|
||||||
.build_private_chat_history_content_proto(request.target_uid, request.start_index)
|
) {
|
||||||
{
|
|
||||||
Ok(chat_history_content_proto) => {
|
Ok(chat_history_content_proto) => {
|
||||||
response.error_code = ErrorCode::Success.into();
|
response.error_code = ErrorCode::Success.into();
|
||||||
response.data = Some(chat_history_content_proto)
|
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(
|
pub fn on_private_chat_operate_request(
|
||||||
_ctx: &NetContext,
|
_player: &Player,
|
||||||
request: PrivateChatOperateRequest,
|
request: PrivateChatOperateRequest,
|
||||||
response: &mut PrivateChatOperateResponse,
|
response: &mut PrivateChatOperateResponse,
|
||||||
) {
|
) {
|
||||||
|
@ -81,10 +78,7 @@ pub fn on_private_chat_operate_request(
|
||||||
response.error_code = ErrorCode::Success.into();
|
response.error_code = ErrorCode::Success.into();
|
||||||
} else {
|
} else {
|
||||||
// TODO: Additional checks
|
// TODO: Additional checks
|
||||||
debug!(
|
debug!("on_private_chat_operate_request called for unimplemented case: {:?}", request);
|
||||||
"on_private_chat_operate_request called for unimplemented case: {:?}",
|
|
||||||
request
|
|
||||||
);
|
|
||||||
response.error_code = ErrorCode::Success.into();
|
response.error_code = ErrorCode::Success.into();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -5,15 +5,15 @@ use wicked_waifus_protocol::combat_message::{
|
||||||
};
|
};
|
||||||
use wicked_waifus_protocol::{
|
use wicked_waifus_protocol::{
|
||||||
AttributeChangedNotify, CombatCommon, DErrorResult, DamageExecuteRequest,
|
AttributeChangedNotify, CombatCommon, DErrorResult, DamageExecuteRequest,
|
||||||
DamageExecuteResponse, EAttributeType, ERemoveEntityType, ErrorCode, FsmConditionPassRequest,
|
DamageExecuteResponse, EAttributeType, ERemoveEntityType, ErrorCode,
|
||||||
FsmConditionPassResponse, GameplayAttributeData, PlayerBattleStateChangeNotify,
|
FsmConditionPassRequest, FsmConditionPassResponse, GameplayAttributeData,
|
||||||
SwitchRoleRequest, SwitchRoleResponse,
|
PlayerBattleStateChangeNotify, SwitchRoleRequest, SwitchRoleResponse,
|
||||||
};
|
};
|
||||||
|
|
||||||
use wicked_waifus_data::damage_data;
|
use wicked_waifus_data::damage_data;
|
||||||
|
|
||||||
use crate::logic::ecs::component::ComponentContainer;
|
use crate::logic::ecs::component::ComponentContainer;
|
||||||
use crate::logic::thread_mgr::NetContext;
|
use crate::logic::player::Player;
|
||||||
use crate::logic::utils::world_util;
|
use crate::logic::utils::world_util;
|
||||||
use crate::query_components;
|
use crate::query_components;
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ fn create_combat_notify(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_combat_message_combat_send_pack_request(
|
pub fn on_combat_message_combat_send_pack_request(
|
||||||
ctx: &mut NetContext,
|
player: &mut Player,
|
||||||
request: CombatSendPackRequest,
|
request: CombatSendPackRequest,
|
||||||
response: &mut CombatSendPackResponse,
|
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 {
|
if let Some(ref request_message) = request_data.message {
|
||||||
match request_message {
|
match request_message {
|
||||||
combat_request_data::Message::SwitchRoleRequest(ref request) => {
|
combat_request_data::Message::SwitchRoleRequest(ref request) => {
|
||||||
handle_switch_role_request(ctx, request_data, request, response);
|
handle_switch_role_request(player, request_data, request, response);
|
||||||
}
|
}
|
||||||
combat_request_data::Message::FsmConditionPassRequest(ref request) => {
|
combat_request_data::Message::FsmConditionPassRequest(ref request) => {
|
||||||
handle_fsm_condition_request(ctx, request_data, request, response);
|
handle_fsm_condition_request(player, request_data, request, response);
|
||||||
}
|
}
|
||||||
combat_request_data::Message::DamageExecuteRequest(ref request) => {
|
combat_request_data::Message::DamageExecuteRequest(ref request) => {
|
||||||
handle_damage_execute_request(ctx, request_data, request, response);
|
handle_damage_execute_request(player, request_data, request, response);
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
@ -75,18 +75,13 @@ pub fn on_combat_message_combat_send_pack_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_switch_role_request(
|
fn handle_switch_role_request(
|
||||||
ctx: &mut NetContext,
|
player: &mut Player,
|
||||||
combat_request: &CombatRequestData,
|
combat_request: &CombatRequestData,
|
||||||
request: &SwitchRoleRequest,
|
request: &SwitchRoleRequest,
|
||||||
response: &mut CombatSendPackResponse,
|
response: &mut CombatSendPackResponse,
|
||||||
) {
|
) {
|
||||||
// Find current formation and update current role
|
// Find current formation and update current role
|
||||||
if let Some(formation) = ctx
|
if let Some(formation) = player.formation_list.values_mut().find(|f| f.is_current) {
|
||||||
.player
|
|
||||||
.formation_list
|
|
||||||
.values_mut()
|
|
||||||
.find(|f| f.is_current)
|
|
||||||
{
|
|
||||||
formation.cur_role = request.role_id;
|
formation.cur_role = request.role_id;
|
||||||
|
|
||||||
let receive_pack = response
|
let receive_pack = response
|
||||||
|
@ -110,7 +105,7 @@ fn handle_switch_role_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_damage_execute_request(
|
fn handle_damage_execute_request(
|
||||||
ctx: &mut NetContext,
|
player: &mut Player,
|
||||||
combat_request: &CombatRequestData,
|
combat_request: &CombatRequestData,
|
||||||
request: &DamageExecuteRequest,
|
request: &DamageExecuteRequest,
|
||||||
response: &mut CombatSendPackResponse,
|
response: &mut CombatSendPackResponse,
|
||||||
|
@ -119,7 +114,8 @@ fn handle_damage_execute_request(
|
||||||
.receive_pack_notify
|
.receive_pack_notify
|
||||||
.get_or_insert_with(Default::default);
|
.get_or_insert_with(Default::default);
|
||||||
|
|
||||||
let world = ctx.world.get_mut_world_entity();
|
let mut world_ref = player.world.borrow_mut();
|
||||||
|
let world = world_ref.get_mut_world_entity();
|
||||||
let config_id = world.get_config_id(request.attacker_entity_id.try_into().unwrap());
|
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)
|
let mut damage = 1; // TODO: Fix the formula with real parameters(10 field equation)
|
||||||
if config_id.to_string().len() == 4 {
|
if config_id.to_string().len() == 4 {
|
||||||
|
@ -164,7 +160,6 @@ fn handle_damage_execute_request(
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
));
|
));
|
||||||
let mut entities_to_remove = Vec::new();
|
|
||||||
if let Some((value, _)) = query_components!(world, request.target_entity_id, Attribute)
|
if let Some((value, _)) = query_components!(world, request.target_entity_id, Attribute)
|
||||||
.0
|
.0
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -190,18 +185,19 @@ fn handle_damage_execute_request(
|
||||||
}),
|
}),
|
||||||
));
|
));
|
||||||
if updated_value == 0 {
|
if updated_value == 0 {
|
||||||
entities_to_remove.push(request.target_entity_id);
|
world_util::remove_entity(
|
||||||
|
player,
|
||||||
|
request.target_entity_id,
|
||||||
|
ERemoveEntityType::HpIsZero,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for entity in entities_to_remove {
|
|
||||||
world_util::remove_entity(ctx, entity, ERemoveEntityType::HpIsZero);
|
|
||||||
}
|
|
||||||
response.error_code = ErrorCode::Success.into();
|
response.error_code = ErrorCode::Success.into();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_battle(
|
fn handle_battle(
|
||||||
ctx: &mut NetContext,
|
player: &mut Player,
|
||||||
combat_request: &CombatRequestData,
|
combat_request: &CombatRequestData,
|
||||||
response: &mut CombatSendPackResponse,
|
response: &mut CombatSendPackResponse,
|
||||||
condition: bool,
|
condition: bool,
|
||||||
|
@ -213,14 +209,15 @@ fn handle_battle(
|
||||||
receive_pack.data.push(create_combat_notify(
|
receive_pack.data.push(create_combat_notify(
|
||||||
combat_request.combat_common.unwrap(),
|
combat_request.combat_common.unwrap(),
|
||||||
combat_notify_data::Message::PlayerBattleStateChangeNotify(PlayerBattleStateChangeNotify {
|
combat_notify_data::Message::PlayerBattleStateChangeNotify(PlayerBattleStateChangeNotify {
|
||||||
player_id: ctx.player.basic_info.id,
|
player_id: player.basic_info.id,
|
||||||
|
|
||||||
in_battle: condition,
|
in_battle: condition,
|
||||||
}),
|
}),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_fsm_condition_request(
|
fn handle_fsm_condition_request(
|
||||||
ctx: &mut NetContext,
|
player: &mut Player,
|
||||||
combat_request: &CombatRequestData,
|
combat_request: &CombatRequestData,
|
||||||
request: &FsmConditionPassRequest,
|
request: &FsmConditionPassRequest,
|
||||||
response: &mut CombatSendPackResponse,
|
response: &mut CombatSendPackResponse,
|
||||||
|
@ -241,5 +238,5 @@ fn handle_fsm_condition_request(
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
));
|
));
|
||||||
handle_battle(ctx, combat_request, response, true);
|
handle_battle(player, combat_request, response, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use crate::logic::thread_mgr::NetContext;
|
|
||||||
use wicked_waifus_protocol::{ErrorCode, LobbyListRequest, LobbyListResponse};
|
use wicked_waifus_protocol::{ErrorCode, LobbyListRequest, LobbyListResponse};
|
||||||
|
use crate::logic::player::Player;
|
||||||
|
|
||||||
pub fn on_lobby_list_request(
|
pub fn on_lobby_list_request(
|
||||||
_ctx: &mut NetContext,
|
_player: &mut Player,
|
||||||
request: LobbyListRequest,
|
request: LobbyListRequest,
|
||||||
response: &mut LobbyListResponse,
|
response: &mut LobbyListResponse,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::logic::thread_mgr::NetContext;
|
use crate::logic::player::Player;
|
||||||
|
|
||||||
macro_rules! dummy_handler {
|
macro_rules! dummy_handler {
|
||||||
($($type_name:ident;)*) => {
|
($($type_name:ident;)*) => {
|
||||||
|
@ -9,7 +9,7 @@ macro_rules! dummy_handler {
|
||||||
|
|
||||||
$(::paste::paste! {
|
$(::paste::paste! {
|
||||||
pub fn [<on_ $type_name:snake _request>](
|
pub fn [<on_ $type_name:snake _request>](
|
||||||
_ctx: &NetContext,
|
_player: &Player,
|
||||||
_request: [<$type_name Request>],
|
_request: [<$type_name Request>],
|
||||||
_response: &mut [<$type_name Response>],
|
_response: &mut [<$type_name Response>],
|
||||||
) {
|
) {
|
||||||
|
@ -33,6 +33,7 @@ dummy_handler! {
|
||||||
ExchangeReward;
|
ExchangeReward;
|
||||||
Liveness;
|
Liveness;
|
||||||
PhotoMemory;
|
PhotoMemory;
|
||||||
|
WeaponSkin;
|
||||||
VisionEquipGroupInfo;
|
VisionEquipGroupInfo;
|
||||||
UpdatePlayStationBlockAccount;
|
UpdatePlayStationBlockAccount;
|
||||||
AdventureManual;
|
AdventureManual;
|
||||||
|
|
|
@ -1,30 +1,24 @@
|
||||||
use wicked_waifus_protocol::{
|
use wicked_waifus_protocol::{EntityAccessInfo, EntityAccessRangeRequest, EntityAccessRangeResponse, EntityActiveRequest, EntityActiveResponse, EntityFollowTrackRequest, EntityFollowTrackResponse, EntityInteractRequest, EntityInteractResponse, EntityOnLandedRequest, EntityOnLandedResponse, EntityPb, EntityPositionRequest, EntityPositionResponse, ErrorCode, GetRewardTreasureBoxRequest, GetRewardTreasureBoxResponse, MovePackagePush};
|
||||||
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 wicked_waifus_data::pb_components::option::OptionType;
|
||||||
|
|
||||||
use crate::logic::thread_mgr::NetContext;
|
use crate::{logic, logic::ecs::component::ComponentContainer, logic::player::Player, query_components};
|
||||||
use crate::logic::utils::action_utils::perform_action;
|
use crate::logic::utils::action_utils::perform_action;
|
||||||
use crate::logic::utils::condition_utils::check_condition;
|
use crate::logic::utils::condition_utils::check_condition;
|
||||||
use crate::{logic, logic::ecs::component::ComponentContainer, query_components};
|
|
||||||
|
|
||||||
pub fn on_entity_active_request(
|
pub fn on_entity_active_request(
|
||||||
ctx: &NetContext,
|
player: &Player,
|
||||||
request: EntityActiveRequest,
|
request: EntityActiveRequest,
|
||||||
response: &mut EntityActiveResponse,
|
response: &mut EntityActiveResponse,
|
||||||
) {
|
) {
|
||||||
let world = ctx.world.get_world_entity();
|
let world_ref = player.world.borrow();
|
||||||
|
let world = world_ref.get_world_entity();
|
||||||
|
|
||||||
if !world.is_in_all_world_map(request.entity_id as i32) {
|
if !world.is_in_all_world_map(request.entity_id as i32) {
|
||||||
tracing::debug!(
|
tracing::debug!(
|
||||||
"EntityActiveRequest: entity with id {} doesn't exist, player_id: {}",
|
"EntityActiveRequest: entity with id {} doesn't exist, player_id: {}",
|
||||||
request.entity_id,
|
request.entity_id,
|
||||||
ctx.player.basic_info.id
|
player.basic_info.id
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
@ -35,19 +29,17 @@ pub fn on_entity_active_request(
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
world
|
world.get_entity_components(request.entity_id as i32)
|
||||||
.get_entity_components(request.entity_id as i32)
|
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.for_each(|comp| comp.set_pb_data(&mut pb));
|
.for_each(|comp| comp.set_pb_data(&mut pb));
|
||||||
pb.component_pbs
|
pb.component_pbs
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: Remove attribute
|
// TODO: Remove attribute
|
||||||
if let (Some(position), Some(_attribute), Some(visibility)) =
|
if let (Some(position), Some(_attribute)) =
|
||||||
query_components!(world, request.entity_id, Position, Attribute, Visibility)
|
query_components!(world, request.entity_id, Position, Attribute)
|
||||||
{
|
{
|
||||||
response.is_visible = visibility.is_visible;
|
response.is_visible = true;
|
||||||
|
|
||||||
response.pos = Some(position.0.get_position_protobuf());
|
response.pos = Some(position.0.get_position_protobuf());
|
||||||
response.rot = Some(position.0.get_rotation_protobuf());
|
response.rot = Some(position.0.get_rotation_protobuf());
|
||||||
|
|
||||||
|
@ -59,12 +51,13 @@ pub fn on_entity_active_request(
|
||||||
"EntityActiveRequest: entity with id {} not found",
|
"EntityActiveRequest: entity with id {} not found",
|
||||||
request.entity_id
|
request.entity_id
|
||||||
);
|
);
|
||||||
response.error_code = ErrorCode::ErrEntityNotFound.into(); // TODO: replace with appropriate error code;
|
response.error_code = ErrorCode::ErrEntityNotFound.into(); // TODO: replace with appropriate error code
|
||||||
|
return;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_entity_on_landed_request(
|
pub fn on_entity_on_landed_request(
|
||||||
_: &NetContext,
|
_: &Player,
|
||||||
request: EntityOnLandedRequest,
|
request: EntityOnLandedRequest,
|
||||||
_: &mut EntityOnLandedResponse,
|
_: &mut EntityOnLandedResponse,
|
||||||
) {
|
) {
|
||||||
|
@ -76,7 +69,7 @@ pub fn on_entity_on_landed_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_entity_position_request(
|
pub fn on_entity_position_request(
|
||||||
_: &NetContext,
|
_: &Player,
|
||||||
request: EntityPositionRequest,
|
request: EntityPositionRequest,
|
||||||
_: &mut EntityPositionResponse,
|
_: &mut EntityPositionResponse,
|
||||||
) {
|
) {
|
||||||
|
@ -88,10 +81,12 @@ pub fn on_entity_position_request(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_move_package_push(ctx: &mut NetContext, push: MovePackagePush) {
|
pub fn on_move_package_push(player: &mut Player, push: MovePackagePush) {
|
||||||
for moving_entity in push.moving_entities {
|
for moving_entity in push.moving_entities {
|
||||||
|
// Query components borrows world component so lets wrap it
|
||||||
{
|
{
|
||||||
let world = ctx.world.get_world_entity();
|
let world_ref = player.world.borrow();
|
||||||
|
let world = world_ref.get_world_entity();
|
||||||
|
|
||||||
if !world.is_in_all_world_map(moving_entity.entity_id as i32) {
|
if !world.is_in_all_world_map(moving_entity.entity_id as i32) {
|
||||||
tracing::debug!(
|
tracing::debug!(
|
||||||
|
@ -115,25 +110,24 @@ pub fn on_move_package_push(ctx: &mut NetContext, push: MovePackagePush) {
|
||||||
.extend(moving_entity.move_infos);
|
.extend(moving_entity.move_infos);
|
||||||
}
|
}
|
||||||
|
|
||||||
let map = logic::utils::quadrant_util::get_map(ctx.player.basic_info.cur_map_id);
|
let map = logic::utils::quadrant_util::get_map(player.basic_info.cur_map_id);
|
||||||
let quadrant_id = map.get_quadrant_id(
|
let quadrant_id = map.get_quadrant_id(
|
||||||
ctx.player.location.position.position.x * 100.0,
|
player.location.position.position.x * 100.0,
|
||||||
ctx.player.location.position.position.y * 100.0,
|
player.location.position.position.y * 100.0,
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO: This may require some changes for Co-Op
|
// TODO: This may require some changes for Co-Op
|
||||||
if quadrant_id != ctx.player.quadrant_id {
|
if quadrant_id != player.quadrant_id {
|
||||||
let (entities_to_remove, entities_to_add) =
|
let (entities_to_remove, entities_to_add) = map.get_update_entities(player.quadrant_id, quadrant_id);
|
||||||
map.get_update_entities(ctx.player.quadrant_id, quadrant_id);
|
player.quadrant_id = quadrant_id;
|
||||||
ctx.player.quadrant_id = quadrant_id;
|
logic::utils::world_util::remove_entities(player, &entities_to_remove);
|
||||||
logic::utils::world_util::remove_entities(ctx, &entities_to_remove);
|
logic::utils::world_util::add_entities(player, &entities_to_add, false);
|
||||||
logic::utils::world_util::add_entities(ctx, &entities_to_add, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_entity_access_range_request(
|
pub fn on_entity_access_range_request(
|
||||||
_: &NetContext,
|
_: &Player,
|
||||||
request: EntityAccessRangeRequest,
|
request: EntityAccessRangeRequest,
|
||||||
response: &mut EntityAccessRangeResponse,
|
response: &mut EntityAccessRangeResponse,
|
||||||
) {
|
) {
|
||||||
|
@ -153,40 +147,26 @@ pub fn on_entity_access_range_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_entity_interact_request(
|
pub fn on_entity_interact_request(
|
||||||
ctx: &mut NetContext,
|
player: &mut Player,
|
||||||
request: EntityInteractRequest,
|
request: EntityInteractRequest,
|
||||||
response: &mut EntityInteractResponse,
|
response: &mut EntityInteractResponse,
|
||||||
) {
|
) {
|
||||||
let config_id = get_config_id_from_entity_id(ctx, request.entity_id);
|
let config_id = get_config_id_from_entity_id(player, request.entity_id);
|
||||||
tracing::debug!(
|
tracing::debug!("EntityInteractRequest with ID: {} and ConfigID {}", request.entity_id, config_id);
|
||||||
"EntityInteractRequest with ID: {} and ConfigID {}",
|
|
||||||
request.entity_id,
|
|
||||||
config_id
|
|
||||||
);
|
|
||||||
|
|
||||||
// TODO: add cases outside LevelEntityConfig if exist
|
// TODO: add cases outside LevelEntityConfig if exist
|
||||||
let Some(entity) = wicked_waifus_data::level_entity_config_data::get(
|
let Some(entity) = wicked_waifus_data::level_entity_config_data::get(player.basic_info.cur_map_id, config_id) else {
|
||||||
ctx.player.basic_info.cur_map_id,
|
|
||||||
config_id,
|
|
||||||
) else {
|
|
||||||
response.error_code = ErrorCode::ErrEntityNotFound.into();
|
response.error_code = ErrorCode::ErrEntityNotFound.into();
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
let Some(template_config) =
|
let Some(template_config) = wicked_waifus_data::template_config_data::get(&entity.blueprint_type) else {
|
||||||
wicked_waifus_data::template_config_data::get(&entity.blueprint_type)
|
|
||||||
else {
|
|
||||||
response.error_code = ErrorCode::ErrEntityNotFound.into();
|
response.error_code = ErrorCode::ErrEntityNotFound.into();
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
let Some(interact_component) = entity
|
let Some(interact_component) = entity.components_data.interact_component.as_ref()
|
||||||
.components_data
|
.or(template_config.components_data.interact_component.as_ref()).cloned() else {
|
||||||
.interact_component
|
|
||||||
.as_ref()
|
|
||||||
.or(template_config.components_data.interact_component.as_ref())
|
|
||||||
.cloned()
|
|
||||||
else {
|
|
||||||
response.error_code = ErrorCode::ErrInteractComponentNotExist.into();
|
response.error_code = ErrorCode::ErrInteractComponentNotExist.into();
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
@ -199,7 +179,7 @@ pub fn on_entity_interact_request(
|
||||||
let mut check = true;
|
let mut check = true;
|
||||||
if let Some(conditions) = option.condition {
|
if let Some(conditions) = option.condition {
|
||||||
for element in conditions.conditions {
|
for element in conditions.conditions {
|
||||||
check = check_condition(ctx, request.entity_id, entity, template_config, element);
|
check = check_condition(player, request.entity_id, &entity, template_config, element);
|
||||||
if !check {
|
if !check {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -210,13 +190,7 @@ pub fn on_entity_interact_request(
|
||||||
match option_type {
|
match option_type {
|
||||||
OptionType::Actions(actions) => {
|
OptionType::Actions(actions) => {
|
||||||
for action in actions.actions {
|
for action in actions.actions {
|
||||||
perform_action(
|
perform_action(player, request.entity_id, &entity, template_config, action);
|
||||||
ctx,
|
|
||||||
request.entity_id,
|
|
||||||
entity,
|
|
||||||
template_config,
|
|
||||||
action,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OptionType::Flow(_) => {
|
OptionType::Flow(_) => {
|
||||||
|
@ -232,16 +206,15 @@ pub fn on_entity_interact_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_entity_follow_track_request(
|
pub fn on_entity_follow_track_request(
|
||||||
ctx: &mut NetContext,
|
player: &Player,
|
||||||
request: EntityFollowTrackRequest,
|
request: EntityFollowTrackRequest,
|
||||||
response: &mut EntityFollowTrackResponse,
|
response: &mut EntityFollowTrackResponse,
|
||||||
) {
|
) {
|
||||||
let config_id = get_config_id_from_entity_id(ctx, request.entity_id);
|
let config_id = get_config_id_from_entity_id(player, request.entity_id);
|
||||||
let position = {
|
let position = {
|
||||||
let world = ctx.world.get_world_entity();
|
let world_ref = player.world.borrow();
|
||||||
let position = query_components!(world, request.entity_id, Position)
|
let world = world_ref.get_world_entity();
|
||||||
.0
|
let position = query_components!(world, request.entity_id, Position).0.unwrap();
|
||||||
.unwrap();
|
|
||||||
position.0.clone()
|
position.0.clone()
|
||||||
};
|
};
|
||||||
tracing::debug!(
|
tracing::debug!(
|
||||||
|
@ -253,19 +226,17 @@ pub fn on_entity_follow_track_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_get_reward_treasure_box_request(
|
pub fn on_get_reward_treasure_box_request(
|
||||||
ctx: &NetContext,
|
player: &Player,
|
||||||
request: GetRewardTreasureBoxRequest,
|
request: GetRewardTreasureBoxRequest,
|
||||||
_response: &mut GetRewardTreasureBoxResponse,
|
_response: &mut GetRewardTreasureBoxResponse,
|
||||||
) {
|
) {
|
||||||
let config_id = get_config_id_from_entity_id(ctx, request.entity_id);
|
let config_id = get_config_id_from_entity_id(player, request.entity_id);
|
||||||
tracing::debug!(
|
tracing::debug!("GetRewardTreasureBoxRequest with ID: {} and ConfigID {config_id}", request.entity_id);
|
||||||
"GetRewardTreasureBoxRequest with ID: {} and ConfigID {config_id}",
|
|
||||||
request.entity_id
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_config_id_from_entity_id(ctx: &NetContext, entity_id: i64) -> i64 {
|
fn get_config_id_from_entity_id(player: &Player, entity_id: i64) -> i64 {
|
||||||
let world = ctx.world.get_world_entity();
|
let world_ref = player.world.borrow();
|
||||||
|
let world = world_ref.get_world_entity();
|
||||||
let entity_config = query_components!(world, entity_id, EntityConfig).0.unwrap();
|
let entity_config = query_components!(world, entity_id, EntityConfig).0.unwrap();
|
||||||
entity_config.config_id as i64
|
entity_config.config_id as i64
|
||||||
}
|
}
|
|
@ -1,11 +1,11 @@
|
||||||
use crate::logic::thread_mgr::NetContext;
|
use crate::logic::player::Player;
|
||||||
use wicked_waifus_protocol::{
|
use wicked_waifus_protocol::{
|
||||||
ErrorCode, FriendAllRequest, FriendAllResponse, FriendInfo, PlayerBasicInfoGetRequest,
|
ErrorCode, FriendAllRequest, FriendAllResponse, FriendInfo, PlayerBasicInfoGetRequest,
|
||||||
PlayerBasicInfoGetResponse, PlayerDetails,
|
PlayerBasicInfoGetResponse, PlayerDetails,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn on_friend_all_request(
|
pub fn on_friend_all_request(
|
||||||
_ctx: &NetContext,
|
_player: &Player,
|
||||||
_: FriendAllRequest,
|
_: FriendAllRequest,
|
||||||
response: &mut FriendAllResponse,
|
response: &mut FriendAllResponse,
|
||||||
) {
|
) {
|
||||||
|
@ -23,7 +23,7 @@ pub fn on_friend_all_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
// pub fn on_friend_apply_send_request(
|
// pub fn on_friend_apply_send_request(
|
||||||
// _ctx: &NetContext,
|
// _player: &Player,
|
||||||
// _request: FriendApplySendRequest,
|
// _request: FriendApplySendRequest,
|
||||||
// _response: &mut FriendApplySendResponse,
|
// _response: &mut FriendApplySendResponse,
|
||||||
// ) {
|
// ) {
|
||||||
|
@ -31,7 +31,7 @@ pub fn on_friend_all_request(
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// pub fn on_friend_recently_team_request(
|
// pub fn on_friend_recently_team_request(
|
||||||
// _ctx: &NetContext,
|
// _player: &Player,
|
||||||
// _request: FriendRecentlyTeamRequest,
|
// _request: FriendRecentlyTeamRequest,
|
||||||
// _response: &mut FriendRecentlyTeamResponse,
|
// _response: &mut FriendRecentlyTeamResponse,
|
||||||
// ) {
|
// ) {
|
||||||
|
@ -39,7 +39,7 @@ pub fn on_friend_all_request(
|
||||||
// }
|
// }
|
||||||
|
|
||||||
pub fn on_player_basic_info_get_request(
|
pub fn on_player_basic_info_get_request(
|
||||||
_ctx: &NetContext,
|
_player: &Player,
|
||||||
request: PlayerBasicInfoGetRequest,
|
request: PlayerBasicInfoGetRequest,
|
||||||
response: &mut PlayerBasicInfoGetResponse,
|
response: &mut PlayerBasicInfoGetResponse,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -2,35 +2,31 @@ use std::collections::HashMap;
|
||||||
use std::sync::{Mutex, OnceLock};
|
use std::sync::{Mutex, OnceLock};
|
||||||
use std::time::UNIX_EPOCH;
|
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::gacha_pool::GachaPool;
|
||||||
use crate::logic::gacha::pool_info::PoolInfo;
|
use crate::logic::gacha::pool_info::PoolInfo;
|
||||||
use crate::logic::gacha::service::GachaService;
|
use crate::logic::gacha::service::GachaService;
|
||||||
use crate::logic::player::Player;
|
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();
|
static GACHA_SERVICE: OnceLock<Mutex<GachaService>> = OnceLock::new();
|
||||||
|
|
||||||
pub fn on_gacha_request(ctx: &mut NetContext, request: GachaRequest, response: &mut GachaResponse) {
|
pub fn on_gacha_request(
|
||||||
let mut gacha_service = GACHA_SERVICE
|
player: &mut Player,
|
||||||
.get_or_init(|| Mutex::new(GachaService::new()))
|
request: GachaRequest,
|
||||||
.lock()
|
response: &mut GachaResponse,
|
||||||
.unwrap();
|
) {
|
||||||
|
let mut gacha_service = GACHA_SERVICE.get_or_init(|| Mutex::new(GachaService::new())).lock().unwrap();
|
||||||
|
|
||||||
// TODO: ensure we have enough elements before pulling
|
// TODO: ensure we have enough elements before pulling
|
||||||
|
|
||||||
match gacha_service.pull(ctx.player, request.gacha_id, request.gacha_times) {
|
match gacha_service.pull(player, request.gacha_id, request.gacha_times) {
|
||||||
Ok(results) => {
|
Ok(results) => {
|
||||||
match consume_tides(ctx.player, request.gacha_id, request.gacha_times) {
|
match consume_tides(player, request.gacha_id, request.gacha_times) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
let _summary = process_gacha_results(&results);
|
let _summary = process_gacha_results(&results);
|
||||||
//update_player_inventory(player, summary);
|
//update_player_inventory(player, summary);
|
||||||
|
@ -52,22 +48,20 @@ pub fn on_gacha_request(ctx: &mut NetContext, request: GachaRequest, response: &
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_gacha_info_request(
|
pub fn on_gacha_info_request(
|
||||||
_ctx: &NetContext,
|
_player: &Player,
|
||||||
request: GachaInfoRequest,
|
request: GachaInfoRequest,
|
||||||
response: &mut GachaInfoResponse,
|
response: &mut GachaInfoResponse,
|
||||||
) {
|
) {
|
||||||
tracing::debug!("received gacha request for language: {}", request.language);
|
tracing::debug!("received gacha request for language: {}", request.language);
|
||||||
let text_map = text_map_data::get_textmap(request.language);
|
let text_map = text_map_data::get_textmap(request.language);
|
||||||
|
|
||||||
let gacha_service = GACHA_SERVICE
|
let gacha_service = GACHA_SERVICE.get_or_init(|| Mutex::new(GachaService::new())).lock().unwrap();
|
||||||
.get_or_init(|| Mutex::new(GachaService::new()))
|
|
||||||
.lock()
|
|
||||||
.unwrap();
|
|
||||||
let active_pools = gacha_service.get_active_pools();
|
let active_pools = gacha_service.get_active_pools();
|
||||||
|
|
||||||
response.gacha_infos = active_pools
|
response.gacha_infos = active_pools.into_iter()
|
||||||
.into_iter()
|
.filter_map(|(pool_id, pool)| {
|
||||||
.filter_map(|(pool_id, pool)| create_gacha_info(pool_id, pool, text_map))
|
create_gacha_info(pool_id, pool, text_map)
|
||||||
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
response.error_code = ErrorCode::Success.into();
|
response.error_code = ErrorCode::Success.into();
|
||||||
|
@ -79,7 +73,7 @@ pub fn on_gacha_info_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_gacha_use_pool_request(
|
pub fn on_gacha_use_pool_request(
|
||||||
_ctx: &NetContext,
|
_player: &Player,
|
||||||
_request: GachaUsePoolRequest,
|
_request: GachaUsePoolRequest,
|
||||||
response: &mut GachaUsePoolResponse,
|
response: &mut GachaUsePoolResponse,
|
||||||
) {
|
) {
|
||||||
|
@ -87,11 +81,9 @@ pub fn on_gacha_use_pool_request(
|
||||||
response.error_code = ErrorCode::Success.into();
|
response.error_code = ErrorCode::Success.into();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_gacha_info(
|
fn create_gacha_info(pool_id: i32,
|
||||||
pool_id: i32,
|
|
||||||
pool: &GachaPool,
|
pool: &GachaPool,
|
||||||
textmap: &HashMap<String, String>,
|
textmap: &HashMap<String, String>) -> Option<GachaInfo> {
|
||||||
) -> Option<GachaInfo> {
|
|
||||||
let pools: Vec<GachaPoolInfo> = gacha_pool_data::iter()
|
let pools: Vec<GachaPoolInfo> = gacha_pool_data::iter()
|
||||||
.filter(|p| p.gacha_id == pool_id)
|
.filter(|p| p.gacha_id == pool_id)
|
||||||
.filter_map(|p| create_pool_info(p, &pool.info, textmap))
|
.filter_map(|p| create_pool_info(p, &pool.info, textmap))
|
||||||
|
@ -111,15 +103,8 @@ fn create_gacha_info(
|
||||||
gacha_consumes,
|
gacha_consumes,
|
||||||
use_pool_id: pools[0].id,
|
use_pool_id: pools[0].id,
|
||||||
pools,
|
pools,
|
||||||
begin_time: pool
|
begin_time: pool.info.start_time.duration_since(UNIX_EPOCH).unwrap().as_secs() as i64,
|
||||||
.info
|
end_time: pool.info.end_time.map_or(0, |end_time| end_time.duration_since(UNIX_EPOCH).unwrap().as_secs() as i64),
|
||||||
.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,
|
daily_limit_times: pool.info.daily_limit,
|
||||||
total_limit_times: pool.info.total_limit,
|
total_limit_times: pool.info.total_limit,
|
||||||
resources_id: pool.info.resources_id().to_string(),
|
resources_id: pool.info.resources_id().to_string(),
|
||||||
|
@ -136,51 +121,29 @@ fn create_pool_info(
|
||||||
// TODO: debug textmap logic
|
// TODO: debug textmap logic
|
||||||
gacha_view_info_data::iter()
|
gacha_view_info_data::iter()
|
||||||
.find(|view| view.id == pool.id)
|
.find(|view| view.id == pool.id)
|
||||||
.map(|view| GachaPoolInfo {
|
.map(|view| {
|
||||||
|
GachaPoolInfo {
|
||||||
id: pool.id,
|
id: pool.id,
|
||||||
begin_time: pool_info
|
begin_time: pool_info.start_time.duration_since(UNIX_EPOCH).unwrap().as_secs() as i64,
|
||||||
.start_time
|
end_time: pool_info.end_time.map_or(0, |end_time| end_time.duration_since(UNIX_EPOCH).unwrap().as_secs() as i64),
|
||||||
.duration_since(UNIX_EPOCH)
|
title: textmap.get(&view.summary_title).unwrap_or(&view.summary_title).to_string(),
|
||||||
.unwrap()
|
description: textmap.get(&view.summary_describe).unwrap_or(&view.summary_describe).to_string(),
|
||||||
.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,
|
ui_type: view.r#type as i32,
|
||||||
theme_color: view.theme_color.clone(),
|
theme_color: view.theme_color.clone(),
|
||||||
show_id_list: view.show_id_list.clone(),
|
show_id_list: view.show_id_list.clone(),
|
||||||
up_list: view.up_list.clone(),
|
up_list: view.up_list.clone(),
|
||||||
preview_id_list: view.preview_id_list.clone(),
|
preview_id_list: view.preview_id_list.clone(),
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_gacha_consumes(pool_info: &PoolInfo) -> Vec<GachaConsume> {
|
fn handle_gacha_consumes(pool_info: &PoolInfo) -> Vec<GachaConsume> {
|
||||||
match (pool_info.pool_type, pool_info.pool_id) {
|
match (pool_info.pool_type, pool_info.pool_id) {
|
||||||
(NoviceConvene, _) => vec![GachaConsume {
|
(NoviceConvene, _) => vec![GachaConsume { times: 10, consume: 0 }], // 8
|
||||||
times: 10,
|
(BeginnersChoiceConvene, 51..56) => vec![GachaConsume { times: 1, consume: 0 }], // 1,
|
||||||
consume: 0,
|
|
||||||
}], // 8
|
|
||||||
(BeginnersChoiceConvene, 51..56) => vec![GachaConsume {
|
|
||||||
times: 1,
|
|
||||||
consume: 0,
|
|
||||||
}], // 1,
|
|
||||||
(_, _) => vec![
|
(_, _) => vec![
|
||||||
GachaConsume {
|
GachaConsume { times: 1, consume: 0 }, // 1
|
||||||
times: 1,
|
GachaConsume { times: 10, consume: 0 }, // 10
|
||||||
consume: 0,
|
|
||||||
}, // 1
|
|
||||||
GachaConsume {
|
|
||||||
times: 10,
|
|
||||||
consume: 0,
|
|
||||||
}, // 10
|
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,54 +1,51 @@
|
||||||
|
use wicked_waifus_protocol::{ErrorCode, GuideFinishRequest, GuideFinishResponse, GuideInfoRequest, GuideInfoResponse, GuideTriggerRequest, GuideTriggerResponse};
|
||||||
|
|
||||||
use crate::logic::player::Player;
|
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(
|
pub fn on_guide_info_request(
|
||||||
ctx: &NetContext,
|
player: &Player,
|
||||||
_: GuideInfoRequest,
|
_: GuideInfoRequest,
|
||||||
response: &mut GuideInfoResponse,
|
response: &mut GuideInfoResponse,
|
||||||
) {
|
) {
|
||||||
response.guide_group_finish_list = ctx.player.guides.finished_guides.iter().cloned().collect();
|
response.guide_group_finish_list = player.guides.finished_guides.iter()
|
||||||
|
.cloned()
|
||||||
|
.collect();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_guide_trigger_request(
|
pub fn on_guide_trigger_request(
|
||||||
ctx: &mut NetContext,
|
player: &mut Player,
|
||||||
request: GuideTriggerRequest,
|
request: GuideTriggerRequest,
|
||||||
response: &mut GuideTriggerResponse,
|
response: &mut GuideTriggerResponse,
|
||||||
) {
|
) {
|
||||||
response.error_code = check_if_guide_exists_and_is_repeatable(ctx.player, request.group_id);
|
response.error_code = check_if_guide_exists_and_is_repeatable(player, request.group_id);
|
||||||
if response.error_code == <ErrorCode as Into<i32>>::into(ErrorCode::Success) {
|
if response.error_code == <ErrorCode as Into<i32>>::into(ErrorCode::Success) {
|
||||||
// TODO: We need to check if guide can be repeated or not
|
// TODO: We need to check if guide can be repeated or not
|
||||||
// if player.guides.started_guides.contains(&request.group_id) {
|
// if player.guides.started_guides.contains(&request.group_id) {
|
||||||
// response.error_code = ErrorCode::GuideGroupDoing.into();
|
// response.error_code = ErrorCode::GuideGroupDoing.into();
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
ctx.player.guides.started_guides.insert(request.group_id);
|
player.guides.started_guides.insert(request.group_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_guide_finish_request(
|
pub fn on_guide_finish_request(
|
||||||
ctx: &mut NetContext,
|
player: &mut Player,
|
||||||
request: GuideFinishRequest,
|
request: GuideFinishRequest,
|
||||||
response: &mut GuideFinishResponse,
|
response: &mut GuideFinishResponse,
|
||||||
) {
|
) {
|
||||||
response.error_code = check_if_guide_exists_and_is_repeatable(ctx.player, request.group_id);
|
response.error_code = check_if_guide_exists_and_is_repeatable(player, request.group_id);
|
||||||
if response.error_code == <ErrorCode as Into<i32>>::into(ErrorCode::Success) {
|
if response.error_code == <ErrorCode as Into<i32>>::into(ErrorCode::Success) {
|
||||||
if !ctx.player.guides.started_guides.contains(&request.group_id) {
|
if !player.guides.started_guides.contains(&request.group_id) {
|
||||||
response.error_code = ErrorCode::GuideGroupNoClient.into();
|
response.error_code = ErrorCode::GuideGroupNoClient.into();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ctx.player.guides.started_guides.remove(&request.group_id);
|
player.guides.started_guides.remove(&request.group_id);
|
||||||
ctx.player.guides.finished_guides.insert(request.group_id);
|
player.guides.finished_guides.insert(request.group_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_if_guide_exists_and_is_repeatable(player: &Player, guide_id: i32) -> i32 {
|
fn check_if_guide_exists_and_is_repeatable(player: &Player, guide_id: i32) -> i32 {
|
||||||
let Some(guide) =
|
let Some(guide) = wicked_waifus_data::guide_group_data::iter().find(|guide| guide.id == guide_id) else {
|
||||||
wicked_waifus_data::guide_group_data::iter().find(|guide| guide.id == guide_id)
|
|
||||||
else {
|
|
||||||
return ErrorCode::GuideGroupIdNoMatch.into();
|
return ErrorCode::GuideGroupIdNoMatch.into();
|
||||||
};
|
};
|
||||||
// TODO: We need to check if guide can be repeated or not
|
// TODO: We need to check if guide can be repeated or not
|
||||||
|
|
|
@ -1,48 +1,36 @@
|
||||||
use crate::logic::thread_mgr::NetContext;
|
use wicked_waifus_protocol::{ItemExchangeInfo, ItemExchangeInfoRequest, ItemExchangeInfoResponse, NormalItemRequest, NormalItemResponse, PhantomItemRequest, PhantomItemResponse, WeaponItemRequest, WeaponItemResponse};
|
||||||
use wicked_waifus_protocol::{
|
|
||||||
ItemExchangeInfo, ItemExchangeInfoRequest, ItemExchangeInfoResponse, NormalItemRequest,
|
use crate::logic::player::Player;
|
||||||
NormalItemResponse, PhantomItemRequest, PhantomItemResponse, WeaponItemRequest,
|
|
||||||
WeaponItemResponse,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub fn on_normal_item_request(
|
pub fn on_normal_item_request(
|
||||||
ctx: &NetContext,
|
player: &mut Player,
|
||||||
_: NormalItemRequest,
|
_: NormalItemRequest,
|
||||||
response: &mut NormalItemResponse,
|
response: &mut NormalItemResponse,
|
||||||
) {
|
) {
|
||||||
tracing::debug!("Received NormalItemRequest, returning player inventory");
|
tracing::debug!("Received NormalItemRequest, returning player inventory");
|
||||||
response.normal_item_list = ctx.player.inventory.to_normal_item_list();
|
response.normal_item_list = player.inventory.to_normal_item_list();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_weapon_item_request(
|
pub fn on_weapon_item_request(
|
||||||
ctx: &NetContext,
|
_player: &mut Player,
|
||||||
_: WeaponItemRequest,
|
_: WeaponItemRequest,
|
||||||
response: &mut WeaponItemResponse,
|
_response: &mut WeaponItemResponse,
|
||||||
) {
|
) {
|
||||||
response.weapon_item_list = ctx.player.inventory.to_weapon_item_list();
|
// TODO: Implement this
|
||||||
|
tracing::warn!("Unhandled WeaponItemRequest");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_phantom_item_request(
|
pub fn on_phantom_item_request(
|
||||||
ctx: &mut NetContext,
|
_player: &mut Player,
|
||||||
_: PhantomItemRequest,
|
_: PhantomItemRequest,
|
||||||
response: &mut PhantomItemResponse,
|
_response: &mut PhantomItemResponse,
|
||||||
) {
|
) {
|
||||||
let (items, equip_info, prop_info) = ctx.player.inventory.get_echoes_list();
|
// TODO: Implement this
|
||||||
response.phantom_item_list = items;
|
tracing::warn!("Unhandled PhantomItemRequest");
|
||||||
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(
|
pub fn on_item_exchange_info_request(
|
||||||
_ctx: &mut NetContext,
|
_player: &mut Player,
|
||||||
_: ItemExchangeInfoRequest,
|
_: ItemExchangeInfoRequest,
|
||||||
response: &mut ItemExchangeInfoResponse,
|
response: &mut ItemExchangeInfoResponse,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
use wicked_waifus_protocol::{LordGymInfoRequest, LordGymInfoResponse};
|
use wicked_waifus_protocol::{LordGymInfoRequest, LordGymInfoResponse};
|
||||||
|
|
||||||
use crate::logic::thread_mgr::NetContext;
|
use crate::logic::player::Player;
|
||||||
|
|
||||||
pub fn on_lord_gym_info_request(
|
pub fn on_lord_gym_info_request(
|
||||||
_ctx: &NetContext,
|
_player: &Player,
|
||||||
request: LordGymInfoRequest,
|
request: LordGymInfoRequest,
|
||||||
_response: &mut LordGymInfoResponse,
|
_response: &mut LordGymInfoResponse,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
use wicked_waifus_protocol::{MailBind, MailBindInfoRequest, MailBindInfoResponse};
|
use wicked_waifus_protocol::{MailBind, MailBindInfoRequest, MailBindInfoResponse};
|
||||||
|
|
||||||
use crate::logic::thread_mgr::NetContext;
|
use crate::logic::player::Player;
|
||||||
|
|
||||||
pub fn on_mail_bind_info_request(
|
pub fn on_mail_bind_info_request(
|
||||||
_: &NetContext,
|
_: &Player,
|
||||||
_: MailBindInfoRequest,
|
_: MailBindInfoRequest,
|
||||||
response: &mut MailBindInfoResponse,
|
response: &mut MailBindInfoResponse,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -6,10 +6,10 @@ use wicked_waifus_protocol::{
|
||||||
PlayerAccessEffectAreaResponse,
|
PlayerAccessEffectAreaResponse,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::logic::thread_mgr::NetContext;
|
use crate::logic::player::Player;
|
||||||
|
|
||||||
pub fn on_dark_coast_delivery_request(
|
pub fn on_dark_coast_delivery_request(
|
||||||
_ctx: &mut NetContext,
|
_player: &mut Player,
|
||||||
request: DarkCoastDeliveryRequest,
|
request: DarkCoastDeliveryRequest,
|
||||||
response: &mut DarkCoastDeliveryResponse,
|
response: &mut DarkCoastDeliveryResponse,
|
||||||
) {
|
) {
|
||||||
|
@ -40,36 +40,36 @@ pub fn on_dark_coast_delivery_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_map_cancel_trace_request(
|
pub fn on_map_cancel_trace_request(
|
||||||
ctx: &mut NetContext,
|
player: &mut Player,
|
||||||
request: MapCancelTraceRequest,
|
request: MapCancelTraceRequest,
|
||||||
response: &mut MapCancelTraceResponse,
|
response: &mut MapCancelTraceResponse,
|
||||||
) {
|
) {
|
||||||
ctx.player.map_trace.traces.remove(&request.mark_id);
|
player.map_trace.traces.remove(&request.mark_id);
|
||||||
response.mark_id = request.mark_id;
|
response.mark_id = request.mark_id;
|
||||||
response.error_code = ErrorCode::Success.into();
|
response.error_code = ErrorCode::Success.into();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_map_trace_request(
|
pub fn on_map_trace_request(
|
||||||
ctx: &mut NetContext,
|
player: &mut Player,
|
||||||
request: MapTraceRequest,
|
request: MapTraceRequest,
|
||||||
response: &mut MapTraceResponse,
|
response: &mut MapTraceResponse,
|
||||||
) {
|
) {
|
||||||
ctx.player.map_trace.traces.insert(request.mark_id);
|
player.map_trace.traces.insert(request.mark_id);
|
||||||
response.mark_id = request.mark_id;
|
response.mark_id = request.mark_id;
|
||||||
response.error_code = ErrorCode::Success.into();
|
response.error_code = ErrorCode::Success.into();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_map_trace_info_request(
|
pub fn on_map_trace_info_request(
|
||||||
ctx: &NetContext,
|
player: &Player,
|
||||||
_: MapTraceInfoRequest,
|
_: MapTraceInfoRequest,
|
||||||
response: &mut MapTraceInfoResponse,
|
response: &mut MapTraceInfoResponse,
|
||||||
) {
|
) {
|
||||||
response.mark_id_list = ctx.player.map_trace.traces.iter().cloned().collect();
|
response.mark_id_list = player.map_trace.traces.iter().cloned().collect();
|
||||||
response.error_code = ErrorCode::Success.into();
|
response.error_code = ErrorCode::Success.into();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_map_unlock_field_info_request(
|
pub fn on_map_unlock_field_info_request(
|
||||||
_ctx: &NetContext,
|
_player: &mut Player,
|
||||||
_: MapUnlockFieldInfoRequest,
|
_: MapUnlockFieldInfoRequest,
|
||||||
response: &mut MapUnlockFieldInfoResponse,
|
response: &mut MapUnlockFieldInfoResponse,
|
||||||
) {
|
) {
|
||||||
|
@ -81,7 +81,7 @@ pub fn on_map_unlock_field_info_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_player_access_effect_area_request(
|
pub fn on_player_access_effect_area_request(
|
||||||
_ctx: &NetContext,
|
_player: &Player,
|
||||||
request: PlayerAccessEffectAreaRequest,
|
request: PlayerAccessEffectAreaRequest,
|
||||||
response: &mut PlayerAccessEffectAreaResponse,
|
response: &mut PlayerAccessEffectAreaResponse,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -1,32 +1,28 @@
|
||||||
use wicked_waifus_protocol::{
|
use wicked_waifus_protocol::{ErrorCode, InputSettingRequest, InputSettingResponse, InputSettingUpdateRequest, InputSettingUpdateResponse, LanguageSettingUpdateRequest, LanguageSettingUpdateResponse, MonthCardRequest, MonthCardResponse, ServerPlayStationPlayOnlyStateRequest, ServerPlayStationPlayOnlyStateResponse, UpdateVoxelEnvRequest, UpdateVoxelEnvResponse, VersionInfoPush, WebSignRequest, WebSignResponse, Zih};
|
||||||
ErrorCode, InputSettingRequest, InputSettingResponse, InputSettingUpdateRequest,
|
|
||||||
InputSettingUpdateResponse, LanguageSettingUpdateRequest, LanguageSettingUpdateResponse,
|
|
||||||
MonthCardRequest, MonthCardResponse, ServerPlayStationPlayOnlyStateRequest,
|
|
||||||
ServerPlayStationPlayOnlyStateResponse, UpdateVoxelEnvRequest, UpdateVoxelEnvResponse,
|
|
||||||
VersionInfoPush, WebSignRequest, WebSignResponse, Zih,
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::logic::thread_mgr::NetContext;
|
use crate::logic::player::Player;
|
||||||
|
|
||||||
pub fn on_month_card_request(
|
pub fn on_month_card_request(
|
||||||
ctx: &mut NetContext,
|
player: &mut Player,
|
||||||
_: MonthCardRequest,
|
_: MonthCardRequest,
|
||||||
response: &mut MonthCardResponse,
|
response: &mut MonthCardResponse,
|
||||||
) {
|
) {
|
||||||
// TODO: Check if we should send MonthCardUseNotify
|
// TODO: Check if we should send MonthCardUseNotify
|
||||||
response.days = ctx.player.month_card.days;
|
response.days = player.month_card.days;
|
||||||
response.is_daily_got =
|
response.is_daily_got = wicked_waifus_commons::time_util::unix_days() == player.month_card.last_received_day;
|
||||||
wicked_waifus_commons::time_util::unix_days() == ctx.player.month_card.last_received_day;
|
|
||||||
response.error_code = ErrorCode::Success.into();
|
response.error_code = ErrorCode::Success.into();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_web_sign_request(_: &mut NetContext, _: WebSignRequest, response: &mut WebSignResponse) {
|
pub fn on_web_sign_request(
|
||||||
response.notice_sign =
|
_: &mut Player,
|
||||||
"Welcome to Wicked Waifus PS provided by Reversed Rooms Dev Team".to_string();
|
_: 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(
|
pub fn on_input_setting_request(
|
||||||
_: &NetContext,
|
_: &Player,
|
||||||
_: InputSettingRequest,
|
_: InputSettingRequest,
|
||||||
response: &mut InputSettingResponse,
|
response: &mut InputSettingResponse,
|
||||||
) {
|
) {
|
||||||
|
@ -34,7 +30,7 @@ pub fn on_input_setting_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_input_setting_update_request(
|
pub fn on_input_setting_update_request(
|
||||||
_: &NetContext,
|
_: &Player,
|
||||||
_: InputSettingUpdateRequest,
|
_: InputSettingUpdateRequest,
|
||||||
response: &mut InputSettingUpdateResponse,
|
response: &mut InputSettingUpdateResponse,
|
||||||
) {
|
) {
|
||||||
|
@ -42,7 +38,7 @@ pub fn on_input_setting_update_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_language_setting_update_request(
|
pub fn on_language_setting_update_request(
|
||||||
_: &NetContext,
|
_: &Player,
|
||||||
_: LanguageSettingUpdateRequest,
|
_: LanguageSettingUpdateRequest,
|
||||||
response: &mut LanguageSettingUpdateResponse,
|
response: &mut LanguageSettingUpdateResponse,
|
||||||
) {
|
) {
|
||||||
|
@ -50,14 +46,14 @@ pub fn on_language_setting_update_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_server_play_station_play_only_state_request(
|
pub fn on_server_play_station_play_only_state_request(
|
||||||
_: &NetContext,
|
_: &Player,
|
||||||
_: ServerPlayStationPlayOnlyStateRequest,
|
_: ServerPlayStationPlayOnlyStateRequest,
|
||||||
response: &mut ServerPlayStationPlayOnlyStateResponse,
|
response: &mut ServerPlayStationPlayOnlyStateResponse,
|
||||||
) {
|
) {
|
||||||
response.cross_play_enabled = false;
|
response.cross_play_enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_version_info_push(_player: &NetContext, push: VersionInfoPush) {
|
pub fn on_version_info_push(_player: &Player, push: VersionInfoPush) {
|
||||||
// TODO: Shall we do safety check and ensure we have compatible versions?
|
// TODO: Shall we do safety check and ensure we have compatible versions?
|
||||||
tracing::debug!(
|
tracing::debug!(
|
||||||
"Client versions: launcher: {}, app: {}, resources: {}",
|
"Client versions: launcher: {}, app: {}, resources: {}",
|
||||||
|
@ -68,7 +64,7 @@ pub fn on_version_info_push(_player: &NetContext, push: VersionInfoPush) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_update_voxel_env_request(
|
pub fn on_update_voxel_env_request(
|
||||||
_: &NetContext,
|
_: &Player,
|
||||||
request: UpdateVoxelEnvRequest,
|
request: UpdateVoxelEnvRequest,
|
||||||
response: &mut UpdateVoxelEnvResponse,
|
response: &mut UpdateVoxelEnvResponse,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -19,7 +19,6 @@ use wicked_waifus_protocol::message::Message;
|
||||||
pub use skill::*;
|
pub use skill::*;
|
||||||
pub use teleport::*;
|
pub use teleport::*;
|
||||||
pub use tutorial::*;
|
pub use tutorial::*;
|
||||||
pub use weapon::*;
|
|
||||||
|
|
||||||
mod advice;
|
mod advice;
|
||||||
mod animal;
|
mod animal;
|
||||||
|
@ -41,11 +40,10 @@ mod scene;
|
||||||
mod skill;
|
mod skill;
|
||||||
mod teleport;
|
mod teleport;
|
||||||
mod tutorial;
|
mod tutorial;
|
||||||
mod weapon;
|
|
||||||
|
|
||||||
macro_rules! handle_request {
|
macro_rules! handle_request {
|
||||||
($($name:ident $(, $inner_package:ident)?;)*) => {
|
($($name:ident $(, $inner_package:ident)?;)*) => {
|
||||||
fn handle_request(ctx: &mut super::thread_mgr::NetContext, mut msg: Message) {
|
fn handle_request(player: &mut super::player::Player, mut msg: Message) {
|
||||||
use ::wicked_waifus_protocol::{MessageID, Protobuf};
|
use ::wicked_waifus_protocol::{MessageID, Protobuf};
|
||||||
|
|
||||||
::paste::paste! {
|
::paste::paste! {
|
||||||
|
@ -53,16 +51,16 @@ macro_rules! handle_request {
|
||||||
$(
|
$(
|
||||||
::wicked_waifus_protocol::$($inner_package::)?[<$name Request>]::MESSAGE_ID => {
|
::wicked_waifus_protocol::$($inner_package::)?[<$name Request>]::MESSAGE_ID => {
|
||||||
let Ok(request) = ::wicked_waifus_protocol::$($inner_package::)?[<$name Request>]::decode(&*msg.remove_payload()) else {
|
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>]), ctx.player.basic_info.id);
|
tracing::debug!("failed to decode {}, player_id: {}", stringify!($($inner_package::)?[<$name Request>]), player.basic_info.id);
|
||||||
return;
|
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();
|
let mut response = ::wicked_waifus_protocol::$($inner_package::)?[<$name Response>]::default();
|
||||||
[<on_ $($inner_package:snake _)? $name:snake _request>](ctx, request, &mut response);
|
[<on_ $($inner_package:snake _)? $name:snake _request>](player, request, &mut response);
|
||||||
|
|
||||||
ctx.player.respond(response, msg.get_rpc_id());
|
player.respond(response, msg.get_rpc_id());
|
||||||
},
|
},
|
||||||
)*
|
)*
|
||||||
unhandled => {
|
unhandled => {
|
||||||
|
@ -81,7 +79,7 @@ macro_rules! handle_request {
|
||||||
|
|
||||||
macro_rules! handle_push {
|
macro_rules! handle_push {
|
||||||
($($name:ident $(, $inner_package:ident)?;)*) => {
|
($($name:ident $(, $inner_package:ident)?;)*) => {
|
||||||
fn handle_push(ctx: &mut super::thread_mgr::NetContext, mut msg: Message) {
|
fn handle_push(player: &mut super::player::Player, mut msg: Message) {
|
||||||
use ::wicked_waifus_protocol::{MessageID, Protobuf};
|
use ::wicked_waifus_protocol::{MessageID, Protobuf};
|
||||||
|
|
||||||
::paste::paste! {
|
::paste::paste! {
|
||||||
|
@ -89,13 +87,13 @@ macro_rules! handle_push {
|
||||||
$(
|
$(
|
||||||
::wicked_waifus_protocol::$($inner_package::)?[<$name Push>]::MESSAGE_ID => {
|
::wicked_waifus_protocol::$($inner_package::)?[<$name Push>]::MESSAGE_ID => {
|
||||||
let Ok(push) = ::wicked_waifus_protocol::$($inner_package::)?[<$name Push>]::decode(&*msg.remove_payload()) else {
|
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>]), ctx.player.basic_info.id);
|
tracing::debug!("failed to decode {}, player_id: {}", stringify!($($inner_package::)?[<$name Push>]), player.basic_info.id);
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
tracing::debug!("logic: processing push {}", stringify!($($inner_package::)?[<$name Push>]));
|
tracing::debug!("logic: processing push {}", stringify!($($inner_package::)?[<$name Push>]));
|
||||||
|
|
||||||
[<on_ $($inner_package:snake _)? $name:snake _push>](ctx, push);
|
[<on_ $($inner_package:snake _)? $name:snake _push>](player, push);
|
||||||
},
|
},
|
||||||
)*
|
)*
|
||||||
unhandled => {
|
unhandled => {
|
||||||
|
@ -202,19 +200,13 @@ handle_request! {
|
||||||
RoleFavorList;
|
RoleFavorList;
|
||||||
FormationAttr;
|
FormationAttr;
|
||||||
UpdateFormation;
|
UpdateFormation;
|
||||||
UnlockRoleSkinList;
|
|
||||||
RoleSkinChange;
|
|
||||||
FlySkinWear;
|
|
||||||
FlySkinWearAllRole;
|
|
||||||
RoleLevelUpView;
|
|
||||||
PbUpLevelRole;
|
|
||||||
RoleBreakThroughView;
|
|
||||||
|
|
||||||
// Scene (TODO: Review this on_..., port some from go)
|
// Scene (TODO: Review this on_..., port some from go)
|
||||||
SceneTrace;
|
SceneTrace;
|
||||||
SceneLoadingFinish;
|
SceneLoadingFinish;
|
||||||
UpdateSceneDate;
|
UpdateSceneDate;
|
||||||
AccessPathTimeServerConfig;
|
AccessPathTimeServerConfig;
|
||||||
|
UnlockRoleSkinList;
|
||||||
PlayerHeadData;
|
PlayerHeadData;
|
||||||
|
|
||||||
// Shop (TODO: Review this on_..., port some from go)
|
// Shop (TODO: Review this on_..., port some from go)
|
||||||
|
@ -245,12 +237,6 @@ handle_request! {
|
||||||
TutorialReceive;
|
TutorialReceive;
|
||||||
TutorialUnlock;
|
TutorialUnlock;
|
||||||
|
|
||||||
// Weapon
|
|
||||||
WeaponSkin;
|
|
||||||
EquipWeaponSkin;
|
|
||||||
SendEquipSkin;
|
|
||||||
EquipTakeOn;
|
|
||||||
|
|
||||||
// TODO: Implement all this properly, workaround for game enter
|
// TODO: Implement all this properly, workaround for game enter
|
||||||
EntityPatrolStop;
|
EntityPatrolStop;
|
||||||
InitRange;
|
InitRange;
|
||||||
|
@ -278,6 +264,7 @@ handle_request! {
|
||||||
Liveness;
|
Liveness;
|
||||||
WebSign;
|
WebSign;
|
||||||
PhotoMemory;
|
PhotoMemory;
|
||||||
|
WeaponSkin;
|
||||||
VisionEquipGroupInfo;
|
VisionEquipGroupInfo;
|
||||||
UpdatePlayStationBlockAccount;
|
UpdatePlayStationBlockAccount;
|
||||||
AdventureManual;
|
AdventureManual;
|
||||||
|
@ -297,15 +284,15 @@ handle_push! {
|
||||||
VersionInfo;
|
VersionInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn handle_logic_message(ctx: &mut super::thread_mgr::NetContext, msg: Message) {
|
pub fn handle_logic_message(player: &mut super::player::Player, msg: Message) {
|
||||||
match msg {
|
match msg {
|
||||||
Message::Request { .. } => handle_request(ctx, msg),
|
Message::Request { .. } => handle_request(player, msg),
|
||||||
Message::Push { .. } => handle_push(ctx, msg),
|
Message::Push { .. } => handle_push(player, msg),
|
||||||
_ => tracing::warn!(
|
_ => tracing::warn!(
|
||||||
"handle_logic_message: wrong message type: {}, message_id: {}, player_id: {}",
|
"handle_logic_message: wrong message type: {}, message_id: {}, player_id: {}",
|
||||||
msg.get_message_type(),
|
msg.get_message_type(),
|
||||||
msg.get_message_id(),
|
msg.get_message_id(),
|
||||||
ctx.player.basic_info.id,
|
player.basic_info.id,
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,36 +1,25 @@
|
||||||
use std::collections::HashSet;
|
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::{
|
use wicked_waifus_protocol::{
|
||||||
ArrayIntInt, ClientCurrentRoleReportRequest, ClientCurrentRoleReportResponse,
|
ClientCurrentRoleReportRequest, ClientCurrentRoleReportResponse, ERemoveEntityType, ErrorCode,
|
||||||
ERemoveEntityType, EntityAddNotify, EntityEquipSkinChangeNotify, EntityFlySkinChangeData,
|
FormationAttrRequest, FormationAttrResponse, PlayerMotionRequest, PlayerMotionResponse,
|
||||||
EntityPb, EntityRemoveInfo, EntityRemoveNotify, EquipFlySkinData, ErrorCode, FlySkinConfigData,
|
RoleFavorListRequest, RoleFavorListResponse, RoleShowListUpdateRequest,
|
||||||
FlySkinWearAllRoleRequest, FlySkinWearAllRoleResponse, FlySkinWearRequest, FlySkinWearResponse,
|
RoleShowListUpdateResponse, UpdateFormationRequest, UpdateFormationResponse,
|
||||||
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::player::Player;
|
||||||
|
use crate::logic::role::{Role, RoleFormation};
|
||||||
|
|
||||||
pub fn on_role_show_list_update_request(
|
pub fn on_role_show_list_update_request(
|
||||||
ctx: &mut NetContext,
|
player: &mut Player,
|
||||||
request: RoleShowListUpdateRequest,
|
request: RoleShowListUpdateRequest,
|
||||||
response: &mut RoleShowListUpdateResponse,
|
response: &mut RoleShowListUpdateResponse,
|
||||||
) {
|
) {
|
||||||
let role_ids: HashSet<i32> = ctx.player.role_list.keys().cloned().collect();
|
let role_ids: HashSet<i32> = player.role_list.keys().cloned().collect();
|
||||||
let all_exist = request.role_list.iter().all(|id| role_ids.contains(id));
|
let all_exist = request.role_list.iter().all(|id| role_ids.contains(id));
|
||||||
|
|
||||||
if all_exist {
|
if all_exist {
|
||||||
ctx.player.basic_info.role_show_list = request.role_list;
|
player.basic_info.role_show_list = request.role_list;
|
||||||
response.error_code = ErrorCode::Success.into();
|
response.error_code = ErrorCode::Success.into();
|
||||||
} else {
|
} else {
|
||||||
response.error_code = ErrorCode::InvalidRequest.into(); // TODO: replace with appropriate error code
|
response.error_code = ErrorCode::InvalidRequest.into(); // TODO: replace with appropriate error code
|
||||||
|
@ -38,7 +27,7 @@ pub fn on_role_show_list_update_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_client_current_role_report_request(
|
pub fn on_client_current_role_report_request(
|
||||||
_ctx: &NetContext,
|
_player: &Player,
|
||||||
request: ClientCurrentRoleReportRequest,
|
request: ClientCurrentRoleReportRequest,
|
||||||
response: &mut ClientCurrentRoleReportResponse,
|
response: &mut ClientCurrentRoleReportResponse,
|
||||||
) {
|
) {
|
||||||
|
@ -47,7 +36,7 @@ pub fn on_client_current_role_report_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_role_favor_list_request(
|
pub fn on_role_favor_list_request(
|
||||||
_ctx: &NetContext,
|
_player: &Player,
|
||||||
_request: RoleFavorListRequest,
|
_request: RoleFavorListRequest,
|
||||||
response: &mut RoleFavorListResponse,
|
response: &mut RoleFavorListResponse,
|
||||||
) {
|
) {
|
||||||
|
@ -56,7 +45,7 @@ pub fn on_role_favor_list_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_formation_attr_request(
|
pub fn on_formation_attr_request(
|
||||||
_ctx: &NetContext,
|
_player: &Player,
|
||||||
_request: FormationAttrRequest,
|
_request: FormationAttrRequest,
|
||||||
response: &mut FormationAttrResponse,
|
response: &mut FormationAttrResponse,
|
||||||
) {
|
) {
|
||||||
|
@ -64,11 +53,12 @@ pub fn on_formation_attr_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_update_formation_request(
|
pub fn on_update_formation_request(
|
||||||
ctx: &mut NetContext,
|
player: &mut Player,
|
||||||
request: UpdateFormationRequest,
|
request: UpdateFormationRequest,
|
||||||
response: &mut UpdateFormationResponse,
|
response: &mut UpdateFormationResponse,
|
||||||
) {
|
) {
|
||||||
let world = ctx.world.get_mut_world_entity();
|
let mut world_ref = player.world.borrow_mut();
|
||||||
|
let world = world_ref.get_mut_world_entity();
|
||||||
|
|
||||||
for formation in request.formations {
|
for formation in request.formations {
|
||||||
let formation_id = formation.formation_id;
|
let formation_id = formation.formation_id;
|
||||||
|
@ -77,12 +67,11 @@ pub fn on_update_formation_request(
|
||||||
|
|
||||||
if is_current {
|
if is_current {
|
||||||
// update player current formation id
|
// update player current formation id
|
||||||
ctx.player.cur_formation_id = formation_id;
|
player.cur_formation_id = formation_id;
|
||||||
|
|
||||||
// search old formation id and set real_formation_id, set is_current to false
|
// search old formation id and set real_formation_id, set is_current to false
|
||||||
let mut real_formation_id = formation_id;
|
let mut real_formation_id = formation_id;
|
||||||
if let Some(rf) = ctx
|
if let Some(rf) = player
|
||||||
.player
|
|
||||||
.formation_list
|
.formation_list
|
||||||
.values_mut()
|
.values_mut()
|
||||||
.find(|rf| rf.is_current && rf.id != formation_id)
|
.find(|rf| rf.is_current && rf.id != formation_id)
|
||||||
|
@ -91,7 +80,7 @@ pub fn on_update_formation_request(
|
||||||
rf.is_current = false;
|
rf.is_current = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(old_formation) = ctx.player.formation_list.get(&real_formation_id) {
|
if let Some(old_formation) = player.formation_list.get(&real_formation_id) {
|
||||||
let removed_entities: Vec<i64> = old_formation
|
let removed_entities: Vec<i64> = old_formation
|
||||||
.role_ids
|
.role_ids
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -100,30 +89,25 @@ pub fn on_update_formation_request(
|
||||||
removed_entities.iter().for_each(|&entity_id| {
|
removed_entities.iter().for_each(|&entity_id| {
|
||||||
world.remove_entity(entity_id as i32);
|
world.remove_entity(entity_id as i32);
|
||||||
});
|
});
|
||||||
ctx.player
|
player.notify(player.build_player_entity_remove_notify(
|
||||||
.notify(ctx.player.build_player_entity_remove_notify(
|
|
||||||
removed_entities,
|
removed_entities,
|
||||||
ERemoveEntityType::RemoveTypeNormal,
|
ERemoveEntityType::RemoveTypeNormal,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
let added_roles: Vec<&Role> = formation
|
let added_roles: Vec<Role> = formation
|
||||||
.role_ids
|
.role_ids
|
||||||
.iter()
|
.iter()
|
||||||
.map(|role_id| ctx.player.role_list.get(role_id).unwrap())
|
.map(|&role_id| Role::new(role_id))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
if !added_roles.is_empty() {
|
if !added_roles.is_empty() {
|
||||||
// add new roles
|
// add new roles
|
||||||
ctx.player.notify(
|
player.notify(player.build_player_entity_add_notify(added_roles));
|
||||||
ctx.player
|
|
||||||
.build_player_entity_add_notify(added_roles, world),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// send update group formation notify
|
// send update group formation notify
|
||||||
ctx.player
|
player.notify(player.build_update_group_formation_notify(
|
||||||
.notify(ctx.player.build_update_group_formation_notify(
|
|
||||||
RoleFormation {
|
RoleFormation {
|
||||||
id: formation_id,
|
id: formation_id,
|
||||||
cur_role,
|
cur_role,
|
||||||
|
@ -137,7 +121,7 @@ pub fn on_update_formation_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
// update all formation and check formation_list
|
// update all formation and check formation_list
|
||||||
ctx.player
|
player
|
||||||
.formation_list
|
.formation_list
|
||||||
.entry(formation_id)
|
.entry(formation_id)
|
||||||
.and_modify(|r| {
|
.and_modify(|r| {
|
||||||
|
@ -153,14 +137,13 @@ pub fn on_update_formation_request(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.player
|
player.notify(player.build_update_formation_notify());
|
||||||
.notify(ctx.player.build_update_formation_notify());
|
|
||||||
|
|
||||||
response.error_code = ErrorCode::Success.into();
|
response.error_code = ErrorCode::Success.into();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_player_motion_request(
|
pub fn on_player_motion_request(
|
||||||
_: &NetContext,
|
_: &Player,
|
||||||
request: PlayerMotionRequest,
|
request: PlayerMotionRequest,
|
||||||
response: &mut PlayerMotionResponse,
|
response: &mut PlayerMotionResponse,
|
||||||
) {
|
) {
|
||||||
|
@ -169,417 +152,3 @@ pub fn on_player_motion_request(
|
||||||
Some(_) => response.error_id = ErrorCode::Success.into(),
|
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,19 +1,14 @@
|
||||||
use wicked_waifus_protocol::{
|
use wicked_waifus_protocol::{ErrorCode, SceneLoadingFinishRequest, SceneLoadingFinishResponse, SceneTraceRequest, SceneTraceResponse, UpdateSceneDateRequest, UpdateSceneDateResponse, AccessPathTimeServerConfigRequest, AccessPathTimeServerConfigResponse, PlayerHeadDataRequest, PlayerHeadDataResponse, UnlockRoleSkinListRequest, UnlockRoleSkinListResponse, JsPatchNotify};
|
||||||
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-disable.js");
|
||||||
const UID_FIX: &str = include_str!("../../../scripts/uidfix.js");
|
const UID_FIX: &str = include_str!("../../../scripts/uidfix.js");
|
||||||
const CENSORSHIP_FIX: &str = include_str!("../../../scripts/censorshipfix.js");
|
const CENSORSHIP_FIX: &str = include_str!("../../../scripts/censorshipfix.js");
|
||||||
const DEBUG_DISABLE: &str = include_str!("../../../scripts/debug_disable.js");
|
const DEBUG_DISABLE: &str = include_str!("../../../scripts/debug_disable.js");
|
||||||
|
|
||||||
use crate::logic::thread_mgr::NetContext;
|
use crate::logic::player::Player;
|
||||||
|
|
||||||
pub fn on_scene_trace_request(
|
pub fn on_scene_trace_request(
|
||||||
_ctx: &NetContext,
|
_player: &Player,
|
||||||
request: SceneTraceRequest,
|
request: SceneTraceRequest,
|
||||||
_: &mut SceneTraceResponse,
|
_: &mut SceneTraceResponse,
|
||||||
) {
|
) {
|
||||||
|
@ -21,22 +16,22 @@ pub fn on_scene_trace_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_scene_loading_finish_request(
|
pub fn on_scene_loading_finish_request(
|
||||||
ctx: &NetContext,
|
player: &Player,
|
||||||
_request: SceneLoadingFinishRequest,
|
_request: SceneLoadingFinishRequest,
|
||||||
response: &mut SceneLoadingFinishResponse,
|
response: &mut SceneLoadingFinishResponse,
|
||||||
) {
|
) {
|
||||||
ctx.player.notify(JsPatchNotify {
|
player.notify(JsPatchNotify {
|
||||||
content: WATER_MASK.to_string(),
|
content: WATER_MASK.to_string(),
|
||||||
});
|
});
|
||||||
ctx.player.notify(JsPatchNotify {
|
player.notify(JsPatchNotify {
|
||||||
content: UID_FIX
|
content: UID_FIX
|
||||||
.replace("{PLAYER_USERNAME}", &ctx.player.basic_info.name)
|
.replace("{PLAYER_USERNAME}", &player.basic_info.name)
|
||||||
.replace("{SELECTED_COLOR}", "50FC71"),
|
.replace("{SELECTED_COLOR}", "50FC71"),
|
||||||
});
|
});
|
||||||
ctx.player.notify(JsPatchNotify {
|
player.notify(JsPatchNotify {
|
||||||
content: CENSORSHIP_FIX.to_string(),
|
content: CENSORSHIP_FIX.to_string(),
|
||||||
});
|
});
|
||||||
ctx.player.notify(JsPatchNotify {
|
player.notify(JsPatchNotify {
|
||||||
content: DEBUG_DISABLE.to_string(),
|
content: DEBUG_DISABLE.to_string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -45,7 +40,7 @@ pub fn on_scene_loading_finish_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_update_scene_date_request(
|
pub fn on_update_scene_date_request(
|
||||||
_ctx: &NetContext,
|
_player: &Player,
|
||||||
_request: UpdateSceneDateRequest,
|
_request: UpdateSceneDateRequest,
|
||||||
response: &mut UpdateSceneDateResponse,
|
response: &mut UpdateSceneDateResponse,
|
||||||
) {
|
) {
|
||||||
|
@ -54,7 +49,7 @@ pub fn on_update_scene_date_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_access_path_time_server_config_request(
|
pub fn on_access_path_time_server_config_request(
|
||||||
_ctx: &NetContext,
|
_player: &Player,
|
||||||
_request: AccessPathTimeServerConfigRequest,
|
_request: AccessPathTimeServerConfigRequest,
|
||||||
response: &mut AccessPathTimeServerConfigResponse,
|
response: &mut AccessPathTimeServerConfigResponse,
|
||||||
) {
|
) {
|
||||||
|
@ -63,10 +58,21 @@ pub fn on_access_path_time_server_config_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_player_head_data_request(
|
pub fn on_player_head_data_request(
|
||||||
_ctx: &NetContext,
|
_player: &Player,
|
||||||
_request: PlayerHeadDataRequest,
|
_request: PlayerHeadDataRequest,
|
||||||
response: &mut PlayerHeadDataResponse,
|
response: &mut PlayerHeadDataResponse,
|
||||||
) {
|
) {
|
||||||
// TODO: port this from golang
|
// TODO: port this from golang
|
||||||
response.pi = vec![];
|
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,26 +1,23 @@
|
||||||
use crate::logic::ecs::component::ComponentContainer;
|
use crate::logic::ecs::component::ComponentContainer;
|
||||||
use wicked_waifus_protocol::{
|
use wicked_waifus_protocol::{ErrorCode, ExploreSkillRouletteSetRequest, ExploreSkillRouletteSetResponse, VisionExploreSkillSetRequest, VisionExploreSkillSetResponse, VisionSkillChangeNotify, VisionSkillInformation};
|
||||||
ErrorCode, ExploreSkillRouletteSetRequest, ExploreSkillRouletteSetResponse,
|
|
||||||
VisionExploreSkillSetRequest, VisionExploreSkillSetResponse, VisionSkillChangeNotify,
|
|
||||||
VisionSkillInformation,
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::logic::thread_mgr::NetContext;
|
use crate::{logic::player::Player, query_with};
|
||||||
use crate::query_with;
|
|
||||||
|
|
||||||
pub fn on_vision_explore_skill_set_request(
|
pub fn on_vision_explore_skill_set_request(
|
||||||
ctx: &mut NetContext,
|
player: &mut Player,
|
||||||
request: VisionExploreSkillSetRequest,
|
request: VisionExploreSkillSetRequest,
|
||||||
response: &mut VisionExploreSkillSetResponse,
|
response: &mut VisionExploreSkillSetResponse,
|
||||||
) {
|
) {
|
||||||
ctx.player.explore_tools.active_explore_skill = request.skill_id;
|
player.explore_tools.active_explore_skill = request.skill_id;
|
||||||
|
|
||||||
for (entity, owner, mut vision_skill) in
|
for (entity, owner, mut vision_skill) in query_with!(
|
||||||
query_with!(ctx.world.get_world_entity(), OwnerPlayer, VisionSkill)
|
player.world.borrow().get_world_entity(),
|
||||||
{
|
OwnerPlayer,
|
||||||
if owner.0 == ctx.player.basic_info.id {
|
VisionSkill
|
||||||
|
) {
|
||||||
|
if owner.0 == player.basic_info.id {
|
||||||
vision_skill.skill_id = request.skill_id;
|
vision_skill.skill_id = request.skill_id;
|
||||||
ctx.player.notify(VisionSkillChangeNotify {
|
player.notify(VisionSkillChangeNotify {
|
||||||
entity_id: entity.into(),
|
entity_id: entity.into(),
|
||||||
vision_skill_infos: vec![VisionSkillInformation {
|
vision_skill_infos: vec![VisionSkillInformation {
|
||||||
skill_id: request.skill_id,
|
skill_id: request.skill_id,
|
||||||
|
@ -35,34 +32,25 @@ pub fn on_vision_explore_skill_set_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_explore_skill_roulette_set_request(
|
pub fn on_explore_skill_roulette_set_request(
|
||||||
ctx: &mut NetContext,
|
player: &mut Player,
|
||||||
request: ExploreSkillRouletteSetRequest,
|
request: ExploreSkillRouletteSetRequest,
|
||||||
response: &mut ExploreSkillRouletteSetResponse,
|
response: &mut ExploreSkillRouletteSetResponse,
|
||||||
) {
|
) {
|
||||||
let mut illegal_skill = false;
|
let mut illegal_skill = false;
|
||||||
for skill_roulette in &request.skill_roulettes {
|
for skill_roulette in &request.skill_roulettes {
|
||||||
for skill_id in &skill_roulette.skill_ids {
|
for skill_id in &skill_roulette.skill_ids {
|
||||||
if *skill_id != 0
|
if *skill_id != 0 && !player.explore_tools.unlocked_explore_skills.contains(skill_id) {
|
||||||
&& !ctx
|
|
||||||
.player
|
|
||||||
.explore_tools
|
|
||||||
.unlocked_explore_skills
|
|
||||||
.contains(skill_id)
|
|
||||||
{
|
|
||||||
illegal_skill = true;
|
illegal_skill = true;
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
match illegal_skill {
|
match illegal_skill {
|
||||||
true => response.error_code = ErrorCode::ErrRouletteFuncIdInvaild.into(),
|
true => response.error_code = ErrorCode::ErrRouletteFuncIdInvaild.into(),
|
||||||
false => {
|
false => {
|
||||||
ctx.player.explore_tools.roulette = request
|
player.explore_tools.roulette = request.skill_roulettes.get(0).unwrap().skill_ids.iter()
|
||||||
.skill_roulettes
|
.map(|&skill_id| skill_id)
|
||||||
.first()
|
.collect::<Vec<i32>>()
|
||||||
.unwrap()
|
|
||||||
.skill_ids
|
|
||||||
.to_vec()
|
|
||||||
.as_slice()
|
.as_slice()
|
||||||
.try_into()
|
.try_into()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
|
@ -1,51 +1,37 @@
|
||||||
use wicked_waifus_protocol::{
|
use wicked_waifus_protocol::{ErrorCode, JoinSceneNotify, LeaveSceneNotify, TeleportDataRequest, TeleportDataResponse, TeleportFinishRequest, TeleportFinishResponse, TeleportNotify, TeleportReason, TeleportTransferRequest, TeleportTransferResponse, TransitionOptionPb};
|
||||||
ErrorCode, JoinSceneNotify, LeaveSceneNotify, TeleportDataRequest, TeleportDataResponse,
|
|
||||||
TeleportFinishRequest, TeleportFinishResponse, TeleportNotify, TeleportReason,
|
|
||||||
TeleportTransferRequest, TeleportTransferResponse, TransitionOptionPb,
|
|
||||||
};
|
|
||||||
|
|
||||||
use wicked_waifus_data::pb_components::teleport::TeleportComponent;
|
|
||||||
use wicked_waifus_data::{level_entity_config_data, RawVectorData};
|
use wicked_waifus_data::{level_entity_config_data, RawVectorData};
|
||||||
|
use wicked_waifus_data::pb_components::teleport::TeleportComponent;
|
||||||
|
|
||||||
use crate::logic::math::Vector3f;
|
use crate::logic::math::Vector3f;
|
||||||
use crate::logic::thread_mgr::NetContext;
|
use crate::logic::player::Player;
|
||||||
use crate::logic::utils::world_util;
|
use crate::logic::utils::world_util;
|
||||||
|
|
||||||
pub fn on_teleport_data_request(
|
pub fn on_teleport_data_request(
|
||||||
ctx: &NetContext,
|
player: &mut Player,
|
||||||
_: TeleportDataRequest,
|
_: TeleportDataRequest,
|
||||||
response: &mut TeleportDataResponse,
|
response: &mut TeleportDataResponse,
|
||||||
) {
|
) {
|
||||||
response.error_code = ErrorCode::Success.into();
|
response.error_code = ErrorCode::Success.into();
|
||||||
response.ids = ctx
|
response.ids = player.teleports.teleports_data.iter()
|
||||||
.player
|
|
||||||
.teleports
|
|
||||||
.teleports_data
|
|
||||||
.iter()
|
|
||||||
.map(|teleport| teleport.id)
|
.map(|teleport| teleport.id)
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_teleport_transfer_request(
|
pub fn on_teleport_transfer_request(
|
||||||
ctx: &mut NetContext,
|
player: &mut Player,
|
||||||
request: TeleportTransferRequest,
|
request: TeleportTransferRequest,
|
||||||
response: &mut TeleportTransferResponse,
|
response: &mut TeleportTransferResponse,
|
||||||
) {
|
) {
|
||||||
tracing::debug!("received transfer request for teleport id: {}", request.id);
|
tracing::debug!("received transfer request for teleport id: {}", request.id);
|
||||||
let Some(teleport) =
|
let Some(teleport) = wicked_waifus_data::teleporter_data::iter()
|
||||||
wicked_waifus_data::teleporter_data::iter().find(|teleporter| request.id == teleporter.id)
|
.find(|teleporter| request.id == teleporter.id) else {
|
||||||
else {
|
|
||||||
response.error_code = ErrorCode::ErrTeleportIdNotExist.into();
|
response.error_code = ErrorCode::ErrTeleportIdNotExist.into();
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
println!(
|
println!("received transfer request for teleport entity id: {}", &teleport.teleport_entity_config_id);
|
||||||
"received transfer request for teleport entity id: {}",
|
let Some(tp) = level_entity_config_data::get(teleport.map_id, teleport.teleport_entity_config_id) else {
|
||||||
&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();
|
response.error_code = ErrorCode::ErrTeleportEntityNotExist.into();
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
@ -55,7 +41,8 @@ pub fn on_teleport_transfer_request(
|
||||||
return;
|
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();
|
response.error_code = ErrorCode::ErrTeleportGmGetCreatureGenCfgFailed.into();
|
||||||
}
|
}
|
||||||
if teleport_component.teleporter_id.unwrap() != request.id {
|
if teleport_component.teleporter_id.unwrap() != request.id {
|
||||||
|
@ -71,8 +58,8 @@ pub fn on_teleport_transfer_request(
|
||||||
response.yaw = 0f32;
|
response.yaw = 0f32;
|
||||||
response.roll = 0f32;
|
response.roll = 0f32;
|
||||||
|
|
||||||
if ctx.player.basic_info.cur_map_id == teleport.map_id {
|
if player.basic_info.cur_map_id == teleport.map_id {
|
||||||
ctx.player.notify(TeleportNotify {
|
player.notify(TeleportNotify {
|
||||||
map_id: teleport.map_id,
|
map_id: teleport.map_id,
|
||||||
pos: Some(teleport_position.to_protobuf()),
|
pos: Some(teleport_position.to_protobuf()),
|
||||||
rot: None,
|
rot: None,
|
||||||
|
@ -84,14 +71,14 @@ pub fn on_teleport_transfer_request(
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// remove entity
|
// remove entity
|
||||||
ctx.player.notify(LeaveSceneNotify {
|
player.notify(LeaveSceneNotify {
|
||||||
player_id: ctx.player.basic_info.id,
|
player_id: player.basic_info.id,
|
||||||
scene_id: "".to_string(),
|
scene_id: "".to_string(),
|
||||||
transition_option: Some(TransitionOptionPb::default()),
|
transition_option: Some(TransitionOptionPb::default()),
|
||||||
});
|
});
|
||||||
let scene_info = world_util::build_scene_information(ctx);
|
let scene_info = world_util::build_scene_information(&player);
|
||||||
// TODO: Trigger initial join world flow??
|
// TODO: Trigger initial join world flow??
|
||||||
ctx.player.notify(JoinSceneNotify {
|
player.notify(JoinSceneNotify {
|
||||||
scene_info: Some(scene_info),
|
scene_info: Some(scene_info),
|
||||||
max_entity_id: i64::MAX,
|
max_entity_id: i64::MAX,
|
||||||
transition_option: Some(TransitionOptionPb::default()),
|
transition_option: Some(TransitionOptionPb::default()),
|
||||||
|
@ -101,7 +88,7 @@ pub fn on_teleport_transfer_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_teleport_finish_request(
|
pub fn on_teleport_finish_request(
|
||||||
_ctx: &mut NetContext,
|
_player: &mut Player,
|
||||||
_: TeleportFinishRequest,
|
_: TeleportFinishRequest,
|
||||||
response: &mut TeleportFinishResponse,
|
response: &mut TeleportFinishResponse,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -4,15 +4,14 @@ use wicked_waifus_protocol::{
|
||||||
TutorialReceiveResponse, TutorialUnlockRequest, TutorialUnlockResponse,
|
TutorialReceiveResponse, TutorialUnlockRequest, TutorialUnlockResponse,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::logic::thread_mgr::NetContext;
|
use crate::logic::player::Player;
|
||||||
|
|
||||||
pub fn on_tutorial_info_request(
|
pub fn on_tutorial_info_request(
|
||||||
ctx: &NetContext,
|
player: &mut Player,
|
||||||
_: TutorialInfoRequest,
|
_: TutorialInfoRequest,
|
||||||
response: &mut TutorialInfoResponse,
|
response: &mut TutorialInfoResponse,
|
||||||
) {
|
) {
|
||||||
response.unlock_list = ctx
|
response.unlock_list = player
|
||||||
.player
|
|
||||||
.tutorials
|
.tutorials
|
||||||
.tutorials
|
.tutorials
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -25,7 +24,7 @@ pub fn on_tutorial_info_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_tutorial_receive_request(
|
pub fn on_tutorial_receive_request(
|
||||||
ctx: &mut NetContext,
|
player: &mut Player,
|
||||||
request: TutorialReceiveRequest,
|
request: TutorialReceiveRequest,
|
||||||
response: &mut TutorialReceiveResponse,
|
response: &mut TutorialReceiveResponse,
|
||||||
) {
|
) {
|
||||||
|
@ -36,13 +35,12 @@ pub fn on_tutorial_receive_request(
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
let Some(tutorial) = ctx
|
let Some(tutorial) = player
|
||||||
.player
|
|
||||||
.tutorials
|
.tutorials
|
||||||
.tutorials
|
.tutorials
|
||||||
.iter()
|
.iter()
|
||||||
.find(|tutorial| tutorial.id == request.id)
|
.find(|tutorial| tutorial.id == request.id) else {
|
||||||
else {
|
|
||||||
response.error_code = ErrorCode::GuideTutorialNotUnlock.into();
|
response.error_code = ErrorCode::GuideTutorialNotUnlock.into();
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
@ -53,10 +51,7 @@ pub fn on_tutorial_receive_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Search the rewards in drop_package
|
// TODO: Search the rewards in drop_package
|
||||||
tracing::debug!(
|
tracing::debug!("Tutorial receive request with drop: {}", tutorial_data.drop_id);
|
||||||
"Tutorial receive request with drop: {}",
|
|
||||||
tutorial_data.drop_id
|
|
||||||
);
|
|
||||||
|
|
||||||
// TODO: Fill in the item map
|
// TODO: Fill in the item map
|
||||||
response.error_code = ErrorCode::Success.into();
|
response.error_code = ErrorCode::Success.into();
|
||||||
|
@ -64,7 +59,7 @@ pub fn on_tutorial_receive_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_tutorial_unlock_request(
|
pub fn on_tutorial_unlock_request(
|
||||||
ctx: &mut NetContext,
|
player: &mut Player,
|
||||||
request: TutorialUnlockRequest,
|
request: TutorialUnlockRequest,
|
||||||
response: &mut TutorialUnlockResponse,
|
response: &mut TutorialUnlockResponse,
|
||||||
) {
|
) {
|
||||||
|
@ -75,8 +70,7 @@ pub fn on_tutorial_unlock_request(
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(tutorial) = ctx
|
if let Some(tutorial) = player
|
||||||
.player
|
|
||||||
.tutorials
|
.tutorials
|
||||||
.tutorials
|
.tutorials
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -90,7 +84,7 @@ pub fn on_tutorial_unlock_request(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let tutorial = ctx.player.unlock_tutorial(request.id);
|
let tutorial = player.unlock_tutorial(request.id);
|
||||||
response.un_lock_info = Some(TutorialInfo {
|
response.un_lock_info = Some(TutorialInfo {
|
||||||
id: tutorial.id,
|
id: tutorial.id,
|
||||||
create_time: tutorial.create_time,
|
create_time: tutorial.create_time,
|
||||||
|
|
|
@ -1,177 +0,0 @@
|
||||||
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) {
|
pub fn set_rotation_from_protobuf(&mut self, rotator: &Rotator) {
|
||||||
self.rotation.x = rotator.roll;
|
self.rotation.x = rotator.pitch;
|
||||||
self.rotation.y = rotator.pitch;
|
self.rotation.y = rotator.yaw;
|
||||||
self.rotation.z = rotator.yaw;
|
self.rotation.z = rotator.roll;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn load_from_save(data: TransformData) -> Self {
|
pub fn load_from_save(data: TransformData) -> Self {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
pub use in_world_player::InWorldPlayer;
|
pub use in_world_player::InWorldPlayer;
|
||||||
|
use std::cell::RefCell;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
use std::rc::Rc;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use wicked_waifus_commons::time_util;
|
use wicked_waifus_commons::time_util;
|
||||||
use wicked_waifus_data::motion_data;
|
use wicked_waifus_data::motion_data;
|
||||||
|
@ -9,20 +11,23 @@ use wicked_waifus_protocol::{
|
||||||
AdventreTask, AdventureManualData, AdventureUpdateNotify, AdviceSettingNotify, BuffItemNotify,
|
AdventreTask, AdventureManualData, AdventureUpdateNotify, AdviceSettingNotify, BuffItemNotify,
|
||||||
ControlInfoNotify, EEntityType, ERemoveEntityType, EnergyInfo, EnergyUpdateNotify,
|
ControlInfoNotify, EEntityType, ERemoveEntityType, EnergyInfo, EnergyUpdateNotify,
|
||||||
EntityAddNotify, EntityConfigType, EntityPb, EntityRemoveInfo, EntityRemoveNotify, EntityState,
|
EntityAddNotify, EntityConfigType, EntityPb, EntityRemoveInfo, EntityRemoveNotify, EntityState,
|
||||||
FavorItem, FightFormationNotifyInfo, FightRoleInfo, FightRoleInfos, FlyEquipAddNotify,
|
FavorItem, FightFormationNotifyInfo, FightRoleInfo, FightRoleInfos, FormationRoleInfo,
|
||||||
FlySkinEquipData, GroupFormation, HostTeleportUnlockNotify, InstDataNotify, ItemPkgOpenNotify,
|
GroupFormation, HostTeleportUnlockNotify, InstDataNotify, ItemPkgOpenNotify,
|
||||||
LevelPlayInfoNotify, LivingStatus, MailInfosNotify, MonthCardDailyRewardNotify,
|
LevelPlayInfoNotify, LivingStatus, MailInfosNotify, MapUnlockFieldNotify,
|
||||||
MoonChasingTargetGetCountNotify, MoonChasingTrackMoonHandbookRewardNotify,
|
MonthCardDailyRewardNotify, MoonChasingTargetGetCountNotify,
|
||||||
NormalItemUpdateNotify, PassiveSkillNotify, PbGetRoleListNotify, PlayerAttr, PlayerAttrKey,
|
MoonChasingTrackMoonHandbookRewardNotify, NormalItemUpdateNotify, PassiveSkillNotify,
|
||||||
PlayerAttrNotify, PlayerAttrType, PlayerFightFormations, PlayerVarNotify, ProtocolUnit,
|
PbGetRoleListNotify, PlayerAttr, PlayerAttrKey, PlayerAttrNotify, PlayerAttrType,
|
||||||
PushContextIdNotify, PushDataCompleteNotify, RoguelikeCurrencyNotify, RoleChangeUnlockNotify,
|
PlayerFightFormations, PlayerVarNotify, ProtocolUnit, PushContextIdNotify,
|
||||||
RoleFavor, RoleFavorListNotify, RoleFlyEquipNotify, RoleMotion, RoleMotionListNotify,
|
PushDataCompleteNotify, RoguelikeCurrencyNotify, RoleChangeUnlockNotify, RoleFavor,
|
||||||
SettingNotify, TeleportUpdateNotify, UnlockSkinDataNotify, UpdateFormationNotify,
|
RoleFavorListNotify, RoleMotion, RoleMotionListNotify, SettingNotify, TeleportUpdateNotify,
|
||||||
UpdateGroupFormationNotify,
|
UpdateFormationNotify, UpdateGroupFormationNotify,
|
||||||
};
|
};
|
||||||
use wicked_waifus_protocol_internal::{PlayerBasicData, PlayerRoleData, PlayerSaveData};
|
use wicked_waifus_protocol_internal::{PlayerBasicData, PlayerRoleData, PlayerSaveData};
|
||||||
|
|
||||||
use super::role::{Role, RoleFormation};
|
use super::{
|
||||||
|
ecs::world::World,
|
||||||
|
role::{Role, RoleFormation},
|
||||||
|
};
|
||||||
use crate::logic::components::RoleSkin;
|
use crate::logic::components::RoleSkin;
|
||||||
use crate::logic::ecs::world::WorldEntity;
|
use crate::logic::ecs::world::WorldEntity;
|
||||||
use crate::logic::player::basic_info::PlayerBasicInfo;
|
use crate::logic::player::basic_info::PlayerBasicInfo;
|
||||||
|
@ -41,17 +46,16 @@ use crate::logic::player::player_mc_element::PlayerMcElement;
|
||||||
use crate::logic::player::player_month_card::PlayerMonthCard;
|
use crate::logic::player::player_month_card::PlayerMonthCard;
|
||||||
use crate::logic::player::player_teleports::{PlayerTeleport, PlayerTeleports};
|
use crate::logic::player::player_teleports::{PlayerTeleport, PlayerTeleports};
|
||||||
use crate::logic::player::player_tutorials::{PlayerTutorial, PlayerTutorials};
|
use crate::logic::player::player_tutorials::{PlayerTutorial, PlayerTutorials};
|
||||||
use crate::logic::player::Element::Spectro;
|
|
||||||
use crate::logic::{
|
use crate::logic::{
|
||||||
components::{
|
components::{
|
||||||
Attribute, EntityConfig, Equip, FightBuff, Movement, OwnerPlayer, ParaglidingSkin,
|
Attribute, EntityConfig, Equip, FightBuff, Movement, OwnerPlayer, PlayerOwnedEntityMarker,
|
||||||
PlayerOwnedEntityMarker, Position, SoarWingSkin, Visibility, VisionSkill, WeaponSkin,
|
Position, Visibility, VisionSkill, SoarWingSkin
|
||||||
},
|
},
|
||||||
ecs::component::ComponentContainer,
|
ecs::component::ComponentContainer,
|
||||||
};
|
};
|
||||||
use crate::session::Session;
|
use crate::session::Session;
|
||||||
use crate::{config, create_player_entity_pb};
|
use crate::{config, create_player_entity_pb, query_components};
|
||||||
use crate::logic::player::player_unlocked_skins::PlayerUnlockedSkins;
|
use crate::logic::player::Element::Spectro;
|
||||||
|
|
||||||
mod basic_info;
|
mod basic_info;
|
||||||
mod explore_tools;
|
mod explore_tools;
|
||||||
|
@ -68,7 +72,6 @@ mod player_mc_element;
|
||||||
mod player_month_card;
|
mod player_month_card;
|
||||||
mod player_teleports;
|
mod player_teleports;
|
||||||
mod player_tutorials;
|
mod player_tutorials;
|
||||||
mod player_unlocked_skins;
|
|
||||||
|
|
||||||
pub struct Player {
|
pub struct Player {
|
||||||
session: Option<Arc<Session>>,
|
session: Option<Arc<Session>>,
|
||||||
|
@ -90,9 +93,8 @@ pub struct Player {
|
||||||
pub map_trace: PlayerMapTrace,
|
pub map_trace: PlayerMapTrace,
|
||||||
pub month_card: PlayerMonthCard,
|
pub month_card: PlayerMonthCard,
|
||||||
pub mc_element: PlayerMcElement,
|
pub mc_element: PlayerMcElement,
|
||||||
pub unlocked_skins: PlayerUnlockedSkins,
|
|
||||||
// Runtime
|
// Runtime
|
||||||
pub world_owner_id: i32,
|
pub world: Rc<RefCell<World>>,
|
||||||
pub last_save_time: u64,
|
pub last_save_time: u64,
|
||||||
pub quadrant_id: u64,
|
pub quadrant_id: u64,
|
||||||
}
|
}
|
||||||
|
@ -121,10 +123,6 @@ impl Player {
|
||||||
self.notify(self.explore_tools.build_roulette_update_notify());
|
self.notify(self.explore_tools.build_roulette_update_notify());
|
||||||
self.notify(self.build_role_favor_list_notify());
|
self.notify(self.build_role_favor_list_notify());
|
||||||
self.notify(self.func.build_func_open_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 {
|
self.notify(InstDataNotify {
|
||||||
enter_infos: vec![], // TODO: No effect in normal world, to implement for dungeon::logic()
|
enter_infos: vec![], // TODO: No effect in normal world, to implement for dungeon::logic()
|
||||||
});
|
});
|
||||||
|
@ -213,11 +211,6 @@ impl Player {
|
||||||
self.role_list.insert(role_id, Role::new(role_id));
|
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.formation_list.insert(1, RoleFormation::default());
|
||||||
self.cur_formation_id = 1;
|
self.cur_formation_id = 1;
|
||||||
|
@ -303,8 +296,6 @@ impl Player {
|
||||||
.collect::<Vec<_>>(),
|
.collect::<Vec<_>>(),
|
||||||
now_chapter: global_status.now_chapter,
|
now_chapter: global_status.now_chapter,
|
||||||
received_chapter: global_status.received_chapter,
|
received_chapter: global_status.received_chapter,
|
||||||
unlock_chapters: vec![],
|
|
||||||
reward_chapters: vec![],
|
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>(),
|
.collect::<Vec<_>>(),
|
||||||
}
|
}
|
||||||
|
@ -314,8 +305,8 @@ impl Player {
|
||||||
RoleFavorListNotify {
|
RoleFavorListNotify {
|
||||||
favor_list: self
|
favor_list: self
|
||||||
.role_list
|
.role_list
|
||||||
.values()
|
.iter()
|
||||||
.map(|role| RoleFavor {
|
.map(|(_, role)| RoleFavor {
|
||||||
role_id: role.role_id,
|
role_id: role.role_id,
|
||||||
level: role.favor_level,
|
level: role.favor_level,
|
||||||
exp: role.favor_exp,
|
exp: role.favor_exp,
|
||||||
|
@ -347,73 +338,12 @@ 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 {
|
pub fn build_motion_list_notify(&self) -> RoleMotionListNotify {
|
||||||
RoleMotionListNotify {
|
RoleMotionListNotify {
|
||||||
motion_list: self
|
motion_list: self
|
||||||
.role_list
|
.role_list
|
||||||
.values()
|
.iter()
|
||||||
.map(|role| {
|
.map(|(_, role)| {
|
||||||
RoleMotion {
|
RoleMotion {
|
||||||
role_id: role.role_id,
|
role_id: role.role_id,
|
||||||
motion_ids: motion_data::iter()
|
motion_ids: motion_data::iter()
|
||||||
|
@ -432,15 +362,14 @@ impl Player {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_player_entity_add_notify(&self, role_list: Vec<&Role>, world: &mut WorldEntity) -> EntityAddNotify {
|
pub fn build_player_entity_add_notify(&self, role_list: Vec<Role>) -> EntityAddNotify {
|
||||||
create_player_entity_pb!(
|
create_player_entity_pb!(
|
||||||
role_list,
|
role_list,
|
||||||
self.basic_info.cur_map_id,
|
self.basic_info.cur_map_id,
|
||||||
self,
|
self,
|
||||||
self.basic_info.id,
|
self.basic_info.id,
|
||||||
self.location.position.clone(),
|
self.location.position.clone(),
|
||||||
self.explore_tools,
|
self.explore_tools
|
||||||
world
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -475,10 +404,15 @@ impl Player {
|
||||||
fight_role_infos: cur_formation
|
fight_role_infos: cur_formation
|
||||||
.role_ids
|
.role_ids
|
||||||
.iter()
|
.iter()
|
||||||
.map(|&role_id| FightRoleInfo {
|
.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,
|
role_id,
|
||||||
entity_id: world.get_entity_id(role_id),
|
entity_id: world.get_entity_id(role_id),
|
||||||
on_stage_without_control: false,
|
on_stage_without_control: false,
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.collect(),
|
.collect(),
|
||||||
cur_role: cur_formation.cur_role,
|
cur_role: cur_formation.cur_role,
|
||||||
|
@ -515,7 +449,14 @@ impl Player {
|
||||||
tracing::warn!("Role {} not found in use role list", role_id);
|
tracing::warn!("Role {} not found in use role list", role_id);
|
||||||
return Default::default();
|
return Default::default();
|
||||||
}
|
}
|
||||||
role_map.get(role_id).unwrap().to_formation_protobuf()
|
let role = *role_map.get(&role_id).unwrap();
|
||||||
|
FormationRoleInfo {
|
||||||
|
role_id: role.role_id,
|
||||||
|
max_hp: 0,
|
||||||
|
cur_hp: 0,
|
||||||
|
level: role.level,
|
||||||
|
role_skin_id: role.skin_id,
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.collect(),
|
.collect(),
|
||||||
is_current: formation.is_current,
|
is_current: formation.is_current,
|
||||||
|
@ -573,7 +514,7 @@ impl Player {
|
||||||
}],
|
}],
|
||||||
});
|
});
|
||||||
self.notify(NormalItemUpdateNotify {
|
self.notify(NormalItemUpdateNotify {
|
||||||
normal_item_list: self.inventory.to_normal_item_list_filtered(&[3]),
|
normal_item_list: self.inventory.to_normal_item_list_filtered(vec![3]),
|
||||||
no_tips: false,
|
no_tips: false,
|
||||||
});
|
});
|
||||||
self.notify(MonthCardDailyRewardNotify {
|
self.notify(MonthCardDailyRewardNotify {
|
||||||
|
@ -655,11 +596,7 @@ impl Player {
|
||||||
.mc_element
|
.mc_element
|
||||||
.map(PlayerMcElement::load_from_save)
|
.map(PlayerMcElement::load_from_save)
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
unlocked_skins: save_data
|
world: Rc::new(RefCell::new(World::new())),
|
||||||
.unlocked_skins
|
|
||||||
.map(PlayerUnlockedSkins::load_from_save)
|
|
||||||
.unwrap_or_default(),
|
|
||||||
world_owner_id: 0,
|
|
||||||
last_save_time: time_util::unix_timestamp(),
|
last_save_time: time_util::unix_timestamp(),
|
||||||
quadrant_id: 0,
|
quadrant_id: 0,
|
||||||
}
|
}
|
||||||
|
@ -694,7 +631,6 @@ impl Player {
|
||||||
map_trace: Some(self.map_trace.build_save_data()),
|
map_trace: Some(self.map_trace.build_save_data()),
|
||||||
month_card: Some(self.month_card.build_save_data()),
|
month_card: Some(self.month_card.build_save_data()),
|
||||||
mc_element: Some(self.mc_element.build_save_data()),
|
mc_element: Some(self.mc_element.build_save_data()),
|
||||||
unlocked_skins: Some(self.unlocked_skins.build_save_data()),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -703,11 +639,12 @@ impl Player {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_role_list_notify(&self) -> PbGetRoleListNotify {
|
pub fn build_role_list_notify(&self) -> PbGetRoleListNotify {
|
||||||
|
// TODO: There is a bug we are investigating with several resonators, this is a workaround
|
||||||
PbGetRoleListNotify {
|
PbGetRoleListNotify {
|
||||||
role_list: self
|
role_list: self
|
||||||
.role_list
|
.role_list
|
||||||
.values()
|
.iter()
|
||||||
.map(|role| role.to_protobuf())
|
.map(|(_, role)| role.to_protobuf())
|
||||||
.collect(),
|
.collect(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,11 @@
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::sync::atomic::AtomicI32;
|
|
||||||
use wicked_waifus_protocol::{
|
|
||||||
ArrayIntInt, NormalItem, PhantomItem, PhantomPropInfo, RolePhantomEquipInfo,
|
|
||||||
RolePhantomPropInfo, WeaponItem,
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::config;
|
use wicked_waifus_protocol::NormalItem;
|
||||||
use crate::logic::utils::seq_utils::{SequenceGenerator, Sequencer};
|
|
||||||
use wicked_waifus_protocol_internal::{
|
use wicked_waifus_protocol_internal::PlayerInventoryData;
|
||||||
PlayerInventoryData, PlayerInventoryPhantomData, PlayerInventoryWeaponData,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub struct PlayerInventory {
|
pub struct PlayerInventory {
|
||||||
items: HashMap<i32, i32>,
|
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 {
|
pub struct ItemUsage {
|
||||||
|
@ -44,20 +33,13 @@ impl PlayerInventory {
|
||||||
|
|
||||||
pub fn load_from_save(data: PlayerInventoryData) -> Self {
|
pub fn load_from_save(data: PlayerInventoryData) -> Self {
|
||||||
Self {
|
Self {
|
||||||
weapons_seq: SequenceGenerator::from_data(&data.weapons),
|
|
||||||
echoes_seq: SequenceGenerator::from_data(&data.echoes),
|
|
||||||
items: data.items.clone(),
|
items: data.items.clone(),
|
||||||
weapons: data.weapons.clone(),
|
|
||||||
echoes: data.echoes.clone(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_save_data(&self) -> PlayerInventoryData {
|
pub fn build_save_data(&self) -> PlayerInventoryData {
|
||||||
PlayerInventoryData {
|
PlayerInventoryData {
|
||||||
items: self.items.clone(),
|
items: self.items.clone(),
|
||||||
weapons: self.weapons.clone(),
|
|
||||||
echoes: self.echoes.clone(),
|
|
||||||
echo_presets: Default::default(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,19 +52,10 @@ impl PlayerInventory {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn consume_item(&mut self, id: i32, quantity: i32) -> Result<i32, InventoryError> {
|
pub fn consume_item(&mut self, id: i32, quantity: i32) -> Result<i32, InventoryError> {
|
||||||
Ok(*self
|
Ok(*self.consume_items(&[ItemUsage { id, quantity: -quantity }])?.get(&id).unwrap())
|
||||||
.consume_items(&[ItemUsage {
|
|
||||||
id,
|
|
||||||
quantity: -quantity,
|
|
||||||
}])?
|
|
||||||
.get(&id)
|
|
||||||
.unwrap())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn consume_items(
|
pub fn consume_items(&mut self, usages: &[ItemUsage]) -> Result<HashMap<i32, i32>, InventoryError> {
|
||||||
&mut self,
|
|
||||||
usages: &[ItemUsage],
|
|
||||||
) -> Result<HashMap<i32, i32>, InventoryError> {
|
|
||||||
if !self.has_enough_items(usages) {
|
if !self.has_enough_items(usages) {
|
||||||
return Err(InventoryError::ItemsNotEnough());
|
return Err(InventoryError::ItemsNotEnough());
|
||||||
}
|
}
|
||||||
|
@ -95,11 +68,6 @@ impl PlayerInventory {
|
||||||
self.items.get(&Self::UNION_EXP_ID).copied().unwrap_or(0)
|
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)]
|
#[inline(always)]
|
||||||
pub fn get_shell_credits(&self) -> i32 {
|
pub fn get_shell_credits(&self) -> i32 {
|
||||||
self.items.get(&Self::SHELL_CREDIT_ID).copied().unwrap_or(0)
|
self.items.get(&Self::SHELL_CREDIT_ID).copied().unwrap_or(0)
|
||||||
|
@ -129,182 +97,35 @@ impl PlayerInventory {
|
||||||
// TODO: Check if this is item or not
|
// TODO: Check if this is item or not
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn get_waveplate_crystal(&self) -> i32 {
|
pub fn get_waveplate_crystal(&self) -> i32 {
|
||||||
self.items
|
self.items.get(&Self::WAVEPLATE_CRYSTAL_ID).copied().unwrap_or(0)
|
||||||
.get(&Self::WAVEPLATE_CRYSTAL_ID)
|
|
||||||
.copied()
|
|
||||||
.unwrap_or(0)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_normal_item_list(&self) -> Vec<NormalItem> {
|
pub fn to_normal_item_list(&self) -> Vec<NormalItem> {
|
||||||
self.items
|
self.items.iter()
|
||||||
.iter()
|
|
||||||
.filter(|(&id, _)| Self::WAVEPLATE_ID != id && Self::WAVEPLATE_CRYSTAL_ID != id)
|
.filter(|(&id, _)| Self::WAVEPLATE_ID != id && Self::WAVEPLATE_CRYSTAL_ID != id)
|
||||||
// TODO: Implement expiration
|
// TODO: Implement expiration
|
||||||
.map(|(&id, &count)| NormalItem {
|
.map(|(&id, &count)| NormalItem { id, count, expire_time: 0 })
|
||||||
id,
|
|
||||||
count,
|
|
||||||
expire_time: 0,
|
|
||||||
})
|
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_normal_item_list_filtered(&self, ids: &[i32]) -> Vec<NormalItem> {
|
pub fn to_normal_item_list_filtered(&self, ids: Vec<i32>) -> Vec<NormalItem> {
|
||||||
self.items
|
self.items.iter()
|
||||||
.iter()
|
|
||||||
.filter(|(&id, _)| ids.contains(&id))
|
.filter(|(&id, _)| ids.contains(&id))
|
||||||
// TODO: Implement expiration
|
// TODO: Implement expiration
|
||||||
.map(|(&id, &count)| NormalItem {
|
.map(|(&id, &count)| NormalItem { id, count, expire_time: 0 })
|
||||||
id,
|
|
||||||
count,
|
|
||||||
expire_time: 0,
|
|
||||||
})
|
|
||||||
.collect::<Vec<_>>()
|
.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)]
|
#[inline(always)]
|
||||||
fn add_internal(&mut self, id: i32, quantity: i32) -> i32 {
|
fn add_internal(&mut self, id: i32, quantity: i32) -> i32 {
|
||||||
*self
|
*self.items.entry(id)
|
||||||
.items
|
|
||||||
.entry(id)
|
|
||||||
.and_modify(|count| *count += quantity)
|
.and_modify(|count| *count += quantity)
|
||||||
.or_insert(quantity)
|
.or_insert(quantity)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn add_many_internal(&mut self, usages: &[ItemUsage]) -> HashMap<i32, i32> {
|
fn add_many_internal(&mut self, usages: &[ItemUsage]) -> HashMap<i32, i32> {
|
||||||
usages
|
usages.iter()
|
||||||
.iter()
|
|
||||||
.filter(|usage| usage.quantity != 0)
|
.filter(|usage| usage.quantity != 0)
|
||||||
.map(|delta| (delta.id, self.add_internal(delta.id, delta.quantity)))
|
.map(|delta| (delta.id, self.add_internal(delta.id, delta.quantity)))
|
||||||
.collect::<HashMap<_, _>>()
|
.collect::<HashMap<_, _>>()
|
||||||
|
@ -317,107 +138,17 @@ impl PlayerInventory {
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn has_enough_items(&self, items_delta: &[ItemUsage]) -> bool {
|
fn has_enough_items(&self, items_delta: &[ItemUsage]) -> bool {
|
||||||
items_delta
|
items_delta.iter()
|
||||||
.iter()
|
.fold(true, |is_enough, delta| {
|
||||||
.all(|delta| self.has_enough_item(delta.id, -delta.quantity))
|
is_enough && self.has_enough_item(delta.id, -delta.quantity)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for PlayerInventory {
|
impl Default for PlayerInventory {
|
||||||
fn default() -> Self {
|
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 {
|
Self {
|
||||||
items: HashMap::new(),
|
items: HashMap::new(),
|
||||||
weapons_seq,
|
|
||||||
weapons,
|
|
||||||
echoes_seq,
|
|
||||||
echoes,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,84 +0,0 @@
|
||||||
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()
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -29,7 +29,7 @@ impl RoleFormation {
|
||||||
RoleFormationData {
|
RoleFormationData {
|
||||||
formation_id: self.id,
|
formation_id: self.id,
|
||||||
cur_role: self.cur_role,
|
cur_role: self.cur_role,
|
||||||
role_id_list: self.role_ids.iter().copied().collect(),
|
role_id_list: self.role_ids.iter().map(|&role_id| role_id).collect(),
|
||||||
is_current: self.is_current,
|
is_current: self.is_current,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use wicked_waifus_protocol::{ArrayIntInt, FormationRoleInfo, RoleInfo};
|
use wicked_waifus_protocol::{ArrayIntInt, RoleInfo};
|
||||||
|
|
||||||
use crate::config;
|
use crate::config;
|
||||||
use crate::logic::utils::growth_utils::get_role_props_by_level;
|
use crate::logic::utils::growth_utils::get_role_props_by_level;
|
||||||
use crate::logic::utils::load_role_info::load_key_value;
|
use crate::logic::utils::load_role_info::load_key_value;
|
||||||
pub use formation::RoleFormation;
|
pub use formation::RoleFormation;
|
||||||
use wicked_waifus_commons::time_util;
|
use wicked_waifus_commons::time_util;
|
||||||
use wicked_waifus_data::base_property_data::BasePropertyData;
|
use wicked_waifus_data::{role_info_data, BasePropertyData};
|
||||||
use wicked_waifus_data::role_info_data;
|
|
||||||
use wicked_waifus_protocol_internal::{RoleData, RoleStats};
|
use wicked_waifus_protocol_internal::{RoleData, RoleStats};
|
||||||
use crate::logic::player::Element;
|
use crate::logic::player::Element;
|
||||||
|
|
||||||
|
@ -51,9 +50,6 @@ pub struct Role {
|
||||||
pub element_energy: i32,
|
pub element_energy: i32,
|
||||||
pub favor_level: i32,
|
pub favor_level: i32,
|
||||||
pub favor_exp: i32,
|
pub favor_exp: i32,
|
||||||
pub wing_skin_id: i32,
|
|
||||||
pub fly_skin_id: i32,
|
|
||||||
pub weapon_skin_id: i32,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Role {
|
impl Role {
|
||||||
|
@ -123,40 +119,21 @@ impl Role {
|
||||||
|
|
||||||
let default_unlocks = &config::get_config().default_unlocks;
|
let default_unlocks = &config::get_config().default_unlocks;
|
||||||
let (level, breakthrough) = if default_unlocks.unlock_all_roles_max_level {
|
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 {
|
} 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 {
|
let resonant_chain_group_index = if default_unlocks.unlock_all_roles_all_sequences {
|
||||||
wicked_waifus_data::resonant_chain_data::iter()
|
6
|
||||||
.filter(|level_data| level_data.group_id == data.resonant_chain_group_id)
|
|
||||||
.map(|level_data| level_data.group_index)
|
|
||||||
.max()
|
|
||||||
.unwrap_or(0)
|
|
||||||
} else {
|
} else {
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
// TODO: add weapon and echo stats
|
|
||||||
let base_stats = &get_role_props_by_level(role_id, level, breakthrough);
|
let base_stats = &get_role_props_by_level(role_id, level, breakthrough);
|
||||||
Self {
|
Self {
|
||||||
role_id,
|
role_id,
|
||||||
name: String::with_capacity(0),
|
name: String::with_capacity(0),
|
||||||
level,
|
level,
|
||||||
exp: 0,
|
exp: 0, // TODO: Compute based on level??
|
||||||
breakthrough,
|
breakthrough,
|
||||||
skill_map: HashMap::new(), // TODO!
|
skill_map: HashMap::new(), // TODO!
|
||||||
star: 0,
|
star: 0,
|
||||||
|
@ -174,16 +151,12 @@ impl Role {
|
||||||
element_energy: base_stats.element_energy,
|
element_energy: base_stats.element_energy,
|
||||||
favor_level: 0,
|
favor_level: 0,
|
||||||
favor_exp: 0,
|
favor_exp: 0,
|
||||||
wing_skin_id: 0,
|
|
||||||
fly_skin_id: 0,
|
|
||||||
weapon_skin_id: 0,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_base_properties(&self) -> BasePropertyData {
|
pub fn get_base_properties(&self) -> BasePropertyData {
|
||||||
// Overwrite dynamic attributes with stores values
|
// Overwrite dynamic attributes with stores values
|
||||||
let mut base_stats = get_role_props_by_level(self.role_id, self.level, self.breakthrough);
|
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
|
// TODO: Integrity check, value has to be between 0 and max
|
||||||
base_stats.life = self.hp;
|
base_stats.life = self.hp;
|
||||||
base_stats.energy = self.energy;
|
base_stats.energy = self.energy;
|
||||||
|
@ -196,7 +169,6 @@ impl Role {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_protobuf(&self) -> RoleInfo {
|
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());
|
let base_prop: HashMap<i32, i32> = load_key_value(&self.get_base_properties());
|
||||||
RoleInfo {
|
RoleInfo {
|
||||||
role_id: self.role_id,
|
role_id: self.role_id,
|
||||||
|
@ -220,17 +192,6 @@ 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) {
|
pub fn load_from_save(data: RoleData) -> (i32, Self) {
|
||||||
(
|
(
|
||||||
data.role_id,
|
data.role_id,
|
||||||
|
@ -256,9 +217,6 @@ impl Role {
|
||||||
element_energy: data.stats.unwrap().element_energy,
|
element_energy: data.stats.unwrap().element_energy,
|
||||||
favor_level: data.favor_level,
|
favor_level: data.favor_level,
|
||||||
favor_exp: data.favor_exp,
|
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,
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -292,9 +250,6 @@ impl Role {
|
||||||
}),
|
}),
|
||||||
favor_level: self.favor_level,
|
favor_level: self.favor_level,
|
||||||
favor_exp: self.favor_exp,
|
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()
|
..Default::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use wicked_waifus_commons::time_util;
|
use wicked_waifus_commons::time_util;
|
||||||
use wicked_waifus_protocol_internal::PlayerSaveData;
|
use wicked_waifus_protocol_internal::PlayerSaveData;
|
||||||
use wicked_waifus_protocol::{message::Message, AfterJoinSceneNotify, EnterGameResponse, JoinSceneNotify, SilenceNpcNotify, TransitionOptionPb};
|
use wicked_waifus_protocol::{message::Message, AfterJoinSceneNotify, EnterGameResponse, JoinSceneNotify, SilenceNpcNotify, TransitionOptionPb};
|
||||||
|
use std::collections::hash_map::Entry::Vacant;
|
||||||
use std::{
|
use std::{
|
||||||
cell::RefCell,
|
cell::RefCell,
|
||||||
collections::{HashMap, VecDeque},
|
collections::{HashMap, VecDeque},
|
||||||
|
@ -121,11 +122,6 @@ 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) {
|
fn handle_logic_input(state: &mut LogicState, input: LogicInput) {
|
||||||
match input {
|
match input {
|
||||||
LogicInput::AddPlayer {
|
LogicInput::AddPlayer {
|
||||||
|
@ -134,56 +130,64 @@ fn handle_logic_input(state: &mut LogicState, input: LogicInput) {
|
||||||
session,
|
session,
|
||||||
player_save_data,
|
player_save_data,
|
||||||
} => {
|
} => {
|
||||||
let mut player = state.players.entry(player_id).or_insert_with(|| {
|
let (player, is_player) = if let Vacant(e) = state.players.entry(player_id) {
|
||||||
RefCell::new(Player::load_from_save(player_save_data))
|
(
|
||||||
}).borrow_mut();
|
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;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// TODO: shall we search in coop?
|
let mut player = player.borrow_mut();
|
||||||
player.world_owner_id = player_id;
|
if is_player {
|
||||||
let mut world = state.worlds.entry(player_id).or_insert_with(|| {
|
player
|
||||||
let mut world = World::new();
|
.world
|
||||||
world.world_entities.insert(
|
.borrow_mut()
|
||||||
player.basic_info.cur_map_id,
|
.world_entitys
|
||||||
WorldEntity::default(),
|
.insert(player.basic_info.cur_map_id, WorldEntity::default());
|
||||||
);
|
state.worlds.insert(player_id, player.world.clone());
|
||||||
Rc::new(RefCell::new(world))
|
}
|
||||||
}).borrow_mut();
|
|
||||||
|
|
||||||
player.init();
|
player.init();
|
||||||
player.set_session(session);
|
player.set_session(session);
|
||||||
player.respond(EnterGameResponse::default(), enter_rpc_id);
|
player.respond(EnterGameResponse::default(), enter_rpc_id);
|
||||||
player.notify_general_data();
|
player.notify_general_data();
|
||||||
|
|
||||||
world.set_in_world_player_data(player.build_in_world_player());
|
player
|
||||||
|
.world
|
||||||
|
.borrow_mut()
|
||||||
|
.set_in_world_player_data(player.build_in_world_player());
|
||||||
|
|
||||||
let mut ctx = NetContext {
|
world_util::add_player_entities(&player);
|
||||||
player: &mut player,
|
let scene_info = world_util::build_scene_information(&player);
|
||||||
world: &mut world,
|
|
||||||
};
|
|
||||||
world_util::add_player_entities(&mut ctx);
|
|
||||||
let scene_info = world_util::build_scene_information(&mut ctx);
|
|
||||||
|
|
||||||
ctx.player.notify(SilenceNpcNotify::default());
|
player.notify(SilenceNpcNotify::default());
|
||||||
|
|
||||||
ctx.player.notify(JoinSceneNotify {
|
player.notify(JoinSceneNotify {
|
||||||
scene_info: Some(scene_info),
|
scene_info: Some(scene_info),
|
||||||
max_entity_id: i64::MAX,
|
max_entity_id: i64::MAX,
|
||||||
transition_option: Some(TransitionOptionPb::default()),
|
transition_option: Some(TransitionOptionPb::default()),
|
||||||
});
|
});
|
||||||
|
|
||||||
ctx.player.notify(AfterJoinSceneNotify::default());
|
player.notify(AfterJoinSceneNotify::default());
|
||||||
ctx.player.notify(ctx.player.build_update_formation_notify());
|
player.notify(player.build_update_formation_notify());
|
||||||
|
|
||||||
let map = logic::utils::quadrant_util::get_map(ctx.player.basic_info.cur_map_id);
|
let map = logic::utils::quadrant_util::get_map(player.basic_info.cur_map_id);
|
||||||
let quadrant_id = map.get_quadrant_id(
|
let quadrant_id = map.get_quadrant_id(
|
||||||
ctx.player.location.position.position.x * 100.0,
|
player.location.position.position.x * 100.0,
|
||||||
ctx.player.location.position.position.y * 100.0,
|
player.location.position.position.y * 100.0,
|
||||||
);
|
);
|
||||||
ctx.player.quadrant_id = quadrant_id;
|
player.quadrant_id = quadrant_id;
|
||||||
ctx.player.notify_month_card();
|
player.notify_month_card();
|
||||||
|
|
||||||
let entities = map.get_initial_entities(quadrant_id);
|
let entities = map.get_initial_entities(quadrant_id);
|
||||||
world_util::add_entities(&mut ctx, &entities, false);
|
world_util::add_entities(&player, &entities, false);
|
||||||
|
|
||||||
drop(player);
|
drop(player);
|
||||||
|
|
||||||
|
@ -196,17 +200,8 @@ 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");
|
tracing::warn!("logic_thread: process message requested, but player with id {player_id} doesn't exist");
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
let mut player = player.borrow_mut();
|
|
||||||
let Some(world) = state.worlds.get_mut(&player.world_owner_id) else {
|
super::handler::handle_logic_message(&mut player.borrow_mut(), message);
|
||||||
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 } => {
|
LogicInput::RemovePlayer { player_id } => {
|
||||||
let Some(player) = state.players.remove(&player_id) else {
|
let Some(player) = state.players.remove(&player_id) else {
|
||||||
|
|
|
@ -6,8 +6,7 @@ use wicked_waifus_data::pb_components::action::{Action, ChangeSelfEntityState, U
|
||||||
use wicked_waifus_data::pb_components::entity_state::EntityStateComponent;
|
use wicked_waifus_data::pb_components::entity_state::EntityStateComponent;
|
||||||
|
|
||||||
use crate::logic::ecs::component::ComponentContainer;
|
use crate::logic::ecs::component::ComponentContainer;
|
||||||
use crate::logic::player::ItemUsage;
|
use crate::logic::player::{ItemUsage, Player};
|
||||||
use crate::logic::thread_mgr::NetContext;
|
|
||||||
use crate::logic::utils::tag_utils;
|
use crate::logic::utils::tag_utils;
|
||||||
use crate::query_components;
|
use crate::query_components;
|
||||||
|
|
||||||
|
@ -19,23 +18,23 @@ macro_rules! unimplemented_action {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn perform_action(ctx: &mut NetContext,
|
pub fn perform_action(player: &mut Player,
|
||||||
entity_id: i64,
|
entity_id: i64,
|
||||||
level_entity_data: &wicked_waifus_data::level_entity_config_data::LevelEntityConfigData,
|
level_entity_data: &wicked_waifus_data::LevelEntityConfigData,
|
||||||
template_config: &wicked_waifus_data::template_config_data::TemplateConfigData,
|
template_config: &wicked_waifus_data::TemplateConfigData,
|
||||||
element: Action) {
|
element: Action) {
|
||||||
match element {
|
match element {
|
||||||
Action::SetBattleState(action) => unimplemented_action! { action },
|
Action::SetBattleState(action) => unimplemented_action! { action },
|
||||||
Action::ExecBattleAction(action) => unimplemented_action! { action },
|
Action::ExecBattleAction(action) => unimplemented_action! { action },
|
||||||
Action::WaitBattleCondition(action) => unimplemented_action! { action },
|
Action::WaitBattleCondition(action) => unimplemented_action! { action },
|
||||||
Action::PlayFlow(action) => unimplemented_action! { action },
|
Action::PlayFlow(action) => unimplemented_action! { action },
|
||||||
Action::Collect(_) => collect_action(ctx, level_entity_data, template_config),
|
Action::Collect(_) => collect_action(player, level_entity_data, template_config),
|
||||||
Action::LeisureInteract(action) => unimplemented_action! { action },
|
Action::LeisureInteract(action) => unimplemented_action! { action },
|
||||||
Action::UnlockTeleportTrigger(action) => unlock_teleport_trigger(ctx, action.params),
|
Action::UnlockTeleportTrigger(action) => unlock_teleport_trigger(player, action.params),
|
||||||
Action::EnableTemporaryTeleport(action) => unimplemented_action! { action },
|
Action::EnableTemporaryTeleport(action) => unimplemented_action! { action },
|
||||||
Action::OpenSystemBoard(action) => unimplemented_action! { action },
|
Action::OpenSystemBoard(action) => unimplemented_action! { action },
|
||||||
Action::OpenSystemFunction(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::ChangeSelfEntityState(action) => change_self_entity_state(player, entity_id, level_entity_data, template_config, action.params),
|
||||||
Action::SetPlayerOperationRestriction(action) => unimplemented_action! { action },
|
Action::SetPlayerOperationRestriction(action) => unimplemented_action! { action },
|
||||||
Action::Wait(action) => unimplemented_action! { action },
|
Action::Wait(action) => unimplemented_action! { action },
|
||||||
Action::ChangeEntityState(action) => unimplemented_action! { action },
|
Action::ChangeEntityState(action) => unimplemented_action! { action },
|
||||||
|
@ -136,8 +135,6 @@ pub fn perform_action(ctx: &mut NetContext,
|
||||||
Action::RemoveTrialFollowShooter(action) => unimplemented_action! { action },
|
Action::RemoveTrialFollowShooter(action) => unimplemented_action! { action },
|
||||||
Action::AddTrialCharacter(action) => unimplemented_action! { action },
|
Action::AddTrialCharacter(action) => unimplemented_action! { action },
|
||||||
Action::RemoveTrialCharacter(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::SetAreaState(action) => unimplemented_action! { action },
|
||||||
Action::SwitchSubLevels(action) => unimplemented_action! { action },
|
Action::SwitchSubLevels(action) => unimplemented_action! { action },
|
||||||
Action::ChangeTeamPosition(action) => unimplemented_action! { action },
|
Action::ChangeTeamPosition(action) => unimplemented_action! { action },
|
||||||
|
@ -211,15 +208,12 @@ pub fn perform_action(ctx: &mut NetContext,
|
||||||
Action::StopUiScreenEffect(action) => unimplemented_action! { action },
|
Action::StopUiScreenEffect(action) => unimplemented_action! { action },
|
||||||
Action::StopNewMoveWithSpline(action) => unimplemented_action! { action },
|
Action::StopNewMoveWithSpline(action) => unimplemented_action! { action },
|
||||||
Action::RequestSystemFunction(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,
|
fn collect_action(player: &mut Player,
|
||||||
level_entity_data: &wicked_waifus_data::level_entity_config_data::LevelEntityConfigData,
|
level_entity_data: &wicked_waifus_data::LevelEntityConfigData,
|
||||||
template_config: &wicked_waifus_data::template_config_data::TemplateConfigData) {
|
template_config: &wicked_waifus_data::TemplateConfigData) {
|
||||||
if let Some(reward_component) = level_entity_data.components_data.reward_component
|
if let Some(reward_component) = level_entity_data.components_data.reward_component
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.or(template_config.components_data.reward_component.as_ref()) {
|
.or(template_config.components_data.reward_component.as_ref()) {
|
||||||
|
@ -233,11 +227,11 @@ fn collect_action(ctx: &mut NetContext,
|
||||||
let usages = drop.drop_preview.iter()
|
let usages = drop.drop_preview.iter()
|
||||||
.map(|(&id, &quantity)| ItemUsage { id, quantity })
|
.map(|(&id, &quantity)| ItemUsage { id, quantity })
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
let updated_items = ctx.player.inventory.add_items(&usages);
|
let updated_items = player.inventory.add_items(&usages);
|
||||||
let normal_item_list = ctx.player.inventory.to_normal_item_list_filtered(
|
let normal_item_list = player.inventory.to_normal_item_list_filtered(
|
||||||
&updated_items.keys().cloned().collect::<Vec<i32>>()
|
updated_items.keys().cloned().collect::<Vec<i32>>()
|
||||||
);
|
);
|
||||||
ctx.player.notify(NormalItemUpdateNotify { normal_item_list, no_tips: false });
|
player.notify(NormalItemUpdateNotify { normal_item_list, no_tips: false });
|
||||||
// UpdateHandBookActiveStateMapNotify
|
// UpdateHandBookActiveStateMapNotify
|
||||||
let mut rewards: HashMap<i32, WR> = HashMap::new();
|
let mut rewards: HashMap<i32, WR> = HashMap::new();
|
||||||
rewards.insert(0, WR {
|
rewards.insert(0, WR {
|
||||||
|
@ -250,7 +244,7 @@ fn collect_action(ctx: &mut NetContext,
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>(),
|
.collect::<Vec<_>>(),
|
||||||
});
|
});
|
||||||
ctx.player.notify(ItemRewardNotify {
|
player.notify(ItemRewardNotify {
|
||||||
drop_id: reward_id,
|
drop_id: reward_id,
|
||||||
reason: 15000,
|
reason: 15000,
|
||||||
magnification: 1,
|
magnification: 1,
|
||||||
|
@ -262,20 +256,21 @@ fn collect_action(ctx: &mut NetContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn unlock_teleport_trigger(ctx: &mut NetContext, action: UnlockTeleportTrigger) {
|
fn unlock_teleport_trigger(player: &mut Player, action: UnlockTeleportTrigger) {
|
||||||
ctx.player.unlock_teleport(action.teleport_id)
|
player.unlock_teleport(action.teleport_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn change_self_entity_state(ctx: &mut NetContext,
|
fn change_self_entity_state(player: &mut Player,
|
||||||
entity_id: i64,
|
entity_id: i64,
|
||||||
level_entity_data: &wicked_waifus_data::level_entity_config_data::LevelEntityConfigData,
|
level_entity_data: &wicked_waifus_data::LevelEntityConfigData,
|
||||||
template_config: &wicked_waifus_data::template_config_data::TemplateConfigData,
|
template_config: &wicked_waifus_data::TemplateConfigData,
|
||||||
action: ChangeSelfEntityState) {
|
action: ChangeSelfEntityState) {
|
||||||
let state = tag_utils::get_tag_id_by_name(action.entity_state.as_str());
|
let state = tag_utils::get_tag_id_by_name(action.entity_state.as_str());
|
||||||
|
|
||||||
// TODO: update Tag::CommonEntityTags too??
|
// TODO: update Tag::CommonEntityTags too??
|
||||||
let old_state = {
|
let old_state = {
|
||||||
let world = ctx.world.get_world_entity();
|
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 mut state_tag = query_components!(world, entity_id, StateTag).0.unwrap();
|
||||||
let old_state = state_tag.state_tag_id;
|
let old_state = state_tag.state_tag_id;
|
||||||
tracing::debug!("ChangeSelfEntityState: old state {old_state} -> new state: {state}");
|
tracing::debug!("ChangeSelfEntityState: old state {old_state} -> new state: {state}");
|
||||||
|
@ -296,7 +291,7 @@ fn change_self_entity_state(ctx: &mut NetContext,
|
||||||
if expected == state {
|
if expected == state {
|
||||||
if let Some(actions) = state_change_behavior.action {
|
if let Some(actions) = state_change_behavior.action {
|
||||||
for sub in actions {
|
for sub in actions {
|
||||||
perform_action(ctx, entity_id, level_entity_data, template_config, sub);
|
perform_action(player, entity_id, level_entity_data, template_config, sub);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -304,7 +299,7 @@ fn change_self_entity_state(ctx: &mut NetContext,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.player.notify(EntityCommonTagNotify {
|
player.notify(EntityCommonTagNotify {
|
||||||
id: entity_id,
|
id: entity_id,
|
||||||
tags: vec![
|
tags: vec![
|
||||||
CommonTagData { tag_id: old_state, remove_tag_ids: false }, // Remove
|
CommonTagData { tag_id: old_state, remove_tag_ids: false }, // Remove
|
||||||
|
@ -312,7 +307,7 @@ fn change_self_entity_state(ctx: &mut NetContext,
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
ctx.player.notify(EntityStateReadyNotify {
|
player.notify(EntityStateReadyNotify {
|
||||||
entity_id,
|
entity_id,
|
||||||
tag_id: state,
|
tag_id: state,
|
||||||
ready: true, // TODO: Always true? or shall we compare it to something??
|
ready: true, // TODO: Always true? or shall we compare it to something??
|
||||||
|
|
|
@ -1,30 +1,28 @@
|
||||||
use wicked_waifus_data::pb_components::condition::{
|
use wicked_waifus_data::pb_components::condition::{CheckConditionGroup, CompareEntityState, Condition};
|
||||||
CheckConditionGroup, CompareEntityState, Condition, HasBuff,
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::logic::ecs::component::ComponentContainer;
|
use crate::logic::ecs::component::ComponentContainer;
|
||||||
use crate::logic::thread_mgr::NetContext;
|
use crate::logic::player::Player;
|
||||||
use crate::logic::utils::tag_utils;
|
use crate::logic::utils::tag_utils;
|
||||||
use crate::query_components;
|
use crate::query_components;
|
||||||
|
|
||||||
macro_rules! unimplemented_condition {
|
macro_rules! unimplemented_condition {
|
||||||
($condition:ident) => {{
|
($condition:ident) => {
|
||||||
|
{
|
||||||
tracing::warn!("Condition check not implemented for: {:?}", $condition);
|
tracing::warn!("Condition check not implemented for: {:?}", $condition);
|
||||||
true
|
true
|
||||||
}};
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn check_condition(
|
pub fn check_condition(player: &Player,
|
||||||
ctx: &mut NetContext,
|
|
||||||
entity_id: i64,
|
entity_id: i64,
|
||||||
level_entity_data: &wicked_waifus_data::level_entity_config_data::LevelEntityConfigData,
|
level_entity_data: &wicked_waifus_data::LevelEntityConfigData,
|
||||||
template_config: &wicked_waifus_data::template_config_data::TemplateConfigData,
|
template_config: &wicked_waifus_data::TemplateConfigData,
|
||||||
element: Condition,
|
element: Condition) -> bool {
|
||||||
) -> bool {
|
|
||||||
match element {
|
match element {
|
||||||
Condition::CompareTimePeriod(condition) => unimplemented_condition! { condition },
|
Condition::CompareTimePeriod(condition) => unimplemented_condition! { condition },
|
||||||
Condition::CheckChildQuestFinished(condition) => unimplemented_condition! { condition },
|
Condition::CheckChildQuestFinished(condition) => unimplemented_condition! { condition },
|
||||||
Condition::CompareEntityState(condition) => compare_entity_state(ctx, entity_id, condition),
|
Condition::CompareEntityState(condition) => compare_entity_state(player, entity_id, condition),
|
||||||
Condition::CheckEntityState(condition) => unimplemented_condition! { condition },
|
Condition::CheckEntityState(condition) => unimplemented_condition! { condition },
|
||||||
Condition::CompareVar(condition) => unimplemented_condition! { condition },
|
Condition::CompareVar(condition) => unimplemented_condition! { condition },
|
||||||
Condition::CompareWeather(condition) => unimplemented_condition! { condition },
|
Condition::CompareWeather(condition) => unimplemented_condition! { condition },
|
||||||
|
@ -38,15 +36,13 @@ pub fn check_condition(
|
||||||
Condition::PreLevelPlay(condition) => unimplemented_condition! { condition },
|
Condition::PreLevelPlay(condition) => unimplemented_condition! { condition },
|
||||||
Condition::CheckLevelPlay(condition) => unimplemented_condition! { condition },
|
Condition::CheckLevelPlay(condition) => unimplemented_condition! { condition },
|
||||||
Condition::CheckLevelPlayState(condition) => unimplemented_condition! { condition },
|
Condition::CheckLevelPlayState(condition) => unimplemented_condition! { condition },
|
||||||
Condition::CheckLevelPlayCompleteNumber(condition) => {
|
Condition::CheckLevelPlayCompleteNumber(condition) => unimplemented_condition! { condition },
|
||||||
unimplemented_condition! { condition }
|
|
||||||
}
|
|
||||||
Condition::CompareLevelPlayRewardState(condition) => unimplemented_condition! { condition },
|
Condition::CompareLevelPlayRewardState(condition) => unimplemented_condition! { condition },
|
||||||
Condition::CheckItems(condition) => unimplemented_condition! { condition },
|
Condition::CheckItems(condition) => unimplemented_condition! { condition },
|
||||||
Condition::HandInItems(condition) => unimplemented_condition! { condition },
|
Condition::HandInItems(condition) => unimplemented_condition! { condition },
|
||||||
Condition::GetItem(condition) => unimplemented_condition! { condition },
|
Condition::GetItem(condition) => unimplemented_condition! { condition },
|
||||||
Condition::UseItem(condition) => unimplemented_condition! { condition },
|
Condition::UseItem(condition) => unimplemented_condition! { condition },
|
||||||
Condition::HasBuff(condition) => has_buff(ctx, entity_id, condition),
|
Condition::HasBuff(condition) => unimplemented_condition! { condition },
|
||||||
Condition::CompareLift(condition) => unimplemented_condition! { condition },
|
Condition::CompareLift(condition) => unimplemented_condition! { condition },
|
||||||
Condition::CheckJigsawInfo(condition) => unimplemented_condition! { condition },
|
Condition::CheckJigsawInfo(condition) => unimplemented_condition! { condition },
|
||||||
Condition::CheckInCombat(condition) => unimplemented_condition! { condition },
|
Condition::CheckInCombat(condition) => unimplemented_condition! { condition },
|
||||||
|
@ -72,20 +68,14 @@ pub fn check_condition(
|
||||||
Condition::CheckEntityLocked(condition) => unimplemented_condition! { condition },
|
Condition::CheckEntityLocked(condition) => unimplemented_condition! { condition },
|
||||||
Condition::CheckRogueAbilitySelect(condition) => unimplemented_condition! { condition },
|
Condition::CheckRogueAbilitySelect(condition) => unimplemented_condition! { condition },
|
||||||
Condition::CompareFishingBoatState(condition) => unimplemented_condition! { condition },
|
Condition::CompareFishingBoatState(condition) => unimplemented_condition! { condition },
|
||||||
Condition::CompleteCertainFishingEntrust(condition) => {
|
Condition::CompleteCertainFishingEntrust(condition) => unimplemented_condition! { condition },
|
||||||
unimplemented_condition! { condition }
|
|
||||||
}
|
|
||||||
Condition::CompareFishingPrestigeLevel(condition) => unimplemented_condition! { condition },
|
Condition::CompareFishingPrestigeLevel(condition) => unimplemented_condition! { condition },
|
||||||
Condition::CheckCertainFishingItemCount(condition) => {
|
Condition::CheckCertainFishingItemCount(condition) => unimplemented_condition! { condition },
|
||||||
unimplemented_condition! { condition }
|
|
||||||
}
|
|
||||||
Condition::CompareFishingTechLevel(condition) => unimplemented_condition! { condition },
|
Condition::CompareFishingTechLevel(condition) => unimplemented_condition! { condition },
|
||||||
Condition::ListenEntitySelfEvent(condition) => unimplemented_condition! { condition },
|
Condition::ListenEntitySelfEvent(condition) => unimplemented_condition! { condition },
|
||||||
Condition::CheckHookLockPoint(condition) => unimplemented_condition! { condition },
|
Condition::CheckHookLockPoint(condition) => unimplemented_condition! { condition },
|
||||||
Condition::CheckEntitesExist(condition) => unimplemented_condition! { condition },
|
Condition::CheckEntitesExist(condition) => unimplemented_condition! { condition },
|
||||||
Condition::CheckEntityHasSceneItemAttributeTag(condition) => {
|
Condition::CheckEntityHasSceneItemAttributeTag(condition) => unimplemented_condition! { condition },
|
||||||
unimplemented_condition! { condition }
|
|
||||||
}
|
|
||||||
Condition::CheckTargetBattleAttribute(condition) => unimplemented_condition! { condition },
|
Condition::CheckTargetBattleAttribute(condition) => unimplemented_condition! { condition },
|
||||||
Condition::CheckAlertAreaEnabled(condition) => unimplemented_condition! { condition },
|
Condition::CheckAlertAreaEnabled(condition) => unimplemented_condition! { condition },
|
||||||
Condition::CompareAlertValue(condition) => unimplemented_condition! { condition },
|
Condition::CompareAlertValue(condition) => unimplemented_condition! { condition },
|
||||||
|
@ -109,13 +99,7 @@ pub fn check_condition(
|
||||||
Condition::ParallaxAlign(condition) => unimplemented_condition! { condition },
|
Condition::ParallaxAlign(condition) => unimplemented_condition! { condition },
|
||||||
Condition::WaitBattleCondition(condition) => unimplemented_condition! { condition },
|
Condition::WaitBattleCondition(condition) => unimplemented_condition! { condition },
|
||||||
Condition::CheckDirection(condition) => unimplemented_condition! { condition },
|
Condition::CheckDirection(condition) => unimplemented_condition! { condition },
|
||||||
Condition::CheckConditionGroup(condition) => check_condition_group(
|
Condition::CheckConditionGroup(condition) => check_condition_group(player, entity_id, level_entity_data, template_config, condition),
|
||||||
ctx,
|
|
||||||
entity_id,
|
|
||||||
level_entity_data,
|
|
||||||
template_config,
|
|
||||||
condition,
|
|
||||||
),
|
|
||||||
Condition::CheckTreasureBeenClaimed(condition) => unimplemented_condition! { condition },
|
Condition::CheckTreasureBeenClaimed(condition) => unimplemented_condition! { condition },
|
||||||
Condition::RangeSphere(condition) => unimplemented_condition! { condition },
|
Condition::RangeSphere(condition) => unimplemented_condition! { condition },
|
||||||
Condition::CheckInRange(condition) => unimplemented_condition! { condition },
|
Condition::CheckInRange(condition) => unimplemented_condition! { condition },
|
||||||
|
@ -135,65 +119,37 @@ pub fn check_condition(
|
||||||
Condition::CheckEntityGravityDirection(condition) => unimplemented_condition! { condition },
|
Condition::CheckEntityGravityDirection(condition) => unimplemented_condition! { condition },
|
||||||
Condition::CheckTeleControlState(condition) => unimplemented_condition! { condition },
|
Condition::CheckTeleControlState(condition) => unimplemented_condition! { condition },
|
||||||
Condition::CheckEntityReward(condition) => unimplemented_condition! { condition },
|
Condition::CheckEntityReward(condition) => unimplemented_condition! { condition },
|
||||||
Condition::CheckIsGramophonePlayingMusic(condition) => {
|
Condition::CheckIsGramophonePlayingMusic(condition) => unimplemented_condition! { condition },
|
||||||
unimplemented_condition! { condition }
|
|
||||||
}
|
|
||||||
Condition::CheckBVBEvent(condition) => unimplemented_condition! { condition },
|
Condition::CheckBVBEvent(condition) => unimplemented_condition! { condition },
|
||||||
Condition::FinishBvbChallenge(condition) => unimplemented_condition! { condition },
|
Condition::FinishBvbChallenge(condition) => unimplemented_condition! { condition },
|
||||||
Condition::CompareActorVar(condition) => unimplemented_condition! { condition },
|
Condition::CompareActorVar(condition) => unimplemented_condition! { condition },
|
||||||
Condition::CheckDangoCultivationProgress(condition) => {
|
Condition::CheckDangoCultivationProgress(condition) => unimplemented_condition! { condition },
|
||||||
unimplemented_condition! { condition }
|
|
||||||
},
|
|
||||||
Condition::CheckPlayerMoraleLevelRange(condition) => {
|
|
||||||
unimplemented_condition! { condition }
|
|
||||||
},
|
|
||||||
Condition::ProgramSpecialProcess(condition) => {
|
|
||||||
unimplemented_condition! { condition }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn compare_entity_state(ctx: &NetContext, entity_id: i64, condition: CompareEntityState) -> bool {
|
fn compare_entity_state(player: &Player, entity_id: i64, condition: CompareEntityState) -> bool {
|
||||||
let actual = {
|
let actual = {
|
||||||
let world = ctx.world.get_world_entity();
|
let world_ref = player.world.borrow();
|
||||||
|
let world = world_ref.get_world_entity();
|
||||||
let state_tag = query_components!(world, entity_id, StateTag).0.unwrap();
|
let state_tag = query_components!(world, entity_id, StateTag).0.unwrap();
|
||||||
state_tag.state_tag_id
|
state_tag.state_tag_id
|
||||||
};
|
};
|
||||||
let expected = tag_utils::get_tag_id_by_name(condition.state.as_str());
|
let expected = tag_utils::get_tag_id_by_name(condition.state.as_str());
|
||||||
// In theory, we can only check for equal or not equal
|
// In theory, we can only check for equal or not equal
|
||||||
tracing::debug!(
|
tracing::debug!("CompareEntityState: type {:?}, actual: {actual}, expected: {expected}", condition.compare);
|
||||||
"CompareEntityState: type {:?}, actual: {actual}, expected: {expected}",
|
|
||||||
condition.compare
|
|
||||||
);
|
|
||||||
condition.compare.cmp(&expected, &actual)
|
condition.compare.cmp(&expected, &actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn has_buff(ctx: &NetContext, entity_id: i64, condition: HasBuff) -> bool {
|
fn check_condition_group(player: &Player,
|
||||||
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,
|
entity_id: i64,
|
||||||
level_entity_data: &wicked_waifus_data::level_entity_config_data::LevelEntityConfigData,
|
level_entity_data: &wicked_waifus_data::LevelEntityConfigData,
|
||||||
template_config: &wicked_waifus_data::template_config_data::TemplateConfigData,
|
template_config: &wicked_waifus_data::TemplateConfigData,
|
||||||
condition: CheckConditionGroup,
|
condition: CheckConditionGroup) -> bool {
|
||||||
) -> bool {
|
|
||||||
let mut check = true;
|
let mut check = true;
|
||||||
// TODO: Investigate if type has a meaning
|
// TODO: Investigate if type has a meaning
|
||||||
for element in condition.condition.conditions {
|
for element in condition.condition.conditions {
|
||||||
check = check_condition(ctx, entity_id, level_entity_data, template_config, element);
|
check = check_condition(player, entity_id, level_entity_data, template_config, element);
|
||||||
if !check {
|
if !check {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,27 +3,31 @@ use wicked_waifus_protocol::{EEntityType, EntityPb, PlayerSceneAoiData};
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
use crate::logic::components::Visibility;
|
use crate::logic::components::Visibility;
|
||||||
|
use crate::logic::player::Player;
|
||||||
use crate::{modify_component, query_hn_with};
|
use crate::{modify_component, query_hn_with};
|
||||||
use crate::logic::thread_mgr::NetContext;
|
|
||||||
|
|
||||||
pub fn build_scene_add_on_init_data(ctx: &mut NetContext) -> PlayerSceneAoiData {
|
pub fn build_scene_add_on_init_data(player: &Player) -> PlayerSceneAoiData {
|
||||||
let world = ctx.world.get_mut_world_entity();
|
let mut world_ref = player.world.borrow_mut();
|
||||||
|
let world = world_ref.get_mut_world_entity();
|
||||||
|
|
||||||
let entities = query_hn_with!(world, PlayerOwnedEntityMarker)
|
let entities = query_hn_with!(world, PlayerOwnedEntityMarker)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|(entity_id, _)| {
|
.map(|(entity_id, _)| {
|
||||||
|
let res_map: (EEntityType, i32);
|
||||||
match EEntityType::try_from(
|
match EEntityType::try_from(
|
||||||
world.get_entity(world.get_config_id(entity_id)).entity_type,
|
world.get_entity(world.get_config_id(entity_id)).entity_type,
|
||||||
) {
|
) {
|
||||||
Ok(EEntityType::Player) => {
|
Ok(EEntityType::Player) => {
|
||||||
(EEntityType::Player, entity_id)
|
res_map = (EEntityType::Player, entity_id);
|
||||||
}
|
}
|
||||||
Ok(EEntityType::Monster) => {
|
Ok(EEntityType::Monster) => {
|
||||||
(EEntityType::Monster, entity_id)
|
res_map = (EEntityType::Monster, entity_id);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
(EEntityType::default(), -1)
|
res_map = (EEntityType::default(), -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
res_map
|
||||||
})
|
})
|
||||||
.collect::<HashSet<(EEntityType, i32)>>();
|
.collect::<HashSet<(EEntityType, i32)>>();
|
||||||
|
|
||||||
|
@ -40,9 +44,9 @@ pub fn build_scene_add_on_init_data(ctx: &mut NetContext) -> PlayerSceneAoiData
|
||||||
world.get_entity_components(entity_id),
|
world.get_entity_components(entity_id),
|
||||||
Visibility,
|
Visibility,
|
||||||
|vis: &mut Visibility| {
|
|vis: &mut Visibility| {
|
||||||
let cur_role_id = ctx.player
|
let cur_role_id = player
|
||||||
.formation_list
|
.formation_list
|
||||||
.get(&ctx.player.cur_formation_id)
|
.get(&player.cur_formation_id)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.cur_role;
|
.cur_role;
|
||||||
(vis.is_visible, vis.is_actor_visible) = if config_id == cur_role_id {
|
(vis.is_visible, vis.is_actor_visible) = if config_id == cur_role_id {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
use wicked_waifus_data::{base_property_data, monster_property_growth_data, role_property_growth_data};
|
use wicked_waifus_data::{BasePropertyData, 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 {
|
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();
|
let mut base_props = get_role_props_or_default(id).clone();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use wicked_waifus_data::base_property_data::BasePropertyData;
|
use wicked_waifus_data::BasePropertyData;
|
||||||
use wicked_waifus_protocol::EAttributeType;
|
use wicked_waifus_protocol::EAttributeType;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
pub mod action_utils;
|
pub mod action_utils;
|
||||||
pub mod condition_utils;
|
pub mod condition_utils;
|
||||||
pub mod entity_serializer;
|
pub mod entity_serializer;
|
||||||
pub mod growth_utils;
|
|
||||||
pub mod load_role_info;
|
pub mod load_role_info;
|
||||||
pub mod quadrant_util;
|
|
||||||
pub mod seq_utils;
|
|
||||||
pub mod tag_utils;
|
|
||||||
pub mod world_util;
|
pub mod world_util;
|
||||||
|
pub mod quadrant_util;
|
||||||
|
pub mod growth_utils;
|
||||||
|
pub mod tag_utils;
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::sync::OnceLock;
|
use std::sync::OnceLock;
|
||||||
use wicked_waifus_data::level_entity_config_data::LevelEntityConfigData;
|
|
||||||
|
|
||||||
pub(crate) struct StaticConfig {
|
use wicked_waifus_data::LevelEntityConfigData;
|
||||||
|
|
||||||
|
struct StaticConfig {
|
||||||
edge_size: f32,
|
edge_size: f32,
|
||||||
edge_check: f32,
|
edge_check: f32,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,55 +0,0 @@
|
||||||
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);
|
|
|
@ -4,16 +4,18 @@ use wicked_waifus_protocol::{
|
||||||
SceneMode, ScenePlayerInformation, SceneTimeInfo,
|
SceneMode, ScenePlayerInformation, SceneTimeInfo,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::logic::components::{
|
use wicked_waifus_data::pb_components::ComponentsData;
|
||||||
Autonomous, Fsm, Interact, MonsterAi, ParaglidingSkin, SoarWingSkin, StateTag, Tag, WeaponSkin,
|
use wicked_waifus_data::{
|
||||||
|
blueprint_config_data, template_config_data, EntityLogic, EntityType, LevelEntityConfigData,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use crate::logic::components::{Autonomous, Fsm, Interact, MonsterAi, SoarWingSkin, StateTag, Tag};
|
||||||
use crate::logic::ecs::entity::EntityBuilder;
|
use crate::logic::ecs::entity::EntityBuilder;
|
||||||
use crate::logic::ecs::world::World;
|
use crate::logic::ecs::world::World;
|
||||||
use crate::logic::math::Transform;
|
use crate::logic::math::Transform;
|
||||||
use crate::logic::player::Player;
|
use crate::logic::player::Player;
|
||||||
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::utils::{entity_serializer, tag_utils};
|
||||||
|
use crate::logic::utils::growth_utils::get_monster_props_by_level;
|
||||||
use crate::logic::{
|
use crate::logic::{
|
||||||
components::{
|
components::{
|
||||||
Attribute, EntityConfig, Equip, FightBuff, Movement, OwnerPlayer, PlayerOwnedEntityMarker,
|
Attribute, EntityConfig, Equip, FightBuff, Movement, OwnerPlayer, PlayerOwnedEntityMarker,
|
||||||
|
@ -22,38 +24,32 @@ use crate::logic::{
|
||||||
ecs::component::ComponentContainer,
|
ecs::component::ComponentContainer,
|
||||||
};
|
};
|
||||||
use crate::query_with;
|
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};
|
|
||||||
|
|
||||||
const COUNT_OVERRIDE: &[(i32, i32)] = &[
|
|
||||||
(1105, 3),
|
|
||||||
(1301, 4)
|
|
||||||
];
|
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! create_player_entity_pb {
|
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) => {{
|
($role_list:expr, $cur_map_id:expr, $player:expr, $player_id:expr, $position:expr, $explore_tools:expr) => {{
|
||||||
|
let mut world_ref = $player.world.borrow_mut();
|
||||||
|
let world = world_ref.get_mut_world_entity();
|
||||||
|
|
||||||
let current_formation = $player.formation_list.get(&$player.cur_formation_id).unwrap();
|
let current_formation = $player.formation_list.get(&$player.cur_formation_id).unwrap();
|
||||||
let cur_role_id = current_formation.cur_role;
|
let cur_role_id = current_formation.cur_role;
|
||||||
|
|
||||||
let mut pbs = Vec::new();
|
let mut pbs = Vec::new();
|
||||||
|
|
||||||
for role in $role_list {
|
for role in $role_list {
|
||||||
let entity = $world.create_entity(
|
let entity = world.create_entity(
|
||||||
role.role_id,
|
role.role_id,
|
||||||
EEntityType::Player.into(),
|
EEntityType::Player.into(),
|
||||||
$cur_map_id,
|
$cur_map_id,
|
||||||
);
|
);
|
||||||
// Once per character buffs are implemented, add a mut on role_buffs
|
// 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 fight_buff_infos = world.generate_role_permanent_buffs(entity.entity_id as i64);
|
||||||
let buf_manager = FightBuff {
|
let buf_manager = FightBuff {
|
||||||
fight_buff_infos,
|
fight_buff_infos,
|
||||||
list_buff_effect_cd: vec![],
|
list_buff_effect_cd: vec![],
|
||||||
};
|
};
|
||||||
|
|
||||||
let entity = $world.create_builder(entity)
|
let entity = world.create_builder(entity)
|
||||||
.with(ComponentContainer::PlayerOwnedEntityMarker(PlayerOwnedEntityMarker {
|
.with(ComponentContainer::PlayerOwnedEntityMarker(PlayerOwnedEntityMarker {
|
||||||
entity_type: EEntityType::Player,
|
entity_type: EEntityType::Player,
|
||||||
}))
|
}))
|
||||||
|
@ -91,13 +87,7 @@ macro_rules! create_player_entity_pb {
|
||||||
skin_id: role.skin_id,
|
skin_id: role.skin_id,
|
||||||
}))
|
}))
|
||||||
.with(ComponentContainer::SoarWingSkin(SoarWingSkin {
|
.with(ComponentContainer::SoarWingSkin(SoarWingSkin {
|
||||||
skin_id: role.fly_skin_id,
|
skin_id: 84000001,
|
||||||
}))
|
|
||||||
.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))
|
.with(ComponentContainer::FightBuff(buf_manager))
|
||||||
.build();
|
.build();
|
||||||
|
@ -107,7 +97,7 @@ macro_rules! create_player_entity_pb {
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
$world
|
world
|
||||||
.get_entity_components(entity.entity_id)
|
.get_entity_components(entity.entity_id)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.for_each(|comp| comp.set_pb_data(&mut pb));
|
.for_each(|comp| comp.set_pb_data(&mut pb));
|
||||||
|
@ -121,18 +111,16 @@ macro_rules! create_player_entity_pb {
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_player_entities(ctx: &mut NetContext) {
|
pub fn add_player_entities(player: &Player) {
|
||||||
let world = ctx.world.get_mut_world_entity();
|
let mut world_ref = player.world.borrow_mut();
|
||||||
let current_formation = ctx
|
let world = world_ref.get_mut_world_entity();
|
||||||
.player
|
|
||||||
.formation_list
|
let current_formation = player.formation_list.get(&player.cur_formation_id).unwrap();
|
||||||
.get(&ctx.player.cur_formation_id)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let role_vec = current_formation
|
let role_vec = current_formation
|
||||||
.role_ids
|
.role_ids
|
||||||
.iter()
|
.iter()
|
||||||
.map(|role_id| ctx.player.role_list.get(role_id).unwrap())
|
.map(|role_id| player.role_list.get(&role_id).unwrap())
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
let cur_role_id = current_formation.cur_role;
|
let cur_role_id = current_formation.cur_role;
|
||||||
|
|
||||||
|
@ -141,7 +129,7 @@ pub fn add_player_entities(ctx: &mut NetContext) {
|
||||||
let entity = world.create_entity(
|
let entity = world.create_entity(
|
||||||
role.role_id,
|
role.role_id,
|
||||||
EEntityType::Player.into(),
|
EEntityType::Player.into(),
|
||||||
ctx.player.basic_info.cur_map_id,
|
player.basic_info.cur_map_id,
|
||||||
);
|
);
|
||||||
// Once per character buffs are implemented, add a mut on role_buffs
|
// 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 fight_buff_infos = world.generate_role_permanent_buffs(entity.entity_id as i64);
|
||||||
|
@ -164,10 +152,10 @@ pub fn add_player_entities(ctx: &mut NetContext) {
|
||||||
entity_state: EntityState::Default,
|
entity_state: EntityState::Default,
|
||||||
}))
|
}))
|
||||||
.with(ComponentContainer::OwnerPlayer(OwnerPlayer(
|
.with(ComponentContainer::OwnerPlayer(OwnerPlayer(
|
||||||
ctx.player.basic_info.id,
|
player.basic_info.id,
|
||||||
)))
|
)))
|
||||||
.with(ComponentContainer::Position(Position(
|
.with(ComponentContainer::Position(Position(
|
||||||
ctx.player.location.position.clone(),
|
player.location.position.clone(),
|
||||||
)))
|
)))
|
||||||
.with(ComponentContainer::Visibility(Visibility {
|
.with(ComponentContainer::Visibility(Visibility {
|
||||||
is_visible: role.role_id == cur_role_id,
|
is_visible: role.role_id == cur_role_id,
|
||||||
|
@ -187,19 +175,13 @@ pub fn add_player_entities(ctx: &mut NetContext) {
|
||||||
weapon_breach_level: 0, // TODO: store this too
|
weapon_breach_level: 0, // TODO: store this too
|
||||||
}))
|
}))
|
||||||
.with(ComponentContainer::VisionSkill(VisionSkill {
|
.with(ComponentContainer::VisionSkill(VisionSkill {
|
||||||
skill_id: ctx.player.explore_tools.active_explore_skill,
|
skill_id: player.explore_tools.active_explore_skill,
|
||||||
}))
|
}))
|
||||||
.with(ComponentContainer::RoleSkin(RoleSkin {
|
.with(ComponentContainer::RoleSkin(RoleSkin {
|
||||||
skin_id: role.skin_id,
|
skin_id: role.skin_id,
|
||||||
}))
|
}))
|
||||||
.with(ComponentContainer::SoarWingSkin(SoarWingSkin {
|
.with(ComponentContainer::SoarWingSkin(SoarWingSkin {
|
||||||
skin_id: role.fly_skin_id,
|
skin_id: 84000001,
|
||||||
}))
|
|
||||||
.with(ComponentContainer::ParaglidingSkin(ParaglidingSkin {
|
|
||||||
skin_id: role.wing_skin_id,
|
|
||||||
}))
|
|
||||||
.with(ComponentContainer::WeaponSkin(WeaponSkin {
|
|
||||||
skin_id: role.weapon_skin_id, // TODO: Is this kept on weapon change
|
|
||||||
}))
|
}))
|
||||||
.with(ComponentContainer::FightBuff(buf_manager))
|
.with(ComponentContainer::FightBuff(buf_manager))
|
||||||
.build();
|
.build();
|
||||||
|
@ -213,23 +195,23 @@ pub fn add_player_entities(ctx: &mut NetContext) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_scene_information(ctx: &mut NetContext) -> SceneInformation {
|
pub fn build_scene_information(player: &Player) -> SceneInformation {
|
||||||
SceneInformation {
|
SceneInformation {
|
||||||
scene_id: String::new(),
|
scene_id: String::new(),
|
||||||
instance_id: ctx.player.location.instance_id,
|
instance_id: player.location.instance_id,
|
||||||
owner_id: ctx.player.basic_info.id,
|
owner_id: player.basic_info.id,
|
||||||
dynamic_entity_list: Vec::new(),
|
dynamic_entity_list: Vec::new(),
|
||||||
blackboard_params: Vec::new(),
|
blackboard_params: Vec::new(),
|
||||||
end_time: 0,
|
end_time: 0,
|
||||||
aoi_data: Some(entity_serializer::build_scene_add_on_init_data(ctx)),
|
aoi_data: Some(entity_serializer::build_scene_add_on_init_data(player)),
|
||||||
player_infos: build_player_info_list(ctx.world),
|
player_infos: build_player_info_list(&player.world.borrow_mut()),
|
||||||
mode: SceneMode::Single.into(),
|
mode: SceneMode::Single.into(),
|
||||||
time_info: Some(SceneTimeInfo {
|
time_info: Some(SceneTimeInfo {
|
||||||
owner_time_clock_time_span: 0,
|
owner_time_clock_time_span: 0,
|
||||||
hour: 8,
|
hour: 8,
|
||||||
minute: 0,
|
minute: 0,
|
||||||
}),
|
}),
|
||||||
cur_context_id: ctx.player.basic_info.id as i64,
|
cur_context_id: player.basic_info.id as i64,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -261,12 +243,11 @@ fn build_player_info_list(world: &World) -> Vec<ScenePlayerInformation> {
|
||||||
world.get_world_entity(),
|
world.get_world_entity(),
|
||||||
PlayerOwnedEntityMarker,
|
PlayerOwnedEntityMarker,
|
||||||
OwnerPlayer,
|
OwnerPlayer,
|
||||||
EntityConfig
|
EntityConfig,
|
||||||
|
RoleSkin
|
||||||
)
|
)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter(|(_, e, owner, _)| {
|
.filter(|(_, _, owner, _, _)| owner.0 == sp.player_id);
|
||||||
owner.0 == sp.player_id && e.entity_type == EEntityType::Player
|
|
||||||
});
|
|
||||||
|
|
||||||
ScenePlayerInformation {
|
ScenePlayerInformation {
|
||||||
cur_role: cur_role_id,
|
cur_role: cur_role_id,
|
||||||
|
@ -283,7 +264,7 @@ fn build_player_info_list(world: &World) -> Vec<ScenePlayerInformation> {
|
||||||
cur_role: cur_role_id,
|
cur_role: cur_role_id,
|
||||||
// is_retain: true,
|
// is_retain: true,
|
||||||
fight_role_infos: active_characters
|
fight_role_infos: active_characters
|
||||||
.map(|(id, _, _, conf)| FightRoleInfo {
|
.map(|(id, _, _, conf, role_skin)| FightRoleInfo {
|
||||||
entity_id: id.into(),
|
entity_id: id.into(),
|
||||||
role_id: conf.config_id,
|
role_id: conf.config_id,
|
||||||
on_stage_without_control: false,
|
on_stage_without_control: false,
|
||||||
|
@ -298,14 +279,12 @@ fn build_player_info_list(world: &World) -> Vec<ScenePlayerInformation> {
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn remove_entity(ctx: &mut NetContext, entity_id: i64, remove_type: ERemoveEntityType) {
|
pub fn remove_entity(player: &Player, entity_id: i64, remove_type: ERemoveEntityType) {
|
||||||
if ctx
|
let mut world_ref = player.world.borrow_mut();
|
||||||
.world
|
let world = world_ref.get_mut_world_entity();
|
||||||
.get_mut_world_entity()
|
|
||||||
.remove_entity(entity_id as i32)
|
if world.remove_entity(entity_id as i32) {
|
||||||
{
|
player.notify(EntityRemoveNotify {
|
||||||
// TODO: For COOP find a way to get players from world
|
|
||||||
ctx.player.notify(EntityRemoveNotify {
|
|
||||||
remove_infos: vec![EntityRemoveInfo {
|
remove_infos: vec![EntityRemoveInfo {
|
||||||
entity_id,
|
entity_id,
|
||||||
r#type: remove_type.into(),
|
r#type: remove_type.into(),
|
||||||
|
@ -315,19 +294,22 @@ pub fn remove_entity(ctx: &mut NetContext, entity_id: i64, remove_type: ERemoveE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn remove_entities(ctx: &mut NetContext, entities: &[&LevelEntityConfigData]) {
|
pub fn remove_entities(player: &Player, entities: &[&LevelEntityConfigData]) {
|
||||||
let mut removed_entities = Vec::with_capacity(entities.len());
|
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();
|
||||||
|
|
||||||
let world = ctx.world.get_mut_world_entity();
|
|
||||||
for entity in entities {
|
for entity in entities {
|
||||||
let entity_id = entity.entity_id as i32; // TODO: Should be i64
|
let entity_id = entity.entity_id as i32; // TODO: Should be i64
|
||||||
if world.remove_entity(entity_id) {
|
if world.remove_entity(entity_id) {
|
||||||
removed_entities.push(world.get_entity_id(entity_id));
|
removed_entities.push(world.get_entity_id(entity_id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
for entity_id in removed_entities {
|
for entity_id in removed_entities {
|
||||||
// TODO: For COOP find a way to get players from world
|
player.notify(EntityRemoveNotify {
|
||||||
ctx.player.notify(EntityRemoveNotify {
|
|
||||||
remove_infos: vec![EntityRemoveInfo {
|
remove_infos: vec![EntityRemoveInfo {
|
||||||
entity_id,
|
entity_id,
|
||||||
r#type: 0,
|
r#type: 0,
|
||||||
|
@ -337,14 +319,13 @@ pub fn remove_entities(ctx: &mut NetContext, entities: &[&LevelEntityConfigData]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_entities(
|
pub fn add_entities(player: &Player, entities: &[&LevelEntityConfigData], external_awake: bool) {
|
||||||
ctx: &mut NetContext,
|
|
||||||
entities: &[&LevelEntityConfigData],
|
|
||||||
external_awake: bool,
|
|
||||||
) {
|
|
||||||
let mut added_entities = Vec::with_capacity(entities.len());
|
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();
|
||||||
|
|
||||||
let world = ctx.world.get_mut_world_entity();
|
|
||||||
for entity in entities {
|
for entity in entities {
|
||||||
// Skip hidden entities
|
// Skip hidden entities
|
||||||
if entity.is_hidden {
|
if entity.is_hidden {
|
||||||
|
@ -403,12 +384,7 @@ pub fn add_entities(
|
||||||
EntityState::Default,
|
EntityState::Default,
|
||||||
),
|
),
|
||||||
EntityLogic::ServerOnly => {
|
EntityLogic::ServerOnly => {
|
||||||
tracing::debug!(
|
tracing::debug!("Unhandled entity to be added of logic: {:?} with blueprint_type {} and id: {}", entity_logic, entity.blueprint_type, entity.entity_id);
|
||||||
"Unhandled entity to be added of logic: {:?} with blueprint_type {} and id: {}",
|
|
||||||
entity_logic,
|
|
||||||
entity.blueprint_type,
|
|
||||||
entity.entity_id
|
|
||||||
);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
EntityLogic::Custom => (
|
EntityLogic::Custom => (
|
||||||
|
@ -452,24 +428,19 @@ pub fn add_entities(
|
||||||
// receive move package push for them
|
// receive move package push for them
|
||||||
.with(ComponentContainer::Movement(Movement::default()));
|
.with(ComponentContainer::Movement(Movement::default()));
|
||||||
|
|
||||||
build_autonomous_component(&mut builder, ctx.player.basic_info.id, entity_logic);
|
build_autonomous_component(&mut builder, player.basic_info.id, entity_logic);
|
||||||
build_interact_component(&mut builder, &components);
|
build_interact_component(&mut builder, &components);
|
||||||
build_tags_components(
|
build_tags_components(&mut builder, &components, player, blueprint_config.unwrap().entity_type, config_id as i64);
|
||||||
&mut builder,
|
build_attribute_component(&mut builder, &components, player.location.instance_id);
|
||||||
&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);
|
build_ai_components(&mut builder, &components);
|
||||||
added_entities.push(builder.build());
|
added_entities.push(builder.build());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let world = ctx.world.get_world_entity();
|
let world_ref = player.world.borrow();
|
||||||
|
let world = world_ref.get_world_entity();
|
||||||
// Since kuro has issues, we can only send one
|
// Since kuro has issues, we can only send one
|
||||||
for entity in added_entities {
|
for entity in added_entities {
|
||||||
// TODO: For COOP find a way to get players from world
|
|
||||||
let mut pb = EntityPb {
|
let mut pb = EntityPb {
|
||||||
id: entity.entity_id as i64, // TODO: Should be i64
|
id: entity.entity_id as i64, // TODO: Should be i64
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -480,7 +451,7 @@ pub fn add_entities(
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.for_each(|comp| comp.set_pb_data(&mut pb));
|
.for_each(|comp| comp.set_pb_data(&mut pb));
|
||||||
|
|
||||||
ctx.player.notify(EntityAddNotify {
|
player.notify(EntityAddNotify {
|
||||||
entity_pbs: vec![pb],
|
entity_pbs: vec![pb],
|
||||||
remove_tag_ids: true,
|
remove_tag_ids: true,
|
||||||
});
|
});
|
||||||
|
@ -525,10 +496,7 @@ fn build_tags_components(
|
||||||
if let Some(entity_state_component) = &components.entity_state_component {
|
if let Some(entity_state_component) = &components.entity_state_component {
|
||||||
let state = match entity_type {
|
let state = match entity_type {
|
||||||
EntityType::Teleporter | EntityType::TemporaryTeleporter => {
|
EntityType::Teleporter | EntityType::TemporaryTeleporter => {
|
||||||
let result = player
|
let result = player.teleports.teleports_data.iter()
|
||||||
.teleports
|
|
||||||
.teleports_data
|
|
||||||
.iter()
|
|
||||||
.find(|teleporter| teleporter.entity_config_id == config_id);
|
.find(|teleporter| teleporter.entity_config_id == config_id);
|
||||||
match result.is_some() {
|
match result.is_some() {
|
||||||
true => tag_utils::get_tag_id_by_name("关卡.Common.状态.激活"),
|
true => tag_utils::get_tag_id_by_name("关卡.Common.状态.激活"),
|
||||||
|
|
|
@ -59,10 +59,7 @@ impl<S: Clone + Send + Sync + 'static> Application<S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn serve_dir(mut self, path: &str, dir: &str) -> Self {
|
pub fn serve_dir(mut self, path: &str, dir: &str) -> Self {
|
||||||
self.router = match path {
|
self.router = self.router.nest_service(path, ServeDir::new(dir));
|
||||||
"" | "/" => self.router.fallback_service(ServeDir::new(dir)),
|
|
||||||
_ => self.router.nest_service(path, ServeDir::new(dir))
|
|
||||||
};
|
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,9 +60,6 @@ message RoleData {
|
||||||
RoleStats stats = 17;
|
RoleStats stats = 17;
|
||||||
int32 favor_level = 18;
|
int32 favor_level = 18;
|
||||||
int32 favor_exp = 19;
|
int32 favor_exp = 19;
|
||||||
int32 wing_skin_id = 20;
|
|
||||||
int32 fly_skin_id = 21;
|
|
||||||
int32 weapon_skin_id = 22;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message RoleFormationData {
|
message RoleFormationData {
|
||||||
|
@ -138,43 +135,8 @@ message PlayerAdventureStatusData {
|
||||||
repeated PlayerAdventureGlobalStatusData status = 1;
|
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 {
|
message PlayerInventoryData {
|
||||||
map<int32, int32> items = 1;
|
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 {
|
message PlayerTeleportData {
|
||||||
|
@ -220,14 +182,6 @@ message PlayerMcElementData {
|
||||||
PlayerMcElementType current_element = 2;
|
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 {
|
message PlayerSaveData {
|
||||||
PlayerBasicData basic_data = 1;
|
PlayerBasicData basic_data = 1;
|
||||||
PlayerRoleData role_data = 2;
|
PlayerRoleData role_data = 2;
|
||||||
|
@ -244,5 +198,4 @@ message PlayerSaveData {
|
||||||
PlayerMapTraceData map_trace = 13;
|
PlayerMapTraceData map_trace = 13;
|
||||||
PlayerMonthCardData month_card = 14;
|
PlayerMonthCardData month_card = 14;
|
||||||
PlayerMcElementData mc_element = 15;
|
PlayerMcElementData mc_element = 15;
|
||||||
PlayerUnlockedSkinsData unlocked_skins = 16;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue