mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-24 18:22:29 +00:00
Compare commits
792 Commits
cpp17
..
ldon_remove
| Author | SHA1 | Date | |
|---|---|---|---|
| b7eeb3b2f9 | |||
| d2f8eead1f | |||
| 71e9dd5a3c | |||
| 542ec38660 | |||
| e14acd6802 | |||
| 15328196e2 | |||
| e8b94a11f1 | |||
| 7458b5f32f | |||
| efa245d636 | |||
| e5b9d72b81 | |||
| 93329b4b06 | |||
| b65cf4c081 | |||
| a59ffc6e6b | |||
| c1c2d7b302 | |||
| 4cc24dea75 | |||
| 1f896d05ed | |||
| 1f978ffd72 | |||
| 6ce273baf5 | |||
| e18b332414 | |||
| 2edda6e743 | |||
| b335568bf9 | |||
| 0758250ad1 | |||
| 843aac631b | |||
| 0ce7c11d36 | |||
| 26d374d52a | |||
| 39f5949441 | |||
| abf73947f4 | |||
| 4358e24dab | |||
| c063d9512e | |||
| 39de9c04f6 | |||
| 1637ea95cb | |||
| 6fb687871c | |||
| dd06033a58 | |||
| 13a50f7806 | |||
| c18562b150 | |||
| dba3010c89 | |||
| 00fb9bc9f9 | |||
| 5893730704 | |||
| 0f23bd24cc | |||
| 324d48aa90 | |||
| dadc1b2843 | |||
| 0534a2c6be | |||
| 050e78b1b6 | |||
| 084b253ff7 | |||
| a9a83a2052 | |||
| d117ce0bf2 | |||
| 10b1f7e1ca | |||
| 4ac32d89e8 | |||
| 7aa5308f9c | |||
| f51bc4daaf | |||
| 049fe55c7f | |||
| f5cf566fca | |||
| 97c11a1199 | |||
| ba64d6f494 | |||
| 410ba4b19a | |||
| 74076078bb | |||
| d9e23a0303 | |||
| dbb9c1d4f4 | |||
| d202695e88 | |||
| 323f5ea92e | |||
| 5b74f1e756 | |||
| ee4af65268 | |||
| 739b975cad | |||
| 5035451af7 | |||
| 18a3ff5f12 | |||
| 0d12bf0b1f | |||
| b3fbe1b015 | |||
| e9cd0b15a2 | |||
| cd08c96fa4 | |||
| ac4a993259 | |||
| 435bac5599 | |||
| d5d6b911b0 | |||
| 29cdca380f | |||
| e5f5db69b4 | |||
| d635e69ee3 | |||
| a1531aa057 | |||
| b24ba221e9 | |||
| 253f0594e4 | |||
| 02517bf6ab | |||
| 184128a79b | |||
| 93869dbef6 | |||
| af82a6c5d5 | |||
| fdca333280 | |||
| c954c08c07 | |||
| 0b8220be32 | |||
| f7d40ec88e | |||
| 316336d1cf | |||
| 224c26620e | |||
| c6d5864aa9 | |||
| c45395be95 | |||
| 6d47351d15 | |||
| 450c748299 | |||
| cafae9d8c6 | |||
| b82f376bfb | |||
| 66f89416d5 | |||
| 11d0da9560 | |||
| 8de9e86fed | |||
| 05c407fbb2 | |||
| aaf41001f1 | |||
| af517be184 | |||
| 1af1b7bbdc | |||
| 1f3ce2b34d | |||
| 2f239fd6a3 | |||
| ab005e5950 | |||
| 7349f99ba2 | |||
| 3e7d4d1d6b | |||
| 43fade82e5 | |||
| 3630f3ec38 | |||
| 66d24ff419 | |||
| 2346b0f6ab | |||
| 2957f5084d | |||
| e6dee96266 | |||
| 86ce506956 | |||
| 7a46a6595c | |||
| fa9478ac44 | |||
| cc7904e1bc | |||
| dba69abefc | |||
| 041879c4e6 | |||
| 0887eb0976 | |||
| f8edde9587 | |||
| 74ce20b256 | |||
| 1cfdd7e4a2 | |||
| bf3593a60d | |||
| 65704274cb | |||
| 1bc9e8aff2 | |||
| c23da55b95 | |||
| 2a37785a7c | |||
| 0ef01165ea | |||
| f9923ffda0 | |||
| 6e765e7ddc | |||
| 8b4a886d01 | |||
| 507bbe83f3 | |||
| d33f806efa | |||
| d7d9c73e5e | |||
| d90d680e8a | |||
| baa53e134a | |||
| 3bafc5b3f4 | |||
| b2e4e91fbd | |||
| 10ffcf155d | |||
| ed71543dff | |||
| 0dcaea1e4e | |||
| 52a359180c | |||
| 8f89f38f5c | |||
| f2b67ae969 | |||
| ef0398ebd3 | |||
| dcc921efcb | |||
| eedd5e2821 | |||
| 96b65b848b | |||
| 694d380e66 | |||
| 672c09ee11 | |||
| ca9756abc9 | |||
| da7b5b3560 | |||
| ecc1dd9475 | |||
| 8f7702095b | |||
| 13303a1e14 | |||
| b184a5d013 | |||
| 9f5ce8e3c9 | |||
| 6621338064 | |||
| 00902d8a7e | |||
| 01f69bcc51 | |||
| f429df39a9 | |||
| 0c533071d4 | |||
| fac9c3469f | |||
| 8414973077 | |||
| 5fba138a5a | |||
| 053bdb8646 | |||
| ff5ea82e38 | |||
| 55d4865d36 | |||
| b01793081a | |||
| 18e9c4dc95 | |||
| ed9f155f7c | |||
| d83dc339fc | |||
| 8d7fdd6549 | |||
| 65f2f823a8 | |||
| fac75a3ae0 | |||
| 19e9c0bc22 | |||
| 9816608bba | |||
| 83b279bac3 | |||
| 32aeb6197f | |||
| 11eab9c284 | |||
| 8d863a507b | |||
| c194e2ac9c | |||
| aeb0dbc6ae | |||
| 4039cb12ba | |||
| b7983d4c20 | |||
| e8ab176d4a | |||
| b7f7c66a50 | |||
| 3455863099 | |||
| 7fe0bbacd4 | |||
| c8dfb72cd2 | |||
| 42b34bbf87 | |||
| 963b8fdd53 | |||
| 0923ff040f | |||
| 369461f9e1 | |||
| bb2dcdcb31 | |||
| e67b3dd6d4 | |||
| ddfc0dda42 | |||
| f7cc51c134 | |||
| 1b27d9dc9d | |||
| 8011c4afcc | |||
| 69de53c459 | |||
| 82b3cccc95 | |||
| 91d9a4f73c | |||
| 93f83923ce | |||
| 9759208ed6 | |||
| 9d3d9a97ff | |||
| a29de5963f | |||
| 381b029ffc | |||
| 772c88d020 | |||
| b69213abcc | |||
| 4338d657fc | |||
| 2430b38406 | |||
| 6cfe7853f5 | |||
| 64c97a5283 | |||
| f32f4346e7 | |||
| dcc2dcdb8d | |||
| 9b8845949e | |||
| 36bfebfe6a | |||
| 0c70004102 | |||
| 5238d30236 | |||
| 58e0ce6a4b | |||
| e4b437cb5f | |||
| 5a94e82db8 | |||
| 9713d62849 | |||
| a751339c99 | |||
| 62e480fed7 | |||
| b74edd9dc2 | |||
| 7eba9552e2 | |||
| 396c300315 | |||
| c192590af6 | |||
| fb5fc935e7 | |||
| 780c7a8476 | |||
| c72e18f082 | |||
| a90d836bcd | |||
| c0129a6b8a | |||
| a77d2408ac | |||
| 6baf8412c6 | |||
| 9907984aca | |||
| f767a7c076 | |||
| 445fcc2d40 | |||
| f4ee11ac62 | |||
| d30593c35e | |||
| 102263f37d | |||
| 19ae461e36 | |||
| c481d52064 | |||
| 7c69400618 | |||
| ca98ea9872 | |||
| 7d40e42cc2 | |||
| f1920f2132 | |||
| 30490abc50 | |||
| c5c0a3a73e | |||
| 0551cfc013 | |||
| 1a2cec58f1 | |||
| a9b992a1b0 | |||
| d87ae839a2 | |||
| 0f859a2a0f | |||
| 7e1e1651e4 | |||
| 1c00edb458 | |||
| eb24e333d7 | |||
| 836210404c | |||
| 896dd48960 | |||
| 312ee2b42c | |||
| 3fc1aea3ce | |||
| 0f5a7e1317 | |||
| bebf95cfe3 | |||
| 02aa4302de | |||
| b7d002dd8b | |||
| 480e3a89df | |||
| 427b4db2b3 | |||
| 306328529e | |||
| 0396bada96 | |||
| e9be7146af | |||
| 53bbbbba1d | |||
| f5817677df | |||
| 7b9d88b70b | |||
| 4750768e0f | |||
| 90295d8dec | |||
| 6fe05bbf5e | |||
| a4d8d2261a | |||
| c58ba2e6a5 | |||
| 3fa236c2bb | |||
| e13346560e | |||
| d6e29810f1 | |||
| 29e693d443 | |||
| 7fbf522aa3 | |||
| 0456bef903 | |||
| 6c8c81f3db | |||
| 538092d59e | |||
| 789cfb2490 | |||
| 83928fa4d0 | |||
| f854137ca0 | |||
| de5b7f472d | |||
| 33e5bd0b67 | |||
| a312cd6e1d | |||
| 8b2b2db848 | |||
| 4f9eaf7574 | |||
| fc7d8a82e5 | |||
| 81e4bd6040 | |||
| 54a175b3ef | |||
| 738fd48163 | |||
| e5916c5c03 | |||
| 1de590137f | |||
| 311042f06d | |||
| 6acfc41778 | |||
| 955cbeb826 | |||
| 6e9f920931 | |||
| 4ae9904822 | |||
| c0b8bfde03 | |||
| c09ada67d6 | |||
| cc5dd4cd82 | |||
| 8708564889 | |||
| f506ce9d58 | |||
| 074b7096df | |||
| b46eca4ec6 | |||
| 54500b0e72 | |||
| d2ad2ec078 | |||
| b85feb5461 | |||
| 022f82291a | |||
| 579c300cbc | |||
| 0f051b68ae | |||
| 58b3708a47 | |||
| b68994f25c | |||
| ad51de052c | |||
| 77406d7322 | |||
| 3ed7215a92 | |||
| 3a1eb51890 | |||
| ca113cdd85 | |||
| da5d4b9830 | |||
| 79287fc507 | |||
| cd98b8bc6f | |||
| 18dd9e6637 | |||
| 6266aa86a4 | |||
| c26c6af356 | |||
| a3a6e55d22 | |||
| b965a165b1 | |||
| 2c2c2ac5ee | |||
| cbccd72050 | |||
| 3db23e402c | |||
| c45840173e | |||
| 76b5803f83 | |||
| b377fd183a | |||
| 8e52dd0579 | |||
| b5db40cba6 | |||
| ea34aa2030 | |||
| 40717970ff | |||
| 1d24432e47 | |||
| a597753bee | |||
| 4d1abce084 | |||
| f822798c63 | |||
| 0c5bd9b338 | |||
| 779fc6265e | |||
| d6ab87e2c4 | |||
| 6e5ca19d18 | |||
| fba078bbe9 | |||
| ce19deb5d1 | |||
| 1f3c5af996 | |||
| 9c4df6f026 | |||
| d8b825f478 | |||
| ba9ce2335e | |||
| 15235d77f7 | |||
| cb4a117503 | |||
| d61879fd3c | |||
| 3e373210c5 | |||
| 5a826add92 | |||
| 3843ed6540 | |||
| 184ea679f2 | |||
| e99528fe73 | |||
| 70161aecc4 | |||
| e8d250827d | |||
| f97cc7cdec | |||
| 06d84b83de | |||
| da2a6205ed | |||
| fa21d835d9 | |||
| 6a7980ec75 | |||
| f23ca8055f | |||
| 892556e26d | |||
| 75410e8886 | |||
| 4af5f79328 | |||
| ea0b37b7fc | |||
| 006f7bf9e9 | |||
| 17be2bf2f7 | |||
| 6165550133 | |||
| 59d10a9db3 | |||
| f287e9318e | |||
| 402491b36b | |||
| 2c4f505309 | |||
| f9eafa52f9 | |||
| 4284624096 | |||
| 9b82cf57e4 | |||
| 9164073d14 | |||
| 148af3edfc | |||
| dcbcc5a156 | |||
| 33f2336244 | |||
| 3f4ea66ea1 | |||
| 5ddb62e275 | |||
| a7795eda5d | |||
| aee3e1084c | |||
| 39fad0c1a0 | |||
| 32cc2d66dd | |||
| 780cf148fa | |||
| 8c1f556f29 | |||
| c9504452e1 | |||
| 528b74109e | |||
| 89c6d1e258 | |||
| 50f9a49911 | |||
| cc0c5afd00 | |||
| a1b5b210dd | |||
| d92c0e330d | |||
| 43963783db | |||
| 11181190ee | |||
| af766dd323 | |||
| 158dad052c | |||
| a9c65cd4b2 | |||
| ef77b28b3f | |||
| b116730885 | |||
| 78eb3be127 | |||
| 1819b7c23b | |||
| eccc79e4ce | |||
| 9102bb1478 | |||
| 8eef2ae089 | |||
| f74605d339 | |||
| 7798504641 | |||
| da067be2fa | |||
| a77f8b582e | |||
| 51a74c23ef | |||
| c593ed6a05 | |||
| c1d7a82307 | |||
| a920d449ff | |||
| 21a1a7bed7 | |||
| 8a0f242fc6 | |||
| 4ec9ccae98 | |||
| cc344ac98a | |||
| 69a8507908 | |||
| f87662f676 | |||
| 1eb5e4a0c1 | |||
| a1cc68d214 | |||
| c6d4d8f291 | |||
| fff53fc465 | |||
| 5a4c651d6b | |||
| ff4c9e1e70 | |||
| 8bc60acd77 | |||
| f26b3195c9 | |||
| 31019b8832 | |||
| df4ccaf970 | |||
| eb0d12f220 | |||
| 60254105f1 | |||
| 1fc4073a05 | |||
| be12cad7bd | |||
| 25c596656c | |||
| ee7ef97506 | |||
| 80ce499f67 | |||
| 62efae2e00 | |||
| e9d312fa86 | |||
| c1c010bc8d | |||
| f03669b8f4 | |||
| b996f40016 | |||
| a4a4a2266b | |||
| 82512899b2 | |||
| 4ac62a2ddc | |||
| 1d4bea21c1 | |||
| ed351fb4cb | |||
| d507222d21 | |||
| 27e19900ae | |||
| 32f4722c0f | |||
| 5e93746e8c | |||
| 1106e404c7 | |||
| 0e2c918479 | |||
| 05dfe748d3 | |||
| cd2b2c3c19 | |||
| 6f2b39792a | |||
| ff6de1938b | |||
| d5451c5d77 | |||
| 96fb156c47 | |||
| 56afa0404b | |||
| 29f7bc7a9c | |||
| ad74af7797 | |||
| 3fe0f59deb | |||
| ebf1cc2bc6 | |||
| 32407dbb56 | |||
| 482816058f | |||
| 8ed2ea5cfe | |||
| 5d4a78fb3f | |||
| ebea77e8ea | |||
| 51356610b2 | |||
| 84a75f2a77 | |||
| 9be5ac4ca6 | |||
| b8586bf9cb | |||
| 7cc23fcbeb | |||
| 539de20a11 | |||
| b57bcced40 | |||
| 9ab61d4ed4 | |||
| 09e0b09649 | |||
| b9f01e0d1c | |||
| f7e997fba1 | |||
| 78776df107 | |||
| bd4810351d | |||
| 0506c01103 | |||
| 24a8ca39d3 | |||
| ecf47a0bbb | |||
| 6a4a4de31c | |||
| efdead0b0a | |||
| e319746ca9 | |||
| f78828216d | |||
| 9d0f7781b4 | |||
| f6e544a2e6 | |||
| 3ffb5299a8 | |||
| aeb1ce0fbe | |||
| 4b764e2cc5 | |||
| 45f08b4645 | |||
| 0e31302a7d | |||
| 94d87584aa | |||
| 3245fa6123 | |||
| bda13383ef | |||
| 43108acae1 | |||
| ff7c3aff92 | |||
| daa1db65b9 | |||
| fd48912bd2 | |||
| cfa3e88bb2 | |||
| 8e7591cd4b | |||
| 44a1256eb9 | |||
| a307636962 | |||
| a617fc5034 | |||
| 63ad92090a | |||
| 147916ce2e | |||
| 98340751b0 | |||
| 42781036a8 | |||
| eacd2c2cde | |||
| 2e0c892b07 | |||
| 880b19cc7f | |||
| fc6689ec09 | |||
| db4f113129 | |||
| 30e0bbb912 | |||
| 6a7a78af29 | |||
| 758a30a080 | |||
| 3016f9409b | |||
| 7ba55759c5 | |||
| 8647bd73ce | |||
| e033d89a32 | |||
| a8928d4a39 | |||
| b801f8dfe5 | |||
| b0b63cc64c | |||
| c8389bc674 | |||
| f1929c4f45 | |||
| f6b5bbef00 | |||
| bdf55403cf | |||
| 084e9b7a35 | |||
| a54d92d078 | |||
| 331eb51126 | |||
| b7e2261e16 | |||
| 4e6c3b524f | |||
| 520ac3ae46 | |||
| 15a70c7aa9 | |||
| 9e960b90bd | |||
| 8e96232690 | |||
| 6aad062e9a | |||
| 818fd53dd0 | |||
| 36e064a7b3 | |||
| 12a0e3e226 | |||
| a78c3b9800 | |||
| 62439fe8ee | |||
| 4b1ea13c32 | |||
| 7a5a0915e5 | |||
| 0202a2ad23 | |||
| eed1fd8a43 | |||
| 1b2c2a1dd0 | |||
| f514dd5b55 | |||
| eb039d176c | |||
| 954b0c5106 | |||
| e03ca7f65e | |||
| f32126faac | |||
| e11868eb65 | |||
| 05113aab7d | |||
| ba62d0bdd3 | |||
| 53eb28c5c6 | |||
| f6d415410d | |||
| f143cddc97 | |||
| 2a19ad0197 | |||
| 30067f9b6d | |||
| 1292e1c9c0 | |||
| 9a2294774e | |||
| 2c7d227f4a | |||
| 25c3d3803f | |||
| 736c345a45 | |||
| c3e7cd65e8 | |||
| 9bbef1d79a | |||
| 6bdc1ffffb | |||
| a9c2e35bc7 | |||
| 10f54313a5 | |||
| 2fd149469d | |||
| 08e5176c0c | |||
| 0daadde415 | |||
| 1ae077ea8f | |||
| 0d28f0c083 | |||
| 01698ae989 | |||
| ab73fd7938 | |||
| 06f3d40c28 | |||
| efc3832f52 | |||
| 64b56bd746 | |||
| 577fbdac01 | |||
| fa2caf8f83 | |||
| 4ad38d4c49 | |||
| 4a23086183 | |||
| 9195e5e961 | |||
| 42352359ad | |||
| 88b405edee | |||
| 8a0d4e37bd | |||
| c10a9cb620 | |||
| 01d326ef83 | |||
| 2ec9a2addd | |||
| 6a416a78a8 | |||
| 5e9bf3b044 | |||
| a3874b5252 | |||
| 0e04e42bea | |||
| 40e690f8e3 | |||
| 6896ef650e | |||
| cfe3b2b071 | |||
| a9790e2779 | |||
| a4b027db58 | |||
| 50c266982f | |||
| 905baa71b2 | |||
| db072e767a | |||
| 02fa823736 | |||
| 0d2d6a2c6b | |||
| 12d10bbc50 | |||
| d98e69ae5d | |||
| 26831d5ad4 | |||
| e82f0254b0 | |||
| 630ab5e69d | |||
| e474df2b12 | |||
| e8a05ec680 | |||
| 712df6c35a | |||
| 56c4eb280f | |||
| 03a4254397 | |||
| 3f62da4573 | |||
| 86ef1b12e2 | |||
| b585d9b062 | |||
| 4603fa2ef8 | |||
| 2c2c09531f | |||
| 4e8764b6b9 | |||
| 3ebbcd84d4 | |||
| d7c5a45cc2 | |||
| 5964bcc3c4 | |||
| 0c531e976b | |||
| a64c0dfd92 | |||
| 19107e5ace | |||
| 852a8e1617 | |||
| 4180ef58ef | |||
| 6a817fdce5 | |||
| 5bdc9c6c60 | |||
| ceff8b8674 | |||
| 968efe8831 | |||
| 5dbd2c38ed | |||
| f785dc232b | |||
| d534d345d5 | |||
| 51b98ec724 | |||
| 2c13f2e928 | |||
| 496a958def | |||
| 39cd5bb9a8 | |||
| b08dc02a0a | |||
| 7bea9a7273 | |||
| d8b9c3e3de | |||
| 206761d5e8 | |||
| bf0322f8f6 | |||
| 5dc351e5d5 | |||
| 22180d4bac | |||
| 43ff59d7db | |||
| 2159b5db2d | |||
| b6b008e74a | |||
| 6409e02aed | |||
| 373fb3f0e7 | |||
| ebda1cf601 | |||
| 6a51bcf8fd | |||
| caa0ffda00 | |||
| 85daee85b8 | |||
| e4748a01e0 | |||
| 472c0cd196 | |||
| df43a23d98 | |||
| 74c878a481 | |||
| 093509baa9 | |||
| b8c44ee41b | |||
| bcd62b76c4 | |||
| a0f8bbb3b9 | |||
| 4db646db94 | |||
| 6c3ae4580f | |||
| 3daf03c796 | |||
| 5b4c4bfd66 | |||
| 47b8aa3f18 | |||
| 287fc5d313 | |||
| 77cacf5cd1 | |||
| e0363a8fe1 | |||
| 5c7eb0707f | |||
| 423bb7f0b3 | |||
| 2b1b786f02 | |||
| b23bc83f0f | |||
| 700d062606 | |||
| 867ff3dcfa | |||
| a19bb7b544 | |||
| 723a3aa18e | |||
| be57c57029 | |||
| 725ad9ddf5 | |||
| c978ca65a4 | |||
| 0cce61e85d | |||
| c8722ea789 | |||
| 2f4a217f7a | |||
| 9aac84a405 | |||
| 91c874a310 | |||
| 9fbcd99be2 | |||
| 68a2af1bce | |||
| dadd674b63 | |||
| f7d4e51da9 | |||
| 152d985821 | |||
| 6e3922b7cc | |||
| 9a90bdf91a | |||
| 17e9198a58 | |||
| e17bd303b8 | |||
| be8a6b6af4 | |||
| 80baf1b9ed | |||
| 8a711f3c64 | |||
| c1e58673b2 | |||
| fe7e850a04 | |||
| 15c9b64120 | |||
| cc8aa354f1 | |||
| 33bf20a037 | |||
| bcef171cf9 | |||
| 9faae00d15 | |||
| 0552582274 | |||
| 376c123fa1 | |||
| 80fb204f39 | |||
| 826f0418f7 | |||
| a824ddec44 | |||
| 9e27ffacff | |||
| 3aaa5020b1 | |||
| d691db6621 | |||
| 82b017887d | |||
| 494811c04b | |||
| cbd2336442 | |||
| 3c9fe45af5 | |||
| f984bd2faf | |||
| fe718a6a1d | |||
| 9e910ad90a | |||
| c0c1b5e678 | |||
| 94ab6499c8 | |||
| 1650a466a1 | |||
| 459303c0fe | |||
| 72b1e58edb | |||
| 58534dea16 | |||
| 7d8347a556 | |||
| 3b9016f503 | |||
| 63eca22aac | |||
| dae20afcba | |||
| 019735c654 | |||
| 0c3dd7dc93 | |||
| 79dbddd56e | |||
| 43716332aa | |||
| 128cc458fd | |||
| e9b361445f | |||
| 6127baf12a | |||
| 8effd671c5 | |||
| 06a51f555e | |||
| 3dc227e8cc | |||
| 4375e51431 | |||
| d360c60289 | |||
| 951a77716c | |||
| ca49f3902f | |||
| b22d8f6148 | |||
| a37260fec5 | |||
| ea98a71f22 | |||
| 7ee28d6361 | |||
| 49d835165c | |||
| 286c08b8d5 | |||
| 9048265283 | |||
| 4b55438b3a | |||
| 26b24c02f1 | |||
| 6af1ae32ae | |||
| 262432f504 | |||
| 3a09197d77 | |||
| 8d21225eb3 | |||
| 4b2fe732d2 | |||
| f5cba5ecab | |||
| df66c75df2 | |||
| b3e4d90e4f | |||
| 0d270fdac7 | |||
| ed06129f9d | |||
| ec5be4985e | |||
| c98d2743c5 | |||
| 7c2a3f602c | |||
| 13e8199298 | |||
| 1737ef605c | |||
| 8e441f006e | |||
| 91ca5dcade | |||
| 7cf52d467e | |||
| dde9b98e4f |
+16
@@ -0,0 +1,16 @@
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: EQEmulator Server Linux CI
|
||||
|
||||
# Limits how many of these builds can run on the drone runner at a time, this isn't about cores
|
||||
concurrency:
|
||||
limit: 1
|
||||
|
||||
steps:
|
||||
- name: server-build
|
||||
# Source build script https://github.com/Akkadius/akk-stack/blob/master/containers/eqemu-server/Dockerfile#L20
|
||||
image: akkadius/eqemu-server:latest
|
||||
commands:
|
||||
- sudo chown eqemu:eqemu /drone/src/ * -R
|
||||
- git submodule init && git submodule update && mkdir -p build && cd build && cmake -DEQEMU_BUILD_LOGIN=ON -DEQEMU_BUILD_BOTS=ON -DEQEMU_BUILD_LUA=ON -G 'Unix Makefiles' .. && make -j$((`nproc`-4))
|
||||
Vendored
+22
-13
@@ -6,7 +6,7 @@
|
||||
{
|
||||
"label": "make",
|
||||
"type": "shell",
|
||||
"command": "cd build && make",
|
||||
"command": "cd bin && make",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
@@ -18,7 +18,7 @@
|
||||
{
|
||||
"label": "make clean",
|
||||
"type": "shell",
|
||||
"command": "cd build && make clean",
|
||||
"command": "cd bin && make clean",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
@@ -30,7 +30,7 @@
|
||||
{
|
||||
"label": "cmake",
|
||||
"type": "shell",
|
||||
"command": "mkdir -p build && cd build && rm CMakeCache.txt && cmake -DEQEMU_BUILD_LOGIN=ON -DEQEMU_BUILD_LUA=ON -G 'Unix Makefiles' ..",
|
||||
"command": "mkdir -p bin && cd bin && rm CMakeCache.txt && cmake -DEQEMU_BUILD_LOGIN=ON -DEQEMU_BUILD_LUA=ON -G 'Unix Makefiles' ..",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
@@ -52,7 +52,7 @@
|
||||
{
|
||||
"label": "download maps",
|
||||
"type": "shell",
|
||||
"command": "mkdir -p build/bin && cd build/bin && wget https://codeload.github.com/Akkadius/EQEmuMaps/zip/master -O maps.zip && unzip -o maps.zip && rm ./maps -rf && mv EQEmuMaps-master maps && rm maps.zip",
|
||||
"command": "mkdir -p bin && cd bin && wget https://codeload.github.com/Akkadius/EQEmuMaps/zip/master -O maps.zip && unzip -o maps.zip && rm ./maps -rf && mv EQEmuMaps-master maps && rm maps.zip",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
@@ -64,7 +64,7 @@
|
||||
{
|
||||
"label": "download quests",
|
||||
"type": "shell",
|
||||
"command": "mkdir -p build/bin && cd build/bin && cd server && git -C ./quests pull 2> /dev/null || git clone https://github.com/ProjectEQ/projecteqquests.git quests",
|
||||
"command": "mkdir -p bin && cd bin && cd server && git -C ./quests pull 2> /dev/null || git clone https://github.com/ProjectEQ/projecteqquests.git quests",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
@@ -76,7 +76,7 @@
|
||||
{
|
||||
"label": "download eqemu_config",
|
||||
"type": "shell",
|
||||
"command": "mkdir -p build/bin && cd build/bin && wget --no-check-certificate https://raw.githubusercontent.com/Akkadius/EQEmuInstall/master/eqemu_config_docker.json -O eqemu_config.json",
|
||||
"command": "mkdir -p bin && cd bin && wget --no-check-certificate https://raw.githubusercontent.com/Akkadius/EQEmuInstall/master/eqemu_config_docker.json -O eqemu_config.json",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
@@ -88,7 +88,7 @@
|
||||
{
|
||||
"label": "rebuild database (mariadb must be started)",
|
||||
"type": "shell",
|
||||
"command": "mkdir -p build/bin && cd build/bin && docker run -i --rm --privileged -v ${HOST_PROJECT_PATH}/build/bin:/src --network=eqemu -it eqemu/server:0.0.3 bash -c './eqemu_server.pl source_peq_db && ./eqemu_server.pl check_db_updates && ./eqemu_server.pl linux_login_server_setup'",
|
||||
"command": "mkdir -p bin && cd bin && docker run -i --rm --privileged -v ${HOST_PROJECT_PATH}/bin:/src --network=eqemu -it eqemu/server:0.0.3 bash -c './eqemu_server.pl source_peq_db && ./eqemu_server.pl check_db_updates && ./eqemu_server.pl linux_login_server_setup'",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
@@ -100,7 +100,7 @@
|
||||
{
|
||||
"label": "zone 7000",
|
||||
"type": "shell",
|
||||
"command": "docker stop zone7000 | true && docker network create eqemu | true && docker run -i --rm --name zone7000 --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/build/bin:/src --ulimit core=10000000 --network=eqemu -p 7000:7000/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./zone dynamic_zone7000:7000",
|
||||
"command": "docker stop zone7000 | true && docker network create eqemu | true && docker run -i --rm --name zone7000 --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 --network=eqemu -p 7000:7000/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./zone dynamic_zone7000:7000",
|
||||
"group": {
|
||||
"kind": "test",
|
||||
"isDefault": true
|
||||
@@ -109,7 +109,7 @@
|
||||
{
|
||||
"label": "zone 7001",
|
||||
"type": "shell",
|
||||
"command": "docker stop zone7001 | true && docker network create eqemu | true && docker run -i --rm --name zone7001 --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/build/bin:/src --ulimit core=10000000 --network=eqemu -p 7001:7001/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./zone dynamic_zone7001:7001",
|
||||
"command": "docker stop zone7001 | true && docker network create eqemu | true && docker run -i --rm --name zone7001 --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 --network=eqemu -p 7001:7001/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./zone dynamic_zone7001:7001",
|
||||
"group": {
|
||||
"kind": "test",
|
||||
"isDefault": true
|
||||
@@ -118,7 +118,7 @@
|
||||
{
|
||||
"label": "loginserver",
|
||||
"type": "shell",
|
||||
"command": "docker stop loginserver | true && docker network create eqemu | true && docker run -i --rm --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/build/bin:/src --ulimit core=10000000 --network=eqemu --name loginserver -p 5999:5999/udp -p 5998:5998/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./loginserver",
|
||||
"command": "docker stop loginserver | true && docker network create eqemu | true && docker run -i --rm --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 --network=eqemu --name loginserver -p 5999:5999/udp -p 5998:5998/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./loginserver",
|
||||
"group": {
|
||||
"kind": "test",
|
||||
"isDefault": true
|
||||
@@ -127,7 +127,7 @@
|
||||
{
|
||||
"label": "shared_memory, world",
|
||||
"type": "shell",
|
||||
"command": "docker stop sharedmemory | true && docker stop world | true && docker network create eqemu | true && docker run --rm -v ${HOST_PROJECT_PATH}/build/bin:/src --network=eqemu --name sharedmemory eqemu/server:0.0.3 ./shared_memory && docker run --rm -v ${HOST_PROJECT_PATH}/build/bin:/src --ulimit core=10000000 -e LD_LIBRARY_PATH=/src/ --network=eqemu --name world -p 9000:9000 -p 9000:9000/udp -p 9001:9001 -p 9080:9080 eqemu/server:0.0.3 gdb -ex run ./world",
|
||||
"command": "docker stop sharedmemory | true && docker stop world | true && docker network create eqemu | true && docker run --rm -v ${HOST_PROJECT_PATH}/bin:/src --network=eqemu --name sharedmemory eqemu/server:0.0.3 ./shared_memory && docker run --rm -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 -e LD_LIBRARY_PATH=/src/ --network=eqemu --name world -p 9000:9000 -p 9000:9000/udp -p 9001:9001 -p 9080:9080 eqemu/server:0.0.3 gdb -ex run ./world",
|
||||
"group": {
|
||||
"kind": "test",
|
||||
"isDefault": true
|
||||
@@ -136,7 +136,7 @@
|
||||
{
|
||||
"label": "queryserv",
|
||||
"type": "shell",
|
||||
"command": "docker stop queryserv | true && docker run --rm -v ${HOST_PROJECT_PATH}/build/bin:/src --ulimit core=10000000 -e LD_LIBRARY_PATH=/src/ --network=eqemu --name queryserv eqemu/server:0.0.3 gdb -ex run ./queryserv",
|
||||
"command": "docker stop queryserv | true && docker run --rm -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 -e LD_LIBRARY_PATH=/src/ --network=eqemu --name queryserv eqemu/server:0.0.3 gdb -ex run ./queryserv",
|
||||
"group": {
|
||||
"kind": "test",
|
||||
"isDefault": true
|
||||
@@ -145,7 +145,16 @@
|
||||
{
|
||||
"label": "mariadb",
|
||||
"type": "shell",
|
||||
"command": "docker stop mariadb | true && cd build/bin && docker network create eqemu | true && docker run --rm -v ${HOST_PROJECT_PATH}/build/bin/db:/bitnami/mariadb -p 3306:3306 -e MARIADB_DATABASE=peq -e MARIADB_USER=eqemu -e MARIADB_PASSWORD=eqemupass -e ALLOW_EMPTY_PASSWORD=yes --name mariadb --network=eqemu bitnami/mariadb:latest",
|
||||
"command": "docker stop mariadb | true && cd bin && docker network create eqemu | true && docker run --rm -v ${HOST_PROJECT_PATH}/bin/db:/bitnami/mariadb -p 3306:3306 -e MARIADB_DATABASE=peq -e MARIADB_USER=eqemu -e MARIADB_PASSWORD=eqemupass -e ALLOW_EMPTY_PASSWORD=yes --name mariadb --network=eqemu bitnami/mariadb:latest",
|
||||
"group": {
|
||||
"kind": "test",
|
||||
"isDefault": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "ucs",
|
||||
"type": "shell",
|
||||
"command": "docker stop ucs | true && cd bin && docker network create eqemu | true && docker run --rm -v ${HOST_PROJECT_PATH}/bin:/src -p 7778:7778 --name ucs --network=eqemu eqemu/server:0.0.3 gdb -ex run ./ucs",
|
||||
"group": {
|
||||
"kind": "test",
|
||||
"isDefault": true
|
||||
|
||||
+21
-5
@@ -1,4 +1,4 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.8)
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
|
||||
|
||||
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH})
|
||||
|
||||
@@ -12,7 +12,7 @@ IF(NOT CMAKE_BUILD_TYPE)
|
||||
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
|
||||
ENDIF(NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
SET(CMAKE_CXX_STANDARD 17)
|
||||
SET(CMAKE_CXX_STANDARD 14)
|
||||
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
SET(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
@@ -55,6 +55,7 @@ FIND_PACKAGE(MariaDB)
|
||||
FIND_PACKAGE(ZLIB)
|
||||
FIND_PACKAGE(OpenSSL)
|
||||
FIND_PACKAGE(Lua51)
|
||||
FIND_PACKAGE(LuaJit)
|
||||
FIND_PACKAGE(PerlLibs)
|
||||
FIND_PACKAGE(Sodium)
|
||||
FIND_PACKAGE(mbedTLS)
|
||||
@@ -87,6 +88,12 @@ ELSE()
|
||||
MESSAGE(STATUS "* Lua: MISSING *")
|
||||
ENDIF()
|
||||
|
||||
IF(LuaJit_FOUND)
|
||||
MESSAGE(STATUS "* LuaJIT: FOUND *")
|
||||
ELSE()
|
||||
MESSAGE(STATUS "* LuaJIT: MISSING *")
|
||||
ENDIF()
|
||||
|
||||
IF(PerlLibs_FOUND)
|
||||
MESSAGE(STATUS "* Perl: FOUND *")
|
||||
ELSE()
|
||||
@@ -122,6 +129,7 @@ OPTION(EQEMU_BUILD_LOGIN "Build the login server." ON)
|
||||
OPTION(EQEMU_BUILD_HC "Build the headless client." OFF)
|
||||
OPTION(EQEMU_BUILD_TESTS "Build utility tests." OFF)
|
||||
OPTION(EQEMU_BUILD_CLIENT_FILES "Build Client Import/Export Data Programs." ON)
|
||||
OPTION(EQEMU_PREFER_LUA "Build with normal Lua even if LuaJIT is found." OFF)
|
||||
|
||||
IF(EQEMU_COMMANDS_LOGGING)
|
||||
ADD_DEFINITIONS(-DCOMMANDS_LOGGING)
|
||||
@@ -133,7 +141,7 @@ ENDIF(EQEMU_ENABLE_BOTS)
|
||||
|
||||
#database
|
||||
IF(MySQL_FOUND AND MariaDB_FOUND)
|
||||
SET(DATABASE_LIBRARY_SELECTION MySQL CACHE STRING "Database library to use:
|
||||
SET(DATABASE_LIBRARY_SELECTION MariaDB CACHE STRING "Database library to use:
|
||||
MySQL
|
||||
MariaDB"
|
||||
)
|
||||
@@ -212,7 +220,12 @@ ELSE()
|
||||
SET(SODIUM_LIBRARY_ENABLED OFF)
|
||||
ENDIF()
|
||||
|
||||
IF(Lua51_FOUND)
|
||||
IF(LUAJIT_FOUND AND NOT (EQEMU_PREFER_LUA AND Lua51_FOUND))
|
||||
SET(LUA_LIBRARY_TYPE " LuaJIT")
|
||||
SET(LUA_LIBRARY_ENABLED ON)
|
||||
SET(LUA_LIBRARY_LIBS ${LUAJIT_LIBRARY} luabind)
|
||||
SET(LUA_LIBRARY_INCLUDE ${LUAJIT_INCLUDE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/libs/luabind")
|
||||
ELSEIF(Lua51_FOUND )
|
||||
SET(LUA_LIBRARY_TYPE " Lua 5.1")
|
||||
SET(LUA_LIBRARY_ENABLED ON)
|
||||
SET(LUA_LIBRARY_LIBS ${LUA_LIBRARY} luabind)
|
||||
@@ -239,6 +252,7 @@ IF(ZLIB_FOUND)
|
||||
SET(ZLIB_LIBRARY_TYPE "zlib-ng")
|
||||
SET(ZLIB_LIBRARY_LIBS "zlibstatic")
|
||||
SET(ZLIB_LIBRARY_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/libs/zlibng")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_BINARY_DIR}/libs/zlibng")
|
||||
ELSE()
|
||||
SET(ZLIB_LIBRARY_TYPE " zlib")
|
||||
SET(ZLIB_LIBRARY_LIBS ${ZLIB_LIBRARY})
|
||||
@@ -299,7 +313,7 @@ IF(LUA_LIBRARY_ENABLED)
|
||||
|
||||
IF(EQEMU_BUILD_LUA)
|
||||
ADD_DEFINITIONS(-DLUA_EQEMU)
|
||||
SET(SERVER_LIBS ${SERVER_LIBS} ${LUA_LIBRARY_LIBS})
|
||||
SET(ZONE_LIBS ${LUA_LIBRARY_LIBS})
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${LUA_LIBRARY_INCLUDE}")
|
||||
|
||||
OPTION(EQEMU_SANITIZE_LUA_LIBS "Sanitize Lua Libraries (Remove OS and IO standard libraries from being able to run)." ON)
|
||||
@@ -334,6 +348,8 @@ IF(UNIX)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
SET(ZONE_LIBS ${ZONE_LIBS} ${SERVER_LIBS})
|
||||
|
||||
IF(EQEMU_BUILD_LOGIN AND NOT TLS_LIBRARY_ENABLED)
|
||||
MESSAGE(FATAL_ERROR "Login server requires a TLS Library to build.")
|
||||
ENDIF()
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
We expect contributors and community members to act professionally and respectfully, and we expect our forums and Discord channels to be dignified environments that expand the community and enhance the learning experience for new members.
|
||||
|
||||
Specifically:
|
||||
|
||||
* Respect people, their ideas, and their work.
|
||||
* Be kind. Be courteous. Be welcoming.
|
||||
* Listen. Consider and acknowledge people's points before responding.
|
||||
* Be respectful of differing viewpoints and experience levels.
|
||||
* Accept constructive criticism and work together toward decisions.
|
||||
* Focus on what is best for the community and users.
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of violent threats, trolling, insulting/derogatory comments, abusive or discriminatory language, or personal attacks.
|
||||
* Public or private harassment.
|
||||
* Publishing others' private information, such as a physical or electronic address, without explicit permission.
|
||||
* Conduct which could reasonably be considered inappropriate in a professional setting.
|
||||
* Advocating for or encouraging any of the above behaviors.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, forum posts, Discord messages, and other contributions that are not aligned with this code of conduct.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project.
|
||||
@@ -17,9 +17,13 @@
|
||||
|:---:|:---:|:---:|
|
||||
|**Install Count**|||
|
||||
### > Windows
|
||||
* [Install](https://eqemu.gitbook.io/server/categories/how-to-guides/installation/server-installation-windows)
|
||||
|
||||
* [Install Guide](https://eqemu.gitbook.io/server/categories/installation/server-installation-windows)
|
||||
|
||||
### > Debian/Ubuntu/CentOS/Fedora
|
||||
|
||||
* [Install Guide](https://eqemu.gitbook.io/server/categories/installation/server-installation-linux)
|
||||
|
||||
* You can use curl or wget to kick off the installer (whichever your OS has)
|
||||
> curl -O https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/linux_installer/install.sh install.sh && chmod 755 install.sh && ./install.sh
|
||||
|
||||
@@ -76,3 +80,4 @@ forum, although pull requests will be much quicker and easier on all parties.
|
||||
<a href="https://github.com/EQEmu/server/graphs/contributors">
|
||||
<img src="https://contributors-img.firebaseapp.com/image?repo=EQEmu/server" />
|
||||
</a>
|
||||
|
||||
|
||||
+2
-2
@@ -16,6 +16,6 @@ build:
|
||||
verbosity: minimal
|
||||
after_build:
|
||||
- cmd: >-
|
||||
7z a build_x64-bots.zip C:\projects\eqemu\build\bin\RelWithDebInfo\*.exe C:\projects\eqemu\build\bin\RelWithDebInfo\*.dll C:\projects\eqemu\build\bin\RelWithDebInfo\*.pdb
|
||||
7z a build_x64-bots.zip C:\projects\eqemu\build\bin\RelWithDebInfo\*.exe C:\projects\eqemu\build\bin\RelWithDebInfo\*.dll C:\projects\eqemu\build\bin\RelWithDebInfo\*.pdb C:\projects\eqemu\build\libs\zlibng\RelWithDebInfo\*.dll
|
||||
|
||||
appveyor PushArtifact build_x64-bots.zip
|
||||
appveyor PushArtifact build_x64-bots.zip
|
||||
|
||||
@@ -16,6 +16,6 @@ build:
|
||||
verbosity: minimal
|
||||
after_build:
|
||||
- cmd: >-
|
||||
7z a build_x64-no-bots.zip C:\projects\eqemu\build\bin\RelWithDebInfo\*.exe C:\projects\eqemu\build\bin\RelWithDebInfo\*.dll C:\projects\eqemu\build\bin\RelWithDebInfo\*.pdb
|
||||
7z a build_x64-no-bots.zip C:\projects\eqemu\build\bin\RelWithDebInfo\*.exe C:\projects\eqemu\build\bin\RelWithDebInfo\*.dll C:\projects\eqemu\build\bin\RelWithDebInfo\*.pdb C:\projects\eqemu\build\libs\zlibng\RelWithDebInfo\*.dll
|
||||
|
||||
appveyor PushArtifact build_x64-no-bots.zip
|
||||
appveyor PushArtifact build_x64-no-bots.zip
|
||||
|
||||
+119
-76
@@ -26,21 +26,24 @@
|
||||
#include "../../common/crash.h"
|
||||
#include "../../common/rulesys.h"
|
||||
#include "../../common/string_util.h"
|
||||
#include "../../common/content/world_content_service.h"
|
||||
|
||||
EQEmuLogSys LogSys;
|
||||
WorldContentService content_service;
|
||||
|
||||
void ExportSpells(SharedDatabase *db);
|
||||
void ExportSkillCaps(SharedDatabase *db);
|
||||
void ExportBaseData(SharedDatabase *db);
|
||||
void ExportDBStrings(SharedDatabase *db);
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
RegisterExecutablePlatform(ExePlatformClientExport);
|
||||
LogSys.LoadLogSettingsDefaults();
|
||||
set_exception_handler();
|
||||
|
||||
LogInfo("Client Files Export Utility");
|
||||
if(!EQEmuConfig::LoadConfig()) {
|
||||
if (!EQEmuConfig::LoadConfig()) {
|
||||
LogError("Unable to load configuration file");
|
||||
return 1;
|
||||
}
|
||||
@@ -48,14 +51,38 @@ int main(int argc, char **argv) {
|
||||
auto Config = EQEmuConfig::get();
|
||||
|
||||
SharedDatabase database;
|
||||
SharedDatabase content_db;
|
||||
|
||||
LogInfo("Connecting to database");
|
||||
if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(),
|
||||
Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) {
|
||||
if (!database.Connect(
|
||||
Config->DatabaseHost.c_str(),
|
||||
Config->DatabaseUsername.c_str(),
|
||||
Config->DatabasePassword.c_str(),
|
||||
Config->DatabaseDB.c_str(),
|
||||
Config->DatabasePort
|
||||
)) {
|
||||
LogError("Unable to connect to the database, cannot continue without a database connection");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Register Log System and Settings */
|
||||
/**
|
||||
* Multi-tenancy: Content database
|
||||
*/
|
||||
if (!Config->ContentDbHost.empty()) {
|
||||
if (!content_db.Connect(
|
||||
Config->ContentDbHost.c_str() ,
|
||||
Config->ContentDbUsername.c_str(),
|
||||
Config->ContentDbPassword.c_str(),
|
||||
Config->ContentDbName.c_str(),
|
||||
Config->ContentDbPort
|
||||
)) {
|
||||
LogError("Cannot continue without a content database connection");
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
content_db.SetMysql(database.getMySQL());
|
||||
}
|
||||
|
||||
database.LoadLogSettings(LogSys.log_settings);
|
||||
LogSys.StartFileLogs();
|
||||
|
||||
@@ -66,15 +93,15 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
if (arg_1 == "spells") {
|
||||
ExportSpells(&database);
|
||||
ExportSpells(&content_db);
|
||||
return 0;
|
||||
}
|
||||
if (arg_1 == "skills") {
|
||||
ExportSkillCaps(&database);
|
||||
ExportSkillCaps(&content_db);
|
||||
return 0;
|
||||
}
|
||||
if (arg_1 == "basedata") {
|
||||
ExportBaseData(&database);
|
||||
ExportBaseData(&content_db);
|
||||
return 0;
|
||||
}
|
||||
if (arg_1 == "dbstring") {
|
||||
@@ -82,9 +109,9 @@ int main(int argc, char **argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ExportSpells(&database);
|
||||
ExportSkillCaps(&database);
|
||||
ExportBaseData(&database);
|
||||
ExportSpells(&content_db);
|
||||
ExportSkillCaps(&content_db);
|
||||
ExportBaseData(&content_db);
|
||||
ExportDBStrings(&database);
|
||||
|
||||
LogSys.CloseFileLogs();
|
||||
@@ -92,93 +119,105 @@ int main(int argc, char **argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ExportSpells(SharedDatabase *db) {
|
||||
void ExportSpells(SharedDatabase *db)
|
||||
{
|
||||
LogInfo("Exporting Spells");
|
||||
|
||||
FILE *f = fopen("export/spells_us.txt", "w");
|
||||
if(!f) {
|
||||
if (!f) {
|
||||
LogError("Unable to open export/spells_us.txt to write, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
const std::string query = "SELECT * FROM spells_new ORDER BY id";
|
||||
auto results = db->QueryDatabase(query);
|
||||
const std::string query = "SELECT * FROM spells_new ORDER BY id";
|
||||
auto results = db->QueryDatabase(query);
|
||||
|
||||
if(results.Success()) {
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
std::string line;
|
||||
unsigned int fields = results.ColumnCount();
|
||||
for(unsigned int i = 0; i < fields; ++i) {
|
||||
if(i != 0) {
|
||||
if (results.Success()) {
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
std::string line;
|
||||
unsigned int fields = results.ColumnCount();
|
||||
for (unsigned int i = 0; i < fields; ++i) {
|
||||
if (i != 0) {
|
||||
line.push_back('^');
|
||||
}
|
||||
|
||||
if(row[i] != nullptr) {
|
||||
if (row[i] != nullptr) {
|
||||
line += row[i];
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(f, "%s\n", line.c_str());
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
bool SkillUsable(SharedDatabase *db, int skill_id, int class_id) {
|
||||
bool SkillUsable(SharedDatabase *db, int skill_id, int class_id)
|
||||
{
|
||||
|
||||
bool res = false;
|
||||
|
||||
std::string query = StringFormat("SELECT max(cap) FROM skill_caps WHERE class=%d AND skillID=%d",
|
||||
class_id, skill_id);
|
||||
auto results = db->QueryDatabase(query);
|
||||
if(!results.Success()) {
|
||||
return false;
|
||||
}
|
||||
std::string query = StringFormat(
|
||||
"SELECT max(cap) FROM skill_caps WHERE class=%d AND skillID=%d",
|
||||
class_id, skill_id
|
||||
);
|
||||
auto results = db->QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return false;
|
||||
if (results.RowCount() == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto row = results.begin();
|
||||
if(row[0] && atoi(row[0]) > 0)
|
||||
return true;
|
||||
auto row = results.begin();
|
||||
if (row[0] && atoi(row[0]) > 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) {
|
||||
int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level)
|
||||
{
|
||||
|
||||
std::string query = StringFormat("SELECT cap FROM skill_caps WHERE class=%d AND skillID=%d AND level=%d",
|
||||
class_id, skill_id, level);
|
||||
auto results = db->QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return 0;
|
||||
}
|
||||
std::string query = StringFormat(
|
||||
"SELECT cap FROM skill_caps WHERE class=%d AND skillID=%d AND level=%d",
|
||||
class_id, skill_id, level
|
||||
);
|
||||
auto results = db->QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return 0;
|
||||
if (results.RowCount() == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto row = results.begin();
|
||||
auto row = results.begin();
|
||||
return atoi(row[0]);
|
||||
}
|
||||
|
||||
void ExportSkillCaps(SharedDatabase *db) {
|
||||
void ExportSkillCaps(SharedDatabase *db)
|
||||
{
|
||||
LogInfo("Exporting Skill Caps");
|
||||
|
||||
FILE *f = fopen("export/SkillCaps.txt", "w");
|
||||
if(!f) {
|
||||
if (!f) {
|
||||
LogError("Unable to open export/SkillCaps.txt to write, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
for(int cl = 1; cl <= 16; ++cl) {
|
||||
for(int skill = 0; skill <= 77; ++skill) {
|
||||
if(SkillUsable(db, skill, cl)) {
|
||||
int previous_cap = 0;
|
||||
for(int level = 1; level <= 100; ++level) {
|
||||
for (int cl = 1; cl <= 16; ++cl) {
|
||||
for (int skill = 0; skill <= 77; ++skill) {
|
||||
if (SkillUsable(db, skill, cl)) {
|
||||
int previous_cap = 0;
|
||||
for (int level = 1; level <= 100; ++level) {
|
||||
int cap = GetSkill(db, skill, cl, level);
|
||||
if(cap < previous_cap) {
|
||||
if (cap < previous_cap) {
|
||||
cap = previous_cap;
|
||||
}
|
||||
|
||||
@@ -192,26 +231,28 @@ void ExportSkillCaps(SharedDatabase *db) {
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void ExportBaseData(SharedDatabase *db) {
|
||||
void ExportBaseData(SharedDatabase *db)
|
||||
{
|
||||
LogInfo("Exporting Base Data");
|
||||
|
||||
FILE *f = fopen("export/BaseData.txt", "w");
|
||||
if(!f) {
|
||||
if (!f) {
|
||||
LogError("Unable to open export/BaseData.txt to write, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
const std::string query = "SELECT * FROM base_data ORDER BY level, class";
|
||||
auto results = db->QueryDatabase(query);
|
||||
if(results.Success()) {
|
||||
for (auto row = results.begin();row != results.end();++row) {
|
||||
std::string line;
|
||||
unsigned int fields = results.ColumnCount();
|
||||
for(unsigned int rowIndex = 0; rowIndex < fields; ++rowIndex) {
|
||||
if(rowIndex != 0)
|
||||
const std::string query = "SELECT * FROM base_data ORDER BY level, class";
|
||||
auto results = db->QueryDatabase(query);
|
||||
if (results.Success()) {
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
std::string line;
|
||||
unsigned int fields = results.ColumnCount();
|
||||
for (unsigned int rowIndex = 0; rowIndex < fields; ++rowIndex) {
|
||||
if (rowIndex != 0) {
|
||||
line.push_back('^');
|
||||
}
|
||||
|
||||
if(row[rowIndex] != nullptr) {
|
||||
if (row[rowIndex] != nullptr) {
|
||||
line += row[rowIndex];
|
||||
}
|
||||
}
|
||||
@@ -223,27 +264,29 @@ void ExportBaseData(SharedDatabase *db) {
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void ExportDBStrings(SharedDatabase *db) {
|
||||
void ExportDBStrings(SharedDatabase *db)
|
||||
{
|
||||
LogInfo("Exporting DB Strings");
|
||||
|
||||
FILE *f = fopen("export/dbstr_us.txt", "w");
|
||||
if(!f) {
|
||||
if (!f) {
|
||||
LogError("Unable to open export/dbstr_us.txt to write, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(f, "Major^Minor^String(New)\n");
|
||||
const std::string query = "SELECT * FROM db_str ORDER BY id, type";
|
||||
auto results = db->QueryDatabase(query);
|
||||
if(results.Success()) {
|
||||
for(auto row = results.begin(); row != results.end(); ++row) {
|
||||
std::string line;
|
||||
unsigned int fields = results.ColumnCount();
|
||||
for(unsigned int rowIndex = 0; rowIndex < fields; ++rowIndex) {
|
||||
if(rowIndex != 0)
|
||||
const std::string query = "SELECT * FROM db_str ORDER BY id, type";
|
||||
auto results = db->QueryDatabase(query);
|
||||
if (results.Success()) {
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
std::string line;
|
||||
unsigned int fields = results.ColumnCount();
|
||||
for (unsigned int rowIndex = 0; rowIndex < fields; ++rowIndex) {
|
||||
if (rowIndex != 0) {
|
||||
line.push_back('^');
|
||||
}
|
||||
|
||||
if(row[rowIndex] != nullptr) {
|
||||
if (row[rowIndex] != nullptr) {
|
||||
line += row[rowIndex];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,10 @@
|
||||
#include "../../common/crash.h"
|
||||
#include "../../common/rulesys.h"
|
||||
#include "../../common/string_util.h"
|
||||
#include "../../common/content/world_content_service.h"
|
||||
|
||||
EQEmuLogSys LogSys;
|
||||
WorldContentService content_service;
|
||||
|
||||
void ImportSpells(SharedDatabase *db);
|
||||
void ImportSkillCaps(SharedDatabase *db);
|
||||
@@ -46,24 +48,48 @@ int main(int argc, char **argv) {
|
||||
auto Config = EQEmuConfig::get();
|
||||
|
||||
SharedDatabase database;
|
||||
SharedDatabase content_db;
|
||||
|
||||
LogInfo("Connecting to database");
|
||||
if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(),
|
||||
Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) {
|
||||
LogError("Unable to connect to the database, cannot continue without a "
|
||||
"database connection");
|
||||
if (!database.Connect(
|
||||
Config->DatabaseHost.c_str(),
|
||||
Config->DatabaseUsername.c_str(),
|
||||
Config->DatabasePassword.c_str(),
|
||||
Config->DatabaseDB.c_str(),
|
||||
Config->DatabasePort
|
||||
)) {
|
||||
LogError("Unable to connect to the database, cannot continue without a database connection");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Multi-tenancy: Content database
|
||||
*/
|
||||
if (!Config->ContentDbHost.empty()) {
|
||||
if (!content_db.Connect(
|
||||
Config->ContentDbHost.c_str() ,
|
||||
Config->ContentDbUsername.c_str(),
|
||||
Config->ContentDbPassword.c_str(),
|
||||
Config->ContentDbName.c_str(),
|
||||
Config->ContentDbPort
|
||||
)) {
|
||||
LogError("Cannot continue without a content database connection");
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
content_db.SetMysql(database.getMySQL());
|
||||
}
|
||||
|
||||
database.LoadLogSettings(LogSys.log_settings);
|
||||
LogSys.StartFileLogs();
|
||||
|
||||
ImportSpells(&database);
|
||||
ImportSkillCaps(&database);
|
||||
ImportBaseData(&database);
|
||||
ImportSpells(&content_db);
|
||||
ImportSkillCaps(&content_db);
|
||||
ImportBaseData(&content_db);
|
||||
ImportDBStrings(&database);
|
||||
|
||||
LogSys.CloseFileLogs();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -300,10 +326,10 @@ void ImportDBStrings(SharedDatabase *db) {
|
||||
std::string sql;
|
||||
int id, type;
|
||||
std::string value;
|
||||
|
||||
|
||||
id = atoi(split[0].c_str());
|
||||
type = atoi(split[1].c_str());
|
||||
|
||||
|
||||
if(split.size() >= 3) {
|
||||
value = ::EscapeString(split[2]);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ locations other than lua/
|
||||
find_path(LUA_INCLUDE_DIR lua.h
|
||||
HINTS
|
||||
ENV LUA_DIR
|
||||
PATH_SUFFIXES include/lua51 include/lua5.1 include/lua-5.1 include/lua include/luajit include
|
||||
PATH_SUFFIXES include/lua51 include/lua5.1 include/lua-5.1 include/lua include
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
@@ -49,7 +49,7 @@ find_path(LUA_INCLUDE_DIR lua.h
|
||||
)
|
||||
|
||||
find_library(LUA_LIBRARY
|
||||
NAMES lua51 lua5.1 lua-5.1 lua luajit
|
||||
NAMES lua51 lua5.1 lua-5.1 lua
|
||||
HINTS
|
||||
ENV LUA_DIR
|
||||
PATH_SUFFIXES lib
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
# Modified from the FindLua51 that comes with CMake
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
FindLuaJit
|
||||
---------
|
||||
|
||||
|
||||
|
||||
Locate LuaJit library This module defines
|
||||
|
||||
::
|
||||
|
||||
LUAJIT_FOUND, if false, do not try to link to Lua
|
||||
LUAJIT_LIBRARIES
|
||||
LUAJIT_INCLUDE_DIR, where to find lua.h
|
||||
LUAJIT_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
|
||||
|
||||
|
||||
|
||||
Note that the expected include convention is
|
||||
|
||||
::
|
||||
|
||||
#include "lua.h"
|
||||
|
||||
and not
|
||||
|
||||
::
|
||||
|
||||
#include <lua/lua.h>
|
||||
|
||||
This is because, the lua location is not standardized and may exist in
|
||||
locations other than lua/
|
||||
#]=======================================================================]
|
||||
|
||||
find_path(LUAJIT_INCLUDE_DIR lua.h
|
||||
HINTS
|
||||
ENV LUA_DIR
|
||||
PATH_SUFFIXES include/luajit include/luajit-2.0 include/luajit-2.1 include
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
/opt
|
||||
)
|
||||
|
||||
find_library(LUAJIT_LIBRARY
|
||||
NAMES luajit51 luajit5.1 luajit-5.1 luajit lua51
|
||||
HINTS
|
||||
ENV LUA_DIR
|
||||
PATH_SUFFIXES lib
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/sw
|
||||
/opt/local
|
||||
/opt/csw
|
||||
/opt
|
||||
)
|
||||
|
||||
if(LUAJIT_LIBRARY)
|
||||
# include the math library for Unix
|
||||
if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU)
|
||||
find_library(LUAJIT_MATH_LIBRARY m)
|
||||
set( LUAJIT_LIBRARIES "${LUAJIT_LIBRARY};${LUAJIT_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
|
||||
# For Windows and Mac, don't need to explicitly include the math library
|
||||
else()
|
||||
set( LUAJIT_LIBRARIES "${LUAJIT_LIBRARY}" CACHE STRING "Lua Libraries")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LUAJIT_INCLUDE_DIR AND EXISTS "${LUAJIT_INCLUDE_DIR}/lua.h")
|
||||
file(STRINGS "${LUAJIT_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"")
|
||||
|
||||
string(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUAJIT_VERSION_STRING "${lua_version_str}")
|
||||
unset(lua_version_str)
|
||||
endif()
|
||||
|
||||
include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
|
||||
# handle the QUIETLY and REQUIRED arguments and set LUAJIT_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaJit
|
||||
REQUIRED_VARS LUAJIT_LIBRARIES LUAJIT_INCLUDE_DIR
|
||||
VERSION_VAR LUAJIT_VERSION_STRING)
|
||||
|
||||
mark_as_advanced(LUAJIT_INCLUDE_DIR LUAJIT_LIBRARIES LUAJIT_LIBRARY LUAJIT_MATH_LIBRARY)
|
||||
|
||||
+349
-1
@@ -6,6 +6,7 @@ SET(common_sources
|
||||
cli/eqemu_command_handler.cpp
|
||||
compression.cpp
|
||||
condition.cpp
|
||||
content/world_content_service.cpp
|
||||
crash.cpp
|
||||
crc16.cpp
|
||||
crc32.cpp
|
||||
@@ -15,6 +16,7 @@ SET(common_sources
|
||||
database_instances.cpp
|
||||
dbcore.cpp
|
||||
deity.cpp
|
||||
dynamic_zone_base.cpp
|
||||
emu_constants.cpp
|
||||
emu_limits.cpp
|
||||
emu_opcodes.cpp
|
||||
@@ -30,6 +32,8 @@ SET(common_sources
|
||||
eq_stream_proxy.cpp
|
||||
eqtime.cpp
|
||||
event_sub.cpp
|
||||
expedition_base.cpp
|
||||
expedition_lockout_timer.cpp
|
||||
extprofile.cpp
|
||||
faction.cpp
|
||||
file_util.cpp
|
||||
@@ -66,6 +70,7 @@ SET(common_sources
|
||||
rulesys.cpp
|
||||
say_link.cpp
|
||||
serialize_buffer.cpp
|
||||
server_event_scheduler.cpp
|
||||
serverinfo.cpp
|
||||
shareddb.cpp
|
||||
skills.cpp
|
||||
@@ -108,6 +113,343 @@ SET(common_sources
|
||||
util/directory.cpp
|
||||
util/uuid.cpp)
|
||||
|
||||
SET(repositories
|
||||
|
||||
# Criteria
|
||||
repositories/criteria/content_filter_criteria.h
|
||||
|
||||
# Base Repositories
|
||||
repositories/base/base_aa_ability_repository.h
|
||||
repositories/base/base_aa_ranks_repository.h
|
||||
repositories/base/base_aa_rank_effects_repository.h
|
||||
repositories/base/base_aa_rank_prereqs_repository.h
|
||||
repositories/base/base_account_repository.h
|
||||
repositories/base/base_account_flags_repository.h
|
||||
repositories/base/base_account_ip_repository.h
|
||||
repositories/base/base_account_rewards_repository.h
|
||||
repositories/base/base_adventure_details_repository.h
|
||||
repositories/base/base_adventure_members_repository.h
|
||||
repositories/base/base_adventure_stats_repository.h
|
||||
repositories/base/base_adventure_template_repository.h
|
||||
repositories/base/base_adventure_template_entry_repository.h
|
||||
repositories/base/base_adventure_template_entry_flavor_repository.h
|
||||
repositories/base/base_alternate_currency_repository.h
|
||||
repositories/base/base_auras_repository.h
|
||||
repositories/base/base_base_data_repository.h
|
||||
repositories/base/base_blocked_spells_repository.h
|
||||
repositories/base/base_bugs_repository.h
|
||||
repositories/base/base_bug_reports_repository.h
|
||||
repositories/base/base_buyer_repository.h
|
||||
repositories/base/base_character_activities_repository.h
|
||||
repositories/base/base_character_alternate_abilities_repository.h
|
||||
repositories/base/base_character_alt_currency_repository.h
|
||||
repositories/base/base_character_auras_repository.h
|
||||
repositories/base/base_character_bandolier_repository.h
|
||||
repositories/base/base_character_bind_repository.h
|
||||
repositories/base/base_character_buffs_repository.h
|
||||
repositories/base/base_character_corpses_repository.h
|
||||
repositories/base/base_character_corpse_items_repository.h
|
||||
repositories/base/base_character_currency_repository.h
|
||||
repositories/base/base_character_data_repository.h
|
||||
repositories/base/base_character_disciplines_repository.h
|
||||
repositories/base/base_character_expedition_lockouts_repository.h
|
||||
repositories/base/base_character_inspect_messages_repository.h
|
||||
repositories/base/base_character_item_recast_repository.h
|
||||
repositories/base/base_character_languages_repository.h
|
||||
repositories/base/base_character_leadership_abilities_repository.h
|
||||
repositories/base/base_character_material_repository.h
|
||||
repositories/base/base_character_memmed_spells_repository.h
|
||||
repositories/base/base_character_pet_buffs_repository.h
|
||||
repositories/base/base_character_pet_info_repository.h
|
||||
repositories/base/base_character_pet_inventory_repository.h
|
||||
repositories/base/base_character_potionbelt_repository.h
|
||||
repositories/base/base_character_skills_repository.h
|
||||
repositories/base/base_character_spells_repository.h
|
||||
repositories/base/base_character_tasks_repository.h
|
||||
repositories/base/base_char_create_combinations_repository.h
|
||||
repositories/base/base_char_create_point_allocations_repository.h
|
||||
repositories/base/base_char_recipe_list_repository.h
|
||||
repositories/base/base_completed_tasks_repository.h
|
||||
repositories/base/base_content_flags_repository.h
|
||||
repositories/base/base_damageshieldtypes_repository.h
|
||||
repositories/base/base_data_buckets_repository.h
|
||||
repositories/base/base_db_str_repository.h
|
||||
repositories/base/base_discovered_items_repository.h
|
||||
repositories/base/base_doors_repository.h
|
||||
repositories/base/base_dynamic_zones_repository.h
|
||||
repositories/base/base_dynamic_zone_members_repository.h
|
||||
repositories/base/base_eventlog_repository.h
|
||||
repositories/base/base_expeditions_repository.h
|
||||
repositories/base/base_expedition_lockouts_repository.h
|
||||
repositories/base/base_faction_base_data_repository.h
|
||||
repositories/base/base_faction_list_repository.h
|
||||
repositories/base/base_faction_list_mod_repository.h
|
||||
repositories/base/base_faction_values_repository.h
|
||||
repositories/base/base_fishing_repository.h
|
||||
repositories/base/base_forage_repository.h
|
||||
repositories/base/base_friends_repository.h
|
||||
repositories/base/base_global_loot_repository.h
|
||||
repositories/base/base_gm_ips_repository.h
|
||||
repositories/base/base_goallists_repository.h
|
||||
repositories/base/base_graveyard_repository.h
|
||||
repositories/base/base_grid_repository.h
|
||||
repositories/base/base_grid_entries_repository.h
|
||||
repositories/base/base_ground_spawns_repository.h
|
||||
repositories/base/base_group_id_repository.h
|
||||
repositories/base/base_group_leaders_repository.h
|
||||
repositories/base/base_guilds_repository.h
|
||||
repositories/base/base_guild_members_repository.h
|
||||
repositories/base/base_guild_ranks_repository.h
|
||||
repositories/base/base_guild_relations_repository.h
|
||||
repositories/base/base_hackers_repository.h
|
||||
repositories/base/base_instance_list_repository.h
|
||||
repositories/base/base_instance_list_player_repository.h
|
||||
repositories/base/base_inventory_repository.h
|
||||
repositories/base/base_inventory_snapshots_repository.h
|
||||
repositories/base/base_ip_exemptions_repository.h
|
||||
repositories/base/base_items_repository.h
|
||||
repositories/base/base_item_tick_repository.h
|
||||
repositories/base/base_ldon_trap_entries_repository.h
|
||||
repositories/base/base_ldon_trap_templates_repository.h
|
||||
repositories/base/base_level_exp_mods_repository.h
|
||||
repositories/base/base_lfguild_repository.h
|
||||
repositories/base/base_login_accounts_repository.h
|
||||
repositories/base/base_login_api_tokens_repository.h
|
||||
repositories/base/base_login_server_admins_repository.h
|
||||
repositories/base/base_login_server_list_types_repository.h
|
||||
repositories/base/base_login_world_servers_repository.h
|
||||
repositories/base/base_logsys_categories_repository.h
|
||||
repositories/base/base_lootdrop_repository.h
|
||||
repositories/base/base_lootdrop_entries_repository.h
|
||||
repositories/base/base_loottable_repository.h
|
||||
repositories/base/base_loottable_entries_repository.h
|
||||
repositories/base/base_mail_repository.h
|
||||
repositories/base/base_merchantlist_repository.h
|
||||
repositories/base/base_merchantlist_temp_repository.h
|
||||
repositories/base/base_name_filter_repository.h
|
||||
repositories/base/base_npc_emotes_repository.h
|
||||
repositories/base/base_npc_faction_repository.h
|
||||
repositories/base/base_npc_faction_entries_repository.h
|
||||
repositories/base/base_npc_scale_global_base_repository.h
|
||||
repositories/base/base_npc_spells_repository.h
|
||||
repositories/base/base_npc_spells_effects_repository.h
|
||||
repositories/base/base_npc_spells_effects_entries_repository.h
|
||||
repositories/base/base_npc_spells_entries_repository.h
|
||||
repositories/base/base_npc_types_repository.h
|
||||
repositories/base/base_npc_types_tint_repository.h
|
||||
repositories/base/base_object_repository.h
|
||||
repositories/base/base_object_contents_repository.h
|
||||
repositories/base/base_perl_event_export_settings_repository.h
|
||||
repositories/base/base_petitions_repository.h
|
||||
repositories/base/base_pets_repository.h
|
||||
repositories/base/base_pets_equipmentset_repository.h
|
||||
repositories/base/base_pets_equipmentset_entries_repository.h
|
||||
repositories/base/base_player_titlesets_repository.h
|
||||
repositories/base/base_proximities_repository.h
|
||||
repositories/base/base_quest_globals_repository.h
|
||||
repositories/base/base_raid_details_repository.h
|
||||
repositories/base/base_raid_members_repository.h
|
||||
repositories/base/base_reports_repository.h
|
||||
repositories/base/base_respawn_times_repository.h
|
||||
repositories/base/base_rule_sets_repository.h
|
||||
repositories/base/base_rule_values_repository.h
|
||||
repositories/base/base_saylink_repository.h
|
||||
repositories/base/base_server_scheduled_events_repository.h
|
||||
repositories/base/base_skill_caps_repository.h
|
||||
repositories/base/base_spawn2_repository.h
|
||||
repositories/base/base_spawnentry_repository.h
|
||||
repositories/base/base_spawngroup_repository.h
|
||||
repositories/base/base_spawn_conditions_repository.h
|
||||
repositories/base/base_spawn_condition_values_repository.h
|
||||
repositories/base/base_spawn_events_repository.h
|
||||
repositories/base/base_spells_new_repository.h
|
||||
repositories/base/base_spell_buckets_repository.h
|
||||
repositories/base/base_spell_globals_repository.h
|
||||
repositories/base/base_starting_items_repository.h
|
||||
repositories/base/base_start_zones_repository.h
|
||||
repositories/base/base_tasks_repository.h
|
||||
repositories/base/base_tasksets_repository.h
|
||||
repositories/base/base_task_activities_repository.h
|
||||
repositories/base/base_timers_repository.h
|
||||
repositories/base/base_titles_repository.h
|
||||
repositories/base/base_trader_repository.h
|
||||
repositories/base/base_tradeskill_recipe_repository.h
|
||||
repositories/base/base_tradeskill_recipe_entries_repository.h
|
||||
repositories/base/base_traps_repository.h
|
||||
repositories/base/base_tributes_repository.h
|
||||
repositories/base/base_tribute_levels_repository.h
|
||||
repositories/base/base_veteran_reward_templates_repository.h
|
||||
repositories/base/base_zone_repository.h
|
||||
repositories/base/base_zone_points_repository.h
|
||||
|
||||
# Extended Repositories
|
||||
repositories/aa_ability_repository.h
|
||||
repositories/aa_ranks_repository.h
|
||||
repositories/aa_rank_effects_repository.h
|
||||
repositories/aa_rank_prereqs_repository.h
|
||||
repositories/account_repository.h
|
||||
repositories/account_flags_repository.h
|
||||
repositories/account_ip_repository.h
|
||||
repositories/account_rewards_repository.h
|
||||
repositories/adventure_details_repository.h
|
||||
repositories/adventure_members_repository.h
|
||||
repositories/adventure_stats_repository.h
|
||||
repositories/adventure_template_repository.h
|
||||
repositories/adventure_template_entry_repository.h
|
||||
repositories/adventure_template_entry_flavor_repository.h
|
||||
repositories/alternate_currency_repository.h
|
||||
repositories/auras_repository.h
|
||||
repositories/base_data_repository.h
|
||||
repositories/blocked_spells_repository.h
|
||||
repositories/bugs_repository.h
|
||||
repositories/bug_reports_repository.h
|
||||
repositories/buyer_repository.h
|
||||
repositories/character_activities_repository.h
|
||||
repositories/character_alternate_abilities_repository.h
|
||||
repositories/character_alt_currency_repository.h
|
||||
repositories/character_auras_repository.h
|
||||
repositories/character_bandolier_repository.h
|
||||
repositories/character_bind_repository.h
|
||||
repositories/character_buffs_repository.h
|
||||
repositories/character_corpses_repository.h
|
||||
repositories/character_corpse_items_repository.h
|
||||
repositories/character_currency_repository.h
|
||||
repositories/character_data_repository.h
|
||||
repositories/character_disciplines_repository.h
|
||||
repositories/character_expedition_lockouts_repository.h
|
||||
repositories/character_inspect_messages_repository.h
|
||||
repositories/character_item_recast_repository.h
|
||||
repositories/character_languages_repository.h
|
||||
repositories/character_leadership_abilities_repository.h
|
||||
repositories/character_material_repository.h
|
||||
repositories/character_memmed_spells_repository.h
|
||||
repositories/character_pet_buffs_repository.h
|
||||
repositories/character_pet_info_repository.h
|
||||
repositories/character_pet_inventory_repository.h
|
||||
repositories/character_potionbelt_repository.h
|
||||
repositories/character_skills_repository.h
|
||||
repositories/character_spells_repository.h
|
||||
repositories/character_tasks_repository.h
|
||||
repositories/char_create_combinations_repository.h
|
||||
repositories/char_create_point_allocations_repository.h
|
||||
repositories/char_recipe_list_repository.h
|
||||
repositories/completed_tasks_repository.h
|
||||
repositories/content_flags_repository.h
|
||||
repositories/damageshieldtypes_repository.h
|
||||
repositories/data_buckets_repository.h
|
||||
repositories/db_str_repository.h
|
||||
repositories/discovered_items_repository.h
|
||||
repositories/doors_repository.h
|
||||
repositories/dynamic_zones_repository.h
|
||||
repositories/dynamic_zone_members_repository.h
|
||||
repositories/eventlog_repository.h
|
||||
repositories/expeditions_repository.h
|
||||
repositories/expedition_lockouts_repository.h
|
||||
repositories/faction_base_data_repository.h
|
||||
repositories/faction_list_repository.h
|
||||
repositories/faction_list_mod_repository.h
|
||||
repositories/faction_values_repository.h
|
||||
repositories/fishing_repository.h
|
||||
repositories/forage_repository.h
|
||||
repositories/friends_repository.h
|
||||
repositories/global_loot_repository.h
|
||||
repositories/gm_ips_repository.h
|
||||
repositories/goallists_repository.h
|
||||
repositories/graveyard_repository.h
|
||||
repositories/grid_repository.h
|
||||
repositories/grid_entries_repository.h
|
||||
repositories/ground_spawns_repository.h
|
||||
repositories/group_id_repository.h
|
||||
repositories/group_leaders_repository.h
|
||||
repositories/guilds_repository.h
|
||||
repositories/guild_members_repository.h
|
||||
repositories/guild_ranks_repository.h
|
||||
repositories/guild_relations_repository.h
|
||||
repositories/hackers_repository.h
|
||||
repositories/instance_list_repository.h
|
||||
repositories/instance_list_player_repository.h
|
||||
repositories/inventory_repository.h
|
||||
repositories/inventory_snapshots_repository.h
|
||||
repositories/ip_exemptions_repository.h
|
||||
repositories/items_repository.h
|
||||
repositories/item_tick_repository.h
|
||||
repositories/ldon_trap_entries_repository.h
|
||||
repositories/ldon_trap_templates_repository.h
|
||||
repositories/level_exp_mods_repository.h
|
||||
repositories/lfguild_repository.h
|
||||
repositories/login_accounts_repository.h
|
||||
repositories/login_api_tokens_repository.h
|
||||
repositories/login_server_admins_repository.h
|
||||
repositories/login_server_list_types_repository.h
|
||||
repositories/login_world_servers_repository.h
|
||||
repositories/logsys_categories_repository.h
|
||||
repositories/lootdrop_repository.h
|
||||
repositories/lootdrop_entries_repository.h
|
||||
repositories/loottable_repository.h
|
||||
repositories/loottable_entries_repository.h
|
||||
repositories/mail_repository.h
|
||||
repositories/merchantlist_repository.h
|
||||
repositories/merchantlist_temp_repository.h
|
||||
repositories/name_filter_repository.h
|
||||
repositories/npc_emotes_repository.h
|
||||
repositories/npc_faction_repository.h
|
||||
repositories/npc_faction_entries_repository.h
|
||||
repositories/npc_scale_global_base_repository.h
|
||||
repositories/npc_spells_repository.h
|
||||
repositories/npc_spells_effects_repository.h
|
||||
repositories/npc_spells_effects_entries_repository.h
|
||||
repositories/npc_spells_entries_repository.h
|
||||
repositories/npc_types_repository.h
|
||||
repositories/npc_types_tint_repository.h
|
||||
repositories/object_repository.h
|
||||
repositories/object_contents_repository.h
|
||||
repositories/perl_event_export_settings_repository.h
|
||||
repositories/petitions_repository.h
|
||||
repositories/pets_repository.h
|
||||
repositories/pets_equipmentset_repository.h
|
||||
repositories/pets_equipmentset_entries_repository.h
|
||||
repositories/player_titlesets_repository.h
|
||||
repositories/proximities_repository.h
|
||||
repositories/quest_globals_repository.h
|
||||
repositories/raid_details_repository.h
|
||||
repositories/raid_members_repository.h
|
||||
repositories/reports_repository.h
|
||||
repositories/respawn_times_repository.h
|
||||
repositories/rule_sets_repository.h
|
||||
repositories/rule_values_repository.h
|
||||
repositories/saylink_repository.h
|
||||
repositories/server_scheduled_events_repository.h
|
||||
repositories/skill_caps_repository.h
|
||||
repositories/spawn2_repository.h
|
||||
repositories/spawnentry_repository.h
|
||||
repositories/spawngroup_repository.h
|
||||
repositories/spawn_conditions_repository.h
|
||||
repositories/spawn_condition_values_repository.h
|
||||
repositories/spawn_events_repository.h
|
||||
repositories/spells_new_repository.h
|
||||
repositories/spell_buckets_repository.h
|
||||
repositories/spell_globals_repository.h
|
||||
repositories/starting_items_repository.h
|
||||
repositories/start_zones_repository.h
|
||||
repositories/tasks_repository.h
|
||||
repositories/tasksets_repository.h
|
||||
repositories/task_activities_repository.h
|
||||
repositories/timers_repository.h
|
||||
repositories/titles_repository.h
|
||||
repositories/trader_repository.h
|
||||
repositories/tradeskill_recipe_repository.h
|
||||
repositories/tradeskill_recipe_entries_repository.h
|
||||
repositories/traps_repository.h
|
||||
repositories/tributes_repository.h
|
||||
repositories/tribute_levels_repository.h
|
||||
repositories/veteran_reward_templates_repository.h
|
||||
repositories/zone_repository.h
|
||||
repositories/zone_points_repository.h
|
||||
|
||||
# Non-Comformative
|
||||
repositories/character_recipe_list_repository.h
|
||||
)
|
||||
|
||||
SET(common_headers
|
||||
any.h
|
||||
base_packet.h
|
||||
@@ -116,18 +458,21 @@ SET(common_headers
|
||||
classes.h
|
||||
compression.h
|
||||
condition.h
|
||||
content/world_content_service.h
|
||||
crash.h
|
||||
crc16.h
|
||||
crc32.h
|
||||
cli/argh.h
|
||||
cli/eqemu_command_handler.h
|
||||
cli/terminal_color.hpp
|
||||
cron/croncpp.h
|
||||
database/database_dump_service.h
|
||||
data_verification.h
|
||||
database.h
|
||||
database_schema.h
|
||||
dbcore.h
|
||||
deity.h
|
||||
dynamic_zone_base.h
|
||||
emu_constants.h
|
||||
emu_limits.h
|
||||
emu_opcodes.h
|
||||
@@ -151,6 +496,8 @@ SET(common_headers
|
||||
eqtime.h
|
||||
errmsg.h
|
||||
event_sub.h
|
||||
expedition_base.h
|
||||
expedition_lockout_timer.h
|
||||
extprofile.h
|
||||
faction.h
|
||||
file_util.h
|
||||
@@ -202,6 +549,7 @@ SET(common_headers
|
||||
say_link.h
|
||||
seperator.h
|
||||
serialize_buffer.h
|
||||
server_event_scheduler.h
|
||||
serverinfo.h
|
||||
servertalk.h
|
||||
shareddb.h
|
||||
@@ -380,7 +728,7 @@ SOURCE_GROUP(Util FILES
|
||||
|
||||
INCLUDE_DIRECTORIES(Patches SocketLib StackWalker)
|
||||
|
||||
ADD_LIBRARY(common ${common_sources} ${common_headers})
|
||||
ADD_LIBRARY(common ${common_sources} ${common_headers} ${repositories})
|
||||
|
||||
IF(UNIX)
|
||||
SET_SOURCE_FILES_PROPERTIES("SocketLib/Mime.cpp" PROPERTY COMPILE_FLAGS -Wno-unused-result)
|
||||
|
||||
@@ -378,6 +378,8 @@ const char *GetClassIDName(uint8 class_id, uint8 level)
|
||||
return "Berserker Guildmaster";
|
||||
case MERCHANT:
|
||||
return "Merchant";
|
||||
case DISCORD_MERCHANT:
|
||||
return "Discord Merchant";
|
||||
case ADVENTURERECRUITER:
|
||||
return "Adventure Recruiter";
|
||||
case ADVENTUREMERCHANT:
|
||||
@@ -388,6 +390,18 @@ const char *GetClassIDName(uint8 class_id, uint8 level)
|
||||
return "Tribute Master";
|
||||
case GUILD_TRIBUTE_MASTER:
|
||||
return "Guild Tribute Master";
|
||||
case GUILD_BANKER:
|
||||
return "Guild Banker";
|
||||
case NORRATHS_KEEPERS_MERCHANT:
|
||||
return "Radiant Crystal Merchant";
|
||||
case DARK_REIGN_MERCHANT:
|
||||
return "Ebon Crystal Merchant";
|
||||
case FELLOWSHIP_MASTER:
|
||||
return "Fellowship Master";
|
||||
case ALT_CURRENCY_MERCHANT:
|
||||
return "Alternate Currency Merchant";
|
||||
case MERCERNARY_MASTER:
|
||||
return "Mercenary Liaison";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
#define CORPSE_CLASS 62 // only seen on Danvi's Corpse in Akheva so far..
|
||||
#define TRIBUTE_MASTER 63
|
||||
#define GUILD_TRIBUTE_MASTER 64 // not sure
|
||||
#define GUILD_BANKER 66
|
||||
#define NORRATHS_KEEPERS_MERCHANT 67
|
||||
#define DARK_REIGN_MERCHANT 68
|
||||
#define FELLOWSHIP_MASTER 69
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace EQEmuCommand {
|
||||
index++;
|
||||
}
|
||||
|
||||
if (!arguments_filled || argc == 2) {
|
||||
if (!arguments_filled || argc == 2 || cmd[{"-h", "--help"}]) {
|
||||
std::string arguments_string;
|
||||
for (auto &arg : arguments) {
|
||||
arguments_string += " " + arg;
|
||||
@@ -101,7 +101,7 @@ namespace EQEmuCommand {
|
||||
|
||||
std::cout << command_string.str() << std::endl;
|
||||
|
||||
exit(1);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,6 +168,11 @@ namespace EQEmuCommand {
|
||||
* Print section header
|
||||
*/
|
||||
std::string command_prefix = it.first.substr(0, it.first.find(":"));
|
||||
|
||||
if (command_prefix.find("test") != std::string::npos) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (command_section != command_prefix) {
|
||||
command_section = command_prefix;
|
||||
std::cout << termcolor::reset << command_prefix << std::endl;
|
||||
@@ -183,11 +188,11 @@ namespace EQEmuCommand {
|
||||
|
||||
std::cout << std::endl;
|
||||
|
||||
std::exit(1);
|
||||
std::exit(0);
|
||||
}
|
||||
|
||||
if (ran_command) {
|
||||
std::exit(1);
|
||||
std::exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2019 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
* are required to give you total support for your newly bought product;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include "world_content_service.h"
|
||||
#include "../database.h"
|
||||
#include "../rulesys.h"
|
||||
#include "../eqemu_logsys.h"
|
||||
#include "../repositories/content_flags_repository.h"
|
||||
|
||||
|
||||
WorldContentService::WorldContentService()
|
||||
{
|
||||
SetCurrentExpansion(Expansion::EXPANSION_ALL);
|
||||
}
|
||||
|
||||
int WorldContentService::GetCurrentExpansion() const
|
||||
{
|
||||
return current_expansion;
|
||||
}
|
||||
|
||||
void WorldContentService::SetExpansionContext()
|
||||
{
|
||||
int expansion = RuleI(Expansion, CurrentExpansion);
|
||||
if (expansion >= Expansion::Classic && expansion <= Expansion::MaxId) {
|
||||
content_service.SetCurrentExpansion(expansion);
|
||||
}
|
||||
|
||||
LogInfo(
|
||||
"Current expansion is [{}] ({})",
|
||||
GetCurrentExpansion(),
|
||||
GetCurrentExpansionName()
|
||||
);
|
||||
}
|
||||
|
||||
std::string WorldContentService::GetCurrentExpansionName()
|
||||
{
|
||||
if (content_service.GetCurrentExpansion() == Expansion::EXPANSION_ALL) {
|
||||
return "All Expansions";
|
||||
}
|
||||
|
||||
if (current_expansion >= Expansion::Classic && current_expansion <= Expansion::MaxId) {
|
||||
return Expansion::ExpansionName[content_service.GetCurrentExpansion()];
|
||||
}
|
||||
|
||||
return "Unknown Expansion";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param current_expansion
|
||||
*/
|
||||
void WorldContentService::SetCurrentExpansion(int current_expansion)
|
||||
{
|
||||
WorldContentService::current_expansion = current_expansion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
const std::vector<std::string> &WorldContentService::GetContentFlags() const
|
||||
{
|
||||
return content_flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param content_flags
|
||||
*/
|
||||
void WorldContentService::SetContentFlags(std::vector<std::string> content_flags)
|
||||
{
|
||||
WorldContentService::content_flags = content_flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param content_flag
|
||||
* @return
|
||||
*/
|
||||
bool WorldContentService::IsContentFlagEnabled(const std::string& content_flag)
|
||||
{
|
||||
for (auto &flag : GetContentFlags()) {
|
||||
if (flag == content_flag) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void WorldContentService::ReloadContentFlags(Database &db)
|
||||
{
|
||||
std::vector<std::string> set_content_flags;
|
||||
auto content_flags = ContentFlagsRepository::GetWhere(db, "enabled = 1");
|
||||
|
||||
set_content_flags.reserve(content_flags.size());
|
||||
for (auto &flags: content_flags) {
|
||||
set_content_flags.push_back(flags.flag_name);
|
||||
}
|
||||
|
||||
LogInfo(
|
||||
"Enabled content flags [{}]",
|
||||
implode(", ", set_content_flags)
|
||||
);
|
||||
|
||||
SetContentFlags(set_content_flags);
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2019 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
* are required to give you total support for your newly bought product;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_WORLD_CONTENT_SERVICE_H
|
||||
#define EQEMU_WORLD_CONTENT_SERVICE_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class Database;
|
||||
|
||||
namespace Expansion {
|
||||
static const int EXPANSION_ALL = -1;
|
||||
static const int EXPANSION_FILTER_MAX = 99;
|
||||
|
||||
enum ExpansionNumber {
|
||||
Classic = 0,
|
||||
TheRuinsOfKunark,
|
||||
TheScarsOfVelious,
|
||||
TheShadowsOfLuclin,
|
||||
ThePlanesOfPower,
|
||||
TheLegacyOfYkesha,
|
||||
LostDungeonsOfNorrath,
|
||||
GatesOfDiscord,
|
||||
OmensOfWar,
|
||||
DragonsOfNorrath,
|
||||
DepthsOfDarkhollow,
|
||||
ProphecyOfRo,
|
||||
TheSerpentsSpine,
|
||||
TheBuriedSea,
|
||||
SecretsOfFaydwer,
|
||||
SeedsOfDestruction,
|
||||
Underfoot,
|
||||
HouseOfThule,
|
||||
VeilOfAlaris,
|
||||
RainOfFear,
|
||||
CallOfTheForsaken,
|
||||
TheDarkendSea,
|
||||
TheBrokenMirror,
|
||||
EmpiresOfKunark,
|
||||
RingOfScale,
|
||||
TheBurningLands,
|
||||
TormentOfVelious,
|
||||
MaxId
|
||||
};
|
||||
|
||||
/**
|
||||
* If you add to this, make sure you update LogCategory
|
||||
*/
|
||||
static const char *ExpansionName[ExpansionNumber::MaxId] = {
|
||||
"Classic",
|
||||
"The Ruins of Kunark",
|
||||
"The Scars of Velious",
|
||||
"The Shadows of Luclin",
|
||||
"The Planes of Power",
|
||||
"The Legacy of Ykesha",
|
||||
"Lost Dungeons of Norrath",
|
||||
"Gates of Discord",
|
||||
"Omens of War",
|
||||
"Dragons of Norrath",
|
||||
"Depths of Darkhollow",
|
||||
"Prophecy of Ro",
|
||||
"The Serpent's Spine",
|
||||
"The Buried Sea",
|
||||
"Secrets of Faydwer",
|
||||
"Seeds of Destruction",
|
||||
"Underfoot",
|
||||
"House of Thule",
|
||||
"Veil of Alaris",
|
||||
"Rain of Fear",
|
||||
"Call of the Forsaken",
|
||||
"The Darkened Sea",
|
||||
"The Broken Mirror",
|
||||
"Empires of Kunark",
|
||||
"Ring of Scale",
|
||||
"The Burning Lands",
|
||||
"Torment of Velious",
|
||||
};
|
||||
}
|
||||
|
||||
class WorldContentService {
|
||||
public:
|
||||
|
||||
WorldContentService();
|
||||
|
||||
std::string GetCurrentExpansionName();
|
||||
int GetCurrentExpansion() const;
|
||||
void SetCurrentExpansion(int current_expansion);
|
||||
|
||||
bool IsClassicEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::Classic || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
|
||||
bool IsTheRuinsOfKunarkEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheRuinsOfKunark || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
|
||||
bool IsTheScarsOfVeliousEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheScarsOfVelious || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
|
||||
bool IsTheShadowsOfLuclinEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheShadowsOfLuclin || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
|
||||
bool IsThePlanesOfPowerEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::ThePlanesOfPower || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
|
||||
bool IsTheLegacyOfYkeshaEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheLegacyOfYkesha || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
|
||||
bool IsLostDungeonsOfNorrathEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::LostDungeonsOfNorrath || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
|
||||
bool IsGatesOfDiscordEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::GatesOfDiscord || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
|
||||
bool IsOmensOfWarEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::OmensOfWar || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
|
||||
bool IsDragonsOfNorrathEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::DragonsOfNorrath || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
|
||||
bool IsDepthsOfDarkhollowEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::DepthsOfDarkhollow || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
|
||||
bool IsProphecyOfRoEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::ProphecyOfRo || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
|
||||
bool IsTheSerpentsSpineEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheSerpentsSpine || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
|
||||
bool IsTheBuriedSeaEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheBuriedSea || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
|
||||
bool IsSecretsOfFaydwerEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::SecretsOfFaydwer || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
|
||||
bool IsSeedsOfDestructionEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::SeedsOfDestruction || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
|
||||
bool IsUnderfootEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::Underfoot || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
|
||||
bool IsHouseOfThuleEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::HouseOfThule || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
|
||||
bool IsVeilOfAlarisEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::VeilOfAlaris || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
|
||||
bool IsRainOfFearEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::RainOfFear || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
|
||||
bool IsCallOfTheForsakenEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::CallOfTheForsaken || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
|
||||
bool IsTheDarkendSeaEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheDarkendSea || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
|
||||
bool IsTheBrokenMirrorEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheBrokenMirror || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
|
||||
bool IsEmpiresOfKunarkEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::EmpiresOfKunark || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
|
||||
bool IsRingOfScaleEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::RingOfScale || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
|
||||
bool IsTheBurningLandsEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheBurningLands || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
|
||||
bool IsTormentOfVeliousEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TormentOfVelious || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
|
||||
|
||||
bool IsCurrentExpansionClassic() { return current_expansion == Expansion::ExpansionNumber::Classic; }
|
||||
bool IsCurrentExpansionTheRuinsOfKunark() { return current_expansion == Expansion::ExpansionNumber::TheRuinsOfKunark; }
|
||||
bool IsCurrentExpansionTheScarsOfVelious() { return current_expansion == Expansion::ExpansionNumber::TheScarsOfVelious; }
|
||||
bool IsCurrentExpansionTheShadowsOfLuclin() { return current_expansion == Expansion::ExpansionNumber::TheShadowsOfLuclin; }
|
||||
bool IsCurrentExpansionThePlanesOfPower() { return current_expansion == Expansion::ExpansionNumber::ThePlanesOfPower; }
|
||||
bool IsCurrentExpansionTheLegacyOfYkesha() { return current_expansion == Expansion::ExpansionNumber::TheLegacyOfYkesha; }
|
||||
bool IsCurrentExpansionLostDungeonsOfNorrath() { return current_expansion == Expansion::ExpansionNumber::LostDungeonsOfNorrath; }
|
||||
bool IsCurrentExpansionGatesOfDiscord() { return current_expansion == Expansion::ExpansionNumber::GatesOfDiscord; }
|
||||
bool IsCurrentExpansionOmensOfWar() { return current_expansion == Expansion::ExpansionNumber::OmensOfWar; }
|
||||
bool IsCurrentExpansionDragonsOfNorrath() { return current_expansion == Expansion::ExpansionNumber::DragonsOfNorrath; }
|
||||
bool IsCurrentExpansionDepthsOfDarkhollow() { return current_expansion == Expansion::ExpansionNumber::DepthsOfDarkhollow; }
|
||||
bool IsCurrentExpansionProphecyOfRo() { return current_expansion == Expansion::ExpansionNumber::ProphecyOfRo; }
|
||||
bool IsCurrentExpansionTheSerpentsSpine() { return current_expansion == Expansion::ExpansionNumber::TheSerpentsSpine; }
|
||||
bool IsCurrentExpansionTheBuriedSea() { return current_expansion == Expansion::ExpansionNumber::TheBuriedSea; }
|
||||
bool IsCurrentExpansionSecretsOfFaydwer() { return current_expansion == Expansion::ExpansionNumber::SecretsOfFaydwer; }
|
||||
bool IsCurrentExpansionSeedsOfDestruction() { return current_expansion == Expansion::ExpansionNumber::SeedsOfDestruction; }
|
||||
bool IsCurrentExpansionUnderfoot() { return current_expansion == Expansion::ExpansionNumber::Underfoot; }
|
||||
bool IsCurrentExpansionHouseOfThule() { return current_expansion == Expansion::ExpansionNumber::HouseOfThule; }
|
||||
bool IsCurrentExpansionVeilOfAlaris() { return current_expansion == Expansion::ExpansionNumber::VeilOfAlaris; }
|
||||
bool IsCurrentExpansionRainOfFear() { return current_expansion == Expansion::ExpansionNumber::RainOfFear; }
|
||||
bool IsCurrentExpansionCallOfTheForsaken() { return current_expansion == Expansion::ExpansionNumber::CallOfTheForsaken; }
|
||||
bool IsCurrentExpansionTheDarkendSea() { return current_expansion == Expansion::ExpansionNumber::TheDarkendSea; }
|
||||
bool IsCurrentExpansionTheBrokenMirror() { return current_expansion == Expansion::ExpansionNumber::TheBrokenMirror; }
|
||||
bool IsCurrentExpansionEmpiresOfKunark() { return current_expansion == Expansion::ExpansionNumber::EmpiresOfKunark; }
|
||||
bool IsCurrentExpansionRingOfScale() { return current_expansion == Expansion::ExpansionNumber::RingOfScale; }
|
||||
bool IsCurrentExpansionTheBurningLands() { return current_expansion == Expansion::ExpansionNumber::TheBurningLands; }
|
||||
bool IsCurrentExpansionTormentOfVelious() { return current_expansion == Expansion::ExpansionNumber::TormentOfVelious; }
|
||||
|
||||
private:
|
||||
int current_expansion{};
|
||||
std::vector<std::string> content_flags;
|
||||
public:
|
||||
const std::vector<std::string> &GetContentFlags() const;
|
||||
bool IsContentFlagEnabled(const std::string& content_flag);
|
||||
void SetContentFlags(std::vector<std::string> content_flags);
|
||||
void ReloadContentFlags(Database &db);
|
||||
void SetExpansionContext();
|
||||
};
|
||||
|
||||
extern WorldContentService content_service;
|
||||
|
||||
#endif //EQEMU_WORLD_CONTENT_SERVICE_H
|
||||
@@ -0,0 +1,876 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <bitset>
|
||||
#include <cctype>
|
||||
#include <ctime>
|
||||
#include <iomanip>
|
||||
#include <algorithm>
|
||||
|
||||
#if __cplusplus > 201402L
|
||||
#include <string_view>
|
||||
#define CRONCPP_IS_CPP17
|
||||
#endif
|
||||
|
||||
namespace cron
|
||||
{
|
||||
#ifdef CRONCPP_IS_CPP17
|
||||
#define HAS_STRING_VIEW
|
||||
#define STRING_VIEW std::string_view
|
||||
#define STRING_VIEW_NPOS std::string_view::npos
|
||||
#define CONSTEXPTR constexpr
|
||||
#else
|
||||
#define STRING_VIEW std::string const &
|
||||
#define STRING_VIEW_NPOS std::string::npos
|
||||
#define CONSTEXPTR
|
||||
#endif
|
||||
|
||||
using cron_int = uint8_t;
|
||||
|
||||
constexpr std::time_t INVALID_TIME = static_cast<std::time_t>(-1);
|
||||
|
||||
constexpr size_t INVALID_CRON_INDEX = static_cast<size_t>(-1);
|
||||
|
||||
class cronexpr;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
enum class cron_field
|
||||
{
|
||||
second,
|
||||
minute,
|
||||
hour_of_day,
|
||||
day_of_week,
|
||||
day_of_month,
|
||||
month,
|
||||
year
|
||||
};
|
||||
|
||||
template <typename Traits>
|
||||
static bool find_next(cronexpr const & cex,
|
||||
std::tm& date,
|
||||
size_t const dot);
|
||||
}
|
||||
|
||||
struct bad_cronexpr : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
explicit bad_cronexpr(STRING_VIEW message) :
|
||||
std::runtime_error(message.data())
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
struct cron_standard_traits
|
||||
{
|
||||
static const cron_int CRON_MIN_SECONDS = 0;
|
||||
static const cron_int CRON_MAX_SECONDS = 59;
|
||||
|
||||
static const cron_int CRON_MIN_MINUTES = 0;
|
||||
static const cron_int CRON_MAX_MINUTES = 59;
|
||||
|
||||
static const cron_int CRON_MIN_HOURS = 0;
|
||||
static const cron_int CRON_MAX_HOURS = 23;
|
||||
|
||||
static const cron_int CRON_MIN_DAYS_OF_WEEK = 0;
|
||||
static const cron_int CRON_MAX_DAYS_OF_WEEK = 6;
|
||||
|
||||
static const cron_int CRON_MIN_DAYS_OF_MONTH = 1;
|
||||
static const cron_int CRON_MAX_DAYS_OF_MONTH = 31;
|
||||
|
||||
static const cron_int CRON_MIN_MONTHS = 1;
|
||||
static const cron_int CRON_MAX_MONTHS = 12;
|
||||
|
||||
static const cron_int CRON_MAX_YEARS_DIFF = 4;
|
||||
|
||||
#ifdef CRONCPP_IS_CPP17
|
||||
static const inline std::vector<std::string> DAYS = { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
|
||||
static const inline std::vector<std::string> MONTHS = { "NIL", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
|
||||
#else
|
||||
static std::vector<std::string>& DAYS()
|
||||
{
|
||||
static std::vector<std::string> days = { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
|
||||
return days;
|
||||
}
|
||||
|
||||
static std::vector<std::string>& MONTHS()
|
||||
{
|
||||
static std::vector<std::string> months = { "NIL", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
|
||||
return months;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
struct cron_oracle_traits
|
||||
{
|
||||
static const cron_int CRON_MIN_SECONDS = 0;
|
||||
static const cron_int CRON_MAX_SECONDS = 59;
|
||||
|
||||
static const cron_int CRON_MIN_MINUTES = 0;
|
||||
static const cron_int CRON_MAX_MINUTES = 59;
|
||||
|
||||
static const cron_int CRON_MIN_HOURS = 0;
|
||||
static const cron_int CRON_MAX_HOURS = 23;
|
||||
|
||||
static const cron_int CRON_MIN_DAYS_OF_WEEK = 1;
|
||||
static const cron_int CRON_MAX_DAYS_OF_WEEK = 7;
|
||||
|
||||
static const cron_int CRON_MIN_DAYS_OF_MONTH = 1;
|
||||
static const cron_int CRON_MAX_DAYS_OF_MONTH = 31;
|
||||
|
||||
static const cron_int CRON_MIN_MONTHS = 0;
|
||||
static const cron_int CRON_MAX_MONTHS = 11;
|
||||
|
||||
static const cron_int CRON_MAX_YEARS_DIFF = 4;
|
||||
|
||||
#ifdef CRONCPP_IS_CPP17
|
||||
static const inline std::vector<std::string> DAYS = { "NIL", "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
|
||||
static const inline std::vector<std::string> MONTHS = { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
|
||||
#else
|
||||
|
||||
static std::vector<std::string>& DAYS()
|
||||
{
|
||||
static std::vector<std::string> days = { "NIL", "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
|
||||
return days;
|
||||
}
|
||||
|
||||
static std::vector<std::string>& MONTHS()
|
||||
{
|
||||
static std::vector<std::string> months = { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
|
||||
return months;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
struct cron_quartz_traits
|
||||
{
|
||||
static const cron_int CRON_MIN_SECONDS = 0;
|
||||
static const cron_int CRON_MAX_SECONDS = 59;
|
||||
|
||||
static const cron_int CRON_MIN_MINUTES = 0;
|
||||
static const cron_int CRON_MAX_MINUTES = 59;
|
||||
|
||||
static const cron_int CRON_MIN_HOURS = 0;
|
||||
static const cron_int CRON_MAX_HOURS = 23;
|
||||
|
||||
static const cron_int CRON_MIN_DAYS_OF_WEEK = 1;
|
||||
static const cron_int CRON_MAX_DAYS_OF_WEEK = 7;
|
||||
|
||||
static const cron_int CRON_MIN_DAYS_OF_MONTH = 1;
|
||||
static const cron_int CRON_MAX_DAYS_OF_MONTH = 31;
|
||||
|
||||
static const cron_int CRON_MIN_MONTHS = 1;
|
||||
static const cron_int CRON_MAX_MONTHS = 12;
|
||||
|
||||
static const cron_int CRON_MAX_YEARS_DIFF = 4;
|
||||
|
||||
#ifdef CRONCPP_IS_CPP17
|
||||
static const inline std::vector<std::string> DAYS = { "NIL", "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
|
||||
static const inline std::vector<std::string> MONTHS = { "NIL", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
|
||||
#else
|
||||
static std::vector<std::string>& DAYS()
|
||||
{
|
||||
static std::vector<std::string> days = { "NIL", "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
|
||||
return days;
|
||||
}
|
||||
|
||||
static std::vector<std::string>& MONTHS()
|
||||
{
|
||||
static std::vector<std::string> months = { "NIL", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
|
||||
return months;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
class cronexpr;
|
||||
|
||||
template <typename Traits = cron_standard_traits>
|
||||
static cronexpr make_cron(STRING_VIEW expr);
|
||||
|
||||
class cronexpr
|
||||
{
|
||||
std::bitset<60> seconds;
|
||||
std::bitset<60> minutes;
|
||||
std::bitset<24> hours;
|
||||
std::bitset<7> days_of_week;
|
||||
std::bitset<31> days_of_month;
|
||||
std::bitset<12> months;
|
||||
|
||||
friend bool operator==(cronexpr const & e1, cronexpr const & e2);
|
||||
friend bool operator!=(cronexpr const & e1, cronexpr const & e2);
|
||||
|
||||
template <typename Traits>
|
||||
friend bool detail::find_next(cronexpr const & cex,
|
||||
std::tm& date,
|
||||
size_t const dot);
|
||||
|
||||
friend std::string to_string(cronexpr const & cex);
|
||||
|
||||
template <typename Traits>
|
||||
friend cronexpr make_cron(STRING_VIEW expr);
|
||||
};
|
||||
|
||||
inline bool operator==(cronexpr const & e1, cronexpr const & e2)
|
||||
{
|
||||
return
|
||||
e1.seconds == e2.seconds &&
|
||||
e1.minutes == e2.minutes &&
|
||||
e1.hours == e2.hours &&
|
||||
e1.days_of_week == e2.days_of_week &&
|
||||
e1.days_of_month == e2.days_of_month &&
|
||||
e1.months == e2.months;
|
||||
}
|
||||
|
||||
inline bool operator!=(cronexpr const & e1, cronexpr const & e2)
|
||||
{
|
||||
return !(e1 == e2);
|
||||
}
|
||||
|
||||
inline std::string to_string(cronexpr const & cex)
|
||||
{
|
||||
return
|
||||
cex.seconds.to_string() + " " +
|
||||
cex.minutes.to_string() + " " +
|
||||
cex.hours.to_string() + " " +
|
||||
cex.days_of_month.to_string() + " " +
|
||||
cex.months.to_string() + " " +
|
||||
cex.days_of_week.to_string();
|
||||
}
|
||||
|
||||
namespace utils
|
||||
{
|
||||
inline std::time_t tm_to_time(std::tm& date)
|
||||
{
|
||||
return std::mktime(&date);
|
||||
}
|
||||
|
||||
inline std::tm* time_to_tm(std::time_t const * date, std::tm* const out)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
errno_t err = localtime_s(out, date);
|
||||
return 0 == err ? out : nullptr;
|
||||
#else
|
||||
return localtime_r(date, out);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline std::tm to_tm(STRING_VIEW time)
|
||||
{
|
||||
std::istringstream str(time.data());
|
||||
str.imbue(std::locale(setlocale(LC_ALL, nullptr)));
|
||||
|
||||
std::tm result;
|
||||
str >> std::get_time(&result, "%Y-%m-%d %H:%M:%S");
|
||||
if (str.fail()) throw std::runtime_error("Parsing date failed!");
|
||||
|
||||
result.tm_isdst = -1; // DST info not available
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
inline std::string to_string(std::tm const & tm)
|
||||
{
|
||||
std::ostringstream str;
|
||||
str.imbue(std::locale(setlocale(LC_ALL, nullptr)));
|
||||
str << std::put_time(&tm, "%Y-%m-%d %H:%M:%S");
|
||||
if (str.fail()) throw std::runtime_error("Writing date failed!");
|
||||
|
||||
return str.str();
|
||||
}
|
||||
|
||||
inline std::string to_upper(std::string text)
|
||||
{
|
||||
std::transform(std::begin(text), std::end(text),
|
||||
std::begin(text), static_cast<int(*)(int)>(std::toupper));
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
static std::vector<std::string> split(STRING_VIEW text, char const delimiter)
|
||||
{
|
||||
std::vector<std::string> tokens;
|
||||
std::string token;
|
||||
std::istringstream tokenStream(text.data());
|
||||
while (std::getline(tokenStream, token, delimiter))
|
||||
{
|
||||
tokens.push_back(token);
|
||||
}
|
||||
return tokens;
|
||||
}
|
||||
|
||||
CONSTEXPTR inline bool contains(STRING_VIEW text, char const ch) noexcept
|
||||
{
|
||||
return STRING_VIEW_NPOS != text.find_first_of(ch);
|
||||
}
|
||||
}
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
inline cron_int to_cron_int(STRING_VIEW text)
|
||||
{
|
||||
try
|
||||
{
|
||||
return static_cast<cron_int>(std::stoul(text.data()));
|
||||
}
|
||||
catch (std::exception const & ex)
|
||||
{
|
||||
throw bad_cronexpr(ex.what());
|
||||
}
|
||||
}
|
||||
|
||||
static std::string replace_ordinals(
|
||||
std::string text,
|
||||
std::vector<std::string> const & replacement)
|
||||
{
|
||||
for (size_t i = 0; i < replacement.size(); ++i)
|
||||
{
|
||||
auto pos = text.find(replacement[i]);
|
||||
if (std::string::npos != pos)
|
||||
text.replace(pos, 3 ,std::to_string(i));
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
static std::pair<cron_int, cron_int> make_range(
|
||||
STRING_VIEW field,
|
||||
cron_int const minval,
|
||||
cron_int const maxval)
|
||||
{
|
||||
cron_int first = 0;
|
||||
cron_int last = 0;
|
||||
if (field.size() == 1 && field[0] == '*')
|
||||
{
|
||||
first = minval;
|
||||
last = maxval;
|
||||
}
|
||||
else if (!utils::contains(field, '-'))
|
||||
{
|
||||
first = to_cron_int(field);
|
||||
last = first;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto parts = utils::split(field, '-');
|
||||
if (parts.size() != 2)
|
||||
throw bad_cronexpr("Specified range requires two fields");
|
||||
|
||||
first = to_cron_int(parts[0]);
|
||||
last = to_cron_int(parts[1]);
|
||||
}
|
||||
|
||||
if (first > maxval || last > maxval)
|
||||
{
|
||||
throw bad_cronexpr("Specified range exceeds maximum");
|
||||
}
|
||||
if (first < minval || last < minval)
|
||||
{
|
||||
throw bad_cronexpr("Specified range is less than minimum");
|
||||
}
|
||||
if (first > last)
|
||||
{
|
||||
throw bad_cronexpr("Specified range start exceeds range end");
|
||||
}
|
||||
|
||||
return { first, last };
|
||||
}
|
||||
|
||||
template <size_t N>
|
||||
static void set_cron_field(
|
||||
STRING_VIEW value,
|
||||
std::bitset<N>& target,
|
||||
cron_int const minval,
|
||||
cron_int const maxval)
|
||||
{
|
||||
if(value.length() > 0 && value[value.length()-1] == ',')
|
||||
throw bad_cronexpr("Value cannot end with comma");
|
||||
|
||||
auto fields = utils::split(value, ',');
|
||||
if (fields.empty())
|
||||
throw bad_cronexpr("Expression parsing error");
|
||||
|
||||
for (auto const & field : fields)
|
||||
{
|
||||
if (!utils::contains(field, '/'))
|
||||
{
|
||||
#ifdef CRONCPP_IS_CPP17
|
||||
auto[first, last] = detail::make_range(field, minval, maxval);
|
||||
#else
|
||||
auto range = detail::make_range(field, minval, maxval);
|
||||
auto first = range.first;
|
||||
auto last = range.second;
|
||||
#endif
|
||||
for (cron_int i = first - minval; i <= last - minval; ++i)
|
||||
{
|
||||
target.set(i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
auto parts = utils::split(field, '/');
|
||||
if (parts.size() != 2)
|
||||
throw bad_cronexpr("Incrementer must have two fields");
|
||||
|
||||
#ifdef CRONCPP_IS_CPP17
|
||||
auto[first, last] = detail::make_range(parts[0], minval, maxval);
|
||||
#else
|
||||
auto range = detail::make_range(parts[0], minval, maxval);
|
||||
auto first = range.first;
|
||||
auto last = range.second;
|
||||
#endif
|
||||
|
||||
if (!utils::contains(parts[0], '-'))
|
||||
{
|
||||
last = maxval;
|
||||
}
|
||||
|
||||
auto delta = detail::to_cron_int(parts[1]);
|
||||
if(delta <= 0)
|
||||
throw bad_cronexpr("Incrementer must be a positive value");
|
||||
|
||||
for (cron_int i = first - minval; i <= last - minval; i += delta)
|
||||
{
|
||||
target.set(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Traits>
|
||||
static void set_cron_days_of_week(
|
||||
std::string value,
|
||||
std::bitset<7>& target)
|
||||
{
|
||||
auto days = utils::to_upper(value);
|
||||
auto days_replaced = detail::replace_ordinals(
|
||||
days,
|
||||
#ifdef CRONCPP_IS_CPP17
|
||||
Traits::DAYS
|
||||
#else
|
||||
Traits::DAYS()
|
||||
#endif
|
||||
);
|
||||
|
||||
if (days_replaced.size() == 1 && days_replaced[0] == '?')
|
||||
days_replaced[0] = '*';
|
||||
|
||||
set_cron_field(
|
||||
days_replaced,
|
||||
target,
|
||||
Traits::CRON_MIN_DAYS_OF_WEEK,
|
||||
Traits::CRON_MAX_DAYS_OF_WEEK);
|
||||
}
|
||||
|
||||
template <typename Traits>
|
||||
static void set_cron_days_of_month(
|
||||
std::string value,
|
||||
std::bitset<31>& target)
|
||||
{
|
||||
if (value.size() == 1 && value[0] == '?')
|
||||
value[0] = '*';
|
||||
|
||||
set_cron_field(
|
||||
value,
|
||||
target,
|
||||
Traits::CRON_MIN_DAYS_OF_MONTH,
|
||||
Traits::CRON_MAX_DAYS_OF_MONTH);
|
||||
}
|
||||
|
||||
template <typename Traits>
|
||||
static void set_cron_month(
|
||||
std::string value,
|
||||
std::bitset<12>& target)
|
||||
{
|
||||
auto month = utils::to_upper(value);
|
||||
auto month_replaced = replace_ordinals(
|
||||
month,
|
||||
#ifdef CRONCPP_IS_CPP17
|
||||
Traits::MONTHS
|
||||
#else
|
||||
Traits::MONTHS()
|
||||
#endif
|
||||
);
|
||||
|
||||
set_cron_field(
|
||||
month_replaced,
|
||||
target,
|
||||
Traits::CRON_MIN_MONTHS,
|
||||
Traits::CRON_MAX_MONTHS);
|
||||
}
|
||||
|
||||
template <size_t N>
|
||||
inline size_t next_set_bit(
|
||||
std::bitset<N> const & target,
|
||||
size_t /*minimum*/,
|
||||
size_t /*maximum*/,
|
||||
size_t offset)
|
||||
{
|
||||
for (auto i = offset; i < N; ++i)
|
||||
{
|
||||
if (target.test(i)) return i;
|
||||
}
|
||||
|
||||
return INVALID_CRON_INDEX;
|
||||
}
|
||||
|
||||
inline void add_to_field(
|
||||
std::tm& date,
|
||||
cron_field const field,
|
||||
int const val)
|
||||
{
|
||||
switch (field)
|
||||
{
|
||||
case cron_field::second:
|
||||
date.tm_sec += val;
|
||||
break;
|
||||
case cron_field::minute:
|
||||
date.tm_min += val;
|
||||
break;
|
||||
case cron_field::hour_of_day:
|
||||
date.tm_hour += val;
|
||||
break;
|
||||
case cron_field::day_of_week:
|
||||
case cron_field::day_of_month:
|
||||
date.tm_mday += val;
|
||||
break;
|
||||
case cron_field::month:
|
||||
date.tm_mon += val;
|
||||
break;
|
||||
case cron_field::year:
|
||||
date.tm_year += val;
|
||||
break;
|
||||
}
|
||||
|
||||
if (INVALID_TIME == utils::tm_to_time(date))
|
||||
throw bad_cronexpr("Invalid time expression");
|
||||
}
|
||||
|
||||
inline void set_field(
|
||||
std::tm& date,
|
||||
cron_field const field,
|
||||
int const val)
|
||||
{
|
||||
switch (field)
|
||||
{
|
||||
case cron_field::second:
|
||||
date.tm_sec = val;
|
||||
break;
|
||||
case cron_field::minute:
|
||||
date.tm_min = val;
|
||||
break;
|
||||
case cron_field::hour_of_day:
|
||||
date.tm_hour = val;
|
||||
break;
|
||||
case cron_field::day_of_week:
|
||||
date.tm_wday = val;
|
||||
break;
|
||||
case cron_field::day_of_month:
|
||||
date.tm_mday = val;
|
||||
break;
|
||||
case cron_field::month:
|
||||
date.tm_mon = val;
|
||||
break;
|
||||
case cron_field::year:
|
||||
date.tm_year = val;
|
||||
break;
|
||||
}
|
||||
|
||||
if (INVALID_TIME == utils::tm_to_time(date))
|
||||
throw bad_cronexpr("Invalid time expression");
|
||||
}
|
||||
|
||||
inline void reset_field(
|
||||
std::tm& date,
|
||||
cron_field const field)
|
||||
{
|
||||
switch (field)
|
||||
{
|
||||
case cron_field::second:
|
||||
date.tm_sec = 0;
|
||||
break;
|
||||
case cron_field::minute:
|
||||
date.tm_min = 0;
|
||||
break;
|
||||
case cron_field::hour_of_day:
|
||||
date.tm_hour = 0;
|
||||
break;
|
||||
case cron_field::day_of_week:
|
||||
date.tm_wday = 0;
|
||||
break;
|
||||
case cron_field::day_of_month:
|
||||
date.tm_mday = 1;
|
||||
break;
|
||||
case cron_field::month:
|
||||
date.tm_mon = 0;
|
||||
break;
|
||||
case cron_field::year:
|
||||
date.tm_year = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (INVALID_TIME == utils::tm_to_time(date))
|
||||
throw bad_cronexpr("Invalid time expression");
|
||||
}
|
||||
|
||||
inline void reset_all_fields(
|
||||
std::tm& date,
|
||||
std::bitset<7> const & marked_fields)
|
||||
{
|
||||
for (size_t i = 0; i < marked_fields.size(); ++i)
|
||||
{
|
||||
if (marked_fields.test(i))
|
||||
reset_field(date, static_cast<cron_field>(i));
|
||||
}
|
||||
}
|
||||
|
||||
inline void mark_field(
|
||||
std::bitset<7> & orders,
|
||||
cron_field const field)
|
||||
{
|
||||
if (!orders.test(static_cast<size_t>(field)))
|
||||
orders.set(static_cast<size_t>(field));
|
||||
}
|
||||
|
||||
template <size_t N>
|
||||
static size_t find_next(
|
||||
std::bitset<N> const & target,
|
||||
std::tm& date,
|
||||
unsigned int const minimum,
|
||||
unsigned int const maximum,
|
||||
unsigned int const value,
|
||||
cron_field const field,
|
||||
cron_field const next_field,
|
||||
std::bitset<7> const & marked_fields)
|
||||
{
|
||||
auto next_value = next_set_bit(target, minimum, maximum, value);
|
||||
if (INVALID_CRON_INDEX == next_value)
|
||||
{
|
||||
add_to_field(date, next_field, 1);
|
||||
reset_field(date, field);
|
||||
next_value = next_set_bit(target, minimum, maximum, 0);
|
||||
}
|
||||
|
||||
if (INVALID_CRON_INDEX == next_value || next_value != value)
|
||||
{
|
||||
set_field(date, field, static_cast<int>(next_value));
|
||||
reset_all_fields(date, marked_fields);
|
||||
}
|
||||
|
||||
return next_value;
|
||||
}
|
||||
|
||||
template <typename Traits>
|
||||
static size_t find_next_day(
|
||||
std::tm& date,
|
||||
std::bitset<31> const & days_of_month,
|
||||
size_t day_of_month,
|
||||
std::bitset<7> const & days_of_week,
|
||||
size_t day_of_week,
|
||||
std::bitset<7> const & marked_fields)
|
||||
{
|
||||
unsigned int count = 0;
|
||||
unsigned int maximum = 366;
|
||||
while (
|
||||
(!days_of_month.test(day_of_month - Traits::CRON_MIN_DAYS_OF_MONTH) ||
|
||||
!days_of_week.test(day_of_week - Traits::CRON_MIN_DAYS_OF_WEEK))
|
||||
&& count++ < maximum)
|
||||
{
|
||||
add_to_field(date, cron_field::day_of_month, 1);
|
||||
|
||||
day_of_month = date.tm_mday;
|
||||
day_of_week = date.tm_wday;
|
||||
|
||||
reset_all_fields(date, marked_fields);
|
||||
}
|
||||
|
||||
return day_of_month;
|
||||
}
|
||||
|
||||
template <typename Traits>
|
||||
static bool find_next(cronexpr const & cex,
|
||||
std::tm& date,
|
||||
size_t const dot)
|
||||
{
|
||||
bool res = true;
|
||||
|
||||
std::bitset<7> marked_fields{ 0 };
|
||||
std::bitset<7> empty_list{ 0 };
|
||||
|
||||
unsigned int second = date.tm_sec;
|
||||
auto updated_second = find_next(
|
||||
cex.seconds,
|
||||
date,
|
||||
Traits::CRON_MIN_SECONDS,
|
||||
Traits::CRON_MAX_SECONDS,
|
||||
second,
|
||||
cron_field::second,
|
||||
cron_field::minute,
|
||||
empty_list);
|
||||
|
||||
if (second == updated_second)
|
||||
{
|
||||
mark_field(marked_fields, cron_field::second);
|
||||
}
|
||||
|
||||
unsigned int minute = date.tm_min;
|
||||
auto update_minute = find_next(
|
||||
cex.minutes,
|
||||
date,
|
||||
Traits::CRON_MIN_MINUTES,
|
||||
Traits::CRON_MAX_MINUTES,
|
||||
minute,
|
||||
cron_field::minute,
|
||||
cron_field::hour_of_day,
|
||||
marked_fields);
|
||||
if (minute == update_minute)
|
||||
{
|
||||
mark_field(marked_fields, cron_field::minute);
|
||||
}
|
||||
else
|
||||
{
|
||||
res = find_next<Traits>(cex, date, dot);
|
||||
if (!res) return res;
|
||||
}
|
||||
|
||||
unsigned int hour = date.tm_hour;
|
||||
auto updated_hour = find_next(
|
||||
cex.hours,
|
||||
date,
|
||||
Traits::CRON_MIN_HOURS,
|
||||
Traits::CRON_MAX_HOURS,
|
||||
hour,
|
||||
cron_field::hour_of_day,
|
||||
cron_field::day_of_week,
|
||||
marked_fields);
|
||||
if (hour == updated_hour)
|
||||
{
|
||||
mark_field(marked_fields, cron_field::hour_of_day);
|
||||
}
|
||||
else
|
||||
{
|
||||
res = find_next<Traits>(cex, date, dot);
|
||||
if (!res) return res;
|
||||
}
|
||||
|
||||
unsigned int day_of_week = date.tm_wday;
|
||||
unsigned int day_of_month = date.tm_mday;
|
||||
auto updated_day_of_month = find_next_day<Traits>(
|
||||
date,
|
||||
cex.days_of_month,
|
||||
day_of_month,
|
||||
cex.days_of_week,
|
||||
day_of_week,
|
||||
marked_fields);
|
||||
if (day_of_month == updated_day_of_month)
|
||||
{
|
||||
mark_field(marked_fields, cron_field::day_of_month);
|
||||
}
|
||||
else
|
||||
{
|
||||
res = find_next<Traits>(cex, date, dot);
|
||||
if (!res) return res;
|
||||
}
|
||||
|
||||
unsigned int month = date.tm_mon;
|
||||
auto updated_month = find_next(
|
||||
cex.months,
|
||||
date,
|
||||
Traits::CRON_MIN_MONTHS,
|
||||
Traits::CRON_MAX_MONTHS,
|
||||
month,
|
||||
cron_field::month,
|
||||
cron_field::year,
|
||||
marked_fields);
|
||||
if (month != updated_month)
|
||||
{
|
||||
if (date.tm_year - dot > Traits::CRON_MAX_YEARS_DIFF)
|
||||
return false;
|
||||
|
||||
res = find_next<Traits>(cex, date, dot);
|
||||
if (!res) return res;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Traits>
|
||||
static cronexpr make_cron(STRING_VIEW expr)
|
||||
{
|
||||
cronexpr cex;
|
||||
|
||||
if (expr.empty())
|
||||
throw bad_cronexpr("Invalid empty cron expression");
|
||||
|
||||
auto fields = utils::split(expr, ' ');
|
||||
fields.erase(
|
||||
std::remove_if(std::begin(fields), std::end(fields),
|
||||
[](STRING_VIEW s) {return s.empty(); }),
|
||||
std::end(fields));
|
||||
if (fields.size() != 6)
|
||||
throw bad_cronexpr("cron expression must have six fields");
|
||||
|
||||
detail::set_cron_field(fields[0], cex.seconds, Traits::CRON_MIN_SECONDS, Traits::CRON_MAX_SECONDS);
|
||||
detail::set_cron_field(fields[1], cex.minutes, Traits::CRON_MIN_MINUTES, Traits::CRON_MAX_MINUTES);
|
||||
detail::set_cron_field(fields[2], cex.hours, Traits::CRON_MIN_HOURS, Traits::CRON_MAX_HOURS);
|
||||
|
||||
detail::set_cron_days_of_week<Traits>(fields[5], cex.days_of_week);
|
||||
|
||||
detail::set_cron_days_of_month<Traits>(fields[3], cex.days_of_month);
|
||||
|
||||
detail::set_cron_month<Traits>(fields[4], cex.months);
|
||||
|
||||
return cex;
|
||||
}
|
||||
|
||||
template <typename Traits = cron_standard_traits>
|
||||
static std::tm cron_next(cronexpr const & cex, std::tm date)
|
||||
{
|
||||
time_t original = utils::tm_to_time(date);
|
||||
if (INVALID_TIME == original) return {};
|
||||
|
||||
if (!detail::find_next<Traits>(cex, date, date.tm_year))
|
||||
return {};
|
||||
|
||||
time_t calculated = utils::tm_to_time(date);
|
||||
if (INVALID_TIME == calculated) return {};
|
||||
|
||||
if (calculated == original)
|
||||
{
|
||||
add_to_field(date, detail::cron_field::second, 1);
|
||||
if (!detail::find_next<Traits>(cex, date, date.tm_year))
|
||||
return {};
|
||||
}
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
template <typename Traits = cron_standard_traits>
|
||||
static std::time_t cron_next(cronexpr const & cex, std::time_t const & date)
|
||||
{
|
||||
std::tm val;
|
||||
std::tm* dt = utils::time_to_tm(&date, &val);
|
||||
if (dt == nullptr) return INVALID_TIME;
|
||||
|
||||
time_t original = utils::tm_to_time(*dt);
|
||||
if (INVALID_TIME == original) return INVALID_TIME;
|
||||
|
||||
if(!detail::find_next<Traits>(cex, *dt, dt->tm_year))
|
||||
return INVALID_TIME;
|
||||
|
||||
time_t calculated = utils::tm_to_time(*dt);
|
||||
if (INVALID_TIME == calculated) return calculated;
|
||||
|
||||
if (calculated == original)
|
||||
{
|
||||
add_to_field(*dt, detail::cron_field::second, 1);
|
||||
if(!detail::find_next<Traits>(cex, *dt, dt->tm_year))
|
||||
return INVALID_TIME;
|
||||
}
|
||||
|
||||
return utils::tm_to_time(*dt);
|
||||
}
|
||||
}
|
||||
+319
-228
@@ -61,15 +61,15 @@ Database::Database(const char* host, const char* user, const char* passwd, const
|
||||
Connect(host, user, passwd, database, port);
|
||||
}
|
||||
|
||||
bool Database::Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port) {
|
||||
bool Database::Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port, std::string connection_label) {
|
||||
uint32 errnum= 0;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
if (!Open(host, user, passwd, database, port, &errnum, errbuf)) {
|
||||
LogError("Failed to connect to database: Error: {}", errbuf);
|
||||
LogError("[MySQL] Connection [{}] Failed to connect to database: Error [{}]", connection_label, errbuf);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
LogInfo("Using database [{}] at [{}]:[{}]", database, host,port);
|
||||
LogInfo("[MySQL] Connection [{}] database [{}] at [{}]:[{}]", connection_label, database, host,port);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -339,7 +339,7 @@ bool Database::ReserveName(uint32 account_id, char* name) {
|
||||
query = StringFormat("INSERT INTO `character_data` SET `account_id` = %i, `name` = '%s'", account_id, name);
|
||||
results = QueryDatabase(query);
|
||||
if (!results.Success() || results.ErrorMessage() != ""){ return false; }
|
||||
|
||||
|
||||
// Put character into the default guild if rule is being used.
|
||||
int guild_id = RuleI(Character, DefaultGuild);
|
||||
|
||||
@@ -353,7 +353,7 @@ bool Database::ReserveName(uint32 account_id, char* name) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -512,96 +512,96 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
|
||||
"guild_auto_consent,"
|
||||
"RestTimer) "
|
||||
"VALUES ("
|
||||
"%u," // id
|
||||
"%u," // account_id
|
||||
"'%s'," // `name`
|
||||
"'%s'," // last_name
|
||||
"%u," // gender
|
||||
"%u," // race
|
||||
"%u," // class
|
||||
"%u," // `level`
|
||||
"%u," // deity
|
||||
"%u," // birthday
|
||||
"%u," // last_login
|
||||
"%u," // time_played
|
||||
"%u," // pvp_status
|
||||
"%u," // level2
|
||||
"%u," // anon
|
||||
"%u," // gm
|
||||
"%u," // intoxication
|
||||
"%u," // hair_color
|
||||
"%u," // beard_color
|
||||
"%u," // eye_color_1
|
||||
"%u," // eye_color_2
|
||||
"%u," // hair_style
|
||||
"%u," // beard
|
||||
"%u," // ability_time_seconds
|
||||
"%u," // ability_number
|
||||
"%u," // ability_time_minutes
|
||||
"%u," // ability_time_hours
|
||||
"'%s'," // title
|
||||
"'%s'," // suffix
|
||||
"%u," // exp
|
||||
"%u," // points
|
||||
"%u," // mana
|
||||
"%u," // cur_hp
|
||||
"%u," // str
|
||||
"%u," // sta
|
||||
"%u," // cha
|
||||
"%u," // dex
|
||||
"%u," // `int`
|
||||
"%u," // agi
|
||||
"%u," // wis
|
||||
"%u," // face
|
||||
"%f," // y
|
||||
"%f," // x
|
||||
"%f," // z
|
||||
"%f," // heading
|
||||
"%u," // pvp2
|
||||
"%u," // pvp_type
|
||||
"%u," // autosplit_enabled
|
||||
"%u," // zone_change_count
|
||||
"%u," // drakkin_heritage
|
||||
"%u," // drakkin_tattoo
|
||||
"%u," // drakkin_details
|
||||
"%i," // toxicity
|
||||
"%i," // hunger_level
|
||||
"%i," // thirst_level
|
||||
"%u," // ability_up
|
||||
"%u," // zone_id
|
||||
"%u," // zone_instance
|
||||
"%u," // leadership_exp_on
|
||||
"%u," // ldon_points_guk
|
||||
"%u," // ldon_points_mir
|
||||
"%u," // ldon_points_mmc
|
||||
"%u," // ldon_points_ruj
|
||||
"%u," // ldon_points_tak
|
||||
"%u," // ldon_points_available
|
||||
"%u," // id
|
||||
"%u," // account_id
|
||||
"'%s'," // `name`
|
||||
"'%s'," // last_name
|
||||
"%u," // gender
|
||||
"%u," // race
|
||||
"%u," // class
|
||||
"%u," // `level`
|
||||
"%u," // deity
|
||||
"%u," // birthday
|
||||
"%u," // last_login
|
||||
"%u," // time_played
|
||||
"%u," // pvp_status
|
||||
"%u," // level2
|
||||
"%u," // anon
|
||||
"%u," // gm
|
||||
"%u," // intoxication
|
||||
"%u," // hair_color
|
||||
"%u," // beard_color
|
||||
"%u," // eye_color_1
|
||||
"%u," // eye_color_2
|
||||
"%u," // hair_style
|
||||
"%u," // beard
|
||||
"%u," // ability_time_seconds
|
||||
"%u," // ability_number
|
||||
"%u," // ability_time_minutes
|
||||
"%u," // ability_time_hours
|
||||
"'%s'," // title
|
||||
"'%s'," // suffix
|
||||
"%u," // exp
|
||||
"%u," // points
|
||||
"%u," // mana
|
||||
"%u," // cur_hp
|
||||
"%u," // str
|
||||
"%u," // sta
|
||||
"%u," // cha
|
||||
"%u," // dex
|
||||
"%u," // `int`
|
||||
"%u," // agi
|
||||
"%u," // wis
|
||||
"%u," // face
|
||||
"%f," // y
|
||||
"%f," // x
|
||||
"%f," // z
|
||||
"%f," // heading
|
||||
"%u," // pvp2
|
||||
"%u," // pvp_type
|
||||
"%u," // autosplit_enabled
|
||||
"%u," // zone_change_count
|
||||
"%u," // drakkin_heritage
|
||||
"%u," // drakkin_tattoo
|
||||
"%u," // drakkin_details
|
||||
"%i," // toxicity
|
||||
"%i," // hunger_level
|
||||
"%i," // thirst_level
|
||||
"%u," // ability_up
|
||||
"%u," // zone_id
|
||||
"%u," // zone_instance
|
||||
"%u," // leadership_exp_on
|
||||
"%u," // ldon_points_guk
|
||||
"%u," // ldon_points_mir
|
||||
"%u," // ldon_points_mmc
|
||||
"%u," // ldon_points_ruj
|
||||
"%u," // ldon_points_tak
|
||||
"%u," // ldon_points_available
|
||||
"%u," // tribute_time_remaining
|
||||
"%u," // show_helm
|
||||
"%u," // career_tribute_points
|
||||
"%u," // tribute_points
|
||||
"%u," // tribute_active
|
||||
"%u," // endurance
|
||||
"%u," // group_leadership_exp
|
||||
"%u," // raid_leadership_exp
|
||||
"%u," // show_helm
|
||||
"%u," // career_tribute_points
|
||||
"%u," // tribute_points
|
||||
"%u," // tribute_active
|
||||
"%u," // endurance
|
||||
"%u," // group_leadership_exp
|
||||
"%u," // raid_leadership_exp
|
||||
"%u," // group_leadership_point
|
||||
"%u," // raid_leadership_points
|
||||
"%u," // air_remaining
|
||||
"%u," // pvp_kills
|
||||
"%u," // pvp_deaths
|
||||
"%u," // pvp_current_points
|
||||
"%u," // pvp_career_points
|
||||
"%u," // pvp_best_kill_streak
|
||||
"%u," // air_remaining
|
||||
"%u," // pvp_kills
|
||||
"%u," // pvp_deaths
|
||||
"%u," // pvp_current_points
|
||||
"%u," // pvp_career_points
|
||||
"%u," // pvp_best_kill_streak
|
||||
"%u," // pvp_worst_death_streak
|
||||
"%u," // pvp_current_kill_strea
|
||||
"%u," // aa_points_spent
|
||||
"%u," // aa_exp
|
||||
"%u," // aa_points
|
||||
"%u," // group_auto_consent
|
||||
"%u," // raid_auto_consent
|
||||
"%u," // guild_auto_consent
|
||||
"%u" // RestTimer
|
||||
"%u," // aa_points_spent
|
||||
"%u," // aa_exp
|
||||
"%u," // aa_points
|
||||
"%u," // group_auto_consent
|
||||
"%u," // raid_auto_consent
|
||||
"%u," // guild_auto_consent
|
||||
"%u" // RestTimer
|
||||
")",
|
||||
character_id, // " id, "
|
||||
account_id, // " account_id, "
|
||||
@@ -703,11 +703,11 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
|
||||
"(%u, %u, %u, %f, %f, %f, %f, %i), "
|
||||
"(%u, %u, %u, %f, %f, %f, %f, %i), "
|
||||
"(%u, %u, %u, %f, %f, %f, %f, %i)",
|
||||
character_id, pp->binds[0].zoneId, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading, 0,
|
||||
character_id, pp->binds[1].zoneId, 0, pp->binds[1].x, pp->binds[1].y, pp->binds[1].z, pp->binds[1].heading, 1,
|
||||
character_id, pp->binds[2].zoneId, 0, pp->binds[2].x, pp->binds[2].y, pp->binds[2].z, pp->binds[2].heading, 2,
|
||||
character_id, pp->binds[3].zoneId, 0, pp->binds[3].x, pp->binds[3].y, pp->binds[3].z, pp->binds[3].heading, 3,
|
||||
character_id, pp->binds[4].zoneId, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading, 4
|
||||
character_id, pp->binds[0].zone_id, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading, 0,
|
||||
character_id, pp->binds[1].zone_id, 0, pp->binds[1].x, pp->binds[1].y, pp->binds[1].z, pp->binds[1].heading, 1,
|
||||
character_id, pp->binds[2].zone_id, 0, pp->binds[2].x, pp->binds[2].y, pp->binds[2].z, pp->binds[2].heading, 2,
|
||||
character_id, pp->binds[3].zone_id, 0, pp->binds[3].x, pp->binds[3].y, pp->binds[3].z, pp->binds[3].heading, 3,
|
||||
character_id, pp->binds[4].zone_id, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading, 4
|
||||
); results = QueryDatabase(query);
|
||||
|
||||
/* HoTT Ability */
|
||||
@@ -750,61 +750,6 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
|
||||
return true;
|
||||
}
|
||||
|
||||
/* This only for new Character creation storing */
|
||||
bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, EQ::InventoryProfile* inv) {
|
||||
uint32 charid = 0;
|
||||
char zone[50];
|
||||
float x, y, z;
|
||||
charid = GetCharacterID(pp->name);
|
||||
|
||||
if(!charid) {
|
||||
LogError("StoreCharacter: no character id");
|
||||
return false;
|
||||
}
|
||||
|
||||
const char *zname = GetZoneName(pp->zone_id);
|
||||
if(zname == nullptr) {
|
||||
/* Zone not in the DB, something to prevent crash... */
|
||||
strn0cpy(zone, "qeynos", 49);
|
||||
pp->zone_id = 1;
|
||||
}
|
||||
else{ strn0cpy(zone, zname, 49); }
|
||||
|
||||
x = pp->x;
|
||||
y = pp->y;
|
||||
z = pp->z;
|
||||
|
||||
/* Saves Player Profile Data */
|
||||
SaveCharacterCreate(charid, account_id, pp);
|
||||
|
||||
/* Insert starting inventory... */
|
||||
std::string invquery;
|
||||
for (int16 i = EQ::invslot::EQUIPMENT_BEGIN; i <= EQ::invbag::BANK_BAGS_END;) {
|
||||
const EQ::ItemInstance* newinv = inv->GetItem(i);
|
||||
if (newinv) {
|
||||
invquery = StringFormat("INSERT INTO `inventory` (charid, slotid, itemid, charges, color) VALUES (%u, %i, %u, %i, %u)",
|
||||
charid, i, newinv->GetItem()->ID, newinv->GetCharges(), newinv->GetColor());
|
||||
|
||||
auto results = QueryDatabase(invquery);
|
||||
}
|
||||
|
||||
if (i == EQ::invslot::slotCursor) {
|
||||
i = EQ::invbag::GENERAL_BAGS_BEGIN;
|
||||
continue;
|
||||
}
|
||||
else if (i == EQ::invbag::CURSOR_BAG_END) {
|
||||
i = EQ::invslot::BANK_BEGIN;
|
||||
continue;
|
||||
}
|
||||
else if (i == EQ::invslot::BANK_END) {
|
||||
i = EQ::invbag::BANK_BAGS_BEGIN;
|
||||
continue;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32 Database::GetCharacterID(const char *name) {
|
||||
std::string query = StringFormat("SELECT `id` FROM `character_data` WHERE `name` = '%s'", name);
|
||||
auto results = QueryDatabase(query);
|
||||
@@ -925,36 +870,40 @@ void Database::GetCharName(uint32 char_id, char* name) {
|
||||
}
|
||||
}
|
||||
|
||||
const char* Database::GetCharNameByID(uint32 char_id) {
|
||||
std::string Database::GetCharNameByID(uint32 char_id) {
|
||||
std::string query = fmt::format("SELECT `name` FROM `character_data` WHERE id = {}", char_id);
|
||||
auto results = QueryDatabase(query);
|
||||
std::string res;
|
||||
|
||||
if (!results.Success()) {
|
||||
return "";
|
||||
return res;
|
||||
}
|
||||
|
||||
if (results.RowCount() == 0) {
|
||||
return "";
|
||||
return res;
|
||||
}
|
||||
|
||||
auto row = results.begin();
|
||||
return row[0];
|
||||
res = row[0];
|
||||
return res;
|
||||
}
|
||||
|
||||
const char* Database::GetNPCNameByID(uint32 npc_id) {
|
||||
std::string Database::GetNPCNameByID(uint32 npc_id) {
|
||||
std::string query = fmt::format("SELECT `name` FROM `npc_types` WHERE id = {}", npc_id);
|
||||
auto results = QueryDatabase(query);
|
||||
std::string res;
|
||||
|
||||
if (!results.Success()) {
|
||||
return "";
|
||||
return res;
|
||||
}
|
||||
|
||||
if (results.RowCount() == 0) {
|
||||
return "";
|
||||
return res;
|
||||
}
|
||||
|
||||
auto row = results.begin();
|
||||
return row[0];
|
||||
res = row[0];
|
||||
return res;
|
||||
}
|
||||
|
||||
bool Database::LoadVariables() {
|
||||
@@ -1026,10 +975,24 @@ bool Database::SetVariable(const std::string varname, const std::string &varvalu
|
||||
}
|
||||
|
||||
// Get zone starting points from DB
|
||||
bool Database::GetSafePoints(const char* short_name, uint32 version, float* safe_x, float* safe_y, float* safe_z, int16* minstatus, uint8* minlevel, char *flag_needed) {
|
||||
bool Database::GetSafePoints(const char* zone_short_name, uint32 instance_version, float* safe_x, float* safe_y, float* safe_z, float* safe_heading, int16* min_status, uint8* min_level, char *flag_needed) {
|
||||
|
||||
std::string query = StringFormat("SELECT safe_x, safe_y, safe_z, min_status, min_level, flag_needed FROM zone "
|
||||
" WHERE short_name='%s' AND (version=%i OR version=0) ORDER BY version DESC", short_name, version);
|
||||
if (zone_short_name == nullptr)
|
||||
return false;
|
||||
|
||||
std::string query = fmt::format(
|
||||
SQL(
|
||||
SELECT
|
||||
`safe_x`, `safe_y`, `safe_z`, `safe_heading`, `min_status`, `min_level`, `flag_needed`
|
||||
FROM
|
||||
zone
|
||||
WHERE
|
||||
`short_name` = '{}'
|
||||
AND
|
||||
(`version` = {} OR `version` = 0)
|
||||
ORDER BY `version` DESC
|
||||
), zone_short_name, instance_version
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
@@ -1042,16 +1005,24 @@ bool Database::GetSafePoints(const char* short_name, uint32 version, float* safe
|
||||
|
||||
if (safe_x != nullptr)
|
||||
*safe_x = atof(row[0]);
|
||||
|
||||
if (safe_y != nullptr)
|
||||
*safe_y = atof(row[1]);
|
||||
|
||||
if (safe_z != nullptr)
|
||||
*safe_z = atof(row[2]);
|
||||
if (minstatus != nullptr)
|
||||
*minstatus = atoi(row[3]);
|
||||
if (minlevel != nullptr)
|
||||
*minlevel = atoi(row[4]);
|
||||
|
||||
if (safe_heading != nullptr)
|
||||
*safe_heading = atof(row[3]);
|
||||
|
||||
if (min_status != nullptr)
|
||||
*min_status = atoi(row[4]);
|
||||
|
||||
if (min_level != nullptr)
|
||||
*min_level = atoi(row[5]);
|
||||
|
||||
if (flag_needed != nullptr)
|
||||
strcpy(flag_needed, row[5]);
|
||||
strcpy(flag_needed, row[6]);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1137,50 +1108,6 @@ bool Database::GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zon
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Database::LoadZoneNames() {
|
||||
std::string query("SELECT zoneidnumber, short_name FROM zone");
|
||||
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (auto row= results.begin();row != results.end();++row)
|
||||
{
|
||||
uint32 zoneid = atoi(row[0]);
|
||||
std::string zonename = row[1];
|
||||
zonename_array.insert(std::pair<uint32,std::string>(zoneid,zonename));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32 Database::GetZoneID(const char* zonename) {
|
||||
|
||||
if (zonename == nullptr)
|
||||
return 0;
|
||||
|
||||
for (auto iter = zonename_array.begin(); iter != zonename_array.end(); ++iter)
|
||||
if (strcasecmp(iter->second.c_str(), zonename) == 0)
|
||||
return iter->first;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* Database::GetZoneName(uint32 zoneID, bool ErrorUnknown) {
|
||||
auto iter = zonename_array.find(zoneID);
|
||||
|
||||
if (iter != zonename_array.end())
|
||||
return iter->second.c_str();
|
||||
|
||||
if (ErrorUnknown)
|
||||
return "UNKNOWN";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8 Database::GetPEQZone(uint32 zoneID, uint32 version){
|
||||
|
||||
std::string query = StringFormat("SELECT peqzone from zone where zoneidnumber='%i' AND (version=%i OR version=0) ORDER BY version DESC", zoneID, version);
|
||||
@@ -1397,29 +1324,31 @@ uint8 Database::GetServerType() {
|
||||
return atoi(row[0]);
|
||||
}
|
||||
|
||||
bool Database::MoveCharacterToZone(const char* charname, const char* zonename, uint32 zoneid) {
|
||||
if(zonename == nullptr || strlen(zonename) == 0)
|
||||
return false;
|
||||
bool Database::MoveCharacterToZone(uint32 character_id, uint32 zone_id)
|
||||
{
|
||||
std::string query = StringFormat(
|
||||
"UPDATE `character_data` SET `zone_id` = %i, `x` = -1, `y` = -1, `z` = -1 WHERE `id` = %i",
|
||||
zone_id,
|
||||
character_id
|
||||
);
|
||||
|
||||
std::string query = StringFormat("UPDATE `character_data` SET `zone_id` = %i, `x` = -1, `y` = -1, `z` = -1 WHERE `name` = '%s'", zoneid, charname);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (results.RowsAffected() == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return results.RowsAffected() != 0;
|
||||
}
|
||||
|
||||
bool Database::MoveCharacterToZone(const char* charname, const char* zonename) {
|
||||
return MoveCharacterToZone(charname, zonename, GetZoneID(zonename));
|
||||
}
|
||||
bool Database::MoveCharacterToZone(const char *charname, uint32 zone_id)
|
||||
{
|
||||
std::string query = StringFormat(
|
||||
"UPDATE `character_data` SET `zone_id` = %i, `x` = -1, `y` = -1, `z` = -1 WHERE `name` = '%s'",
|
||||
zone_id,
|
||||
charname
|
||||
);
|
||||
|
||||
bool Database::MoveCharacterToZone(uint32 iCharID, const char* iZonename) {
|
||||
std::string query = StringFormat("UPDATE `character_data` SET `zone_id` = %i, `x` = -1, `y` = -1, `z` = -1 WHERE `id` = %i", GetZoneID(iZonename), iCharID);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success()) {
|
||||
@@ -1453,6 +1382,20 @@ bool Database::SetMQDetectionFlag(const char* accountname, const char* character
|
||||
return results.RowsAffected() != 0;
|
||||
}
|
||||
|
||||
bool Database::SetMQDetectionFlag(const char* accountname, const char* charactername, const std::string &hacked, const char* zone) {
|
||||
//Utilize the "hacker" table, but also give zone information.
|
||||
auto query = fmt::format("INSERT INTO hackers(account, name, hacked, zone) values('{}', '{}', '{}', '{}')",
|
||||
accountname, charactername, hacked, zone);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return results.RowsAffected() != 0;
|
||||
}
|
||||
|
||||
uint8 Database::GetRaceSkill(uint8 skillid, uint8 in_race)
|
||||
{
|
||||
uint16 race_cap = 0;
|
||||
@@ -2076,7 +2019,7 @@ void Database::ClearRaidLeader(uint32 gid, uint32 rid)
|
||||
QueryDatabase(query);
|
||||
}
|
||||
|
||||
void Database::UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win)
|
||||
void Database::UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win, bool remove)
|
||||
{
|
||||
|
||||
std::string field;
|
||||
@@ -2114,16 +2057,26 @@ void Database::UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win)
|
||||
}
|
||||
}
|
||||
|
||||
if (win)
|
||||
if (win) {
|
||||
field += "wins";
|
||||
else
|
||||
} else {
|
||||
field += "losses";
|
||||
}
|
||||
|
||||
std::string query = StringFormat("UPDATE `adventure_stats` SET %s=%s+1 WHERE player_id=%u",field.c_str(), field.c_str(), char_id);
|
||||
std::string modification;
|
||||
|
||||
if (remove){
|
||||
modification = "-1";
|
||||
} else {
|
||||
modification = "+1";
|
||||
}
|
||||
|
||||
std::string query = StringFormat("UPDATE `adventure_stats` SET %s=%s%s WHERE player_id=%u",field.c_str(), field.c_str(), modification.c_str(), char_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (results.RowsAffected() != 0)
|
||||
if (results.RowsAffected() != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
query = StringFormat("INSERT INTO `adventure_stats` SET %s=1, player_id=%u", field.c_str(), char_id);
|
||||
QueryDatabase(query);
|
||||
@@ -2406,3 +2359,141 @@ int Database::GetInstanceID(uint32 char_id, uint32 zone_id) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param source_character_name
|
||||
* @param destination_character_name
|
||||
* @param destination_account_name
|
||||
* @return
|
||||
*/
|
||||
bool Database::CopyCharacter(
|
||||
std::string source_character_name,
|
||||
std::string destination_character_name,
|
||||
std::string destination_account_name
|
||||
)
|
||||
{
|
||||
auto results = QueryDatabase(
|
||||
fmt::format(
|
||||
"SELECT id FROM character_data WHERE name = '{}' and deleted_at is NULL LIMIT 1",
|
||||
source_character_name
|
||||
)
|
||||
);
|
||||
|
||||
if (results.RowCount() == 0) {
|
||||
LogError("No character found with name [{}]", source_character_name);
|
||||
}
|
||||
|
||||
auto row = results.begin();
|
||||
std::string source_character_id = row[0];
|
||||
|
||||
results = QueryDatabase(
|
||||
fmt::format(
|
||||
"SELECT id FROM account WHERE name = '{}' LIMIT 1",
|
||||
destination_account_name
|
||||
)
|
||||
);
|
||||
|
||||
if (results.RowCount() == 0) {
|
||||
LogError("No account found with name [{}]", destination_account_name);
|
||||
}
|
||||
|
||||
row = results.begin();
|
||||
std::string source_account_id = row[0];
|
||||
|
||||
/**
|
||||
* Fresh ID
|
||||
*/
|
||||
results = QueryDatabase("SELECT (MAX(id) + 1) as new_id from character_data");
|
||||
row = results.begin();
|
||||
std::string new_character_id = row[0];
|
||||
|
||||
TransactionBegin();
|
||||
for (const auto &iter : DatabaseSchema::GetCharacterTables()) {
|
||||
std::string table_name = iter.first;
|
||||
std::string character_id_column_name = iter.second;
|
||||
|
||||
/**
|
||||
* Columns
|
||||
*/
|
||||
results = QueryDatabase(fmt::format("SHOW COLUMNS FROM {}", table_name));
|
||||
std::vector<std::string> columns = {};
|
||||
int column_count = 0;
|
||||
for (row = results.begin(); row != results.end(); ++row) {
|
||||
columns.emplace_back(row[0]);
|
||||
column_count++;
|
||||
}
|
||||
|
||||
results = QueryDatabase(
|
||||
fmt::format(
|
||||
"SELECT {} FROM {} WHERE {} = {}",
|
||||
implode(",", wrap(columns, "`")),
|
||||
table_name,
|
||||
character_id_column_name,
|
||||
source_character_id
|
||||
)
|
||||
);
|
||||
|
||||
std::vector<std::vector<std::string>> new_rows;
|
||||
for (row = results.begin(); row != results.end(); ++row) {
|
||||
std::vector<std::string> new_values = {};
|
||||
for (int column_index = 0; column_index < column_count; column_index++) {
|
||||
std::string column = columns[column_index];
|
||||
std::string value = row[column_index] ? row[column_index] : "null";
|
||||
|
||||
if (column == character_id_column_name) {
|
||||
value = new_character_id;
|
||||
}
|
||||
|
||||
if (column == "name" && table_name == "character_data") {
|
||||
value = destination_character_name;
|
||||
}
|
||||
|
||||
if (column == "account_id" && table_name == "character_data") {
|
||||
value = source_account_id;
|
||||
}
|
||||
|
||||
new_values.emplace_back(value);
|
||||
}
|
||||
|
||||
new_rows.emplace_back(new_values);
|
||||
}
|
||||
|
||||
std::string insert_values;
|
||||
std::vector<std::string> insert_rows;
|
||||
|
||||
for (auto &r: new_rows) {
|
||||
std::string insert_row = "(" + implode(",", wrap(r, "'")) + ")";
|
||||
insert_rows.emplace_back(insert_row);
|
||||
}
|
||||
|
||||
if (!insert_rows.empty()) {
|
||||
QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
table_name,
|
||||
character_id_column_name,
|
||||
new_character_id
|
||||
)
|
||||
);
|
||||
|
||||
auto insert = QueryDatabase(
|
||||
fmt::format(
|
||||
"INSERT INTO {} ({}) VALUES {}",
|
||||
table_name,
|
||||
implode(",", wrap(columns, "`")),
|
||||
implode(",", insert_rows)
|
||||
)
|
||||
);
|
||||
|
||||
if (!insert.ErrorMessage().empty()) {
|
||||
TransactionRollback();
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TransactionCommit();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+35
-42
@@ -45,24 +45,6 @@ namespace EQ
|
||||
class InventoryProfile;
|
||||
}
|
||||
|
||||
struct EventLogDetails_Struct {
|
||||
uint32 id;
|
||||
char accountname[64];
|
||||
uint32 account_id;
|
||||
int16 status;
|
||||
char charactername[64];
|
||||
char targetname[64];
|
||||
char timestamp[64];
|
||||
char descriptiontype[64];
|
||||
char details[128];
|
||||
};
|
||||
|
||||
struct CharacterEventLog_Struct {
|
||||
uint32 count;
|
||||
uint8 eventid;
|
||||
EventLogDetails_Struct eld[255];
|
||||
};
|
||||
|
||||
struct npcDecayTimes_Struct {
|
||||
uint16 minlvl;
|
||||
uint16 maxlvl;
|
||||
@@ -100,23 +82,41 @@ class Database : public DBcore {
|
||||
public:
|
||||
Database();
|
||||
Database(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
|
||||
bool Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port);
|
||||
bool Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port, std::string connection_label = "default");
|
||||
~Database();
|
||||
|
||||
/* Character Creation */
|
||||
|
||||
bool AddToNameFilter(const char* name);
|
||||
bool CreateCharacter(uint32 account_id, char* name, uint16 gender, uint16 race, uint16 class_, uint8 str, uint8 sta, uint8 cha, uint8 dex, uint8 int_, uint8 agi, uint8 wis, uint8 face);
|
||||
bool DeleteCharacter(char* character_name);
|
||||
bool MoveCharacterToZone(const char* charname, const char* zonename);
|
||||
bool MoveCharacterToZone(const char* charname, const char* zonename,uint32 zoneid);
|
||||
bool MoveCharacterToZone(uint32 iCharID, const char* iZonename);
|
||||
bool ReserveName(uint32 account_id, char* name);
|
||||
bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp);
|
||||
bool SetHackerFlag(const char* accountname, const char* charactername, const char* hacked);
|
||||
bool SetMQDetectionFlag(const char* accountname, const char* charactername, const char* hacked, const char* zone);
|
||||
bool StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, EQ::InventoryProfile* inv);
|
||||
bool UpdateName(const char* oldname, const char* newname);
|
||||
bool AddToNameFilter(const char *name);
|
||||
bool CreateCharacter(
|
||||
uint32 account_id,
|
||||
char *name,
|
||||
uint16 gender,
|
||||
uint16 race,
|
||||
uint16 class_,
|
||||
uint8 str,
|
||||
uint8 sta,
|
||||
uint8 cha,
|
||||
uint8 dex,
|
||||
uint8 int_,
|
||||
uint8 agi,
|
||||
uint8 wis,
|
||||
uint8 face
|
||||
);
|
||||
bool DeleteCharacter(char *character_name);
|
||||
bool MoveCharacterToZone(const char *charname, uint32 zone_id);
|
||||
bool MoveCharacterToZone(uint32 character_id, uint32 zone_id);
|
||||
bool ReserveName(uint32 account_id, char *name);
|
||||
bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct *pp);
|
||||
bool SetHackerFlag(const char *accountname, const char *charactername, const char *hacked);
|
||||
bool SetMQDetectionFlag(const char *accountname, const char *charactername, const char *hacked, const char *zone);
|
||||
bool SetMQDetectionFlag(const char *accountname, const char *charactername, const std::string &hacked, const char *zone);
|
||||
bool UpdateName(const char *oldname, const char *newname);
|
||||
bool CopyCharacter(
|
||||
std::string source_character_name,
|
||||
std::string destination_character_name,
|
||||
std::string destination_account_name
|
||||
);
|
||||
|
||||
/* General Information Queries */
|
||||
|
||||
@@ -138,8 +138,8 @@ public:
|
||||
|
||||
void GetAccountName(uint32 accountid, char* name, uint32* oLSAccountID = 0);
|
||||
void GetCharName(uint32 char_id, char* name);
|
||||
const char *GetCharNameByID(uint32 char_id);
|
||||
const char *GetNPCNameByID(uint32 npc_id);
|
||||
std::string GetCharNameByID(uint32 char_id);
|
||||
std::string GetNPCNameByID(uint32 npc_id);
|
||||
void LoginIP(uint32 AccountID, const char* LoginIP);
|
||||
|
||||
/* Instancing */
|
||||
@@ -156,7 +156,6 @@ public:
|
||||
bool VerifyInstanceAlive(uint16 instance_id, uint32 char_id);
|
||||
bool VerifyZoneInstance(uint32 zone_id, uint16 instance_id);
|
||||
|
||||
uint16 GetInstanceID(const char* zone, uint32 charid, int16 version);
|
||||
uint16 GetInstanceID(uint32 zone, uint32 charid, int16 version);
|
||||
uint16 GetInstanceVersion(uint16 instance_id);
|
||||
uint32 GetTimeRemainingInstance(uint16 instance_id, bool &is_perma);
|
||||
@@ -175,7 +174,7 @@ public:
|
||||
|
||||
/* Adventure related. */
|
||||
|
||||
void UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win);
|
||||
void UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win, bool remove = false);
|
||||
bool GetAdventureStats(uint32 char_id, AdventureStats_Struct *as);
|
||||
|
||||
/* Account Related */
|
||||
@@ -243,17 +242,12 @@ public:
|
||||
|
||||
/* General Queries */
|
||||
|
||||
bool GetSafePoints(const char* short_name, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = nullptr);
|
||||
bool GetSafePoints(uint32 zoneID, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = nullptr) { return GetSafePoints(GetZoneName(zoneID), version, safe_x, safe_y, safe_z, minstatus, minlevel, flag_needed); }
|
||||
bool GetSafePoints(const char* zone_short_name, uint32 instance_version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, float* safe_heading = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = nullptr);
|
||||
bool GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zoneid = 0, float* graveyard_x = 0, float* graveyard_y = 0, float* graveyard_z = 0, float* graveyard_heading = 0);
|
||||
bool GetZoneLongName(const char* short_name, char** long_name, char* file_name = 0, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, uint32* graveyard_id = 0, uint32* maxclients = 0);
|
||||
bool LoadPTimers(uint32 charid, PTimerList &into);
|
||||
bool LoadZoneNames();
|
||||
|
||||
const char* GetZoneName(uint32 zoneID, bool ErrorUnknown = false);
|
||||
|
||||
uint32 GetZoneGraveyardID(uint32 zone_id, uint32 version);
|
||||
uint32 GetZoneID(const char* zonename);
|
||||
|
||||
uint8 GetPEQZone(uint32 zoneID, uint32 version);
|
||||
uint8 GetRaceSkill(uint8 skillid, uint8 in_race);
|
||||
@@ -277,7 +271,6 @@ public:
|
||||
void LoadLogSettings(EQEmuLogSys::LogSettings* log_settings);
|
||||
|
||||
private:
|
||||
std::map<uint32,std::string> zonename_array;
|
||||
|
||||
Mutex Mvarcache;
|
||||
VarCache_Struct varcache;
|
||||
|
||||
@@ -128,12 +128,23 @@ std::string DatabaseDumpService::GetMySQLVersion()
|
||||
std::string DatabaseDumpService::GetBaseMySQLDumpCommand()
|
||||
{
|
||||
auto config = EQEmuConfig::get();
|
||||
if (IsDumpContentTables() && !config->ContentDbHost.empty()) {
|
||||
return fmt::format(
|
||||
"mysqldump -u {} -p{} -h {} --port={} {}",
|
||||
config->ContentDbUsername,
|
||||
config->ContentDbPassword,
|
||||
config->ContentDbHost,
|
||||
config->ContentDbPort,
|
||||
config->ContentDbName
|
||||
);
|
||||
};
|
||||
|
||||
return fmt::format(
|
||||
"mysqldump -u {} -p{} -h {} {}",
|
||||
"mysqldump -u {} -p{} -h {} --port={} {}",
|
||||
config->DatabaseUsername,
|
||||
config->DatabasePassword,
|
||||
config->DatabaseHost,
|
||||
config->DatabasePort,
|
||||
config->DatabaseDB
|
||||
);
|
||||
}
|
||||
@@ -289,8 +300,7 @@ void DatabaseDumpService::Dump()
|
||||
config->DatabaseUsername
|
||||
);
|
||||
|
||||
std::string options = "--allow-keywords --extended-insert";
|
||||
|
||||
std::string options = "--allow-keywords --extended-insert --max-allowed-packet=1G --net-buffer-length=32704";
|
||||
if (IsDumpWithNoData()) {
|
||||
options += " --no-data";
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
namespace Convert {
|
||||
struct BindStruct {
|
||||
/*000*/ uint32 zoneId;
|
||||
/*000*/ uint32 zone_id;
|
||||
/*004*/ float x;
|
||||
/*008*/ float y;
|
||||
/*012*/ float z;
|
||||
@@ -1320,18 +1320,18 @@ bool Database::CheckDatabaseConvertPPDeblob(){
|
||||
if (rquery != ""){ results = QueryDatabase(rquery); }
|
||||
|
||||
/* Run Bind Home Convert */
|
||||
if (pp->binds[4].zoneId < 999 && !_ISNAN_(pp->binds[4].x) && !_ISNAN_(pp->binds[4].y) && !_ISNAN_(pp->binds[4].z) && !_ISNAN_(pp->binds[4].heading)) {
|
||||
if (pp->binds[4].zone_id < 999 && !_ISNAN_(pp->binds[4].x) && !_ISNAN_(pp->binds[4].y) && !_ISNAN_(pp->binds[4].z) && !_ISNAN_(pp->binds[4].heading)) {
|
||||
rquery = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)"
|
||||
" VALUES (%u, %u, %u, %f, %f, %f, %f, 1)",
|
||||
character_id, pp->binds[4].zoneId, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading);
|
||||
character_id, pp->binds[4].zone_id, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading);
|
||||
if (rquery != ""){ results = QueryDatabase(rquery); }
|
||||
}
|
||||
|
||||
/* Run Bind Convert */
|
||||
if (pp->binds[0].zoneId < 999 && !_ISNAN_(pp->binds[0].x) && !_ISNAN_(pp->binds[0].y) && !_ISNAN_(pp->binds[0].z) && !_ISNAN_(pp->binds[0].heading)) {
|
||||
if (pp->binds[0].zone_id < 999 && !_ISNAN_(pp->binds[0].x) && !_ISNAN_(pp->binds[0].y) && !_ISNAN_(pp->binds[0].z) && !_ISNAN_(pp->binds[0].heading)) {
|
||||
rquery = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)"
|
||||
" VALUES (%u, %u, %u, %f, %f, %f, %f, 0)",
|
||||
character_id, pp->binds[0].zoneId, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading);
|
||||
character_id, pp->binds[0].zone_id, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading);
|
||||
if (rquery != ""){ results = QueryDatabase(rquery); }
|
||||
}
|
||||
/* Run Language Convert */
|
||||
|
||||
@@ -20,6 +20,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "../common/rulesys.h"
|
||||
#include "../common/string_util.h"
|
||||
#include "../common/timer.h"
|
||||
#include "../common/repositories/dynamic_zone_members_repository.h"
|
||||
#include "../common/repositories/dynamic_zones_repository.h"
|
||||
|
||||
#include "database.h"
|
||||
|
||||
@@ -34,6 +36,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#define strcasecmp _stricmp
|
||||
#else
|
||||
#include "unix.h"
|
||||
#include "../zone/zonedb.h"
|
||||
#include <netinet/in.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
@@ -305,36 +308,6 @@ bool Database::VerifyZoneInstance(uint32 zone_id, uint16 instance_id)
|
||||
return true;
|
||||
}
|
||||
|
||||
uint16 Database::GetInstanceID(const char* zone, uint32 character_id, int16 version) {
|
||||
|
||||
std::string query = StringFormat(
|
||||
"SELECT "
|
||||
"instance_list.id "
|
||||
"FROM "
|
||||
"instance_list, "
|
||||
"instance_list_player "
|
||||
"WHERE "
|
||||
"instance_list.zone = %u "
|
||||
"AND instance_list.version = %u "
|
||||
"AND instance_list.id = instance_list_player.id "
|
||||
"AND instance_list_player.charid = %u "
|
||||
"LIMIT 1 ",
|
||||
GetZoneID(zone),
|
||||
version,
|
||||
character_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return 0;
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return 0;
|
||||
|
||||
auto row = results.begin();
|
||||
return atoi(row[0]);
|
||||
}
|
||||
|
||||
uint16 Database::GetInstanceID(uint32 zone, uint32 character_id, int16 version)
|
||||
{
|
||||
if (!zone)
|
||||
@@ -501,22 +474,18 @@ void Database::AssignRaidToInstance(uint32 raid_id, uint32 instance_id)
|
||||
}
|
||||
|
||||
void Database::BuryCorpsesInInstance(uint16 instance_id) {
|
||||
std::string query = StringFormat(
|
||||
"UPDATE `character_corpses` "
|
||||
"SET `is_buried` = 1, "
|
||||
"`instance_id` = 0 "
|
||||
"WHERE "
|
||||
"`instance_id` = %u ",
|
||||
instance_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE character_corpses SET is_buried = 1, instance_id = 0 WHERE instance_id = {}",
|
||||
instance_id
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
void Database::DeleteInstance(uint16 instance_id)
|
||||
{
|
||||
|
||||
std::string query;
|
||||
|
||||
|
||||
query = StringFormat("DELETE FROM instance_list_player WHERE id=%u", instance_id);
|
||||
QueryDatabase(query);
|
||||
|
||||
@@ -526,6 +495,9 @@ void Database::DeleteInstance(uint16 instance_id)
|
||||
query = StringFormat("DELETE FROM spawn_condition_values WHERE instance_id=%u", instance_id);
|
||||
QueryDatabase(query);
|
||||
|
||||
DynamicZoneMembersRepository::DeleteByInstance(*this, instance_id);
|
||||
DynamicZonesRepository::DeleteWhere(*this, fmt::format("instance_id = {}", instance_id));
|
||||
|
||||
BuryCorpsesInInstance(instance_id);
|
||||
}
|
||||
|
||||
@@ -537,7 +509,7 @@ void Database::FlagInstanceByGroupLeader(uint32 zone, int16 version, uint32 char
|
||||
|
||||
char ln[128];
|
||||
memset(ln, 0, 128);
|
||||
strcpy(ln, GetGroupLeadershipInfo(gid, ln));
|
||||
GetGroupLeadershipInfo(gid, ln);
|
||||
uint32 l_charid = GetCharacterID((const char*)ln);
|
||||
uint16 l_id = GetInstanceID(zone, l_charid, version);
|
||||
|
||||
@@ -603,9 +575,20 @@ void Database::PurgeExpiredInstances()
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<std::string> instance_ids;
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
DeleteInstance(atoi(row[0]));
|
||||
instance_ids.emplace_back(row[0]);
|
||||
}
|
||||
|
||||
std::string imploded_instance_ids = implode(",", instance_ids);
|
||||
|
||||
QueryDatabase(fmt::format("DELETE FROM instance_list WHERE id IN ({})", imploded_instance_ids));
|
||||
QueryDatabase(fmt::format("DELETE FROM instance_list_player WHERE id IN ({})", imploded_instance_ids));
|
||||
QueryDatabase(fmt::format("DELETE FROM respawn_times WHERE instance_id IN ({})", imploded_instance_ids));
|
||||
QueryDatabase(fmt::format("DELETE FROM spawn_condition_values WHERE instance_id IN ({})", imploded_instance_ids));
|
||||
QueryDatabase(fmt::format("UPDATE character_corpses SET is_buried = 1, instance_id = 0 WHERE instance_id IN ({})", imploded_instance_ids));
|
||||
DynamicZoneMembersRepository::DeleteByManyInstances(*this, imploded_instance_ids);
|
||||
DynamicZonesRepository::DeleteWhere(*this, fmt::format("instance_id IN ({})", imploded_instance_ids));
|
||||
}
|
||||
|
||||
void Database::SetInstanceDuration(uint16 instance_id, uint32 new_duration)
|
||||
|
||||
+13
-14
@@ -50,6 +50,8 @@ namespace DatabaseSchema {
|
||||
{"character_data", "id"},
|
||||
{"character_disciplines", "id"},
|
||||
{"character_enabledtasks", "charid"},
|
||||
{"character_expedition_lockouts", "character_id"},
|
||||
{"character_exp_modifiers", "character_id"},
|
||||
{"character_inspect_messages", "id"},
|
||||
{"character_item_recast", "id"},
|
||||
{"character_languages", "id"},
|
||||
@@ -114,6 +116,8 @@ namespace DatabaseSchema {
|
||||
"character_data",
|
||||
"character_disciplines",
|
||||
"character_enabledtasks",
|
||||
"character_expedition_lockouts",
|
||||
"character_exp_modifiers",
|
||||
"character_inspect_messages",
|
||||
"character_item_recast",
|
||||
"character_languages",
|
||||
@@ -166,16 +170,12 @@ namespace DatabaseSchema {
|
||||
{
|
||||
return {
|
||||
"aa_ability",
|
||||
"aa_actions",
|
||||
"aa_effects",
|
||||
"aa_rank_effects",
|
||||
"aa_rank_prereqs",
|
||||
"aa_ranks",
|
||||
"aa_required_level_cost",
|
||||
"adventure_template",
|
||||
"adventure_template_entry",
|
||||
"adventure_template_entry_flavor",
|
||||
"altadv_vars",
|
||||
"alternate_currency",
|
||||
"auras",
|
||||
"base_data",
|
||||
@@ -183,13 +183,11 @@ namespace DatabaseSchema {
|
||||
"books",
|
||||
"char_create_combinations",
|
||||
"char_create_point_allocations",
|
||||
"class_skill",
|
||||
"damageshieldtypes",
|
||||
"doors",
|
||||
"faction_base_data",
|
||||
"faction_list",
|
||||
"faction_list_mod",
|
||||
"fear_hints",
|
||||
"fishing",
|
||||
"forage",
|
||||
"global_loot",
|
||||
@@ -199,7 +197,6 @@ namespace DatabaseSchema {
|
||||
"grid_entries",
|
||||
"ground_spawns",
|
||||
"horses",
|
||||
"instance_list",
|
||||
"items",
|
||||
"ldon_trap_entries",
|
||||
"ldon_trap_templates",
|
||||
@@ -217,19 +214,15 @@ namespace DatabaseSchema {
|
||||
"npc_spells_effects_entries",
|
||||
"npc_spells_entries",
|
||||
"npc_types",
|
||||
"npc_types_metadata",
|
||||
"npc_types_tint",
|
||||
"object",
|
||||
"pets",
|
||||
"pets_equipmentset",
|
||||
"pets_equipmentset_entries",
|
||||
"proximities",
|
||||
"races",
|
||||
"skill_caps",
|
||||
"spawn2",
|
||||
"spawn_condition_values",
|
||||
"spawn_conditions",
|
||||
"spawn_events",
|
||||
"spawnentry",
|
||||
"spawngroup",
|
||||
"spells_new",
|
||||
@@ -246,8 +239,6 @@ namespace DatabaseSchema {
|
||||
"veteran_reward_templates",
|
||||
"zone",
|
||||
"zone_points",
|
||||
"zone_server",
|
||||
"zoneserver_auth",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -261,10 +252,13 @@ namespace DatabaseSchema {
|
||||
return {
|
||||
"chatchannels",
|
||||
"command_settings",
|
||||
"content_flags",
|
||||
"db_str",
|
||||
"eqtime",
|
||||
"launcher",
|
||||
"launcher_zones",
|
||||
"spawn_condition_values",
|
||||
"spawn_events",
|
||||
"level_exp_mods",
|
||||
"logsys_categories",
|
||||
"name_filter",
|
||||
@@ -315,12 +309,17 @@ namespace DatabaseSchema {
|
||||
"banned_ips",
|
||||
"bug_reports",
|
||||
"bugs",
|
||||
"dynamic_zone_members",
|
||||
"dynamic_zones",
|
||||
"eventlog",
|
||||
"expedition_lockouts",
|
||||
"expeditions",
|
||||
"gm_ips",
|
||||
"group_id",
|
||||
"group_leaders",
|
||||
"hackers",
|
||||
"ip_exemptions",
|
||||
"instance_list",
|
||||
"item_tick",
|
||||
"lfguild",
|
||||
"merchantlist_temp",
|
||||
@@ -331,7 +330,7 @@ namespace DatabaseSchema {
|
||||
"reports",
|
||||
"respawn_times",
|
||||
"saylink",
|
||||
|
||||
"server_scheduled_events",
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+50
-14
@@ -35,17 +35,31 @@
|
||||
DBcore::DBcore()
|
||||
{
|
||||
mysql_init(&mysql);
|
||||
pHost = 0;
|
||||
pUser = 0;
|
||||
pPassword = 0;
|
||||
pDatabase = 0;
|
||||
pCompress = false;
|
||||
pSSL = false;
|
||||
pStatus = Closed;
|
||||
pHost = nullptr;
|
||||
pUser = nullptr;
|
||||
pPassword = nullptr;
|
||||
pDatabase = nullptr;
|
||||
pCompress = false;
|
||||
pSSL = false;
|
||||
pStatus = Closed;
|
||||
}
|
||||
|
||||
DBcore::~DBcore()
|
||||
{
|
||||
/**
|
||||
* This prevents us from doing a double free in multi-tenancy setups where we
|
||||
* are re-using the default database connection pointer when we dont have an
|
||||
* external configuration setup ex: (content_database)
|
||||
*/
|
||||
std::string mysql_connection_host;
|
||||
if (mysql.host) {
|
||||
mysql_connection_host = mysql.host;
|
||||
}
|
||||
|
||||
if (GetOriginHost() != mysql_connection_host) {
|
||||
return;
|
||||
}
|
||||
|
||||
mysql_close(&mysql);
|
||||
safe_delete_array(pHost);
|
||||
safe_delete_array(pUser);
|
||||
@@ -69,6 +83,13 @@ MySQLRequestResult DBcore::QueryDatabase(std::string query, bool retryOnFailureO
|
||||
return QueryDatabase(query.c_str(), query.length(), retryOnFailureOnce);
|
||||
}
|
||||
|
||||
bool DBcore::DoesTableExist(std::string table_name)
|
||||
{
|
||||
auto results = QueryDatabase(fmt::format("SHOW TABLES LIKE '{}'", table_name));
|
||||
|
||||
return results.RowCount() > 0;
|
||||
}
|
||||
|
||||
MySQLRequestResult DBcore::QueryDatabase(const char *query, uint32 querylen, bool retryOnFailureOnce)
|
||||
{
|
||||
BenchTimer timer;
|
||||
@@ -81,6 +102,8 @@ MySQLRequestResult DBcore::QueryDatabase(const char *query, uint32 querylen, boo
|
||||
Open();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// request query. != 0 indicates some kind of error.
|
||||
if (mysql_real_query(&mysql, query, querylen) != 0) {
|
||||
unsigned int errorNumber = mysql_errno(&mysql);
|
||||
@@ -200,10 +223,10 @@ bool DBcore::Open(
|
||||
)
|
||||
{
|
||||
LockMutex lock(&MDatabase);
|
||||
safe_delete(pHost);
|
||||
safe_delete(pUser);
|
||||
safe_delete(pPassword);
|
||||
safe_delete(pDatabase);
|
||||
safe_delete_array(pHost);
|
||||
safe_delete_array(pUser);
|
||||
safe_delete_array(pPassword);
|
||||
safe_delete_array(pDatabase);
|
||||
pHost = strcpy(new char[strlen(iHost) + 1], iHost);
|
||||
pUser = strcpy(new char[strlen(iUser) + 1], iUser);
|
||||
pPassword = strcpy(new char[strlen(iPassword) + 1], iPassword);
|
||||
@@ -244,6 +267,10 @@ bool DBcore::Open(uint32 *errnum, char *errbuf)
|
||||
}
|
||||
if (mysql_real_connect(&mysql, pHost, pUser, pPassword, pDatabase, pPort, 0, flags)) {
|
||||
pStatus = Connected;
|
||||
|
||||
std::string connected_origin_host = pHost;
|
||||
SetOriginHost(connected_origin_host);
|
||||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
@@ -258,8 +285,17 @@ bool DBcore::Open(uint32 *errnum, char *errbuf)
|
||||
}
|
||||
}
|
||||
|
||||
void DBcore::SetMysql(MYSQL *mysql)
|
||||
{
|
||||
DBcore::mysql = *mysql;
|
||||
}
|
||||
|
||||
const std::string &DBcore::GetOriginHost() const
|
||||
{
|
||||
return origin_host;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void DBcore::SetOriginHost(const std::string &origin_host)
|
||||
{
|
||||
DBcore::origin_host = origin_host;
|
||||
}
|
||||
|
||||
+42
-21
@@ -2,8 +2,8 @@
|
||||
#define DBCORE_H
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "../common/mutex.h"
|
||||
@@ -15,36 +15,57 @@
|
||||
|
||||
class DBcore {
|
||||
public:
|
||||
enum eStatus { Closed, Connected, Error };
|
||||
enum eStatus {
|
||||
Closed, Connected, Error
|
||||
};
|
||||
|
||||
DBcore();
|
||||
~DBcore();
|
||||
eStatus GetStatus() { return pStatus; }
|
||||
MySQLRequestResult QueryDatabase(const char* query, uint32 querylen, bool retryOnFailureOnce = true);
|
||||
MySQLRequestResult QueryDatabase(std::string query, bool retryOnFailureOnce = true);
|
||||
eStatus GetStatus() { return pStatus; }
|
||||
MySQLRequestResult QueryDatabase(const char *query, uint32 querylen, bool retryOnFailureOnce = true);
|
||||
MySQLRequestResult QueryDatabase(std::string query, bool retryOnFailureOnce = true);
|
||||
void TransactionBegin();
|
||||
void TransactionCommit();
|
||||
void TransactionRollback();
|
||||
uint32 DoEscapeString(char* tobuf, const char* frombuf, uint32 fromlen);
|
||||
void ping();
|
||||
MYSQL* getMySQL(){ return &mysql; }
|
||||
uint32 DoEscapeString(char *tobuf, const char *frombuf, uint32 fromlen);
|
||||
void ping();
|
||||
MYSQL *getMySQL() { return &mysql; }
|
||||
void SetMysql(MYSQL *mysql);
|
||||
|
||||
const std::string &GetOriginHost() const;
|
||||
void SetOriginHost(const std::string &origin_host);
|
||||
|
||||
bool DoesTableExist(std::string table_name);
|
||||
|
||||
protected:
|
||||
bool Open(const char* iHost, const char* iUser, const char* iPassword, const char* iDatabase, uint32 iPort, uint32* errnum = 0, char* errbuf = 0, bool iCompress = false, bool iSSL = false);
|
||||
private:
|
||||
bool Open(uint32* errnum = 0, char* errbuf = 0);
|
||||
bool Open(
|
||||
const char *iHost,
|
||||
const char *iUser,
|
||||
const char *iPassword,
|
||||
const char *iDatabase,
|
||||
uint32 iPort,
|
||||
uint32 *errnum = 0,
|
||||
char *errbuf = 0,
|
||||
bool iCompress = false,
|
||||
bool iSSL = false
|
||||
);
|
||||
|
||||
MYSQL mysql;
|
||||
Mutex MDatabase;
|
||||
private:
|
||||
bool Open(uint32 *errnum = nullptr, char *errbuf = nullptr);
|
||||
|
||||
MYSQL mysql;
|
||||
Mutex MDatabase;
|
||||
eStatus pStatus;
|
||||
|
||||
char* pHost;
|
||||
char* pUser;
|
||||
char* pPassword;
|
||||
char* pDatabase;
|
||||
bool pCompress;
|
||||
uint32 pPort;
|
||||
bool pSSL;
|
||||
std::string origin_host;
|
||||
|
||||
char *pHost;
|
||||
char *pUser;
|
||||
char *pPassword;
|
||||
char *pDatabase;
|
||||
bool pCompress;
|
||||
uint32 pPort;
|
||||
bool pSSL;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,430 @@
|
||||
#include "dynamic_zone_base.h"
|
||||
#include "database.h"
|
||||
#include "eqemu_logsys.h"
|
||||
#include "repositories/instance_list_repository.h"
|
||||
#include "repositories/instance_list_player_repository.h"
|
||||
#include "rulesys.h"
|
||||
#include "servertalk.h"
|
||||
|
||||
DynamicZoneBase::DynamicZoneBase(DynamicZonesRepository::DynamicZoneInstance&& entry)
|
||||
{
|
||||
LoadRepositoryResult(std::move(entry));
|
||||
}
|
||||
|
||||
uint32_t DynamicZoneBase::Create()
|
||||
{
|
||||
if (m_id != 0)
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
if (GetInstanceID() == 0)
|
||||
{
|
||||
CreateInstance();
|
||||
}
|
||||
|
||||
m_id = SaveToDatabase();
|
||||
|
||||
return m_id;
|
||||
}
|
||||
|
||||
uint32_t DynamicZoneBase::CreateInstance()
|
||||
{
|
||||
if (m_instance_id)
|
||||
{
|
||||
LogDynamicZones("CreateInstance failed, instance id [{}] already created", m_instance_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!m_zone_id)
|
||||
{
|
||||
LogDynamicZones("CreateInstance failed, invalid zone id [{}]", m_zone_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16_t unused_instance_id = 0;
|
||||
if (!GetDatabase().GetUnusedInstanceID(unused_instance_id)) // todo: doesn't this race with insert?
|
||||
{
|
||||
LogDynamicZones("Failed to find unused instance id");
|
||||
return 0;
|
||||
}
|
||||
|
||||
m_start_time = std::chrono::system_clock::now();
|
||||
m_expire_time = m_start_time + m_duration;
|
||||
|
||||
auto insert_instance = InstanceListRepository::NewEntity();
|
||||
insert_instance.id = unused_instance_id;
|
||||
insert_instance.zone = m_zone_id;
|
||||
insert_instance.version = m_zone_version;
|
||||
insert_instance.start_time = static_cast<int>(std::chrono::system_clock::to_time_t(m_start_time));
|
||||
insert_instance.duration = static_cast<int>(m_duration.count());
|
||||
insert_instance.never_expires = m_never_expires;
|
||||
|
||||
auto instance = InstanceListRepository::InsertOne(GetDatabase(), insert_instance);
|
||||
if (instance.id == 0)
|
||||
{
|
||||
LogDynamicZones("Failed to create instance [{}] for zone [{}]", unused_instance_id, m_zone_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
m_instance_id = instance.id;
|
||||
|
||||
return m_instance_id;
|
||||
}
|
||||
|
||||
void DynamicZoneBase::LoadRepositoryResult(DynamicZonesRepository::DynamicZoneInstance&& dz_entry)
|
||||
{
|
||||
m_id = dz_entry.id;
|
||||
m_instance_id = dz_entry.instance_id;
|
||||
m_type = static_cast<DynamicZoneType>(dz_entry.type);
|
||||
m_compass.zone_id = dz_entry.compass_zone_id;
|
||||
m_compass.x = dz_entry.compass_x;
|
||||
m_compass.y = dz_entry.compass_y;
|
||||
m_compass.z = dz_entry.compass_z;
|
||||
m_safereturn.zone_id = dz_entry.safe_return_zone_id;
|
||||
m_safereturn.x = dz_entry.safe_return_x;
|
||||
m_safereturn.y = dz_entry.safe_return_y;
|
||||
m_safereturn.z = dz_entry.safe_return_z;
|
||||
m_safereturn.heading = dz_entry.safe_return_heading;
|
||||
m_zonein.x = dz_entry.zone_in_x;
|
||||
m_zonein.y = dz_entry.zone_in_y;
|
||||
m_zonein.z = dz_entry.zone_in_z;
|
||||
m_zonein.heading = dz_entry.zone_in_heading;
|
||||
m_has_zonein = (dz_entry.has_zone_in != 0);
|
||||
// instance_list portion
|
||||
m_zone_id = dz_entry.zone;
|
||||
m_zone_version = dz_entry.version;
|
||||
m_start_time = std::chrono::system_clock::from_time_t(dz_entry.start_time);
|
||||
m_duration = std::chrono::seconds(dz_entry.duration);
|
||||
m_never_expires = (dz_entry.never_expires != 0);
|
||||
m_expire_time = m_start_time + m_duration;
|
||||
}
|
||||
|
||||
void DynamicZoneBase::AddMemberFromRepositoryResult(
|
||||
DynamicZoneMembersRepository::MemberWithName&& entry)
|
||||
{
|
||||
auto status = DynamicZoneMemberStatus::Unknown;
|
||||
AddInternalMember({ entry.character_id, std::move(entry.character_name), status });
|
||||
}
|
||||
|
||||
uint32_t DynamicZoneBase::SaveToDatabase()
|
||||
{
|
||||
LogDynamicZonesDetail("Saving dz instance [{}] to database", m_instance_id);
|
||||
|
||||
if (m_instance_id != 0)
|
||||
{
|
||||
auto insert_dz = DynamicZonesRepository::NewEntity();
|
||||
insert_dz.instance_id = m_instance_id,
|
||||
insert_dz.type = static_cast<int>(m_type);
|
||||
insert_dz.compass_zone_id = m_compass.zone_id;
|
||||
insert_dz.compass_x = m_compass.x;
|
||||
insert_dz.compass_y = m_compass.y;
|
||||
insert_dz.compass_z = m_compass.z;
|
||||
insert_dz.safe_return_zone_id = m_safereturn.zone_id;
|
||||
insert_dz.safe_return_x = m_safereturn.x;
|
||||
insert_dz.safe_return_y = m_safereturn.y;
|
||||
insert_dz.safe_return_z = m_safereturn.z;
|
||||
insert_dz.safe_return_heading = m_safereturn.heading;
|
||||
insert_dz.zone_in_x = m_zonein.x;
|
||||
insert_dz.zone_in_y = m_zonein.y;
|
||||
insert_dz.zone_in_z = m_zonein.z;
|
||||
insert_dz.zone_in_heading = m_zonein.heading;
|
||||
insert_dz.has_zone_in = m_has_zonein;
|
||||
|
||||
auto inserted_dz = DynamicZonesRepository::InsertOne(GetDatabase(), insert_dz);
|
||||
return inserted_dz.id;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DynamicZoneBase::AddCharacter(uint32_t character_id)
|
||||
{
|
||||
DynamicZoneMembersRepository::AddMember(GetDatabase(), m_id, character_id);
|
||||
GetDatabase().AddClientToInstance(m_instance_id, character_id);
|
||||
SendInstanceAddRemoveCharacter(character_id, false); // stops client kick timer
|
||||
}
|
||||
|
||||
void DynamicZoneBase::RemoveCharacter(uint32_t character_id)
|
||||
{
|
||||
DynamicZoneMembersRepository::RemoveMember(GetDatabase(), m_id, character_id);
|
||||
GetDatabase().RemoveClientFromInstance(m_instance_id, character_id);
|
||||
SendInstanceAddRemoveCharacter(character_id, true); // start client kick timer
|
||||
}
|
||||
|
||||
void DynamicZoneBase::RemoveAllCharacters(bool enable_removal_timers)
|
||||
{
|
||||
if (GetInstanceID() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (enable_removal_timers)
|
||||
{
|
||||
SendInstanceRemoveAllCharacters();
|
||||
}
|
||||
|
||||
DynamicZoneMembersRepository::RemoveAllMembers(GetDatabase(), m_id);
|
||||
GetDatabase().RemoveClientsFromInstance(GetInstanceID());
|
||||
}
|
||||
|
||||
void DynamicZoneBase::SaveMembers(const std::vector<DynamicZoneMember>& members)
|
||||
{
|
||||
LogDynamicZonesDetail("Saving [{}] member(s) for dz [{}]", members.size(), m_id);
|
||||
|
||||
m_members = members;
|
||||
|
||||
// the lower level instance_list_players needs to be kept updated as well
|
||||
std::vector<DynamicZoneMembersRepository::DynamicZoneMembers> insert_members;
|
||||
std::vector<InstanceListPlayerRepository::InstanceListPlayer> insert_players;
|
||||
for (const auto& member : m_members)
|
||||
{
|
||||
DynamicZoneMembersRepository::DynamicZoneMembers member_entry{};
|
||||
member_entry.dynamic_zone_id = m_id;
|
||||
member_entry.character_id = member.id;
|
||||
member_entry.is_current_member = true;
|
||||
insert_members.emplace_back(member_entry);
|
||||
|
||||
InstanceListPlayerRepository::InstanceListPlayer player_entry;
|
||||
player_entry.id = static_cast<int>(m_instance_id);
|
||||
player_entry.charid = static_cast<int>(member.id);
|
||||
insert_players.emplace_back(player_entry);
|
||||
}
|
||||
|
||||
DynamicZoneMembersRepository::InsertOrUpdateMany(GetDatabase(), insert_members);
|
||||
InstanceListPlayerRepository::InsertOrUpdateMany(GetDatabase(), insert_players);
|
||||
}
|
||||
|
||||
void DynamicZoneBase::SetCompass(const DynamicZoneLocation& location, bool update_db)
|
||||
{
|
||||
ProcessCompassChange(location);
|
||||
|
||||
if (update_db)
|
||||
{
|
||||
LogDynamicZonesDetail("Saving [{}] compass zone: [{}] xyz: ([{}], [{}], [{}])",
|
||||
m_id, m_compass.zone_id, m_compass.x, m_compass.y, m_compass.z);
|
||||
|
||||
DynamicZonesRepository::UpdateCompass(GetDatabase(),
|
||||
m_id, m_compass.zone_id, m_compass.x, m_compass.y, m_compass.z);
|
||||
|
||||
SendGlobalLocationChange(ServerOP_DzSetCompass, location);
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicZoneBase::SetCompass(uint32_t zone_id, float x, float y, float z, bool update_db)
|
||||
{
|
||||
SetCompass({ zone_id, x, y, z, 0.0f }, update_db);
|
||||
}
|
||||
|
||||
void DynamicZoneBase::SetSafeReturn(const DynamicZoneLocation& location, bool update_db)
|
||||
{
|
||||
m_safereturn = location;
|
||||
|
||||
if (update_db)
|
||||
{
|
||||
LogDynamicZonesDetail("Saving [{}] safereturn zone: [{}] xyzh: ([{}], [{}], [{}], [{}])",
|
||||
m_id, m_safereturn.zone_id, m_safereturn.x, m_safereturn.y, m_safereturn.z, m_safereturn.heading);
|
||||
|
||||
DynamicZonesRepository::UpdateSafeReturn(GetDatabase(), m_id, m_safereturn.zone_id,
|
||||
m_safereturn.x, m_safereturn.y, m_safereturn.z, m_safereturn.heading);
|
||||
|
||||
SendGlobalLocationChange(ServerOP_DzSetSafeReturn, location);
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicZoneBase::SetSafeReturn(uint32_t zone_id, float x, float y, float z, float heading, bool update_db)
|
||||
{
|
||||
SetSafeReturn({ zone_id, x, y, z, heading }, update_db);
|
||||
}
|
||||
|
||||
void DynamicZoneBase::SetZoneInLocation(const DynamicZoneLocation& location, bool update_db)
|
||||
{
|
||||
m_zonein = location;
|
||||
m_has_zonein = true;
|
||||
|
||||
if (update_db)
|
||||
{
|
||||
LogDynamicZonesDetail("Saving [{}] zonein zone: [{}] xyzh: ([{}], [{}], [{}], [{}])",
|
||||
m_id, m_zone_id, m_zonein.x, m_zonein.y, m_zonein.z, m_zonein.heading);
|
||||
|
||||
DynamicZonesRepository::UpdateZoneIn(GetDatabase(), m_id, m_zone_id,
|
||||
m_zonein.x, m_zonein.y, m_zonein.z, m_zonein.heading, m_has_zonein);
|
||||
|
||||
SendGlobalLocationChange(ServerOP_DzSetZoneIn, location);
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicZoneBase::SetZoneInLocation(float x, float y, float z, float heading, bool update_db)
|
||||
{
|
||||
SetZoneInLocation({ 0, x, y, z, heading }, update_db);
|
||||
}
|
||||
|
||||
uint32_t DynamicZoneBase::GetSecondsRemaining() const
|
||||
{
|
||||
auto remaining = std::chrono::duration_cast<std::chrono::seconds>(GetDurationRemaining()).count();
|
||||
return std::max(0, static_cast<int>(remaining));
|
||||
}
|
||||
|
||||
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerAddRemoveCharacterPacket(
|
||||
uint32_t character_id, bool removed)
|
||||
{
|
||||
constexpr uint32_t pack_size = sizeof(ServerDzCharacter_Struct);
|
||||
auto pack = std::make_unique<ServerPacket>(ServerOP_DzAddRemoveCharacter, pack_size);
|
||||
auto buf = reinterpret_cast<ServerDzCharacter_Struct*>(pack->pBuffer);
|
||||
buf->zone_id = GetZoneID();
|
||||
buf->instance_id = GetInstanceID();
|
||||
buf->remove = removed;
|
||||
buf->character_id = character_id;
|
||||
|
||||
return pack;
|
||||
}
|
||||
|
||||
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerRemoveAllCharactersPacket()
|
||||
{
|
||||
constexpr uint32_t pack_size = sizeof(ServerDzCharacter_Struct);
|
||||
auto pack = std::make_unique<ServerPacket>(ServerOP_DzRemoveAllCharacters, pack_size);
|
||||
auto buf = reinterpret_cast<ServerDzCharacter_Struct*>(pack->pBuffer);
|
||||
buf->zone_id = GetZoneID();
|
||||
buf->instance_id = GetInstanceID();
|
||||
buf->remove = true;
|
||||
buf->character_id = 0;
|
||||
|
||||
return pack;
|
||||
}
|
||||
|
||||
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerDzLocationPacket(
|
||||
uint16_t server_opcode, const DynamicZoneLocation& location)
|
||||
{
|
||||
constexpr uint32_t pack_size = sizeof(ServerDzLocation_Struct);
|
||||
auto pack = std::make_unique<ServerPacket>(server_opcode, pack_size);
|
||||
auto buf = reinterpret_cast<ServerDzLocation_Struct*>(pack->pBuffer);
|
||||
buf->dz_id = GetID();
|
||||
buf->sender_zone_id = GetCurrentZoneID();
|
||||
buf->sender_instance_id = GetCurrentInstanceID();
|
||||
buf->zone_id = location.zone_id;
|
||||
buf->x = location.x;
|
||||
buf->y = location.y;
|
||||
buf->z = location.z;
|
||||
buf->heading = location.heading;
|
||||
|
||||
return pack;
|
||||
}
|
||||
|
||||
uint32_t DynamicZoneBase::GetDatabaseMemberCount()
|
||||
{
|
||||
return DynamicZoneMembersRepository::GetCountWhere(GetDatabase(),
|
||||
fmt::format("dynamic_zone_id = {} AND is_current_member = TRUE", m_id));
|
||||
}
|
||||
|
||||
bool DynamicZoneBase::HasDatabaseMember(uint32_t character_id)
|
||||
{
|
||||
if (character_id == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
auto entries = DynamicZoneMembersRepository::GetWhere(GetDatabase(), fmt::format(
|
||||
"dynamic_zone_id = {} AND character_id = {} AND is_current_member = TRUE",
|
||||
m_id, character_id
|
||||
));
|
||||
|
||||
return entries.size() != 0;
|
||||
}
|
||||
|
||||
void DynamicZoneBase::AddInternalMember(const DynamicZoneMember& member)
|
||||
{
|
||||
if (!HasMember(member.id))
|
||||
{
|
||||
m_members.emplace_back(member);
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicZoneBase::RemoveInternalMember(uint32_t character_id)
|
||||
{
|
||||
m_members.erase(std::remove_if(m_members.begin(), m_members.end(),
|
||||
[&](const DynamicZoneMember& member) { return member.id == character_id; }
|
||||
), m_members.end());
|
||||
}
|
||||
|
||||
bool DynamicZoneBase::HasMember(uint32_t character_id)
|
||||
{
|
||||
return std::any_of(m_members.begin(), m_members.end(),
|
||||
[&](const DynamicZoneMember& member) { return member.id == character_id; });
|
||||
}
|
||||
|
||||
bool DynamicZoneBase::HasMember(const std::string& character_name)
|
||||
{
|
||||
return std::any_of(m_members.begin(), m_members.end(),
|
||||
[&](const DynamicZoneMember& member) {
|
||||
return strcasecmp(member.name.c_str(), character_name.c_str()) == 0;
|
||||
});
|
||||
}
|
||||
|
||||
DynamicZoneMember DynamicZoneBase::GetMemberData(uint32_t character_id)
|
||||
{
|
||||
auto it = std::find_if(m_members.begin(), m_members.end(),
|
||||
[&](const DynamicZoneMember& member) { return member.id == character_id; });
|
||||
|
||||
DynamicZoneMember member_data;
|
||||
if (it != m_members.end())
|
||||
{
|
||||
member_data = *it;
|
||||
}
|
||||
return member_data;
|
||||
}
|
||||
|
||||
DynamicZoneMember DynamicZoneBase::GetMemberData(const std::string& character_name)
|
||||
{
|
||||
auto it = std::find_if(m_members.begin(), m_members.end(),
|
||||
[&](const DynamicZoneMember& member) {
|
||||
return strcasecmp(member.name.c_str(), character_name.c_str()) == 0;
|
||||
});
|
||||
|
||||
DynamicZoneMember member_data;
|
||||
if (it != m_members.end())
|
||||
{
|
||||
member_data = *it;
|
||||
}
|
||||
return member_data;
|
||||
}
|
||||
|
||||
bool DynamicZoneBase::SetInternalMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status)
|
||||
{
|
||||
if (status == DynamicZoneMemberStatus::InDynamicZone && !RuleB(DynamicZone, EnableInDynamicZoneStatus))
|
||||
{
|
||||
status = DynamicZoneMemberStatus::Online;
|
||||
}
|
||||
|
||||
if (character_id == m_leader.id)
|
||||
{
|
||||
m_leader.status = status;
|
||||
}
|
||||
|
||||
auto it = std::find_if(m_members.begin(), m_members.end(),
|
||||
[&](const DynamicZoneMember& member) { return member.id == character_id; });
|
||||
|
||||
if (it != m_members.end() && it->status != status)
|
||||
{
|
||||
it->status = status;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string DynamicZoneBase::GetDynamicZoneTypeName(DynamicZoneType dz_type)
|
||||
{
|
||||
switch (dz_type)
|
||||
{
|
||||
case DynamicZoneType::Expedition:
|
||||
return "Expedition";
|
||||
case DynamicZoneType::Tutorial:
|
||||
return "Tutorial";
|
||||
case DynamicZoneType::Task:
|
||||
return "Task";
|
||||
case DynamicZoneType::Mission:
|
||||
return "Mission";
|
||||
case DynamicZoneType::Quest:
|
||||
return "Quest";
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
#ifndef COMMON_DYNAMIC_ZONE_BASE_H
|
||||
#define COMMON_DYNAMIC_ZONE_BASE_H
|
||||
|
||||
#include "eq_constants.h"
|
||||
#include "repositories/dynamic_zones_repository.h"
|
||||
#include "repositories/dynamic_zone_members_repository.h"
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class Database;
|
||||
class ServerPacket;
|
||||
|
||||
struct DynamicZoneMember
|
||||
{
|
||||
uint32_t id = 0;
|
||||
std::string name;
|
||||
DynamicZoneMemberStatus status = DynamicZoneMemberStatus::Online;
|
||||
|
||||
DynamicZoneMember() = default;
|
||||
DynamicZoneMember(uint32_t id, std::string name_)
|
||||
: id(id), name{std::move(name_)} {}
|
||||
DynamicZoneMember(uint32_t id, std::string name_, DynamicZoneMemberStatus status_)
|
||||
: id(id), name{std::move(name_)}, status(status_) {}
|
||||
|
||||
bool IsOnline() const { return status == DynamicZoneMemberStatus::Online ||
|
||||
status == DynamicZoneMemberStatus::InDynamicZone; }
|
||||
bool IsValid() const { return id != 0 && !name.empty(); }
|
||||
};
|
||||
|
||||
struct DynamicZoneLocation
|
||||
{
|
||||
uint32_t zone_id = 0;
|
||||
float x = 0.0f;
|
||||
float y = 0.0f;
|
||||
float z = 0.0f;
|
||||
float heading = 0.0f;
|
||||
|
||||
DynamicZoneLocation() = default;
|
||||
DynamicZoneLocation(uint32_t zone_id_, float x_, float y_, float z_, float heading_)
|
||||
: zone_id(zone_id_), x(x_), y(y_), z(z_), heading(heading_) {}
|
||||
};
|
||||
|
||||
class DynamicZoneBase
|
||||
{
|
||||
public:
|
||||
virtual ~DynamicZoneBase() = default;
|
||||
DynamicZoneBase(const DynamicZoneBase&) = default;
|
||||
DynamicZoneBase(DynamicZoneBase&&) = default;
|
||||
DynamicZoneBase& operator=(const DynamicZoneBase&) = default;
|
||||
DynamicZoneBase& operator=(DynamicZoneBase&&) = default;
|
||||
DynamicZoneBase() = default;
|
||||
DynamicZoneBase(uint32_t dz_id) : m_id(dz_id) {}
|
||||
DynamicZoneBase(DynamicZoneType type) : m_type(type) {}
|
||||
DynamicZoneBase(DynamicZonesRepository::DynamicZoneInstance&& entry);
|
||||
|
||||
static std::string GetDynamicZoneTypeName(DynamicZoneType dz_type);
|
||||
|
||||
virtual void SetSecondsRemaining(uint32_t seconds_remaining) = 0;
|
||||
|
||||
uint64_t GetExpireTime() const { return std::chrono::system_clock::to_time_t(m_expire_time); }
|
||||
uint32_t GetID() const { return m_id; }
|
||||
uint16_t GetInstanceID() const { return static_cast<uint16_t>(m_instance_id); }
|
||||
uint32_t GetMaxPlayers() const { return m_max_players; }
|
||||
uint32_t GetMemberCount() const { return static_cast<uint32_t>(m_members.size()); }
|
||||
uint32_t GetMinPlayers() const { return m_min_players; }
|
||||
uint32_t GetSecondsRemaining() const;
|
||||
uint16_t GetZoneID() const { return static_cast<uint16_t>(m_zone_id); }
|
||||
uint32_t GetZoneIndex() const { return (m_instance_id << 16) | (m_zone_id & 0xffff); }
|
||||
uint32_t GetZoneVersion() const { return m_zone_version; }
|
||||
DynamicZoneType GetType() const { return m_type; }
|
||||
const std::string& GetLeaderName() const { return m_leader.name; }
|
||||
const std::string& GetName() const { return m_name; }
|
||||
const DynamicZoneMember& GetLeader() const { return m_leader; }
|
||||
const std::vector<DynamicZoneMember>& GetMembers() const { return m_members; }
|
||||
const DynamicZoneLocation& GetCompassLocation() const { return m_compass; }
|
||||
const DynamicZoneLocation& GetSafeReturnLocation() const { return m_safereturn; }
|
||||
const DynamicZoneLocation& GetZoneInLocation() const { return m_zonein; }
|
||||
std::chrono::system_clock::duration GetDurationRemaining() const { return m_expire_time - std::chrono::system_clock::now(); }
|
||||
|
||||
void AddCharacter(uint32_t character_id);
|
||||
void AddInternalMember(const DynamicZoneMember& member);
|
||||
void AddMemberFromRepositoryResult(DynamicZoneMembersRepository::MemberWithName&& entry);
|
||||
void ClearInternalMembers() { m_members.clear(); }
|
||||
uint32_t Create();
|
||||
uint32_t GetDatabaseMemberCount();
|
||||
DynamicZoneMember GetMemberData(uint32_t character_id);
|
||||
DynamicZoneMember GetMemberData(const std::string& character_name);
|
||||
bool HasDatabaseMember(uint32_t character_id);
|
||||
bool HasMember(uint32_t character_id);
|
||||
bool HasMember(const std::string& character_name);
|
||||
bool HasMembers() const { return !m_members.empty(); }
|
||||
bool HasZoneInLocation() const { return m_has_zonein; }
|
||||
bool IsExpired() const { return m_expire_time < std::chrono::system_clock::now(); }
|
||||
bool IsInstanceID(uint32_t instance_id) const { return (m_instance_id != 0 && m_instance_id == instance_id); }
|
||||
bool IsValid() const { return m_instance_id != 0; }
|
||||
bool IsSameDz(uint32_t zone_id, uint32_t instance_id) const { return zone_id == m_zone_id && instance_id == m_instance_id; }
|
||||
void RemoveAllCharacters(bool enable_removal_timers = true);
|
||||
void RemoveCharacter(uint32_t character_id);
|
||||
void RemoveInternalMember(uint32_t character_id);
|
||||
void SaveMembers(const std::vector<DynamicZoneMember>& members);
|
||||
void SetCompass(const DynamicZoneLocation& location, bool update_db = false);
|
||||
void SetCompass(uint32_t zone_id, float x, float y, float z, bool update_db = false);
|
||||
bool SetInternalMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status);
|
||||
void SetLeader(const DynamicZoneMember& leader) { m_leader = leader; }
|
||||
void SetMaxPlayers(uint32_t max_players) { m_max_players = max_players; }
|
||||
void SetMinPlayers(uint32_t min_players) { m_min_players = min_players; }
|
||||
void SetName(const std::string& name) { m_name = name; }
|
||||
void SetSafeReturn(const DynamicZoneLocation& location, bool update_db = false);
|
||||
void SetSafeReturn(uint32_t zone_id, float x, float y, float z, float heading, bool update_db = false);
|
||||
void SetZoneInLocation(const DynamicZoneLocation& location, bool update_db = false);
|
||||
void SetZoneInLocation(float x, float y, float z, float heading, bool update_db = false);
|
||||
|
||||
protected:
|
||||
virtual uint16_t GetCurrentInstanceID() { return 0; }
|
||||
virtual uint16_t GetCurrentZoneID() { return 0; }
|
||||
virtual Database& GetDatabase() = 0;
|
||||
virtual void ProcessCompassChange(const DynamicZoneLocation& location) { m_compass = location; }
|
||||
virtual void SendInstanceAddRemoveCharacter(uint32_t character_id, bool remove) = 0;
|
||||
virtual void SendInstanceRemoveAllCharacters() = 0;
|
||||
virtual void SendGlobalLocationChange(uint16_t server_opcode, const DynamicZoneLocation& location) = 0;
|
||||
|
||||
uint32_t CreateInstance();
|
||||
void LoadRepositoryResult(DynamicZonesRepository::DynamicZoneInstance&& dz_entry);
|
||||
uint32_t SaveToDatabase();
|
||||
|
||||
std::unique_ptr<ServerPacket> CreateServerAddRemoveCharacterPacket(uint32_t character_id, bool removed);
|
||||
std::unique_ptr<ServerPacket> CreateServerRemoveAllCharactersPacket();
|
||||
std::unique_ptr<ServerPacket> CreateServerDzLocationPacket(uint16_t server_opcode, const DynamicZoneLocation& location);
|
||||
|
||||
uint32_t m_id = 0;
|
||||
uint32_t m_zone_id = 0;
|
||||
uint32_t m_instance_id = 0;
|
||||
uint32_t m_zone_version = 0;
|
||||
uint32_t m_min_players = 0;
|
||||
uint32_t m_max_players = 0;
|
||||
bool m_never_expires = false;
|
||||
bool m_has_zonein = false;
|
||||
std::string m_name;
|
||||
DynamicZoneMember m_leader;
|
||||
DynamicZoneType m_type{ DynamicZoneType::None };
|
||||
DynamicZoneLocation m_compass;
|
||||
DynamicZoneLocation m_safereturn;
|
||||
DynamicZoneLocation m_zonein;
|
||||
std::chrono::seconds m_duration;
|
||||
std::chrono::time_point<std::chrono::system_clock> m_start_time;
|
||||
std::chrono::time_point<std::chrono::system_clock> m_expire_time;
|
||||
std::vector<DynamicZoneMember> m_members;
|
||||
};
|
||||
|
||||
#endif
|
||||
+8
-5
@@ -136,20 +136,22 @@ N(OP_Dye),
|
||||
N(OP_DynamicWall),
|
||||
N(OP_DzAddPlayer),
|
||||
N(OP_DzChooseZone),
|
||||
N(OP_DzChooseZoneReply),
|
||||
N(OP_DzCompass),
|
||||
N(OP_DzExpeditionEndsWarning),
|
||||
N(OP_DzExpeditionInfo),
|
||||
N(OP_DzExpeditionList),
|
||||
N(OP_DzJoinExpeditionConfirm),
|
||||
N(OP_DzJoinExpeditionReply),
|
||||
N(OP_DzLeaderStatus),
|
||||
N(OP_DzExpeditionInvite),
|
||||
N(OP_DzExpeditionInviteResponse),
|
||||
N(OP_DzExpeditionLockoutTimers),
|
||||
N(OP_DzListTimers),
|
||||
N(OP_DzMakeLeader),
|
||||
N(OP_DzMemberList),
|
||||
N(OP_DzMemberStatus),
|
||||
N(OP_DzMemberListName),
|
||||
N(OP_DzMemberListStatus),
|
||||
N(OP_DzPlayerList),
|
||||
N(OP_DzQuit),
|
||||
N(OP_DzRemovePlayer),
|
||||
N(OP_DzSetLeaderName),
|
||||
N(OP_DzSwapPlayer),
|
||||
N(OP_Emote),
|
||||
N(OP_EndLootRequest),
|
||||
@@ -271,6 +273,7 @@ N(OP_ItemVerifyRequest),
|
||||
N(OP_ItemViewUnknown),
|
||||
N(OP_Jump),
|
||||
N(OP_KeyRing),
|
||||
N(OP_KickPlayers),
|
||||
N(OP_KnowledgeBase),
|
||||
N(OP_LDoNButton),
|
||||
N(OP_LDoNDisarmTraps),
|
||||
|
||||
@@ -438,6 +438,13 @@ static const uint8 SkillDamageTypes[EQ::skills::HIGHEST_SKILL + 1] = // change t
|
||||
|
||||
static const uint32 MAX_SPELL_DB_ID_VAL = 65535;
|
||||
|
||||
static const uint32 DB_SPELL_CAZIC_TOUCH = 982;
|
||||
static const uint32 DB_SPELL_TOUCH_OF_VINITRAS = 2859;
|
||||
|
||||
static const uint32 DB_FACTION_GEM_CHOPPERS = 255;
|
||||
static const uint32 DB_FACTION_HERETICS = 265;
|
||||
static const uint32 DB_FACTION_KING_AKANON = 333;
|
||||
|
||||
enum ChatChannelNames : uint16
|
||||
{
|
||||
ChatChannel_Guild = 0,
|
||||
@@ -464,4 +471,23 @@ namespace ZoneBlockedSpellTypes {
|
||||
const uint8 Region = 2;
|
||||
};
|
||||
|
||||
enum class DynamicZoneType
|
||||
{
|
||||
None = 0,
|
||||
Expedition,
|
||||
Tutorial,
|
||||
Task,
|
||||
Mission, // Shared Task
|
||||
Quest
|
||||
};
|
||||
|
||||
enum class DynamicZoneMemberStatus : uint8_t
|
||||
{
|
||||
Unknown = 0,
|
||||
Online,
|
||||
Offline,
|
||||
InDynamicZone,
|
||||
LinkDead
|
||||
};
|
||||
|
||||
#endif /*COMMON_EQ_CONSTANTS_H*/
|
||||
|
||||
@@ -794,7 +794,7 @@ void EQ::inventory::InitializeDynamicLookups() {
|
||||
continue;
|
||||
|
||||
// direct manipulation of lookup indices is safe so long as (int)ClientVersion::<mob> == (int)MobVersion::<mob>
|
||||
inventory_dynamic_nongm_lookup_entries[iter] = std::unique_ptr<LookupEntry>(new LookupEntry(inventory_static_lookup_entries[iter]));
|
||||
inventory_dynamic_nongm_lookup_entries[iter] = std::make_unique<LookupEntry>(inventory_static_lookup_entries[iter]);
|
||||
|
||||
// clamp affected fields to the lowest standard
|
||||
inventory_dynamic_nongm_lookup_entries[iter]->InventoryTypeSize.Bank = Titanium::invtype::BANK_SIZE; // bank size
|
||||
@@ -864,7 +864,7 @@ void EQ::inventory::InitializeDynamicLookups() {
|
||||
}
|
||||
|
||||
// direct manipulation of lookup indices is safe so long as (int)ClientVersion::<client> == (int)MobVersion::<client>
|
||||
inventory_dynamic_gm_lookup_entries[iter] = std::unique_ptr<LookupEntry>(new LookupEntry(inventory_static_lookup_entries[iter]));
|
||||
inventory_dynamic_gm_lookup_entries[iter] = std::make_unique<LookupEntry>(inventory_static_lookup_entries[iter]);
|
||||
|
||||
inventory_dynamic_gm_lookup_entries[iter]->PossessionsBitmask = 0; // we'll fix later
|
||||
inventory_dynamic_gm_lookup_entries[iter]->CorpseBitmask = 0; // we'll fix later
|
||||
|
||||
+155
-49
@@ -375,13 +375,16 @@ struct NewZone_Struct {
|
||||
/*0686*/ uint16 zone_instance;
|
||||
/*0688*/ uint32 unknown688;
|
||||
/*0692*/ uint8 unknown692[8];
|
||||
// Titanium doesn't have a translator, but we can still safely add stuff under here without issues since client memcpy's only what it knows
|
||||
// Just wastes some bandwidth sending to tit clients /shrug
|
||||
/*0700*/ float fog_density;
|
||||
/*0704*/ uint32 SuspendBuffs;
|
||||
/*0708*/ uint32 FastRegenHP;
|
||||
/*0712*/ uint32 FastRegenMana;
|
||||
/*0716*/ uint32 FastRegenEndurance;
|
||||
/*0720*/ uint32 NPCAggroMaxDist;
|
||||
/*0724*/
|
||||
/*0724*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, if this value is 0, it prevents you from running off edges that would end up underworld
|
||||
/*0728*/
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -826,7 +829,7 @@ struct LeadershipAA_Struct {
|
||||
* Size: 20 Octets
|
||||
*/
|
||||
struct BindStruct {
|
||||
/*000*/ uint32 zoneId;
|
||||
/*000*/ uint32 zone_id;
|
||||
/*004*/ float x;
|
||||
/*008*/ float y;
|
||||
/*012*/ float z;
|
||||
@@ -1769,7 +1772,7 @@ struct GMZoneRequest_Struct {
|
||||
/*0068*/ float x;
|
||||
/*0072*/ float y;
|
||||
/*0076*/ float z;
|
||||
/*0080*/ char unknown0080[4];
|
||||
/*0080*/ float heading;
|
||||
/*0084*/ uint32 success; // 0 if command failed, 1 if succeeded?
|
||||
/*0088*/
|
||||
// /*072*/ int8 success; // =0 client->server, =1 server->client, -X=specific error
|
||||
@@ -3244,7 +3247,7 @@ struct TraderClick_Struct{
|
||||
};
|
||||
|
||||
struct FormattedMessage_Struct{
|
||||
uint32 unknown0;
|
||||
uint32 unknown0; // 1 means from world server
|
||||
uint32 string_id;
|
||||
uint32 type;
|
||||
char message[0];
|
||||
@@ -3252,7 +3255,7 @@ struct FormattedMessage_Struct{
|
||||
struct SimpleMessage_Struct{
|
||||
uint32 string_id;
|
||||
uint32 color;
|
||||
uint32 unknown8;
|
||||
uint32 unknown8; // 1 means from world server
|
||||
};
|
||||
|
||||
struct GuildMemberUpdate_Struct {
|
||||
@@ -4832,17 +4835,99 @@ struct BuffIcon_Struct
|
||||
BuffIconEntry_Struct entries[0];
|
||||
};
|
||||
|
||||
struct ExpeditionInfo_Struct
|
||||
struct ExpeditionInvite_Struct
|
||||
{
|
||||
/*000*/ uint32 max_players;
|
||||
/*004*/ char expedition_name[128];
|
||||
/*132*/ char leader_name[64];
|
||||
/*000*/ uint32 client_id; // unique character id
|
||||
/*004*/ uint32 unknown004; // added after titanium
|
||||
/*008*/ char inviter_name[64];
|
||||
/*072*/ char expedition_name[128];
|
||||
/*200*/ uint8 swapping; // 0: adding 1: swapping
|
||||
/*201*/ char swap_name[64]; // if swapping, swap name being removed
|
||||
/*265*/ uint8 padding[3];
|
||||
/*268*/ uint16 dz_zone_id; // dz_id zone/instance pair, sent back in reply
|
||||
/*270*/ uint16 dz_instance_id;
|
||||
};
|
||||
|
||||
struct ExpeditionJoinPrompt_Struct
|
||||
struct ExpeditionInviteResponse_Struct
|
||||
{
|
||||
/*000*/ char player_name[64];
|
||||
/*064*/ char expedition_name[64];
|
||||
/*000*/ uint32 unknown000;
|
||||
/*004*/ uint32 unknown004; // added after titanium
|
||||
/*008*/ uint16 dz_zone_id; // dz_id pair sent in invite
|
||||
/*010*/ uint16 dz_instance_id;
|
||||
/*012*/ uint8 accepted; // 0: declined 1: accepted
|
||||
/*013*/ uint8 swapping; // 0: adding 1: swapping (sent in invite)
|
||||
/*014*/ char swap_name[64]; // swap name sent in invite
|
||||
/*078*/ uint8 unknown078; // padding garbage?
|
||||
/*079*/ uint8 unknown079; // padding garbage?
|
||||
};
|
||||
|
||||
struct DynamicZoneInfo_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004; // added after titanium
|
||||
/*008*/ uint32 assigned; // padded bool, 0: clear info, 1: fill window info
|
||||
/*012*/ uint32 max_players;
|
||||
/*016*/ char dz_name[128];
|
||||
/*144*/ char leader_name[64];
|
||||
//*208*/ uint32 dz_type; // only in newer clients, if not 1 (expedition type) window does not auto show when dz info assigned
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberEntry_Struct
|
||||
{
|
||||
/*000*/ char name[64]; // variable length, null terminated, max 0x40 (64)
|
||||
/*064*/ uint8 online_status; // 0: unknown, 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberList_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 member_count;
|
||||
/*008*/ DynamicZoneMemberEntry_Struct members[0]; // variable length
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberListName_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ uint32 add_name; // padded bool, 0: remove name, 1: add name with unknown status
|
||||
/*012*/ char name[64];
|
||||
};
|
||||
|
||||
struct ExpeditionLockoutTimerEntry_Struct
|
||||
{
|
||||
/*000*/ char expedition_name[128]; // variable length, null terminated, max 0x80 (128)
|
||||
/*000*/ uint32 seconds_remaining;
|
||||
/*000*/ int32 event_type; // seen -1 (0xffffffff) for replay timers and 1 for event timers
|
||||
/*000*/ char event_name[256]; // variable length, null terminated, max 0x100 (256)
|
||||
};
|
||||
|
||||
struct ExpeditionLockoutTimers_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 count;
|
||||
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
|
||||
};
|
||||
|
||||
struct DynamicZoneLeaderName_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ char leader_name[64];
|
||||
};
|
||||
|
||||
struct ExpeditionCommand_Struct
|
||||
{
|
||||
/*000*/ uint32 unknown000;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ char name[64];
|
||||
};
|
||||
|
||||
struct ExpeditionCommandSwap_Struct
|
||||
{
|
||||
/*000*/ uint32 unknown000;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ char add_player_name[64]; // swap to (player must confirm)
|
||||
/*072*/ char rem_player_name[64]; // swap from
|
||||
};
|
||||
|
||||
struct ExpeditionExpireWarning
|
||||
@@ -4850,48 +4935,67 @@ struct ExpeditionExpireWarning
|
||||
/*008*/ uint32 minutes_remaining;
|
||||
};
|
||||
|
||||
struct ExpeditionCompassEntry_Struct
|
||||
struct DynamicZoneCompassEntry_Struct
|
||||
{
|
||||
/*000*/ uint32 enabled; //guess
|
||||
/*004*/ float y;
|
||||
/*008*/ float x;
|
||||
/*012*/ float z;
|
||||
/*000*/ uint16 dz_zone_id; // target dz id pair
|
||||
/*002*/ uint16 dz_instance_id;
|
||||
/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
|
||||
/*008*/ uint32 unknown008;
|
||||
/*012*/ float y;
|
||||
/*016*/ float x;
|
||||
/*020*/ float z;
|
||||
};
|
||||
|
||||
struct ExpeditionCompass_Struct
|
||||
struct DynamicZoneCompass_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*000*/ uint32 count;
|
||||
/*004*/ ExpeditionCompassEntry_Struct entries[0];
|
||||
/*004*/ DynamicZoneCompassEntry_Struct entries[0];
|
||||
};
|
||||
|
||||
struct ExpeditionMemberEntry_Struct
|
||||
struct DynamicZoneChooseZoneEntry_Struct
|
||||
{
|
||||
char name[64];
|
||||
char status;
|
||||
/*000*/ uint16 dz_zone_id; // dz_id pair
|
||||
/*002*/ uint16 dz_instance_id;
|
||||
/*004*/ uint32 unknown_id1; // seen 28 00 00 00 (40), sent back in reply
|
||||
/*008*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest -- sent back in reply
|
||||
/*012*/ uint32 unknown_id2; // possibly an id based on dz type, for expeditions this was same as dz_id (zone|instance) but task dz was different
|
||||
/*016*/ char description[128]; // variable length, null terminated
|
||||
/*144*/ char leader_name[64]; // variable length, null terminated
|
||||
};
|
||||
|
||||
struct ExpeditionMemberList_Struct
|
||||
struct DynamicZoneChooseZone_Struct
|
||||
{
|
||||
/*000*/ uint32 count;
|
||||
/*004*/ ExpeditionMemberEntry_Struct entries[0];
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 count;
|
||||
/*008*/ DynamicZoneChooseZoneEntry_Struct choices[0];
|
||||
};
|
||||
|
||||
struct ExpeditionLockoutEntry_Struct
|
||||
struct DynamicZoneChooseZoneReply_Struct
|
||||
{
|
||||
/*000*/ uint32 time_left;
|
||||
/*004*/ char expedition[128];
|
||||
/*132*/ char expedition_event[128];
|
||||
/*000*/ uint32 unknown000; // ff ff ff ff
|
||||
/*004*/ uint32 unknown004; // seen 69 00 00 00
|
||||
/*008*/ uint32 unknown008; // ff ff ff ff
|
||||
/*012*/ uint32 unknown_id1; // from choose zone entry message
|
||||
/*016*/ uint16 dz_zone_id; // dz_id pair
|
||||
/*018*/ uint16 dz_instance_id;
|
||||
/*020*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest
|
||||
/*024*/ uint32 unknown_id2; // from choose zone entry message
|
||||
/*028*/ uint32 unknown028; // 00 00 00 00
|
||||
/*032*/ uint32 unknown032; // always same as unknown044
|
||||
/*036*/ uint32 unknown036;
|
||||
/*040*/ uint32 unknown040;
|
||||
/*044*/ uint32 unknown044; // always same as unknown032
|
||||
/*048*/ uint32 unknown048; // seen 01 00 00 00 and 02 00 00 00
|
||||
};
|
||||
|
||||
struct ExpeditionLockoutList_Struct
|
||||
struct KickPlayers_Struct
|
||||
{
|
||||
/*000*/ uint32 count;
|
||||
/*004*/ ExpeditionLockoutEntry_Struct entries[0];
|
||||
};
|
||||
|
||||
struct ExpeditionLeaderSet_Struct
|
||||
{
|
||||
/*000*/ char leader_name[64];
|
||||
/*000*/ char char_name[64];
|
||||
/*064*/ uint32 unknown064; // always 0
|
||||
/*068*/ uint8 kick_expedition; // true if /kickplayers exp
|
||||
/*069*/ uint8 kick_task; // true if /kickplayers task
|
||||
/*070*/ uint8 padding[2];
|
||||
};
|
||||
|
||||
struct CorpseDrag_Struct
|
||||
@@ -5341,18 +5445,20 @@ struct MercenaryMerchantResponse_Struct {
|
||||
|
||||
struct ServerLootItem_Struct {
|
||||
uint32 item_id; // uint32 item_id;
|
||||
int16 equip_slot; // int16 equip_slot;
|
||||
uint16 charges; // uint8 charges;
|
||||
uint16 lootslot; // uint16 lootslot;
|
||||
uint32 aug_1; // uint32 aug_1;
|
||||
uint32 aug_2; // uint32 aug_2;
|
||||
uint32 aug_3; // uint32 aug_3;
|
||||
uint32 aug_4; // uint32 aug_4;
|
||||
uint32 aug_5; // uint32 aug_5;
|
||||
uint32 aug_6; // uint32 aug_5;
|
||||
uint8 attuned;
|
||||
uint8 min_level;
|
||||
uint8 max_level;
|
||||
int16 equip_slot; // int16 equip_slot;
|
||||
uint16 charges; // uint8 charges;
|
||||
uint16 lootslot; // uint16 lootslot;
|
||||
uint32 aug_1; // uint32 aug_1;
|
||||
uint32 aug_2; // uint32 aug_2;
|
||||
uint32 aug_3; // uint32 aug_3;
|
||||
uint32 aug_4; // uint32 aug_4;
|
||||
uint32 aug_5; // uint32 aug_5;
|
||||
uint32 aug_6; // uint32 aug_5;
|
||||
uint8 attuned;
|
||||
uint16 trivial_min_level;
|
||||
uint16 trivial_max_level;
|
||||
uint16 npc_min_level;
|
||||
uint16 npc_max_level;
|
||||
};
|
||||
|
||||
//Found in client near a ref to the string:
|
||||
|
||||
@@ -104,6 +104,15 @@ void EQEmuConfig::parse_config()
|
||||
DatabasePort = atoi(_root["server"]["database"].get("port", "3306").asString().c_str());
|
||||
DatabaseDB = _root["server"]["database"].get("db", "eq").asString();
|
||||
|
||||
/**
|
||||
* Content Database
|
||||
*/
|
||||
ContentDbUsername = _root["server"]["content_database"].get("username", "").asString();
|
||||
ContentDbPassword = _root["server"]["content_database"].get("password", "").asString();
|
||||
ContentDbHost = _root["server"]["content_database"].get("host", "").asString();
|
||||
ContentDbPort = atoi(_root["server"]["content_database"].get("port", 0).asString().c_str());
|
||||
ContentDbName = _root["server"]["content_database"].get("db", "").asString();
|
||||
|
||||
/**
|
||||
* QS
|
||||
*/
|
||||
|
||||
@@ -74,6 +74,13 @@ class EQEmuConfig
|
||||
std::string DatabaseDB;
|
||||
uint16 DatabasePort;
|
||||
|
||||
// From <content_database/>
|
||||
std::string ContentDbHost;
|
||||
std::string ContentDbUsername;
|
||||
std::string ContentDbPassword;
|
||||
std::string ContentDbName;
|
||||
uint16 ContentDbPort;
|
||||
|
||||
// From <qsdatabase> // QueryServ
|
||||
std::string QSDatabaseHost;
|
||||
std::string QSDatabaseUsername;
|
||||
|
||||
@@ -126,6 +126,8 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
|
||||
log_settings[Logs::NPCScaling].log_to_gmsay = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::HotReload].log_to_gmsay = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::HotReload].log_to_console = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::Loot].log_to_gmsay = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::Scheduler].log_to_console = static_cast<uint8>(Logs::General);
|
||||
|
||||
/**
|
||||
* RFC 5424
|
||||
@@ -205,11 +207,7 @@ std::string EQEmuLogSys::FormatOutMessageString(
|
||||
const std::string &in_message
|
||||
)
|
||||
{
|
||||
std::string return_string;
|
||||
|
||||
if (IsRfc5424LogCategory(log_category)) {
|
||||
return_string = "[" + GetPlatformName() + "] ";
|
||||
}
|
||||
std::string return_string = "[" + GetPlatformName() + "] ";
|
||||
|
||||
return return_string + "[" + Logs::LogCategoryName[log_category] + "] " + in_message;
|
||||
}
|
||||
|
||||
@@ -115,6 +115,12 @@ namespace Logs {
|
||||
Flee,
|
||||
Aura,
|
||||
HotReload,
|
||||
Merchants,
|
||||
ZonePoints,
|
||||
Loot,
|
||||
Expeditions,
|
||||
DynamicZones,
|
||||
Scheduler,
|
||||
MaxCategoryID /* Don't Remove this */
|
||||
};
|
||||
|
||||
@@ -189,6 +195,12 @@ namespace Logs {
|
||||
"Flee",
|
||||
"Aura",
|
||||
"HotReload",
|
||||
"Merchants",
|
||||
"ZonePoints",
|
||||
"Loot",
|
||||
"Expeditions",
|
||||
"DynamicZones",
|
||||
"Scheduler",
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -161,6 +161,16 @@
|
||||
OutF(LogSys, Logs::Detail, Logs::Doors, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogGroup(message, ...) do {\
|
||||
if (LogSys.log_settings[Logs::Group].is_category_enabled == 1)\
|
||||
OutF(LogSys, Logs::General, Logs::Group, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogGroupDetail(message, ...) do {\
|
||||
if (LogSys.log_settings[Logs::Group].is_category_enabled == 1)\
|
||||
OutF(LogSys, Logs::Detail, Logs::Group, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogGuilds(message, ...) do {\
|
||||
if (LogSys.log_settings[Logs::Guilds].is_category_enabled == 1)\
|
||||
OutF(LogSys, Logs::General, Logs::Guilds, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
@@ -571,6 +581,71 @@
|
||||
OutF(LogSys, Logs::Detail, Logs::HotReload, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogMerchants(message, ...) do {\
|
||||
if (LogSys.log_settings[Logs::Merchants].is_category_enabled == 1)\
|
||||
OutF(LogSys, Logs::General, Logs::Merchants, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogMerchantsDetail(message, ...) do {\
|
||||
if (LogSys.log_settings[Logs::Merchants].is_category_enabled == 1)\
|
||||
OutF(LogSys, Logs::Detail, Logs::Merchants, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogZonePoints(message, ...) do {\
|
||||
if (LogSys.log_settings[Logs::ZonePoints].is_category_enabled == 1)\
|
||||
OutF(LogSys, Logs::General, Logs::ZonePoints, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogZonePointsDetail(message, ...) do {\
|
||||
if (LogSys.log_settings[Logs::ZonePoints].is_category_enabled == 1)\
|
||||
OutF(LogSys, Logs::Detail, Logs::ZonePoints, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogLoot(message, ...) do {\
|
||||
if (LogSys.log_settings[Logs::Loot].is_category_enabled == 1)\
|
||||
OutF(LogSys, Logs::General, Logs::Loot, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogLootDetail(message, ...) do {\
|
||||
if (LogSys.log_settings[Logs::Loot].is_category_enabled == 1)\
|
||||
OutF(LogSys, Logs::Detail, Logs::Loot, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogExpeditions(message, ...) do {\
|
||||
if (LogSys.log_settings[Logs::Expeditions].is_category_enabled == 1)\
|
||||
OutF(LogSys, Logs::General, Logs::Expeditions, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogExpeditionsModerate(message, ...) do {\
|
||||
if (LogSys.log_settings[Logs::Expeditions].is_category_enabled == 1)\
|
||||
OutF(LogSys, Logs::Moderate, Logs::Expeditions, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogExpeditionsDetail(message, ...) do {\
|
||||
if (LogSys.log_settings[Logs::Expeditions].is_category_enabled == 1)\
|
||||
OutF(LogSys, Logs::Detail, Logs::Expeditions, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogDynamicZones(message, ...) do {\
|
||||
if (LogSys.log_settings[Logs::DynamicZones].is_category_enabled == 1)\
|
||||
OutF(LogSys, Logs::General, Logs::DynamicZones, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogDynamicZonesDetail(message, ...) do {\
|
||||
if (LogSys.log_settings[Logs::DynamicZones].is_category_enabled == 1)\
|
||||
OutF(LogSys, Logs::Detail, Logs::DynamicZones, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogScheduler(message, ...) do {\
|
||||
if (LogSys.log_settings[Logs::Scheduler].is_category_enabled == 1)\
|
||||
OutF(LogSys, Logs::General, Logs::Scheduler, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogSchedulerDetail(message, ...) do {\
|
||||
if (LogSys.log_settings[Logs::Scheduler].is_category_enabled == 1)\
|
||||
OutF(LogSys, Logs::Detail, Logs::Scheduler, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define Log(debug_level, log_category, message, ...) do {\
|
||||
if (LogSys.log_settings[log_category].is_category_enabled == 1)\
|
||||
LogSys.Out(debug_level, log_category, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
@@ -664,6 +739,12 @@
|
||||
#define LogDoorsDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogGroup(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogGroupDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogGuilds(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
@@ -910,6 +991,33 @@
|
||||
#define LogHotReloadDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogMerchants(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogMerchantsDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogZonePoints(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogZonePointsDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogExpeditions(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogExpeditionsModerate(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogExpeditionsDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogDynamicZones(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogDynamicZonesDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define Log(debug_level, log_category, message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
@@ -917,4 +1025,4 @@
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#endif //EQEMU_EQEMU_LOGSYS_LOG_ALIASES_H
|
||||
#endif //EQEMU_EQEMU_LOGSYS_LOG_ALIASES_H
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace EQ {
|
||||
void Stop() {
|
||||
if (m_timer) {
|
||||
uv_close((uv_handle_t*)m_timer, [](uv_handle_t* handle) {
|
||||
delete handle;
|
||||
delete (uv_timer_t *)handle;
|
||||
});
|
||||
m_timer = nullptr;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
#include "expedition_base.h"
|
||||
#include "repositories/expeditions_repository.h"
|
||||
|
||||
ExpeditionBase::ExpeditionBase(uint32_t id, const std::string& uuid,
|
||||
const std::string& expedition_name, const DynamicZoneMember& leader
|
||||
) :
|
||||
m_id(id),
|
||||
m_uuid(uuid),
|
||||
m_expedition_name(expedition_name),
|
||||
m_leader(leader)
|
||||
{
|
||||
}
|
||||
|
||||
void ExpeditionBase::LoadRepositoryResult(ExpeditionsRepository::ExpeditionWithLeader&& entry)
|
||||
{
|
||||
m_id = entry.id;
|
||||
m_uuid = std::move(entry.uuid);
|
||||
m_expedition_name = std::move(entry.expedition_name);
|
||||
m_add_replay_on_join = entry.add_replay_on_join;
|
||||
m_is_locked = entry.is_locked;
|
||||
m_leader.id = entry.leader_id;
|
||||
m_leader.name = std::move(entry.leader_name);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
#ifndef COMMON_EXPEDITION_BASE_H
|
||||
#define COMMON_EXPEDITION_BASE_H
|
||||
|
||||
#include "dynamic_zone_base.h"
|
||||
#include "repositories/expeditions_repository.h"
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
class ExpeditionBase
|
||||
{
|
||||
public:
|
||||
virtual ~ExpeditionBase() = default;
|
||||
ExpeditionBase(const ExpeditionBase&) = default;
|
||||
ExpeditionBase(ExpeditionBase&&) = default;
|
||||
ExpeditionBase& operator=(const ExpeditionBase&) = default;
|
||||
ExpeditionBase& operator=(ExpeditionBase&&) = default;
|
||||
|
||||
uint32_t GetID() const { return m_id; }
|
||||
uint32_t GetLeaderID() const { return m_leader.id; }
|
||||
const std::string& GetName() const { return m_expedition_name; }
|
||||
const std::string& GetLeaderName() const { return m_leader.name; }
|
||||
const std::string& GetUUID() const { return m_uuid; }
|
||||
const DynamicZoneMember& GetLeader() const { return m_leader; }
|
||||
|
||||
void LoadRepositoryResult(ExpeditionsRepository::ExpeditionWithLeader&& entry);
|
||||
|
||||
protected:
|
||||
ExpeditionBase() = default;
|
||||
ExpeditionBase(uint32_t id, const std::string& uuid, const std::string& expedition_name,
|
||||
const DynamicZoneMember& leader);
|
||||
|
||||
uint32_t m_id = 0;
|
||||
bool m_is_locked = false;
|
||||
bool m_add_replay_on_join = true;
|
||||
std::string m_uuid;
|
||||
std::string m_expedition_name;
|
||||
DynamicZoneMember m_leader;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,101 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
* are required to give you total support for your newly bought product;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include "expedition_lockout_timer.h"
|
||||
#include "../common/string_util.h"
|
||||
#include "../common/rulesys.h"
|
||||
#include "../common/util/uuid.h"
|
||||
#include <fmt/format.h>
|
||||
|
||||
const char* const DZ_REPLAY_TIMER_NAME = "Replay Timer"; // see December 14, 2016 patch notes
|
||||
|
||||
ExpeditionLockoutTimer::ExpeditionLockoutTimer(
|
||||
std::string expedition_uuid, std::string expedition_name,
|
||||
std::string event_name, uint64_t expire_time, uint32_t duration
|
||||
) :
|
||||
m_expedition_uuid{std::move(expedition_uuid)},
|
||||
m_expedition_name{std::move(expedition_name)},
|
||||
m_event_name{std::move(event_name)},
|
||||
m_expire_time(std::chrono::system_clock::from_time_t(expire_time)),
|
||||
m_duration(duration)
|
||||
{
|
||||
if (m_event_name == DZ_REPLAY_TIMER_NAME)
|
||||
{
|
||||
m_is_replay_timer = true;
|
||||
}
|
||||
}
|
||||
|
||||
ExpeditionLockoutTimer ExpeditionLockoutTimer::CreateLockout(
|
||||
const std::string& expedition_name, const std::string& event_name, uint32_t seconds, std::string uuid)
|
||||
{
|
||||
seconds = static_cast<uint32_t>(seconds * RuleR(Expedition, LockoutDurationMultiplier));
|
||||
|
||||
if (uuid.empty())
|
||||
{
|
||||
uuid = EQ::Util::UUID::Generate().ToString();
|
||||
}
|
||||
|
||||
ExpeditionLockoutTimer lockout{uuid, expedition_name, event_name, 0, seconds};
|
||||
lockout.Reset(); // sets expire time
|
||||
return lockout;
|
||||
}
|
||||
|
||||
uint32_t ExpeditionLockoutTimer::GetSecondsRemaining() const
|
||||
{
|
||||
auto now = std::chrono::system_clock::now();
|
||||
if (m_expire_time > now)
|
||||
{
|
||||
auto remaining = m_expire_time - now;
|
||||
return static_cast<uint32_t>(std::chrono::duration_cast<std::chrono::seconds>(remaining).count());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
ExpeditionLockoutTimer::DaysHoursMinutes ExpeditionLockoutTimer::GetDaysHoursMinutesRemaining() const
|
||||
{
|
||||
auto seconds = GetSecondsRemaining();
|
||||
return ExpeditionLockoutTimer::DaysHoursMinutes{
|
||||
fmt::format_int(seconds / 86400).str(), // days
|
||||
fmt::format_int((seconds / 3600) % 24).str(), // hours
|
||||
fmt::format_int((seconds / 60) % 60).str() // minutes
|
||||
};
|
||||
}
|
||||
|
||||
bool ExpeditionLockoutTimer::IsSameLockout(const ExpeditionLockoutTimer& compare_lockout) const
|
||||
{
|
||||
return compare_lockout.IsSameLockout(GetExpeditionName(), GetEventName());
|
||||
}
|
||||
|
||||
bool ExpeditionLockoutTimer::IsSameLockout(
|
||||
const std::string& expedition_name, const std::string& event_name) const
|
||||
{
|
||||
return GetExpeditionName() == expedition_name && GetEventName() == event_name;
|
||||
}
|
||||
|
||||
void ExpeditionLockoutTimer::AddLockoutTime(int seconds)
|
||||
{
|
||||
seconds = static_cast<uint32_t>(seconds * RuleR(Expedition, LockoutDurationMultiplier));
|
||||
|
||||
auto new_duration = std::max(0, static_cast<int>(m_duration.count()) + seconds);
|
||||
|
||||
auto start_time = m_expire_time - m_duration;
|
||||
m_duration = std::chrono::seconds(new_duration);
|
||||
m_expire_time = start_time + m_duration;
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
* are required to give you total support for your newly bought product;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EXPEDITION_LOCKOUT_TIMER_H
|
||||
#define EXPEDITION_LOCKOUT_TIMER_H
|
||||
|
||||
#include <chrono>
|
||||
#include <string>
|
||||
|
||||
extern const char* const DZ_REPLAY_TIMER_NAME;
|
||||
|
||||
class ExpeditionLockoutTimer
|
||||
{
|
||||
public:
|
||||
ExpeditionLockoutTimer() = default;
|
||||
ExpeditionLockoutTimer(
|
||||
std::string expedition_uuid, std::string expedition_name,
|
||||
std::string event_name, uint64_t expire_time, uint32_t duration);
|
||||
|
||||
static ExpeditionLockoutTimer CreateLockout(
|
||||
const std::string& expedition_name, const std::string& event_name,
|
||||
uint32_t seconds, std::string uuid = {});
|
||||
|
||||
struct DaysHoursMinutes
|
||||
{
|
||||
std::string days;
|
||||
std::string hours;
|
||||
std::string mins;
|
||||
};
|
||||
|
||||
void AddLockoutTime(int seconds);
|
||||
uint32_t GetDuration() const { return static_cast<uint32_t>(m_duration.count()); }
|
||||
uint64_t GetExpireTime() const { return std::chrono::system_clock::to_time_t(m_expire_time); }
|
||||
uint64_t GetStartTime() const { return std::chrono::system_clock::to_time_t(m_expire_time - m_duration); }
|
||||
uint32_t GetSecondsRemaining() const;
|
||||
DaysHoursMinutes GetDaysHoursMinutesRemaining() const;
|
||||
const std::string& GetExpeditionName() const { return m_expedition_name; }
|
||||
const std::string& GetExpeditionUUID() const { return m_expedition_uuid; }
|
||||
const std::string& GetEventName() const { return m_event_name; }
|
||||
bool IsExpired() const { return GetSecondsRemaining() == 0; }
|
||||
bool IsFromExpedition(const std::string& uuid) const { return uuid == m_expedition_uuid; }
|
||||
bool IsReplayTimer() const { return m_is_replay_timer; }
|
||||
bool IsSameLockout(const ExpeditionLockoutTimer& compare_lockout) const;
|
||||
bool IsSameLockout(const std::string& expedition_name, const std::string& event_name) const;
|
||||
void Reset() { m_expire_time = std::chrono::system_clock::now() + m_duration; }
|
||||
void SetDuration(uint32_t seconds) { m_duration = std::chrono::seconds(seconds); }
|
||||
void SetExpireTime(uint64_t expire_time) { m_expire_time = std::chrono::system_clock::from_time_t(expire_time); }
|
||||
void SetUUID(const std::string& uuid) { m_expedition_uuid = uuid; }
|
||||
|
||||
private:
|
||||
bool m_is_replay_timer = false;
|
||||
std::string m_expedition_uuid; // expedition received in
|
||||
std::string m_expedition_name;
|
||||
std::string m_event_name;
|
||||
std::chrono::seconds m_duration;
|
||||
std::chrono::time_point<std::chrono::system_clock> m_expire_time;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -61,7 +61,7 @@ class SharedDatabase;
|
||||
namespace EQ
|
||||
{
|
||||
class InventoryProfile;
|
||||
|
||||
|
||||
class ItemInstance {
|
||||
public:
|
||||
/////////////////////////
|
||||
|
||||
+9
-7
@@ -39,13 +39,15 @@ struct LootTable_Struct {
|
||||
};
|
||||
|
||||
struct LootDropEntries_Struct {
|
||||
uint32 item_id;
|
||||
int8 item_charges;
|
||||
uint8 equip_item;
|
||||
float chance;
|
||||
uint8 minlevel;
|
||||
uint8 maxlevel;
|
||||
uint8 multiplier;
|
||||
uint32 item_id;
|
||||
int8 item_charges;
|
||||
uint8 equip_item;
|
||||
float chance;
|
||||
uint16 trivial_min_level;
|
||||
uint16 trivial_max_level;
|
||||
uint16 npc_min_level;
|
||||
uint16 npc_max_level;
|
||||
uint8 multiplier;
|
||||
};
|
||||
|
||||
struct LootDrop_Struct {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
EQ::Net::ConsoleServer::ConsoleServer(const std::string &addr, int port)
|
||||
{
|
||||
m_server.reset(new EQ::Net::TCPServer());
|
||||
m_server = std::make_unique<EQ::Net::TCPServer>();
|
||||
m_server->Listen(addr, port, false, [this](std::shared_ptr<EQ::Net::TCPConnection> connection) {
|
||||
ConsoleServerConnection *c = new ConsoleServerConnection(this, connection);
|
||||
m_connections.insert(std::make_pair(c->GetUUID(), std::unique_ptr<ConsoleServerConnection>(c)));
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "../eqemu_logsys.h"
|
||||
|
||||
EQ::Net::ServertalkClient::ServertalkClient(const std::string &addr, int port, bool ipv6, const std::string &identifier, const std::string &credentials)
|
||||
: m_timer(std::unique_ptr<EQ::Timer>(new EQ::Timer(100, true, std::bind(&EQ::Net::ServertalkClient::Connect, this))))
|
||||
: m_timer(std::make_unique<EQ::Timer>(100, true, std::bind(&EQ::Net::ServertalkClient::Connect, this)))
|
||||
{
|
||||
m_port = port;
|
||||
m_ipv6 = ipv6;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "../eqemu_logsys.h"
|
||||
|
||||
EQ::Net::ServertalkLegacyClient::ServertalkLegacyClient(const std::string &addr, int port, bool ipv6)
|
||||
: m_timer(std::unique_ptr<EQ::Timer>(new EQ::Timer(100, true, std::bind(&EQ::Net::ServertalkLegacyClient::Connect, this))))
|
||||
: m_timer(std::make_unique<EQ::Timer>(100, true, std::bind(&EQ::Net::ServertalkLegacyClient::Connect, this)))
|
||||
{
|
||||
m_port = port;
|
||||
m_ipv6 = ipv6;
|
||||
|
||||
@@ -13,7 +13,7 @@ void EQ::Net::ServertalkServer::Listen(const ServertalkServerOptions& opts)
|
||||
m_encrypted = opts.encrypted;
|
||||
m_credentials = opts.credentials;
|
||||
m_allow_downgrade = opts.allow_downgrade;
|
||||
m_server.reset(new EQ::Net::TCPServer());
|
||||
m_server = std::make_unique<EQ::Net::TCPServer>();
|
||||
m_server->Listen(opts.port, opts.ipv6, [this](std::shared_ptr<EQ::Net::TCPConnection> connection) {
|
||||
m_unident_connections.push_back(std::make_shared<ServertalkServerConnection>(connection, this, m_encrypted, m_allow_downgrade));
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "../event/event_loop.h"
|
||||
|
||||
void on_close_handle(uv_handle_t* handle) {
|
||||
delete handle;
|
||||
delete (uv_tcp_t *)handle;
|
||||
}
|
||||
|
||||
EQ::Net::TCPConnection::TCPConnection(uv_tcp_t *socket)
|
||||
@@ -115,7 +115,7 @@ void EQ::Net::TCPConnection::Disconnect()
|
||||
connection->m_on_disconnect_cb(connection);
|
||||
}
|
||||
|
||||
delete handle;
|
||||
delete (uv_tcp_t *)handle;
|
||||
});
|
||||
m_socket = nullptr;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "../event/event_loop.h"
|
||||
|
||||
void on_close_tcp_server_handle(uv_handle_t* handle) {
|
||||
delete handle;
|
||||
delete (uv_tcp_t *)handle;
|
||||
}
|
||||
|
||||
EQ::Net::TCPServer::TCPServer()
|
||||
|
||||
@@ -34,8 +34,8 @@ struct EQ::Net::WebsocketServer::Impl
|
||||
|
||||
EQ::Net::WebsocketServer::WebsocketServer(const std::string &addr, int port)
|
||||
{
|
||||
_impl.reset(new Impl());
|
||||
_impl->server.reset(new EQ::Net::TCPServer());
|
||||
_impl = std::make_unique<Impl>();
|
||||
_impl->server = std::make_unique<EQ::Net::TCPServer>();
|
||||
_impl->server->Listen(addr, port, false, [this](std::shared_ptr<EQ::Net::TCPConnection> connection) {
|
||||
auto wsc = _impl->ws_server.get_connection();
|
||||
WebsocketServerConnection *c = new WebsocketServerConnection(this, connection, wsc);
|
||||
@@ -53,7 +53,7 @@ EQ::Net::WebsocketServer::WebsocketServer(const std::string &addr, int port)
|
||||
return websocketpp::lib::error_code();
|
||||
});
|
||||
|
||||
_impl->ping_timer.reset(new EQ::Timer(5000, true, [this](EQ::Timer *t) {
|
||||
_impl->ping_timer = std::make_unique<EQ::Timer>(5000, true, [this](EQ::Timer *t) {
|
||||
auto iter = _impl->connections.begin();
|
||||
|
||||
while (iter != _impl->connections.end()) {
|
||||
@@ -67,7 +67,7 @@ EQ::Net::WebsocketServer::WebsocketServer(const std::string &addr, int port)
|
||||
|
||||
iter++;
|
||||
}
|
||||
}));
|
||||
});
|
||||
|
||||
_impl->methods.insert(std::make_pair("login", MethodHandlerEntry(std::bind(&WebsocketServer::Login, this, std::placeholders::_1, std::placeholders::_2), 0)));
|
||||
_impl->methods.insert(std::make_pair("subscribe", MethodHandlerEntry(std::bind(&WebsocketServer::Subscribe, this, std::placeholders::_1, std::placeholders::_2), 0)));
|
||||
|
||||
@@ -20,7 +20,7 @@ EQ::Net::WebsocketServerConnection::WebsocketServerConnection(WebsocketServer *p
|
||||
std::shared_ptr<TCPConnection> connection,
|
||||
std::shared_ptr<websocket_connection> ws_connection)
|
||||
{
|
||||
_impl.reset(new Impl());
|
||||
_impl = std::make_unique<Impl>();
|
||||
_impl->parent = parent;
|
||||
_impl->connection = connection;
|
||||
_impl->id = EQ::Util::UUID::Generate().ToString();
|
||||
|
||||
+183
-75
@@ -710,15 +710,48 @@ namespace RoF
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzChooseZone)
|
||||
{
|
||||
SETUP_VAR_ENCODE(DynamicZoneChooseZone_Struct);
|
||||
|
||||
SerializeBuffer buf;
|
||||
buf.WriteUInt32(emu->client_id);
|
||||
buf.WriteUInt32(emu->count);
|
||||
|
||||
for (uint32 i = 0; i < emu->count; ++i)
|
||||
{
|
||||
buf.WriteUInt16(emu->choices[i].dz_zone_id);
|
||||
buf.WriteUInt16(emu->choices[i].dz_instance_id);
|
||||
buf.WriteUInt32(emu->choices[i].unknown_id1);
|
||||
buf.WriteUInt32(emu->choices[i].dz_type);
|
||||
buf.WriteUInt32(emu->choices[i].unknown_id2);
|
||||
buf.WriteString(emu->choices[i].description);
|
||||
buf.WriteString(emu->choices[i].leader_name);
|
||||
}
|
||||
|
||||
__packet->size = buf.size();
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzCompass)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionCompass_Struct);
|
||||
ALLOC_VAR_ENCODE(structs::ExpeditionCompass_Struct, sizeof(structs::ExpeditionInfo_Struct) + sizeof(structs::ExpeditionCompassEntry_Struct) * emu->count);
|
||||
SETUP_VAR_ENCODE(DynamicZoneCompass_Struct);
|
||||
ALLOC_VAR_ENCODE(structs::DynamicZoneCompass_Struct,
|
||||
sizeof(structs::DynamicZoneCompass_Struct) +
|
||||
sizeof(structs::DynamicZoneCompassEntry_Struct) * emu->count
|
||||
);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(count);
|
||||
|
||||
for (uint32 i = 0; i < emu->count; ++i)
|
||||
{
|
||||
OUT(entries[i].dz_zone_id);
|
||||
OUT(entries[i].dz_instance_id);
|
||||
OUT(entries[i].dz_type);
|
||||
OUT(entries[i].x);
|
||||
OUT(entries[i].y);
|
||||
OUT(entries[i].z);
|
||||
@@ -739,112 +772,108 @@ namespace RoF
|
||||
|
||||
ENCODE(OP_DzExpeditionInfo)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneInfo_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneInfo_Struct, structs::DynamicZoneInfo_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(assigned);
|
||||
OUT(max_players);
|
||||
eq->unknown004 = 785316192;
|
||||
eq->unknown008 = 435601;
|
||||
strncpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
|
||||
strncpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
|
||||
strn0cpy(eq->dz_name, emu->dz_name, sizeof(eq->dz_name));
|
||||
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzExpeditionList)
|
||||
ENCODE(OP_DzExpeditionInvite)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionLockoutList_Struct);
|
||||
ENCODE_LENGTH_EXACT(ExpeditionInvite_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionInvite_Struct, structs::ExpeditionInvite_Struct);
|
||||
|
||||
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
||||
uint32 client_id = 0;
|
||||
uint8 null_term = 0;
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&emu->count, sizeof(uint32));
|
||||
OUT(client_id);
|
||||
strn0cpy(eq->inviter_name, emu->inviter_name, sizeof(eq->inviter_name));
|
||||
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
|
||||
OUT(swapping);
|
||||
strn0cpy(eq->swap_name, emu->swap_name, sizeof(eq->swap_name));
|
||||
OUT(dz_zone_id);
|
||||
OUT(dz_instance_id);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzExpeditionLockoutTimers)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionLockoutTimers_Struct);
|
||||
|
||||
SerializeBuffer buf;
|
||||
buf.WriteUInt32(emu->client_id);
|
||||
buf.WriteUInt32(emu->count);
|
||||
for (uint32 i = 0; i < emu->count; ++i)
|
||||
{
|
||||
ss.write(emu->entries[i].expedition, strlen(emu->entries[i].expedition));
|
||||
ss.write((const char*)&null_term, sizeof(char));
|
||||
ss.write((const char*)&emu->entries[i].time_left, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write(emu->entries[i].expedition_event, strlen(emu->entries[i].expedition_event));
|
||||
ss.write((const char*)&null_term, sizeof(char));
|
||||
buf.WriteString(emu->timers[i].expedition_name);
|
||||
buf.WriteUInt32(emu->timers[i].seconds_remaining);
|
||||
buf.WriteInt32(emu->timers[i].event_type);
|
||||
buf.WriteString(emu->timers[i].event_name);
|
||||
}
|
||||
|
||||
__packet->size = ss.str().length();
|
||||
__packet->size = buf.size();
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
|
||||
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzJoinExpeditionConfirm)
|
||||
ENCODE(OP_DzSetLeaderName)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(ExpeditionJoinPrompt_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionJoinPrompt_Struct, structs::ExpeditionJoinPrompt_Struct);
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneLeaderName_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneLeaderName_Struct, structs::DynamicZoneLeaderName_Struct);
|
||||
|
||||
strncpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
|
||||
strncpy(eq->player_name, emu->player_name, sizeof(eq->player_name));
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzLeaderStatus)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionLeaderSet_Struct);
|
||||
|
||||
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
||||
uint32 client_id = 0;
|
||||
uint8 null_term = 0;
|
||||
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write(emu->leader_name, strlen(emu->leader_name));
|
||||
ss.write((const char*)&null_term, sizeof(char));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));//0xffffffff
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));//1
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
|
||||
__packet->size = ss.str().length();
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
|
||||
OUT(client_id);
|
||||
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzMemberList)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
|
||||
SETUP_VAR_ENCODE(DynamicZoneMemberList_Struct);
|
||||
|
||||
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
||||
|
||||
uint32 client_id = 0;
|
||||
uint8 null_term = 0;
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&emu->count, sizeof(uint32));
|
||||
for (uint32 i = 0; i < emu->count; ++i)
|
||||
SerializeBuffer buf;
|
||||
buf.WriteUInt32(emu->client_id);
|
||||
buf.WriteUInt32(emu->member_count);
|
||||
for (uint32 i = 0; i < emu->member_count; ++i)
|
||||
{
|
||||
ss.write(emu->entries[i].name, strlen(emu->entries[i].name));
|
||||
ss.write((const char*)&null_term, sizeof(char));
|
||||
ss.write((const char*)&emu->entries[i].status, sizeof(char));
|
||||
buf.WriteString(emu->members[i].name);
|
||||
buf.WriteUInt8(emu->members[i].online_status);
|
||||
}
|
||||
|
||||
__packet->size = ss.str().length();
|
||||
__packet->size = buf.size();
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
|
||||
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzMemberListName)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneMemberListName_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneMemberListName_Struct, structs::DynamicZoneMemberListName_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(add_name);
|
||||
strn0cpy(eq->name, emu->name, sizeof(eq->name));
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzMemberListStatus)
|
||||
{
|
||||
auto emu = reinterpret_cast<DynamicZoneMemberList_Struct*>((*p)->pBuffer);
|
||||
if (emu->member_count == 1)
|
||||
{
|
||||
ENCODE_FORWARD(OP_DzMemberList);
|
||||
}
|
||||
}
|
||||
|
||||
ENCODE(OP_Emote)
|
||||
{
|
||||
EQApplicationPacket *in = *p;
|
||||
@@ -1827,6 +1856,7 @@ namespace RoF
|
||||
OUT(FastRegenHP);
|
||||
OUT(FastRegenMana);
|
||||
OUT(FastRegenEndurance);
|
||||
OUT(underworld_teleport_index);
|
||||
|
||||
eq->FogDensity = emu->fog_density;
|
||||
|
||||
@@ -1938,7 +1968,7 @@ namespace RoF
|
||||
|
||||
for (int r = 0; r < 5; r++)
|
||||
{
|
||||
outapp->WriteUInt32(emu->binds[r].zoneId);
|
||||
outapp->WriteUInt32(emu->binds[r].zone_id);
|
||||
outapp->WriteFloat(emu->binds[r].x);
|
||||
outapp->WriteFloat(emu->binds[r].y);
|
||||
outapp->WriteFloat(emu->binds[r].z);
|
||||
@@ -4387,6 +4417,84 @@ namespace RoF
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzAddPlayer)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
|
||||
|
||||
strn0cpy(emu->name, eq->name, sizeof(emu->name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzChooseZoneReply)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::DynamicZoneChooseZoneReply_Struct);
|
||||
SETUP_DIRECT_DECODE(DynamicZoneChooseZoneReply_Struct, structs::DynamicZoneChooseZoneReply_Struct);
|
||||
|
||||
IN(unknown000);
|
||||
IN(unknown004);
|
||||
IN(unknown008);
|
||||
IN(unknown_id1);
|
||||
IN(dz_zone_id);
|
||||
IN(dz_instance_id);
|
||||
IN(dz_type);
|
||||
IN(unknown_id2);
|
||||
IN(unknown028);
|
||||
IN(unknown032);
|
||||
IN(unknown036);
|
||||
IN(unknown040);
|
||||
IN(unknown044);
|
||||
IN(unknown048);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzExpeditionInviteResponse)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionInviteResponse_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionInviteResponse_Struct, structs::ExpeditionInviteResponse_Struct);
|
||||
|
||||
IN(dz_zone_id);
|
||||
IN(dz_instance_id);
|
||||
IN(accepted);
|
||||
IN(swapping);
|
||||
strn0cpy(emu->swap_name, eq->swap_name, sizeof(emu->swap_name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzMakeLeader)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
|
||||
|
||||
strn0cpy(emu->name, eq->name, sizeof(emu->name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzRemovePlayer)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
|
||||
|
||||
strn0cpy(emu->name, eq->name, sizeof(emu->name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzSwapPlayer)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionCommandSwap_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionCommandSwap_Struct, structs::ExpeditionCommandSwap_Struct);
|
||||
|
||||
strn0cpy(emu->add_player_name, eq->add_player_name, sizeof(emu->add_player_name));
|
||||
strn0cpy(emu->rem_player_name, eq->rem_player_name, sizeof(emu->rem_player_name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_Emote)
|
||||
{
|
||||
unsigned char *__eq_buffer = __packet->pBuffer;
|
||||
|
||||
+183
-75
@@ -759,15 +759,48 @@ namespace RoF2
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzChooseZone)
|
||||
{
|
||||
SETUP_VAR_ENCODE(DynamicZoneChooseZone_Struct);
|
||||
|
||||
SerializeBuffer buf;
|
||||
buf.WriteUInt32(emu->client_id);
|
||||
buf.WriteUInt32(emu->count);
|
||||
|
||||
for (uint32 i = 0; i < emu->count; ++i)
|
||||
{
|
||||
buf.WriteUInt16(emu->choices[i].dz_zone_id);
|
||||
buf.WriteUInt16(emu->choices[i].dz_instance_id);
|
||||
buf.WriteUInt32(emu->choices[i].unknown_id1);
|
||||
buf.WriteUInt32(emu->choices[i].dz_type);
|
||||
buf.WriteUInt32(emu->choices[i].unknown_id2);
|
||||
buf.WriteString(emu->choices[i].description);
|
||||
buf.WriteString(emu->choices[i].leader_name);
|
||||
}
|
||||
|
||||
__packet->size = buf.size();
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzCompass)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionCompass_Struct);
|
||||
ALLOC_VAR_ENCODE(structs::ExpeditionCompass_Struct, sizeof(structs::ExpeditionInfo_Struct) + sizeof(structs::ExpeditionCompassEntry_Struct) * emu->count);
|
||||
SETUP_VAR_ENCODE(DynamicZoneCompass_Struct);
|
||||
ALLOC_VAR_ENCODE(structs::DynamicZoneCompass_Struct,
|
||||
sizeof(structs::DynamicZoneCompass_Struct) +
|
||||
sizeof(structs::DynamicZoneCompassEntry_Struct) * emu->count
|
||||
);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(count);
|
||||
|
||||
for (uint32 i = 0; i < emu->count; ++i)
|
||||
{
|
||||
OUT(entries[i].dz_zone_id);
|
||||
OUT(entries[i].dz_instance_id);
|
||||
OUT(entries[i].dz_type);
|
||||
OUT(entries[i].x);
|
||||
OUT(entries[i].y);
|
||||
OUT(entries[i].z);
|
||||
@@ -788,112 +821,108 @@ namespace RoF2
|
||||
|
||||
ENCODE(OP_DzExpeditionInfo)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneInfo_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneInfo_Struct, structs::DynamicZoneInfo_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(assigned);
|
||||
OUT(max_players);
|
||||
eq->unknown004 = 785316192;
|
||||
eq->unknown008 = 435601;
|
||||
strncpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
|
||||
strncpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
|
||||
strn0cpy(eq->dz_name, emu->dz_name, sizeof(eq->dz_name));
|
||||
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzExpeditionList)
|
||||
ENCODE(OP_DzExpeditionInvite)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionLockoutList_Struct);
|
||||
ENCODE_LENGTH_EXACT(ExpeditionInvite_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionInvite_Struct, structs::ExpeditionInvite_Struct);
|
||||
|
||||
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
||||
uint32 client_id = 0;
|
||||
uint8 null_term = 0;
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&emu->count, sizeof(uint32));
|
||||
OUT(client_id);
|
||||
strn0cpy(eq->inviter_name, emu->inviter_name, sizeof(eq->inviter_name));
|
||||
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
|
||||
OUT(swapping);
|
||||
strn0cpy(eq->swap_name, emu->swap_name, sizeof(eq->swap_name));
|
||||
OUT(dz_zone_id);
|
||||
OUT(dz_instance_id);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzExpeditionLockoutTimers)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionLockoutTimers_Struct);
|
||||
|
||||
SerializeBuffer buf;
|
||||
buf.WriteUInt32(emu->client_id);
|
||||
buf.WriteUInt32(emu->count);
|
||||
for (uint32 i = 0; i < emu->count; ++i)
|
||||
{
|
||||
ss.write(emu->entries[i].expedition, strlen(emu->entries[i].expedition));
|
||||
ss.write((const char*)&null_term, sizeof(char));
|
||||
ss.write((const char*)&emu->entries[i].time_left, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write(emu->entries[i].expedition_event, strlen(emu->entries[i].expedition_event));
|
||||
ss.write((const char*)&null_term, sizeof(char));
|
||||
buf.WriteString(emu->timers[i].expedition_name);
|
||||
buf.WriteUInt32(emu->timers[i].seconds_remaining);
|
||||
buf.WriteInt32(emu->timers[i].event_type);
|
||||
buf.WriteString(emu->timers[i].event_name);
|
||||
}
|
||||
|
||||
__packet->size = ss.str().length();
|
||||
__packet->size = buf.size();
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
|
||||
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzJoinExpeditionConfirm)
|
||||
ENCODE(OP_DzSetLeaderName)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(ExpeditionJoinPrompt_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionJoinPrompt_Struct, structs::ExpeditionJoinPrompt_Struct);
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneLeaderName_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneLeaderName_Struct, structs::DynamicZoneLeaderName_Struct);
|
||||
|
||||
strncpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
|
||||
strncpy(eq->player_name, emu->player_name, sizeof(eq->player_name));
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzLeaderStatus)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionLeaderSet_Struct);
|
||||
|
||||
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
||||
uint32 client_id = 0;
|
||||
uint8 null_term = 0;
|
||||
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write(emu->leader_name, strlen(emu->leader_name));
|
||||
ss.write((const char*)&null_term, sizeof(char));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));//0xffffffff
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));//1
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
|
||||
__packet->size = ss.str().length();
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
|
||||
OUT(client_id);
|
||||
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzMemberList)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
|
||||
SETUP_VAR_ENCODE(DynamicZoneMemberList_Struct);
|
||||
|
||||
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
||||
|
||||
uint32 client_id = 0;
|
||||
uint8 null_term = 0;
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&emu->count, sizeof(uint32));
|
||||
for (uint32 i = 0; i < emu->count; ++i)
|
||||
SerializeBuffer buf;
|
||||
buf.WriteUInt32(emu->client_id);
|
||||
buf.WriteUInt32(emu->member_count);
|
||||
for (uint32 i = 0; i < emu->member_count; ++i)
|
||||
{
|
||||
ss.write(emu->entries[i].name, strlen(emu->entries[i].name));
|
||||
ss.write((const char*)&null_term, sizeof(char));
|
||||
ss.write((const char*)&emu->entries[i].status, sizeof(char));
|
||||
buf.WriteString(emu->members[i].name);
|
||||
buf.WriteUInt8(emu->members[i].online_status);
|
||||
}
|
||||
|
||||
__packet->size = ss.str().length();
|
||||
__packet->size = buf.size();
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
|
||||
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzMemberListName)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneMemberListName_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneMemberListName_Struct, structs::DynamicZoneMemberListName_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(add_name);
|
||||
strn0cpy(eq->name, emu->name, sizeof(eq->name));
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzMemberListStatus)
|
||||
{
|
||||
auto emu = reinterpret_cast<DynamicZoneMemberList_Struct*>((*p)->pBuffer);
|
||||
if (emu->member_count == 1)
|
||||
{
|
||||
ENCODE_FORWARD(OP_DzMemberList);
|
||||
}
|
||||
}
|
||||
|
||||
ENCODE(OP_Emote)
|
||||
{
|
||||
EQApplicationPacket *in = *p;
|
||||
@@ -1876,6 +1905,7 @@ namespace RoF2
|
||||
OUT(FastRegenHP);
|
||||
OUT(FastRegenMana);
|
||||
OUT(FastRegenEndurance);
|
||||
OUT(underworld_teleport_index);
|
||||
|
||||
eq->FogDensity = emu->fog_density;
|
||||
|
||||
@@ -1995,7 +2025,7 @@ namespace RoF2
|
||||
|
||||
for (int r = 0; r < 5; r++)
|
||||
{
|
||||
outapp->WriteUInt32(emu->binds[r].zoneId);
|
||||
outapp->WriteUInt32(emu->binds[r].zone_id);
|
||||
outapp->WriteFloat(emu->binds[r].x);
|
||||
outapp->WriteFloat(emu->binds[r].y);
|
||||
outapp->WriteFloat(emu->binds[r].z);
|
||||
@@ -4584,6 +4614,84 @@ namespace RoF2
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzAddPlayer)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
|
||||
|
||||
strn0cpy(emu->name, eq->name, sizeof(emu->name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzChooseZoneReply)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::DynamicZoneChooseZoneReply_Struct);
|
||||
SETUP_DIRECT_DECODE(DynamicZoneChooseZoneReply_Struct, structs::DynamicZoneChooseZoneReply_Struct);
|
||||
|
||||
IN(unknown000);
|
||||
IN(unknown004);
|
||||
IN(unknown008);
|
||||
IN(unknown_id1);
|
||||
IN(dz_zone_id);
|
||||
IN(dz_instance_id);
|
||||
IN(dz_type);
|
||||
IN(unknown_id2);
|
||||
IN(unknown028);
|
||||
IN(unknown032);
|
||||
IN(unknown036);
|
||||
IN(unknown040);
|
||||
IN(unknown044);
|
||||
IN(unknown048);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzExpeditionInviteResponse)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionInviteResponse_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionInviteResponse_Struct, structs::ExpeditionInviteResponse_Struct);
|
||||
|
||||
IN(dz_zone_id);
|
||||
IN(dz_instance_id);
|
||||
IN(accepted);
|
||||
IN(swapping);
|
||||
strn0cpy(emu->swap_name, eq->swap_name, sizeof(emu->swap_name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzMakeLeader)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
|
||||
|
||||
strn0cpy(emu->name, eq->name, sizeof(emu->name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzRemovePlayer)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
|
||||
|
||||
strn0cpy(emu->name, eq->name, sizeof(emu->name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzSwapPlayer)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionCommandSwap_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionCommandSwap_Struct, structs::ExpeditionCommandSwap_Struct);
|
||||
|
||||
strn0cpy(emu->add_player_name, eq->add_player_name, sizeof(emu->add_player_name));
|
||||
strn0cpy(emu->rem_player_name, eq->rem_player_name, sizeof(emu->rem_player_name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_Emote)
|
||||
{
|
||||
unsigned char *__eq_buffer = __packet->pBuffer;
|
||||
|
||||
@@ -58,13 +58,16 @@ E(OP_DeleteCharge)
|
||||
E(OP_DeleteItem)
|
||||
E(OP_DeleteSpawn)
|
||||
E(OP_DisciplineUpdate)
|
||||
E(OP_DzChooseZone)
|
||||
E(OP_DzCompass)
|
||||
E(OP_DzExpeditionEndsWarning)
|
||||
E(OP_DzExpeditionInfo)
|
||||
E(OP_DzExpeditionList)
|
||||
E(OP_DzJoinExpeditionConfirm)
|
||||
E(OP_DzLeaderStatus)
|
||||
E(OP_DzExpeditionInvite)
|
||||
E(OP_DzExpeditionLockoutTimers)
|
||||
E(OP_DzMemberList)
|
||||
E(OP_DzMemberListName)
|
||||
E(OP_DzMemberListStatus)
|
||||
E(OP_DzSetLeaderName)
|
||||
E(OP_Emote)
|
||||
E(OP_ExpansionInfo)
|
||||
E(OP_FormattedMessage)
|
||||
@@ -159,6 +162,12 @@ D(OP_ConsiderCorpse)
|
||||
D(OP_Consume)
|
||||
D(OP_Damage)
|
||||
D(OP_DeleteItem)
|
||||
D(OP_DzAddPlayer)
|
||||
D(OP_DzChooseZoneReply)
|
||||
D(OP_DzExpeditionInviteResponse)
|
||||
D(OP_DzMakeLeader)
|
||||
D(OP_DzRemovePlayer)
|
||||
D(OP_DzSwapPlayer)
|
||||
D(OP_Emote)
|
||||
D(OP_EnvDamage)
|
||||
D(OP_FaceChange)
|
||||
|
||||
+144
-27
@@ -628,7 +628,7 @@ struct NewZone_Struct {
|
||||
/*0856*/ uint32 scriptNPCReceivedanItem;
|
||||
/*0860*/ uint32 bCheck; // padded bool
|
||||
/*0864*/ uint32 scriptIDSomething;
|
||||
/*0868*/ uint32 scriptIDSomething2;
|
||||
/*0868*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
|
||||
/*0872*/ uint32 scriptIDSomething3;
|
||||
/*0876*/ uint32 SuspendBuffs; // padded bool
|
||||
/*0880*/ uint32 LavaDamage; // LavaDamage value
|
||||
@@ -1053,7 +1053,7 @@ struct LeadershipAA_Struct {
|
||||
* Size: 20 Octets
|
||||
*/
|
||||
struct BindStruct {
|
||||
/*000*/ uint32 zoneId;
|
||||
/*000*/ uint32 zone_id;
|
||||
/*004*/ float x;
|
||||
/*008*/ float y;
|
||||
/*012*/ float z;
|
||||
@@ -2084,7 +2084,7 @@ struct GMZoneRequest_Struct {
|
||||
/*0068*/ float x;
|
||||
/*0072*/ float y;
|
||||
/*0076*/ float z;
|
||||
/*0080*/ char unknown0080[4];
|
||||
/*0080*/ float heading;
|
||||
/*0084*/ uint32 success; // 0 if command failed, 1 if succeeded?
|
||||
/*0088*/
|
||||
// /*072*/ int8 success; // =0 client->server, =1 server->client, -X=specific error
|
||||
@@ -4882,52 +4882,169 @@ struct VeteranClaim
|
||||
/*076*/ uint32 action;
|
||||
};
|
||||
|
||||
struct ExpeditionEntryHeader_Struct
|
||||
struct ExpeditionInvite_Struct
|
||||
{
|
||||
/*000*/ uint32 unknown000;
|
||||
/*000*/ uint32 number_of_entries;
|
||||
/*000*/ uint32 client_id; // unique character id
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ char inviter_name[64];
|
||||
/*072*/ char expedition_name[128];
|
||||
/*200*/ uint8 swapping; // 0: adding 1: swapping
|
||||
/*201*/ char swap_name[64]; // if swapping, swap name being removed
|
||||
/*265*/ uint8 padding[3];
|
||||
/*268*/ uint16 dz_zone_id; // dz_id zone/instance pair, sent back in reply
|
||||
/*270*/ uint16 dz_instance_id;
|
||||
};
|
||||
|
||||
struct ExpeditionJoinPrompt_Struct
|
||||
struct ExpeditionInviteResponse_Struct
|
||||
{
|
||||
/*000*/ uint32 clientid;
|
||||
/*000*/ uint32 unknown000;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ char player_name[64];
|
||||
/*072*/ char expedition_name[64];
|
||||
/*008*/ uint16 dz_zone_id; // dz_id pair sent in invite
|
||||
/*010*/ uint16 dz_instance_id;
|
||||
/*012*/ uint8 accepted; // 0: declined 1: accepted
|
||||
/*013*/ uint8 swapping; // 0: adding 1: swapping (sent in invite)
|
||||
/*014*/ char swap_name[64]; // swap name sent in invite
|
||||
/*078*/ uint8 unknown078; // padding garbage?
|
||||
/*079*/ uint8 unknown079; // padding garbage?
|
||||
};
|
||||
|
||||
struct DynamicZoneInfo_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ uint32 assigned; // padded bool, 0: clear info, 1: fill window info
|
||||
/*012*/ uint32 max_players;
|
||||
/*016*/ char dz_name[128];
|
||||
/*144*/ char leader_name[64];
|
||||
//*208*/ uint32 dz_type; // only in newer clients, if not 1 (expedition type) window does not auto show when dz info assigned
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberEntry_Struct
|
||||
{
|
||||
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
|
||||
/*000*/ uint8 online_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberList_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 member_count; // number of players in window
|
||||
/*008*/ DynamicZoneMemberEntry_Struct members[0]; // variable length
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberListName_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ uint32 add_name; // padded bool, 0: remove name, 1: add name with unknown status
|
||||
/*012*/ char name[64];
|
||||
};
|
||||
|
||||
struct ExpeditionLockoutTimerEntry_Struct
|
||||
{
|
||||
/*000*/ char expedition_name[1]; // variable length, null terminated, max 0x80 (128)
|
||||
/*000*/ uint32 seconds_remaining;
|
||||
/*000*/ int32 event_type; // seen -1 (0xffffffff) for replay timers and 1 for event timers
|
||||
/*000*/ char event_name[1]; // variable length, null terminated, max 0x100 (256)
|
||||
};
|
||||
|
||||
struct ExpeditionLockoutTimers_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 count;
|
||||
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
|
||||
};
|
||||
|
||||
struct DynamicZoneLeaderName_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ char leader_name[64];
|
||||
};
|
||||
|
||||
struct ExpeditionCommand_Struct
|
||||
{
|
||||
/*000*/ uint32 unknown000;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ char name[64];
|
||||
};
|
||||
|
||||
struct ExpeditionCommandSwap_Struct
|
||||
{
|
||||
/*000*/ uint32 unknown000;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ char add_player_name[64]; // swap to (player must confirm)
|
||||
/*072*/ char rem_player_name[64]; // swap from
|
||||
};
|
||||
|
||||
struct ExpeditionExpireWarning
|
||||
{
|
||||
/*000*/ uint32 clientid;
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ uint32 minutes_remaining;
|
||||
};
|
||||
|
||||
struct ExpeditionInfo_Struct
|
||||
struct DynamicZoneCompassEntry_Struct
|
||||
{
|
||||
/*000*/ uint32 clientid;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*000*/ uint16 dz_zone_id; // target dz id pair
|
||||
/*002*/ uint16 dz_instance_id;
|
||||
/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
|
||||
/*008*/ uint32 unknown008;
|
||||
/*012*/ uint32 max_players;
|
||||
/*016*/ char expedition_name[128];
|
||||
/*142*/ char leader_name[64];
|
||||
};
|
||||
|
||||
struct ExpeditionCompassEntry_Struct
|
||||
{
|
||||
/*000*/ float unknown000; //seen *((uint32*)) = 1584791871
|
||||
/*004*/ uint32 enabled; //guess
|
||||
/*008*/ uint32 unknown008; //seen 1019
|
||||
/*012*/ float y;
|
||||
/*016*/ float x;
|
||||
/*020*/ float z;
|
||||
};
|
||||
|
||||
struct ExpeditionCompass_Struct
|
||||
struct DynamicZoneCompass_Struct
|
||||
{
|
||||
/*000*/ uint32 clientid;
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 count;
|
||||
/*008*/ ExpeditionCompassEntry_Struct entries[0];
|
||||
/*008*/ DynamicZoneCompassEntry_Struct entries[0];
|
||||
};
|
||||
|
||||
struct DynamicZoneChooseZoneEntry_Struct
|
||||
{
|
||||
/*000*/ uint16 dz_zone_id; // dz_id pair
|
||||
/*002*/ uint16 dz_instance_id;
|
||||
/*004*/ uint32 unknown_id1; // seen 28 00 00 00 (40), sent back in reply
|
||||
/*008*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest -- sent back in reply
|
||||
/*012*/ uint32 unknown_id2; // possibly an id based on dz type, for expeditions this was same as dz_id (zone|instance) but task dz was different
|
||||
/*016*/ char description[1]; // variable length, null terminated, max 0x80 (128)
|
||||
/*000*/ char leader_name[1]; // variable length, null terminated, max 0x40 (64)
|
||||
};
|
||||
|
||||
struct DynamicZoneChooseZone_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 count;
|
||||
/*008*/ DynamicZoneChooseZoneEntry_Struct choices[0];
|
||||
};
|
||||
|
||||
struct DynamicZoneChooseZoneReply_Struct
|
||||
{
|
||||
/*000*/ uint32 unknown000; // ff ff ff ff
|
||||
/*004*/ uint32 unknown004; // seen 69 00 00 00
|
||||
/*008*/ uint32 unknown008; // ff ff ff ff
|
||||
/*012*/ uint32 unknown_id1; // from choose zone entry message
|
||||
/*016*/ uint16 dz_zone_id; // dz_id pair
|
||||
/*018*/ uint16 dz_instance_id;
|
||||
/*020*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest
|
||||
/*024*/ uint32 unknown_id2; // from choose zone entry message
|
||||
/*028*/ uint32 unknown028; // 00 00 00 00
|
||||
/*032*/ uint32 unknown032; // always same as unknown044
|
||||
/*036*/ uint32 unknown036;
|
||||
/*040*/ uint32 unknown040;
|
||||
/*044*/ uint32 unknown044; // always same as unknown032
|
||||
/*048*/ uint32 unknown048; // seen 01 00 00 00 and 02 00 00 00
|
||||
};
|
||||
|
||||
struct KickPlayers_Struct
|
||||
{
|
||||
/*000*/ char char_name[64];
|
||||
/*064*/ uint32 unknown064; // always 0
|
||||
/*068*/ uint8 kick_expedition; // true if /kickplayers exp
|
||||
/*069*/ uint8 kick_task; // true if /kickplayers task
|
||||
/*070*/ uint8 padding[2];
|
||||
};
|
||||
|
||||
struct MaxCharacters_Struct
|
||||
|
||||
@@ -44,13 +44,16 @@ E(OP_DeleteCharge)
|
||||
E(OP_DeleteItem)
|
||||
E(OP_DeleteSpawn)
|
||||
E(OP_DisciplineUpdate)
|
||||
E(OP_DzChooseZone)
|
||||
E(OP_DzCompass)
|
||||
E(OP_DzExpeditionEndsWarning)
|
||||
E(OP_DzExpeditionInfo)
|
||||
E(OP_DzExpeditionList)
|
||||
E(OP_DzJoinExpeditionConfirm)
|
||||
E(OP_DzLeaderStatus)
|
||||
E(OP_DzExpeditionInvite)
|
||||
E(OP_DzExpeditionLockoutTimers)
|
||||
E(OP_DzMemberList)
|
||||
E(OP_DzMemberListName)
|
||||
E(OP_DzMemberListStatus)
|
||||
E(OP_DzSetLeaderName)
|
||||
E(OP_Emote)
|
||||
E(OP_ExpansionInfo)
|
||||
E(OP_FormattedMessage)
|
||||
@@ -145,6 +148,12 @@ D(OP_ConsiderCorpse)
|
||||
D(OP_Consume)
|
||||
D(OP_Damage)
|
||||
D(OP_DeleteItem)
|
||||
D(OP_DzAddPlayer)
|
||||
D(OP_DzChooseZoneReply)
|
||||
D(OP_DzExpeditionInviteResponse)
|
||||
D(OP_DzMakeLeader)
|
||||
D(OP_DzRemovePlayer)
|
||||
D(OP_DzSwapPlayer)
|
||||
D(OP_Emote)
|
||||
D(OP_EnvDamage)
|
||||
D(OP_FaceChange)
|
||||
|
||||
+138
-27
@@ -575,7 +575,11 @@ struct NewZone_Struct {
|
||||
/*0848*/ int32 unknown848;
|
||||
/*0852*/ uint16 zone_id;
|
||||
/*0854*/ uint16 zone_instance;
|
||||
/*0856*/ char unknown856[20];
|
||||
/*0856*/ uint32 scriptNPCReceivedanItem;
|
||||
/*0860*/ uint32 bCheck; // padded bool
|
||||
/*0864*/ uint32 scriptIDSomething;
|
||||
/*0868*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
|
||||
/*0872*/ uint32 scriptIDSomething3;
|
||||
/*0876*/ uint32 SuspendBuffs;
|
||||
/*0880*/ uint32 unknown880; // Seen 50
|
||||
/*0884*/ uint32 unknown884; // Seen 10
|
||||
@@ -994,7 +998,7 @@ struct LeadershipAA_Struct {
|
||||
* Size: 20 Octets
|
||||
*/
|
||||
struct BindStruct {
|
||||
/*000*/ uint32 zoneId;
|
||||
/*000*/ uint32 zone_id;
|
||||
/*004*/ float x;
|
||||
/*008*/ float y;
|
||||
/*012*/ float z;
|
||||
@@ -2058,7 +2062,7 @@ struct GMZoneRequest_Struct {
|
||||
/*0068*/ float x;
|
||||
/*0072*/ float y;
|
||||
/*0076*/ float z;
|
||||
/*0080*/ char unknown0080[4];
|
||||
/*0080*/ float heading;
|
||||
/*0084*/ uint32 success; // 0 if command failed, 1 if succeeded?
|
||||
/*0088*/
|
||||
// /*072*/ int8 success; // =0 client->server, =1 server->client, -X=specific error
|
||||
@@ -4811,52 +4815,159 @@ struct VeteranClaim
|
||||
/*076*/ uint32 action;
|
||||
};
|
||||
|
||||
struct ExpeditionEntryHeader_Struct
|
||||
struct ExpeditionInvite_Struct
|
||||
{
|
||||
/*000*/ uint32 unknown000;
|
||||
/*000*/ uint32 number_of_entries;
|
||||
/*000*/ uint32 client_id; // unique character id
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ char inviter_name[64];
|
||||
/*072*/ char expedition_name[128];
|
||||
/*200*/ uint8 swapping; // 0: adding 1: swapping
|
||||
/*201*/ char swap_name[64]; // if swapping, swap name being removed
|
||||
/*265*/ uint8 padding[3];
|
||||
/*268*/ uint16 dz_zone_id; // dz_id zone/instance pair, sent back in reply
|
||||
/*270*/ uint16 dz_instance_id;
|
||||
};
|
||||
|
||||
struct ExpeditionJoinPrompt_Struct
|
||||
struct ExpeditionInviteResponse_Struct
|
||||
{
|
||||
/*000*/ uint32 clientid;
|
||||
/*000*/ uint32 unknown000;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ char player_name[64];
|
||||
/*072*/ char expedition_name[64];
|
||||
/*008*/ uint16 dz_zone_id; // dz_id pair sent in invite
|
||||
/*010*/ uint16 dz_instance_id;
|
||||
/*012*/ uint8 accepted; // 0: declined 1: accepted
|
||||
/*013*/ uint8 swapping; // 0: adding 1: swapping (sent in invite)
|
||||
/*014*/ char swap_name[64]; // swap name sent in invite
|
||||
/*078*/ uint8 unknown078; // padding garbage?
|
||||
/*079*/ uint8 unknown079; // padding garbage?
|
||||
};
|
||||
|
||||
struct DynamicZoneInfo_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ uint32 assigned; // padded bool
|
||||
/*012*/ uint32 max_players;
|
||||
/*016*/ char dz_name[128];
|
||||
/*144*/ char leader_name[64];
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberEntry_Struct
|
||||
{
|
||||
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
|
||||
/*000*/ uint8 online_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberList_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 member_count; // number of players in window
|
||||
/*008*/ DynamicZoneMemberEntry_Struct members[0]; // variable length
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberListName_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ uint32 add_name; // padded bool, 0: remove name, 1: add name with unknown status
|
||||
/*012*/ char name[64];
|
||||
};
|
||||
|
||||
struct ExpeditionLockoutTimerEntry_Struct
|
||||
{
|
||||
/*000*/ char expedition_name[1]; // variable length, null terminated, max 0x80 (128)
|
||||
/*000*/ uint32 seconds_remaining;
|
||||
/*000*/ int32 event_type; // seen -1 (0xffffffff) for replay timers and 1 for event timers
|
||||
/*000*/ char event_name[1]; // variable length, null terminated, max 0x100 (256)
|
||||
};
|
||||
|
||||
struct ExpeditionLockoutTimers_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 count;
|
||||
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
|
||||
};
|
||||
|
||||
struct DynamicZoneLeaderName_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ char leader_name[64];
|
||||
};
|
||||
|
||||
struct ExpeditionCommand_Struct
|
||||
{
|
||||
/*000*/ uint32 unknown000;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ char name[64];
|
||||
};
|
||||
|
||||
struct ExpeditionCommandSwap_Struct
|
||||
{
|
||||
/*000*/ uint32 unknown000;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ char add_player_name[64]; // swap to (player must confirm)
|
||||
/*072*/ char rem_player_name[64]; // swap from
|
||||
};
|
||||
|
||||
struct ExpeditionExpireWarning
|
||||
{
|
||||
/*000*/ uint32 clientid;
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ uint32 minutes_remaining;
|
||||
};
|
||||
|
||||
struct ExpeditionInfo_Struct
|
||||
struct DynamicZoneCompassEntry_Struct
|
||||
{
|
||||
/*000*/ uint32 clientid;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*000*/ uint16 dz_zone_id; // target dz id pair
|
||||
/*002*/ uint16 dz_instance_id;
|
||||
/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
|
||||
/*008*/ uint32 unknown008;
|
||||
/*012*/ uint32 max_players;
|
||||
/*016*/ char expedition_name[128];
|
||||
/*142*/ char leader_name[64];
|
||||
};
|
||||
|
||||
struct ExpeditionCompassEntry_Struct
|
||||
{
|
||||
/*000*/ float unknown000; //seen *((uint32*)) = 1584791871
|
||||
/*004*/ uint32 enabled; //guess
|
||||
/*008*/ uint32 unknown008; //seen 1019
|
||||
/*012*/ float y;
|
||||
/*016*/ float x;
|
||||
/*020*/ float z;
|
||||
};
|
||||
|
||||
struct ExpeditionCompass_Struct
|
||||
struct DynamicZoneCompass_Struct
|
||||
{
|
||||
/*000*/ uint32 clientid;
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 count;
|
||||
/*008*/ ExpeditionCompassEntry_Struct entries[0];
|
||||
/*008*/ DynamicZoneCompassEntry_Struct entries[0];
|
||||
};
|
||||
|
||||
struct DynamicZoneChooseZoneEntry_Struct
|
||||
{
|
||||
/*000*/ uint16 dz_zone_id; // dz_id pair
|
||||
/*002*/ uint16 dz_instance_id;
|
||||
/*004*/ uint32 unknown_id1; // sent back in reply
|
||||
/*008*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest -- sent back in reply
|
||||
/*012*/ uint32 unknown_id2; // possibly an id based on dz type, for expeditions this was same as dz_id (zone|instance) but task dz was different
|
||||
/*016*/ char description[1]; // variable length, null terminated, max 0x80 (128)
|
||||
/*000*/ char leader_name[1]; // variable length, null terminated, max 0x40 (64)
|
||||
};
|
||||
|
||||
struct DynamicZoneChooseZone_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 count;
|
||||
/*008*/ DynamicZoneChooseZoneEntry_Struct choices[0];
|
||||
};
|
||||
|
||||
struct DynamicZoneChooseZoneReply_Struct
|
||||
{
|
||||
/*000*/ uint32 unknown000; // ff ff ff ff
|
||||
/*004*/ uint32 unknown004; // seen 69 00 00 00
|
||||
/*008*/ uint32 unknown008; // ff ff ff ff
|
||||
/*012*/ uint32 unknown_id1; // from choose zone entry message
|
||||
/*016*/ uint16 dz_zone_id; // dz_id pair
|
||||
/*018*/ uint16 dz_instance_id;
|
||||
/*020*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest
|
||||
/*024*/ uint32 unknown_id2; // from choose zone entry message
|
||||
/*028*/ uint32 unknown028; // 00 00 00 00
|
||||
/*032*/ uint32 unknown032; // always same as unknown044
|
||||
/*036*/ uint32 unknown036;
|
||||
/*040*/ uint32 unknown040;
|
||||
/*044*/ uint32 unknown044; // always same as unknown032
|
||||
/*048*/ uint32 unknown048; // seen 01 00 00 00 and 02 00 00 00
|
||||
};
|
||||
|
||||
struct MaxCharacters_Struct
|
||||
|
||||
+184
-75
@@ -483,15 +483,48 @@ namespace SoD
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzChooseZone)
|
||||
{
|
||||
SETUP_VAR_ENCODE(DynamicZoneChooseZone_Struct);
|
||||
|
||||
SerializeBuffer buf;
|
||||
buf.WriteUInt32(emu->client_id);
|
||||
buf.WriteUInt32(emu->count);
|
||||
|
||||
for (uint32 i = 0; i < emu->count; ++i)
|
||||
{
|
||||
buf.WriteUInt16(emu->choices[i].dz_zone_id);
|
||||
buf.WriteUInt16(emu->choices[i].dz_instance_id);
|
||||
buf.WriteUInt32(emu->choices[i].unknown_id1);
|
||||
buf.WriteUInt32(emu->choices[i].dz_type);
|
||||
buf.WriteUInt32(emu->choices[i].unknown_id2);
|
||||
buf.WriteString(emu->choices[i].description);
|
||||
buf.WriteString(emu->choices[i].leader_name);
|
||||
}
|
||||
|
||||
__packet->size = buf.size();
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzCompass)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionCompass_Struct);
|
||||
ALLOC_VAR_ENCODE(structs::ExpeditionCompass_Struct, sizeof(structs::ExpeditionInfo_Struct) + sizeof(structs::ExpeditionCompassEntry_Struct) * emu->count);
|
||||
SETUP_VAR_ENCODE(DynamicZoneCompass_Struct);
|
||||
ALLOC_VAR_ENCODE(structs::DynamicZoneCompass_Struct,
|
||||
sizeof(structs::DynamicZoneCompass_Struct) +
|
||||
sizeof(structs::DynamicZoneCompassEntry_Struct) * emu->count
|
||||
);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(count);
|
||||
|
||||
for (uint32 i = 0; i < emu->count; ++i)
|
||||
{
|
||||
OUT(entries[i].dz_zone_id);
|
||||
OUT(entries[i].dz_instance_id);
|
||||
OUT(entries[i].dz_type);
|
||||
OUT(entries[i].x);
|
||||
OUT(entries[i].y);
|
||||
OUT(entries[i].z);
|
||||
@@ -512,112 +545,109 @@ namespace SoD
|
||||
|
||||
ENCODE(OP_DzExpeditionInfo)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneInfo_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneInfo_Struct, structs::DynamicZoneInfo_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(assigned);
|
||||
OUT(max_players);
|
||||
eq->unknown004 = 785316192;
|
||||
eq->unknown008 = 435601;
|
||||
strcpy(eq->expedition_name, emu->expedition_name);
|
||||
strcpy(eq->leader_name, emu->leader_name);
|
||||
strn0cpy(eq->dz_name, emu->dz_name, sizeof(eq->dz_name));
|
||||
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzExpeditionList)
|
||||
ENCODE(OP_DzExpeditionInvite)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionLockoutList_Struct);
|
||||
ENCODE_LENGTH_EXACT(ExpeditionInvite_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionInvite_Struct, structs::ExpeditionInvite_Struct);
|
||||
|
||||
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
||||
uint32 client_id = 0;
|
||||
uint8 null_term = 0;
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&emu->count, sizeof(uint32));
|
||||
OUT(client_id);
|
||||
strn0cpy(eq->inviter_name, emu->inviter_name, sizeof(eq->inviter_name));
|
||||
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
|
||||
OUT(swapping);
|
||||
strn0cpy(eq->swap_name, emu->swap_name, sizeof(eq->swap_name));
|
||||
OUT(dz_zone_id);
|
||||
OUT(dz_instance_id);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzExpeditionLockoutTimers)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionLockoutTimers_Struct);
|
||||
|
||||
SerializeBuffer buf;
|
||||
buf.WriteUInt32(emu->client_id);
|
||||
buf.WriteUInt32(emu->count);
|
||||
for (uint32 i = 0; i < emu->count; ++i)
|
||||
{
|
||||
ss.write(emu->entries[i].expedition, strlen(emu->entries[i].expedition));
|
||||
ss.write((const char*)&null_term, sizeof(char));
|
||||
ss.write((const char*)&emu->entries[i].time_left, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write(emu->entries[i].expedition_event, strlen(emu->entries[i].expedition_event));
|
||||
ss.write((const char*)&null_term, sizeof(char));
|
||||
buf.WriteString(emu->timers[i].expedition_name);
|
||||
buf.WriteUInt32(emu->timers[i].seconds_remaining);
|
||||
buf.WriteInt32(emu->timers[i].event_type);
|
||||
buf.WriteString(emu->timers[i].event_name);
|
||||
}
|
||||
|
||||
__packet->size = ss.str().length();
|
||||
__packet->size = buf.size();
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
|
||||
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzJoinExpeditionConfirm)
|
||||
ENCODE(OP_DzSetLeaderName)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(ExpeditionJoinPrompt_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionJoinPrompt_Struct, structs::ExpeditionJoinPrompt_Struct);
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneLeaderName_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneLeaderName_Struct, structs::DynamicZoneLeaderName_Struct);
|
||||
|
||||
strcpy(eq->expedition_name, emu->expedition_name);
|
||||
strcpy(eq->player_name, emu->player_name);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzLeaderStatus)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionLeaderSet_Struct);
|
||||
|
||||
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
||||
uint32 client_id = 0;
|
||||
uint8 null_term = 0;
|
||||
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write(emu->leader_name, strlen(emu->leader_name));
|
||||
ss.write((const char*)&null_term, sizeof(char));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));//0xffffffff
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));//1
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
|
||||
__packet->size = ss.str().length();
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
|
||||
OUT(client_id);
|
||||
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzMemberList)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
|
||||
SETUP_VAR_ENCODE(DynamicZoneMemberList_Struct);
|
||||
|
||||
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
||||
|
||||
uint32 client_id = 0;
|
||||
uint8 null_term = 0;
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&emu->count, sizeof(uint32));
|
||||
for (uint32 i = 0; i < emu->count; ++i)
|
||||
SerializeBuffer buf;
|
||||
buf.WriteUInt32(emu->client_id);
|
||||
buf.WriteUInt32(emu->member_count);
|
||||
for (uint32 i = 0; i < emu->member_count; ++i)
|
||||
{
|
||||
ss.write(emu->entries[i].name, strlen(emu->entries[i].name));
|
||||
ss.write((const char*)&null_term, sizeof(char));
|
||||
ss.write((const char*)&emu->entries[i].status, sizeof(char));
|
||||
buf.WriteString(emu->members[i].name);
|
||||
buf.WriteUInt8(emu->members[i].online_status);
|
||||
}
|
||||
|
||||
__packet->size = ss.str().length();
|
||||
__packet->size = buf.size();
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
|
||||
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzMemberListName)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneMemberListName_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneMemberListName_Struct, structs::DynamicZoneMemberListName_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(add_name);
|
||||
strn0cpy(eq->name, emu->name, sizeof(eq->name));
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzMemberListStatus)
|
||||
{
|
||||
auto emu = reinterpret_cast<DynamicZoneMemberList_Struct*>((*p)->pBuffer);
|
||||
if (emu->member_count == 1)
|
||||
{
|
||||
ENCODE_FORWARD(OP_DzMemberList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ENCODE(OP_Emote)
|
||||
{
|
||||
EQApplicationPacket *in = *p;
|
||||
@@ -1353,6 +1383,7 @@ namespace SoD
|
||||
OUT(FastRegenHP);
|
||||
OUT(FastRegenMana);
|
||||
OUT(FastRegenEndurance);
|
||||
OUT(underworld_teleport_index);
|
||||
|
||||
/*fill in some unknowns with observed values, hopefully it will help */
|
||||
eq->unknown800 = -1;
|
||||
@@ -1444,7 +1475,7 @@ namespace SoD
|
||||
eq->level1 = emu->level;
|
||||
// OUT(unknown00022[2]);
|
||||
for (r = 0; r < 5; r++) {
|
||||
OUT(binds[r].zoneId);
|
||||
OUT(binds[r].zone_id);
|
||||
OUT(binds[r].x);
|
||||
OUT(binds[r].y);
|
||||
OUT(binds[r].z);
|
||||
@@ -2973,6 +3004,84 @@ namespace SoD
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzAddPlayer)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
|
||||
|
||||
strn0cpy(emu->name, eq->name, sizeof(emu->name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzChooseZoneReply)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::DynamicZoneChooseZoneReply_Struct);
|
||||
SETUP_DIRECT_DECODE(DynamicZoneChooseZoneReply_Struct, structs::DynamicZoneChooseZoneReply_Struct);
|
||||
|
||||
IN(unknown000);
|
||||
IN(unknown004);
|
||||
IN(unknown008);
|
||||
IN(unknown_id1);
|
||||
IN(dz_zone_id);
|
||||
IN(dz_instance_id);
|
||||
IN(dz_type);
|
||||
IN(unknown_id2);
|
||||
IN(unknown028);
|
||||
IN(unknown032);
|
||||
IN(unknown036);
|
||||
IN(unknown040);
|
||||
IN(unknown044);
|
||||
IN(unknown048);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzExpeditionInviteResponse)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionInviteResponse_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionInviteResponse_Struct, structs::ExpeditionInviteResponse_Struct);
|
||||
|
||||
IN(dz_zone_id);
|
||||
IN(dz_instance_id);
|
||||
IN(accepted);
|
||||
IN(swapping);
|
||||
strn0cpy(emu->swap_name, eq->swap_name, sizeof(emu->swap_name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzMakeLeader)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
|
||||
|
||||
strn0cpy(emu->name, eq->name, sizeof(emu->name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzRemovePlayer)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
|
||||
|
||||
strn0cpy(emu->name, eq->name, sizeof(emu->name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzSwapPlayer)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionCommandSwap_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionCommandSwap_Struct, structs::ExpeditionCommandSwap_Struct);
|
||||
|
||||
strn0cpy(emu->add_player_name, eq->add_player_name, sizeof(emu->add_player_name));
|
||||
strn0cpy(emu->rem_player_name, eq->rem_player_name, sizeof(emu->rem_player_name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_Emote)
|
||||
{
|
||||
unsigned char *__eq_buffer = __packet->pBuffer;
|
||||
|
||||
@@ -35,13 +35,16 @@ E(OP_Consider)
|
||||
E(OP_Damage)
|
||||
E(OP_DeleteCharge)
|
||||
E(OP_DeleteItem)
|
||||
E(OP_DzChooseZone)
|
||||
E(OP_DzCompass)
|
||||
E(OP_DzExpeditionEndsWarning)
|
||||
E(OP_DzExpeditionInfo)
|
||||
E(OP_DzExpeditionList)
|
||||
E(OP_DzJoinExpeditionConfirm)
|
||||
E(OP_DzLeaderStatus)
|
||||
E(OP_DzExpeditionInvite)
|
||||
E(OP_DzExpeditionLockoutTimers)
|
||||
E(OP_DzMemberList)
|
||||
E(OP_DzMemberListName)
|
||||
E(OP_DzMemberListStatus)
|
||||
E(OP_DzSetLeaderName)
|
||||
E(OP_Emote)
|
||||
E(OP_ExpansionInfo)
|
||||
E(OP_FormattedMessage)
|
||||
@@ -111,6 +114,12 @@ D(OP_Consider)
|
||||
D(OP_ConsiderCorpse)
|
||||
D(OP_Consume)
|
||||
D(OP_DeleteItem)
|
||||
D(OP_DzAddPlayer)
|
||||
D(OP_DzChooseZoneReply)
|
||||
D(OP_DzExpeditionInviteResponse)
|
||||
D(OP_DzMakeLeader)
|
||||
D(OP_DzRemovePlayer)
|
||||
D(OP_DzSwapPlayer)
|
||||
D(OP_Emote)
|
||||
D(OP_FaceChange)
|
||||
D(OP_FindPersonRequest)
|
||||
|
||||
+139
-27
@@ -444,7 +444,11 @@ struct NewZone_Struct {
|
||||
/*0848*/ int32 unknown848;
|
||||
/*0852*/ uint16 zone_id;
|
||||
/*0854*/ uint16 zone_instance;
|
||||
/*0856*/ char unknown856[20];
|
||||
/*0856*/ uint32 scriptNPCReceivedanItem;
|
||||
/*0860*/ uint32 bCheck; // padded bool
|
||||
/*0864*/ uint32 scriptIDSomething;
|
||||
/*0868*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
|
||||
/*0872*/ uint32 scriptIDSomething3;
|
||||
/*0876*/ uint32 SuspendBuffs;
|
||||
/*0880*/ uint32 unknown880; //seen 50
|
||||
/*0884*/ uint32 unknown884; //seen 10
|
||||
@@ -799,7 +803,7 @@ struct LeadershipAA_Struct {
|
||||
* Size: 20 Octets
|
||||
*/
|
||||
struct BindStruct {
|
||||
/*000*/ uint32 zoneId;
|
||||
/*000*/ uint32 zone_id;
|
||||
/*004*/ float x;
|
||||
/*008*/ float y;
|
||||
/*012*/ float z;
|
||||
@@ -1710,7 +1714,7 @@ struct GMZoneRequest_Struct {
|
||||
/*0068*/ float x;
|
||||
/*0072*/ float y;
|
||||
/*0076*/ float z;
|
||||
/*0080*/ char unknown0080[4];
|
||||
/*0080*/ float heading;
|
||||
/*0084*/ uint32 success; // 0 if command failed, 1 if succeeded?
|
||||
/*0088*/
|
||||
// /*072*/ int8 success; // =0 client->server, =1 server->client, -X=specific error
|
||||
@@ -4165,52 +4169,160 @@ struct VeteranReward
|
||||
/*012*/ VeteranRewardItem items[8];
|
||||
};
|
||||
|
||||
struct ExpeditionEntryHeader_Struct
|
||||
|
||||
struct ExpeditionInvite_Struct
|
||||
{
|
||||
/*000*/ uint32 unknown000;
|
||||
/*000*/ uint32 number_of_entries;
|
||||
/*000*/ uint32 client_id; // unique character id
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ char inviter_name[64];
|
||||
/*072*/ char expedition_name[128];
|
||||
/*200*/ uint8 swapping; // 0: adding 1: swapping
|
||||
/*201*/ char swap_name[64]; // if swapping, swap name being removed
|
||||
/*265*/ uint8 padding[3];
|
||||
/*268*/ uint16 dz_zone_id; // dz_id zone/instance pair, sent back in reply
|
||||
/*270*/ uint16 dz_instance_id;
|
||||
};
|
||||
|
||||
struct ExpeditionJoinPrompt_Struct
|
||||
struct ExpeditionInviteResponse_Struct
|
||||
{
|
||||
/*000*/ uint32 clientid;
|
||||
/*000*/ uint32 unknown000;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ char player_name[64];
|
||||
/*072*/ char expedition_name[64];
|
||||
/*008*/ uint16 dz_zone_id; // dz_id pair sent in invite
|
||||
/*010*/ uint16 dz_instance_id;
|
||||
/*012*/ uint8 accepted; // 0: declined 1: accepted
|
||||
/*013*/ uint8 swapping; // 0: adding 1: swapping (sent in invite)
|
||||
/*014*/ char swap_name[64]; // swap name sent in invite
|
||||
/*078*/ uint8 unknown078; // padding garbage?
|
||||
/*079*/ uint8 unknown079; // padding garbage?
|
||||
};
|
||||
|
||||
struct DynamicZoneInfo_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ uint32 assigned; // padded bool
|
||||
/*012*/ uint32 max_players;
|
||||
/*016*/ char dz_name[128];
|
||||
/*144*/ char leader_name[64];
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberEntry_Struct
|
||||
{
|
||||
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
|
||||
/*000*/ uint8 online_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberList_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 member_count; // number of players in window
|
||||
/*008*/ DynamicZoneMemberEntry_Struct members[0]; // variable length
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberListName_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ uint32 add_name; // padded bool, 0: remove name, 1: add name with unknown status
|
||||
/*012*/ char name[64];
|
||||
};
|
||||
|
||||
struct ExpeditionLockoutTimerEntry_Struct
|
||||
{
|
||||
/*000*/ char expedition_name[1]; // variable length, null terminated, max 0x80 (128)
|
||||
/*000*/ uint32 seconds_remaining;
|
||||
/*000*/ int32 event_type; // seen -1 (0xffffffff) for replay timers and 1 for event timers
|
||||
/*000*/ char event_name[1]; // variable length, null terminated, max 0x100 (256)
|
||||
};
|
||||
|
||||
struct ExpeditionLockoutTimers_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 count;
|
||||
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
|
||||
};
|
||||
|
||||
struct DynamicZoneLeaderName_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ char leader_name[64];
|
||||
};
|
||||
|
||||
struct ExpeditionCommand_Struct
|
||||
{
|
||||
/*000*/ uint32 unknown000;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ char name[64];
|
||||
};
|
||||
|
||||
struct ExpeditionCommandSwap_Struct
|
||||
{
|
||||
/*000*/ uint32 unknown000;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ char add_player_name[64]; // swap to (player must confirm)
|
||||
/*072*/ char rem_player_name[64]; // swap from
|
||||
};
|
||||
|
||||
struct ExpeditionExpireWarning
|
||||
{
|
||||
/*000*/ uint32 clientid;
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ uint32 minutes_remaining;
|
||||
};
|
||||
|
||||
struct ExpeditionInfo_Struct
|
||||
struct DynamicZoneCompassEntry_Struct
|
||||
{
|
||||
/*000*/ uint32 clientid;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*000*/ uint16 dz_zone_id; // target dz id pair
|
||||
/*002*/ uint16 dz_instance_id;
|
||||
/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
|
||||
/*008*/ uint32 unknown008;
|
||||
/*012*/ uint32 max_players;
|
||||
/*016*/ char expedition_name[128];
|
||||
/*142*/ char leader_name[64];
|
||||
};
|
||||
|
||||
struct ExpeditionCompassEntry_Struct
|
||||
{
|
||||
/*000*/ float unknown000; //seen *((uint32*)) = 1584791871
|
||||
/*004*/ uint32 enabled; //guess
|
||||
/*008*/ uint32 unknown008; //seen 1019
|
||||
/*012*/ float y;
|
||||
/*016*/ float x;
|
||||
/*020*/ float z;
|
||||
};
|
||||
|
||||
struct ExpeditionCompass_Struct
|
||||
struct DynamicZoneCompass_Struct
|
||||
{
|
||||
/*000*/ uint32 clientid;
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 count;
|
||||
/*008*/ ExpeditionCompassEntry_Struct entries[0];
|
||||
/*008*/ DynamicZoneCompassEntry_Struct entries[0];
|
||||
};
|
||||
|
||||
struct DynamicZoneChooseZoneEntry_Struct
|
||||
{
|
||||
/*000*/ uint16 dz_zone_id; // dz_id pair
|
||||
/*002*/ uint16 dz_instance_id;
|
||||
/*004*/ uint32 unknown_id1; // sent back in reply
|
||||
/*008*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest -- sent back in reply
|
||||
/*012*/ uint32 unknown_id2; // possibly an id based on dz type, for expeditions this was same as dz_id (zone|instance) but task dz was different
|
||||
/*016*/ char description[1]; // variable length, null terminated, max 0x80 (128)
|
||||
/*000*/ char leader_name[1]; // variable length, null terminated, max 0x40 (64)
|
||||
};
|
||||
|
||||
struct DynamicZoneChooseZone_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 count;
|
||||
/*008*/ DynamicZoneChooseZoneEntry_Struct choices[0];
|
||||
};
|
||||
|
||||
struct DynamicZoneChooseZoneReply_Struct
|
||||
{
|
||||
/*000*/ uint32 unknown000; // ff ff ff ff
|
||||
/*004*/ uint32 unknown004; // seen 69 00 00 00
|
||||
/*008*/ uint32 unknown008; // ff ff ff ff
|
||||
/*012*/ uint32 unknown_id1; // from choose zone entry message
|
||||
/*016*/ uint16 dz_zone_id; // dz_id pair
|
||||
/*018*/ uint16 dz_instance_id;
|
||||
/*020*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest
|
||||
/*024*/ uint32 unknown_id2; // from choose zone entry message
|
||||
/*028*/ uint32 unknown028; // 00 00 00 00
|
||||
/*032*/ uint32 unknown032; // always same as unknown044
|
||||
/*036*/ uint32 unknown036;
|
||||
/*040*/ uint32 unknown040;
|
||||
/*044*/ uint32 unknown044; // always same as unknown032
|
||||
/*048*/ uint32 unknown048; // seen 01 00 00 00 and 02 00 00 00
|
||||
};
|
||||
|
||||
struct AltCurrencySelectItem_Struct {
|
||||
|
||||
+184
-75
@@ -471,14 +471,48 @@ namespace SoF
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzChooseZone)
|
||||
{
|
||||
SETUP_VAR_ENCODE(DynamicZoneChooseZone_Struct);
|
||||
|
||||
SerializeBuffer buf;
|
||||
buf.WriteUInt32(emu->client_id);
|
||||
buf.WriteUInt32(emu->count);
|
||||
|
||||
for (uint32 i = 0; i < emu->count; ++i)
|
||||
{
|
||||
buf.WriteUInt16(emu->choices[i].dz_zone_id);
|
||||
buf.WriteUInt16(emu->choices[i].dz_instance_id);
|
||||
buf.WriteUInt32(emu->choices[i].unknown_id1);
|
||||
buf.WriteUInt32(emu->choices[i].dz_type);
|
||||
buf.WriteUInt32(emu->choices[i].unknown_id2);
|
||||
buf.WriteString(emu->choices[i].description);
|
||||
buf.WriteString(emu->choices[i].leader_name);
|
||||
}
|
||||
|
||||
__packet->size = buf.size();
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzCompass)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionCompass_Struct);
|
||||
ALLOC_VAR_ENCODE(structs::ExpeditionCompass_Struct, sizeof(structs::ExpeditionInfo_Struct) + sizeof(structs::ExpeditionCompassEntry_Struct) * emu->count);
|
||||
SETUP_VAR_ENCODE(DynamicZoneCompass_Struct);
|
||||
ALLOC_VAR_ENCODE(structs::DynamicZoneCompass_Struct,
|
||||
sizeof(structs::DynamicZoneCompass_Struct) +
|
||||
sizeof(structs::DynamicZoneCompassEntry_Struct) * emu->count
|
||||
);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(count);
|
||||
|
||||
for (uint32 i = 0; i < emu->count; ++i)
|
||||
{
|
||||
OUT(entries[i].dz_zone_id);
|
||||
OUT(entries[i].dz_instance_id);
|
||||
OUT(entries[i].dz_type);
|
||||
OUT(entries[i].x);
|
||||
OUT(entries[i].y);
|
||||
OUT(entries[i].z);
|
||||
@@ -499,111 +533,108 @@ namespace SoF
|
||||
|
||||
ENCODE(OP_DzExpeditionInfo)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneInfo_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneInfo_Struct, structs::DynamicZoneInfo_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(assigned);
|
||||
OUT(max_players);
|
||||
eq->enabled_max = 1;
|
||||
strcpy(eq->expedition_name, emu->expedition_name);
|
||||
strcpy(eq->leader_name, emu->leader_name);
|
||||
strn0cpy(eq->dz_name, emu->dz_name, sizeof(eq->dz_name));
|
||||
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzExpeditionList)
|
||||
ENCODE(OP_DzExpeditionInvite)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionLockoutList_Struct);
|
||||
ENCODE_LENGTH_EXACT(ExpeditionInvite_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionInvite_Struct, structs::ExpeditionInvite_Struct);
|
||||
|
||||
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
||||
uint32 client_id = 0;
|
||||
uint8 null_term = 0;
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&emu->count, sizeof(uint32));
|
||||
for (int i = 0; i < emu->count; ++i)
|
||||
OUT(client_id);
|
||||
strn0cpy(eq->inviter_name, emu->inviter_name, sizeof(eq->inviter_name));
|
||||
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
|
||||
OUT(swapping);
|
||||
strn0cpy(eq->swap_name, emu->swap_name, sizeof(eq->swap_name));
|
||||
OUT(dz_zone_id);
|
||||
OUT(dz_instance_id);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzExpeditionLockoutTimers)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionLockoutTimers_Struct);
|
||||
|
||||
SerializeBuffer buf;
|
||||
buf.WriteUInt32(emu->client_id);
|
||||
buf.WriteUInt32(emu->count);
|
||||
for (uint32 i = 0; i < emu->count; ++i)
|
||||
{
|
||||
ss.write(emu->entries[i].expedition, strlen(emu->entries[i].expedition));
|
||||
ss.write((const char*)&null_term, sizeof(char));
|
||||
ss.write((const char*)&emu->entries[i].time_left, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write(emu->entries[i].expedition_event, strlen(emu->entries[i].expedition_event));
|
||||
ss.write((const char*)&null_term, sizeof(char));
|
||||
buf.WriteString(emu->timers[i].expedition_name);
|
||||
buf.WriteUInt32(emu->timers[i].seconds_remaining);
|
||||
buf.WriteInt32(emu->timers[i].event_type);
|
||||
buf.WriteString(emu->timers[i].event_name);
|
||||
}
|
||||
|
||||
__packet->size = ss.str().length();
|
||||
__packet->size = buf.size();
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
|
||||
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzJoinExpeditionConfirm)
|
||||
ENCODE(OP_DzSetLeaderName)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(ExpeditionJoinPrompt_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionJoinPrompt_Struct, structs::ExpeditionJoinPrompt_Struct);
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneLeaderName_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneLeaderName_Struct, structs::DynamicZoneLeaderName_Struct);
|
||||
|
||||
strcpy(eq->expedition_name, emu->expedition_name);
|
||||
strcpy(eq->player_name, emu->player_name);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzLeaderStatus)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionLeaderSet_Struct);
|
||||
|
||||
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
||||
uint32 client_id = 0;
|
||||
uint8 null_term = 0;
|
||||
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
//ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write(emu->leader_name, strlen(emu->leader_name));
|
||||
ss.write((const char*)&null_term, sizeof(char));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));//0xffffffff
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));//1
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
|
||||
__packet->size = ss.str().length();
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
|
||||
OUT(client_id);
|
||||
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzMemberList)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
|
||||
SETUP_VAR_ENCODE(DynamicZoneMemberList_Struct);
|
||||
|
||||
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
||||
|
||||
uint32 client_id = 0;
|
||||
uint8 null_term = 0;
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&emu->count, sizeof(uint32));
|
||||
for (uint32 i = 0; i < emu->count; ++i)
|
||||
SerializeBuffer buf;
|
||||
buf.WriteUInt32(emu->client_id);
|
||||
buf.WriteUInt32(emu->member_count);
|
||||
for (uint32 i = 0; i < emu->member_count; ++i)
|
||||
{
|
||||
ss.write(emu->entries[i].name, strlen(emu->entries[i].name));
|
||||
ss.write((const char*)&null_term, sizeof(char));
|
||||
ss.write((const char*)&emu->entries[i].status, sizeof(char));
|
||||
buf.WriteString(emu->members[i].name);
|
||||
buf.WriteUInt8(emu->members[i].online_status);
|
||||
}
|
||||
|
||||
__packet->size = ss.str().length();
|
||||
__packet->size = buf.size();
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
|
||||
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzMemberListName)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneMemberListName_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneMemberListName_Struct, structs::DynamicZoneMemberListName_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(add_name);
|
||||
strn0cpy(eq->name, emu->name, sizeof(eq->name));
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzMemberListStatus)
|
||||
{
|
||||
auto emu = reinterpret_cast<DynamicZoneMemberList_Struct*>((*p)->pBuffer);
|
||||
if (emu->member_count == 1)
|
||||
{
|
||||
ENCODE_FORWARD(OP_DzMemberList);
|
||||
}
|
||||
}
|
||||
|
||||
ENCODE(OP_Emote)
|
||||
{
|
||||
EQApplicationPacket *in = *p;
|
||||
@@ -1030,6 +1061,7 @@ namespace SoF
|
||||
OUT(FastRegenHP);
|
||||
OUT(FastRegenMana);
|
||||
OUT(FastRegenEndurance);
|
||||
OUT(underworld_teleport_index);
|
||||
|
||||
/*fill in some unknowns with observed values, hopefully it will help */
|
||||
eq->unknown796 = -1;
|
||||
@@ -1108,7 +1140,7 @@ namespace SoF
|
||||
eq->level1 = emu->level;
|
||||
// OUT(unknown00022[2]);
|
||||
for (r = 0; r < 5; r++) {
|
||||
OUT(binds[r].zoneId);
|
||||
OUT(binds[r].zone_id);
|
||||
OUT(binds[r].x);
|
||||
OUT(binds[r].y);
|
||||
OUT(binds[r].z);
|
||||
@@ -2434,6 +2466,83 @@ namespace SoF
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzAddPlayer)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
|
||||
|
||||
strn0cpy(emu->name, eq->name, sizeof(emu->name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzChooseZoneReply)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::DynamicZoneChooseZoneReply_Struct);
|
||||
SETUP_DIRECT_DECODE(DynamicZoneChooseZoneReply_Struct, structs::DynamicZoneChooseZoneReply_Struct);
|
||||
|
||||
emu->unknown000 = eq->unknown000;
|
||||
emu->unknown008 = eq->unknown004;
|
||||
IN(unknown_id1);
|
||||
IN(dz_zone_id);
|
||||
IN(dz_instance_id);
|
||||
IN(dz_type);
|
||||
IN(unknown_id2);
|
||||
emu->unknown028 = eq->unknown024;
|
||||
emu->unknown032 = eq->unknown028;
|
||||
emu->unknown036 = eq->unknown032;
|
||||
emu->unknown040 = eq->unknown036;
|
||||
emu->unknown044 = eq->unknown040;
|
||||
emu->unknown048 = eq->unknown044;
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzExpeditionInviteResponse)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionInviteResponse_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionInviteResponse_Struct, structs::ExpeditionInviteResponse_Struct);
|
||||
|
||||
IN(dz_zone_id);
|
||||
IN(dz_instance_id);
|
||||
IN(accepted);
|
||||
IN(swapping);
|
||||
strn0cpy(emu->swap_name, eq->swap_name, sizeof(emu->swap_name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzMakeLeader)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
|
||||
|
||||
strn0cpy(emu->name, eq->name, sizeof(emu->name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzRemovePlayer)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
|
||||
|
||||
strn0cpy(emu->name, eq->name, sizeof(emu->name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzSwapPlayer)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionCommandSwap_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionCommandSwap_Struct, structs::ExpeditionCommandSwap_Struct);
|
||||
|
||||
strn0cpy(emu->add_player_name, eq->add_player_name, sizeof(emu->add_player_name));
|
||||
strn0cpy(emu->rem_player_name, eq->rem_player_name, sizeof(emu->rem_player_name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_Emote)
|
||||
{
|
||||
unsigned char *__eq_buffer = __packet->pBuffer;
|
||||
|
||||
@@ -36,13 +36,16 @@ E(OP_Damage)
|
||||
E(OP_DeleteCharge)
|
||||
E(OP_DeleteItem)
|
||||
E(OP_DeleteSpawn)
|
||||
E(OP_DzChooseZone)
|
||||
E(OP_DzCompass)
|
||||
E(OP_DzExpeditionEndsWarning)
|
||||
E(OP_DzExpeditionInfo)
|
||||
E(OP_DzExpeditionList)
|
||||
E(OP_DzJoinExpeditionConfirm)
|
||||
E(OP_DzLeaderStatus)
|
||||
E(OP_DzExpeditionInvite)
|
||||
E(OP_DzExpeditionLockoutTimers)
|
||||
E(OP_DzMemberList)
|
||||
E(OP_DzMemberListName)
|
||||
E(OP_DzMemberListStatus)
|
||||
E(OP_DzSetLeaderName)
|
||||
E(OP_Emote)
|
||||
E(OP_ExpansionInfo)
|
||||
E(OP_FormattedMessage)
|
||||
@@ -103,6 +106,12 @@ D(OP_Consider)
|
||||
D(OP_ConsiderCorpse)
|
||||
D(OP_Consume)
|
||||
D(OP_DeleteItem)
|
||||
D(OP_DzAddPlayer)
|
||||
D(OP_DzChooseZoneReply)
|
||||
D(OP_DzExpeditionInviteResponse)
|
||||
D(OP_DzMakeLeader)
|
||||
D(OP_DzRemovePlayer)
|
||||
D(OP_DzSwapPlayer)
|
||||
D(OP_Emote)
|
||||
D(OP_FaceChange)
|
||||
D(OP_FindPersonRequest)
|
||||
|
||||
+135
-24
@@ -448,7 +448,11 @@ struct NewZone_Struct {
|
||||
/*0844*/ int32 unknown844;
|
||||
/*0848*/ uint16 zone_id;
|
||||
/*0850*/ uint16 zone_instance;
|
||||
/*0852*/ char unknown852[20];
|
||||
/*0852*/ uint32 scriptNPCReceivedanItem;
|
||||
/*0856*/ uint32 bCheck; // padded bool
|
||||
/*0860*/ uint32 scriptIDSomething;
|
||||
/*0864*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
|
||||
/*0868*/ uint32 scriptIDSomething3;
|
||||
/*0872*/ uint32 SuspendBuffs;
|
||||
/*0876*/ uint32 unknown876; //seen 50
|
||||
/*0880*/ uint32 unknown880; //seen 10
|
||||
@@ -800,7 +804,7 @@ struct LeadershipAA_Struct {
|
||||
* Size: 20 Octets
|
||||
*/
|
||||
struct BindStruct {
|
||||
/*000*/ uint32 zoneId;
|
||||
/*000*/ uint32 zone_id;
|
||||
/*004*/ float x;
|
||||
/*008*/ float y;
|
||||
/*012*/ float z;
|
||||
@@ -1738,7 +1742,7 @@ struct GMZoneRequest_Struct {
|
||||
/*0068*/ float x;
|
||||
/*0072*/ float y;
|
||||
/*0076*/ float z;
|
||||
/*0080*/ char unknown0080[4];
|
||||
/*0080*/ float heading;
|
||||
/*0084*/ uint32 success; // 0 if command failed, 1 if succeeded?
|
||||
/*0088*/
|
||||
// /*072*/ int8 success; // =0 client->server, =1 server->client, -X=specific error
|
||||
@@ -4084,43 +4088,150 @@ struct VeteranReward
|
||||
/*012*/ VeteranRewardItem items[8];
|
||||
};
|
||||
|
||||
struct ExpeditionExpireWarning
|
||||
struct ExpeditionInvite_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ char inviter_name[64];
|
||||
/*068*/ char expedition_name[128];
|
||||
/*196*/ uint8 swapping; // 0: adding 1: swapping
|
||||
/*197*/ char swap_name[64]; // if swapping, swap name being removed
|
||||
/*261*/ uint8 padding[3];
|
||||
/*264*/ uint16 dz_zone_id; // dz_id zone/instance pair, sent back in reply
|
||||
/*268*/ uint16 dz_instance_id;
|
||||
};
|
||||
|
||||
struct ExpeditionInviteResponse_Struct
|
||||
{
|
||||
/*000*/ uint32 unknown000;
|
||||
/*004*/ uint16 dz_zone_id; // dz_id pair sent in invite
|
||||
/*006*/ uint16 dz_instance_id;
|
||||
/*008*/ uint8 accepted; // 0: declined 1: accepted
|
||||
/*009*/ uint8 swapping; // 0: adding 1: swapping (sent in invite)
|
||||
/*010*/ char swap_name[64]; // swap name sent in invite
|
||||
/*074*/ uint8 unknown078; // padding/garbage?
|
||||
/*075*/ uint8 unknown079; // padding/garbage?
|
||||
};
|
||||
|
||||
struct DynamicZoneInfo_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 assigned; // padded bool
|
||||
/*008*/ uint32 max_players;
|
||||
/*012*/ char dz_name[128];
|
||||
/*140*/ char leader_name[64];
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberEntry_Struct
|
||||
{
|
||||
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
|
||||
/*000*/ uint8 online_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberList_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 member_count;
|
||||
/*008*/ DynamicZoneMemberEntry_Struct members[0]; // variable length
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberListName_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 add_name; // padded bool, 0: remove name, 1: add name with unknown status
|
||||
/*008*/ char name[64];
|
||||
};
|
||||
|
||||
struct ExpeditionLockoutTimerEntry_Struct
|
||||
{
|
||||
/*000*/ char expedition_name[1]; // variable length, null terminated, max 0x80 (128)
|
||||
/*000*/ uint32 seconds_remaining;
|
||||
/*000*/ int32 event_type; // seen -1 (0xffffffff) for replay timers and 1 for event timers
|
||||
/*000*/ char event_name[1]; // variable length, null terminated, max 0x100 (256)
|
||||
};
|
||||
|
||||
struct ExpeditionLockoutTimers_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 count;
|
||||
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
|
||||
};
|
||||
|
||||
struct DynamicZoneLeaderName_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ char leader_name[64];
|
||||
};
|
||||
|
||||
struct ExpeditionCommand_Struct
|
||||
{
|
||||
/*000*/ uint32 unknown000;
|
||||
/*004*/ char name[64];
|
||||
};
|
||||
|
||||
struct ExpeditionCommandSwap_Struct
|
||||
{
|
||||
/*000*/ uint32 unknown000;
|
||||
/*004*/ char add_player_name[64]; // swap to (player must confirm)
|
||||
/*068*/ char rem_player_name[64]; // swap from
|
||||
};
|
||||
|
||||
struct ExpeditionExpireWarning
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 minutes_remaining;
|
||||
};
|
||||
|
||||
struct ExpeditionInfo_Struct
|
||||
struct DynamicZoneCompassEntry_Struct
|
||||
{
|
||||
/*000*/ uint32 clientid;
|
||||
/*004*/ uint32 enabled_max;
|
||||
/*008*/ uint32 max_players;
|
||||
/*012*/ char expedition_name[128];
|
||||
/*142*/ char leader_name[64];
|
||||
};
|
||||
|
||||
struct ExpeditionCompassEntry_Struct
|
||||
{
|
||||
/*000*/ float unknown000; //seen *((uint32*)) = 1584791871
|
||||
/*004*/ uint32 enabled; //guess
|
||||
/*008*/ uint32 unknown008; //seen 1019
|
||||
/*000*/ uint16 dz_zone_id; // target dz id pair
|
||||
/*002*/ uint16 dz_instance_id;
|
||||
/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
|
||||
/*008*/ uint32 unknown008;
|
||||
/*012*/ float y;
|
||||
/*016*/ float x;
|
||||
/*020*/ float z;
|
||||
};
|
||||
|
||||
struct ExpeditionCompass_Struct
|
||||
struct DynamicZoneCompass_Struct
|
||||
{
|
||||
/*000*/ uint32 clientid;
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 count;
|
||||
/*008*/ ExpeditionCompassEntry_Struct entries[0];
|
||||
/*008*/ DynamicZoneCompassEntry_Struct entries[0];
|
||||
};
|
||||
|
||||
struct ExpeditionJoinPrompt_Struct
|
||||
struct DynamicZoneChooseZoneEntry_Struct
|
||||
{
|
||||
/*000*/ uint32 clientid;
|
||||
/*004*/ char player_name[64];
|
||||
/*068*/ char expedition_name[64];
|
||||
/*000*/ uint16 dz_zone_id; // dz_id pair
|
||||
/*002*/ uint16 dz_instance_id;
|
||||
/*004*/ uint32 unknown_id1; // sent back in reply
|
||||
/*008*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest -- sent back in reply
|
||||
/*012*/ uint32 unknown_id2; // possibly an id based on dz type, for expeditions this was same as dz_id (zone|instance) but task dz was different
|
||||
/*016*/ char description[1]; // variable length, null terminated, max 0x80 (128)
|
||||
/*000*/ char leader_name[1]; // variable length, null terminated, max 0x40 (64)
|
||||
};
|
||||
|
||||
struct DynamicZoneChooseZone_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 count;
|
||||
/*008*/ DynamicZoneChooseZoneEntry_Struct choices[0];
|
||||
};
|
||||
|
||||
struct DynamicZoneChooseZoneReply_Struct
|
||||
{
|
||||
/*000*/ uint32 unknown000;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ uint32 unknown_id1;
|
||||
/*012*/ uint16 dz_zone_id;
|
||||
/*014*/ uint16 dz_instance_id;
|
||||
/*016*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest
|
||||
/*020*/ uint32 unknown_id2;
|
||||
/*024*/ uint32 unknown024;
|
||||
/*028*/ uint32 unknown028; // always same as unknown040
|
||||
/*032*/ uint32 unknown032;
|
||||
/*036*/ uint32 unknown036;
|
||||
/*040*/ uint32 unknown040; // always same as unknown028
|
||||
/*044*/ uint32 unknown044;
|
||||
};
|
||||
|
||||
struct AltCurrencySelectItem_Struct {
|
||||
|
||||
+181
-74
@@ -414,15 +414,48 @@ namespace Titanium
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzChooseZone)
|
||||
{
|
||||
SETUP_VAR_ENCODE(DynamicZoneChooseZone_Struct);
|
||||
|
||||
SerializeBuffer buf;
|
||||
buf.WriteUInt32(emu->client_id);
|
||||
buf.WriteUInt32(emu->count);
|
||||
|
||||
for (uint32 i = 0; i < emu->count; ++i)
|
||||
{
|
||||
buf.WriteUInt16(emu->choices[i].dz_zone_id);
|
||||
buf.WriteUInt16(emu->choices[i].dz_instance_id);
|
||||
buf.WriteUInt32(emu->choices[i].unknown_id1);
|
||||
buf.WriteUInt32(emu->choices[i].dz_type);
|
||||
buf.WriteUInt32(emu->choices[i].unknown_id2);
|
||||
buf.WriteString(emu->choices[i].description);
|
||||
buf.WriteString(emu->choices[i].leader_name);
|
||||
}
|
||||
|
||||
__packet->size = buf.size();
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzCompass)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionCompass_Struct);
|
||||
ALLOC_VAR_ENCODE(structs::ExpeditionCompass_Struct, sizeof(structs::ExpeditionInfo_Struct) + sizeof(structs::ExpeditionCompassEntry_Struct) * emu->count);
|
||||
SETUP_VAR_ENCODE(DynamicZoneCompass_Struct);
|
||||
ALLOC_VAR_ENCODE(structs::DynamicZoneCompass_Struct,
|
||||
sizeof(structs::DynamicZoneCompass_Struct) +
|
||||
sizeof(structs::DynamicZoneCompassEntry_Struct) * emu->count
|
||||
);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(count);
|
||||
|
||||
for (uint32 i = 0; i < emu->count; ++i)
|
||||
{
|
||||
OUT(entries[i].dz_zone_id);
|
||||
OUT(entries[i].dz_instance_id);
|
||||
OUT(entries[i].dz_type);
|
||||
OUT(entries[i].x);
|
||||
OUT(entries[i].y);
|
||||
OUT(entries[i].z);
|
||||
@@ -443,111 +476,108 @@ namespace Titanium
|
||||
|
||||
ENCODE(OP_DzExpeditionInfo)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneInfo_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneInfo_Struct, structs::DynamicZoneInfo_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(assigned);
|
||||
OUT(max_players);
|
||||
eq->enabled_max = 1;
|
||||
strcpy(eq->expedition_name, emu->expedition_name);
|
||||
strcpy(eq->leader_name, emu->leader_name);
|
||||
strn0cpy(eq->dz_name, emu->dz_name, sizeof(eq->dz_name));
|
||||
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzExpeditionList)
|
||||
ENCODE(OP_DzExpeditionInvite)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionLockoutList_Struct);
|
||||
ENCODE_LENGTH_EXACT(ExpeditionInvite_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionInvite_Struct, structs::ExpeditionInvite_Struct);
|
||||
|
||||
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
||||
uint32 client_id = 0;
|
||||
uint8 null_term = 0;
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&emu->count, sizeof(uint32));
|
||||
OUT(client_id);
|
||||
strn0cpy(eq->inviter_name, emu->inviter_name, sizeof(eq->inviter_name));
|
||||
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
|
||||
OUT(swapping);
|
||||
strn0cpy(eq->swap_name, emu->swap_name, sizeof(eq->swap_name));
|
||||
OUT(dz_zone_id);
|
||||
OUT(dz_instance_id);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzExpeditionLockoutTimers)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionLockoutTimers_Struct);
|
||||
|
||||
SerializeBuffer buf;
|
||||
buf.WriteUInt32(emu->client_id);
|
||||
buf.WriteUInt32(emu->count);
|
||||
for (uint32 i = 0; i < emu->count; ++i)
|
||||
{
|
||||
ss.write(emu->entries[i].expedition, strlen(emu->entries[i].expedition));
|
||||
ss.write((const char*)&null_term, sizeof(char));
|
||||
ss.write((const char*)&emu->entries[i].time_left, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write(emu->entries[i].expedition_event, strlen(emu->entries[i].expedition_event));
|
||||
ss.write((const char*)&null_term, sizeof(char));
|
||||
buf.WriteString(emu->timers[i].expedition_name);
|
||||
buf.WriteUInt32(emu->timers[i].seconds_remaining);
|
||||
buf.WriteInt32(emu->timers[i].event_type);
|
||||
buf.WriteString(emu->timers[i].event_name);
|
||||
}
|
||||
|
||||
__packet->size = ss.str().length();
|
||||
__packet->size = buf.size();
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
|
||||
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzJoinExpeditionConfirm)
|
||||
ENCODE(OP_DzSetLeaderName)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(ExpeditionJoinPrompt_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionJoinPrompt_Struct, structs::ExpeditionJoinPrompt_Struct);
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneLeaderName_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneLeaderName_Struct, structs::DynamicZoneLeaderName_Struct);
|
||||
|
||||
strcpy(eq->expedition_name, emu->expedition_name);
|
||||
strcpy(eq->player_name, emu->player_name);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzLeaderStatus)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionLeaderSet_Struct);
|
||||
|
||||
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
||||
uint32 client_id = 0;
|
||||
uint8 null_term = 0;
|
||||
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
//ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write(emu->leader_name, strlen(emu->leader_name));
|
||||
ss.write((const char*)&null_term, sizeof(char));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));//0xffffffff
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));//1
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
|
||||
__packet->size = ss.str().length();
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
|
||||
OUT(client_id);
|
||||
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzMemberList)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
|
||||
SETUP_VAR_ENCODE(DynamicZoneMemberList_Struct);
|
||||
|
||||
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
||||
|
||||
uint32 client_id = 0;
|
||||
uint8 null_term = 0;
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&emu->count, sizeof(uint32));
|
||||
for (uint32 i = 0; i < emu->count; ++i)
|
||||
SerializeBuffer buf;
|
||||
buf.WriteUInt32(emu->client_id);
|
||||
buf.WriteUInt32(emu->member_count);
|
||||
for (uint32 i = 0; i < emu->member_count; ++i)
|
||||
{
|
||||
ss.write(emu->entries[i].name, strlen(emu->entries[i].name));
|
||||
ss.write((const char*)&null_term, sizeof(char));
|
||||
ss.write((const char*)&emu->entries[i].status, sizeof(char));
|
||||
buf.WriteString(emu->members[i].name);
|
||||
buf.WriteUInt8(emu->members[i].online_status);
|
||||
}
|
||||
|
||||
__packet->size = ss.str().length();
|
||||
__packet->size = buf.size();
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
|
||||
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzMemberListName)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneMemberListName_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneMemberListName_Struct, structs::DynamicZoneMemberListName_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(add_name);
|
||||
strn0cpy(eq->name, emu->name, sizeof(eq->name));
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzMemberListStatus)
|
||||
{
|
||||
auto emu = reinterpret_cast<DynamicZoneMemberList_Struct*>((*p)->pBuffer);
|
||||
if (emu->member_count == 1)
|
||||
{
|
||||
ENCODE_FORWARD(OP_DzMemberList);
|
||||
}
|
||||
}
|
||||
|
||||
ENCODE(OP_Emote)
|
||||
{
|
||||
EQApplicationPacket *in = *p;
|
||||
@@ -992,7 +1022,7 @@ namespace Titanium
|
||||
eq->level1 = emu->level;
|
||||
// OUT(unknown00022[2]);
|
||||
for (r = 0; r < 5; r++) {
|
||||
OUT(binds[r].zoneId);
|
||||
OUT(binds[r].zone_id);
|
||||
OUT(binds[r].x);
|
||||
OUT(binds[r].y);
|
||||
OUT(binds[r].z);
|
||||
@@ -1943,6 +1973,83 @@ namespace Titanium
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzAddPlayer)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
|
||||
|
||||
strn0cpy(emu->name, eq->name, sizeof(emu->name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzChooseZoneReply)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::DynamicZoneChooseZoneReply_Struct);
|
||||
SETUP_DIRECT_DECODE(DynamicZoneChooseZoneReply_Struct, structs::DynamicZoneChooseZoneReply_Struct);
|
||||
|
||||
emu->unknown000 = eq->unknown000;
|
||||
emu->unknown008 = eq->unknown004;
|
||||
IN(unknown_id1);
|
||||
IN(dz_zone_id);
|
||||
IN(dz_instance_id);
|
||||
IN(dz_type);
|
||||
IN(unknown_id2);
|
||||
emu->unknown028 = eq->unknown024;
|
||||
emu->unknown032 = eq->unknown028;
|
||||
emu->unknown036 = eq->unknown032;
|
||||
emu->unknown040 = eq->unknown036;
|
||||
emu->unknown044 = eq->unknown040;
|
||||
emu->unknown048 = eq->unknown044;
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzExpeditionInviteResponse)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionInviteResponse_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionInviteResponse_Struct, structs::ExpeditionInviteResponse_Struct);
|
||||
|
||||
IN(dz_zone_id);
|
||||
IN(dz_instance_id);
|
||||
IN(accepted);
|
||||
IN(swapping);
|
||||
strn0cpy(emu->swap_name, eq->swap_name, sizeof(emu->swap_name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzMakeLeader)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
|
||||
|
||||
strn0cpy(emu->name, eq->name, sizeof(emu->name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzRemovePlayer)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
|
||||
|
||||
strn0cpy(emu->name, eq->name, sizeof(emu->name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzSwapPlayer)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionCommandSwap_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionCommandSwap_Struct, structs::ExpeditionCommandSwap_Struct);
|
||||
|
||||
strn0cpy(emu->add_player_name, eq->add_player_name, sizeof(emu->add_player_name));
|
||||
strn0cpy(emu->rem_player_name, eq->rem_player_name, sizeof(emu->rem_player_name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_Emote)
|
||||
{
|
||||
unsigned char *__eq_buffer = __packet->pBuffer;
|
||||
|
||||
@@ -32,13 +32,16 @@ E(OP_Damage)
|
||||
E(OP_DeleteCharge)
|
||||
E(OP_DeleteItem)
|
||||
E(OP_DeleteSpawn)
|
||||
E(OP_DzChooseZone)
|
||||
E(OP_DzCompass)
|
||||
E(OP_DzExpeditionEndsWarning)
|
||||
E(OP_DzExpeditionInfo)
|
||||
E(OP_DzExpeditionList)
|
||||
E(OP_DzJoinExpeditionConfirm)
|
||||
E(OP_DzLeaderStatus)
|
||||
E(OP_DzExpeditionInvite)
|
||||
E(OP_DzExpeditionLockoutTimers)
|
||||
E(OP_DzMemberList)
|
||||
E(OP_DzMemberListName)
|
||||
E(OP_DzMemberListStatus)
|
||||
E(OP_DzSetLeaderName)
|
||||
E(OP_Emote)
|
||||
E(OP_FormattedMessage)
|
||||
E(OP_GroundSpawn)
|
||||
@@ -86,6 +89,12 @@ D(OP_CharacterCreate)
|
||||
D(OP_ClientUpdate)
|
||||
D(OP_Consume)
|
||||
D(OP_DeleteItem)
|
||||
D(OP_DzAddPlayer)
|
||||
D(OP_DzChooseZoneReply)
|
||||
D(OP_DzExpeditionInviteResponse)
|
||||
D(OP_DzMakeLeader)
|
||||
D(OP_DzRemovePlayer)
|
||||
D(OP_DzSwapPlayer)
|
||||
D(OP_Emote)
|
||||
D(OP_FaceChange)
|
||||
D(OP_InspectAnswer)
|
||||
|
||||
@@ -738,7 +738,7 @@ struct LeadershipAA_Struct {
|
||||
* Size: 20 Octets
|
||||
*/
|
||||
struct BindStruct {
|
||||
/*000*/ uint32 zoneId;
|
||||
/*000*/ uint32 zone_id;
|
||||
/*004*/ float x;
|
||||
/*008*/ float y;
|
||||
/*012*/ float z;
|
||||
@@ -1509,7 +1509,7 @@ struct GMZoneRequest_Struct {
|
||||
/*0068*/ float x;
|
||||
/*0072*/ float y;
|
||||
/*0076*/ float z;
|
||||
/*0080*/ char unknown0080[4];
|
||||
/*0080*/ float heading;
|
||||
/*0084*/ uint32 success; // 0 if command failed, 1 if succeeded?
|
||||
/*0088*/
|
||||
// /*072*/ int8 success; // =0 client->server, =1 server->client, -X=specific error
|
||||
@@ -3299,43 +3299,150 @@ struct VeteranReward
|
||||
/*004*/ VeteranRewardItem item;
|
||||
};
|
||||
|
||||
struct ExpeditionExpireWarning
|
||||
struct ExpeditionInvite_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ char inviter_name[64];
|
||||
/*068*/ char expedition_name[128];
|
||||
/*196*/ uint8 swapping; // 0: adding 1: swapping
|
||||
/*197*/ char swap_name[64]; // if swapping, swap name being removed
|
||||
/*261*/ uint8 padding[3];
|
||||
/*264*/ uint16 dz_zone_id; // dz_id zone/instance pair, sent back in reply
|
||||
/*268*/ uint16 dz_instance_id;
|
||||
};
|
||||
|
||||
struct ExpeditionInviteResponse_Struct
|
||||
{
|
||||
/*000*/ uint32 unknown000;
|
||||
/*004*/ uint16 dz_zone_id; // dz_id pair sent in invite
|
||||
/*006*/ uint16 dz_instance_id;
|
||||
/*008*/ uint8 accepted; // 0: declined 1: accepted
|
||||
/*009*/ uint8 swapping; // 0: adding 1: swapping (sent in invite)
|
||||
/*010*/ char swap_name[64]; // swap name sent in invite
|
||||
/*074*/ uint8 unknown078; // padding/garbage?
|
||||
/*075*/ uint8 unknown079; // padding/garbage?
|
||||
};
|
||||
|
||||
struct DynamicZoneInfo_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 assigned; // padded bool
|
||||
/*008*/ uint32 max_players;
|
||||
/*012*/ char dz_name[128];
|
||||
/*140*/ char leader_name[64];
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberEntry_Struct
|
||||
{
|
||||
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
|
||||
/*000*/ uint8 online_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberList_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 member_count;
|
||||
/*008*/ DynamicZoneMemberEntry_Struct members[0]; // variable length
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberListName_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 add_name; // padded bool, 0: remove name, 1: add name with unknown status
|
||||
/*008*/ char name[64];
|
||||
};
|
||||
|
||||
struct ExpeditionLockoutTimerEntry_Struct
|
||||
{
|
||||
/*000*/ char expedition_name[1]; // variable length, null terminated, max 0x80 (128)
|
||||
/*000*/ uint32 seconds_remaining;
|
||||
/*000*/ int32 event_type; // seen -1 (0xffffffff) for replay timers and 1 for event timers
|
||||
/*000*/ char event_name[1]; // variable length, null terminated, max 0x100 (256)
|
||||
};
|
||||
|
||||
struct ExpeditionLockoutTimers_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 count;
|
||||
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
|
||||
};
|
||||
|
||||
struct DynamicZoneLeaderName_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ char leader_name[64];
|
||||
};
|
||||
|
||||
struct ExpeditionCommand_Struct
|
||||
{
|
||||
/*000*/ uint32 unknown000;
|
||||
/*004*/ char name[64];
|
||||
};
|
||||
|
||||
struct ExpeditionCommandSwap_Struct
|
||||
{
|
||||
/*000*/ uint32 unknown000;
|
||||
/*004*/ char add_player_name[64]; // swap to (player must confirm)
|
||||
/*068*/ char rem_player_name[64]; // swap from
|
||||
};
|
||||
|
||||
struct ExpeditionExpireWarning
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 minutes_remaining;
|
||||
};
|
||||
|
||||
struct ExpeditionInfo_Struct
|
||||
struct DynamicZoneCompassEntry_Struct
|
||||
{
|
||||
/*000*/ uint32 clientid;
|
||||
/*004*/ uint32 enabled_max;
|
||||
/*008*/ uint32 max_players;
|
||||
/*012*/ char expedition_name[128];
|
||||
/*142*/ char leader_name[64];
|
||||
};
|
||||
|
||||
struct ExpeditionCompassEntry_Struct
|
||||
{
|
||||
/*000*/ float unknown000; //seen *((uint32*)) = 1584791871
|
||||
/*004*/ uint32 enabled; //guess
|
||||
/*008*/ uint32 unknown008; //seen 1019
|
||||
/*000*/ uint16 dz_zone_id; // target dz id pair
|
||||
/*002*/ uint16 dz_instance_id;
|
||||
/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
|
||||
/*008*/ uint32 unknown008;
|
||||
/*012*/ float y;
|
||||
/*016*/ float x;
|
||||
/*020*/ float z;
|
||||
};
|
||||
|
||||
struct ExpeditionCompass_Struct
|
||||
struct DynamicZoneCompass_Struct
|
||||
{
|
||||
/*000*/ uint32 clientid;
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 count;
|
||||
/*008*/ ExpeditionCompassEntry_Struct entries[0];
|
||||
/*008*/ DynamicZoneCompassEntry_Struct entries[0];
|
||||
};
|
||||
|
||||
struct ExpeditionJoinPrompt_Struct
|
||||
struct DynamicZoneChooseZoneEntry_Struct
|
||||
{
|
||||
/*000*/ uint32 clientid;
|
||||
/*004*/ char player_name[64];
|
||||
/*068*/ char expedition_name[64];
|
||||
/*000*/ uint16 dz_zone_id; // dz_id pair
|
||||
/*002*/ uint16 dz_instance_id;
|
||||
/*004*/ uint32 unknown_id1; // sent back in reply
|
||||
/*008*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest -- sent back in reply
|
||||
/*012*/ uint32 unknown_id2; // possibly an id based on dz type, for expeditions this was same as dz_id (zone|instance) but task dz was different
|
||||
/*016*/ char description[1]; // variable length, null terminated, max 0x80 (128)
|
||||
/*000*/ char leader_name[1]; // variable length, null terminated, max 0x40 (64)
|
||||
};
|
||||
|
||||
struct DynamicZoneChooseZone_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 count;
|
||||
/*008*/ DynamicZoneChooseZoneEntry_Struct choices[0];
|
||||
};
|
||||
|
||||
struct DynamicZoneChooseZoneReply_Struct
|
||||
{
|
||||
/*000*/ uint32 unknown000;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ uint32 unknown_id1;
|
||||
/*012*/ uint16 dz_zone_id;
|
||||
/*014*/ uint16 dz_instance_id;
|
||||
/*016*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest
|
||||
/*020*/ uint32 unknown_id2;
|
||||
/*024*/ uint32 unknown024;
|
||||
/*028*/ uint32 unknown028; // always same as unknown040
|
||||
/*032*/ uint32 unknown032;
|
||||
/*036*/ uint32 unknown036;
|
||||
/*040*/ uint32 unknown040; // always same as unknown028
|
||||
/*044*/ uint32 unknown044;
|
||||
};
|
||||
|
||||
struct LFGuild_SearchPlayer_Struct
|
||||
|
||||
+184
-75
@@ -613,14 +613,48 @@ namespace UF
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzChooseZone)
|
||||
{
|
||||
SETUP_VAR_ENCODE(DynamicZoneChooseZone_Struct);
|
||||
|
||||
SerializeBuffer buf;
|
||||
buf.WriteUInt32(emu->client_id);
|
||||
buf.WriteUInt32(emu->count);
|
||||
|
||||
for (uint32 i = 0; i < emu->count; ++i)
|
||||
{
|
||||
buf.WriteUInt16(emu->choices[i].dz_zone_id);
|
||||
buf.WriteUInt16(emu->choices[i].dz_instance_id);
|
||||
buf.WriteUInt32(emu->choices[i].unknown_id1);
|
||||
buf.WriteUInt32(emu->choices[i].dz_type);
|
||||
buf.WriteUInt32(emu->choices[i].unknown_id2);
|
||||
buf.WriteString(emu->choices[i].description);
|
||||
buf.WriteString(emu->choices[i].leader_name);
|
||||
}
|
||||
|
||||
__packet->size = buf.size();
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzCompass)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionCompass_Struct);
|
||||
ALLOC_VAR_ENCODE(structs::ExpeditionCompass_Struct, sizeof(structs::ExpeditionInfo_Struct) + sizeof(structs::ExpeditionCompassEntry_Struct) * emu->count);
|
||||
SETUP_VAR_ENCODE(DynamicZoneCompass_Struct);
|
||||
ALLOC_VAR_ENCODE(structs::DynamicZoneCompass_Struct,
|
||||
sizeof(structs::DynamicZoneCompass_Struct) +
|
||||
sizeof(structs::DynamicZoneCompassEntry_Struct) * emu->count
|
||||
);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(count);
|
||||
|
||||
for (uint32 i = 0; i < emu->count; ++i)
|
||||
{
|
||||
OUT(entries[i].dz_zone_id);
|
||||
OUT(entries[i].dz_instance_id);
|
||||
OUT(entries[i].dz_type);
|
||||
OUT(entries[i].x);
|
||||
OUT(entries[i].y);
|
||||
OUT(entries[i].z);
|
||||
@@ -641,112 +675,108 @@ namespace UF
|
||||
|
||||
ENCODE(OP_DzExpeditionInfo)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneInfo_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneInfo_Struct, structs::DynamicZoneInfo_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(assigned);
|
||||
OUT(max_players);
|
||||
eq->unknown004 = 785316192;
|
||||
eq->unknown008 = 435601;
|
||||
strcpy(eq->expedition_name, emu->expedition_name);
|
||||
strcpy(eq->leader_name, emu->leader_name);
|
||||
strn0cpy(eq->dz_name, emu->dz_name, sizeof(eq->dz_name));
|
||||
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzExpeditionList)
|
||||
ENCODE(OP_DzExpeditionInvite)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionLockoutList_Struct);
|
||||
ENCODE_LENGTH_EXACT(ExpeditionInvite_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionInvite_Struct, structs::ExpeditionInvite_Struct);
|
||||
|
||||
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
||||
uint32 client_id = 0;
|
||||
uint8 null_term = 0;
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&emu->count, sizeof(uint32));
|
||||
OUT(client_id);
|
||||
strn0cpy(eq->inviter_name, emu->inviter_name, sizeof(eq->inviter_name));
|
||||
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
|
||||
OUT(swapping);
|
||||
strn0cpy(eq->swap_name, emu->swap_name, sizeof(eq->swap_name));
|
||||
OUT(dz_zone_id);
|
||||
OUT(dz_instance_id);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzExpeditionLockoutTimers)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionLockoutTimers_Struct);
|
||||
|
||||
SerializeBuffer buf;
|
||||
buf.WriteUInt32(emu->client_id);
|
||||
buf.WriteUInt32(emu->count);
|
||||
for (uint32 i = 0; i < emu->count; ++i)
|
||||
{
|
||||
ss.write(emu->entries[i].expedition, strlen(emu->entries[i].expedition));
|
||||
ss.write((const char*)&null_term, sizeof(char));
|
||||
ss.write((const char*)&emu->entries[i].time_left, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write(emu->entries[i].expedition_event, strlen(emu->entries[i].expedition_event));
|
||||
ss.write((const char*)&null_term, sizeof(char));
|
||||
buf.WriteString(emu->timers[i].expedition_name);
|
||||
buf.WriteUInt32(emu->timers[i].seconds_remaining);
|
||||
buf.WriteInt32(emu->timers[i].event_type);
|
||||
buf.WriteString(emu->timers[i].event_name);
|
||||
}
|
||||
|
||||
__packet->size = ss.str().length();
|
||||
__packet->size = buf.size();
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
|
||||
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzJoinExpeditionConfirm)
|
||||
ENCODE(OP_DzSetLeaderName)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(ExpeditionJoinPrompt_Struct);
|
||||
SETUP_DIRECT_ENCODE(ExpeditionJoinPrompt_Struct, structs::ExpeditionJoinPrompt_Struct);
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneLeaderName_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneLeaderName_Struct, structs::DynamicZoneLeaderName_Struct);
|
||||
|
||||
strcpy(eq->expedition_name, emu->expedition_name);
|
||||
strcpy(eq->player_name, emu->player_name);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzLeaderStatus)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionLeaderSet_Struct);
|
||||
|
||||
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
||||
uint32 client_id = 0;
|
||||
uint8 null_term = 0;
|
||||
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write(emu->leader_name, strlen(emu->leader_name));
|
||||
ss.write((const char*)&null_term, sizeof(char));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));//0xffffffff
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&client_id, sizeof(uint32));//1
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
|
||||
__packet->size = ss.str().length();
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
|
||||
OUT(client_id);
|
||||
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzMemberList)
|
||||
{
|
||||
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
|
||||
SETUP_VAR_ENCODE(DynamicZoneMemberList_Struct);
|
||||
|
||||
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
|
||||
|
||||
uint32 client_id = 0;
|
||||
uint8 null_term = 0;
|
||||
ss.write((const char*)&client_id, sizeof(uint32));
|
||||
ss.write((const char*)&emu->count, sizeof(uint32));
|
||||
for (uint32 i = 0; i < emu->count; ++i)
|
||||
SerializeBuffer buf;
|
||||
buf.WriteUInt32(emu->client_id);
|
||||
buf.WriteUInt32(emu->member_count);
|
||||
for (uint32 i = 0; i < emu->member_count; ++i)
|
||||
{
|
||||
ss.write(emu->entries[i].name, strlen(emu->entries[i].name));
|
||||
ss.write((const char*)&null_term, sizeof(char));
|
||||
ss.write((const char*)&emu->entries[i].status, sizeof(char));
|
||||
buf.WriteString(emu->members[i].name);
|
||||
buf.WriteUInt8(emu->members[i].online_status);
|
||||
}
|
||||
|
||||
__packet->size = ss.str().length();
|
||||
__packet->size = buf.size();
|
||||
__packet->pBuffer = new unsigned char[__packet->size];
|
||||
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
|
||||
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzMemberListName)
|
||||
{
|
||||
ENCODE_LENGTH_EXACT(DynamicZoneMemberListName_Struct);
|
||||
SETUP_DIRECT_ENCODE(DynamicZoneMemberListName_Struct, structs::DynamicZoneMemberListName_Struct);
|
||||
|
||||
OUT(client_id);
|
||||
OUT(add_name);
|
||||
strn0cpy(eq->name, emu->name, sizeof(eq->name));
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
ENCODE(OP_DzMemberListStatus)
|
||||
{
|
||||
auto emu = reinterpret_cast<DynamicZoneMemberList_Struct*>((*p)->pBuffer);
|
||||
if (emu->member_count == 1)
|
||||
{
|
||||
ENCODE_FORWARD(OP_DzMemberList);
|
||||
}
|
||||
}
|
||||
|
||||
ENCODE(OP_Emote)
|
||||
{
|
||||
EQApplicationPacket *in = *p;
|
||||
@@ -1577,6 +1607,7 @@ namespace UF
|
||||
OUT(FastRegenHP);
|
||||
OUT(FastRegenMana);
|
||||
OUT(FastRegenEndurance);
|
||||
OUT(underworld_teleport_index);
|
||||
|
||||
eq->FogDensity = emu->fog_density;
|
||||
|
||||
@@ -1674,7 +1705,7 @@ namespace UF
|
||||
eq->level1 = emu->level;
|
||||
// OUT(unknown00022[2]);
|
||||
for (r = 0; r < 5; r++) {
|
||||
OUT(binds[r].zoneId);
|
||||
OUT(binds[r].zone_id);
|
||||
OUT(binds[r].x);
|
||||
OUT(binds[r].y);
|
||||
OUT(binds[r].z);
|
||||
@@ -3314,6 +3345,84 @@ namespace UF
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzAddPlayer)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
|
||||
|
||||
strn0cpy(emu->name, eq->name, sizeof(emu->name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzChooseZoneReply)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::DynamicZoneChooseZoneReply_Struct);
|
||||
SETUP_DIRECT_DECODE(DynamicZoneChooseZoneReply_Struct, structs::DynamicZoneChooseZoneReply_Struct);
|
||||
|
||||
IN(unknown000);
|
||||
IN(unknown004);
|
||||
IN(unknown008);
|
||||
IN(unknown_id1);
|
||||
IN(dz_zone_id);
|
||||
IN(dz_instance_id);
|
||||
IN(dz_type);
|
||||
IN(unknown_id2);
|
||||
IN(unknown028);
|
||||
IN(unknown032);
|
||||
IN(unknown036);
|
||||
IN(unknown040);
|
||||
IN(unknown044);
|
||||
IN(unknown048);
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzExpeditionInviteResponse)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionInviteResponse_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionInviteResponse_Struct, structs::ExpeditionInviteResponse_Struct);
|
||||
|
||||
IN(dz_zone_id);
|
||||
IN(dz_instance_id);
|
||||
IN(accepted);
|
||||
IN(swapping);
|
||||
strn0cpy(emu->swap_name, eq->swap_name, sizeof(emu->swap_name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzMakeLeader)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
|
||||
|
||||
strn0cpy(emu->name, eq->name, sizeof(emu->name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzRemovePlayer)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
|
||||
|
||||
strn0cpy(emu->name, eq->name, sizeof(emu->name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_DzSwapPlayer)
|
||||
{
|
||||
DECODE_LENGTH_EXACT(structs::ExpeditionCommandSwap_Struct);
|
||||
SETUP_DIRECT_DECODE(ExpeditionCommandSwap_Struct, structs::ExpeditionCommandSwap_Struct);
|
||||
|
||||
strn0cpy(emu->add_player_name, eq->add_player_name, sizeof(emu->add_player_name));
|
||||
strn0cpy(emu->rem_player_name, eq->rem_player_name, sizeof(emu->rem_player_name));
|
||||
|
||||
FINISH_DIRECT_DECODE();
|
||||
}
|
||||
|
||||
DECODE(OP_Emote)
|
||||
{
|
||||
unsigned char *__eq_buffer = __packet->pBuffer;
|
||||
|
||||
+12
-3
@@ -38,13 +38,16 @@ E(OP_Damage)
|
||||
E(OP_DeleteCharge)
|
||||
E(OP_DeleteItem)
|
||||
E(OP_DisciplineUpdate)
|
||||
E(OP_DzChooseZone)
|
||||
E(OP_DzCompass)
|
||||
E(OP_DzExpeditionEndsWarning)
|
||||
E(OP_DzExpeditionInfo)
|
||||
E(OP_DzExpeditionList)
|
||||
E(OP_DzJoinExpeditionConfirm)
|
||||
E(OP_DzLeaderStatus)
|
||||
E(OP_DzExpeditionInvite)
|
||||
E(OP_DzExpeditionLockoutTimers)
|
||||
E(OP_DzMemberList)
|
||||
E(OP_DzMemberListName)
|
||||
E(OP_DzMemberListStatus)
|
||||
E(OP_DzSetLeaderName)
|
||||
E(OP_Emote)
|
||||
E(OP_ExpansionInfo)
|
||||
E(OP_FormattedMessage)
|
||||
@@ -120,6 +123,12 @@ D(OP_ConsiderCorpse)
|
||||
D(OP_Consume)
|
||||
D(OP_Damage)
|
||||
D(OP_DeleteItem)
|
||||
D(OP_DzAddPlayer)
|
||||
D(OP_DzChooseZoneReply)
|
||||
D(OP_DzExpeditionInviteResponse)
|
||||
D(OP_DzMakeLeader)
|
||||
D(OP_DzRemovePlayer)
|
||||
D(OP_DzSwapPlayer)
|
||||
D(OP_Emote)
|
||||
D(OP_EnvDamage)
|
||||
D(OP_FaceChange)
|
||||
|
||||
+139
-27
@@ -444,7 +444,11 @@ struct NewZone_Struct {
|
||||
/*0848*/ int32 unknown848;
|
||||
/*0852*/ uint16 zone_id;
|
||||
/*0854*/ uint16 zone_instance;
|
||||
/*0856*/ char unknown856[20];
|
||||
/*0856*/ uint32 scriptNPCReceivedanItem;
|
||||
/*0860*/ uint32 bCheck; // padded bool
|
||||
/*0864*/ uint32 scriptIDSomething;
|
||||
/*0868*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
|
||||
/*0872*/ uint32 scriptIDSomething3;
|
||||
/*0876*/ uint32 SuspendBuffs;
|
||||
/*0880*/ uint32 unknown880; //seen 50
|
||||
/*0884*/ uint32 unknown884; //seen 10
|
||||
@@ -829,7 +833,7 @@ struct LeadershipAA_Struct {
|
||||
* Size: 20 Octets
|
||||
*/
|
||||
struct BindStruct {
|
||||
/*000*/ uint32 zoneId;
|
||||
/*000*/ uint32 zone_id;
|
||||
/*004*/ float x;
|
||||
/*008*/ float y;
|
||||
/*012*/ float z;
|
||||
@@ -1751,7 +1755,7 @@ struct GMZoneRequest_Struct {
|
||||
/*0068*/ float x;
|
||||
/*0072*/ float y;
|
||||
/*0076*/ float z;
|
||||
/*0080*/ char unknown0080[4];
|
||||
/*0080*/ float heading;
|
||||
/*0084*/ uint32 success; // 0 if command failed, 1 if succeeded?
|
||||
/*0088*/
|
||||
// /*072*/ int8 success; // =0 client->server, =1 server->client, -X=specific error
|
||||
@@ -4246,52 +4250,160 @@ struct VeteranReward
|
||||
/*012*/ VeteranRewardItem items[8];
|
||||
};
|
||||
|
||||
struct ExpeditionEntryHeader_Struct
|
||||
|
||||
struct ExpeditionInvite_Struct
|
||||
{
|
||||
/*000*/ uint32 unknown000;
|
||||
/*000*/ uint32 number_of_entries;
|
||||
/*000*/ uint32 client_id; // unique character id
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ char inviter_name[64];
|
||||
/*072*/ char expedition_name[128];
|
||||
/*200*/ uint8 swapping; // 0: adding 1: swapping
|
||||
/*201*/ char swap_name[64]; // if swapping, swap name being removed
|
||||
/*265*/ uint8 padding[3];
|
||||
/*268*/ uint16 dz_zone_id; // dz_id zone/instance pair, sent back in reply
|
||||
/*270*/ uint16 dz_instance_id;
|
||||
};
|
||||
|
||||
struct ExpeditionJoinPrompt_Struct
|
||||
struct ExpeditionInviteResponse_Struct
|
||||
{
|
||||
/*000*/ uint32 clientid;
|
||||
/*000*/ uint32 unknown000;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ char player_name[64];
|
||||
/*072*/ char expedition_name[64];
|
||||
/*008*/ uint16 dz_zone_id; // dz_id pair sent in invite
|
||||
/*010*/ uint16 dz_instance_id;
|
||||
/*012*/ uint8 accepted; // 0: declined 1: accepted
|
||||
/*013*/ uint8 swapping; // 0: adding 1: swapping (sent in invite)
|
||||
/*014*/ char swap_name[64]; // swap name sent in invite
|
||||
/*078*/ uint8 unknown078; // padding garbage?
|
||||
/*079*/ uint8 unknown079; // padding garbage?
|
||||
};
|
||||
|
||||
struct DynamicZoneInfo_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ uint32 assigned; // padded bool
|
||||
/*012*/ uint32 max_players;
|
||||
/*016*/ char dz_name[128];
|
||||
/*144*/ char leader_name[64];
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberEntry_Struct
|
||||
{
|
||||
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
|
||||
/*000*/ uint8 online_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberList_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 member_count; // number of players in window
|
||||
/*008*/ DynamicZoneMemberEntry_Struct members[0]; // variable length
|
||||
};
|
||||
|
||||
struct DynamicZoneMemberListName_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ uint32 add_name; // padded bool, 0: remove name, 1: add name with unknown status
|
||||
/*012*/ char name[64];
|
||||
};
|
||||
|
||||
struct ExpeditionLockoutTimerEntry_Struct
|
||||
{
|
||||
/*000*/ char expedition_name[1]; // variable length, null terminated, max 0x80 (128)
|
||||
/*000*/ uint32 seconds_remaining;
|
||||
/*000*/ int32 event_type; // seen -1 (0xffffffff) for replay timers and 1 for event timers
|
||||
/*000*/ char event_name[1]; // variable length, null terminated, max 0x100 (256)
|
||||
};
|
||||
|
||||
struct ExpeditionLockoutTimers_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 count;
|
||||
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
|
||||
};
|
||||
|
||||
struct DynamicZoneLeaderName_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ char leader_name[64];
|
||||
};
|
||||
|
||||
struct ExpeditionCommand_Struct
|
||||
{
|
||||
/*000*/ uint32 unknown000;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ char name[64];
|
||||
};
|
||||
|
||||
struct ExpeditionCommandSwap_Struct
|
||||
{
|
||||
/*000*/ uint32 unknown000;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ char add_player_name[64]; // swap to (player must confirm)
|
||||
/*072*/ char rem_player_name[64]; // swap from
|
||||
};
|
||||
|
||||
struct ExpeditionExpireWarning
|
||||
{
|
||||
/*000*/ uint32 clientid;
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*008*/ uint32 minutes_remaining;
|
||||
};
|
||||
|
||||
struct ExpeditionInfo_Struct
|
||||
struct DynamicZoneCompassEntry_Struct
|
||||
{
|
||||
/*000*/ uint32 clientid;
|
||||
/*004*/ uint32 unknown004;
|
||||
/*000*/ uint16 dz_zone_id; // target dz id pair
|
||||
/*002*/ uint16 dz_instance_id;
|
||||
/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
|
||||
/*008*/ uint32 unknown008;
|
||||
/*012*/ uint32 max_players;
|
||||
/*016*/ char expedition_name[128];
|
||||
/*142*/ char leader_name[64];
|
||||
};
|
||||
|
||||
struct ExpeditionCompassEntry_Struct
|
||||
{
|
||||
/*000*/ float unknown000; //seen *((uint32*)) = 1584791871
|
||||
/*004*/ uint32 enabled; //guess
|
||||
/*008*/ uint32 unknown008; //seen 1019
|
||||
/*012*/ float y;
|
||||
/*016*/ float x;
|
||||
/*020*/ float z;
|
||||
};
|
||||
|
||||
struct ExpeditionCompass_Struct
|
||||
struct DynamicZoneCompass_Struct
|
||||
{
|
||||
/*000*/ uint32 clientid;
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 count;
|
||||
/*008*/ ExpeditionCompassEntry_Struct entries[0];
|
||||
/*008*/ DynamicZoneCompassEntry_Struct entries[0];
|
||||
};
|
||||
|
||||
struct DynamicZoneChooseZoneEntry_Struct
|
||||
{
|
||||
/*000*/ uint16 dz_zone_id; // dz_id pair
|
||||
/*002*/ uint16 dz_instance_id;
|
||||
/*004*/ uint32 unknown_id1; // sent back in reply
|
||||
/*008*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest -- sent back in reply
|
||||
/*012*/ uint32 unknown_id2; // possibly an id based on dz type, for expeditions this was same as dz_id (zone|instance) but task dz was different
|
||||
/*016*/ char description[1]; // variable length, null terminated, max 0x80 (128)
|
||||
/*000*/ char leader_name[1]; // variable length, null terminated, max 0x40 (64)
|
||||
};
|
||||
|
||||
struct DynamicZoneChooseZone_Struct
|
||||
{
|
||||
/*000*/ uint32 client_id;
|
||||
/*004*/ uint32 count;
|
||||
/*008*/ DynamicZoneChooseZoneEntry_Struct choices[0];
|
||||
};
|
||||
|
||||
struct DynamicZoneChooseZoneReply_Struct
|
||||
{
|
||||
/*000*/ uint32 unknown000; // ff ff ff ff
|
||||
/*004*/ uint32 unknown004; // seen 69 00 00 00
|
||||
/*008*/ uint32 unknown008; // ff ff ff ff
|
||||
/*012*/ uint32 unknown_id1; // from choose zone entry message
|
||||
/*016*/ uint16 dz_zone_id; // dz_id pair
|
||||
/*018*/ uint16 dz_instance_id;
|
||||
/*020*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest
|
||||
/*024*/ uint32 unknown_id2; // from choose zone entry message
|
||||
/*028*/ uint32 unknown028; // 00 00 00 00
|
||||
/*032*/ uint32 unknown032; // always same as unknown044
|
||||
/*036*/ uint32 unknown036;
|
||||
/*040*/ uint32 unknown040;
|
||||
/*044*/ uint32 unknown044; // always same as unknown032
|
||||
/*048*/ uint32 unknown048; // seen 01 00 00 00 and 02 00 00 00
|
||||
};
|
||||
|
||||
struct AltCurrencySelectItem_Struct {
|
||||
|
||||
+5
-5
@@ -46,15 +46,15 @@ std::string GetPlatformName()
|
||||
{
|
||||
switch (GetExecutablePlatformInt()) {
|
||||
case EQEmuExePlatform::ExePlatformWorld:
|
||||
return "WorldServer";
|
||||
return "World";
|
||||
case EQEmuExePlatform::ExePlatformQueryServ:
|
||||
return "QueryServer";
|
||||
return "QS";
|
||||
case EQEmuExePlatform::ExePlatformZone:
|
||||
return "ZoneServer";
|
||||
return "Zone";
|
||||
case EQEmuExePlatform::ExePlatformUCS:
|
||||
return "UCS";
|
||||
case EQEmuExePlatform::ExePlatformLogin:
|
||||
return "LoginServer";
|
||||
return "Login";
|
||||
case EQEmuExePlatform::ExePlatformSocket_Server:
|
||||
return "SocketServer";
|
||||
case EQEmuExePlatform::ExePlatformSharedMemory:
|
||||
@@ -70,4 +70,4 @@ std::string GetPlatformName()
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -860,7 +860,6 @@ uint16 GetRaceIDFromPlayerRaceBit(uint32 player_race_bit);
|
||||
|
||||
float GetRaceGenderDefaultHeight(int race, int gender);
|
||||
|
||||
|
||||
// player race-/gender-based model feature validators
|
||||
namespace PlayerAppearance
|
||||
{
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
* are required to give you total support for your newly bought product;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_AA_ABILITY_REPOSITORY_H
|
||||
#define EQEMU_AA_ABILITY_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../string_util.h"
|
||||
#include "base/base_aa_ability_repository.h"
|
||||
|
||||
class AaAbilityRepository: public BaseAaAbilityRepository {
|
||||
public:
|
||||
|
||||
/**
|
||||
* This file was auto generated and can be modified and extended upon
|
||||
*
|
||||
* Base repository methods are automatically
|
||||
* generated in the "base" version of this repository. The base repository
|
||||
* is immutable and to be left untouched, while methods in this class
|
||||
* are used as extension methods for more specific persistence-layer
|
||||
* accessors or mutators.
|
||||
*
|
||||
* Base Methods (Subject to be expanded upon in time)
|
||||
*
|
||||
* Note: Not all tables are designed appropriately to fit functionality with all base methods
|
||||
*
|
||||
* InsertOne
|
||||
* UpdateOne
|
||||
* DeleteOne
|
||||
* FindOne
|
||||
* GetWhere(std::string where_filter)
|
||||
* DeleteWhere(std::string where_filter)
|
||||
* InsertMany
|
||||
* All
|
||||
*
|
||||
* Example custom methods in a repository
|
||||
*
|
||||
* AaAbilityRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* AaAbilityRepository::GetWhereNeverExpires()
|
||||
* AaAbilityRepository::GetWhereXAndY()
|
||||
* AaAbilityRepository::DeleteWhereXAndY()
|
||||
*
|
||||
* Most of the above could be covered by base methods, but if you as a developer
|
||||
* find yourself re-using logic for other parts of the code, its best to just make a
|
||||
* method that can be re-used easily elsewhere especially if it can use a base repository
|
||||
* method and encapsulate filters there
|
||||
*/
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_AA_ABILITY_REPOSITORY_H
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
* are required to give you total support for your newly bought product;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_AA_RANK_EFFECTS_REPOSITORY_H
|
||||
#define EQEMU_AA_RANK_EFFECTS_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../string_util.h"
|
||||
#include "base/base_aa_rank_effects_repository.h"
|
||||
|
||||
class AaRankEffectsRepository: public BaseAaRankEffectsRepository {
|
||||
public:
|
||||
|
||||
/**
|
||||
* This file was auto generated and can be modified and extended upon
|
||||
*
|
||||
* Base repository methods are automatically
|
||||
* generated in the "base" version of this repository. The base repository
|
||||
* is immutable and to be left untouched, while methods in this class
|
||||
* are used as extension methods for more specific persistence-layer
|
||||
* accessors or mutators.
|
||||
*
|
||||
* Base Methods (Subject to be expanded upon in time)
|
||||
*
|
||||
* Note: Not all tables are designed appropriately to fit functionality with all base methods
|
||||
*
|
||||
* InsertOne
|
||||
* UpdateOne
|
||||
* DeleteOne
|
||||
* FindOne
|
||||
* GetWhere(std::string where_filter)
|
||||
* DeleteWhere(std::string where_filter)
|
||||
* InsertMany
|
||||
* All
|
||||
*
|
||||
* Example custom methods in a repository
|
||||
*
|
||||
* AaRankEffectsRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* AaRankEffectsRepository::GetWhereNeverExpires()
|
||||
* AaRankEffectsRepository::GetWhereXAndY()
|
||||
* AaRankEffectsRepository::DeleteWhereXAndY()
|
||||
*
|
||||
* Most of the above could be covered by base methods, but if you as a developer
|
||||
* find yourself re-using logic for other parts of the code, its best to just make a
|
||||
* method that can be re-used easily elsewhere especially if it can use a base repository
|
||||
* method and encapsulate filters there
|
||||
*/
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_AA_RANK_EFFECTS_REPOSITORY_H
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
* are required to give you total support for your newly bought product;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_AA_RANK_PREREQS_REPOSITORY_H
|
||||
#define EQEMU_AA_RANK_PREREQS_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../string_util.h"
|
||||
#include "base/base_aa_rank_prereqs_repository.h"
|
||||
|
||||
class AaRankPrereqsRepository: public BaseAaRankPrereqsRepository {
|
||||
public:
|
||||
|
||||
/**
|
||||
* This file was auto generated and can be modified and extended upon
|
||||
*
|
||||
* Base repository methods are automatically
|
||||
* generated in the "base" version of this repository. The base repository
|
||||
* is immutable and to be left untouched, while methods in this class
|
||||
* are used as extension methods for more specific persistence-layer
|
||||
* accessors or mutators.
|
||||
*
|
||||
* Base Methods (Subject to be expanded upon in time)
|
||||
*
|
||||
* Note: Not all tables are designed appropriately to fit functionality with all base methods
|
||||
*
|
||||
* InsertOne
|
||||
* UpdateOne
|
||||
* DeleteOne
|
||||
* FindOne
|
||||
* GetWhere(std::string where_filter)
|
||||
* DeleteWhere(std::string where_filter)
|
||||
* InsertMany
|
||||
* All
|
||||
*
|
||||
* Example custom methods in a repository
|
||||
*
|
||||
* AaRankPrereqsRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* AaRankPrereqsRepository::GetWhereNeverExpires()
|
||||
* AaRankPrereqsRepository::GetWhereXAndY()
|
||||
* AaRankPrereqsRepository::DeleteWhereXAndY()
|
||||
*
|
||||
* Most of the above could be covered by base methods, but if you as a developer
|
||||
* find yourself re-using logic for other parts of the code, its best to just make a
|
||||
* method that can be re-used easily elsewhere especially if it can use a base repository
|
||||
* method and encapsulate filters there
|
||||
*/
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_AA_RANK_PREREQS_REPOSITORY_H
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
* are required to give you total support for your newly bought product;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_AA_RANKS_REPOSITORY_H
|
||||
#define EQEMU_AA_RANKS_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../string_util.h"
|
||||
#include "base/base_aa_ranks_repository.h"
|
||||
|
||||
class AaRanksRepository: public BaseAaRanksRepository {
|
||||
public:
|
||||
|
||||
/**
|
||||
* This file was auto generated and can be modified and extended upon
|
||||
*
|
||||
* Base repository methods are automatically
|
||||
* generated in the "base" version of this repository. The base repository
|
||||
* is immutable and to be left untouched, while methods in this class
|
||||
* are used as extension methods for more specific persistence-layer
|
||||
* accessors or mutators.
|
||||
*
|
||||
* Base Methods (Subject to be expanded upon in time)
|
||||
*
|
||||
* Note: Not all tables are designed appropriately to fit functionality with all base methods
|
||||
*
|
||||
* InsertOne
|
||||
* UpdateOne
|
||||
* DeleteOne
|
||||
* FindOne
|
||||
* GetWhere(std::string where_filter)
|
||||
* DeleteWhere(std::string where_filter)
|
||||
* InsertMany
|
||||
* All
|
||||
*
|
||||
* Example custom methods in a repository
|
||||
*
|
||||
* AaRanksRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* AaRanksRepository::GetWhereNeverExpires()
|
||||
* AaRanksRepository::GetWhereXAndY()
|
||||
* AaRanksRepository::DeleteWhereXAndY()
|
||||
*
|
||||
* Most of the above could be covered by base methods, but if you as a developer
|
||||
* find yourself re-using logic for other parts of the code, its best to just make a
|
||||
* method that can be re-used easily elsewhere especially if it can use a base repository
|
||||
* method and encapsulate filters there
|
||||
*/
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_AA_RANKS_REPOSITORY_H
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
* are required to give you total support for your newly bought product;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_ACCOUNT_FLAGS_REPOSITORY_H
|
||||
#define EQEMU_ACCOUNT_FLAGS_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../string_util.h"
|
||||
#include "base/base_account_flags_repository.h"
|
||||
|
||||
class AccountFlagsRepository: public BaseAccountFlagsRepository {
|
||||
public:
|
||||
|
||||
/**
|
||||
* This file was auto generated and can be modified and extended upon
|
||||
*
|
||||
* Base repository methods are automatically
|
||||
* generated in the "base" version of this repository. The base repository
|
||||
* is immutable and to be left untouched, while methods in this class
|
||||
* are used as extension methods for more specific persistence-layer
|
||||
* accessors or mutators.
|
||||
*
|
||||
* Base Methods (Subject to be expanded upon in time)
|
||||
*
|
||||
* Note: Not all tables are designed appropriately to fit functionality with all base methods
|
||||
*
|
||||
* InsertOne
|
||||
* UpdateOne
|
||||
* DeleteOne
|
||||
* FindOne
|
||||
* GetWhere(std::string where_filter)
|
||||
* DeleteWhere(std::string where_filter)
|
||||
* InsertMany
|
||||
* All
|
||||
*
|
||||
* Example custom methods in a repository
|
||||
*
|
||||
* AccountFlagsRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* AccountFlagsRepository::GetWhereNeverExpires()
|
||||
* AccountFlagsRepository::GetWhereXAndY()
|
||||
* AccountFlagsRepository::DeleteWhereXAndY()
|
||||
*
|
||||
* Most of the above could be covered by base methods, but if you as a developer
|
||||
* find yourself re-using logic for other parts of the code, its best to just make a
|
||||
* method that can be re-used easily elsewhere especially if it can use a base repository
|
||||
* method and encapsulate filters there
|
||||
*/
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_ACCOUNT_FLAGS_REPOSITORY_H
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
* are required to give you total support for your newly bought product;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_ACCOUNT_IP_REPOSITORY_H
|
||||
#define EQEMU_ACCOUNT_IP_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../string_util.h"
|
||||
#include "base/base_account_ip_repository.h"
|
||||
|
||||
class AccountIpRepository: public BaseAccountIpRepository {
|
||||
public:
|
||||
|
||||
/**
|
||||
* This file was auto generated and can be modified and extended upon
|
||||
*
|
||||
* Base repository methods are automatically
|
||||
* generated in the "base" version of this repository. The base repository
|
||||
* is immutable and to be left untouched, while methods in this class
|
||||
* are used as extension methods for more specific persistence-layer
|
||||
* accessors or mutators.
|
||||
*
|
||||
* Base Methods (Subject to be expanded upon in time)
|
||||
*
|
||||
* Note: Not all tables are designed appropriately to fit functionality with all base methods
|
||||
*
|
||||
* InsertOne
|
||||
* UpdateOne
|
||||
* DeleteOne
|
||||
* FindOne
|
||||
* GetWhere(std::string where_filter)
|
||||
* DeleteWhere(std::string where_filter)
|
||||
* InsertMany
|
||||
* All
|
||||
*
|
||||
* Example custom methods in a repository
|
||||
*
|
||||
* AccountIpRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* AccountIpRepository::GetWhereNeverExpires()
|
||||
* AccountIpRepository::GetWhereXAndY()
|
||||
* AccountIpRepository::DeleteWhereXAndY()
|
||||
*
|
||||
* Most of the above could be covered by base methods, but if you as a developer
|
||||
* find yourself re-using logic for other parts of the code, its best to just make a
|
||||
* method that can be re-used easily elsewhere especially if it can use a base repository
|
||||
* method and encapsulate filters there
|
||||
*/
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_ACCOUNT_IP_REPOSITORY_H
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
* are required to give you total support for your newly bought product;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_ACCOUNT_REPOSITORY_H
|
||||
#define EQEMU_ACCOUNT_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../string_util.h"
|
||||
#include "base/base_account_repository.h"
|
||||
|
||||
class AccountRepository: public BaseAccountRepository {
|
||||
public:
|
||||
|
||||
/**
|
||||
* This file was auto generated and can be modified and extended upon
|
||||
*
|
||||
* Base repository methods are automatically
|
||||
* generated in the "base" version of this repository. The base repository
|
||||
* is immutable and to be left untouched, while methods in this class
|
||||
* are used as extension methods for more specific persistence-layer
|
||||
* accessors or mutators.
|
||||
*
|
||||
* Base Methods (Subject to be expanded upon in time)
|
||||
*
|
||||
* Note: Not all tables are designed appropriately to fit functionality with all base methods
|
||||
*
|
||||
* InsertOne
|
||||
* UpdateOne
|
||||
* DeleteOne
|
||||
* FindOne
|
||||
* GetWhere(std::string where_filter)
|
||||
* DeleteWhere(std::string where_filter)
|
||||
* InsertMany
|
||||
* All
|
||||
*
|
||||
* Example custom methods in a repository
|
||||
*
|
||||
* AccountRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* AccountRepository::GetWhereNeverExpires()
|
||||
* AccountRepository::GetWhereXAndY()
|
||||
* AccountRepository::DeleteWhereXAndY()
|
||||
*
|
||||
* Most of the above could be covered by base methods, but if you as a developer
|
||||
* find yourself re-using logic for other parts of the code, its best to just make a
|
||||
* method that can be re-used easily elsewhere especially if it can use a base repository
|
||||
* method and encapsulate filters there
|
||||
*/
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_ACCOUNT_REPOSITORY_H
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
* are required to give you total support for your newly bought product;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_ACCOUNT_REWARDS_REPOSITORY_H
|
||||
#define EQEMU_ACCOUNT_REWARDS_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../string_util.h"
|
||||
#include "base/base_account_rewards_repository.h"
|
||||
|
||||
class AccountRewardsRepository: public BaseAccountRewardsRepository {
|
||||
public:
|
||||
|
||||
/**
|
||||
* This file was auto generated and can be modified and extended upon
|
||||
*
|
||||
* Base repository methods are automatically
|
||||
* generated in the "base" version of this repository. The base repository
|
||||
* is immutable and to be left untouched, while methods in this class
|
||||
* are used as extension methods for more specific persistence-layer
|
||||
* accessors or mutators.
|
||||
*
|
||||
* Base Methods (Subject to be expanded upon in time)
|
||||
*
|
||||
* Note: Not all tables are designed appropriately to fit functionality with all base methods
|
||||
*
|
||||
* InsertOne
|
||||
* UpdateOne
|
||||
* DeleteOne
|
||||
* FindOne
|
||||
* GetWhere(std::string where_filter)
|
||||
* DeleteWhere(std::string where_filter)
|
||||
* InsertMany
|
||||
* All
|
||||
*
|
||||
* Example custom methods in a repository
|
||||
*
|
||||
* AccountRewardsRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* AccountRewardsRepository::GetWhereNeverExpires()
|
||||
* AccountRewardsRepository::GetWhereXAndY()
|
||||
* AccountRewardsRepository::DeleteWhereXAndY()
|
||||
*
|
||||
* Most of the above could be covered by base methods, but if you as a developer
|
||||
* find yourself re-using logic for other parts of the code, its best to just make a
|
||||
* method that can be re-used easily elsewhere especially if it can use a base repository
|
||||
* method and encapsulate filters there
|
||||
*/
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_ACCOUNT_REWARDS_REPOSITORY_H
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
* are required to give you total support for your newly bought product;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_ADVENTURE_DETAILS_REPOSITORY_H
|
||||
#define EQEMU_ADVENTURE_DETAILS_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../string_util.h"
|
||||
#include "base/base_adventure_details_repository.h"
|
||||
|
||||
class AdventureDetailsRepository: public BaseAdventureDetailsRepository {
|
||||
public:
|
||||
|
||||
/**
|
||||
* This file was auto generated and can be modified and extended upon
|
||||
*
|
||||
* Base repository methods are automatically
|
||||
* generated in the "base" version of this repository. The base repository
|
||||
* is immutable and to be left untouched, while methods in this class
|
||||
* are used as extension methods for more specific persistence-layer
|
||||
* accessors or mutators.
|
||||
*
|
||||
* Base Methods (Subject to be expanded upon in time)
|
||||
*
|
||||
* Note: Not all tables are designed appropriately to fit functionality with all base methods
|
||||
*
|
||||
* InsertOne
|
||||
* UpdateOne
|
||||
* DeleteOne
|
||||
* FindOne
|
||||
* GetWhere(std::string where_filter)
|
||||
* DeleteWhere(std::string where_filter)
|
||||
* InsertMany
|
||||
* All
|
||||
*
|
||||
* Example custom methods in a repository
|
||||
*
|
||||
* AdventureDetailsRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* AdventureDetailsRepository::GetWhereNeverExpires()
|
||||
* AdventureDetailsRepository::GetWhereXAndY()
|
||||
* AdventureDetailsRepository::DeleteWhereXAndY()
|
||||
*
|
||||
* Most of the above could be covered by base methods, but if you as a developer
|
||||
* find yourself re-using logic for other parts of the code, its best to just make a
|
||||
* method that can be re-used easily elsewhere especially if it can use a base repository
|
||||
* method and encapsulate filters there
|
||||
*/
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_ADVENTURE_DETAILS_REPOSITORY_H
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
* are required to give you total support for your newly bought product;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_ADVENTURE_MEMBERS_REPOSITORY_H
|
||||
#define EQEMU_ADVENTURE_MEMBERS_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../string_util.h"
|
||||
#include "base/base_adventure_members_repository.h"
|
||||
|
||||
class AdventureMembersRepository: public BaseAdventureMembersRepository {
|
||||
public:
|
||||
|
||||
/**
|
||||
* This file was auto generated and can be modified and extended upon
|
||||
*
|
||||
* Base repository methods are automatically
|
||||
* generated in the "base" version of this repository. The base repository
|
||||
* is immutable and to be left untouched, while methods in this class
|
||||
* are used as extension methods for more specific persistence-layer
|
||||
* accessors or mutators.
|
||||
*
|
||||
* Base Methods (Subject to be expanded upon in time)
|
||||
*
|
||||
* Note: Not all tables are designed appropriately to fit functionality with all base methods
|
||||
*
|
||||
* InsertOne
|
||||
* UpdateOne
|
||||
* DeleteOne
|
||||
* FindOne
|
||||
* GetWhere(std::string where_filter)
|
||||
* DeleteWhere(std::string where_filter)
|
||||
* InsertMany
|
||||
* All
|
||||
*
|
||||
* Example custom methods in a repository
|
||||
*
|
||||
* AdventureMembersRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* AdventureMembersRepository::GetWhereNeverExpires()
|
||||
* AdventureMembersRepository::GetWhereXAndY()
|
||||
* AdventureMembersRepository::DeleteWhereXAndY()
|
||||
*
|
||||
* Most of the above could be covered by base methods, but if you as a developer
|
||||
* find yourself re-using logic for other parts of the code, its best to just make a
|
||||
* method that can be re-used easily elsewhere especially if it can use a base repository
|
||||
* method and encapsulate filters there
|
||||
*/
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_ADVENTURE_MEMBERS_REPOSITORY_H
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
* are required to give you total support for your newly bought product;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_ADVENTURE_STATS_REPOSITORY_H
|
||||
#define EQEMU_ADVENTURE_STATS_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../string_util.h"
|
||||
#include "base/base_adventure_stats_repository.h"
|
||||
|
||||
class AdventureStatsRepository: public BaseAdventureStatsRepository {
|
||||
public:
|
||||
|
||||
/**
|
||||
* This file was auto generated and can be modified and extended upon
|
||||
*
|
||||
* Base repository methods are automatically
|
||||
* generated in the "base" version of this repository. The base repository
|
||||
* is immutable and to be left untouched, while methods in this class
|
||||
* are used as extension methods for more specific persistence-layer
|
||||
* accessors or mutators.
|
||||
*
|
||||
* Base Methods (Subject to be expanded upon in time)
|
||||
*
|
||||
* Note: Not all tables are designed appropriately to fit functionality with all base methods
|
||||
*
|
||||
* InsertOne
|
||||
* UpdateOne
|
||||
* DeleteOne
|
||||
* FindOne
|
||||
* GetWhere(std::string where_filter)
|
||||
* DeleteWhere(std::string where_filter)
|
||||
* InsertMany
|
||||
* All
|
||||
*
|
||||
* Example custom methods in a repository
|
||||
*
|
||||
* AdventureStatsRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* AdventureStatsRepository::GetWhereNeverExpires()
|
||||
* AdventureStatsRepository::GetWhereXAndY()
|
||||
* AdventureStatsRepository::DeleteWhereXAndY()
|
||||
*
|
||||
* Most of the above could be covered by base methods, but if you as a developer
|
||||
* find yourself re-using logic for other parts of the code, its best to just make a
|
||||
* method that can be re-used easily elsewhere especially if it can use a base repository
|
||||
* method and encapsulate filters there
|
||||
*/
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_ADVENTURE_STATS_REPOSITORY_H
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
* are required to give you total support for your newly bought product;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_ADVENTURE_TEMPLATE_ENTRY_FLAVOR_REPOSITORY_H
|
||||
#define EQEMU_ADVENTURE_TEMPLATE_ENTRY_FLAVOR_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../string_util.h"
|
||||
#include "base/base_adventure_template_entry_flavor_repository.h"
|
||||
|
||||
class AdventureTemplateEntryFlavorRepository: public BaseAdventureTemplateEntryFlavorRepository {
|
||||
public:
|
||||
|
||||
/**
|
||||
* This file was auto generated and can be modified and extended upon
|
||||
*
|
||||
* Base repository methods are automatically
|
||||
* generated in the "base" version of this repository. The base repository
|
||||
* is immutable and to be left untouched, while methods in this class
|
||||
* are used as extension methods for more specific persistence-layer
|
||||
* accessors or mutators.
|
||||
*
|
||||
* Base Methods (Subject to be expanded upon in time)
|
||||
*
|
||||
* Note: Not all tables are designed appropriately to fit functionality with all base methods
|
||||
*
|
||||
* InsertOne
|
||||
* UpdateOne
|
||||
* DeleteOne
|
||||
* FindOne
|
||||
* GetWhere(std::string where_filter)
|
||||
* DeleteWhere(std::string where_filter)
|
||||
* InsertMany
|
||||
* All
|
||||
*
|
||||
* Example custom methods in a repository
|
||||
*
|
||||
* AdventureTemplateEntryFlavorRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* AdventureTemplateEntryFlavorRepository::GetWhereNeverExpires()
|
||||
* AdventureTemplateEntryFlavorRepository::GetWhereXAndY()
|
||||
* AdventureTemplateEntryFlavorRepository::DeleteWhereXAndY()
|
||||
*
|
||||
* Most of the above could be covered by base methods, but if you as a developer
|
||||
* find yourself re-using logic for other parts of the code, its best to just make a
|
||||
* method that can be re-used easily elsewhere especially if it can use a base repository
|
||||
* method and encapsulate filters there
|
||||
*/
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_ADVENTURE_TEMPLATE_ENTRY_FLAVOR_REPOSITORY_H
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
* are required to give you total support for your newly bought product;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_ADVENTURE_TEMPLATE_ENTRY_REPOSITORY_H
|
||||
#define EQEMU_ADVENTURE_TEMPLATE_ENTRY_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../string_util.h"
|
||||
#include "base/base_adventure_template_entry_repository.h"
|
||||
|
||||
class AdventureTemplateEntryRepository: public BaseAdventureTemplateEntryRepository {
|
||||
public:
|
||||
|
||||
/**
|
||||
* This file was auto generated and can be modified and extended upon
|
||||
*
|
||||
* Base repository methods are automatically
|
||||
* generated in the "base" version of this repository. The base repository
|
||||
* is immutable and to be left untouched, while methods in this class
|
||||
* are used as extension methods for more specific persistence-layer
|
||||
* accessors or mutators.
|
||||
*
|
||||
* Base Methods (Subject to be expanded upon in time)
|
||||
*
|
||||
* Note: Not all tables are designed appropriately to fit functionality with all base methods
|
||||
*
|
||||
* InsertOne
|
||||
* UpdateOne
|
||||
* DeleteOne
|
||||
* FindOne
|
||||
* GetWhere(std::string where_filter)
|
||||
* DeleteWhere(std::string where_filter)
|
||||
* InsertMany
|
||||
* All
|
||||
*
|
||||
* Example custom methods in a repository
|
||||
*
|
||||
* AdventureTemplateEntryRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* AdventureTemplateEntryRepository::GetWhereNeverExpires()
|
||||
* AdventureTemplateEntryRepository::GetWhereXAndY()
|
||||
* AdventureTemplateEntryRepository::DeleteWhereXAndY()
|
||||
*
|
||||
* Most of the above could be covered by base methods, but if you as a developer
|
||||
* find yourself re-using logic for other parts of the code, its best to just make a
|
||||
* method that can be re-used easily elsewhere especially if it can use a base repository
|
||||
* method and encapsulate filters there
|
||||
*/
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_ADVENTURE_TEMPLATE_ENTRY_REPOSITORY_H
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
* are required to give you total support for your newly bought product;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_ADVENTURE_TEMPLATE_REPOSITORY_H
|
||||
#define EQEMU_ADVENTURE_TEMPLATE_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../string_util.h"
|
||||
#include "base/base_adventure_template_repository.h"
|
||||
|
||||
class AdventureTemplateRepository: public BaseAdventureTemplateRepository {
|
||||
public:
|
||||
|
||||
/**
|
||||
* This file was auto generated and can be modified and extended upon
|
||||
*
|
||||
* Base repository methods are automatically
|
||||
* generated in the "base" version of this repository. The base repository
|
||||
* is immutable and to be left untouched, while methods in this class
|
||||
* are used as extension methods for more specific persistence-layer
|
||||
* accessors or mutators.
|
||||
*
|
||||
* Base Methods (Subject to be expanded upon in time)
|
||||
*
|
||||
* Note: Not all tables are designed appropriately to fit functionality with all base methods
|
||||
*
|
||||
* InsertOne
|
||||
* UpdateOne
|
||||
* DeleteOne
|
||||
* FindOne
|
||||
* GetWhere(std::string where_filter)
|
||||
* DeleteWhere(std::string where_filter)
|
||||
* InsertMany
|
||||
* All
|
||||
*
|
||||
* Example custom methods in a repository
|
||||
*
|
||||
* AdventureTemplateRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* AdventureTemplateRepository::GetWhereNeverExpires()
|
||||
* AdventureTemplateRepository::GetWhereXAndY()
|
||||
* AdventureTemplateRepository::DeleteWhereXAndY()
|
||||
*
|
||||
* Most of the above could be covered by base methods, but if you as a developer
|
||||
* find yourself re-using logic for other parts of the code, its best to just make a
|
||||
* method that can be re-used easily elsewhere especially if it can use a base repository
|
||||
* method and encapsulate filters there
|
||||
*/
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_ADVENTURE_TEMPLATE_REPOSITORY_H
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
* are required to give you total support for your newly bought product;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_ALTERNATE_CURRENCY_REPOSITORY_H
|
||||
#define EQEMU_ALTERNATE_CURRENCY_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../string_util.h"
|
||||
#include "base/base_alternate_currency_repository.h"
|
||||
|
||||
class AlternateCurrencyRepository: public BaseAlternateCurrencyRepository {
|
||||
public:
|
||||
|
||||
/**
|
||||
* This file was auto generated and can be modified and extended upon
|
||||
*
|
||||
* Base repository methods are automatically
|
||||
* generated in the "base" version of this repository. The base repository
|
||||
* is immutable and to be left untouched, while methods in this class
|
||||
* are used as extension methods for more specific persistence-layer
|
||||
* accessors or mutators.
|
||||
*
|
||||
* Base Methods (Subject to be expanded upon in time)
|
||||
*
|
||||
* Note: Not all tables are designed appropriately to fit functionality with all base methods
|
||||
*
|
||||
* InsertOne
|
||||
* UpdateOne
|
||||
* DeleteOne
|
||||
* FindOne
|
||||
* GetWhere(std::string where_filter)
|
||||
* DeleteWhere(std::string where_filter)
|
||||
* InsertMany
|
||||
* All
|
||||
*
|
||||
* Example custom methods in a repository
|
||||
*
|
||||
* AlternateCurrencyRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* AlternateCurrencyRepository::GetWhereNeverExpires()
|
||||
* AlternateCurrencyRepository::GetWhereXAndY()
|
||||
* AlternateCurrencyRepository::DeleteWhereXAndY()
|
||||
*
|
||||
* Most of the above could be covered by base methods, but if you as a developer
|
||||
* find yourself re-using logic for other parts of the code, its best to just make a
|
||||
* method that can be re-used easily elsewhere especially if it can use a base repository
|
||||
* method and encapsulate filters there
|
||||
*/
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_ALTERNATE_CURRENCY_REPOSITORY_H
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
* are required to give you total support for your newly bought product;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_AURAS_REPOSITORY_H
|
||||
#define EQEMU_AURAS_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../string_util.h"
|
||||
#include "base/base_auras_repository.h"
|
||||
|
||||
class AurasRepository: public BaseAurasRepository {
|
||||
public:
|
||||
|
||||
/**
|
||||
* This file was auto generated and can be modified and extended upon
|
||||
*
|
||||
* Base repository methods are automatically
|
||||
* generated in the "base" version of this repository. The base repository
|
||||
* is immutable and to be left untouched, while methods in this class
|
||||
* are used as extension methods for more specific persistence-layer
|
||||
* accessors or mutators.
|
||||
*
|
||||
* Base Methods (Subject to be expanded upon in time)
|
||||
*
|
||||
* Note: Not all tables are designed appropriately to fit functionality with all base methods
|
||||
*
|
||||
* InsertOne
|
||||
* UpdateOne
|
||||
* DeleteOne
|
||||
* FindOne
|
||||
* GetWhere(std::string where_filter)
|
||||
* DeleteWhere(std::string where_filter)
|
||||
* InsertMany
|
||||
* All
|
||||
*
|
||||
* Example custom methods in a repository
|
||||
*
|
||||
* AurasRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* AurasRepository::GetWhereNeverExpires()
|
||||
* AurasRepository::GetWhereXAndY()
|
||||
* AurasRepository::DeleteWhereXAndY()
|
||||
*
|
||||
* Most of the above could be covered by base methods, but if you as a developer
|
||||
* find yourself re-using logic for other parts of the code, its best to just make a
|
||||
* method that can be re-used easily elsewhere especially if it can use a base repository
|
||||
* method and encapsulate filters there
|
||||
*/
|
||||
|
||||
// Custom extended repository methods here
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_AURAS_REPOSITORY_H
|
||||
@@ -0,0 +1,401 @@
|
||||
/**
|
||||
* DO NOT MODIFY THIS FILE
|
||||
*
|
||||
* This repository was automatically generated and is NOT to be modified directly.
|
||||
* Any repository modifications are meant to be made to the repository extending the base.
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_AA_ABILITY_REPOSITORY_H
|
||||
#define EQEMU_BASE_AA_ABILITY_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../string_util.h"
|
||||
|
||||
class BaseAaAbilityRepository {
|
||||
public:
|
||||
struct AaAbility {
|
||||
int id;
|
||||
std::string name;
|
||||
int category;
|
||||
int classes;
|
||||
int races;
|
||||
int drakkin_heritage;
|
||||
int deities;
|
||||
int status;
|
||||
int type;
|
||||
int charges;
|
||||
int grant_only;
|
||||
int first_rank_id;
|
||||
int enabled;
|
||||
int reset_on_death;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"id",
|
||||
"name",
|
||||
"category",
|
||||
"classes",
|
||||
"races",
|
||||
"drakkin_heritage",
|
||||
"deities",
|
||||
"status",
|
||||
"type",
|
||||
"charges",
|
||||
"grant_only",
|
||||
"first_rank_id",
|
||||
"enabled",
|
||||
"reset_on_death",
|
||||
};
|
||||
}
|
||||
|
||||
static std::string ColumnsRaw()
|
||||
{
|
||||
return std::string(implode(", ", Columns()));
|
||||
}
|
||||
|
||||
static std::string TableName()
|
||||
{
|
||||
return std::string("aa_ability");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
ColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static AaAbility NewEntity()
|
||||
{
|
||||
AaAbility entry{};
|
||||
|
||||
entry.id = 0;
|
||||
entry.name = "";
|
||||
entry.category = -1;
|
||||
entry.classes = 131070;
|
||||
entry.races = 65535;
|
||||
entry.drakkin_heritage = 127;
|
||||
entry.deities = 131071;
|
||||
entry.status = 0;
|
||||
entry.type = 0;
|
||||
entry.charges = 0;
|
||||
entry.grant_only = 0;
|
||||
entry.first_rank_id = -1;
|
||||
entry.enabled = 1;
|
||||
entry.reset_on_death = 0;
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
static AaAbility GetAaAbilityEntry(
|
||||
const std::vector<AaAbility> &aa_abilitys,
|
||||
int aa_ability_id
|
||||
)
|
||||
{
|
||||
for (auto &aa_ability : aa_abilitys) {
|
||||
if (aa_ability.id == aa_ability_id) {
|
||||
return aa_ability;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static AaAbility FindOne(
|
||||
Database& db,
|
||||
int aa_ability_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
aa_ability_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
AaAbility entry{};
|
||||
|
||||
entry.id = atoi(row[0]);
|
||||
entry.name = row[1] ? row[1] : "";
|
||||
entry.category = atoi(row[2]);
|
||||
entry.classes = atoi(row[3]);
|
||||
entry.races = atoi(row[4]);
|
||||
entry.drakkin_heritage = atoi(row[5]);
|
||||
entry.deities = atoi(row[6]);
|
||||
entry.status = atoi(row[7]);
|
||||
entry.type = atoi(row[8]);
|
||||
entry.charges = atoi(row[9]);
|
||||
entry.grant_only = atoi(row[10]);
|
||||
entry.first_rank_id = atoi(row[11]);
|
||||
entry.enabled = atoi(row[12]);
|
||||
entry.reset_on_death = atoi(row[13]);
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int aa_ability_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
aa_ability_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
AaAbility aa_ability_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> update_values;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
update_values.push_back(columns[0] + " = " + std::to_string(aa_ability_entry.id));
|
||||
update_values.push_back(columns[1] + " = '" + EscapeString(aa_ability_entry.name) + "'");
|
||||
update_values.push_back(columns[2] + " = " + std::to_string(aa_ability_entry.category));
|
||||
update_values.push_back(columns[3] + " = " + std::to_string(aa_ability_entry.classes));
|
||||
update_values.push_back(columns[4] + " = " + std::to_string(aa_ability_entry.races));
|
||||
update_values.push_back(columns[5] + " = " + std::to_string(aa_ability_entry.drakkin_heritage));
|
||||
update_values.push_back(columns[6] + " = " + std::to_string(aa_ability_entry.deities));
|
||||
update_values.push_back(columns[7] + " = " + std::to_string(aa_ability_entry.status));
|
||||
update_values.push_back(columns[8] + " = " + std::to_string(aa_ability_entry.type));
|
||||
update_values.push_back(columns[9] + " = " + std::to_string(aa_ability_entry.charges));
|
||||
update_values.push_back(columns[10] + " = " + std::to_string(aa_ability_entry.grant_only));
|
||||
update_values.push_back(columns[11] + " = " + std::to_string(aa_ability_entry.first_rank_id));
|
||||
update_values.push_back(columns[12] + " = " + std::to_string(aa_ability_entry.enabled));
|
||||
update_values.push_back(columns[13] + " = " + std::to_string(aa_ability_entry.reset_on_death));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
implode(", ", update_values),
|
||||
PrimaryKey(),
|
||||
aa_ability_entry.id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static AaAbility InsertOne(
|
||||
Database& db,
|
||||
AaAbility aa_ability_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(aa_ability_entry.id));
|
||||
insert_values.push_back("'" + EscapeString(aa_ability_entry.name) + "'");
|
||||
insert_values.push_back(std::to_string(aa_ability_entry.category));
|
||||
insert_values.push_back(std::to_string(aa_ability_entry.classes));
|
||||
insert_values.push_back(std::to_string(aa_ability_entry.races));
|
||||
insert_values.push_back(std::to_string(aa_ability_entry.drakkin_heritage));
|
||||
insert_values.push_back(std::to_string(aa_ability_entry.deities));
|
||||
insert_values.push_back(std::to_string(aa_ability_entry.status));
|
||||
insert_values.push_back(std::to_string(aa_ability_entry.type));
|
||||
insert_values.push_back(std::to_string(aa_ability_entry.charges));
|
||||
insert_values.push_back(std::to_string(aa_ability_entry.grant_only));
|
||||
insert_values.push_back(std::to_string(aa_ability_entry.first_rank_id));
|
||||
insert_values.push_back(std::to_string(aa_ability_entry.enabled));
|
||||
insert_values.push_back(std::to_string(aa_ability_entry.reset_on_death));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
implode(",", insert_values)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
aa_ability_entry.id = results.LastInsertedID();
|
||||
return aa_ability_entry;
|
||||
}
|
||||
|
||||
aa_ability_entry = NewEntity();
|
||||
|
||||
return aa_ability_entry;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
std::vector<AaAbility> aa_ability_entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &aa_ability_entry: aa_ability_entries) {
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(aa_ability_entry.id));
|
||||
insert_values.push_back("'" + EscapeString(aa_ability_entry.name) + "'");
|
||||
insert_values.push_back(std::to_string(aa_ability_entry.category));
|
||||
insert_values.push_back(std::to_string(aa_ability_entry.classes));
|
||||
insert_values.push_back(std::to_string(aa_ability_entry.races));
|
||||
insert_values.push_back(std::to_string(aa_ability_entry.drakkin_heritage));
|
||||
insert_values.push_back(std::to_string(aa_ability_entry.deities));
|
||||
insert_values.push_back(std::to_string(aa_ability_entry.status));
|
||||
insert_values.push_back(std::to_string(aa_ability_entry.type));
|
||||
insert_values.push_back(std::to_string(aa_ability_entry.charges));
|
||||
insert_values.push_back(std::to_string(aa_ability_entry.grant_only));
|
||||
insert_values.push_back(std::to_string(aa_ability_entry.first_rank_id));
|
||||
insert_values.push_back(std::to_string(aa_ability_entry.enabled));
|
||||
insert_values.push_back(std::to_string(aa_ability_entry.reset_on_death));
|
||||
|
||||
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseInsert(),
|
||||
implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static std::vector<AaAbility> All(Database& db)
|
||||
{
|
||||
std::vector<AaAbility> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AaAbility entry{};
|
||||
|
||||
entry.id = atoi(row[0]);
|
||||
entry.name = row[1] ? row[1] : "";
|
||||
entry.category = atoi(row[2]);
|
||||
entry.classes = atoi(row[3]);
|
||||
entry.races = atoi(row[4]);
|
||||
entry.drakkin_heritage = atoi(row[5]);
|
||||
entry.deities = atoi(row[6]);
|
||||
entry.status = atoi(row[7]);
|
||||
entry.type = atoi(row[8]);
|
||||
entry.charges = atoi(row[9]);
|
||||
entry.grant_only = atoi(row[10]);
|
||||
entry.first_rank_id = atoi(row[11]);
|
||||
entry.enabled = atoi(row[12]);
|
||||
entry.reset_on_death = atoi(row[13]);
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<AaAbility> GetWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
std::vector<AaAbility> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {}",
|
||||
BaseSelect(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AaAbility entry{};
|
||||
|
||||
entry.id = atoi(row[0]);
|
||||
entry.name = row[1] ? row[1] : "";
|
||||
entry.category = atoi(row[2]);
|
||||
entry.classes = atoi(row[3]);
|
||||
entry.races = atoi(row[4]);
|
||||
entry.drakkin_heritage = atoi(row[5]);
|
||||
entry.deities = atoi(row[6]);
|
||||
entry.status = atoi(row[7]);
|
||||
entry.type = atoi(row[8]);
|
||||
entry.charges = atoi(row[9]);
|
||||
entry.grant_only = atoi(row[10]);
|
||||
entry.first_rank_id = atoi(row[11]);
|
||||
entry.enabled = atoi(row[12]);
|
||||
entry.reset_on_death = atoi(row[13]);
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static int DeleteWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {}",
|
||||
TableName(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int Truncate(Database& db)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"TRUNCATE TABLE {}",
|
||||
TableName()
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_AA_ABILITY_REPOSITORY_H
|
||||
@@ -0,0 +1,320 @@
|
||||
/**
|
||||
* DO NOT MODIFY THIS FILE
|
||||
*
|
||||
* This repository was automatically generated and is NOT to be modified directly.
|
||||
* Any repository modifications are meant to be made to the repository extending the base.
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_AA_RANK_EFFECTS_REPOSITORY_H
|
||||
#define EQEMU_BASE_AA_RANK_EFFECTS_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../string_util.h"
|
||||
|
||||
class BaseAaRankEffectsRepository {
|
||||
public:
|
||||
struct AaRankEffects {
|
||||
int rank_id;
|
||||
int slot;
|
||||
int effect_id;
|
||||
int base1;
|
||||
int base2;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("rank_id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"rank_id",
|
||||
"slot",
|
||||
"effect_id",
|
||||
"base1",
|
||||
"base2",
|
||||
};
|
||||
}
|
||||
|
||||
static std::string ColumnsRaw()
|
||||
{
|
||||
return std::string(implode(", ", Columns()));
|
||||
}
|
||||
|
||||
static std::string TableName()
|
||||
{
|
||||
return std::string("aa_rank_effects");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
ColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static AaRankEffects NewEntity()
|
||||
{
|
||||
AaRankEffects entry{};
|
||||
|
||||
entry.rank_id = 0;
|
||||
entry.slot = 1;
|
||||
entry.effect_id = 0;
|
||||
entry.base1 = 0;
|
||||
entry.base2 = 0;
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
static AaRankEffects GetAaRankEffectsEntry(
|
||||
const std::vector<AaRankEffects> &aa_rank_effectss,
|
||||
int aa_rank_effects_id
|
||||
)
|
||||
{
|
||||
for (auto &aa_rank_effects : aa_rank_effectss) {
|
||||
if (aa_rank_effects.rank_id == aa_rank_effects_id) {
|
||||
return aa_rank_effects;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static AaRankEffects FindOne(
|
||||
Database& db,
|
||||
int aa_rank_effects_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
aa_rank_effects_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
AaRankEffects entry{};
|
||||
|
||||
entry.rank_id = atoi(row[0]);
|
||||
entry.slot = atoi(row[1]);
|
||||
entry.effect_id = atoi(row[2]);
|
||||
entry.base1 = atoi(row[3]);
|
||||
entry.base2 = atoi(row[4]);
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int aa_rank_effects_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
aa_rank_effects_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
AaRankEffects aa_rank_effects_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> update_values;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
update_values.push_back(columns[0] + " = " + std::to_string(aa_rank_effects_entry.rank_id));
|
||||
update_values.push_back(columns[1] + " = " + std::to_string(aa_rank_effects_entry.slot));
|
||||
update_values.push_back(columns[2] + " = " + std::to_string(aa_rank_effects_entry.effect_id));
|
||||
update_values.push_back(columns[3] + " = " + std::to_string(aa_rank_effects_entry.base1));
|
||||
update_values.push_back(columns[4] + " = " + std::to_string(aa_rank_effects_entry.base2));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
implode(", ", update_values),
|
||||
PrimaryKey(),
|
||||
aa_rank_effects_entry.rank_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static AaRankEffects InsertOne(
|
||||
Database& db,
|
||||
AaRankEffects aa_rank_effects_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(aa_rank_effects_entry.rank_id));
|
||||
insert_values.push_back(std::to_string(aa_rank_effects_entry.slot));
|
||||
insert_values.push_back(std::to_string(aa_rank_effects_entry.effect_id));
|
||||
insert_values.push_back(std::to_string(aa_rank_effects_entry.base1));
|
||||
insert_values.push_back(std::to_string(aa_rank_effects_entry.base2));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
implode(",", insert_values)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
aa_rank_effects_entry.rank_id = results.LastInsertedID();
|
||||
return aa_rank_effects_entry;
|
||||
}
|
||||
|
||||
aa_rank_effects_entry = NewEntity();
|
||||
|
||||
return aa_rank_effects_entry;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
std::vector<AaRankEffects> aa_rank_effects_entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &aa_rank_effects_entry: aa_rank_effects_entries) {
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(aa_rank_effects_entry.rank_id));
|
||||
insert_values.push_back(std::to_string(aa_rank_effects_entry.slot));
|
||||
insert_values.push_back(std::to_string(aa_rank_effects_entry.effect_id));
|
||||
insert_values.push_back(std::to_string(aa_rank_effects_entry.base1));
|
||||
insert_values.push_back(std::to_string(aa_rank_effects_entry.base2));
|
||||
|
||||
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseInsert(),
|
||||
implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static std::vector<AaRankEffects> All(Database& db)
|
||||
{
|
||||
std::vector<AaRankEffects> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AaRankEffects entry{};
|
||||
|
||||
entry.rank_id = atoi(row[0]);
|
||||
entry.slot = atoi(row[1]);
|
||||
entry.effect_id = atoi(row[2]);
|
||||
entry.base1 = atoi(row[3]);
|
||||
entry.base2 = atoi(row[4]);
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<AaRankEffects> GetWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
std::vector<AaRankEffects> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {}",
|
||||
BaseSelect(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AaRankEffects entry{};
|
||||
|
||||
entry.rank_id = atoi(row[0]);
|
||||
entry.slot = atoi(row[1]);
|
||||
entry.effect_id = atoi(row[2]);
|
||||
entry.base1 = atoi(row[3]);
|
||||
entry.base2 = atoi(row[4]);
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static int DeleteWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {}",
|
||||
TableName(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int Truncate(Database& db)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"TRUNCATE TABLE {}",
|
||||
TableName()
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_AA_RANK_EFFECTS_REPOSITORY_H
|
||||
@@ -0,0 +1,302 @@
|
||||
/**
|
||||
* DO NOT MODIFY THIS FILE
|
||||
*
|
||||
* This repository was automatically generated and is NOT to be modified directly.
|
||||
* Any repository modifications are meant to be made to the repository extending the base.
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_AA_RANK_PREREQS_REPOSITORY_H
|
||||
#define EQEMU_BASE_AA_RANK_PREREQS_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../string_util.h"
|
||||
|
||||
class BaseAaRankPrereqsRepository {
|
||||
public:
|
||||
struct AaRankPrereqs {
|
||||
int rank_id;
|
||||
int aa_id;
|
||||
int points;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("rank_id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"rank_id",
|
||||
"aa_id",
|
||||
"points",
|
||||
};
|
||||
}
|
||||
|
||||
static std::string ColumnsRaw()
|
||||
{
|
||||
return std::string(implode(", ", Columns()));
|
||||
}
|
||||
|
||||
static std::string TableName()
|
||||
{
|
||||
return std::string("aa_rank_prereqs");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
ColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static AaRankPrereqs NewEntity()
|
||||
{
|
||||
AaRankPrereqs entry{};
|
||||
|
||||
entry.rank_id = 0;
|
||||
entry.aa_id = 0;
|
||||
entry.points = 0;
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
static AaRankPrereqs GetAaRankPrereqsEntry(
|
||||
const std::vector<AaRankPrereqs> &aa_rank_prereqss,
|
||||
int aa_rank_prereqs_id
|
||||
)
|
||||
{
|
||||
for (auto &aa_rank_prereqs : aa_rank_prereqss) {
|
||||
if (aa_rank_prereqs.rank_id == aa_rank_prereqs_id) {
|
||||
return aa_rank_prereqs;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static AaRankPrereqs FindOne(
|
||||
Database& db,
|
||||
int aa_rank_prereqs_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
aa_rank_prereqs_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
AaRankPrereqs entry{};
|
||||
|
||||
entry.rank_id = atoi(row[0]);
|
||||
entry.aa_id = atoi(row[1]);
|
||||
entry.points = atoi(row[2]);
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int aa_rank_prereqs_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
aa_rank_prereqs_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
AaRankPrereqs aa_rank_prereqs_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> update_values;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
update_values.push_back(columns[0] + " = " + std::to_string(aa_rank_prereqs_entry.rank_id));
|
||||
update_values.push_back(columns[1] + " = " + std::to_string(aa_rank_prereqs_entry.aa_id));
|
||||
update_values.push_back(columns[2] + " = " + std::to_string(aa_rank_prereqs_entry.points));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
implode(", ", update_values),
|
||||
PrimaryKey(),
|
||||
aa_rank_prereqs_entry.rank_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static AaRankPrereqs InsertOne(
|
||||
Database& db,
|
||||
AaRankPrereqs aa_rank_prereqs_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(aa_rank_prereqs_entry.rank_id));
|
||||
insert_values.push_back(std::to_string(aa_rank_prereqs_entry.aa_id));
|
||||
insert_values.push_back(std::to_string(aa_rank_prereqs_entry.points));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
implode(",", insert_values)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
aa_rank_prereqs_entry.rank_id = results.LastInsertedID();
|
||||
return aa_rank_prereqs_entry;
|
||||
}
|
||||
|
||||
aa_rank_prereqs_entry = NewEntity();
|
||||
|
||||
return aa_rank_prereqs_entry;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
std::vector<AaRankPrereqs> aa_rank_prereqs_entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &aa_rank_prereqs_entry: aa_rank_prereqs_entries) {
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(aa_rank_prereqs_entry.rank_id));
|
||||
insert_values.push_back(std::to_string(aa_rank_prereqs_entry.aa_id));
|
||||
insert_values.push_back(std::to_string(aa_rank_prereqs_entry.points));
|
||||
|
||||
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseInsert(),
|
||||
implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static std::vector<AaRankPrereqs> All(Database& db)
|
||||
{
|
||||
std::vector<AaRankPrereqs> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AaRankPrereqs entry{};
|
||||
|
||||
entry.rank_id = atoi(row[0]);
|
||||
entry.aa_id = atoi(row[1]);
|
||||
entry.points = atoi(row[2]);
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<AaRankPrereqs> GetWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
std::vector<AaRankPrereqs> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {}",
|
||||
BaseSelect(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AaRankPrereqs entry{};
|
||||
|
||||
entry.rank_id = atoi(row[0]);
|
||||
entry.aa_id = atoi(row[1]);
|
||||
entry.points = atoi(row[2]);
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static int DeleteWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {}",
|
||||
TableName(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int Truncate(Database& db)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"TRUNCATE TABLE {}",
|
||||
TableName()
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_AA_RANK_PREREQS_REPOSITORY_H
|
||||
@@ -0,0 +1,392 @@
|
||||
/**
|
||||
* DO NOT MODIFY THIS FILE
|
||||
*
|
||||
* This repository was automatically generated and is NOT to be modified directly.
|
||||
* Any repository modifications are meant to be made to the repository extending the base.
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_AA_RANKS_REPOSITORY_H
|
||||
#define EQEMU_BASE_AA_RANKS_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../string_util.h"
|
||||
|
||||
class BaseAaRanksRepository {
|
||||
public:
|
||||
struct AaRanks {
|
||||
int id;
|
||||
int upper_hotkey_sid;
|
||||
int lower_hotkey_sid;
|
||||
int title_sid;
|
||||
int desc_sid;
|
||||
int cost;
|
||||
int level_req;
|
||||
int spell;
|
||||
int spell_type;
|
||||
int recast_time;
|
||||
int expansion;
|
||||
int prev_id;
|
||||
int next_id;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"id",
|
||||
"upper_hotkey_sid",
|
||||
"lower_hotkey_sid",
|
||||
"title_sid",
|
||||
"desc_sid",
|
||||
"cost",
|
||||
"level_req",
|
||||
"spell",
|
||||
"spell_type",
|
||||
"recast_time",
|
||||
"expansion",
|
||||
"prev_id",
|
||||
"next_id",
|
||||
};
|
||||
}
|
||||
|
||||
static std::string ColumnsRaw()
|
||||
{
|
||||
return std::string(implode(", ", Columns()));
|
||||
}
|
||||
|
||||
static std::string TableName()
|
||||
{
|
||||
return std::string("aa_ranks");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
ColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static AaRanks NewEntity()
|
||||
{
|
||||
AaRanks entry{};
|
||||
|
||||
entry.id = 0;
|
||||
entry.upper_hotkey_sid = -1;
|
||||
entry.lower_hotkey_sid = -1;
|
||||
entry.title_sid = -1;
|
||||
entry.desc_sid = -1;
|
||||
entry.cost = 1;
|
||||
entry.level_req = 51;
|
||||
entry.spell = -1;
|
||||
entry.spell_type = 0;
|
||||
entry.recast_time = 0;
|
||||
entry.expansion = 0;
|
||||
entry.prev_id = -1;
|
||||
entry.next_id = -1;
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
static AaRanks GetAaRanksEntry(
|
||||
const std::vector<AaRanks> &aa_rankss,
|
||||
int aa_ranks_id
|
||||
)
|
||||
{
|
||||
for (auto &aa_ranks : aa_rankss) {
|
||||
if (aa_ranks.id == aa_ranks_id) {
|
||||
return aa_ranks;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static AaRanks FindOne(
|
||||
Database& db,
|
||||
int aa_ranks_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
aa_ranks_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
AaRanks entry{};
|
||||
|
||||
entry.id = atoi(row[0]);
|
||||
entry.upper_hotkey_sid = atoi(row[1]);
|
||||
entry.lower_hotkey_sid = atoi(row[2]);
|
||||
entry.title_sid = atoi(row[3]);
|
||||
entry.desc_sid = atoi(row[4]);
|
||||
entry.cost = atoi(row[5]);
|
||||
entry.level_req = atoi(row[6]);
|
||||
entry.spell = atoi(row[7]);
|
||||
entry.spell_type = atoi(row[8]);
|
||||
entry.recast_time = atoi(row[9]);
|
||||
entry.expansion = atoi(row[10]);
|
||||
entry.prev_id = atoi(row[11]);
|
||||
entry.next_id = atoi(row[12]);
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int aa_ranks_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
aa_ranks_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
AaRanks aa_ranks_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> update_values;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
update_values.push_back(columns[0] + " = " + std::to_string(aa_ranks_entry.id));
|
||||
update_values.push_back(columns[1] + " = " + std::to_string(aa_ranks_entry.upper_hotkey_sid));
|
||||
update_values.push_back(columns[2] + " = " + std::to_string(aa_ranks_entry.lower_hotkey_sid));
|
||||
update_values.push_back(columns[3] + " = " + std::to_string(aa_ranks_entry.title_sid));
|
||||
update_values.push_back(columns[4] + " = " + std::to_string(aa_ranks_entry.desc_sid));
|
||||
update_values.push_back(columns[5] + " = " + std::to_string(aa_ranks_entry.cost));
|
||||
update_values.push_back(columns[6] + " = " + std::to_string(aa_ranks_entry.level_req));
|
||||
update_values.push_back(columns[7] + " = " + std::to_string(aa_ranks_entry.spell));
|
||||
update_values.push_back(columns[8] + " = " + std::to_string(aa_ranks_entry.spell_type));
|
||||
update_values.push_back(columns[9] + " = " + std::to_string(aa_ranks_entry.recast_time));
|
||||
update_values.push_back(columns[10] + " = " + std::to_string(aa_ranks_entry.expansion));
|
||||
update_values.push_back(columns[11] + " = " + std::to_string(aa_ranks_entry.prev_id));
|
||||
update_values.push_back(columns[12] + " = " + std::to_string(aa_ranks_entry.next_id));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
implode(", ", update_values),
|
||||
PrimaryKey(),
|
||||
aa_ranks_entry.id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static AaRanks InsertOne(
|
||||
Database& db,
|
||||
AaRanks aa_ranks_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(aa_ranks_entry.id));
|
||||
insert_values.push_back(std::to_string(aa_ranks_entry.upper_hotkey_sid));
|
||||
insert_values.push_back(std::to_string(aa_ranks_entry.lower_hotkey_sid));
|
||||
insert_values.push_back(std::to_string(aa_ranks_entry.title_sid));
|
||||
insert_values.push_back(std::to_string(aa_ranks_entry.desc_sid));
|
||||
insert_values.push_back(std::to_string(aa_ranks_entry.cost));
|
||||
insert_values.push_back(std::to_string(aa_ranks_entry.level_req));
|
||||
insert_values.push_back(std::to_string(aa_ranks_entry.spell));
|
||||
insert_values.push_back(std::to_string(aa_ranks_entry.spell_type));
|
||||
insert_values.push_back(std::to_string(aa_ranks_entry.recast_time));
|
||||
insert_values.push_back(std::to_string(aa_ranks_entry.expansion));
|
||||
insert_values.push_back(std::to_string(aa_ranks_entry.prev_id));
|
||||
insert_values.push_back(std::to_string(aa_ranks_entry.next_id));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
implode(",", insert_values)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
aa_ranks_entry.id = results.LastInsertedID();
|
||||
return aa_ranks_entry;
|
||||
}
|
||||
|
||||
aa_ranks_entry = NewEntity();
|
||||
|
||||
return aa_ranks_entry;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
std::vector<AaRanks> aa_ranks_entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &aa_ranks_entry: aa_ranks_entries) {
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(aa_ranks_entry.id));
|
||||
insert_values.push_back(std::to_string(aa_ranks_entry.upper_hotkey_sid));
|
||||
insert_values.push_back(std::to_string(aa_ranks_entry.lower_hotkey_sid));
|
||||
insert_values.push_back(std::to_string(aa_ranks_entry.title_sid));
|
||||
insert_values.push_back(std::to_string(aa_ranks_entry.desc_sid));
|
||||
insert_values.push_back(std::to_string(aa_ranks_entry.cost));
|
||||
insert_values.push_back(std::to_string(aa_ranks_entry.level_req));
|
||||
insert_values.push_back(std::to_string(aa_ranks_entry.spell));
|
||||
insert_values.push_back(std::to_string(aa_ranks_entry.spell_type));
|
||||
insert_values.push_back(std::to_string(aa_ranks_entry.recast_time));
|
||||
insert_values.push_back(std::to_string(aa_ranks_entry.expansion));
|
||||
insert_values.push_back(std::to_string(aa_ranks_entry.prev_id));
|
||||
insert_values.push_back(std::to_string(aa_ranks_entry.next_id));
|
||||
|
||||
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseInsert(),
|
||||
implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static std::vector<AaRanks> All(Database& db)
|
||||
{
|
||||
std::vector<AaRanks> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AaRanks entry{};
|
||||
|
||||
entry.id = atoi(row[0]);
|
||||
entry.upper_hotkey_sid = atoi(row[1]);
|
||||
entry.lower_hotkey_sid = atoi(row[2]);
|
||||
entry.title_sid = atoi(row[3]);
|
||||
entry.desc_sid = atoi(row[4]);
|
||||
entry.cost = atoi(row[5]);
|
||||
entry.level_req = atoi(row[6]);
|
||||
entry.spell = atoi(row[7]);
|
||||
entry.spell_type = atoi(row[8]);
|
||||
entry.recast_time = atoi(row[9]);
|
||||
entry.expansion = atoi(row[10]);
|
||||
entry.prev_id = atoi(row[11]);
|
||||
entry.next_id = atoi(row[12]);
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<AaRanks> GetWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
std::vector<AaRanks> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {}",
|
||||
BaseSelect(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AaRanks entry{};
|
||||
|
||||
entry.id = atoi(row[0]);
|
||||
entry.upper_hotkey_sid = atoi(row[1]);
|
||||
entry.lower_hotkey_sid = atoi(row[2]);
|
||||
entry.title_sid = atoi(row[3]);
|
||||
entry.desc_sid = atoi(row[4]);
|
||||
entry.cost = atoi(row[5]);
|
||||
entry.level_req = atoi(row[6]);
|
||||
entry.spell = atoi(row[7]);
|
||||
entry.spell_type = atoi(row[8]);
|
||||
entry.recast_time = atoi(row[9]);
|
||||
entry.expansion = atoi(row[10]);
|
||||
entry.prev_id = atoi(row[11]);
|
||||
entry.next_id = atoi(row[12]);
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static int DeleteWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {}",
|
||||
TableName(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int Truncate(Database& db)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"TRUNCATE TABLE {}",
|
||||
TableName()
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_AA_RANKS_REPOSITORY_H
|
||||
@@ -0,0 +1,302 @@
|
||||
/**
|
||||
* DO NOT MODIFY THIS FILE
|
||||
*
|
||||
* This repository was automatically generated and is NOT to be modified directly.
|
||||
* Any repository modifications are meant to be made to the repository extending the base.
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_ACCOUNT_FLAGS_REPOSITORY_H
|
||||
#define EQEMU_BASE_ACCOUNT_FLAGS_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../string_util.h"
|
||||
|
||||
class BaseAccountFlagsRepository {
|
||||
public:
|
||||
struct AccountFlags {
|
||||
int p_accid;
|
||||
std::string p_flag;
|
||||
std::string p_value;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("p_accid");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"p_accid",
|
||||
"p_flag",
|
||||
"p_value",
|
||||
};
|
||||
}
|
||||
|
||||
static std::string ColumnsRaw()
|
||||
{
|
||||
return std::string(implode(", ", Columns()));
|
||||
}
|
||||
|
||||
static std::string TableName()
|
||||
{
|
||||
return std::string("account_flags");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
ColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static AccountFlags NewEntity()
|
||||
{
|
||||
AccountFlags entry{};
|
||||
|
||||
entry.p_accid = 0;
|
||||
entry.p_flag = "";
|
||||
entry.p_value = "";
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
static AccountFlags GetAccountFlagsEntry(
|
||||
const std::vector<AccountFlags> &account_flagss,
|
||||
int account_flags_id
|
||||
)
|
||||
{
|
||||
for (auto &account_flags : account_flagss) {
|
||||
if (account_flags.p_accid == account_flags_id) {
|
||||
return account_flags;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static AccountFlags FindOne(
|
||||
Database& db,
|
||||
int account_flags_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
account_flags_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
AccountFlags entry{};
|
||||
|
||||
entry.p_accid = atoi(row[0]);
|
||||
entry.p_flag = row[1] ? row[1] : "";
|
||||
entry.p_value = row[2] ? row[2] : "";
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int account_flags_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
account_flags_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
AccountFlags account_flags_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> update_values;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
update_values.push_back(columns[0] + " = " + std::to_string(account_flags_entry.p_accid));
|
||||
update_values.push_back(columns[1] + " = '" + EscapeString(account_flags_entry.p_flag) + "'");
|
||||
update_values.push_back(columns[2] + " = '" + EscapeString(account_flags_entry.p_value) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
implode(", ", update_values),
|
||||
PrimaryKey(),
|
||||
account_flags_entry.p_accid
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static AccountFlags InsertOne(
|
||||
Database& db,
|
||||
AccountFlags account_flags_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(account_flags_entry.p_accid));
|
||||
insert_values.push_back("'" + EscapeString(account_flags_entry.p_flag) + "'");
|
||||
insert_values.push_back("'" + EscapeString(account_flags_entry.p_value) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
implode(",", insert_values)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
account_flags_entry.p_accid = results.LastInsertedID();
|
||||
return account_flags_entry;
|
||||
}
|
||||
|
||||
account_flags_entry = NewEntity();
|
||||
|
||||
return account_flags_entry;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
std::vector<AccountFlags> account_flags_entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &account_flags_entry: account_flags_entries) {
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(account_flags_entry.p_accid));
|
||||
insert_values.push_back("'" + EscapeString(account_flags_entry.p_flag) + "'");
|
||||
insert_values.push_back("'" + EscapeString(account_flags_entry.p_value) + "'");
|
||||
|
||||
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseInsert(),
|
||||
implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static std::vector<AccountFlags> All(Database& db)
|
||||
{
|
||||
std::vector<AccountFlags> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AccountFlags entry{};
|
||||
|
||||
entry.p_accid = atoi(row[0]);
|
||||
entry.p_flag = row[1] ? row[1] : "";
|
||||
entry.p_value = row[2] ? row[2] : "";
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<AccountFlags> GetWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
std::vector<AccountFlags> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {}",
|
||||
BaseSelect(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AccountFlags entry{};
|
||||
|
||||
entry.p_accid = atoi(row[0]);
|
||||
entry.p_flag = row[1] ? row[1] : "";
|
||||
entry.p_value = row[2] ? row[2] : "";
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static int DeleteWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {}",
|
||||
TableName(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int Truncate(Database& db)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"TRUNCATE TABLE {}",
|
||||
TableName()
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_ACCOUNT_FLAGS_REPOSITORY_H
|
||||
@@ -0,0 +1,311 @@
|
||||
/**
|
||||
* DO NOT MODIFY THIS FILE
|
||||
*
|
||||
* This repository was automatically generated and is NOT to be modified directly.
|
||||
* Any repository modifications are meant to be made to the repository extending the base.
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_ACCOUNT_IP_REPOSITORY_H
|
||||
#define EQEMU_BASE_ACCOUNT_IP_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../string_util.h"
|
||||
|
||||
class BaseAccountIpRepository {
|
||||
public:
|
||||
struct AccountIp {
|
||||
int accid;
|
||||
std::string ip;
|
||||
int count;
|
||||
std::string lastused;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("accid");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"accid",
|
||||
"ip",
|
||||
"count",
|
||||
"lastused",
|
||||
};
|
||||
}
|
||||
|
||||
static std::string ColumnsRaw()
|
||||
{
|
||||
return std::string(implode(", ", Columns()));
|
||||
}
|
||||
|
||||
static std::string TableName()
|
||||
{
|
||||
return std::string("account_ip");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
ColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static AccountIp NewEntity()
|
||||
{
|
||||
AccountIp entry{};
|
||||
|
||||
entry.accid = 0;
|
||||
entry.ip = "";
|
||||
entry.count = 1;
|
||||
entry.lastused = current_timestamp();
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
static AccountIp GetAccountIpEntry(
|
||||
const std::vector<AccountIp> &account_ips,
|
||||
int account_ip_id
|
||||
)
|
||||
{
|
||||
for (auto &account_ip : account_ips) {
|
||||
if (account_ip.accid == account_ip_id) {
|
||||
return account_ip;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static AccountIp FindOne(
|
||||
Database& db,
|
||||
int account_ip_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
account_ip_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
AccountIp entry{};
|
||||
|
||||
entry.accid = atoi(row[0]);
|
||||
entry.ip = row[1] ? row[1] : "";
|
||||
entry.count = atoi(row[2]);
|
||||
entry.lastused = row[3] ? row[3] : "";
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int account_ip_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
account_ip_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
AccountIp account_ip_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> update_values;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
update_values.push_back(columns[0] + " = " + std::to_string(account_ip_entry.accid));
|
||||
update_values.push_back(columns[1] + " = '" + EscapeString(account_ip_entry.ip) + "'");
|
||||
update_values.push_back(columns[2] + " = " + std::to_string(account_ip_entry.count));
|
||||
update_values.push_back(columns[3] + " = '" + EscapeString(account_ip_entry.lastused) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
implode(", ", update_values),
|
||||
PrimaryKey(),
|
||||
account_ip_entry.accid
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static AccountIp InsertOne(
|
||||
Database& db,
|
||||
AccountIp account_ip_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(account_ip_entry.accid));
|
||||
insert_values.push_back("'" + EscapeString(account_ip_entry.ip) + "'");
|
||||
insert_values.push_back(std::to_string(account_ip_entry.count));
|
||||
insert_values.push_back("'" + EscapeString(account_ip_entry.lastused) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
implode(",", insert_values)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
account_ip_entry.accid = results.LastInsertedID();
|
||||
return account_ip_entry;
|
||||
}
|
||||
|
||||
account_ip_entry = NewEntity();
|
||||
|
||||
return account_ip_entry;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
std::vector<AccountIp> account_ip_entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &account_ip_entry: account_ip_entries) {
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(account_ip_entry.accid));
|
||||
insert_values.push_back("'" + EscapeString(account_ip_entry.ip) + "'");
|
||||
insert_values.push_back(std::to_string(account_ip_entry.count));
|
||||
insert_values.push_back("'" + EscapeString(account_ip_entry.lastused) + "'");
|
||||
|
||||
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseInsert(),
|
||||
implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static std::vector<AccountIp> All(Database& db)
|
||||
{
|
||||
std::vector<AccountIp> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AccountIp entry{};
|
||||
|
||||
entry.accid = atoi(row[0]);
|
||||
entry.ip = row[1] ? row[1] : "";
|
||||
entry.count = atoi(row[2]);
|
||||
entry.lastused = row[3] ? row[3] : "";
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<AccountIp> GetWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
std::vector<AccountIp> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {}",
|
||||
BaseSelect(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AccountIp entry{};
|
||||
|
||||
entry.accid = atoi(row[0]);
|
||||
entry.ip = row[1] ? row[1] : "";
|
||||
entry.count = atoi(row[2]);
|
||||
entry.lastused = row[3] ? row[3] : "";
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static int DeleteWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {}",
|
||||
TableName(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int Truncate(Database& db)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"TRUNCATE TABLE {}",
|
||||
TableName()
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_ACCOUNT_IP_REPOSITORY_H
|
||||
@@ -0,0 +1,445 @@
|
||||
/**
|
||||
* DO NOT MODIFY THIS FILE
|
||||
*
|
||||
* This repository was automatically generated and is NOT to be modified directly.
|
||||
* Any repository modifications are meant to be made to the repository extending the base.
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_ACCOUNT_REPOSITORY_H
|
||||
#define EQEMU_BASE_ACCOUNT_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../string_util.h"
|
||||
|
||||
class BaseAccountRepository {
|
||||
public:
|
||||
struct Account {
|
||||
int id;
|
||||
std::string name;
|
||||
std::string charname;
|
||||
int sharedplat;
|
||||
std::string password;
|
||||
int status;
|
||||
std::string ls_id;
|
||||
int lsaccount_id;
|
||||
int gmspeed;
|
||||
int revoked;
|
||||
int karma;
|
||||
std::string minilogin_ip;
|
||||
int hideme;
|
||||
int rulesflag;
|
||||
std::string suspendeduntil;
|
||||
int time_creation;
|
||||
int expansion;
|
||||
std::string ban_reason;
|
||||
std::string suspend_reason;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"id",
|
||||
"name",
|
||||
"charname",
|
||||
"sharedplat",
|
||||
"password",
|
||||
"status",
|
||||
"ls_id",
|
||||
"lsaccount_id",
|
||||
"gmspeed",
|
||||
"revoked",
|
||||
"karma",
|
||||
"minilogin_ip",
|
||||
"hideme",
|
||||
"rulesflag",
|
||||
"suspendeduntil",
|
||||
"time_creation",
|
||||
"expansion",
|
||||
"ban_reason",
|
||||
"suspend_reason",
|
||||
};
|
||||
}
|
||||
|
||||
static std::string ColumnsRaw()
|
||||
{
|
||||
return std::string(implode(", ", Columns()));
|
||||
}
|
||||
|
||||
static std::string TableName()
|
||||
{
|
||||
return std::string("account");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
ColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static Account NewEntity()
|
||||
{
|
||||
Account entry{};
|
||||
|
||||
entry.id = 0;
|
||||
entry.name = "";
|
||||
entry.charname = "";
|
||||
entry.sharedplat = 0;
|
||||
entry.password = "";
|
||||
entry.status = 0;
|
||||
entry.ls_id = "eqemu";
|
||||
entry.lsaccount_id = 0;
|
||||
entry.gmspeed = 0;
|
||||
entry.revoked = 0;
|
||||
entry.karma = 0;
|
||||
entry.minilogin_ip = "";
|
||||
entry.hideme = 0;
|
||||
entry.rulesflag = 0;
|
||||
entry.suspendeduntil = "0000-00-00 00:00:00";
|
||||
entry.time_creation = 0;
|
||||
entry.expansion = 0;
|
||||
entry.ban_reason = "";
|
||||
entry.suspend_reason = "";
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
static Account GetAccountEntry(
|
||||
const std::vector<Account> &accounts,
|
||||
int account_id
|
||||
)
|
||||
{
|
||||
for (auto &account : accounts) {
|
||||
if (account.id == account_id) {
|
||||
return account;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static Account FindOne(
|
||||
Database& db,
|
||||
int account_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
account_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
Account entry{};
|
||||
|
||||
entry.id = atoi(row[0]);
|
||||
entry.name = row[1] ? row[1] : "";
|
||||
entry.charname = row[2] ? row[2] : "";
|
||||
entry.sharedplat = atoi(row[3]);
|
||||
entry.password = row[4] ? row[4] : "";
|
||||
entry.status = atoi(row[5]);
|
||||
entry.ls_id = row[6] ? row[6] : "";
|
||||
entry.lsaccount_id = atoi(row[7]);
|
||||
entry.gmspeed = atoi(row[8]);
|
||||
entry.revoked = atoi(row[9]);
|
||||
entry.karma = atoi(row[10]);
|
||||
entry.minilogin_ip = row[11] ? row[11] : "";
|
||||
entry.hideme = atoi(row[12]);
|
||||
entry.rulesflag = atoi(row[13]);
|
||||
entry.suspendeduntil = row[14] ? row[14] : "";
|
||||
entry.time_creation = atoi(row[15]);
|
||||
entry.expansion = atoi(row[16]);
|
||||
entry.ban_reason = row[17] ? row[17] : "";
|
||||
entry.suspend_reason = row[18] ? row[18] : "";
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int account_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
account_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
Account account_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> update_values;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
update_values.push_back(columns[1] + " = '" + EscapeString(account_entry.name) + "'");
|
||||
update_values.push_back(columns[2] + " = '" + EscapeString(account_entry.charname) + "'");
|
||||
update_values.push_back(columns[3] + " = " + std::to_string(account_entry.sharedplat));
|
||||
update_values.push_back(columns[4] + " = '" + EscapeString(account_entry.password) + "'");
|
||||
update_values.push_back(columns[5] + " = " + std::to_string(account_entry.status));
|
||||
update_values.push_back(columns[6] + " = '" + EscapeString(account_entry.ls_id) + "'");
|
||||
update_values.push_back(columns[7] + " = " + std::to_string(account_entry.lsaccount_id));
|
||||
update_values.push_back(columns[8] + " = " + std::to_string(account_entry.gmspeed));
|
||||
update_values.push_back(columns[9] + " = " + std::to_string(account_entry.revoked));
|
||||
update_values.push_back(columns[10] + " = " + std::to_string(account_entry.karma));
|
||||
update_values.push_back(columns[11] + " = '" + EscapeString(account_entry.minilogin_ip) + "'");
|
||||
update_values.push_back(columns[12] + " = " + std::to_string(account_entry.hideme));
|
||||
update_values.push_back(columns[13] + " = " + std::to_string(account_entry.rulesflag));
|
||||
update_values.push_back(columns[14] + " = '" + EscapeString(account_entry.suspendeduntil) + "'");
|
||||
update_values.push_back(columns[15] + " = " + std::to_string(account_entry.time_creation));
|
||||
update_values.push_back(columns[16] + " = " + std::to_string(account_entry.expansion));
|
||||
update_values.push_back(columns[17] + " = '" + EscapeString(account_entry.ban_reason) + "'");
|
||||
update_values.push_back(columns[18] + " = '" + EscapeString(account_entry.suspend_reason) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
implode(", ", update_values),
|
||||
PrimaryKey(),
|
||||
account_entry.id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static Account InsertOne(
|
||||
Database& db,
|
||||
Account account_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(account_entry.id));
|
||||
insert_values.push_back("'" + EscapeString(account_entry.name) + "'");
|
||||
insert_values.push_back("'" + EscapeString(account_entry.charname) + "'");
|
||||
insert_values.push_back(std::to_string(account_entry.sharedplat));
|
||||
insert_values.push_back("'" + EscapeString(account_entry.password) + "'");
|
||||
insert_values.push_back(std::to_string(account_entry.status));
|
||||
insert_values.push_back("'" + EscapeString(account_entry.ls_id) + "'");
|
||||
insert_values.push_back(std::to_string(account_entry.lsaccount_id));
|
||||
insert_values.push_back(std::to_string(account_entry.gmspeed));
|
||||
insert_values.push_back(std::to_string(account_entry.revoked));
|
||||
insert_values.push_back(std::to_string(account_entry.karma));
|
||||
insert_values.push_back("'" + EscapeString(account_entry.minilogin_ip) + "'");
|
||||
insert_values.push_back(std::to_string(account_entry.hideme));
|
||||
insert_values.push_back(std::to_string(account_entry.rulesflag));
|
||||
insert_values.push_back("'" + EscapeString(account_entry.suspendeduntil) + "'");
|
||||
insert_values.push_back(std::to_string(account_entry.time_creation));
|
||||
insert_values.push_back(std::to_string(account_entry.expansion));
|
||||
insert_values.push_back("'" + EscapeString(account_entry.ban_reason) + "'");
|
||||
insert_values.push_back("'" + EscapeString(account_entry.suspend_reason) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
implode(",", insert_values)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
account_entry.id = results.LastInsertedID();
|
||||
return account_entry;
|
||||
}
|
||||
|
||||
account_entry = NewEntity();
|
||||
|
||||
return account_entry;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
std::vector<Account> account_entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &account_entry: account_entries) {
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(account_entry.id));
|
||||
insert_values.push_back("'" + EscapeString(account_entry.name) + "'");
|
||||
insert_values.push_back("'" + EscapeString(account_entry.charname) + "'");
|
||||
insert_values.push_back(std::to_string(account_entry.sharedplat));
|
||||
insert_values.push_back("'" + EscapeString(account_entry.password) + "'");
|
||||
insert_values.push_back(std::to_string(account_entry.status));
|
||||
insert_values.push_back("'" + EscapeString(account_entry.ls_id) + "'");
|
||||
insert_values.push_back(std::to_string(account_entry.lsaccount_id));
|
||||
insert_values.push_back(std::to_string(account_entry.gmspeed));
|
||||
insert_values.push_back(std::to_string(account_entry.revoked));
|
||||
insert_values.push_back(std::to_string(account_entry.karma));
|
||||
insert_values.push_back("'" + EscapeString(account_entry.minilogin_ip) + "'");
|
||||
insert_values.push_back(std::to_string(account_entry.hideme));
|
||||
insert_values.push_back(std::to_string(account_entry.rulesflag));
|
||||
insert_values.push_back("'" + EscapeString(account_entry.suspendeduntil) + "'");
|
||||
insert_values.push_back(std::to_string(account_entry.time_creation));
|
||||
insert_values.push_back(std::to_string(account_entry.expansion));
|
||||
insert_values.push_back("'" + EscapeString(account_entry.ban_reason) + "'");
|
||||
insert_values.push_back("'" + EscapeString(account_entry.suspend_reason) + "'");
|
||||
|
||||
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseInsert(),
|
||||
implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static std::vector<Account> All(Database& db)
|
||||
{
|
||||
std::vector<Account> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
Account entry{};
|
||||
|
||||
entry.id = atoi(row[0]);
|
||||
entry.name = row[1] ? row[1] : "";
|
||||
entry.charname = row[2] ? row[2] : "";
|
||||
entry.sharedplat = atoi(row[3]);
|
||||
entry.password = row[4] ? row[4] : "";
|
||||
entry.status = atoi(row[5]);
|
||||
entry.ls_id = row[6] ? row[6] : "";
|
||||
entry.lsaccount_id = atoi(row[7]);
|
||||
entry.gmspeed = atoi(row[8]);
|
||||
entry.revoked = atoi(row[9]);
|
||||
entry.karma = atoi(row[10]);
|
||||
entry.minilogin_ip = row[11] ? row[11] : "";
|
||||
entry.hideme = atoi(row[12]);
|
||||
entry.rulesflag = atoi(row[13]);
|
||||
entry.suspendeduntil = row[14] ? row[14] : "";
|
||||
entry.time_creation = atoi(row[15]);
|
||||
entry.expansion = atoi(row[16]);
|
||||
entry.ban_reason = row[17] ? row[17] : "";
|
||||
entry.suspend_reason = row[18] ? row[18] : "";
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<Account> GetWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
std::vector<Account> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {}",
|
||||
BaseSelect(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
Account entry{};
|
||||
|
||||
entry.id = atoi(row[0]);
|
||||
entry.name = row[1] ? row[1] : "";
|
||||
entry.charname = row[2] ? row[2] : "";
|
||||
entry.sharedplat = atoi(row[3]);
|
||||
entry.password = row[4] ? row[4] : "";
|
||||
entry.status = atoi(row[5]);
|
||||
entry.ls_id = row[6] ? row[6] : "";
|
||||
entry.lsaccount_id = atoi(row[7]);
|
||||
entry.gmspeed = atoi(row[8]);
|
||||
entry.revoked = atoi(row[9]);
|
||||
entry.karma = atoi(row[10]);
|
||||
entry.minilogin_ip = row[11] ? row[11] : "";
|
||||
entry.hideme = atoi(row[12]);
|
||||
entry.rulesflag = atoi(row[13]);
|
||||
entry.suspendeduntil = row[14] ? row[14] : "";
|
||||
entry.time_creation = atoi(row[15]);
|
||||
entry.expansion = atoi(row[16]);
|
||||
entry.ban_reason = row[17] ? row[17] : "";
|
||||
entry.suspend_reason = row[18] ? row[18] : "";
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static int DeleteWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {}",
|
||||
TableName(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int Truncate(Database& db)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"TRUNCATE TABLE {}",
|
||||
TableName()
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_ACCOUNT_REPOSITORY_H
|
||||
@@ -0,0 +1,302 @@
|
||||
/**
|
||||
* DO NOT MODIFY THIS FILE
|
||||
*
|
||||
* This repository was automatically generated and is NOT to be modified directly.
|
||||
* Any repository modifications are meant to be made to the repository extending the base.
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_ACCOUNT_REWARDS_REPOSITORY_H
|
||||
#define EQEMU_BASE_ACCOUNT_REWARDS_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../string_util.h"
|
||||
|
||||
class BaseAccountRewardsRepository {
|
||||
public:
|
||||
struct AccountRewards {
|
||||
int account_id;
|
||||
int reward_id;
|
||||
int amount;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("account_id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"account_id",
|
||||
"reward_id",
|
||||
"amount",
|
||||
};
|
||||
}
|
||||
|
||||
static std::string ColumnsRaw()
|
||||
{
|
||||
return std::string(implode(", ", Columns()));
|
||||
}
|
||||
|
||||
static std::string TableName()
|
||||
{
|
||||
return std::string("account_rewards");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
ColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static AccountRewards NewEntity()
|
||||
{
|
||||
AccountRewards entry{};
|
||||
|
||||
entry.account_id = 0;
|
||||
entry.reward_id = 0;
|
||||
entry.amount = 0;
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
static AccountRewards GetAccountRewardsEntry(
|
||||
const std::vector<AccountRewards> &account_rewardss,
|
||||
int account_rewards_id
|
||||
)
|
||||
{
|
||||
for (auto &account_rewards : account_rewardss) {
|
||||
if (account_rewards.account_id == account_rewards_id) {
|
||||
return account_rewards;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static AccountRewards FindOne(
|
||||
Database& db,
|
||||
int account_rewards_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
account_rewards_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
AccountRewards entry{};
|
||||
|
||||
entry.account_id = atoi(row[0]);
|
||||
entry.reward_id = atoi(row[1]);
|
||||
entry.amount = atoi(row[2]);
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int account_rewards_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
account_rewards_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
AccountRewards account_rewards_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> update_values;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
update_values.push_back(columns[0] + " = " + std::to_string(account_rewards_entry.account_id));
|
||||
update_values.push_back(columns[1] + " = " + std::to_string(account_rewards_entry.reward_id));
|
||||
update_values.push_back(columns[2] + " = " + std::to_string(account_rewards_entry.amount));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
implode(", ", update_values),
|
||||
PrimaryKey(),
|
||||
account_rewards_entry.account_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static AccountRewards InsertOne(
|
||||
Database& db,
|
||||
AccountRewards account_rewards_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(account_rewards_entry.account_id));
|
||||
insert_values.push_back(std::to_string(account_rewards_entry.reward_id));
|
||||
insert_values.push_back(std::to_string(account_rewards_entry.amount));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
implode(",", insert_values)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
account_rewards_entry.account_id = results.LastInsertedID();
|
||||
return account_rewards_entry;
|
||||
}
|
||||
|
||||
account_rewards_entry = NewEntity();
|
||||
|
||||
return account_rewards_entry;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
std::vector<AccountRewards> account_rewards_entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &account_rewards_entry: account_rewards_entries) {
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(account_rewards_entry.account_id));
|
||||
insert_values.push_back(std::to_string(account_rewards_entry.reward_id));
|
||||
insert_values.push_back(std::to_string(account_rewards_entry.amount));
|
||||
|
||||
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseInsert(),
|
||||
implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static std::vector<AccountRewards> All(Database& db)
|
||||
{
|
||||
std::vector<AccountRewards> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AccountRewards entry{};
|
||||
|
||||
entry.account_id = atoi(row[0]);
|
||||
entry.reward_id = atoi(row[1]);
|
||||
entry.amount = atoi(row[2]);
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<AccountRewards> GetWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
std::vector<AccountRewards> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {}",
|
||||
BaseSelect(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AccountRewards entry{};
|
||||
|
||||
entry.account_id = atoi(row[0]);
|
||||
entry.reward_id = atoi(row[1]);
|
||||
entry.amount = atoi(row[2]);
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static int DeleteWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {}",
|
||||
TableName(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int Truncate(Database& db)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"TRUNCATE TABLE {}",
|
||||
TableName()
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_ACCOUNT_REWARDS_REPOSITORY_H
|
||||
@@ -0,0 +1,355 @@
|
||||
/**
|
||||
* DO NOT MODIFY THIS FILE
|
||||
*
|
||||
* This repository was automatically generated and is NOT to be modified directly.
|
||||
* Any repository modifications are meant to be made to the repository extending the base.
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_ADVENTURE_DETAILS_REPOSITORY_H
|
||||
#define EQEMU_BASE_ADVENTURE_DETAILS_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../string_util.h"
|
||||
|
||||
class BaseAdventureDetailsRepository {
|
||||
public:
|
||||
struct AdventureDetails {
|
||||
int id;
|
||||
int adventure_id;
|
||||
int instance_id;
|
||||
int count;
|
||||
int assassinate_count;
|
||||
int status;
|
||||
int time_created;
|
||||
int time_zoned;
|
||||
int time_completed;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"id",
|
||||
"adventure_id",
|
||||
"instance_id",
|
||||
"count",
|
||||
"assassinate_count",
|
||||
"status",
|
||||
"time_created",
|
||||
"time_zoned",
|
||||
"time_completed",
|
||||
};
|
||||
}
|
||||
|
||||
static std::string ColumnsRaw()
|
||||
{
|
||||
return std::string(implode(", ", Columns()));
|
||||
}
|
||||
|
||||
static std::string TableName()
|
||||
{
|
||||
return std::string("adventure_details");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
ColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static AdventureDetails NewEntity()
|
||||
{
|
||||
AdventureDetails entry{};
|
||||
|
||||
entry.id = 0;
|
||||
entry.adventure_id = 0;
|
||||
entry.instance_id = -1;
|
||||
entry.count = 0;
|
||||
entry.assassinate_count = 0;
|
||||
entry.status = 0;
|
||||
entry.time_created = 0;
|
||||
entry.time_zoned = 0;
|
||||
entry.time_completed = 0;
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
static AdventureDetails GetAdventureDetailsEntry(
|
||||
const std::vector<AdventureDetails> &adventure_detailss,
|
||||
int adventure_details_id
|
||||
)
|
||||
{
|
||||
for (auto &adventure_details : adventure_detailss) {
|
||||
if (adventure_details.id == adventure_details_id) {
|
||||
return adventure_details;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static AdventureDetails FindOne(
|
||||
Database& db,
|
||||
int adventure_details_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
adventure_details_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
AdventureDetails entry{};
|
||||
|
||||
entry.id = atoi(row[0]);
|
||||
entry.adventure_id = atoi(row[1]);
|
||||
entry.instance_id = atoi(row[2]);
|
||||
entry.count = atoi(row[3]);
|
||||
entry.assassinate_count = atoi(row[4]);
|
||||
entry.status = atoi(row[5]);
|
||||
entry.time_created = atoi(row[6]);
|
||||
entry.time_zoned = atoi(row[7]);
|
||||
entry.time_completed = atoi(row[8]);
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int adventure_details_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
adventure_details_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
AdventureDetails adventure_details_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> update_values;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
update_values.push_back(columns[1] + " = " + std::to_string(adventure_details_entry.adventure_id));
|
||||
update_values.push_back(columns[2] + " = " + std::to_string(adventure_details_entry.instance_id));
|
||||
update_values.push_back(columns[3] + " = " + std::to_string(adventure_details_entry.count));
|
||||
update_values.push_back(columns[4] + " = " + std::to_string(adventure_details_entry.assassinate_count));
|
||||
update_values.push_back(columns[5] + " = " + std::to_string(adventure_details_entry.status));
|
||||
update_values.push_back(columns[6] + " = " + std::to_string(adventure_details_entry.time_created));
|
||||
update_values.push_back(columns[7] + " = " + std::to_string(adventure_details_entry.time_zoned));
|
||||
update_values.push_back(columns[8] + " = " + std::to_string(adventure_details_entry.time_completed));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
implode(", ", update_values),
|
||||
PrimaryKey(),
|
||||
adventure_details_entry.id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static AdventureDetails InsertOne(
|
||||
Database& db,
|
||||
AdventureDetails adventure_details_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(adventure_details_entry.id));
|
||||
insert_values.push_back(std::to_string(adventure_details_entry.adventure_id));
|
||||
insert_values.push_back(std::to_string(adventure_details_entry.instance_id));
|
||||
insert_values.push_back(std::to_string(adventure_details_entry.count));
|
||||
insert_values.push_back(std::to_string(adventure_details_entry.assassinate_count));
|
||||
insert_values.push_back(std::to_string(adventure_details_entry.status));
|
||||
insert_values.push_back(std::to_string(adventure_details_entry.time_created));
|
||||
insert_values.push_back(std::to_string(adventure_details_entry.time_zoned));
|
||||
insert_values.push_back(std::to_string(adventure_details_entry.time_completed));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
implode(",", insert_values)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
adventure_details_entry.id = results.LastInsertedID();
|
||||
return adventure_details_entry;
|
||||
}
|
||||
|
||||
adventure_details_entry = NewEntity();
|
||||
|
||||
return adventure_details_entry;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
std::vector<AdventureDetails> adventure_details_entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &adventure_details_entry: adventure_details_entries) {
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(adventure_details_entry.id));
|
||||
insert_values.push_back(std::to_string(adventure_details_entry.adventure_id));
|
||||
insert_values.push_back(std::to_string(adventure_details_entry.instance_id));
|
||||
insert_values.push_back(std::to_string(adventure_details_entry.count));
|
||||
insert_values.push_back(std::to_string(adventure_details_entry.assassinate_count));
|
||||
insert_values.push_back(std::to_string(adventure_details_entry.status));
|
||||
insert_values.push_back(std::to_string(adventure_details_entry.time_created));
|
||||
insert_values.push_back(std::to_string(adventure_details_entry.time_zoned));
|
||||
insert_values.push_back(std::to_string(adventure_details_entry.time_completed));
|
||||
|
||||
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseInsert(),
|
||||
implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static std::vector<AdventureDetails> All(Database& db)
|
||||
{
|
||||
std::vector<AdventureDetails> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AdventureDetails entry{};
|
||||
|
||||
entry.id = atoi(row[0]);
|
||||
entry.adventure_id = atoi(row[1]);
|
||||
entry.instance_id = atoi(row[2]);
|
||||
entry.count = atoi(row[3]);
|
||||
entry.assassinate_count = atoi(row[4]);
|
||||
entry.status = atoi(row[5]);
|
||||
entry.time_created = atoi(row[6]);
|
||||
entry.time_zoned = atoi(row[7]);
|
||||
entry.time_completed = atoi(row[8]);
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<AdventureDetails> GetWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
std::vector<AdventureDetails> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {}",
|
||||
BaseSelect(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AdventureDetails entry{};
|
||||
|
||||
entry.id = atoi(row[0]);
|
||||
entry.adventure_id = atoi(row[1]);
|
||||
entry.instance_id = atoi(row[2]);
|
||||
entry.count = atoi(row[3]);
|
||||
entry.assassinate_count = atoi(row[4]);
|
||||
entry.status = atoi(row[5]);
|
||||
entry.time_created = atoi(row[6]);
|
||||
entry.time_zoned = atoi(row[7]);
|
||||
entry.time_completed = atoi(row[8]);
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static int DeleteWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {}",
|
||||
TableName(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int Truncate(Database& db)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"TRUNCATE TABLE {}",
|
||||
TableName()
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_ADVENTURE_DETAILS_REPOSITORY_H
|
||||
@@ -0,0 +1,293 @@
|
||||
/**
|
||||
* DO NOT MODIFY THIS FILE
|
||||
*
|
||||
* This repository was automatically generated and is NOT to be modified directly.
|
||||
* Any repository modifications are meant to be made to the repository extending the base.
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_ADVENTURE_MEMBERS_REPOSITORY_H
|
||||
#define EQEMU_BASE_ADVENTURE_MEMBERS_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../string_util.h"
|
||||
|
||||
class BaseAdventureMembersRepository {
|
||||
public:
|
||||
struct AdventureMembers {
|
||||
int id;
|
||||
int charid;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("charid");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"id",
|
||||
"charid",
|
||||
};
|
||||
}
|
||||
|
||||
static std::string ColumnsRaw()
|
||||
{
|
||||
return std::string(implode(", ", Columns()));
|
||||
}
|
||||
|
||||
static std::string TableName()
|
||||
{
|
||||
return std::string("adventure_members");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
ColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static AdventureMembers NewEntity()
|
||||
{
|
||||
AdventureMembers entry{};
|
||||
|
||||
entry.id = 0;
|
||||
entry.charid = 0;
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
static AdventureMembers GetAdventureMembersEntry(
|
||||
const std::vector<AdventureMembers> &adventure_memberss,
|
||||
int adventure_members_id
|
||||
)
|
||||
{
|
||||
for (auto &adventure_members : adventure_memberss) {
|
||||
if (adventure_members.charid == adventure_members_id) {
|
||||
return adventure_members;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static AdventureMembers FindOne(
|
||||
Database& db,
|
||||
int adventure_members_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
adventure_members_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
AdventureMembers entry{};
|
||||
|
||||
entry.id = atoi(row[0]);
|
||||
entry.charid = atoi(row[1]);
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int adventure_members_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
adventure_members_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
AdventureMembers adventure_members_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> update_values;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
update_values.push_back(columns[0] + " = " + std::to_string(adventure_members_entry.id));
|
||||
update_values.push_back(columns[1] + " = " + std::to_string(adventure_members_entry.charid));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
implode(", ", update_values),
|
||||
PrimaryKey(),
|
||||
adventure_members_entry.charid
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static AdventureMembers InsertOne(
|
||||
Database& db,
|
||||
AdventureMembers adventure_members_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(adventure_members_entry.id));
|
||||
insert_values.push_back(std::to_string(adventure_members_entry.charid));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
implode(",", insert_values)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
adventure_members_entry.charid = results.LastInsertedID();
|
||||
return adventure_members_entry;
|
||||
}
|
||||
|
||||
adventure_members_entry = NewEntity();
|
||||
|
||||
return adventure_members_entry;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
std::vector<AdventureMembers> adventure_members_entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &adventure_members_entry: adventure_members_entries) {
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(adventure_members_entry.id));
|
||||
insert_values.push_back(std::to_string(adventure_members_entry.charid));
|
||||
|
||||
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseInsert(),
|
||||
implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static std::vector<AdventureMembers> All(Database& db)
|
||||
{
|
||||
std::vector<AdventureMembers> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AdventureMembers entry{};
|
||||
|
||||
entry.id = atoi(row[0]);
|
||||
entry.charid = atoi(row[1]);
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<AdventureMembers> GetWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
std::vector<AdventureMembers> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {}",
|
||||
BaseSelect(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AdventureMembers entry{};
|
||||
|
||||
entry.id = atoi(row[0]);
|
||||
entry.charid = atoi(row[1]);
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static int DeleteWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {}",
|
||||
TableName(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int Truncate(Database& db)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"TRUNCATE TABLE {}",
|
||||
TableName()
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_ADVENTURE_MEMBERS_REPOSITORY_H
|
||||
@@ -0,0 +1,374 @@
|
||||
/**
|
||||
* DO NOT MODIFY THIS FILE
|
||||
*
|
||||
* This repository was automatically generated and is NOT to be modified directly.
|
||||
* Any repository modifications are meant to be made to the repository extending the base.
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_ADVENTURE_STATS_REPOSITORY_H
|
||||
#define EQEMU_BASE_ADVENTURE_STATS_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../string_util.h"
|
||||
|
||||
class BaseAdventureStatsRepository {
|
||||
public:
|
||||
struct AdventureStats {
|
||||
int player_id;
|
||||
int guk_wins;
|
||||
int mir_wins;
|
||||
int mmc_wins;
|
||||
int ruj_wins;
|
||||
int tak_wins;
|
||||
int guk_losses;
|
||||
int mir_losses;
|
||||
int mmc_losses;
|
||||
int ruj_losses;
|
||||
int tak_losses;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("player_id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"player_id",
|
||||
"guk_wins",
|
||||
"mir_wins",
|
||||
"mmc_wins",
|
||||
"ruj_wins",
|
||||
"tak_wins",
|
||||
"guk_losses",
|
||||
"mir_losses",
|
||||
"mmc_losses",
|
||||
"ruj_losses",
|
||||
"tak_losses",
|
||||
};
|
||||
}
|
||||
|
||||
static std::string ColumnsRaw()
|
||||
{
|
||||
return std::string(implode(", ", Columns()));
|
||||
}
|
||||
|
||||
static std::string TableName()
|
||||
{
|
||||
return std::string("adventure_stats");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
ColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static AdventureStats NewEntity()
|
||||
{
|
||||
AdventureStats entry{};
|
||||
|
||||
entry.player_id = 0;
|
||||
entry.guk_wins = 0;
|
||||
entry.mir_wins = 0;
|
||||
entry.mmc_wins = 0;
|
||||
entry.ruj_wins = 0;
|
||||
entry.tak_wins = 0;
|
||||
entry.guk_losses = 0;
|
||||
entry.mir_losses = 0;
|
||||
entry.mmc_losses = 0;
|
||||
entry.ruj_losses = 0;
|
||||
entry.tak_losses = 0;
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
static AdventureStats GetAdventureStatsEntry(
|
||||
const std::vector<AdventureStats> &adventure_statss,
|
||||
int adventure_stats_id
|
||||
)
|
||||
{
|
||||
for (auto &adventure_stats : adventure_statss) {
|
||||
if (adventure_stats.player_id == adventure_stats_id) {
|
||||
return adventure_stats;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static AdventureStats FindOne(
|
||||
Database& db,
|
||||
int adventure_stats_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
adventure_stats_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
AdventureStats entry{};
|
||||
|
||||
entry.player_id = atoi(row[0]);
|
||||
entry.guk_wins = atoi(row[1]);
|
||||
entry.mir_wins = atoi(row[2]);
|
||||
entry.mmc_wins = atoi(row[3]);
|
||||
entry.ruj_wins = atoi(row[4]);
|
||||
entry.tak_wins = atoi(row[5]);
|
||||
entry.guk_losses = atoi(row[6]);
|
||||
entry.mir_losses = atoi(row[7]);
|
||||
entry.mmc_losses = atoi(row[8]);
|
||||
entry.ruj_losses = atoi(row[9]);
|
||||
entry.tak_losses = atoi(row[10]);
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int adventure_stats_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
adventure_stats_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
AdventureStats adventure_stats_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> update_values;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
update_values.push_back(columns[0] + " = " + std::to_string(adventure_stats_entry.player_id));
|
||||
update_values.push_back(columns[1] + " = " + std::to_string(adventure_stats_entry.guk_wins));
|
||||
update_values.push_back(columns[2] + " = " + std::to_string(adventure_stats_entry.mir_wins));
|
||||
update_values.push_back(columns[3] + " = " + std::to_string(adventure_stats_entry.mmc_wins));
|
||||
update_values.push_back(columns[4] + " = " + std::to_string(adventure_stats_entry.ruj_wins));
|
||||
update_values.push_back(columns[5] + " = " + std::to_string(adventure_stats_entry.tak_wins));
|
||||
update_values.push_back(columns[6] + " = " + std::to_string(adventure_stats_entry.guk_losses));
|
||||
update_values.push_back(columns[7] + " = " + std::to_string(adventure_stats_entry.mir_losses));
|
||||
update_values.push_back(columns[8] + " = " + std::to_string(adventure_stats_entry.mmc_losses));
|
||||
update_values.push_back(columns[9] + " = " + std::to_string(adventure_stats_entry.ruj_losses));
|
||||
update_values.push_back(columns[10] + " = " + std::to_string(adventure_stats_entry.tak_losses));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
implode(", ", update_values),
|
||||
PrimaryKey(),
|
||||
adventure_stats_entry.player_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static AdventureStats InsertOne(
|
||||
Database& db,
|
||||
AdventureStats adventure_stats_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(adventure_stats_entry.player_id));
|
||||
insert_values.push_back(std::to_string(adventure_stats_entry.guk_wins));
|
||||
insert_values.push_back(std::to_string(adventure_stats_entry.mir_wins));
|
||||
insert_values.push_back(std::to_string(adventure_stats_entry.mmc_wins));
|
||||
insert_values.push_back(std::to_string(adventure_stats_entry.ruj_wins));
|
||||
insert_values.push_back(std::to_string(adventure_stats_entry.tak_wins));
|
||||
insert_values.push_back(std::to_string(adventure_stats_entry.guk_losses));
|
||||
insert_values.push_back(std::to_string(adventure_stats_entry.mir_losses));
|
||||
insert_values.push_back(std::to_string(adventure_stats_entry.mmc_losses));
|
||||
insert_values.push_back(std::to_string(adventure_stats_entry.ruj_losses));
|
||||
insert_values.push_back(std::to_string(adventure_stats_entry.tak_losses));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
implode(",", insert_values)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
adventure_stats_entry.player_id = results.LastInsertedID();
|
||||
return adventure_stats_entry;
|
||||
}
|
||||
|
||||
adventure_stats_entry = NewEntity();
|
||||
|
||||
return adventure_stats_entry;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
std::vector<AdventureStats> adventure_stats_entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &adventure_stats_entry: adventure_stats_entries) {
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(adventure_stats_entry.player_id));
|
||||
insert_values.push_back(std::to_string(adventure_stats_entry.guk_wins));
|
||||
insert_values.push_back(std::to_string(adventure_stats_entry.mir_wins));
|
||||
insert_values.push_back(std::to_string(adventure_stats_entry.mmc_wins));
|
||||
insert_values.push_back(std::to_string(adventure_stats_entry.ruj_wins));
|
||||
insert_values.push_back(std::to_string(adventure_stats_entry.tak_wins));
|
||||
insert_values.push_back(std::to_string(adventure_stats_entry.guk_losses));
|
||||
insert_values.push_back(std::to_string(adventure_stats_entry.mir_losses));
|
||||
insert_values.push_back(std::to_string(adventure_stats_entry.mmc_losses));
|
||||
insert_values.push_back(std::to_string(adventure_stats_entry.ruj_losses));
|
||||
insert_values.push_back(std::to_string(adventure_stats_entry.tak_losses));
|
||||
|
||||
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseInsert(),
|
||||
implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static std::vector<AdventureStats> All(Database& db)
|
||||
{
|
||||
std::vector<AdventureStats> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AdventureStats entry{};
|
||||
|
||||
entry.player_id = atoi(row[0]);
|
||||
entry.guk_wins = atoi(row[1]);
|
||||
entry.mir_wins = atoi(row[2]);
|
||||
entry.mmc_wins = atoi(row[3]);
|
||||
entry.ruj_wins = atoi(row[4]);
|
||||
entry.tak_wins = atoi(row[5]);
|
||||
entry.guk_losses = atoi(row[6]);
|
||||
entry.mir_losses = atoi(row[7]);
|
||||
entry.mmc_losses = atoi(row[8]);
|
||||
entry.ruj_losses = atoi(row[9]);
|
||||
entry.tak_losses = atoi(row[10]);
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<AdventureStats> GetWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
std::vector<AdventureStats> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {}",
|
||||
BaseSelect(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AdventureStats entry{};
|
||||
|
||||
entry.player_id = atoi(row[0]);
|
||||
entry.guk_wins = atoi(row[1]);
|
||||
entry.mir_wins = atoi(row[2]);
|
||||
entry.mmc_wins = atoi(row[3]);
|
||||
entry.ruj_wins = atoi(row[4]);
|
||||
entry.tak_wins = atoi(row[5]);
|
||||
entry.guk_losses = atoi(row[6]);
|
||||
entry.mir_losses = atoi(row[7]);
|
||||
entry.mmc_losses = atoi(row[8]);
|
||||
entry.ruj_losses = atoi(row[9]);
|
||||
entry.tak_losses = atoi(row[10]);
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static int DeleteWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {}",
|
||||
TableName(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int Truncate(Database& db)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"TRUNCATE TABLE {}",
|
||||
TableName()
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_ADVENTURE_STATS_REPOSITORY_H
|
||||
@@ -0,0 +1,293 @@
|
||||
/**
|
||||
* DO NOT MODIFY THIS FILE
|
||||
*
|
||||
* This repository was automatically generated and is NOT to be modified directly.
|
||||
* Any repository modifications are meant to be made to the repository extending the base.
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_ADVENTURE_TEMPLATE_ENTRY_FLAVOR_REPOSITORY_H
|
||||
#define EQEMU_BASE_ADVENTURE_TEMPLATE_ENTRY_FLAVOR_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../string_util.h"
|
||||
|
||||
class BaseAdventureTemplateEntryFlavorRepository {
|
||||
public:
|
||||
struct AdventureTemplateEntryFlavor {
|
||||
int id;
|
||||
std::string text;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"id",
|
||||
"text",
|
||||
};
|
||||
}
|
||||
|
||||
static std::string ColumnsRaw()
|
||||
{
|
||||
return std::string(implode(", ", Columns()));
|
||||
}
|
||||
|
||||
static std::string TableName()
|
||||
{
|
||||
return std::string("adventure_template_entry_flavor");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
ColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static AdventureTemplateEntryFlavor NewEntity()
|
||||
{
|
||||
AdventureTemplateEntryFlavor entry{};
|
||||
|
||||
entry.id = 0;
|
||||
entry.text = "";
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
static AdventureTemplateEntryFlavor GetAdventureTemplateEntryFlavorEntry(
|
||||
const std::vector<AdventureTemplateEntryFlavor> &adventure_template_entry_flavors,
|
||||
int adventure_template_entry_flavor_id
|
||||
)
|
||||
{
|
||||
for (auto &adventure_template_entry_flavor : adventure_template_entry_flavors) {
|
||||
if (adventure_template_entry_flavor.id == adventure_template_entry_flavor_id) {
|
||||
return adventure_template_entry_flavor;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static AdventureTemplateEntryFlavor FindOne(
|
||||
Database& db,
|
||||
int adventure_template_entry_flavor_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
adventure_template_entry_flavor_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
AdventureTemplateEntryFlavor entry{};
|
||||
|
||||
entry.id = atoi(row[0]);
|
||||
entry.text = row[1] ? row[1] : "";
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int adventure_template_entry_flavor_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
adventure_template_entry_flavor_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
AdventureTemplateEntryFlavor adventure_template_entry_flavor_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> update_values;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
update_values.push_back(columns[0] + " = " + std::to_string(adventure_template_entry_flavor_entry.id));
|
||||
update_values.push_back(columns[1] + " = '" + EscapeString(adventure_template_entry_flavor_entry.text) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
implode(", ", update_values),
|
||||
PrimaryKey(),
|
||||
adventure_template_entry_flavor_entry.id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static AdventureTemplateEntryFlavor InsertOne(
|
||||
Database& db,
|
||||
AdventureTemplateEntryFlavor adventure_template_entry_flavor_entry
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(adventure_template_entry_flavor_entry.id));
|
||||
insert_values.push_back("'" + EscapeString(adventure_template_entry_flavor_entry.text) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
implode(",", insert_values)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
adventure_template_entry_flavor_entry.id = results.LastInsertedID();
|
||||
return adventure_template_entry_flavor_entry;
|
||||
}
|
||||
|
||||
adventure_template_entry_flavor_entry = NewEntity();
|
||||
|
||||
return adventure_template_entry_flavor_entry;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
std::vector<AdventureTemplateEntryFlavor> adventure_template_entry_flavor_entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &adventure_template_entry_flavor_entry: adventure_template_entry_flavor_entries) {
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
insert_values.push_back(std::to_string(adventure_template_entry_flavor_entry.id));
|
||||
insert_values.push_back("'" + EscapeString(adventure_template_entry_flavor_entry.text) + "'");
|
||||
|
||||
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> insert_values;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseInsert(),
|
||||
implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static std::vector<AdventureTemplateEntryFlavor> All(Database& db)
|
||||
{
|
||||
std::vector<AdventureTemplateEntryFlavor> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AdventureTemplateEntryFlavor entry{};
|
||||
|
||||
entry.id = atoi(row[0]);
|
||||
entry.text = row[1] ? row[1] : "";
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<AdventureTemplateEntryFlavor> GetWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
std::vector<AdventureTemplateEntryFlavor> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {}",
|
||||
BaseSelect(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AdventureTemplateEntryFlavor entry{};
|
||||
|
||||
entry.id = atoi(row[0]);
|
||||
entry.text = row[1] ? row[1] : "";
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static int DeleteWhere(Database& db, std::string where_filter)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {}",
|
||||
TableName(),
|
||||
where_filter
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int Truncate(Database& db)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"TRUNCATE TABLE {}",
|
||||
TableName()
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_ADVENTURE_TEMPLATE_ENTRY_FLAVOR_REPOSITORY_H
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user